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 |
---|---|---|---|---|---|---|
Create a new Spanner client object. | def initialize
# These require statements are intentionally placed here to initialize
# the gRPC module only when it's required.
# See https://github.com/googleapis/toolkit/issues/446
require "gapic/grpc"
require "google/spanner/v1/spanner_services_pb"
# Create the configuration object
@config = Configuration.new Client.configure
# Yield the configuration if needed
yield @config if block_given?
# Create credentials
credentials = @config.credentials
# Use self-signed JWT if the endpoint is unchanged from default,
# but only if the default endpoint does not have a region prefix.
enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
[email protected](".").first.include?("-")
credentials ||= Credentials.default scope: @config.scope,
enable_self_signed_jwt: enable_self_signed_jwt
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
credentials = Credentials.new credentials, scope: @config.scope
end
@quota_project_id = @config.quota_project
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
@spanner_stub = ::Gapic::ServiceStub.new(
::Google::Cloud::Spanner::V1::Spanner::Stub,
credentials: credentials,
endpoint: @config.endpoint,
channel_args: @config.channel_args,
interceptors: @config.interceptors
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @client = Client.new\n end",
"def new\n @client = Client.new\n end",
"def new\n @client = Client.new\n end",
"def new\n\t\t@client = Client.new\n\tend",
"def new_client\n Savon.client(\n wsdl: @wsdl,\n endpoint: @endpoint,\n convert_request_keys_to: :none,\n soap_version: 1,\n pretty_print_xml: true,\n filters: [:password],\n logger: @soap_logger,\n log_level: @soap_log_level,\n log: @soap_log\n )\n end",
"def client\n # @client ||= MyService::Client.new(SinaToken.consumer.key, SinaToken.consumer.secret, token, secret)\n end",
"def new_i3s_client(options = {})\n OneviewSDK::ImageStreamer::Client.new(options.merge(token: @token))\n end",
"def client\n puts \"creating client\"\n @client ||= Vineyard::Client.new(options) #unless defined?(@client) && @client.hash == options.hash\n @client\n end",
"def initialize(opts = {})\n @opts = opts\n @opts[:type] ||= :block\n @opts[:timeout] ||= 10\n\n sanitize_opts!\n create_client\n end",
"def client\n @client ||= Client.new(config[:credentials], config[:end_point])\n end",
"def new_client(credentials)\n safely do\n return SBCClient.new(credentials.user, credentials.password)\n end\n end",
"def initialize(**options)\n @config = Configuration.new(**options)\n @client = Client.new(config)\n end",
"def initialize\n # Note: Suds logging is disabled\n @soap_client = Suds.client(endpoint: ENDPOINT, namespace: NAMESPACE,\n soap_version: 1, wsdl: WSDL, log: false)\n end",
"def aws_pinpoint_client\n return @aws_pinpoint_client if @aws_pinpoint_client\n\n @aws_pinpoint_client = Aws::Pinpoint::Client.new(region: self.class.sms_aws_region)\n end",
"def client\n @client ||= Client.new(configuration)\n end",
"def initialize(options = {})\n @services = { }\n\n settings = Config.client_settings(options)\n\n # pick up the username from the options, the global, or assume no username\n @username = settings[:username]\n\n # do a similar thing for the api key\n @api_key = settings[:api_key]\n\n # grab token pair\n @userId = settings[:userId]\n @authToken = settings[:authToken]\n\n # and the endpoint url\n @endpoint_url = settings[:endpoint_url] || API_PUBLIC_ENDPOINT\n\n # set the user agent to the one provided, or set it to a default one\n @user_agent = settings[:user_agent] || \"softlayer_api gem/#{SoftLayer::VERSION} (Ruby #{RUBY_PLATFORM}/#{RUBY_VERSION})\"\n\n # and assign a time out if the settings offer one\n @network_timeout = settings[:timeout] if settings.has_key?(:timeout)\n\n raise \"A SoftLayer Client requires an endpoint URL\" if !@endpoint_url || @endpoint_url.empty?\n end",
"def new\n build_client\n end",
"def initialize_client\n @client = HelpScoutDocs::Client.new(@options) unless defined?(@client) && @client.hash == @options.hash\n @client\n end",
"def create_savon_client(endpoint, namespace)\n client = Savon::Client.new do |wsdl, httpi|\n wsdl.endpoint = endpoint\n wsdl.namespace = namespace\n AdsCommon::Http.configure_httpi(@api.config, httpi)\n end\n return client\n end",
"def srch_client\n\t\t\t\t@@client ||= Srchio::Client.new(:searcher_id => srch_config[:searcher_id])\n\t\t\tend",
"def client\n @client ||= Savon::Client.new do\n wsdl.endpoint = Kraut.endpoint\n wsdl.namespace = \"urn:SecurityServer\"\n end\n end",
"def initialize(*args)\n @client ||= Betaface::REST::Client.new(*args) \n end",
"def get_client\n\t\t# create client object with app credentials\n\t\t@client = Soundcloud.new(:client_id => ENV['SC_CLIENT_ID'],\n :client_secret => ENV['SC_CLIENT_SECRET'],\n :redirect_uri => 'http://localhost:3000/soundcloud')\n\tend",
"def client \n @client ||= Savon::Client.new do\n wsdl.document = self.endpoint\n end\n end",
"def new(&block)\n Builder.new(&block).to_client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize options = {}\n @config = options[:config]\n @config ||= AWS.config\n @config = @config.with(options)\n @client = config.send(Inflection.ruby_name(self.class.to_s) + '_client')\n end",
"def client\n @client ||= NPS::Client.new\n end",
"def create_client\n @client = if @opts[:servers]\n Monga::Clients::ReplicaSetClient.new(@opts)\n else\n Monga::Clients::SingleInstanceClient.new(@opts)\n end\n end",
"def new_client(id, env, private_key, secret)\n app_config = AppConfig.new(\n id: id,\n env: env,\n private_key: private_key,\n secret: secret\n )\n\n Client.new(config: app_config)\n end",
"def initialize(client_id:, client_secret:, access_token: nil, transport: Faraday)\n @client_id = client_id.to_s\n @client_secret = client_secret.to_s\n @access_token = access_token.to_s\n @transport = transport\n end",
"def initialize(**options)\n @api_client = PayPoint::Blue::API.new(**options)\n super\n end",
"def initialize(client)\n\t\tself.client = client\n\tend",
"def initialize(client)\n\t\tself.client = client\n\tend",
"def client\n @client ||= Client.new\n end",
"def initialize\n @client = Savon.client(wsdl: Twinfield::WSDLS[:session])\n end",
"def client(options)\n Service::Client.new(\n :username => options[:username],\n :password => options[:password],\n :url => options[:server],\n :user_agent => USER_AGENT\n )\n end",
"def new\n @client = Client.new\n respond_with(@client)\n end",
"def client\n return @client if @client\n\n unless session = cached_session\n Logger.info \"Creating a new Baidu session!\"\n session = create_session!\n end\n\n @client = Baidu::PCS::Client.new(session, dir_name)\n rescue => err\n raise Error.wrap(err, 'Authorization Failed.')\n end",
"def initialize(client)\n\t self.client=client\n end",
"def initialize(options = {})\n options = DEFAULT_ARGS.merge(options)\n\n @client = Faraday.new(\n faraday_options(options),\n ) do |conn|\n conn.response(:json)\n conn.adapter(Faraday.default_adapter)\n end\n end",
"def new_client(credentials)\n #Fog constructor expecting credentials[:terremark_password] and credentials[:terremark_username]\n terremark_credentials = {:terremark_vcloud_username => \"#{credentials.user}\", :terremark_vcloud_password => \"#{credentials.password}\" }\n safely do\n terremark_client = Fog::Terremark::Vcloud.new(terremark_credentials)\n vdc_id = terremark_client.default_vdc_id\n end\n if (vdc_id.nil?)\n raise \"AuthFailure\"\n end\n terremark_client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end",
"def initialize(client)\n @client = client\n end"
]
| [
"0.6986114",
"0.6986114",
"0.6986114",
"0.67052305",
"0.6580621",
"0.6496268",
"0.6377539",
"0.6372808",
"0.6353549",
"0.62784785",
"0.61829644",
"0.6166497",
"0.6165346",
"0.61387175",
"0.61275196",
"0.6092542",
"0.607398",
"0.60600674",
"0.6059014",
"0.6048901",
"0.60480887",
"0.60320824",
"0.6029586",
"0.6000485",
"0.5998302",
"0.5992935",
"0.5977632",
"0.5971295",
"0.5965147",
"0.5943071",
"0.5922342",
"0.59213126",
"0.5894288",
"0.5894288",
"0.58919287",
"0.588955",
"0.58874714",
"0.5879672",
"0.5863645",
"0.58611494",
"0.5851904",
"0.58494246",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113",
"0.5849113"
]
| 0.62966794 | 9 |
Configurations for individual RPCs | def rpcs
@rpcs ||= begin
parent_rpcs = nil
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
Rpcs.new parent_rpcs
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rpc_configs\n @rpc_enabled = true\n @rpc_configs = OpenStruct.new(\n :address => rpc_default_path,\n :verbose => false,\n :server => OpenStruct.new(\n :preload => nil,\n :num_workers => 5\n ),\n :client => OpenStruct.new(\n :preload => nil,\n :retries => 3,\n :timeout => 50 #ms\n )\n )\n yield @rpc_configs\n @rpc_configs.freeze\n end",
"def rpcs\n @rpcs ||= begin\n parent_rpcs = nil\n parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)\n Rpcs.new parent_rpcs\n end\n end",
"def rpcs\n @rpcs ||= begin\n parent_rpcs = nil\n parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)\n Rpcs.new parent_rpcs\n end\n end",
"def rpcs\n @rpcs ||= begin\n parent_rpcs = nil\n parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)\n Rpcs.new parent_rpcs\n end\n end",
"def rpcs\n @rpcs ||= begin\n parent_rpcs = nil\n parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)\n Rpcs.new parent_rpcs\n end\n end",
"def rpcs\n @rpcs ||= begin\n parent_rpcs = nil\n parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)\n Rpcs.new parent_rpcs\n end\n end",
"def rpcs\n @rpcs ||= begin\n parent_rpcs = nil\n parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)\n Rpcs.new parent_rpcs\n end\n end",
"def rpcs\n @rpcs ||= begin\n parent_rpcs = nil\n parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)\n Rpcs.new parent_rpcs\n end\n end",
"def rpcs\n @rpcs ||= begin\n parent_rpcs = nil\n parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)\n Rpcs.new parent_rpcs\n end\n end",
"def rpcs\n @rpcs ||= begin\n parent_rpcs = nil\n parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)\n Rpcs.new parent_rpcs\n end\n end",
"def rpcs\n @rpcs ||= begin\n parent_rpcs = nil\n parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)\n Rpcs.new parent_rpcs\n end\n end",
"def rpcs\n @rpcs ||= begin\n parent_rpcs = nil\n parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)\n Rpcs.new parent_rpcs\n end\n end",
"def rpcs\n @rpcs ||= begin\n parent_rpcs = nil\n parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)\n Rpcs.new parent_rpcs\n end\n end",
"def rpcs\n @rpcs ||= begin\n parent_rpcs = nil\n parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)\n Rpcs.new parent_rpcs\n end\n end",
"def rpcs\n @rpcs ||= begin\n parent_rpcs = nil\n parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)\n Rpcs.new parent_rpcs\n end\n end",
"def rpcs\n @rpcs ||= begin\n parent_rpcs = nil\n parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)\n Rpcs.new parent_rpcs\n end\n end",
"def rpcs\n @rpcs ||= begin\n parent_rpcs = nil\n parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)\n Rpcs.new parent_rpcs\n end\n end",
"def rpcs\n @rpcs ||= begin\n parent_rpcs = nil\n parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)\n Rpcs.new parent_rpcs\n end\n end",
"def rpcs\n @rpcs ||= begin\n parent_rpcs = nil\n parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)\n Rpcs.new parent_rpcs\n end\n end",
"def rpcs\n @rpcs ||= begin\n parent_rpcs = nil\n parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)\n Rpcs.new parent_rpcs\n end\n end",
"def rpcs\n @rpcs ||= begin\n parent_rpcs = nil\n parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)\n Rpcs.new parent_rpcs\n end\n end",
"def rpcs\n @rpcs ||= begin\n parent_rpcs = nil\n parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)\n Rpcs.new parent_rpcs\n end\n end",
"def rpcs\n @rpcs ||= begin\n parent_rpcs = nil\n parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)\n Rpcs.new parent_rpcs\n end\n end",
"def get_serv_config\n\t\taction = \"configuration\"\n\t\tresponse = call_api(action)\n\tend",
"def configurations; end",
"def configuration\n cfg = {:service => @service}\n cfg[:acl] = @acl.name if (@acl)\n cfg[:avpairs] = @avpairs if (@avpairs)\n cfg[:network_av] = @network_av.configuration if (@network_av)\n cfg[:shell_command_av] = @shell_command_av.configuration if (@shell_command_av)\n return(cfg)\n end",
"def config\n requester.config \n end",
"def config\n\n end",
"def configure(service_name, configurations); end",
"def generate_config_for(mode)\n config_items = []\n @cluster_members.each do |mem|\n # The config item should match the structure NodeInfo\n # in node/cluster/membership.go in order for that one\n # to unmarshal successfully.\n config_item = {node_id: mem.id}\n if :docker.eql? mode\n config_item[:rpc_url] = \"#{mem.id}:#{mem.rpc_port}\"\n config_item[:api_url] = \"#{mem.id}:#{mem.api_port}\"\n else\n config_item[:rpc_url] = \"localhost:#{mem.rpc_port}\"\n config_item[:api_url] = \"localhost:#{mem.api_port}\"\n end\n config_items << config_item\n end\n config_items\n end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def server_side_config_options\n [:klass, :client_config]\n end",
"def configure\n load_all_configs \n end",
"def enum_configs\n host = session.session_host\n port = session.session_port\n exec_commands = [\n {\n 'cmd' => '/export verbose',\n 'fn' => 'get_config',\n 'desc' => 'Get Device Config on Mikrotik Device'\n },\n ]\n exec_commands.each do |ec|\n command = ec['cmd']\n cmd_out = session.shell_command(command).gsub(/#{command}/, '')\n print_status(\"Gathering info from #{command}\")\n # detect if we're in pagination and get as much data as possible\n if ec['fn'] == 'get_config'\n mikrotik_routeros_config_eater(host, port, cmd_out.strip)\n else\n cmd_loc = store_loot(\"mikrotik.#{ec['fn']}\",\n 'text/plain',\n session,\n cmd_out.strip,\n \"#{ec['fn']}.txt\",\n ec['desc'])\n vprint_good(\"Saving to #{cmd_loc}\")\n end\n end\n end",
"def get_config\n\t\tend",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def config(options = {})\n @api = options[:api].to_s\n @tag = options[:tag].to_s\n @response = options[:response]\n end",
"def configuration\n cfg = {}\n cfg[:author_avpair] = @author_avpair.name if (@author_avpair)\n cfg[:command_authorization_profile] = @command_authorization_profile.name if (@command_authorization_profile)\n cfg[:enable_acl] = @enable_acl.name if (@enable_acl)\n cfg[:login_acl] = @login_acl.name if (@login_acl)\n return(cfg)\n end",
"def configuration\n cfg = {}\n cfg[:author_avpair] = @author_avpair.name if (@author_avpair)\n cfg[:command_authorization_profile] = @command_authorization_profile.name if (@command_authorization_profile)\n cfg[:disabled] = self.disabled? if (self.disabled?)\n cfg[:enable_password] = @enable_password if (@enable_password)\n cfg[:enable_password_expires_on] = @enable_password_expires_on.to_s if (@enable_password_expires_on)\n cfg[:enable_password_lifespan] = @enable_password_lifespan if (@enable_password_lifespan != 0)\n cfg[:enable_acl] = @enable_acl.name if (@enable_acl)\n cfg[:encryption] = @encryption.to_s if (@encryption)\n cfg[:login_acl] = @login_acl.name if (@login_acl)\n cfg[:login_password] = @login_password if (@login_password)\n cfg[:login_password_expires_on] = @login_password_expires_on.to_s if (@login_password_expires_on)\n cfg[:login_password_lifespan] = @login_password_lifespan if (@login_password_lifespan != 0)\n cfg[:salt] = @salt if (@salt)\n cfg[:user_group] = @user_group.name if (@user_group)\n return(cfg)\n end",
"def configure\n end",
"def config_options\n {\n 'datacenter' => new_resource.datacenter,\n 'template_path' => new_resource.template_path,\n 'power_on' => true,\n 'datastore' => new_resource.datastore,\n 'wait' => true,\n 'hostname' => new_resource.hostname,\n 'name' => new_resource.name,\n 'customization_spec' => {\n 'domain' => new_resource.domain,\n 'ipsettings' => {\n 'ip' => new_resource.ip || node['vcac_vm']['ip'],\n 'gateway' => new_resource.gateway,\n 'subnetMask' => new_resource.subnet_mask,\n },\n }\n }\nend",
"def override_client_config_timeouts config\n config.timeout = timeout\n rpc_names = config.rpcs.methods - Object.methods\n rpc_names.each do |rpc_name|\n rpc = config.rpcs.send rpc_name\n rpc.timeout = timeout if rpc.respond_to? :timeout=\n end\n end",
"def configuration\n cfg = {}\n cfg[:acl] = @acl.name if (@acl)\n\n if (@command)\n cfg[:command] = @command.source\n else\n cfg[:shell_command_object_group] = @shell_command_object_group.name\n end\n return(cfg)\n end",
"def configure; end",
"def configuration\n cfg = {}\n if (@command)\n cfg[:command] = @command.source\n else\n cfg[:shell_command_object_group] = @shell_command_object_group.name\n end\n\n cfg[:acl] = @acl.name if (@acl)\n return(cfg)\n end",
"def configure(root_config)\n\n end"
]
| [
"0.7670324",
"0.65388",
"0.6519626",
"0.6519626",
"0.6519626",
"0.6519626",
"0.6519626",
"0.6519626",
"0.6519626",
"0.6519626",
"0.6519626",
"0.6519626",
"0.6519626",
"0.6519626",
"0.6519626",
"0.6519626",
"0.6519626",
"0.6519626",
"0.6496722",
"0.64504987",
"0.64504987",
"0.64504987",
"0.64504987",
"0.6396777",
"0.63363606",
"0.6260413",
"0.61833",
"0.61474645",
"0.6111119",
"0.6061607",
"0.60104513",
"0.60104513",
"0.60104513",
"0.60104513",
"0.60104513",
"0.60104513",
"0.60104513",
"0.60104513",
"0.60104513",
"0.60104513",
"0.60104513",
"0.60104513",
"0.60104513",
"0.60104513",
"0.60104513",
"0.60104513",
"0.60104513",
"0.60104513",
"0.5970412",
"0.5923075",
"0.59167826",
"0.5913299",
"0.58810645",
"0.58810645",
"0.58810645",
"0.58810645",
"0.58810645",
"0.58595955",
"0.5816499",
"0.58107275",
"0.5803859",
"0.5790462",
"0.57801867",
"0.57795334",
"0.57466453",
"0.57202756",
"0.5718768"
]
| 0.6475326 | 50 |
GET /learn GET /learn.json | def current_repetition
@cards = current_user.cards_due
@card = @cards.sample
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @learn = Learn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @learn }\n end\n end",
"def new\n @learn = Learn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @learn }\n end\n end",
"def index\n @lesson_learneds = LessonLearned.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lesson_learneds }\n end\n end",
"def show\n @lesson_learned = LessonLearned.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lesson_learned }\n end\n end",
"def index\n @learners = Learner.all\n end",
"def index\n @guides = Guide.page(1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: {:guides => @guides.as_json} }\n end\n end",
"def create\n @learn = Learn.new(params[:learn])\n\n respond_to do |format|\n if @learn.save\n format.html { redirect_to @learn, notice: 'Learn was successfully created.' }\n format.json { render json: @learn, status: :created, location: @learn }\n else\n format.html { render action: \"new\" }\n format.json { render json: @learn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @advances = user_capabilities(Advance).current_advances\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @advances }\n end\n end",
"def new\n @lesson_learned = LessonLearned.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lesson_learned }\n end\n end",
"def index\n\t\tauthorize! :read, Skill\n\t\t\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @skills }\n end\n end",
"def learn_url\n \"http://learn.uwaterloo.ca\"\n end",
"def index\n @lessons = Lesson.all\n\n render 'index.json'\n end",
"def index\n @learn_articles = LearnArticle.all\n end",
"def index\n @question_learneds = QuestionLearned.all\n end",
"def index\n @my_exams = MyExam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_exams }\n end\n end",
"def index\n @learnings = Learning.all\n end",
"def index\n #@lessons = Lesson.all\n @lessons = @course.lessons.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @lessons }\n end\n end",
"def 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 index\n @skills = Skill.all\n\n render json: @skills\n end",
"def api\n url = \"https://wagon-dictionary.herokuapp.com/#{@answer}\"\n response = URI.open(url).read\n json = JSON.parse(response)\n return json['found']\n end",
"def index\n @educations = Education.all\n render json: @educations\n end",
"def show\n @advocacy = Advocacy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @advocacy }\n end\n end",
"def index\n @expertises = Expertise.all\n\n render json: @expertises\n end",
"def show\n @guide = Guide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guide.as_json(:root => true) }\n end\n end",
"def index\n @teachers = Teacher.order(:tea_no).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @teachers }\n end\n end",
"def index\n\t\t@courses = @teacher.courses\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @courses }\n end\n end",
"def index\n @lectures = Lecture.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @lectures }\n end\n end",
"def test_get_skills_route\n render :json => get_profile_skills_for_profile(\"https://www.linkedin.com/in/marissamayer\").to_json\n end",
"def index\n @ideas = Idea.all\n\n render json: @ideas\n end",
"def learn\n begin\n pattern = params[:chat][:pattern].strip\n template = params[:chat][:template]\n teach_bot(pattern,template)\n response = {error: false,message: \"Bot is trained.\"}\n render json: response,status: :ok\n rescue Exception => e\n response = {error: true,message: e.message}\n render json: response,status: :unprocessable_entity \n end\n end",
"def index\n @guys = Guy.all\n respond_to do |format|\n format.json { render json: @guys }\n end\n end",
"def test\n get(\"/help/test.json\")\n end",
"def test\n get(\"/help/test.json\")\n end",
"def index\n @enrolleds = Enrolled.all\n @courses = Course.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enrolleds }\n end\n end",
"def index\n @interests = Interest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @interests }\n end\n end",
"def index\n @guides = Guide.paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guides }\n end\n end",
"def index\n @teaches = Teach.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teaches }\n end\n end",
"def index\n @interests = Interest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @interests }\n end\n end",
"def index\n render :json => UserInterest.all\n end",
"def index\n @goal_rewards = user.goal_rewards\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goal_rewards }\n end\n end",
"def show\n @knowledge = Knowledge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @knowledge }\n end\n end",
"def index\n @ideas = Idea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end",
"def index\n @learning_resources = @language.learning_resources\n end",
"def index\n @ideas = Idea.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end",
"def index\n @reward_and_levels = RewardAndLevel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reward_and_levels }\n end\n end",
"def index\n @learnwordlists = Learnwordlist.all\n end",
"def index\n @ways_of_admissions = WaysOfAdmission.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ways_of_admissions }\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 show\n @terms_of_use = TermsOfUse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @terms_of_use }\n end\n end",
"def index\n @words = Word.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @words }\n end\n end",
"def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @interest }\n end\n end",
"def show\n @advance = Advance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @advance }\n end\n end",
"def update\n @learn = Learn.find(params[:id])\n\n respond_to do |format|\n if @learn.update_attributes(params[:learn])\n format.html { redirect_to @learn, notice: 'Learn was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @learn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @guides = Guide.all\n end",
"def index\n @guides = Guide.all\n end",
"def courses\n @learn_courses\n end",
"def index\n render json: { \"Exercice Technique\" => \"Transporter Organizations Colisweb backend developer exercise\", \"Poste visé\" => \"Développeur Back Ruby, Alternance\", \"Candidat\" => \"Gressier Jimmy\"}\n end",
"def new\n @knowledge = Knowledge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @knowledge }\n end\n end",
"def index\n @education_levels = EducationLevel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @education_levels }\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 show\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exam }\n end\n end",
"def index\n @courses = Course.all\n render json: @courses, status: :ok\n end",
"def show\n @breadcrumb = 'read'\n @guide = Guide.find(params[:id])\n @subguides = @guide.subguides.paginate(:page => params[:page], :per_page => per_page).order('sort_order')\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guide }\n end\n end",
"def index\n @attris = Attri.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attris }\n end\n end",
"def view\n res = @client.get(path)\n @attributes = res.json if res.success?\n end",
"def new\n @guide = Guide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @guide.as_json(:root => true) }\n end\n end",
"def index\n @admin_skills = Admin::Skill.all\n\n render json: @admin_skills\n end",
"def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @interest }\n end\n end",
"def show\n @teach = Teach.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teach }\n end\n end",
"def show\n @teach = Teach.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teach }\n end\n end",
"def show\n @research = Research.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @research }\n end\n end",
"def index\n @litters = Litter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @litters }\n end\n end",
"def set_api_v1_learn_crypto\n @api_v1_learn_crypto = Api::V1::LearnCrypto.find(params[:id])\n end",
"def new\n @advocacy = Advocacy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @advocacy }\n end\n end",
"def index\n @witnesses = Witness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @witnesses }\n end\n end",
"def show\n @training = Training.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @training }\n end\n end",
"def show\n @getadvice = Getadvice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @getadvice }\n end\n end",
"def show\n @lab_teach_resource = LabTeachResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_teach_resource }\n end\n end",
"def show\n render status: 200, json: Training.find(params[:id])\n end",
"def show\n #@lesson = Lesson.find(params[:id])\n @lesson = @course.lessons.find(params[:id])\n @lessons = @course.lessons.all\n @courses = Course.all\n @pages = @lesson.pages.all\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @lesson }\n end\n end",
"def index\n @courses = Course.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def index\n @courses = Course.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def index\n @courses = Course.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses}\n end\n end",
"def new\n @knowledge = current_user.knowledges.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @knowledge }\n end\n end",
"def index\n @enrolls = Enroll.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enrolls }\n end\n end",
"def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interest }\n end\n end",
"def show\n @skill = Skill.find(params[:id])\n\t\tauthorize! :read, Skill\n\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @skill }\n end\n end",
"def index\n @recommended_links = RecommendedLink.all\n\n render json: @recommended_links\n end",
"def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @interest }\n end\n end",
"def show\n @lei = Lei.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lei }\n end\n end",
"def show\n render json: @skill\n end",
"def index\n getProfile\n @consents = TherapistConsent.where('therapist_id = ? ', @therapist.id)\n respond_to do |format|\n format.html { render action: 'index' }\n format.json { render :status => 200, :json => { action: 'index', consents: @consents }}\n end\n end",
"def new\n @tutorial = Tutorial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial }\n end\n end",
"def new\n @tutorial = Tutorial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial }\n end\n end",
"def new\n @books = Book.all\n @knowledge_point = KnowledgePoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @knowledge_point }\n end\n end",
"def index\n @ideas = Idea.current_ideas_for(current_user).entries\n respond_with(@ideas) do |format|\n format.json { render json: @ideas }\n end\n end",
"def index\n @strategy_guides = StrategyGuide.all\n \n respond_with(@strategy_guides)\n end",
"def index\n @study_courses = StudyCourse.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @study_courses }\n end\n end",
"def new\n @exam = Exam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exam }\n end\n end",
"def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end"
]
| [
"0.7505591",
"0.69095147",
"0.6632864",
"0.6514951",
"0.6372981",
"0.63381803",
"0.6310782",
"0.6226623",
"0.6147296",
"0.60580903",
"0.6048885",
"0.602975",
"0.5987045",
"0.5956902",
"0.5950432",
"0.5927009",
"0.59180695",
"0.5908847",
"0.5851757",
"0.5849044",
"0.5838203",
"0.58250105",
"0.5819402",
"0.5807711",
"0.5799211",
"0.5798302",
"0.5779201",
"0.5775123",
"0.5773501",
"0.5756693",
"0.57407093",
"0.57328904",
"0.5731891",
"0.5731891",
"0.5715915",
"0.5696173",
"0.56943375",
"0.56870353",
"0.5682397",
"0.5674484",
"0.56690985",
"0.566861",
"0.5668373",
"0.5664793",
"0.56546503",
"0.5651666",
"0.5633711",
"0.5624163",
"0.5614598",
"0.5610754",
"0.5604584",
"0.55996203",
"0.55987334",
"0.55955976",
"0.55847603",
"0.55847603",
"0.55819404",
"0.55794865",
"0.55650574",
"0.5542138",
"0.5536003",
"0.5526172",
"0.5524465",
"0.55240744",
"0.5518185",
"0.55172133",
"0.55148137",
"0.5502424",
"0.55014616",
"0.54976755",
"0.54976755",
"0.5497645",
"0.5491554",
"0.5490926",
"0.54905295",
"0.5487571",
"0.5484789",
"0.54822934",
"0.5480109",
"0.54798955",
"0.5477667",
"0.5475979",
"0.5475979",
"0.5470854",
"0.547016",
"0.5468805",
"0.54670846",
"0.54595363",
"0.5454934",
"0.5453471",
"0.5452529",
"0.54512626",
"0.5449915",
"0.54480773",
"0.54480773",
"0.54456323",
"0.54445326",
"0.54429096",
"0.5442621",
"0.54387105",
"0.54365253"
]
| 0.0 | -1 |
Returns the current loggedin user (if any). | def current_user
if session[:user_id]
@current_user ||= User.find_by(id: session[:user_id])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_user\n if session[:user_id]\n return User.find(session[:id])\n else\n return nil\n end\n end",
"def current_user\n if session[:user_id]\n User.find(session[:user_id])\n else\n nil\n end\n end",
"def current_user\n return unless session[:user_id]\n User.find(session[:user_id])\n end",
"def get_current_user\n if session[:authenticated]\n return User.find_by_id(session[:user_id])\n end\n return nil\n end",
"def getLoggedInUser\n if session[:user_id]\n return User.find(session[:user_id])\n else\n return nil\n end\n end",
"def current_user\n if session[:user_id]\n User.find(session[:user_id])\n else\n end\n end",
"def current_user\n User.get_user(session[:user_id]) if session[:user_id]\n end",
"def current_user\n if session[:user_id]\n return @user ||= User.find(session[:user_id]['$oid'])\n else\n return nil\n end\n end",
"def current_user\n\t\tif session[:user_id].present?\n\t\t\tUser.find(session[:user_id])\n\t\tend\n\tend",
"def current_user\n if session[:user_id]\n user = User.find(session[:user_id])\n else\n nil\n end\n end",
"def current_user\n if valid_session?\n User.find(session[:user_id])\n end\n end",
"def get_current_user\n if @current_user\n return @current_user\n else\n @current_user = User.find_by(id: session[:user_id])\n end\n end",
"def get_logged_in_user\n if logged_in?\n user = User.find(session[:current_user_id])\n if user\n return user\n else\n return nil\n end\n end\n \n #default return nil\n nil\n end",
"def get_current_user\n @current_user ||= User.find(session[:user_id]) unless session[:user_id].blank?\n return @current_user\n end",
"def current_user\n if session[:user_id]\n User.find_by(id: session[:user_id])\n end\n end",
"def current_user\n User.find_by(uid: session[:user]) if logged_in?\n end",
"def current_user(id = session[:user_id])\n User.get_one id\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if logged_in?\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if logged_in?\n end",
"def current_user\n return @current_user if @current_user.present?\n\n if session[:uid]\n @current_user = User.from_session(session)\n end\n\n @current_user\n end",
"def current_user\n if logged_in?\n return User.get(session['user'])\n end\n AnonymousUser.new\n end",
"def get_current_user\n unless session[:user_id]\n @current_user = nil\n return\n end\n @current_user = User.first(:conditions => {:id => session[:user_id] })\n end",
"def get_current_user\n unless session[:user_id].blank?\n @current_user = User.find(session[:user_id])\n else\n @current_user = nil\n end\n end",
"def current_user\n\t\t\tUser.find(session[:user_id])\n\t\tend",
"def current_user\n\t\t\tUser.find(session[:user_id])\n\t\tend",
"def current_user\n @current_user if logged_in?\n end",
"def current_user\n @current_user if logged_in?\n end",
"def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend",
"def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend",
"def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend",
"def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend",
"def current_user\n if !session[:user_id] then nil else User.find(session[:user_id]) end\n end",
"def current_user\n User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n User.find(session[:user_id]) if session[:user_id]\n end",
"def get_current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[\"user_id\"])\n end\n end",
"def current_user\n user_id = get_log_in_session\n if user_id\n get_user(user_id)\n else\n user = get_user(cookies.signed['user_id'])\n if user&.authenticated?(:remember, cookies[:remember_token])\n set_log_in_session user\n user\n end\n end\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n #return current user if @current_user already exists.\n #if there's no current user, return the user with ID == session user ID, if there is one.\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n return @current_user\n end",
"def current_user\n if !@current_user.nil?\n @current_user\n elsif !session[:current_user_id].nil?\n begin\n @current_user = User.find(session[:current_user_id])\n rescue ActiveRecord::RecordNotFound\n @current_user = nil\n end\n end\n end",
"def current_user\n if Rails.application.config.use_omniauth\n return nil unless session[:user_info]\n @current_user ||= User.find_user_from_omniauth(session[:user_info])\n else\n @current_user ||= User.where(username: request.env['aker.check'].user.username).first\n end\n end",
"def current_user\n return unless session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end",
"def current_user\n return unless session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end",
"def current_user\n return unless session[:user_id]\n @current_user ||= User.first(:id => session[:user_id])\n end",
"def current_user\n begin\n unless @current_user.nil?\n return @current_user\n else\n if session[:user_id]\n return @current_user = User.find(session[:user_id])\n else\n return nil\n end\n end\n rescue\n return nil\n end\nend",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n #return current user or set to this if there isnt a current user\n end",
"def current_user\n # User.find would throw an error if we cannot find the user\n User.find_by({ id: session[:user_id] })\n end",
"def current_user\n\n sql = \"SELECT * FROM users WHERE id = $1;\"\n \n results = run_sql(sql, [session[:user_id]]) \n return results.first\n end",
"def current_user\n\tif session[:user_id].present?\n\t\tUser.find(session[:user_id])\t\n\tend\nend",
"def current_user\n return @current_user ||= User.find(session[:user_id]) unless session[:user_id].nil?\n end",
"def current_user\n if @current_user.nil?\n @current_user = User.find_by(id: session[:user_id])\n else\n @current_user\n end\n end",
"def current_user\n get_from_options_or_controller(:current_user)\n end",
"def current_user\n begin \n User.find(session[:user_id])\n rescue ActiveRecord::RecordNotFound\n nil\n end\n end",
"def current_user\n if user_signed_in?\n Session.active_sessions.find_by(id: request.headers['sid'], utoken: request.headers['utoken']).user\n else\n nil\n end\n end",
"def current_user\n if user_signed_in?\n Session.active_sessions.find_by(id: request.headers['sid'], utoken: request.headers['utoken']).user\n else\n nil\n end\n end",
"def current_user\n User.find_by(id: session[:user_id])\n end",
"def current_user\n User.find_by(id: session[:user_id])\n end",
"def current_user\n return nil unless session[:user_id]\n User.get(session[:user_id])\nend",
"def current_user\r\n\tif(session[:user_id])\r\n\t\t@u ||= User.first(id: session[:user_id])\r\n\t\treturn @u\r\n\telse\r\n\t\treturn nil\r\n\tend\r\nend",
"def current_user\n \t# If the session contains the user_id with non-nil, we have ID of some user\n \t# Return the user object for ID\n \t\n \t# Using instance variable helps limit calls\n \t# \"Or equals\" means \n \t\t# if nil, set it -- if not, return it\n \tif session[:user_id]\n \t@current_user ||= User.find(session[:user_id])\n end\n end",
"def current_user\n logged_in? ? User.find_by_id(session[:user_id]) : nil\n end",
"def find_current_user\n if is_logged_in?\n @current_user = User.find(session[:user_id])\n else\n @current_user = nil\n end\n end",
"def current_user\n if logged_in?\n session[:user] = nil\n return temporary_logged_in_user ? temporary_logged_in_user :\n set_temporary_logged_in_user(cached_user)\n else\n session[:user] ||= create_new_user # if there wasn't one\n session[:user] = create_new_user unless session[:user].respond_to?(:stale?)\n session[:user] = create_new_user if session[:user].stale?\n return session[:user]\n end\n end",
"def current_user\n return unless session[:user_id]\n @current_user ||= User.find_by_id(session[:user_id])\n end",
"def current_user\n if session[:user_id].present?\n @current_user = User.find_by(uid: session[:user_id])\n # session.clear if @current_user.nil?\n return @current_user\n end\n end",
"def current_user\n if session[:user_id]\n return User.find(session[:user_id])\n end\nend",
"def current_user\n\t\t\tUser.find_by_id(session[:user_id])\n\t\tend",
"def current_user\n if session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end\n end",
"def return_current_user\n @current_user ||= User.find(session[:id_of_current_user]) if session[:id_of_current_user]\n end",
"def current_user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end",
"def logged_in_user\n if (!logged_in?)\n return User.logged_out_user\n end\n #return nil if !logged_in?\n return session[\"app_user\"]\n end",
"def current_user\n core_id = Origen::Users::User.current_user_id\n user = app_users.find { |user| user.core_id == core_id }\n user || User.new(core_id)\n end",
"def current_user\n @user ||= User.find_by_id(session[:user_id])if logged_in?\n end",
"def current_user\n load_session\n @current_user\n end",
"def find_current_user\n user_id = session[:user_id]\n if user_id\n user = Marty::User.active.find(user_id) rescue nil\n else\n user = try_to_autologin\n end\n\n user\n end",
"def current_user\n return nil unless session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n # return current user or set it to what is found in cookie, only if there is one to begin with\n end",
"def current_user\n \t@current_user || User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n @current_user ||= begin\n if session[:user_id]\n user = User.where(id: session[:user_id])\n user[0] if user.any?\n end\n end\n # @current_user ||= User.find session[:user_id] if session[:user_id]\n end",
"def current_user\n\n \tif session[:user_id].present?\n \t\tUser.find(session[:user_id])\n\n \tend\n\n end",
"def current_user\n\tsession[:user_id] ? User.find(session[:user_id]) : nil\nend",
"def current_user\n\tsession[:user_id] ? User.find(session[:user_id]) : nil\nend",
"def current_user\n # retrieve from database on every request instead of\n # storing it as global variable when current_user=\n # is called to prevent user information becoming stale.\n @current_user ||= (session[:user_name] && User.find_by(user_name: session[:user_name])) || real_user\n end",
"def current_user\n\t\tif !@current_user\n\t\t\t@current_user = User.find_by(id: session[:user_id])\n\t\tend\n\t\t@current_user\n\tend",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n return unless session[:user_id]\n @current_user = User.find_by_id(session[:user_id])\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if user_signed_in?\n end",
"def current_user\n\t\tUser.find_by(:id => session[:user_id])\n\tend",
"def current_user\n User.find session[:user_id] if user_signed_in?\n end",
"def authenticated_user\n if session[:user_id].nil?\n return nil\n else\n return User.find(session[:user_id])\n end\n end",
"def current_user\n return @current_user if defined?(@current_user)\n @current_user = User.find_by_id(session[:user_id])\n end",
"def current_user\n if session[:user_id]\n @current_user = User.find(session[:user_id])\n end\n end",
"def current_user\n @user ||= User.find_by(id: session[:user_id]) if session[:user_id]\n end",
"def current_user\n \n # Normally we would look in the session to see if there is a user_id \n # to figure out if the user is loggged in.\n # For demo purposes this app randomly picks if the user is logged in\n if rand(100) > 20 \n User.last\n else\n nil\n end\n end"
]
| [
"0.85960984",
"0.8593657",
"0.855797",
"0.8545853",
"0.8534344",
"0.8497545",
"0.847914",
"0.8460573",
"0.8457271",
"0.84556973",
"0.84472865",
"0.8442264",
"0.8441092",
"0.84366953",
"0.8400402",
"0.83765614",
"0.8368829",
"0.8337418",
"0.8337418",
"0.8314651",
"0.8311652",
"0.83023316",
"0.8291481",
"0.82835174",
"0.82835174",
"0.82822436",
"0.82822436",
"0.82777715",
"0.82777715",
"0.82777715",
"0.82777715",
"0.8276581",
"0.8275023",
"0.8275023",
"0.8255083",
"0.8249995",
"0.82446975",
"0.8239647",
"0.8232271",
"0.82151717",
"0.82147837",
"0.82147837",
"0.82103586",
"0.8191853",
"0.8187335",
"0.81870914",
"0.818249",
"0.8178561",
"0.8178069",
"0.8167405",
"0.8166237",
"0.8165827",
"0.8164524",
"0.8164524",
"0.816404",
"0.816404",
"0.81622803",
"0.8161969",
"0.8160386",
"0.8157338",
"0.8153178",
"0.81529313",
"0.81492436",
"0.8147794",
"0.814727",
"0.81466174",
"0.8136481",
"0.8136481",
"0.8132164",
"0.81201875",
"0.81201875",
"0.81199944",
"0.8119824",
"0.8116362",
"0.8112842",
"0.81102794",
"0.81090635",
"0.81087977",
"0.81074595",
"0.80979383",
"0.8093762",
"0.80920845",
"0.80920845",
"0.8090045",
"0.8087256",
"0.80838054",
"0.80838054",
"0.8081629",
"0.80800456",
"0.80800176",
"0.80791426",
"0.8078592",
"0.8078462",
"0.8073231",
"0.807296",
"0.8071747"
]
| 0.8078152 | 96 |
Initializes an empty options hash to store ActiveConfiguration::Option instances containing configuration details. | def initialize
@options = HashWithIndifferentAccess.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def options\n @options ||= Hash.new{ |h, k| h[k] = {} }\n end",
"def options\n opts = {}\n self.configuration_options.each do |option|\n opts.merge!({option.name.to_sym => option.value})\n end\n opts\n end",
"def initialize_options\n @options = @spec.options.inject({}) do |options, (name, params)|\n options[name] = Option.new\n options[name].enabled = false\n options[name].description = params[\"description\"] || params\n options[name].files = params[\"files\"] || {}\n options\n end.to_struct if @spec.options\n end",
"def initialize\n @@options = {}\n end",
"def initialize\n @options = {}\n end",
"def initialize\n @options = {}\n end",
"def initialize\n @options = {}\n end",
"def options\n Hash[ *Configuration::VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]\n end",
"def options\n @options = @options.select { |key, _val| CONFIGURATIONS.include?(key.to_sym) }\n end",
"def options\n {}.tap do |options|\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n end\n end",
"def options\n {}.tap{ |options| VALID_OPTIONS_KEYS.each{|k| options[k] = send(k) } }\n end",
"def options\n Hash[\n *Configuration::VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten\n ]\n end",
"def options\n @_options ||= {}\n end",
"def options\n @options ||= OpenStruct.new(default_options)\n end",
"def options\n @options ||= {}\n end",
"def options\n @options ||= {}\n end",
"def options\n @options ||= {}\n end",
"def options\n return @_options if defined?(@_options)\n\n original_options = super\n @_options = Thor::CoreExt::HashWithIndifferentAccess.new(\n configuration_options.merge(original_options)\n )\n end",
"def initialize()\n @options = { }\n end",
"def options\n opts = {}\n VALID_CONFIG_KEYS.each_key do |k|\n opts.merge!(k => send(k))\n end\n opts\n end",
"def options\n opts = {}\n VALID_CONFIG_KEYS.each_key do |k|\n opts.merge!(k => send(k))\n end\n opts\n end",
"def options\n opts = {}\n VALID_CONFIG_KEYS.each_key do |k|\n opts.merge!(k => send(k))\n end\n opts\n end",
"def options\n @options ||= {}\n end",
"def options\n @options ||= {}\n end",
"def options\n @options ||= {}\n end",
"def options\n @options ||= OpenStruct.new\n end",
"def option_set\n @options ||= {}\n end",
"def options\n @options ||= Launchr::OrderedHash.new\n @options\n end",
"def options()\n {}\n end",
"def options\n Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]\n end",
"def options\n Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]\n end",
"def options\n @options ||= OpenStruct.new\n end",
"def options\n @options ||= OpenStruct.new\n end",
"def configuration\n if system_keys.any?\n options.merge({\n system_keys: Configuration.default_system_keys.merge(system_keys)\n })\n\n else\n options\n\n end\n end",
"def options\n @options ||= {}\n end",
"def options\n @options ||= {}\n end",
"def initialize(*args)\n @option_map = {}\n end",
"def options\n {}\n end",
"def options\n {}\n end",
"def initialize options={}\n @own_options = options\n end",
"def init_options( opts )\n options = default_options.merge( opts ) \n @environment = options[:environment]\n @perf_threshold = options[:perf_threshold]\n @moleable = options[:moleable]\n @app_name = options[:app_name]\n @user_key = options[:user_key]\n @store = options[:store]\n @excluded_paths = options[:excluded_paths]\n end",
"def options\n return @options if @options_parsed\n options = super\n config_path = File.join(File.dirname(__FILE__),\n '../..', CONFIG_FILE_NAME)\n return options unless File.exist? config_path\n\n defaults = YAML.load_file(config_path).deep_symbolize_keys || {}\n options = defaults.merge_with_arrays(options)\n @options = Thor::CoreExt::HashWithIndifferentAccess.new(options)\n @options_parsed = true\n\n @options\n end",
"def options\n @options ||= {}\n @options\n end",
"def initialize(options)\n super\n @initial_options = options.symbolize_keys.reject { |_key, value| value.blank? }\n parse_options(@initial_options)\n end",
"def default_options\n {}\n end",
"def default_options\n {}\n end",
"def default_options\n {}\n end",
"def options\n Hash[\n DeskApi::Configuration.keys.map do |key|\n [key, instance_variable_get(:\"@#{key}\")]\n end\n ]\n end",
"def options\n VALID_OPTIONS_KEYS.each_with_object({}) do |k, options|\n options[k] = send(k)\n end\n end",
"def options \n options = {}\n VALID_OPTIONS_KEYS.each {|k| options[k] = send(k)}\n options\n end",
"def initialize(options={})\n @init_options = options.kind_of?(Hash) ? options : {}\n end",
"def options\n self[:options] || {}\n end",
"def initialize\n @options = defaults\n end",
"def initialize\n @options = defaults\n end",
"def options\n OPTIONS_KEYS.inject({}) do |options, key|\n options.merge!(key => send(key))\n end\n end",
"def initialize options={}\n self.options = options\n end",
"def options()\n @options ||= OpenStruct.new({\n :debug => false,\n :gist_api_url => nil,\n :gist_extension => defaults[\"extension\"],\n :private_gist => defaults[\"private\"],\n :browse_enabled => defaults[\"browse\"],\n :embed_enabled => nil,\n :description => nil,\n :setup_credentials => false\n })\n end",
"def options\n Hash[VALID_OPTIONS.map { |key| [key, send(key)] }]\n end",
"def options\n Hash[VALID_OPTIONS_KEYS.map {|key| [key, send(key)] }]\n end",
"def options\n options = {}\n VALID_OPTIONS_KEYS.each {|k| options[k] = send(k)}\n options\n end",
"def options \n self.merge!(@config.opts)\n end",
"def options\n options = {}\n VALID_OPTIONS_KEYS.each { |k| options[k] = send(k) }\n options\n end",
"def options\n options = {}\n VALID_OPTIONS_KEYS.each { |k| options[k] = send(k) }\n options\n end",
"def initialize\n OPTIONS.each_pair do |key, value|\n send(\"#{key}=\", value)\n end\n end",
"def initialize(options = {})\n (options.keys - DEFAULTS.keys - EXTRA_OPTIONS)[0..1].each do |missing|\n raise ArgumentError, \"Invalid option: #{missing}\"\n end\n @options = options\n end",
"def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end",
"def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end",
"def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end",
"def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end",
"def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end",
"def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end",
"def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end",
"def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end",
"def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end",
"def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end",
"def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end",
"def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end",
"def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end",
"def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end",
"def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end",
"def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end",
"def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k) }\n options\n end",
"def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k) }\n options\n end",
"def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k) }\n options\n end",
"def default_options\n {}\n end",
"def default_options\n {}\n end",
"def default_options\n {}\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end",
"def default_options\n {}\n end",
"def initialize(initial_hash = nil)\n super\n @optional_method_names = %i[registerOptions]\n end",
"def initialize(options = {})\n options = ActiveSupport::HashWithIndifferentAccess.new(options)\n unknown_keys = options.keys - self.class.all_options.map(&:to_s)\n raise Informative, \"Unknown installation options: #{unknown_keys.to_sentence}.\" unless unknown_keys.empty?\n self.class.defaults.each do |key, default|\n value = options.fetch(key, default)\n send(\"#{key}=\", value)\n end\n end",
"def initialize(options = {})\n reset_options\n options.each_pair do |key, value|\n send(\"#{key}=\", value) if VALID_OPTIONS_KEYS.include?(key)\n end\n end",
"def initialize(options = {})\n application_configuration.merge!(options)\n configuration_options.each do |key|\n send(\"#{key}=\", application_configuration[key])\n end\n end",
"def options\n options = {}\n VALID_OPTIONS_KEYS.each do |k|\n options[k] = send(k)\n end\n options\n end"
]
| [
"0.77682495",
"0.74370295",
"0.7346797",
"0.72785294",
"0.7230288",
"0.7230288",
"0.7230288",
"0.71697503",
"0.71620077",
"0.7138633",
"0.7127613",
"0.7113905",
"0.7098109",
"0.7095942",
"0.70636994",
"0.70636994",
"0.70636994",
"0.70473963",
"0.7045181",
"0.70262027",
"0.70262027",
"0.6990468",
"0.69883513",
"0.69883513",
"0.69883513",
"0.6980706",
"0.6950377",
"0.6923026",
"0.6915129",
"0.6913669",
"0.6913669",
"0.6897339",
"0.6897339",
"0.68661076",
"0.6856873",
"0.6856873",
"0.68256074",
"0.6817155",
"0.6817155",
"0.6800384",
"0.6794384",
"0.6781522",
"0.6781381",
"0.677943",
"0.6775595",
"0.6775595",
"0.6775595",
"0.67692155",
"0.6753109",
"0.6741095",
"0.67381865",
"0.6737046",
"0.6735812",
"0.6735812",
"0.6732978",
"0.67309856",
"0.67288154",
"0.6725911",
"0.6724935",
"0.6723032",
"0.6717333",
"0.67161155",
"0.67161155",
"0.6715051",
"0.67076147",
"0.670669",
"0.670669",
"0.670669",
"0.670669",
"0.670669",
"0.670669",
"0.670669",
"0.670669",
"0.670669",
"0.670669",
"0.670669",
"0.670669",
"0.670669",
"0.670669",
"0.670669",
"0.670669",
"0.66993487",
"0.66993487",
"0.66993487",
"0.66910696",
"0.6690586",
"0.6690586",
"0.6681872",
"0.6681872",
"0.6681872",
"0.6681872",
"0.6681872",
"0.6681872",
"0.66784626",
"0.66774315",
"0.66757154",
"0.6673039",
"0.66708505",
"0.6660322",
"0.6658708"
]
| 0.67623013 | 48 |
Creates and accepts the configuration details for an Option. An example of setting an option with a block: option :sort do default 'alphabetical' restrict 'alphabetical', 'manual' end Here, the option method is called and passed the key of :sort and then the the block that follows. The block given to option is then evaluated against a new instance of ActiveConfiguration::Option. | def option(key, &block)
opt = Option.new(key)
opt.instance_eval(&block)
@options[key.to_sym] = opt
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configuration_option(*opts, &block)\n Autoproj.config.declare(*opts, &block)\nend",
"def configure(&block)\n raise ArgumentError, \"Block is required.\" unless block_given?\n yield @options\n end",
"def construct( &block )\n self.instance_eval(&block)\n @options\n end",
"def initialize_options\n @options = @spec.options.inject({}) do |options, (name, params)|\n options[name] = Option.new\n options[name].enabled = false\n options[name].description = params[\"description\"] || params\n options[name].files = params[\"files\"] || {}\n options\n end.to_struct if @spec.options\n end",
"def configuration_from_options(options); end",
"def on_option(opt_name, opt_value = nil, &block)\n handlers[{ regexp: opt_name, type: :option_name }] = block\n handlers[{ regexp: opt_value, type: :option_value }] = block if opt_value\n end",
"def option(name, description, &block)\n name = name.to_s\n block ||= lambda{|v| options[name.to_sym] = v }\n short, long = \"-#{name[0,1]}\", \"--#{name}\"\n op.on_head(name, description, &block)\n end",
"def new_option(argv, &block) # :nodoc:\n attrs = argv.last.kind_of?(Hash) ? argv.pop : {}\n attrs = parse_attrs(argv).merge(attrs)\n\n attrs[:hint] ||= guess_hint(attrs)\n attrs[:callback] = block if block\n\n option_class(attrs).new(attrs)\n end",
"def configure &block\n @config_helper = ConfigHelper.new(&block)\n end",
"def process_options(&block)\n self.option_processors ||= []\n option_processors << block\n self\n end",
"def with_options(&block); end",
"def option(name, meta_options={})\n config_object_class.configurable(name)\n options << [name, meta_options]\n name\n end",
"def configure(options=nil, &block)\n config_class = @provisioner.config_class\n return if !config_class\n\n @logger.debug(\"Configuring provisioner with: #{config_class}\")\n @config = config_class.new\n @config.set_options(options) if options\n block.call(@config) if block\n end",
"def option_type_config; end",
"def define_options(opt)\n # override this; no additional options by default\n end",
"def options(opt)\n end",
"def method_missing( meth, *args, &block )\n if self.class.types.include?(meth) and args.length.between?(1,2)\n name = args[0]\n default = args.length == 2 ?\n args[1] : meth\n option = @klass.new(name, default)\n option.description, @description =\n @description, nil\n @options << option\n else\n super\n end\n end",
"def configure(option)\n config.merge(option)\n end",
"def options(opt); end",
"def options(opt); end",
"def with_options(options = {}, &block)\n return unless block\n backup_options = @stkw_config[:base_opt]\n @stkw_config[:base_opt] = @stkw_config[:base_opt].merge(options)\n begin\n instance_eval &block\n ensure\n @stkw_config[:base_opt] = backup_options\n end\n end",
"def add_options(&block)\n if options\n old_options = options\n self.options = proc do\n instance_exec(&old_options)\n instance_exec(&block)\n end\n else\n self.options = block\n end\n self\n end",
"def option(name, short, long, desc, default = nil, &block)\n desc = desc + \" (default: #{default})\" if default\n # Save the option's default value and add the OptionParser logic\n @options[name] = default\n @parser.on(short, long, desc) do |v|\n @options[name] = (block_given? ? yield(v) : true)\n end\n # Widen the summary width if needed\n width = 2 + (short ? 4 : 0) + long.to_s.size\n @parser.summary_width = [@parser.summary_width, width].max\n end",
"def option_property\n block = proc do |key_and_value|\n hash = YAML.load(key_and_value)\n raise OptionParser::InvalidArgument.new('\"' + key_and_value + '\"') unless hash.kind_of?(Hash)\n #\n key = hash.keys[0]\n value = hash[key]\n save_option_value(key, value); propagate_option('--property', key_and_value)\n end\n @cl_parser.on('--property \"KEY: VALUE\"', 'Enter arbitrary property values.',\n 'Can be used multiple times for multiple properties.', &block)\n end",
"def options(*args, &block); end",
"def configure options\n options.map do |key, value|\n types = {String => 'string', Fixnum => 'int', TrueClass => 'bool',\n FalseClass => 'bool', Float => 'float', Array => 'list --list-type=string'}\n type = types[value.class]\n raise 'Invalid type for configure' unless type\n value = value.to_json if value.is_a?(Array)\n value = %(\"#{value}\") if type == 'string'\n check = \"gconftool-2 --get \\\"#{key}\\\" | grep #{value} #{echo_result}\"\n Command.new(\"gconftool-2 --set \\\"#{key}\\\" --type #{type} #{value}\", check)\n end\n end",
"def initialize(config={}, opts={})\n opts = {\n :option_break => OPTION_BREAK,\n :preserve_option_break => false,\n :assign_defaults => true\n }.merge(opts)\n\n @registry = []\n @options = {}\n @config = config\n @option_break = opts[:option_break]\n @preserve_option_break = opts[:preserve_option_break]\n @assign_defaults = opts[:assign_defaults]\n\n yield(self) if block_given?\n end",
"def options\n opts = {}\n self.configuration_options.each do |option|\n opts.merge!({option.name.to_sym => option.value})\n end\n opts\n end",
"def method_missing method, *args, &block\n temp = @@config_options.send method\n if temp.is_a?(Proc)\n temp.call *args\n else\n temp\n end\n end",
"def configure(options = nil)\n if block_given?\n yield default_options\n else\n default_options.deep_merge!(options)\n end\n end",
"def optParse\n OptionParser.new do |o|\n o.on('-v', 'Be more verbose.') { |i|\n self[:verbose] += 1\n }\n o.on('-V', '--version', 'Show version & exit.') { |i|\n puts Meta::VERSION\n exit EX_OK\n }\n o.on('--config NAME',\n \"Set a config name or file\",\n \"(default is #{@conf[:config_name]}).\") {|arg|\n @conf[:config_name] = arg\n }\n o.on('--config-dirs', 'Show possible config locations.') {\n mark = false\n @conf[:config_dirs].each { |idx|\n f = Pathname(idx) + @conf[:config_name]\n if File.file?(f) && !mark\n puts \"* #{f}\"\n mark = true\n else\n puts \" #{f}\"\n end\n }\n exit EX_OK\n }\n\n yield o if block_given?\n o.banner = @conf[:banner]\n\n env = nil\n env = ENV[@conf[:config_env]].shellsplit if ENV.key?(@conf[:config_env])\n\n begin\n [env, ARGV].each { |i| o.parse!(i) if i }\n rescue\n CliUtils.errx EX_USAGE, $!.to_s\n end\n end\n end",
"def set(option, value=self, &block)\n if block_given?\n write_option option, block\n elsif value == self\n self.options = option.to_hash\n else\n write_option option, value\n end\n end",
"def option(*args, &block)\n #p [:option, args, :optional, optional?]\n key_values, args = args.partition{ |x| x.kind_of?(Hash)}\n key_values = key_values.inject({ }){ |hash, kv| hash.merge(kv)}\n\n errors = []\n\n # handle optional/required flipflop\n if optional?\n required = { :default => nil }\n if key_values.delete(:required)\n if key_values.key?(:optional)\n errors << \"Can't specify both :required and :optional\"\n end\n if key_values.key?(:default)\n errors << \"Can't specify both :required and :default\"\n end\n required = { }\n elsif key_values.delete(:optional) && !key_values.key?(:default)\n required = { :default => nil }\n end\n else\n key_values.delete(:required)\n required = { }\n end\n args = [{ :using => Option }.merge(required).merge(key_values), *args]\n da = has(*args, &block)\n if errors.size > 0\n raise ArgumentError, \"#{da.name}: #{errors.join(', ')}\", [caller[-1]]\n end\n da.instance_eval do\n #p [:checking_values, values, values.class]\n if da.values.kind_of?(Range)\n must \"be in range #{da.values}\" do |s|\n da.values.include?(s)\n end\n elsif da.values.respond_to?(:size) && da.values.size > 0\n must \"be one of #{da.values.join(', ')}\" do |s|\n da.values.include?(s)\n end\n end\n if da.match\n must \"match pattern #{da.match.inspect}\" do |s|\n #p [:matching, s, da.match.inspect]\n s.to_s =~ da.match\n end\n end\n end\n da\n end",
"def set_option(symbol, *opts, &block)\n @mandatory_arguments[symbol] = {:key => symbol, :argument => opts[0], :switch => opts[1]} if opts[3] == true\n if block.nil?\n on(*opts) do |x|\n case symbol\n when :server\n @options[symbol] = @test_options.environments[x]\n else\n @options[symbol] = x\n end\n end\n else\n on(*opts, &block)\n end\n end",
"def config\n yield @@config_options\n end",
"def initialize\n @option_parser = OptionParser.new do |opt|\n opt.banner = banner\n opt.summary_indent = Shebang::Config[:indent]\n\n # Process each help topic\n help_topics.each do |title, text|\n opt.separator \"#{Shebang::Config[:heading]}#{\n Shebang::Config[:indent]}#{text}\" % title\n end\n\n opt.separator \"#{Shebang::Config[:heading]}\" % 'Options'\n\n # Add all the options\n options.each do |option|\n opt.on(*option.option_parser) do |value|\n option.value = value\n\n # Run a method?\n if !option.options[:method].nil? \\\n and respond_to?(option.options[:method])\n # Pass the value to the method?\n if self.class.instance_method(option.options[:method]).arity != 0\n send(option.options[:method], value)\n else\n send(option.options[:method])\n end\n end\n end\n end\n end\n end",
"def configure(options_hash = {})\n keys.each do |key|\n if options_hash[key]\n instance_variable_set(:\"@#{key}\", options_hash[key])\n end\n end\n if block_given?\n yield self\n end\n return self\n end",
"def option(*opts, &block)\n @parser.on(*opts, &block)\n end",
"def option(name, behaviors = {}, &block)\n Ablerc.options << Ablerc::Option.new(name, behaviors, &block)\n end",
"def test_options_recognized\n block_ = ::Proc.new do\n set_value(:a, 1)\n end\n hash_ = ::Hash.new\n assert_raise(::Blockenspiel::BlockParameterError) do\n ::Blockenspiel.invoke(block_, :parameterless => false) do\n add_method(:set_value) do |key_, value_|\n hash_[key_] = value_\n end\n end\n end\n end",
"def add_option(name, type, options_info, options_text, option_name, option_descr, attribute)\n raise 'Invalid option type' unless VALID_OPTION_TYPE.include?(type)\n options_info = parse_string(options_info) if options_info.is_a?(String)\n options_text = parse_string(options_text) if options_text.is_a?(String)\n options_text.map! { |option_text| get_text(option_text) } unless options_text.is_a?(String)\n option_name = get_text(option_name)\n option_descr = get_text(option_descr)\n getter = attribute\n setter = \"#{getter}=\"\n return if options_info.is_a?(Array) && options_info.size <= 1\n @options[name] = Helper.new(type, options_info, options_text, option_name, option_descr, getter, setter)\n end",
"def configure &block\n configuration.tap { |conf| yield conf }\n end",
"def create_standard_options\n option_separator\n option_separator 'Standard options:'\n option_config_name\n option_logging\n end",
"def configure(&block)\n default_values!\n yield self\n end",
"def option(name, options = {})\n settings[name] = options[:default]\n\n class_eval <<-RUBY\n def #{name}\n settings[#{name.inspect}]\n end\n\n def #{name}=(value)\n settings[#{name.inspect}] = value\n end\n\n def #{name}?\n #{name}\n end\n RUBY\n end",
"def 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 initialize\n @option = Tools::Option.new\n end",
"def initialize(identifier, default={})\n raise(ArgumentError, \"Argument 'identifier' must be a String argument to identify the option.\") unless identifier.is_a?(String)\n raise(ArgumentError, \"Optional argument 'default' must be a Hash.\") unless default.nil? || default.is_a?(Hash)\n @identifier = identifier\n @default = Marshal.dump(default) # Allows later to create deep copies.\n @options = default\n self.update(read())\nend",
"def process_options\n \n end",
"def process_options\n \n end",
"def process_options\n \n end",
"def process_options\n \n end",
"def config_options\n {\n 'datacenter' => new_resource.datacenter,\n 'template_path' => new_resource.template_path,\n 'power_on' => true,\n 'datastore' => new_resource.datastore,\n 'wait' => true,\n 'hostname' => new_resource.hostname,\n 'name' => new_resource.name,\n 'customization_spec' => {\n 'domain' => new_resource.domain,\n 'ipsettings' => {\n 'ip' => new_resource.ip || node['vcac_vm']['ip'],\n 'gateway' => new_resource.gateway,\n 'subnetMask' => new_resource.subnet_mask,\n },\n }\n }\nend",
"def configure(options=nil, &block)\n # We don't want ancestors to be searched. This is the default in 1.8,\n # but not in 1.9, hence this hackery.\n const_args = [\"Config\"]\n const_args << false if RUBY_VERSION >= \"1.9\"\n\n # We assume that every provisioner has a `Config` class beneath\n # it for configuring.\n return if !@provisioner || [email protected]_defined?(*const_args)\n\n # Instantiate the config class and configure it\n @config = @provisioner.const_get(*const_args).new\n @config.top = top\n @config.set_options(options) if options\n block.call(@config) if block\n end",
"def options\n Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]\n end",
"def options\n Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]\n end",
"def configure(&block)\n block.call Configuration\n end",
"def configure opts\n configuration.merge!(opts)\n end",
"def options\n Hash[ *Configuration::VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]\n end",
"def option(sym, default = nil, &block)\n _defmetasyntax(\"option\", _intern(sym), block) {|target|\n seq() { default } | seq(sym)\n }\n end",
"def option(spec, has_value=false)\n # Parse the spec and check if the option has already been specified\n data = OptionData.new(spec, has_value)\n raise \"Option '#{key}' already specified\" if accepts? data.short_name\n raise \"Option '#{key}' already specified\" if accepts? data.long_name\n\n # Store the option's index and data\n @options[data.short_name] = data if !data.short_name.nil?\n @options[data.long_name] = data if !data.long_name.nil?\n end",
"def options(*args, &block)\n map_method(:options, args, &block)\n end",
"def configure\n configuration.enabled = true if configuration.enabled.nil?\n\n yield(configuration.configured_options)\n end",
"def configure(&block)\n configurator.configure(&block)\n end",
"def initialize(option=nil, params=nil)\n @option = option\n validate(@option)\n @options = YAML.load_file(\"./config/options/#{@option}.yml\")\n\n ##\n # Condition necessary for rspec tests, it was necessary not to expose sensitive data\n # \n if [\"test_xls\",\n \"test_text_size\",\n \"test_text_count\",\n \"test_params\",\n \"test_params_env\",\n \"test_query_alert\"].include?(@option)\n \n test_options = YAML.load_file(\"./config/test.yml\")\n test_database_options = test_options['database']\n test_mail_options = test_options['mail']['basic_test']\n\n @options[\"database\"] = {\n \"adapter\" => test_database_options['adapter'],\n \"host\" => test_database_options['host'],\n \"port\" => test_database_options['port'],\n \"username\" => test_database_options['username'],\n \"password\" => test_database_options['password'],\n \"database\" => test_database_options['database']\n }\n\n @options[\"email\"][\"from\"] = test_mail_options['from']\n @options[\"email\"][\"to\"] = test_mail_options['to']\n end\n\n\n @query_options = @options['query']\n @params = params\n end",
"def options(hash = {}, &block)\n # if we are passing in a hash to define our options, use that straight\n options_from_hash(hash) unless hash.empty?\n\n # Setup all instance variables\n reset! if hash.empty?\n @@args ||= ARGV\n\n # Eval the passed block to define the options.\n instance_eval(&block) if block_given?\n\n # Parse what we've got.\n parse unless parsed?\n end",
"def options\n Hash[VALID_OPTIONS.map { |key| [key, send(key)] }]\n end",
"def method_missing(sym, *args, &block)\n # Get a list of all the services (convert symbols to lower case)\n services = Trackerific.services.map { |service| service.to_s.downcase.to_sym }\n # Do not accept any configuration values for anything except services\n raise NoMethodError unless services.include? sym\n unless args.empty?\n # Only accept Hashes\n raise ArgumentError unless args[0].class == Hash\n # Validate configuration values against the required parameters for that service\n service = Trackerific.service_get(sym)\n validate_options args[0], service.required_parameters, service.valid_options\n # Store the configuration options\n @options[sym] = args[0]\n end\n # return the configuration options\n @options[sym]\n end",
"def init_config()\n options_apply_filter(\"DEFAULT\")\n end",
"def preconfigure\n yield(configuration.configured_options)\n end",
"def configure_with_block(&block)\n self.instance_eval(&block) if block_given?\n end",
"def configure_with_block(&block)\n self.instance_eval(&block) if block_given?\n end",
"def method_missing(name,*args,&block)\n options = args.extract_options!\n options.assert_valid_keys(@meta::VALID_KEYS)\n options = check_and_maintain_options(options)\n\n\t\tcheck_reserved_words(name)\n\n options[:klass] = @klass # option should know class\n options[:parent] = @parent.name.to_sym if @parent\n options[:name] = name\n \n new_meta_option = SettingsLord::MetaSetting.new(options)\n @meta_collection.add(new_meta_option)\n end",
"def configure( &block )\n @configuration = block\n end",
"def add_option name, default_value = nil\n # marks the option as accepted\n accepted_options << name\n # defines an accessor method for the option\n define_method(name) do\n if supplied.has_key?(name)\n supplied[name]\n else\n default_value\n end\n end\n end",
"def make_option_list\n end",
"def make_option_list\n end",
"def config\n options = @options.merge(:text => human_name)\n options.merge!(:menu => @menus.collect(&:config)) if @menus.size > 0\n options.merge!(:handler => \"function(){ Backend.app.load('#{url_for(@url.merge(:only_path => true))}') }\".to_l) if @url\n options\n end",
"def options\n @config[:options] ||= {}\n \n @config[:options][:order_id] = @order.id\n @config[:options].merge!(@data[:options]) if @data[:options].present?\n \n @config[:options]\n end",
"def config\n options.to_smash.deep_merge(opts.to_smash)\n end",
"def config\n options.to_smash.deep_merge(opts.to_smash)\n end",
"def configure(options)\n config_options.push(options)\n end",
"def options() end",
"def initialize *opts, &blk\n super()\n\n @advised = [ ]\n @advised_for = { }\n\n opts_hash = Hash === opts[-1] ? opts.pop : { }\n opts_key = opts.shift\n @options = opts_hash\n\n @before = (opts_key == :before ? blk : opts_hash[:before]) ||\n NULL_PROC\n @after = (opts_key == :after ? blk : opts_hash[:after]) ||\n NULL_PROC\n @around = (opts_key == :around ? blk : opts_hash[:around]) ||\n NULL_AROUND_PROC\n\n @blk = blk\n end",
"def initialize\n OPTIONS.each_pair do |key, value|\n send(\"#{key}=\", value)\n end\n end",
"def initialize options_to_parse_by_name = {},\n option_default_values = {},\n stop_on_unknown = false,\n disable_required_check = false\n @stop_on_unknown = stop_on_unknown\n @disable_required_check = disable_required_check\n\n options = options_to_parse_by_name.values\n super( options )\n\n # Add defaults\n option_default_values.each do |option_name, value|\n @assigns[ option_name.to_s ] = value\n\n @non_assigned_required.delete \\\n options_to_parse_by_name[ option_name ]\n end\n\n @shorts = {}\n @switches = {}\n @extra = []\n\n options.each do |option|\n @switches[option.switch_name] = option\n\n option.aliases.each do |short|\n name = short.to_s.sub(/^(?!\\-)/, \"-\")\n @shorts[name] ||= option.switch_name\n end\n end\n end",
"def configure(&block)\n self.instance_eval(&block) if block_given?\n end",
"def load(optparse, &block)\n return if block.nil? && !File.exists?(Config::CONFIG_FILE)\n config = @config\n config.optparse = optparse\n environment = Class.new do\n define_method(:set) { |opt,val| config.set(opt,val) }\n define_method(:use) { |plugin,*args,&b| config.use(plugin,*args,&b) }\n define_method(:before) { |*args,&block| config.before(*args,&block) }\n define_method(:after) { |*args,&block| config.after(*args,&block) }\n define_method(:tick) { |&block| config.tick(&block) }\n define_method(:option) { |sh,lo,desc,&b| config.option(sh,lo,desc,&b) }\n end.new\n\n if block # for test environment\n environment.instance_eval(&block)\n else\n environment.instance_eval(File.read(Config::CONFIG_FILE), Config::CONFIG_FILE)\n end\n end",
"def options\n Hash[\n *Configuration::VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten\n ]\n end",
"def configure!(args)\n self.class.options.each do |name, opts|\n argv = args.detect{|k,v| (Array(opts[:aliases]) + Array(opts[:short]) + [name]).include?(k.to_sym)}\n argv = argv.last if argv\n argv ||= opts[:default]\n if(argv)\n check_type!(name, argv, opts[:type])\n self.send(\"#{name}=\", argv)\n else\n if(opts[:required])\n raise ArgumentError.new \"Missing required argument: #{name}\"\n end\n end\n end\n if(ipaddress && gateway.nil?)\n self.gateway = ipaddress.sub(%r{\\d+$}, '1')\n end\n end",
"def add_options; end",
"def initialize(sym, options)\n @sym = sym\n @required = options[:required] != false\n @default = options[:default]\n @type = options[:type]\n @single = options[:single]\n @builder = options[:builder]\n @name = options[:name]\n\n if @type \n raise ConfigurationError, \"'#{sym}' requires a type: #{@type}\" unless @type.is_a?(Class)\n if [email protected]_to?(:parse)\n raise ConfigurationError, \"'#{sym}' attribute requires type '#{@type.name}' to implement 'parse'\"\n end\n end\n end",
"def treat_as_option doption\n option = nil\n valeur = nil\n if doption.start_with? '--'\n doption.gsub(/^--([^=]+)=?(.*)?$/){\n option = $1\n valeur = $2\n }\n else\n option_courte = doption[1..1]\n option = OPTION_LIST[option_courte]\n fatal_error(:unknown_option, :option => option_courte) if option.nil?\n valeur = doption[2..-1]\n end\n # Est-ce que c'est une \"option-command\"\n if OPTION_COMMAND_LIST.has_key? option\n @@command = option\n else\n @@options = @@options.merge option => valeur\n end\n end",
"def configure(&block); end",
"def configure(&block); end",
"def sort_opts!(&block)\n block ||= lambda {|option| (option.long || option.short).to_s.sub(/^-+/, '') }\n\n splits = []\n current = []\n\n options = self.options.values.uniq\n registry.each do |option|\n if options.include?(option)\n current << option\n else\n splits << current\n splits << option\n current = []\n end\n end\n\n splits << current\n @registry = splits.collect {|split| split.kind_of?(Array) ? split.sort_by(&block) : split }\n @registry.flatten!\n\n self\n end",
"def build_dict(option_specs) #:nodoc:\n @dict = {}\n keys = []\n option_specs.each do |option_spec|\n # Parse the specification\n m, label, oper, cont, arg = *option_spec.match(/([^=:]+)(?:([=:])([@])?(\\w+))?/)\n raise ParseError.new(\"invalid option format for '#{option_spec}'\") unless m\n\n # Figure out the specification type\n is_bang_arg = label.gsub!(/!$/, '')\n is_increment = label.gsub!(/\\+$/, '')\n forms = label.split('|')\n key = forms.first\n\n # Create an instance of OptionDefinition to hold metat data\n od = OptionDefinition.new(key)\n od.option_type = :boolean if is_bang_arg\n od.option_type = :increment if is_increment\n if (arg)\n od.option_type = (oper == '=') ? :required_argument : :optional_argument\n od.container_type = case cont\n when '@'; :array\n else :scalar\n end\n od.argument_type = case arg\n when 'f', 'float' ; :float\n when 'i', 'integer'; :integer\n when 's', 'string' ; :string\n else raise ParseError.new(\"unknown argument type '#{arg}'\")\n end\n end\n\n # Process alternate key names\n forms.each do |k|\n @dict[k] = od.dup\n keys << k\n end\n\n # Only support negation on long option names\n if (is_bang_arg)\n @dict[\"no-#{key}\"] = od.dup\n end\n end\n\n # Allow abbreviated long options\n keys.abbrev.each do |ab,key|\n @dict[ab] = @dict[key].dup\n @dict[ab].abbreviated = true unless (ab == key)\n end\n end",
"def define_config(tool, options={}, &block)\n tool = tool.to_s\n\n @setup ||= {}\n\n if block\n @setup[tool] = Setup.new(tool, options, &block)\n\n # REMOVED: Doing this automatically made it impossible for tools to set the profile.\n #if tool == current_tool\n # configure_tool(tool) unless autoconfig?\n #end\n end \n\n @setup[tool]\n end",
"def each_option\n @options.each {|opt_sym, opt| yield opt_sym, opt }\n end",
"def configure(&block)\n yield(configuration)\n end"
]
| [
"0.6747116",
"0.65691507",
"0.64178103",
"0.6314809",
"0.62327296",
"0.6194542",
"0.61855745",
"0.614044",
"0.61189175",
"0.60965264",
"0.60913324",
"0.60803825",
"0.60517997",
"0.6040868",
"0.60336405",
"0.6019346",
"0.60152006",
"0.60050344",
"0.6003364",
"0.60033184",
"0.5969246",
"0.5968029",
"0.596038",
"0.59423953",
"0.5941683",
"0.59368896",
"0.59300077",
"0.5929842",
"0.5916128",
"0.5890274",
"0.5872814",
"0.58717346",
"0.58656865",
"0.58621913",
"0.58283186",
"0.5826733",
"0.58192223",
"0.57931596",
"0.57818186",
"0.57675374",
"0.57413197",
"0.57361495",
"0.5735361",
"0.5722001",
"0.5695765",
"0.56810415",
"0.5678064",
"0.56739855",
"0.566102",
"0.566102",
"0.566102",
"0.56604904",
"0.56602526",
"0.5654536",
"0.56495595",
"0.56495595",
"0.564508",
"0.5639533",
"0.56357116",
"0.56355095",
"0.5619222",
"0.5618956",
"0.5616861",
"0.56159794",
"0.56108683",
"0.5610747",
"0.5602977",
"0.5589875",
"0.55891806",
"0.5581737",
"0.5581677",
"0.5581677",
"0.5573761",
"0.55714464",
"0.5571295",
"0.556182",
"0.556182",
"0.5558268",
"0.555556",
"0.55532783",
"0.55532783",
"0.5551343",
"0.55503523",
"0.5545073",
"0.5543354",
"0.55427",
"0.5539858",
"0.5538713",
"0.55358976",
"0.5511256",
"0.5510095",
"0.55089086",
"0.5501002",
"0.549983",
"0.549983",
"0.54994446",
"0.54991704",
"0.5496949",
"0.5494583",
"0.54931164"
]
| 0.6593896 | 1 |
Returns the size of the bitfield in number of bits +bitfield_max :column | def bitfield_max column_name
@@bitfields[column_name].values.sum.max
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bit_length\n @bit_length ||= ECDSA.bit_length(field.prime)\n end",
"def size\n BitCounter.count(@val)\n end",
"def bit_set_size\n @bit_set.size\n end",
"def bit_length\n (negative? ? -self : self + ONE).log2.ceil\n end",
"def column_size; end",
"def size\n (@bit_length*@length*@count)/8.0\n end",
"def byte_size()\n if @record and RECORD_INFO[@record.type].size > 0 then\n RECORD_INFO[@record.type].size * @value.length\n else\n sum = 0\n @value.each do |val|\n sum += (val.length % 2 == 0) ? val.length : val.length + 1\n end\n sum\n end\n end",
"def max_column\n @columns&.max_by(&:size)\n end",
"def col_max\n return COLUMNS_MAX\n end",
"def get_bit_length(n)\n if n == 0\n # we require no bit to store 0.\n # That is, absence of bit is considered 0.\n return 0\n else \n return 1 + get_bit_length(n >> 1)\n end\nend",
"def queens_size\n # Special case to handle a bitset of 64 bits\n if @size == 8\n bits = 0\n (@size * @size).times { |i|\n if @state[i]\n bits += 1\n end\n }\n return bits\n end\n\n return @state.cardinality\n end",
"def length_of_column n\n length_of_largest_cell_in_column n \n end",
"def field_size\n if self[:field_size] and self[:field_size] > 0\n self[:field_size]\n else\n results.size\n end\n end",
"def increment_mask_for column_name, *fields\n fields = bitfields if fields.empty?\n column = @@bitfields[column_name]\n raise ArgumentError, \"Unknown column for bitfield: #{column_name}\" if column.nil?\n fields.sum do |field_name|\n raise ArugmentError, \"Unknown field: #{field_name} for column #{column_name}\" if column[field_name].nil?\n 2 ** (bitfield_max(column_name) - column[field_name].last)\n end\n end",
"def byte_size()\n @value.length * 4\n end",
"def byte_size()\n @value.length * 4\n end",
"def size_mum_record\n 8\n end",
"def only_mask_for column_name, *fields\n fields = bitfields if fields.empty?\n column = @@bitfields[column_name]\n max = bitfield_max(column_name)\n raise ArgumentError, \"Unknown column for bitfield: #{column_name}\" if column.nil?\n\n column.sum do |field_name, range|\n fields.include?(field_name) ? range.invert(max).sum{|i| 2 ** i} : 0\n end\n \n # fields.inject(\"0\" * (bitfield_max(column_name) + 1)) do |mask, field_name|\n # raise ArugmentError, \"Unknown field: #{field_name} for column #{column_name}\" if column[field_name].nil?\n # range = column[field_name]\n # mask[range] = \"1\" * range.count\n # mask\n # end.to_i(2)\n end",
"def cols_len\n (0...column_size).collect {|j| max_len_column(j)}\n end",
"def field_size\n if self[:field_size].present? && self[:field_size] > 0\n self[:field_size]\n else\n results.size\n end\n end",
"def fbe_size\n 4\n end",
"def fbe_size\n 4\n end",
"def fbe_size\n 4\n end",
"def fbe_size\n 4\n end",
"def fbe_size\n 4\n end",
"def fbe_size\n 4\n end",
"def fbe_size\n 4\n end",
"def fbe_size\n 4\n end",
"def fbe_size\n 4\n end",
"def fbe_size\n 4\n end",
"def fbe_size\n 8\n end",
"def fbe_size\n 8\n end",
"def fbe_size\n 8\n end",
"def fbe_size\n 8\n end",
"def col_max ## Gets the max columns for other modes.\n return CP::BATTLERS.basic ? 1 : $game_party.max_battle_members\n end",
"def col_max; 1; end",
"def column_count\n @stkw_config[:max_col]\n end",
"def count_columns\n fields.size\n end",
"def getBits(binary)\n length = binary[0].length\n return length\n end",
"def num_fields\n @fields.size\n end",
"def max_field_length\n if fields.is_a? Array\n fields.map { |f| f.to_s.length }.max\n else\n fields.to_s.length\n end\n end",
"def size\n @db.get_first_value( \"SELECT COUNT(*) FROM #{TABLE_NAME};\" ).to_i\n end",
"def field_count\n @fields.length\n end",
"def column_size\n @delegate.getColSize\n end",
"def bitfields column_name\n @@bitfields[column_name].keys\n end",
"def col_max() 2 end",
"def size\n @record.send( :\"#{@column}_size\" ) rescue -1\n end",
"def field_count\n @fields.size\n end",
"def col_max\n [(self.width - padding * 2) / 96, 1].max\n end",
"def max_sql_bytesize\n @max_sql_bytesize ||= begin\n case (row = connection.query(\"SHOW VARIABLES LIKE 'max_allowed_packet'\").first)\n when Array\n row[1]\n when Hash\n row['Value']\n else\n raise \"Don't know what to do if connection.query returns a #{row.class}\"\n end.to_i\n end\n end",
"def bytesize_of(member)\n self::MEMBERS_HASH[member].size\n end",
"def current_table_size\n @table.inject(0) { |r, (k, v)| r + k.bytesize + v.bytesize + 32 }\n end",
"def get_max_field()\n 0\n end",
"def default_field_lengths\n field_lengths = @headers ? @headers.inject({}) {|h,(k,v)| h[k] = String.size(v); h} :\n @fields.inject({}) {|h,e| h[e] = 1; h }\n @rows.each do |row|\n @fields.each do |field|\n len = String.size(row[field])\n field_lengths[field] = len if len > field_lengths[field].to_i\n end\n end\n field_lengths\n end",
"def col_max\n return 3\n end",
"def col_max\n return 3\n end",
"def length\n @fields.length\n end",
"def byte_length\n @byte_length ||= ECDSA.byte_length(field.prime)\n end",
"def size\n return 0 if columns.empty?\n\n columns.first.size\n end",
"def _nbits(x)\n raise TypeError, \"The argument to _nbits should be nonnegative.\" if x < 0\n # Ruby 2.1 introduced Integer#bit_length\n return x.bit_length if x.respond_to? :bit_length\n if x <= MAXIMUM_SMALLISH_INTEGER\n return 0 if x==0\n x.to_s(2).length\n elsif x <= NBITS_LIMIT\n Math.frexp(x).last\n else\n n = 0\n while x!=0\n y = x\n x >>= NBITS_BLOCK\n n += NBITS_BLOCK\n end\n n += y.to_s(2).length - NBITS_BLOCK if y!=0\n n\n end\n end",
"def fbe_size\n 2\n end",
"def fbe_size\n 2\n end",
"def fbe_size\n 2\n end",
"def fbe_size\n 2\n end",
"def max_columns(fit = T.unsafe(nil)); end",
"def col_max() return 2 end",
"def get_max_haplotype_size\n max_haplotype = 0\n @blocks.values.each do |block|\n if block.haplotypes.length > max_haplotype\n max_haplotype = block.haplotypes.length\n end\n end\n return max_haplotype\n end",
"def table_size\n @table.size\n end",
"def table_size\n @table.size\n end",
"def size_col(col) #:nodoc:\n # Look up the cell value to see if it has been changed\n unless @col_sizes[col].nil?\n width = @col_sizes[col]\n\n # The relationship is different for user units less than 1.\n if width < 1\n return (width *12).to_i\n else\n return (width *7 +5 ).to_i\n end\n else\n return 64\n end\n end",
"def sizeBytes(value)\n checkArg value >= 0\n mval = 0x100\n cnt = 1\n while value >= mval\n cnt += 1\n mval <<= 8\n end\n cnt\n end",
"def length\n @bin_data.length\n end",
"def size\n @max\n end",
"def length_in_long_words\n return @bits.attr_length\n end",
"def num_fields\n IBM_DB.num_fields(@stmt)\n end",
"def column_size\n first_row = @rows[0]\n if first_row._equal?(nil)\n return 0\n end\n first_row.size\n end",
"def size\n Float::MAX.to_i\n end",
"def max_allowed_value(table_name, column_name)\n definition = @client.query(\"DESC `#{table_name}` `#{column_name}`\").first\n max_allowed_value_per_type(definition[\"Type\"])\n end",
"def table_size_for(entry_count); end",
"def dbsize; end",
"def dbsize; end",
"def fbe_allocation_size(value)\n fbe_size\n end",
"def fbe_allocation_size(value)\n fbe_size\n end",
"def fbe_allocation_size(value)\n fbe_size\n end",
"def fbe_allocation_size(value)\n fbe_size\n end",
"def fbe_allocation_size(value)\n fbe_size\n end",
"def fbe_allocation_size(value)\n fbe_size\n end",
"def fbe_allocation_size(value)\n fbe_size\n end",
"def fbe_allocation_size(value)\n fbe_size\n end",
"def fbe_allocation_size(value)\n fbe_size\n end",
"def fbe_allocation_size(value)\n fbe_size\n end",
"def fbe_allocation_size(value)\n fbe_size\n end",
"def fbe_allocation_size(value)\n fbe_size\n end",
"def fbe_allocation_size(value)\n fbe_size\n end",
"def fbe_allocation_size(value)\n fbe_size\n end",
"def size\n\t\t\[email protected]\n\t\tend",
"def fbe_size\n 1\n end",
"def fbe_size\n 1\n end",
"def fbe_size\n 1\n end",
"def fbe_size\n 1\n end"
]
| [
"0.71370023",
"0.6767409",
"0.6750003",
"0.6675906",
"0.6595411",
"0.64401454",
"0.6420186",
"0.6418719",
"0.63654286",
"0.6361144",
"0.63010246",
"0.62875146",
"0.6273314",
"0.6264639",
"0.6259859",
"0.6259859",
"0.62225676",
"0.62160003",
"0.62077475",
"0.6169275",
"0.6120211",
"0.6120211",
"0.6120211",
"0.6120211",
"0.6120211",
"0.6120211",
"0.6120211",
"0.6120211",
"0.6120211",
"0.6120211",
"0.6094229",
"0.6094229",
"0.6094229",
"0.6094229",
"0.60893625",
"0.6084332",
"0.60784",
"0.60693413",
"0.6068645",
"0.6056399",
"0.60256594",
"0.600744",
"0.6005963",
"0.5974764",
"0.5969035",
"0.5931609",
"0.59299135",
"0.5928998",
"0.59118557",
"0.59039414",
"0.59022516",
"0.58918107",
"0.5878344",
"0.5876205",
"0.58714914",
"0.58714914",
"0.58489937",
"0.58468413",
"0.5845136",
"0.5837611",
"0.5831589",
"0.5831589",
"0.5831589",
"0.5831589",
"0.58057916",
"0.580121",
"0.5799863",
"0.57890266",
"0.57890266",
"0.5777383",
"0.57737356",
"0.5768034",
"0.5754624",
"0.5733642",
"0.5728936",
"0.5727739",
"0.5724452",
"0.5708747",
"0.57011664",
"0.5682443",
"0.5682443",
"0.56786215",
"0.56786215",
"0.56786215",
"0.56786215",
"0.56786215",
"0.56786215",
"0.56786215",
"0.56786215",
"0.56786215",
"0.56786215",
"0.56786215",
"0.56786215",
"0.56786215",
"0.56786215",
"0.56708634",
"0.56696403",
"0.56696403",
"0.56696403",
"0.56696403"
]
| 0.8107433 | 0 |
Returns the field names for the bitfield column +bitfields | def bitfields column_name
@@bitfields[column_name].keys
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def field_names\n fields.keys\n end",
"def field_names\n @field_names ||= (columns_hash.keys.map(&:to_sym) rescue [])\n end",
"def bits_for(*field_names)\n bits = []\n \n field_names.flatten.each do |i|\n if i.is_a?(Integer)\n bits << i\n next\n end\n \n if i.respond_to?(:to_sym) and @field_list[i.to_sym]\n bits << @field_list[i.to_sym]\n end\n end\n \n bits.flatten\n end",
"def field_names\r\n return @field_names\r\n end",
"def field_names\n internal_format.keys\n end",
"def to_bitfields(lens,byte_endianness=:little_endian, bits_little_endian=false)\n fields = []\n i = to_i(byte_endianness,bits_little_endian)\n for len in lens\n mask = (1<<len)-1\n fields << (i&mask)\n i >>= len\n end\n fields\n end",
"def field_names\n @_field_path.map{ |field_| field_.name }\n end",
"def bitfield_args\n @bitfield_args ||= []\n end",
"def all_field_names\n field_set.all_field_names\n end",
"def unsigned_field_names\n @unsigned_fields.join(',')\n end",
"def fields\n klass.members.map(&:to_sym)\n end",
"def fields\n @fields.keys\n end",
"def fields\n @fields.keys\n end",
"def field_types\r\n return @field_types\r\n end",
"def field_names\n jso.field_names\n end",
"def column_names\n keys = COLUMN_NAMES\n keys.map{|key| [Person.field_name(key), key]}\n end",
"def bitfield_max column_name\n @@bitfields[column_name].values.sum.max\n end",
"def fields\n fc = FFI::MemoryPointer.new(:uint)\n rc = NWRFCLib.get_field_count(@desc, fc, @error)\n NWRFC.check_error(@error) if rc > 0\n fc = fc.read_uint\n fd = NWRFCLib::RFCFieldDesc.new\n # Make a list of field names\n fc.times.inject([]) {|array, index|\n rc = NWRFCLib.get_field_desc_by_index(@desc, index, fd.to_ptr, @error.to_ptr)\n NWRFC.check_error(@error) if rc > 0\n #@todo WARNING! our get_str method did not handle getting the name of the RESPTEXT parameter in STFC_DEEP_TABLE correctly\n # As a workaround, we use our read_string_dn method; do we need to use this elsewhere?\n #array << fd[:name].get_str.to_sym #<-The code with good intentions\n array << fd[:name].to_ptr.read_string_dn.uC.to_sym #<- Workaround; the way of the future?\n }\n end",
"def column_names\n columns.map(&:name)\n end",
"def only_mask_for column_name, *fields\n fields = bitfields if fields.empty?\n column = @@bitfields[column_name]\n max = bitfield_max(column_name)\n raise ArgumentError, \"Unknown column for bitfield: #{column_name}\" if column.nil?\n\n column.sum do |field_name, range|\n fields.include?(field_name) ? range.invert(max).sum{|i| 2 ** i} : 0\n end\n \n # fields.inject(\"0\" * (bitfield_max(column_name) + 1)) do |mask, field_name|\n # raise ArugmentError, \"Unknown field: #{field_name} for column #{column_name}\" if column[field_name].nil?\n # range = column[field_name]\n # mask[range] = \"1\" * range.count\n # mask\n # end.to_i(2)\n end",
"def fields\n column_names.map(&:to_sym)\n .reject { |c| [:id, :created_at, :updated_at].include? c }\n end",
"def query_fields\n @columns\n end",
"def column_names\n @columns.keys\n end",
"def get_binary_field(field_name)\n\t\tend",
"def fields\n FIELDS\n end",
"def keys\n fields.map { |f| f.name }\n end",
"def fields\n FIELDS\n end",
"def field_names\n attribute_names.map(&:to_sym)\n end",
"def field_names\n @field_names ||= attribute_names.map(&:to_sym)\n end",
"def columns\n @cr[2] & 0x7f\n end",
"def field_names\n (text_fields + html_fields + atom_fields + datetime_fields +\n number_fields + geo_fields).uniq\n end",
"def field_ids\n @fields.keys\n end",
"def fields\n FIELDS\n end",
"def to_s\n bits=\"\"\n @fields.each {|f| \n if f.kind_of? Fields::Field\n bits << f.bitstring\n else\n bits << f.to_bitstring\n end\n }\n [bits].pack('B*')\n end",
"def fields\r\n @hash.keys\r\n end",
"def field_names\n property_defaults.keys\n end",
"def get_fields\n FIELD_DESCS\n end",
"def field_names\n label_fields.to_h\n end",
"def readable_columns\n readable_attributes.keys\n end",
"def fields\n @field_labels.collect { |k, v| { sym: k, name: v } }\n end",
"def column_names\n klass.attributes\n end",
"def fields\n schema.fields\n end",
"def fields\n schema.fields\n end",
"def fields\n schema.fields\n end",
"def fields\n schema.fields\n end",
"def column_names(table_name)\n columns(table_name).map(&:name)\n end",
"def columns\n @columns.to_enum\n end",
"def display_fields\n database_field_names\n end",
"def serialized_columns\n serialization_map.keys\n end",
"def value_column_names\n value_columns.map(&:name)\n end",
"def facet_field_names(lens = nil)\n blacklight_config_for(lens).facet_fields.values.map(&:field)\n end",
"def get_fields\n return (\n _get_specific_action_config(:action_fields, :fields)&.map(&:to_s) ||\n self.get_model&.column_names ||\n []\n )\n end",
"def getHeaderFieldNames\n\t\tend",
"def range_for column_name, field_name\n column = @@bitfields[column_name]\n raise ArgumentError, \"Unknown column for bitfield: #{column_name}\" if column.nil?\n return column[field_name] if column[field_name]\n raise ArugmentError, \"Unknown field: #{field_name} for column #{column_name}\"\n end",
"def _field_types\n special_attribute('@fieldTypes'.freeze)\n end",
"def field_list(no_placeholder_fields: false)\n return @field_list if @field_list\n\n fields = db_columns.keys.map(&:to_s)\n\n if respond_to?(:placeholder_fields) && !no_placeholder_fields\n placeholder_fields.each do |before, placeholder|\n i = fields.index(before)\n i ||= 0\n fields.insert(i, placeholder)\n end\n end\n\n @field_list = fields.join(' ')\n end",
"def get_F32_field(field_name)\n\t\tend",
"def field_indexes\r\n return @field_indexes\r\n end",
"def bits\n self.class.bits.select { |bit, _| include? bit }.keys\n end",
"def bit_field name, width\n raise \"'bit_field' can be used only inside a 'field' block.\" if @_current_bit_fields.nil?\n \n # Register the bit field definition\n @_current_bit_fields << [name, width, bit_mask(width)]\n \n # Define the attribute accessor\n bits_attr_accessor(name)\n \n if width == 1 or name.to_s =~ /_flag$/\n # Define a question mark method if the size is 1 bit\n class_eval \"def #{name}?; self.attributes[#{name.inspect}] != 0; end\\n\", __FILE__, __LINE__\n \n # returns nil if no substitution happens...\n if flag_method_name = name.to_s.gsub!(/_flag$/, '?')\n # Define another question mark method if ends with \"_flag\"\n class_eval \"alias #{flag_method_name} #{name}?\\n\", __FILE__, __LINE__\n end\n end\n \n end",
"def bits\n self.class.bits.select { |bit, _| include? bit }.keys\n end",
"def fields()\n if !@custom_fields || @fields.length == 0 then\n @elements.each { |field|\n if field.respond_to?(:is_form_field) then\n @fields << field.name\n @element_map[field.name.to_s] = field\n elsif field.is_a?(Fieldset) then\n @fields << { field.name => field.fields }\n @element_map.update(field.element_map)\n end\n }\n end\n @fields.uniq!\n return @fields\n end",
"def column_names\n klass.new.attributes.keys\n end",
"def reset_bitfields column_name, *fields\n mask = reset_mask_for column_name, *fields\n update_all \"#{column_name} = #{column_name} & #{mask}\"\n end",
"def columns(table_name, name = nil)\n sql = <<-END_SQL\n SELECT r.rdb$field_name, r.rdb$field_source, f.rdb$field_type, f.rdb$field_sub_type,\n f.rdb$field_length, f.rdb$field_precision, f.rdb$field_scale,\n COALESCE(r.rdb$default_source, f.rdb$default_source) rdb$default_source,\n COALESCE(r.rdb$null_flag, f.rdb$null_flag) rdb$null_flag\n FROM rdb$relation_fields r\n JOIN rdb$fields f ON r.rdb$field_source = f.rdb$field_name\n WHERE r.rdb$relation_name = '#{ar_to_fb_case(table_name)}'\n ORDER BY r.rdb$field_position\n END_SQL\n select_rows(sql, name).collect do |field|\n field_values = field.collect do |value|\n case value\n when String then value.rstrip\n else value\n end\n end\n FbColumn.new(*field_values)\n end\n end",
"def getQuestionMatrixColNames(ridx)\n nmatrix = getNumQuestionMatrixConfig(ridx)\n nfields = getNumQuestionFieldConfig(ridx)\n colnames = Array.new\n if nmatrix > 0\n qrnames = getQuestionMatrixRowsConfig(ridx)\n qcnames = getQuestionMatrixColsConfig(ridx)\n cqfidx = 0\n qcnames.each do |colname|\n showcol = getQuestionMatrixColFlag(ridx,cqfidx)\n if showcol.to_s == \"1\"\n colnames << colname \n end\n cqfidx = cqfidx + 1\n end\n end\n return colnames\n end",
"def list_columns\n columns\n end",
"def writable_columns\n writable_attributes.keys\n end",
"def fields; end",
"def fields; end",
"def fields; end",
"def mailchimp_list_field_names\n config.mailchimp_list_fields.map(&:name)\n end",
"def field_names(filter = [], include_inherited = true)\n names = fields.keys\n\n if include_inherited && has_parent?\n names.concat(inherited_fields)\n end\n\n unless filter.empty?\n names = names & filter.map(&:to_sym)\n end\n\n names.sort!\n names\n end",
"def fields()\n @@defined_subclass_field_lists[self.class]\n end",
"def fields\n self.class.fields(true)\n end",
"def pack_bit_fields\n @unpacked = []\n \n self.class.fields.each_with_index do |name, position|\n \n if bit_fields = self.class.bit_fields[name]\n \n bit_value = 0\n bit_fields.each do |(bit_name, bits_number, bit_mask)|\n masked = @attributes[bit_name] & bit_mask\n \n raise ValueOverflow, \n \"the value #{@attributes[bit_name]} \"+\n \"is too big for #{bits_number} bits\" if masked != @attributes[bit_name]\n \n bit_value = bit_value << bits_number\n bit_value |= masked\n end\n \n # Value of fields composed by binary fields is always overwritten\n # by the composition of the latter\n attributes[name] = bit_value\n end\n \n @unpacked[position] = @attributes[name] || 0\n \n end\n \n @raw = @unpacked.pack( self.class.unpack_recipe )\n end",
"def columns\n @model.columns.map{|c| c.name}\n end",
"def search_facet_fields\n self.content_columns.select {|c| [:boolean,:decimal,:float,:integer,:string,:text].include?(c.type) }.map {|c| c.name }\n end",
"def fields(reload = false)\n @fields = nil if reload\n \n table_keys = tables(reload).keys.map(&:to_s)\n @fields ||= table_keys.sort.map {|key| tables[key.to_sym].fields.sort }.flatten\n \n # @fields.sort! { |a,b| (a.seq||0) <=> (b.seq||0) }\n @fields\n end",
"def string_field_names\n # database_field_names.join(', ')\n database_field_names.to_s[1...-1]\n end",
"def field_name\n @field.name\n end",
"def get_column_names(table_name)\r\n column_names = get_info(table_name, 'name')\r\n end",
"def column_names\n klass.properties.keys\n end",
"def field_names(include_hidden = false)\n # collect field names\n names = []\n hidden = no_eval_param(:hide)\n @field_names.each do |name|\n if include_hidden or not hidden.include?(name)\n names << name\n end\n end\n names\n end",
"def type_name_enum\r\n [ [ '数字字段1', 'int1' ] ,[ '数字字段2', 'int2' ] ,[ '数字字段3', 'int3' ] ,[ '数字字段4', 'int4' ],[ '数字字段5', 'int5' ],\r\n [ '文本字段1', 'text1' ],[ '文本字段2', 'text2' ],[ '文本字段3', 'text3' ],[ '文本字段4', 'text4' ],[ '文本字段5', 'text5' ],\r\n [ '文本字段6', 'text6' ],[ '文本字段7', 'text7' ],[ '文本字段8', 'text8' ],[ '文本字段9', 'text9' ],[ '文本字段10', 'text10' ]]\r\n end",
"def fields\n java_import org.dspace.content.MetadataField\n MetadataField.findAllInSchema(DSpace.context, @obj.getSchemaID)\n end",
"def types\n FIELD_TYPES\n end",
"def column_header_names\r\n column_headers.collect {|header| header.name }\r\n end",
"def fields\n @fields\n end",
"def fields\n @fields\n end",
"def all_fields\n fields.values\n end",
"def fields\n all_fields\n end",
"def field_names\n (@profile.keys - NON_PROFILE_FIELDS).sort\n end",
"def column_names\n @column_names ||= @columns.keys\n end",
"def get_field_column_name(args)\r\n #expected args => :unlimited, :field\r\n prefix = args[:unlimited] ? \"u_\" : \"l_\"\r\n field_id = \"_#{args[:field_id]}\"\r\n field_name = args[:field]\r\n column_name = \"#{prefix}#{field_name}\"\r\n checksum = \"_#{Digest::CRC16.hexdigest(field_name)}\"\r\n field_truncate_pos = @max_db_identifier_size - (prefix.size + checksum.size)\r\n if column_name.size > @max_db_identifier_size then\r\n \"#{prefix}#{field_name[0,field_truncate_pos]}#{checksum}\"\r\n else\r\n column_name\r\n end\r\n end",
"def col_names_for_insert\n self.class.fields.join(\", \")\n end",
"def column_names\n columns_in_order.map { |c| c.name }\n end",
"def columns()\n return @columns.keys\n end",
"def fields\n @fields\n end",
"def header_fields\n IO.binread(@path, HEADER_SIZE, 0).unpack(\"N5C1\")\n end"
]
| [
"0.6971322",
"0.6948479",
"0.6645891",
"0.6638981",
"0.65271646",
"0.6456592",
"0.64458656",
"0.6425023",
"0.6373594",
"0.6361138",
"0.61620855",
"0.61535007",
"0.61535007",
"0.6116174",
"0.6113793",
"0.6084116",
"0.60780674",
"0.6060987",
"0.60595375",
"0.6041304",
"0.6040349",
"0.60302526",
"0.6026706",
"0.6021114",
"0.60095584",
"0.5999604",
"0.59914917",
"0.59879565",
"0.59742105",
"0.59733206",
"0.5960434",
"0.5900978",
"0.58958495",
"0.58906555",
"0.5886657",
"0.5883321",
"0.5870467",
"0.58493555",
"0.58444196",
"0.58376664",
"0.5835814",
"0.5817562",
"0.5817562",
"0.5817562",
"0.5812159",
"0.58085996",
"0.5781173",
"0.5746773",
"0.5744368",
"0.5728399",
"0.57280976",
"0.57261866",
"0.5724481",
"0.571842",
"0.57142365",
"0.57124686",
"0.57099116",
"0.56666106",
"0.56658417",
"0.56653273",
"0.56606996",
"0.5654337",
"0.565428",
"0.564824",
"0.564276",
"0.56386924",
"0.5638541",
"0.5625685",
"0.56230426",
"0.56230426",
"0.56230426",
"0.56229377",
"0.56221384",
"0.5620192",
"0.56192034",
"0.5617958",
"0.56124306",
"0.560751",
"0.5604263",
"0.55994886",
"0.5599153",
"0.557442",
"0.5570633",
"0.55667937",
"0.55646193",
"0.5557471",
"0.5557267",
"0.55549043",
"0.55544204",
"0.55544204",
"0.55494106",
"0.55457455",
"0.5542542",
"0.55417466",
"0.5527092",
"0.5521469",
"0.5518938",
"0.55097175",
"0.55096555",
"0.5508211"
]
| 0.8190619 | 0 |
Returns the column by name +column_for | def range_for column_name, field_name
column = @@bitfields[column_name]
raise ArgumentError, "Unknown column for bitfield: #{column_name}" if column.nil?
return column[field_name] if column[field_name]
raise ArugmentError, "Unknown field: #{field_name} for column #{column_name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column_for(col_name)\n relation.column_names.detect { |col| col == col_name }\n end",
"def column(name)\n @name_to_columns[name]\n end",
"def column_for_attribute(name)\n self.class.columns_hash[name.to_s]\n end",
"def column_for_attribute(name)\n self.class.columns_hash[name]\n end",
"def column(column_name)\n @columns.detect {|f| f.name == column_name.to_s}\n end",
"def column_for_attribute(name)\n name = name.to_sym\n return self.faux_columns[name] if self.faux_columns.has_key?(name)\n super\n end",
"def column_by_name(name)\n self.class.find_column_by_name(columns_array, name)\n end",
"def column_for(method) #:nodoc:\n @object.column_for_attribute(method) if @object.respond_to?(:column_for_attribute)\n end",
"def column_for(method) #:nodoc:\n @object.column_for_attribute(method) if @object.respond_to?(:column_for_attribute)\n end",
"def col(name)\n query_table[name.to_s]\n end",
"def col(name)\n query_table[name.to_s]\n end",
"def column_by_name(name)\n find_column_by_name(columns_array, name)\n end",
"def column_name\n ensure_setup!\n column.name.to_sym\n end",
"def find_column(name)\n columns.detect { |column| column.name.to_sym == name.to_sym }\n end",
"def column(id)\n @columns[id]\n end",
"def column_for(name, &block)\n column = columns[name]\n column.config(&block) if column && block_given?\n\n column\n end",
"def column_named(name) #nodoc\n @_column_hashes[name.to_sym]\n end",
"def fe_for(column_name)\n col = @model.column_for_attribute(column_name)\n fe(col.type, col.name)\n end",
"def column_name\n name.to_sym\n end",
"def column(column)\n Column.new(@data, column)\n end",
"def get_column(name, locale)\n column_data(name)[locale] if column_data(name).present?\n end",
"def column\n @__col\n end",
"def column(index)\n columns[index]\n end",
"def column_name(index)\n \"Column #{index}\"\n end",
"def column_name; end",
"def column(index)\n @columns[index]\n end",
"def [](name)\n return self.column(name)\n end",
"def column_for_attribute(name)\n if self.class._has_virtual_column?(name)\n return VirtualColumnWrapper.new(singleton_class._virtual_column(name))\n else\n super\n end\n end",
"def column_for_field_index(index)\n column(column_index_for_field_index(index))\n end",
"def find_column(column_name)\n return create_temporary_fake_column(column_name) if (! @model_class.table_exists?)\n out = model_class.columns.detect { |c| c.name.to_s == column_name.to_s }\n return create_temporary_fake_column(column_name) if (! out)\n\n unless is_acceptable_column_type?(out)\n raise FlexColumns::Errors::InvalidColumnTypeError, %{You're trying to define a flex column #{column_name.inspect}, but\nthat column (on model #{model_class.name}) isn't of a type that accepts text.\nThat column is of type: #{out.type.inspect}.}\n end\n\n out\n end",
"def column\n Column.where(id: object.column_id)[0]\n end",
"def column( index )\n Column.new( self, col_letter( index ) )\n end",
"def column(index)\n end",
"def chooseColumn\n @metadata.chooseColumn\n end",
"def column attribute_name, opts = {}\n klass = opts[:class] || @default_opts[:class] || nil\n raise ArgumentError, 'You must specify a :class option, either explicitly, or using with_opts' if klass.nil?\n\n source_attribute = (opts[:from] || attribute_name).to_s\n\n define_method attribute_name do\n serialized_attrib_names = klass.columns.select {|c| c.cast_type.is_a?(ActiveRecord::Type::Serialized) }.map {|c| c.name.to_s }\n if serialized_attrib_names.include?(source_attribute.to_s)\n return YAML.load(@raw_attributes[attribute_name.to_s])\n end\n\n val = klass.columns_hash[source_attribute].type_cast_from_database(@raw_attributes[attribute_name.to_s])\n\n if val.is_a?(Time) && Time.respond_to?(:zone) && Time.zone.respond_to?(:utc_offset)\n # Adjust UTC times to rails timezone\n val.localtime(Time.zone.utc_offset)\n end\n\n return val\n end\n\n # bit mucky, a lot here that feels like it should be a little method of its own\n select_column = \"#{klass.table_name}.#{source_attribute}\"\n select_column += \" as #{attribute_name}\" if opts[:from]\n (@sql_select_columns ||= []) << select_column\n end",
"def column_for_position(position); end",
"def column_for_position(position); end",
"def column_for_position(position); end",
"def column; end",
"def column; end",
"def column; end",
"def column; end",
"def column; end",
"def column; end",
"def column; end",
"def getCol\n return @col\n end",
"def column(options = {})\n options = normalize_options(options) \n return \"\" if @column == \"\"\n @column =~ /(.*\\.)?(.*)/\n if (table_class = options[:table_class])\n\t\"#{table_class.table.table_name}.`#{$2}`\"\n else\n\t\"#{$1}`#{$2}`\"\n end\n end",
"def column_by_header( header )\n header.is_a?( Column ) ? header : Column.new( self, data.colref_by_header( header ) )\n end",
"def geometry_column_by_name(name); end",
"def column(name)\n id = name.is_a?(Symbol) ? name : name.to_sym\n column = @rows.map{|row| row[id]}\n return Series.new(name, column)\n end",
"def find_column(name, options = {})\n options = normalize_options(options)\n return nil unless (table_class = options[:table_class])\n \n name =~ /(.*\\.)?(.*)/\n return nil if \n\t$1 != nil and \n\t$1 != table_class.table.table_name\n \n for col in table_class.table.columns\n\treturn col if col.name == $2 \t\n end\n return nil\n end",
"def [](name)\n @columns_hash[name.to_s]\n end",
"def dig_column(klass, name_or_segments)\n segments = name_or_segments.is_a?(Array) ? name_or_segments : name_or_segments.to_s.split(\".\")\n column_name = segments.shift\n if( segments.empty? )\n return klass.columns_hash[column_name]\n else\n reflection = klass.reflect_on_association(column_name.to_sym)\n raise \"Can't find reflection for: #{klass}.#{column_name}\" unless reflection\n raise \"Can't fetch column from has_many association: #{klass}.#{column_name}\" if reflection.macro == :has_many\n return dig_column(reflection.klass, segments)\n end\n end",
"def [](column_name)\n @metadata[column_name]\n end",
"def [](column_name)\n @metadata[column_name]\n end",
"def [](column_name)\n @metadata[column_name]\n end",
"def column(index)\n index = case index\n when String\n @headers.index(index)\n when Symbol\n @headers.index(index.to_s)\n else\n index\n end\n\n columns[index] if index\n end",
"def column_value(key)\n # ensure the requested column is in the table\n column_detail(key)\n @column_values[key.to_s.upcase]\n end",
"def column(key)\n columns.detect { |c| c.header == key.as_sym }\n end",
"def column_data(column)\n attributes[column.to_s]\n end",
"def column_info(method)\n column = @object.column_for_attribute(method) if @object.respond_to?(:column_for_attribute)\n \n # translated attributes dont have a column info at this point\n # check the associated translation class\n if not column\n tx_info = translation_info(method)\n if tx_info\n column = tx_info[:column]\n end\n end\n \n column\n end",
"def column(name, *args)\n define_method name do\n instance_variable_get(\"@_#{name}\")\n end\n define_method \"#{name}=\" do |val|\n instance_variable_set(\"@_#{name}\", val)\n end\n self.columns = columns.concat([[name].concat(args)])\n end",
"def col(num)\n namespace + '_col_' + num.to_s\n end",
"def column_name\n Name.new(\"#{name}_id\")\n end",
"def column_for_attribute(attr)\n FauxColumnInfo.new(self.class.types[attr])\n end",
"def column?(column_name)\n self.class.column?(column_name.to_sym)\n end",
"def [](name)\n key = name.to_s\n if attributes.key?(key)\n attributes[key]\n elsif index = underscored_column_names.index(key)\n attributes[@columns[index].name]\n end\n end",
"def my_column_name\n return @my_column_name if defined? @my_column_name\n if is_sq?\n @my_column_name = \"#{lime_group.sid}X#{gid}X#{parent_qid}#{title}\"\n else\n @my_column_name = \"#{lime_group.sid}X#{gid}X#{qid}\"\n end\n return @my_column_name\n end",
"def column_name\n return 'json_scrape' if invalid_param('column_name')\n\n @params['column_name']\n end",
"def column\n \"#{table_name}.#{friendly_id_config.cache_column}\"\n end",
"def col_name(col)\n [@_table_name, col.name].join('.')\n end",
"def get_column_for(tag_name, subfield_name)\n if options_config.include?(tag_name) and options_config[tag_name].include?(\"layout\")\n f = options_config[tag_name][\"layout\"][\"fields\"].assoc(subfield_name)\n return f if f\n end\n return [subfield_name, {\"cols\" => 1}]\n end",
"def real_column; end",
"def column name\n @conditions << Condition.new(name)\n @conditions.last\n end",
"def column(column_name, options={})\n columns_object.merge(column_name.to_sym => options)\n end",
"def find_column(column, columns=self.columns, create_dimpaths_from=nil)\n case column\n when Query::Column\n column if columns.include?(column)\n when Array\n if create_dimpaths_from\n Query::Column::DimensionPath.new(create_dimpaths_from, column)\n else\n columns.find {|col| col.is_a?(Query::Column::DimensionPath) && col.names == column}\n end\n else\n columns.find {|col| col.to_s == column.to_s}\n end\n end",
"def col_by_id(id, raise_on_nil = false)\n c = @columns_hash[id.to_s]\n raise \"Column ID `#{id}` was requested, however it was not defined by method 'columns'\" if raise_on_nil and c.nil?\n return c\n end",
"def column_as(col) #nodoc\n _col = column(col)\n _column_hashes.values.find{ |c| c.as == _col.name }\n end",
"def get_column(ordinal_number, split = true)\n column = @columns[ordinal_number.to_i]\n if split\n column = column.split \".\"\n column[0]\n else\n column\n end\n end",
"def column_name(column)\n tmp = ''\n column.name.gsub(/_/, ' ').gsub(/id/,\"\").split.each{|word| tmp += word.capitalize + ' '}\n return tmp\n end",
"def column(name, query = nil, **options, &block)\n self.class.define_column(columns_array, name, query, **options, &block)\n end",
"def column(*args,&block)\n columns.column(*args, &block)\n end",
"def gtfs_col_for_attr(model_attr)\n @@gtfs_cols[self][model_attr]\n end",
"def column_value\n row.fetch(column){row[@column.to_s]}\n end",
"def column\n cast_type = ActiveRecord::Base.connection.send(:lookup_cast_type, definition)\n metadata = ActiveRecord::ConnectionAdapters::SqlTypeMetadata.new(\n type: cast_type.type,\n sql_type: definition,\n limit: cast_type.limit\n )\n mysql_metadata = ActiveRecord::ConnectionAdapters::MySQL::TypeMetadata.new(metadata)\n @column ||= self.class.column_factory.new(\n name,\n default_value,\n mysql_metadata,\n null_value\n )\n end",
"def column(index)\n column_indexes(index).map do |e|\n @input[e]\n end\n end",
"def [](column)\n @attributes[column]\n end",
"def column(name, query = nil, **options, &block)\n define_column(columns_array, name, query, **options, &block)\n end",
"def column(column_number, get_by = :copy)\n rank(1, column_number, get_by)\n end",
"def get_column_name(type,index)\n\t\tcase type\n\t\t\twhen 'day'\n\t\t\t\tget_from_date(type,index)\n\t\t\twhen 'week'\n\t\t\t\tget_from_date(type,index)+\" - \"+get_to_date(type,index)\n\t\t\twhen 'month'\n\t\t\t\tdate = Date.today+index.month\n\t\t\t\tl(:\"cpm.months.#{date.strftime('%B')}\")+\" \"+date.strftime('%Y')\n\t\tend\n\tend",
"def column?(col)\n self.class.column?(col)\n end",
"def column(name, type)\n @fields.merge!(name => type.to_s)\n end",
"def column(column_number, get_by = :copy)\n unless [:copy, :reference].include?(get_by)\n raise ArgumentError, \"column() 2nd parameter must be :copy or :reference\"\n end\n \n if get_by == :copy\n self.slice(0 ... self.shape[0], column_number)\n else # by reference\n self[0 ... self.shape[0], column_number]\n end\n end",
"def column(name, *args)\n if relation = args.detect {|arg| arg.is_a? Arel::Relation}\n args.delete(relation)\n args.map! {|arg| arg.is_a?(Arel::Attribute) ? relation[arg] : arg}\n end\n args.push(arel_table[name]) unless args.any? {|arg| arg.is_a? Arel::Attribute}\n report_columns[name.to_sym] = Reportkit::ColumnDefinition.new(name, *args.compact)\n end",
"def find_column_and_table(path, base)\n if path.length > 1\n find_column_and_table(path[1..-1], base.reflect_on_association(path.first.to_sym).class_name.constantize)\n else\n [base.columns_hash[path.first.to_s], base]\n end\n end",
"def autoreport_column(column)\n return if column.name == 'id'\n belongs_to_ref = klass.reflections.find { |_, a| a.foreign_key == column.name }\n if belongs_to_ref\n name, ref = belongs_to_ref\n name_col = (ref.klass.column_names & autoreport_association_name_columns(ref)).first\n if name_col\n name_expr = \"#{ref.klass.table_name}.#{name_col}\"\n category_dimension name, expression: name_expr, relation: ->(r) { r.joins(name) }\n else\n category_dimension column.name\n end\n elsif column.cast_type.type == :datetime\n time_dimension column.name\n elsif column.cast_type.number?\n number_dimension column.name\n else\n category_dimension column.name\n end\n end",
"def get_column(col_num)\n column = []\n @grid.each do |row|\n column << row[col_num]\n end\n column\n end",
"def quote_column_name(name) #:nodoc:\r\n %Q(\"#{name}\")\r\n end",
"def cell_column(row, column, reader = true)\n return \"r#{row}_c#{column}\" if reader\n\n \"r#{row}_c#{column}=\"\n end",
"def get_col_from_index(idx)\n idx%cols\n end",
"def column(column)\n Cell.new(@data, @row, column)\n end"
]
| [
"0.80981773",
"0.7893585",
"0.77641433",
"0.76494175",
"0.75689787",
"0.7542143",
"0.73651725",
"0.73638535",
"0.73638535",
"0.7333518",
"0.7333518",
"0.72934926",
"0.7252329",
"0.72387636",
"0.7210727",
"0.71819156",
"0.7118217",
"0.7116076",
"0.7039199",
"0.6917202",
"0.68800205",
"0.6869546",
"0.6859114",
"0.68143404",
"0.6779657",
"0.675172",
"0.67302275",
"0.6696523",
"0.66526484",
"0.6622641",
"0.66220254",
"0.65987766",
"0.6559598",
"0.6549283",
"0.6537336",
"0.65144014",
"0.65144014",
"0.65144014",
"0.651341",
"0.651341",
"0.651341",
"0.651341",
"0.651341",
"0.651341",
"0.651341",
"0.64951843",
"0.6451609",
"0.6436137",
"0.6431465",
"0.64314324",
"0.642892",
"0.6428325",
"0.6393089",
"0.6388389",
"0.6388389",
"0.6388389",
"0.6381424",
"0.6375312",
"0.63623345",
"0.63592106",
"0.63567245",
"0.6354037",
"0.6352874",
"0.6344434",
"0.63329077",
"0.6326403",
"0.63251853",
"0.632379",
"0.6323597",
"0.63221306",
"0.63012916",
"0.6281069",
"0.6256544",
"0.6251907",
"0.6231109",
"0.6228504",
"0.6228423",
"0.6225008",
"0.6219268",
"0.6203702",
"0.6201058",
"0.6187249",
"0.61711127",
"0.6164664",
"0.6144094",
"0.61290634",
"0.6086155",
"0.6047438",
"0.6035676",
"0.60238916",
"0.60229516",
"0.6019055",
"0.60134834",
"0.60079294",
"0.6004877",
"0.599108",
"0.5982259",
"0.5976711",
"0.59752834",
"0.597205",
"0.59611875"
]
| 0.0 | -1 |
Returns a "reset mask" for a list of fields +reset_mask_for :fields | def reset_mask_for column_name, *fields
fields = bitfields if fields.empty?
max = bitfield_max(column_name)
(0..max).sum{|i| 2 ** i} - only_mask_for(column_name, *fields)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mask\n (@bound_fields + @unbound_fields + @operands).map do |(field,_)|\n WordField[field].mask\n end.inject do |memo,field_mask|\n memo | field_mask\n end\n end",
"def reset_bitfields column_name, *fields\n mask = reset_mask_for column_name, *fields\n update_all \"#{column_name} = #{column_name} & #{mask}\"\n end",
"def reset_fields\n each_field_name do |key|\n reset_field(key)\n end\n end",
"def reset_fields\n if self.is_default?\n self.applies_to_all = true\n self.codes = []\n elsif self.applies_to_all?\n self.codes = []\n end\n\n return true\n end",
"def remove_all_dismantle_masks\n groups = [$data_items, $data_armors, $data_weapons]\n for group in groups\n for obj in group\n next if obj.nil?\n obj.set_dismantle_mask_flags(true)\n end # for\n end # for\n end",
"def get_property_update_masks_groups(properties, mask_prefix: '')\n mask_groups = []\n properties.each do |prop|\n if prop.flatten_object\n mask_groups += get_property_update_masks_groups(\n prop.properties, mask_prefix: \"#{prop.api_name}.\"\n )\n elsif prop.update_mask_fields\n mask_groups << [prop.name.underscore, prop.update_mask_fields]\n else\n mask_groups << [prop.name.underscore, [mask_prefix + prop.api_name]]\n end\n end\n mask_groups\n end",
"def mask_array\n @mask.split('')\n end",
"def mask(*args)\n flags = self.flags\n \n args.inject(0) do |n, name|\n n += flags[name.to_s]\n end\n end",
"def clear_fields\n\t\tend",
"def unset_mask\n @masking_key = nil\n end",
"def unset_mask\n @masking_key = nil\n end",
"def only_mask_for column_name, *fields\n fields = bitfields if fields.empty?\n column = @@bitfields[column_name]\n max = bitfield_max(column_name)\n raise ArgumentError, \"Unknown column for bitfield: #{column_name}\" if column.nil?\n\n column.sum do |field_name, range|\n fields.include?(field_name) ? range.invert(max).sum{|i| 2 ** i} : 0\n end\n \n # fields.inject(\"0\" * (bitfield_max(column_name) + 1)) do |mask, field_name|\n # raise ArugmentError, \"Unknown field: #{field_name} for column #{column_name}\" if column[field_name].nil?\n # range = column[field_name]\n # mask[range] = \"1\" * range.count\n # mask\n # end.to_i(2)\n end",
"def off!(indexes)\n Array(indexes).each do |index|\n validate_index(index)\n @bits &= ~(1 << index)\n end\n end",
"def gen_float_masks(m)\n\n bm = []\n base_and = m.gsub(/0/, \"1\")\n base_or = m.gsub(/0/, \"0\")\n\n nx = m.count(\"X\")\n nm = 2**nx\n nm.times do |i|\n bi = i.to_bin_s(nx)\n a = base_and.clone\n o = base_or.clone\n nx.times do |j|\n a.sub!(\"X\", bi[j])\n o.sub!(\"X\", bi[j])\n end\n bm << [\n a.to_i(2),\n o.to_i(2),\n ]\n end\n bm\n end",
"def read_mask=(arr) # :nodoc:\n @read_mask = transform_fields('read_mask',arr)\n end",
"def reset_available_custom_fields\n Project.reset_available_custom_fields\n end",
"def calc_date_mask(field_name)\n if params[:product][:\"#{field_name}(2i)\"] == '' and params[:product][:\"#{field_name}(3i)\"] != ''\n return\n elsif params[:product][:\"#{field_name}(2i)\"] == ''\n params[:product][:\"#{field_name}(2i)\"] = '1'\n params[:product][:\"#{field_name}(3i)\"] = '1'\n params[:product][:\"#{field_name}_mask\"] = :year\n elsif params[:product][:\"#{field_name}(3i)\"] == ''\n params[:product][:\"#{field_name}(3i)\"] = '1'\n params[:product][:\"#{field_name}_mask\"] = :year_month\n else\n params[:product][:\"#{field_name}_mask\"] = :year_month_day\n end\n end",
"def add_mask(mod)\n\n unless const_defined? \"MASKS\"\n const_set(\"MASKS\",Hash.new)\n end\n\n unless const_defined? \"MASK_INFO\"\n const_set(\"MASK_INFO\",Hash.new)\n end\n\n unless const_defined? \"Masked\"\n const_set(\"Masked\",Module.new)\n end\n\n tmod = mod.name.gsub(\"::\",\"_\")\n\n cln = mod.clone\n\n self::Masked.const_set(tmod,cln)\n\n trans = []\n\n cln.instance_methods(false).each do |m|\n meth = m.to_sym\n masked_name = \"__#{tmod}_#{(mod.object_id + cln.object_id).abs}_#{m}\".to_sym\n\n self::MASK_INFO[masked_name] = mod\n\n trans << [meth, masked_name]\n\n cln.module_eval <<-CODE\n alias #{masked_name} #{meth}\n remove_method(:#{meth})\n CODE\n end\n\n module_eval { include cln }\n\n trans.each do |t|\n name, meth = t[0], t[1]\n\n cln_method = cln.instance_method(meth)\n self::MASK_INFO[cln_method] = self::MASK_INFO[meth]\n self::MASK_INFO.delete meth\n\n cln.module_eval \"remove_method :#{meth}\"\n\n if self::MASKS.key? name\n self::MASKS[name].unshift cln_method\n else\n original_method = instance_method(name)\n self::MASKS[name] = [cln_method, original_method]\n self::MASK_INFO[original_method] = self\n\n module_eval(<<-CODE,\"maskable.rb\",70)\n if instance_methods.include? \"#{name}\"\n remove_method :#{name}\n end\n\n def #{name}(*a,&b)\n mk = Method::Mask.new(:#{name}, self, \n self.class::MASKS[:#{name}], a, b)\n if Thread.current['__running_mask']\n Thread.current['__running_mask'] << mk\n else\n Thread.current['__running_mask'] = [mk]\n end\n \n return Method.rest\n ensure\n if Thread.current['__running_mask'].size == 1\n Thread.current['__running_mask'] = []\n else\n Thread.current['__running_mask'].pop\n end\n end\n\n CODE\n end\n end\n end",
"def set_mask\n @mask = Mask.find(params[:id])\n end",
"def fields!(fields = nil)\n mutate(:fields, fields)\n end",
"def set_mandatory_list_mode\n self['mask'] |= Mask.name_values[:list]\n @attributes_cache.delete('mask')\n end",
"def resets\n @resets ||= buttons.select { |f| f.class == Reset }\n end",
"def reset_all\n yield self if block_given?\n http.post('/__admin/reset', '')\n end",
"def mask(payload, mask)\n return mask_native(payload, mask) if respond_to?(:mask_native)\n result = []\n payload.each_with_index do |byte, i|\n result[i] = byte ^ mask[i % 4]\n end\n result\n end",
"def set_mask(opts)\n opts = check_params(opts,[:masks])\n super(opts)\n end",
"def instead_of(*field_names)\n [].tap do |list|\n none_num = any_of_number(*field_names)\n self.each_value { |num| list << num if (num & none_num) != none_num }\n end\n end",
"def index\n @masks = Mask.all\n end",
"def write_mask=(arr) # :nodoc:\n @write_mask = transform_fields('write_mask',arr)\n end",
"def reset_default_fields\n self.cleared_default_fields.each do |k, v|\n self.send(\"#{k}=\", v)\n end\n end",
"def option_to_mask(options, all_options)\n mask = 0\n options.each do |key|\n if all_options.keys.include?(key)\n mask = mask | all_options[key]\n else\n raise \"option not supported: #{key}. must be one of: #{all_options.keys}\"\n end\n end\n mask\n end",
"def get_mask(groups)\n mask = 0\n groups.split.each do |i|\n selected = @friendgroups.find { |g| g['name'] == i}\n if selected.nil?\n raise LjException.new(LJERR_BAD_FGROUP,\"Invalid friends group '#{i}'\")\n else\n mask += 2 ** selected['id']\n end\n end\n return mask\n end",
"def set_dismantle_mask_flags(flag = true)\n return unless self.is_a?(RPG::Item) || self.is_a?(RPG::EquipItem)\n @dismantle_items.each do |obj| obj.mask = flag end\n end",
"def object_mask(*args)\n proxy = APIParameterFilter.new(self)\n return proxy.object_mask(*args)\n end",
"def mask\n super\n end",
"def clear\n @field.each_index { |i| @field[i] = 0 }\n end",
"def object_mask(*args)\n raise ArgumentError, \"object_mask expects object mask strings\" if args.empty? || (1 == args.count && !args[0])\n raise ArgumentError, \"object_mask expects strings\" if args.find{ |arg| !arg.kind_of?(String) }\n\n mask_parser = ObjectMaskParser.new()\n object_masks = args.collect { |mask_string| mask_parser.parse(mask_string)}.flatten\n object_mask = (@parameters[:object_mask] || []) + object_masks\n\n # we create a new object in case the user wants to store off the\n # filter chain and reuse it later\n APIParameterFilter.new(self.target, @parameters.merge({ :object_mask => object_mask }));\n end",
"def revert_fields(*names)\n names = changed if names.empty?\n reverted = []\n names.each do |name|\n if self.respond_to? \"#{name}_change\"\n values = self.__send__ \"#{name}_change\"\n if values\n self.__send__ \"#{name}=\", values.first\n reverted << name\n end\n end\n end\n\n reverted\n end",
"def remove_dismantle_mask(key, id)\n case key\n when :item\n $data_items[id].set_dismantle_mask_flags(true)\n when :armor\n $data_armors[id].set_dismantle_mask_flags(true)\n when :weapon\n $data_weapons[id].set_dismantle_mask_flags(true)\n end\n end",
"def reform_select_from_fields(table_fields)\n # if we're asking for * then ignore all other individual fields\n table_fields.each do |tf|\n if tf[1] == '*'\n table_fields.delete_if {|k| k[0] == tf[0] && k[1] != '*'}\n end\n end\n \n # re-form the select with the remainder\n new_select_fields = []\n table_fields.each do |tf|\n new_tf = \"`#{tf[0]}`.\"\n new_tf += (tf[1] == '*') ? \"*\" : \"`#{tf[1]}`\"\n \n # tf[2] is the fourth option, aggregate functions\n # eg: ['users', 'username', ' as login_name', 'count'] => count(`users`.`username`) as login_name\n new_tf = tf[3] + \"(#{new_tf})\" unless tf[3].blank?\n \n # tf[2] is the third option, as\n # eg: ['users', 'username', ' as login_name'] => `users`.`username` as login_name\n new_tf += tf[2] unless tf[2].blank?\n new_select_fields << new_tf\n end\n \n # return nil instead of empty array\n return nil if new_select_fields.blank?\n new_select_fields.join(\",\")\n end",
"def reset_cleared_default_fields\n @cleared_default_fields = {}\n end",
"def controlfields\n cf = []\n org_codes = %w(NNU-TL NNU-F NyNyUA NyNyUAD NyNyUCH NBPol NyBlHS NHi)\n org_code = get_repo_org_code\n cf << add_003_tag(org_code) if org_codes.include?(org_code)\n cf << add_005_tag\n @record.controlfields = cf\n end",
"def get_rid_of(*objs)\n objs.each { |obj| obj.keep = false }\n end",
"def null_controlled_fields!(attrs)\n ::ScoobySnacks::METADATA_SCHEMA.controlled_field_names.each do |field_name|\n # do not null fields that are not being changed\n next unless attrs.keys.include?(\"#{field_name}_attributes\")\n\n object.public_send(\"#{field_name}=\", [])\n end\n end",
"def unset(*args)\n fields = args.map { |a| a.is_a?(Hash) ? a.keys : a }\n .__find_args__\n .map { |f| [database_field_name(f), true] }\n view.update_many(\"$unset\" => Hash[fields])\n end",
"def custom_fields_safe_setters\n custom_fields_recipe['rules'].map do |rule|\n case rule['type'].to_sym\n when :date, :date_time, :money then \"formatted_#{rule['name']}\"\n when :file then [rule['name'], \"remove_#{rule['name']}\", \"remote_#{rule['name']}_url\"]\n when :select, :belongs_to then [\"#{rule['name']}_id\", \"position_in_#{rule['name']}\"]\n when :has_many, :many_to_many then nil\n else\n rule['name']\n end\n end.compact.flatten\n end",
"def server_object_mask\n if parameters[:object_mask] && !parameters[:object_mask].empty?\n\n # Reduce the masks found in this object to a minimal set\n #\n # If you pass the API a mask that asks for the same property twice (within\n # the same type scope), the API treats it as an error (and throws an exception)\n #\n # We get around that by parsing the various masks that have been given to us\n # merging their properties where possible, thereby removing the duplicates\n # from the mask that actually gets passed to the server. As a side benefit,\n # the mask we send to the server will be streamlined; without too many extraneous\n # characters\n reduced_masks = parameters[:object_mask].inject([]) do |merged_masks, object_mask|\n mergeable_mask = merged_masks.find { |mask| mask.can_merge_with? object_mask }\n if mergeable_mask\n mergeable_mask.merge object_mask\n else\n merged_masks.push object_mask\n end\n\n merged_masks\n end\n\n if reduced_masks.count == 1\n reduced_masks[0].to_s\n else\n \"[#{reduced_masks.collect{|mask| mask.to_s}.join(',')}]\"\n end\n else\n nil\n end\n end",
"def show_masks\n ret = Hash.new\n self::MASKS.each do |meth,mask|\n ret[meth] = mask.map { |m| self::MASK_INFO[m] }\n end\n ret\n end",
"def nested_reset\n all = %w(\n a\n abbr\n acronym\n address\n applet\n article\n aside\n audio\n b\n big\n blockquote\n canvas\n caption\n center\n cite\n code\n dd\n del\n details\n dfn\n div\n dl\n dt\n em\n embed\n fieldset\n figcaption\n figure\n footer\n form\n h1\n h2\n h3\n h4\n h5\n h6\n header\n hgroup\n i\n iframe\n img\n ins\n kbd\n label\n legend\n li\n mark\n menu\n nav\n object\n ol\n output\n p\n pre\n q\n ruby\n s\n samp\n section\n small\n span\n strike\n strong\n sub\n summary\n sup\n table\n tbody\n td\n tfoot\n th\n thead\n time\n tr\n tt\n u\n ul\n var\n video\n )\n\n _(all) {\n reset_box_model\n reset_font\n }\n _ ['table'] {\n reset_table\n }\n _ ['caption', 'th', 'td'] {\n reset_table_cell\n }\n _ ['q', 'blockquote'] {\n reset_quotation\n }\n _ ['a'] {\n _ ['img'] {\n reset_image_anchor_border\n }\n }\n end",
"def maskhash\n return @maskhash\n end",
"def masked_val(value, mask)\n \nend",
"def none_of(*field_names)\n [].tap do |list|\n lack_num = any_of_number(*field_names)\n self.each_value { |num| list << num if (num & lack_num) == 0 }\n end\n end",
"def fieldsets\n @fieldsets ||= mount_tables_for_fieldsets\n @fieldsets\n end",
"def field_groups\n @field_groups ||= begin\n field_group_indexes.map do |e|\n e.map do |e|\n @input[e]\n end\n end\n end\n end",
"def masked(mask_image)\n mask_image = mask_image.CGImage\n\n width = CGImageGetWidth(mask_image)\n height = CGImageGetHeight(mask_image)\n component_bits = CGImageGetBitsPerComponent(mask_image)\n pixel_bits = CGImageGetBitsPerPixel(mask_image)\n row_bytes = CGImageGetBytesPerRow(mask_image)\n data_provider = CGImageGetDataProvider(mask_image)\n\n mask = CGImageMaskCreate(width, height, component_bits,\n pixel_bits, row_bytes, data_provider,nil, false)\n\n masked = CGImageCreateWithMask(self.CGImage, mask)\n UIImage.imageWithCGImage(masked, scale:self.scale, orientation:self.imageOrientation)\n end",
"def fields_not_to_clean\n ['deleted_record','record_before','record_after']\n end",
"def mask(type = MASK_IP)\n case :type\n when MASK_IP\n return @mask_ip\n when MASK_HEX\n return @mask_hex\n else\n return @mask_cidr\n end\n end",
"def fix_fields(c)\n MegaBar::TmpFieldDisplay.where(field_id: c[:tmp].id).update_all(field_id: c[:perm].id)\n MegaBar::TmpOption.where(field_id: c[:tmp].id).update_all(field_id: c[:perm].id)\n end",
"def mask_params\n params.require(:mask).permit(:phone_number, :number_id)\n end",
"def remove_fields_by_uids(uids)\n @fields.reject! {|field| !uids.include?(field.uid)}\n end",
"def clear\n @@fields.each do |field|\n self.instance_variable_set(\"@\"+field.to_s,nil)\n end\n end",
"def masked_mappings\n @masked_mappings ||= begin\n if @klass\n { @klass => @columns }\n else\n column_level_klass_masked_mappings\n end\n end\n end",
"def mask\n @mask ||= self.class.masks[depth]\n end",
"def wanted_netmasks\n netmasks = [new_resource.netmask, nic.IPSubnet].flatten.compact\n\n # Return only IPv4 netmasks\n netmasks.select { |ip| ip =~ /\\./ }\n end",
"def clear_flags\n @regs.each(&:clear_flags)\n end",
"def mask\n raw_value\n end",
"def reset\n all_filters.each(&:reset)\n validate\n end",
"def remove_all()\n @field_weights = Array.new\n end",
"def create_masks(object_id, palette_id, tolerance = 0.1)\n image = ChunkyPNG::Image.from_file(\"images/objects/%s.png\" % [object_id.to_s(16).upcase.rjust(2, \"0\")])\n index_a = OBJECTS[object_id][:pal]\n index_b = OBJECTS.map{ |k, v| v[:pal] }.select{ |i| i > index_a }.sort[0] || PALETTE.width\n masks = (index_a .. index_b - 1).map{ |i| mask(image, PALETTE[i, palette_id], BLACK, tolerance) }\n masks.each_with_index{ |m, i| m.save(\"images/object_layers/\" + object_id.to_s(16).upcase.rjust(2, \"0\") + \"-\" + i.to_s + \".png\") }\n return true\nend",
"def bits_for(*field_names)\n bits = []\n \n field_names.flatten.each do |i|\n if i.is_a?(Integer)\n bits << i\n next\n end\n \n if i.respond_to?(:to_sym) and @field_list[i.to_sym]\n bits << @field_list[i.to_sym]\n end\n end\n \n bits.flatten\n end",
"def entries_custom_fields=(fields)\n destroyed_fields = []\n\n fields.each do |attributes|\n id_or_name = attributes.delete('id') || attributes.delete('_id') || attributes['name']\n field = self.source.find_entries_custom_field(id_or_name)\n\n if field && !!attributes.delete('_destroy')\n destroyed_fields << { :_id => field._id, :_destroy => true }\n next\n end\n\n field ||= self.source.entries_custom_fields.build\n\n field.from_presenter(attributes)\n end\n\n # shift to the accepts_nested_attributes function to delete fields\n self.source.entries_custom_fields_attributes = destroyed_fields\n end",
"def reset(field_)\n name_ = _interpret_field(field_)\n return self unless name_ && @_values.include?(name_)\n values_ = []\n @_field_path.each do |fld_|\n oldval_ = @_values[fld_.name]\n if fld_.name == name_\n values_ << fld_.default_value\n return Value.new(values_, @_format, @_unparse_params)\n else\n values_ << oldval_\n end\n end\n self\n end",
"def clear_flags\n each(&:clear_flags)\n self\n end",
"def masked(mask_image)\n mask_image = mask_image.CGImage\n\n width = CGImageGetWidth(mask_image)\n height = CGImageGetHeight(mask_image)\n component_bits = CGImageGetBitsPerComponent(mask_image)\n pixel_bits = CGImageGetBitsPerPixel(mask_image)\n row_bytes = CGImageGetBytesPerRow(mask_image)\n data_provider = CGImageGetDataProvider(mask_image)\n\n mask = CGImageMaskCreate(width, height, component_bits,\n pixel_bits, row_bytes, data_provider,nil, false)\n\n masked = CGImageCreateWithMask(self.CGImage, mask)\n UIImage.imageWithCGImage(masked)\n end",
"def set_mask\n raise WebSocket::Error::Frame::MaskTooShort if bytesize < 4\n @masking_key = self[0..3].bytes.to_a\n end",
"def reference_custom_field_ids\n self[:value] ||= {}\n self[:value][:custom_field_ids] ||= []\n \n @custom_field_ids ||= self[:value][:custom_field_ids].collect{|cf_id| cf_id.to_i if CustomField.exists?(cf_id) }.compact\n end",
"def fieldsets\n subset_content[:fieldsets] if valid_subset?\n end",
"def reset_flags\n @flags = { :zero => false , :plus => false ,\n :minus => false , :overflow => false }\n end",
"def masking?; true; end",
"def fill_up_empty_fields\n (0..(PANELS_COUNT-1)).each do |panel_no|\n (0..(FIELD_SIZE-1)).each do |row_no|\n (0..(FIELD_SIZE-1)).each do |column_no|\n # if field is empty choose a random indeference and put it in\n if @panels.field([panel_no, row_no, column_no]).class_name.empty?\n @panels.set_field([panel_no, row_no, column_no],\n INDEFERENCES[rand(INDEFERENCES.count)])\n end\n end\n end\n end\n end",
"def mask_bits\n mask_bits = 0\n shifted_mask = @mask_addr\n (1..32).each do |_i|\n mask_bits += 1 if (shifted_mask & 0x1) == 1\n shifted_mask = shifted_mask >> 1\n end\n return mask_bits\n end",
"def reset_atr_mod_list\n @atr_mod_list = AtrList.new(0,0,0,0,0,0,0,0,0,0)\n end",
"def without(*args)\n clone.tap do |crit|\n if args.any?\n unless args == [ :id ] || args == [ :_id ]\n crit.options[:fields] = {}\n end\n args.flatten.each do |f|\n crit.options[:fields][f] = 0\n end\n end\n end\n end",
"def flexi_fields_except_fk\n _field_names = self.associations.values.flatten.map { |_v| :\"#{_v.to_s.singularize}_id\" }\n if none_flexi_fields.present?\n none_flexi_fields.each do |field|\n ['file_name', 'content_type', 'file_size', 'updated_at'].each do |_suffix|\n _field_names << :\"#{field.name.to_s}_#{_suffix}\"\n end\n end\n end\n self.flexi_fields.select { |_f| !_field_names.include?(_f.name.to_sym) }\n end",
"def toggle!(indexes)\n Array(indexes).each do |index|\n validate_index(index)\n @bits ^= (1 << index)\n end\n end",
"def filter_fields\n @fields_by_range = FIELDS\n @fields_by_index = @fields_by_range.each_with_index.inject({}) do |col,((k,v),i)|\n col[k] = i\n col\n end\n return @fields_by_range,@fields_by_index\n end",
"def all_fields_labeled(label_name)\n @fields.values.reject do |field|\n !field.has_label?(label_name.to_sym)\n end\n end",
"def fields!\n @schema.fields!\n end",
"def generate_mask(code, params, password)\n raise InvalidParametersError, 'Invalid flags' unless params.existing_mode?\n impl(params).generate(code, params, password)\n end",
"def dilate mask\n morph mask, :dilate\n end",
"def reset!\n all.map { |repository| repository.send(:reset) }\n\n true\n end",
"def mask_columns_with_null(column_names, mask)\n if mask.size != column_names.size\n raise \"Columns has #{column_names.size} elements, but mask has only #{mask.size}\"\n end\n\n new_columns = []\n column_names.each_with_index{ |c,i| new_columns << (mask[i] ? c : 'null')}\n new_columns\n end",
"def fields=(field_maps)\n @fields = []\n field_maps.each { |fld| @fields << Field.new(fld) }\n @fields\n end",
"def defaults\n fields.inject({}) do |defs, (field_name,field)|\n next(defs) if field.default.nil?\n defs[field_name.to_s] = field.default\n defs\n end\n end",
"def reset_external_id_matching_fields!\n @external_id_definitions_access_by = nil\n @external_id_definitions = nil\n end",
"def fields\n return @fields if defined?(@fields)\n\n @fields = array_of_items_for(Fields, :fields)\n end",
"def filter_fields\n i = -1\n render json: AppConfig['api_field_mappings'].map { |f| [f, i += 1] }.to_h\n end",
"def difference_fields(base_fields, remove_fields)\n fields(base_fields.to_a - remove_fields.to_a)\n end",
"def subset_fields name\n return unless subsets.has_key?(name) && subsets[name].has_key?(:fieldsets)\n subset_fields = []\n subsets[name][:fieldsets].each do |fieldset|\n fields = @fieldsets[fieldset][:fields]\n fieldset = fields.is_a?(Array) ? fields : [fields]\n subset_fields |= fieldset\n end\n subset_fields.uniq\n end",
"def pulp_special_fields(*fields)\n [*fields].each{|f| pulp_special_field(f) }\n end",
"def sencha_fields(*params)\n self.sencha_fieldset(:default, {\n :fields => params\n })\n end"
]
| [
"0.631488",
"0.6240865",
"0.5869973",
"0.5704371",
"0.56187505",
"0.53187746",
"0.5154865",
"0.5145627",
"0.5107875",
"0.50851136",
"0.50851136",
"0.5072117",
"0.49948743",
"0.48419213",
"0.4832822",
"0.48278758",
"0.47796956",
"0.47496808",
"0.47422838",
"0.47414747",
"0.47139478",
"0.46839148",
"0.46682584",
"0.46622387",
"0.46324492",
"0.4603402",
"0.46024838",
"0.45926967",
"0.45819867",
"0.45767462",
"0.45753038",
"0.45641956",
"0.45628354",
"0.4519658",
"0.45177877",
"0.45139802",
"0.45107162",
"0.4509245",
"0.45072958",
"0.4501492",
"0.44915676",
"0.44907692",
"0.4474936",
"0.4467416",
"0.4446658",
"0.44461983",
"0.44351605",
"0.44124806",
"0.4411977",
"0.4411277",
"0.43913576",
"0.43803614",
"0.43788686",
"0.43786272",
"0.4376822",
"0.43726712",
"0.43716398",
"0.43676382",
"0.43671903",
"0.43667117",
"0.43666112",
"0.4359463",
"0.43585318",
"0.4349307",
"0.4346463",
"0.4338927",
"0.433385",
"0.4332453",
"0.4330515",
"0.4325586",
"0.43237188",
"0.43178946",
"0.43171477",
"0.43139288",
"0.43137643",
"0.4309462",
"0.42847484",
"0.42824572",
"0.42815062",
"0.42803782",
"0.42762974",
"0.4276194",
"0.42757693",
"0.42721075",
"0.42635596",
"0.4261041",
"0.42538795",
"0.42520678",
"0.42510602",
"0.42408952",
"0.42274013",
"0.42215198",
"0.42079145",
"0.41944396",
"0.41935018",
"0.4190175",
"0.41899502",
"0.4189256",
"0.4187437",
"0.41871297"
]
| 0.66708994 | 0 |
Returns an "increment mask" for a list of fields +increment_mask_for :fields | def increment_mask_for column_name, *fields
fields = bitfields if fields.empty?
column = @@bitfields[column_name]
raise ArgumentError, "Unknown column for bitfield: #{column_name}" if column.nil?
fields.sum do |field_name|
raise ArugmentError, "Unknown field: #{field_name} for column #{column_name}" if column[field_name].nil?
2 ** (bitfield_max(column_name) - column[field_name].last)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calcIndex(inFields)\n index = 0\n field = 0\n @inMask.each_index do |i|\n index += inFields[i] << field\n field += @inMask[i] \n end\n index\n end",
"def increment_bitfields column_name, *fields\n mask = increment_mask_for column_name, *fields\n update_all \"#{column_name} = #{column_name} + #{mask}\"\n end",
"def increment_bitfields column_name, *fields\n mask = self.class.increment_mask_for column_name, *fields\n self[column_name] = self[column_name] += mask\n save\n end",
"def mask\n (@bound_fields + @unbound_fields + @operands).map do |(field,_)|\n WordField[field].mask\n end.inject do |memo,field_mask|\n memo | field_mask\n end\n end",
"def only_mask_for column_name, *fields\n fields = bitfields if fields.empty?\n column = @@bitfields[column_name]\n max = bitfield_max(column_name)\n raise ArgumentError, \"Unknown column for bitfield: #{column_name}\" if column.nil?\n\n column.sum do |field_name, range|\n fields.include?(field_name) ? range.invert(max).sum{|i| 2 ** i} : 0\n end\n \n # fields.inject(\"0\" * (bitfield_max(column_name) + 1)) do |mask, field_name|\n # raise ArugmentError, \"Unknown field: #{field_name} for column #{column_name}\" if column[field_name].nil?\n # range = column[field_name]\n # mask[range] = \"1\" * range.count\n # mask\n # end.to_i(2)\n end",
"def reset_mask_for column_name, *fields\n fields = bitfields if fields.empty?\n max = bitfield_max(column_name)\n (0..max).sum{|i| 2 ** i} - only_mask_for(column_name, *fields)\n end",
"def mask(*args)\n flags = self.flags\n \n args.inject(0) do |n, name|\n n += flags[name.to_s]\n end\n end",
"def gen_float_masks(m)\n\n bm = []\n base_and = m.gsub(/0/, \"1\")\n base_or = m.gsub(/0/, \"0\")\n\n nx = m.count(\"X\")\n nm = 2**nx\n nm.times do |i|\n bi = i.to_bin_s(nx)\n a = base_and.clone\n o = base_or.clone\n nx.times do |j|\n a.sub!(\"X\", bi[j])\n o.sub!(\"X\", bi[j])\n end\n bm << [\n a.to_i(2),\n o.to_i(2),\n ]\n end\n bm\n end",
"def bits_for(*field_names)\n bits = []\n \n field_names.flatten.each do |i|\n if i.is_a?(Integer)\n bits << i\n next\n end\n \n if i.respond_to?(:to_sym) and @field_list[i.to_sym]\n bits << @field_list[i.to_sym]\n end\n end\n \n bits.flatten\n end",
"def set_incremental_index_on_field_types\n field_types.each_with_index do |field_type, index|\n field_type.index = index\n end\n end",
"def increments(field, options = {})\n incrementing_fields[field] = options.reverse_merge!(auto: true)\n attr_protected(field) if respond_to?(:attr_protected)\n end",
"def filter_fields\n i = -1\n render json: AppConfig['api_field_mappings'].map { |f| [f, i += 1] }.to_h\n end",
"def any_of_number(*field_names)\n self.bits_for(*field_names).reduce(0) { |m, bit| m | (1 << bit) }\n end",
"def get_property_update_masks_groups(properties, mask_prefix: '')\n mask_groups = []\n properties.each do |prop|\n if prop.flatten_object\n mask_groups += get_property_update_masks_groups(\n prop.properties, mask_prefix: \"#{prop.api_name}.\"\n )\n elsif prop.update_mask_fields\n mask_groups << [prop.name.underscore, prop.update_mask_fields]\n else\n mask_groups << [prop.name.underscore, [mask_prefix + prop.api_name]]\n end\n end\n mask_groups\n end",
"def reset_bitfields column_name, *fields\n mask = reset_mask_for column_name, *fields\n update_all \"#{column_name} = #{column_name} & #{mask}\"\n end",
"def transform_numbers_field fields,row_size\n count = 0\n @numbers.each do |n,arr|\n i = fields.delete(n) # delete the old field\n ## replace by the new fields instead\n arr.each { |v| fields[v] = row_size + count; count += 1 }\n end\n return fields\n end",
"def controlfields\n cf = []\n org_codes = %w(NNU-TL NNU-F NyNyUA NyNyUAD NyNyUCH NBPol NyBlHS NHi)\n org_code = get_repo_org_code\n cf << add_003_tag(org_code) if org_codes.include?(org_code)\n cf << add_005_tag\n @record.controlfields = cf\n end",
"def calc_date_mask(field_name)\n if params[:product][:\"#{field_name}(2i)\"] == '' and params[:product][:\"#{field_name}(3i)\"] != ''\n return\n elsif params[:product][:\"#{field_name}(2i)\"] == ''\n params[:product][:\"#{field_name}(2i)\"] = '1'\n params[:product][:\"#{field_name}(3i)\"] = '1'\n params[:product][:\"#{field_name}_mask\"] = :year\n elsif params[:product][:\"#{field_name}(3i)\"] == ''\n params[:product][:\"#{field_name}(3i)\"] = '1'\n params[:product][:\"#{field_name}_mask\"] = :year_month\n else\n params[:product][:\"#{field_name}_mask\"] = :year_month_day\n end\n end",
"def id_fields\n until @field_pos.keys.length == @fields.length\n # iterate through each field range\n @f_ranges.each_with_index do |f_r, f_ind|\n possibles = []\n # see if positional values for unknown fall within the field range\n @positional_values.each_with_index do |p_v, p_ind|\n next if @field_pos.values.include?(p_ind)\n\n possibles.push(p_ind) if in_range?(p_v, f_r)\n end\n # assign field to position if it is the only possible combination\n @field_pos[@fields[f_ind]] = possibles[0] if possibles.length == 1\n end\n end\n end",
"def on!(indexes)\n Array(indexes).each do |index|\n validate_index(index)\n @bits |= (1 << index)\n end\n end",
"def get_mask(groups)\n mask = 0\n groups.split.each do |i|\n selected = @friendgroups.find { |g| g['name'] == i}\n if selected.nil?\n raise LjException.new(LJERR_BAD_FGROUP,\"Invalid friends group '#{i}'\")\n else\n mask += 2 ** selected['id']\n end\n end\n return mask\n end",
"def pattern_indexes=(indexes)\n p_bits = ('0' * step_count)\n indexes.each do |index|\n p_bits[index] = '1'\n end\n self.bits = p_bits.rjust(self.step_count, '0').to_i(2)\n end",
"def field_ids\n @fields.keys\n end",
"def mask_bits\n mask_bits = 0\n shifted_mask = @mask_addr\n (1..32).each do |_i|\n mask_bits += 1 if (shifted_mask & 0x1) == 1\n shifted_mask = shifted_mask >> 1\n end\n return mask_bits\n end",
"def instead_of(*field_names)\n [].tap do |list|\n none_num = any_of_number(*field_names)\n self.each_value { |num| list << num if (num & none_num) != none_num }\n end\n end",
"def update_auto_increments\n self.class.incrementing_fields.each do |field, options|\n increment!(field, options) if options[:auto]\n end && true\n end",
"def offset_id_fields\n @offset_id_fields ||= begin\n # In case a Class is associated with a specific decendant of one of the reassociate_types, include descendants.\n # Exclude id_mapping_types since they will be handled by reassociate_with_imported_records via reassociate_fields\n known_types = (reassociate_types + reassociate_types.map(&:descendants).flatten - id_mapping_types).uniq\n\n reassociate_types.map do |klass|\n [\n klass,\n AssocationWrapper.new(klass).grouped_fieldnames_of_typed_associations_with(known_types.map(&:name))\n .values.flatten.sort\n ]\n end.to_h.tap do |class_to_fieldnames_hash|\n # array of decision_issue_ids; not declared as an association in Rails, so add it manually\n class_to_fieldnames_hash[CavcRemand].push(\"decision_issue_ids\").sort!\n\n # Why is :participant_id listed as a association? Why is it a symbol whereas others are strings?\n class_to_fieldnames_hash[Claimant].delete(:participant_id)\n\n class_to_fieldnames_hash.transform_values!(&:uniq)\n end.compact\n end\n end",
"def field_groups\n @field_groups ||= begin\n field_group_indexes.map do |e|\n e.map do |e|\n @input[e]\n end\n end\n end\n end",
"def inc(incs)\n view.update_many(\"$inc\" => collect_operations(incs))\n end",
"def add_mask(mod)\n\n unless const_defined? \"MASKS\"\n const_set(\"MASKS\",Hash.new)\n end\n\n unless const_defined? \"MASK_INFO\"\n const_set(\"MASK_INFO\",Hash.new)\n end\n\n unless const_defined? \"Masked\"\n const_set(\"Masked\",Module.new)\n end\n\n tmod = mod.name.gsub(\"::\",\"_\")\n\n cln = mod.clone\n\n self::Masked.const_set(tmod,cln)\n\n trans = []\n\n cln.instance_methods(false).each do |m|\n meth = m.to_sym\n masked_name = \"__#{tmod}_#{(mod.object_id + cln.object_id).abs}_#{m}\".to_sym\n\n self::MASK_INFO[masked_name] = mod\n\n trans << [meth, masked_name]\n\n cln.module_eval <<-CODE\n alias #{masked_name} #{meth}\n remove_method(:#{meth})\n CODE\n end\n\n module_eval { include cln }\n\n trans.each do |t|\n name, meth = t[0], t[1]\n\n cln_method = cln.instance_method(meth)\n self::MASK_INFO[cln_method] = self::MASK_INFO[meth]\n self::MASK_INFO.delete meth\n\n cln.module_eval \"remove_method :#{meth}\"\n\n if self::MASKS.key? name\n self::MASKS[name].unshift cln_method\n else\n original_method = instance_method(name)\n self::MASKS[name] = [cln_method, original_method]\n self::MASK_INFO[original_method] = self\n\n module_eval(<<-CODE,\"maskable.rb\",70)\n if instance_methods.include? \"#{name}\"\n remove_method :#{name}\n end\n\n def #{name}(*a,&b)\n mk = Method::Mask.new(:#{name}, self, \n self.class::MASKS[:#{name}], a, b)\n if Thread.current['__running_mask']\n Thread.current['__running_mask'] << mk\n else\n Thread.current['__running_mask'] = [mk]\n end\n \n return Method.rest\n ensure\n if Thread.current['__running_mask'].size == 1\n Thread.current['__running_mask'] = []\n else\n Thread.current['__running_mask'].pop\n end\n end\n\n CODE\n end\n end\n end",
"def set_min(fields)\n view.update_many(\"$min\" => collect_operations(fields))\n end",
"def field_group_index_for_field_index(index)\n r = (row_index_for_field_index(index) / @field_size).to_i * @field_size\n c = (column_index_for_field_index(index) / @field_size).to_i\n r + c\n end",
"def only(*args)\n clone.tap do |crit|\n if args.any?\n crit.options[:fields] = {:_type => 1}\n crit.field_list = args.flatten\n crit.field_list.each do |f|\n crit.options[:fields][f] = 1\n end\n end\n end\n end",
"def pulp_special_fields(*fields)\n [*fields].each{|f| pulp_special_field(f) }\n end",
"def reference_custom_field_ids\n self[:value] ||= {}\n self[:value][:custom_field_ids] ||= []\n \n @custom_field_ids ||= self[:value][:custom_field_ids].collect{|cf_id| cf_id.to_i if CustomField.exists?(cf_id) }.compact\n end",
"def json_fields_of(decorated_collection, fields_from_params = params[:fields])\n return [] if decorated_collection.blank?\n\n decorated = decorated_collection.first\n index_field_names = decorated.index_field_names.map(&:to_s)\n fields = (fields_from_params.presence || index_field_names).split(/\\s*,\\s*/).flatten\n fields & index_field_names\n end",
"def filter_fields\n @fields_by_range = FIELDS\n @fields_by_index = @fields_by_range.each_with_index.inject({}) do |col,((k,v),i)|\n col[k] = i\n col\n end\n return @fields_by_range,@fields_by_index\n end",
"def field_concatinator(field, values)\n if values.size > 0\n list = [([\"#{field} ~* ?\"]*values.size).join(\" AND \")] + values\n list[0] = \"(#{list[0]})\"\n list\n else\n []\n end\n end",
"def enable_mask(operation)\n str = ''\n shift_out_left do |bit|\n if operation == :store && bit.is_to_be_stored? ||\n operation == :read && bit.is_to_be_read? ||\n operation == :overlay && bit.has_overlay?\n str += '1'\n else\n str += '0'\n end\n end\n str.to_i(2)\n end",
"def field_group(index)\n field_group_indexes(index).map do |e|\n @input[e]\n end\n end",
"def equal_to_numbers(field_values = {})\n fields = {}\n \n field_values.each_pair do |field_name, v|\n bits = self.bits_for(field_name)\n fields[bits] = v if bits.length > 0\n end\n \n all_num = 0\n none_num = 0\n fields.each_pair { |field_bits, val|\n field_bits.each_with_index do |bit, i|\n if @options[:bool_caster].call(val[i])\n all_num |= (1 << bit)\n else\n none_num |= (1 << bit)\n end\n end\n }\n \n [all_num, none_num]\n end",
"def field_indexes\r\n return @field_indexes\r\n end",
"def field_group_indexes(get_at = nil)\n # 9x9 -> [[0,1,2,9,10,11,18,19,20], [3,4,5,12,13,14,21,22,23], ..... ]\n @@field_group_indexes[@length] ||= begin\n base = @length / @field_size\n temp_indexes = base.times.map { |count| base.times.map { |c| count + (base * c) } }\n max_index = (length ** 2) - 1\n field_group_rows = (0..max_index).to_a.each_slice(@field_size).each_slice(@length).to_a\n indexes = field_group_rows.flat_map do |e|\n temp_indexes.map { |indexes| indexes.flat_map { |i| e[i]} }\n end\n end\n if get_at\n @@field_group_indexes[@length][get_at]\n else\n @@field_group_indexes[@length]\n end\n end",
"def build_fields(params_list)\n params_list = params_list.first.to_a if Hash === params_list.first\n \n params_list.map do |params|\n if Array === params\n params.flatten! if Array === params.second\n options = params.extract_options!\n name = params.first\n format = params.second\n else\n name = params\n options = {}\n end\n\n attributes = {format: format, collection: @current_collection}.merge(options)\n Field.new(name, attributes)\n end\n end",
"def parse_mask(mask)\n and_mask = mask.gsub(\"X\", \"1\").to_i(2)\n or_mask = mask.gsub(\"X\", \"0\").to_i(2)\n\n [and_mask, or_mask]\nend",
"def any_of(*field_names)\n [].tap do |list|\n any_num = any_of_number(*field_names)\n self.each_value { |num| list << num if (num & any_num) > 0 }\n end\n end",
"def possible_fields(map, nums)\n result = Set.new()\n map.each do |field, ranges|\n if all_in_ranges?(nums, ranges)\n result << field \n end\n end\n result\nend",
"def field_ids\n @conditions['field_ids'] || cbobject.basis_fields\n end",
"def pad_field(*fields)\n fields.each do |field|\n unless self[field].size % 4 == 0\n self[field] << \"\\x00\" * (4 - (self[field].size % 4))\n end\n end\n end",
"def fields(fields = {})\n fields.each do |k,v|\n define_accessor(k.underscore, v)\n end\n end",
"def with_attribute(_, *attributes)\n # TODO: Test lots of databases\n bitmask_query attributes, \"#{table_name}.#{field_name} & :mask = :mask\"\n end",
"def maskify(cc)\n return cc.length <= 4 ? cc : ('#' * (cc.length-4)) + cc[cc.length-4..cc.length-1]\nend",
"def transform_inc_to_set(inc_expr)\n _tag, expr = inc_expr\n ['set', expr, ['+', expr, 1]]\n end",
"def create_number_field(form,\n value,\n name,\n label,\n field_id,\n minimum,\n maximum,\n required: false,\n validation: nil,\n html_class: nil,\n is_multiple: false,\n readonly: false,\n index: 0,\n ttip: nil)\n render partial: 'dynamic_form/fields/number_field',\n locals: {\n f: form,\n multiple: is_multiple,\n index:,\n field_value: value,\n field_name: name,\n field_label: label,\n field_class: html_class,\n field_id:,\n minimum:,\n maximum:,\n readonly:,\n required:,\n validation:,\n ttip:\n }\n end",
"def increment_checklist_counters(checklist, increment)\n\n checklist = [checklist] if checklist.class == Check\n\n checklist.each do |check|\n\n if check.designer_auditor?\n self.designer_auditor_count += increment if check.full_review?\n self.dc_designer_auditor_count += increment if check.date_code_check?\n self.dr_designer_auditor_count += increment if check.dot_rev_check?\n else\n self.designer_only_count += increment if check.full_review?\n self.dc_designer_only_count +=\tincrement if check.date_code_check?\n self.dr_designer_only_count += increment if check.dot_rev_check?\n end\n\n end\n \n self.save\n\n end",
"def increment_flag list\n if (params[:commit] != \"Flag\")\n return\n end\n \n if list.nil? || list.flags.nil?\n return\n end\n \n list.flags += 1\n list.save!\n return\n end",
"def pack_bit_fields\n @unpacked = []\n \n self.class.fields.each_with_index do |name, position|\n \n if bit_fields = self.class.bit_fields[name]\n \n bit_value = 0\n bit_fields.each do |(bit_name, bits_number, bit_mask)|\n masked = @attributes[bit_name] & bit_mask\n \n raise ValueOverflow, \n \"the value #{@attributes[bit_name]} \"+\n \"is too big for #{bits_number} bits\" if masked != @attributes[bit_name]\n \n bit_value = bit_value << bits_number\n bit_value |= masked\n end\n \n # Value of fields composed by binary fields is always overwritten\n # by the composition of the latter\n attributes[name] = bit_value\n end\n \n @unpacked[position] = @attributes[name] || 0\n \n end\n \n @raw = @unpacked.pack( self.class.unpack_recipe )\n end",
"def duplicants_fieldlet_ids\n\t\t\tself.duplicant_field::FIELDLET_IDS\n\t\tend",
"def field(*fields)\n options = fields.extract_options!\n\n fields.each do |f|\n _field(f, options)\n end\n end",
"def mask_params\n params.require(:mask).permit(:phone_number, :number_id)\n end",
"def update_fields(fields)\n\n # instead of going through each attribute on self, iterate through each item in field and update from there\n self.attributes.each do |k, v|\n attributes[k.to_sym] = fields[SYMBOL_TO_STRING[k.to_sym]] || fields[k.to_sym] || attributes[k.to_sym]\n end\n\n attributes[:id] = fields[SYMBOL_TO_STRING[:id]] || attributes[:id]\n self\n end",
"def update_fields(fields)\n\n # instead of going through each attribute on self, iterate through each item in field and update from there\n self.attributes.each do |k, v|\n attributes[k.to_sym] = fields[SYMBOL_TO_STRING[k.to_sym]] || fields[k.to_sym] || attributes[k.to_sym]\n end\n\n attributes[:id] = fields[SYMBOL_TO_STRING[:id]] || attributes[:id]\n self\n end",
"def update_fields(fields)\n\n # instead of going through each attribute on self, iterate through each item in field and update from there\n self.attributes.each do |k, v|\n attributes[k.to_sym] = fields[SYMBOL_TO_STRING[k.to_sym]] || fields[k.to_sym] || attributes[k.to_sym]\n end\n\n attributes[:id] = fields[SYMBOL_TO_STRING[:id]] || attributes[:id]\n self\n end",
"def compressible_ranges(fields, start)\n ranges = []\n\n i = start\n while i < 8 && fields[i] != 0 ; i += 1 ; end\n\n if i\n li = i\n\n while i < 8\n while i < 8 && fields[i] == 0 ; i += 1 ; end\n if i > li + 1\n ranges << (li...i)\n end\n\n while i < 8 && fields[i] != 0 ; i += 1 ; end\n\n li = i\n end\n end\n\n ranges.sort! { |a,b| b.count <=> a.count }\n ranges\n end",
"def controlFields\n tag_range(\"001\", \"009\")\n end",
"def read_field(*args)\n m = 0\n args.flatten.each_with_index do |bit, i|\n if bit.is_a?(Integer)\n m |= ((@value[bit] || 0) << i)\n end\n end\n m\n end",
"def add_fields(fields)\n\t\tend",
"def mask(payload, mask)\n return mask_native(payload, mask) if respond_to?(:mask_native)\n result = []\n payload.each_with_index do |byte, i|\n result[i] = byte ^ mask[i % 4]\n end\n result\n end",
"def fields(fields)\n fields.each { |options| add_column(nil, nil, options); }\n end",
"def to_fields(fields, mapping_method)\n fields.each { |field| to_field field, mapping_method }\n end",
"def pulp_locked_fields(*fields)\n [*fields].each {|field| pulp_locked_field(field) }\n end",
"def the_fields_grouped(field_keys)\n res = []\n object.get_fields_grouped(field_keys).each do |_group|\n group = {}.with_indifferent_access\n _group.keys.each do |k|\n group[k] = _group[k].map{|v| h.do_shortcode(v.to_s.translate(@_deco_locale), object) }\n end\n res << group\n end\n res\n end",
"def generate_mask(palette_size)\n number_one_bits_array = Array.new(Math.log(palette_size, 2).ceil) { |index| (palette_size - 1) >> index & 1 }\n number_one_bits = number_one_bits_array.reduce(0) { |num, one_bit| num += one_bit }\n raise \"Invalid pallette size\" if number_one_bits & (number_one_bits - 1) != 0 or palette_size & (palette_size - 1) != 0 or palette_size <= 1\n palette_size - 1\n end",
"def field_group_for_field_index(index)\n field_group(field_group_index_for_field_index(index))\n end",
"def pulp_fields(*fields)\n fields.to_a.each {|field| pulp_field(field) }\n end",
"def sh4LowerShiftOps(list)\n newList = []\n list.each {\n | node |\n if node.is_a? Instruction\n case node.opcode\n when \"ulshifti\", \"ulshiftp\", \"urshifti\", \"urshiftp\", \"lshifti\", \"lshiftp\", \"rshifti\", \"rshiftp\"\n if node.opcode[0, 1] == \"u\"\n type = \"l\"\n direction = node.opcode[1, 1]\n else\n type = \"a\"\n direction = node.opcode[0, 1]\n end\n if node.operands[0].is_a? Immediate\n maskedImm = Immediate.new(node.operands[0].codeOrigin, node.operands[0].value & 31)\n if maskedImm.value == 0\n # There is nothing to do here.\n elsif maskedImm.value == 1 or (type == \"l\" and [2, 8, 16].include? maskedImm.value)\n newList << Instruction.new(node.codeOrigin, \"sh#{type}#{direction}x\", [maskedImm, node.operands[1]])\n else\n tmp = Tmp.new(node.codeOrigin, :gpr)\n if direction == \"l\"\n newList << Instruction.new(node.codeOrigin, \"move\", [maskedImm, tmp])\n else\n newList << Instruction.new(node.codeOrigin, \"move\", [Immediate.new(node.operands[0].codeOrigin, -1 * maskedImm.value), tmp])\n end\n newList << Instruction.new(node.codeOrigin, \"sh#{type}d\", [tmp, node.operands[1]])\n end\n else\n tmp = Tmp.new(node.codeOrigin, :gpr)\n newList << Instruction.new(node.codeOrigin, \"move\", [Immediate.new(node.operands[0].codeOrigin, 31), tmp])\n newList << Instruction.new(node.codeOrigin, \"andi\", [node.operands[0], tmp])\n if direction == \"r\"\n newList << Instruction.new(node.codeOrigin, \"negi\", [tmp, tmp])\n end\n newList << Instruction.new(node.codeOrigin, \"sh#{type}d\", [tmp, node.operands[1]])\n end\n else\n newList << node\n end\n else\n newList << node\n end\n }\n newList\nend",
"def field_array_controls\n \"__controls__\"\n end",
"def custom_fields\n field_values = @client.account_details.custom_field_values\n\n fields = []\n\n 3.times do |i|\n n = i+1\n\n if send(:\"field#{n}_value_id\").nil?\n fields << nil\n else\n\n field_value = field_values.select { |fv| fv[\"id\"] == send(:\"field#{n}_value_id\") }\n fields << Unfuddled::CustomField.new(\n :number => n,\n :title => project.send(:\"ticket_field#{n}_title\"),\n :type => project.send(:\"ticket_field#{n}_disposition\"),\n :value => field_value\n )\n end\n end\n\n fields\n end",
"def maskify(cc)\n characters = cc.to_s.length - 4\n\n array = cc.to_s.split('')\n values = array.values_at(-4, -3, -2, -1)\n joint_values = values.join('')\n\n result = (\"#\" * characters) + joint_values\n return result\nend",
"def expand_association_to_ids fields\n expanded = {}\n fields.each_pair do |name, type|\n case type\n when 'belongs_to'\n expanded[\"#{name}_id\"] = 'integer'\n end\n end\n fields.merge(expanded)\n end",
"def computed_fields; end",
"def boost_fields(boosts)\n boosts.each_pair do |field_name, boost|\n @setup.text_fields(field_name).each do |field|\n @query.add_fulltext_field(field, boost)\n end\n end\n end",
"def sencha_fields(*params)\n self.sencha_fieldset(:default, {\n :fields => params\n })\n end",
"def card_number_mask\n \"XXX XXXX XXX #{last4}\"\n end",
"def maskify(cc)\n # your beautiful code goes here\n cc.length <= 4 ? cc : \"#\" * (cc.length-4) + cc[-4..-1]\nend",
"def write_mask=(arr) # :nodoc:\n @write_mask = transform_fields('write_mask',arr)\n end",
"def work_entry_other_ids(field)\n case field.tag\n when /(760|762|765|767|770|772|773|774|775|777|780|785|786|787)/\n field.subfields.select { |sf| work_entry_other_id_subfields(field).include?(sf.code) }\n .map { |sf| remove_parenthetical_id_prefix_from_sf_w(sf) }\n end\n end",
"def mask_array\n @mask.split('')\n end",
"def repeated(type, name, number, options = {})\n define_field(type, name, number, options.merge!(repeated: true))\n end",
"def calcIndice\n\t\t# [true,true,false,true]\t\t\t\t[2,1]\n\t\t# [false,true,false,false]\t\t--> \t[1]\n\t\t# [true,true,true,false,true]\t\t\t[3,1]\n\n\t\tgrid = self.toBoolean\n\t\t@indicesLigne = groupeIndicesGrid(grid)\n\t\t@indicesColonne = groupeIndicesGrid(grid.transpose)\n\t\treturn grid\n\tend",
"def encode_fields(*fields)\n fields.map do |type, value|\n case type\n when :raw\n value\n when :string\n encode_string(value)\n when :list\n encode_list(value)\n when :mpint\n encode_mpint(value)\n when :time\n encode_time(value)\n when :uint64\n encode_uint64(value)\n when :uint32\n encode_uint32(value)\n when :options\n encode_options(value)\n else\n raise DecodeError, \"bad type: #{type}\"\n end\n end.join\n end",
"def object_mask(*args)\n proxy = APIParameterFilter.new(self)\n return proxy.object_mask(*args)\n end",
"def mask(series, key, mod)\r\n locations = series_mask[key]\r\n \r\n unless mod == nil\r\n mod_locations = series_mask[\"#{key}#{mod}\"] \r\n if mod_locations\r\n locations += mod_locations \r\n locations.uniq!\r\n end\r\n end\r\n \r\n locations.each {|i| series[i] *= -1} unless locations == nil\r\n series\r\n end",
"def add_field_configuration_to_solr_request!(*fields)\n if fields.empty?\n self.add_field_configuration_to_solr_request = true\n else\n index_fields.slice(*fields).each_value { |v| v.include_in_request = true }\n show_fields.slice(*fields).each_value { |v| v.include_in_request = true }\n facet_fields.slice(*fields).each_value { |v| v.include_in_request = true }\n end\n end",
"def none_of_number(*field_names)\n ~self.any_of_number(*field_names)\n end",
"def fields(fields)\n if fields.nil?\n return nil\n elsif fields.is_a? Java::CascadingTuple::Fields\n return fields\n elsif fields.is_a? ::Array\n if fields.size == 1\n return fields(fields[0])\n end\n raise \"Fields cannot be nil: #{fields.inspect}\" if fields.include?(nil)\n end\n return Java::CascadingTuple::Fields.new([fields].flatten.map{ |f| f.kind_of?(Fixnum) ? java.lang.Integer.new(f) : f }.to_java(java.lang.Comparable))\n end",
"def build_regex(fields)\n fields_or = fields.map { |field| \"#{field}(\\\\[\\\\])?\" }.join('|')\n\n Regexp.new(\"^#{fields_or}$\")\n end",
"def pattern_indexes\n self.bits ||= 0\n array = bits.to_s(2).rjust(self.step_count, '0').chars.each_with_index.map do |value, index|\n index if value == '1'\n end\n array.compact\n end",
"def number_field(object_name, method, options = T.unsafe(nil)); end",
"def bitfield_args\n @bitfield_args ||= []\n end"
]
| [
"0.64448756",
"0.64394754",
"0.60582227",
"0.5737367",
"0.54996616",
"0.5363126",
"0.52102506",
"0.5117863",
"0.5067465",
"0.5027698",
"0.50190216",
"0.50178236",
"0.50029695",
"0.4988282",
"0.49580488",
"0.48778778",
"0.48602548",
"0.48440126",
"0.4824261",
"0.4753182",
"0.47520185",
"0.47451892",
"0.47394904",
"0.47136796",
"0.4680087",
"0.46630132",
"0.46475255",
"0.4621974",
"0.45961487",
"0.45956603",
"0.45901477",
"0.45832062",
"0.45664465",
"0.45109853",
"0.45109746",
"0.44458094",
"0.44081417",
"0.4403645",
"0.43855903",
"0.43781537",
"0.43759868",
"0.4360134",
"0.4352792",
"0.43371612",
"0.43319207",
"0.43298462",
"0.43252683",
"0.43238348",
"0.43223646",
"0.43194067",
"0.4315132",
"0.42969742",
"0.42920402",
"0.42913884",
"0.42824808",
"0.42728493",
"0.4264287",
"0.42618507",
"0.4259113",
"0.42584676",
"0.42500037",
"0.42500037",
"0.42500037",
"0.42464915",
"0.4241896",
"0.4218953",
"0.42040688",
"0.4203521",
"0.41960636",
"0.41909015",
"0.4186641",
"0.4181949",
"0.41775817",
"0.41737878",
"0.41696927",
"0.41681033",
"0.41570017",
"0.41557574",
"0.41472995",
"0.41439664",
"0.4136429",
"0.4131027",
"0.41252515",
"0.4116985",
"0.41150096",
"0.41133004",
"0.40999103",
"0.40921438",
"0.40850264",
"0.40819368",
"0.40757287",
"0.4072704",
"0.40479064",
"0.40360546",
"0.40341255",
"0.40277845",
"0.40272194",
"0.40231615",
"0.40195692",
"0.40166873"
]
| 0.6035005 | 3 |
Returns an "only mask" for a list of fields +only_mask_for :fields | def only_mask_for column_name, *fields
fields = bitfields if fields.empty?
column = @@bitfields[column_name]
max = bitfield_max(column_name)
raise ArgumentError, "Unknown column for bitfield: #{column_name}" if column.nil?
column.sum do |field_name, range|
fields.include?(field_name) ? range.invert(max).sum{|i| 2 ** i} : 0
end
# fields.inject("0" * (bitfield_max(column_name) + 1)) do |mask, field_name|
# raise ArugmentError, "Unknown field: #{field_name} for column #{column_name}" if column[field_name].nil?
# range = column[field_name]
# mask[range] = "1" * range.count
# mask
# end.to_i(2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mask\n (@bound_fields + @unbound_fields + @operands).map do |(field,_)|\n WordField[field].mask\n end.inject do |memo,field_mask|\n memo | field_mask\n end\n end",
"def only(*args)\n clone.tap do |crit|\n if args.any?\n crit.options[:fields] = {:_type => 1}\n crit.field_list = args.flatten\n crit.field_list.each do |f|\n crit.options[:fields][f] = 1\n end\n end\n end\n end",
"def only(*fields)\n query('_only' => fields)\n end",
"def restrict_fields\n\n allowed_fields=User.new.attributes.keys\n @fields=allowed_fields & (params[:fields] || \"\").split(\",\")\n if @fields.present?\n @[email protected](@fields) \n else\n @fields=allowed_fields\n end \n end",
"def instead_of(*field_names)\n [].tap do |list|\n none_num = any_of_number(*field_names)\n self.each_value { |num| list << num if (num & none_num) != none_num }\n end\n end",
"def object_mask(*args)\n proxy = APIParameterFilter.new(self)\n return proxy.object_mask(*args)\n end",
"def readable(*fields)\n added_fields = add_fields(@read_mask,\"readable\",fields)\n allow(*fields)\n @read_mask = added_fields if(@read_mask.eql?(WILDCARD))\n added_fields\n end",
"def restrict_fields\n allowed_fields=Location.new.attributes.keys+[\"top_left_coordinate_str\", \"bottom_right_coordinate_str\"]-[\"top_left_coordinate_id\", \"bottom_right_coordinate_id\"]\n @fields=allowed_fields & (params[:fields] || \"\").split(\",\")\n \n if @fields.present?\n @[email protected](@fields) \n else\n @fields=allowed_fields\n end \n\n end",
"def allow(*fields)\n added_fields = add_fields(@allowed_fields,\"allow\",fields)\n @allowed_fields = added_fields if(@allowed_fields.eql?(WILDCARD))\n added_fields\n end",
"def writable(*fields)\n added_fields = add_fields(@write_mask,\"writable\",fields)\n allow(*fields)\n @write_mask = added_fields if(@write_mask.eql?(WILDCARD))\n added_fields\n end",
"def simple_fields\n fields.select(&:filterable?)\n end",
"def pulp_special_fields(*fields)\n [*fields].each{|f| pulp_special_field(f) }\n end",
"def exclusion_guard(arr)\n arr | required_fields\n end",
"def only!(*keys)\n ret = only(*keys)\n replace(except(*keys))\n return ret\n end",
"def protobuf_fields(*fields)\n options = fields.extract_options!\n options[:only] = fields if fields.present?\n\n self._protobuf_field_options = options\n end",
"def visible(fields)\n Array.wrap(fields).reject { |field| undisplayed?(field) }\n end",
"def none_of(*field_names)\n [].tap do |list|\n lack_num = any_of_number(*field_names)\n self.each_value { |num| list << num if (num & lack_num) == 0 }\n end\n end",
"def mask_array\n @mask.split('')\n end",
"def mask(*args)\n flags = self.flags\n \n args.inject(0) do |n, name|\n n += flags[name.to_s]\n end\n end",
"def flexi_fields_except_fk\n _field_names = self.associations.values.flatten.map { |_v| :\"#{_v.to_s.singularize}_id\" }\n if none_flexi_fields.present?\n none_flexi_fields.each do |field|\n ['file_name', 'content_type', 'file_size', 'updated_at'].each do |_suffix|\n _field_names << :\"#{field.name.to_s}_#{_suffix}\"\n end\n end\n end\n self.flexi_fields.select { |_f| !_field_names.include?(_f.name.to_sym) }\n end",
"def columns\n restrictions - exclude\n end",
"def any_of(*field_names)\n [].tap do |list|\n any_num = any_of_number(*field_names)\n self.each_value { |num| list << num if (num & any_num) > 0 }\n end\n end",
"def only(*methods)\r\n with_options(only: methods)\r\n end",
"def mask(payload, mask)\n return mask_native(payload, mask) if respond_to?(:mask_native)\n result = []\n payload.each_with_index do |byte, i|\n result[i] = byte ^ mask[i % 4]\n end\n result\n end",
"def field_for_select\n candidate_fields = [primary_field, list_view_fields, fields].flatten.compact\n candidate_fields.reject(&:restricted?).find(&:human_readable?)\n end",
"def only *filter_list\n filter.only filter_list\n self\n end",
"def write_mask=(arr) # :nodoc:\n @write_mask = transform_fields('write_mask',arr)\n end",
"def wanted_netmasks\n netmasks = [new_resource.netmask, nic.IPSubnet].flatten.compact\n\n # Return only IPv4 netmasks\n netmasks.select { |ip| ip =~ /\\./ }\n end",
"def remove_all_dismantle_masks\n groups = [$data_items, $data_armors, $data_weapons]\n for group in groups\n for obj in group\n next if obj.nil?\n obj.set_dismantle_mask_flags(true)\n end # for\n end # for\n end",
"def varfield_librarys(value_only: true)\n varfields('f', value_only: value_only)\n end",
"def build_regex(fields)\n fields_or = fields.map { |field| \"#{field}(\\\\[\\\\])?\" }.join('|')\n\n Regexp.new(\"^#{fields_or}$\")\n end",
"def wildcard_mask\n if self.ipv4?\n (@mask_addr ^ IPAddr::IN4MASK).to_ip\n else\n (@mask_addr ^ IPAddr::IN6MASK).to_ip\n end\n end",
"def subset_fields\n self.class.subset_fields(subset.to_sym) if valid_subset?\n end",
"def reset_mask_for column_name, *fields\n fields = bitfields if fields.empty?\n max = bitfield_max(column_name)\n (0..max).sum{|i| 2 ** i} - only_mask_for(column_name, *fields)\n end",
"def fields!(fields = nil)\n mutate(:fields, fields)\n end",
"def public_fields\n fields.select{ |field_name| field_name[0] != '_' }\n end",
"def mask\n super\n end",
"def set_readonly(*field_names)\n field_names.each { |field|\n @element_map[field.to_s].readonly!\n }\n end",
"def maskRecord(record)\n maskedRecord = record\n excludedFields = []\n begin\n @fieldsToExcludeJSONPathsArray.each do | field |\n field_value = myDig(record, field)\n if field_value != nil\n excludedFields = excludedFields + field_value.split(',')\n end\n end\n rescue Exception => e\n $log.error \"Failed to find mask exclude record: #{e}\"\n end\n begin\n recordStr = record.to_s\n\n if @handleSpecialEscapedJsonCases == true\n @specialEscapedJsonRegexs.each do | regex, replace |\n recordStr = recordStr.gsub(regex, replace)\n end\n end \n \n @fields_to_mask_regex.each do | fieldToMaskRegex, fieldToMaskRegexStringReplacement |\n if !(excludedFields.include? @fields_to_mask_keys[fieldToMaskRegex])\n recordStr = recordStr.gsub(fieldToMaskRegex, fieldToMaskRegexStringReplacement) \n end\n end\n \n maskedRecord = strToHash(recordStr)\n rescue Exception => e\n $log.error \"Failed to mask record: #{e}\"\n end\n\n maskedRecord\n end",
"def read_mask=(arr) # :nodoc:\n @read_mask = transform_fields('read_mask',arr)\n end",
"def only(*keys)\n keys = keys.to_sargs\n self.select { |k| keys.include?(k) } || self\n end",
"def set_mandatory_list_mode\n self['mask'] |= Mask.name_values[:list]\n @attributes_cache.delete('mask')\n end",
"def fields(*fields)\n result = []\n keys.sort.each do |name|\n result << self[name].pick(*fields)\n end\n result\n end",
"def filter_fields\n @fields_by_range = FIELDS\n @fields_by_index = @fields_by_range.each_with_index.inject({}) do |col,((k,v),i)|\n col[k] = i\n col\n end\n return @fields_by_range,@fields_by_index\n end",
"def without(*args)\n clone.tap do |crit|\n if args.any?\n unless args == [ :id ] || args == [ :_id ]\n crit.options[:fields] = {}\n end\n args.flatten.each do |f|\n crit.options[:fields][f] = 0\n end\n end\n end\n end",
"def allowed_fields\n @allowed_fields.dup\n end",
"def only\n attributes.fetch(:only)\n end",
"def fields(filter = nil)\n unless filter\n # Since we're returning the FieldMap object, which the caller\n # may mutate, we precautionarily mark dirty -- unless it's frozen\n # immutable.\n @fields.clean = false unless @fields.frozen?\n return @fields\n end\n @fields.reindex unless @fields.clean\n flds = []\n if filter.is_a?(String) && @fields.tags[filter]\n @fields.tags[filter].each do |idx|\n flds << @fields[idx]\n end\n elsif filter.is_a?(Array) || filter.is_a?(Range)\n @fields.each_by_tag(filter) do |tag|\n flds << tag\n end\n end\n flds\n end",
"def bits_for(*field_names)\n bits = []\n \n field_names.flatten.each do |i|\n if i.is_a?(Integer)\n bits << i\n next\n end\n \n if i.respond_to?(:to_sym) and @field_list[i.to_sym]\n bits << @field_list[i.to_sym]\n end\n end\n \n bits.flatten\n end",
"def field(*fields, export_only: false)\n @config.fields += fields.map(&:to_sym)\n @config.fields.uniq!\n\n if export_only\n @config.export_only_fields += fields.map(&:to_sym)\n @config.export_only_fields.uniq!\n end\n\n nil\n end",
"def datatable_exclude_fields\n # None\n []\n end",
"def pulp_locked_fields(*fields)\n [*fields].each {|field| pulp_locked_field(field) }\n end",
"def visible_fields\n fields.select {|f| f.visible? }\n end",
"def authorized_fields(actor, action, resource, allow_wildcard: false) # rubocop:disable Metrics/MethodLength\n results = query_rule('allow_field', actor, action, resource, Polar::Variable.new('field'))\n fields = Set.new\n results.each do |result|\n field = result['field']\n if field.is_a?(Polar::Variable)\n return Set['*'] if allow_wildcard\n\n raise ::Oso::Error,\n 'The result of authorized_fields() contained an '\\\n '\"unconstrained\" field that could represent any '\\\n 'field, but allow_wildcard was set to False. To fix, '\\\n 'set allow_wildcard to True and compare with the \"*\" '\\\n 'string.'\n end\n fields.add(field)\n end\n fields\n end",
"def wildmask\n super\n end",
"def field(*fields)\n options = fields.extract_options!\n\n fields.each do |f|\n _field(f, options)\n end\n end",
"def fields(attributes = nil)\n clone.tap { |crit| crit.options[:fields] = attributes || {} }\n end",
"def mask\n raw_value\n end",
"def with_attribute(_, *attributes)\n # TODO: Test lots of databases\n bitmask_query attributes, \"#{table_name}.#{field_name} & :mask = :mask\"\n end",
"def none_of_number(*field_names)\n ~self.any_of_number(*field_names)\n end",
"def mask\n @mask ||= self.class.masks[depth]\n end",
"def selected_fields\n return @selected_fields unless @selected_fields.nil?\n\n fields = [*options[:select]].map { |f| f.split(',') }.flatten\n fields.concat(required_fields) if @fasta && !fields.empty?\n @selected_fields = fields.map { |f| glob_to_regex(f) }\n end",
"def object_mask(*args)\n raise ArgumentError, \"object_mask expects object mask strings\" if args.empty? || (1 == args.count && !args[0])\n raise ArgumentError, \"object_mask expects strings\" if args.find{ |arg| !arg.kind_of?(String) }\n\n mask_parser = ObjectMaskParser.new()\n object_masks = args.collect { |mask_string| mask_parser.parse(mask_string)}.flatten\n object_mask = (@parameters[:object_mask] || []) + object_masks\n\n # we create a new object in case the user wants to store off the\n # filter chain and reuse it later\n APIParameterFilter.new(self.target, @parameters.merge({ :object_mask => object_mask }));\n end",
"def remove_fields_by_uids(uids)\n @fields.reject! {|field| !uids.include?(field.uid)}\n end",
"def masking?; true; end",
"def fields(*args)\n return @fields if args.empty?\n @fields = args.flatten.compact.map{|i| i.to_sym}\n end",
"def allowedonly()\n merge(gaallowedonly: 'true')\n end",
"def set_dismantle_mask_flags(flag = true)\n return unless self.is_a?(RPG::Item) || self.is_a?(RPG::EquipItem)\n @dismantle_items.each do |obj| obj.mask = flag end\n end",
"def mask_columns_with_null(column_names, mask)\n if mask.size != column_names.size\n raise \"Columns has #{column_names.size} elements, but mask has only #{mask.size}\"\n end\n\n new_columns = []\n column_names.each_with_index{ |c,i| new_columns << (mask[i] ? c : 'null')}\n new_columns\n end",
"def possible_fields(map, nums)\n result = Set.new()\n map.each do |field, ranges|\n if all_in_ranges?(nums, ranges)\n result << field \n end\n end\n result\nend",
"def sencha_fields(*params)\n self.sencha_fieldset(:default, {\n :fields => params\n })\n end",
"def restrictions\n only = association.options[:only].to_a.collect(&:to_s)\n only.empty? ? table_columns : only\n end",
"def mask(type = MASK_IP)\n case :type\n when MASK_IP\n return @mask_ip\n when MASK_HEX\n return @mask_hex\n else\n return @mask_cidr\n end\n end",
"def server_object_mask\n if parameters[:object_mask] && !parameters[:object_mask].empty?\n\n # Reduce the masks found in this object to a minimal set\n #\n # If you pass the API a mask that asks for the same property twice (within\n # the same type scope), the API treats it as an error (and throws an exception)\n #\n # We get around that by parsing the various masks that have been given to us\n # merging their properties where possible, thereby removing the duplicates\n # from the mask that actually gets passed to the server. As a side benefit,\n # the mask we send to the server will be streamlined; without too many extraneous\n # characters\n reduced_masks = parameters[:object_mask].inject([]) do |merged_masks, object_mask|\n mergeable_mask = merged_masks.find { |mask| mask.can_merge_with? object_mask }\n if mergeable_mask\n mergeable_mask.merge object_mask\n else\n merged_masks.push object_mask\n end\n\n merged_masks\n end\n\n if reduced_masks.count == 1\n reduced_masks[0].to_s\n else\n \"[#{reduced_masks.collect{|mask| mask.to_s}.join(',')}]\"\n end\n else\n nil\n end\n end",
"def process_select_and_deny_fields\r\n only = @form['result_set']['select_fields'] || @form['result_set']['only']\r\n @records = @records.only( separated_to_symbols(only) ) if only\r\n\r\n without = @form['result_set']['deny_fields'] || @form['result_set']['without']\r\n @records = @records.without( separated_to_symbols(without) ) if without\r\nend",
"def any_of_number(*field_names)\n self.bits_for(*field_names).reduce(0) { |m, bit| m | (1 << bit) }\n end",
"def custom_fields_safe_setters\n custom_fields_recipe['rules'].map do |rule|\n case rule['type'].to_sym\n when :date, :date_time, :money then \"formatted_#{rule['name']}\"\n when :file then [rule['name'], \"remove_#{rule['name']}\", \"remote_#{rule['name']}_url\"]\n when :select, :belongs_to then [\"#{rule['name']}_id\", \"position_in_#{rule['name']}\"]\n when :has_many, :many_to_many then nil\n else\n rule['name']\n end\n end.compact.flatten\n end",
"def pluck(*fields)\n fields = fields.flatten(1).reject(&:blank?).map(&:to_s)\n\n source_fields = fields - EVERFIELDS\n scope = except(FIELD_STORAGES, EXTRA_STORAGES)\n .source(source_fields.presence || false)\n\n hits = raw_limit_value ? scope.hits : scope.scroll_hits(batch_size: DEFAULT_PLUCK_BATCH_SIZE)\n hits.map do |hit|\n if fields.one?\n fetch_field(hit, fields.first)\n else\n fields.map do |field|\n fetch_field(hit, field)\n end\n end\n end\n end",
"def required_fields\n required_fields = []\n ignore_fields = [:id, :date_entered, :date_modified]\n self.fields.each_value do |field|\n next if ignore_fields.include? field[\"name\"].to_sym\n required_fields << field[\"name\"].to_sym if field[\"required\"] == 1\n end \n required_fields\n end",
"def required_fields\n required_fields = []\n ignore_fields = [:id, :date_entered, :date_modified]\n self.fields.each_value do |field|\n next if ignore_fields.include? field[\"name\"].to_sym\n required_fields << field[\"name\"].to_sym if field[\"required\"] == 1\n end \n required_fields\n end",
"def masking?; false; end",
"def option_to_mask(options, all_options)\n mask = 0\n options.each do |key|\n if all_options.keys.include?(key)\n mask = mask | all_options[key]\n else\n raise \"option not supported: #{key}. must be one of: #{all_options.keys}\"\n end\n end\n mask\n end",
"def masked_val(value, mask)\n \nend",
"def fields(names)\r\n names.each { |name| @template.concat(field(name)) }\r\n ''\r\n end",
"def fields\n return @fields if defined?(@fields)\n\n @fields = array_of_items_for(Fields, :fields)\n end",
"def space_mask(lines)\n max_line_length = lines.map{ |a| a.length }.max\n lines.inject([true] * max_line_length){ |mask, line|\n mask.zip(line).\n map{ |a, b| a && (!b || b == SPACE) }}\n end",
"def non_relationship_fields\n self.fields.select { |field| !field.is_relationship? }\n end",
"def calc_date_mask(field_name)\n if params[:product][:\"#{field_name}(2i)\"] == '' and params[:product][:\"#{field_name}(3i)\"] != ''\n return\n elsif params[:product][:\"#{field_name}(2i)\"] == ''\n params[:product][:\"#{field_name}(2i)\"] = '1'\n params[:product][:\"#{field_name}(3i)\"] = '1'\n params[:product][:\"#{field_name}_mask\"] = :year\n elsif params[:product][:\"#{field_name}(3i)\"] == ''\n params[:product][:\"#{field_name}(3i)\"] = '1'\n params[:product][:\"#{field_name}_mask\"] = :year_month\n else\n params[:product][:\"#{field_name}_mask\"] = :year_month_day\n end\n end",
"def mask_protected_sequences\n # protect __send__, __FILE__, etc.\n @str.gsub!(/__([a-z]+)__/i,\n \"_#{PROTECT_ATTR}_#{PROTECT_ATTR}\\\\1_#{PROTECT_ATTR}_#{PROTECT_ATTR}\")\n @str.gsub!(/(\\A|[^\\\\])\\\\([#{Regexp.escape @protectable.join}])/m,\n \"\\\\1\\\\2#{PROTECT_ATTR}\")\n @str.gsub!(/\\\\(\\\\[#{Regexp.escape @protectable.join}])/m, \"\\\\1\")\n end",
"def mask_params\n params.require(:mask).permit(:phone_number, :number_id)\n end",
"def add_mask(mod)\n\n unless const_defined? \"MASKS\"\n const_set(\"MASKS\",Hash.new)\n end\n\n unless const_defined? \"MASK_INFO\"\n const_set(\"MASK_INFO\",Hash.new)\n end\n\n unless const_defined? \"Masked\"\n const_set(\"Masked\",Module.new)\n end\n\n tmod = mod.name.gsub(\"::\",\"_\")\n\n cln = mod.clone\n\n self::Masked.const_set(tmod,cln)\n\n trans = []\n\n cln.instance_methods(false).each do |m|\n meth = m.to_sym\n masked_name = \"__#{tmod}_#{(mod.object_id + cln.object_id).abs}_#{m}\".to_sym\n\n self::MASK_INFO[masked_name] = mod\n\n trans << [meth, masked_name]\n\n cln.module_eval <<-CODE\n alias #{masked_name} #{meth}\n remove_method(:#{meth})\n CODE\n end\n\n module_eval { include cln }\n\n trans.each do |t|\n name, meth = t[0], t[1]\n\n cln_method = cln.instance_method(meth)\n self::MASK_INFO[cln_method] = self::MASK_INFO[meth]\n self::MASK_INFO.delete meth\n\n cln.module_eval \"remove_method :#{meth}\"\n\n if self::MASKS.key? name\n self::MASKS[name].unshift cln_method\n else\n original_method = instance_method(name)\n self::MASKS[name] = [cln_method, original_method]\n self::MASK_INFO[original_method] = self\n\n module_eval(<<-CODE,\"maskable.rb\",70)\n if instance_methods.include? \"#{name}\"\n remove_method :#{name}\n end\n\n def #{name}(*a,&b)\n mk = Method::Mask.new(:#{name}, self, \n self.class::MASKS[:#{name}], a, b)\n if Thread.current['__running_mask']\n Thread.current['__running_mask'] << mk\n else\n Thread.current['__running_mask'] = [mk]\n end\n \n return Method.rest\n ensure\n if Thread.current['__running_mask'].size == 1\n Thread.current['__running_mask'] = []\n else\n Thread.current['__running_mask'].pop\n end\n end\n\n CODE\n end\n end\n end",
"def allowed_fields(aAbility)\n\t\t\tinner_query_fields(aAbility)\n\t\tend",
"def custom_fields_safe_attributes\n self.custom_fields_recipe['rules'].map do |rule|\n case rule['type'].to_sym\n when :date then \"formatted_#{rule['name']}\"\n when :file then [rule['name'], \"remove_#{rule['name']}\"]\n when :select, :belongs_to then [\"#{rule['name']}_id\", \"position_in_#{rule['name']}\"]\n when :has_many, :many_to_many then nil\n else\n rule['name']\n end\n end.compact.flatten\n end",
"def get_mask(groups)\n mask = 0\n groups.split.each do |i|\n selected = @friendgroups.find { |g| g['name'] == i}\n if selected.nil?\n raise LjException.new(LJERR_BAD_FGROUP,\"Invalid friends group '#{i}'\")\n else\n mask += 2 ** selected['id']\n end\n end\n return mask\n end",
"def dilate mask\n morph mask, :dilate\n end",
"def difference_fields(base_fields, remove_fields)\n fields(base_fields.to_a - remove_fields.to_a)\n end",
"def allowed_fields=(arr) # :nodoc:\n @allowed_fields = transform_fields('allowed_fields',arr)\n end",
"def mask_with_a_care!(mask)\n original_addr = @addr\n mask_without_a_care!(mask)\n @addr = original_addr unless self.class.mask_by_default\n return self\n end",
"def editable_fields(obj)\n \tobj.attributes.select {|key| key.start_with? \"need_to_edit_\"}\n end",
"def pin_pattern_exclude(*pin_ids)\n if pin_ids.last.is_a?(Hash)\n options = pin_ids.pop\n else\n options = {}\n end\n pin_ids.each do |id|\n if pin_aliases[id]\n Origen.app.pin_names[pin_aliases[id].first] = id\n id = pin_aliases[id].first\n end\n Origen.app.pin_pattern_exclude << id\n end\n Origen.app.pin_pattern_exclude << options unless options.empty?\n end"
]
| [
"0.70332766",
"0.63485366",
"0.6307429",
"0.562097",
"0.550545",
"0.5471939",
"0.5459215",
"0.54271746",
"0.5417391",
"0.54117924",
"0.5371074",
"0.52499115",
"0.5242881",
"0.5218936",
"0.52105075",
"0.51930135",
"0.5143433",
"0.5108858",
"0.5104175",
"0.5073474",
"0.50555354",
"0.5055506",
"0.50491667",
"0.50437623",
"0.5040102",
"0.5010724",
"0.49920374",
"0.4965242",
"0.49540928",
"0.49301666",
"0.49210104",
"0.49193898",
"0.4907836",
"0.48855132",
"0.48719224",
"0.48588952",
"0.48569438",
"0.48566625",
"0.48518035",
"0.48292243",
"0.4822215",
"0.48010615",
"0.4794136",
"0.4781372",
"0.47801054",
"0.47791946",
"0.47736624",
"0.47657382",
"0.47656804",
"0.47611585",
"0.47502592",
"0.47392625",
"0.4732901",
"0.47172943",
"0.47071156",
"0.4706152",
"0.47054604",
"0.47042686",
"0.46942943",
"0.46633387",
"0.46543428",
"0.46530727",
"0.46437392",
"0.46395344",
"0.4638127",
"0.46338925",
"0.46332696",
"0.46248716",
"0.45976385",
"0.45957363",
"0.45956823",
"0.45935068",
"0.458243",
"0.45787102",
"0.4552853",
"0.45449424",
"0.4542745",
"0.45401984",
"0.4536084",
"0.4536084",
"0.4527792",
"0.4520536",
"0.45185903",
"0.45183152",
"0.45051056",
"0.45022073",
"0.44977766",
"0.4490401",
"0.44884324",
"0.44874498",
"0.4484049",
"0.44839397",
"0.44822213",
"0.4467894",
"0.44677055",
"0.44646388",
"0.44629192",
"0.44584474",
"0.44523862",
"0.44490692"
]
| 0.60703146 | 3 |
Sets one or more bitfields to 0 within a column +reset_bitfield :column, :fields | def reset_bitfields column_name, *fields
mask = reset_mask_for column_name, *fields
update_all "#{column_name} = #{column_name} & #{mask}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_mask_for column_name, *fields\n fields = bitfields if fields.empty?\n max = bitfield_max(column_name)\n (0..max).sum{|i| 2 ** i} - only_mask_for(column_name, *fields)\n end",
"def clear\n @field.each_index { |i| @field[i] = 0 }\n end",
"def increment_bitfields column_name, *fields\n mask = increment_mask_for column_name, *fields\n update_all \"#{column_name} = #{column_name} + #{mask}\"\n end",
"def reset_fields\n if self.is_default?\n self.applies_to_all = true\n self.codes = []\n elsif self.applies_to_all?\n self.codes = []\n end\n\n return true\n end",
"def increment_bitfields column_name, *fields\n mask = self.class.increment_mask_for column_name, *fields\n self[column_name] = self[column_name] += mask\n save\n end",
"def only_mask_for column_name, *fields\n fields = bitfields if fields.empty?\n column = @@bitfields[column_name]\n max = bitfield_max(column_name)\n raise ArgumentError, \"Unknown column for bitfield: #{column_name}\" if column.nil?\n\n column.sum do |field_name, range|\n fields.include?(field_name) ? range.invert(max).sum{|i| 2 ** i} : 0\n end\n \n # fields.inject(\"0\" * (bitfield_max(column_name) + 1)) do |mask, field_name|\n # raise ArugmentError, \"Unknown field: #{field_name} for column #{column_name}\" if column[field_name].nil?\n # range = column[field_name]\n # mask[range] = \"1\" * range.count\n # mask\n # end.to_i(2)\n end",
"def reset_flags\n @flags = { :zero => false , :plus => false ,\n :minus => false , :overflow => false }\n end",
"def reset_fields\n each_field_name do |key|\n reset_field(key)\n end\n end",
"def flags_clear!()\n @flags = 0\n end",
"def reset_column_information\n @available_flag = nil\n super\n end",
"def reset_column_information\n @available_flag = nil\n super\n end",
"def clear_fields\n\t\tend",
"def zero\n 0.upto(@words-1) do |w|\n @bits[w] = 0\n end\n end",
"def reset\n self.members.each_with_index do |member, i|\n # First field -> primary key, set to nil to invalidate the entry\n if i == 0\n self[i] = nil\n else\n self[i] = case member.to_s[0]\n when 'r', 'i' then 0 # r or i\n when 's', 'm' then '' # s or m\n when 'f' then 0.0\n else\n raise 'Unknown data type'\n end\n end\n end\n return self\n end",
"def clear_flags\n each(&:clear_flags)\n self\n end",
"def set_all!(key)\n @klass.update_all(\"#{@column} = COALESCE(#{@column}, 0) | #{@maps[key]}\")\n end",
"def reset_cleared_default_fields\n @cleared_default_fields = {}\n end",
"def initialize(bits_)\n @bits = nil\n @bits = bits_\n end",
"def pack_bit_fields\n @unpacked = []\n \n self.class.fields.each_with_index do |name, position|\n \n if bit_fields = self.class.bit_fields[name]\n \n bit_value = 0\n bit_fields.each do |(bit_name, bits_number, bit_mask)|\n masked = @attributes[bit_name] & bit_mask\n \n raise ValueOverflow, \n \"the value #{@attributes[bit_name]} \"+\n \"is too big for #{bits_number} bits\" if masked != @attributes[bit_name]\n \n bit_value = bit_value << bits_number\n bit_value |= masked\n end\n \n # Value of fields composed by binary fields is always overwritten\n # by the composition of the latter\n attributes[name] = bit_value\n end\n \n @unpacked[position] = @attributes[name] || 0\n \n end\n \n @raw = @unpacked.pack( self.class.unpack_recipe )\n end",
"def none_of_number(*field_names)\n ~self.any_of_number(*field_names)\n end",
"def initialize\n initialize__bit_set(BITS)\n end",
"def clear\n @@fields.each do |field|\n self.instance_variable_set(\"@\"+field.to_s,nil)\n end\n end",
"def clear(bit)\n set(bit, false)\n end",
"def increment_mask_for column_name, *fields\n fields = bitfields if fields.empty?\n column = @@bitfields[column_name]\n raise ArgumentError, \"Unknown column for bitfield: #{column_name}\" if column.nil?\n fields.sum do |field_name|\n raise ArugmentError, \"Unknown field: #{field_name} for column #{column_name}\" if column[field_name].nil?\n 2 ** (bitfield_max(column_name) - column[field_name].last)\n end\n end",
"def clearBitsIthrough0(num, i)\n mask = -1 << i\n mask & num\n end",
"def set_bits\n bits = []\n 0.upto(63) {|i| bits << i if set?(i)}\n bits\n end",
"def clear!\n fields.each { |tag, field| self.__send__(\"#{field.name}=\", nil) }\n end",
"def empty_bits(_options = {})\n array_span = (0..(size - 1)).to_a\n empty_bits = array_span - used_bits\n empty_bits\n end",
"def clear_flags\n @regs.each(&:clear_flags)\n end",
"def off!(indexes)\n Array(indexes).each do |index|\n validate_index(index)\n @bits &= ~(1 << index)\n end\n end",
"def delete_bit(collection)\n [collection.name].flatten.each do |name|\n @lookup.delete(name)\n end\n collection.each do |bit|\n @bits.delete_at(bit.position) # Remove the bit\n @bits.insert(bit.position, Bit.new(self, bit.position, writable: @init_as_writable))\n end\n self\n end",
"def reset_default_fields\n self.cleared_default_fields.each do |k, v|\n self.send(\"#{k}=\", v)\n end\n end",
"def fields!(fields = nil)\n mutate(:fields, fields)\n end",
"def unset(*fields)\n prepare_atomic_operation do |ops|\n fields.flatten.each do |field|\n normalized = database_field_name(field)\n if executing_atomically?\n process_attribute normalized, nil\n else\n attributes.delete(normalized)\n end\n ops[atomic_attribute_name(normalized)] = true\n end\n { \"$unset\" => ops }\n end\n end",
"def clear_flags\n @flags = 0\n write\n end",
"def bits_set\n (\"%b\" % self).count('1')\n #to_s(2).count('1') # alternative\n #count = 0 # alternative\n #byte = self.abs\n #count += byte & 1 and byte >>= 1 until byte == 0 # cf. http://snippets.dzone.com/posts/show/4233\n #count\n end",
"def reset_counters!\n reload!\n self.class.counter_columns.each do |cc|\n counter = self.send(cc.name)\n counter.reset! unless counter.nil?\n end\n save\n end",
"def value_setter(column_name, values_or_symbols_array, mapping)\n send(\"#{column_name}=\", 0)\n values_or_symbols_array.each { |val| add_value(column_name, force_to_bitwise_value(val, mapping)) }\n end",
"def unset(position)\n # duplicated code to avoid a method call\n @field[position / ELEMENT_WIDTH] &= ~(1 << (position % ELEMENT_WIDTH))\n end",
"def reset_column_information\n generated_methods.each { |name| undef_method(name) }\n @column_names = @columns_hash = @content_columns = @dynamic_methods_hash = @generated_methods = nil\n end",
"def remove_all()\n @field_weights = Array.new\n end",
"def reset_available_custom_fields\n Project.reset_available_custom_fields\n end",
"def with_msb0\n @with_bit_order = :msb0\n self\n end",
"def reset_flags\n self.people.update_all(paired: false, attempted: false)\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 reset_unnecessary_fields\n self.department_id = nil\n self.media = nil\n self.telephone = nil\n self.organization = nil\n self.stream_flow_ids = []\n self.public_role_es = nil\n self.public_role_eu = nil\n self.public_role_en = nil\n self.gc_id = nil\n self.description_es = nil\n self.description_eu = nil\n self.description_en = nil\n self.politician_has_agenda = nil\n end",
"def bitfield_args\n @bitfield_args ||= []\n end",
"def reset_flag_count\n Flag.create(memory_id: self.id, user_id: user.id, message: \"Flagcount Reset by administrator #{user.username}\")\n self.flagcount = 0\n self.save\n end",
"def set_zeros_in_columns(matrix, row)\n matrix.length.times { |column_index| matrix[row][column_index] = 0 }\nend",
"def reset_field(key)\n field = self.class.fetch_field(key)\n field_set key, field.make_default(self)\n end",
"def zero_all\n UkAccountValidator::ModulusWeight.new(\n modulus_weight.sort_code_start,\n modulus_weight.sort_code_end,\n modulus_weight.modulus,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n modulus_weight.exception\n )\n end",
"def test_006_clear()\n TestVals.each do |sVal|\n bs = BitString.new(sVal)\n tbs = bs.clear\n assert_equal(sVal.to_i(2),\n bs.to_i,\n \"Test that '#{sVal}'.clear() leaves original set\")\n assert_equal(0,\n tbs.to_i,\n \"Test that '#{sVal}'.clear() returns cleared bitstring\")\n bs.clear!\n assert_equal(0,\n bs.to_i,\n \"Test that '#{sVal}'.clear!() clears original bitstring\")\n end\n end",
"def clear!\n set_ds_field []\n end",
"def clear!\n set_ds_field []\n end",
"def cleared_default_fields\n @cleared_default_fields || {}\n end",
"def reset()\n\n\t\t@aChecksum = [ 0xFF, 0xFF ];\n\n\tend",
"def none_of(*field_names)\n [].tap do |list|\n lack_num = any_of_number(*field_names)\n self.each_value { |num| list << num if (num & lack_num) == 0 }\n end\n end",
"def reset_fields\n self.sender_doc_id_version = nil\n self.receiver_doc_id_version = nil\n self.project_doc_id_version = nil\n self.submission_receiver_doc_id = nil\n self.submission_project_doc_id = nil\n self.response_sender_doc_id = nil\n self.response_project_doc_id = nil\n self.plnd_submission = nil\n self.actl_submission = nil\n self.xpcd_response = nil\n self.actl_response = nil\n self.response_status = nil\n end",
"def clear(row, col)\n if within_field?(row, col) && !cell_cleared?(row, col)\n @field[row][col].clear\n if contains_mine?(row, col)\n @field[row][col].detonate\n else\n if adjacent_mines(row, col) == 0\n clear(row - 1, col - 1)\n clear(row - 1, col)\n clear(row - 1, col + 1)\n clear(row, col - 1)\n clear(row, col + 1)\n clear(row + 1, col - 1)\n clear(row + 1, col)\n clear(row + 1, col + 1)\n end\n end\n end\n end",
"def clear_columns\n @columns = []\n end",
"def set_zeroes(matrix)\n marked_rows = []\n marked_cols = []\n\n matrix.each_with_index do |row_arr, row_idx|\n row_arr.each_with_index do |cell, col_idx|\n if cell == 0\n marked_rows << row_idx unless marked_rows.include?(row_idx)\n marked_cols << col_idx unless marked_cols.include?(col_idx)\n end\n end\n end\n\n matrix.each_with_index do |row_arr, row_idx|\n row_arr.each_with_index do |_, col_idx|\n if marked_rows.include?(row_idx) || marked_cols.include?(col_idx)\n matrix[row_idx][col_idx] = 0\n end\n end\n end\n\n matrix\nend",
"def zero_out_the_nulls\n %w(churn\n num_owners\n num_reviews\n num_reviewers \n num_participants\n num_security_experienced_participants\n num_bug_security_experienced_participants\n num_stability_experienced_participants\n num_build_experienced_participants\n num_test_fail_experienced_participants\n num_compatibility_experienced_participants\n security_adjacencys\n avg_sheriff_hours\n num_future_regression_bugs\n num_future_compat_bugs\n num_future_security_bugs\n num_future_stabil_crash_bugs\n num_future_stabil_mem_address_bugs\n num_regression_word_used\n num_compat_word_used\n num_security_word_used\n num_stabil_crash_word_used\n num_stabil_mem_address_word_used\n ).each do |col|\n zero_the_nulls = \"UPDATE release_filepaths SET #{col}=0 WHERE #{col} IS NULL\"\n ActiveRecord::Base.connection.execute zero_the_nulls\n end\n end",
"def clear_damage_values\n mrts_conditional_drops_clear_damage_values\n @element = 0\n end",
"def reset_data(value = nil)\n # This method was originally setup to set the reset value by passing an argument\n if value\n shift_out_with_index { |bit, i| bit.reset_val = value[i] }\n self\n else\n data = 0\n shift_out_with_index do |bit, i|\n return bit.reset_data if bit.reset_data.is_a?(Symbol)\n\n data |= bit.reset_data << i\n end\n data\n end\n end",
"def set(bit, value = true)\n if value\n @bits = union convert_bit(bit)\n @set_indexes << bit unless @set_indexes.include?(bit)\n elsif set?(bit)\n @bits = xor convert_bit(bit)\n @set_indexes.delete(bit)\n end\n\n @bits\n end",
"def bit_field name, width\n raise \"'bit_field' can be used only inside a 'field' block.\" if @_current_bit_fields.nil?\n \n # Register the bit field definition\n @_current_bit_fields << [name, width, bit_mask(width)]\n \n # Define the attribute accessor\n bits_attr_accessor(name)\n \n if width == 1 or name.to_s =~ /_flag$/\n # Define a question mark method if the size is 1 bit\n class_eval \"def #{name}?; self.attributes[#{name.inspect}] != 0; end\\n\", __FILE__, __LINE__\n \n # returns nil if no substitution happens...\n if flag_method_name = name.to_s.gsub!(/_flag$/, '?')\n # Define another question mark method if ends with \"_flag\"\n class_eval \"alias #{flag_method_name} #{name}?\\n\", __FILE__, __LINE__\n end\n end\n \n end",
"def reset_dummy(options = {})\r\n options[:with_processed] = true unless options.key?(:with_processed)\r\n build_dummy_table(options[:with_processed])\r\n reset_class(\"Dummy\", options)\r\nend",
"def setbit(key, offset, value); end",
"def setbit(key, offset, value); end",
"def zero_matrix\n @zeroed_rows = Set.new\n @zeroed_cols = Set.new\n matrix = @matrix.dup\n\n find_zeros\n zeroize_rows(matrix)\n zeroize_cols(matrix)\n\n Matrix.new matrix\n end",
"def unflag(cell)\n announce_unflag(cell)\n @minefield.unflag(cell)\n end",
"def reset\n # The read and write caches are Arrays. We use the _bits_ least\n # significant bits of the PEROBS::ObjectBase ID to select the index in\n # the read or write cache Arrays.\n @reads = ::Array.new(2 ** @bits)\n @writes = ::Array.new(2 ** @bits)\n @transaction_stack = ::Array.new\n @transaction_thread = nil\n @transaction_objects = ::Hash.new\n end",
"def any_of_number(*field_names)\n self.bits_for(*field_names).reduce(0) { |m, bit| m | (1 << bit) }\n end",
"def set_bits(n, m, i, j)\n #Reset N's bits to zero from i to j(backwards starting with 0)\n #Set M's bit to N starting from j\n\n max = ~0\n #1's till position j, then zeroes\n left_bits = max - ((1<<j)-1)\n right_bits = ((1<<i)-1)\n mask = left_bits | right_bits\n (n & mask) | (m << i)\nend",
"def clear_field(field_name)\n\t\tend",
"def on!(indexes)\n Array(indexes).each do |index|\n validate_index(index)\n @bits |= (1 << index)\n end\n end",
"def unflag_row_deltas\n logger.debug \"Resetting row delta flags for #{name}\"\n q = \"UPDATE #{audit} SET `_has_delta` = 0\"\n db.query(q)\n end",
"def bits=(bits)\n @bits = bits\n init_vars\n end",
"def set_zero_flag_from(actual_value)\n\t\[email protected]_bit_at(ZERO_FLAG, (actual_value.zero? ? 1 : 0))\n\tend",
"def not\n ~@bits\n end",
"def reset_fields\n self.outpost_queued = false\n # outpost_prevent is set and reset at end of previous turn\n # pirate_coins persists turn after turn\n self.gained_last_turn = []\n self.bought_victory = false\n self.played_treasure = false\n self.played_crossroads = false\n self.played_fools_gold = false\n save!\n end",
"def _zero_iv_bits(iv)\n iv = iv.dup\n iv.setbyte(8, iv.getbyte(8) & 0x7f)\n iv.setbyte(12, iv.getbyte(12) & 0x7f)\n iv\n end",
"def set_cell_status_null\n\t\t@cell_status.each_key do |key|\n\t\t\t@cell_status[key]=0\n\t\tend\n\tend",
"def null_controlled_fields!(attrs)\n ::ScoobySnacks::METADATA_SCHEMA.controlled_field_names.each do |field_name|\n # do not null fields that are not being changed\n next unless attrs.keys.include?(\"#{field_name}_attributes\")\n\n object.public_send(\"#{field_name}=\", [])\n end\n end",
"def set_fields(params=nil)\n params ||= {}\n if params[:bits] and params[:addr]\n raise( ::ArgumentError, \n \"Don't use :addr and :bits fields together. \"+\n \"Just use :addr => 'x.x.x.x/nn' where nn are the bits.\" )\n else\n super(params)\n end\n end",
"def set_zeroes(matrix)\n row = Array.new(matrix.length, false)\n col = Array.new(matrix[0].length, false)\n \n (0...matrix.length).each do |i|\n (0...matrix[0].length).each do |j|\n if matrix[i][j] == 0\n row[i] = true\n col[j] = true\n end\n end\n end\n (0...matrix.length).each do |i|\n (0...matrix[0].length).each do |j|\n if row[i] || col[j]\n matrix[i][j] = 0\n end\n end\n end\n matrix\nend",
"def changed_bits(options = {})\n temp = named_bits.select { |name, bits| bits.data != bits.reset_val }\n temp.each do |r|\n Origen.log.info \"\\t\\t#{self.name}.#{r[0]} : #{r[1].value.to_hex}\".bold.blue\n end\n Origen.log.info ' '\n end",
"def zero\n self.group = []\n end",
"def reset_all_nodes\n nodes.where(net_id: id).each do |node|\n node.output = 0\n node.total_input = 0\n node.save\n end\n end",
"def clr_only(value)\n shift_out_with_index { |bit, i| bit.clr_only = (value[i] == 0b1) }\n self\n end",
"def reset_flags\n @flags[:chat?] = false\n @flags[:graphic?] = false\n @flags[:animation?] = false\n #@flags[:state?] = false\n @flags[:region?] = false\n @flags[:forced_chat?] = false\n @flags[:teleport?] = false\n @flags[:moved?] = false\n end",
"def blank_out_fields(record, fields)\n fields.to_a.each do |field|\n record[field.to_sym] = '' if record[field.to_sym].nil?\n end\n record\n end",
"def clear_default_fields\n reset_cleared_default_fields\n self.default_fields.each do |k, v|\n if respond_to?(\"#{k}=\") && unescape(self.send(\"#{k}\")) == unescape(v)\n add_to_cleared_default_fields(k, self.send(\"#{k}\")) and self.send(\"#{k}=\", \"\")\n end\n end\n end",
"def clear_all_gutsable_flags\n all_battle_members.each do |member|\n member.gutsable = false\n end\n end",
"def clear\n @my_field.set!(@len, @coord[0], @coord[1], @hor)\n end",
"def free_fields\n free_pieses(@battle_field) + free_pieses(@battle_field.transpose)\n end",
"def clean_up\n @minefield = nil\n end",
"def clear!\n @columns.clear\n @columns_hash.clear\n @primary_keys.clear\n @tables.clear\n @version = nil\n end",
"def mask\n (@bound_fields + @unbound_fields + @operands).map do |(field,_)|\n WordField[field].mask\n end.inject do |memo,field_mask|\n memo | field_mask\n end\n end",
"def reset_is_default_flags\n if self.is_default == true\n self.dataset.weights.get_all_but(self.id).update_all(is_default: false)\n end\n end"
]
| [
"0.7262586",
"0.6679082",
"0.6489623",
"0.61005795",
"0.6023518",
"0.59675944",
"0.59645706",
"0.5939816",
"0.592227",
"0.5879115",
"0.5879115",
"0.58146495",
"0.56871295",
"0.5653341",
"0.5648795",
"0.5642839",
"0.5557983",
"0.54491323",
"0.5445896",
"0.54279023",
"0.5410517",
"0.5407804",
"0.5405802",
"0.540375",
"0.5395022",
"0.5393971",
"0.5364028",
"0.53450036",
"0.5323645",
"0.5310939",
"0.5298329",
"0.5283565",
"0.5261959",
"0.5252713",
"0.524605",
"0.524083",
"0.5238209",
"0.52161974",
"0.5213302",
"0.5191002",
"0.5183686",
"0.5148552",
"0.51404035",
"0.513299",
"0.5129068",
"0.512628",
"0.5113677",
"0.509326",
"0.5085986",
"0.5057101",
"0.50513864",
"0.5050808",
"0.5037646",
"0.5037646",
"0.50193614",
"0.49882552",
"0.49852356",
"0.49704915",
"0.4964666",
"0.49629194",
"0.4960272",
"0.49506027",
"0.49464172",
"0.49429768",
"0.49349758",
"0.49347225",
"0.4931967",
"0.49119696",
"0.49119696",
"0.490414",
"0.49011394",
"0.48927087",
"0.4892127",
"0.48900443",
"0.48881552",
"0.48733875",
"0.48718533",
"0.4871348",
"0.48657012",
"0.48649812",
"0.4863372",
"0.48619488",
"0.48615244",
"0.4858317",
"0.48557317",
"0.4837974",
"0.48316124",
"0.482846",
"0.48267806",
"0.4822932",
"0.48180857",
"0.48113978",
"0.48107487",
"0.48093417",
"0.4808004",
"0.48067278",
"0.48021913",
"0.47984934",
"0.47923973",
"0.47687015"
]
| 0.85810494 | 0 |
Increases one or more bitfields by 1 value +increment_bitfield :column, :fields | def increment_bitfields column_name, *fields
mask = increment_mask_for column_name, *fields
update_all "#{column_name} = #{column_name} + #{mask}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def increment_bitfields column_name, *fields\n mask = self.class.increment_mask_for column_name, *fields\n self[column_name] = self[column_name] += mask\n save\n end",
"def increment_mask_for column_name, *fields\n fields = bitfields if fields.empty?\n column = @@bitfields[column_name]\n raise ArgumentError, \"Unknown column for bitfield: #{column_name}\" if column.nil?\n fields.sum do |field_name|\n raise ArugmentError, \"Unknown field: #{field_name} for column #{column_name}\" if column[field_name].nil?\n 2 ** (bitfield_max(column_name) - column[field_name].last)\n end\n end",
"def reset_bitfields column_name, *fields\n mask = reset_mask_for column_name, *fields\n update_all \"#{column_name} = #{column_name} & #{mask}\"\n end",
"def bit_add(a, b)\n\t(7).downto(0).each do |x|\n\tend\nend",
"def inc_cursor_bits(cursor, cursor_bits, nbr_bits)\n nbr_bytes, result_cursor_bits = (cursor_bits + nbr_bits).divmod(8)\n return cursor + nbr_bytes, result_cursor_bits\n end",
"def increments(field, options = {})\n incrementing_fields[field] = options.reverse_merge!(auto: true)\n attr_protected(field) if respond_to?(:attr_protected)\n end",
"def hincrby(key, field, increment); end",
"def hincrby(key, field, increment); end",
"def op_increment!(field, amount = 1)\n unless amount.is_a?(Numeric)\n raise ArgumentError, \"Amount should be numeric\"\n end\n operate_field! field, { __op: :Increment, amount: amount.to_i }.freeze\n end",
"def hincrbyfloat(key, field, increment); end",
"def hincrbyfloat(key, field, increment); end",
"def only_mask_for column_name, *fields\n fields = bitfields if fields.empty?\n column = @@bitfields[column_name]\n max = bitfield_max(column_name)\n raise ArgumentError, \"Unknown column for bitfield: #{column_name}\" if column.nil?\n\n column.sum do |field_name, range|\n fields.include?(field_name) ? range.invert(max).sum{|i| 2 ** i} : 0\n end\n \n # fields.inject(\"0\" * (bitfield_max(column_name) + 1)) do |mask, field_name|\n # raise ArugmentError, \"Unknown field: #{field_name} for column #{column_name}\" if column[field_name].nil?\n # range = column[field_name]\n # mask[range] = \"1\" * range.count\n # mask\n # end.to_i(2)\n end",
"def inc_bc\n self.bc = (self.bc + 1) & 0xFFFF\n end",
"def reset_mask_for column_name, *fields\n fields = bitfields if fields.empty?\n max = bitfield_max(column_name)\n (0..max).sum{|i| 2 ** i} - only_mask_for(column_name, *fields)\n end",
"def increment!(field, options)\n options = options.dup\n model_name = (options.delete(:model_name) || self.class.model_name).to_s\n options[:scope] = evaluate_scope(options[:scope]) if options[:scope]\n options[:step] = evaluate_step(options[:step]) if options[:step]\n write_attribute(\n field.to_sym,\n Mongoid::Autoinc::Incrementor.new(model_name, field, options).inc\n )\n end",
"def inc(cb)\n c = 0\n additive = 0\n left_32 = cb.slice(12..15)\n while c<=4\n additive += left_32(c)\n c+=1\n end\n additive %= 4\n cb = cb.setbyte(15,additive)\nend",
"def pack_bit_fields\n @unpacked = []\n \n self.class.fields.each_with_index do |name, position|\n \n if bit_fields = self.class.bit_fields[name]\n \n bit_value = 0\n bit_fields.each do |(bit_name, bits_number, bit_mask)|\n masked = @attributes[bit_name] & bit_mask\n \n raise ValueOverflow, \n \"the value #{@attributes[bit_name]} \"+\n \"is too big for #{bits_number} bits\" if masked != @attributes[bit_name]\n \n bit_value = bit_value << bits_number\n bit_value |= masked\n end\n \n # Value of fields composed by binary fields is always overwritten\n # by the composition of the latter\n attributes[name] = bit_value\n end\n \n @unpacked[position] = @attributes[name] || 0\n \n end\n \n @raw = @unpacked.pack( self.class.unpack_recipe )\n end",
"def increment_and_save!\n update_and_save { self.last_value = (last_value || 0) + 1 }\n end",
"def update_auto_increments\n self.class.incrementing_fields.each do |field, options|\n increment!(field, options) if options[:auto]\n end && true\n end",
"def increment!(name,amount=1)\n raise ArgumentError, \"Only integer fields can be incremented.\" unless self.class.fields.include?({:name => name.to_s, :type => :integer})\n redis.incr(field_key(name), amount)\n end",
"def increment!(name,amount=1)\n raise ArgumentError, \"Only integer fields can be incremented.\" unless self.class.fields.include?({:name => name.to_s, :type => :integer})\n store.update_count(field_key(name), amount)\n end",
"def field_bc1(op)\n (op & 0x03ff0000) >> 16\nend",
"def read_field(*args)\n m = 0\n args.flatten.each_with_index do |bit, i|\n if bit.is_a?(Integer)\n m |= ((@value[bit] || 0) << i)\n end\n end\n m\n end",
"def hincrby(key, field, increment)\n node_for(key).hincrby(key, field, increment)\n end",
"def plus_one(digits)\n digits[-1] += 1 \n digits \nend",
"def increment_with_sql!(attribute, by = 1)\n raise ArgumentError(\"Invalid attribute: #{attribute}\") unless attribute_names.include?(attribute.to_s)\n original_value_sql = \"CASE WHEN `#{attribute}` IS NULL THEN 0 ELSE `#{attribute}` END\"\n self.class.update_all(\"`#{attribute}` = #{original_value_sql} + #{by.to_i}\", \"id = #{id}\")\n reload\n end",
"def bit_field name, width\n raise \"'bit_field' can be used only inside a 'field' block.\" if @_current_bit_fields.nil?\n \n # Register the bit field definition\n @_current_bit_fields << [name, width, bit_mask(width)]\n \n # Define the attribute accessor\n bits_attr_accessor(name)\n \n if width == 1 or name.to_s =~ /_flag$/\n # Define a question mark method if the size is 1 bit\n class_eval \"def #{name}?; self.attributes[#{name.inspect}] != 0; end\\n\", __FILE__, __LINE__\n \n # returns nil if no substitution happens...\n if flag_method_name = name.to_s.gsub!(/_flag$/, '?')\n # Define another question mark method if ends with \"_flag\"\n class_eval \"alias #{flag_method_name} #{name}?\\n\", __FILE__, __LINE__\n end\n end\n \n end",
"def any_of_number(*field_names)\n self.bits_for(*field_names).reduce(0) { |m, bit| m | (1 << bit) }\n end",
"def increment(field, amount = 1)\n #value = (self[field] || 0) + amount\n #self[field] = value\n #if !@parse_object_id\n # # TODO - warn that the object must be stored first\n # return nil\n #end\n\n body = {field => Parse::Increment.new(amount)}.to_json\n data = Parse.client.request(self.uri, :put, body)\n parse data\n self\n end",
"def growallfields\n @fields = Field.all\n @fields.each { |field|\n if (field.fstate != 5) then\n field.fstate = field.fstate + 1\n field.update_attribute(:fstate, field.fstate)\n end\n }\n render :xml => @fields\n end",
"def increment!\n @value += @increment\n \n self\n end",
"def set_next(value)\n increase_length\n\n new_index = (@index + 1) % @size\n previous = @bit_set.set(new_index, value == true) ? 1 : 0\n current = value == true ? 1 : 0\n\n\n @index = new_index\n @cardinality = @cardinality - previous + current\n end",
"def increase(custom_field_id, cells)\n ActiveRecord::Base.transaction do\n custom_field = CustomFields::AutoNumbering.find(custom_field_id)\n \n if self.unset_cells(custom_field, cells).empty?\n value = format_value(custom_field, cells)\n\n key_hash = AutoNumberRunning.key_hash(custom_field.format_key, value)\n\n auto_number_running = custom_field.auto_number_runnings.find(:first,\n :conditions => {\n :auto_number_runnings => { :key_hash => key_hash }\n }\n )\n auto_number_running ||= AutoNumberRunning.new(\n :key_hash => key_hash,\n :current => (custom_field.start_value - custom_field.increment)\n )\n\n custom_field.auto_number_runnings << auto_number_running if auto_number_running.new_record?\n auto_number_running.current = auto_number_running.current + custom_field.increment\n\n auto_number_running.save\n\n format_value(auto_number_running, cells)\n end\n end.to_s\n end",
"def set_bit integer, i\n integer | 0x80000000 >> i\n end",
"def zincrby(key, increment, member); end",
"def zincrby(key, increment, member); end",
"def incrby(key, increment); end",
"def incrby(key, increment); end",
"def add(o)\n validate_member!(o)\n @val |= 1 << o\n self\n end",
"def increment\n Dictionary.db.zincrby @key, 1, @value\n end",
"def hincrby(key, field, increment)\n send_command([:hincrby, key, field, Integer(increment)])\n end",
"def transform_numbers_field fields,row_size\n count = 0\n @numbers.each do |n,arr|\n i = fields.delete(n) # delete the old field\n ## replace by the new fields instead\n arr.each { |v| fields[v] = row_size + count; count += 1 }\n end\n return fields\n end",
"def inc_value(iIncrement = 1)\n super\n end",
"def calcIndex(inFields)\n index = 0\n field = 0\n @inMask.each_index do |i|\n index += inFields[i] << field\n field += @inMask[i] \n end\n index\n end",
"def increment\n @value += 1\n end",
"def incrbyfloat(key, increment); end",
"def incrbyfloat(key, increment); end",
"def []=(position, value)\n if value == 1\n @field[position / ELEMENT_WIDTH] |= 1 << (position % ELEMENT_WIDTH)\n elsif (@field[position / ELEMENT_WIDTH]) & (1 << (position % ELEMENT_WIDTH)) != 0\n @field[position / ELEMENT_WIDTH] ^= 1 << (position % ELEMENT_WIDTH)\n end\n end",
"def increase(attr)\n raise NoMethodError, \"undefined method `#{attr}` for #{self}\" unless self.respond_to?(attr)\n raise NotCounterbleError, \"not countable attributs `#{attr}` for #{self}\" unless countable.include? attr\n self.send(\"#{attr}=\", self.send(attr).send(:+, 1))\n end",
"def add_ins(obj)\n self.first.value = self.first.value + obj.first.value\n obj.type = 'int'\n self.type = 'int'\n end",
"def up(x=1)\n self.base_value += x\n self.save\n self.base_value\n end",
"def increment(node)\n change_by node, 1\n end",
"def incr major, minor\n incr_by major, minor, 1\n end",
"def set_incremental_index_on_field_types\n field_types.each_with_index do |field_type, index|\n field_type.index = index\n end\n end",
"def increment!(amount=1)\n raise RuntimeError, \"Data is not valid Binary: #{self}\" unless self.is_bitstring?\n\n size = self.length\n decimal = self.binary_to_decimal + amount\n\n if decimal > 255\n raise Bolverk::OverflowError, \"Cannot reference decimal value: #{decimal}\"\n else\n self.replace(decimal.to_s(base=2).rjust(size, \"0\"))\n end\n end",
"def setbit(key, offset, value); end",
"def setbit(key, offset, value); end",
"def <<(bits)\n value = @value * (2**bits.to_i)\n if (bounded?)\n self.class.new(value & self.mask, @length)\n else\n self.class.new(value)\n end\n end",
"def incr(x) x + 1 end",
"def incr\n add(1)\n end",
"def add(element)\n bin_row = bin_row(element)\n element_rows(element).each { |y|\n return false if ((@rows[y] & bin_row) != 0)\n }.each { |y|\n @rows[y] = @rows[y] | bin_row\n }\n self\n end",
"def increment_column!(attribute, by = 1)\n # \"foo\"\n increment(attribute, by).update_column(attribute, self[attribute])\n end",
"def grow_to_include(bit)\n new_size = Math.max(@bits.attr_length << 1, num_words_to_hold(bit))\n newbits = Array.typed(::Java::Long).new(new_size) { 0 }\n System.arraycopy(@bits, 0, newbits, 0, @bits.attr_length)\n @bits = newbits\n end",
"def increment_integer(user_id)\n user = User.find user_id\n user.integer_value += 1\n user.save\n\n user\n end",
"def total_set\n @field.inject(0) { |a, byte| a += byte & 1 and byte >>= 1 until byte == 0; a }\n end",
"def total_set\n @field.inject(0) { |a, byte| a += byte & 1 and byte >>= 1 until byte == 0; a }\n end",
"def bits_set\n (\"%b\" % self).count('1')\n #to_s(2).count('1') # alternative\n #count = 0 # alternative\n #byte = self.abs\n #count += byte & 1 and byte >>= 1 until byte == 0 # cf. http://snippets.dzone.com/posts/show/4233\n #count\n end",
"def total_set\n @field.each_byte.inject(0) { |a, byte| (a += 1; byte &= byte - 1) while byte > 0 ; a }\n end",
"def field_bc2(op)\n (op & 0x0000ffc0) >> 6\nend",
"def field_m(op)\n (op & 0xfc000000) >> 26\nend",
"def increment_flag list\n if (params[:commit] != \"Flag\")\n return\n end\n \n if list.nil? || list.flags.nil?\n return\n end\n \n list.flags += 1\n list.save!\n return\n end",
"def add(a,b)\n ret1 = a + b\n ret = ret1 & 0xff\n self[0xF] = (ret1!=ret)?1:0\n ret\n end",
"def increment!(attribute, by = 1, touch: nil)\n increment(attribute, by)\n change = public_send(attribute) - (public_send(:\"#{attribute}_in_database\") || 0)\n self.class.update_counters(id, attribute => change, touch: touch)\n public_send(:\"clear_#{attribute}_change\")\n self\n end",
"def total_set\n @field.inject(0) { |a, byte| a += byte & 1 and byte >>= 1 until byte == 0; a }\n end",
"def total_set\n @field.inject(0) { |a, byte| a += byte & 1 and byte >>= 1 until byte == 0; a }\n end",
"def hincrbyfloat(key, field, increment)\n node_for(key).hincrbyfloat(key, field, increment)\n end",
"def []=(position, value)\n value == 1 ? @field[position / ELEMENT_WIDTH] |= 1 << (position % ELEMENT_WIDTH) : @field[position / ELEMENT_WIDTH] ^= 1 << (position % ELEMENT_WIDTH)\n end",
"def each_plus_one(array)\n array.map { |number|\n number += 1\n }\nend",
"def increment\n self.class.increment(self)\n end",
"def increment!(attribute, by = 1)\n increment(attribute, by) && save\n self\n end",
"def increment(*)\n @build += 1\n end",
"def bit_rotate_count_for(operand, size)\n\t\toperand.v_bit.zero? ? 1 : @cx.low % size\n\tend",
"def increment\n curr_value = counter\n self.counter = curr_value + 1\n save\n curr_value\n end",
"def []=(position, value)\n if value == 1\n @field[position / ELEMENT_WIDTH] |= 1 << (position % ELEMENT_WIDTH)\n elsif (@field[position / ELEMENT_WIDTH]) & (1 << (position % ELEMENT_WIDTH)) != 0\n @field[position / ELEMENT_WIDTH] ^= 1 << (position % ELEMENT_WIDTH)\n end\n end",
"def count_by column_name, field\n inc = increment_mask_for column_name, field\n only = only_mask_for column_name, field\n # Create super-special-bitfield-grouping-query w/ AREL\n sql = arel_table.\n project(\"count(#{primary_key}) as #{field}_count, (#{column_name} & #{only})/#{inc} as #{field}\").\n group(field).to_sql\n connection.send :select, sql, 'AREL' # Execute the query\n end",
"def increment(attribute, by = 1)\n self[attribute] ||= 0\n self[attribute] += by\n self\n end",
"def numberOf1Bits(n)\n res = 0\n while n != 0\n n &= (n - 1)\n res += 1\n end\n return res\nend",
"def set(index, numBits, value)\n andMask = 2**numBits - 1 # 000000001111\n andMask = andMask << (index % @@wordBits) # 000011110000\n andMask = andMask ^ @xorMask # 111100001111\n @bits[index/@@wordBits] &= andMask # bbbb0000bbbb\n valMask = value << (index % @@wordBits) # 0000vvvv0000\n @bits[index/@@wordBits] |= valMask # bbbbvvvvbbbb\n end",
"def update_field(field_name, &block)\n latest = Transaction.current.updated(self).record\n vector = increment_vector_clock(latest['_flowHeader']['vectorClock'])\n header = latest['_flowHeader'].merge('vectorClock' => vector)\n version = {\n 'lastWriterID' => Flow.peer_id,\n 'vectorClockSum' => vector.inject(0) {|sum, entry| sum + entry['count'] }\n }\n new_value = yield version\n self.class.new(latest.merge('_flowHeader' => header, field_name => new_value))\n end",
"def _inc(key,value)\n _set(key, (_get(key) || 0) + value)\n end",
"def equal_to_numbers(field_values = {})\n fields = {}\n \n field_values.each_pair do |field_name, v|\n bits = self.bits_for(field_name)\n fields[bits] = v if bits.length > 0\n end\n \n all_num = 0\n none_num = 0\n fields.each_pair { |field_bits, val|\n field_bits.each_with_index do |bit, i|\n if @options[:bool_caster].call(val[i])\n all_num |= (1 << bit)\n else\n none_num |= (1 << bit)\n end\n end\n }\n \n [all_num, none_num]\n end",
"def each( &blk ) #:yields: a Field or a Bitstruct\n @fields.each {|atom|\n if atom.is_a? Bitfield\n atom.fields.each {|f| yield f}\n else\n yield atom\n end\n }\n\n end",
"def <<( new_field )\n lo = 0\n hi = size\n\n while lo < hi\n mid = (lo + hi).div(2)\n if new_field < self[mid]\n hi = mid\n else\n lo = mid + 1\n end\n end\n\n insert(lo, new_field)\n end",
"def inc_b\n end",
"def increment_sequence_number\n @sequence_number += 1\n @sequence_number = 0 if @sequence_number > 0xFFFFFFFF\n end",
"def binary_integer_addition(b1, b2)\n\tr = []\n\tcarry = 0\n\t(b1.length-1).downto(0).each { |i|\n\t\tif b1[i] + b2[i] == 0\n\t\t\tr << 0 + carry\n\t\t\tcarry = 0\n\t\telsif b1[i] + b2[i] == 1\n\t\t\tcarry == 0 ? r << 1 : (r << 0; carry = 1)\n\t\telsif b1[i] + b2[i] == 2\n\t\t\tcarry == 0 ? r << 0 : r << 1\n\t\t\tcarry = 1\n\t\tend\n\t}\n\tif carry == 1\n\t\tr << 1\n\tend\n\tr.reverse\nend",
"def add_credits(qty)\n update_column(:credits, credits + qty)\n end",
"def parse_bit_fields raw\n @raw = raw\n \n # Setup\n @unpacked = @raw.unpack( self.class.unpack_recipe )\n @attributes ||= {}\n \n self.class.fields.each_with_index do |name, position|\n \n @attributes[name] = @unpacked[position]\n \n if bit_fields = self.class.bit_fields[name]\n \n bit_value = attributes[name]\n \n # We must extract bits from end since \n # ruby doesn't have types (and fixed lengths)\n bit_fields.reverse.each do |(bit_name, bits_number, bit_mask)|\n @attributes[bit_name] = bit_value & bit_mask\n bit_value = bit_value >> bits_number\n end\n end\n end\n end",
"def set_fields(fbe_value)\n fbe_current_offset = 0\n fbe_current_size = 0\n\n byte0.fbe_offset = fbe_current_offset\n fbe_field_size = byte0.set(fbe_value.byte0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n byte1.fbe_offset = fbe_current_offset\n fbe_field_size = byte1.set(fbe_value.byte1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n byte2.fbe_offset = fbe_current_offset\n fbe_field_size = byte2.set(fbe_value.byte2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n byte3.fbe_offset = fbe_current_offset\n fbe_field_size = byte3.set(fbe_value.byte3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n byte4.fbe_offset = fbe_current_offset\n fbe_field_size = byte4.set(fbe_value.byte4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n byte5.fbe_offset = fbe_current_offset\n fbe_field_size = byte5.set(fbe_value.byte5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n char0.fbe_offset = fbe_current_offset\n fbe_field_size = char0.set(fbe_value.char0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n char1.fbe_offset = fbe_current_offset\n fbe_field_size = char1.set(fbe_value.char1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n char2.fbe_offset = fbe_current_offset\n fbe_field_size = char2.set(fbe_value.char2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n char3.fbe_offset = fbe_current_offset\n fbe_field_size = char3.set(fbe_value.char3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n char4.fbe_offset = fbe_current_offset\n fbe_field_size = char4.set(fbe_value.char4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n char5.fbe_offset = fbe_current_offset\n fbe_field_size = char5.set(fbe_value.char5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n wchar0.fbe_offset = fbe_current_offset\n fbe_field_size = wchar0.set(fbe_value.wchar0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n wchar1.fbe_offset = fbe_current_offset\n fbe_field_size = wchar1.set(fbe_value.wchar1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n wchar2.fbe_offset = fbe_current_offset\n fbe_field_size = wchar2.set(fbe_value.wchar2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n wchar3.fbe_offset = fbe_current_offset\n fbe_field_size = wchar3.set(fbe_value.wchar3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n wchar4.fbe_offset = fbe_current_offset\n fbe_field_size = wchar4.set(fbe_value.wchar4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n wchar5.fbe_offset = fbe_current_offset\n fbe_field_size = wchar5.set(fbe_value.wchar5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int8b0.fbe_offset = fbe_current_offset\n fbe_field_size = int8b0.set(fbe_value.int8b0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int8b1.fbe_offset = fbe_current_offset\n fbe_field_size = int8b1.set(fbe_value.int8b1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int8b2.fbe_offset = fbe_current_offset\n fbe_field_size = int8b2.set(fbe_value.int8b2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int8b3.fbe_offset = fbe_current_offset\n fbe_field_size = int8b3.set(fbe_value.int8b3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int8b4.fbe_offset = fbe_current_offset\n fbe_field_size = int8b4.set(fbe_value.int8b4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int8b5.fbe_offset = fbe_current_offset\n fbe_field_size = int8b5.set(fbe_value.int8b5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint8b0.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b0.set(fbe_value.uint8b0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint8b1.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b1.set(fbe_value.uint8b1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint8b2.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b2.set(fbe_value.uint8b2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint8b3.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b3.set(fbe_value.uint8b3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint8b4.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b4.set(fbe_value.uint8b4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint8b5.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b5.set(fbe_value.uint8b5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int16b0.fbe_offset = fbe_current_offset\n fbe_field_size = int16b0.set(fbe_value.int16b0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int16b1.fbe_offset = fbe_current_offset\n fbe_field_size = int16b1.set(fbe_value.int16b1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int16b2.fbe_offset = fbe_current_offset\n fbe_field_size = int16b2.set(fbe_value.int16b2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int16b3.fbe_offset = fbe_current_offset\n fbe_field_size = int16b3.set(fbe_value.int16b3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int16b4.fbe_offset = fbe_current_offset\n fbe_field_size = int16b4.set(fbe_value.int16b4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int16b5.fbe_offset = fbe_current_offset\n fbe_field_size = int16b5.set(fbe_value.int16b5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint16b0.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b0.set(fbe_value.uint16b0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint16b1.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b1.set(fbe_value.uint16b1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint16b2.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b2.set(fbe_value.uint16b2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint16b3.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b3.set(fbe_value.uint16b3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint16b4.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b4.set(fbe_value.uint16b4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint16b5.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b5.set(fbe_value.uint16b5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int32b0.fbe_offset = fbe_current_offset\n fbe_field_size = int32b0.set(fbe_value.int32b0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int32b1.fbe_offset = fbe_current_offset\n fbe_field_size = int32b1.set(fbe_value.int32b1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int32b2.fbe_offset = fbe_current_offset\n fbe_field_size = int32b2.set(fbe_value.int32b2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int32b3.fbe_offset = fbe_current_offset\n fbe_field_size = int32b3.set(fbe_value.int32b3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int32b4.fbe_offset = fbe_current_offset\n fbe_field_size = int32b4.set(fbe_value.int32b4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int32b5.fbe_offset = fbe_current_offset\n fbe_field_size = int32b5.set(fbe_value.int32b5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint32b0.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b0.set(fbe_value.uint32b0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint32b1.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b1.set(fbe_value.uint32b1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint32b2.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b2.set(fbe_value.uint32b2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint32b3.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b3.set(fbe_value.uint32b3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint32b4.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b4.set(fbe_value.uint32b4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint32b5.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b5.set(fbe_value.uint32b5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int64b0.fbe_offset = fbe_current_offset\n fbe_field_size = int64b0.set(fbe_value.int64b0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int64b1.fbe_offset = fbe_current_offset\n fbe_field_size = int64b1.set(fbe_value.int64b1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int64b2.fbe_offset = fbe_current_offset\n fbe_field_size = int64b2.set(fbe_value.int64b2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int64b3.fbe_offset = fbe_current_offset\n fbe_field_size = int64b3.set(fbe_value.int64b3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int64b4.fbe_offset = fbe_current_offset\n fbe_field_size = int64b4.set(fbe_value.int64b4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int64b5.fbe_offset = fbe_current_offset\n fbe_field_size = int64b5.set(fbe_value.int64b5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint64b0.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b0.set(fbe_value.uint64b0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint64b1.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b1.set(fbe_value.uint64b1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint64b2.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b2.set(fbe_value.uint64b2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint64b3.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b3.set(fbe_value.uint64b3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint64b4.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b4.set(fbe_value.uint64b4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint64b5.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b5.set(fbe_value.uint64b5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n # noinspection RubyUnnecessaryReturnValue\n fbe_current_size\n end",
"def increment_contributions\n contributions = self.contributions.nil? ? 0 : self.contributions\n contributions += 1\n self.save\n end"
]
| [
"0.87612927",
"0.77834016",
"0.6443977",
"0.5953096",
"0.5942322",
"0.59417933",
"0.583617",
"0.583617",
"0.5690166",
"0.5625212",
"0.5625212",
"0.5588072",
"0.55383843",
"0.549851",
"0.54783934",
"0.5478259",
"0.54649013",
"0.54446375",
"0.5435712",
"0.5432103",
"0.54049903",
"0.53970385",
"0.53940284",
"0.5353587",
"0.5350066",
"0.5346602",
"0.5322468",
"0.52932066",
"0.5291371",
"0.5290625",
"0.52770627",
"0.52734154",
"0.526742",
"0.52653575",
"0.52646494",
"0.52646494",
"0.5257017",
"0.5257017",
"0.52540016",
"0.5242833",
"0.5240196",
"0.5163034",
"0.5151706",
"0.51316327",
"0.5126336",
"0.5118785",
"0.5118785",
"0.511663",
"0.5115936",
"0.5108465",
"0.5083044",
"0.5080955",
"0.5076285",
"0.5063501",
"0.5047225",
"0.5041825",
"0.5041825",
"0.5036591",
"0.50230896",
"0.5020201",
"0.5004351",
"0.5003714",
"0.5002093",
"0.50004387",
"0.4998545",
"0.4998545",
"0.49983987",
"0.49719286",
"0.4966132",
"0.49604958",
"0.4958136",
"0.49564162",
"0.49545074",
"0.4943695",
"0.4943695",
"0.4943242",
"0.49428248",
"0.49343094",
"0.49309915",
"0.49303183",
"0.49142677",
"0.49121454",
"0.4894203",
"0.48859575",
"0.48857492",
"0.48751998",
"0.48546574",
"0.4835379",
"0.4829389",
"0.4819326",
"0.4813152",
"0.47941655",
"0.4788683",
"0.47773147",
"0.47772753",
"0.47756556",
"0.47744566",
"0.47731912",
"0.475404",
"0.47517255"
]
| 0.89511776 | 0 |
Counts resources grouped by a bitfield +count_by :column, :fields | def count_by column_name, field
inc = increment_mask_for column_name, field
only = only_mask_for column_name, field
# Create super-special-bitfield-grouping-query w/ AREL
sql = arel_table.
project("count(#{primary_key}) as #{field}_count, (#{column_name} & #{only})/#{inc} as #{field}").
group(field).to_sql
connection.send :select, sql, 'AREL' # Execute the query
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count\n size = 0\n core_search.group(\"name.id, #{main_group_by_columns}\").each do |_x|\n size += 1\n end\n size\n end",
"def count_for(resource)\n\t\tself.find(resource).count\n\tend",
"def count(resource)\n list(resource.to_s,1)[\"meta\"][\"total_count\"]\n end",
"def countables\n key :type, Integer\n key :ts, Time\n key :uid, String\n\n key :count, Integer\n\n generate_aggregators { |ts, method|\n totype = method_names_type_counter(method)\n fromtype = get_fromtype_for_totype(totype)\n aggregate_and_create(fromtype, totype, ts)\n }\n end",
"def field_count(field)\n return 0 if /^(\\w+)s_versions/.match?(field.to_s)\n\n # constantize is safe here because `field` is not user input\n FIELD_QUERIES[field]&.count || field.to_s.classify.constantize.count\n end",
"def count(constraints = {})\n query(constraints).count\n end",
"def count_by(&block)\n self.group_by(&block)\n .map{ |key, items| [key, items&.count] }\n .to_h\n end",
"def count_by(&block)\n self.group_by(&block)\n .map{ |key, items| [key, items&.count] }\n .to_h\n end",
"def ri_counts(*args)\n resources, opts = ri_opts(args)\n counts = {}\n threads = []\n resources.each do |res|\n next unless res.populated?\n threads << Thread.new do\n counts[res.acronym] = res.concept_count(self.xxhash, opts)\n end\n end\n threads.each(&:join)\n counts\n end",
"def count(where_pattern)\n client.query(\"#{prefixes} SELECT (COUNT(distinct(?resource)) as ?count) FROM <#{graph}> WHERE { #{where_pattern} }\").first[\"count\"].value.to_i\n end",
"def records_total_count\n fetch_records.unscope(:group, :select).count(:all)\n end",
"def count_records **args\n logger.progname = 'RestOperations#CountRecords'\n query = OrientSupport::OrientQuery.new args\n \tquery.projection << 'COUNT (*)'\n \tresult = get_records raw: true, query: query\n begin\n result.first['COUNT']\n rescue\n return 0\n end\n end",
"def get_record_types_count\n Hash[Hash[get_record_types.group_by {|x| x}.map {|k,v| [k,v.count]}].sort] # counts of each record type\n end",
"def count(options = {})\n query = {}\n\n if options[:filters]\n query['match'] = options[:filter_match] || 'AND'\n options[:filters].each_with_index do |filter, index|\n query[\"Filter#{index + 1}\"] = filter.join(' ')\n end\n end\n\n query[:system] = true if options[:system]\n\n @party.get(\"forms/#{@id}/entries/count\", query: query)['EntryCount']\n end",
"def count **args\n logger.progname = 'RestOperations#CountRecords'\n query = OrientSupport::OrientQuery.new args\n query.projection << 'COUNT (*)'\n result = get_records raw: true, query: query\n result.first['COUNT'] rescue 0 # return_value\n end",
"def field_count fieldname\n case fieldname.downcase\n when /_tags$/\n tagtype = fieldname.sub /_tags$/, ''\n tagtype = ['Culinary Term', 'Untyped'] if tagtype == 'Other'\n visible_tags(:tagtype => tagtype).count\n when 'list', 'lists'\n ListServices.associated_lists(object).count # ListServices.find_by_listee(object).count\n end\n end",
"def count(*args)\n # Ignore first arg if it is not a Hash\n a = self.respond_to?(:construct_count_options_from_legacy_args) ?\n construct_count_options_from_legacy_args(*args) :\n construct_count_options_from_args(*args)\n column_name, options = *a\n find_every(options).count()\n end",
"def load_field_counts(field, user_id = nil)\n count = \"*\"\n table = FIELD_TABLES[field] || field.to_s\n tables = \"#{table} t\"\n t_user_id = (table == \"users\" ? \"t.id \" : \"t.user_id \")\n conditions = t_user_id + (user_id ? \"= #{user_id}\" : \"> 0\")\n\n # Exception for species list entries.\n if field == :species_list_entries\n tables = \"species_lists t, #{table} os\"\n conditions += \" AND os.species_list_id = t.id\"\n end\n\n # Exception for past versions.\n if table =~ /^(\\w+)s_versions/\n parent = Regexp.last_match(1)\n count = \"DISTINCT #{parent}_id\"\n tables += \", #{parent}s p\"\n conditions += \" AND t.#{parent}_id = p.id\"\n conditions += \" AND #{t_user_id} != p.user_id\"\n end\n\n if (extra_conditions = FIELD_CONDITIONS[field])\n conditions += \" AND (#{extra_conditions})\"\n end\n\n query = %(\n SELECT COUNT(#{count}) AS cnt, #{t_user_id}\n FROM #{tables}\n WHERE #{conditions}\n GROUP BY #{t_user_id}\n ORDER BY cnt DESC\n )\n\n # Get data as:\n # data = [\n # [count, user_id],\n # [count, user_id],\n # ...\n # ]\n data = User.connection.select_rows(query)\n\n # Fill in @user_data structure.\n data.each do |cnt, usr_id|\n @user_data[usr_id.to_i] ||= {}\n @user_data[usr_id.to_i][field] = cnt.to_i\n end\n end",
"def count(resource_type)\n path = '/api/' + resource_type.to_s\n response = http_get(path,{limit: '1'})\n response[\"meta\"][\"total_count\"]\n end",
"def get_number_of_activities(group_by)\n\n\t@title = \"Activities for each type\"\n\t@attribute_name = 'Activity type '\n\n\t@adapter = DataMapper.repository(:default).adapter\n\[email protected]_naming_convention = DataMapper::NamingConventions::Resource::Underscored\n\n\tif(group_by == 'day')\n\t\t@data = @adapter.select(\"Select type,created_at, COUNT (type) As cnt from activities\n\t\tGroup by type,strftime('%Y', created_at),strftime('%m', created_at),strftime('%d', created_at)\n\t\torder by cnt asc;\")\n\n\t\terb :activities_group_by_day\n\telsif (group_by == 'month')\n\t\t@data = @adapter.select(\"Select type,strftime('%m', created_at) as month, strftime('%Y', created_at) as year, COUNT (type) As cnt from activities\n\t\tGroup by type,strftime('%Y', created_at),strftime('%m', created_at)\n\t\torder by cnt asc;\")\n\t\terb :activities_group_by_month\n\telsif (group_by == 'year')\n\t\t@data = @adapter.select(\"Select type,strftime('%Y', created_at) as year, COUNT (type) As cnt from activities\n\t\tGroup by type,strftime('%Y', created_at)\n\t\torder by cnt asc;\")\n\t\terb :activities_group_by_year\n\tend\n\t\nend",
"def number_of_descriptive_resources(login=nil)\n count_by_frbr(login, :is_described_by, :how_many_resources?) \n end",
"def number_of_descriptive_resources(login=nil)\n count_by_frbr(login, :is_described_by, :how_many_resources?) \n end",
"def count **args\n\t\tquery( **( { projection: 'COUNT(*)' }.merge args )).execute(reduce: true){|x| x[:\"COUNT(*)\"]}\n end",
"def count_field_names\n count_fields.map(&:to_s)\n end",
"def count_records(records)\n records.count(:all)\n end",
"def count\n all.count\n end",
"def count(col = nil)\n count_operation = col.blank?\n\n return self unless @tracked.keys.include?(col) || count_operation\n return @tracked[col] unless count_operation\n\n @tracked.keys.each do |k|\n groups = model.from(@filtered_rset).group(k.to_s).count\n groups.each do |val, num|\n @tracked[k][val.to_s] = num unless val.blank?\n end\n end\n self\n end",
"def count\n filtered = apply_criteria(@data)\n filtered.count\n end",
"def project_counts\n @project_counts ||= Kithe::Model.joins(:contains_contained_by).\n where(published: true, contains_contained_by: {container_id: project_list.collect(&:id) }).\n group(:container_id).\n count\n end",
"def get_counts(repo_uri)\n types = %w(pui_collection pui_archival_object pui_record_group pui_accession pui_digital_object pui_agent pui_subject)\n counts = archivesspace.get_types_counts(types, repo_uri)\n # 'pui_record' as defined in AppConfig ('record_badge') is intended for archival objects only,\n # which in solr is 'pui_archival_object' not 'pui_record' so we need to flip it here\n counts['pui_record'] = counts.delete 'pui_archival_object'\n final_counts = {}\n counts.each do |k, v|\n final_counts[k.sub(\"pui_\", '')] = v\n end\n final_counts['resource'] = final_counts['collection']\n final_counts['classification'] = final_counts['record_group']\n final_counts\n end",
"def result_count_by_type\n ret = Hash.new {|h, k| h[k] = 0}\n result_ids.group_by(&:first).each do |scope, ids|\n ret[scope] += ids.size\n end\n ret\n end",
"def count(scope, attr)\n \"poro_count_#{attr}\"\n end",
"def counters\n {\n files: files_count,\n apps: apps_count,\n workflows: workflows_count,\n jobs: jobs_count,\n members: members_count,\n }\n end",
"def counts(options = {})\n find(:all, options_for_counts(options))\n end",
"def counts\r\n @counts\r\n end",
"def pagy_arel_count(collection)\n if collection.group_values.empty?\n # COUNT(*)\n collection.count(:all)\n else\n # COUNT(*) OVER ()\n sql = Arel.star.count.over(Arel::Nodes::Grouping.new([]))\n collection.unscope(:order).limit(1).pluck(sql).first.to_i\n end\n end",
"def count(grp)\n @counts[grp] || 0\n end",
"def get_field_count\n\t\tend",
"def count\n @params[:rettype] = 'count'\n self\n end",
"def member_and_collection_count_for_rails2(node)\n if :resources == node.message\n hash_node = node.arguments[2]\n if hash_node\n return (hash_node.grep_nodes_count(:node_type => :lit) - hash_node.grep_nodes_count(:node_type => :hash)) / 2\n end\n end\n 0\n end",
"def counts\n count = Hash.new(0)\n self.each{|ele| count[ele] += 1}\n count\n end",
"def collections_count\n Collection.count(:all, :joins => :plugin, :conditions => { :plugins => { :content_provider_id => self.id } })\n end",
"def counts\n @counts ||=\n begin\n h = {}\n by_label.each do |label, notes|\n h[label] = notes.size\n end\n h\n end\n end",
"def member_and_collection_count_for_rails3(node)\n :resources == node.subject.message ? node.grep_nodes_count(:node_type => :call, :message => VERBS) : 0\n end",
"def count(query={})\n collection.count({ query: query })\n end",
"def count_records(params)\n scope_data_class(params) do\n params[:scope] = config[:scope]\n data_adapter.count_records(params, final_columns)\n end\n end",
"def count\n @options[:select] = \"COUNT\"\n @options.delete(:attributes_to_get)\n\n response = run\n\n while continue?(response)\n @options[:exclusive_start_key] = response.last_evaluated_key\n response = run(response)\n end\n\n response.count\n end",
"def count_records(params, columns)\n 0\n end",
"def count_records(params, columns)\n 0\n end",
"def summarize_field(records, field)\n extracted = Hash.new(0)\n records.each do |record|\n begin\n value = field.split(\".\").inject(record) { |hash, key| hash[key] }\n rescue\n value = 'no such field'\n end\n extracted[value] += 1\n end\n return extracted\nend",
"def count(params = {})\n record_count :dataset, params\n end",
"def record_counts(model_query, filtered_query)\n counts = Hash.new\n total = model_query.distinct.count(:id)\n\n # Handle results of joined queries. This feels a little bit hacky.\n total = total.keys.length if total.is_a?(Hash)\n\n counts[:total_rows] = total\n\n if tablesorter_params[:filter]\n # Count again if additional filters were applied (fires a query)\n cnt = filtered_query.count(\"#{model_query.table_name}.id\")\n\n # Handle results of having-queries. This feels a little bit hacky.\n cnt = cnt.keys.length if cnt.is_a?(Hash)\n\n counts[:filtered_rows] = cnt\n else\n counts[:filtered_rows] = total # There wasn't any reduction.\n end\n\n counts\n end",
"def count(column = nil)\n return super unless column && first && first.class.respond_to?(:descends_from_active_record?)\n column = column.to_sym unless column.is_a?(Symbol) \n inject( 0 ) { |sum, x| x[column].nil? ? sum : sum + 1 }\n end",
"def count\n end",
"def count\n end",
"def dor_resource_count\n public_xml_doc.xpath('//contentMetadata/resource').count\n end",
"def count\n # implement in subclasses\n end",
"def count\n self.class.count(self)\n end",
"def counters\n return {} if object.guest?\n\n {\n files: files_private_count,\n folders: folders_private_count,\n apps: apps_private_count,\n workflows: workflows_count,\n jobs: jobs_count,\n assets: assets_count,\n notes: notes_count,\n }\n end",
"def count(opts={})\n all(opts).size\n end",
"def objects_count\n obj_count = {total_count: Building.count, building_complexes_count: BuildingComplex.count, apartments_count: Apartment.count, penthouses_count: Penthouse.count, apartment_houses_count: ApartmentHouse.count}\n render json: obj_count\n end",
"def count\n folder.data_objects.all(parameters).count\n end",
"def count(attr = nil)\n if attr.nil?\n super()\n else\n column(attr).count\n end\n end",
"def count; end",
"def count; end",
"def count; end",
"def count\n connection.zcard(key_label)\n end",
"def count\n @all.size\n end",
"def count_occ(usages_list)\n count = 0\n usages_list.each do |k,v|\n if k['location']['type'] == 'pipeline'\n count += 1\n end\n end\n return count\nend",
"def field_count\n super\n end",
"def count\n @collection.count(Scope.new(@collection, @selector, @opts))\n end",
"def count_columns\n fields.size\n end",
"def contact_count_by_group\n r = nil\n if grouped?\n begin\n # Rails will raise an (unexpected) RecordNotFound if there's only a nil group value\n r = Contact.visible.\n where(statement).\n joins(joins_for_order_statement(group_by_statement)).\n group(group_by_statement).\n count\n rescue ActiveRecord::RecordNotFound\n r = {nil => contact_count}\n end\n c = group_by_column\n end\n r\n rescue ::ActiveRecord::StatementInvalid => e\n raise StatementInvalid.new(e.message)\n end",
"def facet_field_count(field, value)\n facet_fields_by_hash[field.to_s][value.to_s] if facet_fields_by_hash[field.to_s]\n end",
"def field_count\n @fields.size\n end",
"def update_counters(kind = \"\")\n self.post_type.full_categories.where(id: (@cats_before + self.categories.pluck(:id)).uniq).each { |c| c.update_column(\"count\", c.posts.published.size) } if [\"\", \"categories\"].include?(kind) && manage_categories?\n self.post_type.post_tags.where(id: (@tags_before + self.post_tags.pluck(:id)).uniq).each { |tag| tag.update_column(\"count\", tag.posts.published.size) } if [\"\", \"tags\"].include?(kind) && manage_tags?\n end",
"def resource_count_stats\n klass = klass_from_controller(controller_name)\n full_total = klass.count\n visible_total = if klass.authorization_supported?\n klass.all_authorized_for('view').count\n elsif klass.is_a?(Person) && Seek::Config.is_virtualliver && User.current_user.nil?\n 0\n else\n klass.count\n end\n [visible_total, full_total]\n end",
"def count\n @collector.count\n end",
"def count\n self.all.count\n end",
"def count_per_period_all\n \tcount = Center.all.inject({}) do |col,center|\n \t\tcol[center.id] = count_sum_per_period(center.id)\n \t\tcol\n \tend\n end",
"def tagging_count(options={})\n table = options.delete(:table) || 'tag'\n default_options = {:limit=>20,:group=>\"#{table}_id\", :select=>\"id, taggable_type, #{table}_id, count(*) as count\",\n :include=>table, :order=>'count DESC'}\n Tagging.find(:all, default_options.merge!(options))\n end",
"def specific_type_of_medication_per_hospital\n self.group(:hospital_id, :medication_id).count\n end",
"def count(filters, options = {})\n join_manager = ActiveRelation::JoinManager.new(resource_klass: self,\n filters: filters)\n\n records = apply_request_settings_to_records(records: records(options),\n filters: filters,\n join_manager: join_manager,\n options: options)\n\n count_records(records)\n end",
"def count\n all.size\n end",
"def count(*vars)\n result = if vars.first.is_a?(Symbol)\n template = vars.shift\n # preserves an eventual wrapper by calling the template method\n self[:context].send(template, params(:size => 0), *vars)\n else\n Query.elastics.count_search(:get, self, *vars)\n end\n result['hits']['total']\n end",
"def count\n each.count\n end",
"def count_members\n @band.count\n end",
"def count\n\t\tputs \"Counting number of entries in the CIDR cache table ...\" if @verbose\n\t\tcnt=0\n\t\t@known_cidr_blks.keys.map do |key|\n\t\t\tif is_cidr?(key)\n\t\t\t\tcnt=cnt+1\n\t\t\tend\n\t\tend\n\t\tputs \"Current number of CIDR object entries: #{cnt}\" if @verbose\n\t\treturn cnt\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\tend",
"def group_count(*props)\n result = Hash.new(0)\n props = props.map { |p| p.to_s }\n if props.empty? and block_given?\n each { |e| result[yield(e)] += 1 }\n elsif block_given?\n each do |e|\n key = props.map { |p| e.get_property(p) }\n key << yield(e)\n result[key] += 1\n end\n elsif props.count == 1\n prop = props.first\n each do |e|\n result[e.get_property(prop)] += 1\n end\n elsif props.any?\n each do |e|\n result[props.map { |p| e.get_property(p) }] += 1\n end\n else\n each do |e|\n result[e] += 1\n end\n end\n result\n end",
"def count_by(geo, results)\n totals = results.each_with_object(Hash.new(0)) do |res,counts|\n # binding.pry\n next unless [\"us\",\"ca\"].include?(res.country)\n counts[res.send(geo.to_sym)] += 1\n end\n puts \"TOTAL: #{totals.values.inject(:+)}\"\n\n totals = totals.sort_by { |geo,count| -count }\n\n puts \"Total groups by #{geo.to_s}: \"\n totals.each do |k,v|\n puts \"#{k}: #{v}\"\n end\nend",
"def count\n query.count\n end",
"def count\n query.count\n end",
"def count_objects\n count = 0\n @objects.keys.each do |key|\n count += @objects[key].length\n end\n\n return count\n end",
"def count\n raise \"View#count cannot be used with group options\" if query[:group]\n if can_reduce?\n row = reduce.skip(0).limit(1).rows.first\n row.nil? ? 0 : row.value\n else\n limit(0).total_rows\n end\n end",
"def count\n ensure_aggregate!\n SQLite::API.aggregate_count( @func )\n end",
"def count\n count = 0\n each do |data|\n count += 1\n end\n count\n end",
"def count(selector={})\n @db.count(@name, selector || {})\n end",
"def get_occurrences\n occurrences = {}\n\n settings.fields.each do |field|\n occurrences[field] = get_occurrence(field, false)\n end\n\n occurrences\nend",
"def count(options = {})\r\n options.stringify_keys!\r\n options.assert_valid_keys(*%W[moType keyword])\r\n resp = connection.get(custom_method_collection_url(:count, options), headers)\r\n resp.body.to_i\r\n end",
"def count_records_in_measure_groups\n patient_cache = get_db.collection('patient_cache')\n base_query = {'value.measure_id' => @measure_id, 'value.sub_id' => @sub_id,\n 'value.effective_date' => @parameter_values['effective_date'],\n 'value.test_id' => @parameter_values['test_id']}\n\n base_query.merge!(filter_parameters)\n \n query = base_query.clone\n\n query.merge!({'value.manual_exclusion' => {'$in' => [nil, false]}})\n \n result = {:measure_id => @measure_id, :sub_id => @sub_id, \n :effective_date => @parameter_values['effective_date'],\n :test_id => @parameter_values['test_id'], :filters => @parameter_values['filters']}\n \n # need to time the old way agains the single query to verify that the single query is more performant\n aggregate = {\"population\"=>0, \"denominator\"=>0, \"numerator\"=>0, \"antinumerator\"=>0, \"exclusions\"=>0}\n %w(population denominator numerator antinumerator exclusions).each do |measure_group|\n patient_cache.find(query.merge(\"value.#{measure_group}\" => true)) do |cursor|\n aggregate[measure_group] = cursor.count\n end\n end\n aggregate[\"considered\"] = patient_cache.find(query).count\n aggregate[\"exclusions\"] += patient_cache.find(base_query.merge({'value.manual_exclusion'=>true})).count\n result.merge!(aggregate)\n\n result.merge!(execution_time: (Time.now.to_i - @parameter_values['start_time'].to_i)) if @parameter_values['start_time']\n\n get_db.collection(\"query_cache\").save(result, safe: true)\n result\n end"
]
| [
"0.6700518",
"0.63404983",
"0.62339914",
"0.6218993",
"0.6062148",
"0.60613865",
"0.60381085",
"0.60381085",
"0.60129595",
"0.59839845",
"0.5957038",
"0.59498876",
"0.5930106",
"0.5909058",
"0.5902918",
"0.5897846",
"0.5897376",
"0.58841914",
"0.5878093",
"0.58779985",
"0.5838099",
"0.5838099",
"0.5837285",
"0.58329415",
"0.58275545",
"0.58108664",
"0.5794164",
"0.57897055",
"0.5778636",
"0.57705796",
"0.5767478",
"0.57206815",
"0.5715771",
"0.5709288",
"0.57075447",
"0.5703142",
"0.5696039",
"0.5694446",
"0.5692232",
"0.56814045",
"0.5658536",
"0.5650494",
"0.56390953",
"0.56270635",
"0.5626647",
"0.5621689",
"0.5613877",
"0.561347",
"0.561347",
"0.5592873",
"0.55524826",
"0.55410826",
"0.5536814",
"0.5533891",
"0.5533891",
"0.5531252",
"0.5526557",
"0.552377",
"0.5505384",
"0.55015415",
"0.5498604",
"0.54932964",
"0.54919463",
"0.54726195",
"0.54726195",
"0.54726195",
"0.54646164",
"0.54623055",
"0.5454185",
"0.545283",
"0.5438822",
"0.5437779",
"0.54218423",
"0.54107165",
"0.54098463",
"0.5409467",
"0.54070383",
"0.54002565",
"0.5394468",
"0.5385279",
"0.537568",
"0.53648454",
"0.5359168",
"0.5359027",
"0.535575",
"0.53553236",
"0.5352566",
"0.53522956",
"0.53453565",
"0.53438",
"0.5340966",
"0.5340966",
"0.5324173",
"0.53241223",
"0.532295",
"0.5317645",
"0.531631",
"0.53155565",
"0.53136224",
"0.53101194"
]
| 0.74481875 | 0 |
Increases one or more bitfields by 1 value +increment_bitfield :column, :fields | def increment_bitfields column_name, *fields
mask = self.class.increment_mask_for column_name, *fields
self[column_name] = self[column_name] += mask
save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def increment_bitfields column_name, *fields\n mask = increment_mask_for column_name, *fields\n update_all \"#{column_name} = #{column_name} + #{mask}\"\n end",
"def increment_mask_for column_name, *fields\n fields = bitfields if fields.empty?\n column = @@bitfields[column_name]\n raise ArgumentError, \"Unknown column for bitfield: #{column_name}\" if column.nil?\n fields.sum do |field_name|\n raise ArugmentError, \"Unknown field: #{field_name} for column #{column_name}\" if column[field_name].nil?\n 2 ** (bitfield_max(column_name) - column[field_name].last)\n end\n end",
"def reset_bitfields column_name, *fields\n mask = reset_mask_for column_name, *fields\n update_all \"#{column_name} = #{column_name} & #{mask}\"\n end",
"def bit_add(a, b)\n\t(7).downto(0).each do |x|\n\tend\nend",
"def inc_cursor_bits(cursor, cursor_bits, nbr_bits)\n nbr_bytes, result_cursor_bits = (cursor_bits + nbr_bits).divmod(8)\n return cursor + nbr_bytes, result_cursor_bits\n end",
"def increments(field, options = {})\n incrementing_fields[field] = options.reverse_merge!(auto: true)\n attr_protected(field) if respond_to?(:attr_protected)\n end",
"def hincrby(key, field, increment); end",
"def hincrby(key, field, increment); end",
"def op_increment!(field, amount = 1)\n unless amount.is_a?(Numeric)\n raise ArgumentError, \"Amount should be numeric\"\n end\n operate_field! field, { __op: :Increment, amount: amount.to_i }.freeze\n end",
"def hincrbyfloat(key, field, increment); end",
"def hincrbyfloat(key, field, increment); end",
"def only_mask_for column_name, *fields\n fields = bitfields if fields.empty?\n column = @@bitfields[column_name]\n max = bitfield_max(column_name)\n raise ArgumentError, \"Unknown column for bitfield: #{column_name}\" if column.nil?\n\n column.sum do |field_name, range|\n fields.include?(field_name) ? range.invert(max).sum{|i| 2 ** i} : 0\n end\n \n # fields.inject(\"0\" * (bitfield_max(column_name) + 1)) do |mask, field_name|\n # raise ArugmentError, \"Unknown field: #{field_name} for column #{column_name}\" if column[field_name].nil?\n # range = column[field_name]\n # mask[range] = \"1\" * range.count\n # mask\n # end.to_i(2)\n end",
"def inc_bc\n self.bc = (self.bc + 1) & 0xFFFF\n end",
"def reset_mask_for column_name, *fields\n fields = bitfields if fields.empty?\n max = bitfield_max(column_name)\n (0..max).sum{|i| 2 ** i} - only_mask_for(column_name, *fields)\n end",
"def inc(cb)\n c = 0\n additive = 0\n left_32 = cb.slice(12..15)\n while c<=4\n additive += left_32(c)\n c+=1\n end\n additive %= 4\n cb = cb.setbyte(15,additive)\nend",
"def increment!(field, options)\n options = options.dup\n model_name = (options.delete(:model_name) || self.class.model_name).to_s\n options[:scope] = evaluate_scope(options[:scope]) if options[:scope]\n options[:step] = evaluate_step(options[:step]) if options[:step]\n write_attribute(\n field.to_sym,\n Mongoid::Autoinc::Incrementor.new(model_name, field, options).inc\n )\n end",
"def pack_bit_fields\n @unpacked = []\n \n self.class.fields.each_with_index do |name, position|\n \n if bit_fields = self.class.bit_fields[name]\n \n bit_value = 0\n bit_fields.each do |(bit_name, bits_number, bit_mask)|\n masked = @attributes[bit_name] & bit_mask\n \n raise ValueOverflow, \n \"the value #{@attributes[bit_name]} \"+\n \"is too big for #{bits_number} bits\" if masked != @attributes[bit_name]\n \n bit_value = bit_value << bits_number\n bit_value |= masked\n end\n \n # Value of fields composed by binary fields is always overwritten\n # by the composition of the latter\n attributes[name] = bit_value\n end\n \n @unpacked[position] = @attributes[name] || 0\n \n end\n \n @raw = @unpacked.pack( self.class.unpack_recipe )\n end",
"def increment_and_save!\n update_and_save { self.last_value = (last_value || 0) + 1 }\n end",
"def update_auto_increments\n self.class.incrementing_fields.each do |field, options|\n increment!(field, options) if options[:auto]\n end && true\n end",
"def increment!(name,amount=1)\n raise ArgumentError, \"Only integer fields can be incremented.\" unless self.class.fields.include?({:name => name.to_s, :type => :integer})\n redis.incr(field_key(name), amount)\n end",
"def increment!(name,amount=1)\n raise ArgumentError, \"Only integer fields can be incremented.\" unless self.class.fields.include?({:name => name.to_s, :type => :integer})\n store.update_count(field_key(name), amount)\n end",
"def field_bc1(op)\n (op & 0x03ff0000) >> 16\nend",
"def read_field(*args)\n m = 0\n args.flatten.each_with_index do |bit, i|\n if bit.is_a?(Integer)\n m |= ((@value[bit] || 0) << i)\n end\n end\n m\n end",
"def hincrby(key, field, increment)\n node_for(key).hincrby(key, field, increment)\n end",
"def plus_one(digits)\n digits[-1] += 1 \n digits \nend",
"def increment_with_sql!(attribute, by = 1)\n raise ArgumentError(\"Invalid attribute: #{attribute}\") unless attribute_names.include?(attribute.to_s)\n original_value_sql = \"CASE WHEN `#{attribute}` IS NULL THEN 0 ELSE `#{attribute}` END\"\n self.class.update_all(\"`#{attribute}` = #{original_value_sql} + #{by.to_i}\", \"id = #{id}\")\n reload\n end",
"def bit_field name, width\n raise \"'bit_field' can be used only inside a 'field' block.\" if @_current_bit_fields.nil?\n \n # Register the bit field definition\n @_current_bit_fields << [name, width, bit_mask(width)]\n \n # Define the attribute accessor\n bits_attr_accessor(name)\n \n if width == 1 or name.to_s =~ /_flag$/\n # Define a question mark method if the size is 1 bit\n class_eval \"def #{name}?; self.attributes[#{name.inspect}] != 0; end\\n\", __FILE__, __LINE__\n \n # returns nil if no substitution happens...\n if flag_method_name = name.to_s.gsub!(/_flag$/, '?')\n # Define another question mark method if ends with \"_flag\"\n class_eval \"alias #{flag_method_name} #{name}?\\n\", __FILE__, __LINE__\n end\n end\n \n end",
"def any_of_number(*field_names)\n self.bits_for(*field_names).reduce(0) { |m, bit| m | (1 << bit) }\n end",
"def increment(field, amount = 1)\n #value = (self[field] || 0) + amount\n #self[field] = value\n #if !@parse_object_id\n # # TODO - warn that the object must be stored first\n # return nil\n #end\n\n body = {field => Parse::Increment.new(amount)}.to_json\n data = Parse.client.request(self.uri, :put, body)\n parse data\n self\n end",
"def growallfields\n @fields = Field.all\n @fields.each { |field|\n if (field.fstate != 5) then\n field.fstate = field.fstate + 1\n field.update_attribute(:fstate, field.fstate)\n end\n }\n render :xml => @fields\n end",
"def increment!\n @value += @increment\n \n self\n end",
"def set_next(value)\n increase_length\n\n new_index = (@index + 1) % @size\n previous = @bit_set.set(new_index, value == true) ? 1 : 0\n current = value == true ? 1 : 0\n\n\n @index = new_index\n @cardinality = @cardinality - previous + current\n end",
"def increase(custom_field_id, cells)\n ActiveRecord::Base.transaction do\n custom_field = CustomFields::AutoNumbering.find(custom_field_id)\n \n if self.unset_cells(custom_field, cells).empty?\n value = format_value(custom_field, cells)\n\n key_hash = AutoNumberRunning.key_hash(custom_field.format_key, value)\n\n auto_number_running = custom_field.auto_number_runnings.find(:first,\n :conditions => {\n :auto_number_runnings => { :key_hash => key_hash }\n }\n )\n auto_number_running ||= AutoNumberRunning.new(\n :key_hash => key_hash,\n :current => (custom_field.start_value - custom_field.increment)\n )\n\n custom_field.auto_number_runnings << auto_number_running if auto_number_running.new_record?\n auto_number_running.current = auto_number_running.current + custom_field.increment\n\n auto_number_running.save\n\n format_value(auto_number_running, cells)\n end\n end.to_s\n end",
"def set_bit integer, i\n integer | 0x80000000 >> i\n end",
"def zincrby(key, increment, member); end",
"def zincrby(key, increment, member); end",
"def incrby(key, increment); end",
"def incrby(key, increment); end",
"def add(o)\n validate_member!(o)\n @val |= 1 << o\n self\n end",
"def increment\n Dictionary.db.zincrby @key, 1, @value\n end",
"def hincrby(key, field, increment)\n send_command([:hincrby, key, field, Integer(increment)])\n end",
"def transform_numbers_field fields,row_size\n count = 0\n @numbers.each do |n,arr|\n i = fields.delete(n) # delete the old field\n ## replace by the new fields instead\n arr.each { |v| fields[v] = row_size + count; count += 1 }\n end\n return fields\n end",
"def inc_value(iIncrement = 1)\n super\n end",
"def calcIndex(inFields)\n index = 0\n field = 0\n @inMask.each_index do |i|\n index += inFields[i] << field\n field += @inMask[i] \n end\n index\n end",
"def increment\n @value += 1\n end",
"def incrbyfloat(key, increment); end",
"def incrbyfloat(key, increment); end",
"def increase(attr)\n raise NoMethodError, \"undefined method `#{attr}` for #{self}\" unless self.respond_to?(attr)\n raise NotCounterbleError, \"not countable attributs `#{attr}` for #{self}\" unless countable.include? attr\n self.send(\"#{attr}=\", self.send(attr).send(:+, 1))\n end",
"def []=(position, value)\n if value == 1\n @field[position / ELEMENT_WIDTH] |= 1 << (position % ELEMENT_WIDTH)\n elsif (@field[position / ELEMENT_WIDTH]) & (1 << (position % ELEMENT_WIDTH)) != 0\n @field[position / ELEMENT_WIDTH] ^= 1 << (position % ELEMENT_WIDTH)\n end\n end",
"def add_ins(obj)\n self.first.value = self.first.value + obj.first.value\n obj.type = 'int'\n self.type = 'int'\n end",
"def up(x=1)\n self.base_value += x\n self.save\n self.base_value\n end",
"def increment(node)\n change_by node, 1\n end",
"def incr major, minor\n incr_by major, minor, 1\n end",
"def set_incremental_index_on_field_types\n field_types.each_with_index do |field_type, index|\n field_type.index = index\n end\n end",
"def increment!(amount=1)\n raise RuntimeError, \"Data is not valid Binary: #{self}\" unless self.is_bitstring?\n\n size = self.length\n decimal = self.binary_to_decimal + amount\n\n if decimal > 255\n raise Bolverk::OverflowError, \"Cannot reference decimal value: #{decimal}\"\n else\n self.replace(decimal.to_s(base=2).rjust(size, \"0\"))\n end\n end",
"def setbit(key, offset, value); end",
"def setbit(key, offset, value); end",
"def <<(bits)\n value = @value * (2**bits.to_i)\n if (bounded?)\n self.class.new(value & self.mask, @length)\n else\n self.class.new(value)\n end\n end",
"def incr(x) x + 1 end",
"def incr\n add(1)\n end",
"def add(element)\n bin_row = bin_row(element)\n element_rows(element).each { |y|\n return false if ((@rows[y] & bin_row) != 0)\n }.each { |y|\n @rows[y] = @rows[y] | bin_row\n }\n self\n end",
"def increment_column!(attribute, by = 1)\n # \"foo\"\n increment(attribute, by).update_column(attribute, self[attribute])\n end",
"def increment_integer(user_id)\n user = User.find user_id\n user.integer_value += 1\n user.save\n\n user\n end",
"def grow_to_include(bit)\n new_size = Math.max(@bits.attr_length << 1, num_words_to_hold(bit))\n newbits = Array.typed(::Java::Long).new(new_size) { 0 }\n System.arraycopy(@bits, 0, newbits, 0, @bits.attr_length)\n @bits = newbits\n end",
"def bits_set\n (\"%b\" % self).count('1')\n #to_s(2).count('1') # alternative\n #count = 0 # alternative\n #byte = self.abs\n #count += byte & 1 and byte >>= 1 until byte == 0 # cf. http://snippets.dzone.com/posts/show/4233\n #count\n end",
"def total_set\n @field.inject(0) { |a, byte| a += byte & 1 and byte >>= 1 until byte == 0; a }\n end",
"def total_set\n @field.inject(0) { |a, byte| a += byte & 1 and byte >>= 1 until byte == 0; a }\n end",
"def total_set\n @field.each_byte.inject(0) { |a, byte| (a += 1; byte &= byte - 1) while byte > 0 ; a }\n end",
"def field_bc2(op)\n (op & 0x0000ffc0) >> 6\nend",
"def field_m(op)\n (op & 0xfc000000) >> 26\nend",
"def increment_flag list\n if (params[:commit] != \"Flag\")\n return\n end\n \n if list.nil? || list.flags.nil?\n return\n end\n \n list.flags += 1\n list.save!\n return\n end",
"def add(a,b)\n ret1 = a + b\n ret = ret1 & 0xff\n self[0xF] = (ret1!=ret)?1:0\n ret\n end",
"def increment!(attribute, by = 1, touch: nil)\n increment(attribute, by)\n change = public_send(attribute) - (public_send(:\"#{attribute}_in_database\") || 0)\n self.class.update_counters(id, attribute => change, touch: touch)\n public_send(:\"clear_#{attribute}_change\")\n self\n end",
"def hincrbyfloat(key, field, increment)\n node_for(key).hincrbyfloat(key, field, increment)\n end",
"def total_set\n @field.inject(0) { |a, byte| a += byte & 1 and byte >>= 1 until byte == 0; a }\n end",
"def total_set\n @field.inject(0) { |a, byte| a += byte & 1 and byte >>= 1 until byte == 0; a }\n end",
"def []=(position, value)\n value == 1 ? @field[position / ELEMENT_WIDTH] |= 1 << (position % ELEMENT_WIDTH) : @field[position / ELEMENT_WIDTH] ^= 1 << (position % ELEMENT_WIDTH)\n end",
"def each_plus_one(array)\n array.map { |number|\n number += 1\n }\nend",
"def increment\n self.class.increment(self)\n end",
"def increment!(attribute, by = 1)\n increment(attribute, by) && save\n self\n end",
"def increment(*)\n @build += 1\n end",
"def bit_rotate_count_for(operand, size)\n\t\toperand.v_bit.zero? ? 1 : @cx.low % size\n\tend",
"def increment\n curr_value = counter\n self.counter = curr_value + 1\n save\n curr_value\n end",
"def count_by column_name, field\n inc = increment_mask_for column_name, field\n only = only_mask_for column_name, field\n # Create super-special-bitfield-grouping-query w/ AREL\n sql = arel_table.\n project(\"count(#{primary_key}) as #{field}_count, (#{column_name} & #{only})/#{inc} as #{field}\").\n group(field).to_sql\n connection.send :select, sql, 'AREL' # Execute the query\n end",
"def []=(position, value)\n if value == 1\n @field[position / ELEMENT_WIDTH] |= 1 << (position % ELEMENT_WIDTH)\n elsif (@field[position / ELEMENT_WIDTH]) & (1 << (position % ELEMENT_WIDTH)) != 0\n @field[position / ELEMENT_WIDTH] ^= 1 << (position % ELEMENT_WIDTH)\n end\n end",
"def increment(attribute, by = 1)\n self[attribute] ||= 0\n self[attribute] += by\n self\n end",
"def numberOf1Bits(n)\n res = 0\n while n != 0\n n &= (n - 1)\n res += 1\n end\n return res\nend",
"def set(index, numBits, value)\n andMask = 2**numBits - 1 # 000000001111\n andMask = andMask << (index % @@wordBits) # 000011110000\n andMask = andMask ^ @xorMask # 111100001111\n @bits[index/@@wordBits] &= andMask # bbbb0000bbbb\n valMask = value << (index % @@wordBits) # 0000vvvv0000\n @bits[index/@@wordBits] |= valMask # bbbbvvvvbbbb\n end",
"def update_field(field_name, &block)\n latest = Transaction.current.updated(self).record\n vector = increment_vector_clock(latest['_flowHeader']['vectorClock'])\n header = latest['_flowHeader'].merge('vectorClock' => vector)\n version = {\n 'lastWriterID' => Flow.peer_id,\n 'vectorClockSum' => vector.inject(0) {|sum, entry| sum + entry['count'] }\n }\n new_value = yield version\n self.class.new(latest.merge('_flowHeader' => header, field_name => new_value))\n end",
"def _inc(key,value)\n _set(key, (_get(key) || 0) + value)\n end",
"def equal_to_numbers(field_values = {})\n fields = {}\n \n field_values.each_pair do |field_name, v|\n bits = self.bits_for(field_name)\n fields[bits] = v if bits.length > 0\n end\n \n all_num = 0\n none_num = 0\n fields.each_pair { |field_bits, val|\n field_bits.each_with_index do |bit, i|\n if @options[:bool_caster].call(val[i])\n all_num |= (1 << bit)\n else\n none_num |= (1 << bit)\n end\n end\n }\n \n [all_num, none_num]\n end",
"def each( &blk ) #:yields: a Field or a Bitstruct\n @fields.each {|atom|\n if atom.is_a? Bitfield\n atom.fields.each {|f| yield f}\n else\n yield atom\n end\n }\n\n end",
"def <<( new_field )\n lo = 0\n hi = size\n\n while lo < hi\n mid = (lo + hi).div(2)\n if new_field < self[mid]\n hi = mid\n else\n lo = mid + 1\n end\n end\n\n insert(lo, new_field)\n end",
"def increment_sequence_number\n @sequence_number += 1\n @sequence_number = 0 if @sequence_number > 0xFFFFFFFF\n end",
"def binary_integer_addition(b1, b2)\n\tr = []\n\tcarry = 0\n\t(b1.length-1).downto(0).each { |i|\n\t\tif b1[i] + b2[i] == 0\n\t\t\tr << 0 + carry\n\t\t\tcarry = 0\n\t\telsif b1[i] + b2[i] == 1\n\t\t\tcarry == 0 ? r << 1 : (r << 0; carry = 1)\n\t\telsif b1[i] + b2[i] == 2\n\t\t\tcarry == 0 ? r << 0 : r << 1\n\t\t\tcarry = 1\n\t\tend\n\t}\n\tif carry == 1\n\t\tr << 1\n\tend\n\tr.reverse\nend",
"def inc_b\n end",
"def add_credits(qty)\n update_column(:credits, credits + qty)\n end",
"def parse_bit_fields raw\n @raw = raw\n \n # Setup\n @unpacked = @raw.unpack( self.class.unpack_recipe )\n @attributes ||= {}\n \n self.class.fields.each_with_index do |name, position|\n \n @attributes[name] = @unpacked[position]\n \n if bit_fields = self.class.bit_fields[name]\n \n bit_value = attributes[name]\n \n # We must extract bits from end since \n # ruby doesn't have types (and fixed lengths)\n bit_fields.reverse.each do |(bit_name, bits_number, bit_mask)|\n @attributes[bit_name] = bit_value & bit_mask\n bit_value = bit_value >> bits_number\n end\n end\n end\n end",
"def set_fields(fbe_value)\n fbe_current_offset = 0\n fbe_current_size = 0\n\n byte0.fbe_offset = fbe_current_offset\n fbe_field_size = byte0.set(fbe_value.byte0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n byte1.fbe_offset = fbe_current_offset\n fbe_field_size = byte1.set(fbe_value.byte1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n byte2.fbe_offset = fbe_current_offset\n fbe_field_size = byte2.set(fbe_value.byte2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n byte3.fbe_offset = fbe_current_offset\n fbe_field_size = byte3.set(fbe_value.byte3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n byte4.fbe_offset = fbe_current_offset\n fbe_field_size = byte4.set(fbe_value.byte4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n byte5.fbe_offset = fbe_current_offset\n fbe_field_size = byte5.set(fbe_value.byte5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n char0.fbe_offset = fbe_current_offset\n fbe_field_size = char0.set(fbe_value.char0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n char1.fbe_offset = fbe_current_offset\n fbe_field_size = char1.set(fbe_value.char1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n char2.fbe_offset = fbe_current_offset\n fbe_field_size = char2.set(fbe_value.char2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n char3.fbe_offset = fbe_current_offset\n fbe_field_size = char3.set(fbe_value.char3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n char4.fbe_offset = fbe_current_offset\n fbe_field_size = char4.set(fbe_value.char4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n char5.fbe_offset = fbe_current_offset\n fbe_field_size = char5.set(fbe_value.char5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n wchar0.fbe_offset = fbe_current_offset\n fbe_field_size = wchar0.set(fbe_value.wchar0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n wchar1.fbe_offset = fbe_current_offset\n fbe_field_size = wchar1.set(fbe_value.wchar1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n wchar2.fbe_offset = fbe_current_offset\n fbe_field_size = wchar2.set(fbe_value.wchar2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n wchar3.fbe_offset = fbe_current_offset\n fbe_field_size = wchar3.set(fbe_value.wchar3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n wchar4.fbe_offset = fbe_current_offset\n fbe_field_size = wchar4.set(fbe_value.wchar4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n wchar5.fbe_offset = fbe_current_offset\n fbe_field_size = wchar5.set(fbe_value.wchar5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int8b0.fbe_offset = fbe_current_offset\n fbe_field_size = int8b0.set(fbe_value.int8b0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int8b1.fbe_offset = fbe_current_offset\n fbe_field_size = int8b1.set(fbe_value.int8b1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int8b2.fbe_offset = fbe_current_offset\n fbe_field_size = int8b2.set(fbe_value.int8b2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int8b3.fbe_offset = fbe_current_offset\n fbe_field_size = int8b3.set(fbe_value.int8b3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int8b4.fbe_offset = fbe_current_offset\n fbe_field_size = int8b4.set(fbe_value.int8b4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int8b5.fbe_offset = fbe_current_offset\n fbe_field_size = int8b5.set(fbe_value.int8b5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint8b0.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b0.set(fbe_value.uint8b0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint8b1.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b1.set(fbe_value.uint8b1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint8b2.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b2.set(fbe_value.uint8b2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint8b3.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b3.set(fbe_value.uint8b3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint8b4.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b4.set(fbe_value.uint8b4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint8b5.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b5.set(fbe_value.uint8b5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int16b0.fbe_offset = fbe_current_offset\n fbe_field_size = int16b0.set(fbe_value.int16b0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int16b1.fbe_offset = fbe_current_offset\n fbe_field_size = int16b1.set(fbe_value.int16b1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int16b2.fbe_offset = fbe_current_offset\n fbe_field_size = int16b2.set(fbe_value.int16b2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int16b3.fbe_offset = fbe_current_offset\n fbe_field_size = int16b3.set(fbe_value.int16b3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int16b4.fbe_offset = fbe_current_offset\n fbe_field_size = int16b4.set(fbe_value.int16b4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int16b5.fbe_offset = fbe_current_offset\n fbe_field_size = int16b5.set(fbe_value.int16b5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint16b0.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b0.set(fbe_value.uint16b0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint16b1.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b1.set(fbe_value.uint16b1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint16b2.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b2.set(fbe_value.uint16b2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint16b3.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b3.set(fbe_value.uint16b3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint16b4.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b4.set(fbe_value.uint16b4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint16b5.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b5.set(fbe_value.uint16b5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int32b0.fbe_offset = fbe_current_offset\n fbe_field_size = int32b0.set(fbe_value.int32b0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int32b1.fbe_offset = fbe_current_offset\n fbe_field_size = int32b1.set(fbe_value.int32b1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int32b2.fbe_offset = fbe_current_offset\n fbe_field_size = int32b2.set(fbe_value.int32b2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int32b3.fbe_offset = fbe_current_offset\n fbe_field_size = int32b3.set(fbe_value.int32b3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int32b4.fbe_offset = fbe_current_offset\n fbe_field_size = int32b4.set(fbe_value.int32b4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int32b5.fbe_offset = fbe_current_offset\n fbe_field_size = int32b5.set(fbe_value.int32b5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint32b0.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b0.set(fbe_value.uint32b0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint32b1.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b1.set(fbe_value.uint32b1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint32b2.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b2.set(fbe_value.uint32b2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint32b3.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b3.set(fbe_value.uint32b3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint32b4.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b4.set(fbe_value.uint32b4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint32b5.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b5.set(fbe_value.uint32b5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int64b0.fbe_offset = fbe_current_offset\n fbe_field_size = int64b0.set(fbe_value.int64b0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int64b1.fbe_offset = fbe_current_offset\n fbe_field_size = int64b1.set(fbe_value.int64b1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int64b2.fbe_offset = fbe_current_offset\n fbe_field_size = int64b2.set(fbe_value.int64b2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int64b3.fbe_offset = fbe_current_offset\n fbe_field_size = int64b3.set(fbe_value.int64b3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int64b4.fbe_offset = fbe_current_offset\n fbe_field_size = int64b4.set(fbe_value.int64b4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n int64b5.fbe_offset = fbe_current_offset\n fbe_field_size = int64b5.set(fbe_value.int64b5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint64b0.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b0.set(fbe_value.uint64b0)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint64b1.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b1.set(fbe_value.uint64b1)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint64b2.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b2.set(fbe_value.uint64b2)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint64b3.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b3.set(fbe_value.uint64b3)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint64b4.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b4.set(fbe_value.uint64b4)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n uint64b5.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b5.set(fbe_value.uint64b5)\n # noinspection RubyUnusedLocalVariable\n fbe_current_offset += fbe_field_size\n fbe_current_size += fbe_field_size\n\n # noinspection RubyUnnecessaryReturnValue\n fbe_current_size\n end",
"def increment_contributions\n contributions = self.contributions.nil? ? 0 : self.contributions\n contributions += 1\n self.save\n end"
]
| [
"0.89512604",
"0.7784009",
"0.6442566",
"0.59542763",
"0.5943443",
"0.59417194",
"0.5836268",
"0.5836268",
"0.5690341",
"0.5625472",
"0.5625472",
"0.5587132",
"0.55391765",
"0.5497798",
"0.54786706",
"0.5478626",
"0.5463752",
"0.54449135",
"0.5435353",
"0.54316",
"0.54045564",
"0.53958285",
"0.53928965",
"0.535376",
"0.5349865",
"0.5345867",
"0.53208333",
"0.529269",
"0.5291082",
"0.52896917",
"0.52772975",
"0.52727073",
"0.5267854",
"0.52651674",
"0.52640945",
"0.52640945",
"0.52568996",
"0.52568996",
"0.5253592",
"0.52432406",
"0.5240207",
"0.5161329",
"0.5152053",
"0.513164",
"0.51266026",
"0.5118708",
"0.5118708",
"0.5116437",
"0.5115302",
"0.5107588",
"0.5083153",
"0.50796133",
"0.50758183",
"0.50632375",
"0.50470805",
"0.5041272",
"0.5041272",
"0.5036874",
"0.50234526",
"0.50198364",
"0.5002981",
"0.5002553",
"0.5000547",
"0.50004894",
"0.49983796",
"0.49982435",
"0.49982435",
"0.497148",
"0.49656492",
"0.49597672",
"0.49576738",
"0.4957462",
"0.49537346",
"0.4943699",
"0.49433437",
"0.49433437",
"0.49413708",
"0.4934109",
"0.4930471",
"0.49290714",
"0.4912999",
"0.49120474",
"0.48941958",
"0.4884987",
"0.48847273",
"0.48745236",
"0.48553187",
"0.48352608",
"0.48285696",
"0.4820561",
"0.48134872",
"0.47929052",
"0.47878397",
"0.47774076",
"0.47773406",
"0.47768494",
"0.47743157",
"0.4772066",
"0.47533032",
"0.47517627"
]
| 0.8761737 | 1 |
Possible moves a knight can make | def possible_moves(x, y)
@moves = [[x+1,y+2], [x+1,y-2],
[x-1,y+2], [x-1,y-2],
[x+2,y+1], [x+2,y-1],
[x-2,y+1], [x-2,y-1]]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def knight_moves(position_start,position_end)\n \n\n move = [-2,-1,1,2,].product([-2,-1,1,2]).select do |x,y| x.abs != y.abs end\n \n board = (0..7).map do \n [Array.new(8,nil)]\n end\n \n queue= []\n queue.push(position_start)\n notFind = true\n \n \n while !queue.empty? && notFind \n position = queue.shift\n move.\n collect do |x,y| \n [position[0] + x , position[1] + y]\n end.\n find_all do |x,y| \n (0..7) === x && (0..7) === y \n end.\n each do |x,y|\n if board[x][y].nil? \n board[x][y] = position \n notFind = !(x == position_end[0] && y == position_end[1])\n queue.push([x,y])\n end \n end \n end\n \n path = []\n position = position_end\n path << position_end\n while position != position_start \n position = board[position[0]][position[1]]\n path.unshift(position)\n end\n \n path\n end",
"def knight_moves(starting_position,ending_position)\n return puts \"You didn't need to move at all!\" if starting_position == ending_position\n search_queue = []\n moves_array = [starting_position]\n knight = Knight.new(starting_position)\n possible_moves = knight.next_possible_moves\n if possible_moves.include?(ending_position)\n moves_array << ending_position\n number_of_moves = moves_array.size - 1\n else\n possible_moves.each do |position|\n search_queue << [position]\n end\n end\n until moves_array[-1] == ending_position\n next_moves = search_queue.shift\n knight.position = next_moves[-1]\n possible_moves = knight.next_possible_moves\n if possible_moves.include?(ending_position)\n next_moves.each { |move| moves_array << move }\n number_of_moves = moves_array.size\n moves_array << ending_position\n else\n possible_moves.each do |position|\n possibility = next_moves + [position]\n search_queue << possibility\n end\n end\n end\n if number_of_moves == 1\n puts \"You made it in #{number_of_moves} move! Here's your path:\"\n else\n puts \"You made it in #{number_of_moves} moves! Here's your path:\"\n end\n moves_array.each { |position| puts position.inspect }\nend",
"def determine_moves(loc)\n\n piece = @spaces[loc]\n\n moveset = []\n attackset = []\n new_moves = []\n\n x = loc[0]\n y = loc[1]\n\n enemy_king_checked = false\n\n\n case piece.type\n\n when \"pawn\"\n\n if piece.color == \"white\"\n\n new_moves << [x, y+1]\n new_moves << [x,y+2] if y == 1\n\n if @spaces[new_moves[0]].nil?\n\n moveset << new_moves[0]\n moveset << new_moves[1] if y == 1\n\n end\n\n atk_moves = [[x+1, y+1], [x-1, y+1]]\n atk_moves.each do |move|\n attackset << move if @spaces[move].nil?.! and @spaces[move].color == \"black\"\n if @spaces[move].nil?.!\n enemy_king_checked = true if @spaces[move].color == \"black\" and @spaces[move].type == \"king\"\n end\n end\n \n\n elsif piece.color == \"black\"\n\n new_moves = [[x, y-1]]\n new_moves << [x,y-2] if y == 6\n\n if @spaces[new_moves[0]].nil?\n\n moveset << new_moves[0]\n moveset << new_moves[1] if loc[1] == 6\n\n end\n\n atk_moves = [[x+1, y-1], [x-1, y-1]]\n atk_moves.each do |move|\n attackset << move if @spaces[move].nil?.! and @spaces[move].color == \"white\"\n if @spaces[move].nil?.!\n enemy_king_checked = true if @spaces[move].color == \"white\" and @spaces[move].type == \"king\"\n end\n end\n end\n\n @spaces[loc].moveset = moveset\n @spaces[loc].attackset = attackset\n \n\n when \"rook\"\n\n runner(loc, :north)\n runner(loc, :east)\n runner(loc, :south)\n runner(loc, :west)\n\n when \"knight\"\n\n possible_directions =\n [ [x+1, y+2],\n [x+1, y-2],\n [x-1, y+2],\n [x-1, y-2],\n [x+2, y+1],\n [x+2, y-1],\n [x-2, y+1],\n [x-2, y-1] ]\n\n moveset = possible_directions.select do |d|\n (d[0].between?(0,7) & d[1].between?(0,7)) and @spaces[d].nil?\n end\n\n attackset = possible_directions.select do |d|\n (d[0].between?(0,7) & d[1].between?(0,7)) and (@spaces[d].nil?.! and @spaces[d].color != @spaces[loc].color)\n end\n\n @spaces[loc].moveset = moveset\n @spaces[loc].attackset = attackset\n\n\n when \"bishop\"\n\n runner(loc, :northeast)\n runner(loc, :southeast)\n runner(loc, :northwest)\n runner(loc, :southwest)\n\n\n when \"queen\"\n\n runner(loc, :north)\n runner(loc, :northeast)\n runner(loc, :east)\n runner(loc, :southeast)\n runner(loc, :south)\n runner(loc, :southwest)\n runner(loc, :west)\n runner(loc, :northwest)\n\n\n when \"king\"\n\n runner(loc, :north, 1)\n runner(loc, :northeast, 1)\n runner(loc, :east, 1)\n runner(loc, :southeast, 1)\n runner(loc, :south, 1)\n runner(loc, :southwest, 1)\n runner(loc, :west, 1)\n runner(loc, :northwest, 1)\n\n end\n\n\n end",
"def knight_moves(start, dest)\n return puts \"You are already there.\" if start == dest # If user input same starting and destination\n return puts \"Starting position is invalid\" if !valid_play(start[0], start[1]) # If user input invalid starting position\n return puts \"Destination is invalid\" if !valid_play(dest[0], dest[1]) # If user input invalid position on the board as destination\n\n visited = [start] # Start the visited array with start position as that has been checked for above (if start == dest)\n queue = []\n \n queue = build_path(Node.new(start), visited) # Returns the first iteration of the possible moves for the knight piece\n while !queue.empty? # Run until all positions have been checked\n current = queue.shift()\n if current.value == dest # If found\n print_path(current)\n break\n else\n visited << current.value # Mark position checked for\n queue += build_path(current, visited) # Add on new possible positions the knight can take\n end\n end\n end",
"def legal_moves\n # Fill this in\n end",
"def move_knight\n #there is no more than eight moves\nend",
"def valid_moves\n\n end",
"def knight_moves(start, target)\n valid_coordinates = valid_coordinate?(start) && valid_coordinate?(target)\n return puts \"Invalid coordinates!\" unless valid_coordinates\n @coordinate = start\n @visited << start\n\n knight = find_target(target)\n\n path = calculate_path_to(knight)\n\n number_of_moves = path.size - 1\n puts \"You made it in #{number_of_moves} moves! Here's your path:\"\n path.each do |move|\n p move\n end\n\n @visited = []\n end",
"def generate_possible_moves(state)\n end",
"def knight_moves(start_case, target_case)\r\n knight = Knight.new\r\n board = Board.new\r\n\r\n board.moves(knight, start_case, target_case)\r\nend",
"def knight_moves\n\t\tnode = Square.new(@start)\n\t\t@queue << node\n\t\twhile @queue.empty? == false\n\t\t\tcurrent = @queue[0]\n\t\t\tif current.value == @final\n\t\t\t\tdisplay_result(current)\t\t\t\n\t\t\telse\n\n\t\t\t\t8.times do |num|\n\t\t\t\t\tx = current.value[0] + @row[num]\n\t\t\t\t\ty = current.value[1] + @col[num]\n\t\t\t\t\tif (x.between?(1,8) && y.between?(1,8)) && @revised.include?([x, y]) == false\n\t\t\t\t\t\tnode = Square.new([x, y])\n\t\t\t\t\t\tnode.parent = current\n\t\t\t\t\t\tnode.count = current.count + 1\n\t\t\t\t\t\t@queue << node\n\t\t\t\t\telse\n\t\t\t\t\t\tnext\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t@revised << current.value\n\t\t\t\[email protected]\n\t\t\tend\n\t\tend\n\t\tputs \"NOT FOUND !!!\"\n\t\tputs \"This program presumes a 8x8 Chess Board\"\n\t\tputs \"Therefore your coordinates must be between (1, 1) and (8, 8).\"\n\tend",
"def get_moves\n reset_moves\n jump_moves\n base_moves if @valid_moves.empty?\n end",
"def possible_moves(board)\n poss_move_array = []\n current_square = @history.last\n current_coords = parse_coord(current_square)\n\n poss_move_array.push(single_march(current_coords, board)) if single_march(current_coords, board)\n\n poss_move_array.push(double_march(current_coords, board)) if first_move? && double_march(current_coords, board)\n\n valid_diagonals(current_coords, board).each { |move| poss_move_array.push(move) }\n\n # en passant only allowed opportunity first created\n poss_move_array.push(en_passant?(current_coords, board)) if en_passant?(current_coords, board)\n\n poss_move_array\n end",
"def knight_moves(start, stop)\n\tknight = Knight.new(start)\n\tboard = Board.new\n\tq = MyQueue.new\n\n\tq.push knight\n\n\tuntil knight.position == stop\n\t\tknight = q.pop #select the knight from queue\n\t\t#Set children to all valid moves\n\t\tchildren = knight.children.select { |k| board.on_board?(k) } #k for knight\n\t\t#add each valid child move to the queue\n\t\tchildren.each { |k| q.push(k) }\n\tend\n\tknight.history #returns the array of all moves made\nend",
"def possible_moves(starting_position, actual_piece, turn = @turn, board = @board)\n row = starting_position[0]\n column = starting_position[1]\n potential_moves = []\n\n active_pieces = []\n enemy_pieces = []\n\n if turn == 1\n active_pieces = @w_pieces\n enemy_pieces = @b_pieces\n else\n active_pieces = @b_pieces\n enemy_pieces = @w_pieces\n end\n\n # moves available for white pawns\n if actual_piece == $w_pawn\n # if the white pawn is in its original spot, then it can move two spots or one spot\n return if row == 7\n\n if row == 1\n potential_moves << [row+1, column] if board[row+1][column] == ' '\n potential_moves << [row+2, column] if board[row+2][column] == ' '\n else\n potential_moves << [row+1, column] if board[row+1][column] == ' '\n end\n\n # can take black pieces, but only if they are available diagonally\n potential_moves << [row+1, column+1] if @b_pieces.include?(board[row+1][column+1])\n potential_moves << [row+1, column-1] if @b_pieces.include?(board[row+1][column-1])\n\n # can take black pawns under special en-passant rule\n if @en_passant_piece != []\n passant_row = invert_position_converter(@en_passant_piece)[0]\n passant_col = invert_position_converter(@en_passant_piece)[1]\n if passant_row == row && (passant_col == column + 1 || passant_col == column - 1)\n # it must be empty in order for us to do en-passant (otherwise the pawn can just take)\n if @board[passant_row+1][passant_col] = ' '\n potential_moves << [passant_row+1, passant_col]\n end\n end\n end\n end \n\n # moves available for black pawns\n if actual_piece == $b_pawn\n # if the black pawn is in its original spot, then it can move two spots or one spot\n return if row == 0\n\n if row == 6\n potential_moves << [row-1, column] if board[row-1][column] == ' '\n potential_moves << [row-2, column] if board[row-2][column] == ' '\n else\n potential_moves << [row-1, column] if board[row-1][column] == ' '\n end\n\n # can take white pieces\n potential_moves << [row-1, column+1] if @b_pieces.include?(board[row-1][column+1])\n potential_moves << [row-1, column-1] if @b_pieces.include?(board[row-1][column-1])\n\n # can take white pawns under special en-passant rule\n\n if @en_passant_piece != []\n passant_row = invert_position_converter(@en_passant_piece)[0]\n passant_col = invert_position_converter(@en_passant_piece)[1]\n if passant_row == row && (passant_col == column + 1 || passant_col == column - 1)\n if @board[passant_row-1][passant_col] = ' '\n potential_moves << [passant_row-1, passant_col]\n end\n end\n end\n end\n\n # moves available for rooks\n if actual_piece == $w_rook || actual_piece == $b_rook\n\n i_row = row\n i_col = column\n\n # returns all potential moves north of the starting position\n until i_row+1 == 8 || active_pieces.include?(board[i_row+1][i_col])\n if enemy_pieces.include?(board[i_row+1][i_col])\n potential_moves << [i_row+1,i_col]\n break\n else\n potential_moves << [i_row+1,i_col]\n end\n i_row += 1\n end\n \n i_row = row\n i_col = column \n\n # returns all potential moves south of the starting position\n until active_pieces.include?(board[i_row-1][i_col]) || i_row-1 == -1\n if enemy_pieces.include?(board[i_row-1][i_col])\n potential_moves << [i_row-1,i_col]\n break\n else\n potential_moves << [i_row-1,i_col]\n end\n i_row -= 1\n end\n\n i_row = row\n i_col = column\n \n\n # returns all potential moves right of the starting position\n until active_pieces.include?(board[i_row][i_col+1]) || i_col+1 == 8\n if enemy_pieces.include?(board[i_row][i_col+1])\n potential_moves << [i_row,i_col+1]\n break\n else\n potential_moves << [i_row,i_col+1]\n end\n i_col += 1\n end\n\n i_row = row\n i_col = column\n \n # returns all potential moves left of the starting position\n until active_pieces.include?(board[i_row][i_col-1]) || i_col-1 == -1\n if enemy_pieces.include?(board[i_row][i_col-1])\n potential_moves << [i_row,i_col-1]\n break\n else\n potential_moves << [i_row,i_col-1]\n end\n i_col -= 1\n end\n\n i_row = row\n i_col = column\n\n end\n\n # moves available for knights\n if actual_piece == $w_knig || actual_piece == $b_knig\n\n # returns all potential moves\n potential_moves << [row+2, column+1]\n potential_moves << [row+1, column+2]\n potential_moves << [row-1, column+2]\n potential_moves << [row-2, column+1]\n potential_moves << [row-2, column-1]\n potential_moves << [row-1, column-2]\n potential_moves << [row+1, column-2]\n potential_moves << [row+2, column-1]\n\n end\n\n # moves available for bishops\n if actual_piece == $w_bish || actual_piece == $b_bish\n\n i_row = row\n i_col = column\n\n # returns all potential moving north-east of the starting position\n\n until i_row+1 == 8 || i_col+1 == 8 || active_pieces.include?(board[i_row+1][i_col+1])\n if enemy_pieces.include?(board[i_row+1][i_col+1])\n potential_moves << [i_row+1,i_col+1]\n break\n else\n potential_moves << [i_row+1,i_col+1]\n end\n i_row += 1\n i_col += 1\n end\n \n i_row = row\n i_col = column \n\n # returns all potential moving south-east of the starting position\n until i_row-1 == -1 || i_col+1 ==8 || active_pieces.include?(board[i_row-1][i_col+1])\n if enemy_pieces.include?(board[i_row-1][i_col+1])\n potential_moves << [i_row-1,i_col+1]\n break\n else\n potential_moves << [i_row-1,i_col+1]\n end\n i_row -= 1\n i_col += 1\n end\n \n i_row = row\n i_col = column \n\n # returns all potential moving south-west of the starting position\n until i_row-1 == -1 || i_col-1 == -1 || active_pieces.include?(board[i_row-1][i_col-1])\n if enemy_pieces.include?(board[i_row-1][i_col-1])\n potential_moves << [i_row-1,i_col-1]\n break\n else\n potential_moves << [i_row-1,i_col-1]\n end\n i_row -= 1\n i_col -= 1\n end\n \n i_row = row\n i_col = column \n \n # returns all potential moving north-east of the starting position\n until i_row+1 == 8 || i_col-1 == -1 || active_pieces.include?(board[i_row+1][i_col-1])\n if enemy_pieces.include?(board[i_row+1][i_col-1])\n potential_moves << [i_row+1,i_col-1]\n break\n else\n potential_moves << [i_row+1,i_col-1]\n end\n i_row += 1\n i_col -= 1\n end\n \n i_row = row\n i_col = column \n\n end\n\n # moves available for queens\n if actual_piece == $w_quee || actual_piece == $b_quee\n if actual_piece == $w_quee\n potential_moves.concat(possible_moves(starting_position, $w_rook, turn = 1))\n potential_moves.concat(possible_moves(starting_position, $w_bish, turn = 1))\n end\n if actual_piece == $b_quee\n potential_moves.concat(possible_moves(starting_position, $b_rook, turn = 2))\n potential_moves.concat(possible_moves(starting_position, $b_bish, turn = 2))\n end\n end\n\n # moves available for kings\n if actual_piece == $w_king || actual_piece == $b_king\n i_row = row\n i_col = column\n\n potential_moves << [i_row+1, i_col]\n potential_moves << [i_row+1, i_col+1]\n potential_moves << [i_row, i_col+1]\n potential_moves << [i_row-1, i_col-1]\n potential_moves << [i_row-1, i_col]\n potential_moves << [i_row-1, i_col+1]\n potential_moves << [i_row, i_col-1]\n potential_moves << [i_row+1, i_col-1]\n\n # castling conditions\n # The king does not move over a square that is attacked by an enemy piece during the castling move, i.e., when castling, there may not be an enemy piece that can move (in case of pawns: by diagonal movement) to a square that is moved over by the king.\n\n # The king cannot be in check if they are trying to castle\n if !@check_condition\n if actual_piece == $w_king\n # checks for left rook potential\n if board[0][1] == ' ' && board[0][2] == ' ' && board[0][3] == ' '\n binding.pry\n if @w_king_move == \"not moved\" && @w_rook_left == \"not moved\"\n if !enemy_positions.include?([0, 3])\n potential_moves << [0, 2]\n end\n end\n #checks for right rook potential\n elsif board[0][5] == ' ' && board[0][6] == ' '\n if @w_king_move == \"not moved\" && @w_rook_right == \"not moved\"\n if !enemy_positions.include?([0, 5])\n potential_moves << [0, 6]\n end\n end\n end\n end\n if actual_piece == $b_king\n # checks for left rook potential\n if board[7][1] == ' ' && board[7][2] == ' ' && board[7][3] == ' '\n if @b_king_move == \"not moved\" && @b_rook_left == \"not moved\"\n if !enemy_positions.include?([7, 3])\n potential_moves << [7, 2]\n end \n end\n #checks for right rook potential\n elsif board[7][5] == ' ' && board[7][6] == ' '\n if @b_king_move == \"not moved\" && @b_rook_right == \"not moved\"\n if !enemy_positions.include?([7, 5])\n potential_moves << [7, 6] \n end\n end\n end\n end\n end\n\n end\n\n potential_moves = potential_moves.select { |pos| valid_move?(pos, turn)}\n\n potential_moves\n\n end",
"def knight(p1)\n row = get_row_from_index(p1)\n col = get_col_from_index(p1)\n valid = []\n valid_no_ff = []\n\n # Valid knight moves based on its board position\n if row < 7 && col < 8\n valid << (p1 + 17)\n end\n if row < 7 && col > 1\n valid << (p1 + 15)\n end\n if row < 8 && col < 7\n valid << (p1 + 10)\n end\n if row < 8 && col > 2\n valid << (p1 + 6)\n end\n if row > 1 && col < 7\n valid << (p1 - 6)\n end\n if row > 1 && col > 2\n valid << (p1 - 10)\n end\n if row > 2 && col < 8\n valid << (p1 - 15)\n end\n if row > 2 && col > 1\n valid << (p1 - 17)\n end\n\n # All possible moves for the knight based on board boundaries will added\n # This iterator filters for friendly fire, and removes indexes pointing to same color pices\n valid.each do |pos|\n unless piece_color(pos) == @@color\n valid_no_ff << pos\n end\n end\n\n return valid_no_ff\n end",
"def knight_move\n !(horizontal_move or vertical_move) && (((@initial_pos[0] - @final_pos[0]).abs) < 3 && ((@initial_pos[1] - @final_pos[1]).abs) < 3)\n end",
"def move_knight(p1)\n row = get_row_from_index(p1)\n col = get_col_from_index(p1)\n\n valid = []\n valid_moves_no_friendly_fire = []\n\n # Valid knight moves based on its board position\n valid << (p1 + 17) if row < 7 && col < 8\n valid << (p1 + 15) if row < 7 && col > 1\n valid << (p1 + 10) if row < 8 && col < 7\n valid << (p1 + 6) if row < 8 && col > 2\n valid << (p1 - 6) if row > 1 && col < 7\n valid << (p1 - 10) if row > 1 && col > 2\n valid << (p1 - 15) if row > 2 && col < 8\n valid << (p1 - 17) if row > 2 && col > 1\n\n # All possible moves for the knight based on board boundaries will added\n # This iterator filters for friendly fire, and removes indexes pointing to same color pices\n valid.each do |pos|\n valid_moves_no_friendly_fire << pos unless piece_color(pos) == Move.color\n end\n\n valid_moves_no_friendly_fire\n end",
"def possible_moves\n possible_moves = []\n\n # move up\n up_right = [start[X] + 1, start[Y] + 2]\n possible_moves << up_right\n\n up_left = [start[X] - 1, start[Y] + 2]\n possible_moves << up_left\n\n # move right\n right_up = [start[X] + 2, start[Y] + 1]\n possible_moves << right_up\n\n right_down = [start[X] + 2, start[Y] - 1]\n possible_moves << right_down\n\n # move down\n down_right = [start[X] + 1, start[Y] - 2]\n possible_moves << down_right\n\n down_left = [start[X] - 1, start[Y] - 2]\n possible_moves << down_left\n\n # move left\n left_up = [start[X] - 2, start[Y] + 1]\n possible_moves << left_up\n\n left_down = [start[X] - 2, start[Y] - 1]\n possible_moves << left_down\n\n possible_moves.select { |move| @board.valid_position?(move) }\n\n end",
"def possible_moves\n # p possible_non_attack_moves\n # p possible_attack_moves\n moves = possible_non_attack_moves + possible_attack_moves\n moves.reject! { |move| move.any? { |c| c < 0 || c > 7} }\n moves\n end",
"def moves_knight(color, a, b)\n \t_moves = knight(a, b)\n \t_moves.map! do |spot|\n\t\t\tx, y = spot\n\t\t\tnext if (x < 0 || x > 7 || y < 0 || y > 7) \n\t\t\tspot if (@board[x][y].piece == nil || @board[x][y].piece.color != color)\n\t\tend\n\t\t_moves.compact\n end",
"def knight_moves(start, destination)\n\t\tnode = possible_moves(Node.new(start), destination)\n\t\tpath = []\n\t\twhile node.parent != nil\n\t\t\tpath.push(node.value)\n\t\t\tnode = node.parent\n\t\tend\n\t\tpath.push(start)\n\t\tprint_path(path.reverse)\n\tend",
"def moves\n sliding_moves + jumping_moves\n end",
"def knight_moves(from, to)\r\n if from == to\r\n return to\r\n end\r\n queue = []\r\n #hash for tracking paths taken, initialized with start location\r\n paths_list = {from.to_s.to_sym => [from]}\r\n #This tracks if we have made a particular move from the current node\r\n #values are stored as symbolized node + move type \r\n visited = {}\r\n answer = []\r\n done = false\r\n #start location\r\n queue.push from\r\n\r\n until queue.empty? || done do\r\n #get first item in queue\r\n node = queue.shift\r\n\r\n @@moves.each do |move_type, offset|\r\n destinaiton = [node[0] + offset[0], node[1] + offset[1]]\r\n \r\n if @board.in_bounds?(destinaiton) && !visited[(node.to_s + move_type.to_s).to_sym]\r\n visited[(node.to_s + move_type.to_s).to_sym] = true\r\n queue.push destinaiton\r\n \r\n #track backward the path taken\r\n paths_list[destinaiton.to_s.to_sym] = (paths_list[node.to_s.to_sym] + [destinaiton])\r\n if to == destinaiton\r\n answer = paths_list[destinaiton.to_s.to_sym]\r\n done = true\r\n break\r\n end\r\n end\r\n end\r\n end\r\n answer\r\n end",
"def all_moves harmless\n\t\t# NOTE: harmless test disabled\n\t\tharmless = false\n\n\t\tmoves = {} \n\n\t\tif moved? or next_to_enemy?\n\t\t\tmoves[ :STAY ] = pos\n\t\t\treturn moves\n\t\tend\n\n\t\tlam = lambda do |dir| \n\t\t\t# Test movement of collective\n\t\t\tif can_pass? dir, false\n\t\t\t\tmoves[ dir ] = square.neighbor dir\n\t\t\tend\n\t\tend\n\n\t\t# Note that we don't bother with orientation so close to conflict\t\n\n\t\tif harmless\n\t\t\t$logger.info { \"#{ self } attackers harmless; staying is not an option\" }\n\t\telse\n\t\t\tmoves[ :STAY ] = square\n\t\tend\n\t\tlam.call :N\n\t\tlam.call :E\n\t\tlam.call :S\n\t\tlam.call :W\n\n\t\tif moves.empty?\n\t\t\t$logger.info \"We are stuck, apparently; staying anyway.\"\n\t\t\tmoves[ :STAY ] = square\n\t\tend\n\n\t\t$logger.info { \"possible moves: #{ moves }\" }\n\n\t\tmoves\n\tend",
"def find_possible_moves\n @possible_moves = []\n\n @moveset.each do |move, value|\n x = @x + value[0]\n y = @y + value[1]\n\n next unless ChessBoard.check_boundaries(x, y) && !visited_coordinates.include?([x, y])\n\n @possible_moves << move\n end\n end",
"def knight_moves(position, final)\n position == final ? result = [final] : result = 0\n position = [position]\n queue = []\n while result == 0\n pm = possible_movements(position.last)\n if pm.include?(final)\n result = position << final\n else\n pm.each do |move|\n queue << (position + [move])\n end\n position = queue.delete_at(0)\n end\n end\n pretty_result(result)\nend",
"def jump_moves\n moves = [] # initializes empty move array\n\n # choses \"forward\" y direction based on piece team\n if @team == \"l\"\n dir = 1\n else\n dir = -1\n end\n\n # looks at the two forward far diagonal positions and adds them to moves array if there are no pieces there and an opponent piece in between\n pos1 = [@x_pos + 2, @y_pos + 2*dir]\n moves << pos1 if Piece.all.find{|p| p.x_pos == @x_pos + 1 && p.y_pos == @y_pos + dir && p.team != @team} && Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos1}\n pos2 = [@x_pos - 2, @y_pos + 2*dir]\n moves << pos2 if Piece.all.find{|p| p.x_pos == @x_pos - 1 && p.y_pos == @y_pos + dir && p.team != @team} && Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos2}\n \n\n # deletes any moves with coordinates that aren't on the board\n moves.delete_if{|move| move.find{|n| n < 0 || n > 7}}\n return moves\n end",
"def possible_king_moves(start_arr)\n\t\tx = start_arr[0]\n\t\ty = start_arr[1]\n\t\tcandidates = []\n\t\tcandidates << [x+1,y]\n\t\tcandidates << [x-1,y]\t\t\n\t\tcandidates << [x,y+1]\t\t\t\t\n\t\tcandidates << [x,y-1]\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\tcandidates << [x+1,y+1]\n\t\tcandidates << [x-1,y-1]\t\n\t\tcandidates << [x-1,y+1]\t\t\t\t\n\t\tcandidates << [x+1,y-1]\t\t\t\t\n\t\tchildren = candidates.select { |pos| pos[0] >= 0 && pos[1] >= 0 && pos[0] <= 7 && pos[1] <= 7}\n\t\tchildren.delete_if do |child|\n\t\t\tif !(@board[child] == \"*\")\n\t\t\t\t# If pieces not same color\n\t\t\t\tif @board[child].color == @board[start_arr].color\n\t\t\t\t\tif occupied(child)\n\t\t\t\t\t\tcan_do = true\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tchildren\n\tend",
"def test_exposed_check_by_move\n board = ChessBoard.new\n piece = Knight.new(:white)\n board.add(piece, 'd4')\n\n board.add(King.new(:white), 'd1')\n board.add(Rook.new(:black), 'd8')\n\n refute(piece.valid_move?('d4', 'e6', board), 'Knight cannot expose king to check')\n end",
"def knight_moves(initial, final)\n @board.check_impossible_move(initial, final)\n\n search_queue = [Vertex.new(initial)]\n\n until search_queue.empty?\n test_vertex = search_queue.shift\n\n return show_path(make_path(test_vertex)) if test_vertex.value == final\n \n @board.possible_moves(test_vertex.value).each do |move|\n new_vertex = Vertex.new(move)\n new_vertex.parent = test_vertex\n test_vertex.children << move\n search_queue << new_vertex\n end \n\n end\n \"No path was found :(\"\n end",
"def knight_moves(src_sqr = [0, 0], tgt_sqr = [0, 0])\n # Init the board and a Knight piece\n board = Board.new\n knight = Knight.new\n \n puts \"\\nFrom #{src_sqr} to #{tgt_sqr}...\"\n \n unless board.valid_position?(src_sqr[0], src_sqr[1]) && board.valid_position?(tgt_sqr[0], tgt_sqr[1])\n puts \"Invalid starting or ending positions!\\nPlease, provide only valid positions in range [0, 0] to [7, 7] to find a solution!\"\n\treturn\n end\n \n # Mark the source square on the board and set its distance to 0\n board.mark_square(src_sqr[0], src_sqr[1], knight.to_sym)\n board.set_square_distance(src_sqr[0], src_sqr[1], 0)\n # Enqueue the source square\n queue = [src_sqr]\n \n # BFS algorithm \n while !queue.empty?\n cur_sqr = queue.shift \n \n\tbreak if cur_sqr == tgt_sqr\n\t\n # Get all possible moves from current position\t\n\tknight.set_position(cur_sqr[0], cur_sqr[1])\n\tknight.get_possible_moves.each do |move| \n\t next unless board.is_square_empty?(move[0], move[1]) \n\t \n\t # Enqueue all possible moves whose related squares are not visited yet\n\t queue << move \n\t board.mark_square(move[0], move[1], knight.to_sym)\n\t board.set_square_distance(move[0], move[1], board.get_square_distance(cur_sqr[0], cur_sqr[1]) + 1)\n\t board.set_square_parent(move[0], move[1], cur_sqr)\n\tend\n end\n \n # Build the reverse path from src_sqr to tgt_sqr, starting from tgt_sqr\n path = [tgt_sqr]\n parent = board.get_square_parent(tgt_sqr[0], tgt_sqr[1])\n while !parent.nil?\n path << parent\n\tparent = board.get_square_parent(parent[0], parent[1])\n end\n \n # Print the solution\n puts \"Solution obtained in #{path.length - 1} move#{path.length - 1 != 1 ? 's' : ''}! The path is:\"\n path.reverse.each {|move| p move}\n \nend",
"def knight_moves(start, finish)\n tree = MoveTree.new(start)\n queue = [tree]\n result = nil\n visited_points = Set.new()\n while queue.length > 0\n current_node = queue.shift\n visited_points.add(current_node.point)\n if current_node.point == finish\n result = get_path(current_node)\n break\n else\n propagate_tree(current_node)\n queue += current_node.children.reject { |n| visited_points.include?(n.point) }\n end\n end\n result\nend",
"def valid_moves\n super\n end",
"def generate_moves\n @delta.each do |step|\n (1..7).each do |i|\n new_pos = [@pos[0] + step[0] * i, @pos[1] + step[1] * i]\n if valid_coord?(new_pos)\n @move_list << new_pos\n break if @board[new_pos]\n else\n break\n end\n end\n end\n end",
"def get_moves(piece, board)\n valid_col = case piece.name\n when ?A then 3\n when ?B then 5\n when ?C then 7\n when ?D then 9\n else 11\n end\n moves = []\n\n # If in hallway\n if piece.row == 1\n cols = valid_col < piece.col ? (valid_col...piece.col).to_a : (piece.col+1..valid_col).to_a\n if cols.count{|c| board[[1, c]] == ?.} == cols.length\n if board[[2, valid_col]] == ?.\n if board[[3, valid_col]] == ?.\n moves << [[3, valid_col], (cols.count + 2) * piece.cost]\n elsif board[[3, valid_col]] == piece.name\n moves << [[2, valid_col], (cols.count + 1) * piece.cost]\n end\n end\n end\n # If not in its column (can never stand in hallway anf column at same time)\n elsif (piece.col == valid_col && piece.row == 2 && board[[piece.row + 1, piece.col]] != piece.name) || (piece.col != valid_col && piece.row == 2)\n 2.times do |t|\n dir = t == 0 ? -1 : 1\n curr = piece.col\n steps = 1\n while board[[1, curr]] == ?.\n moves << [[1, curr], steps * piece.cost] if ![3, 5, 7, 9].include?(curr)\n steps += 1\n curr += dir\n end\n end\n elsif piece.row == 3 && piece.col != valid_col && board[[2, piece.col]] == ?.\n 2.times do |t|\n dir = t == 0 ? -1 : 1\n curr = piece.col\n steps = 2\n while board[[1, curr]] == ?.\n moves << [[1, curr], steps * piece.cost] if ![3, 5, 7, 9].include?(curr)\n steps += 1\n curr += dir\n end\n end\n end\n moves\nend",
"def possible_moves\r\n return [] if won?\r\n (0..8).select {|i| board.cells[i] == \" \"}\r\n end",
"def gen_knight_moves(color)\n moves = []\n \n # knights can't move to squares occupied by their own color\n # so determine where the knights comrades are\n if color == :white\n position = @position.white \n comrades = @position.white_pieces\n else\n position = @position.black\n comrades = @position.black_pieces\n end\n \n # no work to do when there are no knights\n return moves if position[:knight].nil?\n \n # for each knight \n position[:knight].set_bits.each do |from| \n # valid moves are all those squares attacked from the current\n # position that aren't occupied by comrades\n move_to = Move::Attacks[:knight][from] & ~comrades\n move_to.set_bits.each do |to| \n moves.push [Square.index(from), Square.index(to)]\n end\n end\n moves\n end",
"def knight_moves(from, to)\n\treturn unless input_valid?(from, to)\n\tpath = knight_path(from, to)\n\tdisplay_path path\nend",
"def moves!\n total_possible_moves = []\n total_possible_moves.concat(diag_moves(diag_initializer))\n total_possible_moves.concat(straight_moves(move_initializer))\n total_possible_moves.select { |move| self.valid_move?(move) }\n end",
"def possible_moves\n all_moves = []\n x, y = @position\n moves = [[x, y-1], [x-1, y-1], [x-1, y], [x-1, y+1], [x, y+1], [x+1, y+1], [x+1, y], [x+1, y-1]]\n moves.each do |position|\n all_moves << [position] if position.all? { |number| number.between?(0,7) }\n end\n all_moves\n end",
"def moves\n\n #\n all_moves = sigma_deltas().map {|delta| transform(delta)}\n # all_moves.select { |move| board.on_board?(move)}\n end",
"def possible_moves\n possibles = []\n @state.each_with_index do |column, i|\n possibles << i if column[5] == :e\n end\n possibles\n end",
"def available_moves\n adjacent_tiles(*@hole)\n end",
"def possible_moves\n return []\n end",
"def calculate_moves(piece, location)\n @x = location[0].to_i\n @y = location[1].to_i\n @possible_moves = []\n\n def add_straight_line_moves(index)\n move = \"#{@x + (index + 1)}#{@y}\" # Right\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x}#{@y + (index + 1)}\" # Up\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x - (index + 1)}#{@y}\" # Left\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x}#{@y - (index + 1)}\" # Down\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n end\n\n def add_diagonal_moves(index)\n move = \"#{@x + (index + 1)}#{@y + (index + 1)}\" # Up right\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x - (index + 1)}#{@y - (index + 1)}\" # Down left\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x + (index + 1)}#{@y - (index + 1)}\" # Down right\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x - (index + 1)}#{@y + (index + 1)}\" # Up left\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n end\n\n case piece\n\n when \"WhitePawn\"\n # 1 step forward\n move = \"#{@x}#{@y + 1}\"\n @possible_moves << move unless @board[move] != nil \n # Attack forward right\n move = \"#{@x + 1}#{@y + 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent \n @possible_moves << move \n end \n # Attack forward left\n move = \"#{@x - 1}#{@y + 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent \n @possible_moves << move \n end \n # 2 steps forward if its in the starting point\n move = \"#{@x}#{@y + 2}\"\n @possible_moves << move unless @y != 2 || path_blocked?(move) ||\n @board[move] != nil\n\n when \"BlackPawn\"\n # Same moves of the WhitePawn but reversed\n move = \"#{@x}#{@y - 1}\"\n @possible_moves << move unless @board[move] != nil \n \n move = \"#{@x + 1}#{@y - 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent\n @possible_moves << move \n end\n \n move = \"#{@x - 1}#{@y - 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent\n @possible_moves << move\n end\n \n move = \"#{@x}#{@y - 2}\"\n @possible_moves << move unless @y != 7 || path_blocked?(move) || @board[move]\n\n when \"Rook\"\n # 7 is the max distance between squares\n # The method is called 7 times to have a list of all possible targets ready\n 7.times { |index| add_straight_line_moves(index) }\n\n when \"Knight\"\n knight_moves = [[@x + 1, @y + 2], [@x + 2, @y + 1], \n [@x + 2, @y - 1], [@x + 1, @y - 2], \n [@x - 1, @y - 2], [@x - 2, @y - 1], \n [@x - 2, @y + 1], [@x - 1, @y + 2]]\n \n knight_moves.each do |move|\n move = \"#{move[0]}#{move[1]}\" \n @possible_moves << move unless out_of_bounds?(move) || friendly_piece?(move)\n end\n\n when \"Bishop\"\n 7.times { |index| add_diagonal_moves(index) }\n \n when \"Queen\"\n 7.times do |index|\n add_straight_line_moves(index)\n add_diagonal_moves(index)\n end\n \n when \"King\"\n # The King can move only 1 square away so the methods are called just once\n add_straight_line_moves(0)\n add_diagonal_moves(0)\n else\n\n end\n end",
"def movement(row1, col1, board)\n\n possible_moves=Array.new\n if @color==\"white\"\n # checking square in front\n if row1+1<8 && board.get_square(row1+1,col1).occupied==false\n possible_moves <<[row1+1,col1]\n\n #checking 2 squares forward\n if @position==\"initial\" && !board.get_square(row1+2,col1).occupied\n possible_moves <<[row1+2,col1]\n end\n end\n\n # checking attacking squares\n if row1+1<8 && col1-1>=0\n atk_sq1 = board.get_square(row1+1,col1-1)\n\n if atk_sq1.occupied && atk_sq1.piece.color != @color || !atk_sq1.occupied && atk_sq1.en_passanted\n possible_moves <<[row1+1,col1-1]\n end\n end\n if row1+1<8 && col1+1<8\n atk_sq2 = board.get_square(row1+1,col1+1)\n if atk_sq2.occupied && atk_sq2.piece.color != @color || !atk_sq2.occupied && atk_sq2.en_passanted\n possible_moves <<[row1+1,col1+1]\n end\n end\n\n elsif @color==\"black\"\n # checking square in front\n if row1-1>=0 && board.get_square(row1-1,col1).occupied==false\n possible_moves <<[row1-1,col1]\n\n # checking for 2 squares forward\n if @position==\"initial\" && board.get_square(row1-2,col1).occupied==false\n possible_moves <<[row1-2,col1]\n end\n end\n\n # checking attacking squares\n if row1-1>=0 && col1-1>=0\n atk_sq1 = board.get_square(row1-1,col1-1)\n if (atk_sq1.occupied && atk_sq1.piece.color != @color) || (!atk_sq1.occupied && atk_sq1.en_passanted)\n possible_moves <<[row1-1,col1-1]\n end\n end\n if row1-1>=0 && col1+1<8\n atk_sq2 = board.get_square(row1-1,col1+1)\n if (atk_sq2.occupied && atk_sq2.piece.color != @color) || (!atk_sq2.occupied && atk_sq2.en_passanted)\n possible_moves <<[row1-1,col1+1]\n end\n end\n end\n\n #removing moves that go off the board\n possible_moves = possible_moves.select do |a|\n a[0]>=0 && a[0]<8 && a[1]>=0 && a[1]<8\n end\n\n return possible_moves\n\n end",
"def moves\n # All pieces can stay in place\n [[0,0]]\n end",
"def knight_moves(from, to)\r\n\treturn unless input_valid?(from, to)\r\n\tpath = knight_path(from, to)\r\n\tdisplay_path path\r\nend",
"def legal_moves\n out = Set.new\n board = self.unrolled\n mark = next_turn_taker(board)\n \n board.each_with_index do |space, i|\n if space == @@MARKS[:empty]\n new_state = GameState.new(self.board_bits)\n new_state.mark_index i, mark\n out << new_state\n end\n end\n \n return out\n end",
"def checkmoves(king, attacking_pieces, board )\n if self == king\n enemy_pieces = self.game.pieces.where('player_id != ?', king.player_id).where(captured_piece: false)\n king_moves = king.piece_can_move_to(board)\n enemy_pieces.each do |enemy_piece|\n if enemy_piece.type == \"Pawn\" #testing for if pawn is attacking square king could move to. wierd case since pawn cant move to this square unless an enemy piece is there to capture (take diagonal)\n pawn_test_spots = []\n if enemy_piece.game.black_player_id == enemy_piece.player_id\n pawn_test_spots = [[enemy_piece.y_position - 1,enemy_piece.x_position - 1],[enemy_piece.y_position - 1,enemy_piece.x_position + 1]]\n\n elsif enemy_piece.game.white_player_id == enemy_piece.player_id\n pawn_test_spots = [[enemy_piece.y_position + 1,enemy_piece.x_position - 1],[enemy_piece.y_position + 1,enemy_piece.x_position + 1]]\n end\n king_moves -= pawn_test_spots\n next\n end\n king_moves -= enemy_piece.piece_can_move_to(board)\n end\n return king_moves\n end\n\n return [] if attacking_pieces.length > 1 # can't defend from two attacking pieces unless king is moved\n\n current_piece = self\n current_piece_moves_avail = current_piece.piece_can_move_to(board)\n enemy_piece = attacking_pieces[0] # since only one piece is attacking, we should rename this\n current_piece_moves_avail = current_piece_moves_avail & (enemy_piece.piece_can_move_to(board) + [[enemy_piece.y_position,enemy_piece.x_position]])# finding the squares these pieces can both move to\n\n prevent_check_moves = []\n\n current_piece_moves_avail.each do |square|\n y = square[0]\n x = square[1]\n play_board = Marshal.load(Marshal.dump(board))\n play_board[self.y_position][self.x_position] = 0\n play_board[y][x] = self.player_id\n # enemy piece should have x,y such that board[y][x] should equal to enemy player.id\n if play_board[enemy_piece.y_position][enemy_piece.x_position] == self.player_id\n prevent_check_moves << square\n next\n end\n prevent_check_moves << square if !enemy_piece.piece_can_move_to(play_board).include?([king.y_position,king.x_position])\n end\n return prevent_check_moves\n\n end",
"def possible_moves(location)\n # something that returns legal_destinations, minus blocked paths\n # print \"legal dest are: #{legal_destinations(location)}\\n\"\n possible_moves = legal_destinations(location).select do |legal_move|\n # print \"current legal move is #{legal_move}\\n\"\n legal_move_obj = @board[legal_move]\n no_piece_in_the_way?(location, legal_move) &&\n (legal_move_obj == nil || legal_move_obj.color != self.color) &&\n legal_move.all? { |coord| coord >= 0 && coord <= 8 }\n end\n\n possible_moves\n end",
"def find_moves(start, stop)\n\tmoves = knight_moves(start, stop)\n\tputs \"You made it in #{moves.length - 1} moves! Here's you path:\"\n\tputs moves.inspect\nend",
"def valid_moves\n (slide_moves + jump_moves).select { |move| valid_move_seq?([move]) }\n end",
"def moves\n end",
"def valid_moves\n moves = []\n\n # go in all directions\n (-1..1).each do |_x_step|\n (-1..1).each do |_y_step|\n # start walking in that direction\n (1..7).each do |steps|\n x = x_coordinate + steps * x_direction\n y = y_coordinate + steps * y_direction\n\n # stop walking if you hit a wall\n break unless valid_move?(x, y)\n\n # remember the valid moves\n moves.push(Move.new(x, y))\n end\n end\n end\n moves\n end",
"def possible_knight_moves(start_arr)\n\t\tx = start_arr[0]\n\t\ty = start_arr[1]\n\t\tcandidates = []\n\t\tcandidates << [x+1,y+2]\n\t\tcandidates << [x+1,y-2]\n\t\tcandidates << [x-1,y+2]\n\t\tcandidates << [x-1,y-2]\n\t\tcandidates << [x+2,y+1]\n\t\tcandidates << [x+2,y-1]\n\t\tcandidates << [x-2,y+1]\n\t\tcandidates << [x-2,y+1]\n\t\tchildren = candidates.select { |pos| pos[0] >= 0 && pos[1] >= 0 && pos[0] <= 7 && pos[1] <= 7}\n\t\tchildren.delete_if do |child|\n\t\t\tif !(@board[child] == \"*\")\n\t\t\t\tif @board[child].color == @board[start_arr].color\n\t\t\t\t\ttrue\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tchildren\n\tend",
"def play\n @possible_moves.each do |move|\n new_board = @board | move\n if (@@position[new_board] || Tactics.new(new_board, @possible_moves).play) == LOSS then\n return @@position[@board] = WIN \n end\n end\n @@position[@board] = LOSS\n end",
"def possible_hero(king_loc, player, board)\r\n threat = offending_player(king_loc, player, board)[0]\r\n threat_loc = offending_player(king_loc, player, board)[1]\r\n attack_path = threat.calculate_path(threat_loc, king_loc)\r\n destroy_threat = []\r\n move_in_path = []\r\n board.each_with_index do |row, i|\r\n row.each_index do |j| \r\n piece = board[i][j]\r\n if !piece.nil? and piece.color == player and [i, j] != king_loc\r\n if piece.color == player\r\n destroy_threat << [i, j] if piece.valid_move([i,j], threat_loc, board)\r\n end\r\n attack_path.each do |block|\r\n if board[block[0]][block[1]].nil? \r\n move_in_path << [[i, j], block] if piece.valid_move([i,j], block, board)\r\n else\r\n move_in_path << [[i, j], block] if piece.valid_move([i,j], block, board) && board[block[0]][block[1]].color != player\r\n end\r\n end\r\n end \r\n end\r\n end \r\n possible_boards = []\r\n destroy_threat.each do |hero|\r\n possible_boards << temporary_board(hero, threat_loc)\r\n end\r\n move_in_path.each do |hero|\r\n possible_boards << temporary_board(hero[0], hero[1]) \r\n end\r\n checks = []\r\n possible_boards.each do |test_board|\r\n checks << in_check(player, test_board)\r\n end \r\n return true if checks.include? false\r\n return false\r\n end",
"def perfect_move(marker, index)\r\n\t\tif board[index] == perfect_move\r\n\t\t\tboard[index] = marker\r\n\tend\r\n\r\n\t#final moves in order to win\r\n\tdef 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\r\n\r\n\t#blocks an opponent from making the winning move\r\n\tdef block(human, marker, index)\r\n\t\tif human[marker] == win\r\n\t\t\tboard[index] = perfect_move\r\n\t\t\ttrue\r\n\t\telse\r\n\t\t\tfalse\r\n\t\tend\r\n\tend\r\n\r\n\tdef fork()\r\n\tend\r\n\r\n\tdef fork_block()\r\n\tend\r\n\r\n\tdef opposite_corner()\r\n\tend\r\n\r\n\tdef empty_corner()\r\n\tend\r\n\r\n\tdef empty_side()\r\n\tend\r\n\r\nend",
"def get_poss_moves\n x = @location[0] #x is row\n y = @location[1] #y is column\n\n move_list = [] #quarter circle forward punch\n\n if @colour == \"white\"\n move_list = white_pawn_moves(x,y)\n else\n move_list = black_pawn_moves(x,y)\n end\n\n possible_moves = move_list.select { |e|\n (e[0] >= 0) && (e[0] <= 7) && (e[1] >= 0) && (e[1] <= 7)\n }\n possible_moves\n end",
"def gen_king_moves white\n\t\tmoves = []\n\t\tkings = @bitboards[white ? WKING : BKING]\n\t\tbits_to_positions(kings).each do |king|\n\t\t\tmoves += gen_rook_type_moves( white, king, 1)\n\t\t\tmoves += gen_bishop_type_moves( white, king, 1)\n\t\t\tmoves += gen_castle_moves( white, king)\n\t\tend\n\t\tmoves\n\tend",
"def get_moves_2(piece, board)\n valid_col = case piece.name\n when ?A then 3\n when ?B then 5\n when ?C then 7\n when ?D then 9\n else 11\n end\n moves = []\n\n # If in hallway\n if piece.row == 1\n cols = valid_col < piece.col ? (valid_col...piece.col).to_a : (piece.col+1..valid_col).to_a\n if cols.count{|c| board[[1, c]] == ?.} == cols.length\n if board[[2, valid_col]] == ?. && board[[3, valid_col]] == piece.name && board[[4, valid_col]] == piece.name && board[[5, valid_col]] == piece.name\n moves << [[2, valid_col], (cols.count + 1) * piece.cost]\n elsif board[[2, valid_col]] == ?. && board[[3, valid_col]] == ?. && board[[4, valid_col]] == piece.name && board[[5, valid_col]] == piece.name\n moves << [[3, valid_col], (cols.count + 2) * piece.cost]\n elsif board[[2, valid_col]] == ?. && board[[3, valid_col]] == ?. && board[[4, valid_col]] == ?. && board[[5, valid_col]] == piece.name\n moves << [[4, valid_col], (cols.count + 3) * piece.cost]\n elsif board[[2, valid_col]] == ?. && board[[3, valid_col]] == ?. && board[[4, valid_col]] == ?. && board[[5, valid_col]] == ?.\n moves << [[5, valid_col], (cols.count + 4) * piece.cost]\n end\n end\n # If right column and something is underneath and nothing above\n # If in wrong column completely and nothing above\n elsif piece.row >= 2\n below = (piece.row+1..5).to_a\n above = (2..piece.row-1).to_a\n if ((piece.col == valid_col && below.count{|c| board[[c, piece.col]] != piece.name} != 0 && below.length != 0) || (piece.col != valid_col)) && (above.count{|c| board[[c, piece.col]] == ?.} == above.length)\n 2.times do |t|\n dir = t == 0 ? -1 : 1\n curr = piece.col\n steps = 1 + above.length\n while board[[1, curr]] == ?.\n moves << [[1, curr], steps * piece.cost] if ![3, 5, 7, 9].include?(curr)\n steps += 1\n curr += dir\n end\n end\n end\n end\n moves\nend",
"def possible_moves(spaces)\n possible_moves = []\n if ((@position + 1) % 8 == 0)\n @moves = [8,7,-1,-9,-8]\n elsif (@position % 8 == 0)\n @moves = [-8,-7,1,9,8]\n end\n @moves.each do |move|\n possible_moves << (@position + move)\n end\n possible_moves.select! { |move| (0..63).include?(move) }\n possible_moves.select! do |move| \n spaces[move].class == Fixnum or spaces[move].side_id != @side_id ? true : false\n end\n possible_moves\n end",
"def get_moves\n [\n { row: @row + 1, col: @col + 2 },\n { row: @row + 1, col: @col - 2 },\n { row: @row + 2, col: @col + 1 },\n { row: @row + 2, col: @col - 1 },\n { row: @row - 1, col: @col + 2 },\n { row: @row - 1, col: @col - 2 },\n { row: @row - 2, col: @col + 1 },\n { row: @row - 2, col: @col - 1 }\n ].select do |move|\n [:blank_space, :enemy_piece].include? describe_location(move[:row], move[:col])\n end\n end",
"def moves\n\n end",
"def choose_move\n choose_move_when_in_check\n #update to be player specific\n choose_piece_to_move\n which_piece_selected\n choose_where_to_move\n end",
"def get_possible_moves\n moves = \n\t @@offsets.collect do |move| \n\t row = @position[:row] + move[0]\n\t col = @position[:col] + move[1]\n\t\t[row, col] if row.between?(0, 7) && col.between?(0, 7)\n\t end\n\tmoves.compact\n end",
"def moves\n forward_steps + side_attacks\n end",
"def player_moves(board)\n\t\tnew_hash_o = {} # Holds the winning combination positions the other player is occupying\n\t\tnew_hash_c = {} # Holds the winning combination positions the current player is occupying\n\t\tfinal_hash_o = {} # Holds the other player winning combination that need to be blocked on the next move\n\t\tfinal_hash_c = {} # Holds the move to be made for the current player winning combination\n\t\tWIN_COMBINATIONS.each do |k,v| # Check which of the other player's and current player's positions are part of a winning combination\n\t\t new_hash_o[k] = []\n\t\t new_hash_c[k] = []\n\t\t @other_player_positions.each do |t| # Check which of the other player's positions are part of a winning combination\n\t\t\t if v.include?(t)\n\t\t\t \tnew_hash_o[k] << t # If the position is part of a winning combination include it in the new hash\n\t\t \tend\n\t\t end\n\t\t @current_player_positions.each do |t| # Check which of the current player's positions are part of a winning combination\n\t\t\t if v.include?(t)\n\t\t\t \tnew_hash_c[k] << t # If the position is part of a winning combination include it in the new hash\n\t\t \tend\n\t\t end\n\t\tend\n\t\t@other_player_positions = [] # Clear the other player position results ready for the next turn\n\t\t@current_player_positions = [] # Clear the current player position results ready for the next turn\n\t\tnew_hash_o.each do |k,v| # Check whether the other player has one move to go on a winning combination\n\t\t\t# If there are two positions of a winning combination held by the other player include the combination in the final hash\n\t\t\tif new_hash_o[k].size > 1\n\t\t\t\tfinal_hash_o[k] = new_hash_o[k] # Final hash holds the vulnerable positions that need to be filled\n\t\t\tend\n\t\tend\n\t\tnew_hash_c.each do |k,v| # Check whether the current player has one move to go on a winning combination\n\t\t\t# If there are two positions of a winning combination held by the current player include the combination in the final hash\n\t\t\tif new_hash_c[k].size > 1\n\t\t\t\tfinal_hash_c[k] = new_hash_c[k] # Final hash holds the winning positions that need to be filled\n\t\t\tend\n\t\tend\n\t\t# Find the final position to move to block the other player's winning combination\n\t\t # Find the final position for current player to move to win\n\t\tWIN_COMBINATIONS.each do |k,v|\n\t\t\tif final_hash_o.include?(k)\n\t\t\t\t@move_o << WIN_COMBINATIONS[k] - final_hash_o[k]\n\t\t\t\tif !board.valid_move?(@move_o[0][0]) # Check whether the final position is a valid move\n\t\t\t\t\t@move_o.shift # If not a valid position remove the final move\n\t\t\t\tend\n\t\t\tend\n\t\t\tif final_hash_c.include?(k)\n\t\t\t\t@move_c << WIN_COMBINATIONS[k] - final_hash_c[k]\n\t\t\t\tif !board.valid_move?(@move_c[0][0]) # Check whether the final position is a valid move\n\t\t\t\t\t@move_c.shift # If not a valid position remove the final move from the array\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tif !@move_o.empty? # Don't test and pass an empty array\n\t\t\t\t@move_o = @move_o.sample # Only one move can be made\n\t\t\t\t@move_o # Final move to block the other player's winning combination\n\t\tend\n\t\tif !@move_c.empty? # Don't test and pass an empty array\n\t\t\t\t@move_c = @move_c.sample # Only one move can be made\n\t\t\t\t@move_c # Final move to block the other player's winning combination\n\t\tend\n\tend",
"def moves\n if color == :black\n find_moves(MOVES[:black_moves]) +\n find_attacks(MOVES[:black_attacks])\n else\n find_moves(MOVES[:white_moves]) +\n find_attacks(MOVES[:white_attacks])\n end\n end",
"def choose_move(board)\n\t\tpossible_moves = get_open_spaces(board)\n if @loud\n puts \"As a smart player, I will look at all available spaces: #{possible_moves.inspect}\"\n end\n\n\t\tmy_boards = possible_moves.map { |move| TTTGame.place(move.x, move.y, @mark, board) } # Every board that exists after I move.\n\t\ttheir_boards = possible_moves.map { |move| TTTGame.place(move.x, move.y, @opp_mark, board) } # Every board that would exist if my opponent moved next.\n\n if @loud\n puts 'Then, since I know all of our possible moves, I can generate the future boards for myself and my opponent, after this turn.'\n puts 'Check all of the boards that could exist after I move to see if I can win.'\n end\n\n\t\tmy_boards.each_with_index do |b, bi|\n\t\t\tif TTTGame.won?(b)\n if @loud\n puts \"I can win by moving to #{possible_moves[bi].to_s}\"\n end\n\t\t\t\treturn possible_moves[bi]\n\t\t\tend\n\t\tend\n\n if @loud\n puts 'Check all of the boards that could exist if my opponent moved to see if I can prevent him winning.'\n end\n\n\t\ttheir_boards.each_with_index do |b, bi|\n\t\t\tif TTTGame.won?(b)\n if @loud\n puts \"I can prevent #{@opp_mark} from winning by moving to #{possible_moves[bi].to_s}\"\n end\n\t\t\t\treturn possible_moves[bi]\n\t\t\tend\n\t\tend\n\n if @loud\n puts 'There are no win conditions for either player, so we choose a space from the open ones.'\n end\n\n center_space = Coordinate.new(1, 1)\n\n if possible_moves.include?(center_space)\n if @loud\n puts 'The center space is available and is generally optimal to choose! I take it.'\n end\n return center_space\n end\n\n chosen_space = rand(possible_moves.length)\n if @loud\n puts \"The center space is taken, so we just pick another space randomly: #{possible_moves[chosen_space]}.\"\n end\n\t\tpossible_moves[chosen_space]\n\tend",
"def valid_move?(move)\n # Array of all posiible moves , check the board and map out the possible moves from there.\n end",
"def possible_moves\n moves_hash = { slides: Set.new, jumps: Set.new }\n\n possible_slides.each { |move| moves_hash[:slides] << move }\n possible_jumps.each { |move| moves_hash[:jumps] << move }\n\n moves_hash\n end",
"def perfect_move(marker, index)\n\t\tif board[index] == perfect_move\n\t\t\tboard[index] = marker\n\tend\n\n\t#final moves in order to win\n\tdef 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\n\n\t#blocks an opponent from making the winning move\n\tdef block(human, marker, index)\n\t\tif human[marker] == win\n\t\t\tboard[index] = perfect_move\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend\n\n\tdef fork()\n\tend\n\n\tdef fork_block()\n\tend\n\n\tdef opposite_corner()\n\tend\n\n\tdef empty_corner()\n\tend\n\n\tdef empty_side()\n\tend\n\nend",
"def knights_moves(start, finish)\n board = create_board\n\n path = []\n queue = []\n\n queue << start\n\n loop do\n \tcurrent_node = board[queue[0][0]][queue[0][1]]\n\n current_node.moves.each do |node|\n unless node == start || board[node[0]][node[1]].parent != nil\n board[node[0]][node[1]].parent = queue[0] \n queue << node\n end\t\n end\n\n if queue.include? finish\n\n parent = board[finish[0]][finish[1]].parent\n path << parent\n\n loop do\n \tparent = board[parent[0]][parent[1]].parent\n \tbreak if parent == nil\n \tpath.unshift(parent)\n end\n\n path << finish\n break\n end\n\n \tqueue.shift\n end\n puts \"You can make it in #{path.length-1} steps!\"\n path\nend",
"def moves\n poss_moves = []\n determine_moves.each do |diff| #array of directions\n poss_moves += grow_unblocked_moves_in_dir(diff[0],diff[1])\n end\n poss_moves\n end",
"def moves\n possible_moves = []\n\n self.move_dirs.each do |dir|\n num_steps = 1\n blocked = false\n\n until blocked\n next_step = [dir[0]*num_steps, dir[1]*num_steps]\n next_pos = [self.pos[0] + next_step[0], self.pos[1] + next_step[1]]\n\n break unless next_pos.all? { |i| i.between?(0,7) }\n\n if self.board[next_pos]\n blocked = true\n possible_moves << next_pos unless self.color == self.board[next_pos].color\n else\n possible_moves << next_pos\n num_steps += 1\n end\n end\n end\n\n possible_moves\n end",
"def gen_rook_moves(color, piece=:rook)\n moves = []\n if color == :white\n position = @position.white \n comrades = @position.white_pieces\n enemy = @position.black_pieces\n else\n position = @position.black\n comrades = @position.black_pieces\n enemy = @position.white_pieces\n end\n\n # no work to do when there are no pieces\n return moves if position[piece].nil?\n \n # for each piece\n position[piece].set_bits.each do |from| \n # [i,j] = current position\n i = from / 8\n j = from % 8\n\n #dirs flags which directions the piece is blocked\n dirs = 0\n for k in 1..7\n break if dirs == 0xf\n \n # try moving north\n if (dirs & 0x1) != 0x1\n to = from+k*8\n if i+k>7 || comrades.set?(to)\n # no further north moves possible\n dirs = dirs | 0x1\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further north moves possible\n dirs = dirs | 0x1 if enemy.set?(to) \n end\n end\n \n # try moving south\n if (dirs & 0x2) != 0x2\n to = from-k*8\n if i<k || comrades.set?(to)\n # no further south moves possible\n dirs = dirs | 0x2\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further north moves possible\n dirs = dirs | 0x2 if enemy.set?(to) \n end\n end\n \n # try moving east\n if (dirs & 0x4) != 0x4\n to = from+k\n if j+k>7 || comrades.set?(to)\n # no further east moves possible\n dirs = dirs | 0x4\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further east moves possible\n dirs = dirs | 0x4 if enemy.set?(to) \n end\n end\n \n # try moving west\n if (dirs & 0x8) != 0x8\n to = from-k\n if j-k<0 || comrades.set?(to)\n # no further east moves possible\n dirs = dirs | 0x8\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further west moves possible\n dirs = dirs | 0x8 if enemy.set?(to) \n end\n end \n end\n end \n moves\n end",
"def permissible(start, stop, piece, player)\r\n $board[start[0]][start[1]].nil? ? start_color = nil : start_color = $board[start[0]][start[1]].color\r\n $board[stop[0]][stop[1]].nil? ? stop_color = nil : stop_color = $board[stop[0]][stop[1]].color \r\n # Ensures player moving own piece\r\n if start_color != player\r\n puts \"Invalid selection!\"; return false\r\n end\r\n temp_board = temporary_board(start, stop)\r\n check = in_check(player, temp_board)\r\n # Ensures King not currently in check, or move places King in check\r\n if check == true\r\n puts ''\r\n puts \"Invalid move. King in check.\" ; return false \r\n end\r\n # Ensures player doesn't capture own piece\r\n if stop_color == player\r\n puts ''\r\n puts \"You cannot capture your own piece!\"; return false\r\n end\r\n # Permits en passant\r\n if piece.class == Pawn && $board[@prev_coord[0]][@prev_coord[1]].class == Pawn\r\n if @prev_delta_y == 2 && @prev_coord[1] == start[1] && @prev_coord[0] == stop[0] \r\n if (player == 'white' && stop[1] == @prev_coord[1] + 1) or (player == 'black' && stop[1] == @prev_coord[1] -1 )\r\n print \"En passant\"\r\n $board[@prev_coord[0]][@prev_coord[1]] = nil\r\n return true\r\n end\r\n end\r\n end\r\n #King hasn't moved yet, rook hasn't moved yet\r\n if piece.class == King and start[1] == stop[1] and (start[0] - stop[0]).abs == 2 and piece.turn == 0 #first rank King,king hasn't moved, \r\n if castle_valid(start, stop, piece, player)\r\n print \"Castling...\"\r\n return true\r\n end\r\n end\r\n # Ensures move is a valid combination for piece type\r\n if piece.valid_move(start, stop, $board) == false\r\n puts ''\r\n puts \"Invalid move!\" ; return false\r\n end\r\n return true\r\n end",
"def moves\n state.moves_taken\n end",
"def potential_diagonal_moves is_king=false\n moves = []\n\n # Possible moves\n # - all possible combination of increment/decrement of r_idx/c_idx\n\n r_min = is_king ? (r_idx - 1 >= 0 ? r_idx - 1 : r_idx) : 0\n c_min = is_king ? (c_idx - 1 >= 0 ? c_idx - 1 : c_idx) : 0\n r_max = is_king ? (r_idx + 1 <= 7 ? r_idx + 1 : r_idx) : Board::WIDTH - 1\n c_max = is_king ? (c_idx + 1 <= 7 ? c_idx + 1 : c_idx) : Board::WIDTH - 1\n\n # top-right: row-decrement, column-increment [4, 5] [3, 6]\n r = r_idx - 1\n c = c_idx + 1\n while (r >= r_min) && (c <= c_max)\n moves << [r, c]\n r -= 1\n c += 1\n end\n\n # bottom-right: row-increment, column-increment [4, 5] [5, 6]\n r = r_idx + 1\n c = c_idx + 1\n while (r <= r_max) && (c <= c_max)\n moves << [r, c]\n r += 1\n c += 1\n end\n\n # bottom-left: row-increment, column-decrement [4, 5] [5, 4]\n r = r_idx + 1\n c = c_idx - 1\n while (r <= r_max) && (c >= c_min)\n moves << [r, c]\n r += 1\n c -= 1\n end\n\n # top-left: row-decrement, column-decrement [4, 5] [3, 4]\n r = r_idx - 1\n c = c_idx - 1\n while (r >= r_min) && (c >= c_min)\n moves << [r, c]\n r -= 1\n c -= 1\n end\n\n # TODO\n # - refactor to avoid repeated pattern of code without compromising with runtime\n\n moves\n end",
"def Knight_long_path(position, target)\n possible_moves = []\n moves = ['move_down', 'move_up', 'move_right', 'move_left']\n chessercise = Chessercise.new\n for i in moves do\n for j in moves do\n now = getposition(position)\n if i != j\n if @directions_flag[i.to_sym] != @directions_flag[j.to_sym]\n if chessercise.send(i.to_sym, now) != nil\n mv_now = chessercise.send(i.to_sym, now)\n now = getposition(mv_now)\n if chessercise.send(j.to_sym, now) != nil\n mv_now = chessercise.send(j.to_sym, now)\n now = getposition(mv_now)\n if chessercise.send(j.to_sym, now) != nil\n mv_now = chessercise.send(j.to_sym, now)\n possible_moves.push(mv_now)\n end\n end\n end\n end\n end\n end\n end\n return possible_moves\n # print Knight_long_path('d2')\n end",
"def allowed_moves(from_cell, chessboard)\n map_chess_move_array(from_cell, allowed_cells(from_cell, chessboard))\n end",
"def valid_moves(from)\n piece = @board.at(from)\n if piece.king? || piece.knight?\n piece.moves.map do |move|\n to = relative_coords(from, move)\n to if possible_move?(to)\n end.compact\n elsif piece.pawn?\n pawn_valid_moves(from)\n else\n valid_moves_recursive(from)\n end\n end",
"def available_moves(from_cell, chessboard)\n map_chess_move_array(from_cell, available_cells(from_cell, chessboard))\n end",
"def valid_moves(from)\r\n\tpossible_moves(from).select { |move| valid_position?(move) }\r\nend",
"def moves\n directions = MOVE_DIRECTIONS[self.piece_type]\n directions.map do |(dx, dy)|\n x, y = self.position\n [x + dx, y + dy]\n end.select { |coord| on_board?(coord) && not_blocked?(coord) }\n\n # cond = board[[coord]].nil? || board[[coord]].color != self.color\n # opp_cond = !(board[coord].color == self.color)\n # coord = [2,4]\n # [[2,3], nil, [3,4]]\n #(self.board[coord].color != self.color)\n end",
"def move_piece(move)\n curr_piece = @board[move[0]]\n if curr_piece.non_check_moves.include?(move[1])\n #if en passant, remove captured piece\n if curr_piece.class == Pawn\n #puts curr_piece.can_en_passant?\n #puts \"HELKFDSJLFKD\"\n if curr_piece.can_en_passant?\n #puts \"HOMFDMSKFDFLSJFKDSLFJSDKLF JDSFKLSJFKLEJ FE FJSKLF\"\n rank = move[0][0]\n col = move[1][1]\n captured_pawn_pos = [rank,col]\n #puts captured_pawn_pos.inspect\n @board[captured_pawn_pos] = nil\n end\n end\n @board[move[1]] = curr_piece\n @board[move[0]] = nil\n curr_piece.move_history << move\n curr_piece.pos = move[1]\n #if castling, move rook too\n if curr_piece.class == King && (move[0][1] - move[1][1]).abs == 2\n #find the appropriate rook to move\n start_rank = move[0][0]\n start_file = move[1][1] == 2 ? 0 : 7\n start_pos = [start_rank, start_file]\n rook = @board[start_pos]\n #determine its final location, then move it.\n end_file = start_file == 0 ? 3 : 5\n end_pos = [start_rank, end_file]\n @board[end_pos] = rook\n @board[start_pos] = nil\n rook.move_history << end_pos\n rook.pos = end_pos\n end\n return true\n else\n puts \"Your king is still in check!\" if @board.in_check?(curr_piece.color)\n puts \"Not a legal move for this #{curr_piece.color} #{curr_piece.class}!\"\n puts\n return false\n end\n end",
"def perform_move(move)\n start_location = move[0]\n destination = move[1]\n i,j = start_location\n a,b = destination\n jumped = false\n #unless on_board?(destination)\n #raise error\n\n piece = @rows[i][j]\n all_possible_moves = piece.slide_moves(@rows) + piece.jump_moves(@rows)\n\n unless !all_possible_moves.include?(destination)#change to throw error\n\n jump = piece.jump_moves(@rows)\n if jump.include?(destination)\n jumped = true\n #removes jumped piece from board\n add = (piece.color == :white ? -1 : 1)\n if destination[1] > start_location[1]\n middle_b = destination[1] - 1\n middle_a = destination[0] + add\n delete_piece = @rows[middle_a][middle_b]\n delete_piece.location = nil\n @rows[middle_a][middle_b] = nil\n else\n middle_b = destination[1] + 1\n middle_a = destination[0] + add\n delete_piece = @rows[middle_a][middle_b]\n delete_piece.location = nil\n @rows[middle_a][middle_b] = nil\n end\n end\n\n @rows[i][j] = nil\n piece.location = [a,b]\n @rows[a][b] = piece\n end\n #checks if moved piece should be kinged, if so sets king to true\n piece.make_king\n if jumped\n #go_again unless (@rows[a][b]).jump_moves(@rows).nil?\n end\n end",
"def possible_moves\n\t\[email protected]_index { |piece, idx| piece == \"-\" ? idx : nil }.compact\n\tend",
"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 possible_pawn_moves(start_arr)\n\t\tx = start_arr[1]\n\t\ty = start_arr[0]\n\t\tcandidates = []\n\t\tcandidates << [y+1, x]\n\t\t# If pawn has not moved before, it can take a double step straight forward.\n\t\tif y == 1\n\t\t\tcandidates << [y+2, x]\n\t\tend\n\t\tchoices = []\n\t\t# Not a candidate if player's own pieces in the way\n\t\tcandidates.delete_if do |pos|\n\t\t\tif !(@board[pos] == \"*\") && (@board[pos].color == @board[start_arr].color)\n\t\t\t\ttrue\n\t\t\tend\n\t\tend\n\t\t# Can only move up 2 pieces if no pieces in the way.\n\t\tif (candidates.include? [y+2, x]) && !(candidates.include? [y+1,x])\n\t\t\tcandidates = []\n\t\tend\n\t\t# Make sure possible move is on the board\n\t\tchildren = candidates.select { |pos| pos[0] >= 0 && pos[1] >= 0 && pos[0] <= 7 && pos[1] <= 7}\n\tend",
"def under_check\r\n # Define permitted moves for the king, when under check.\r\n end",
"def moves; [] end",
"def test_knights_repeat_moving_should_stalemate\n e = RulesEngine.new\n place_pieces(e, \"\n K - - N - - - -\n - - - - - - - -\n - - - - - - - -\n - - - - - - - -\n - - - - - - - -\n - - - - - - - -\n - - - - - - - -\n k - - n - - - -\n \")\n\n e.move!(D1, B2);\n e.move!(D8, B7);\n e.move!(B2, D1);\n e.move!(B7, D8);\n\n e.move!(D1, B2);\n e.move!(D8, B7);\n e.move!(B2, D1);\n e.move!(B7, D8);\n\n e.move!(D1, B2);\n e.move!(D8, B7);\n e.move!(B2, D1);\n e.move!(B7, D8);\n\n assert(e.draw?(Colour::WHITE))\n assert(e.draw?(Colour::BLACK))\n end",
"def find_possible_moves(board)\n possibilities = []\n move_set.each do |move|\n rank = @location[0] + move[0]\n file = @location[1] + move[1]\n next unless valid_location?(rank, file)\n\n possibilities << [rank, file] unless board.data[rank][file]\n end\n possibilities\n end",
"def moves\n available_moves = []\n\n deltas.each do |delta|\n next_move = self.position.zip_sum(delta)\n break unless on_board?(next_move)\n break unless empty_square?(next_move)\n available_moves << next_move\n end\n\n available_moves + capture_moves\n end",
"def find_knight_moves graph, init_vertice\n found_path, moves = traverse_vertice(graph, init_vertice, [])\n return moves if found_path\n nil\nend",
"def available_moves(position = player.position, all: false)\n [\n Point.new(position.x - 1, position.y),\n Point.new(position.x, position.y - 1),\n Point.new(position.x + 1, position.y),\n Point.new(position.x, position.y + 1),\n ].select { |point| all || is_legit_move?(point) }\n end"
]
| [
"0.75381595",
"0.7486832",
"0.74303484",
"0.7376419",
"0.73356426",
"0.72956777",
"0.7270879",
"0.72465944",
"0.7216324",
"0.7215012",
"0.7179586",
"0.7146166",
"0.7139532",
"0.7114055",
"0.7110928",
"0.7104329",
"0.7094344",
"0.708093",
"0.7063682",
"0.70535696",
"0.7033753",
"0.70150214",
"0.70116323",
"0.6985759",
"0.6974809",
"0.69738805",
"0.6966769",
"0.6964212",
"0.6947087",
"0.6928396",
"0.69279486",
"0.6892144",
"0.68832487",
"0.68818945",
"0.68777",
"0.6874718",
"0.6870993",
"0.6866961",
"0.68348515",
"0.6834354",
"0.6827402",
"0.68264204",
"0.68159974",
"0.68151575",
"0.68033034",
"0.6802975",
"0.678464",
"0.67782134",
"0.67623144",
"0.6759863",
"0.674209",
"0.6741266",
"0.67360896",
"0.6736024",
"0.672264",
"0.67223597",
"0.67068774",
"0.6688158",
"0.66753817",
"0.66666335",
"0.66642267",
"0.6660162",
"0.665602",
"0.66454864",
"0.66447705",
"0.66442",
"0.6640612",
"0.66386044",
"0.66335106",
"0.66318893",
"0.66182655",
"0.6613062",
"0.66048783",
"0.66019195",
"0.6599278",
"0.6596906",
"0.6588507",
"0.65827096",
"0.6555808",
"0.65427816",
"0.65408474",
"0.653637",
"0.6527739",
"0.65100724",
"0.6500483",
"0.6497163",
"0.64838153",
"0.64784074",
"0.6476169",
"0.647574",
"0.64717674",
"0.64609736",
"0.64553714",
"0.6453785",
"0.6448387",
"0.64427054",
"0.6441564",
"0.6440129",
"0.6439399",
"0.64364547"
]
| 0.67855936 | 46 |
FIXME remove and use filter in views def conditions_for_collection [ '(workcamps.begin >= ?)', Date.new(2010,1,1) ] end | def email_all
wc = Incoming::Workcamp.find(params[:id])
addresses = wc.participants.map { |p| p.organization.email.to_s.strip }
redirect_to "mailto:#{addresses.join(',')}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n current_year = DateTime.now.year\n date_registration_opens = DateTime.new(current_year, 1, 1)\n date_registration_closes = DateTime.new(current_year+1, 1, 1)\n @camps = Camp.where(\"(start_date >= ? AND start_date < ?)\", date_registration_opens, date_registration_closes).all\n end",
"def buil_must_query_filter\n query_filter = [{ 'range' => date_range_filter }]\n query_filter | @raw_query\n end",
"def append_matter_date_cond(search,conditions_hash)\n\n \n search += \" AND created_at Between :start_date AND :end_date \" if params[:get_records] == \"My\"\n \n time = nil\n case params[:report][:duration]\n when \"1\" #1 months\n time = Time.zone.now.last_month\n when \"2\" #3 months\n 3.times do |i|\n unless time\n time = Time.zone.now.last_month\n else\n time = time.last_month\n end\n end\n when \"3\" #6 months\n 6.times do |i|\n unless time\n time = Time.zone.now.last_month\n else\n time = time.last_month\n end\n end\n else #date range given\n conditions_hash[:start_date] = params[:date_start].to_time\n conditions_hash[:end_date] = params[:date_end].to_time + (23.9*60*60)\n end\n if params[:report][:duration] != \"range\"\n conditions_hash[:start_date] = time\n conditions_hash[:end_date] = Time.zone.now\n end\n search\n end",
"def get_date_solr_query(p = {})\n times = get_times(p)\n registered_only?(p) ? '' : \"AND #{Last_Changed_Field}:[\\\"#{times[:first]}\\\" TO \\\"#{times[:last]}\\\"]\" # unless the user has asked for only registered items, apply the date range for published date\n end",
"def conditions_for_collection\n selector = case session[:travel_filter]\n when 'arrivals' then ['travels.arrival AND travels.date >= (?)', Date::today]\n when 'departures' then ['travels.arrival = ? AND travels.date >= (?)', false, Date::today]\n when 'all_dates' then TRUE\n when 'current' then ['travels.date >= (?)', Date::today]\n else ['travels.date >= (?)', Date::today] # This will include nil case where filter has not been set for session\n end\n return selector\n end",
"def set_filter_collection\n # @category_collection = Schedule::CATEGORY\n @applicant_collection = current_company.applicants.are_qualified.map{|applicant| [applicant.name, applicant.id, {\"data-job-id\": applicant.job_id}]}\n @job_collection = current_company.jobs.published_and_closed_jobs.map{|job| [job.title, job.id]}\n end",
"def published_conditions\r\n \"(#{table_name}.publish_at IS NULL OR #{table_name}.publish_at <= '#{Time.now.to_s(:db)}') AND (#{table_name}.unpublish_at IS NULL OR #{table_name}.unpublish_at > '#{Time.now.to_s(:db)}')\"\r\n end",
"def conditions; end",
"def conditions; end",
"def set_matters_revenue_conditions(conditions_hash)\n search = \"company_id = :company_id \"\n if params[:date_selected]\n conditions_hash[:start_date] = params[:date_start].to_time\n conditions_hash[:end_date] = params[:date_end].to_time + (23.9*60*60)\n end\n search += \" AND matter_type_id = :matter_type_id\" unless params[:report][:summarize_by].blank?\n search += \" AND created_at Between :date_start AND :date_end \" if params[:date_selected].eql?(\"1\")\n\n search\n end",
"def conditions\n [[]]\n end",
"def conditions\n @conditions\n end",
"def conditions\n @conditions\n end",
"def build_condition_for_date(start_date, end_date, start_date_string=\"created_at\", end_date_string=\"created_at\")\n\t\t\" #{start_date_string} >= '#{start_date.to_time}' and #{end_date_string} <= '#{end_date.to_time + 1.day}' \" if validate_date?(start_date,end_date)\n\tend",
"def restrict_date_range( objects )\n # set start_date to either passed param, or beginning of time\n start_date = params[:start_date].blank? ? Date.new(0) : Date.strptime(params[:start_date], \"%Y-%m-%d\")\n # set end_date to either passed param or now\n end_date = params[:end_date].blank? ? Date.today : Date.strptime(params[:end_date], \"%Y-%m-%d\")\n\n filtered = []\n objects.each do |obj|\n # apperantly things can have nil created_at\n if obj.created_at.blank?\n if params[:start_date].blank? && params[:end_date].blank?\n filtered += [obj]\n end\n elsif start_date <= obj.created_at.to_date && end_date >= obj.created_at.to_date\n filtered += [obj]\n end\n end\n return filtered\n end",
"def restrict_date_range( objects )\n # set start_date to either passed param, or beginning of time\n start_date = params[:start_date].blank? ? Date.new(0) : Date.strptime(params[:start_date], \"%Y-%m-%d\")\n # set end_date to either passed param or now\n end_date = params[:end_date].blank? ? Date.today : Date.strptime(params[:end_date], \"%Y-%m-%d\")\n\n filtered = []\n objects.each do |obj|\n # apperantly things can have nil created_at\n if obj.created_at.blank?\n if params[:start_date].blank? && params[:end_date].blank?\n filtered += [obj]\n end\n elsif start_date <= obj.created_at.to_date && end_date >= obj.created_at.to_date\n filtered += [obj]\n end\n end\n return filtered\n end",
"def restrict_date_range( objects )\n # set start_date to either passed param, or beginning of time\n start_date = params[:start_date].blank? ? Date.new(0) : Date.strptime(params[:start_date], \"%Y-%m-%d\")\n # set end_date to either passed param or now\n end_date = params[:end_date].blank? ? Date.today : Date.strptime(params[:end_date], \"%Y-%m-%d\")\n\n filtered = []\n objects.each do |obj|\n # apperantly things can have nil created_at\n if obj.created_at.blank?\n if params[:start_date].blank? && params[:end_date].blank?\n filtered += [obj]\n end\n elsif start_date <= obj.created_at.to_date && end_date >= obj.created_at.to_date\n filtered += [obj]\n end\n end\n return filtered\n end",
"def conditions\n @conditions ||= []\n end",
"def study_subjects_conditions\n\t\tunless q.blank?\n\t\t\tstudy_subjects = StudySubject.search(:q => q, :paginate => false)\n\t\t\tstudy_subject_ids = study_subjects.collect(&:id)\n\t\t\t['abstracts.study_subject_id IN (:study_subject_ids)', \n\t\t\t\t{ :study_subject_ids => study_subject_ids } ]\n\t\tend\n\tend",
"def filter_params\n params.permit(:date_lte, :date_gte, :time_lte, :time_gte, :month_details)\n end",
"def conditions\n @@conditions ||= []\n end",
"def conditions\n scope.conditions\n end",
"def conditions_for_collection\n if params[:id]\n ['(projects.user_id = (?) OR EXISTS (SELECT 1 FROM security_settings where security_settings.project_id = projects.id AND ' + \n 'security_settings.user_id = ? AND security_settings.level > 0))', current_user.id, current_user.id]\n else\n ['(projects.user_id = (?) OR EXISTS (SELECT 1 FROM security_settings where security_settings.project_id = projects.id AND ' + \n 'security_settings.user_id = ? AND security_settings.level > 0)) AND (projects.id = ?)', current_user.id, current_user.id, current_project_id]\n end\n end",
"def conditions_for_collection\n ['frms.usr_id = ?', [session[:usr_id]]]\n end",
"def conditions_clause\n cc = conditions.dup\n cc << filter_clause\n cc.compact.map{|c| @resource.send(:sanitize_sql_for_conditions, c)} * ' AND '\n end",
"def append_date_condition(search,r_name)\n if params[:date_selected]\n search += \" AND created_at Between :start_date AND :end_date \"\n r_name += \" created between #{params[:date_start]} - #{params[:date_end]}\"\n end\n [search,r_name]\n end",
"def list_conditions\n @list_conditions ||= FilterFoo.new\n end",
"def time_filter(selection)\n\t\t\tif self.method_defined? :gc_created_at\n\t\t\t\ttime_column = 'gc_created_at'\n\t\t\telsif self.method_defined? :source_created_at\n\t\t\t\ttime_column = 'source_created_at'\n\t\t\telse\n\t\t\t\ttime_column = 'created_at'\n\t\t\tend\n\t\t\t\n\t\t\tif selection.is_a?(Hash)\n\t\t\t\tif selection[:filter] == 'between'\n\t\t\t\t\tself.where(name_of_class + '.' + time_column + '>= ?', Time.parse(selection[:from]))\n\t\t\t\t\t\t.where(name_of_class + '.' + time_column + '<= ?', Time.parse(selection[:to]))\n\t\t\t\telse\n\t\t\t\t\tself.all\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tcase selection\n\t\t\t\twhen 'any'\n\t\t\t\t\tself.all\n\t\t\t\twhen 'today'\n\t\t\t\t\tself.where(name_of_class + '.' + time_column + '>= ?', Date.today)\n\t\t\t\twhen 'yesterday'\n\t\t\t\t\tself.where(name_of_class + '.' + time_column + '>= ?', Date.today - 1)\n\t\t\t\twhen 'this_week'\n\t\t\t\t\tself.where(name_of_class + '.' + time_column + '>= ?', Time.now.beginning_of_week)\n\t\t\t\twhen 'this_month'\n\t\t\t\t\tself.where(name_of_class + '.' + time_column + '>= ?', Time.now.beginning_of_month)\n\t\t\t\twhen 'last_month'\n\t\t\t\t\tself.where(name_of_class + '.' + time_column + '>= ?', Time.now.last_month.beginning_of_month)\n\t\t\t\t\t\t.where(name_of_class + '.' + time_column + '<= ?', Time.now.last_month.end_of_month)\n\t\t\t\twhen 'last_7_days'\n\t\t\t\t\tself.where(name_of_class + '.' + time_column + '>= ?', Date.today - 7)\n\t\t\t\twhen 'last_30_days'\n\t\t\t\t\tself.where(name_of_class + '.' + time_column + '>= ?', Date.today - 30)\n\t\t\t\telse\n\t\t\t\t\tself.all\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def conditions_for_collection\n ['grps.usr_id = ?', [session[:usr_id]]]\n end",
"def get_condition\n\t\toperator = self.get_operator\n\t\tformat_as = self.format_as\n\t\tarr = []\n\t\tif format_as == 'Month'\t\t\t\n\t\t\tif (self.comparison_operator == 5 && !self.predefined_range.nil?)\n\t\t\t\tget_predefined_conditions(arr)\n\t\t\telsif(self.comparison_operator == 5 && self.date_range == true)\n\t\t\t\tget_range_condition(arr)\n\t\t\telsif(self.comparison_operator == 5 && self.date_range == false)\n\t\t\t\tget_reference_condition(arr)\n\t\t\telse\n\t\t\t\tvalues = get_months_index(self.get_filter_values)\n\t\t\t\tarr << {\"fieldName\" => self.field_name, \"formatAs\" => format_as,\"dataType\" => \"string\",\n\t\t\t\t\t\t\"comparision\" => operator, \"value\" => values}\n\t\t\tend\n\t\telsif format_as == 'Month Year'\n\t\t\tif self.get_filter_values\n\t\t\t\tvals = []\n\t \t\t\tself.get_filter_values.each do |val|\n\t \t\t\t\tvalue = val.split(' ')\n\t \t\t\t\tvals << \"#{value[0]} \"+(\"%02d\" % Date::ABBR_MONTHNAMES.index(value[1]))\n\t \t\t\t\t# vals << \"#{value[0]} #{Date::ABBR_MONTHNAMES.index(value[1])}\"\t\t\t\t\n\t \t\t\tend\n \t\t\t\tvalues=vals\n \t\t\tend\n \t\t\tarr <<\n \t\t {\"fieldName\" => self.field_name, \"formatAs\" => format_as,\"dataType\" => \"string\",\n\t\t\t \"comparision\" => self.get_operator,\"value\" => (values || nil)}\t\n\t\telsif format_as == 'Quarter'\n \t\t\tarr <<\n \t\t {\"fieldName\" => self.field_name, \"formatAs\" => format_as,\"dataType\" => \"string\",\n\t\t\t \"comparision\" => self.get_operator,\"value\" => self.get_filter_values}\t\n\t\telse\n\t\t\tif (self.comparison_operator == 5 && !self.predefined_range.nil?)\n\t\t\t\tget_predefined_conditions(arr)\n\t\t\telsif(self.comparison_operator == 5 && self.date_range == true)\n\t\t\t\tget_range_condition(arr)\n\t\t\telsif(self.comparison_operator == 5 && self.date_range == false)\n\t\t\t\tget_reference_condition(arr)\n\t\t\telse\n\t\t\t\tvalues = self.field_values ? self.get_filter_values : nil\n\t\t\tarr << {\"fieldName\" => self.field_name, \"formatAs\" => format_as,\"dataType\" => \"string\",\n\t\t\t\"comparision\" => operator, \"value\" => values}\t\n\t\t\tend\n\t\tend\n\t\tarr\t\n\tend",
"def conditions_for_collection\n [\"activities.type IS NULL \"]\n end",
"def construct_range_conditions(constraint)\n if constraint.is_a?(Range)\n condition = [ \"(#{from_column_name} BETWEEN :begin AND :end) OR (:begin BETWEEN #{from_column_name} AND #{to_column_name})\",\n { :begin => constraint.begin, :end => constraint.end } ]\n elsif constraint\n condition = [ \"? BETWEEN #{from_column_name} AND #{to_column_name}\", constraint ]\n else\n condition = [ \"#{from_column_name} IS NULL AND #{to_column_name} IS NULL\"]\n end\n condition\n end",
"def date_range_scope\n Article.where('created_at BETWEEN ? AND ?', @date_from, @date_to)\n end",
"def get_criteria\n parameters = params[:analysis] ? params[:analysis] : params\n criteria = { name: parameters[:name] }\n criteria[:collection] = parameters[:collection] if parameters[:collection].present?\n if parameters[:date_from].present?\n criteria[:attribute] = :date\n criteria[:value] = date_from..date_to\n return criteria\n end\n [:size, :color, :fabric].each do |attr|\n if parameters[attr].present?\n criteria[:attribute] = \"pieces.#{attr}\"\n criteria[:value] = parameters[attr]\n return criteria\n end\n end\n criteria\n end",
"def unpublished_conditions\r\n \"(#{table_name}.publish_at IS NOT NULL AND #{table_name}.publish_at > '#{Time.now.to_s(:db)}') OR (#{table_name}.unpublish_at IS NOT NULL AND #{table_name}.unpublish_at < '#{Time.now.to_s(:db)}')\"\r\n end",
"def conditions_for_collection\n ['prsnas.usr_id = ?', [session[:usr_id]]]\n end",
"def conditions\n\t\t[conditions_clauses.join(' AND '), *conditions_options]\n\tend",
"def conditions\n\t\t[conditions_clauses.join(' AND '), *conditions_options]\n\tend",
"def build_from_params(params)\n super\n if params[:from].present? && params[:to].present?\n add_filter('date_in', '><', [params[:from], params[:to]])\n elsif params[:from].present?\n add_filter('date_in', '>=', [params[:from]])\n elsif params[:to].present?\n add_filter('date_in', '<=', [params[:to]])\n end\n self\n end",
"def index\n @customfieldconditions = Customfieldcondition.all\n end",
"def conditions\n return @conditions\n end",
"def conditions\n return @conditions\n end",
"def filter_events(collection=Conference)\n query = event_query(collection)\n query.apply_where\n end",
"def conditions\n [conditions_clauses.join(' AND '), *conditions_options]\nend",
"def attribute_condition(argument)\n case argument\n when nil then \"IS ?\"\n when Array, ActiveRecord::Associations::AssociationCollection then \"IN (?)\"\n when Range then \"BETWEEN ? AND ?\"\n else \"= ?\"\n end\n end",
"def attendance_between_dates_condition\n\t\t\"attendances.attendance_on BETWEEN '#{start_on}' AND '#{end_on}'\"\n\tend",
"def set_work_search_blog\n @event = Event.find(params[:id]) \n @event.date_range = @event.start.to_date.to_s + \" To \"+ (@event.end.to_date - 1.day).to_s \n end",
"def chain_with_datetime_query(collection, query)\n case query.method.to_s\n when 'between'\n method = if query.field == 'user_created_at'\n :user_signed_up_betw\n elsif query.field == 'interacted_at'\n :interacted_at_betw\n elsif query.field =~ /\\Adashboard:[0-9a-f]+\\Z/\n :dashboard_betw\n end\n\n collection.send(method,\n query,\n query.min_value.in_time_zone(query_set.time_zone),\n query.max_value.in_time_zone(query_set.time_zone)\n )\n when 'lesser_than', 'greater_than'\n beginning_of_that_days_ago = (\n Time.current.in_time_zone(query_set.time_zone) - (query.value.to_i).days\n ).beginning_of_day\n\n method = if query.field == 'user_created_at'\n query.method == 'greater_than' ? :user_signed_up_gt : :user_signed_up_lt\n elsif query.field == 'interacted_at'\n query.method == 'greater_than' ? :interacted_at_gt : :interacted_at_lt\n elsif query.field =~ /\\Adashboard:[0-9a-f]+\\Z/\n query.method == 'greater_than' ? :dashboard_gt : :dashboard_lt\n end\n\n collection.send(method, query, beginning_of_that_days_ago)\n end\n end",
"def available_criteria\n @available_criteria ||= Redmine::Helpers::TimeReport.get_available_criteria(project)\n end",
"def filterable_by_date_range(with_name = :created_at)\n @_filterable_by_date_range_field = with_name.to_s\n end",
"def assignedto_conditions \n #if category == 5 #KEW-PA 7 (search by : assignedto)\n #[\"assignedto_id=?\", assignedto] unless assignedto.blank? \n #else #KEW-PA 9 (search by : assignedto)\n #[assignedtodetails, assignedto,AssetDefect.all.map(&:asset_id)] unless assignedto.blank? \n #end\n [\"assignedto_id=?\", assignedto] unless assignedto.blank? #use this condition WITH FILTER FOR asset in ASSETDEFECT DB only - in show page.\n end",
"def get_conditions\n @conditions\n end",
"def conditions= conditions\n @conditions = conditions\n end",
"def booked_date_range\n { from: :start_date, to: :end_date }\n end",
"def build_conditions(conditions)\n conditions = [\"1=1\"] if conditions.blank?\n unless self.claim_id.blank?\n conditions[0] += \" and id = ?\"\n conditions << self.claim_id\n end\n unless self.organisation_id.blank?\n conditions[0] += \" and organisation_id = ?\"\n conditions << self.organisation_id\n end\n unless self.date_service_start.blank?\n conditions[0] += \" and date_service >= ?\"\n conditions << self.date_service_start\n end\n unless self.date_service_end.blank?\n conditions[0] += \" and date_service <= ?\"\n conditions << self.date_service_end\n end\n unless self.invoice_date_start.blank?\n conditions[0] += \" and invoice_date >= ?\"\n conditions << self.invoice_date_start\n end\n unless self.invoice_date_end.blank?\n conditions[0] += \" and invoice_date <= ?\"\n conditions << self.invoice_date_end\n end\n unless self.programme_id.blank?\n conditions[0] += \" and programme_id = ?\"\n conditions << self.programme_id\n end\n unless self.fee_schedule_id.blank?\n conditions[0] += \" and fee_schedule_id = ?\"\n conditions << self.fee_schedule_id\n end\n unless self.claim_status_id.blank?\n conditions[0] += \" and claim_status_id = ?\"\n conditions << self.claim_status_id\n end\n unless self.invoice_no.blank?\n conditions[0] += \" and invoice_no = ?\"\n conditions << self.invoice_no\n end\n if self.zero_value == 1 \n conditions[0] += \" and amount = 0\"\n end\n conditions\n end",
"def items_between(start_date, end_date, opts={})\n items do |obj|\n obj.restriction = { :and =>\n [\n {:is_greater_than_or_equal_to =>\n [\n {:field_uRI => {:field_uRI=>'item:DateTimeReceived'}},\n {:field_uRI_or_constant=>{:constant => {:value =>start_date}}}\n ]\n },\n {:is_less_than_or_equal_to =>\n [\n {:field_uRI => {:field_uRI=>'item:DateTimeReceived'}},\n {:field_uRI_or_constant=>{:constant => {:value =>end_date}}}\n ]\n }\n ]\n }\n end\n end",
"def conditions(extra_conditions = nil)\n time_qualifiers = qualifiers.select { |q| q.qualifiable_type == \"TimeRange\" }\n status_qualifiers = qualifiers.select { |q| q.qualifiable_type == \"Status\" }\n property_qualifiers = qualifiers.select { |q| q.qualifiable_type == \"PropertyValue\" }\n customer_qualifiers = qualifiers.select { |q| q.qualifiable_type == \"Customer\" }\n standard_qualifiers = (qualifiers - property_qualifiers - status_qualifiers -\n customer_qualifiers - time_qualifiers)\n\n res = conditions_for_standard_qualifiers(standard_qualifiers)\n res += conditions_for_property_qualifiers(property_qualifiers)\n res << conditions_for_status_qualifiers(status_qualifiers)\n res << conditions_for_customer_qualifiers(customer_qualifiers)\n res << conditions_for_time_qualifiers(time_qualifiers)\n res << conditions_for_keywords\n res << extra_conditions if extra_conditions\n res << user.user_tasks_sql\n res << unread_conditions(user) if unread_only?\n\n res = res.select { |c| !c.blank? }\n res = res.join(\" AND \")\n\n return res\n end",
"def __evolve_date__\n { \"$gte\" => min.__evolve_date__, \"$lte\" => max.__evolve_date__ }\n end",
"def filter_db\n \n start = params[:start]\n finish = params[:finish]\n search_field = params[:search_on][:field]\n sort_field = search_field == \"year_month\" ? \"pe_tenyear\" : search_field\n \n @db = Macroval.find(:all, :conditions => {\"#{search_field}\" => start..finish}, :limit => 24, :order => \"#{sort_field} ASC\")\n \n render :partial => 'macroval', :layout=>false \n end",
"def cur_calendars\n Article.find(:all, :conditions => ['issue_id = ? AND ((priority >= 50 AND priority < 55) OR (priority >= 70 AND priority < 75))', id], :order => 'priority')\n end",
"def add_range_to_jql str\n str << \" and created >= '#{@sprint_start_date}' and created <= '#{@sprint_end_date}'\"\n end",
"def conditions_for_collection\n return [ 'jobs.group_id IS NULL' ] if current_user.nil?\n return [] if current_user.has_role?(:admin)\n groups = current_user.groups\n if (groups.size > 0)\n return [ '(jobs.group_id IN (?) OR jobs.group_id IS NULL)', groups.map!{|g| g.is_a?(Group) ? g.id : g} ]\n else\n return [ 'jobs.group_id IS NULL' ]\n end\n end",
"def conditions_for_time_qualifiers(time_qualifiers)\n return if time_qualifiers.empty?\n\n res = []\n time_qualifiers.each do |tq|\n start_time = tq.qualifiable.start_time\n end_time = tq.qualifiable.end_time\n column = tq.qualifiable_column\n column = Task.connection.quote_column_name(column)\n\n sql = \"tasks.#{ column } >= '#{ start_time.to_formatted_s(:db) }'\"\n sql += \" and tasks.#{ column } < '#{ end_time.to_formatted_s(:db) }'\"\n res << sql\n end\n\n res = res.join(\" or \")\n return \"(#{ res })\"\n end",
"def index\n @events = Event.valid_dates\n @events = @events.after_startdate(params[:startdate]) if params[:startdate].present?\n @events = @events.before_enddate(params[:enddate]) if params[:enddate].present?\n end",
"def collection\n apply_scopes(super).order(:date).includes{[person, shift.shift_group, shift.county]}.uniq\n end",
"def criteria_builders\n [:list, :range, :timespan]\n end",
"def date_clause(table, field, from, to)\n s = []\n s << (\"#{table}.#{field} > '%s'\" % [connection.quoted_date((from - 1).to_time.end_of_day)]) if from\n s << (\"#{table}.#{field} <= '%s'\" % [connection.quoted_date(to.to_time.end_of_day)]) if to\n s.join(' AND ')\n end",
"def conditions\n @conditions + @condition_blocks\n end",
"def collection_search_params_logic\n base_logic = [:default_solr_parameters, :add_query_to_solr, :add_access_controls_to_solr_params]\n base_logic += [:add_collection_filter, :some_rows]\n base_logic\n end",
"def conditions\n [@clause, current_id, *@clause_args]\n end",
"def filtered_questions\n assigned_questions = Question.scoped\n assigned_questions = assigned_questions.where(:rotation => rotation) unless rotation == nil\n assigned_questions = assigned_questions.where(:year => year) unless year == nil\n return assigned_questions\n end",
"def append_time_expense_date_cond(search,r_name,conditions_hash)\r\n \r\n search += \"AND time_entry_date Between :start_date AND :end_date \"\r\n \r\n time = nil\r\n case params[:report][:duration]\r\n when \"1\" #1 week\r\n time = 7.days.ago\r\n when \"2\" #2 weeks\r\n time = 14.days.ago\r\n when \"3\" #1month\r\n time = Time.zone.now.last_month\r\n when \"4\" #3months\r\n 3.times do |i|\r\n unless time\r\n time = Time.zone.now.last_month\r\n else\r\n time = time.last_month\r\n end\r\n end\r\n when \"range\" #Date Range\r\n r_name += \" entered between #{params[:date_start]} - #{params[:date_end]}\"\r\n conditions_hash[:start_date] = params[:date_start].to_time\r\n conditions_hash[:end_date] = params[:date_end].to_time + (23.9*60*60)\r\n end\r\n if params[:report][:duration] != \"range\"\r\n conditions_hash[:start_date] = time\r\n conditions_hash[:end_date] = Time.zone.now\r\n end\r\n [search,r_name]\r\n end",
"def conditions_to_fields(conditions); end",
"def filter\n filter = \"\"\n\n filter = filter_by_user\n filter += filter_by_status\n filter += filter_by_milestones_projects_and_customers\n filter += filter_by_properties\n\n if session[:hide_deferred].to_i > 0\n filter << \"(tasks.hide_until IS NULL OR tasks.hide_until < '#{@tz.now.utc.to_s(:db)}') AND \"\n end \n filter << \"(tasks.milestone_id NOT IN (#{@completed_milestone_ids}) OR tasks.milestone_id IS NULL) AND \"\n\n filter = filter.gsub(/( AND )$/, \"\")\n return filter\n end",
"def ensure_filters\n min = JobTitle.order(:position).first.position\n max = JobTitle.order(:position).last.position\n self.filter_experience_min = min if filter_experience_min.nil?\n self.filter_experience_max = max if filter_experience_max.nil?\n self.target_experience_min = min if target_experience_min.nil?\n self.target_experience_max = max if target_experience_max.nil?\n end",
"def agg_where\n agg_filters = params.fetch(:agg_filters, {})\n if agg_filters.is_a?(String)\n agg_filters = JSON.parse(agg_filters)\n end\n where = Hash[agg_filters.map{|key, val|\n [key, val]\n }.reject{|x| x[1].empty? }.map{|x| [x[0], x[1].keys]}]\n\n [\"start_date\", \"completion_date\"].each do |key|\n if where.has_key?(key)\n unix_milliseconds_string = where[key].first # only doing one!\n year = Time.at(unix_milliseconds_string.to_i / 1000).year\n where[key] = {\n gte: \"#{year}||/y\",\n lte: \"#{year}||/y\",\n }\n end\n end\n where\n end",
"def init_contract_filters\n\t \n\t statusable = Category.statusable\n\t if statusable.length == 0\n\t @conditions << \"(true = false)\"\n\t else\n\t @conditions << \"(category_id in (#{Category.statusable.collect{|c|c.id}.join(',')}))\"\n end\n\tend",
"def criterion_list searchable_attr = {}, formats ={}, criteria = {}\n\n searchable_attr.each{|attr|\n criterion_key = attr_2_criterion_sym(attr)\n #operator_key = attr_2_operator(attr)\n if params[criterion_key] then\n if not params[criterion_key].blank? then\n if criterion_key.to_s.ends_with?('_date') || criterion_key.to_s.ends_with?('_at') then\n # This is a bit shakey: duck programming at its \"best\" providing you know ath all date attributes must end with \"_date\"\n #criteria[attr] = DateTime.strptime(params[criterion_key], ((formats[criterion_key].nil?)?t($DF + \"default\") : t(formats[criterion_key])))\n criteria[attr] = DateTime.strptime(params[criterion_key], ((formats[criterion_key].nil?)?$DATE_TRANSFER_FORMAT : t(formats[criterion_key])))\n else\n criteria[attr] =params[criterion_key]\n end\n #else\n \n \n end # not blank\n end \n }\n return criteria\n end",
"def load_filtered_ended_workshops\n # Default to the last week, by schedule\n end_date = params[:end] || Date.today\n start_date = params[:start] || end_date - 1.week\n query_by = params[:query_by] || QUERY_BY_SCHEDULE\n course = params[:course]\n\n workshops = Pd::Workshop.in_state(::Pd::Workshop::STATE_ENDED)\n unless current_user.permission?(UserPermission::WORKSHOP_ADMIN)\n workshops = workshops.organized_by current_user\n end\n\n # optional '-' (meaning not) followed by a course name\n if course && (match = /^(-)?(.+)$/.match course)\n course_name = COURSE_MAP[match[2]]\n workshops =\n if match[1]\n workshops.where.not(course: course_name)\n else\n workshops.where(course: course_name)\n end\n end\n\n workshops =\n if query_by == QUERY_BY_END\n workshops.end_on_or_after(start_date).end_on_or_before(end_date)\n else # assume by schedule\n workshops.scheduled_start_on_or_after(start_date).scheduled_start_on_or_before(end_date)\n end\n\n workshops\n end",
"def research_courses\n Course.find :all, :conditions => { :ts_year => year, :ts_quarter => quarter_code, :ts_research => true }\n end",
"def date_range_clause(table, field, from, to)\n s = []\n if from\n s << (\"#{table}.#{field} > '%s'\" % [connection.quoted_date((Date.yesterday + from).to_time.end_of_day)])\n end\n if to\n s << (\"#{table}.#{field} <= '%s'\" % [connection.quoted_date((Date.today + to).to_time.end_of_day)])\n end\n s.join(' AND ')\n end",
"def list_filters\n {\n track_end_date: 'TrkEndDate gt VALUE',\n track_first_submitted: 'TrkFirstSubmitted gt VALUE',\n app_no: 'AppNo eq VALUE',\n first_name: 'AppFirstName eq VALUE',\n last_name: 'AppLastName eq VALUE',\n email: 'AppEmailAddress eq VALUE'\n }\n end",
"def conditions\n return ['1=0'] if !valid?\n\n conds = []\n values = []\n for col in klass.columns do\n col_str = col_name(col)\n val = @attrs[encode_name(col)]\n if !val.blank?\n case col.type\n when :string, :text\n if val =~ /\\*$/\n conds << col_str + ' like ?'\n values << val.gsub(/\\*$/, '%')\n else\n conds << col_str + '=?'\n values << val\n end\n when :datetime\n case is_dbms?\n when Dbms::MYSQL\n# conds << col_str + @_operator.exp(encode_name(col))\n conds << sprintf(\"date(%s)\",\n col_str) +\n @_operator.exp(encode_name(col))\n else\n conds << sprintf(\"date(timezone('%s',%s))\",\n DEFAULT_TIMEZONE_FOR_TIMESTAMP_DATE_COMPARISON,\n col_str) +\n @_operator.exp(encode_name(col))\n end\n values << val.to_s\n when :boolean\n case is_dbms?\n when Dbms::MYSQL\n conds << col_str + @_operator.exp(encode_name(col))\n values << (val=='true')\n else\n conds << col_str + @_operator.exp(encode_name(col))\n values << val\n end\n else\n conds << col_str + @_operator.exp(encode_name(col))\n values << val\n end\n end\n end\n return [conds.join(' and ')] + values\n end",
"def index\n @events = Event.all\n if params[:filter] == \"Past\"\n @events = @events.where('start_time < ?', DateTime.now)\n elsif params[:filter] ==\"Future\"\n @events = @events.where('start_time > ?', DateTime.now)\n end\n @events = @events.order('created_at ASC').paginate(:page => params[:page], :per_page => 12)\n end",
"def couses_add_view_init\n @curr_year = params[:year]\n if params[:year].nil?\n @curr_year = Course.get_current_year\n else\n @curr_year =params[:year].to_i\n end\n\n @min_year = Course.minimum('start_year')\n if @min_year.nil?\n @min_year = Course.get_current_year\n else\n @min_year = @min_year.to_i\n end\n @min_year = Course.get_current_year if @min_year > Course.get_current_year\n\n\n @max_year = Course.maximum('start_year')\n if @max_year.nil?\n @max_year = Course.get_current_year\n else\n @max_year = @max_year.to_i\n end\n @max_year = Course.get_current_year if @max_year < Course.get_current_year\n @courses = Course.where(start_year: @curr_year)\n end",
"def full_set(special=nil)\n if special && special[:exclude]\n exclude_str = \" AND NOT (#{base_set_class.sql_for(special[:exclude])}) \"\n elsif new_record? || self[right_col_name] - self[left_col_name] == 1\n return [self]\n end\n base_set_class.find(:all, :conditions => \"#{scope_condition} #{exclude_str} AND (#{left_col_name} BETWEEN #{self[left_col_name]} AND #{self[right_col_name]})\", :order => left_col_name)\n end",
"def conditions=(value)\n @conditions = value\n end",
"def conditions=(value)\n @conditions = value\n end",
"def filter_publications(collection=Publication)\n query = publication_query(collection)\n query.apply_where\n end",
"def index\n # @campus_recuritments = CampusRecuritment.all\n @campus_recuritments = CampusRecuritment.where(:Authorized => true).where(\"DATE(deadline) > DATE(?)\", Time.now).order(created_at: :desc)\n end",
"def where_clause\n '(DATE(checkin_at) >= :init_date AND DATE(checkout_at) >= :init_date)\n AND (DATE(checkin_at) <= :end_date AND DATE(checkout_at) <= :end_date)'\n end",
"def show_date_condition\n false\n end",
"def to_conditions(params={})\n # Create an object to store named parameter conditions\n conditioner = OpenStruct.new\n conditioner.or = []\n conditioner.and = []\n conditioner.parameters = {}\n \n if @start_date && @end_date\n conditioner.and << \" CAST(start_date AS DATE) >= :start_date AND CAST(start_date AS DATE) <= :end_date\"\n conditioner.parameters[:start_date] = @start_date.to_s(:db)\n conditioner.parameters[:end_date] = @end_date.to_s(:db)\n end\n statement = conditioner.or.join(' OR ')\n statement += \" AND \" if !conditioner.or.empty? and !conditioner.and.empty?\n statement += conditioner.and.join(' AND ')\n return [statement, conditioner.parameters]\n end",
"def prepare_orm_filters\n filters = [[]]\n date_format = I18n.t(:\"date.formats.default\", {:locale => I18n.locale })\n self.data_grid.columns.each_with_index do |col, col_index|\n if col.filter and !col.filter_value.blank?\n case col.filter\n when :boolean\n filters[0] << \"#{col.filter_by} = ?\"\n filters << (col.filter_value == '1') ? true : false\n when :auto\n filters[0] << \"#{col.filter_by} = ?\"\n filters << col.filter_value\n when :text\n filters[0] << \"#{col.filter_by} #{ActiveRecord::Base.connection.adapter_name.downcase.to_sym == :postgresql ? 'ILIKE' : 'LIKE'} ?\"\n filters << \"%#{col.filter_value}%\"\n when :number\n filters[0] << \"#{col.filter_by} = ?\"\n filters << col.filter_value.to_i\n when :range\n range = col.filter_value.split(DataGrid.range_separator)\n\n if !range[0].blank? and !range[1].blank?\n begin\n range[0] < 2\n rescue\n range[0] = range[0].to_f\n range[1] = range[1].to_f\n end\n filters[0] << \"#{col.filter_by} >= ? AND #{col.filter_by} <= ?\"\n filters << range[0]\n filters << range[1]\n elsif range[0].blank? and !range[1].blank?\n begin\n range[1] < 2\n rescue\n range[1] = range[1].to_f\n end\n filters[0] << \"#{col.filter_by} <= ?\"\n filters << range[1]\n elsif range[1].blank? and !range[0].blank?\n begin\n range[0] < 2\n rescue\n range[0] = range[0].to_f\n end\n filters[0] << \"#{col.filter_by} >= ?\"\n filters << range[0]\n end\n\n when :date\n range = col.filter_value.split(DataGrid.range_separator)\n\n if !range[0].blank? and !range[1].blank?\n begin\n range[0] < 2\n rescue\n range[0] = DateTime.strptime(range[0], date_format)\n range[1] = DateTime.strptime(range[1], date_format)\n end\n filters[0] << \"#{col.filter_by} >= ? AND #{col.filter_by} <= ?\"\n filters << range[0]\n filters << range[1]\n elsif range[0].blank? and !range[1].blank?\n begin\n range[1] < 2\n rescue\n range[1] = DateTime.strptime(range[1], date_format)\n end\n filters[0] << \"#{col.filter_by} <= ?\"\n filters << range[1]\n elsif range[1].blank? and !range[0].blank?\n begin\n range[0] < 2\n rescue\n range[0] = DateTime.strptime(range[0], date_format)\n end\n filters[0] << \"#{col.filter_by} >= ?\"\n filters << range[0]\n end\n end\n end\n end\n \n filters[0] = filters[0].join(' AND ')\n filters\n end",
"def conditions\n @generated_conditions.collect { |_, cond| cond }\n end",
"def schedule_filter\n redirect_params = {}\n redirect_params[:month] = params[:month] if params[:month]\n redirect_params[:year] = params[:year] if params[:year]\n\n render(:partial => \"tasks/filter\", \n :locals => { \n :redirect_params => redirect_params,\n :hide_grouping => true,\n :hide_colors => true,\n :hide_icons => true,\n :hide_sorting => true,\n :hide_organize => true,\n :hide_hide_dependencies => true\n })\n end",
"def filtering_params(params)\n params.slice(:added_by, :after, :before)\n end",
"def date_range(items, from, to)\n\n date_range_items = items.reject{ |item| item[\"date\"] < from }\n date_range_items.reject!{ |item| item[\"date\"] > to }\n\n return date_range_items\nend",
"def initialize(collection_id:, date_range:, filter_microfilm: true)\n @collection_id = collection_id\n @date_range = date_range\n @filter_microfilm = filter_microfilm\n end",
"def query_3\n start_date = '2014-01-10'\n end_date = '2014-01-18'\n documents = Perpetuity[Document].select { |document| document.revision_date.in (start_date.to_time..end_date.to_time)}\n return documents.to_a.size\nend",
"def filtering_params(params)\n params.slice(:selecteduser, :weekstart, :weekend, :jobnumber)\nend"
]
| [
"0.6571027",
"0.65448755",
"0.63149136",
"0.62904465",
"0.6232841",
"0.613697",
"0.61290294",
"0.6059844",
"0.6059844",
"0.6058535",
"0.5981415",
"0.59449416",
"0.59449416",
"0.593825",
"0.59343964",
"0.59343964",
"0.59343964",
"0.58803636",
"0.58066624",
"0.57854086",
"0.5769492",
"0.57101995",
"0.57014394",
"0.57011867",
"0.5680336",
"0.5679856",
"0.56755507",
"0.56661576",
"0.566328",
"0.56609976",
"0.56597406",
"0.56554514",
"0.56530195",
"0.5639271",
"0.5634596",
"0.56244034",
"0.56143",
"0.56143",
"0.56086564",
"0.558897",
"0.55876315",
"0.55876315",
"0.557534",
"0.55729496",
"0.55694056",
"0.5551957",
"0.55502456",
"0.55485237",
"0.5546503",
"0.5542786",
"0.553072",
"0.5528847",
"0.5525857",
"0.5523823",
"0.5517659",
"0.55158365",
"0.5512075",
"0.5500039",
"0.54954684",
"0.54881126",
"0.54596895",
"0.5457166",
"0.5455504",
"0.54531235",
"0.5447971",
"0.54330325",
"0.5423974",
"0.5415439",
"0.5410171",
"0.54055214",
"0.5401147",
"0.5382648",
"0.5375592",
"0.5368685",
"0.53685385",
"0.5365396",
"0.5359734",
"0.53543836",
"0.5353536",
"0.5351159",
"0.5349696",
"0.53446114",
"0.5344114",
"0.5338009",
"0.5336584",
"0.5335155",
"0.5332385",
"0.5332385",
"0.5327277",
"0.5323199",
"0.5317343",
"0.53122056",
"0.53096676",
"0.52936983",
"0.5291566",
"0.5287612",
"0.5273748",
"0.52536356",
"0.52503926",
"0.52402365",
"0.5236273"
]
| 0.0 | -1 |
GET /missions/1 GET /missions/1.xml | def show
@mission = Mission.find(params[:id])
respond_to do |format|
format.js {@mission.to_json}
format.html {@mission}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n if not @mission = Mission.find(params[:id])\n render json: \"Mission not found for id: \" + params[:id]\n else\n respond_to do |format|\n format.json { render json: @mission }\n format.xml { render xml: @mission }\n end\n end\n end",
"def index\n @missions = Mission.all\n end",
"def index\n @missions = Mission.all\n end",
"def index\n @missions = Mission.all\n end",
"def index\n @missions = Mission.all\n end",
"def show\n @missionario = Missionario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @missionario }\n end\n end",
"def commission\n get 'commission'\n end",
"def show\n @mission = Mission.find(params[:id])\n end",
"def show\n @mission = Mission.find(params[:id])\n end",
"def show\n @mission = Mission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @mission }\n end\n end",
"def show\n @mission = Mission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mission }\n end\n end",
"def index\n @lessons = current_user.organization.lessons.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lessons }\n end\n end",
"def show\n @crit_requirement = CritRequirement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @crit_requirement }\n end\n end",
"def rights_overview\n\t\t@survey = Survey.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.html \n\t\t\tformat.xml { render :xml => @survey }\n\t\tend\n\tend",
"def tournaments\n get('sports/en/tournaments.xml')\n end",
"def index\n @permissions = Permission.find(:all)\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.xml { render :xml => @permissions }\n\t\tend\n end",
"def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end",
"def show\n @authorization_period = AuthorizationPeriod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @authorization_period }\n end\n end",
"def show\n @missionary = Missionary.find(params[:id])\n end",
"def index\n @mission_memberships = MissionMembership.all\n end",
"def index\n @tournaments = @resource_finder.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tournaments }\n end\n end",
"def show\n @agile_task = AgileTask.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @agile_task }\n end\n end",
"def show\n @lesson = current_user.organization.lessons.find(params[:id], :include => :pages)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lesson }\n end\n end",
"def index\n authorize :user\n if @localmap=Localmap.get(@user,params[:localID])\n @message=\"Found\"\n else\n @message=\"Not found\"\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @localmap,:template => 'localmaps/localmap.xml.builder' }\n end\n end",
"def show\n @physician = Physician.find(params[:id])\n #todo: authorize we are the correct physician.\n\n respond_to do |format|\n format.html\n format.xml #show.xml.builder\n end\n end",
"def index\n @authorization_periods = AuthorizationPeriod.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @authorization_periods }\n end\n end",
"def index\n @user = User.find(params[:user_id])\n @lab_memberships = @user.lab_memberships\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lab_memberships }\n end\n end",
"def show\n @permission = Permission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @permission }\n end\n end",
"def show\n @permission = Permission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @permission }\n end\n end",
"def get_mission_invites\n\t#get all missions of user with invitaion_status = pending\n user = User.exists? (params[:user_id])\n\tif user\n\t\tmissions = user.missions.references( :user_missions).select('missions.id, missions.title, user_missions.invitation_time').where( user_missions:{ invitation_status: PENDING_MESA_INVITATION})\n\t\trespond_to do |format|\n\t\t format.json {render :json=> {:mesa_invites=> missions, :status => true} }\n\t\tend\n else\n\t respond_to do |format|\n\t\t format.json {render :json=> {:error=>'No user exists with id' , :status => false} }\n\t end\n\tend\n end",
"def index\n @race_disciplines = RaceDiscipline.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @race_disciplines }\n end\n end",
"def show\n @modulo = Modulo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @modulo }\n end\n end",
"def show\n @permission = Permission.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to(users_url)}\n format.xml { render :xml => @permission }\n end\n end",
"def show\n @solicitation = Solicitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @solicitation }\n end\n end",
"def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end",
"def read(id=nil)\r\n request = Net::HTTP.new(@uri.host, @uri.port)\r\n if id.nil?\r\n response = request.get(\"#{@uri.path}.xml\") \r\n else\r\n response = request.get(\"#{@uri.path}/#{id}.xml\") \r\n end\r\n response.body\r\n end",
"def show\n @ipadmission = Ipadmission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ipadmission }\n end\n end",
"def index\n @solicitudes = Solicitud.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @solicitudes }\n end\n end",
"def show\n @criterion = Criterion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @criterion }\n end\n end",
"def abilities\n get('/ability/')\n end",
"def show\n @p_stat = PStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @p_stat }\n end\n end",
"def activities(params = {})\n scope 'default'\n get('activities/', params)\n end",
"def show\n @subject_permission = SubjectPermission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subject_permission }\n end\n end",
"def show\n @authorization = Authorization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @authorization }\n end\n end",
"def show\n @stat = Stat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stat }\n end\n end",
"def show\n @stat = Stat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stat }\n end\n end",
"def show\n @requirement_level = RequirementLevel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @requirement_level }\n end\n end",
"def show\n @organization_membershipship = current_person.organization_memberships.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @organization_membershipship }\n end\n end",
"def show\n @course_taken_status = CourseTakenStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @course_taken_status }\n end\n end",
"def tournaments_info(tournament_id, tournament_type = 'sr:tournament')\n get(\"sports/en/tournaments/#{tournament_type}:#{tournament_id}/info.xml\")\n end",
"def index\n @accessories = Accessory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @accessories }\n end\n end",
"def index\n @labs = @course.labs.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @labs }\n end\n end",
"def show\n @lab = @course.labs.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @lab }\n end\n end",
"def index\n @meant_it_rels = MeantItRel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @meant_it_rels }\n end\n end",
"def show\n @stat = Stat.find(params[:id])\n\t\traise \"not owner\" unless @stat.person.id == @person.id\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stat }\n end\n end",
"def list_courses\n if current_user.is_admin?\n @user = User.find(params[:id])\n @courses = @user.courses\n respond_to do |format|\n format.xml { render :xml => @courses }\n end\n else\n respond_to do |format|\n format.xml { render :text => \"error\" }\n end\n end\n end",
"def show\n @patrimonio = Patrimonio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @patrimonio }\n end\n end",
"def activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def index\n @requests = Request.authorize_requests_for current_user.id\n respond_to do |format|\n format.html { }\n format.json { render :json => @requests}\n format.xml { render :xml => @requests.to_xml}\n end\n end",
"def index\n @permissions = Permission.all\n\n #read permissions from yaml file\n read_permissions\n \n @domains = Domain.find(:all, :conditions => { :is_role => 1 })\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @permissions }\n end\n end",
"def show\n @loan = Loan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @loan }\n end\n end",
"def show\n @livingroom = Livingroom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @livingroom }\n end\n end",
"def index\n @curriculums = Curriculum.all(:order => 'start_year DESC')\n authorize! :read, Curriculum\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @curriculums }\n end\n end",
"def index\n @mission_statuses = MissionStatus.all\n end",
"def maintenance_list(statuspage_id)\n request :method => :get,\n :url => @url + 'maintenance/list/' + statuspage_id\n end",
"def show\n @enrollment = Enrollment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @enrollment }\n end\n end",
"def set_mission\n @mission = Mission.find(params[:id])\n end",
"def show\n @analisis = Analisis.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @analisis }\n end\n end",
"def show\n\t\t@permission = Permission.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml\t{ render :xml => @permission }\n\t\tend\n\tend",
"def show\n @periodista = Periodista.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @periodista }\n end\n end",
"def index\n @asset_disposals = AssetDisposal.with_permissions_to(:edit).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @asset_disposals }\n end\n end",
"def show\n @regiment = Regiment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @regiment }\n end\n end",
"def read(id=nil)\n request = Net::HTTP.new(@uri.host, @uri.port)\n if id.nil?\n response = request.get(\"#{@uri.path}.xml\")\n else\n response = request.get(\"#{@uri.path}/#{id}.xml\")\n end\n\n response.body\n end",
"def index\n @organs = Organ.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @organs }\n end\n end",
"def index\n @requests = Request.accessible_by(current_ability)\n\n \n\n end",
"def index\n @rooms = Room.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rooms }\n end\n end",
"def index\n @loans = Loan.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @loans }\n end\n end",
"def show\n @assignmentstatus = Assignmentstatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @assignmentstatus }\n end\n end",
"def show\n @skill_level = SkillLevel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @skill_level }\n end\n end",
"def show\n @personal = Personal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @personal }\n end\n end",
"def index\n @jido_guardian_rels = JidoGuardianRel.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jido_guardian_rels }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @marital_status }\n end\n end",
"def maintenance_list_by_id(statuspage_id)\n request :method => :get,\n :url => @url + 'maintenances/' + statuspage_id\n end",
"def index\n @commission_days = CommissionDay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @commission_days }\n end\n end",
"def show\n @land = Land.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @land }\n end\n end",
"def show\n @medium_mission = MediumMission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medium_mission }\n end\n end",
"def show\n @ministries = Ministries.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ministries }\n end\n end",
"def show\n @mostsmallmission = Mostsmallmission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallmission }\n end\n end",
"def index\n @involvements = Involvement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @involvements }\n end\n end",
"def show\n @imovel = Imovel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @imovel }\n end\n end",
"def get_working_missions\n \t#get all missions of user with invitaion_status = pending and mission status = true\n user = User.exists?(params[:user_id])\n\tif user\n\t\tmissions = user.missions.references(:user_missions).select('missions.id, missions.title').where( user_missions:{ invitation_status: ACCEPTED_MESA_INVITATION}, missions: {is_authorized: true})\n\t\trespond_to do |format|\n\t\t format.json {render :json=> {:working_mesa=> missions, :status => true} }\n\t\tend\n else\n\t respond_to do |format|\n\t\t format.json {render :json=> {:error=>'No user exists with id' , :status => false} }\n\t end\n\tend\n end",
"def show\n @annual_stat = AnnualStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @annual_stat }\n end\n end",
"def get_mission_details\n \tmission = Mission.exists? params[:mission_id]\n \tif mission\n\t\tmission_details(mission)\n respond_to do |format|\n\t\t format.json {render :json=> {:mesa_details=> @mission_details, :mesa_users => @mission_users, :mesa_leader => @mission_leader, :mesa_owner => @mission_owner, :status => true} }\n\t\tend\n else\n\t respond_to do |format|\n\t\t format.json {render :json=> {:error=>'No mesa exists with id' , :status => false}}\n\t end\n\tend\n end",
"def show\n @administration = Administration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @administration }\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 show\n @mission_sheet = MissionSheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mission_sheet }\n end\n end",
"def index\n @achievements = Achievement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @achievements }\n end\n end",
"def show\n @activity = Activity.find(params[:id])\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @activity.to_xml }\n end\n end",
"def show\n @mitigation = Mitigation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mitigation }\n end\n end",
"def incident_list(statuspage_id)\n request :method => :get,\n :url => @url + 'incident/list/' + statuspage_id\n end"
]
| [
"0.6442743",
"0.6334556",
"0.6334556",
"0.6334556",
"0.6334556",
"0.6154974",
"0.61020136",
"0.60673654",
"0.6055454",
"0.6037528",
"0.60260445",
"0.5943436",
"0.5816645",
"0.57859576",
"0.5764186",
"0.5731234",
"0.5714797",
"0.56805295",
"0.567767",
"0.56710225",
"0.5664581",
"0.56085837",
"0.5599899",
"0.55903774",
"0.5588821",
"0.5563195",
"0.5559576",
"0.55575174",
"0.55575174",
"0.5554636",
"0.5554282",
"0.55464965",
"0.55418974",
"0.5523957",
"0.552361",
"0.5520415",
"0.55197513",
"0.5503895",
"0.5500422",
"0.5497159",
"0.5495424",
"0.54938436",
"0.5489127",
"0.54807943",
"0.54800844",
"0.54800844",
"0.5472169",
"0.545962",
"0.54576266",
"0.54568964",
"0.5448467",
"0.54464257",
"0.54385537",
"0.54385376",
"0.5424589",
"0.5418744",
"0.5410099",
"0.54078",
"0.54078",
"0.54027534",
"0.54017186",
"0.54009664",
"0.53986305",
"0.5394707",
"0.5393378",
"0.53907",
"0.53874916",
"0.5381896",
"0.53812945",
"0.5380981",
"0.53784055",
"0.53752166",
"0.537175",
"0.53717136",
"0.53703815",
"0.5366173",
"0.53656524",
"0.5362425",
"0.53615403",
"0.5355308",
"0.53524345",
"0.5351504",
"0.535106",
"0.53479075",
"0.534289",
"0.5341124",
"0.534059",
"0.5338247",
"0.53368646",
"0.53360087",
"0.53357184",
"0.5333847",
"0.53313535",
"0.533075",
"0.5329409",
"0.53270227",
"0.5324597",
"0.5320258",
"0.53160566",
"0.53107315",
"0.53037155"
]
| 0.0 | -1 |
GET /missions/new GET /missions/new.xml | def new
@mission = Mission.new
respond_to do |format|
format.html # new.html.erb
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @mission = Mission.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mission }\n end\n end",
"def new\n @modulo = Modulo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @modulo }\n end\n end",
"def new\n @patron = Patron.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patron }\n end\n end",
"def new\n @local = Local.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @local }\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 @mission = Mission.new(:convocationjours => [Convocationjour.new])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @mission }\n end\n end",
"def new\n @p_stat = PStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @p_stat }\n end\n end",
"def new\n @personal = Personal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @personal }\n end\n end",
"def new\n @crit_requirement = CritRequirement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @crit_requirement }\n end\n end",
"def new\n @novel = Novel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @novel }\n end\n end",
"def new\n @patrimonio = Patrimonio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patrimonio }\n end\n end",
"def new\n @solicitud = Solicitud.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solicitud }\n end\n end",
"def new\n @ministries = Ministries.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ministries }\n end\n end",
"def new\n @resource = Resource.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end",
"def new\n @periodista = Periodista.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @periodista }\n end\n end",
"def new\n head :status => 405\n return\n \n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.xml { render :xml => @participant }\n end\n end",
"def new\n @permission = Permission.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @permission }\n end\n end",
"def new\n @livingroom = Livingroom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @livingroom }\n end\n end",
"def new\n @want = Want.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @want }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n @lease = Lease.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lease }\n end\n end",
"def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end",
"def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end",
"def new\n @request = Request.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n @status = Status.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @status }\n end\n end",
"def new\n @status = Status.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @status }\n end\n end",
"def new\n @status = Status.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @status }\n end\n end",
"def new\n @administration = Administration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @administration }\n end\n end",
"def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trial }\n end\n end",
"def new\n @loan = Loan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @loan }\n end\n end",
"def new\n @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end",
"def new\n @mission = Mission.new\n\n # make a new one\n\n end",
"def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end",
"def new\n @goal = Mg::Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @goal }\n end\n end",
"def new\n @goaltemplate = Goaltemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @goaltemplate }\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 @lablocational = Lablocational.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lablocational }\n end\n end",
"def new\n @ponto = Ponto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ponto }\n end\n end",
"def new\n @sti = Sti.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sti }\n end\n end",
"def new\n @portal = Portal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @portal }\n end\n end",
"def new\n @travel = Travel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @travel }\n end\n end",
"def new\n @travel = Travel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @travel }\n end\n end",
"def new\n @tstat = Tstat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tstat }\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @system }\n end\n end",
"def new\n @incident = Incident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incident }\n end\n end",
"def new\n @incident = Incident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incident }\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 @incident = Incident.new\n \n @title = \"New Incident\" \n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incident }\n end\n end",
"def new\n @assignmentstatus = Assignmentstatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @assignmentstatus }\n end\n end",
"def new\n @partyrole = Partyrole.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partyrole }\n end\n end",
"def new\n @activity = Activity.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\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 @period = Period.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @period }\n end\n end",
"def new\n new_prc\n\n setup_campuses_and_semesters\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prc }\n end\n end",
"def new\n @pool = Pool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pool }\n end\n end",
"def new\n @missionmaker = Missionmaker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @missionmaker }\n end\n end",
"def new\n respond_to do |format|\n format.xml { render :xml => @schedule }\n end\n end",
"def new\n @tso = Tso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tso }\n end\n end",
"def new\n @nom = Nom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nom }\n end\n end",
"def new\n @rol = Rol.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rol }\n end\n end",
"def new\n @rol = Rol.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rol }\n end\n end",
"def new\n @commission_day = CommissionDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @commission_day }\n end\n end",
"def 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 @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 @pat_project = Pat::Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pat_project }\n end\n end",
"def new\n @activities_project = ActivitiesProject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activities_project }\n end\n end",
"def new\n @testament = Testament.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @testament }\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 @reqinfo = Reqinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reqinfo }\n end\n end",
"def new\n @requirement = Requirement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @requirement }\n end\n end",
"def new\n @enrollment = Enrollment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @enrollment }\n end\n end",
"def new\n @enrollment = Enrollment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @enrollment }\n end\n end",
"def new\n @maintenance_schedule = MaintenanceSchedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @maintenance_schedule }\n end\n end",
"def new\n @partytype = Partytype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partytype }\n end\n end",
"def new\n @ptcourse = Ptcourse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ptcourse }\n end\n end",
"def new\n @page = Page.new(:status => params[:from])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @po }\n end\n end",
"def new\n @journal = Journal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @journal }\n end\n end",
"def new\n @relationship = Relationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @relationship }\n end\n end",
"def new\n @resp = Response.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resp }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instituto }\n end\n end",
"def new\n @ministry = Ministry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ministry }\n end\n end",
"def new\n @universe = Universe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @universe }\n end\n end",
"def new\n @page = current_cms.pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @ponto = Ponto.new\n @t = params[:estagiario_id]\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ponto }\n end\n end",
"def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route }\n end\n end",
"def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route }\n end\n end",
"def new\n @population = Population.new(:access_level => 'creator')\n session[:breadcrumbs].add \"New\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @population }\n end\n end",
"def new\n logger.debug 'new_some interesting information'\n @comdty = Comdty.new\n setvariables\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comdty }\n end\n end",
"def new\n @partyrelationship = Partyrelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partyrelationship }\n end\n end",
"def new\n @pending_month = PendingMonth.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pending_month }\n end\n end",
"def new\n @tournament = @resource_finder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tournament }\n end\n end",
"def new\n @paciente = Paciente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @paciente }\n end\n end",
"def new\n @imovel = Imovel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @imovel }\n end\n end"
]
| [
"0.68822676",
"0.676747",
"0.67286885",
"0.6657133",
"0.6579722",
"0.6579722",
"0.6574091",
"0.655989",
"0.6556449",
"0.65373224",
"0.65348136",
"0.652663",
"0.6524759",
"0.6521269",
"0.6520349",
"0.6518998",
"0.6511877",
"0.6511858",
"0.650504",
"0.65037197",
"0.649668",
"0.649668",
"0.649668",
"0.6487636",
"0.6487272",
"0.6487272",
"0.6484008",
"0.6482492",
"0.6482492",
"0.6482492",
"0.64799744",
"0.647336",
"0.64721924",
"0.6469377",
"0.64640445",
"0.6463496",
"0.6459363",
"0.64532596",
"0.64364403",
"0.64323413",
"0.6430546",
"0.6427565",
"0.6410262",
"0.6408322",
"0.6408322",
"0.6407586",
"0.6399172",
"0.6399172",
"0.6399172",
"0.63951606",
"0.63869894",
"0.63869894",
"0.6386725",
"0.63830405",
"0.6381614",
"0.63804436",
"0.6379946",
"0.63773555",
"0.6376739",
"0.6372965",
"0.6370133",
"0.6368914",
"0.63654214",
"0.6365322",
"0.63564014",
"0.6354737",
"0.6354737",
"0.6352919",
"0.635258",
"0.63507843",
"0.63496304",
"0.63491607",
"0.6347724",
"0.63474596",
"0.6347019",
"0.63445824",
"0.63430786",
"0.63430786",
"0.63408995",
"0.6340761",
"0.6340529",
"0.63401574",
"0.633639",
"0.6322964",
"0.6320052",
"0.63171595",
"0.6315091",
"0.63120764",
"0.63110656",
"0.63107055",
"0.6310194",
"0.6308024",
"0.6308024",
"0.6306079",
"0.6304575",
"0.63025826",
"0.6296804",
"0.62957543",
"0.6294738",
"0.62946737"
]
| 0.67462385 | 2 |
POST /missions POST /missions.xml | def create
@mission = Mission.new(params[:mission])
respond_to do |format|
if @mission.save
format.js {
missions = Array.new
Mission.all.each do |m|
mission = Hash.new
mission[:id] = m.id
mission[:name] = m.name
if m.id == @mission.id
mission[:selected] = "true"
else
mission[:selected] = "false"
end
missions << mission
end
render :json => missions.sort_by { |mission| mission[:name]}
}
format.html { redirect_to(@mission, :notice => "The #{@mission.name} was sucesfully created.") }
else
format.html { render :action => "new" }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @mission_membership = MissionMembership.new(mission_membership_params)\n\n respond_to do |format|\n if @mission_membership.save\n format.html { redirect_to @mission_membership, notice: 'Mission membership was successfully created.' }\n format.json { render :show, status: :created, location: @mission_membership }\n else\n format.html { render :new }\n format.json { render json: @mission_membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mission_membership_params\n params.require(:mission_membership).permit(:user_id, :mission_id)\n end",
"def create\n @mission = Mission.new(mission_params)\n\n respond_to do |format|\n if @mission.save\n format.html { redirect_to @mission, notice: 'Mission was successfully created.' }\n format.json { render :show, status: :created, location: @mission }\n else\n format.html { render :new }\n format.json { render json: @mission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mission = Mission.new(mission_params)\n\n respond_to do |format|\n if @mission.save\n format.html { redirect_to @mission, notice: 'Mission was successfully created.' }\n format.json { render :show, status: :created, location: @mission }\n else\n format.html { render :new }\n format.json { render json: @mission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mission = Mission.new(mission_params)\n\n respond_to do |format|\n if @mission.save\n format.html { redirect_to @mission, notice: 'Mission was successfully created.' }\n format.json { render json: @mission, status: :created, location: @mission }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mission_params\n params.require(:mission).permit(:title, :body, :place, :appointment, :benevole_id, :etablissement_id)\n end",
"def create\n @mission = Mission.new(params[:mission])\n\n respond_to do |format|\n if @mission.save\n format.html { redirect_to @mission, :notice => 'La mission est cree.' }\n format.json { render :json => @mission, :status => :created, :location => @mission }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @mission.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @admission = Admission.create(admission_params)\n end",
"def mission_params\n params.require(:mission).permit(:name, :start, :end, :mtype, :category, :edition_id)\n end",
"def mission_params\n\n params.require(:mission).permit(:title, :brief, :shared_motivation, :build_intent, :from_date, :to_date, :to_time,:from_time, :place, :status, :is_authorized, :owner_id)\n end",
"def create\n \n @mission = Mission.new(mission_params)\n \n #assign users to mission\n if params[:user_ids].present?\n user = params[:user_ids].delete_if{ |x| x.empty? }\n @mission.users << User.find(params[:user_ids]) \n end\n \n \n respond_to do |format|\n if @mission.save\n format.html { redirect_to [:admin, @mission], notice: 'Mission was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mission }\n else\n format.html { render action: 'new' }\n format.json { render json: @mission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mission_status = MissionStatus.new(mission_status_params)\n\n respond_to do |format|\n if @mission_status.save\n format.html { redirect_to [:admin, @mission_status], notice: 'Mission status was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mission_status }\n else\n format.html { render action: 'new' }\n format.json { render json: @mission_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mission_params\n params.require(:mission).permit(:name, :description, :deadline, :state_id, :keyword, :parent_id, :lft, :rgt, :depth)\n end",
"def create\n\n @etablissement = Etablissement.find(params[:etablissement_id]) \n @mission = @etablissement.missions.new(mission_params)\n\n @mission.benevole = current_benevole\n #@etablissement = Etablissement.find(params[:id])\n\n respond_to do |format|\n @mission.save\n if @mission.save\n MissionMailer.new_mission_b(Mission.last).deliver_now\n MissionMailer.new_mission_e(Mission.last).deliver_now\n format.html { redirect_to @etablissement, notice: 'La Proposition a bien été crée.' }\n format.json { render :show, status: :created, location: @mission }\n else\n format.html { render :new }\n format.json { render json: @mission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def commission\n get 'commission'\n end",
"def create\n p = Prospectus.where(company_id: params[:company_id]).first\n do_mission = DoMission.create(prospectus_id: p.id, operator_id: current_user.id, status: 1, expired_at: Time.now + 10.days)\n render json: retval_wrapper({id: do_mission.id.to_s}) and return\n end",
"def index\n @missions = Mission.all\n end",
"def index\n @missions = Mission.all\n end",
"def index\n @missions = Mission.all\n end",
"def index\n @missions = Mission.all\n end",
"def create\n @mission_capacity = MissionCapacity.new(mission_capacity_params)\n\n respond_to do |format|\n if @mission_capacity.save\n format.html { redirect_to @mission_capacity, notice: 'Mission capacity was successfully created.' }\n format.json { render :show, status: :created, location: @mission_capacity }\n else\n format.html { render :new }\n format.json { render json: @mission_capacity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admission = Admission.new(admission_params)\n\n respond_to do |format|\n if @admission.save\n format.html { redirect_to @admission, notice: 'Admission was successfully created.' }\n format.json { render :show, status: :created, location: @admission }\n else\n format.html { render :new }\n format.json { render json: @admission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # mission_owner = User.exists? mission_params[:owner_id] \n # respond_to do |format|\n\t\t#unless mission_owner.nil? \n\t\t#\towner_role = mission_owner.roles.first.id unless mission_owner.roles.first.nil? \n\t\t#end\n\t # if VALID_ADMIN_USERS.include?(owner_role)\n\t\t@mission = Mission.new(mission_params)\n\t\[email protected]\n @mission.set_status(MESA_IS_AUTHORIZED)\n #UserMission.create(user_id: current_user.id, mission_id: @mission.id,invitation_time: Time.now.utc, invitation_status: ACCEPTED_MESA_INVITATION)\n mission_owner = @mission.get_mission_owner \n\t\tUserMailer.send_new_mesa_email(mission_owner[:name],@mission.title).deliver\n #UserMailer.validate_brief_email(mission_owner[:name]).deliver\n\t\t#format.json { render :json=> {:mesa_id => @mission.id, :status => true} }\n\t # else\n\t\t#format.json { render :json=> {:error => 'You do not have permission to create mesa', :status => false} }\n\t # end\n # end\n end",
"def create_mission_resources\n get_instructions\n map_plateau\n land_rovers\n end",
"def create\n @admission_type = AdmissionType.new(params[:admission_type])\n\n respond_to do |format|\n if @admission_type.save\n format.html { redirect_to @admission_type, :notice => 'Tipo de Ingresso criado com sucesso.' }\n format.json { render :json => @admission_type, :status => :created, :location => @admission_type }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @admission_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def mission_params\n params.require(:mission).permit(:message, :title)\n end",
"def create\n #When creating a new mission, current point should default to zero\n @mission = Mission.new()\n # @mission = Mission.new({\"name\" => params[:name], \"goal_points\" => params[:goal_points].to_i, \"current_points\" => 0, \"image\" => params[:image]})\n @mission.name = params[:name]\n @mission.goal_points = params[:goal_points].to_i\n @mission.current_points = 0\n @mission.image = params[:image]\n \n \n if @mission.valid? \n @mission.save!\n respond_to do |format|\n format.json { render json: @mission }\n format.xml { render xml: @mission }\n end\n else\n respond_to do |format|\n #format.json { render action: 'index' }\n format.json { render json: @mission.errors,status: :unprocessable_entity }\n \n end\n end\n end",
"def post_outcome_request\n raise IMS::LTI::InvalidLTIConfigError, \"\" unless has_required_attributes?\n\n res = post_service_request(@lis_outcome_service_url,\n 'application/xml',\n generate_request_xml)\n\n @outcome_response = extend_outcome_response(OutcomeResponse.new)\n @outcome_response.process_post_response(res)\n end",
"def create\n authorize :resquest_type, :create?\n @resquest_type = ResquestType.new(resquest_type_params)\n\n respond_to do |format|\n if @resquest_type.save\n format.html { redirect_to @resquest_type, notice: 'Resquest type was successfully created.' }\n format.json { render :show, status: :created, location: @resquest_type }\n else\n format.html { render :new }\n format.json { render json: @resquest_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @emission = Emission.new(emission_params)\n\n respond_to do |format|\n if @emission.save\n format.html { redirect_to @emission, notice: 'Emission was successfully created.' }\n format.json { render :show, status: :created, location: @emission }\n else\n format.html { render :new }\n format.json { render json: @emission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def admission_params\n params.require(:admission).permit(:id, :training_id, :admission_letter, :admissions_sent)\n end",
"def mission_params\n params.require(:mission).permit(:name, :description, :start_date, :end_date, :contact, :country_id, :language_id, :user_ids, :active, :translations_attributes => [:id, :locale, :name, :description], :picture_attributes =>[:id, :image, :filename] )\n end",
"def set_mission\n @mission = Mission.find(params[:id])\n end",
"def create\n @missionary = Missionary.new(params[:missionary])\n respond_to do |format|\n if @missionary.save\n format.html { redirect_to(@missionary, :notice => 'Missionary was successfully created.') }\n else\n format.html{render :action => \"new\"}\n end\n end\n end",
"def mission_status_params\n params.require(:mission_status).permit(:name, :code)\n end",
"def post\n resource.post(request, response)\n end",
"def create\n @admission = Admission.new(admission_params)\n @admission.user = current_user\n \n respond_to do |format|\n if @admission.save\n AdmissionMailer.admission_mail(current_user.email).deliver\n format.html { redirect_to @admission, notice: 'Admission information was successfully registered.' }\n format.json { render :show, status: :created, location: @admission }\n else\n format.html { render :new }\n format.json { render json: @admission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end",
"def create\n @mission_team = @game.mission_teams.new(mission_team_params)\n\n respond_to do |format|\n if @mission_team.save\n format.html { redirect_to [@game, @mission_team], notice: 'Mission team was successfully created.' }\n format.json { render :show, status: :created, location: @mission_team }\n else\n format.html { render :new }\n format.json { render json: @mission_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @medium_mission = MediumMission.new(params[:medium_mission])\n\n respond_to do |format|\n if @medium_mission.save\n format.html { redirect_to @medium_mission, notice: 'Medium mission was successfully created.' }\n format.json { render json: @medium_mission, status: :created, location: @medium_mission }\n else\n format.html { render action: \"new\" }\n format.json { render json: @medium_mission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @missionario = Missionario.new(params[:missionario])\n return unless access_control\n\n #if @missionario.cargo.nivel < @nivelmin\n # flash[:notice] = 'Cargo não foi alterado.'\n # @missionario.cargo = Cargo.find_by_nivel(5)\n #end\n\n respond_to do |format|\n\n if @missionario.save\n flash[:notice] = \"Missionario criado: #{@missionario.nome_cracha}\"\n coordenacao(params[:missionario][:cargo_id])\n unless @user.missionario\n @user.missionario = @missionario\n @user.save\n redirect_to :controller => :home\n return\n end\n\n format.html { redirect_to(@missionario) }\n format.xml { render :xml => @missionario, :status => :created, :location => @missionario }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @missionario.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mission_membership.update(mission_membership_params)\n format.html { redirect_to @mission_membership, notice: 'Mission membership was successfully updated.' }\n format.json { render :show, status: :ok, location: @mission_membership }\n else\n format.html { render :edit }\n format.json { render json: @mission_membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n prepare_params\n\n @request = Request.new(request_params.merge(user: current_user))\n @request.assign_sudo_users(request_params[:sudo_user_ids])\n respond_to do |format|\n if enough_resources && @request.save\n successful_save(format)\n else\n unsuccessful_action(format, :new)\n end\n end\n end",
"def create\r\n @owner_commission = OwnerCommission.new(owner_commission_params)\r\n\r\n respond_to do |format|\r\n if @owner_commission.save\r\n format.html { redirect_to @owner_commission, notice: 'Owner commission was successfully created.' }\r\n format.json { render action: 'show', status: :created, location: @owner_commission }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @owner_commission.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def test_post_invoices_xml \n Redmine::ApiTest::Base.should_allow_api_authentication(:post,\n '/invoices.xml',\n {:invoice => {:project_id => 1, :number => 'INV/TEST-1'}},\n {:success_code => :created})\n \n assert_difference('Invoice.count') do\n post '/invoices.xml', {:invoice => {:project_id => 1, :number => 'INV/TEST-1', :contact_id => 1, :status_id => 1, :invoice_date => Date.today}}, credentials('admin')\n end\n\n invoice = Invoice.first(:order => 'id DESC')\n assert_equal 'INV/TEST-1', invoice.number\n \n assert_response :created\n assert_equal 'application/xml', @response.content_type\n assert_tag 'invoice', :child => {:tag => 'id', :content => invoice.id.to_s}\n end",
"def create\n authorize AccountMovement\n @account_movement = @investor.account_movements.build(account_movement_params)\n #@account_movement = AccountMovement.new(account_movement_params)\n respond_to do |format|\n if @account_movement.save\n format.html { redirect_to account_movements_list_investor_path(@investor), notice: 'Movimento em Conta Registado.' }\n format.json { render :show, status: :created, location: @account_movement }\n else\n format.html { render :new }\n format.json { render json: @account_movement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\tauthorize! :create, TipoPrivilegio\n @tipo_privilegio = TipoPrivilegio.new(tipo_privilegio_params)\n\n respond_to do |format|\n if @tipo_privilegio.save\n\t\t\t\t\t\tsesion= Sesion.find_by(usuario_id: current_usuario.id, fechaFin: nil)\n\t\t\t\tTransaccion.create!(\n \t\t\t\tdescripcion: \"Creación del tipo de Privilegio : #{@tipo_privilegio.attributes}\",\n \t\t\t\tsesion_id: sesion.id\n\t\t\t\t)\n format.html { redirect_to @tipo_privilegio\nflash[:success] = 'Tipo privilegio fue creado satisfactoriamente.' }\n format.json { render :show, status: :created, location: @tipo_privilegio }\n else\n format.html { render :new }\n format.json { render json: @tipo_privilegio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mostsmallmission = Mostsmallmission.new(params[:mostsmallmission])\n\n respond_to do |format|\n if @mostsmallmission.save\n format.html { redirect_to @mostsmallmission, notice: 'Mostsmallmission was successfully created.' }\n format.json { render json: @mostsmallmission, status: :created, location: @mostsmallmission }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mostsmallmission.errors, status: :unprocessable_entity }\n end\n end\n end",
"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 set_mission\n @mission = Mission.find(params[:id])\n end",
"def set_mission\n @mission = Mission.find(params[:id])\n end",
"def set_mission\n @mission = Mission.find(params[:id])\n end",
"def set_mission\n @mission = Mission.find(params[:id])\n end",
"def post()\n # construct arguments to fetch\n args = {\n method: 'post',\n credentials: 'include',\n headers: {'Content-Type' => 'application/json'},\n body: {\n project: @ppmc.id,\n ids: @ppmc.mentors.join(','),\n action: 'add',\n targets: ['ldap', 'ppmc', 'committer']\n }.inspect\n }\n\n @disabled = true\n Polyfill.require(%w(Promise fetch)) do\n @create_disabled = true\n fetch(\"actions/ppmc\", args).then {|response|\n content_type = response.headers.get('content-type') || ''\n if response.status == 200 and content_type.include? 'json'\n response.json().then do |json|\n self.update(json)\n end\n else\n alert \"#{response.status} #{response.statusText}\"\n end\n @create_disabled = false\n }.catch {|error|\n alert error\n @create_disabled = false\n }\n end\n end",
"def create\n authorize! :create, Cargo\n @cargo = Cargo.new(cargo_params)\n # @sueldo= Sueldo.new(cargo_params['sueldo_attributes'])\n\n respond_to do |format|\n if @cargo.save\n log(\"Se ha creado el cargo: #{@lt}\", 0)\n\n format.html { redirect_to @cargo, notice: 'El cargo fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @cargo }\n # @sueldo.save\n else\n format.html { render :new }\n format.json { render json: @cargo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @summit = Summit.new(summit_params)\n \n @summit.currency = \"$\"\n @summit.location_country = \"USA\"\n \n @summit.deadline = create_deadline_json\n @summit.admin_email = \"\"\n \n respond_to do |format|\n if @summit.save\n format.html { redirect_to @summit, notice: 'Summit was successfully created.' }\n #format.json { render :show, status: :created, location: @summit }\n else\n format.html { render :new_public }\n #format.json { render json: @summit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def POST; end",
"def create\n @restriction = Restriction.new(params[:restriction])\n\n if @restriction.save\n render json: @restriction, status: :created, location: @restriction\n else\n render json: @restriction.errors, status: :unprocessable_entity\n end\n end",
"def set_mission\n @mission = Mission.find(params[:mission_id])\n end",
"def admission_params\n params.require(:admission).permit(:field, :specialization, :payment_type)\n end",
"def create\n @ways_of_admission = WaysOfAdmission.new(params[:ways_of_admission])\n\n respond_to do |format|\n if @ways_of_admission.save\n format.html { redirect_to @ways_of_admission, :notice => 'Ways of admission was successfully created.' }\n format.json { render :json => @ways_of_admission, :status => :created, :location => @ways_of_admission }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @ways_of_admission.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def mission_params\n params.require(:mission).permit(:name, :image)\n end",
"def create\n @medium_mission_inv = MediumMissionInv.new(params[:medium_mission_inv])\n\n respond_to do |format|\n if @medium_mission_inv.save\n format.html { redirect_to @medium_mission_inv, notice: 'Medium mission inv was successfully created.' }\n format.json { render json: @medium_mission_inv, status: :created, location: @medium_mission_inv }\n else\n format.html { render action: \"new\" }\n format.json { render json: @medium_mission_inv.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @mission = Mission.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mission }\n end\n end",
"def create\n @mission_sheet = MissionSheet.new(params[:mission_sheet])\n\n respond_to do |format|\n if @mission_sheet.save\n format.html { redirect_to @mission_sheet, notice: 'Mission sheet was successfully created.' }\n format.json { render json: @mission_sheet, status: :created, location: @mission_sheet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mission_sheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mission_environment = MissionEnvironment.new(mission_environment_params)\n\n respond_to do |format|\n if @mission_environment.save\n format.html { redirect_to @mission_environment, notice: 'Mission environment was successfully created.' }\n format.json { render :show, status: :created, location: @mission_environment }\n else\n format.html { render :new }\n format.json { render json: @mission_environment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end",
"def index\n @mission_memberships = MissionMembership.all\n end",
"def create_and_invitation_studant(params = {})\n run(:post, \"/invitations\", [201,422], JSON.dump(params))\n end",
"def update\n respond_to do |format|\n if @mission.update(mission_params)\n format.html { redirect_to @mission, notice: 'Mission was successfully updated.' }\n format.json { render :show, status: :ok, location: @mission }\n else\n format.html { render :edit }\n format.json { render json: @mission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mission.update(mission_params)\n format.html { redirect_to @mission, notice: 'Mission was successfully updated.' }\n format.json { render :show, status: :ok, location: @mission }\n else\n format.html { render :edit }\n format.json { render json: @mission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mission.update(mission_params)\n format.html { redirect_to @mission, notice: 'Mission was successfully updated.' }\n format.json { render :show, status: :ok, location: @mission }\n else\n format.html { render :edit }\n format.json { render json: @mission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @organization_membership = OrganizationMembership.new(organization_membership_create_params)\n # authorize @organization_membership\n\n if @organization_membership.save\n render json: @organization_membership, status: :created, location: nil\n else\n render json: @organization_membership.errors, status: :unprocessable_entity\n end\n end",
"def create\n puts \"My assert Attributes: #{params[:assert]}\"\n @assert = Assert.new(params[:assert])\n\n respond_to do |format|\n if @assert.save\n format.html { redirect_to @assert, notice: 'Assert was successfully created.' }\n format.json { render json: @assert, status: :created, location: @assert }\n else\n format.html { render action: \"new\" }\n format.json { render json: @assert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def eligibility(params = {})\n scope 'default'\n post('eligibility/', params)\n end",
"def create\n @curriculum = Curriculum.new(params[:curriculum])\n authorize! :create, @curriculum\n\n @curriculum.admins << @current_user\n @terms = Term.order(:start_year).all\n\n respond_to do |format|\n if @curriculum.save\n format.html { redirect_to(edit_curriculum_url(:id => @curriculum), :notice => 'Curriculum was successfully created.') }\n format.xml { render :xml => @curriculum, :status => :created, :location => @curriculum }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @curriculum.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def admission_params\n params.require(:admission).permit(:startdate, :enddate, :sclass_id, :subject_id, :totalfee, :feestructure).merge(user_id: current_user.id)\n end",
"def resource_params\n params.require(:maintenance).permit(:date, :mileage, :cost, :description, :warranty_time, :maintenance_type)\n end",
"def create\n authorize! :create, Solicitud\n @solicitante=Solicitante.find(params[:solicitante_id])\n @beneficiario=Beneficiario.find(params[:beneficiario_id])\n @solicitud = Solicitud.create(solicitud_params)\n @[email protected]\n @[email protected]\n\n respond_to do |format|\n if @solicitud.save\n format.html { redirect_to solicitante_beneficiario_path(@solicitante, @beneficiario), notice: 'Solicitud creada exitosamente.' }\n format.json { render :show, status: :created, location: solicitante_beneficiario_path(@solicitante, @beneficiario) }\n else\n format.html { render :new }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @mission = Mission.new(:convocationjours => [Convocationjour.new])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @mission }\n end\n end",
"def create\n\t\tauthorize! :create, EstadoPresupuesto\n @estado_presupuesto = EstadoPresupuesto.new(estado_presupuesto_params)\n\n respond_to do |format|\n if @estado_presupuesto.save\n format.html { redirect_to gestionar_estados_presupuestos_path}#@estado_presupuesto, notice: 'Estado presupuesto fue creado satisfactoriamente.' }\n format.json { render :show, status: :created, location: @estado_presupuesto }\n else\n format.html { render :new }\n format.json { render json: @estado_presupuesto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_assignment(name)\n @url = \"http://#{$canvas_host}/api/v1/courses/#{$canvas_course_id}/assignments\"\n puts \"@url is #{@url}\"\n\n @payload={'assignment': { \n 'name': name,\n 'points_possible': '0',\n 'grading_type': 'pass_fail',\n 'published': 'true',\n 'submission_types': [ \"none\" ]\n }\n }\n\n @postResponse = HTTParty.post(@url, :body => @payload.to_json, :headers => $header )\n puts(\" POST to create assignment has Response.code #{@postResponse.code} and postResponse is #{@postRepsone}\")\nend",
"def set_mission\r\n @mission = Mission.friendly.find(params[:id])\r\n end",
"def update\n @admission.update_attributes(admission_params)\n end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def create\n @screen = session.active_screen\n\n params[:permission][:actions] = nil if params[:permission][:actions].nil?\n \n permission_type = params[:permission_type].to_s\n permission_attributes = params[:permission] || {}\n screen_id = params[:screen_id].to_i\n \n @permissions = Permission.create_permissions(permission_type, permission_attributes, screen_id)\n @permission = @permissions.last\n\n respond_to do |format|\n format.html # create.html.erb\n format.xml { render :xml => @permission }\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 @commission_type = CommissionType.new(commission_type_params)\n\n respond_to do |format|\n if @commission_type.save\n format.html { redirect_to @commission_type, notice: 'Commission type was successfully created.' }\n format.json { render :show, status: :created, location: @commission_type }\n else\n format.html { render :new }\n format.json { render json: @commission_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_mission_membership\n @mission_membership = MissionMembership.find(params[:id])\n end",
"def create\n authorize! :create_almacen,Sigesp::Solicitud \n unidad = session['unidad'] \n return render json: { unidad: \"Esta Unidad Administrativa no tiene Numero de Control \" }, status: :unprocessable_entity if Sigesp::CtrlRequisicion.control_compra(unidad).nil?\n\n @solicitudes = Sigesp::Solicitud.crear_solicitudes_almacen(sigesp_solicitud_alamcen_params)\n @grupoSolicitud = SolicitudGrupo.new\n @solicitudes.each do |solicitud|\n @grupoSolicitud.solicitudes << solicitud \n end\n if @grupoSolicitud.valid? \n @grupoSolicitud.guardar(unidad,current_usuario)\n return render json: { url: sigesp_solicitudsalmacen_path(@grupoSolicitud.solicitudes[0])} \n else\n return render json:@grupoSolicitud.errors ,status: :unprocessable_entity\n end \n end",
"def create\n @api_v1_mentorship_interest = Api::V1::MentorshipInterest.new(api_v1_mentorship_interest_params)\n\n respond_to do |format|\n if @api_v1_mentorship_interest.save\n format.html { redirect_to @api_v1_mentorship_interest, notice: 'Mentorship interest was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_mentorship_interest }\n else\n format.html { render :new }\n format.json { render json: @api_v1_mentorship_interest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lab_membership = LabMembership.new(params[:lab_membership])\n @user = @lab_membership.user\n\n respond_to do |format|\n if @lab_membership.save\n flash[:notice] = 'LabMembership was successfully created.'\n format.html { redirect_to( user_lab_memberships_path(@user) ) }\n format.xml { render :xml => @lab_membership, :status => :created, :location => @lab_membership }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lab_membership.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def volunteer_portal\n authorize! :volunteer_portal, :Reservation\n end",
"def create\n @invier_acceso = InvierAcceso.new(params[:invier_acceso])\n\n respond_to do |format|\n if @invier_acceso.save\n flash[:notice] = 'InvierAcceso was successfully created.'\n format.html { redirect_to(@invier_acceso) }\n format.xml { render :xml => @invier_acceso, :status => :created, :location => @invier_acceso }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invier_acceso.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @ponto = Ponto.new(params[:ponto])\n @orgao = @lotacao.orgao\n @ponto.usuario = current_user\n respond_to do |format|\n if @ponto.save\n format.html { redirect_to(pessoa_funcionario_lotacao_pontos_path(@pessoa,@funcionario,@lotacao), :notice => 'Ponto cadastrado com sucesso.') }\n format.xml { render :xml => @ponto, :status => :created, :location => @ponto }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ponto.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @discipline = Discipline.new(discipline_params)\n @discipline.users_id = current_user.id\n\n respond_to do |format|\n if @discipline.save\n @discipline.codigo = \"DISC-%04d\" % [@discipline.id]\n @discipline.save\n if params[:anexos]\n\n params[:anexos].each { |anx|\n @discanexo = Discanexo.new\n @discanexo.anexo = anx\n @discanexo.Discipline_id = @discipline.id\n @discanexo.save\n }\n end\n flash[:success] = \"Disciplina cadastrada com sucesso.\"\n format.html { redirect_to @discipline}\n format.json { render :show, status: :created, location: @discipline }\n else\n format.html { render :new }\n format.json { render json: @discipline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(*args)\n request :post, *args\n end",
"def create\n @restriction = Restriction.new(restriction_params)\n\n respond_to do |format|\n if @restriction.save\n format.html { redirect_to @restriction, notice: 'Restriction was successfully created.' }\n format.json { render json: @restriction, status: :created, location: @restriction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @restriction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_private_pos_account\n @pos_account_type = PosAccountType.where(\"token = '57d3c9d284c0'\")\n @pos_account = User.find_by_certified_agent_id(params[:certified_agent_id])\n\n init_form\n\n pos_account_type = PosAccountType.find_by_id(params[:user][:pos_account_type_id])\n\n build_resource(params[:user].merge({profile_id: Profile.find_by_name(pos_account_type.name).id, pos_account_type_id: pos_account_type.id, company: params[:user][:company], rib: params[:user][:rib], bank_code: params[:user][:bank_code], wicket_code: params[:user][:wicket_code], account_number: params[:user][:account_number], activities_description: params[:user][:activities_description], certified_agent_id: params[:certified_agent_id], sub_certified_agent_id: SecureRandom.hex(9), identification_token: Digest::SHA1.hexdigest([DateTime.now.iso8601(6), rand].join), password: \"password\", password_confirmation: \"password\"}))\n\n if resource.save\n=begin\n # Création de lid agent agréé sur paymoney\n if (pos_account_type.name rescue nil) == \"POS marchand\"\n account_type = \"OTpPcVxO\"\n else\n account_type = \"jVUdVQBK\"\n end\n\n request = Typhoeus::Request.new(URI.escape(\"#{Parameter.first.paymoney_url}/PAYMONEY_WALLET/rest/create_compte_pariculier/#{account_type}/#{resource.firstname}/#{resource.lastname}/#{Date.today}/#{resource.email}/#{resource.identification_token}/#{resource.mobile_number}/nulll/nulll/nullllllllll/nu/#{@pos_account.paymoney_token}/#{resource.country.name}\"), followlocation: true, method: :get)\n\n clown = resource.clone\n\n request.on_complete do |response|\n if response.success?\n response = JSON.parse(response.body) #rescue nil\n if response.blank?\n resource.errors.add(:id, \"Une erreur s'est produite, veuillez contacter l'administrateur.\")\n else\n case (response[\"status\"][\"idStatus\"].to_s rescue \"\")\n when \"1\"\n resource.update_attributes(created_on_paymoney_wallet: true, paymoney_account_number: response[\"compteNumero\"], paymoney_password: response[\"comptePassword\"], paymoney_token: response[\"compteLibelle\"])\n when \"4\"\n resource.errors.add(:id, \"Ce compte existe déjà.\")\n\n clown.delete\n else\n resource.errors.add(:id, \"Une erreur inconnue s'est produite, veuillez contacter l'administrateur. Statut: #{response[\"status\"][\"idStatus\"].to_s rescue \"\"} Message: #{response[\"status\"][\"idStatus\"].to_s rescue \"\"}\")\n clown.delete\n end\n end\n else\n clown.delete\n resource.errors.add(:id, \"La ressource n'est pas disponible, veuillez contacter l'administrateur.\")\n end\n end\n\n request.run\n=end\n\n # Création de lid agent agréé sur paymoney wallet pour les marchands\n if ((pos_account_type.name rescue nil) == \"POS particulier\" ) && (resource.created_on_paymoney_wallet rescue nil) == true\n request = Typhoeus::Request.new(\"#{Parameter.first.paymoney_wallet_url}/api/86d138798bc43ed59e5207c68e864564/#{resource.certified_agent_id}/#{resource.sub_certified_agent_id}/#{resource.paymoney_account_number}/#{resource.paymoney_token}\", followlocation: true, method: :get)\n\n request.on_complete do |response|\n if response.success?\n if (request.response.body rescue nil) == \"1\"\n resource.update_attribute(:created_on_paymoney_wallet, true)\n flash.now[:success] = \"Le compte a été correctement créé. \"\n build_resource({})\n else\n end\n end\n end\n\n request.run\n end\n else\n clean_up_passwords resource\n end\n\n\n #render text: \"#{Parameter.first.paymoney_url}/PAYMONEY_WALLET/rest/create_compte/#{account_type}/#{resource.firstname}/#{resource.lastname}/null/#{resource.email}/#{resource.identification_token}/#{resource.mobile_number}/#{resource.bank_code}/#{resource.wicket_code}/#{resource.account_number}/#{resource.rib}/#{resource.country.name}\"\n render :new_private_pos_account\n end",
"def create\n @req = Req.new(req_params)\n @req.office = current_user.office\n @req.user = current_user\n\n\n respond_to do |format|\n if @req.save\n flash[:notice] = \"Your requirement has been saved\"\n format.html { redirect_to @req }\n format.json { render :show, status: :created, location: @req }\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @req.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sendreq\n newReq = Joinrequest.new(:resolved => false, :manager_id => params[:id], :property_id => params[:pid], :tenant_id => session[:user_id])\n newReq.save\n redirect_to \"/tenants/show\"\n end"
]
| [
"0.59712154",
"0.5774457",
"0.5764914",
"0.5764914",
"0.5734137",
"0.56896967",
"0.5676138",
"0.5545584",
"0.5517663",
"0.5495247",
"0.5484578",
"0.54711264",
"0.54429877",
"0.54247534",
"0.5392861",
"0.5379041",
"0.531111",
"0.531111",
"0.531111",
"0.531111",
"0.5307907",
"0.5292602",
"0.52913606",
"0.5263838",
"0.5260761",
"0.5250465",
"0.5211908",
"0.5202867",
"0.51988614",
"0.51985633",
"0.5174991",
"0.51724935",
"0.51543725",
"0.5151999",
"0.51484895",
"0.51304656",
"0.5128532",
"0.51220405",
"0.5099096",
"0.5095054",
"0.5088826",
"0.5079521",
"0.5077946",
"0.5064103",
"0.50635517",
"0.5060778",
"0.5053419",
"0.502095",
"0.5018024",
"0.5014178",
"0.5014178",
"0.5014178",
"0.5014178",
"0.500632",
"0.5003884",
"0.49996775",
"0.4993889",
"0.49886987",
"0.4976543",
"0.49706766",
"0.49687678",
"0.49633318",
"0.49624038",
"0.49584374",
"0.49564198",
"0.49559245",
"0.4955893",
"0.49427962",
"0.49418148",
"0.49417317",
"0.49417317",
"0.49417317",
"0.4924928",
"0.49197942",
"0.49026704",
"0.48971477",
"0.4890171",
"0.48824722",
"0.48819274",
"0.48807636",
"0.48779878",
"0.48772117",
"0.48767236",
"0.48746192",
"0.48733005",
"0.48729444",
"0.48713088",
"0.486904",
"0.48552993",
"0.48528144",
"0.4852627",
"0.48516023",
"0.4843349",
"0.48417026",
"0.4836649",
"0.48346144",
"0.48300147",
"0.4826668",
"0.48245147",
"0.4818752",
"0.48183605"
]
| 0.0 | -1 |
PUT /missions/1 PUT /missions/1.xml | def update
@mission = Mission.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @mission = Mission.find(params[:id])\n\n respond_to do |format|\n if @mission.update_attributes(mission_params)\n format.html { redirect_to @mission, notice: 'Mission was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mission.update(mission_params)\n format.html { redirect_to @mission, notice: 'Mission was successfully updated.' }\n format.json { render :show, status: :ok, location: @mission }\n else\n format.html { render :edit }\n format.json { render json: @mission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mission.update(mission_params)\n format.html { redirect_to @mission, notice: 'Mission was successfully updated.' }\n format.json { render :show, status: :ok, location: @mission }\n else\n format.html { render :edit }\n format.json { render json: @mission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mission.update(mission_params)\n format.html { redirect_to @mission, notice: 'Mission was successfully updated.' }\n format.json { render :show, status: :ok, location: @mission }\n else\n format.html { render :edit }\n format.json { render json: @mission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end",
"def update\n @mission = Mission.find(params[:id])\n\n respond_to do |format|\n if @mission.update_attributes(params[:mission])\n format.html { redirect_to @mission, :notice => 'Changements bien pris en compte' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @mission.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mission_status.update(mission_status_params)\n format.html { redirect_to [:admin, @mission_status], notice: 'Mission status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mission_status.errors, status: :unprocessable_entity }\n end\n end\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",
"def update\n respond_to do |format|\n if @mission_membership.update(mission_membership_params)\n format.html { redirect_to @mission_membership, notice: 'Mission membership was successfully updated.' }\n format.json { render :show, status: :ok, location: @mission_membership }\n else\n format.html { render :edit }\n format.json { render json: @mission_membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end",
"def update\n @admission.update_attributes(admission_params)\n end",
"def update\n @mission_sheet = MissionSheet.find(params[:id])\n\n respond_to do |format|\n if @mission_sheet.update_attributes(params[:mission_sheet])\n format.html { redirect_to @mission_sheet, notice: 'Mission sheet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mission_sheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @admission_type = AdmissionType.find(params[:id])\n\n respond_to do |format|\n if @admission_type.update_attributes(params[:admission_type])\n format.html { redirect_to @admission_type, :notice => 'Tipo de Ingressso atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @admission_type.errors, :status => :unprocessable_entity }\n end\n end\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 test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => '[email protected]',\r\n :user_id => 1 }\r\n assert_response 401\r\n end",
"def put!\n request! :put\n end",
"def set_mission\n @mission = Mission.find(params[:id])\n end",
"def update\n flash[:notice] = ''\n params[:missionario][:sacramento_ids] ||= []\n params[:missionario][:existe_telefone_attributes] ||= { }\n\n @missionario = Missionario.find(params[:id])\n\n return unless access_control\n\n cargo = Cargo.find(params[:missionario][:cargo_id])\n if cargo.nivel < @nivelmin\n flash[:notice] = 'Cargo não foi alterado.'\n parms[:missionario][:cargo_id] = @missionario.cargo.id\n end\n\n respond_to do |format|\n if @missionario.update_attributes(params[:missionario])\n coordenacao(params[:missionario][:cargo_id])\n flash[:notice] += 'Missionario was successfully updated.'\n format.html { redirect_to(@missionario) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @missionario.errors, :status => :unprocessable_entity }\n end\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 opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update\n respond_to do |format|\n if @mission_capacity.update(mission_capacity_params)\n format.html { redirect_to @mission_capacity, notice: 'Mission capacity was successfully updated.' }\n format.json { render :show, status: :ok, location: @mission_capacity }\n else\n format.html { render :edit }\n format.json { render json: @mission_capacity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @missionary = Missionary.find(params[:id])\n \n respond_to do |format|\n if @missionary.update_attributes(params[:missionary])\n format.html{ redirect_to(@missionary, :notice => \"#{@missionary.full_name} was successfully updated.\") }\n else\n format.html{ render :action => \"edit\"}\n end\n end\n end",
"def put(*args)\n request :put, *args\n end",
"def update\n authorize! :update, @theorem\n if @theorem.update(theorem_params)\n render json: @theorem, status: :ok, location: @theorem\n else\n render json: @theorem.errors, status: :unprocessable_entity\n end\n end",
"def set_mission\n @mission = Mission.find(params[:id])\n end",
"def set_mission\n @mission = Mission.find(params[:id])\n end",
"def set_mission\n @mission = Mission.find(params[:id])\n end",
"def set_mission\n @mission = Mission.find(params[:id])\n end",
"def update\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n if @ministerio.update_attributes(params[:ministerio])\n format.html { redirect_to(@ministerio, :notice => 'Ministerio was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ministerio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n @mostsmallmission = Mostsmallmission.find(params[:id])\n\n respond_to do |format|\n if @mostsmallmission.update_attributes(params[:mostsmallmission])\n format.html { redirect_to @mostsmallmission, notice: 'Mostsmallmission was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mostsmallmission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_should_update_link_via_API_XML\r\n get \"/logout\"\r\n put \"/links/1.xml\", :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response 401\r\n end",
"def update\n authorize! :update, Solicitud\n respond_to do |format|\n if @solicitud.update(solicitud_params)\n format.html { redirect_to solicitudes_path, notice: 'Solicitud actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: solicitudes_path }\n else\n format.html { render :edit }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\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 update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\n end\n end",
"def update!\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 test_should_update_membership\n login_as(:john)\n put :update, :id => 1, :membership => { }\n assert_response :redirect\n end",
"def test_should_update_membership\n login_as(:john)\n put :update, :id => 1, :membership => { }\n assert_response :redirect\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n updated = params[:availabilities].keys.map(&:to_i)\n #existing = @person.availabilities.map(&:timeslot_id)\n #new = updated - existing\n #deleted = existing - updated\n #@person.availabilities.delete(deleted.map{|d| @person.availabilities.find_by_timeslot_id(d)})\n @person.availabilities=(updated.map{|t| @person.availabilities.find_or_create_by_timeslot_id(t)})\n flash[:notice] = 'Person was successfully updated.'\n format.html { redirect_to(@person) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_mission\n @mission = Mission.find(params[:mission_id])\n end",
"def update\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n if @sitio.update_attributes(params[:sitio])\n format.html { redirect_to(@sitio, :notice => 'Sitio was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sitio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @restroom = Restroom.find(params[:id])\n authorize @restroom\n\n respond_to do |format|\n if @restroom.update_attributes(params[:restroom])\n format.html { redirect_to @restroom, notice: 'Restroom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @restroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @oase = Oasis.find(params[:id])\n\n respond_to do |format|\n if @oase.update_attributes(params[:oase])\n format.html { redirect_to @oase, notice: 'Oasis was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @oase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ipadmission = Ipadmission.find(params[:id])\n\n respond_to do |format|\n if @ipadmission.update_attributes(params[:ipadmission])\n format.html { redirect_to(@ipadmission, :notice => 'Ipadmission was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ipadmission.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @tournament = Tournament.find(params[:id])\n authorize! :manage, @tournament\n\n respond_to do |format|\n if @tournament.update_attributes(params[:tournament])\n format.html { redirect_to @tournament, notice: 'Tournament was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tournament.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mission.update(mission_params)\n MissionMailer.update_mission_b(Mission.last).deliver_now\n MissionMailer.update_mission_e(Mission.last).deliver_now\n format.html { redirect_to @mission.etablissement, notice: 'La Proposition a bien été modifiée.' }\n format.json { render :show, status: :ok, location: @mission.etablissement }\n else\n format.html { render :edit }\n format.json { render json: @mission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_mission\r\n @mission = Mission.friendly.find(params[:id])\r\n end",
"def update_rest\n @question_localized = QuestionLocalized.find(params[:id])\n\n respond_to do |format|\n if @question_localized.update_attributes(params[:question_localized])\n flash[:notice] = 'QuestionLocalized was successfully updated.'\n format.html { redirect_to(@question_localized) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question_localized.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def update\n @ontology = SYMPH::Ontology.find(params[:id])\n\n respond_to do |format|\n if @ontology.update_attributes(params[:ontology])\n flash[:notice] = 'Ontology was successfully updated.'\n format.html { redirect_to(ontologies_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ontology.errors, :status => :unprocessable_entity }\n end\n end\n\t\n end",
"def update\n @restroom = Restroom.find(params[:id])\n authorize! :update, @restroom\n\n respond_to do |format|\n if @restroom.update_attributes(params[:restroom])\n format.html { redirect_to @restroom, notice: 'Restroom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @restroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @restroom = Restroom.find(params[:id])\n authorize! :update, @restroom\n\n respond_to do |format|\n if @restroom.update_attributes(params[:restroom])\n format.html { redirect_to @restroom, notice: 'Restroom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @restroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @uom = Uom.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @uom.update_attributes(params[:uom])\r\n format.html { redirect_to(@uom, :notice => 'Uom was successfully updated.') }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n \r\n end\r\n end\r\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_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @supervisor_estagio = SupervisorEstagio.find(params[:id])\n\n respond_to do |format|\n if @supervisor_estagio.update_attributes(params[:supervisor_estagio])\n flash[:notice] = 'Supervisor de Estagio atualizado com sucesso.'\n format.html { redirect_to(@supervisor_estagio) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @supervisor_estagio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mission_environment.update(mission_environment_params)\n format.html { redirect_to @mission_environment, notice: 'Mission environment was successfully updated.' }\n format.json { render :show, status: :ok, location: @mission_environment }\n else\n format.html { render :edit }\n format.json { render json: @mission_environment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @testament = Testament.find(params[:id])\n\n respond_to do |format|\n if @testament.update_attributes(params[:testament])\n flash[:notice] = 'Testament was successfully updated.'\n format.html { redirect_to(@testament) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @testament.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ambito = Ambito.find(params[:id])\n\n respond_to do |format|\n if @ambito.update_attributes(params[:ambito])\n format.html { redirect_to(@ambito, :notice => 'Ambito was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ambito.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @organization_membershipship = current_person.organization_memberships.find(params[:id])\n\n respond_to do |format|\n if @organization_membershipship.update_attributes(params[:organization_membershipship])\n format.html { redirect_to(@organization_membershipship, :notice => 'Organization membership was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @organization_membershipship.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 @timeline = Timeline.find(params[:id])\n\n respond_to do |format|\n if @timeline.update_attributes(params[:timeline])\n flash[:notice] = 'Timeline was successfully updated.'\n format.html { redirect_to([:admin, @timeline]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @timeline.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @sti = Sti.find(params[:id])\n\n respond_to do |format|\n if @sti.update_attributes(params[:sti])\n flash[:notice] = 'Sti was successfully updated.'\n format.html { redirect_to(@sti) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sti.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n # this action is not provided for partyroles\n end",
"def update\n @ministries = Ministries.find(params[:id])\n\n respond_to do |format|\n if @ministries.update_attributes(params[:ministries])\n flash[:notice] = 'Ministries was successfully updated.'\n format.html { redirect_to(@ministries) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ministries.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admission.update(admission_params)\n format.html { redirect_to @admission, notice: 'Admission was successfully updated.' }\n format.json { render :show, status: :ok, location: @admission }\n else\n format.html { render :edit }\n format.json { render json: @admission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @step = TaskrequestsStep.find(params[:taskrequests_step_id])\n @absence_request = @step.absence_requests.find(params[:id])\n\n respond_to do |format|\n if @absence_request.update_attributes(params[:absence_request])\n format.html { redirect_to(@absence_request, :notice => 'Absence request was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @absence_request.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def update\n @medium_mission = MediumMission.find(params[:id])\n\n respond_to do |format|\n if @medium_mission.update_attributes(params[:medium_mission])\n format.html { redirect_to @medium_mission, notice: 'Medium mission was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @medium_mission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mission_procedure.update(mission_procedure_params)\n format.html { redirect_to @mission_procedure, notice: 'Mission procedure was successfully updated.' }\n format.json { render :show, status: :ok, location: @mission_procedure }\n else\n format.html { render :edit }\n format.json { render json: @mission_procedure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n if @incident.update_attributes(params[:incident])\n format.html { redirect_to(@incident) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incident.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admission.update(admission_params)\n format.html { redirect_to @admission, notice: 'Admission information was successfully updated.' }\n format.json { render :show, status: :ok, location: @admission }\n else\n format.html { render :edit }\n format.json { render json: @admission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @visarequest = Visarequest.find(params[:id])\n\n respond_to do |format|\n if @visarequest.update_attributes(params[:visarequest])\n flash[:notice] = 'Visarequest was successfully updated.'\n format.html { redirect_to(@visarequest) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @visarequest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n if @socio.update_attributes(params[:socio])\n format.html { redirect_to @socio, :notice => 'Socio atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @socio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(*args)\n request(:put, *args)\n end",
"def put(path, params)\n request(:put, path, params)\n end",
"def update\n @request = Request.find(params[:id])\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n format.html { redirect_to(@request, :notice => 'Prestamo actualizado.') }\n else\n format.xml { render :xml => @request.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n authorize :resquest_type, :update?\n respond_to do |format|\n if @resquest_type.update(resquest_type_params)\n format.html { redirect_to @resquest_type, notice: 'Resquest type was successfully updated.' }\n format.json { render :show, status: :ok, location: @resquest_type }\n else\n format.html { render :edit }\n format.json { render json: @resquest_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @quest = Quest.find(params[:id])\n\n respond_to do |format|\n if @quest.update_attributes(params[:quest])\n format.html { redirect_to(@quest, :notice => 'Quest was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @quest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @novel = Novel.find(params[:id])\n\n respond_to do |format|\n if @novel.update_attributes(params[:novel])\n flash[:notice] = 'Novel was successfully updated.'\n format.html { redirect_to(@novel) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @novel.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n @tso = Tso.find(params[:id])\n\n respond_to do |format|\n if @tso.update_attributes(params[:tso])\n flash[:notice] = 'Tso was successfully updated.'\n format.html { redirect_to(@tso) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tso.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @questao = Questao.find(params[:id])\n\n respond_to do |format|\n if @questao.update_attributes(params[:questao])\n format.html { redirect_to(@questao, :notice => 'Questao was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @questao.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @medium_mission_inv = MediumMissionInv.find(params[:id])\n\n respond_to do |format|\n if @medium_mission_inv.update_attributes(params[:medium_mission_inv])\n format.html { redirect_to @medium_mission_inv, notice: 'Medium mission inv was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @medium_mission_inv.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @centro = Centro.find(params[:id])\n\n respond_to do |format|\n if @centro.update_attributes(params[:centro])\n format.html { redirect_to(@centro, :notice => 'Centro atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @centro.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @curriculum = Curriculum.find(params[:id])\n @curriculum.update_attributes(params[:curriculum])\n\n respond_with @curriculum, :location => [:admin, @course, @curriculum]\n end",
"def update\n @temision = Temision.find(params[:id])\n\n respond_to do |format|\n if @temision.update_attributes(params[:temision])\n format.html { redirect_to(@temision, :notice => 'Temision was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @temision.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @organization = Organization.find(params[:id])\n\n if current_user.has_role?('admin')\n @organization.is_pending = false\n end\n respond_to do |format|\n if @organization.update_attributes(params[:organization])\n flash[:notice] = 'Organization was successfully updated.'\n format.html { redirect_to(@organization) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @organization.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put\n if(resource.collection?)\n Forbidden\n elsif(!resource.parent_exists? || !resource.parent_collection?)\n Conflict\n else\n resource.lock_check if resource.supports_locking?\n status = resource.put(request, response)\n response['Location'] = \"#{scheme}://#{host}:#{port}#{url_format(resource)}\" if status == Created\n response.body = response['Location']\n status\n end\n end"
]
| [
"0.6356518",
"0.62677306",
"0.62677306",
"0.62677306",
"0.6198845",
"0.61596245",
"0.59818494",
"0.59580255",
"0.5948959",
"0.5912207",
"0.5886129",
"0.58220345",
"0.5815251",
"0.5794813",
"0.5771521",
"0.572228",
"0.57096887",
"0.57015574",
"0.569868",
"0.5684844",
"0.5681375",
"0.5667724",
"0.56576407",
"0.5624567",
"0.56191313",
"0.56191313",
"0.56191313",
"0.56191313",
"0.561208",
"0.5611038",
"0.55863106",
"0.5584497",
"0.5578817",
"0.5570163",
"0.5569381",
"0.5564125",
"0.55614895",
"0.55614895",
"0.5546321",
"0.5545685",
"0.5543527",
"0.55348873",
"0.5533429",
"0.55150646",
"0.5507796",
"0.5490387",
"0.5475884",
"0.54718643",
"0.5471632",
"0.5471632",
"0.5471632",
"0.54583085",
"0.5454931",
"0.5454931",
"0.5451985",
"0.5447794",
"0.54468745",
"0.54461724",
"0.5444539",
"0.54402286",
"0.54401565",
"0.54354346",
"0.5432404",
"0.5432078",
"0.5431648",
"0.5424466",
"0.5419999",
"0.5418762",
"0.54182",
"0.5415523",
"0.5415523",
"0.5415449",
"0.5413881",
"0.5411545",
"0.5404721",
"0.5401655",
"0.54003036",
"0.5399681",
"0.5399681",
"0.5399681",
"0.5399681",
"0.5399681",
"0.5399681",
"0.5399681",
"0.5399681",
"0.5398457",
"0.5397712",
"0.5396708",
"0.5395212",
"0.5390619",
"0.5388749",
"0.5385963",
"0.5374923",
"0.53738934",
"0.53680676",
"0.5358215",
"0.5358016",
"0.5356114",
"0.53549296",
"0.5351889"
]
| 0.62584555 | 4 |
DELETE /missions/1 DELETE /missions/1.xml | def destroy
@mission = Mission.find(params[:id])
@mission.destroy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @ipadmission = Ipadmission.find(params[:id])\n @ipadmission.destroy\n\n respond_to do |format|\n format.html { redirect_to(ipadmissions_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 @missionario = Missionario.find(params[:id])\n unless @user.nivel <= 1\n flash[:notice] = 'Acesso negado'\n redirect_to(missionarios_url)\n return\n end\n @missionario.destroy\n\n respond_to do |format|\n format.html { redirect_to(missionarios_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 @mission.destroy\n respond_to do |format|\n format.html { redirect_to admin_missions_url, notice: 'Mission was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mission = Mission.find(params[:id])\n @mission.destroy\n\n respond_to do |format|\n format.html { redirect_to missions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @mission = Mission.find(params[:id])\n @mission.destroy\n\n respond_to do |format|\n format.html { redirect_to missions_url }\n format.json { head :no_content }\n end\n 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 @missionary = Missionary.find(params[:id])\n @missionary.destroy\n end",
"def destroy\n @restriction = Restriction.find(params[:id])\n @restriction.destroy\n\n head :no_content\n end",
"def destroy\n @admission.destroy\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n client = Connection::MarkLogic.new.client\n client.send_corona_request(\"/v1/documents?uri=/amandments/amandment_#{@amandment.id}.xml\", :delete)\n @amandment.destroy\n respond_to do |format|\n format.html { redirect_to home_meeting_path, notice: 'Amandman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_course_by_id(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/courses/#{org_unit_id}\" # setup user path\n # ap path\n _delete(path)\n puts '[+] Course data deleted successfully'.green\nend",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def deleteResource(doc, msg_from)\n \n \n begin\n\n puts \"Deleting\"\n\n path = \"\"\n params = {}\n headers = {}\n \n context, path = findContext(doc, path) \n \n # Deleting member from group\n if context == :user_group_member\n params = {}\n else\n raise Exception.new(\"No context given!\")\n end\n \n httpAndNotify(path, params, msg_from, :delete)\n \n rescue Exception => e\n puts \"Problem in parsing data (CREATE) from xml or sending http request to the VR server: \" + e\n puts \" -- line: #{e.backtrace[0].to_s}\"\n end\n \n end",
"def maintenance_delete(statuspage_id, maintenance_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['maintenance_id'] = maintenance_id\n\n request :method => :post,\n :url => @url + 'maintenance/delete',\n :payload => data\n end",
"def destroy\n @invier_acceso = InvierAcceso.find(params[:id])\n @invier_acceso.destroy\n\n respond_to do |format|\n format.html { redirect_to(invier_accesos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @mission_membership.destroy\n respond_to do |format|\n format.html { redirect_to mission_memberships_url, notice: 'Mission membership was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @absence_request = AbsenceRequest.find(params[:id])\n @absence_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(absence_requests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tree_node_ac_rights = TreeNodeAcRight.find(params[:id])\n @tree_node_ac_rights.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_tree_node_tree_node_permissions_path }\n format.xml { head :ok }\n end\n end",
"def destroy\n @visarequest = Visarequest.find(params[:id])\n @visarequest.destroy\n\n respond_to do |format|\n format.html { redirect_to(visarequests_url) }\n format.xml { head :ok }\n end\n end",
"def delete(id)\n request = Net::HTTP::Delete.new(\"#{@url}/#{id}.xml\")\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 destroy\n @permiso = Permiso.find(params[:id])\n @permiso.destroy\n\n respond_to do |format|\n format.html { redirect_to(permisos_url) }\n format.xml { head :ok }\n end\n end",
"def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def destroy\n @mission.destroy\n respond_to do |format|\n format.html { redirect_to missions_url, notice: 'Mission was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mission.destroy\n respond_to do |format|\n format.html { redirect_to missions_url, notice: 'Mission was successfully destroyed.' }\n format.json { head :no_content }\n end\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 @permission = Permission.find(params[:id])\n @permission.destroy\n\n respond_to do |format|\n format.html { redirect_to(permissions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n cargo = Cargo.find(params[:id])\r\n cargo.delete if cargo\r\n #do we need update the statisitc?\r\n # url=request.url\r\n # @user=User.find(session[:user_id])\r\n respond_to do |format|\r\n # if @user.name==\"admin\"\r\n # format.html { redirect_to(admincargo_manage_path) }\r\n # else\r\n format.html { redirect_to(:action=>\"index\") }\r\n # end\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n MissionMailer.destroy_mission_b(Mission.find(params[:id])).deliver_now\n MissionMailer.destroy_mission_e(Mission.find(params[:id])).deliver_now\n @mission.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'La Proposition a bien été supprimée' }\n format.json { head :no_content }\n end\n end",
"def delete_course_template(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/#{org_unit_id}\"\n _delete(path)\n puts '[+] Course template data deleted successfully'.green\nend",
"def destroy\n @estacion = Estacion.find(params[:id])\n @estacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(estaciones_url) }\n format.xml { head :ok }\n end\n end",
"def _delete(type, *args)\n type = type.to_s.camelize\n metadata = args.map { |full_name| {:full_name => full_name} }\n request :delete do |soap|\n soap.body = {\n :metadata => metadata\n }.merge(attributes!(type))\n end\n end",
"def destroy\n @ambito = Ambito.find(params[:id])\n @ambito.destroy\n\n respond_to do |format|\n format.html { redirect_to(ambitos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @accessory = Accessory.find(params[:id])\n @accessory.destroy\n\n respond_to do |format|\n format.html { redirect_to(accessories_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @testament = Testament.find(params[:id])\n @testament.destroy\n\n respond_to do |format|\n format.html { redirect_to(testaments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @medium_mission = MediumMission.find(params[:id])\n @medium_mission.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_missions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aclpart = Aclpart.find(params[:id])\n @aclpart.destroy\n\n respond_to do |format|\n format.html { redirect_to(aclparts_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @jido_guardian_rel = JidoGuardianRel.find(params[:id])\n @jido_guardian_rel.destroy\n\n respond_to do |format|\n format.html { redirect_to(jido_guardian_rels_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @nom = Nom.find(params[:id])\n @nom.destroy\n\n respond_to do |format|\n format.html { redirect_to(noms_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @patron = Patron.find(params[:id])\n @patron.destroy\n\n respond_to do |format|\n format.html { redirect_to(patrons_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @mission_status.destroy\n respond_to do |format|\n format.html { redirect_to admin_mission_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @access.destroy\n respond_to do |format|\n format.html { redirect_to accesses_url }\n format.json { head :no_content }\n end\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 delete(id)\r\n connection.delete(\"/#{@doctype}[@ino:id=#{id}]\")\r\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(course_path(params[:course_id])) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n\t\tauthorize! :destroy, @activity\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @aplicacion = Aplicacion.find(params[:id])\n @aplicacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(aplicacions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @access.destroy\n end",
"def destroy\n @solicitation = Solicitation.find(params[:id])\n @solicitation.destroy\n\n respond_to do |format|\n format.html { redirect_to(solicitations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @crit_requirement = CritRequirement.find(params[:id])\n @crit_requirement.destroy\n\n respond_to do |format|\n format.html { redirect_to(crit_requirements_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n\t\tauthorize! :index, @user\n\n @fichario_assunto = Fichario::Assunto.find(params[:id])\n @fichario_assunto.destroy\n\n respond_to do |format|\n format.html { redirect_to(fichario_assuntos_url) }\n format.xml { head :ok }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @criteria = Criteria.find(params[:id])\n @criteria.destroy\n\n respond_to do |format|\n format.html { redirect_to(criterias_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @disciplina = Disciplina.find(params[:id])\n @disciplina.destroy\n\n respond_to do |format|\n format.html { redirect_to(disciplinas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ministerio = Ministerio.find(params[:id])\n @ministerio.destroy\n\n respond_to do |format|\n format.html { redirect_to(ministerios_url) }\n format.xml { head :ok }\n end\n end",
"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 @mostsmallmission = Mostsmallmission.find(params[:id])\n @mostsmallmission.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallmissions_url }\n format.json { head :no_content }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @access = Access.find(params[:id])\n @access.destroy\n redirect_to accesses_url\n end",
"def destroy\n @deposit_threshold = DepositThreshold.find(params[:id])\n @deposit_threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to(deposit_thresholds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @access_type = AccessType.find(params[:id])\n @access_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(access_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @requisicion = Requisicion.find(params[:id])\n @requisicion.destroy\n\n respond_to do |format|\n format.html { redirect_to(requisicions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @t1 = T1.find(params[:id])\n @t1.destroy\n\n respond_to do |format|\n format.html { redirect_to(t1s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @criterion = Criterion.find(params[:id])\n @criterion.destroy\n\n respond_to do |format|\n format.html { redirect_to(subject_url(@criterion.subject)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @modulo = Modulo.find(params[:id])\n @modulo.destroy\n\n respond_to do |format|\n format.html { redirect_to(modulos_url) }\n format.xml { head :ok }\n end\n end",
"def delete(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'delete'}.merge(authentication))\n end",
"def destroy\n @modulo = Modulo.find(params[:id])\n @modulo.destroy\n\n respond_to do |format|\n format.html { redirect_to(modulos_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def destroy\n @lease = Lease.find(params[:id])\n @lease.destroy\n\n respond_to do |format|\n format.html { redirect_to(leases_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @relatorios = Relatorio.find(params[:id])\n @relatorios.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end",
"def delete(path, params)\n request(:delete, path, {})\n end",
"def delete(type, id)\n http_delete @target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\", @auth_header, @zone\n end",
"def destroy\n @enrollment = Enrollment.find(params[:id])\n @enrollment.destroy\n\n respond_to do |format|\n format.html { redirect_to(enrollment_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @asignacion = Asignacion.find(params[:id])\r\n @asignacion.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(asignacions_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def destroy\n @status = Status.find(params[:id])\n @status.destroy\n\n respond_to do |format|\n format.html { redirect_to(statuss_url) }\n format.xml { head :ok }\n end\n end",
"def delete_analysis(analysis_id); rest_delete(\"#{link('analyses')}/#{analysis_id}\"); nil; end",
"def destroy\n @iguanasactualizacion = Iguanasactualizacion.find(params[:id])\n @iguanasactualizacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(iguanasactualizaciones_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @oligo = Oligo.find(params[:id])\n @oligo.destroy\n\n respond_to do |format|\n format.html { redirect_to(oligos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @entitlement = Entitlement.find(params[:id])\n @entitlement.destroy\n\n respond_to do |format|\n format.html { redirect_to(entitlements_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @actividad = Actividad.find(params[:id])\n @actividad.destroy\n\n respond_to do |format|\n format.html { redirect_to(actividads_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @norma = Norma.find(params[:id])\n @norma.destroy\n\n respond_to do |format|\n format.html { redirect_to(normas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @assert = Assert.find(params[:id])\n @assert.destroy\n\n respond_to do |format|\n format.html { redirect_to asserts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @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"
]
| [
"0.6556368",
"0.6511632",
"0.64810014",
"0.640924",
"0.64016426",
"0.63914824",
"0.6342617",
"0.6337935",
"0.6328765",
"0.6326571",
"0.6316322",
"0.6315472",
"0.6277839",
"0.62714213",
"0.6256996",
"0.62533706",
"0.62397665",
"0.62386996",
"0.6229038",
"0.62103415",
"0.6204584",
"0.6180129",
"0.6179316",
"0.6163077",
"0.61574143",
"0.6149136",
"0.6145985",
"0.61415744",
"0.61415744",
"0.6136307",
"0.61265117",
"0.61200655",
"0.6111653",
"0.6106814",
"0.6097819",
"0.6096254",
"0.6090238",
"0.6085519",
"0.60736924",
"0.60711706",
"0.6069949",
"0.6068227",
"0.6067928",
"0.60664356",
"0.6053687",
"0.6049338",
"0.6048572",
"0.6045858",
"0.6041691",
"0.6034823",
"0.6033695",
"0.60331905",
"0.6027663",
"0.60253006",
"0.6023941",
"0.6021987",
"0.6021473",
"0.6019441",
"0.60181546",
"0.6017446",
"0.6013479",
"0.60112786",
"0.60070854",
"0.60051376",
"0.6000662",
"0.6000662",
"0.6000662",
"0.6000662",
"0.5997698",
"0.5997502",
"0.59967965",
"0.5994016",
"0.59934187",
"0.59927106",
"0.59923136",
"0.59916264",
"0.5991545",
"0.5989771",
"0.598873",
"0.598576",
"0.5984829",
"0.5982983",
"0.5982158",
"0.5982115",
"0.59784544",
"0.59784544",
"0.59784544",
"0.59784544",
"0.59784544",
"0.59784544",
"0.59784544",
"0.5975172",
"0.59739816",
"0.59733975",
"0.59723985",
"0.59719974",
"0.59712774",
"0.5962625",
"0.59623265",
"0.59619445"
]
| 0.650412 | 2 |
has_many :posts has_many :reviews | def avatar
if object.dp.present?
k = object.dp.url.gsub('upload','upload/g_face,c_thumb,w_150,h_150')
else
k = object.avatar
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reviews\n reviews = []\n katas = Kata.all\n katas.each { |k| reviews += k.reviews.where(user_id: self.id) }\n return reviews\n end",
"def my_reviews\n self.reviews.select do |review|\n review.user.id = self.id \n end \n end",
"def fetch\n Product.includes(:reviews).all\n end",
"def reviews\n self.reviews\n end",
"def review_count\n self.reviews.count\n end",
"def review_count\n self.reviews.count\n end",
"def review_count\n self.reviews.count\n end",
"def count_ratings\n self.reviews.all.count\n end",
"def reviews\n @items = ProductComment.includes(:account).where({product: @product}).all\n end",
"def reviews_count\n \tobject.reviews.count\n end",
"def reviews\n @reviews\n end",
"def index\n @reviews = @publication.reviews.all\n end",
"def reviews\n Review.all.select do |r|\n r.user == self\n end\n end",
"def get_reviews\n @comment_reviews = CommentReview.where('comment_id = ?', params[:comment_id])\n end",
"def reviews\n Review.all.select {|review| review.customer == self}\n end",
"def set_reviews\n @reviews = Review.where(restaurant_id: @restaurant.id).order(\"created_at DESC\")\n end",
"def review\n @users = User.all\n @review = Review.new\n end",
"def number_of_reviews\n self.reviews.count\n end",
"def index\n @reviews = @story.reviews\n end",
"def user_reviews\n Review.all.select {|review| review.user == self}\n end",
"def index\n\t\t@reviews = @movie.reviews\n\tend",
"def index\n @reviews = current_user.reviews\n end",
"def customers\n self.reviews.collect do |review|\n review.customer\n end\n end",
"def index\n @reviews = Review.all\n \n end",
"def index\n @reviews = @post.reviews.all\n respond_with @post, @reviews\n end",
"def reviews( params={} )\n reviews = get_connections(\"reviews\", params)\n return map_connections reviews, :to => Facebook::Graph::Review\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def critics(reviews)\n @criticreview = reviews\n end",
"def create\n @user = User.find(params[:id])\n @user.reviews.push(current_user)\n redirect_to reviews_path\n end",
"def related_posts; end",
"def reviewed_books\n self.reviews.map{|r| r.book}\n end",
"def review_count\n reviews.count\n end",
"def count_reviews_of\n @count_reviews_of ||= Review.of(editor).posted_within(self).count\n end",
"def review_exist?\n self.reviews.any?\n end",
"def index\n @reviews = Review.includes(:user).limit(5)\n end",
"def index\n @product_reviews = ProductReview.all\n end",
"def index\n @reviews_and_ratings = ReviewsAndRating.all\n end",
"def ratings\n\t\tself.reviews.map{|review| review.rating}\n\tend",
"def show\n @reviews = Review.where(user_id: @user.id).includes(:spot)\n end",
"def reviews_count\n\t\treviews.size\n\tend",
"def has_reviews?\n\t\t!self.reviews.empty? \n\tend",
"def show\n @id=params[:id]\n @pics = Picture.where(post_id_fk: @id)\n @reviews=Review.where(post_idfk: @id)\n\n @re=Review.new\n\n end",
"def reviews\n download_reviews\n @reviews.flatten!\n end",
"def get_reviews(proposal_id)\n\t\treturn Review.find_all_by_proposal_id(proposal_id)\n\tend",
"def review\n # unapproved post viewer\n # MAKE ADMIN ONLY\n @posts = Post.order(\"approved, created_at desc\")\n .paginate(per_page: 7, page: params[:page])\n end",
"def review_comment_count\n self.reviews.map { |review| review.comments.count }.inject(:+)\n end",
"def average_review_rating\n self.reviews.all.average(:rating)\n end",
"def create\n @post = Post.new(post_params)\n @post.user_id=current_user.id\n create_review(@post)\n end",
"def score_of_review_comments\n votes = 0\n self.reviews.each do |review|\n review.comments.each { |comment| votes += comment.vote_count }\n end\n votes\n end",
"def index\n @products = Product.page(params[:page]).reverse_order.per(5).includes([:reviews])\n end",
"def reviews\n @reviews ||= (@doc/\"ProductReview\").collect { |it| Element.new(it) }\n end",
"def reviews\n Review.all.select do |r|\n r.album == self\n end\n end",
"def index\n @admin_reviews = Review.all\n end",
"def user_reviews\n list_of_reviews = self.reviews\n list_of_reviews.map{|review| \"User: #{review.user.name}, Rating: #{review.rating}, Review: #{review.description}\"}\n end",
"def review_comment_vote_count\n number_of_votes = 0\n self.reviews.each do |review|\n review.comments.each do |comment|\n number_of_votes += comment.votes.count\n end\n end\n number_of_votes\n end",
"def load_reviews (movie)\n\t\tmovie[\"reviews\"] = Review.by_movie_quick(movie[\"id\"])\n\t\tif Review.by_movie(movie[\"id\"]).size <= 7\n\t\t\tmovie[\"more_reviews\"] = false\n\t\telse \n\t\t\tmovie[\"more_reviews\"] = true\n\t\tend\n\tend",
"def associate_review\n review = Review.find_by(user_id: self.user_id, skin_id: self.skin_id)\n self.review_id = review.id if review\n end",
"def create\n @review = @post.reviews.where(user_id: current_user.id).create(params[:review])\n respond_with @post, @review, location: post_path(@post, anchor: \"review_#{@review.id}\")\n end",
"def index\n @item_reviews = ItemReview.all\n end",
"def index\n @item_reviews = ItemReview.all\n end",
"def reviews(order: :most_recent, limit: 10)\n @reviews ||= ReviewSet.new(self,\n review_order: order,\n limit_size: limit).reviews\n end",
"def set_reviews\n @book = Book.find(params[:book_id])\n end",
"def recent_reviews\n # 5 most recent reviews of this restaurant\n\n self.reviews.order(:date).limit(5)\n end",
"def show\n @reviews = @user.reviews.includes(:item)\n @favorites = @user.favorites.includes(:item)\n end",
"def listing_reviews\n Review.where(listing_id: listings.select(:id).collect(&:id))\n end",
"def index\n\t\t@store_reviews = @store.store_reviews;\t\t\n\tend",
"def create\n @product = Product.find params[:product_id] \n @review = @product.reviews.create(review_params)\n if @review.save\n redirect_to :back\n end\n end",
"def index\n\t\t@reviews = @share.reviews.order(priority: :asc)\n\t\t@reviewToAlter = @share.reviews.new\n\tend",
"def reviewers\n reviews.map { |r|\n r.user }.uniq\n end",
"def reviews_as_owner\n Review.where(:product_id => product_ids)\n end",
"def my_reviews\n Review.all.select do |review_instance|\n review_instance.traveller == self\n end\n end",
"def mark_products_with_reviews\r\n Product.all.each do |product|\r\n product.with_reviews = \"y\" unless AliReview.where(productId: product.productId)[0].nil?\r\n product.save if product.with_reviews == \"Y\"\r\n end\r\n end",
"def review_set\n return @review_set\n end",
"def recent_reviews\n\t\tself.reviews_as_reviewee.sort_by{|review| review.created_at}.reverse[0..4]\n\tend",
"def review\n fetch('restaurant.review')\n end",
"def show\n @reviews = Review.where(project_id: @project.id).order(\"created_at DESC\")\n end",
"def show\n @reviews = Review.where(site_id: @site.id).order(\"created_at DESC\")\n end",
"def show\n @item = Item.find(params[:id])\n @reviews = @item.reviews\n end",
"def add_review(restaurant, content)\n new_review = Review.new(restaurant, content)\n new_review.customer = self\n new_review.restaurant = restaurant\n end",
"def set_reviews\n @products = Product.find(params[:products_id])\n end",
"def set_reviews_and_rating\n @reviews_and_rating = ReviewsAndRating.find(params[:id])\n end",
"def index\n @evenreviews = Evenreview.all\n end",
"def related_customers\n ratings.customers\n end",
"def movies\n # output = []\n # Review.all.each do |review|\n # if review.user == self\n # output << review.movie\n # end\n # end\n # output\n reviews.map { |review| review.movie }\n end",
"def index\n @fourth_reviews = FourthReview.all\n end",
"def index\n @critic_reviews = CriticReview.all\n end",
"def openstruct_reviews\r\n @shop.reviews\r\n end",
"def reviews\n # output = []\n # Review.all.each do |review|\n # if review.user == self\n # output << review\n # end\n # end\n # output\n Review.all.select { |review| review.user == self }\n end",
"def review\n @review\n end",
"def review\n end"
]
| [
"0.6980106",
"0.6744505",
"0.67256397",
"0.65626365",
"0.6464096",
"0.6464096",
"0.6464096",
"0.64589745",
"0.6436625",
"0.64264774",
"0.64059836",
"0.63755494",
"0.6359005",
"0.62737733",
"0.62632424",
"0.6257059",
"0.6255399",
"0.6217944",
"0.62071806",
"0.6188471",
"0.6170726",
"0.61179775",
"0.61102086",
"0.61095977",
"0.6073992",
"0.6072591",
"0.60459745",
"0.60459745",
"0.60459745",
"0.60459745",
"0.60459745",
"0.60459745",
"0.60459745",
"0.60459745",
"0.60459745",
"0.60459745",
"0.60459745",
"0.60459745",
"0.60366166",
"0.60260814",
"0.6020006",
"0.60184395",
"0.6017276",
"0.60132843",
"0.5999071",
"0.59339195",
"0.5923813",
"0.5919485",
"0.5907246",
"0.5898704",
"0.5884244",
"0.58755296",
"0.5874172",
"0.5861219",
"0.5860472",
"0.58439213",
"0.58226013",
"0.58185595",
"0.58176535",
"0.58086425",
"0.5781335",
"0.5777472",
"0.57529235",
"0.57496625",
"0.5742761",
"0.5733173",
"0.5725976",
"0.5719741",
"0.5719571",
"0.57185477",
"0.57185477",
"0.5717719",
"0.5717051",
"0.5712732",
"0.57081753",
"0.56901395",
"0.5688949",
"0.56866306",
"0.5682771",
"0.56825644",
"0.5679857",
"0.56752014",
"0.5672624",
"0.56421745",
"0.56373566",
"0.5628831",
"0.56219",
"0.56186974",
"0.5618364",
"0.56182355",
"0.55998236",
"0.5598573",
"0.5597225",
"0.55917996",
"0.55909",
"0.55898523",
"0.5569428",
"0.5569164",
"0.556819",
"0.55605704",
"0.55509734"
]
| 0.0 | -1 |
get a specific stat based on an entity_type and an entity_id | def get_stats(tagging)
hash = {}
tagging.first.tags.each do |tag|
hash = fill_hash_with_tag(hash,tag)
end
@array = []
@array = fill_array_with_hash(hash)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_entity(entity_id, entity_type)\n entity_class = begin; entity_type.constantize; rescue; nil; end\n return if entity_class.nil?\n\n @entity = if entity_class.respond_to?(:visible)\n entity_class.visible.find_by(id: entity_id)\n else\n entity_class.find_by(id: entity_id)\n end\n end",
"def get_entities(type)\n @entities[type.name]\n end",
"def getStatsEntityBy_year( entity_id, year)\n params = Hash.new\n params['entity_id'] = entity_id\n params['year'] = year\n return doCurl(\"get\",\"/stats/entity/by_year\",params)\n end",
"def details_by_type_and_id(type, id)\n get(resource_path_for_entity_type(type) + \"/#{id}\")\n end",
"def get_entity id\n @entities.each do |e|\n return e if e.id == id\n end\n end",
"def getStatsEntityBy_date( entity_id, year, month)\n params = Hash.new\n params['entity_id'] = entity_id\n params['year'] = year\n params['month'] = month\n return doCurl(\"get\",\"/stats/entity/by_date\",params)\n end",
"def get_enemy_stat(stat)\n enemy.get_stat(stat)\n end",
"def type\n entity_type.name\n end",
"def getEntity( entity_id, domain, path, data_filter)\n params = Hash.new\n params['entity_id'] = entity_id\n params['domain'] = domain\n params['path'] = path\n params['data_filter'] = data_filter\n return doCurl(\"get\",\"/entity\",params)\n end",
"def get_name_from_id_helper(entity_id, entity_type=nil,list_command_path=nil, subtype=nil)\n return entity_id unless is_numeric_id?(entity_id)\n\n entity_id = entity_id.to_i\n if entity_type.nil?\n entity_type,list_command_path,subtype = self.class.whoami()\n end\n\n match = nil\n response = self.class.get_cached_response(entity_type,list_command_path,subtype)\n if response and response.ok? and response['data']\n match = response['data'].find{|entity|entity_id == entity['id']}\n end\n unless match\n raise DTK::Client::DtkError, \"Not able to resolve entity name, please provide #{entity_type} name.\"\n end\n match['display_name']\n end",
"def details_by_type_and_name(type, name)\n entity_id = get_id_by_type_and_name(type, name)\n if entity_id.nil?\n raise \"Id for entity with type '#{type}' and name '#{name}' can't be found\"\n else\n details_by_type_and_id(type, entity_id)\n end\n end",
"def entity_id\n entities.select{|e| e.name == name}.first.id\n end",
"def get(entity)\n @components[entity.id] \n end",
"def get_id(entity)\n check_property_value(entity.properties, :type)\n check_property_value(entity.properties, :name)\n\n get_id_by_type_and_name(entity.properties[:type], entity.properties[:name])\n end",
"def find(id)\n describe(entity(id))\n end",
"def entities_of_type(type)\n @entities.select { |entity| entity['type'] == type }.map { |entity| Entity.new entity }\n end",
"def load_entity(entity_id)\n @entities[entity_id]\n end",
"def load_entity(type, id)\n path = entity_path(type, id)\n data = service.get(path)\n create_entity(type, id, data)\n end",
"def entity\n @entity ||=\n begin\n detected = lam.QueryAssignedLicenses().find{|la| la.entityDisplayName == resource[:entity_id]}\n if detected\n detected.entityId\n else\n resource[:entity_id]\n end\n end\n end",
"def find_by_tag_in_entity_type(tenant_id,entity_type_id,tag)\n return @instance.find_by_tag_in_entity_type(tenant_id,entity_type_id,tag)\n end",
"def entity_type\n return @entity_type\n end",
"def details(entity)\n details_by_type_and_name(entity.properties[:type], entity.properties[:name])\n end",
"def include_by entity_type, entity_id, user_id\n if entity = entity_type.singularize.camelize.constantize.find(entity_id)\n include entity, user_id\n end\n end",
"def get_workspace_entities_by_type(workspace_namespace, workspace_name, entity_type)\n path = self.api_root + \"/api/workspaces/#{uri_encode(workspace_namespace)}/#{uri_encode(workspace_name)}/entities/#{entity_type}\"\n process_firecloud_request(:get, path)\n end",
"def find_by_type(medium, *args)\n path = \"medium/#{medium}\"\n Rdigg.fetch(path, @@type, args)\n end",
"def get_entity(entity_type)\n # Search for the first occuring node of type entity which is a child node\n # of the metadata element.\n entity = @document.elements[\"//[local-name()='metadata' and namespace-uri()='%s']/%s[1]\" %\n [Model::NS_MMD_1, entity_type]]\n \n unless entity.nil? or entity.is_a? REXML::Text\n create_method = method('create_' + entity.name)\n create_method.call(entity) if create_method\n else\n return nil\n end\n end",
"def get_workspace_entity(workspace_namespace, workspace_name, entity_type, entity_name)\n path = self.api_root + \"/api/workspaces/#{uri_encode(workspace_namespace)}/#{uri_encode(workspace_name)}/entities/#{entity_type}/#{entity_name}\"\n process_firecloud_request(:get, path)\n end",
"def get(item_type, item_id)\n all(item_type).detect { |item| item[:id].to_i == item_id.to_i }\n end",
"def get_tags(tenant_id, entity_type_id,entity_id)\n return @instance.get_tags(tenant_id, entity_type_id,entity_id)\n end",
"def determine_item(item_type, item_id)\n case item_type\n \n when \"weapon_id\"\n Weapon.find(item_id) \n when \"armor_id\"\n Armor.find(item_id)\n when \"potion_id\"\n Potion.find(item_id)\n end\n end",
"def getEntityBy_groupid( group_id)\n params = Hash.new\n params['group_id'] = group_id\n return doCurl(\"get\",\"/entity/by_groupid\",params)\n end",
"def entity_list(entity)\n case entity\n when Player then @players\n else @npcs\n end\n end",
"def get_entity_type_identifier(type)\n get_type_identifier(type, Occi::Core::Entity.kind)\n end",
"def entity_by_id(model_class)\n halt 400 unless (params[:id].to_i.to_s == params[:id])\n model_class[params[:id]] || (halt 404)\n end",
"def fetch_aggregate(type, id)\n return unless identity_map[type]\n\n identity_map[type][id]\n end",
"def getSyndication_logBy_entity_id( entity_id, page, per_page)\n params = Hash.new\n params['entity_id'] = entity_id\n params['page'] = page\n params['per_page'] = per_page\n return doCurl(\"get\",\"/syndication_log/by_entity_id\",params)\n end",
"def get_entity_count(type)\n @tracker.count(type)\n end",
"def entity(point_or_name); end",
"def details(entity_id, request_options = \"\")\n API::request(:get, \"entities/#{entity_id}\" + request_options)\n end",
"def get(type, id)\n case type.to_sym\n when :blob then grit.blob(id)\n when :tree then grit.tree(id)\n when :commit then grit.commit(id)\n when :tag\n \n object = grit.git.ruby_git.get_object_by_sha1(id)\n if object.type == :tag \n Grit::Tag.new(object.tag, grit.commit(object.object))\n else\n nil\n end\n \n else raise \"unknown type: #{type}\"\n end\n end",
"def find(entity_set, id)\n query = service[entity_set].query\n url_chunk = query.find(id)\n\n body = api_get(url_chunk).body\n build_entity(entity_set, body)\n end",
"def entity_values(kind)\n self.entities.kind(kind.to_s).pluck('value')\n end",
"def extract_entity_details entity = nil, entity_type = nil\n if entity\n validate_author(entity)\n return [entity.type, entity.id]\n else\n unless entity_type\n raise ArgumentError.new(\"Must include an author/recipient as an Unloq::Entity instance or include an author_type or recipient_type\")\n end\n return [entity_type, nil]\n end\n end",
"def get_entity( name, parent_context = nil )\n id = @entity_names[ get_entity_unique_name(name, parent_context) ]\n @entity_list[ id ]\n end",
"def entity\n @keys[:entity]\n end",
"def set_entity_type\n @entity_type = EntityType.find(params[:id])\n end",
"def set_entity_type\n @entity_type = EntityType.find(params[:id])\n end",
"def get_entity(entity_name)\n uri = URI(@config[:server] + \"/#{entity_name}\")\n uri.query = URI.encode_www_form({:filter => @config[:filter]})\n \n result = Net::HTTP.get_response(uri)\n raise Exception(\"The request to #{uri} failed.\") unless result.is_a?(Net::HTTPSuccess)\n \n JSON.parse(result.body)\n \n rescue\n @logger.error(\"Unable to retrieve entity:\\n#{$!}\")\n []\n end",
"def getSyndicationBy_entity_id( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"get\",\"/syndication/by_entity_id\",params)\n end",
"def show\n @breadcrumb = 'read'\n @entity_type = EntityType.find(params[:id])\n @entities = @entity_type.entities.paginate(:page => params[:page], :per_page => per_page).order('fiscal_id')\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entity_type }\n end\n end",
"def stat(stat_or_name)\n\t\tif stat_or_name.is_a? Stat\n\t\t\tstat_or_name\n\t\telse\n\t\t\tstats.find :first, :conditions =>\n\t\t\t\t[\"name LIKE ?\", stat_or_name+'%']\n\t\tend\n\tend",
"def get_stats_for_one(stat_entries, id)\n arr = stat_entries.extract(id)\n {max: arr.max, min: arr.min, avg: arr.avg, median: arr.median, stddev: arr.stddev}\n end",
"def get_global_statistic_by_type(type)\n type = type.to_s.to_sym\n path = \"#{@results_dir_path}/global_statistic.json\"\n data = ensure_load_json(path, {}, symbolize_names: true)\n data[type]\n end",
"def get_resource(id, type)\n\t\[email protected](type).call.get(id)\n\tend",
"def type\n if entity.respond_to?(:resource_type)\n entity.resource_type\n else\n entity.class\n end.to_s\n end",
"def find_entity_and_tag_count_in_entity_type(tenant_id,entity_type_id,tags,strict=true)\n return @instance.find_entity_and_tag_count_in_entity_type(tenant_id,entity_type_id,tags,strict)\n end",
"def entityID\n end",
"def entityID\n end",
"def entity load=true\n @entity ||= (klass.where(id: id).first if load)\n end",
"def api_v11_timeseries_entity_type_attributes_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_timeseries_entity_type_attributes_get ...\"\n end\n \n # resource path\n path = \"/api/v11/timeseries/entityTypeAttributes\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_v11_timeseries_entity_type_attributes_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def entity(index)\n i = get_field_index_by_external_id(index,@fields[:entity])\n fields(index, i)['item_id'].to_i unless i.nil?\n end",
"def getEntityBy_user_id( user_id)\n params = Hash.new\n params['user_id'] = user_id\n return doCurl(\"get\",\"/entity/by_user_id\",params)\n end",
"def set_entity_status\n @entity_status = EntityStatus.find(params[:id])\n end",
"def generate_literal_statistics(type = nil, count = 10000)\n unless type\n type = get_all_classes\n end\n\n type = [type] unless type.is_a?(Array)\n\n type.each_with_index { |entity_type, index|\n all_properties = {}\n puts \"#{__method__} - start process entity type: #{entity_type} [#{(index / type.size.to_f).round(2)}]\" if @console_output\n entity_type = entity_type.to_s.to_sym\n\n get_best_ranked_resources(entity_type, count).each { |resource, _|\n properties = @query.get_all_predicates_by_subject(resource.to_s, true).map { |solution_prop|\n solution_prop[:property].to_s\n } || []\n\n properties.uniq.each { |prop|\n next if Predicate.unimportant?(prop)\n all_properties[entity_type] ||= {}\n all_properties[entity_type][prop] ||= 0\n all_properties[entity_type][prop] += 1\n }\n\n }\n\n update_global_statistic(all_properties)\n }\n end",
"def get_entity_type_identifiers\n get_kind_type_identifiers_related_to Occi::Core::Entity.kind.type_identifier\n end",
"def show\n if singular_resource?\n entity = ConnecEntity.where(group_id: @group_id, entity_name: entities_key).first\n entity ||= ConnecEntity.create(group_id: @group_id, entity_name: entities_key)\n else\n entity = ConnecEntity.where(group_id: @group_id, entity_name: entities_key, uid: params[:id]).first\n end\n \n if entity\n logger.info(\"INSPECT: #{entities_key} => #{process_entity(entity).to_json}\")\n render json: { entities_key => process_entity(entity) }\n else\n render json: { errors: process_errors([\"Resource not found\"], 404) }, status: :not_found\n end\n end",
"def first_entity_value(entities, entity)\n\t return nil unless entities.has_key? entity\n\t if(entity == \"question_type\")\n\t\t\tval = entities[entity][1][\"value\"]\n\t else\n\t\tval = entities[entity][0][\"value\"]\n\t end\n\t return nil if val.nil?\n\t return val.is_a?(Hash) ? val[\"value\"] : val\n\tend",
"def getEntityBy_supplier_id( supplier_id)\n params = Hash.new\n params['supplier_id'] = supplier_id\n return doCurl(\"get\",\"/entity/by_supplier_id\",params)\n end",
"def getToolsSyndicate118( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"get\",\"/tools/syndicate/118\",params)\n end",
"def find_by_tags_in_entity_type(tenant_id,entity_type_id,tags,strict=true)\n return @instance.find_by_tags_in_entity_type(tenant_id,entity_type_id,tags,strict)\n end",
"def get_entity_type\n 'country'\n end",
"def list_entities project_id:, entity_type_id:\n # [START dialogflow_list_entities]\n # project_id = \"Your Google Cloud project ID\"\n # entity_type_id = \"Existing Entity Type ID\"\n\n require \"google/cloud/dialogflow\"\n\n entity_types_client = Google::Cloud::Dialogflow::EntityTypes.new\n parent = entity_types_client.class.entity_type_path project_id, entity_type_id\n\n entities = entity_types_client.get_entity_type(parent).entities\n\n entities.each do |entity|\n puts \"Entity value: #{entity.value}\"\n puts \"Entity synonyms: #{entity.synonyms}\"\n end\n # [END dialogflow_list_entities]\nend",
"def get_activities_by_object_type_and_id(object_type, id)\n @client.raw('get', \"/helpers/activities/#{object_type}/#{id}\")\n end",
"def find(id, type = :full)\n case type\n when :full\n response = JSON.parse(@client.get(\"items/#{id}\").body)\n Promisepay::Item.new(@client, response['items'])\n when :status\n response = JSON.parse(@client.get(\"items/#{id}/status\").body)\n Promisepay::Item.new(@client, response['items'])\n end\n end",
"def asset_type_rule asset_type\n policy_asset_type_rules.find_by(:asset_type_id => asset_type.id)\n end",
"def entity(dbname, id, params = {})\n version = params.fetch(:t, '-')\n get db_url(dbname, version, 'entity'), params.merge(:e => id)\n end",
"def stats\n case category\n when Item::ItemCatArmour\n item_stat_armour || build_item_stat_armour\n when Item::ItemCatWeapon\n item_stat_weapon || build_item_stat_weapon\n end\n end",
"def exclude_by entity_type, entity_id, user_id\n if entity = entity_type.singularize.camelize.constantize.find(entity_id)\n exclude entity, user_id\n end\n end",
"def show\n @collection = current_user.collections.find(params[:collection_id])\n @entity_type = @collection.entity_types.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entity_type }\n end\n end",
"def identify_json(entity_type)\n if (entity_type == \"user\")\n\t filename = \"users.json\"\n elsif (entity_type == \"project\")\n\t filename = \"projects.json\"\n else\n\t filename = nil\n end\n filename\n end",
"def get_entity_type_identifiers\n get_entity_types_related_to Occi::Core::Entity.kind.type_identifier\n end",
"def get_entity(name)\n # These are the valid entities and their validators are defined\n if [\"Taluk\",\"Panchayat\",\"Place\"].include?(name)\n return name.constantize, name.downcase+\"_params\", name.downcase\n else\n return nil\n end\n end",
"def countries_geo_entity_stats\n countries.present? ? GeoEntityStat.where(geo_entity_id: countries.map(&:id)) : geo_entity_stats\n end",
"def find_mru_entity_types(entity_type, login, amount = 10, already_chosen_ids=[])\n klass = Inflector.constantize(entity_type.entity_type.to_s.camelize)\n \n #This is the case where we have no previously chosen objects,e.g. expressions of a manifestation\n if already_chosen_ids.blank?\n @mru_frbr_objects = klass.find(:all, :limit => amount, \n #Not useful due to batch upload user :conditions => [\"updated_by = ?\", login.login_id],\n :order => 'updated_at desc'\n )\n \n #we need to append a not in clause\n else\n thing_id = entity_type.entity_type + \"_id\"\n @mru_frbr_objects = klass.find(:all, :limit => amount, \n :conditions => [\"#{thing_id} not in (?)\", already_chosen_ids],\n :order => 'updated_at desc'\n )\n end\n \n end",
"def get(type, id)\n case type\n when :company\n Company.new(process_get(\"companies/#{id}\"))\n when :property\n Property.new(process_get(\"properties/#{id}\"))\n when :unit\n Unit.new(process_get(\"units/#{id}\"))\n else\n raise InvalidTypeParam, \"Type not recognized: #{type}\"\n end\n end",
"def entity(index)\n get_field_from_relationship(workspace_id(index), @fields_extra[:entity])\n end",
"def get_entity_type\n return 'county'\n end",
"def get_style(type, id)\n if Weapon_style_by_attribute == true\n # BY ATTRIBUTE\n if type == 0\n item = $data_weapons[id]\n if item.element_set.include?(17)\n #this element means it requires the ability to wield swords\n return 'Sword'\n end\n if item.element_set.include?(18)\n #this element means it requires the ability to wield staffs\n return 'Staff'\n end\n \n end\n if type == 1\n item = $data_armors[id]\n if item.element_set.include?(17)\n #you can re-use elements for armour for example this can mean shield when tagged on armour\n return 'Shield'\n end\n if item.element_set.include?(19)\n #or to avoid confusion you can use differant ones\n return 'Armour'\n end\n end\n return nil\n else\n # BY ID\n if type == 0\n case id\n when 1\n return 'Sword'\n when 29\n return 'Staff' \n end\n end\n if type == 1\n case id\n when 1\n return 'Shield'\n end\n end\n return nil\n end\n end",
"def get_entity_types\n get_types(Occi::Core::Entity.kind)\n end",
"def handle_stat(num)\n return reply( :numeric, ERR_NOSUCHARTICLE, \"no such article found\") if !@current_group\n @current_article_id = num.to_i if num\n article = @current_group[@current_article_id.to_s].values[0]\n if article\n reply :numeric, RPL_STAT, \"#{num} #{article.msgid} article retrieved\"\n reply :raw, article\n reply :done\n else\n reply :numeric, ERR_NOSUCHARTICLE, \"no such article found\"\n end\n end",
"def get_entity_list(entity_type, ns=Model::NS_MMD_1)\n # Search for the first occuring node of type entity which is a child node\n # of the metadata element.\n entity_list = @document.elements[\n \"//[local-name()='metadata' and namespace-uri()='%s']/[local-name()='%s-list' and namespace-uri()='%s'][1]\" %\n [Model::NS_MMD_1, entity_type, ns]]\n \n unless entity_list.nil? or entity_list.is_a? REXML::Text\n collection = Model::ScoredCollection.new(entity_list.attributes['count'],\n entity_list.attributes['offset'])\n # Select the method to use for reading the list.\n read_list_method = method('read_' + entity_list.name.gsub('-', '_'))\n \n # Read the entity list and store the entities in the collection.\n read_list_method.call(entity_list, collection, true) if read_list_method\n \n return collection\n else\n return Model::ScoredCollection.new\n end\n end",
"def parse_test_entity(entity)\n\t\treturn @output[\"#{entity}\".to_sym]\n\tend",
"def service_class_for( entity_type )\n entity_map_cache[ entity_type.to_sym ]\n end",
"def fire_entity_not_found(entity); end",
"def get_top_restaurant(entity_id, entity_type)\n search = \"location_details?entity_id=#{entity_id}&entity_type=#{entity_type}\"\n headers = { user_key: ZOMATO_KEY }\n\n response = HTTParty.get(URL+search, headers: headers)\n\n top_rated_restaurant = response[\"best_rated_restaurant\"][0]\n\n restaurant_keys = [{ name: top_rated_restaurant[\"restaurant\"][\"name\"]},\n { address: top_rated_restaurant[\"restaurant\"][\"location\"][\"address\"]},\n { latitude: top_rated_restaurant[\"restaurant\"][\"location\"][\"latitude\"]},\n { longitude: top_rated_restaurant[\"restaurant\"][\"location\"][\"longitude\"]},\n { avg_price: top_rated_restaurant[\"restaurant\"][\"average_cost_for_two\"]},\n { website: top_rated_restaurant[\"restaurant\"][\"url\"]},\n { currency: top_rated_restaurant[\"restaurant\"][\"currency\"]},\n { zomato_restaurant_id: top_rated_restaurant[\"restaurant\"][\"R\"][\"res_id\"]}]\n\n end",
"def find_contactable contact\n contactable_type = contact.contactable_type\n id_param = contactable_type.classify.constantize.find(contact.contactable_id)\n return contactable = id_param\n end",
"def entity_at_point(x, y)\n all = at(*cell_at_point(x, y)).find_all do |e|\n e.x <= x && e.x > (x - Entity::WIDTH) &&\n e.y <= y && e.y > (y - Entity::HEIGHT)\n end\n raise \"More than one entity at #{x}x#{y}: #{all.inspect}\" if all.size > 1\n all.first\n end",
"def set_entity\n @entity = Entity::Repo.find(params[:id])\n end",
"def get_activities_by_object_type_and_id(object_type, id)\n return @client.raw(\"get\", \"/helpers/activities/#{object_type}/#{id}\")\n end",
"def retrieve_entity\n if self.id\n @entity = Deltacloud::Database::Entity::retrieve(@model)\n if @entity.exists?\n after_retrieve\n end\n else\n @entity = nil\n end\n end",
"def get_trending(enterprise_id, type, opts={})\n ts = opts.fetch(:ts, Time.now.floor)\n args = {\n enterprise_id: enterprise_id,\n ts: opts.fetch(:ts, Time.now.floor),\n type: type\n }\n res = where(args).limit(opts.fetch(:limit, DEFAULT_COUNT))\n enterprise = Octo::Enterprise.find_by_id(enterprise_id)\n if res.count == 0 and enterprise.fakedata?\n Octo.logger.info 'Beginning to fake data'\n res = []\n if ts.class == Range\n ts_begin = ts.begin\n ts_end = ts.end\n ts_begin.to(ts_end, 1.day).each do |_ts|\n 3.times do |rank|\n items = @trend_class.constantize.send(:where, {enterprise_id: enterprise_id}).first(10)\n if items.count > 0\n uid = items.shuffle.pop.unique_id\n _args = args.merge( ts: _ts, rank: rank, score: rank+1, uid: uid )\n res << self.new(_args).save!\n end\n end\n end\n elsif ts.class == Time\n 3.times do |rank|\n uid = 0\n items = @trend_class.constantize.send(:where, {enterprise_id: enterprise_id}).first(10)\n if items.count > 0\n uid = items.shuffle.pop.unique_id\n _args = args.merge( rank: rank, score: rank+1, uid: uid )\n res << self.new(_args).save!\n end\n end\n end\n end\n res.map do |r|\n clazz = @trend_class.constantize\n clazz.public_send(:recreate_from, r)\n end\n end"
]
| [
"0.6633558",
"0.62709147",
"0.60815454",
"0.6045277",
"0.6008174",
"0.5924431",
"0.582173",
"0.5774409",
"0.57586753",
"0.5747536",
"0.57082707",
"0.56715655",
"0.5650089",
"0.5649181",
"0.56151795",
"0.5604592",
"0.5596424",
"0.5546341",
"0.55349576",
"0.5534275",
"0.55285394",
"0.55192965",
"0.54821146",
"0.53806347",
"0.5377024",
"0.5354327",
"0.5349559",
"0.5343768",
"0.53204113",
"0.53168285",
"0.5311445",
"0.5285442",
"0.52789843",
"0.52583367",
"0.5255023",
"0.52536595",
"0.52357364",
"0.5223219",
"0.5207911",
"0.52034426",
"0.519741",
"0.51964253",
"0.51910466",
"0.51565105",
"0.51191455",
"0.511404",
"0.511404",
"0.508565",
"0.5079728",
"0.5073909",
"0.50726634",
"0.5071915",
"0.5070232",
"0.50688565",
"0.50685716",
"0.505185",
"0.50490683",
"0.50490683",
"0.5036889",
"0.50332457",
"0.50324076",
"0.5012214",
"0.5003344",
"0.49969023",
"0.49848917",
"0.49793345",
"0.4967863",
"0.4965815",
"0.49601611",
"0.49433807",
"0.49417886",
"0.4933873",
"0.49210152",
"0.49159133",
"0.49098495",
"0.4909428",
"0.490901",
"0.48758096",
"0.48682034",
"0.48669443",
"0.48540777",
"0.4853952",
"0.48464635",
"0.48429376",
"0.48393717",
"0.4838543",
"0.48313764",
"0.4829807",
"0.48286346",
"0.4825152",
"0.4812847",
"0.48091424",
"0.4803851",
"0.47825092",
"0.4771431",
"0.47644934",
"0.4758527",
"0.4755382",
"0.47550082",
"0.47285324",
"0.47227234"
]
| 0.0 | -1 |
GET /export_budgets GET /export_budgets.json | def index
@export_budgets = ExportBudget.get_export_budgets_by_user current_user
@export_budgets = @export_budgets.page(params[:page]).per(25)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @export_budgets = ExportBudget.all\n end",
"def index\n get_budgets\n end",
"def index\n @budgets = Budget.all\n end",
"def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def set_export_budget\n @export_budget = ExportBudget.find(params[:id])\n end",
"def index\n @budgets = Budget.find_owned_by current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n f = find_budgets\n format.ext_json { render :json => f.to_ext_json(:class => :budget, \n :count => f.length,\n :methods=>[:total_budget_costs,:total_budget_invoices,:total_budget_pricings],\n :include=>{:user=>{:only=>\"login\"}}) }\n \n end\n end",
"def create\n @export_budget = ExportBudget.new(export_budget_params)\n @export_budget.author = current_user\n respond_to do |format|\n if @export_budget.save\n format.html { redirect_to @export_budget, notice: 'Export budget was successfully created.' }\n format.js { }\n format.json { render :back, status: :created, location: @export_budget }\n else\n format.html { render :new }\n format.js { }\n format.json { render json: @export_budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def budgets\n # https://developer.xero.com/documentation/api/budgets\n # if you are having issues in adding the accounting.budgets.read scope, get in touch => [email protected]\n @budgets = xero_client.accounting_api.get_budgets(current_user.active_tenant_id).budgets\n @budget = xero_client.accounting_api.get_budget(current_user.active_tenant_id, @budgets.sample.budget_id).budgets\n end",
"def index\n # TODO: implement filters\n @budgets = Budget.order(\"budgets.starts_at DESC, budgets.number ASC\")\n .page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n #format.select2 { render json: { items: budgets.map(&:to_select2_json), total: @budgets.count} }\n #format.json { render json: @budgets }\n end\n end",
"def create\n @export_budget = ExportBudget.new(params[:export_budget])\n respond_to do |format|\n if @export_budget.save\n @result = 'save'\n format.html { redirect_to :back, notice: 'Export budget was successfully created.' }\n format.js { }\n format.json { render :back, status: :created, location: @export_budget }\n else\n @result = 'not_save'\n format.html { render :new }\n format.js { }\n format.json { render json: @export_budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @export_budget.update(export_budget_params)\n format.html { redirect_to @export_budget, notice: 'Export budget was successfully updated.' }\n format.json { render :show, status: :ok, location: @export_budget }\n else\n format.html { render :edit }\n format.json { render json: @export_budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @export_budget.update(export_budget_params)\n format.html { redirect_to @export_budget, notice: 'Export budget was successfully updated.' }\n format.json { render :show, status: :ok, location: @export_budget }\n else\n format.html { render :edit }\n format.json { render json: @export_budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_export_budget\n # -binding.pry\n @export_budget = ExportBudget.find(params[:id])\n end",
"def index\n @admin_bills = Admin::Bill.where(user_id: current_user.id).paginate(:page => params[:page]).order(\"created_at DESC\")\n @export = Admin::Bill.all.where(user_id: current_user.id)\n respond_to do |format|\n format.html\n format.xlsx {\n response.headers['Content-Disposition'] = 'attachment; filename=\"Bills.xlsx\"'\n }\n format.js { render :layout => false }\n end\n end",
"def index\n @exports = Export.where(warehouse_id: current_merchant_account.warehouse_id)\n respond_to do |format|\n format.html\n format.json { render :json => @exports }\n end\n end",
"def export\n # Get the file of an artifact in a system\n result = SwaggerClient::ArtifactsApi.new.api_systems_system_id_artifacts_export_get(\n options[:systemId], options[:filename], options[:compress], Emasser::GET_ARTIFACTS_RETURN_TYPE\n )\n if options[:compress]\n p result\n else\n begin\n puts JSON.pretty_generate(JSON.parse(result))\n rescue StandardError\n puts result\n end\n end\n rescue SwaggerClient::ApiError => e\n puts 'Exception when calling ArtifactsApi->api_systems_system_id_artifacts_export_get'\n puts to_output_hash(e)\n end",
"def index\n @budgets = Budget.all\n @budgets = Budget.order(params[:by] + \" \" + params[:order]).page params[:page] if params[:sort] == \"true\"\n @budgets = Budget.order(:id).page params[:page]\n end",
"def index\n p \"#{params}\"\n @budget_lines = BudgetLine.all\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def index\n @budgets = Budget.all.paginate(page: params[:page], :per_page => 5).order(\"created_at DESC\")\n end",
"def get_exports_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.get_exports ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_exports, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_exports, must be greater than or equal to 1.'\n end\n\n allowable_values = [\"Coupon\", \"Referral\", \"Effect\", \"CustomerSession\", \"LoyaltyLedger\", \"LoyaltyLedgerLog\", \"Collection\", \"AudienceMembership\"]\n if @api_client.config.client_side_validation && opts[:'entity'] && !allowable_values.include?(opts[:'entity'])\n fail ArgumentError, \"invalid value for \\\"entity\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/v1/exports'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'applicationId'] = opts[:'application_id'] if !opts[:'application_id'].nil?\n query_params[:'campaignId'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil?\n query_params[:'entity'] = opts[:'entity'] if !opts[:'entity'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'InlineResponse20039' \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_exports\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def download\n @plan = Plan.find(params[:id])\n authorize @plan\n @phase_options = @plan.phases.order(:number).pluck(:title, :id)\n @phase_options.insert(0, ['All phases', 'All']) if @phase_options.length > 1\n @export_settings = @plan.settings(:export)\n render 'download'\n end",
"def destroy\n @export_budget.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Export budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @export_budget.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Export budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @budget_dispositions = BudgetDisposition.all\n end",
"def export_budget_params\n # params.require(:export_budget).permit(:year, :title,:town,:pages => [:title_page,:content_page,:last_page,:content => [:public_budget]])\n params.require(:export_budget).permit!\n end",
"def export_budget_params\n params.require(:export_budget).permit(:year, :title, :template, :town_id,:header,:footer)\n end",
"def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end",
"def get_budget_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BudgetApi.get_budget_all_using_get ...'\n end\n # resource path\n local_var_path = '/nucleus/v1/budget'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'currency_conversion'] = opts[:'currency_conversion'] if !opts[:'currency_conversion'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageBudget')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BudgetApi#get_budget_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @budget }\n end\n end",
"def index\n\n @debtors = Debtor.all\n\n render json: @debtors\n end",
"def export\n ret = @uri.export(params[:branchs])\n render plain: ret[:message], status: ret[:status]\n end",
"def index\n\t\t@budget_id = params[:budget_id]\n\t\t@budget = Budget.find(@budget_id)\n\t\t@valorizations = @budget.valorizations\n\t\trender :index, :layout => false\n\tend",
"def show\n add_breadcrumb I18n.t('helpers.breadcrumbs.budgets.show')\n @budget_details = BudgetDetail.all\n\n @budget = Budget.find(params[:id])\n respond_to do |format|\n format.html\n format.pdf do\n pdf = BudgetPdf.new(@budget, view_context)\n send_data pdf.render,\n filename: \"budget_#{@budget.id}.pdf\",\n type: 'application/pdf',\n disposition: 'inline'\n end\n format.json {render json: @budget, include: :budget_details}\n end\n end",
"def show\n load_budget\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budget }\n end\n end",
"def index\n @admin_bill_details = Admin::BillDetail.where(user_id: current_user.id).paginate(:page => params[:page])\n @export = Admin::BillDetail.all.where(user_id: current_user.id)\n respond_to do |format|\n format.html\n format.xlsx {\n response.headers['Content-Disposition'] = 'attachment; filename=\"BillDetails.xlsx\"'\n }\n format.js { render :layout => false }\n end\n end",
"def get_budgets_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BudgetsApi.get_budgets ...'\n end\n # resource path\n local_var_path = '/budgets'\n\n # query parameters\n query_params = {}\n query_params[:'include_accounts'] = opts[:'include_accounts'] if !opts[:'include_accounts'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['bearer']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BudgetSummaryResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BudgetsApi#get_budgets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def export_as_json\n @user = T.must(current_user)\n authorize @user, policy_class: SettingsPolicy\n\n @games = GamePurchase.where(user_id: @user.id).includes(:game, :platforms, :stores)\n\n respond_to do |format|\n format.json do\n export_data = {\n user: {\n id: @user.id,\n username: @user.username\n },\n games: @games.as_json(include: [:game, :platforms, :stores])\n }\n send_data JSON.pretty_generate(export_data), disposition: :json, filename: 'vglist.json'\n end\n end\n end",
"def values_export(params = {})\n @client.get(\"#{path}/values/export.csv\", params)\n end",
"def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to budgets_path }\n format.json { render json: @budget, status: :created, location: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @ptbudgets = Ptbudget.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ptbudgets }\n end\n end",
"def index\n @budget_products = BudgetProduct.all\n end",
"def export\n\n\t\tname_list = []\n\t\tfor name in Name.all\n\t\t\tname_list << [name.sei, name.mei ]\n\t\tend\n\n\t\tFile.open('tmp/names.yml', 'w') {|f|\n\t\t\tf.write YAML.dump(name_list)\n\t\t}\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to :action => :index }\n\t\t\tformat.json { render json: @orders }\n\t\tend\n\tend",
"def index\n @budget_approvers = BudgetApprover.all\n end",
"def index\n @banks = Bank.all\n render json: @banks\n end",
"def index\n @bank_accounts = BankAccount.all\n render :json => @bank_accounts.to_json\n end",
"def index\n @budgetitems = Budgetitem.all.order(:name)\n end",
"def download\n page = params[:page].to_i\n\n a = download_conjugation(page)\n @verbs_conj.each do |verb|\n v = Verb.new(:infinitive => verb[:infinitive], :translation => verb[:translation], :group => verb[:group])\n if v.save\n @tenses.each_with_index do |tense, index|\n @forms.each_with_index do |form, index2|\n if(verb[tense][form].strip != '')\n @form = Form.new(:content => verb[tense][form], :temp => index.to_i, :person => index2.to_i,:verb => v)\n @form.save\n end\n end\n end\n end\n end\n File.open(\"public/temp_#{page}.json\",\"w\") do |f|\n f.write(JSON.pretty_generate(@verbs_conj))\n end\n\n @verbs = Verb.all\n respond_to do |format|\n format.html{ render action: 'index'}\n format.json { head :no_content }\n end\n\n end",
"def export\n\n end",
"def index\n @funds = Fund.all\n\n render json: @funds\n end",
"def get_analytics_reporting_exports_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AnalyticsApi.get_analytics_reporting_exports ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/analytics/reporting/exports\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ReportingExportJobListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AnalyticsApi#get_analytics_reporting_exports\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n \tparams[:search] ? @deliverables = Deliverable.search(params[:search]) : @deliverables = Deliverable.all\n @artifacts = Hash.new\n @deliverables.each do |d|\n \t@artifacts[d.id] = Artifact.find_by_deliverable_id(d.id)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deliverables }\n end\n end",
"def index\n @time = Time.new\n @prev_time = @time - 1.month\n @next_time = @time + 1.month\n @months = [@prev_time, @time, @next_time]\n @month_time_format = \"%B %Y\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end",
"def export\n\n end",
"def index\n @ct_gov_import_exports = CtGovImportExport.all\n end",
"def download\n grade_entry_form = GradeEntryForm.find(params[:id])\n send_data grade_entry_form.export_as_csv,\n disposition: 'attachment',\n type: 'text/csv',\n filename: \"#{grade_entry_form.short_identifier}_grades_report.csv\"\n end",
"def create\n @budget = Budget.new(budget_params)\n respond_to do |format|\n if @budget.save\n \n if !params[:budget][:items].nil?\n params[:budget][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(budget_id: @budget.id)\n end\n end\n \n format.html { redirect_to budgets_path, notice: \"Budget was successfully created.\" }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def export\n send_data current_user.records.select(:json).order('updated_at desc').collect(&:json).to_json, filename: 'records.json'\n end",
"def index\n @budget_for_orders = BudgetForOrder.all.order(\"created_at DESC\")\n end",
"def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end",
"def index\n # TODO: ideally instead of eager loading sells, we could just include\n # quantity_sold in the eager_lod for lots.\n @portfolios = Portfolio.eager_graph(lots: :sells).eager_graph(allocations: {:asset_class => :funds}).all\n\n render json: @portfolios\n end",
"def export\n url = \"#{self.url}/export?auth=#{self.authtoken}\"\n status, response = rest_post( url, nil )\n if ok?( status )\n return status, response['export_count'], response['error_count']\n end\n return status, 0, 0\n end",
"def generate_export_json(output_directory, request, output)\n export = {\n transactionTime: Time.now.strftime(\"%FT%T%:z\"),\n request: request,\n requiresAccessToken: false,\n output: output,\n }\n file_path = File.join(output_directory, \"export.json\")\n File.open(file_path, \"w\") do |file|\n file.write(JSON.pretty_generate(export))\n end\nend",
"def index\n @downloads = Download.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @downloads }\n end\n end",
"def index\n @bucketlist_item = BucketlistItem.all\n # @bucketlist_item = @trip.bucketlist_item\n render json: @bucketlist_item\n end",
"def show\n @item = Item.find(params[:id])\n @requested = @item.rewards.select { |r| !r.premia_sent }.sort_by { |r| r.pledger.name }\n @fulfilled = @item.rewards.select { |r| r.premia_sent }.sort_by { |r| r.pledger.name }\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n format.csv {\n @pledgers = @requested.map(&:pledger).group_by(&:name).map{ |x,y| [y.first, y.count] }\n headers['Content-Disposition'] = \"attachment; filename=\\\"#{@item.name} Requests\\\"\"\n headers['Content-Type'] ||= 'text/csv'\n }\n end\n end",
"def index\n @entries = current_user.entries.for_month(@date)\n @budgets = current_user.budgets\n end",
"def export\n @paystub = Paystub.find(params[:id])\n name = \"#{@paystub.doctor.lname}_#{Date::MONTHNAMES[@paystub.month]}_#{@paystub.year}\"\n @sdate = Date.new(@paystub.year, @paystub.month)\n @edate = 1.month.since(@sdate)\n\n @claims = Claim.joins(:services).where(provider_no: @paystub.doctor.provider_no).where(date_paid: (@sdate..@edate)).group('services.svc_date,pmt_pgm').pluck(:svc_date,Arel.sql('count(distinct claims.id),count(*), pmt_pgm, SUM(amt_subm)/100.0, SUM(amt_paid)/100.0'))\n\n @paystub.update_attribute(:filename, name+'.pdf')\n\n pdf = build_paystub( @paystub,@claims )\n pdf.render_file @paystub.filespec\n redirect_to paystubs_path, alert: \"New paystub created for Dr. #{@paystub.doctor.lname}\"\n end",
"def index\n assign_current_user\n case params['format']\n when 'csv', 'xls', 'xlsx'\n @debts_all = Debt.all\n else\n @debts_all = Debt.paginate(page: params[:page], per_page: 10)\n end\n respond_to do |format|\n format.html\n format.xls\n format.xlsx\n format.csv { send_data @debts_all.to_csv }\n end\n end",
"def index\n @budgets = Budget.where(:session => $sess_name)\n\n end",
"def show\n @budget = Budget.find(params[:id])\n @other_budgets = current_user.budgets conditions: [\"id != ?\", @budget.id]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budget }\n end\n end",
"def index\n authorize! :view, Bill\n @bill = Bill.new\n @bills = Bill.includes(:patient, :claim_type, :insurance_company).order(:date)\n from = params[:from].try(:strftime, \"%d_%m_%Y\")\n to = params[:to].try(:strftime, \"%d_%m_%Y\")\n date_range_name = (from && to) ? \"#{from}_#{to}\" : 'All'\n filename = \"bills_#{date_range_name}.xls\"\n respond_to do |format|\n format.html\n format.js\n format.json { render json: BillDatatable.new(view_context) }\n format.xls { send_data(Bill.to_csv(@bills), filename: filename) }\n end\n end",
"def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render json: @budget, status: :created, location: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @fee_cutting_records }\n format.json { render :text => get_json }\n format.csv { export_csv(@fee_cutting_records,\n { :id => \"id\", :user_id => \"姓名\", :year => \"年度\", :month => \"月份\",\n :room_fee => \"住房公积金\", :med_fee => \"医疗保险\", :elc_fee => \"水电气费\",\n :net_fee => \"上网费\", :job_fee => \"失业保险\", :selfedu_fee => \"职工个人教育费\",\n :other_fee1 => \"其他扣款一\", :other_fee2 => \"其他扣款二\", :other_fee3 => \"其他扣款三\",\n :self_tax => \"个人所得税\"}, \"扣款记录数据.csv\") }\n end\n end",
"def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render json: @budget, status: :created, budget: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_demand_breakdowns }\n end\n end",
"def index\n @transfers = Transfer.all\n render json: @transfers\n end",
"def index\n @financial_aid_packages = @participant.financial_aid_packages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @financial_aid_packages }\n end\n end",
"def create\n @budget = Budget.new(budget_params)\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @budget = Budget.new(budget_params)\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def burndown\n @sprint = Sprint.find(params[:id])\n\n respond_to do |format|\n format.html { \n @graph = open_flash_chart_object(800, 500, url_for( :action => 'burndown', :id => params[:id], :format => :json )) \n }\n format.json { \n chart = @sprint.flash_burndown\n render :text => chart, :layout => false\n }\n end\n end",
"def item_download_counts\n @items = MonthlyItemDownloadCount.unit_download_counts_by_item(\n unit: @unit,\n start_year: params[:from_year].to_i,\n start_month: params[:from_month].to_i,\n end_year: params[:to_year].to_i,\n end_month: params[:to_month].to_i)\n\n # The items array contains item IDs and download counts but not titles.\n # So here we will insert them.\n AscribedElement.\n where(registered_element: @unit.institution.title_element).\n where(item_id: @items.map{ |row| row['id'] }).pluck(:item_id, :string).each do |asc_e|\n row = @items.find{ |r| r['id'] == asc_e[0] }\n row['title'] = asc_e[1] if row\n end\n\n respond_to do |format|\n format.html do\n render partial: \"show_downloads_by_item\"\n end\n format.csv do\n csv = CSV.generate do |csv|\n csv << [\"Month\", \"Downloads\"]\n @items.each do |row|\n csv << row.values\n end\n end\n send_data csv,\n type: \"text/csv\",\n disposition: \"attachment\",\n filename: \"unit_#{@unit.id}_download_counts.csv\"\n end\n end\n end",
"def portfolio_balance_tracking\n total = []\n date_time = []\n portafolio = Portafolio.find_by(id: params[:id])\n portafolio.balance_trackings.each do |record|\n total << record.total\n date_time << record.date_time\n end\n render json: {total: total, date_time: date_time}\n end",
"def new\n @budget = Budget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budget }\n end\n end",
"def generate_bulk_export\n # Delete the bulk_export directory if it exists.\n FileUtils.rm_rf(\"bulk_export\")\n\n get_all_insurance_plans\n get_all_location_resources\n p \"===============================================================\"\n p \"Creating the Bulk export folder output ...\"\n generate_payer_bulk_data\n generate_formulary_bulk_data\nend",
"def index\n @down_sizes = DownSize.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @down_sizes }\n end\n end",
"def download\n @posts = PostService.getAllPosts\n respond_to do |format|\n format.html\n format.csv { send_data @posts.to_csv, :filename => \"Post List.csv\" }\n end\n end",
"def list_exports_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ExportsApi.list_exports ...'\n end\n # resource path\n local_var_path = '/data/v1/exports'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['accessToken']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ListExportsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ExportsApi#list_exports\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def export_assets project_id:, dump_file_path:\n # [START asset_quickstart_export_assets]\n require \"google/cloud/asset\"\n\n asset_service = Google::Cloud::Asset.asset_service\n # project_id = 'YOUR_PROJECT_ID'\n formatted_parent = asset_service.project_path project: project_id\n # Assets dump file path, e.g.: gs://[YOUR_BUCKET]/[YOUR_ASSETS_FILE]\n # dump_file_path = 'YOUR_ASSET_DUMP_FILE_PATH'\n output_config = {\n gcs_destination: {\n uri: dump_file_path\n }\n }\n\n operation = asset_service.export_assets(\n parent: formatted_parent, output_config: output_config\n ) do |op|\n # Handle the error.\n raise op.results.message if op.error?\n end\n\n operation.wait_until_done!\n response = operation.response\n puts \"Exported assets to: #{response.output_config.gcs_destination.uri}\"\n # Do things with the result\n # [END asset_quickstart_export_assets]\nend",
"def index\n @bankdeposits = Bankdeposit.all\n end",
"def export\n @transactions = Transaction.find_all_by_user_id(current_user.id)\n csv = \"\"\n i = 0\n @transactions.each do |trans|\n if (i==0)\n csv += trans.to_csv(true)\n else\n csv += trans.to_csv(false)\n end\n i += 1\n end\n\n respond_to do |format|\n format.csv { send_data csv }\n end\n end",
"def index\n @export_types = ExportType.all\n end",
"def export_all\n headers['Content-Type'] = \"application/vnd.ms-excel\"\n headers['Content-Disposition'] = 'attachment; filename=\"report.xls\"'\n headers['Cache-Control'] = ''\n #SQL QUERY INTO XLS FORMAT\n @bands = PledgedBand.find_by_sql \"SELECT pledged_bands.name, pledged_bands.pledges_count, fans.first_name, fans.last_name, fans.email, pledges.created_at FROM pledged_bands LEFT JOIN pledges ON pledged_bands.id = pledges.pledged_band_id LEFT JOIN fans on pledges.fan_id = fans.id\"\n end",
"def new\n @budget = Budget.new\n @budgetProducts = []\n @customer = Customer.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budget }\n end\n end",
"def to_file\n tempfile = Tempfile.new('part_export')\n File.write(tempfile, sorted_requests.map(&:to_json).join(\"\\n\"))\n tempfile\n end",
"def index\n @bids = Bid.includes(:user, :game_round).order(created_at: :desc).paginate(:page => params[:page])\n respond_to do |format|\n format.html\n format.csv do\n csv_file_name = \"bid_records.csv\"\n send_data Bid.generate_csv(@bids, col_sep: \",\"), filename: csv_file_name\n end\n end\n end",
"def get_export_task_0_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyTaskApi.get_export_task_0 ...'\n end\n # resource path\n local_var_path = '/infra/settings/firewall/export'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ExportTask')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyTaskApi#get_export_task_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list_exports(db)\n db.query(\"SELECT e.id, e.dataset, e.path, r.root_dataset, r.root_path FROM storage_export e\n\t\t INNER JOIN storage_root r ON r.id = e.root_id\n\t\t WHERE\n\t\t e.`default` = 'no' AND\n\t\t r.node_id = #{$CFG.get(:vpsadmin, :server_id)}\")\n end",
"def index\n @subsedes = Subsede.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subsedes }\n end\n end",
"def getbalance(args={})\n {\n :method=> \"GetBalances\"\n }.to_json\n end"
]
| [
"0.7589122",
"0.6765112",
"0.6594881",
"0.65468884",
"0.64546865",
"0.6392319",
"0.62771064",
"0.6250989",
"0.6243598",
"0.61574376",
"0.60981613",
"0.6057186",
"0.6057186",
"0.6053283",
"0.59907717",
"0.59508246",
"0.59342587",
"0.59255177",
"0.5895308",
"0.58896405",
"0.58881277",
"0.58729976",
"0.58272505",
"0.58272505",
"0.5795287",
"0.5779297",
"0.57690287",
"0.57672894",
"0.57617563",
"0.5760935",
"0.57593715",
"0.57552755",
"0.5750195",
"0.57411265",
"0.5738343",
"0.57154584",
"0.5713159",
"0.5708018",
"0.56882864",
"0.56649953",
"0.5661707",
"0.565765",
"0.56526816",
"0.5635651",
"0.5627322",
"0.56164217",
"0.5604589",
"0.55911255",
"0.5587142",
"0.5568471",
"0.5567778",
"0.5551404",
"0.5550225",
"0.55501795",
"0.55220056",
"0.5509525",
"0.5509052",
"0.5507761",
"0.5501467",
"0.54972243",
"0.5491861",
"0.54762894",
"0.54703265",
"0.5468657",
"0.54420346",
"0.5438265",
"0.54372454",
"0.54346585",
"0.5419914",
"0.54178786",
"0.5417319",
"0.54157317",
"0.54154354",
"0.54150707",
"0.54146576",
"0.54090285",
"0.54082215",
"0.54071987",
"0.54045635",
"0.5403802",
"0.5402509",
"0.5397354",
"0.539327",
"0.5373264",
"0.53649753",
"0.5356867",
"0.53288686",
"0.53279924",
"0.532371",
"0.5320008",
"0.53189784",
"0.53170073",
"0.53155416",
"0.53135574",
"0.5313455",
"0.5309108",
"0.5309101",
"0.5307661",
"0.53055537",
"0.53050303"
]
| 0.7251409 | 1 |
GET /export_budgets/1 GET /export_budgets/1.json | def show
respond_to do |format|
format.html
format.pdf {
render pdf: @export_budget.title,
formats: [:html],
template: 'export_budgets/create_pdf.html.haml',
show_as_html: params.key?('debug')
}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @export_budgets = ExportBudget.all\n end",
"def index\n @export_budgets = ExportBudget.get_export_budgets_by_user current_user\n @export_budgets = @export_budgets.page(params[:page]).per(25)\n end",
"def set_export_budget\n @export_budget = ExportBudget.find(params[:id])\n end",
"def index\n get_budgets\n end",
"def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def index\n @budgets = Budget.all\n end",
"def set_export_budget\n # -binding.pry\n @export_budget = ExportBudget.find(params[:id])\n end",
"def create\n @export_budget = ExportBudget.new(export_budget_params)\n @export_budget.author = current_user\n respond_to do |format|\n if @export_budget.save\n format.html { redirect_to @export_budget, notice: 'Export budget was successfully created.' }\n format.js { }\n format.json { render :back, status: :created, location: @export_budget }\n else\n format.html { render :new }\n format.js { }\n format.json { render json: @export_budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @export_budget.update(export_budget_params)\n format.html { redirect_to @export_budget, notice: 'Export budget was successfully updated.' }\n format.json { render :show, status: :ok, location: @export_budget }\n else\n format.html { render :edit }\n format.json { render json: @export_budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @export_budget.update(export_budget_params)\n format.html { redirect_to @export_budget, notice: 'Export budget was successfully updated.' }\n format.json { render :show, status: :ok, location: @export_budget }\n else\n format.html { render :edit }\n format.json { render json: @export_budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @budgets = Budget.find_owned_by current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end",
"def create\n @export_budget = ExportBudget.new(params[:export_budget])\n respond_to do |format|\n if @export_budget.save\n @result = 'save'\n format.html { redirect_to :back, notice: 'Export budget was successfully created.' }\n format.js { }\n format.json { render :back, status: :created, location: @export_budget }\n else\n @result = 'not_save'\n format.html { render :new }\n format.js { }\n format.json { render json: @export_budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n f = find_budgets\n format.ext_json { render :json => f.to_ext_json(:class => :budget, \n :count => f.length,\n :methods=>[:total_budget_costs,:total_budget_invoices,:total_budget_pricings],\n :include=>{:user=>{:only=>\"login\"}}) }\n \n end\n end",
"def index\n # TODO: implement filters\n @budgets = Budget.order(\"budgets.starts_at DESC, budgets.number ASC\")\n .page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n #format.select2 { render json: { items: budgets.map(&:to_select2_json), total: @budgets.count} }\n #format.json { render json: @budgets }\n end\n end",
"def index\n @exports = Export.where(warehouse_id: current_merchant_account.warehouse_id)\n respond_to do |format|\n format.html\n format.json { render :json => @exports }\n end\n end",
"def budgets\n # https://developer.xero.com/documentation/api/budgets\n # if you are having issues in adding the accounting.budgets.read scope, get in touch => [email protected]\n @budgets = xero_client.accounting_api.get_budgets(current_user.active_tenant_id).budgets\n @budget = xero_client.accounting_api.get_budget(current_user.active_tenant_id, @budgets.sample.budget_id).budgets\n end",
"def destroy\n @export_budget.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Export budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @export_budget.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Export budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def export\n # Get the file of an artifact in a system\n result = SwaggerClient::ArtifactsApi.new.api_systems_system_id_artifacts_export_get(\n options[:systemId], options[:filename], options[:compress], Emasser::GET_ARTIFACTS_RETURN_TYPE\n )\n if options[:compress]\n p result\n else\n begin\n puts JSON.pretty_generate(JSON.parse(result))\n rescue StandardError\n puts result\n end\n end\n rescue SwaggerClient::ApiError => e\n puts 'Exception when calling ArtifactsApi->api_systems_system_id_artifacts_export_get'\n puts to_output_hash(e)\n end",
"def show\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @budget }\n end\n end",
"def get_exports_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.get_exports ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_exports, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_exports, must be greater than or equal to 1.'\n end\n\n allowable_values = [\"Coupon\", \"Referral\", \"Effect\", \"CustomerSession\", \"LoyaltyLedger\", \"LoyaltyLedgerLog\", \"Collection\", \"AudienceMembership\"]\n if @api_client.config.client_side_validation && opts[:'entity'] && !allowable_values.include?(opts[:'entity'])\n fail ArgumentError, \"invalid value for \\\"entity\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/v1/exports'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'applicationId'] = opts[:'application_id'] if !opts[:'application_id'].nil?\n query_params[:'campaignId'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil?\n query_params[:'entity'] = opts[:'entity'] if !opts[:'entity'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'InlineResponse20039' \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_exports\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @admin_bills = Admin::Bill.where(user_id: current_user.id).paginate(:page => params[:page]).order(\"created_at DESC\")\n @export = Admin::Bill.all.where(user_id: current_user.id)\n respond_to do |format|\n format.html\n format.xlsx {\n response.headers['Content-Disposition'] = 'attachment; filename=\"Bills.xlsx\"'\n }\n format.js { render :layout => false }\n end\n end",
"def show\n add_breadcrumb I18n.t('helpers.breadcrumbs.budgets.show')\n @budget_details = BudgetDetail.all\n\n @budget = Budget.find(params[:id])\n respond_to do |format|\n format.html\n format.pdf do\n pdf = BudgetPdf.new(@budget, view_context)\n send_data pdf.render,\n filename: \"budget_#{@budget.id}.pdf\",\n type: 'application/pdf',\n disposition: 'inline'\n end\n format.json {render json: @budget, include: :budget_details}\n end\n end",
"def index\n @budget_dispositions = BudgetDisposition.all\n end",
"def download\n @plan = Plan.find(params[:id])\n authorize @plan\n @phase_options = @plan.phases.order(:number).pluck(:title, :id)\n @phase_options.insert(0, ['All phases', 'All']) if @phase_options.length > 1\n @export_settings = @plan.settings(:export)\n render 'download'\n end",
"def show\n load_budget\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budget }\n end\n end",
"def index\n @budgets = Budget.all\n @budgets = Budget.order(params[:by] + \" \" + params[:order]).page params[:page] if params[:sort] == \"true\"\n @budgets = Budget.order(:id).page params[:page]\n end",
"def index\n @budgets = Budget.all.paginate(page: params[:page], :per_page => 5).order(\"created_at DESC\")\n end",
"def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to budgets_path }\n format.json { render json: @budget, status: :created, location: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def export_budget_params\n params.require(:export_budget).permit(:year, :title, :template, :town_id,:header,:footer)\n end",
"def export_budget_params\n # params.require(:export_budget).permit(:year, :title,:town,:pages => [:title_page,:content_page,:last_page,:content => [:public_budget]])\n params.require(:export_budget).permit!\n end",
"def index\n p \"#{params}\"\n @budget_lines = BudgetLine.all\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def index\n @admin_bill_details = Admin::BillDetail.where(user_id: current_user.id).paginate(:page => params[:page])\n @export = Admin::BillDetail.all.where(user_id: current_user.id)\n respond_to do |format|\n format.html\n format.xlsx {\n response.headers['Content-Disposition'] = 'attachment; filename=\"BillDetails.xlsx\"'\n }\n format.js { render :layout => false }\n end\n end",
"def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end",
"def get_budget_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BudgetApi.get_budget_all_using_get ...'\n end\n # resource path\n local_var_path = '/nucleus/v1/budget'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'currency_conversion'] = opts[:'currency_conversion'] if !opts[:'currency_conversion'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageBudget')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BudgetApi#get_budget_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_analytics_reporting_exports_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AnalyticsApi.get_analytics_reporting_exports ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/analytics/reporting/exports\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ReportingExportJobListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AnalyticsApi#get_analytics_reporting_exports\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def export\n url = \"#{self.url}/export?auth=#{self.authtoken}\"\n status, response = rest_post( url, nil )\n if ok?( status )\n return status, response['export_count'], response['error_count']\n end\n return status, 0, 0\n end",
"def new\n @budget = Budget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budget }\n end\n end",
"def values_export(params = {})\n @client.get(\"#{path}/values/export.csv\", params)\n end",
"def index\n\t\t@budget_id = params[:budget_id]\n\t\t@budget = Budget.find(@budget_id)\n\t\t@valorizations = @budget.valorizations\n\t\trender :index, :layout => false\n\tend",
"def export\n ret = @uri.export(params[:branchs])\n render plain: ret[:message], status: ret[:status]\n end",
"def create\n @budget = Budget.new(budget_params)\n respond_to do |format|\n if @budget.save\n \n if !params[:budget][:items].nil?\n params[:budget][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(budget_id: @budget.id)\n end\n end\n \n format.html { redirect_to budgets_path, notice: \"Budget was successfully created.\" }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_budgets_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BudgetsApi.get_budgets ...'\n end\n # resource path\n local_var_path = '/budgets'\n\n # query parameters\n query_params = {}\n query_params[:'include_accounts'] = opts[:'include_accounts'] if !opts[:'include_accounts'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['bearer']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BudgetSummaryResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BudgetsApi#get_budgets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @budget_products = BudgetProduct.all\n end",
"def index\n @downloads = Download.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @downloads }\n end\n end",
"def index\n @ptbudgets = Ptbudget.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ptbudgets }\n end\n end",
"def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render json: @budget, status: :created, budget: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render json: @budget, status: :created, location: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_export_task_0_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyTaskApi.get_export_task_0 ...'\n end\n # resource path\n local_var_path = '/infra/settings/firewall/export'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ExportTask')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyTaskApi#get_export_task_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @banks = Bank.all\n render json: @banks\n end",
"def create\n @budget = Budget.new(budget_params)\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @budget = Budget.new(budget_params)\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @export_run = ExportRun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @export_run }\n end\n end",
"def new\n @budget = Budget.new\n\n respond_to do |format|\n format.html # new.html.erb\n # format.json { render json: @budget }\n end\n end",
"def index\n\n @debtors = Debtor.all\n\n render json: @debtors\n end",
"def index\n @time = Time.new\n @prev_time = @time - 1.month\n @next_time = @time + 1.month\n @months = [@prev_time, @time, @next_time]\n @month_time_format = \"%B %Y\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end",
"def index\n @budget_approvers = BudgetApprover.all\n end",
"def index\n @budgetitems = Budgetitem.all.order(:name)\n end",
"def index\n @bank_accounts = BankAccount.all\n render :json => @bank_accounts.to_json\n end",
"def show\n @budget = Budget.find(params[:id])\n @other_budgets = current_user.budgets conditions: [\"id != ?\", @budget.id]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budget }\n end\n end",
"def index\n @ct_gov_import_exports = CtGovImportExport.all\n end",
"def burndown\n @sprint = Sprint.find(params[:id])\n\n respond_to do |format|\n format.html { \n @graph = open_flash_chart_object(800, 500, url_for( :action => 'burndown', :id => params[:id], :format => :json )) \n }\n format.json { \n chart = @sprint.flash_burndown\n render :text => chart, :layout => false\n }\n end\n end",
"def index\n \tparams[:search] ? @deliverables = Deliverable.search(params[:search]) : @deliverables = Deliverable.all\n @artifacts = Hash.new\n @deliverables.each do |d|\n \t@artifacts[d.id] = Artifact.find_by_deliverable_id(d.id)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deliverables }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @export }\n end\n end",
"def export\n @paystub = Paystub.find(params[:id])\n name = \"#{@paystub.doctor.lname}_#{Date::MONTHNAMES[@paystub.month]}_#{@paystub.year}\"\n @sdate = Date.new(@paystub.year, @paystub.month)\n @edate = 1.month.since(@sdate)\n\n @claims = Claim.joins(:services).where(provider_no: @paystub.doctor.provider_no).where(date_paid: (@sdate..@edate)).group('services.svc_date,pmt_pgm').pluck(:svc_date,Arel.sql('count(distinct claims.id),count(*), pmt_pgm, SUM(amt_subm)/100.0, SUM(amt_paid)/100.0'))\n\n @paystub.update_attribute(:filename, name+'.pdf')\n\n pdf = build_paystub( @paystub,@claims )\n pdf.render_file @paystub.filespec\n redirect_to paystubs_path, alert: \"New paystub created for Dr. #{@paystub.doctor.lname}\"\n end",
"def new\n @budget = Budget.new\n @budgetProducts = []\n @customer = Customer.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budget }\n end\n end",
"def index\n @funds = Fund.all\n\n render json: @funds\n end",
"def show\n @packages = @batch.packages.in_progress.where(:requires_approval => true).order(\"status_id desc\").page(params[:page])\n @failures = @batch.tasks.where(status_id: Status.failed.id).count\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @batch }\n end\n end",
"def download\n grade_entry_form = GradeEntryForm.find(params[:id])\n send_data grade_entry_form.export_as_csv,\n disposition: 'attachment',\n type: 'text/csv',\n filename: \"#{grade_entry_form.short_identifier}_grades_report.csv\"\n end",
"def show\n @item = Item.find(params[:id])\n @requested = @item.rewards.select { |r| !r.premia_sent }.sort_by { |r| r.pledger.name }\n @fulfilled = @item.rewards.select { |r| r.premia_sent }.sort_by { |r| r.pledger.name }\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n format.csv {\n @pledgers = @requested.map(&:pledger).group_by(&:name).map{ |x,y| [y.first, y.count] }\n headers['Content-Disposition'] = \"attachment; filename=\\\"#{@item.name} Requests\\\"\"\n headers['Content-Type'] ||= 'text/csv'\n }\n end\n end",
"def index\n @budgets = Budget.where(:session => $sess_name)\n\n end",
"def item_download_counts\n @items = MonthlyItemDownloadCount.unit_download_counts_by_item(\n unit: @unit,\n start_year: params[:from_year].to_i,\n start_month: params[:from_month].to_i,\n end_year: params[:to_year].to_i,\n end_month: params[:to_month].to_i)\n\n # The items array contains item IDs and download counts but not titles.\n # So here we will insert them.\n AscribedElement.\n where(registered_element: @unit.institution.title_element).\n where(item_id: @items.map{ |row| row['id'] }).pluck(:item_id, :string).each do |asc_e|\n row = @items.find{ |r| r['id'] == asc_e[0] }\n row['title'] = asc_e[1] if row\n end\n\n respond_to do |format|\n format.html do\n render partial: \"show_downloads_by_item\"\n end\n format.csv do\n csv = CSV.generate do |csv|\n csv << [\"Month\", \"Downloads\"]\n @items.each do |row|\n csv << row.values\n end\n end\n send_data csv,\n type: \"text/csv\",\n disposition: \"attachment\",\n filename: \"unit_#{@unit.id}_download_counts.csv\"\n end\n end\n end",
"def download\n page = params[:page].to_i\n\n a = download_conjugation(page)\n @verbs_conj.each do |verb|\n v = Verb.new(:infinitive => verb[:infinitive], :translation => verb[:translation], :group => verb[:group])\n if v.save\n @tenses.each_with_index do |tense, index|\n @forms.each_with_index do |form, index2|\n if(verb[tense][form].strip != '')\n @form = Form.new(:content => verb[tense][form], :temp => index.to_i, :person => index2.to_i,:verb => v)\n @form.save\n end\n end\n end\n end\n end\n File.open(\"public/temp_#{page}.json\",\"w\") do |f|\n f.write(JSON.pretty_generate(@verbs_conj))\n end\n\n @verbs = Verb.all\n respond_to do |format|\n format.html{ render action: 'index'}\n format.json { head :no_content }\n end\n\n end",
"def index\n @budget_for_orders = BudgetForOrder.all.order(\"created_at DESC\")\n end",
"def index\n @bucketlist_item = BucketlistItem.all\n # @bucketlist_item = @trip.bucketlist_item\n render json: @bucketlist_item\n end",
"def export_as_json\n @user = T.must(current_user)\n authorize @user, policy_class: SettingsPolicy\n\n @games = GamePurchase.where(user_id: @user.id).includes(:game, :platforms, :stores)\n\n respond_to do |format|\n format.json do\n export_data = {\n user: {\n id: @user.id,\n username: @user.username\n },\n games: @games.as_json(include: [:game, :platforms, :stores])\n }\n send_data JSON.pretty_generate(export_data), disposition: :json, filename: 'vglist.json'\n end\n end\n end",
"def bitbucket_sync_export_with_http_info(id, bitbucket_sync_export_parameters, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BitbucketSyncApi.bitbucket_sync_export ...'\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 BitbucketSyncApi.bitbucket_sync_export\"\n end\n # verify the required parameter 'bitbucket_sync_export_parameters' is set\n if @api_client.config.client_side_validation && bitbucket_sync_export_parameters.nil?\n fail ArgumentError, \"Missing the required parameter 'bitbucket_sync_export_parameters' when calling BitbucketSyncApi.bitbucket_sync_export\"\n end\n # resource path\n local_var_path = '/bitbucket_syncs/{id}/export'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(bitbucket_sync_export_parameters) \n\n # return_type\n return_type = opts[:return_type] || 'BitbucketSyncExportResponse' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\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(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BitbucketSyncApi#bitbucket_sync_export\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end",
"def index\n @down_sizes = DownSize.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @down_sizes }\n end\n end",
"def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_demand_breakdowns }\n end\n end",
"def export\n\n end",
"def new\n @export_run = ExportRun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @export_run }\n end\n end",
"def datevdownload\n if params[:account][:export_fixed_at_start_date]\n date_from = params[:account][:export_fixed_at_start_date]\n else\n date_from = Date.today.beginning_of_month\n end\n if params[:account][:export_fixed_at_end_date]\n date_to = params[:account][:export_fixed_at_end_date]\n else\n date_to = Date.today.end_of_month\n end\n #@contacts = Billing::Businessdocument.joins(:contact).where(\"businessdocuments.type='Billing::Invoice' or businessdocuments.type='Billing::Cancellation'\")\n @contact_ids = ''\n @businessdocumentpositions = Billing::Businessdocumentposition.includes(:businessdocument, :vat).where(\"(businessdocuments.type='Billing::Invoice' or businessdocuments.type='Billing::Cancellation') and invoice_number IS NOT NULL and invoice_date >= '#{date_from}' AND invoice_date <= '#{date_to}'\").order(\"businessdocuments.invoice_number, businessdocuments.id, businessdocumentpositions.position, businessdocumentpositions.id\")\n @businessdocuments = Billing::Businessdocument.where(\"(businessdocuments.type='Billing::Invoice' or businessdocuments.type='Billing::Cancellation') and invoice_date >= '#{date_from}' AND invoice_date <= '#{date_to}'\").order(\"businessdocuments.invoice_number, businessdocuments.id\")\n\n @account = current_tenant\n if params[:account][:export_fixed_at_start_date] and params[:account][:export_fixed_at_end_date]\n @account.tax_consultant_id = params[:account][:tax_consultant_id]\n @account.tax_consultant_client_id = params[:account][:tax_consultant_client_id]\n @account.revenue_account = params[:account][:revenue_account]\n @account.export_fixed_at_start_date = params[:account][:export_fixed_at_start_date]\n @account.export_fixed_at_end_date = params[:account][:export_fixed_at_end_date]\n @account.save\n end\n respond_to do |format|\n format.xlsx {\n authorize_feature! 'csv_export'\n response.headers['Content-Disposition'] = 'attachment; filename=' + \"EXTF_#{I18n.t(:invoicelist)}-#{Date.today}.xlsx\"\n }\n # format.csv {\n # authorize_feature! 'csv_export'\n # response.headers['Content-Disposition'] = 'attachment; filename=' + \"#{I18n.t(:datevexport_csv_filename, startdate: @account.export_fixed_at_start_date.to_s, enddate: @account.export_fixed_at_end_date.to_s, createdate: Date.today.to_s)}.csv\"\n # }\n format.csv do\n require 'zip'\n\n authorize_feature! 'csv_export'\n\n # create tmp_file with account id to ensure unique filenames\n tmp_dir = Rails.root.join('tmp', @account.id.to_s)\n Dir.mkdir(tmp_dir) unless File.exists?(tmp_dir)\n\n tmp_dir = Rails.root.join(tmp_dir, current_user.id.to_s)\n Dir.mkdir(tmp_dir) unless File.exists?(tmp_dir)\n\n\n start_date_short = (l @account.export_fixed_at_start_date, format: '%Y%m%d').to_s\n end_date_short = (l @account.export_fixed_at_end_date, format: '%Y%m%d').to_s\n today_short = (l Date.today, format: '%Y%m%d').to_s\n\n zip_file_name = \"DATEV-Export_#{t(:from)}_#{start_date_short}_#{t(:until)}_#{end_date_short}_erstellt_#{today_short}.zip\"\n\n filename_accounts = \"EXTF_GP_Stamm_#{(l Date.today, format: '%Y%m%d')}.csv\"\n filename_batch = \"EXTF_Buchungsstapel_#{(@account.export_fixed_at_start_date.blank? ? '' : (l @account.export_fixed_at_start_date, format: '%Y%m%d').to_s)}_bis_#{(@account.export_fixed_at_end_date.blank? ? '' : (l @account.export_fixed_at_end_date, format: '%Y%m%d').to_s)}.csv\"\n\n zip_file_path = Rails.root.join(tmp_dir, zip_file_name)\n File.delete(zip_file_path) if File.exist?(zip_file_path)\n\n Zip::ZipFile.open(zip_file_path.to_s, Zip::ZipFile::CREATE) do |zipfile|\n zipfile.get_output_stream(filename_accounts) { |f| f.write BusinessdocumentExportDatevCsv.new.get_contacts(@account, @businessdocumentpositions) }\n zipfile.get_output_stream(filename_batch) { |f| f.write BusinessdocumentExportDatevCsv.new.get_invoicepositions(@account, @businessdocumentpositions, date_from, date_to) }\n end\n\n send_file(zip_file_path, :type => 'application/zip', :disposition => 'attachment', :filename => zip_file_name)\n\n end\n end\n end",
"def index\n @transfers = Transfer.all\n render json: @transfers\n end",
"def export\n\n end",
"def show\n @balance = Compta::Balance.new({period_id:@period.id}.merge @params_balance)\n send_export_token\n if @balance.valid?\n respond_to do |format|\n \n format.html \n format.js\n format.csv { send_data @balance.to_csv, filename:export_filename(@balance, :csv) } \n format.xls { send_data @balance.to_xls, filename:export_filename(@balance, :csv)}\n format.pdf { send_data @balance.to_pdf, filename:export_filename(@balance, :pdf)}\n end\n else\n redirect_to new_compta_period_balance_url(@period)\n \n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @fee_cutting_records }\n format.json { render :text => get_json }\n format.csv { export_csv(@fee_cutting_records,\n { :id => \"id\", :user_id => \"姓名\", :year => \"年度\", :month => \"月份\",\n :room_fee => \"住房公积金\", :med_fee => \"医疗保险\", :elc_fee => \"水电气费\",\n :net_fee => \"上网费\", :job_fee => \"失业保险\", :selfedu_fee => \"职工个人教育费\",\n :other_fee1 => \"其他扣款一\", :other_fee2 => \"其他扣款二\", :other_fee3 => \"其他扣款三\",\n :self_tax => \"个人所得税\"}, \"扣款记录数据.csv\") }\n end\n end",
"def export\n send_data current_user.records.select(:json).order('updated_at desc').collect(&:json).to_json, filename: 'records.json'\n end",
"def index\n @export_types = ExportType.all\n end",
"def getbalance(args={})\n {\n :method=> \"GetBalances\"\n }.to_json\n end",
"def get_export_task_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyTaskApi.get_export_task ...'\n end\n # resource path\n local_var_path = '/global-infra/settings/firewall/export'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ExportTask')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyTaskApi#get_export_task\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n authorize! :view, Bill\n @bill = Bill.new\n @bills = Bill.includes(:patient, :claim_type, :insurance_company).order(:date)\n from = params[:from].try(:strftime, \"%d_%m_%Y\")\n to = params[:to].try(:strftime, \"%d_%m_%Y\")\n date_range_name = (from && to) ? \"#{from}_#{to}\" : 'All'\n filename = \"bills_#{date_range_name}.xls\"\n respond_to do |format|\n format.html\n format.js\n format.json { render json: BillDatatable.new(view_context) }\n format.xls { send_data(Bill.to_csv(@bills), filename: filename) }\n end\n end",
"def activity_line_items\n\n get_projects\n\n respond_to do |format|\n format.xlsx do\n response.headers['Content-Disposition'] = \"attachment; filename=Activity Line Items Table Export.xlsx\"\n end\n end\n end",
"def set_budget\n @budget = Budget.find(params[:id])\n end",
"def list_exports_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ExportsApi.list_exports ...'\n end\n # resource path\n local_var_path = '/data/v1/exports'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['accessToken']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ListExportsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ExportsApi#list_exports\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n assign_current_user\n case params['format']\n when 'csv', 'xls', 'xlsx'\n @debts_all = Debt.all\n else\n @debts_all = Debt.paginate(page: params[:page], per_page: 10)\n end\n respond_to do |format|\n format.html\n format.xls\n format.xlsx\n format.csv { send_data @debts_all.to_csv }\n end\n end",
"def create\n @budget = Budget.new(budget_params)\n @client = Client.new\n @clients = Client.all\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'El presupuesto se creó correctamente' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generate_export_json(output_directory, request, output)\n export = {\n transactionTime: Time.now.strftime(\"%FT%T%:z\"),\n request: request,\n requiresAccessToken: false,\n output: output,\n }\n file_path = File.join(output_directory, \"export.json\")\n File.open(file_path, \"w\") do |file|\n file.write(JSON.pretty_generate(export))\n end\nend",
"def show\n @financial_aid_package = @participant.financial_aid_packages.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @financial_aid_package.to_json(methods: [:breakdown]) }\n end\n end",
"def export\n\n\t\tname_list = []\n\t\tfor name in Name.all\n\t\t\tname_list << [name.sei, name.mei ]\n\t\tend\n\n\t\tFile.open('tmp/names.yml', 'w') {|f|\n\t\t\tf.write YAML.dump(name_list)\n\t\t}\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to :action => :index }\n\t\t\tformat.json { render json: @orders }\n\t\tend\n\tend",
"def index\n @financial_aid_packages = @participant.financial_aid_packages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @financial_aid_packages }\n end\n end"
]
| [
"0.7548582",
"0.71902925",
"0.6794416",
"0.6652618",
"0.66223776",
"0.6508981",
"0.6422111",
"0.6389017",
"0.6345606",
"0.6345606",
"0.63383055",
"0.63162136",
"0.6138084",
"0.6087938",
"0.60656977",
"0.60319436",
"0.6016057",
"0.6016057",
"0.600245",
"0.5995106",
"0.5991982",
"0.5941856",
"0.59200644",
"0.5879064",
"0.58757484",
"0.58717287",
"0.58610064",
"0.58110327",
"0.5809987",
"0.57976717",
"0.5794153",
"0.57412696",
"0.5740117",
"0.5715681",
"0.5699031",
"0.5656728",
"0.5651464",
"0.56445587",
"0.5640366",
"0.5638584",
"0.56356853",
"0.5632019",
"0.55998015",
"0.55963624",
"0.5596208",
"0.55959034",
"0.5586084",
"0.55796736",
"0.5565296",
"0.55462736",
"0.5545539",
"0.5544686",
"0.55276084",
"0.55199224",
"0.5519306",
"0.55180484",
"0.5517361",
"0.55155766",
"0.5512667",
"0.5509183",
"0.5507948",
"0.55001265",
"0.54925674",
"0.5485417",
"0.5482879",
"0.5477915",
"0.54752696",
"0.54692465",
"0.5467153",
"0.54670113",
"0.5466347",
"0.545735",
"0.54384005",
"0.5435615",
"0.54337585",
"0.5432016",
"0.54308206",
"0.54155415",
"0.5414292",
"0.5405576",
"0.5398639",
"0.5394203",
"0.53864825",
"0.53643316",
"0.5355727",
"0.5352174",
"0.5349611",
"0.5348354",
"0.53477776",
"0.53470904",
"0.5346228",
"0.53452134",
"0.53424186",
"0.53400344",
"0.5336286",
"0.53307235",
"0.5327174",
"0.5325383",
"0.53217363",
"0.5318864",
"0.5316605"
]
| 0.0 | -1 |
POST /export_budgets POST /export_budgets.json | def create
@export_budget = ExportBudget.new(export_budget_params)
@export_budget.author = current_user
respond_to do |format|
if @export_budget.save
format.html { redirect_to @export_budget, notice: 'Export budget was successfully created.' }
format.js { }
format.json { render :back, status: :created, location: @export_budget }
else
format.html { render :new }
format.js { }
format.json { render json: @export_budget.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @export_budgets = ExportBudget.all\n end",
"def create\n @export_budget = ExportBudget.new(params[:export_budget])\n respond_to do |format|\n if @export_budget.save\n @result = 'save'\n format.html { redirect_to :back, notice: 'Export budget was successfully created.' }\n format.js { }\n format.json { render :back, status: :created, location: @export_budget }\n else\n @result = 'not_save'\n format.html { render :new }\n format.js { }\n format.json { render json: @export_budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def export_budget_params\n params.require(:export_budget).permit(:year, :title, :template, :town_id,:header,:footer)\n end",
"def set_export_budget\n @export_budget = ExportBudget.find(params[:id])\n end",
"def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to budgets_path }\n format.json { render json: @budget, status: :created, location: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @budget = Budget.new(budget_params)\n respond_to do |format|\n if @budget.save\n \n if !params[:budget][:items].nil?\n params[:budget][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(budget_id: @budget.id)\n end\n end\n \n format.html { redirect_to budgets_path, notice: \"Budget was successfully created.\" }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @export_budgets = ExportBudget.get_export_budgets_by_user current_user\n @export_budgets = @export_budgets.page(params[:page]).per(25)\n end",
"def export_budget_params\n # params.require(:export_budget).permit(:year, :title,:town,:pages => [:title_page,:content_page,:last_page,:content => [:public_budget]])\n params.require(:export_budget).permit!\n end",
"def update\n respond_to do |format|\n if @export_budget.update(export_budget_params)\n format.html { redirect_to @export_budget, notice: 'Export budget was successfully updated.' }\n format.json { render :show, status: :ok, location: @export_budget }\n else\n format.html { render :edit }\n format.json { render json: @export_budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @export_budget.update(export_budget_params)\n format.html { redirect_to @export_budget, notice: 'Export budget was successfully updated.' }\n format.json { render :show, status: :ok, location: @export_budget }\n else\n format.html { render :edit }\n format.json { render json: @export_budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render json: @budget, status: :created, budget: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render json: @budget, status: :created, location: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @budget = Budget.new(budget_params)\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @budget = Budget.new(budget_params)\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_export_budget\n # -binding.pry\n @export_budget = ExportBudget.find(params[:id])\n end",
"def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end",
"def index\n @budgets = Budget.all\n end",
"def index\n get_budgets\n end",
"def destroy\n @export_budget.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Export budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @export_budget.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Export budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @budget = Budget.new(budget_params)\n @client = Client.new\n @clients = Client.all\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'El presupuesto se creó correctamente' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\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 budgets\n # https://developer.xero.com/documentation/api/budgets\n # if you are having issues in adding the accounting.budgets.read scope, get in touch => [email protected]\n @budgets = xero_client.accounting_api.get_budgets(current_user.active_tenant_id).budgets\n @budget = xero_client.accounting_api.get_budget(current_user.active_tenant_id, @budgets.sample.budget_id).budgets\n end",
"def budget_params\n params.require(:budget).permit(:income, :savings, :housing, :utilities, :food, :food, :transportation, :clothing, :personal, :recreation, :debt, :kids, :session, :budget_name)\n end",
"def create\n @budgetitem = Budgetitem.new(budgetitem_params)\n\n respond_to do |format|\n if @budgetitem.save\n format.html { redirect_to @budgetitem, notice: 'Budgetitem was successfully created.' }\n format.json { render :show, status: :created, location: @budgetitem }\n else\n format.html { render :new }\n format.json { render json: @budgetitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def export\n @paystub = Paystub.find(params[:id])\n name = \"#{@paystub.doctor.lname}_#{Date::MONTHNAMES[@paystub.month]}_#{@paystub.year}\"\n @sdate = Date.new(@paystub.year, @paystub.month)\n @edate = 1.month.since(@sdate)\n\n @claims = Claim.joins(:services).where(provider_no: @paystub.doctor.provider_no).where(date_paid: (@sdate..@edate)).group('services.svc_date,pmt_pgm').pluck(:svc_date,Arel.sql('count(distinct claims.id),count(*), pmt_pgm, SUM(amt_subm)/100.0, SUM(amt_paid)/100.0'))\n\n @paystub.update_attribute(:filename, name+'.pdf')\n\n pdf = build_paystub( @paystub,@claims )\n pdf.render_file @paystub.filespec\n redirect_to paystubs_path, alert: \"New paystub created for Dr. #{@paystub.doctor.lname}\"\n end",
"def post_flows_datatable_export_jobs_with_http_info(datatable_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.post_flows_datatable_export_jobs ...\"\n end\n \n \n # verify the required parameter 'datatable_id' is set\n fail ArgumentError, \"Missing the required parameter 'datatable_id' when calling ArchitectApi.post_flows_datatable_export_jobs\" if datatable_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/flows/datatables/{datatableId}/export/jobs\".sub('{format}','json').sub('{' + 'datatableId' + '}', datatable_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DataTableExportJob')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#post_flows_datatable_export_jobs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def budget_params\n params.require(:budget).permit(:user_id, :month, :year, :budget_date, :name,\n incomes_attributes:[:id,:monthtitle_id,:yeartitle_id,\n :person_id,\n :inflowtype_id,:owner,:amount,:user_id,:details,:income_type,\n :month,:year,:_destroy],\n expenses_attributes:[:id,:monthtitle_id,:yeartitle_id, :outflowtype_id,:person_id,:owner, :amount, :user_id,\n :details,:expense_type,:month,:year ,:_destroy],\n comments_attributes:[:id,:user_id, :commentary,:_destroy])\n end",
"def budget_params\n params.require(:budget).permit(:name, :from, :expires, :user_id, items: [:id])\n end",
"def download\n page = params[:page].to_i\n\n a = download_conjugation(page)\n @verbs_conj.each do |verb|\n v = Verb.new(:infinitive => verb[:infinitive], :translation => verb[:translation], :group => verb[:group])\n if v.save\n @tenses.each_with_index do |tense, index|\n @forms.each_with_index do |form, index2|\n if(verb[tense][form].strip != '')\n @form = Form.new(:content => verb[tense][form], :temp => index.to_i, :person => index2.to_i,:verb => v)\n @form.save\n end\n end\n end\n end\n end\n File.open(\"public/temp_#{page}.json\",\"w\") do |f|\n f.write(JSON.pretty_generate(@verbs_conj))\n end\n\n @verbs = Verb.all\n respond_to do |format|\n format.html{ render action: 'index'}\n format.json { head :no_content }\n end\n\n end",
"def generate_bulk_export\n # Delete the bulk_export directory if it exists.\n FileUtils.rm_rf(\"bulk_export\")\n\n get_all_insurance_plans\n get_all_location_resources\n p \"===============================================================\"\n p \"Creating the Bulk export folder output ...\"\n generate_payer_bulk_data\n generate_formulary_bulk_data\nend",
"def create_budget_using_post_with_http_info(budget_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BudgetApi.create_budget_using_post ...'\n end\n # verify the required parameter 'budget_request' is set\n if @api_client.config.client_side_validation && budget_request.nil?\n fail ArgumentError, \"Missing the required parameter 'budget_request' when calling BudgetApi.create_budget_using_post\"\n end\n # resource path\n local_var_path = '/nucleus/v1/budget'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(budget_request)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Budget')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BudgetApi#create_budget_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @budget = Budget.new(params[:budget])\n @budget.user = current_user\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render json: @budget, status: :created, location: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def export\n\n\t\tname_list = []\n\t\tfor name in Name.all\n\t\t\tname_list << [name.sei, name.mei ]\n\t\tend\n\n\t\tFile.open('tmp/names.yml', 'w') {|f|\n\t\t\tf.write YAML.dump(name_list)\n\t\t}\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to :action => :index }\n\t\t\tformat.json { render json: @orders }\n\t\tend\n\tend",
"def to_file\n tempfile = Tempfile.new('part_export')\n File.write(tempfile, sorted_requests.map(&:to_json).join(\"\\n\"))\n tempfile\n end",
"def download\n grade_entry_form = GradeEntryForm.find(params[:id])\n send_data grade_entry_form.export_as_csv,\n disposition: 'attachment',\n type: 'text/csv',\n filename: \"#{grade_entry_form.short_identifier}_grades_report.csv\"\n end",
"def index\n @budget_dispositions = BudgetDisposition.all\n end",
"def export\n url = \"#{self.url}/export?auth=#{self.authtoken}\"\n status, response = rest_post( url, nil )\n if ok?( status )\n return status, response['export_count'], response['error_count']\n end\n return status, 0, 0\n end",
"def generate_export_json(output_directory, request, output)\n export = {\n transactionTime: Time.now.strftime(\"%FT%T%:z\"),\n request: request,\n requiresAccessToken: false,\n output: output,\n }\n file_path = File.join(output_directory, \"export.json\")\n File.open(file_path, \"w\") do |file|\n file.write(JSON.pretty_generate(export))\n end\nend",
"def budget_params\n params.require(:budget).permit(:name, :allotment, :start, :end)\n end",
"def index\n # TODO: implement filters\n @budgets = Budget.order(\"budgets.starts_at DESC, budgets.number ASC\")\n .page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n #format.select2 { render json: { items: budgets.map(&:to_select2_json), total: @budgets.count} }\n #format.json { render json: @budgets }\n end\n end",
"def export\n\n end",
"def export_params\n params.require(:export).permit(:merchant_account_id, :warehouse_id, :target_warehouse_id, :description)\n end",
"def generate_formulary_bulk_data\n p \"There are no Formulary resources available to generate bulk data.\" if FORMULARIES.empty?\n FORMULARIES.each do |formulary|\n NDOUTS.clear\n request = \"#{FHIR_SERVER}/fhir/InsurancePlan/#{formulary[:id]}/$export\"\n output_directory = File.join(\"bulk_export\", formulary[:id])\n FileUtils.mkdir_p(output_directory)\n generate_ndjson(\"InsurancePlan\", [formulary], output_directory)\n get_related_basic_and_medicationknowledge(formulary[:id], output_directory)\n\n location_ids = extract_location_id_from_reference(formulary[:coverageArea])\n get_related_locations(location_ids, output_directory)\n generate_export_json(output_directory, request, NDOUTS)\n end\nend",
"def export\n\n end",
"def export\n send_data current_user.records.select(:json).order('updated_at desc').collect(&:json).to_json, filename: 'records.json'\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n f = find_budgets\n format.ext_json { render :json => f.to_ext_json(:class => :budget, \n :count => f.length,\n :methods=>[:total_budget_costs,:total_budget_invoices,:total_budget_pricings],\n :include=>{:user=>{:only=>\"login\"}}) }\n \n end\n end",
"def new\n @budget = Budget.new\n @budgetProducts = []\n @customer = Customer.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budget }\n end\n end",
"def export\n ret = @uri.export(params[:branchs])\n render plain: ret[:message], status: ret[:status]\n end",
"def export_with_http_info(space_id, request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TransactionService.export ...\"\n end\n # verify the required parameter 'space_id' is set\n fail ArgumentError, \"Missing the required parameter 'space_id' when calling TransactionService.export\" if space_id.nil?\n # verify the required parameter 'request' is set\n fail ArgumentError, \"Missing the required parameter 'request' when calling TransactionService.export\" if request.nil?\n # resource path\n local_var_path = \"/transaction/export\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'spaceId'] = space_id\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json;charset=utf-8', 'text/csv']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json;charset=utf-8']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n \n # connection timeout\n timeout = @api_client.get_connection_timeout()\n\n # http body (model)\n post_body = @api_client.object_to_http_body(request)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :timeout => timeout,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionService#export\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @budget_disposition = BudgetDisposition.new(budget_disposition_params)\n\n respond_to do |format|\n if @budget_disposition.save\n format.html { redirect_to @budget_disposition, notice: 'Budget disposition was successfully created.' }\n format.json { render :show, status: :created, location: @budget_disposition }\n else\n format.html { render :new }\n format.json { render json: @budget_disposition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n @item.budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to after_save_redirection_path, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def export(params={})\n columns = delimited_string_to_array(Settings.export.travel_fields)\n send_data Travel.export(columns), :filename => \"travel.csv\"\n end",
"def download\n @plan = Plan.find(params[:id])\n authorize @plan\n @phase_options = @plan.phases.order(:number).pluck(:title, :id)\n @phase_options.insert(0, ['All phases', 'All']) if @phase_options.length > 1\n @export_settings = @plan.settings(:export)\n render 'download'\n end",
"def export_prices\n # h = {rentals: []}\n # @data.rentals.each do |r|\n # h[:rentals] << r.rental_calculator\n # end\n\n h = {rental_modifications: []}\n @data.rental_modifications.each do |rm|\n h[:rental_modifications] << rm.rental_calculator\n end\n\n output = File.open('output.json','w')\n output << JSON.generate(h)\n output.close\n\n 'Prices exported'\n end",
"def index\n p \"#{params}\"\n @budget_lines = BudgetLine.all\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def export\n headers = JSON[params[:column_array]]\n rows = JSON[params[:row_array]]\n column_names = Array.new\n headers.each do |col|\n column_names << col\n end\n csv_string = CSV.generate do |csv|\n csv << column_names\n rows.each do |row|\n csv << row\n end\n end\n\n filename = params[:file_name] + \".csv\"\n send_data(csv_string,\n :type => 'text/csv; charset=utf-8; header=present',\n :filename => filename)\n end",
"def create\n @budget = Budget.new(budget_params)\n @budget1 = @budget\n respond_to do |format|\n if @budget.save\n BudgetMailer.budget_email(@budget1).deliver_now\n format.html { redirect_to reservation_requests_path, notice: 'Presupuesto creado exitosamente.' }\n else\n @my_reservation_requests = ReservationRequest.find(budget_params[:reservation_request_id])\n Rails.logger.debug \" conteo: #{1}\"\n @budget.budget_service_details.build\n @budget.budget_room_details.build\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @budget_item = BudgetItem.new(params[:budget_item])\n\n respond_to do |format|\n if @budget_item.save\n format.html { redirect_to(@budget_item, :notice => 'Budget item was successfully created.') }\n format.xml { render :xml => @budget_item, :status => :created, :location => @budget_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @budget_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @admin_bills = Admin::Bill.where(user_id: current_user.id).paginate(:page => params[:page]).order(\"created_at DESC\")\n @export = Admin::Bill.all.where(user_id: current_user.id)\n respond_to do |format|\n format.html\n format.xlsx {\n response.headers['Content-Disposition'] = 'attachment; filename=\"Bills.xlsx\"'\n }\n format.js { render :layout => false }\n end\n end",
"def new\n @budget = Budget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budget }\n end\n end",
"def export\n # Get the file of an artifact in a system\n result = SwaggerClient::ArtifactsApi.new.api_systems_system_id_artifacts_export_get(\n options[:systemId], options[:filename], options[:compress], Emasser::GET_ARTIFACTS_RETURN_TYPE\n )\n if options[:compress]\n p result\n else\n begin\n puts JSON.pretty_generate(JSON.parse(result))\n rescue StandardError\n puts result\n end\n end\n rescue SwaggerClient::ApiError => e\n puts 'Exception when calling ArtifactsApi->api_systems_system_id_artifacts_export_get'\n puts to_output_hash(e)\n end",
"def index\n @budgets = Budget.find_owned_by current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end",
"def values_export(params = {})\n @client.get(\"#{path}/values/export.csv\", params)\n end",
"def budget_params\n params.require(:budget).permit(:client_id, :contract_id, :date, :description, :state, :total_amount, :name,\n budget_details_attributes: [:id, :rubro_id, :cost, :measurement_unit, :price, :quantity, :subtotal, :utility, :_destroy])\n end",
"def save_financials\n current_user.update(assets: params[:assets], average_annual_income: params[:average_annual_income], credit_score: params[:credit_score], total_debt: params[:total_debt])\n user_listings = current_user.listings\n render json: [current_user, user_listings]\n end",
"def index\n @budgets = Budget.all.paginate(page: params[:page], :per_page => 5).order(\"created_at DESC\")\n end",
"def import_budget_chart!\n organizations.each do |sorg|\n org = Organization.find_or_initialize_by(admin_id: sorg[:admin_id])\n org.update(name: sorg[:name])\n org.parent = Organization.find_by(admin_id: sorg[:parent]) if sorg[:parent]\n\n org.save\n end\n end",
"def export\n result = Urlmaster.all\n head = 'EF BB BF'.split(' ').map{|a|a.hex.chr}.join()\n exportFile = CSV.generate(csv = head) do |writer|\n writer << [\"mapId\", \"venueName\", \"floor\", \"typeMap\", \"venueFloorMapImageUrl\", \"venueFloorMapUrl\"]\n result.each do |r|\n writer << [r[:mapId], r[:venueName], r[:floor], r[:typeMap], r[:venueFloorMapImageUrl], r[:venueFloorMapUrl]]\n end\n end\n send_data exportFile, filename: \"MapCrawler-#{Time.now.in_time_zone(\"Asia/Tokyo\").strftime(\"%y%m%d%H%M%S\")}.csv\", type: \"text/csv\"\n # redirect_to crawler_path\n end",
"def export_loyalty_balances_with_http_info(loyalty_program_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.export_loyalty_balances ...'\n end\n # verify the required parameter 'loyalty_program_id' is set\n if @api_client.config.client_side_validation && loyalty_program_id.nil?\n fail ArgumentError, \"Missing the required parameter 'loyalty_program_id' when calling ManagementApi.export_loyalty_balances\"\n end\n # resource path\n local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/export_customer_balances'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].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/csv'])\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] || 'String' \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#export_loyalty_balances\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def fee_reciepts_export_csv\n parameters={:search => params[:search] ,:filename => filename}\n csv_export('finance_transaction', 'fee_reciepts_export', parameters) \n end",
"def index\n @budgets = Budget.all\n @budgets = Budget.order(params[:by] + \" \" + params[:order]).page params[:page] if params[:sort] == \"true\"\n @budgets = Budget.order(:id).page params[:page]\n end",
"def set_budget\n @budget = Budget.find(params[:id])\n end",
"def create\n megam_rest.post_billedhistories(to_hash)\n end",
"def create\n @budget_approver = BudgetApprover.new(budget_approver_params)\n respond_to do |format|\n if @budget_approver.save\n format.html { redirect_to @budget_approver, notice: 'Budget approver page was successfully created.' }\n format.json { render :show, status: :created, location: @budget_approver }\n else\n format.html { render :new }\n format.json { render json: @budget_approver.errors, status: :unprocessable_entity }\n end\n end\n end",
"def export_all\n headers['Content-Type'] = \"application/vnd.ms-excel\"\n headers['Content-Disposition'] = 'attachment; filename=\"report.xls\"'\n headers['Cache-Control'] = ''\n #SQL QUERY INTO XLS FORMAT\n @bands = PledgedBand.find_by_sql \"SELECT pledged_bands.name, pledged_bands.pledges_count, fans.first_name, fans.last_name, fans.email, pledges.created_at FROM pledged_bands LEFT JOIN pledges ON pledged_bands.id = pledges.pledged_band_id LEFT JOIN fans on pledges.fan_id = fans.id\"\n end",
"def new\n @budget = Budget.new\n\n respond_to do |format|\n format.html # new.html.erb\n # format.json { render json: @budget }\n end\n end",
"def bitbucket_sync_export_with_http_info(id, bitbucket_sync_export_parameters, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BitbucketSyncApi.bitbucket_sync_export ...'\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 BitbucketSyncApi.bitbucket_sync_export\"\n end\n # verify the required parameter 'bitbucket_sync_export_parameters' is set\n if @api_client.config.client_side_validation && bitbucket_sync_export_parameters.nil?\n fail ArgumentError, \"Missing the required parameter 'bitbucket_sync_export_parameters' when calling BitbucketSyncApi.bitbucket_sync_export\"\n end\n # resource path\n local_var_path = '/bitbucket_syncs/{id}/export'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(bitbucket_sync_export_parameters) \n\n # return_type\n return_type = opts[:return_type] || 'BitbucketSyncExportResponse' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\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(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BitbucketSyncApi#bitbucket_sync_export\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end",
"def set_budget\n @budget = Budget.find(params[:id])\n\n end",
"def item_download_counts\n @items = MonthlyItemDownloadCount.unit_download_counts_by_item(\n unit: @unit,\n start_year: params[:from_year].to_i,\n start_month: params[:from_month].to_i,\n end_year: params[:to_year].to_i,\n end_month: params[:to_month].to_i)\n\n # The items array contains item IDs and download counts but not titles.\n # So here we will insert them.\n AscribedElement.\n where(registered_element: @unit.institution.title_element).\n where(item_id: @items.map{ |row| row['id'] }).pluck(:item_id, :string).each do |asc_e|\n row = @items.find{ |r| r['id'] == asc_e[0] }\n row['title'] = asc_e[1] if row\n end\n\n respond_to do |format|\n format.html do\n render partial: \"show_downloads_by_item\"\n end\n format.csv do\n csv = CSV.generate do |csv|\n csv << [\"Month\", \"Downloads\"]\n @items.each do |row|\n csv << row.values\n end\n end\n send_data csv,\n type: \"text/csv\",\n disposition: \"attachment\",\n filename: \"unit_#{@unit.id}_download_counts.csv\"\n end\n end\n end",
"def datevdownload\n if params[:account][:export_fixed_at_start_date]\n date_from = params[:account][:export_fixed_at_start_date]\n else\n date_from = Date.today.beginning_of_month\n end\n if params[:account][:export_fixed_at_end_date]\n date_to = params[:account][:export_fixed_at_end_date]\n else\n date_to = Date.today.end_of_month\n end\n #@contacts = Billing::Businessdocument.joins(:contact).where(\"businessdocuments.type='Billing::Invoice' or businessdocuments.type='Billing::Cancellation'\")\n @contact_ids = ''\n @businessdocumentpositions = Billing::Businessdocumentposition.includes(:businessdocument, :vat).where(\"(businessdocuments.type='Billing::Invoice' or businessdocuments.type='Billing::Cancellation') and invoice_number IS NOT NULL and invoice_date >= '#{date_from}' AND invoice_date <= '#{date_to}'\").order(\"businessdocuments.invoice_number, businessdocuments.id, businessdocumentpositions.position, businessdocumentpositions.id\")\n @businessdocuments = Billing::Businessdocument.where(\"(businessdocuments.type='Billing::Invoice' or businessdocuments.type='Billing::Cancellation') and invoice_date >= '#{date_from}' AND invoice_date <= '#{date_to}'\").order(\"businessdocuments.invoice_number, businessdocuments.id\")\n\n @account = current_tenant\n if params[:account][:export_fixed_at_start_date] and params[:account][:export_fixed_at_end_date]\n @account.tax_consultant_id = params[:account][:tax_consultant_id]\n @account.tax_consultant_client_id = params[:account][:tax_consultant_client_id]\n @account.revenue_account = params[:account][:revenue_account]\n @account.export_fixed_at_start_date = params[:account][:export_fixed_at_start_date]\n @account.export_fixed_at_end_date = params[:account][:export_fixed_at_end_date]\n @account.save\n end\n respond_to do |format|\n format.xlsx {\n authorize_feature! 'csv_export'\n response.headers['Content-Disposition'] = 'attachment; filename=' + \"EXTF_#{I18n.t(:invoicelist)}-#{Date.today}.xlsx\"\n }\n # format.csv {\n # authorize_feature! 'csv_export'\n # response.headers['Content-Disposition'] = 'attachment; filename=' + \"#{I18n.t(:datevexport_csv_filename, startdate: @account.export_fixed_at_start_date.to_s, enddate: @account.export_fixed_at_end_date.to_s, createdate: Date.today.to_s)}.csv\"\n # }\n format.csv do\n require 'zip'\n\n authorize_feature! 'csv_export'\n\n # create tmp_file with account id to ensure unique filenames\n tmp_dir = Rails.root.join('tmp', @account.id.to_s)\n Dir.mkdir(tmp_dir) unless File.exists?(tmp_dir)\n\n tmp_dir = Rails.root.join(tmp_dir, current_user.id.to_s)\n Dir.mkdir(tmp_dir) unless File.exists?(tmp_dir)\n\n\n start_date_short = (l @account.export_fixed_at_start_date, format: '%Y%m%d').to_s\n end_date_short = (l @account.export_fixed_at_end_date, format: '%Y%m%d').to_s\n today_short = (l Date.today, format: '%Y%m%d').to_s\n\n zip_file_name = \"DATEV-Export_#{t(:from)}_#{start_date_short}_#{t(:until)}_#{end_date_short}_erstellt_#{today_short}.zip\"\n\n filename_accounts = \"EXTF_GP_Stamm_#{(l Date.today, format: '%Y%m%d')}.csv\"\n filename_batch = \"EXTF_Buchungsstapel_#{(@account.export_fixed_at_start_date.blank? ? '' : (l @account.export_fixed_at_start_date, format: '%Y%m%d').to_s)}_bis_#{(@account.export_fixed_at_end_date.blank? ? '' : (l @account.export_fixed_at_end_date, format: '%Y%m%d').to_s)}.csv\"\n\n zip_file_path = Rails.root.join(tmp_dir, zip_file_name)\n File.delete(zip_file_path) if File.exist?(zip_file_path)\n\n Zip::ZipFile.open(zip_file_path.to_s, Zip::ZipFile::CREATE) do |zipfile|\n zipfile.get_output_stream(filename_accounts) { |f| f.write BusinessdocumentExportDatevCsv.new.get_contacts(@account, @businessdocumentpositions) }\n zipfile.get_output_stream(filename_batch) { |f| f.write BusinessdocumentExportDatevCsv.new.get_invoicepositions(@account, @businessdocumentpositions, date_from, date_to) }\n end\n\n send_file(zip_file_path, :type => 'application/zip', :disposition => 'attachment', :filename => zip_file_name)\n\n end\n end\n end",
"def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end",
"def create_batch\n all_months.each do |month|\n cash_flow = find_or_build_cash_flow(month, @category.id)\n\n cash_flow.planned = cash_flow_params[:value]\n cash_flow.save!\n end\n\n render json: { success: true }, status: :created\n end",
"def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end",
"def post_analytics_reporting_exports_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AnalyticsApi.post_analytics_reporting_exports ...\"\n end\n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling AnalyticsApi.post_analytics_reporting_exports\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/analytics/reporting/exports\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ReportingExportJobResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AnalyticsApi#post_analytics_reporting_exports\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @budget_approvers = BudgetApprover.all\n end",
"def portfolio_balance_tracking\n total = []\n date_time = []\n portafolio = Portafolio.find_by(id: params[:id])\n portafolio.balance_trackings.each do |record|\n total << record.total\n date_time << record.date_time\n end\n render json: {total: total, date_time: date_time}\n end",
"def create_data_download(project_id, opts = {})\n post \"projects/#{project_id}/datadownload\", opts\n end",
"def generate_payer_bulk_data\n p \"There are no payer resources available to generate bulk data.\" if PAYERS.empty?\n\n PAYERS.each do |payer|\n NDOUTS.clear\n request = \"#{FHIR_SERVER}/fhir/InsurancePlan/#{payer[:id]}/$export\"\n output_directory = File.join(\"bulk_export\", payer[:id])\n FileUtils.mkdir_p(output_directory)\n related_formularies_id = []\n payer[:coverage].each do |coverage|\n formulary = coverage[:extension].find { |ext| ext[:url] == \"http://hl7.org/fhir/us/davinci-drug-formulary/StructureDefinition/usdf-FormularyReference-extension\" }\n unless formulary.nil?\n related_formularies_id << formulary[:valueReference][:reference].split(\"/\").last\n end\n end\n\n related_formularies = FORMULARIES.find_all { |formulary| related_formularies_id.include?(formulary[:id]) }\n related_formularies.prepend(payer)\n generate_ndjson(\"InsurancePlan\", related_formularies, output_directory)\n\n related_formularies_id.each { |id| get_related_basic_and_medicationknowledge(id, output_directory) }\n location_ids = extract_location_id_from_reference(payer[:coverageArea])\n get_related_locations(location_ids, output_directory)\n generate_export_json(output_directory, request, NDOUTS)\n end\nend",
"def create\n @budget_src = BudgetSrc.new(params[:budget_src])\n\n respond_to do |format|\n if @budget_src.save\n format.html { redirect_to(@budget_src, :notice => 'Budget src was successfully created.') }\n format.xml { render :xml => @budget_src, :status => :created, :location => @budget_src }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @budget_src.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def export\n @scenario.export\n send_file \"#{@scenario.bin_file_name}.new\", type: 'application/octet-stream'\n end",
"def bills\n data = []\n data.push AdaptedMiscFee.represent(miscellaneous_fees)\n data.push AdaptedExpense.represent(object.expenses)\n data.flatten.as_json\n end",
"def raw_export\n return unless has_permission :can_do_billing\n case request.method\n when :get\n @page_title = 'Generate Raw Data Report'\n @from = Time.now.beginning_of_month\n @to = @from.next_month\n when :post\n from = Date.new(params[:from][:year].to_i,params[:from][:month].to_i)\n to = Date.new(params[:to][:year].to_i,params[:to][:month].to_i)\n @records = BillingCharge.find(:all,:conditions=>['billing_charges.created_at > ? and billing_charges.created_at < ?',from,to],\n :order=>['billing_charges.id'],:include=>[:pilot,:instructor,:aircraft])\n report = StringIO.new\n CSV::Writer.generate(report, ',') do |csv|\n csv << %w(Timestamp Pilot Amount Total Type Note Aircraft Aircraft_Rate Instructor Instructor_Rate Hobbs_Start Hobbs_End Tach Ground_Instruction)\n @records.each do |r|\n csv << [r.created_at, r.pilot.full_name_with_id, r.charge_amount, r.running_total, \n r.type.to_s == 'FlightRecord' ? 'flight/ground instruction' : r.type, r.notes, r.aircraft_id.nil? ? nil : r.aircraft.identifier, \n r.aircraft_rate, r.instructor_id.nil? ? nil : r.instructor.full_name_with_id,\n r.instructor_rate, r.hobbs_start, r.hobbs_end, r.tach_end, r.ground_instruction_time]\n end\n end\n\n report.rewind\n send_data(report.read,\n :type => 'text/csv; charset=iso-8859-1; header=present',\n :filename => 'report.csv')\n end\nend",
"def export_csv\n # Find all Setup with the stored restrictions\n sorting :default => \"name\"\n collection = PostitTask.find :all, :order => @sort, :conditions => session[:conditions]\n # Creation of the file\n file_name = \"postit_task_export_\" + current_user.id.to_s + \".csv\"\n \n csv_string = CSV.generate({:col_sep => ';', :encoding => \"ISO-8859-15\" }) do |csv|\n csv << [\"Nom\".trn,\"Description\".trn,\"Séquence\".trn]\n collection.each do |element|\n csv << [element.name,element.description,element.sequence]\n end\n end\n send_data Iconv.conv('iso-8859-1//IGNORE', 'utf-8', csv_string), :filename => file_name, :disposition => 'attachment', :type => 'text/csv; charset=iso-8859-1; header=present'\n end",
"def export_loyalty_card_balances_with_http_info(loyalty_program_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.export_loyalty_card_balances ...'\n end\n # verify the required parameter 'loyalty_program_id' is set\n if @api_client.config.client_side_validation && loyalty_program_id.nil?\n fail ArgumentError, \"Missing the required parameter 'loyalty_program_id' when calling ManagementApi.export_loyalty_card_balances\"\n end\n # resource path\n local_var_path = '/v1/loyalty_programs/{loyaltyProgramId}/export_card_balances'.sub('{' + 'loyaltyProgramId' + '}', CGI.escape(loyalty_program_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].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/csv'])\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] || 'String' \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#export_loyalty_card_balances\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n\n @debtors = Debtor.all\n\n render json: @debtors\n end",
"def index\n @budget_products = BudgetProduct.all\n end",
"def export_post(post) end",
"def set_budget\n @budget = Budget.find(params[:id])\n end"
]
| [
"0.6652156",
"0.6514427",
"0.62387013",
"0.6163214",
"0.6105515",
"0.6072496",
"0.6053069",
"0.6045837",
"0.59647715",
"0.59647715",
"0.59000593",
"0.589061",
"0.5880425",
"0.5880353",
"0.58298516",
"0.57742",
"0.5751221",
"0.5738721",
"0.5677169",
"0.5677169",
"0.56648296",
"0.56333023",
"0.5610269",
"0.5575468",
"0.5511877",
"0.5404789",
"0.53990173",
"0.5396577",
"0.53946203",
"0.5391039",
"0.5385295",
"0.5381214",
"0.5380375",
"0.5379917",
"0.533204",
"0.5311447",
"0.53104067",
"0.53056973",
"0.53051496",
"0.53023505",
"0.52825",
"0.52615166",
"0.52600634",
"0.5251006",
"0.52302605",
"0.5228725",
"0.5221489",
"0.5205287",
"0.5197799",
"0.5192054",
"0.5181944",
"0.51775974",
"0.5172175",
"0.5168386",
"0.51623863",
"0.51494867",
"0.51442534",
"0.5143995",
"0.51336676",
"0.51192874",
"0.5116765",
"0.5115159",
"0.5105398",
"0.50929177",
"0.50927806",
"0.50869143",
"0.5083181",
"0.507983",
"0.50554955",
"0.50548035",
"0.5054656",
"0.5036495",
"0.5033901",
"0.50252545",
"0.50165176",
"0.50144124",
"0.5012375",
"0.5012082",
"0.50091743",
"0.50089616",
"0.5004834",
"0.5004828",
"0.50042856",
"0.5003618",
"0.49937224",
"0.4993378",
"0.4993369",
"0.49919432",
"0.49855968",
"0.4980244",
"0.49781832",
"0.49757785",
"0.49749684",
"0.49738237",
"0.49685067",
"0.49680695",
"0.49620536",
"0.49584866",
"0.49363935",
"0.49350226"
]
| 0.6523707 | 1 |
PATCH/PUT /export_budgets/1 PATCH/PUT /export_budgets/1.json | def update
respond_to do |format|
if @export_budget.update(export_budget_params)
format.html { redirect_to @export_budget, notice: 'Export budget was successfully updated.' }
format.json { render :show, status: :ok, location: @export_budget }
else
format.html { render :edit }
format.json { render json: @export_budget.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end",
"def update\n respond_to do |format|\n if @budget.update(budget_params)\n Item.where([\"budget_id = #{params[:id]}\"]).update_all(budget_id: nil)\n if !params[:budget][:items].nil?\n params[:budget][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(budget_id: params[:id])\n end\n end\n format.html { redirect_to budgets_path, notice: \"Budget was successfully updated.\" }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n # format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n # format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @budget.update(budget_params)\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @budget.update(budget_params)\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @budget_file.update(budget_file_params)\n #if @revenue.update(revenue_params.merge({:tree_info => tree_info, :rows => rows}))\n # @budget_file.taxonomy.explanation = explanation\n # @budget_file.taxonomy.save\n\n format.html { redirect_to @budget_file, notice: t('budget_files_controller.save') }\n format.json { render :show, status: :ok, location: @budget_file }\n else\n format.html { render :edit }\n format.json { render json: @budget_file.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def set_export_budget\n @export_budget = ExportBudget.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @budget.update(budget_params)\n format.html { redirect_to @budget, notice: 'El presupuesto se actualizó correctamente' }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_export_budget\n # -binding.pry\n @export_budget = ExportBudget.find(params[:id])\n end",
"def update\n budget = Budget.find params[:budget_id]\n budget.status = false\n budget.save\n redirect_to budgets_path\n end",
"def update\n @budget = Budget.find(params[:id])\n @budget1 = @budget\n respond_to do |format|\n if @budget.update(budget_params)\n BudgetMailer.budget_email(@budget1).deliver_now\n format.html { redirect_to reservation_requests_path, notice: 'Presupuesto modificado exitosamente.' }\n else\n @my_reservation_requests = ReservationRequest.find(budget_params[:reservation_request_id])\n @my_budget = Budget.find(params[:id])\n @services_details=@my_budget.budget_service_details\n @budget.budget_service_details.build\n @budget.budget_room_details.build\n format.html { render :edit }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @budgetitem.update(budgetitem_params)\n format.html { redirect_to @budgetitem, notice: 'Budgetitem was successfully updated.' }\n format.json { render :show, status: :ok, location: @budgetitem }\n else\n format.html { render :edit }\n format.json { render json: @budgetitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @budget_src = BudgetSrc.find(params[:id])\n\n respond_to do |format|\n if @budget_src.update_attributes(params[:budget_src])\n format.html { redirect_to(@budget_src, :notice => 'Budget src was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @budget_src.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @budget_for_order.update(budget_for_order_params)\n format.html { redirect_to @budget_for_order, notice: 'Budget for order was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget_for_order }\n else\n format.html { render :edit }\n format.json { render json: @budget_for_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @budget = Budget.new(budget_params)\n respond_to do |format|\n if @budget.save\n \n if !params[:budget][:items].nil?\n params[:budget][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(budget_id: @budget.id)\n end\n end\n \n format.html { redirect_to budgets_path, notice: \"Budget was successfully created.\" }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @budget_approver.update(budget_approver_params)\n format.html { redirect_to @budget_approver, notice: 'Budget approver page was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget_approver }\n else\n format.html { render :edit }\n format.json { render json: @budget_approver.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @export.update(export_params)\n format.html { redirect_to @export, notice: 'Export was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @export.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @budget_disposition.update(budget_disposition_params)\n format.html { redirect_to @budget_disposition, notice: 'Budget disposition was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget_disposition }\n else\n format.html { render :edit }\n format.json { render json: @budget_disposition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @setbreak.update(setbreak_params)\n format.json { respond_with_bip @setbreak }\n else\n format.json { respond_with_bip @setbreak }\n end\n end\n end",
"def update\n resource.update(deposit_contract_params)\n respond_with client, resource\n end",
"def update\n @budget_item = BudgetItem.find(params[:id])\n\n respond_to do |format|\n if @budget_item.update_attributes(params[:budget_item])\n format.html { redirect_to(@budget_item, :notice => 'Budget item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @budget_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @monthly_overhead_breakdown_item = MonthlyOverheadBreakdownItem.find(params[:id])\n\n respond_to do |format|\n if @monthly_overhead_breakdown_item.update_attributes(params[:monthly_overhead_breakdown_item])\n format.html { redirect_to @monthly_overhead_breakdown_item, notice: 'Monthly overhead breakdown item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @monthly_overhead_breakdown_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @therapy_budget.update(therapy_budget_params)\n format.html { redirect_to @therapy_budget, notice: 'Therapy budget was successfully updated.' }\n format.json { render :show, status: :ok, location: @therapy_budget }\n else\n format.html { render :edit }\n format.json { render json: @therapy_budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line = Line.find(params[:id])\n @budget = @line.budget\n\n respond_to do |format|\n if @line.update_attributes(params[:line])\n format.html { redirect_to budget_path(@budget), notice: 'Line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @budget_line.update(budget_line_params)\n format.html { redirect_to @budget_line, notice: 'Budget line was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget_line }\n else\n format.html { render :edit }\n format.json { render json: @budget_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_budget\n @budget = Budget.find(params[:id])\n end",
"def set_budget\n @budget = Budget.find(params[:id])\n\n end",
"def update\n respond_to do |format|\n if @budget_request.update(budget_request_params)\n budget_request = BudgetRequest.find_by(id: @budget_request.id)\n budget_request.update_attribute(:state, BudgetRequest.state.finished)\n format.html {redirect_to edit_budget_request_path, notice: 'Pedido de Cotización actualizada.'}\n format.json {render :show, status: :ok, location: @order}\n else\n format.html { render :edit }\n format.json { render json: @budget_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ct_gov_import_export.update(ct_gov_import_export_params)\n format.html { redirect_to @ct_gov_import_export, notice: 'Ct gov import export was successfully updated.' }\n format.json { render :show, status: :ok, location: @ct_gov_import_export }\n else\n format.html { render :edit }\n format.json { render json: @ct_gov_import_export.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @breadcrumb = 'update'\n @budget_heading = BudgetHeading.find(params[:id])\n @budget_heading.updated_by = current_user.id if !current_user.nil?\n \n respond_to do |format|\n if @budget_heading.update_attributes(params[:budget_heading])\n format.html { redirect_to @budget_heading,\n notice: (crud_notice('updated', @budget_heading) + \"#{undo_link(@budget_heading)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budget_heading.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ptbudget = Ptbudget.find(params[:id])\n\n respond_to do |format|\n if @ptbudget.update_attributes(params[:ptbudget])\n flash[:notice] = 'Ptbudget was successfully updated.'\n format.html { redirect_to(@ptbudget) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ptbudget.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @export_run = ExportRun.find(params[:id])\n\n respond_to do |format|\n if @export_run.update_attributes(params[:export_run])\n format.html { redirect_to @export_run, notice: 'Export run was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @export_run.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item = BudgetItem.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:budget_item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(budget_items_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @brave_burst.update(brave_burst_params)\n format.html { redirect_to @brave_burst, notice: 'Brave burst was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @brave_burst.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_budget\n @budget = Budget.find(params[:id])\n end",
"def set_budget\n @budget = Budget.find(params[:id])\n end",
"def set_budget\n @budget = Budget.find(params[:id])\n end",
"def set_budget\n @budget = Budget.find(params[:id])\n end",
"def update\n #@bundles_items_design = BundlesItemsDesign.find(params[:id])\n #\n #respond_to do |format|\n # if @bundles_items_design.update_attributes(params[:bundles_items_design])\n # format.html { redirect_to @bundles_items_design, notice: 'Bundles items design was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: \"edit\" }\n # format.json { render json: @bundles_items_design.errors, status: :unprocessable_entity }\n # end\n #end\n end",
"def update\n @export = Export.find(params[:id])\n\n respond_to do |format|\n if @export.update_attributes(params[:export])\n format.html { redirect_to(@export, :notice => 'Export was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @export.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ptbudget = Ptbudget.find(params[:id])\n\n respond_to do |format|\n if @ptbudget.update_attributes(params[:ptbudget])\n flash[:notice] = t('ptbudget.title')+\" \"+t('updated')\n format.html { redirect_to(@ptbudget) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ptbudget.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bill_summary.update(bill_summary_params)\n format.html { redirect_to @bill_summary, notice: 'Bill summary was successfully updated.' }\n format.json { render :show, status: :ok, location: @bill_summary }\n else\n format.html { render :edit }\n format.json { render json: @bill_summary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @monthly_revenue_breakdown_item = MonthlyRevenueBreakdownItem.find(params[:id])\n\n respond_to do |format|\n if @monthly_revenue_breakdown_item.update_attributes(params[:monthly_revenue_breakdown_item])\n format.html { redirect_to @monthly_revenue_breakdown_item, notice: 'Monthly revenue breakdown item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @monthly_revenue_breakdown_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sys_export = SysExport.find(params[:id])\n\n respond_to do |format|\n if @sys_export.update_attributes(params[:sys_export])\n format.html { redirect_to @sys_export, notice: 'Sys export was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sys_export.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bundle_total.update(bundle_total_params)\n format.html { redirect_to @bundle_total, notice: 'Bundle total was successfully updated.' }\n format.json { render :show, status: :ok, location: @bundle_total }\n else\n format.html { render :edit }\n format.json { render json: @bundle_total.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @expense_report\n\n\n @expense_report.actual_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @expense_report.trip.destination\n req.expense_type = 'actual'\n end\n end\n\n\n respond_to do |format|\n if @expense_report.update(expense_report_params)\n format.html { redirect_to @expense_report, notice: 'Expense report was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense_report }\n else\n format.html { render :edit }\n format.json { render json: @expense_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @bigquery_export = args[:bigquery_export] if args.key?(:bigquery_export)\n end",
"def update!(**args)\n @bigquery_export = args[:bigquery_export] if args.key?(:bigquery_export)\n end",
"def update\n respond_to do |format|\n if @blueprint.update(blueprint_params)\n format.html { redirect_to @blueprint, notice: 'Blueprint was successfully updated.' }\n format.json { render :show, status: :ok, location: @blueprint }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @blueprint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to :json\n\n if @expense_claim.update(expense_claim_params)\n head :ok\n else\n render partial: 'expense_claim_key_data', layout: false, status: :ok, locals: { expense_claim: @expense_claim }\n end\n end",
"def update\n respond_to do |format|\n if @budget_product.update(budget_product_params)\n format.html { redirect_to @budget_product, notice: 'Budget product was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget_product }\n else\n format.html { render :edit }\n format.json { render json: @budget_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project_download = ProjectDownload.find(params[:id])\n\n respond_to do |format|\n if @project_download.update_attributes(params[:project_download])\n format.html { redirect_to @project_download, :notice => 'Project download was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @project_download.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @consumer_debt.update(consumer_debt_params)\n format.html { redirect_to my_portfolio_path, notice: 'Consumer debt was successfully updated.' }\n format.json { render :show, status: :ok, location: @consumer_debt }\n else\n format.html { render :edit }\n format.json { render json: @consumer_debt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @subset.update(subset_params)\n format.html { redirect_to @subset, notice: 'Subset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @subset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @email_export.update(email_export_params)\n format.html { redirect_to @email_export, notice: 'Email export was successfully updated.' }\n format.json { render :show, status: :ok, location: @email_export }\n else\n format.html { render :edit }\n format.json { render json: @email_export.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @barangay_bridge_project_completion.update(barangay_bridge_project_completion_params)\n format.html { redirect_to @barangay_bridge_project_completion, notice: 'Barangay bridge project completion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @barangay_bridge_project_completion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bond.update(bond_params)\n format.html { redirect_to bonds_path, notice: I18n.t('messages.updated_with', item: @bond.company) }\n format.json { render :show, status: :ok, location: @bond }\n else\n format.html { render :edit }\n format.json { render json: @bond.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @export_budget = ExportBudget.new(params[:export_budget])\n respond_to do |format|\n if @export_budget.save\n @result = 'save'\n format.html { redirect_to :back, notice: 'Export budget was successfully created.' }\n format.js { }\n format.json { render :back, status: :created, location: @export_budget }\n else\n @result = 'not_save'\n format.html { render :new }\n format.js { }\n format.json { render json: @export_budget.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\n puts \"update #{@need.as_json} #{updated_params.as_json}\"\n respond_to do |format|\n if @need.update(updated_params)\n puts \"brucep update success\"\n format.html { redirect_to new_need_path }\n format.json { render :show, status: :ok, location: @need }\n else\n format.html { render :edit }\n format.json { render json: @need.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @funding_requirement.update(funding_requirement_params)\n format.html { redirect_to @funding_requirement, notice: 'Funding requirement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @funding_requirement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @deployment.update(deployment_params)\n services_params(@deployment).each do |service_name, version_name|\n version = Version.find_by(name: version_name)\n @deployment.versions << version if version\n end\n @deployment.save\n format.html { redirect_to @deployment, notice: 'Deployment was successfully updated.' }\n format.json { render :show, status: :ok, location: @deployment }\n else\n format.html { render :edit }\n format.json { render json: @deployment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @billable.update(billable_params)\n format.html { redirect_to @billable, notice: 'Billable was successfully updated.' }\n format.json { render :show, status: :ok, location: @billable }\n else\n format.html { render :edit }\n format.json { render json: @billable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @export_type.update(export_type_params)\n format.html { redirect_to @export_type, notice: 'Export type was successfully updated.' }\n format.json { render :show, status: :ok, location: @export_type }\n else\n format.html { render :edit }\n format.json { render json: @export_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @export_budget = ExportBudget.new(export_budget_params)\n @export_budget.author = current_user\n respond_to do |format|\n if @export_budget.save\n format.html { redirect_to @export_budget, notice: 'Export budget was successfully created.' }\n format.js { }\n format.json { render :back, status: :created, location: @export_budget }\n else\n format.html { render :new }\n format.js { }\n format.json { render json: @export_budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bundlesticker = Bundlesticker.find(params[:id])\n\n respond_to do |format|\n if @bundlesticker.update_attributes(params[:bundlesticker])\n format.html { redirect_to @bundlesticker, notice: 'Bundlesticker was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bundlesticker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @breakdown = Breakdown.find(params[:id])\n\n respond_to do |format|\n if @breakdown.update_attributes(params.require(:breakdown).permit(:bdate, :description, :vehicle_id))\n format.html { redirect_to breakdowns_url,\n notice: 'Breakdown was successfully updated.' }\n format.json { head :no_content }\n else\n prepFormVariables\n format.html { render action: \"edit\" }\n format.json { render json: @breakdown.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bill = Bill.find_by(uid:params[:id]).extend(Billit::BillRepresenter)\n @bill.from_json(request.body.read)\n @bill.save\n begin\n Sunspot.index!(@bill)\n rescue\n puts \"#{$!}\"\n puts \"unindexed bill: \" + @bill.uid\n end\n respond_with @bill, :represent_with => Billit::BillRepresenter\n end",
"def update\n respond_to do |format|\n add_items\n if @package.update(package_params)\n format.html { redirect_to @package, notice: 'Package was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n @blueprint = Blueprint.find(params[:id])\n\n respond_to do |format|\n if @blueprint.update_attributes(params[:blueprint])\n format.html { redirect_to(blueprint_path(@blueprint), :notice => 'Blueprint was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @blueprint.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sub_package.update(sub_package_params)\n format.html { redirect_to @sub_package, notice: 'Sub package was successfully updated.' }\n format.json { render :show, status: :ok, location: @sub_package }\n else\n format.html { render :edit }\n format.json { render json: @sub_package.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boc.update(boc_params)\n format.html { redirect_to @boc, notice: 'Boc was successfully updated.' }\n format.json { render :show, status: :ok, location: @boc }\n else\n format.html { render :edit }\n format.json { render json: @boc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @fixed_asset.update(fixed_asset_params)\n FixedAsset.reindex\n format.html { redirect_to @fixed_asset, notice: 'Fixed asset was successfully updated.' }\n format.json { render :show, status: :ok, location: @fixed_asset }\n else\n format.html { render :edit }\n format.json { render json: @fixed_asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @barrels_income.update(barrels_income_params)\n format.html { redirect_to @barrels_income, notice: 'Barrels income was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @barrels_income.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bill = Bill.find(params[:id])\n\n if @bill.update(params[:bill])\n head :no_content\n else\n render json: @bill.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @ticketbill.update(ticketbill_params)\n format.html { redirect_to @ticketbill, notice: 'Ticketbill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ticketbill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @supermarket = Supermarket.find(params[:id]) \n respond_to do |format|\n if @supermarket.update(supermarket_params)\n format.json { render json: @supermarket, status: :ok }\n end\n end\n end",
"def update\n @monthlybill = Monthlybill.find(params[:id])\n\n respond_to do |format|\n if @monthlybill.update_attributes(params[:monthlybill])\n format.html { redirect_to @monthlybill, notice: 'Monthlybill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @monthlybill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bid = @swarm_request.bids.find(params[:id])\n\n respond_to do |format|\n if @bid.update_attributes(params[:bid])\n format.html { redirect_to(swarm_request_bid_url(:id => @bid.to_param, :swarm_request_id => @swarm_request.to_param), :notice => 'Bid was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bid.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n respond_to do |format|\n if @batch_file.update(batch_file_params)\n format.html { redirect_to @batch_file, notice: \"Batch file was successfully updated.\" }\n format.json { render :show, status: :ok, location: @batch_file }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @batch_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tenant_fee.update(tenant_fee_params)\n format.html { redirect_to @tenant_fee, notice: 'Tenant fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @tenant_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to budgets_path }\n format.json { render json: @budget, status: :created, location: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bill = Bill.find(params[:id])\n\n respond_to do |format|\n if @bill.update_attributes(params[:period])\n format.html { redirect_to @bill, notice: t('activerecord.attributes.bill.successfully') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n respond_to do |format|\n if @vehicle_boat_part.update(vehicle_boat_part_params)\n format.html { redirect_to @vehicle_boat_part, notice: 'Vehicle boat part was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_boat_part }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_boat_part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @boat.update(boat_params)\n head :no_content\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end",
"def update\n @bod.assign_attributes(bod_params)\n # ask_for_permission(@bod, 'update_bod') and return if current_user.cannot 'update_bod'\n # Extract category, if given\n category = params[:bod][:category]\n unless category.nil?\n @bod.category_type, @bod.category_id = category.split(':')\n end\n #\n @bod.save ?\n are_saved = update_balances(@bod) : are_saved = [false]\n respond_to do |format|\n if are_saved.all?\n format.html { redirect_to bods_url, notice: @bod.table_name_to_show.concat(' fue actualizado satisfactoriamente.') }\n else\n format.html { render :edit }\n format.json { render json: @bod.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bill = Bill.find(params[:id])\n\n respond_to do |format|\n if @bill.update_attributes(params[:bill])\n # Update all energy goals related to this bill\n updateEnergyGoals(@bill)\n format.html { redirect_to @bill, notice: 'Bill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @flow_bill.update(flow_bill_params)\n format.html { redirect_to @flow_bill, notice: '流水账更新成功!' }\n format.json { render :show, status: :ok, location: @flow_bill }\n else\n format.html { render :edit }\n format.json { render json: @flow_bill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bom_output.update(bom_output_params)\n format.html { redirect_to @bom_output, notice: 'Bom output was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bom_output.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@assembly = Assembly.find(params[:id])\n @assembly.package_id = params[:package_id]\n respond_to do |format|\n if @assembly.update_attributes(params[:assembly])\n format.html { redirect_to [@plan, @assembly], notice: 'Assembly was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @assembly.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @budgetcategory = Budgetcategory.find(params[:id])\n\n respond_to do |format|\n if @budgetcategory.update_attributes(params[:budgetcategory])\n format.html { redirect_to @budgetcategory, notice: 'Budgetcategory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budgetcategory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n add_breadcrumb \"Batches\", batches_url\n add_breadcrumb \"Edit Batch\"\n respond_to do |format|\n if @batch.update(batch_params)\n format.html { redirect_to @batch, notice: 'Batch was successfully updated.' }\n format.json { render :show, status: :ok, location: @batch }\n else\n format.html { render :edit }\n flash[:alert] = @batch.errors.full_messages.to_sentence\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @breakdown = Breakdown.find(params[:id])\n\n respond_to do |format|\n if @breakdown.update_attributes(params[:breakdown])\n format.html { redirect_to @breakdown, notice: 'Breakdown was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @breakdown.errors, status: :unprocessable_entity }\n end\n end\n end"
]
| [
"0.70865214",
"0.6602434",
"0.6531733",
"0.6527077",
"0.6527077",
"0.64581615",
"0.64581615",
"0.6326326",
"0.63256735",
"0.6191894",
"0.6118001",
"0.6056394",
"0.60519725",
"0.60293",
"0.60031736",
"0.6001804",
"0.6001043",
"0.5991407",
"0.59882265",
"0.5937003",
"0.5888964",
"0.5870276",
"0.5852774",
"0.5762944",
"0.57524896",
"0.57498693",
"0.5736037",
"0.5700866",
"0.5696527",
"0.568311",
"0.566485",
"0.5662306",
"0.56341743",
"0.563008",
"0.5627333",
"0.5623165",
"0.55931413",
"0.55931413",
"0.55931413",
"0.55931413",
"0.55908144",
"0.5578516",
"0.55715495",
"0.557012",
"0.5569247",
"0.55665535",
"0.5540061",
"0.5532896",
"0.5517687",
"0.5517687",
"0.55044216",
"0.55038685",
"0.55017626",
"0.5499032",
"0.5494328",
"0.5491889",
"0.5487642",
"0.54834884",
"0.54776436",
"0.54727393",
"0.54701966",
"0.54677975",
"0.54662675",
"0.5454539",
"0.54524106",
"0.5451641",
"0.5451259",
"0.5449715",
"0.54423374",
"0.5437003",
"0.5435081",
"0.54293567",
"0.542799",
"0.5421062",
"0.5417969",
"0.5416433",
"0.5414731",
"0.5409041",
"0.54020983",
"0.53982246",
"0.5390778",
"0.53852993",
"0.53834194",
"0.53817284",
"0.5379908",
"0.53793365",
"0.5376545",
"0.5375552",
"0.5371711",
"0.53710836",
"0.5367563",
"0.53599405",
"0.5357321",
"0.5347199",
"0.53469044",
"0.53465563",
"0.5345313",
"0.5342338",
"0.5340433"
]
| 0.7553417 | 1 |
DELETE /export_budgets/1 DELETE /export_budgets/1.json | def destroy
@export_budget.destroy
respond_to do |format|
format.html { redirect_to :back, notice: 'Export budget was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if params[:id] =~ /\\d+/\n @budget = Budget.find(params[:id])\n ActiveRecord::Base.connection.execute(\"delete from budget_products where budget_id = #{params[:id]}\")\n @budget.destroy\n end\n \n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @budget_src = BudgetSrc.find(params[:id])\n @budget_src.destroy\n\n respond_to do |format|\n format.html { redirect_to(budget_srcs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @budget.destroy\n\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: \"Budget was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to budget_path(params[:budget_id]) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @budget_item = BudgetItem.find(params[:id])\n @budget_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(budget_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @export.destroy\n respond_to do |format|\n format.html { redirect_to exports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @budget_request.destroy\n respond_to do |format|\n format.html { redirect_to budget_requests_url, notice: 'Budget request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @therapy_budget.destroy\n respond_to do |format|\n format.html { redirect_to therapy_budgets_url, notice: 'Therapy budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @budget_line.destroy\n respond_to do |format|\n format.html { redirect_to budget_lines_url, notice: 'Budget line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @export_run = ExportRun.find(params[:id])\n @export_run.destroy\n\n respond_to do |format|\n format.html { redirect_to export_runs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line = Line.find(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to budget_path(@line.budget) }\n format.json { head :no_content }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @ptbudget = Ptbudget.find(params[:id])\n @ptbudget.destroy\n\n respond_to do |format|\n format.html { redirect_to(ptbudgets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ptbudget = Ptbudget.find(params[:id])\n @ptbudget.destroy\n\n respond_to do |format|\n format.html { redirect_to(ptbudgets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @budgetcategory = Budgetcategory.find(params[:id])\n @budgetcategory.destroy\n\n respond_to do |format|\n format.html { redirect_to budgetcategories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ct_gov_import_export.destroy\n respond_to do |format|\n format.html { redirect_to ct_gov_import_exports_url, notice: 'Ct gov import export was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @budget_for_order.destroy\n respond_to do |format|\n format.html { redirect_to budget_for_orders_url, notice: 'Budget for order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @export = Export.find(params[:id])\n @export.destroy\n\n respond_to do |format|\n format.html { redirect_to(exports_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @budget_file.destroy\n respond_to do |format|\n format.html { redirect_to budget_files_path, notice: 'BudgetFile was successfully destroyed.' }\n format.js\n format.json { head :no_content }\n end\n end",
"def destroy\n @budget_disposition.destroy\n respond_to do |format|\n format.html { redirect_to budget_dispositions_url, notice: 'Budget disposition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @req_breakdown = ReqBreakdown.find(params[:id])\n @req_breakdown.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_req_breakdowns_url) }\n format.xml { head :ok }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def deleteFlatpack( flatpack_id)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n return doCurl(\"delete\",\"/flatpack\",params)\n end",
"def destroy\n @sys_export = SysExport.find(params[:id])\n @sys_export.destroy\n\n respond_to do |format|\n format.html { redirect_to sys_exports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n f_respond_destroy(@budgetitem.destroy, @budgetitem.name, budgetitems_url)\n# @budgetitem.destroy\n# respond_to do |format|\n# format.html { redirect_to budgetitems_url, notice: 'Budgetitem was successfully destroyed.' }\n# format.json { head :no_content }\n# end\n end",
"def destroy\n @climb_datum = ClimbDatum.find(params[:id])\n @climb_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to climb_data_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @monthly_revenue_breakdown_item = MonthlyRevenueBreakdownItem.find(params[:id])\n @monthly_revenue_breakdown_item.destroy\n\n respond_to do |format|\n format.html { redirect_to monthly_revenue_breakdown_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @genbank_file.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @item = item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(budget_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @budget_approver.destroy\n respond_to do |format|\n format.html { redirect_to budget_approvers_url, notice: 'Budget approver page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @monthly_overhead_breakdown_item = MonthlyOverheadBreakdownItem.find(params[:id])\n @monthly_overhead_breakdown_item.destroy\n\n respond_to do |format|\n format.html { redirect_to monthly_overhead_breakdown_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @budgeting_type = BudgetingType.find(params[:id])\n @budgeting_type.destroy\n\n respond_to do |format|\n format.html { redirect_to budgeting_types_url }\n format.json { head :no_content }\n end\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def destroy\n @budget_heading = BudgetHeading.find(params[:id])\n respond_to do |format|\n if @budget_heading.destroy\n format.html { redirect_to budget_headings_url,\n notice: (crud_notice('destroyed', @budget_heading) + \"#{undo_link(@budget_heading)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to budget_headings_url, alert: \"#{@budget_heading.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @budget_heading.errors, status: :unprocessable_entity }\n end\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @brave_burst.destroy\n respond_to do |format|\n format.html { redirect_to brave_bursts_url }\n format.json { head :no_content }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @bundles_items_design = BundlesItemsDesign.find(params[:id])\n @bundles_items_design.destroy\n\n respond_to do |format|\n format.html { redirect_to bundles_items_designs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @import = @business.imports.find(params[:id])\n @import.reload.destroy\n\n respond_to do |format|\n format.html { redirect_to business_imports_url(@business) }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @bill = Bill.find(params[:id])\n # TODO: \"un-updateEnergyGoals\" related to this bill\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bicicletum.destroy\n respond_to do |format|\n format.html { redirect_to bicicleta_url }\n format.json { head :no_content }\n end\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def delete_analysis(analysis_id); rest_delete(\"#{link('analyses')}/#{analysis_id}\"); nil; end",
"def destroy\n set_proposed_item\n calculate_saving\n \n\n @proposed_item.destroy\n respond_to do |format|\n format.html { redirect_to @budget, notice: 'Proposed item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @average_bp.destroy\n respond_to do |format|\n format.html { redirect_to admin_average_bps_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @monthlybill = Monthlybill.find(params[:id])\n @monthlybill.destroy\n\n respond_to do |format|\n format.html { redirect_to monthlybills_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n @loadbalancer.send_delete\n\n respond_to do |format|\n format.html { redirect_to loadbalancers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @project_download = ProjectDownload.find(params[:id])\n @project_download.destroy\n\n respond_to do |format|\n format.html { redirect_to project_downloads_url }\n format.json { head :no_content }\n end\n end",
"def b2_delete_file_version(file)\n\n auth_hash = convert_json(b2_authorize_account)\n api_url = auth_hash[\"apiUrl\"]\n account_authorization_token = auth_hash[\"authorizationToken\"]\n\n file_hash = parse_files_json(file)\n file_name = file\n file_id = file_hash[file]\n\n uri = URI(\"#{api_url}/b2api/v1/b2_delete_file_version\")\n req = Net::HTTP::Post.new(uri)\n req.add_field(\"Authorization\",\"#{account_authorization_token}\")\n req.body = \"{\\\"fileName\\\":\\\"#{file_name}\\\", \\\"fileId\\\":\\\"#{file_id}\\\"}\"\n http = Net::HTTP.new(req.uri.host, req.uri.port)\n http.use_ssl = true\n res = http.start {|http| http.request(req)}\n\n case res\n when Net::HTTPSuccess then res.body\n when Net::HTTPRedirection then fetch(res['location'], limit - 1)\n else res.error!\n end\n\nend",
"def destroy\n @journal_debit.destroy\n respond_to do |format|\n format.html { redirect_to journal_debits_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @bbhk.destroy\n respond_to do |format|\n format.html { redirect_to bbhks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bill_summary.destroy\n respond_to do |format|\n format.html { redirect_to bill_summaries_url, notice: 'Bill summary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to bills_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @deposit_threshold = DepositThreshold.find(params[:id])\n @deposit_threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to(deposit_thresholds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @backup_file = BackupFile.find(params[:id])\n @backup_file.destroy\n\n respond_to do |format|\n format.html { redirect_to backup_files_url }\n format.json { head :no_content }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n @dbs_deposit = DbsDeposit.find(params[:id])\n @dbs_deposit.destroy\n\n respond_to do |format|\n format.html { redirect_to(dbs_deposits_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @backup.destroy\n respond_to do |format|\n format.html { redirect_to backups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset_balance_item.destroy\n respond_to do |format|\n format.html { redirect_to asset_balance_items_url, notice: 'Asset balance item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @apk_bin = ApkBin.find(params[:id])\n @apk_bin.destroy\n\n respond_to do |format|\n format.html { redirect_to apk_bins_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @barrels_income.destroy\n respond_to do |format|\n format.html { redirect_to barrels_incomes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bank = Bank.find(params[:id])\n @bank.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_banks_url }\n format.json { head :no_content }\n end\n end",
"def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end",
"def destroy\n @fabric = Fabric.find(params[:id])\n @fabric.destroy\n\n respond_to do |format|\n format.html { redirect_to fabrics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @bill = Bill.find(params[:id])\r\n @bill.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to bills_url, only_path: true }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @breakdown = Breakdown.find(params[:id])\n @breakdown.destroy\n\n redirect_to @breakdown.bill\n\n end",
"def destroy\n @bodily_output.destroy\n respond_to do |format|\n format.html { redirect_to bodily_outputs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bank = Bank.find(params[:id])\n @bank.destroy\n\n respond_to do |format|\n format.html { redirect_to banks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bill.destroy\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bill.destroy\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @baggage = Baggage.find(params[:id])\n @baggage.destroy\n\n respond_to do |format|\n format.html { redirect_to baggages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cabinet_balancer.destroy\n respond_to do |format|\n format.html { redirect_to cabinet_balancers_path, notice: I18n.t('deleted') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bank.destroy\n respond_to do |format|\n format.html { redirect_to banks_url, notice: '' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @record = Asset.find(params[:id])\n @record.trash\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n #binding.pry\n @balance = Balance.find(params[:id])\n @balance.destroy\n respond_to do |format|\n format.html { redirect_to balances_url }\n format.json { head :no_content }\n end\n end",
"def remove_artifacts(job_ids)\n\n job_ids.each do |id|\n api_url = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/jobs/#{id}/artifacts\"\n\n begin\n response = RestClient::Request.new(\n :method => :delete,\n :url => api_url,\n :verify_ssl => false,\n :headers => {\"PRIVATE-TOKEN\" => API_TOKEN}\n ).execute\n\n if response != nil && response.code == 204\n puts \"delete job artifacts #{id} => success\"\n else\n puts \"delete job artifacts #{id} => failed\"\n end\n\n rescue RestClient::ExceptionWithResponse => err\n puts \"delete job artifacts #{id} => error\"\n end\n end\n\nend",
"def destroy\n @importtodb = Importtodb.find(params[:id])\n @importtodb.destroy\n\n respond_to do |format|\n format.html { redirect_to importtodbs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @breakdown = Breakdown.find(params[:id])\n @breakdown.destroy\n\n respond_to do |format|\n format.html { redirect_to(breakdowns_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 path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @cashflow = Cashflow.find(params[:id])\n @cashflow.destroy\n\n respond_to do |format|\n format.html { redirect_to cashflows_url }\n format.json { head :no_content }\n end\n end",
"def destroy_rest\n @item_usage = ItemUsage.find(params[:id])\n @item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_usages_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @download = Download.find(params[:id])\n @download.destroy\n\n respond_to do |format|\n format.html { redirect_to downloads_url }\n format.json { head :no_content }\n end\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @investigated.destroy\n respond_to do |format| \n format.json { head :no_content }\n end\n end"
]
| [
"0.7124757",
"0.7117221",
"0.69661367",
"0.68645066",
"0.68367815",
"0.6817065",
"0.6817065",
"0.6817065",
"0.6806081",
"0.6765439",
"0.6673919",
"0.660283",
"0.65861756",
"0.6483434",
"0.64724207",
"0.6471914",
"0.64633",
"0.6438148",
"0.64346224",
"0.64345163",
"0.64345163",
"0.6411581",
"0.6401329",
"0.63655293",
"0.6355332",
"0.63485634",
"0.63398117",
"0.6332699",
"0.6329373",
"0.6308148",
"0.63070506",
"0.6301578",
"0.6267287",
"0.6260719",
"0.625884",
"0.6254673",
"0.6254271",
"0.6242123",
"0.62163204",
"0.61980134",
"0.61877525",
"0.6178005",
"0.6177129",
"0.61629754",
"0.6157318",
"0.6156437",
"0.615218",
"0.61400265",
"0.613799",
"0.6126222",
"0.61236733",
"0.61140627",
"0.61103296",
"0.61097854",
"0.6107436",
"0.6107038",
"0.6102585",
"0.6102045",
"0.6098785",
"0.60938495",
"0.60920674",
"0.6091676",
"0.60907465",
"0.6089976",
"0.60877824",
"0.60877824",
"0.60877824",
"0.60877824",
"0.6087481",
"0.6086711",
"0.6083234",
"0.6080554",
"0.6075391",
"0.6073895",
"0.60726845",
"0.6065232",
"0.6062863",
"0.60610014",
"0.60608864",
"0.6060668",
"0.60563374",
"0.60544944",
"0.60544944",
"0.60543084",
"0.60512406",
"0.6051021",
"0.6049019",
"0.6046646",
"0.6042462",
"0.6041092",
"0.60355765",
"0.60322446",
"0.60319436",
"0.6029575",
"0.6023877",
"0.602352",
"0.60227394",
"0.60160774",
"0.60150135"
]
| 0.75227684 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_export_budget
@export_budget = ExportBudget.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 setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; 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 workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def 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 startcompany(action)\n @done = true\n action.setup\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 setup\n #implement in subclass;\n end",
"def after_set_callback; 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 setup(easy)\n super\n easy.customrequest = @verb\n end",
"def around_hooks; end",
"def save_action; 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 shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def duas1(action)\n action.call\n action.call\nend"
]
| [
"0.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.53314966",
"0.53114754",
"0.52984965",
"0.52977055",
"0.5296272",
"0.5260649",
"0.5245076",
"0.52388334",
"0.52388334",
"0.52388334",
"0.52388334",
"0.52388334",
"0.5235081",
"0.52321917",
"0.5228592",
"0.5220735",
"0.52198535",
"0.52139324",
"0.5208539",
"0.5206585",
"0.5178542",
"0.5175199",
"0.5173538",
"0.5167041",
"0.51614195",
"0.51577675",
"0.5153909",
"0.51528823",
"0.5152225",
"0.51429904",
"0.5141399",
"0.51345575",
"0.51145",
"0.5114052",
"0.5114052",
"0.5110216",
"0.5108656",
"0.50935394",
"0.5089196",
"0.5081936",
"0.5079627",
"0.50675833",
"0.5056105",
"0.5053687",
"0.5050475",
"0.5050475",
"0.503471",
"0.5028311",
"0.501982",
"0.50157547",
"0.5013552",
"0.50014806",
"0.50011593",
"0.49976763",
"0.4990292",
"0.4990292",
"0.49882022",
"0.4981269",
"0.49792367",
"0.49766538",
"0.4967978",
"0.49667212",
"0.4958987",
"0.49572337",
"0.49550423",
"0.4954479",
"0.4952353",
"0.494726",
"0.4944055",
"0.4935437",
"0.4931248",
"0.49283475",
"0.49281213",
"0.49268973",
"0.4921738",
"0.49204507",
"0.4918924",
"0.49182287",
"0.4916538",
"0.49158585",
"0.49156788"
]
| 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def export_budget_params
# params.require(:export_budget).permit(:year, :title,:town,:pages => [:title_page,:content_page,:last_page,:content => [:public_budget]])
params.require(:export_budget).permit!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
]
| [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
]
| 0.0 | -1 |
Returns the ID of the customer success with most customers | def execute
customer_success_attending = @away_customer_success.any? ? fetch_customer_success_attending : @customer_success
ordered_customer_success = order_by_score(customer_success_attending)
ordered_customers = @customers.empty? ? [] : order_by_score(@customers)
distribute_customers_per_customer_success(ordered_customer_success, ordered_customers)
customer_success_with_most_customers = group_by_most_attendings(ordered_customer_success)
return 0 unless customer_success_with_most_customers[1].count == 1
customer_success_with_most_customers[1].first[:id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def best_customers\n Invoice.where(merchant_id: self.id)\n .joins(:transactions, :customer)\n .select('customers.*, count(transactions) as most_success')\n .where('transactions.result = ?', 0)\n .group('customers.id')\n .order('most_success desc')\n .limit(5)\n end",
"def execute\n if number_available_customer_successes && max_number_customers\n @available_customer_successes = recover_available_cs_sorted_by_score\n @customers = recover_customers_sorted_by_score\n @available_customer_successes = match_customers_to_customer_successes.sort_by(&:number_of_customers).reverse!\n return winning_customer_success_id\n end\n 0\n end",
"def favorite_customer\n customers.\n joins(:transactions).\n where(transactions: {result: \"success\"}).\n group(:id).\n order(\"transactions.count\").last\n end",
"def execute\n raise StandardError, \"Limit for CS away not satisfacted\" if !limit_cs_away?\n raise StandardError, \"Limit for CS exceed (max: 999)\" if !limit_cs?\n raise StandardError, \"Limit for CUSTOMER exceed (max: 999.999)\" if !limit_customer? \n\n remove_away\n @customer_success.sort_by!{|cs| cs[:score]}\n @customers.sort_by!{|c| c[:score]}\n\n ranking = Hash.new(0)\n \n @customers.each do |customer|\n cs_index = 0\n while @customer_success[cs_index][:score] < customer[:score]\n cs_index += 1\n break if cs_index == @customer_success.size\n end\n if cs_index < @customer_success.size\n ranking[@customer_success[cs_index][:id]] += 1\n else\n next\n end\n end\n \n # check if there are cs with the same number of customers\n result = Hash[ranking.select { |k, v| v == ranking.values.max}]\n if result.count > 1 || result.empty?\n return 0\n else\n result.keys[0]\n end\n end",
"def number_of_customers()\n sql = 'SELECT title, SUM(CASE WHEN customer_id is NULL then 0 else 1 END) FROM tickets FULL OUTER JOIN screenings on tickets.screening_id = screenings.id FULL OUTER JOIN films on screenings.film_id = films.id WHERE films.id = $1 group by films.title'\n values = [@id]\n result = SqlRunner.run(sql, values)[0]['sum'].to_i\n end",
"def num_of_customers\n total_customers = self.customers\n return total_customers.size\n end",
"def count_customers\n return customers().length\n end",
"def customers_count()\n return customers().length()\n end",
"def favorite_customer\n cust = Customer.joins(invoices: [:transactions])\n .where(\"transactions.result = ?\", \"success\")\n .select(\"customers.*, count(transactions.id) as sales\")\n .group(:id)\n .order(\"sales desc\")\n .limit(1)\n\n cust.to_a.shift\n end",
"def favorite_customer\n Customer.joins(invoices: :transactions)\n .where('transactions.result = 0')\n .where(\"invoices.merchant_id = ?\", self)\n .group(:id)\n .select(\"customers.*, COUNT(transactions.id) AS total_transactions\")\n .order(\"total_transactions DESC\")\n .first\n end",
"def execute\n # Write your solution here\n\n #1- Atualizar gerentes somente com os disponiveis\n availableCustomerSuccess = @customer_success.reject {|item| @customer_success_away.include?(item[:id])}\n\n #2- Ordenar os gerentes success pelo nível dele\n availableCustomerSuccess = availableCustomerSuccess.sort_by {|item| item[:score]}\n\n #3- Verifica se score do ultimo gerente é o mesmo do ultimo cliente\n customerSuccessVerify = availableCustomerSuccess[-1]\n customerLast = @customers[-1]\n if customerSuccessVerify[:score] == customerLast[:score]\n return customerSuccessVerify[:id]\n end\n\n #4- Percorrer todos os clientes encontrar o primeiro com o maior ou igual score, adicionar contador\n maxCounter = 0\n sum = 1\n @customers.each_with_index {\n |valCustomer, indexCustomer|\n availableCustomerSuccess.each_with_index {\n |val, index|\n \n if val[:score] >= valCustomer[:score] \n if val.key?(:'counter')\n availableCustomerSuccess[index][:counter] += sum\n if val[:score] > maxCounter\n maxCounter = val[:counter]\n end\n else\n availableCustomerSuccess[index] = hash_add(val, 'counter', sum)\n end\n\n break\n end\n }\n }\n\n #5- Retorna customer encontrado, caso for igual a 1, senão retorna 0\n customersFound = availableCustomerSuccess.select {|item| item[:counter] == maxCounter} \n\n if customersFound.length() == 1\n return customersFound[0][:id]\n end\n\n return 0\n end",
"def total_no_of_customers()\n @@no_of_customers += 1\n puts \"Total number of customers: #@@no_of_customers\"\n end",
"def find_number_of_customers\n sql = \"SELECT customers.*\n FROM customers\n INNER JOIN tickets\n ON tickets.customer_id = customers.id\n WHERE film_id = $1\"\n values = [@id]\n customers_array = SqlRunner.run(sql, values)\n customer_objects = customers_array.count\n return customer_objects\n end",
"def total_no_of_customers()\n @@no_of_customers += 1\n puts \"Total number of customers: #@@no_of_customers\"\n end",
"def num_of_customers()\n customers.size\nend",
"def max_results\n $testCaseID = \"VT229-0012\"\n con_remove\n createContact 20\n \n @count = Rho::RhoContact.find(:count,:max_results)\n puts @count\n Alert.show_status('Contacts',@count,'hide')\n redirect :action => :index\n end",
"def increment_customers\n self.num_customers += 1\n end",
"def how_many_customers?()\n customers_booked = customers()\n return customers.length()\n end",
"def customer_count()\n customers().count()\nend",
"def get_most_frequent_client\n client, request_count = @client_counter.max_by{|k, v| v}\n return client\n end",
"def customer_id\n return @customer_id\n end",
"def highest_comment_count\n User.preload(:comments).joins(:comments).group('users.id').order(Arel.sql('count(comments.id) desc')).limit(10)\n end",
"def decrement_customers\n self.num_customers -= 1\n end",
"def execute\n customers.each do |customer|\n manager = search_cs_manager(sorted_available_cs_managers, customer)\n next if manager.nil?\n\n add_customer_to_manager(customer, manager)\n end\n\n return 0 if @top_manager[:manager].nil? # no manager received a costumer\n return 0 if @top_manager[:customer_count_tie] # tie between two managers\n\n @top_manager[:manager][:id]\n end",
"def all_customers_alt() # Read film1.all_customers_alt\n sql = \"SELECT COUNT(id) FROM tickets WHERE film_id = $1\"\n values = [@id]\n result = SqlRunner.run(sql, values)\n count_hash = result[0]\n return count_hash['count']\n end",
"def count_of_customers_watching_film()\n sql = \"SELECT COUNT(*) FROM customers INNER JOIN tickets ON customers.id = tickets.cust_id WHERE tickets.film_id = $1\"\n # sql = \"SELECT COUNT(*) FROM tickets where film_id = $1\"\n values = [@id]\n cust_count = SqlRunner.run(sql, values)\n return cust_count[0]['count'].to_i\n end",
"def total_no_customer()\n @@no_of_customer+=1\n puts \"The total number of customer is #{@@no_of_customer} \"\n puts \" \"\n end",
"def most_active_users\n ids = replies.not_anonymous.count(:user_id,\n :group => :user_id,\n :order => \"count_user_id DESC\",\n :limit => (4 - experts.length)).keys\n User.find(ids.compact)\n end",
"def most_test_cases\n @most = User.most_test_cases\n end",
"def most_active_user\n \n end",
"def how_many_tickets\n sql = 'SELECT COUNT(customer_id) FROM tickets WHERE customer_id = $1'\n values = [@id]\n SqlRunner.run(sql, values)[0]['count'].to_i\n end",
"def successful_users_count\n return @successful_users_count\n end",
"def assign_user_id(users)\r\n highest_id = users.ids.max || 100 # reserve first 100 ids for testing\r\n return highest_id + 1\r\nend",
"def most_popular\n\n # Recipecard.all.select {|rc| rc.recipe ==self}\n # most_popular.map {|rc| rc.users}\n recipe_hash = {}\n RecipeCard.all.each do |recipecard|\n if recipe_hash[recipecard.name]==nil\n recipe_hash[recipecard.name]=1\n else\n recipe_hash[recipecard.name]+= 1\n end\n end\n recipe_hash.max_by{|k,v| v}[0]\n end",
"def get_customer_id\n return @customer_id\n end",
"def count_most_often(c)\n numbers = {}\n sorted = []\n (1..42).to_a.each do |e|\n conditions = \"(n1 = #{e} OR n2 = #{e} OR n3 = #{e} OR n4 = #{e} OR n5 = #{e})\"\n conditions += \" AND (no >= #{no-100})\" #if !n.nil?\n r = Result.count(:conditions => conditions,\n :order =>'no DESC')\n numbers[e] = r\n end\n numbers.sort_by{|k,v| v}.reverse.each{|e| sorted << e[0]}\n while numbers[c] == numbers[c+1]\n c += 1\n end\n #p sorted\n return sorted[0..c-1]\n end",
"def next_customer_initial\n @@customer_initial_index ||= 0\n initial = customer_initials[@@customer_initial_index]\n @@customer_initial_index += 1\n initial\n end",
"def get_top_order\n cards.maximum('card_order') || 0\n end",
"def customer_count\n sql = \"SELECT c.* FROM customers c INNER JOIN tickets t ON t.customer_id = c.id WHERE t.film_id = #{@id};\"\n customers = SqlRunner.run(sql)\n return customers.count\nend",
"def customer_id\n @row[\"購入者 顧客ID\"].to_s\n end",
"def id\n customer_id\n end",
"def showMostSearched\n @user = User.order('counter DESC').limit(params[:limit])\n render json: @user\n end",
"def new_client_id\n if clients.keys.length > 0\n new_id = clients.keys.max + 1\n else\n new_id = 1\n end\n\n return new_id\n end",
"def active_customers_ids\n @active_customers_ids ||= flatten_calls.collect { |c| c[:customer_acc_id] }.uniq\n end",
"def ticket_count()\n sql = \"SELECT COUNT (tickets.*) FROM tickets\n WHERE tickets.customer_id = $1\"\n values = [@id]\n result = SqlRunner.run(sql, values)[0].first\n return result\n end",
"def top_copurchases(sku,n,counts)\n counts[sku].flatten.group_by(&:sku).sort{|a,b|b[1].length <=> a[1].length}[0..(n-1)].map{|a|[a[0],a[1].length]}\nend",
"def customer_id\n customer.id\n end",
"def number_of_commenting_users\n temp = describing_comments.collect{|comment| comment.submitter_id}.uniq.length\n ((temp >= @@low_amount_of_commenters)?(temp.to_s):(\"פחות מ-#{@@low_amount_of_commenters}\"))\n end",
"def bottom_merchants_by_invoice_count\n merchants = @engine.merchants.all\n threshold = average_invoices_per_merchant - 2 * average_invoices_per_merchant_standard_deviation\n merchants.inject([]) do |top_merchants, merch|\n invoices = @engine.invoices.find_all_by_merchant_id(merch.id)\n top_merchants << merch if invoices.length < threshold\n top_merchants\n end\n end",
"def ticket_count()\n sql = \"SELECT COUNT(*) FROM tickets WHERE cust_id = $1\"\n values = [@id]\n count = SqlRunner.run(sql, values)\n return count[0]['count'].to_i\n end",
"def best_tipper\n meal_with_highest_tip = meals.max do |meal_a, meal_b|\n meal_a.tip <=> meal_b.tip\n end\n\n meal_with_highest_tip.customer \n end",
"def success_count\n return @success_count\n end",
"def current_customer(unit)\n customers.at(unit).first\n end",
"def next\r\n\r\n Customer.first(:order => 'customers.id', :conditions => [\"customers.id > ?\", self.id])\r\n end",
"def getMostAwesomePerson\n return @persons.max\n end",
"def get_unique_clients\n return @client_counter.length\n end",
"def top_10_fans\n users_array = UserTeam.all.collect{|user| user.user_id}\n most_common_value = users_array.uniq.sort_by{ |i| users_array.count( i ) }.reverse\n biggest_fans = most_common_value.map {|user| User.find(user).name}[0..9]\n users_teams_count = most_common_value.map {|user| User.find(user).teams.count}[0..9]\n counter = 0\n return_hash = {}\n until counter == biggest_fans.length do\n return_hash[biggest_fans[counter].to_s] = users_teams_count[counter].to_s\n counter += 1\n end\n return_hash\nend",
"def checkout_time(customers, n)\n arr = Array.new(n, 0)\n customers.each { |customer| arr[arr.index(arr.min)] += customer }\n arr.max\nend",
"def customer_id=(value)\n @customer_id = value\n end",
"def favorite_merchant(id)\n invoices.joins('JOIN merchants ON invoices.merchant_id = merchants.id')\n .joins(:transactions)\n .where('transactions.result = ?', 'success')\n .select('merchants.*, COUNT(transactions.id) AS count')\n .group('merchants.id')\n .order('count DESC')\n .first\n end",
"def max_failed_count\n MAX_FAILED_COUNT\n end",
"def max_incoming_flights\n\n max_count = -1\n @query.get_graph.each_key do |city|\n count = @query.json_graph_api.count_incoming_edges(city)\n if count > max_count\n max_count = count\n end\n end\n return max_count\n\n end",
"def most_money(driver_data)\n driver_id = nil\n most_money = 0\n\n driver_data.each do |driver, data|\n if data[:money] > most_money\n driver_id = driver\n most_money = data[:money]\n end\n end\n\n return driver_id\n\nend",
"def top_comm\n\t\t\t@commenters = User.all.order('comments.id DESC').joins('LEFT JOIN comments ON \n\t\t\t\tcomments.user_id == users.id').group('users.id').where('comments.created_at >= ?',\n\t\t\t\t1.week.ago.utc).limit(10)\n\t\tend",
"def next_id\n (all.map(&:id).max || 0) + 1\n end",
"def highest_bill\n \t@user = Review.order(totalbill: :desc).first(5)\n end",
"def top_readers\n hash = @orders.inject(Hash.new(0)) do |count, order|\n count[order.reader.name] += 1\n count\n end\n top = hash.max_by { |key, value| value }.first\n puts \"Active reader is: #{top}\"\n end",
"def get_last_id\n file = File.dirname(__FILE__) + \"/../data/data.csv\"\n last_id = File.exist?(file) ? CSV.read(file).last[0].to_i + 1 : nil\n @@count_class_instances = last_id || 0\n end",
"def ticket_count()\n sql = \"SELECT * FROM tickets WHERE customer_id = $1\"\n values = [@id]\n SqlRunner.run(sql, values).count\n end",
"def most_commented\n @movies = Movie.joins(:comment).\n select('movie.movie_id, movie.title, count(movie.movie_id) as count').\n group('movie.movie_id').\n order('count DESC').take(10)\n end",
"def max\n negative = txns.select { |t| t.amount.negative? }\n negative.empty? ? 0 : negative.max_by(&:id).id\n end",
"def highest_order_number\n record_set_items_dataset.max(:OrderNumber)\n end",
"def most_duplicates\r\n highest = 0\r\n @seminarians.each {|s| highest = s.duplicate_days if s.duplicate_days > highest}\r\n return highest\r\n end",
"def create_customer\n session[:customer_id] = nil\n session[:customer_oauth_id] = nil\n\n auth = request.env[\"omniauth.auth\"]\n # We should only have one of these.\n oauths = Authentication.where(:provider => auth[\"provider\"],\n :uid => auth[\"uid\"],\n :customer_id.ne => nil,\n :master_id => nil).order(\"created_at desc\").all\n oauth = oauths.first\n oauths.drop(1).each do |oa|\n logger.error \"sessions#create_customer: Removing extra authentications\"\n oa.destroy()\n end\n if oauth\n session[:customer_oauth_id] = oauth.id\n cust = oauth.customer\n if cust != nil\n session[:customer_id] = cust.id\n oauth.last_info = auth[\"info\"]\n oauth.save\n redirect_to my_index_websites_path, :notice => \"Signed in!\"\n else\n redirect_to new_customer_registration_path, :notice => \"Could not find you. Please create an account.\"\n end\n else\n oauth = Authentication.create_with_omniauth(auth)\n session[:customer_oauth_id] = oauth.id\n redirect_to new_customer_registration_path, :notice => \"Need to create an account.\"\n end\n end",
"def get_last_id\n file = File.dirname(__FILE__) + \"/../data/data.csv\"\n last_id = File.exist?(file) ? CSV.read(file).last[0].to_i + 1 : nil\n @@count_class_instances = last_id || 0\n end",
"def get_most_active_users(num_users = 5)\n get_most_generic_for_users(DOCS[:most_active_users], num_users)\n end",
"def last_count\n \tordered_count = self.ordered_year_count.where(\"dam_id = ? AND fish_id = ?\", self.dam_id, self.fish_id)\n \trange = ordered_count.where(:count_date => self.count_date.ago(1.week)..self.count_date)\n \tbegin\n \t\tcount = range[1].count\n \trescue\n \t\treturn false\n \tend\n end",
"def calculate_invoice_identifier\n invoice_array = Invoice.where(year: Time.now.strftime(\"%Y\").to_i, category: @event.category)\n return 1 if invoice_array.empty?\n latest_identifier = invoice_array.last.invoice_identifier\n latest_identifier + 1\n end",
"def customer() #in the tickets (join) table so we can grab customer_id easily, the _id's are already bundled in this table\n sql = \"SELECT * FROM customers WHERE id = $1\"\n values = [@customer_id]\n customer = SqlRunner.run(sql, values).first\n return Customer.new(customer)\n end",
"def next_messages_id\n messages.max{|a,b| a[:id] <=> b[:id]}[:id] + 1\nend",
"def count_drinks_customer()\n @drinks.count\n end",
"def customer(options = nil)\n request = Request.new(@client)\n path = \"/authorization-requests/\" + CGI.escape(@id) + \"/customers\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"customer\"]\n customer = Customer(self._client)\n return_values.push(customer.fill_with_data(body))\n\n \n return_values[0]\n end",
"def most_active\n @users_comments = User.joins(:comment).\n select('user.user_id, user.user_name, user.first_name, user.last_name, count(user.user_id) as count').\n group('user.user_id').\n order('count DESC').take(10)\n\n @users_ratings = User.joins(:rating).\n select('user.user_id, user.user_name, user.first_name, user.last_name, count(user.user_id) as count').\n group('user.user_id').\n order('count DESC').take(10)\n end",
"def max_identities(max)\n @max_identities = max.to_i\n self\n end",
"def number_of_films()\n sql = \"SELECT * FROM tickets where customer_id = $1\"\n values = [@id]\n ticket_data = SqlRunner.run(sql, values)\n return ticket_data.count\n end",
"def biggest_council\n return if payer_breakdown.blank? || payer_breakdown.all?{ |o| o[:organisation_type] != 'Council' }\n council_details = payer_breakdown.select{ |o| o[:organisation_type] == 'Council'}.sort{|a,b| b[:total_spend] <=> a[:total_spend]}.first\n Council.find_by_id(council_details[:organisation_id])\n end",
"def tickets_bought\n sql = \"SELECT COUNT(*)\n FROM tickets\n WHERE tickets.customer_id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)[0][\"count\"].to_i\n end",
"def number_of_creaters(login=nil)\n count_by_frbr(login, :is_created_by, :how_many_roles?) \n end",
"def user_counter \n RecipeCard.all.select{|cards|cards.recipe == self}.count \n end",
"def get_max_interactions\n return @snps.length-1\n end",
"def previous\r\n\r\n Customer.first(:order => 'customers.id DESC', :conditions => [\"customers.id < ?\", self.id])\r\n end",
"def next_expiration_id\n elems = handle.retrieve_elements('USER_TEMPLATE/SCHED_ACTION/ID')\n return 0 unless elems\n elems.to_a.max.to_i + 1\n end",
"def customer_id\n params['customer_id']\n end",
"def most_recent_review\n\t\tself.reviews.sort_by{ |review| review.id }.reverse.first\n\tend",
"def customer\n @customer ||= fetcher.get(Customer, customer_id)\n end",
"def last_mention_count\n Count.find(:first, :conditions => {:city_id => self.id}, :order => 'date DESC').count\n end",
"def number_of_success\n\t\treturn number_of_attempts_with_status(success: true)\n\tend",
"def successful_users_count=(value)\n @successful_users_count = value\n end",
"def get_max_id(tweets)\n\t\tids = []\n\t\ttweets.each{|tweet|\n\t\t\tids.push(tweet['id'])\n\t\t}\n\t\treturn ids.max\n\tend",
"def get_max_id(tweets)\n\t\tids = []\n\t\ttweets.each{|tweet|\n\t\t\tids.push(tweet['id'])\n\t\t}\n\t\treturn ids.max\n\tend"
]
| [
"0.73630947",
"0.6858806",
"0.662369",
"0.64193577",
"0.6311541",
"0.62901014",
"0.6272751",
"0.6252109",
"0.6050386",
"0.5881546",
"0.5833581",
"0.58074903",
"0.5763817",
"0.5755153",
"0.5738761",
"0.5693936",
"0.56691223",
"0.5653916",
"0.55835515",
"0.5535157",
"0.5531788",
"0.55255973",
"0.5520448",
"0.54750925",
"0.5442261",
"0.5391572",
"0.53863984",
"0.5318148",
"0.52952915",
"0.5264284",
"0.5179441",
"0.51754427",
"0.5160298",
"0.5143357",
"0.512511",
"0.51195973",
"0.51158684",
"0.51082337",
"0.51054597",
"0.50917596",
"0.5089081",
"0.50750023",
"0.50709254",
"0.50659007",
"0.5061392",
"0.5022941",
"0.50040174",
"0.49919397",
"0.49846578",
"0.4970508",
"0.4964355",
"0.4954066",
"0.49526355",
"0.49338162",
"0.4932057",
"0.49283752",
"0.4925482",
"0.49239337",
"0.4907742",
"0.49060583",
"0.4906008",
"0.48932257",
"0.4891892",
"0.4878008",
"0.4873146",
"0.48269007",
"0.48221108",
"0.48199755",
"0.48196715",
"0.4813206",
"0.48090538",
"0.4790295",
"0.47891062",
"0.47830456",
"0.47806454",
"0.47789076",
"0.47782454",
"0.47753924",
"0.47748572",
"0.47747517",
"0.4774474",
"0.47690004",
"0.47688028",
"0.47674012",
"0.47592556",
"0.47577944",
"0.47453004",
"0.47444537",
"0.47334686",
"0.47251815",
"0.47153404",
"0.47048315",
"0.47034562",
"0.47034407",
"0.46895942",
"0.4688698",
"0.4686814",
"0.46844187",
"0.46651295",
"0.46651295"
]
| 0.6535336 | 3 |
checks if a given dictionary word from the original dictionary can be made using the given tiles | def check_word(word)
letters = make_letter_array(@tiles)
w = word.split("")
for letter in w
if letters.index(letter)
letters[letters.index(letter)] = nil
letters.compact!
else
return false
end
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def construct_word(word, word_len, dict, twos=@@two_tiles, threes=@@three_tiles, fours=@@four_tiles)\n\t\n\t\tleftover = word_len - word.length\n\t\t\n\t\t# NOTE: I decided to repeat .each routines, as the alternative would mean passing a whole lot of variables to a routine that only executes a few lines of code. When changing one scenario, all other matching scenarios must be changed.\n\t\t# 0: A word of appropriate length has been found. All that remains is to search the dictionary.\n\t\t# 1: There will never be a scenario with one left-over. There are no tiles of length 1.\n\t\t# 2: The only tiles that will fit is of length 2. Only query 'twos'.\n\t\t# 3: The only tiles that will fit is of length 3.\n\t\t# 4: Valid tile placement includes tiles of length 2 and 4.\n\t\t# 5: Valid tile placement includes tiles of length 2 and 3.\n\t\t# 6+: Valid tile placement includes tiles of length 2, 3, and 4.\n\t\tcase leftover\n\t\t\twhen 0 \n\t\t\t\tif (dict.query(word))\n\t\t\t\t\t@@valid_combinations.push(word)\n\t\t\t\tend\n\t\t\twhen 2\n\t\t\t\ttwos.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_twos = twos - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, new_twos, threes, fours) \n\t\t\t\t}\n\t\t\twhen 3\n\t\t\t\tthrees.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_threes = threes - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, twos, new_threes, fours) \n\t\t\t\t}\n\t\t\twhen 4\n\t\t\t\ttwos.each { |tile|\n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_twos = twos - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, new_twos, threes, fours) \n\t\t\t\t}\n\t\t\t\tfours.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_fours = fours - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, twos, threes, new_fours) \n\t\t\t\t}\n\t\t\twhen 5\n\t\t\t\ttwos.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_twos = twos - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, new_twos, threes, fours) \n\t\t\t\t}\n\t\t\t\tthrees.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_threes = threes - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, twos, new_threes, fours) \n\t\t\t\t}\n\t\t\twhen 6..15\n\t\t\t\ttwos.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_twos = twos - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, new_twos, threes, fours) \n\t\t\t\t}\n\t\t\t\tthrees.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_threes = threes - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, twos, new_threes, fours) \n\t\t\t\t}\n\t\t\t\tfours.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_fours = fours - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, twos, threes, new_fours) \n\t\t\t\t}\n\t\t\telse \n\t\t\t\tputs \"Leftover: \" << leftover.to_s\n\t\t\tend\n\t\t\n\tend",
"def check_dictionary(dict)\n dictionary_redux = []\n for word in dict\n result = check_word(word)\n if result\n dictionary_redux << word\n end\n end\n new_dict = add_reversals(dictionary_redux)\n return new_dict\n end",
"def all_valid \n h = @horizontal.reject { |(x,y),r| x==r }\n v = @vertical.reject { |(x,y),r| y==r }\n\n words = h.map { |position,right|\n x,y = position\n (x..right).map { |x| @board.tile_at([x,y]) }\n }\n words.concat v.map {|position, bottom|\n x,y = position\n (y..bottom).map { |y| @board.tile_at([x,y]) }\n }\n\n FFI::Hunspell.dict do |dict|\n for word in words do\n word = (word.map {|tile| tile.letter}).join.downcase\n return false unless dict.check? word\n end\n end\n return true\n end",
"def test\n dict_list = make_list\n #make sure they're the same length\n if @word1.length != @word2.length\n puts \"Error: Words of different lengths\"\n false\n #make sure it is in the dictionary file\n elsif (!dict_list.include?(@word1)||!dict_list.include?(@word2))\n puts \"Error: Word does not exist\"\n false\n else\n true\n end\n end",
"def checking_dictionary_for_word_match\n valid_word?(@prefix)\n end",
"def test_rack_contains_a_word_with_duplicate_letters\n [:A,:B,:A,:C].each{|x| @newTileRack.append(x)}\n assert_equal(true,@newTileRack.has_tiles_for?('AAB'))\n end",
"def check_word(word, rack)\n if rack.include?(\"?\") ? blank_tile = true : blank_tile = false\n end\n # Make a copy of rack to use to change values.\n rack_copy = rack.clone\n # result equals true and only goes false if a letter from rack isn't in the word\n result = true\n word.chars do |letter|\n if rack_copy.include?(letter)\n # Find the first instance of letter by its index and delete it at index.\n # This must be down to avoid .include? returning true on a letter multiple\n # times\n rack_copy.delete_at(rack_copy.index(letter))\n # If the letter isn't in rack but theres a blank tile then go back to start\n # of loop\n elsif blank_tile\n # change to false to avoid using blank tile more than once\n blank_tile = false\n # if the letter doesn't exist than turn result to false and break loop\n else\n result = false\n break\n end\n end\n result\nend",
"def check_for_dictionary(dictionary)\n right = dictionary.word_present?(@word)\n return true if right\n false\n end",
"def legal?(board, dict, raise_exception = false)\n legal_shape?(board, raise_exception) && legal_words?(board, dict, raise_exception)\n end",
"def valid_word?(chars, word)\n return false if chars.length < word.length\n\n word_hash = Hash.new(0)\n chars_hash = Hash.new(0)\n\n word.each_char {|el| word_hash[el] += 1}\n chars.each {|el| chars_hash[el] += 1}\n\n word_hash.each do |k,v|\n return false if !chars_hash.has_key?(k) || chars_hash[k] < v\n end\n\n true\nend",
"def is_word(word)\n if @trie.has_key?(word) == true && word.length > 2 && @words.include?(word) == false\n return true\n else\n return false\n end\nend",
"def check_passage(x, y, bit)\r\r\n x = round_x(x)\r\r\n y = round_y(y)\r\r\n all_tiles(x.floor, y.floor).each do |tile_id|\r\r\n flag = tileset.flags[tile_id]\r\r\n next if flag & 0x10 != 0 # [☆]: No effect on passage\r\r\n return true if flag & bit == 0 # [○] : Passable\r\r\n return false if flag & bit == bit # [×] : Impassable\r\r\n end\r\r\n return false # Impassable\r\r\n end",
"def check_passage(x, y, bit)\n all_tiles(x, y).each do |tile_id|\n flag = tileset.flags[tile_id]\n next if flag & 0x10 != 0 # [☆]: No effect on passage\n return true if flag & bit == 0 # [○] : Passable\n return false if flag & bit == bit # [×] : Impassable\n end\n return false # Impassable\n end",
"def extra_letter( dict_word, word )\n\n\tnum = word.length - 1\n\n\t# Remove a letter from the test word to see if a match results\n\tnum.times do |i|\n\n\t\ttest_word = word[0, i+1] + word[i+2, num]\n\n\t\t# Match made\n\t\treturn true if @dictionary[test_word]\t\n\tend\n\n\t# No match found\n\treturn false\nend",
"def check_hooking player, board, word_list\n\t\t\tbest =Array.new(2, ScrabbleWord.new('', 0, 0, 0, 0))\n\t\t\twords = DICTIONARY.get_all(player.tiles)\n\t\t\tword_hash = Hash.new\n\t\t\twords.each do |word|\n\t\t\t\tword.each_char do |char|\n\t\t\t\t\tword_hash[char] ||= Set.new\n\t\t\t\t\tword_hash[char] << word\n\t\t\t\tend\n\t\t\tend\n\t\t\tword_list.each do |word|\n\t\t\t\tplayer.tiles.each do |char|\n\t\t\t\t\tif DICTIONARY.word?(word.word + char) || DICTIONARY.word?(char + word.word)\n\t\t\t\t\t\tword_hash[char].each do |new_word|\n\t\t\t\t\t\t\trow = word.row\n\t\t\t\t\t\t\tcol = word.col\n\t\t\t\t\t\t \tword.dir == :across ? col -=1 : row -= 1\n\t\t\t\t\t\t\tbest = hook_helper(new_word, word.word.length , word, board, char, word.row , word.col, best, word.word + char) if DICTIONARY.word?(word.word + char)\n\t\t\t\t\t\t\tbest = hook_helper(new_word, 0 , word, board, char, row, col, best, char + word.word) if DICTIONARY.word?(char + word.word)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t[best, best.inject(0){|sum, i| sum + i.score}]\n\t\tend",
"def test_rack_contains_some_but_not_all_needed_letters\n [:A,:B,:C,:D].each{|x| @newTileRack.append(x)}\n assert_equal(false,@newTileRack.has_tiles_for?('IABJ'))\n end",
"def legal_words?(board, dict, raise_exception = false)\n\n if can_play_letters?(board, raise_exception) \n bad_words = self.new_illegal_words(board, dict)\n if bad_words.empty?\n return true\n elsif raise_exception\n raise IllegalMove, \"#{bad_words.join(', ')} #{bad_words.size==1 ? 'is not a legal word' : 'are not legal words'}!\" \n end\n end\n\n return false\n end",
"def dictionary(word)\n dictionary = [\"apple\", \"pie\", \"a\",\n \"hello\", \"world\", \"he\"]\n\n dictionary.include?(word)\nend",
"def get_valid_moves(dictionary)\n #iterates through each letter of the alphabet and checks to see how many moves can be made after adding that letter\n #if the letter would make a word then we skip that letter\n #returns a hash where keys are the letters that don't make a word and values are how many possible moves can be made after using that letter\n #also removes any letters that don't have any possible moves after (those would be invalid moves)\n valid_moves = {}\n \n if @current_fragment == '' #if ROB is the first player return a hash with all letters with value 1\n ALPHABET.each do |letter|\n valid_moves[letter] = 1\n end\n return valid_moves\n end\n \n \n ALPHABET.each do |letter|\n valid_moves[letter] = 0\n end\n \n ALPHABET.each do |guess| \n test_string = @current_fragment+guess\n if !dictionary.include?(test_string)\n valid_moves[guess] = dictionary.count {|word| word[0...test_string.length].include?(test_string)}\n end\n end\n\n if valid_moves.values.uniq.length > 1\n return valid_moves.keep_if {|letter,count| count > 0}\n else\n valid_moves\n end\n end",
"def is_word?(fragment)\n dictionary.include?(fragment)\n end",
"def is_word?(string, dictionary = Dictionary.new)\n dictionary.include?(string)\nend",
"def invalid board, tile, row, col, dir\n\t\t\tinvalid = false\n\t\t\tword = ''\n\t\t\tif dir == :down\n\t\t\t\tif (!board[row, col-1].nil? && board[row, col-1].tile) || (!board[row, col+1].nil? && board[row, col+1].tile)\n\t\t\t\t\ttemp_col = col\n\t\t\t\t\twhile board[row, temp_col-1].tile\n\t\t\t\t\t\ttemp_col -= 1\n\t\t\t\t\tend\n\t\t\t\t\twhile temp_col < 15 &&(board[row, temp_col].tile || col == temp_col)\n\t\t\t\t\t\tif temp_col == col\n\t\t\t\t\t\t\tword += tile\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tword += board[row, temp_col].tile\n\t\t\t\t\t\tend\n\t\t\t\t\t\ttemp_col+=1\n\t\t\t\t\tend\n\t\t\t\t\tif !DICTIONARY.word?(word)\n\t\t\t\t\t\tinvalid = true,\n\t\t\t\t\t\tword = ''\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif(!board[row-1, col].nil? && board[row-1, col].tile) || (!board[row+1, col].nil? && board[row+1, col].tile)\n\t\t\t\t\ttemp_row = row\n\t\t\t\t\twhile board[temp_row-1, col].tile\n\t\t\t\t\t\ttemp_row -= 1\n\t\t\t\t\tend\n\t\t\t\t\twhile temp_row < 15 &&(board[temp_row, col].tile || row == temp_row)\n\t\t\t\t\t\tif temp_row == row\n\t\t\t\t\t\t\tword += tile\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tword += board[temp_row, col].tile\n\t\t\t\t\t\tend\n\t\t\t\t\t\ttemp_row+=1\n\t\t\t\t\tend\n\t\t\t\t\tif !DICTIONARY.word?(word)\n\t\t\t\t\t\tinvalid = true\n\t\t\t\t\t\tword = ''\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\t[invalid, word]\n\t\tend",
"def checkSame(givenInput, autoDict)\n (0...givenInput.length).each do |i|\n if givenInput[i] != autoDict[givenInput[0]][i]\n return false\n end\n end\n return true\nend",
"def check\n @dictionaries.each do |dictionary|\n @right = check_for_dictionary(dictionary)\n return true if @right\n end\n false\n end",
"def test_rack_doesnt_contain_any_needed_letters\n [:A,:B,:C,:D].each{|x| @newTileRack.append(x)}\n assert_equal(false,@newTileRack.has_tiles_for?('IKL'))\n end",
"def valid_word_for_board?(letters, word)\n letters.each_with_index do |row, i|\n row.each_with_index do |letter, j|\n if word[0] == letter\n if make_word_from_board?(letters, word, i, j)\n return true\n end\n end\n end\n end\n false\n end",
"def verify_tiles\n end",
"def word_comparison(letters_hash, word_hash)\n result = {}\n word_hash.each do |key, _value|\n if !letters_hash.include?(key) || word_hash[key] > letters_hash[key]\n result[:score] = 0\n result[:message] = 'Your word is not in the grid :('\n return result\n else\n return {}\n end\n end\n end",
"def dictionary_words? set\n (set & DICTIONARY) == set\n end",
"def test_rack_has_needed_letters_when_letters_are_in_order_no_duplicates\n [:A,:B,:C,:D].each{|x| @newTileRack.append(x)}\n assert_equal(true,@newTileRack.has_tiles_for?('ABD'))\n end",
"def is_in_set?(word)\n\t\t# iterate over the hashes and recalc the hash value for the word. If the location in the bitmap is 0, then return false, meaning that the word is DEFINITELY not in the set\n\t\[email protected] do |hash|\n\t\t\treturn false if @bitmap[hash.hash_this(word.chomp)] == 0\n\t\tend\n\n\t\ttrue # return true meaning that it is likely to be in the set\n\tend",
"def spell_check\n #Temp has to get around iterating blocking hash editing\n temp_hash = Hash.new\n #For each word hash pair\n $words.each do |word|\n #Sets values for lexicon reading\n first_char = word[0][0]\n len = word[0].length\n\n #Searches lexicon for match, default is false\n match = false\n #For each word in the lexicon with the same first and second characters checks for equality\n $lexicon[first_char][len].each do |check|\n #If the words are the same sets spelling to true, or correct and breaks out of loop\n if check[0] == word[0]\n match = true\n break;\n end\n end\n #Sets temp hash to proper values, to be reassigned to word hash after full iterations\n temp_hash[word[0]] = match\n end\n #Sets words hash with proper values\n temp_hash.each do |temp|\n $words[temp[0]] = temp[1]\n end\nend",
"def my_include?(dict, query)\n dict.each do |valid_word|\n if valid_word == query\n return true\n end\n end\n return false\nend",
"def api_valid_word?(variable)\n url = \"https://wagon-dictionary.herokuapp.com/#{variable}\"\n wagon_dictionary_serialized = open(url).read\n dictionary = JSON.parse(wagon_dictionary_serialized)\n\n valid_attempt = dictionary['found']\n return valid_attempt\nend",
"def make_word_from_board?(letters, word, i, j)\n matched_dices = []\n unmatched_dices = []\n letter_used = letters.map {|column| column.map { false }}\n letter_used[i][j] = true\n matched_dices.push([i, j])\n word_pos = 1\n while word_pos < word.size\n letter_matched = false\n # move a step next to the current letter to check if we can form the word\n (i-1..i+1).each do |m|\n # ignore if our matching window is outside the dices\n if m == -1 || m == letters.size\n next\n end\n (j-1..j+1).each do |n|\n # ignore if our matching window is outside the dices\n if n == -1 || n == letters[0].size\n next\n end\n # ignore for the central dice\n if m == i && n == j\n next\n end\n # ignore if letter at the position has already been used\n if letter_used[m][n]\n next\n end\n # skip if the dice is already unmatched\n if unmatched_dices.find{|dice| dice[0] == m && dice[1] == n}\n next\n end\n if letters[m][n] == word[word_pos]\n i = m\n j = n\n letter_matched = true\n letter_used[i][j] = true\n matched_dices.push([i, j])\n break\n end\n end\n if letter_matched\n word_pos += 1\n break\n end\n end\n unless letter_matched\n # return false when only a single letter is matching\n if word_pos == 1\n return false\n end\n word_pos -= 1\n # get the last matched dice\n i, j = matched_dices.pop\n letter_used[i][j] = false\n unmatched_dices.push([i, j])\n end\n end\n true\n end",
"def compare_strings(input_text, dictionary_word)\n for i in 0..input_text.length - 1 do\n if input_text.length - i >= dictionary_word.length\n j = i + dictionary_word.length - 1\n arr = input_text.slice(i..j)\n if arr.eql?(dictionary_word)\n @output_hash = update_output_hash(arr, @output_hash)\n end\n end\n end\nend",
"def test_rack_has_needed_letters_when_letters_are_not_in_order_no_duplicates\n [:A,:B,:C,:D].each{|x| @newTileRack.append(x)}\n assert_equal(true,@newTileRack.has_tiles_for?('DAC'))\n end",
"def authorized?(letter, word, x, y)\n (0...self.size).member?(x) && (0...self.size).member?(y) && (@grid[x][y] == nil) &&\n @words.include?(word) && (/#{letter}/ =~ word)\n end",
"def build_dict(dict)\n dict.each do |word|\n sz = word.size\n @words[sz][word] = true\n end\n end",
"def wordInGrid(grid, width, height, word, conditionsToCheck)\n\n conditionsToCheck.each do |conditionName, conditionResult|\n if (conditionResult)\n if wordInStrings(word, eval(\"#{conditionName}(grid, width, height)\"))\n return true\n end\n end\n end\n\n # If the function has made it this far, then the word was\n # not found in the grid using any of the selected rules\n return false\nend",
"def submit_word(word)\n letters_present_for(word) && @dictionary.include?(word)\n end",
"def check_map(map)\n\t\tways = Array2D.new(@width, @height, -1)\n\t\[email protected] do |x|\n\t\t\[email protected] do |y|\n\t\t\t\tpoint = Point.new(x, y)\n\t\t\t\tways[point] = 0 if ! map[point]\n\t\t\tend\n\t\tend\n\t\tways[@center] = 1\n\n\t\tnew_cells = true\n\t\tstep = 2\n\t\twhile new_cells\n\t\t\tnew_cells = false\n\t\t\[email protected] do |x|\n\t\t\t\[email protected] do |y|\n\t\t\t\t\tpoint = Point.new(x, y)\n\t\t\t\t\tif map[point]\n\t\t\t\t\t\tways[point] = -1\n\t\t\t\t\telsif ways[point] == 0\n\t\t\t\t\t\tif ways[point.up] == step - 1\n\t\t\t\t\t\t\tways[point] = step\n\t\t\t\t\t\t\tnew_cells = true\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif ways[point.down] == step - 1\n\t\t\t\t\t\t\tways[point] = step\n\t\t\t\t\t\t\tnew_cells = true\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif ways[point.left] == step - 1\n\t\t\t\t\t\t\tways[point] = step\n\t\t\t\t\t\t\tnew_cells = true\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif ways[point.right] == step - 1\n\t\t\t\t\t\t\tways[point] = step\n\t\t\t\t\t\t\tnew_cells = true\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tstep += 1\n\t\tend\n\n\t\[email protected] do |x|\n\t\t\[email protected] do |y|\n\t\t\t\tpoint = Point.new(x, y)\n\t\t\t\treturn false if ways[point] == 0\n\t\t\tend\n\t\tend\n\t\ttrue\n\tend",
"def can_you_see?(map, dim, direction)\n plus = case direction\n when 1 then [-1,-1]\n when 2 then [-1, 0]\n when 3 then [-1, 1]\n when 4 then [ 0,-1]\n when 6 then [ 0, 1]\n when 7 then [ 1,-1]\n when 8 then [ 1, 0]\n when 9 then [ 1, 1]\n end\n\n #print \"whereami: \"\n whereami = whereami(map)\n coord = whereami\n\n while dim > 0 do\n whereamfrom = coord\n coord = [coord,plus].transpose.map{|ary| ary.inject(&:+) }\n\n #print \"distance: \"\n distance = distance(whereamfrom, coord)\n\n if whereamfrom == whereami || coord == whereami\n # 最初は0.5しか進まないわけだが...。\n if plus.any?{|e| e==0}\n dim -= 0.5\n else #角度を付けて入ってきた場合\n dim -= Math.sqrt(0.5**2 + 0.5**2)\n end\n else\n dim -= distance\n end\n return false if dim < 0\n #print \"now: \"\n #p coord\n #print \"dim: \"\n #p dim\n if myself?(coord, map)\n return true\n elsif mirror?(coord, map)\n # print \"!!! mirror #{plus} -> \"\n # TODO: 入った角度による。これはきれいに反射した場合\n plus = plus.map{|e| -1*e }\n # print \"#{plus}\\n\"\n end\n end\nend",
"def in_trie?(word_fragment)\n # Cleaner implementation, but less readable\n # word_fragment.empty? || (@sub_tries.key?(word_fragment[0]) &&\n # @sub_tries[word_fragment[0]].in_trie?(word_fragment[1..-1]))\n\n # TODO: Find a way to refactor this such that it looks cleaner while remaining readable\n if word_fragment.empty?\n true\n elsif @sub_tries.key?(word_fragment[0])\n @sub_tries[word_fragment[0]].in_trie?(word_fragment[1..-1])\n else\n false\n end\n end",
"def test_rack_doesnt_contain_enough_duplicate_letters\n [:A,:B,:A,:C].each{|x| @newTileRack.append(x)}\n assert_equal(false,@newTileRack.has_tiles_for?('AAAA'))\n end",
"def flipped_letter( dict_word, word )\n\n\t# Flip adjacent letters in test word to see if a match results\n\tword.length.times do |i|\n\n\t\tif i < word.length - 2\n\t\t\ttest_word = word[0, i+1] + word[i+2] + word[i+1] + word[i+3, word.length-1]\n\t\tend\n\t\t\n\t\t# Match found\n\t\treturn true if dict_word.eql? test_word\n\tend\n\n\t# No match found\n\treturn false\nend",
"def counter?(x, y)\r\n if @map_id != 0\r\n for i in [2, 1, 0]\r\n tile_id = data[x, y, i]\r\n if tile_id == nil\r\n return false\r\n elsif @passages[tile_id] & 0x80 == 0x80\r\n return true\r\n end\r\n end\r\n end\r\n return false\r\n end",
"def defect_count( dict_word, word )\n\n\tdict_letters = Hash.new \t# Characters in dictionary word\n\tword_letters = Hash.new \t# Characters in test word\n\n\t# Add the characters to hash, add the values if character is already present.\n\tdict_word.length.times do |i|\n\t\tif dict_letters[dict_word[i]].nil?\n\t\t\tdict_letters[dict_word[i]] = 1\n\t\telse\n\t\t\tdict_letters[dict_word[i]] += 1\n\t\tend\n\tend\n\n\t# Do the same thing for the other word\n\tword.length.times do |i|\n\t\tif word_letters[word[i]].nil?\n\t\t\tword_letters[word[i]] = 1\n\t\telse\n\t\t\tword_letters[word[i]] += 1\n\t\tend\n\tend\n\n\tdefects = 0 # Defect count to return\n\t\n\t# Compare the two words unique characters, for each non-matching character, add number of \n\t# characters present as defects\n\tif dict_letters.size > word_letters.size\n\t\tdict_letters.each do |key, val|\n\t\t\tdefects += val if word_letters[key].nil?\t\t\n\t\tend\n\telse\n\t\tword_letters.each do |key, val|\n\t\t\tdefects += val if dict_letters[key].nil?\t\t\n\t\tend\n\tend\n\n\t# For the matching unique characters, add the difference in quantity as defects\n\tdict_letters.each do |kd, vd|\n\t\tword_letters.each do |kw, vw|\n\n\t\t\tdefects += (vd - vw).abs if kd.eql? kw\n\t\tend\n\tend\n\n\t# Get the smallest word length\n\tbound = (dict_word.length < word.length)? dict_word.length : word.length\n\n\t# To reward words which have very similar sequences of characters, we add defects for\n\t# each character that does not match sequentially with other word.\n\tbound.times do |i|\n\n\t\t# add defect for each unmatching character\n\t\tdefects += 1 unless dict_word[i].eql? word[i]\n\tend\n\n\t# return score\n\treturn defects\nend",
"def test_convert_words_and_find_valid\n @grapher.nmap = {'1'=>'a', '2'=>'b', '3'=>'c'}\n paths = [['1','2','3','1'], ['3','2','1']]\n hdicts = [{'ahy'=>['hay','yah']}, {'abc'=>['cab','bac']}]\n exp = ['bac','cab']\n assert_equal exp, @grapher.convert_words_and_find(paths, hdicts)\n end",
"def unscramble(scrambled_word, dictionary)\n # slight optimization to only check against words in the dictionary\n # with the same length\n words_by_size = dictionary.inject({}) do |h, word|\n h[word.size] = h[word.size] ? h[word.size] << word : [word]\n h\n end\n\n words_to_check = words_by_size[scrambled_word.size]\n scrambled_word.chars.each do |c|\n words_to_check = words_to_check.select{|w| w.include? c}\n end\n\n words_to_check = words_to_check.select{|w| w.chars.all?{|c| scrambled_word.include? c}}\n\n puts \"#{scrambled_word} ==> #{words_to_check.first}\"\nend",
"def check_map\n begin\n @map_cells_range.each do |y|\n @map_cells_range.each do |x|\n if @tiles[x].nil? || @tiles[x][y].nil?\n raise RuntimeError, \"tile #{x},#{y} not found, regenerate the map\"\n end\n end\n end\n rescue RuntimeError => e\n error e.message\n generate_map\n return false\n end\n true\n end",
"def word_break(s, word_dict)\n dp = [true]\n\n (1..s.length).each do |i|\n (0..i-1).each do |j|\n break if dp[i] = dp[j] && word_dict.include?(s[j...i])\n end\n end\n dp\n dp[s.length] == true\nend",
"def check_if_present(word)\n chars = word.downcase.split('')\n match = false\n char_count = 0\n crawl = root\n\n chars.each do |a_char|\n char_count += 1\n child = crawl.children\n if child.keys.include?(a_char)\n crawl = child[a_char]\n if crawl.is_end && (char_count == chars.length)\n match=true\n end\n else\n break;\n end\n end\n match # returns if the word is in dictionary or not.\n end",
"def check_input(input_word)\n # Define a string which includes all valid letter\n dict = \"abcdefghijklmnopqrstuvwxyz\"\n # Define return variable and give a default value\n is_valid = true\n # set return value as false if the length of word not exactly equal 5\n if(input_word.split(//).size != 5)\n is_valid = false\n end\n # If the letter occurs more than once in the word, set return value to false\n # include? method to find if a letter is included in input_word\n input_word.split(//).each do |letter|\n if(dict.include?(letter) == false)\n is_valid = false\n end\n end # end of the each method\n return is_valid\n end",
"def check(words:)\n dictionary = Set.new([\"hello\", \"my\", \"name\", \"is\", \"orange\"])\n corrected = []\n words.each do | word |\n dictionary.include?(word) ? corrected.push(word) : corrected.push(\"~#{word}~\")\n end\n corrected\nend",
"def uses_available_letters?(input, letters_in_hand)\n # edge case\n return false if input.length > 10 || input.length < 1 \n\n temp_in_hand = letters_in_hand.clone\n\n input.upcase!\n tile_split = input.split(\"\") \n\n tile_split.each do |letter|\n return false if !temp_in_hand.include?(letter) \n \n temp_in_hand.delete_at(temp_in_hand.index(letter))\n end \n return true\nend",
"def checkMagazine(magazine, note)\n # 1) store every word in magazine to hash\n dict = Hash.new()\n magazine.each do |word|\n if dict[word].nil?\n dict[word] = 1\n else\n dict[word] += 1\n end\n end\n\n # 2) iterate through note if word does not exist in hash, return false\n note.each do |word|\n if dict[word].nil? || dict[word] == 0\n return \"No\"\n else\n dict[word] -= 1\n end\n end\n\n # 3) otherwise return true\n return \"Yes\"\nend",
"def verify_word_on_board(w, hash_table)\n w = w.upcase # Since the letters on board is in capital letter\n\n p hash_table\n i = 0\n searched_index = {} # Hash table to keep track what has been searched\n (0...w.length).each { |i| searched_index.store(i, -1)} # Initiate values to indicate that no letters have been searched\n\n while i >= 0 && i < w.length\n # puts \"\\nStart of while loop, i = #{i}, searching letter #{w[i]}...\" ###\n move = false\n\n unless hash_table[w[i]].empty?\n # print \"Letter #{w[i]} exist at #{hash_table[w[i]]}\\n\" ###\n hash_table[w[i]].each_with_index do | value , index |\n # puts \"Scanning through #{w[i]} at position #{value}\" ###\n \n # This unmark the position that was used previously during backtracking.\n if value + @total_letters < 0\n # puts \"Position #{hash_table[w[i]][index]} of #{w[i]} is restored...\" ###\n hash_table[w[i]][index] += (@total_letters * 2)\n # puts \"Position of #{w[i]} is now #{hash_table[w[i]][index]}.\" ###\n end\n\n if index <= searched_index[i] # This skips letters that are already searched\n # puts \"#{w[i]} at #{hash_table[w[i]][index]} is already searched.\" ###\n next\n end\n\n if value >= 0\n \n # The position is subtrated by no of total letters to indicate that it has been searched.\n # No of total letters is used so that duplicate of hash table is not required.\n \n if i == 0 || is_adjacent(hash_table[w[i]][index],(@total_letters + hash_table[w[i-1]][searched_index[i-1]]))\n hash_table[w[i]][index] -= @total_letters\n # puts \"#{value} has been subracted by @total_letters to #{hash_table[w[i]][index]}\" ###\n \n \n searched_index[i] = index\n # puts \"Moving to next letter, searched_index[#{i}] now has been updated to #{searched_index[i]}\" ###\n move = true\n i += 1\n break\n end\n\n end\n end\n\n end\n\n # i -= 1 if move == false\n if move == false\n if i > 0\n # puts \"Previously used #{w[i-1]} position of #{hash_table[w[i-1]][searched_index[i-1]]} is being marked for restoration.\" ###\n \n hash_table[w[i-1]][searched_index[i-1]] -= @total_letters # To mark position to be restored to original value as it will not be used anymore\n # puts \"Current position of #{w[i-1]} is #{hash_table[w[i-1]][searched_index[i-1]]}.\" ###\n searched_index[i] = -1\n end\n\n\n # puts \"Letter #{w[i]} is not available/not adjacent and i will be subtracted\" ###\n i -= 1\n end\n\n end\n\n # Restore back all coordinates for next word\n\n\n restore_hash_table(hash_table)\n\n # Check whether word exists.\n if i >= 0 \n puts \"#{w} exists!\"\n return true\n else\n puts \"#{w} is not available.\"\n return false\n end\n \n end",
"def valid_word?(word)\n # Cleaner implementation, but less readable\n # (word.empty? && @is_complete_word) || (@sub_tries.key?(word[0]) &&\n # @sub_tries[word[0]].valid_word?(word[1..-1]))\n\n # TODO: Find a way to refactor this such that it looks cleaner while remaining readable\n if word.empty?\n @is_complete_word\n elsif @sub_tries.key?(word[0])\n @sub_tries[word[0]].valid_word?(word[1..-1])\n else\n false\n end\n end",
"def new_illegal_words(board, dict)\n new_words(board).reject {|word| dict.legal_word?(word.to_s)}\n end",
"def table_ps(x,y)\n return true if $game_map.tile_proj_passable?(x,y)\n id_cnt = 0\n layered_tiles(x,y).each do |tile_id|\n flag = tileset.flags[tile_id]\n id_cnt += flag & 0x10\n next if flag & 0x10 != 0\n return true if flag & 0x0400 == 0\n return true if flag & 0x0f == 0\n return false if flag & 0x0f == 0x0f\n end\n return id_cnt == 48\n end",
"def process()\n \n dict = DictionaryFactory::build(@data, @settings[:options])\n \n unless dict == false\n @data[:words] = dict\n return true\n else\n return false\n end\n \n end",
"def test_convert_words_and_find_invalid\n @grapher.nmap = {'1'=>'a', '2'=>'b', '3'=>'c'}\n paths = [['1','2','4','1'], ['3','2','1']]\n hdicts = [{'ahy'=>['hay','yah']}, {'ab'=>['ab','ba']}]\n exp = ['abca','cba']\n assert_nil @grapher.convert_words_and_find(paths, hdicts)\n end",
"def is_valid_tile?(name)\n\t\terror = \"Not a valid tile. Please choose again.\"\n\n\t\tcheck(name, error)\n\tend",
"def passable?(x, y, d)\n # \"passable\" if out of map border\n return true if x < 0 || x >= @map.width || y < 0 || y >= @map.height\n # set bit\n bit = (1 << (d / 2 - 1)) & 0x0f\n # iterate through all layers\n Cache::MapLayers.each {|i|\n # get tile ID\n tile_id = @map.data[x, y, i]\n # if tile ID not valid\n if tile_id == nil\n # impassable\n return false\n # if obstacle bit is set\n elsif $data_tilesets[@map.tileset_id].passages[tile_id] & bit != 0\n # impassable\n return false\n # if obstacle bit is set in all directions\n elsif $data_tilesets[@map.tileset_id].passages[tile_id] & 0x0F == 0x0F\n # impassable\n return false\n # if priority is 0\n elsif $data_tilesets[@map.tileset_id].priorities[tile_id] == 0\n # passable\n return true\n end}\n # passable\n return true\n end",
"def map_passable?(x, y, d)\r\n $game_map.passable?(x, y, d)\r\n end",
"def is_in_english_dict?(input)\n input.downcase! \n\n dictionary = CSV.read(\"assets/dictionary-english.csv\")\n dictionary = dictionary.flatten\n\n dictionary.include?(input) ? true : false\nend",
"def is_valid_word?(word)\n DICTIONARY.include?(word)\n end",
"def phase_one?(str1,str2)\n dictionary = str1.chars.permutation.to_a\n dictionary.include?(str2.chars)\nend",
"def map_passable_rect?(x, y, d, rect)\r\r\n $game_map.passable_rect?(x, y, d, rect)\r\r\n end",
"def passable_rect?(x, y, d, rect)\r\r\n x2 = x + (rect.x / 32.0)\r\r\n y2 = y + (rect.y / 32.0)\r\r\n x3 = x2 + (rect.width / 32.0)\r\r\n y3 = y2 + (rect.height / 32.0)\r\r\n x4 = (x2 + x3) / 2.0\r\r\n y4 = (y2 + y3) / 2.0\r\r\n\r\r\n if((x2.floor != x3.floor && [1, 3, 4, 6, 7, 9].include?(d)) || (y2.floor != y3.floor && [1, 2, 3, 7, 8, 9].include?(d)))\r\r\n return false if ([1, 2, 3].include?(d) && !check_passage(x2, y2, 1)) || ([3, 6, 9].include?(d) && !check_passage(x2, y2, 4))\r\r\n return false if ([3, 6, 9].include?(d) && !check_passage(x2, y3, 4)) || ([7, 8, 9].include?(d) && !check_passage(x2, y3, 8))\r\r\n return false if ([1, 2, 3].include?(d) && !check_passage(x3, y2, 1)) || ([1, 4, 7].include?(d) && !check_passage(x3, y2, 2))\r\r\n return false if ([1, 4, 7].include?(d) && !check_passage(x3, y3, 2)) || ([7, 8, 9].include?(d) && !check_passage(x3, y3, 8))\r\r\n end\r\r\n return true\r\r\n end",
"def test_convert_word_valid\n arr = ['1','2','3']\n @grapher.nmap = {'1'=>'a', '2'=>'b', '3'=>'c'}\n assert_equal 'abc', @grapher.convert_word(arr)\n end",
"def map_tile_in_rock(tile)\n (-1..1).all? { |dx| (-1..1).all? { |dy|\n t = tile.offset(dx, dy) and t.shape_basic == :Wall and tm = t.tilemat and (tm == :STONE or tm == :MINERAL or tm == :SOIL)\n } }\n end",
"def word_in_the_grid?(attempt, grid)\n attempt_array = attempt.upcase.split('')\n attempt_array.each do |letter|\n return false if attempt_array.count(letter) > grid.count(letter)\n return false unless grid.include? letter\n end\n true\n end",
"def known_edits2 (word)\n # get every possible distance - 2 edit of the input word. Return those that are in the dictionary.\n end",
"def is_in_english_dict?(input)\n dictionary = CSV.read(\"assets/dictionary-english.csv\")\n valid_word = dictionary.include?(input.downcase) ? true : false\n return valid_word\nend",
"def check(tile_1, tile_2, direction)\n @compatibilities.include?([tile_1, tile_2, direction])\n end",
"def dictionary_attack dictionary\n\t\tfile = File.open(dictionary, \"rb\")\n\t\twordlist = file.readlines\n\t\twordlist.each do |line|\n\t\t\tif(check_password? line.chomp)\n\t\t\t\treturn line\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend",
"def must_form_word(letter_vars)\n raise 'The word is too long.' if letter_vars.size > MAX_WORD_LENGTH\n # Create a variable for the word with the dictionary's words as\n # domain and add the constraint.\n word = int_var @dictionary.words_of_size(letter_vars.size)\n letter_vars.to_number(BASE).must == word\n @words << word\n end",
"def valid_path_exists?(word)\n if (word.length < MIN_WORD_LENGTH)\n puts \"Words must be greater than three letters long\"\n return nil\n end\n\n tail = word[1, word.length]\n (0..15).each do |i|\n if (@b[i].die.getLetter.casecmp(word[0,1]) == 0) # if the letter matches the first in word\n @b[i].used = true\n return true if dfs(@b[i], tail) # need to check all instances of that letter\n @b[i].used = nil\n end\n unmark_used_nodes \n end\n return nil\n end",
"def isValidWalk(walk)\n return false if walk.size != 10\n return false if walk.count(\"n\") != walk.count(\"s\")\n return false if walk.count(\"e\") != walk.count(\"w\")\n true\nend",
"def checking_dictionary_for_word_match\n @prefix = @str[@i_last_real_word...@i]\n \n if valid_word?(@prefix)\n if @skip_counter > 0\n @skip_counter -= 1\n else\n @words[i] = @prefix\n @i_last_real_word = @i\n end\n end\n end",
"def tile_check(x, y, d)\n # get pixel movement rate and set bit\n pix, bit = $BlizzABS.pixel, (1 << (d / 2 - 1)) & 0x0F\n # passable if virtual passability works\n return true if ($game_map.virtual_passability[x / pix, y / pix] & bit != 0x00)\n # get x and y of next tile\n case d\n when 2 then nx, ny = x / pix, (y + 1) / pix\n when 4 then nx, ny = (x - 1) / pix, y / pix\n when 6 then nx, ny = (x + 1) / pix, y / pix\n when 8 then nx, ny = x / pix, (y - 1) / pix\n else\n nx = ny = nil\n end\n # passable if still on the same tile\n return (x / pix == nx && y / pix == ny)\n end",
"def test_word\n 42.times { assert @standard_wordlist.include?(@tester.word) }\n end",
"def win?\n\t\t@placeholder == @secret_word\n\tend",
"def check_building(building, x, y)\n (0..Unit.tile_width(building) - 1).each do |dx|\n (0..Unit.tile_height(building) -1).each do |dy|\n map.buildable? x + dx, y + dy\n end\n end\n #TODO moet ook checken of de positie binnen restricted coords valt.\n #TODO moet ook checken of het gebied egaal is\n #TODO moet ook checken of er units op die tiles staan\n end",
"def is_constructable?(letter, mag)\n letter_words = letter.split(\" \")\n letter_chars = {} \n \n letter_words.each do |w|\n w.chars.each do |ch| \n letter_chars[ch] = 0 unless letter_chars[ch]\n letter_chars[ch] += 1\n end\n end\n \n mag.split(\" \").each do |w|\n w.chars.each do |ch|\n letter_chars[ch] -= 1 if letter_chars[ch]\n if letter_chars[ch] == 0\n letter_chars.delete(ch)\n return true if letter_chars.empty? \n end\n end\n end\n\n false\nend",
"def constant_dance(direction, tiles_hash)\n tiles_hash[direction]\nend",
"def find_words words\n # We will work with \"DictWord\" objects rather than with raw strings\n @words = words.map{|w| DictWord.new(w)}\n # It tries to find every single word (as long as it's possible because of size of grid) in the grid \n # If running on a UNIX system, we could use fork to improve the performance\n # Process.fork {\n @words.each{|dw| place dw if (dw.word != nil && dw.word.size <= @w )}\n # }\n # We return only the words that were found in the grid \n return @words.select{|w|w.place != nil} \n end",
"def can_make_word(string)\n blocks = [\n ['B','O'],\n ['X','K'],\n ['D','Q'],\n ['C','P'],\n ['N','A'],\n ['G','T'],\n ['R','E'],\n ['T','G'],\n ['Q','D'],\n ['F','S'],\n ['J','W'],\n ['H','U'],\n ['V','I'],\n ['A','N'],\n ['E','R'],\n ['F','S'],\n ['L','Y'],\n ['P','C'],\n ['Z','M']\n ]\n\n letters = string.upcase.chars\n\n letters.each do |letter|\n blocks.each_with_index do |block, i|\n if block.include?(letter)\n blocks.delete_at(i)\n binding.pry\n return true\n # else \n # return false \n end \n end\n end \n\nend",
"def all_words_valid? set\n (set & DICTIONARY) == set\n end",
"def build_word(base_word_arry, available_letters_arry)\n if available_letters_arry.include?(base_word_arry[0])\n available_letters_arry.slice!(available_letters_arry.index(base_word_arry[0]))\n base_word_arry.slice!(0)\n if base_word_arry.length > 0 && available_letters_arry.length > 0\n build_word(base_word_arry, available_letters_arry)\n else\n return true\n end\n else\n return false\n end\nend",
"def move_is_disconnected_from_existing_words?\n return false if board.empty?\n\n new_tile_positions.each do |new_tile_position|\n new_tile_row = new_tile_position[0]\n new_tile_col = new_tile_position[1]\n\n existing_tile_positions.each do |existing_tile_position|\n existing_tile_row = existing_tile_position[0]\n existing_tile_col = existing_tile_position[1]\n\n return false if (new_tile_row == existing_tile_row) && (\n new_tile_col == existing_tile_col - 1 ||\n new_tile_col == existing_tile_col + 1\n )\n\n return false if (new_tile_col == existing_tile_col) && (\n new_tile_row == existing_tile_row + 1 ||\n new_tile_row == existing_tile_row - 1\n )\n end\n end\n\n true\n end",
"def detect_invalid_tile(x, y, width, height, tile_id)\n ox = Yuki::MapLinker.get_OffsetX\n oy = Yuki::MapLinker.get_OffsetY\n rangex = (x + ox)...(x + ox + width)\n rangey = (y + oy)...(y + oy + height)\n gm = $game_map\n return rangex.any? { |tx| rangey.any? { |ty| gm.get_tile(tx, ty) == tile_id } }\n end",
"def validateword\n # read lines from text file\n lines = []\n File.open( \"dictionary.txt\" ) do |io|\n io.each {|line| line.chomp! ; lines << line}\n end\n response = []\n # make a binary search as array is sorted \n json_params = request[:body][:word]\n print request[:body].class\n isValid = binary_search(json_params,lines)\n if isValid\n response = {isValid:true,message:'is a valid word'}\n else\n response = {isValid:false,message:'is not a valid word'}\n end\n render json:response;\n end",
"def is_word?(word)\n Constants::DICTIONARY.key?(word.downcase)\n end",
"def in_grid?(word, grid)\n\t word.chars.all? { |letter| word.count(letter) <= grid.count(letter) }\n\tend",
"def valid_sentence?(sentence_array)\n\t# input is expected to be array\n\t# method tests rules. Does the array have \n\t\t# 1 verb or more\n\t\t# 1 noun or 2 articles minimum\n\t\t# are all the words in the dictionary\n\tnouns = [\"abcd\", \"c\", \"def\", \"h\", \"ij\", \"cde\"]\n\tverbs = [\"bc\", \"fg\", \"g\", \"hij\", \"bcd\"]\n\tarticles = [\"a\", \"ac\", \"e\"]\n\tsentence_counter = 0 \n\n\tif sentence_array.class == Array\n\t\t# continue\n\t\tfor sentence in sentence_array do \n\n\t\t\t# are all the words valid in the dictionary?\t\n\t\t\tall = nouns + verbs + articles\n\t\t\tfor word in sentence do \n\t\t\t\tif all.include?(word)\n\t\t\t\t\t# p \"this word is valid\"\n\t\t\t\telse\n\t\t\t\t\tp \"#{word} is not a valid word in the dictionary\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\t\t# p \"all words in sentence ar valid words..\"\n\t\t\t\n\t\t\t# does it have a verb?\n\t\t\tv = (sentence & verbs)\n\t\t\tif v.count > 0\n\t\t\t\t# p \"sentence at index #{sentence_counter} has at least 1 verb #{v}\"\n\n\t\t\t\t# does it have 1 noun? or if not, does it have 2 articles?\n\t\t\t\tn = (sentence & nouns)\n\n\t\t\t\tif n.count > 0\n\t\t\t\t\t# p \"sentence at index #{sentence_counter} has a noun #{n}\"\n\n\t\t\t\telse\n\t\t\t\t\t# 2 articles?\n\t\t\t\t\ta = (sentence & articles)\n\t\t\t\t\tif a.count >= 2\n\t\t\t\t\t\t# p \"sentence at index #{sentence_counter} has no noun, but 2 articles #{a}\"\n\t\t\t\t\telse\n\t\t\t\t\t\treturn false\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tp \"false sentence, does not contain a verb #{sentence}\"\n\t\t\t\treturn false\n\t\t\t\t# this sentence does not have a verb\n\t\t\tend\n\t\t\tsentence_counter += 1\n\t\tend\n\t\tputs \"\"\n\t\tputs \"every sentence is valid! \\n #{sentence_array}\"\n\t\treturn true\n\telse\n\t\tp \"the input is not valid, needs to be an array\"\n\t\treturn false\n\t\t# remove this from the array\n\t\t# will have to trick the system\n\tend\n\t\nend",
"def test_convert_word_invalid\n arr = ['1','2','4']\n @grapher.nmap = {'1'=>'a', '2'=>'b', '3'=>'c'}\n assert_nil @grapher.convert_word(arr)\n end",
"def test_find_words_valid\n words = ['apple','bat','cat']\n dict = Set['apple','bat','cat']\n assert_equal Set[\"apple\"], @grapher.find_words(words, dict)\n end"
]
| [
"0.6588492",
"0.65031785",
"0.64959717",
"0.6491809",
"0.6129646",
"0.5994317",
"0.59269834",
"0.58905125",
"0.5888142",
"0.5878064",
"0.5856911",
"0.58515334",
"0.5843693",
"0.5808219",
"0.5802023",
"0.5760909",
"0.57211196",
"0.5671177",
"0.5657717",
"0.56404006",
"0.56311595",
"0.5628099",
"0.5618137",
"0.5614594",
"0.55835944",
"0.5569743",
"0.5554587",
"0.55539894",
"0.55538094",
"0.5551751",
"0.55508524",
"0.55111784",
"0.5509077",
"0.54728717",
"0.5471536",
"0.54516405",
"0.5445255",
"0.53986776",
"0.5380401",
"0.53730524",
"0.53613967",
"0.5360255",
"0.53458005",
"0.534378",
"0.53274894",
"0.53171253",
"0.53145945",
"0.53112197",
"0.529092",
"0.52887946",
"0.5276401",
"0.52625185",
"0.5254227",
"0.5252118",
"0.5243464",
"0.5239686",
"0.5238206",
"0.52370745",
"0.52357304",
"0.52353287",
"0.5230536",
"0.5224714",
"0.52232337",
"0.5216919",
"0.52151793",
"0.52141774",
"0.52066225",
"0.5197699",
"0.5195482",
"0.5185563",
"0.5179252",
"0.5178398",
"0.517767",
"0.5174224",
"0.5167218",
"0.51656157",
"0.51600146",
"0.51585394",
"0.51522934",
"0.51520455",
"0.51492053",
"0.5146946",
"0.5124747",
"0.51165426",
"0.5113927",
"0.51091474",
"0.5107425",
"0.51031286",
"0.5098983",
"0.50942063",
"0.50898975",
"0.50877357",
"0.50870544",
"0.5060765",
"0.50551915",
"0.5052539",
"0.50514627",
"0.5046335",
"0.5037111",
"0.50355655"
]
| 0.599113 | 6 |
returns the dictionary of all valid words for given tiles and their inverses | def check_dictionary(dict)
dictionary_redux = []
for word in dict
result = check_word(word)
if result
dictionary_redux << word
end
end
new_dict = add_reversals(dictionary_redux)
return new_dict
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_valid \n h = @horizontal.reject { |(x,y),r| x==r }\n v = @vertical.reject { |(x,y),r| y==r }\n\n words = h.map { |position,right|\n x,y = position\n (x..right).map { |x| @board.tile_at([x,y]) }\n }\n words.concat v.map {|position, bottom|\n x,y = position\n (y..bottom).map { |y| @board.tile_at([x,y]) }\n }\n\n FFI::Hunspell.dict do |dict|\n for word in words do\n word = (word.map {|tile| tile.letter}).join.downcase\n return false unless dict.check? word\n end\n end\n return true\n end",
"def get_valid_moves(dictionary)\n #iterates through each letter of the alphabet and checks to see how many moves can be made after adding that letter\n #if the letter would make a word then we skip that letter\n #returns a hash where keys are the letters that don't make a word and values are how many possible moves can be made after using that letter\n #also removes any letters that don't have any possible moves after (those would be invalid moves)\n valid_moves = {}\n \n if @current_fragment == '' #if ROB is the first player return a hash with all letters with value 1\n ALPHABET.each do |letter|\n valid_moves[letter] = 1\n end\n return valid_moves\n end\n \n \n ALPHABET.each do |letter|\n valid_moves[letter] = 0\n end\n \n ALPHABET.each do |guess| \n test_string = @current_fragment+guess\n if !dictionary.include?(test_string)\n valid_moves[guess] = dictionary.count {|word| word[0...test_string.length].include?(test_string)}\n end\n end\n\n if valid_moves.values.uniq.length > 1\n return valid_moves.keep_if {|letter,count| count > 0}\n else\n valid_moves\n end\n end",
"def cryptic_dictionary(words)\nend",
"def valid_words(letters)\n center = letters[-1]\n out = []\n node = @dict.root\n queue = [node]\n next_queue = []\n until queue.empty?\n queue.each do |node|\n if node.terminal?\n word = node.full_state\n out.push(word) if word.include?(center)\n end\n letters.each do |char|\n child = node.walk(char)\n next_queue.push(child) unless child.nil?\n end\n end\n queue = next_queue\n next_queue = []\n end\n out\n end",
"def possible_words\n\t\t\[email protected] to_r\n\t\tend",
"def generateInverses()\n toReturn = Hash.new()\n \n @validCharacters.each do |x|\n @validCharacters.each do |y|\n if (multiply([x,y]) == '!')\n toReturn[x] = y\n break\n end\n end\n end\n \n toReturn\n end",
"def substrings(input_text, dictionary)\n input_text.downcase!\n dictionary.each do |word|\n compare_strings(input_text, word)\n end\n return @output_hash\nend",
"def dictionary()\n word_list = {\n \"hello\" => \"hi\",\n \"to\" => \"2\",\n \"two\" => \"2\",\n \"too\" => \"2\",\n \"for\" => \"4\",\n \"four\" => \"4\",\n \"be\" => \"b\",\n \"you\" => \"u\",\n \"at\" => \"@\",\n \"and\" => \"&\"\n }\nend",
"def spell_check\n #Temp has to get around iterating blocking hash editing\n temp_hash = Hash.new\n #For each word hash pair\n $words.each do |word|\n #Sets values for lexicon reading\n first_char = word[0][0]\n len = word[0].length\n\n #Searches lexicon for match, default is false\n match = false\n #For each word in the lexicon with the same first and second characters checks for equality\n $lexicon[first_char][len].each do |check|\n #If the words are the same sets spelling to true, or correct and breaks out of loop\n if check[0] == word[0]\n match = true\n break;\n end\n end\n #Sets temp hash to proper values, to be reassigned to word hash after full iterations\n temp_hash[word[0]] = match\n end\n #Sets words hash with proper values\n temp_hash.each do |temp|\n $words[temp[0]] = temp[1]\n end\nend",
"def find_words words\n # We will work with \"DictWord\" objects rather than with raw strings\n @words = words.map{|w| DictWord.new(w)}\n # It tries to find every single word (as long as it's possible because of size of grid) in the grid \n # If running on a UNIX system, we could use fork to improve the performance\n # Process.fork {\n @words.each{|dw| place dw if (dw.word != nil && dw.word.size <= @w )}\n # }\n # We return only the words that were found in the grid \n return @words.select{|w|w.place != nil} \n end",
"def words # utility\n @dict.keys.sort\n end",
"def word_map(lines)\n words = []\n lines.each_with_index do |s, i|\n words[i] = []\n start = -1\n word = ''\n in_word = false\n (s + '|').each_char.each_with_index do |c, j|\n if in_word\n if '.?!*|'.include?(c)\n words[i][start] = word\n words[i][j-1] = word\n in_word = false\n else\n word << c\n end\n else\n unless '.?!*|'.include?(c)\n in_word = true\n word = c\n start = j\n end\n end\n end\n end\n words\n end",
"def valid_words(rack)\n # Load the words\n list_of_words = load_words\n array_of_valid_words = []\n # for each word check if all the letters of word are in rack\n list_of_words.each do |word|\n array_of_valid_words << word if check_word(word, rack)\n end\n array_of_valid_words\nend",
"def construct_word(word, word_len, dict, twos=@@two_tiles, threes=@@three_tiles, fours=@@four_tiles)\n\t\n\t\tleftover = word_len - word.length\n\t\t\n\t\t# NOTE: I decided to repeat .each routines, as the alternative would mean passing a whole lot of variables to a routine that only executes a few lines of code. When changing one scenario, all other matching scenarios must be changed.\n\t\t# 0: A word of appropriate length has been found. All that remains is to search the dictionary.\n\t\t# 1: There will never be a scenario with one left-over. There are no tiles of length 1.\n\t\t# 2: The only tiles that will fit is of length 2. Only query 'twos'.\n\t\t# 3: The only tiles that will fit is of length 3.\n\t\t# 4: Valid tile placement includes tiles of length 2 and 4.\n\t\t# 5: Valid tile placement includes tiles of length 2 and 3.\n\t\t# 6+: Valid tile placement includes tiles of length 2, 3, and 4.\n\t\tcase leftover\n\t\t\twhen 0 \n\t\t\t\tif (dict.query(word))\n\t\t\t\t\t@@valid_combinations.push(word)\n\t\t\t\tend\n\t\t\twhen 2\n\t\t\t\ttwos.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_twos = twos - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, new_twos, threes, fours) \n\t\t\t\t}\n\t\t\twhen 3\n\t\t\t\tthrees.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_threes = threes - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, twos, new_threes, fours) \n\t\t\t\t}\n\t\t\twhen 4\n\t\t\t\ttwos.each { |tile|\n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_twos = twos - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, new_twos, threes, fours) \n\t\t\t\t}\n\t\t\t\tfours.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_fours = fours - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, twos, threes, new_fours) \n\t\t\t\t}\n\t\t\twhen 5\n\t\t\t\ttwos.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_twos = twos - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, new_twos, threes, fours) \n\t\t\t\t}\n\t\t\t\tthrees.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_threes = threes - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, twos, new_threes, fours) \n\t\t\t\t}\n\t\t\twhen 6..15\n\t\t\t\ttwos.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_twos = twos - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, new_twos, threes, fours) \n\t\t\t\t}\n\t\t\t\tthrees.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_threes = threes - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, twos, new_threes, fours) \n\t\t\t\t}\n\t\t\t\tfours.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_fours = fours - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, twos, threes, new_fours) \n\t\t\t\t}\n\t\t\telse \n\t\t\t\tputs \"Leftover: \" << leftover.to_s\n\t\t\tend\n\t\t\n\tend",
"def substrings text,dictionary\n\ttext.downcase!\n\thash = {}\n\tdictionary.each do |word|\n\t\tcount = text.scan(word.downcase).length\n\t\thash[word] = count if count > 0\n\tend\n\thash\nend",
"def edgy_words(hash)\n return hash if hash.keys.size <= 15\n\n h = hash.dup\n h.each do |word, prob|\n h[word] = 1.0 - h[word] if h[word] >= 0.5\n end\n arr = h.to_a.sort{|x, y| x[1] <=> y[1]}\n words = arr[0, 15].collect{|x| x.first}\n\n result = words.inject({}){|h, w| h[w] = hash[w]; h}\n end",
"def check(words:)\n dictionary = Set.new([\"hello\", \"my\", \"name\", \"is\", \"orange\"])\n corrected = []\n words.each do | word |\n dictionary.include?(word) ? corrected.push(word) : corrected.push(\"~#{word}~\")\n end\n corrected\nend",
"def substrings words, dictionary\n hits = Hash.new\n dictionary.each do |lookup|\n hits[lookup] = words.scan(/#{lookup}/i).length\n end\n hits.delete_if {|k,v| v == 0} # squeeze out the empties\nend",
"def known(words)\n temp = words.find_all {|k| @dictionary.key?(k) } \n res = temp.sort_by do |word|\n @dictionary[word]\n end\n return res.reverse\n #find all words for which condition is true,\n #you need to figure out this condition\n \n end",
"def subwords(word, dictionary)\r\n res = []\r\n substrings(word).each do |ele|\r\n res << ele if dictionary.include?(ele)\r\n end\r\n res\r\nend",
"def possibilities(words)\n words.each do |word, translations|\n sorted = translations.sort\n words[word] = sorted.each_index.map {|i|\n sorted.combination(i+1).to_a\n }.flatten(1).sort\n end\nend",
"def scan\n $stderr.print \"[lexicon] \"\n\n dict = Set.new\n\n files.each do |file|\n if $DEBUG\n $stderr.puts \"[scanning dictionary] #{file}\" if $DEBUG\n else\n $stderr.print \".\"\n end\n\n text = File.read(file).gsub(\"\\n\", \" \")\n states = text.split(/[.,:;?!()\"]\\s*/)\n\n states.each do |state|\n state.scan(WORD) do |word|\n word = normalize(word)\n dict << word if valid_word?(word)\n end\n end\n end\n\n @set = dict\n\n $stderr.puts\n end",
"def word_unscrambler(word, dictionary)\nresult = []\ndictionary.each do |entry|\n\tif entry.split(\"\").sort.join(\"\") == word.split(\"\").sort.join(\"\")\n\t\tresult << entry\n\tend\nend\nresult \nend",
"def known_edits2 (word)\n # get every possible distance - 2 edit of the input word. Return those that are in the dictionary.\n end",
"def word_comparison(letters_hash, word_hash)\n result = {}\n word_hash.each do |key, _value|\n if !letters_hash.include?(key) || word_hash[key] > letters_hash[key]\n result[:score] = 0\n result[:message] = 'Your word is not in the grid :('\n return result\n else\n return {}\n end\n end\n end",
"def words\n @words ||= begin\n words = Set.new\n board_traverser.each_with_recur do |word, char, recurser|\n next unless searcher.has_child? char\n searcher.down_to char do\n words << word if searcher.on_word? && [email protected]?(word)\n recurser.call\n end\n end\n words.sort_by &:length\n end\n end",
"def recursive_hypernyms(word, part_of_speech)\n if Relations.map.keys.include? word\n return [word]\n else\n # look in wordnet\n synsets = @wordnet.lookup_synsets(word, part_of_speech) \n \n hypernyms = Set.new\n \n synsets.each { |ss|\n ss.traverse(:hypernyms).each { |synset|\n synset.words.each { |w|\n hypernyms << w.lemma\n }\n }\n }\n \n #check these with the mappings\n return hypernyms.to_a & Relations.map.keys.to_a\n end\n end",
"def found_words\n @word_index.keys\n end",
"def find_all_concatenated_words_in_a_dict(words)\n res = []\n words.each do |original_word|\n smaller_words = words.select { |word| word.length < original_word.length }\n next if smaller_words.count < 2\n permutations = create_permutations(smaller_words).map { |perm| perm.join }\n p permutations\n res << original_word if permutations.include?(original_word)\n end\n res\nend",
"def known(words)\n #find all words for which condition is true,you need to figure out this condition\n known_words = words.find_all {|w| @dictionary.has_key?(w)} \n return known_words\n end",
"def existing_words\n draw_current = draw\n p \"The 7 letters drawn are:\"\n p draw_current\n p \"-\"*70\n\n combinations = combine(draw_current).flat_map{ |w| w.permutation.to_a}.uniq.map { |e| e.join }\n combinations.map{|i| search(i, UPPER_BOUND_INI, LOWER_BOUND_INI, NO_ITERATION_INI)}.flatten.reject{|x| x==nil}\nend",
"def words\n @words ||= dictionary.select { |word| word.length > 3 }\n end",
"def unscramble(str,dict)\n words = []\n index = 0\n while index < dict.length\n if str.chars.sort == dict[index].chars.sort\n words = words.push(dict[index])\n end\n index = index + 1\n end\n return words\nend",
"def substrings(phrase, dictionary)\n dictionary.reduce(Hash.new(0)) do |map, word| \n map[word] += phrase.upcase.scan(word.upcase).length if phrase.upcase.include?(word.upcase)\n map\n end\nend",
"def substrings(input, dictionary)\n\thash = {}\t\t\t\t\t# Initialize empty hash\n\tdictionary.each do |word|\n\t\t# For each word, count the number of times it appears\n\t\tcount = input.downcase.scan(word.downcase).length\n\t\tif count > 0\n\t\t\t# If greater than 0:\n\t\t\thash[word] = count\t# Add word => count to hash\n\t\tend\n\tend\n\thash\nend",
"def substrings(words,dictionary)\n words = words.split(/\\W+/)\n substrings = Hash.new(0)\n\n words.each_with_index do |word,i|\n j = i\n for j in 0...dictionary.size\n if word.downcase.include? dictionary[j]\n substrings[dictionary[j]] +=1\n end\n end\n end #end each\n pp substrings.sort_by {|k,v| v}\nend",
"def find_words(words, dict)\n return nil if words.nil? || dict.nil?\n return [] if words.empty? || dict.empty?\n\n size = -1\n list = Set.new\n\n words.each do |w|\n if dict.include? w.downcase\n break if w.length < size\n\n size = w.length\n list << w\n end\n end\n list\n end",
"def dictionary\n\t#recieve word not sentence. already split\n\t#find word from dictionary\n dictionary = {\n \"hello\" => \"hi\",\n \"to\" => \"2\",\n \"two\" => \"2\",\n \"too\" => \"2\",\n \"for\" => \"4\",\n \"For\" => \"4\",\n \"four\" => \"4\",\n \"be\" => \"b\",\n \"you\" => \"u\",\n \"at\" => \"@\",\n \"and\" => \"&\"\n }\nend",
"def known_edits2 (word)\n # get every possible distance - 2 edit of the input word. Return those that are in the dictionary.\n words1 = edits1(word)\n words2 = []\n words1.each do |w|\n words2.concat(edits1(w))\n end\n return known(words2.uniq)\n end",
"def substrings(string, dictionary)\n found_words = Hash.new(0)\n\n words = string.downcase.gsub(/[^a-z\\s]/, '').split(' ') #cut non-alphanumberic chars from string and put words into array\n\n words.each do |word|\n dictionary.each do |dword|\n if word.include?(dword)\n found_words[dword] += 1\n end\n end\n end\n\n puts found_words\nend",
"def verify_word_on_board(w, hash_table)\n w = w.upcase # Since the letters on board is in capital letter\n\n p hash_table\n i = 0\n searched_index = {} # Hash table to keep track what has been searched\n (0...w.length).each { |i| searched_index.store(i, -1)} # Initiate values to indicate that no letters have been searched\n\n while i >= 0 && i < w.length\n # puts \"\\nStart of while loop, i = #{i}, searching letter #{w[i]}...\" ###\n move = false\n\n unless hash_table[w[i]].empty?\n # print \"Letter #{w[i]} exist at #{hash_table[w[i]]}\\n\" ###\n hash_table[w[i]].each_with_index do | value , index |\n # puts \"Scanning through #{w[i]} at position #{value}\" ###\n \n # This unmark the position that was used previously during backtracking.\n if value + @total_letters < 0\n # puts \"Position #{hash_table[w[i]][index]} of #{w[i]} is restored...\" ###\n hash_table[w[i]][index] += (@total_letters * 2)\n # puts \"Position of #{w[i]} is now #{hash_table[w[i]][index]}.\" ###\n end\n\n if index <= searched_index[i] # This skips letters that are already searched\n # puts \"#{w[i]} at #{hash_table[w[i]][index]} is already searched.\" ###\n next\n end\n\n if value >= 0\n \n # The position is subtrated by no of total letters to indicate that it has been searched.\n # No of total letters is used so that duplicate of hash table is not required.\n \n if i == 0 || is_adjacent(hash_table[w[i]][index],(@total_letters + hash_table[w[i-1]][searched_index[i-1]]))\n hash_table[w[i]][index] -= @total_letters\n # puts \"#{value} has been subracted by @total_letters to #{hash_table[w[i]][index]}\" ###\n \n \n searched_index[i] = index\n # puts \"Moving to next letter, searched_index[#{i}] now has been updated to #{searched_index[i]}\" ###\n move = true\n i += 1\n break\n end\n\n end\n end\n\n end\n\n # i -= 1 if move == false\n if move == false\n if i > 0\n # puts \"Previously used #{w[i-1]} position of #{hash_table[w[i-1]][searched_index[i-1]]} is being marked for restoration.\" ###\n \n hash_table[w[i-1]][searched_index[i-1]] -= @total_letters # To mark position to be restored to original value as it will not be used anymore\n # puts \"Current position of #{w[i-1]} is #{hash_table[w[i-1]][searched_index[i-1]]}.\" ###\n searched_index[i] = -1\n end\n\n\n # puts \"Letter #{w[i]} is not available/not adjacent and i will be subtracted\" ###\n i -= 1\n end\n\n end\n\n # Restore back all coordinates for next word\n\n\n restore_hash_table(hash_table)\n\n # Check whether word exists.\n if i >= 0 \n puts \"#{w} exists!\"\n return true\n else\n puts \"#{w} is not available.\"\n return false\n end\n \n end",
"def relevant_l33t_substitutions(password)\n subs = Hash.new do |hash, key|\n hash[key] = []\n end\n L33T_TABLE.each do |letter, substibutions|\n password.each_char do |password_char|\n if substibutions.include?(password_char)\n subs[letter] << password_char\n end\n end\n end\n subs\n end",
"def dictionary\nsubs = {\n \"hello\"=>\"hi\",\n \"to\" => \"2\",\n \"two\" => \"2\",\n \"too\" => \"2\",\n \"for\" => \"4\",\n \"four\" => \"4\",\n \"be\" => \"b\",\n \"you\" => \"u\",\n \"at\" => \"@\",\n \"and\" => \"&\"\n}\nend",
"def compare_strings(input_text, dictionary_word)\n for i in 0..input_text.length - 1 do\n if input_text.length - i >= dictionary_word.length\n j = i + dictionary_word.length - 1\n arr = input_text.slice(i..j)\n if arr.eql?(dictionary_word)\n @output_hash = update_output_hash(arr, @output_hash)\n end\n end\n end\nend",
"def dictionary\n {\n \"hello\" => 'hi',\n \"to\" => '2',\n \"two\" => '2',\n \"too\" => '2',\n \"for\" => '4',\n \"For\" => '4',\n \"four\" => '4',\n \"be\" => 'b',\n \"you\" => 'u',\n \"at\" => '@',\n \"and\" => '&'\n }\nend",
"def substrings(word, dictionary)\n\tresult = Hash.new(0)\t\t\t# constructor passed a 0 makes 0 the default return value for non-exist keys\n\n\tdictionary.each do |w|\n\t\tfor i in 0..word.length-1\n\t\t\tresult[w] += 1 if word[i..word.length-1] == w \t\t\t\t\n\t\tend\n\tend\n\tresult\nend",
"def dictionary\n{\n \"hello\" => \"hi\",\n \"to\" => \"2\",\n \"two\" => \"2\",\n \"too\" => \"2\",\n \"for\" => \"4\",\n \"four\" => \"4\",\n \"be\" => \"b\",\n \"you\" => \"u\",\n \"at\" => \"@\",\n \"and\" => \"&\"\n}\nend",
"def test_convert_words_and_find_valid\n @grapher.nmap = {'1'=>'a', '2'=>'b', '3'=>'c'}\n paths = [['1','2','3','1'], ['3','2','1']]\n hdicts = [{'ahy'=>['hay','yah']}, {'abc'=>['cab','bac']}]\n exp = ['bac','cab']\n assert_equal exp, @grapher.convert_words_and_find(paths, hdicts)\n end",
"def subwords(word, dictionary)\n arr = substrings(word)\n arr.select { |str| dictionary.include?(str) }\nend",
"def check_hooking player, board, word_list\n\t\t\tbest =Array.new(2, ScrabbleWord.new('', 0, 0, 0, 0))\n\t\t\twords = DICTIONARY.get_all(player.tiles)\n\t\t\tword_hash = Hash.new\n\t\t\twords.each do |word|\n\t\t\t\tword.each_char do |char|\n\t\t\t\t\tword_hash[char] ||= Set.new\n\t\t\t\t\tword_hash[char] << word\n\t\t\t\tend\n\t\t\tend\n\t\t\tword_list.each do |word|\n\t\t\t\tplayer.tiles.each do |char|\n\t\t\t\t\tif DICTIONARY.word?(word.word + char) || DICTIONARY.word?(char + word.word)\n\t\t\t\t\t\tword_hash[char].each do |new_word|\n\t\t\t\t\t\t\trow = word.row\n\t\t\t\t\t\t\tcol = word.col\n\t\t\t\t\t\t \tword.dir == :across ? col -=1 : row -= 1\n\t\t\t\t\t\t\tbest = hook_helper(new_word, word.word.length , word, board, char, word.row , word.col, best, word.word + char) if DICTIONARY.word?(word.word + char)\n\t\t\t\t\t\t\tbest = hook_helper(new_word, 0 , word, board, char, row, col, best, char + word.word) if DICTIONARY.word?(char + word.word)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t[best, best.inject(0){|sum, i| sum + i.score}]\n\t\tend",
"def dictionary\n { \"hello\" => \"hi\",\n \"to\" => \"2\",\n \"two\" => \"2\",\n \"too\" => \"2\",\n \"for\" => \"4\",\n \"four\" => \"4\",\n \"be\" => \"b\",\n \"you\" => \"u\",\n \"at\" => \"@\",\n \"and\" => \"&\" }\nend",
"def possibilities(words = {})\n words.reduce(Hash.new([])) do |combos, (k,v)|\n 1.upto(v.length) do |i|\n combos[k] += v.combination(i).to_a.map {|combo| combo.sort }\n end\n combos[k].sort!\n combos\n end\nend",
"def dictionary\n hash = {}\n @length_indexed_dict.each do |len, words_of_same_length|\n hash.merge! words_of_same_length\n end\n hash\n end",
"def solve\n\t\t# Attempt to find a mismatch in start/end\n\t\t# letters in the maps. This signifies first\n\t\t# and last words of the solution\n\t\tdiff_list = []\n\t\t@start_map.each {|k,v|\n\t\t\tr = @end_map[k]\n\t\t\tdiff = r-v\n\t\t\tputs \"#{k} => #{v} | #{r} diff #{diff}\"\n\t\t\t\n\t\t\t# If values in map don't match, remember this\n\t\t\tif diff != 0\n\t\t\t\tdiff_list << diff\n\t\t\tend\n\t\t}\n\n\t\t# Ensure the matchings satisfy the properties of\n\t\t# and solvable puzzle. If there are \n\t\tputs diff_list\n\t\tif diff_list.size == 0\n\t\t\t# This means there are cycles (multiple\n\t\t\t# choices for the first word).\n\t\telsif diff_list.size == 2\n\t\t\t# Ensure there is exactly one starting\n\t\t\t# word and exactly one ending word\n\t\t\treturn [] if !diff_list.include?( 1 )\n\t\t\treturn [] if !diff_list.include?( -1 )\n\t\telse\n\t\t\t# This signifies an unsolvable puzzle\n\t\t\tputs \"Not Solvable\"\n\t\t\treturn []\n\t\tend\n\n\t\t# The characteristics of this word list look\n\t\t# good so far. Let's now try to enumerate the\n\t\t# solution array\n\t\treturn enumerate_solution\n end",
"def find_words(lines, words, sec, point_map)\n found = {}\n max = @letters.length\n lines.each_with_index do |s, i|\n start = 0\n while start < 15\n pattern = ''\n match_regex = ''\n j = start\n while j <= 14 do\n break if s[j] == '!'\n #puts \"** #{i},#{j}\"\n match_regex << (s[j] == '?' ? \"(#{sec[i][j].keys.join('|')})\" : (s[j] == '*' ? '.' : s[j]))\n pattern << s[j]\n break if pattern.count(\".?\") >= max\n j += 1\n end\n if j && j < 14 && s[j] != '!' && words[i][j+1]\n pattern += words[i][j+1]\n match_regex += words[i][j+1]\n end\n\n\n #puts \"regex: #{match_regex}\"\n found.merge!(match(pattern, start, i, words[i], sec[i], point_map[i], match_regex)) unless pattern == ''\n\n if '.?!*'.include?(s[start])\n start += 1\n else\n start += words[i][start].length + 1\n end\n\n end\n end\n #puts \"found: #{found.inspect}\"\n found\n end",
"def init_trie(filepath, user_tiles)\n\t\ttrie = Containers::Trie.new\n\t\ttile_vals = init_tiles_hash\n\t\tuser_tiles = user_tiles.chars.to_a\n\n\t\tIO.foreach(filepath) do |valid_word|\n\t\t\tword = valid_word.downcase.chomp.chars.to_a\n\t\t\t# if word is a subset user_tiles, it\n\t\t\t# can be formed with user_tiles so push it\n\t\t\tif (word-user_tiles).empty?\n\t\t\t\ttrie.push(word.join(\"\"), get_score(word, tile_vals))\n\t\t\tend\n\t\tend\n\t\treturn trie\n\tend",
"def get_dictionary\n dictionary = {}\n File.foreach(FILE_PATH) do |word| # loop throughout file\n word = word.chop.to_s.downcase # get only word (chop out enter)\n word_length = word.length\n if ALLOWED_LENGTHS.include?(word_length) # check whether word length is in ALLOWED_LENGTHS\n number_keys = \"\"\n (0...word_length).each do |i|\n number_keys += @letter_num_hash[word[i]] # append numbers based on each letter\n end\n word_value = dictionary.fetch(number_keys, []) # fetch word value else initialize new array\n word_value << word\n dictionary[number_keys] = word_value # assign word to respective numbers key\n end\n end\n return dictionary #return final dictionary\n end",
"def find_words(words)\n search_results = SearchResults.new\n \n general = Vector.new\n must_match = Vector.new\n must_not_match = Vector.new\n not_found = false\n \n extract_words_for_searcher(words.join(' ')) do |word|\n case word[0]\n when ?+\n word = word[1,99]\n vector = must_match\n when ?-\n \t word = word[1,99]\n vector = must_not_match\n else\n \t vector = general\n end\n \n index = @dict.find(word.downcase)\n if index\n vector.add_word_index(index)\n else\n not_found = true\n \t search_results.add_warning \"'#{word}' does not occur in the documents\"\n end\n end\n \n if (general.num_bits + must_match.num_bits).zero? \n search_results.add_warning \"No valid search terms given\"\n elsif not not_found\n res = []\n @document_vectors.each do |entry, (dvec, mtime)|\n score = dvec.score_against(must_match, must_not_match, general)\n res << [ entry, score ] if score > 0\n end\n \n res.sort {|a,b| b[1] <=> a[1] }.each {|name, score|\n search_results.add_result(name, score)\n }\n \n search_results.add_warning \"No matches\" unless search_results.contains_matches\n end\n search_results\n end",
"def substrings (word, dict)\n\tbigarray = []\t\n\twordray = word.downcase.split \t\n \t\n \tfor i in wordray \t\t\n\t\tnn = dict.select { |w| i.include?(w) }\t\t\t\n\t\tbigarray = bigarray+nn\t\n\tend\t\t\n\t\t\n\tbigash = Hash.new(0).tap { |h| bigarray.each { |word| h[word] += 1 } }\n\treturn bigash\t\nend",
"def word_list\n @word_list ||= Set.new File.read(\"dictionary.txt\").split(\"\\n\").map(&:downcase)\n end",
"def find_concepts( s )\n jump_count = 0 #prevent matched word from matching again\n ret = []\n return ret if s.blank?\n \n words = s.scan(LanguageModel::PTN_TERM).map{|w|w.downcase}\n 0.upto(words.length-1) do |i| #foreach word in sentence\n h = @ch\n if jump_count > 0 then jump_count-=1 ; next end\n \n i.upto(words.length-1) do |j| #foreach word try matching with concept table\n #p \" >Checking words[#{i},#{j}] = #{w}\"\n w = words[j] #'current word\n wn = words[j+1] if j+1 < words.length # next word\n if !h[w] # no concept is matched\n break \n elsif h[w].class == Hash #many concepts are matched\n # Next Word doesn't match & key was found\n if !h[w][wn] && h[w][:_key_]\n if block_given?\n yield h[w][:_key_] , words[i..j].join(' ')\n else\n #puts \"Found: #{words[i..j].join(' ')}\"\n ret << [h[w][:_key_], words[i..j].join(' ')]\n end\n break\n else #Move to Next Word\n jump_count += 1\n h = h[w]\n end\n elsif h[w].class == Fixnum #one concept is matched\n if block_given?\n yield h[w] , words[i..j].join(' ')\n else\n #puts \"Found: #{words[i..j].join(' ')}\"\n ret << [h[w], words[i..j].join(' ')]\n end\n break\n else\n error \"[ConceptStorage#find_concept] Invalid value #{h[w].inspect}\"\n end\n end#do\n end#do\n ret\n end",
"def find_matches(number, dictionary)\n words = []\n x = []\n number.split('').each { |digit| x.push(NUMBER_TO_WORD_MAPPER[digit]) }\n x[0].product(*x[1..-1]).each { |val| words.push(val.join) if dictionary.include? val.join } unless x.empty?\n words\n end",
"def words\n grid.words.map {|word| decorate_word(word) }\n end",
"def count_words(string)\n \n result = {}\n\n clean = string.downcase.gsub(/[^a-z]+/,\" \").split\n clean2 = clean.each{|d| checker1(d,result)}\n \n return(result)\n \n\nend",
"def search_conditions_as_hash(locale)\n [\n { :value => I18n.t(\"advanced_searches.text_search_field.all_words\", locale: locale), :key => \"all_words\"},\n { :value => I18n.t(\"advanced_searches.text_search_field.one_word\", locale: locale), :key => \"one_word\"},\n { :value => I18n.t(\"advanced_searches.text_search_field.exact\", locale: locale), :key => \"exact\"}\n ]\n end",
"def test_convert_words_and_find_invalid\n @grapher.nmap = {'1'=>'a', '2'=>'b', '3'=>'c'}\n paths = [['1','2','4','1'], ['3','2','1']]\n hdicts = [{'ahy'=>['hay','yah']}, {'ab'=>['ab','ba']}]\n exp = ['abca','cba']\n assert_nil @grapher.convert_words_and_find(paths, hdicts)\n end",
"def build_maps\n\t\t@start_map = {}\n\t\t@end_map = {}\n\t\t[*\"a\"..\"z\"].each{ |l|\n\t\t\t@start_map[ l ] = 0\n\t\t\t@end_map[ l ] = 0\n\t\t}\n\t\t\n\t\t@sorted_list.each {|word|\n\t\t\tfirst_letter = word[0]\n\t\t\tlast_letter = word[word.length-1]\n\n\t\t\t@start_map[ first_letter ] += 1\n\t\t\t@end_map[ last_letter ] += 1\n\t\t}\n end",
"def build_dict(dict)\n dict.each do |word|\n sz = word.size\n @words[sz][word] = true\n end\n end",
"def substrings(words, input)\n result = Hash.new {|h,k| h[k] = Set.new}\n l = input.length\n words.each do |word|\n i = 0\n while i + word.length <= l\n j = input.index(word, i)\n break if ! j\n result[word] << j + word.length\n i = j + 1\n end\n end\n result\n end",
"def load_dict\n words = []\n File.open(\"dict.txt\").each do |line| # Hard code for now\n if line.length.between?(5, 12)\n words << line.rstrip.downcase\n end\n end\n words\n end",
"def scan_regex_pattern_expression expression\n words = {}\n expression.each_pair do |key, exp|\n words[key] = dictionary.scan(Regexp.new(exp)).map(&:join)\n end\n words\n end",
"def words\n terms.collect { |t| t.word }\n end",
"def direct_hypernyms(word, part_of_speech)\n if Relations.map.keys.include? word\n return [word]\n else\n # look in wordnet\n synsets = @wordnet.lookup_synsets(word, part_of_speech) \n \n hypernyms = Set.new\n \n # get all hypernyms from wordnet\n synsets.each { |ss|\n ss.hypernyms.each { |synset|\n synset.words.each { |w|\n hypernyms << w.lemma\n }\n }\n }\n \n #check these with the mappings\n return hypernyms.to_a & Relations.map.keys.to_a\n end\n end",
"def substrings(word_string, dictionary)\r\n results = {}\r\n count = 0\r\n word_array = (word_string.downcase).split(' ')\r\n dictionary.each do |search_phrase|\r\n word_array.each do |word|\r\n count+=1 if (word.include? search_phrase)\r\n end\r\n results[search_phrase] = count if count > 0\r\n count = 0\r\n end\r\n return results\r\nend",
"def non_opt_words(current)\n output = []\n (0..(current.length-1)).each do |index|\n ('a'..'z').each do |let|\n test_word = current.clone\n test_word[index] = let\n output << test_word if legal_word?(test_word)\n end\n end\n output.uniq\nend",
"def dictionary_hash(array)\n dictionary = {}\n array.each do |word|\n letters = word.chars.sort.join\n if dictionary.has_key?(letters)\n dictionary[letters] = dictionary[letters] << word\n else\n dictionary[letters] = [word]\n end\n end\n dictionary\nend",
"def check_for_definitions\n @words.each do |word|\n @lemma ? lemma = \" - #{@lemmas[word]}\" : lemma = \"\"\n\n # Strip characters - mimics trimWordLowerCase in texts.js\n regex = /[\\u200B-\\u200D\\uFEFF\\u00A0]/\n word.gsub!(regex, \"\")\n regex = /^[.,!¡?¿:;\\/|\\\\'\"“”‘’‚„«»‹›()\\[\\]\\-_]+|[.,!¡?¿:;\\/|\\\\'\"“”‘’‚„«»‹›()\\[\\]\\-_]+$/\n word.gsub!(regex, \"\")\n \n next if word.length == 0\n \n # Convert to lowercase\n word = word.mb_chars.downcase.to_s\n current_word = word\n \n while word.length > 0 do\n if Match.find_by_word_and_text_id(word, @text)\n break\n else\n if word.length == 1\n @missing.push(\"#{current_word}#{lemma}\")\n break\n else\n if word.last == \"*\"\n word.chomp!(\"*\") # Remove wildcard character, if present\n word = word[0..-2] # Remove last character\n end\n word << \"*\" # Add wildcard character\n end\n end\n end\n end\n end",
"def dictionary()\n return @data[:words]\n end",
"def uniq_subs(word)\n subs = {}\n word.length.times do |i|\n (i...word.length).each do |j|\n if !subs[str[i..j]]\n subs[str[i..j]] = str[i..j]\n end\n end\n end\nend",
"def correct(word)\n if @dictionary.has_key?(word)\n return [word]\n end\n \n dist1_replacements = known(edits1(word))\n if dist1_replacements.length != 0\n \treturn dist1_replacements.sort_by{|value| @dictionary[value]}.reverse\n end\n \n dist2_replacements = known_edits2(word)\n if dist2_replacements.length != 0\n \treturn dist2_replacements.sort_by{|value| @dictionary[value]}.reverse\n end\n return nil\n end",
"def words\n words = @phrase.split(\" \")\n words.each do |word|\n translate(word)\n end\n end",
"def display_words\n words = self.dictionary.map do |dictionary_entry|\n dictionary_entry.word.lexical_item\n end\n words \n end",
"def dictionary \n {\n \"hello\" => 'hi',\n \"to\" => '2',\n \"two\" => '2',\n \"too\" => '2',\n \"for\" => '4',\n \"four\" => '4',\n 'be' => 'b',\n 'you' => 'u',\n \"at\" => \"@\", \n \"and\" => \"&\"\n \n }\nend",
"def get_spelling_words(file)\n lines = IO.readlines(file).map(&:chomp)\n review_word = false\n challenge_word = false\n words = []\n lines.each do |line|\n if md=line.match(/\\A(\\d+)\\.\\s+(\\w+)\\Z/)\n (num, word) = md.captures\n words << SpellingWord.new(num, word, review_word, challenge_word)\n elsif line.match(/\\AReview Words/)\n review_word = true\n challenge_word = false\n elsif line.match(/\\AChallenge Words/)\n challenge_word = true\n review_word = false\n end\n end\n words\nend",
"def substrings(string, dictionary)\n substrings_hash = {}\n arr_of_strings = string.downcase.split\nend",
"def generate_words\r\n words = Hash.new\r\n\r\n # TODO - add error handling\r\n dictionary = \"bigdict.txt\"\r\n dictionary = \"test.txt\" if DEBUG\r\n \r\n # for benchmarking purposes, we search 80k records in about 1 second. mindblowing increase in computing power since 1980!\r\n time = Time.new\r\n\r\n File.foreach dictionary do |word|\r\n word.chomp!\r\n words[word] = score_word(word) if valid_word?(word)\r\n end #end file.each\r\n\r\n time = Time.new - time\r\n\r\n # output all words in descending score value\r\n words.sort_by { |word, score| score }.reverse.each do |result|\r\n puts \"#{result[0]} - #{result[1]}\"\r\n end\r\n\r\n puts \"Found #{words.length} words in #{time} seconds\"\r\nend",
"def new_illegal_words(board, dict)\n new_words(board).reject {|word| dict.legal_word?(word.to_s)}\n end",
"def missingWords(s, t)\n res = []\n s_words = s.split(\" \")\n t_words = t.split(\" \")\n i = 0\n j = 0\n while i < s_words.length\n if s_words[i] != t_words[j]\n res.push(s_words[i])\n else \n j += 1\n end\n i += 1\n end\n res\nend",
"def substrings (search_word_list, dictionary)\n #Hash to track word and its count\n word_count_hash = Hash.new\n #Turns search_word_list into an array\n search_word_list_array = search_word_list.split(\" \")\n \n #Loops through the search_word_list\n search_word_list_array.each do |search_word|\n search_word.downcase!\n #Loops through the dictionary\n dictionary.each do |dictionary_word| \n #Checks if dictionary_word is in search_word\n if search_word.include? dictionary_word\n #Checks if the key already exists and increments count by 1 if it does\n if word_count_hash.key?(dictionary_word)\n word_count_hash[dictionary_word] += 1\n else \n #Sets the value of the key to 1 if it doesn't already exist\n word_count_hash[dictionary_word] = 1\n end\n end\n end\n end\n return word_count_hash\nend",
"def substrings(phrase,dictionary)\n word_freq = Hash.new(0)\n phrase.split().each do |word|\n dictionary.each do |dict|\n if word.downcase.include?(dict)\n word_freq[dict]+=1\n end\n end\n end\n puts word_freq\nend",
"def substrings (string, dictionary)\n\n\t#Ensure string is lowercase\n\tstring.downcase!\n\tstring_array = string.split(\" \")\n\t\n\t#Initialize hash based on dictionary\n\twords = Hash.new(0)\n\tdictionary.each { |x| \n\t\n\t\tstring_array.each { |y| \n\t\n\t\t\t#find word based on dictionary in substring\n\t\t\tif y.include?(x)\t\t\n\t\t\t\twords[x] += 1\n\t\t\tend\n\t\t\t}\n\t\t} \n\t\n\tputs words\nend",
"def all_excluded_words\n (excluded_words + (lazy? ? LAZY_WORDS : [])).map(&:downcase)\n end",
"def test_find_words_dict_empty\n words = ['apple','bat','candy']\n dict = Set.new\n assert_equal [], @grapher.find_words(words, dict)\n end",
"def dictionary\n {\n :hello => \"hi\",\n :to => \"2\",\n :two => \"2\",\n :too => \"2\",\n :for => \"4\",\n :four => \"4\",\n :be => \"b\",\n :you => \"u\",\n :at => \"@\",\n :and => \"&\"\n}\nend",
"def dictionary \n the_dictionary = {\n \"hello\" => \"hi\",\n \"to\" => \"2\",\n \"two\" => \"2\",\n \"too\" => \"2\",\n \"for\" => \"4\",\n \"four\" => \"4\",\n \"be\" => \"b\",\n \"you\" => \"u\",\n \"at\" => \"@\",\n \"and\" => \"&\"\n }\nend",
"def wordsmith letter_pool\n\t### Dictionary Read ###\n dictionary = []\n file_path = \"dictionary.txt\"\n File.foreach( file_path ) do |word|\n dictionary.push word.chop.to_s.downcase\n end\n\t#puts \"----------------->\" + dictionary.size.to_s\n\t############## EO Dicitonary\n\n\t############ Begin generating words ##############\n\t## Result holder\n\tresults = {}\n\ttotal_number = letter_pool.length - 1\n\t########## Check for words with 3 chars ########\n\tfor i in (2..total_number)\n\t\t######## 3 chararcters are held in min_word ; rest of all held in rest ############ \n\t\tmin_word = letter_pool[0..i]\n\t\trest = letter_pool[i + 1..total_number]\n\t\tnext if min_word.length < 3 || rest.length < 3\n\t\t######## All permutations of min_word resides in first_set\n\t\tfirst_set = min_word.shift.product(*min_word).map(&:join)\n\t\tnext if first_set.nil?\n\t\t########### All permutations of rest of chars residesd in rest_set\n\t\trest_set = rest.shift.product(*rest).map(&:join)\n\t\tnext if rest_set.nil?\n\t\tresults[i] = [(first_set & dictionary), (rest_set & dictionary)]\n\tend\n\t######################\n\tword_pool = []\n\tresults.each do |key, set|\n\t\tnext if set.first.nil? || set.last.nil?\n\t\tset.first.product(set.last).each do |words|\n\t\tword_pool << words\n\tend\n\tend\n\t##########################\n\tword_pool << (letter_pool.shift.product(*letter_pool).map(&:join) & dictionary).join(\", \")\n\tword_pool\nend",
"def word_unscrambler(str, words)\n str = str.split('').sort.join('')\n possible = []\n words.map do |word|\n sort_word = word.split('').sort.join('')\n possible << word if word_c == str\n end\n return possible\nend",
"def substrings(word_string, dictionary)\n\tresults = {}\n\tmatch_count = 0\n\tword_array = word_string.split(\" \")\n\tdictionary.each do |match_string|\n\t\tword_array.each do |word|\n\t\t\tword.downcase!\n\t\t\tmatch_count += 1 if (word.include?(match_string))\n\t\tend\n\t\tif match_count > 0\n\t\t\tresults[match_string] = match_count\n\t\tend\n\t\tmatch_count = 0\n\tend\n\treturn results\nend",
"def substrings(phrase, dictionary)\n words = phrase.split(/\\W+/)\n \n counts = Hash.new(0)\n \n words.each do |w|\n dictionary.each do |d|\n if w.downcase.include?(d.downcase)\n counts[d] += 1\n end\n end\n end\n \n return counts\nend",
"def generate_letter_word_collections\n Word.all.each {|word|\n self.two_letter_word_collection << word.two_letter_words\n self.three_letter_word_collection << word.three_letter_words\n self.four_letter_word_collection << word.four_letter_words\n self.five_letter_word_collection << word.five_letter_words\n self.six_letter_word_collection << word.six_letter_words\n self.seven_letter_word_collection << word.seven_letter_words\n self.eight_letter_word_collection << word.eight_letter_words\n self.nine_letter_word_collection << word.nine_letter_words\n }\n self.two_letter_word_collection = self.two_letter_word_collection.flatten.sort.uniq\n self.three_letter_word_collection = self.three_letter_word_collection.flatten.sort.uniq\n self.four_letter_word_collection = self.four_letter_word_collection.flatten.sort.uniq\n self.five_letter_word_collection = self.five_letter_word_collection.flatten.sort.uniq\n self.six_letter_word_collection = self.six_letter_word_collection.flatten.sort.uniq\n self.seven_letter_word_collection = self.seven_letter_word_collection.flatten.sort.uniq\n self.eight_letter_word_collection = self.eight_letter_word_collection.flatten.sort.uniq\n self.nine_letter_word_collection = self.nine_letter_word_collection.flatten.sort.uniq\n self\n end"
]
| [
"0.65597695",
"0.59374464",
"0.5908689",
"0.59035337",
"0.58894753",
"0.5857034",
"0.581963",
"0.5784805",
"0.5776234",
"0.5724411",
"0.56745124",
"0.56719923",
"0.5671813",
"0.56216055",
"0.55539846",
"0.5538507",
"0.55145586",
"0.5502408",
"0.5490264",
"0.54880303",
"0.5434465",
"0.542676",
"0.54267085",
"0.54211104",
"0.5383392",
"0.5365412",
"0.5361111",
"0.5354702",
"0.53482014",
"0.5344059",
"0.53399867",
"0.5339788",
"0.53279006",
"0.5290782",
"0.52854663",
"0.5281721",
"0.52561384",
"0.52473354",
"0.5233866",
"0.5229936",
"0.5214307",
"0.52128935",
"0.51934767",
"0.5187517",
"0.5186173",
"0.5185594",
"0.5184252",
"0.516508",
"0.5164136",
"0.51630855",
"0.51607275",
"0.5159252",
"0.51571727",
"0.514545",
"0.5144957",
"0.51278174",
"0.51243",
"0.5120817",
"0.5118768",
"0.5115416",
"0.51134276",
"0.5098156",
"0.5089439",
"0.5087844",
"0.5087468",
"0.50812274",
"0.5079723",
"0.50796235",
"0.50790864",
"0.5075778",
"0.50748813",
"0.5072304",
"0.50666094",
"0.50598794",
"0.5057912",
"0.5055611",
"0.50553805",
"0.5054658",
"0.5049834",
"0.5042758",
"0.5041408",
"0.5038194",
"0.50347656",
"0.5028151",
"0.502802",
"0.5016099",
"0.5016011",
"0.50137925",
"0.5013145",
"0.50098",
"0.5005253",
"0.49936542",
"0.4987592",
"0.49805135",
"0.4977821",
"0.4977432",
"0.49720988",
"0.49700743",
"0.4969456",
"0.4966741"
]
| 0.62545735 | 1 |
Remembers a user in a persistent session. | def remember(user)
user.remember
cookies.permanent.signed[:user_id] = user.id
cookies.permanent[:remember_token] = user.remember_token
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_user\n return unless exists?(:previous_user)\n set :user, fetch(:previous_user)\n unset :previous_user\n clear_sessions\n end",
"def change_password\n @user = User.find_by_id(session[:remember_token])\n end",
"def log_in_user!(user)\n session[:session_token] = user.reset_session_token!\n end",
"def log_in_user!(user)\n session[:session_token] = user.reset_session_token!\n end",
"def user_remember(user)\n user.remember_user\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def user_remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def sign_in(user)\n remember_token = User.new_remember_token\n cookies.permanent[:remember_token] = remember_token\n user.update_attribute(:remember_token, User.hash(remember_token))\n self.current_user = user\n end",
"def sign_in(user)\n remember_token = User.new_remember_token\n cookies.permanent[:remember_token] = remember_token\n user.update_attribute(:remember_token, User.hash(remember_token))\n self.current_user = user\n end",
"def set_session_current_user(user)\n self.current_user = user\n # Try to reuse existing sessions.\n if session[:authpwn_suid]\n token = Tokens::SessionUid.with_code(session[:authpwn_suid]).first\n if token\n if token.user == user\n token.touch\n return user\n else\n token.destroy\n end\n end\n end\n if user\n session[:authpwn_suid] = Tokens::SessionUid.random_for(user,\n request.remote_ip, request.user_agent || 'N/A').suid\n else\n session.delete :authpwn_suid\n end\n end",
"def set_user\n zeus = User.find(@zeus_user.id)\n zeus.state = User.states['retrieved_password']\n zeus.save!\n \n request.session[:rbac_user_id] = @zeus_user.id\n end",
"def login(user)\n session[:session_token] = user.reset_session_token\n end",
"def set_user\n @user = User.find_by(username: params[:user][:username])\n session[:user_id] = @user.id\n end",
"def remember user\n # generates the remember token and saves it's encrypted form to the db\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def remember(user)\n user.remember\n # abort(@session[:user_id].to_s)\n # cookies.permanent.signed[:user_id] = user.id\n # cookies.permanent[:remember_token] = user.remember_token\n end",
"def set_user_session\n @user = user_session.find(params[:id])\n end",
"def login!(user)\n session[:session_token] = user.reset_session_token!\n end",
"def login_user!(user)\n user.reset_session_token!\n session[:session_token] = user.session_token\n end",
"def set_current_user(user)\n sha1 = Digest::SHA1.hexdigest(user.id.to_s + Time.now.to_i.to_s)\n cookies[:remember_token] = { :value => sha1, :expires => 3.years.from_now }\n user.remember_token = sha1\n user.save\n @current_user = user\n end",
"def login(user)\n session[:session_token] = user.reset_session_token!\n end",
"def switch_user\n session[:user_id] = params[:user_id]\n redirect_to \"/admin/account\"\n end",
"def log_in_user!(a_user)\n session[:session_token] = a_user.reset_session_token!\n end",
"def set_user_session(user)\n session[:logged_in_users_id] = user.id\n end",
"def remember(user)\n user.persist\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def save_session user\n # The password_seed method is used to generate the stored token.\n # The remember_token is then stored as a signed cookie along with the\n # user's ID from the database.\n remember_token = password_seed\n cookies.permanent.signed[:remember_user_id] = user.id\n cookies.permanent.signed[:remember_user_token] = remember_token\n \n # The WHIRLPOOL hash of remember_token and the user's password seed is\n # then stored in the database.\n remember_hash = Digest::Whirlpool.hexdigest(remember_token +\n user.password_seed)\n user.update_attributes(:remember_hash => remember_hash)\n user.save\n end",
"def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def login!(user)\n @current_user = user\n session[:session_token] = user.reset_session_token!\n end",
"def sign_in(user)\n # Issues new random piece of text (aka\n # remember_token) to user\n remember_token = User.new_remember_token\n # Giving user plain text token\n cookies.permanent[:remember_token] = remember_token\n # Hashing the version of the remember_token which the host maintains.\n user.update_attribute(:remember_token, User.hash(remember_token))\n #sets the one who signed in (user) to current user\n self.current_user=user\n end",
"def current_user=(new_user)\n current_session.user = new_user\n end",
"def login!(user)\n @current_user = user;\n session[:session_token] = user.reset_session_token!\n end",
"def remember(user)\n user.save_remember_digest\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def login!(user)\n user.reset_session_token!\n # curr_session_token == user.session_token\n # sets user.curr_session_token and persists to UserSessionsOwnership table\n user.set_curr_session_token\n @current_user = user # set current_user upon login\n # session[:session_token] = user.session_token\n session[:session_token] = user.curr_session_token\n end",
"def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id # encrypt the user_id instead of plaintext\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def remember (user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def remember(user)\n user.remember!\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def load_user(user)\n session[:user_id] = user.id\n session_reset_timeout!\n user.update_attributes last_login_on: Time.now, login_count: user.login_count + 1\n end",
"def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\nend",
"def sign_in(user)\n remember_token = User.new_token\n cookies.permanent[:remember_token] = remember_token\n user.update_attribute(:remember_digest, User.digest(remember_token))\n cookies.permanent.signed[:user_id] = user.id\n self.current_user = user\n end",
"def log_in(user)\n current_user = user\n session[:session_token] = user.reset_session_token!\n end",
"def restore_last_user\n return @last_user if @last_user\n if session[:last_user_id].present?\n @last_user = User.find_by_id(session[:last_user_id])\n message = translate(\"users.sign_in_back\", user: @last_user.name)\n set_flash_message(message, :success, false)\n session.destroy()\n session[:id] = @last_user.id if @last_user.present?\n return @last_user\n end\n end",
"def set_user\n @user = User.find(session[:user_id])\n end",
"def sign_in(user)\n remember_token = User.new_remember_token # create a new remember token\n cookies.permanent[:remember_token] = remember_token # save the remember token on the client side as a cookie\n user.update_attributes remember_token: User.hash(remember_token) # save the remember token on the server side in the DB\n self.current_user = user\n end",
"def user_log_in(user)\n session[:user_id] = user.id\n end",
"def with_user(new_user, &block)\n begin\n set_user(new_user)\n yield exists?(:previous_user) ? fetch(:previous_user) : nil\n ensure\n reset_user\n end\n \n clear_sessions\n end",
"def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.token\n end",
"def switch\n authorize!(:manage, :all)\n user = User.find_by(login: params[:login].upcase)\n if user\n session[:original_user_id] = session[:user_id]\n session[:user_id] = user.id\n redirect_to root_url, notice: \"Sie sind nun der Nutzer mit dem Login #{user.login}.\"\n else\n redirect_to root_url, notice: \"Der Nutzer existiert nicht im System.\"\n end\n end",
"def remember(user)\n user.remember # Calls model\n cookies.permanent.signed[:user_id] = user.id # Save off encryped user ID\n cookies.permanent[:remember_token] = user.remember_token # Save off random thing for validation\n end",
"def set_user_session\n UserSession.current_user = current_user\n end",
"def remember(user)\n user.remember\n # The \"signed\" method encrypts the user_id, since cookies are not themselves encrypted\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def set_user\n @user = User.find(session[:id]) if @user.nil && session[:id]\n end",
"def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def set_user\n require_logged_in\n @user = User.find_by(id: session[:user_id])\n end",
"def remember(user) \n user.remember # the method creates remember_token for that user and saves the hashed the version in the db \n cookies.permanent.signed[:user_id] = user.id # This stores the user.ID(encrypted) in the browser cookie\n cookies.permanent[:remember_token] = user.remember_token # This stores the remember token(encrypted) in the cookie \n # the remember token was created in the first line of code \"user.remember\"\n end",
"def set_user\n @user = User.find(session[:user_id])\n end",
"def set_user\n @user = User.find(session[:user_id])\n end",
"def remember(user)\n user.remember\n cookies.permanent.encrypted[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def destroy\n User.find(current_user.id)\n reset_session\n redirect_to new_user_path\n end",
"def forget_everything\n empty_session!\n PersistentUser.new(@user).delete\n end",
"def set_user\n @user = User.find(session[:user_id])\n end",
"def remember(user)\nuser.remember\ncookies.permanent.signed[:user_id] = user.id\ncookies.permanent[:remember_token] = user.remember_token\nend",
"def auto_login(user, should_remember = false)\n session[:user_id] = user.id.to_s\n @current_user = user\n remember_me! if should_remember\n end",
"def set_user\n UserInfo.current_user = session[:user]\n end",
"def remember\n self.remember_token = Incline::User::new_token\n update_attribute(:remember_digest, Incline::User::digest(self.remember_token))\n end",
"def set_user_session\n @user_session = UserSession.find\n end",
"def lookup_user\n reset_session #use this when they ask you to find a user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end",
"def remember(user)\n user.remember\n cookies.permanent.signed[:user_id]= user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def log_on_user(user, session, cookies)\n cookies.permanent[TOKEN_COOKIE] = { value: user.id, httponly: true }\n @env[CURRENT_USER_KEY] = user\n end",
"def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent.signed[:remember_token] = user.remember_token\n end",
"def remember(user)\n\t\t#calls the remember method in AdminUser model\n\t\tuser.remember\n\t\t#cookies method helps to do permanent sessions. This is actually a syntactic sugar for a bigger thing. \n\t\tcookies.permanent.signed[:user_name] = user.username\n\t\t#save the remembertoken as well. this dosent need to be encrypted\n\t\tcookies.permanent[:remember_token] = user.remember_token\n\tend",
"def remember\n self.remember_token = User.new_token\n self.remember_digest = User.digest(self.remember_token)\n update_attribute(:remember_digest, self.remember_digest) #for new user, this creates record\n end",
"def remember\n self.remember_token = User.new_token\n update remember_digest: User.digest(remember_token)\n end",
"def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end"
]
| [
"0.675591",
"0.6644072",
"0.6311052",
"0.6311052",
"0.62816244",
"0.62358135",
"0.6200064",
"0.6200064",
"0.6180077",
"0.61798525",
"0.6169222",
"0.6156497",
"0.6137487",
"0.61251116",
"0.6117853",
"0.6090493",
"0.60684174",
"0.6063047",
"0.60603493",
"0.605217",
"0.6049069",
"0.6048137",
"0.60210264",
"0.6017216",
"0.6016608",
"0.6014918",
"0.60103375",
"0.60053235",
"0.6001431",
"0.59950596",
"0.59910667",
"0.5990275",
"0.5989106",
"0.5979459",
"0.5968974",
"0.59596485",
"0.5959282",
"0.59570605",
"0.5956767",
"0.5945443",
"0.594528",
"0.59439903",
"0.594214",
"0.5941698",
"0.59361553",
"0.5927905",
"0.59277105",
"0.59229356",
"0.5916376",
"0.59157735",
"0.59098774",
"0.59082294",
"0.5899883",
"0.5899883",
"0.5896879",
"0.588365",
"0.58773607",
"0.5867109",
"0.58667296",
"0.58655554",
"0.58610237",
"0.585902",
"0.5856854",
"0.5842479",
"0.5838615",
"0.58343583",
"0.5832638",
"0.5827982",
"0.5823784",
"0.58181304",
"0.58150756",
"0.58150756"
]
| 0.5917268 | 72 |
Returns true if the given user is the current user. | def current_user?(user)
user == current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_current_user(user)\n if user == current_user\n return true\n else\n return false\n end\n end",
"def is_current_user(user)\n logged_in? && @current_user.id == user.id\n end",
"def current_user?(user)\n\t\tcurrent_user == user\n\tend",
"def current_user?(user)\n\t\tuser == current_user\n\tend",
"def current_user?(user)\n\t\tuser == current_user\n\tend",
"def current_user?(user)\n\t\tuser == current_user\n\tend",
"def current_user?(user)\n\t\tuser == current_user\n\tend",
"def current_user?(user)\n\t\tuser == current_user\n\tend",
"def current_user?(user)\n\t\tuser == current_user\n\tend",
"def current_user?(user)\n\t\tuser == current_user\n\tend",
"def current_user?(user)\n\t\tuser == current_user\n\tend",
"def current_user?(user)\n\t\tuser == current_user\n\tend",
"def current_user?(user)\n\t\tuser == current_user\n\tend",
"def current_user?(user)\n\t\tuser == current_user\n\tend",
"def current_user?(user)\n\t\tuser == self.current_user\n\t\t\n\tend",
"def current_user?(user)\n user == current_user\n end",
"def current_user?(user)\n user == current_user\n end",
"def current_user?(user)\n user == current_user\n end",
"def current_user?(user)\n user == current_user\n end",
"def current_user?(user)\n user == current_user\n end",
"def current_user?(user)\n user == current_user\n end",
"def current_user?(user)\n user == current_user\n end",
"def current_user?(user)\r\n user == current_user\r\n end",
"def current_user?(user)\n \t\tuser == current_user\n \tend",
"def current_user?(user)\n\t\tuser==current_user\n\tend",
"def current_user?(user)\n \t\tuser == current_user\n \tend",
"def current_user?(user)\n user == current_user\n end",
"def current_user?(user)\n user && user == current_user\n end",
"def current_user?(user)\n \tuser == current_user\n \tend",
"def current_user?(user)\n \tuser == current_user\n \tend",
"def current_user?(user)\n current_user == user\n end",
"def current_user?(user)\n current_user == user\n end",
"def current_user?(user)\n current_user == user\n end",
"def current_user?(user)\n current_user == user\n end",
"def current_user?(user)\n current_user == user\n end",
"def current_user?(user)\n current_user == user\n end",
"def current_user?(user)\n current_user == user\n end",
"def current_user?(user)\n current_user == user\n end",
"def current_user?(user)\n\tuser == current_user\n end"
]
| [
"0.9062532",
"0.8867281",
"0.8851428",
"0.881641",
"0.881641",
"0.881641",
"0.881641",
"0.881641",
"0.881641",
"0.881641",
"0.881641",
"0.881641",
"0.881641",
"0.8816007",
"0.87907284",
"0.8765191",
"0.8765191",
"0.8765191",
"0.8765191",
"0.8765191",
"0.8765191",
"0.8765191",
"0.8728337",
"0.8720313",
"0.86855763",
"0.86669374",
"0.8629749",
"0.8604128",
"0.8583261",
"0.8583261",
"0.857721",
"0.857721",
"0.857721",
"0.857721",
"0.857721",
"0.857721",
"0.857721",
"0.857721",
"0.8530303"
]
| 0.0 | -1 |
Returns the current loggedin user (if any). | def current_user
if (user_id = session[:user_id])
@current_user ||= User.find_by(id: user_id)
elsif (user_id = cookies.signed[:user_id])
user = User.find_by(id: user_id)
if user && user.authenticated?(:remember, cookies[:remember_token])
log_in user
@current_user = user
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_user\n if session[:user_id]\n return User.find(session[:id])\n else\n return nil\n end\n end",
"def current_user\n if session[:user_id]\n User.find(session[:user_id])\n else\n nil\n end\n end",
"def current_user\n return unless session[:user_id]\n User.find(session[:user_id])\n end",
"def get_current_user\n if session[:authenticated]\n return User.find_by_id(session[:user_id])\n end\n return nil\n end",
"def getLoggedInUser\n if session[:user_id]\n return User.find(session[:user_id])\n else\n return nil\n end\n end",
"def current_user\n if session[:user_id]\n User.find(session[:user_id])\n else\n end\n end",
"def current_user\n User.get_user(session[:user_id]) if session[:user_id]\n end",
"def current_user\n if session[:user_id]\n return @user ||= User.find(session[:user_id]['$oid'])\n else\n return nil\n end\n end",
"def current_user\n\t\tif session[:user_id].present?\n\t\t\tUser.find(session[:user_id])\n\t\tend\n\tend",
"def current_user\n if session[:user_id]\n user = User.find(session[:user_id])\n else\n nil\n end\n end",
"def current_user\n if valid_session?\n User.find(session[:user_id])\n end\n end",
"def get_current_user\n if @current_user\n return @current_user\n else\n @current_user = User.find_by(id: session[:user_id])\n end\n end",
"def get_logged_in_user\n if logged_in?\n user = User.find(session[:current_user_id])\n if user\n return user\n else\n return nil\n end\n end\n \n #default return nil\n nil\n end",
"def get_current_user\n @current_user ||= User.find(session[:user_id]) unless session[:user_id].blank?\n return @current_user\n end",
"def current_user\n if session[:user_id]\n User.find_by(id: session[:user_id])\n end\n end",
"def current_user\n User.find_by(uid: session[:user]) if logged_in?\n end",
"def current_user(id = session[:user_id])\n User.get_one id\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if logged_in?\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if logged_in?\n end",
"def current_user\n return @current_user if @current_user.present?\n\n if session[:uid]\n @current_user = User.from_session(session)\n end\n\n @current_user\n end",
"def current_user\n if logged_in?\n return User.get(session['user'])\n end\n AnonymousUser.new\n end",
"def get_current_user\n unless session[:user_id]\n @current_user = nil\n return\n end\n @current_user = User.first(:conditions => {:id => session[:user_id] })\n end",
"def get_current_user\n unless session[:user_id].blank?\n @current_user = User.find(session[:user_id])\n else\n @current_user = nil\n end\n end",
"def current_user\n\t\t\tUser.find(session[:user_id])\n\t\tend",
"def current_user\n\t\t\tUser.find(session[:user_id])\n\t\tend",
"def current_user\n @current_user if logged_in?\n end",
"def current_user\n @current_user if logged_in?\n end",
"def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend",
"def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend",
"def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend",
"def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend",
"def current_user\n if !session[:user_id] then nil else User.find(session[:user_id]) end\n end",
"def current_user\n User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n User.find(session[:user_id]) if session[:user_id]\n end",
"def get_current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[\"user_id\"])\n end\n end",
"def current_user\n user_id = get_log_in_session\n if user_id\n get_user(user_id)\n else\n user = get_user(cookies.signed['user_id'])\n if user&.authenticated?(:remember, cookies[:remember_token])\n set_log_in_session user\n user\n end\n end\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n #return current user if @current_user already exists.\n #if there's no current user, return the user with ID == session user ID, if there is one.\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n return @current_user\n end",
"def current_user\n if !@current_user.nil?\n @current_user\n elsif !session[:current_user_id].nil?\n begin\n @current_user = User.find(session[:current_user_id])\n rescue ActiveRecord::RecordNotFound\n @current_user = nil\n end\n end\n end",
"def current_user\n if Rails.application.config.use_omniauth\n return nil unless session[:user_info]\n @current_user ||= User.find_user_from_omniauth(session[:user_info])\n else\n @current_user ||= User.where(username: request.env['aker.check'].user.username).first\n end\n end",
"def current_user\n return unless session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end",
"def current_user\n return unless session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end",
"def current_user\n return unless session[:user_id]\n @current_user ||= User.first(:id => session[:user_id])\n end",
"def current_user\n begin\n unless @current_user.nil?\n return @current_user\n else\n if session[:user_id]\n return @current_user = User.find(session[:user_id])\n else\n return nil\n end\n end\n rescue\n return nil\n end\nend",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n #return current user or set to this if there isnt a current user\n end",
"def current_user\n # User.find would throw an error if we cannot find the user\n User.find_by({ id: session[:user_id] })\n end",
"def current_user\n\n sql = \"SELECT * FROM users WHERE id = $1;\"\n \n results = run_sql(sql, [session[:user_id]]) \n return results.first\n end",
"def current_user\n\tif session[:user_id].present?\n\t\tUser.find(session[:user_id])\t\n\tend\nend",
"def current_user\n return @current_user ||= User.find(session[:user_id]) unless session[:user_id].nil?\n end",
"def current_user\n if @current_user.nil?\n @current_user = User.find_by(id: session[:user_id])\n else\n @current_user\n end\n end",
"def current_user\n get_from_options_or_controller(:current_user)\n end",
"def current_user\n begin \n User.find(session[:user_id])\n rescue ActiveRecord::RecordNotFound\n nil\n end\n end",
"def current_user\n if user_signed_in?\n Session.active_sessions.find_by(id: request.headers['sid'], utoken: request.headers['utoken']).user\n else\n nil\n end\n end",
"def current_user\n if user_signed_in?\n Session.active_sessions.find_by(id: request.headers['sid'], utoken: request.headers['utoken']).user\n else\n nil\n end\n end",
"def current_user\n User.find_by(id: session[:user_id])\n end",
"def current_user\n User.find_by(id: session[:user_id])\n end",
"def current_user\n return nil unless session[:user_id]\n User.get(session[:user_id])\nend",
"def current_user\r\n\tif(session[:user_id])\r\n\t\t@u ||= User.first(id: session[:user_id])\r\n\t\treturn @u\r\n\telse\r\n\t\treturn nil\r\n\tend\r\nend",
"def current_user\n \t# If the session contains the user_id with non-nil, we have ID of some user\n \t# Return the user object for ID\n \t\n \t# Using instance variable helps limit calls\n \t# \"Or equals\" means \n \t\t# if nil, set it -- if not, return it\n \tif session[:user_id]\n \t@current_user ||= User.find(session[:user_id])\n end\n end",
"def current_user\n logged_in? ? User.find_by_id(session[:user_id]) : nil\n end",
"def find_current_user\n if is_logged_in?\n @current_user = User.find(session[:user_id])\n else\n @current_user = nil\n end\n end",
"def current_user\n if logged_in?\n session[:user] = nil\n return temporary_logged_in_user ? temporary_logged_in_user :\n set_temporary_logged_in_user(cached_user)\n else\n session[:user] ||= create_new_user # if there wasn't one\n session[:user] = create_new_user unless session[:user].respond_to?(:stale?)\n session[:user] = create_new_user if session[:user].stale?\n return session[:user]\n end\n end",
"def current_user\n return unless session[:user_id]\n @current_user ||= User.find_by_id(session[:user_id])\n end",
"def current_user\n if session[:user_id].present?\n @current_user = User.find_by(uid: session[:user_id])\n # session.clear if @current_user.nil?\n return @current_user\n end\n end",
"def current_user\n if session[:user_id]\n return User.find(session[:user_id])\n end\nend",
"def current_user\n\t\t\tUser.find_by_id(session[:user_id])\n\t\tend",
"def current_user\n if session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end\n end",
"def return_current_user\n @current_user ||= User.find(session[:id_of_current_user]) if session[:id_of_current_user]\n end",
"def current_user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end",
"def logged_in_user\n if (!logged_in?)\n return User.logged_out_user\n end\n #return nil if !logged_in?\n return session[\"app_user\"]\n end",
"def current_user\n core_id = Origen::Users::User.current_user_id\n user = app_users.find { |user| user.core_id == core_id }\n user || User.new(core_id)\n end",
"def current_user\n @user ||= User.find_by_id(session[:user_id])if logged_in?\n end",
"def current_user\n load_session\n @current_user\n end",
"def find_current_user\n user_id = session[:user_id]\n if user_id\n user = Marty::User.active.find(user_id) rescue nil\n else\n user = try_to_autologin\n end\n\n user\n end",
"def current_user\n return nil unless session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n # return current user or set it to what is found in cookie, only if there is one to begin with\n end",
"def current_user\n \t@current_user || User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n @current_user ||= begin\n if session[:user_id]\n user = User.where(id: session[:user_id])\n user[0] if user.any?\n end\n end\n # @current_user ||= User.find session[:user_id] if session[:user_id]\n end",
"def current_user\n\n \tif session[:user_id].present?\n \t\tUser.find(session[:user_id])\n\n \tend\n\n end",
"def current_user\n\tsession[:user_id] ? User.find(session[:user_id]) : nil\nend",
"def current_user\n\tsession[:user_id] ? User.find(session[:user_id]) : nil\nend",
"def current_user\n # retrieve from database on every request instead of\n # storing it as global variable when current_user=\n # is called to prevent user information becoming stale.\n @current_user ||= (session[:user_name] && User.find_by(user_name: session[:user_name])) || real_user\n end",
"def current_user\n\t\tif !@current_user\n\t\t\t@current_user = User.find_by(id: session[:user_id])\n\t\tend\n\t\t@current_user\n\tend",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n return unless session[:user_id]\n @current_user = User.find_by_id(session[:user_id])\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if user_signed_in?\n end",
"def current_user\n\t\tUser.find_by(:id => session[:user_id])\n\tend",
"def current_user\n User.find session[:user_id] if user_signed_in?\n end",
"def authenticated_user\n if session[:user_id].nil?\n return nil\n else\n return User.find(session[:user_id])\n end\n end",
"def current_user\n return @current_user if defined?(@current_user)\n @current_user = User.find_by_id(session[:user_id])\n end",
"def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n @current_user = User.find(session[:user_id])\n end\n end",
"def current_user\n @user ||= User.find_by(id: session[:user_id]) if session[:user_id]\n end",
"def current_user\n \n # Normally we would look in the session to see if there is a user_id \n # to figure out if the user is loggged in.\n # For demo purposes this app randomly picks if the user is logged in\n if rand(100) > 20 \n User.last\n else\n nil\n end\n end"
]
| [
"0.85960984",
"0.8593657",
"0.855797",
"0.8545853",
"0.8534344",
"0.8497545",
"0.847914",
"0.8460573",
"0.8457271",
"0.84556973",
"0.84472865",
"0.8442264",
"0.8441092",
"0.84366953",
"0.8400402",
"0.83765614",
"0.8368829",
"0.8337418",
"0.8337418",
"0.8314651",
"0.8311652",
"0.83023316",
"0.8291481",
"0.82835174",
"0.82835174",
"0.82822436",
"0.82822436",
"0.82777715",
"0.82777715",
"0.82777715",
"0.82777715",
"0.8276581",
"0.8275023",
"0.8275023",
"0.8255083",
"0.8249995",
"0.82446975",
"0.8239647",
"0.8232271",
"0.82151717",
"0.82147837",
"0.82147837",
"0.82103586",
"0.8191853",
"0.8187335",
"0.81870914",
"0.818249",
"0.8178561",
"0.8178069",
"0.8167405",
"0.8166237",
"0.8165827",
"0.8164524",
"0.8164524",
"0.816404",
"0.816404",
"0.81622803",
"0.8161969",
"0.8160386",
"0.8157338",
"0.8153178",
"0.81529313",
"0.81492436",
"0.8147794",
"0.814727",
"0.81466174",
"0.8136481",
"0.8136481",
"0.8132164",
"0.81201875",
"0.81201875",
"0.81199944",
"0.8119824",
"0.8116362",
"0.8112842",
"0.81102794",
"0.81090635",
"0.81087977",
"0.81074595",
"0.80979383",
"0.8093762",
"0.80920845",
"0.80920845",
"0.8090045",
"0.8087256",
"0.80838054",
"0.80838054",
"0.8081629",
"0.80800456",
"0.80800176",
"0.80791426",
"0.8078592",
"0.8078462",
"0.8078152",
"0.8078152",
"0.8078152",
"0.8078152",
"0.8078152",
"0.8073231",
"0.807296",
"0.8071747"
]
| 0.0 | -1 |
Returns true if the user is logged in, false otherwise. | def logged_in?
!current_user.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_is_logged_in()\n user = get_user()\n if user != nil\n true\n else\n false\n end\n end",
"def logged_in?\n user._logged_in?\n end",
"def logged_in?\n if session[:username]\n if session[:logged_in?]\n return true\n end\n else\n return false\n end\n end",
"def logged_in?\n if !session[:user_id].nil?\n return true\n else\n return false\n end\n end",
"def user_is_logged_in?\n !!session[:user_id]\n end",
"def logged_in?\n return false unless session[:user_id]\n\n User.find_by_id(session[:user_id]).present?\n end",
"def logged_in?\n !!logged_user\n end",
"def logged_in?\n (current_user ? login_access : false).is_a?(User)\n end",
"def logged_in?\n if current_user\n true\n else\n false\n end\n end",
"def logged_in?\n current_user != :false\n end",
"def logged_in?\n current_user != :false\n end",
"def logged_in?\n current_user.present?\n end",
"def logged_in?\n return true if self.current_user\n return false\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\r\n current_user != :false\r\n end",
"def loggedin?\n @session.nil? ? false : (return true)\n end",
"def is_logged_in?\n\t\t!session[:user_id].nil?\n\tend",
"def logged_in?\n\t\t\tcurrent_user.is_a? User\n\t\tend",
"def logged_in?()\n if session[:user_id]\n return true\n else \n return false\n end\n end",
"def logged_in?\n current_user != :false \n end",
"def is_logged_in_user?\n session[:user_authenticated]\n end",
"def logged_in?\n @logged_in == true\n end",
"def logged_in?\n @logged_in == true\n end",
"def logged_in?\n if current_user\n true\n else \n false\n end\n end",
"def is_logged_in?\n !session[:user_id].nil?\n end",
"def user_is_logged_in?\n !!session[:user_id]\n end",
"def logged_in?\n\t\tif not current_user.present? then redirect_to \"/unauthorized\" and return false\n\t\tend\n\t\treturn true\n\tend",
"def logged_in?\n return false unless @auth_header\n true\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n\t\t !!current_user\n end",
"def logged_in?\r\n\t\t!current_user.nil?\r\n\tend",
"def logged_in?\n\n if session[:current_user_id]\n return true\n end\n \n #Default return false\n false\n \n end",
"def logged_in?\n\t\tcurrent_user.present?\n\tend",
"def logged_in?\n !session[:user_id].nil?\n end",
"def logged_in?\n !session[:user_id].nil?\n end",
"def logged_in?\n !session[:user_id].nil?\n end",
"def logged_in?\n !session[:user_id].nil?\n end",
"def logged_in?\n !!logged_in_user \n end",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n current_user ? true : false;\n end",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n @logged_in\n end",
"def logged_in?\n current_user.present? # True neu user login\n end",
"def logged_in?\n #boolean return\t\n \tcurrent_user != nil\n end",
"def is_user_logged_in?\n\tlogged_in = false\n\t if logged_in\n then true\n else\n redirect_to root_path\n end\n end",
"def logged_in?\n @logged_in ? true : false\n end",
"def logged_in?\n current_user != nil ? true : false\n end",
"def logged_in?\n return session['current_user']\n end",
"def logged_in?\n !current_user.nil?\n end",
"def logged_in?\n !current_user.nil?\n end",
"def logged_in?\n\t\t!current_user.nil?\n \tend",
"def is_logged_in?\n return true if current_user || current_admin\n end",
"def logged_in?\n \t\t!current_user.nil?\n \tend",
"def logged_in?\n\t\t#if currentuser.nil returns true then logedin is false\n\t\t!current_user.nil?\n\tend",
"def logged_in?\n !current_user.blank?\n end",
"def logged_in?\n !!session[:logged_in]\n end",
"def logged_in?\n # !! turns this into a boolean, so we DON'T get nil\n !!session[:user_id]\n end",
"def logged_in?\n !!session[:user_id]\n # !!@current_user\n end",
"def logged_in?\n ## to query if the logged in, call the current_user with !! preceeded, this turns it to true or false\n # TRUE or FALSE\n !!current_user\n end",
"def _is_login\n p session[:user]\n session[:user] ? true : false\n end",
"def logged_in?\n if session[:username].blank? or\n session[:authenticated].blank? or\n !session[:authenticated]\n return false\n end\n\n return true\n end",
"def user_logged_in?\n current_user.present?\n end",
"def user_logged_in?\n current_user.present?\n end",
"def is_logged_in?\n session[:user_id].present?\n end",
"def logged_in?\n current_user_id.to_i > 0\n end",
"def logged_in?\n current_user.is_a? User\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end"
]
| [
"0.90813833",
"0.8762974",
"0.87540007",
"0.871761",
"0.8688184",
"0.8648873",
"0.86459655",
"0.86361825",
"0.8630182",
"0.8627261",
"0.8627261",
"0.85820407",
"0.85658157",
"0.85602945",
"0.85602945",
"0.8550414",
"0.85482794",
"0.8543129",
"0.85398126",
"0.85386676",
"0.85165113",
"0.85101676",
"0.85074073",
"0.85074073",
"0.8506478",
"0.8504072",
"0.8497672",
"0.84902334",
"0.84831274",
"0.8481774",
"0.8481774",
"0.8481774",
"0.8481774",
"0.8481774",
"0.8481774",
"0.8481774",
"0.8481774",
"0.8481774",
"0.847046",
"0.84681886",
"0.8464805",
"0.84644175",
"0.84556246",
"0.84556246",
"0.84556246",
"0.84556246",
"0.84551924",
"0.8453456",
"0.8452944",
"0.8452457",
"0.8452167",
"0.8452167",
"0.8452167",
"0.8452167",
"0.8452167",
"0.8452167",
"0.8452167",
"0.8452167",
"0.8452167",
"0.8452167",
"0.8452167",
"0.8452167",
"0.8452167",
"0.8452167",
"0.8452167",
"0.8452167",
"0.8452167",
"0.8452167",
"0.8452167",
"0.84418356",
"0.84418356",
"0.84418356",
"0.84418356",
"0.8427846",
"0.8424654",
"0.8421421",
"0.8420047",
"0.841093",
"0.8408572",
"0.8403831",
"0.8403831",
"0.84022784",
"0.84015906",
"0.84008014",
"0.83956325",
"0.8393625",
"0.8385754",
"0.83832383",
"0.8382011",
"0.8381135",
"0.83770806",
"0.8374717",
"0.83734626",
"0.83734626",
"0.8368801",
"0.8368465",
"0.8364459",
"0.8360054",
"0.8360054",
"0.8360054",
"0.8360054"
]
| 0.0 | -1 |
Forgets a persistent session. | def forget(user)
user.forget
cookies.delete(:user_id)
cookies.delete(:remember_token)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_session!\n raw_session.clear\n end",
"def abandon!\n @user = nil\n session.delete\n end",
"def abandon!\n @user = nil\n session.delete\n end",
"def abandon!\n @user = nil\n session.clear\n end",
"def invalidate_session\n @sequence = 0\n @session_id = nil\n end",
"def turn_off\n self.class._end_session\n end",
"def kill_session\n session[:session] = false\n session[:sessionToken] = \"\"\n session[:sessionMember] = \"\"\n session[:sessionMV] = \"\"\n session[:sessionOffer] = \"\"\n end",
"def clear_session\n session.clear\n end",
"def clear_session\n\t\tsession.clear\n\tend",
"def reset_session!\n request.reset_session\n end",
"def reset_session!\n request.reset_session\n end",
"def reset!\n @session_key = nil\n end",
"def clear_session\n session[:timeout] = nil\n session[:uid] = nil\n end",
"def clear_session\n session[:timeout] = nil\n session[:uid] = nil\n end",
"def forget_everything\n empty_session!\n PersistentUser.new(@user).delete\n end",
"def clear_session\n Mack::SessionStore.expire_all\n end",
"def clear_session_keys\n ActiveRecord::Base.clear_session_keys\n end",
"def reset\n session.unset(@name)\n end",
"def kill_session\n @authenticator.kill_session\n @session = ''\n end",
"def clear_session\n session[:int_key] = nil\n session[:email] = nil\n session[:password] = nil\n session[:account_id] = nil\n redirect_to root_url\n end",
"def destroy_session\n request.session_options[:skip] = true\n end",
"def delete_session\n session[:userid] = nil\n session[:attributes] = nil\n end",
"def clear_session\n rails_controller_instance.reset_session\n end",
"def destroy_session\n request.session_options[:skip] = true\n end",
"def disable_sessions\n self.auto_capture_sessions = false\n @enable_sessions = false\n end",
"def logout_killing_session!\n logout_keeping_session!\n reset_session\n end",
"def sessions_reset\n self.sessions_flush\n @sessions = {}\n end",
"def abandon\n response = self.class.post('/', :body => self.class.build_XML_request('Session.Abandon', self))\n self.class.response_valid? response\n end",
"def logout_killing_session!\n logout_keeping_session!\n reset_session\n end",
"def clear_session\n @session = @login_info = nil\n end",
"def clear_session\n\t\tsession[:email] = nil \n\t\tsession[:player_id] = nil\n\t\tsession[:admin] = nil\n\t\tsession[:login_time] = nil \n\tend",
"def invalidate!\n self.active = false\n self.save!\n if controller\n cookies.delete(:user_session)\n end\n end",
"def reset_current_session\n\n pop_session_frame\n push_session_frame\n\n end",
"def discard_saved_state\n execute(\"discardstate\", @uuid)\n end",
"def clear_session\n session[:player_id] = nil\n cookies[:player_id] = nil\n cookies[:password_hash] = nil\n end",
"def forget\n self.remember_token = nil\n self.update_attribute(:remember_digest, nil)\n end",
"def reset_session\n Rails.logger.info('SSO: ApplicationController#reset_session', sso_logging_info)\n\n cookies.delete(Settings.sso.cookie_name, domain: Settings.sso.cookie_domain)\n @session_object&.destroy\n @current_user&.destroy\n @session_object = nil\n @current_user = nil\n super\n end",
"def remove!\n @session.delete(SESSION_KEY) if empty?\n end",
"def destroy\n @session.clear\n end",
"def clear_session\n session[:timeout] = nil\n session[:user_name] = nil\n session[:real_user_name] = nil\n session[:job_id] = nil\n session[:auth_type] = nil\n cookies.delete :auth_token\n reset_session\n end",
"def skip_set_cookies_header\n reset_session\n end",
"def forget\n update_attribute(:remember_digest, nil)\n # We don't need the below line because if we update remember_digest to nil, then\n # you cannot use the old remember_token anyway, so it is unnecessary\n # self.remember_token = nil\n end",
"def reset!\n @sess_hash = {}\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def logout_killing_session!(class_name)\n logout_keeping_session!(class_name)\n reset_session\n end",
"def reset\n reset_session\n redirect_to root_path\n end",
"def forget\n self.remember_token = nil\n update_attribute(:remember_digest, nil)\n end",
"def forget\n self.remember_token = nil\n update_attribute(:remember_digest, nil)\n end",
"def reset_session\r\nif session && session.respond_to?(:destroy)\r\nsession.destroy\r\nelse\r\nself.session = {}\r\nend\r\n@env['action_dispatch.request.flash_hash'] = nil\r\nend",
"def session_dont_remember\n httpsession = Thread.current[:hayabusa][:httpsession]\n raise \"Could not figure out HTTP-session.\" if !httpsession\n session = httpsession.session\n raise \"Could not get session-variable from HTTP-session.\" if !session\n session[:remember] = 0\n \n self.cookie(\n \"name\" => \"HayabusaSession\",\n \"value\" => _httpsession.session_id,\n \"path\" => \"/\"\n )\n end",
"def forget_me\r\n self.remember_token_expires_at = nil\r\n self.remember_token = nil\r\n save(:validate => false)\r\n end",
"def forget_me\n self.remember_token_expires_at = nil\n self.remember_token = nil\n save(false)\n end",
"def forget_me\n self.remember_token_expires_at = nil\n self.remember_token = nil\n save(false)\n end",
"def destroy\n\t\treset_session\n\t\tredirect_to new_session_path\n\tend",
"def forget_me\n self.remember_token_expires_at = nil\n self.remember_token = nil\n save(:validate => false)\n end",
"def renew_session\n @authenticator.kill_session\n @authenticator.get_session\n end",
"def clear_session\n session[:user_id] = nil\n cookies[:user_id] = nil\n cookies[:password_hash] = nil\n end",
"def discard_saved_state\n end",
"def forget\n self.remember_token = nil\n update_attribute(:remember_token_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def skip_session\n request.session_options[:skip] = true\n end",
"def skip_session\n request.session_options[:skip] = true\n end",
"def kill_session(id=\"new\")\n session[\"cart_new\"] = nil\n session[\"cart_#{id}\".to_sym] = nil\n end",
"def invalidateUserSession(user)\n userSession = Session.find_by_user_id(user.id)\n if !userSession.nil? then\n userSession.delete\n end\n end",
"def forget\n\t\tupdate_attribute(:remember_digest, nil)\n\tend",
"def forget\n\t\tupdate_attribute(:remember_digest, nil)\n\tend",
"def forget\n\t\tupdate_attribute(:remember_digest, nil)\n\tend",
"def forget_me\n self.remember_token_expires_at = nil\n self.remember_token = nil\n save(:validate => false) \n end",
"def revoke_session(user)\n\t\[email protected] user\n\tend",
"def session_noop(input={}, raw=false)\n response = get('mw/Session.Noop', input, raw)\n end",
"def session_end!(destroy=true)\n if destroy\n session.clear\n else\n session['sinatra.session'] = false\n end\n end",
"def forget\n update_attribute(:remember_token, nil)\n end",
"def do_not_set_cookie\n request.session_options[:skip] = true\n end",
"def do_not_set_cookie\n request.session_options[:skip] = true\n end",
"def do_not_set_cookie\n request.session_options[:skip] = true\n end",
"def forget(player)\n return if player.nil?\n player.forget\n cookies.delete(:player_id)\n cookies.delete(:remember_token)\n end",
"def clear_sessions \n sessions.each do |key, session|\n logger.info \"Closing: #{key}\"\n session.close\n end \n sessions.clear \n reset_password\n end",
"def forget_form_data(type)\n session.delete(type)\n end",
"def no_session # :nologin: :norobots:\n end",
"def forget\n \tupdate_attribute(:remember_digest, nil)\n end",
"def forget\n \tupdate_attribute(:remember_digest, nil)\n end",
"def clear_ebay_session(req)\n Lynr.cache.del(\"#{req.session['dealer_id']}_ebay_session\")\n end",
"def forget\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\nend",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end"
]
| [
"0.7149095",
"0.7059213",
"0.7059213",
"0.70340604",
"0.69786507",
"0.68063825",
"0.6668415",
"0.6590212",
"0.65894204",
"0.65851307",
"0.65851307",
"0.6546038",
"0.6429771",
"0.6429771",
"0.6391262",
"0.63660854",
"0.63422614",
"0.6315281",
"0.63146967",
"0.62607706",
"0.62582135",
"0.625448",
"0.6244664",
"0.62210834",
"0.62135315",
"0.6204033",
"0.6203912",
"0.61731076",
"0.616716",
"0.61386466",
"0.6127195",
"0.61266893",
"0.6124367",
"0.611479",
"0.6084139",
"0.6080993",
"0.6073571",
"0.6054348",
"0.60416186",
"0.60411334",
"0.60337406",
"0.60223436",
"0.6021022",
"0.600566",
"0.60055006",
"0.5992432",
"0.5988533",
"0.5988533",
"0.59832674",
"0.5967238",
"0.59468657",
"0.5939907",
"0.5939907",
"0.5939015",
"0.5936521",
"0.5934587",
"0.592334",
"0.59207064",
"0.5912597",
"0.5911248",
"0.5911248",
"0.587101",
"0.587101",
"0.5864805",
"0.58643234",
"0.58635604",
"0.58635604",
"0.58635604",
"0.58592856",
"0.5857979",
"0.58547854",
"0.5846602",
"0.58448434",
"0.58412915",
"0.58412915",
"0.58412915",
"0.5840833",
"0.5837698",
"0.58351755",
"0.5834466",
"0.58331794",
"0.58331794",
"0.5832386",
"0.5824714",
"0.580332",
"0.580332",
"0.580332",
"0.580332",
"0.580332",
"0.580332",
"0.580332",
"0.580332",
"0.580332",
"0.580332",
"0.580332",
"0.580332",
"0.580332",
"0.580332",
"0.580332",
"0.580332",
"0.580332"
]
| 0.0 | -1 |
Logs out the current user. | def log_out
forget(current_user)
session.delete(:user_id)
@current_user = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_out\n reset_session\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n\t\t# current_user.delete_auth_token # won't work with curl, but html is good\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n if !current_user.nil?\n forget(current_user)\n\n session.delete(:user_id)\n session.delete(:user_type)\n @current_user = nil\n end\n end",
"def log_out\n forget(current_user)\n reset_session\n @current_user = nil\n end",
"def log_out\n session.delete(:user_credentials)\n @current_user = nil\n end",
"def log_out\n\t\tforget(current_user) #call user.forget\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n\t\tforget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n\t\tforget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n\t\tforget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n\t\tforget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n\t\tforget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user= nil\n\tend",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n flash[:danger] = 'Logoff realizado!'\n end",
"def log_out\r\n forget(current_user)\r\n session.delete(:user_id)\r\n @current_user = nil\r\n end",
"def log_out\n forget current_user\n reset_session\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n forget current_user\n session.delete :user_id\n @current_user = nil\n end",
"def log_out\n\t \tsession.delete(:user_id)\n\t \t@current_user =nil\n\t end",
"def log_out\n session.delete(:user_id)\n @current_user = nil \n end",
"def log_out\n forget(current_user)\n session.delete(:username)\n @current_user = nil\n end",
"def user_log_out\n forget_user(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n session.delete(:user_type_string)\n @current_user = nil\n end",
"def log_out \n session.clear\n @current_user = nil\n end",
"def user_log_out\n user_forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n\t\tforget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\t\t# Setting @current_user to nil would only matter if @current_user were created before the destroy action (which it isn’t) and if we didn’t issue an immediate redirect (which we do). This is an unlikely combination of events, and with the application as presently constructed it isn’t necessary, but because it’s security-related I include it for completeness\n\tend",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n\n end",
"def log_out\n session.delete(:user_id)\n session.delete(:type)\n @current_user = nil\n end",
"def log_out\n \tsession.delete(:user_id)\n \t@current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n forget(@current_user)\n @current_user=nil\n end",
"def log_out\n\t\tsession.delete(:id)\n\t\t@current_user = nil\n\t\tadmin_session(false)\n\tend",
"def log_out\n session.delete(:uid)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id) #remove the user id from the browser cache\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n # Logging out involves undoing the effects of the log_in method.\n session.delete(:user_id) # Delete the user id stored in the session.\n @current_user = nil # Clear the cached current user.\n end",
"def log_out\n\t\tsuper\n\t\t@current_user = nil\n\tend",
"def logout!\n return unless current_user\n reset_session\n @current_user = nil\n end",
"def log_out\n session.delete(:email)\n @current_user = nil\n end",
"def log_out\n session.clear\n cookies.clear\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:session_database)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n session.delete(:user_name)\n session.delete(:user_email)\n @current_user = nil\n end"
]
| [
"0.85847217",
"0.8553567",
"0.8553567",
"0.8553567",
"0.8553567",
"0.8553567",
"0.85448325",
"0.85448325",
"0.85448325",
"0.85448325",
"0.85447145",
"0.8513818",
"0.85132295",
"0.85004026",
"0.8490199",
"0.84505224",
"0.84501094",
"0.84357476",
"0.843385",
"0.843385",
"0.843385",
"0.843385",
"0.843385",
"0.8419483",
"0.8410347",
"0.8409856",
"0.8409856",
"0.8409856",
"0.8409856",
"0.8409856",
"0.8409856",
"0.8409856",
"0.8409856",
"0.8409856",
"0.8409856",
"0.8409856",
"0.8409856",
"0.8409856",
"0.8409856",
"0.8409856",
"0.8409856",
"0.8409856",
"0.8409856",
"0.8409856",
"0.8409856",
"0.8409856",
"0.8409856",
"0.8409856",
"0.8382575",
"0.83781433",
"0.83688635",
"0.8367587",
"0.8364423",
"0.8363327",
"0.83507067",
"0.8347402",
"0.83467627",
"0.83426905",
"0.83180314",
"0.83137727",
"0.8307604",
"0.83034235",
"0.8289469",
"0.8277401",
"0.8273388",
"0.8247669",
"0.8237447",
"0.8215971",
"0.818946",
"0.81523305",
"0.8149904",
"0.8149112",
"0.8136902",
"0.81179744",
"0.8115369"
]
| 0.8369916 | 70 |
Redirects to stored location (or to the default). | def redirect_back_or(default)
redirect_to(session[:forwarding_url] || default)
session.delete(:forwarding_url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redirect_to_stored(default='/')\n return_to = session[:return_to] || default\n session[:return_to] = nil\n redirect return_to\n end",
"def redirect_to_stored_location_or(default)\n redirect_to(session[:forward_url] || default)\n session.delete(:forward_url)\n end",
"def redirect_back_or_default(default)\n redirect_to(pop_stored_location || default)\n end",
"def redirect_back_or_default(default)\n redirect_to(pop_stored_location || default)\n end",
"def redirect(options = {})\r\n end",
"def redirect_to_stored_or_default(default)\n if session['return-to'].nil?\n redirect_to default\n else\n redirect_to_url session['return-to']\n session['return-to'] = nil\n end\nend",
"def redirect_back_or_default(default)\n redirect_to(location_stored? ? session[:return_to] : default)\n session[:return_to] = nil\n end",
"def redirect(location, status = '302'); request.redirect(location, status); end",
"def store_location\n session[:redirect] = request.url\n end",
"def restore_location_or(default)\n redirect_to(session[:return_to] || default)\n session.delete(:return_to)\n end",
"def redirect?; end",
"def store_location!\n session[\"return_to\"] = request.env[\"warden.options\"][:attempted_path] if request.get?\n end",
"def store_location\n session[:redirect_path] = request.path\n end",
"def redirect_to_target(default=nil)\n \n goto_url=params[:return_to] || session[:return_to] || default || \"/\"\n \n session[:return_to] = nil\n redirect_to(goto_url)\n end",
"def redirect\n redirect_to @goto_url\n end",
"def store_and_redirect_location\n #session[:return_to] = \"/\"\n redirect_to \"/welcome/new\",:status => 401\n end",
"def redirect_back_or_default(default)\n redirect_to url_for_redirect(default)\n end",
"def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url) # Delete the stored URL for next log in\n end",
"def redirect(path)\n throw :redirect, path\n end",
"def store_location(url = url_for(:controller => controller_name, :action => action_name))\n # It's possible to create a redirection attack with a redirect to data: protocol... and possibly others, so:\n # Whitelisting redirection to our own site and relative paths.\n url = nil unless url =~ /\\A([%2F\\/]|#{root_url})/\n session[:return_to] = url\n end",
"def redirect(url); end",
"def store_redirect\n if params.key?(:redirect)\n store_redirect_url_for(params[:redirect], request.referer)\n end\n end",
"def redirect_back_or_default(default)\n loc = session[:return_to] || default\n session[:return_to] = nil\n redirect loc\n end",
"def redirect_path(name, default = nil)\n stored_redirect_path(name) || default || root_path\n end",
"def store_location\n\t\t\tsession[:return_to] = request.fullpath\n\t\tend",
"def store_location!\n session[:\"#{scope}_return_to\"] = attempted_path if request.get? && !http_auth?\n end",
"def redirect_to_path(path)\n redirect_to path\n end",
"def redirect_back_or_to(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n end",
"def redirect_back_or_default(default)\n redirect_to(default)\n end",
"def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n # The following deletion happens even though the redirect stastement is written first.\n # This is because the redirect doesn't actually happen until an explicit\n # return statement or until the end of a method.\n session.delete(:forwarding_url)\n end",
"def redirect_back_or(default)\n\n\t\t# redirects user to page stored in session symbol or the\n\t\t# dafault location if return_ to is not set.\n\t\tredirect_to(session[:return_to] || default)\n\n\t\t# Deletes the session symbol return_to\n\t\tsession.delete(:return_to)\n\tend",
"def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n # Delete after the redirect so that the user will not be forwarded to the\n # same URL upon each login attempt.\n # Redirects always wait for the rest of the code block to return before\n # actually redirecting.\n end",
"def redirect_to(args={})\n # use an url if specified\n @redirect = args[:url] if args[:url]\n # or build up an action if specified\n @redirect = File.join(\"/#{@workingpath[1..-1].join('/')}\",args[:action].to_s) if args[:action]\n logmsg \"base_controller::redirect_to() setting redirect to #{@redirect}\" if @@debug\n end",
"def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url) #delete what is stored.\n end",
"def store_location\n\t\tsession[:return_to] = request.url\n\tend",
"def store_location\n\t\tsession[:return_to] = request.fullpath\n\tend",
"def store_location\n\t\tsession[:return_to] = request.fullpath\n\tend",
"def store_location\n\n\t\t# Stores the requested page in a session symbol return_to\n\t\tsession[:return_to] = request.url\n\tend",
"def redirect_back_or(default)\n #send back to what was stored in\n #\"session[:return_to] or default location\n redirect_to(session[:return_to] || default)\n #deletes saved return location\n session.delete(:return_to)\n end",
"def redirect_back_or( default )\n\t\tredirect_to( session[:forwarding_url] || default )\n\t\tsession.delete( :forwarding_url )\n\tend",
"def set_redirect_location\n @redirect_location = @shareable\n end",
"def redirects; end",
"def store_location\n session[:redirect_after_login] = request.request_uri\n end",
"def redirect_back_or_default(default)\n redirect_to(session[:return_to] || default)\n session[:return_to] = nil\n end",
"def redirect_back_or_default(default)\n redirect_to(session[:return_to] || default)\n session[:return_to] = nil\n end",
"def redirect_back_or_default(default)\n redirect_to(session[:return_to] || default)\n session[:return_to] = nil\n end",
"def redirect_back_or_default(default)\n redirect_to(session[:return_to] || default)\n session[:return_to] = nil\n end",
"def redirect_back_or_default(default)\n redirect_to(session[:return_to] || default)\n session[:return_to] = nil\n end",
"def redirect_to(path)\n render(:status => 302, \"Location\" => path) { p { text(\"You are redirected to \"); a(path, :href => path) } }\n end",
"def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n end",
"def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n end",
"def redirect_back_or_default(default)\n redirect_to(session[:return_to] || default)\n session[:return_to] = nil\n end",
"def store_location\n\t\tsession[ :forwarding_url ] = request.original_url if request.get?\n\tend",
"def redirect_back(default)\n redirect_to(session[:forward_url] || default)\n session.delete(:forward_url)\n end",
"def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default )\n session.delete(:forwarding_url)\n end",
"def redirect_back(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete :forwarding_url\n end",
"def redirect_back_or(default)\n redirect_to session[:forwarding_url] || default\n session.delete(:forwarding_url)\n end",
"def store_location\n store_location_for(:user, params[:redirect_to]) if params[:redirect_to].present?\n\n # note: don't store the previous url on each call. this led to an issue where\n # missing asset might get run through this code, causing the user to be redirected\n # to the missing asset during a login\n # session[:previous_url] = request.url if request.url != new_user_session_url\n end",
"def hubssolib_redirect_back_or_default(default)\n url = hubssolib_get_return_to\n hubssolib_set_return_to(nil)\n\n redirect_to(url || default)\n end",
"def redirect_to options = {}\n @has_redirect = options\n end",
"def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n end",
"def redirect_back_or_default(default=nil)\n default = self.default_route\n redirect_to(session[:return_to] || default)\n session[:return_to] = nil\n end",
"def redirect_back_or(default)\n # Redirects don’t happen until an explicit return or the end of the method, \n # so any code appearing after the redirect is still executed.\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n end",
"def redirect_back_or(default)\n redirect_url = session[:forwarding_url] || default\n session.delete :forwarding_url\n redirect_to redirect_url\n end",
"def store_location\n\t\tsession[:forwarding_url] = request.original_url if request.get?\n\tend",
"def store_location\n\t\tsession[:forwarding_url] = request.original_url if request.get?\n\tend",
"def store_location\n\t\tsession[:forwarding_url] = request.original_url if request.get?\n\tend",
"def store_location\n\t\tsession[:forwarding_url] = request.original_url if request.get?\n\tend",
"def redirect_to_forwarding_url_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n end",
"def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n end",
"def store_location\n session[:return_to] = request.original_url\n end",
"def redirect_back_or_default(default)\n redirect(session[:return_to] || default)\n session[:return_to] = nil\n end",
"def store_location\n\t\t\tsession[:return_to] = request.fullpath\n\t end",
"def redirect_back_or(default)\n\t\tredirect_to(session[:return_to] || default)\n\t\tclear_return_to\n\tend",
"def redirect_back_or(default)\n\t\tredirect_to(session[:return_to] || default)\n\t\tclear_return_to\n\tend",
"def redirect_back_or_default(default)\n loc = session[:return_to] || default\n session[:return_to] = nil\n redirect_to loc\n end",
"def redirect_back_or_default(default, options = {})\n target = url_to_store(session[:return_to])\n (target = logged_in? ? home_url(current_user) : nil) if target == '{home}'\n #target = nil if target == APP_CONFIG.hostname || target == APP_CONFIG.hostname + '/'\n target = default unless target\n target = safe_redirect(target)\n session[:return_to] = nil\n return target if options[:find_target_only]\n redirect_to(target)\n end",
"def redirect_back_or_default(default)\n\t\tredirect_to(session[:return_to] || default)\n\t\tsession[:return_to] = nil\n\tend",
"def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url] || default )\n\t\tsession.delete(:forwarding_url)\n\tend",
"def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url]||default)\n\t\tsession.delete(:forwarding_url)\n\tend",
"def store_location\n \t\tsession[:forwarding_url] = request.original_url if request.get?\n \tend",
"def redirect_back_or_default(default)\n if session[:return_to].nil?\n redirect_to default\n else\n redirect_to session[:return_to]\n session[:return_to] = nil\n end\n end",
"def redirect_back_or_default(default)\n if session[:return_to].nil?\n redirect_to default\n else\n redirect_to session[:return_to]\n session[:return_to] = nil\n end\n end",
"def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarind_url)\n end",
"def set_redirect\n @redirect = params[:origin_url] == nil ? bookmarks_path : params[:origin_url]\n end",
"def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default )\n session.delete(:forwarding_url)\n end",
"def redirect_back_or_default(default)\n session[:return_to] ? redirect_to(session[:return_to]) : redirect_to(default)\n session[:return_to] = nil\n end",
"def redirect_back_or_default(default)\n session[:return_to] ? redirect_to(session[:return_to]) : redirect_to(default)\n session[:return_to] = nil\n end",
"def redirect_back_or_default(default)\n session[:return_to] ? redirect_to(session[:return_to]) : redirect_to(default)\n session[:return_to] = nil\n end",
"def redirect_back_or( default )\n redirect_to( session[ :return_to ] || default )\n session.delete( :return_to )\n end",
"def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || root_path)\n session.delete(:forwarding_url)\n end",
"def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url] || default)\n\t\tsession.delete(:forwarding_url)\n\tend",
"def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url] || default)\n\t\tsession.delete(:forwarding_url)\n\tend",
"def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url] || default)\n\t\tsession.delete(:forwarding_url)\n\tend",
"def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url] || default)\n\t\tsession.delete(:forwarding_url)\n\tend",
"def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url] || default)\n\t\tsession.delete(:forwarding_url)\n\tend",
"def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url] || default)\n\t\tsession.delete(:forwarding_url)\n\tend",
"def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url] || default)\n\t\tsession.delete(:forwarding_url)\n\tend",
"def redirect(url)\n raise \"To be implemented by client application\"\n end",
"def store_location\n session[:return_to] = request.fullpath\n end",
"def redirect_back_or(default)\n \tredirect_to(session[:forwarding_url] || default)\n\t session.delete(:forwarding_url)\n\tend"
]
| [
"0.7730111",
"0.7649159",
"0.704684",
"0.7029194",
"0.6981081",
"0.6871779",
"0.67809576",
"0.67569697",
"0.6699827",
"0.65908873",
"0.6580519",
"0.65731466",
"0.65681744",
"0.6567211",
"0.654002",
"0.653624",
"0.6530604",
"0.65075284",
"0.64961356",
"0.64893895",
"0.6443822",
"0.6438121",
"0.64144045",
"0.64038223",
"0.63955456",
"0.63915783",
"0.638389",
"0.63774705",
"0.6366385",
"0.6365043",
"0.6356526",
"0.63548374",
"0.6352605",
"0.63401383",
"0.633513",
"0.63308966",
"0.63308966",
"0.63304746",
"0.6327596",
"0.6324449",
"0.63240635",
"0.63172257",
"0.631491",
"0.63140327",
"0.63140327",
"0.63140327",
"0.63140327",
"0.63140327",
"0.6307154",
"0.6288226",
"0.6288226",
"0.6286348",
"0.628622",
"0.6282425",
"0.62797725",
"0.6279272",
"0.62750477",
"0.6270668",
"0.62699354",
"0.6269081",
"0.62617534",
"0.6260936",
"0.6243385",
"0.62430793",
"0.624299",
"0.624299",
"0.624299",
"0.624299",
"0.6242862",
"0.62418014",
"0.6233176",
"0.6231419",
"0.62295544",
"0.6228895",
"0.6228895",
"0.6228469",
"0.62256324",
"0.6223309",
"0.6220299",
"0.6220131",
"0.62192047",
"0.62185204",
"0.62185204",
"0.62183094",
"0.62165177",
"0.62163824",
"0.6214744",
"0.6214744",
"0.6214744",
"0.6214643",
"0.6213592",
"0.6211143",
"0.6211143",
"0.6211143",
"0.6211143",
"0.6211143",
"0.6211143",
"0.6211143",
"0.6209995",
"0.6208843",
"0.6204134"
]
| 0.0 | -1 |
Stores the URL trying to be accessed. | def store_location
session[:forwarding_url] = request.original_url if request.get?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store_location\n session[:forwarding_url] = request.url if request.get?\n # Makes sure that the URL is saved only for a GET request because submitting\n # DELETE, PATCH or POST will raise errors when the URL is expecting\n # a GET request.\n end",
"def store_location\n # store last url as long as it isn't a /users path\n\tsession[:previous_url] = request.fullpath unless request.fullpath =~ /\\/users/ or request.fullpath =~ /\\/json/ or request.fullpath =~ /\\/static/\n\t\n end",
"def store_location\n\t\tif request.get?\n\t\t\tcookies[:previous_url] = request.url\n\t\tend\n\tend",
"def store_location\n # store last url as long as it isn't a /users path\n session[:previous_url] = request.fullpath unless request.fullpath =~ /\\/users/\n end",
"def store_location\n # store last url as long as it isn't a /users path\n session[:previous_url] = request.fullpath unless request.fullpath =~ /\\/users/\n end",
"def store_location\n # store last url as long as it isn't a /users path\n session[:previous_url] = request.fullpath unless request.fullpath =~ /\\/users/\n end",
"def store_location\n # store last url as long as it isn't a /users path\n session[:previous_url] = request.fullpath unless request.fullpath =~ /\\/users/\n end",
"def store_location\n # store last url as long as it isn't a /users path\n session[:previous_url] = request.fullpath unless request.fullpath =~ /\\/users/\n end",
"def store_location\n # store last url as long as it isn't a /users path\n session[:previous_url] = request.fullpath unless request.fullpath =~ /\\/users/\n end",
"def store_location!\n session[:\"#{scope}_return_to\"] = attempted_path if request.get? && !http_auth?\n end",
"def store_location\n # Store the URL only when the reqest was GET\n session[:forwarding_url] = request.original_url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_URL\n session[:forwarding_url] = request.original_url if request.get?\n end",
"def store_location\n\t\tsession[:forwarding_url] = request.url if request.get?\n\tend",
"def store_location\n\t\tsession[:forwarding_url] = request.url if request.get?\n\tend",
"def store_location\n\t\tsession[:forwarding_url] = request.url if request.get?\n\tend",
"def store_location\n\t\tsession[:forwarding_url] = request.url if request.get?\n\tend",
"def store_url\n session[:forwarding_url] = request.original_url if request.get?\n end",
"def url= new_url\n new_url = self.class.standardized_url new_url\n return if new_url == url\n super new_url # Heading for trouble if url wasn't unique\n @indexing_url = nil # Clear the memoized indexing_url\n self.http_status = nil # Reset the http_status\n # We do NOT build the associated site here, because we may be BUILDING the page_ref for a site, in\n # which case that site will assign itself to us. Instead, the site attribute is memoized, and if it\n # hasn't been built by the time that it is accessed, THEN we find or build an appropriate site\n self.site = SiteServices.find_or_build_for self\n self.kind = :site if site&.page_ref == self # Site may have failed to build\n # We trigger the site-adoption process if the existing site doesn't serve the new url\n # self.site = nil if site&.persisted? && (SiteServices.find_for(url) != site) # Gonna have to find another site\n request_attributes :url # Trigger gleaning and mercury_result to validate/modify url\n attrib_ready! :url # Has been requested but is currently ready\n end",
"def store_location!\n store_location_for(scope, attempted_path) if request.get? && !http_auth?\n end",
"def url=(_); end",
"def set_url\n @url = Url.find_by(key: params[:key])\n end",
"def store_location\n session[:forward_url] = request.url if request.get?\n end",
"def store_location\n\t\tsession[:forwarding_url]=request.original_url if request.get?\n\tend",
"def store_location\n\t\t# store last url - this is needed for post-login redirect to whatever the user last visited.\n\t\tif (request.fullpath != \"/users/sign_in\" &&\n\t\t\t\trequest.fullpath != \"/users/sign_up\" &&\n\t\t\t\trequest.fullpath != \"/users/password\" &&\n\t\t\t\trequest.fullpath != \"/users/sign_out\" &&\n\t\t\t\trequest.fullpath !~ /\\/users\\/confirmation/i &&\n\t\t\t\t!request.xhr?) # don't store ajax calls\n\t\t\tsession[:previous_url] = request.fullpath\n\t\tend\n\tend",
"def store_location\n # store last url - this is needed for post-login redirect to whatever the user last visited.\n return unless request.get? \n if (!request.fullpath.match(\"/users\") &&\n !request.xhr?) # don't store ajax calls\n session[\"user_return_to\"] = request.fullpath\n end\n end",
"def url_server\n\t\t\tunless @links_to_visit.empty?\n\t\t\t\t@url = @links_to_visit.pop\n\t\t\tend\n\t\tend",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.url? if request.get?\n end",
"def store_location\n \tsession[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n\t\tsession[ :forwarding_url ] = request.original_url if request.get?\n\tend",
"def store_location\n if request.get?\n session[:forwarding_url] = request.original_url\n end\n end",
"def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end",
"def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end",
"def store_location \n\t\tsession[:forwarding_url] = request.url if request.get?\n\tend",
"def store_location\n\t # store last url - this is needed for post-login redirect to whatever the user last visited.\n\t if !devise_controller? && !request.xhr? # don't store ajax calls\n\t session[:previous_url] = request.fullpath \n\t end\n\tend",
"def url=(url)\n @@url = url\n end",
"def store_location\n session[ :return_to ] = request.url if request.get?\n end",
"def store_location\n # store last url - this is needed for post-login redirect to whatever the user last visited.\n if (request.path != \"/users/sign_in\" &&\n request.path != \"/users/sign_up\" &&\n request.path != \"/users/password/new\" &&\n request.path != \"/users/password/edit\" &&\n request.path != \"/users/confirmation\" &&\n request.path != \"/users/sign_out\" &&\n !request.fullpath.match(/\\/users\\/auth\\//) &&\n !request.xhr?) # don't store ajax calls\n session[:previous_url] = request.fullpath\n end\n end",
"def store_location_url(url)\n session[:forwarding_url] = url\n end",
"def store_location\n\t\tsession[:forwarding_url] = request.original_url if request.get?\n\tend",
"def store_location\n\t\tsession[:forwarding_url] = request.original_url if request.get?\n\tend",
"def store_location\n\t\tsession[:forwarding_url] = request.original_url if request.get?\n\tend",
"def store_location\n\t\tsession[:forwarding_url] = request.original_url if request.get?\n\tend",
"def store_location\n session[:forwarding_url] = request.original_fullpath if request.get?\n end",
"def store_location\n \t\tsession[:forwarding_url] = request.original_url if request.get?\n \tend",
"def url=(url)\n @@url = url\n end",
"def store_location\n # session[:forwarding_url] = request.url if request.get?\n user_session[:forwarding_url] = request.referer if request.get? && request.referer\n end",
"def save_previous_url\n\t\t\tunless request.referer.include?('likes')\n\t\t\t\tsession[:previous_url] = URI(request.referrer).path\n\t\t\tend\n\t\tend",
"def store_location\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n\t\t#Store target location (only if request=get). (For example, if user request a page but\n\t\t# it's not signed in. It remembers the request)\n\t\tsession[:return_to] = request.url if request.get?\n\tend",
"def store_location\n session[:forwarding_url]=request.fullpath if request.get?\n end",
"def store_location\n\t\tsession[:return_to] = request.url if request.get?\n\tend",
"def store_location\n\t\tsession[:return_to] = request.url if request.get?\n\tend",
"def store_location\n\t\tsession[:return_to] = request.url if request.get?\n\tend",
"def store_location\n\t\tsession[:last_page] = @request.request_uri\n\tend",
"def store_location\n\t session[:forwarding_url] = request.original_url if request.get?\n\tend",
"def store_location\n if request.get?\n session[:return_to] = request.url\n end\n end",
"def store_location\n if request.get?\n session[:return_to] = request.url\n end\n end",
"def store_location\n if request.get?\n session[:return_to] = request.url\n end\n end",
"def store_location\n if request.get?\n session[:return_to] = request.url\n end\n end",
"def store_location\n \tsession[:forwarding_url] = request.original_url if request.get?\n\tend",
"def store_location(url = url_for(:controller => controller_name, :action => action_name))\n # It's possible to create a redirection attack with a redirect to data: protocol... and possibly others, so:\n # Whitelisting redirection to our own site and relative paths.\n url = nil unless url =~ /\\A([%2F\\/]|#{root_url})/\n session[:return_to] = url\n end",
"def store_location\n session[:forwarding_url] = request.url if request.get? # only for get requests. A user could technically delete their cookie then submit a form\n end",
"def store_forwarding_url\n session[:forwarding_url] = request.url if request.get?\n end",
"def store_location\n if ((!request.fullpath.match(\"/users\") && !request.fullpath.match(\"/admin\") && !request.fullpath.match(\"/admin/login\")) &&\n !request.xhr?) # don't store ajax calls\n# puts \"----------------------------\"\n# puts \"--not store--\"\n session[:previous_url] = request.fullpath\n else\n# puts \"----------------------------\"\n# puts \"--store--\"\n end\n end",
"def guardar_URL\n\t\tsession[:url_deseada] = request.original_url if request.get?\n\tend"
]
| [
"0.6911905",
"0.6895635",
"0.6885458",
"0.67844397",
"0.67844397",
"0.67844397",
"0.67844397",
"0.67844397",
"0.67844397",
"0.6695066",
"0.6679288",
"0.66376084",
"0.6633876",
"0.6629198",
"0.6593085",
"0.6593085",
"0.6593085",
"0.6593085",
"0.6592063",
"0.65686387",
"0.65581894",
"0.6556927",
"0.6549827",
"0.6544405",
"0.6494122",
"0.64913654",
"0.6487764",
"0.64818734",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6478159",
"0.6468487",
"0.64663166",
"0.6461805",
"0.6461492",
"0.64610165",
"0.64610165",
"0.6459076",
"0.645516",
"0.6444079",
"0.64184505",
"0.64035386",
"0.6393652",
"0.63932675",
"0.63932675",
"0.63932675",
"0.63932675",
"0.6389309",
"0.6379621",
"0.63749844",
"0.6368416",
"0.63656354",
"0.6351192",
"0.63509923",
"0.6337971",
"0.6337097",
"0.6337097",
"0.6337097",
"0.63334996",
"0.631782",
"0.6317664",
"0.6317664",
"0.6317664",
"0.6317664",
"0.6314601",
"0.6314321",
"0.63032174",
"0.6299804",
"0.6290964",
"0.62892735"
]
| 0.0 | -1 |
Confirms a loggedin user. | def logged_in_user
unless logged_in?
store_location
flash[:danger] = "Please log in."
redirect_to login_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def correct_user\n @user = User.find(params[:id])\n if !current_user?(@user)\n message = \"currently logged in as #{current_user.name}. Not you? \"\n message += \"#{view_context.link_to('Log out.', log_out)}\".html_safe\n flash[:warning] = message\n redirect_to(root_url)\n end\n end",
"def confirm_logged_in\n \tunless session[:user_id]\n \t\tflash[:notice] = \"Please Log in.\"\n \t\tredirect_to(login_path)\n \tend\n end",
"def correct_user\n\t\t\tauthenticate_user!\n\t\t\tunless @user == current_user || current_user.admin?\n\t\t\t\tredirect_to (root_path)\n\t\t\t\tflash[:alert]\n\t\t\tend\n\t\tend",
"def confirm\n if @user = UserConfirmsAccount.new(:token => params[:token]).call\n self.establish_session @user\n redirect_to profile_url, :notice => \"Thanks for confirming #{@user.email}\"\n else\n redirect_to profile_url, :notice => \"There was a problem confirming - try re-sending the email?\"\n end\n end",
"def confirm\n user = User.find(params[:id])\n authorize user\n if user.state != \"active\"\n user.confirm\n user.make_user_a_member\n\n # assume this type of user just activated someone from somewhere else in the app\n flash['notice'] = \"Activation of #{user.name_and_login} complete.\"\n redirect_to(session[:return_to] || root_path)\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n unless @user == current_user\n flash[:danger] = 'You are not authorized to do that.'\n redirect_to(root_url)\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n if @user != current_user\n flash[:alert] = \"Action not authorized\"\n redirect_to(root_url)\n end\n end",
"def correct_user\n unless helpers.current_user?(@user)\n flash[:danger] = \"You don't have permission to do that\"\n redirect_to root_path\n end\n end",
"def confirm_logged_in\n unless session[:user_id]\n redirect_to login_path, alert: \"Please log in\"\n end\n end",
"def confirm_user_logged_in\n unless logged_in?\n store_url # So that user is sent to the same URL after they log in\n flash[:danger] = \"Please log in.\"\n redirect_to root_url\n end\n end",
"def confirm_logged_in\n unless session[:user_id] != nil\n redirect_to root_path\n end\n end",
"def correct_user\n @user = User.find(params[:user_id])\n redirect_to('/unauthorized') unless current_user?(@user)\n end",
"def confirm\n if current_visitor && current_visitor.has_role?('admin', 'manager')\n user = User.find(params[:id]) unless params[:id].blank?\n if !params[:id].blank? && user && user.state != \"active\"\n user.confirm!\n user.make_user_a_member\n # assume this type of user just activated someone from somewhere else in the app\n flash[:notice] = \"Activation of #{user.name_and_login} complete.\"\n redirect_to(session[:return_to] || root_path)\n end\n else\n flash[:notice] = \"Please login as an administrator.\"\n redirect_to(root_path)\n end\n end",
"def correct_user\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tredirect_to(root_url) unless @user == current_user\n\t\tend",
"def correct_user\n @user = User.find(params[:id])\n if current_user != @user\n flash[:danger] = \"You don't have permission for that\"\n redirect_to(root_url) unless current_user?(@user)\n end\n end",
"def appctrl_confirm_user\n redirect_to( signin_path() ) unless @current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n if !current_user?(@user)\n flash[:danger] = \"Sorry, you're aren't allowed to access that.\"\n redirect_to(\"/#flash\") \n end\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to root_path, alert: \"You do not have access to that page\" unless current_user == @user\n end",
"def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to root_path unless @user == current_user\n\tend",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n flash[:danger] = \"Admin Access Only.\"\n end",
"def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tif current_user != @user\n\t\t\t\tredirect_back(fallback_location: root_path)\n\t\t\tend\n\t\tend",
"def user_stray\n if !logged_in? || @user == nil\n flash[:alert] = \"You have been logged out of your session. Please log back in to continue.\"\n redirect \"/\"\n elsif @user.id != current_user.id\n flash[:alert] = \"You do not have permission to view or edit other users' content.\"\n redirect \"/\"\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n user = User.find(params[:id])\n unless current_user?(user) \n flash[:danger] = \"Uncorrect user.\"\n redirect_to(root_url) \n end\n end",
"def switch\n authorize!(:manage, :all)\n user = User.find_by(login: params[:login].upcase)\n if user\n session[:original_user_id] = session[:user_id]\n session[:user_id] = user.id\n redirect_to root_url, notice: \"Sie sind nun der Nutzer mit dem Login #{user.login}.\"\n else\n redirect_to root_url, notice: \"Der Nutzer existiert nicht im System.\"\n end\n end",
"def correct_user\n set_user\n unless current_user?(@user)\n flash[:danger] = 'This action is not permitted for this account since you are not the owner'\n redirect_to overview_user_path(current_user)\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def confirm_user\n if session[:user_id]\n return true\n else\n flash[:notice] = \"please login\"\n redirect_to(:controller => 'manage', :action => 'login')\n return false\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \"Yikes. Sorry, but it doesn't look you have permission to do that 😬\"\n redirect_back(fallback_location: root_url)\n end\n end",
"def correct_user\n\t @user = User.find(params[:id])\n\t unless current_user?(@user)\n\t flash[:danger] = \"You don't have rights\"\n\t\t\tredirect_back_or(root_url)\n\t end\n\tend",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user === current_user\n end",
"def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tredirect_to(root_path) unless current_user?(@user)\n\t\tend",
"def confirm_logged_in\n unless session[:username]\n redirect_to authenticate_login_path\n else\n true\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to root_path unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \n \"You do not have permission to access #{@user.name}'s account.\"\n redirect_to(root_url)\n end\n end",
"def correct_user\n @course = Course.find(params[:id])\n @user = @course.users\n unless current_user == @user\n redirect_to(root_url) \n flash[:danger] = \"You are not the authorised user\"\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user # sauf si\n end",
"def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_path) unless current_user?(@user)\n\tend",
"def correct_user\n\t\tunless current_user == @univers.user\n\t\t\tflash[:danger] = \"You have no power there\"\n\t\t\tredirect_to universes_path\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user) #checks if current_user == @user\n #current_user? defined in session helper\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n \n redirect_to(login_path) unless current_user?(@user)\n end",
"def confirm_logged_in\n unless session[:user_id]\n flash[:notice] = \"Please log in.\"\n redirect_to root_path\n return false # halts the before_action\n else\n return true\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(user_root_path,:notice => 'You cannot access this page') unless current_user == @user\n end",
"def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend",
"def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend",
"def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend",
"def logged_in_user\n unless !current_user.nil?\n flash[:danger] = \"Please log in.\"\n redirect_to root_path\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n\n if @user != current_user\n redirect_to(root_path)\n else\n # nothing to do\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @question = Question.find(params[:id])\n redirect_to(root_url) unless current_user == @question.user\n end",
"def confirm_matching\n @user = User.find(params[:id])\n redirect_to root_path unless current_user? @user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless (current_user.id == @user.id)\n end",
"def correct_user\n @user = User.find(params[:id])\n # current_user?() is a sessions_helper method. The user of the params hash has\n # to match the current user or will be redirected to root\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n\t\t@user = User.find(params[ :id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend",
"def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to root_path\n end\n end",
"def confirm_logged_in\r\n unless session[:username]\r\n redirect_to authenticate_index_path\r\n else\r\n true\r\n end\r\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user) # current_user is method in sessions_helper.rb\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end"
]
| [
"0.70087826",
"0.6982988",
"0.6919373",
"0.688131",
"0.6845446",
"0.68326277",
"0.67944413",
"0.67929715",
"0.6642435",
"0.6624581",
"0.66114175",
"0.66022736",
"0.6589018",
"0.65539706",
"0.65349805",
"0.65303934",
"0.6512816",
"0.650312",
"0.64878744",
"0.6487622",
"0.6480418",
"0.6479267",
"0.64705276",
"0.64680994",
"0.64656436",
"0.6457351",
"0.64541256",
"0.64485556",
"0.64485556",
"0.64485556",
"0.64485556",
"0.64485556",
"0.64485556",
"0.64485556",
"0.64485556",
"0.64485556",
"0.6445996",
"0.6437721",
"0.64289176",
"0.64260334",
"0.6424799",
"0.6417934",
"0.64177954",
"0.64163303",
"0.6410097",
"0.6401843",
"0.63820904",
"0.63622755",
"0.63595843",
"0.6355515",
"0.635374",
"0.6351282",
"0.6350864",
"0.63502026",
"0.63502026",
"0.63502026",
"0.6347271",
"0.63426447",
"0.6342538",
"0.6342538",
"0.6342538",
"0.6342538",
"0.6342538",
"0.6342538",
"0.6342538",
"0.6342538",
"0.63400817",
"0.63345385",
"0.63329995",
"0.6331134",
"0.6330873",
"0.632984",
"0.6325074",
"0.63200074",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605"
]
| 0.0 | -1 |
Confirms the correct user. | def correct_user
user_id = params[:user_id] || params[:id] || session[:user_id]
@user = User.find_by(id: user_id)
unless @user.nil?
unless current_user?(@user) || current_user.administrator?
flash[:danger] = "Only the account owner or an adminstrator to do that."
redirect_to(root_path)
end
else
nonexistent_user_error
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def correct_user\n msg = \"You do not have permission to update another user's information\"\n require_correct_user(@user, msg)\n end",
"def correct_user\n\t\t\tauthenticate_user!\n\t\t\tunless @user == current_user || current_user.admin?\n\t\t\t\tredirect_to (root_path)\n\t\t\t\tflash[:alert]\n\t\t\tend\n\t\tend",
"def correct_user\n unless helpers.current_user?(@user)\n flash[:danger] = \"You don't have permission to do that\"\n redirect_to root_path\n end\n end",
"def correct_user\n set_user\n unless current_user?(@user)\n flash[:danger] = 'This action is not permitted for this account since you are not the owner'\n redirect_to overview_user_path(current_user)\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n unless @user == current_user\n flash[:danger] = 'You are not authorized to do that.'\n redirect_to(root_url)\n end\n end",
"def correct_user\n user = User.find(params[:id])\n unless current_user?(user) \n flash[:danger] = \"Uncorrect user.\"\n redirect_to(root_url) \n end\n end",
"def correct_user\n\t\tunless current_user == @univers.user\n\t\t\tflash[:danger] = \"You have no power there\"\n\t\t\tredirect_to universes_path\n end\n end",
"def confirm\n if @user = UserConfirmsAccount.new(:token => params[:token]).call\n self.establish_session @user\n redirect_to profile_url, :notice => \"Thanks for confirming #{@user.email}\"\n else\n redirect_to profile_url, :notice => \"There was a problem confirming - try re-sending the email?\"\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n if current_user != @user\n flash[:danger] = \"You don't have permission for that\"\n redirect_to(root_url) unless current_user?(@user)\n end\n end",
"def correct_user\n @question = Question.find(params[:id])\n redirect_to(root_url) unless current_user == @question.user\n end",
"def correct_user\n @user = User.find(params[:id])\n if @user != current_user\n flash[:alert] = \"Action not authorized\"\n redirect_to(root_url)\n end\n end",
"def correct_user\n @user = User.find(params[:user_id])\n redirect_to('/unauthorized') unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user_help?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n if !current_user?(@user)\n message = \"currently logged in as #{current_user.name}. Not you? \"\n message += \"#{view_context.link_to('Log out.', log_out)}\".html_safe\n flash[:warning] = message\n redirect_to(root_url)\n end\n end",
"def correct_user\n if !is_correct_user\n redirect_to incorrect_user_path_for\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \n \"You do not have permission to access #{@user.name}'s account.\"\n redirect_to(root_url)\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \"Please don't mess with others' profiles!\"\n # redirect_to root_url\n redirect_to @user\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \"Yikes. Sorry, but it doesn't look you have permission to do that 😬\"\n redirect_back(fallback_location: root_url)\n end\n end",
"def correct_user\n\t @user = User.find(params[:id])\n\t unless current_user?(@user)\n\t flash[:danger] = \"You don't have rights\"\n\t\t\tredirect_back_or(root_url)\n\t end\n\tend",
"def correct_user\n unless @user == current_user\n redirect_to user_notes_path(current_user)\n end\n end",
"def correct_user\n redirect_to(root_url) unless @user == current_user\n end",
"def confirm_with_user\n confirmed = Helper::Util.confirm \"Is this OK? \", true\n return if confirmed\n\n loop do\n Helper::Util.clear\n\n print_identification\n\n say \"<%= color('The following options may be adjusted before continuing.', BOLD) %>\"\n choice = choose do |menu|\n self.class.available_options.reject(&:skip_confirmation).each do |option|\n value = send option.confirm_symbol\n menu.choice \"#{option.label}: #{option.display_value(value)}\"\n end\n\n menu.choice \"Accept and continue\"\n menu.choice \"Quit\"\n menu.readline = true\n menu.prompt = \"What would you like to do?\"\n end\n\n Helper::Util.clear\n\n print_identification\n\n if (option = self.class.available_options.find { |o| choice =~ /^#{Regexp.quote(o.label)}/ })\n loop do\n break if prompt_for_option(option)\n say \"Invalid value for option.\\n\\n\"\n end\n elsif choice =~ /^Accept/\n log\n return\n else\n exit(0)\n end\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n if !current_user?(@user)\n flash[:danger] = \"Sorry, you're aren't allowed to access that.\"\n redirect_to(\"/#flash\") \n end\n end",
"def correct_user(user)\n user == current_user\n end",
"def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tif current_user != @user\n\t\t\t\tredirect_back(fallback_location: root_path)\n\t\t\tend\n\t\tend",
"def correct_user\n @user = HoacUser.find(params[:id])\n redirect_to(edit_hoac_user_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to root_path, alert: \"You do not have access to that page\" unless current_user == @user\n end",
"def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tredirect_to(root_url) unless @user == current_user\n\t\tend",
"def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to root_path unless @user == current_user\n\tend",
"def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tredirect_to(root_path) unless current_user?(@user)\n\t\tend",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user === current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n flash[:danger] = \"Admin Access Only.\"\n end",
"def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_path) unless current_user?(@user)\n\tend",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user # sauf si\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to root_path unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:user_id])\n unless current_user?(@user)\n flash[:danger] = \"You don't have permission for that action.\"\n redirect_to(root_url)\n end\n end",
"def correct_user\n @course = Course.find(params[:id])\n @user = @course.users\n unless current_user == @user\n redirect_to(root_url) \n flash[:danger] = \"You are not the authorised user\"\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n logger.debug \"***correct_user - Detected User - #{@user.name}\"\n redirect_to(root_url) unless current_user?(@user) || admin_user\n end",
"def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend",
"def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend",
"def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def confirm_matching\n @user = User.find(params[:id])\n redirect_to root_path unless current_user? @user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(user_root_path,:notice => 'You cannot access this page') unless current_user == @user\n end",
"def correct_user\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to root_url, notice: \"You do not have permission to view or edit this information because it isn't yours.\" unless current_user?(@user)\n end",
"def correct_user\n \n redirect_to(login_path) unless current_user?(@user)\n end"
]
| [
"0.7474259",
"0.73411936",
"0.7317917",
"0.7183303",
"0.7174887",
"0.7049758",
"0.70130193",
"0.7012358",
"0.7006517",
"0.7006201",
"0.7003461",
"0.69663024",
"0.69136065",
"0.6911695",
"0.690295",
"0.6892608",
"0.68439376",
"0.6842948",
"0.68397075",
"0.683463",
"0.6826711",
"0.6825813",
"0.6811448",
"0.680094",
"0.67988366",
"0.6793706",
"0.67789406",
"0.67666626",
"0.67421",
"0.6740984",
"0.6740906",
"0.6736732",
"0.6736732",
"0.6736732",
"0.6736732",
"0.6736732",
"0.6736732",
"0.6736732",
"0.6736732",
"0.6736732",
"0.6732851",
"0.6725006",
"0.6723821",
"0.67211986",
"0.67211986",
"0.67211986",
"0.67211986",
"0.67211986",
"0.67211986",
"0.67211986",
"0.67211986",
"0.6720861",
"0.6715527",
"0.6711952",
"0.6684064",
"0.66769403",
"0.66658443",
"0.6663128",
"0.6663128",
"0.6663128",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.66540176",
"0.6653203",
"0.66520107",
"0.664873",
"0.66435707"
]
| 0.67279315 | 41 |
Confirms an administrator user. | def administrator_user
unless current_user.administrator?
flash[:danger] = "Only an administrator can do that."
redirect_to(root_path)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def confirm_admin\n \tunless session[:admin]\n \t\tflash[:notice] = \"You are not an admin.\"\n \t\tredirect_to(user_path( :id => session[:user_id]))\n \tend\n end",
"def admin_user\n\t\t\tflash_text = \"Administrative privilege required to perform this action.\"\n\t\t\tflash[:danger] = flash_text unless current_user.admin?\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend",
"def confirm_admin\n @confirm_admin = true if session[:role_name] == 'Administrator'\n end",
"def admin_user\n redirect_to(root_url) and flash[:danger] = \"Only admins can do that!\" unless current_user.admin?\n\n end",
"def admin_user\n unless this_is_admin?(current_user)\n flash[:danger] = \"You don't have the rights for this action.\"\n redirect_to(root_url)\n end\n end",
"def admin_user\n unless this_is_admin?(current_user)\n flash[:danger] = \"You don't have the rights for this action.\"\n redirect_to(root_url)\n end\n end",
"def admin_user\n if user_signed_in? && current_user.adminrole?\n flash.now[:success] = \"Admin Access Granted\"\n else\n redirect_to root_path\n end\n end",
"def admin_user\n if(!current_user.admin?)\n flash[:danger] = \"Access Denied. Admin required\"\n redirect_to root_url\n end\n end",
"def confirm\n if current_visitor && current_visitor.has_role?('admin', 'manager')\n user = User.find(params[:id]) unless params[:id].blank?\n if !params[:id].blank? && user && user.state != \"active\"\n user.confirm!\n user.make_user_a_member\n # assume this type of user just activated someone from somewhere else in the app\n flash[:notice] = \"Activation of #{user.name_and_login} complete.\"\n redirect_to(session[:return_to] || root_path)\n end\n else\n flash[:notice] = \"Please login as an administrator.\"\n redirect_to(root_path)\n end\n end",
"def be_admin\n if current_user.switch_to(\"admin\")\n flash[:notice] = \"You have now an 'admin' role\"\n else\n flash[:error] = \"You are not authorized to have a 'admin' role\"\n end\n redirect_to( request.env[\"HTTP_REFERER\"])\n end",
"def admin_user\n unless current_user.is_admin?\n flash[:danger] = \"Keine Berechtigung.\"\n redirect_to(root_url)\n end\n end",
"def admin_user\n unless current_user.is_admin?\n flash[:danger] = \"Keine Berechtigung.\"\n redirect_to(root_url)\n end\n end",
"def admin_user\n\t\tunless admin? \n\t\t\tflash[:danger] = \"Only administrators have access to this page\"\n\t\t\tredirect_back_or(root_url) \n\t\tend\n\tend",
"def confirm_admin\n redirect_to root_path unless current_user.admin?\n end",
"def correct_user\n\t\t\tauthenticate_user!\n\t\t\tunless @user == current_user || current_user.admin?\n\t\t\t\tredirect_to (root_path)\n\t\t\t\tflash[:alert]\n\t\t\tend\n\t\tend",
"def admin_user\n unless current_user.admin?\n flash[:danger] = \"You do not have the permission to do that.\"\n redirect_to home_path\n end\n end",
"def verify_admin_of_user\n redirect_to admins_path,\n flash: { alert: I18n.t(\"administrator.flash.unauthorized\") } unless current_user.admin_of?(@user, \"can_manage_users\")\n end",
"def admin_user \n if (!current_user.lunches_admin?) \n flash[:alert] = 'You not allowed to edit menu.'\n \n redirect_to(root_url)\n end\n end",
"def admin_user!\n unless signed_in? and current_user.admin?\n\t flash[:notice]=\"Por favor inicie sesión como administrador\".encode('UTF-8')\n\t redirect_back(fallback_location: root_path) \n end\n end",
"def admin_user\n redirect_to(root_path) unless current_user.try(:admin?) || current_user?(@user)\n end",
"def check_admin_user\n unless current_user && current_user.privilege_admin?\n flash[:danger] = \"You do not have permission to perform this operation\"\n redirect_to root_path\n end\n end",
"def correct_user\n @userAdmin = UserAdmin.find(params[:id])\n unless current_user?(@userAdmin)\n flash[:danger] = \"You don't have the rights for this page/action.\"\n redirect_to(root_url)\n end\n end",
"def admin_user\n redirect_to root_url, notice: \"You do not have permission to view or edit this information.\" unless current_user.admin?\n end",
"def admin_user\n\t unless current_user.admin?\n flash[:danger] = \"Log in as Admin.\"\n redirect_to(root_url)\n\t end \n\t end",
"def admin_user\n unless @is_admin\n flash[:danger] = \"Must be admin to modify recipes\"\n redirect_to(recipes_url) \n end\n end",
"def admin_user\n redirect_to(root_path) unless (current_user != nil && current_user.admin == true)\n end",
"def admin\n unless current_user.admin?\n flash[:danger] = \"Sorry, you must be an admin to do that.\"\n redirect_to user_path(current_user)\n end\n end",
"def admin_user\n unless current_user && current_user.admin?\n store_location\n flash[:danger] = \"Please log in as admin.\"\n redirect_to users_url\n end\n end",
"def admin_user\n unless @is_admin\n flash[:danger] = \"Must be admin to modify recipes\"\n redirect_to(recipes_url) \n end\n end",
"def admin_user\n redirect_to(root_url) unless !current_user?(@user) && current_user.admin?\n end",
"def verify_admin\n if !current_user.present? || current_user.email != I18n.t('general.admin_email')\n redirect_to concerts_path\n flash[:notice] = I18n.t('general.log_as_admin')\n end\n end",
"def admin_user\n unless current_user && current_user.admin?\n redirect_to login_url, notice: \"admin can only do this action.\" \n end\n end",
"def authenticate_admin\n\t\tauthenticate_user!\n\t\tunless current_user.approved == 1\n\t\t\tsign_out\n\t\t\tflash[:error] = \"User is not admin! Try again using another username!\"\n\t\t\tredirect_to new_user_session_path\n\t\t\t# redirect_to new_user_session_path\n\t\tend\n\tend",
"def admin_user\n @user = current_user\n redirect_to @user unless @user.admin?\n end",
"def admin_user\n \n unless current_user.admin?\n \tflash[:danger] = \"Please log in with the correct user name.\"\n \tredirect_to(root_url)\n end\n end",
"def admin_user\n redirect_to(root_path) unless is_admin?\n end",
"def confirm\n user = User.find(params[:id])\n authorize user\n if user.state != \"active\"\n user.confirm\n user.make_user_a_member\n\n # assume this type of user just activated someone from somewhere else in the app\n flash['notice'] = \"Activation of #{user.name_and_login} complete.\"\n redirect_to(session[:return_to] || root_path)\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n flash[:danger] = \"Admin Access Only.\"\n end",
"def admin_user\n if (!current_user || current_user.username != 'admin')\n redirect_to(root_url)\n end\n end",
"def admin_user\n redirect_to(root_path) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_path) unless current_user.admin?\n end",
"def check_admin\n redirect_to root_path, alert: \"You do not have admin privileges.\" unless current_user.admin\n end",
"def check_admin\n redirect_to root_path, alert: \"You do not have admin privileges.\" unless current_user.admin\n end",
"def correct_user\n unless helpers.current_user?(@user)\n flash[:danger] = \"You don't have permission to do that\"\n redirect_to root_path\n end\n end",
"def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t end",
"def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end",
"def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend",
"def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend",
"def admin_user\n\t\tredirect_to(root_url) unless current_user.admin? #NB il metodo \"admin?\" è stato aggiunto direttamente da Rails quando alla creazione ha visto che admin è un booleano\n\tend",
"def administrate!\r\n\tif !current_user.administrator\r\n\t\tredirect \"/dashboard\"\r\n\tend\r\nend",
"def admin_user\n #redirect_to(root_url) unless\n current_user.admin?\n end",
"def admin_user\n #redirect_to(root_url) unless\n current_user.admin?\n end",
"def verify_admin?\n return if current_user.admin?\n\n flash[:alert] = \"Sorry, only admins allowed to view the dashboard.\"\n redirect_to :root\n end",
"def admin_user\n redirect_to(current_user) unless current_user.admin?\n end",
"def admin_user\n redirect_to(admin_admins_path) unless current_user.admin?\n end",
"def correct_user\n set_user\n unless current_user?(@user)\n flash[:danger] = 'This action is not permitted for this account since you are not the owner'\n redirect_to overview_user_path(current_user)\n end\n end",
"def authenticate_administrator_user\n if !administrator_signed_in?\n redirect_to new_administrator_session_path(), notice: \"Connectez vous en tant que administrateur du site\"\n return\n end\n if (!current_administrator.is_admin)\n redirect_to root_path(), notice: \"Votre compte administrateur n'est pas encore approuvé\"\n return\n end\n # ELse it is good\n end",
"def check_admin_status\n if current_user.nil? || !current_user.admin?\n flash[:alert] = \"Access denied. Please login as an admin user\"\n redirect_to root_url\n end\n end",
"def check_admin_status\n if current_user.nil? || !current_user.admin?\n flash[:alert] = \"Access denied. Please login as an admin user\"\n redirect_to root_url\n end\n end",
"def check_administrator_user\n result = current_user.is_administrator?\n\n if (!result)\n # If it doesn't meet the minimum privilege level, redirect.\n flash[:error] = t(\"ui.error.forbidden\")\n redirect_to root_path()\n end\n\n return result\n end",
"def admin_approve_user\n @user.update(approved: true)\n redirect_to admin_path, notice: \"User Approved\"\n end",
"def admin_user\n\t\tredirect_to(root_path) unless current_user.admin?\n\tend",
"def admin\n unless current_user.admin?\n redirect_to root_url\n flash[:danger] = \"You have no access here\"\n end\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin?\n end"
]
| [
"0.7336965",
"0.7294434",
"0.7221028",
"0.7094599",
"0.7063222",
"0.7063222",
"0.70558053",
"0.70520467",
"0.7024281",
"0.69845605",
"0.6948249",
"0.6948249",
"0.6920176",
"0.6908153",
"0.69053614",
"0.68236005",
"0.68215466",
"0.6812401",
"0.6775577",
"0.6770334",
"0.67656726",
"0.67580044",
"0.67518467",
"0.67421615",
"0.67215437",
"0.67052454",
"0.6704496",
"0.67017734",
"0.66693974",
"0.6656135",
"0.6643673",
"0.6595266",
"0.657842",
"0.6559344",
"0.65489066",
"0.65426606",
"0.65409195",
"0.65294635",
"0.65249544",
"0.65053076",
"0.65053076",
"0.6505175",
"0.6505175",
"0.6496085",
"0.64906603",
"0.6489506",
"0.6489506",
"0.6489506",
"0.6489506",
"0.6489328",
"0.6489328",
"0.6477226",
"0.6466694",
"0.6464347",
"0.6464347",
"0.64445823",
"0.6443215",
"0.6431563",
"0.6431525",
"0.6422885",
"0.642057",
"0.642057",
"0.642005",
"0.6418415",
"0.6411425",
"0.6411266",
"0.64025795",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595",
"0.6401595"
]
| 0.7330511 | 1 |
Stores form data that was entered incorrectly | def store_form_data(type,data)
session[type] = data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_values\n self.first_name = @first_name_field.text.strip.chomp\n self.last_name = @last_name_field.text.strip.chomp\n self.email = @email_field.text.strip.chomp\n self.github = @github_field.text.strip.chomp\n self.twitter = @twitter_field.text.strip.chomp\n self.fun_fact = @fun_fact_field.text.strip.chomp\n\n # TODO: 2. Finish the implementation to set the other fields. DONE\n end",
"def save_values\n self.first_name = @first_name_field.text.strip.chomp\n self.last_name = @last_name_field.text.strip.chomp\n self.email = @email_field.text.strip.chomp\n self.github = @github_field.text.strip.chomp\n self.twitter = @twitter_field.text.strip.chomp\n self.fun_fact = @fun_fact_field.text.strip.chomp\n # self.preferred_text_editor = @preferred_text_editor.text.strip.chomp\n # self.teaching_experience = @teaching_experience.text.strip.chomp\n # TODO: 2. Finish the implementation to set the other fields.\n end",
"def save_values\n self.first_name = @first_name_field.text.strip.chomp\n self.last_name = @last_name_field.text.strip.chomp\n self.age = @age.text.strip.chomp\n self.email = @email.text.strip.chomp\n self.github = @github.text.strip.chomp\n self.twitter = @twitter.text.strip.chomp\n self.fun_fact = @fun_fact.text.strip.chomp\n puts self.first_name\n puts self.last_name\n puts self.age\n\n # TODO: 2. Finish the implementation to set the other fields.\n end",
"def form_data?; end",
"def prepare_to_save\n errors.add(:base, :has_already_been_submitted) && (return false) if @already_submitted\n @already_submitted = true\n end",
"def call\n # Can not be both unrecognised and incorrect\n session[SESSION_KEY] = session[SESSION_KEY].except('unrecognised')\n add_fields(incorrect: true)\n end",
"def form_errors\n if respond_to?(:flash)\n flash[:form_errors] ||= {}\n else\n @form_errors ||= {}\n end\n end",
"def form_data=(data)\n @form_data = data if data\n end",
"def validate_form2\n errors = \"\"\n residency_valid = true\n\n # puts \"WE BE VALIDATING #{params[:name]}\"\n # First, clean up any malicious code.\n params[:name] = escape_html(params[:name])\n params[:name_initial] = escape_html(params[:name_initial])\n params[:last_name] = escape_html(params[:last_name])\n params[:mother_last_name] = escape_html(params[:mother_last_name])\n params[:purpose] = escape_html(params[:purpose])\n # params[:birthdate] = escape_html(params[:birthdate])\n params[:birthdate] = params[:birthdate]\n params[:residency_country] = escape_html(params[:residency_country])\n params[:residency_city_state] = escape_html(params[:residency_city_state])\n\n # Store the data so we can show it again in case of\n # errors, using the session.\n session[:name] = params[:name]\n session[:name_initial] = params[:name_initial]\n session[:last_name] = params[:last_name]\n session[:mother_last_name] = params[:mother_last_name]\n session[:purpose] = params[:purpose]\n session[:birthdate] = params[:birthdate]\n session[:residency_country] = params[:residency_country]\n session[:residency_city] = params[:residency_city]\n session[:residency_state] = params[:residency_state]\n\n # Now let's start validation\n if(params[:name].to_s.length == 0 or\n !validate_name(params[\"name\"]))\n errors += \"&name=false\"\n end\n if(params[:name_initial].to_s.length > 0 and\n !validate_name(params[\"name_initial\"]))\n errors += \"&name_initial=false\"\n end\n if(params[:last_name].to_s.length == 0 or\n !validate_name(params[\"last_name\"]))\n errors += \"&last_name=false\"\n end\n # if(params[:mother_last_name].to_s.length == 0 or\n # !validate_name(params[\"mother_last_name\"]))\n # errors += \"&mother_last_name=false\"\n # end\n # maiden name is optional\n if(!validate_name(params[\"mother_last_name\"]))\n errors += \"&mother_last_name=false\"\n end\n if(params[:purpose].to_s.length == 0 or\n !validate_reason(params[\"purpose\"]))\n errors += \"&purpose=false\"\n end\n if(params[:birthdate].to_s.length == 0 or\n !validate_birthdate(params[\"birthdate\"]))\n errors += \"&birthdate=false\"\n end\n\n # check minimum age\n if(params[:birthdate].to_s.length == 0 or\n !validate_birthdate(params[\"birthdate\"], true))\n errors += \"&age=false\"\n end\n\n if(params[:residency_country].to_s.length == 0 or\n !validate_country(params[\"residency_country\"]))\n residency_valid = false\n errors += \"&residency_country=false\"\n end\n\n # if a PR is the country set we proceed\n # to check if we have a municipality set.\n if(residency_valid and params[:residency_country] == \"PR\" and\n !validate_territory(params[:residency_country], params[:residency_city]))\n errors += \"&residency_city=false\"\n end\n\n # if a US is the country set we proceed\n # to check if we have a state set.\n if(residency_valid and params[:residency_country] == \"US\" and\n !validate_territory(params[:residency_country], params[:residency_state]))\n errors += \"&residency_state=false\"\n end\n\n # make sure we deal with any intentional\n # misconfigurations, such as someone playing with\n # html/javascript to submit US as country with PR municipalities\n # etc.\n if(params[:residency_country] == \"US\")\n session[:residency_city] == \"\"\n elsif(params[:residency_country] == \"PR\")\n session[:residency_state] = \"\"\n else\n # otherwise clear it for everything else\n session[:residency_state] = \"\"\n session[:residency_city] = \"\"\n end\n\n # If any errors ocurred, do a redirect:\n if errors.length > 0\n redirect to (\"/form2?errors=true#{errors}\")\n else\n # otherwise, we're good to go on.\n territory = \"\"\n territory += \"#{session[:residency_city]}, \" if session[:residency_city].to_s.length > 0\n territory += \"#{session[:residency_state]}, \" if session[:residency_state].to_s.length > 0\n session[:residence] = \"#{territory}#{session[:residency_country]}\"\n end\nend",
"def invalid\n puts \"Invalid entry, please try again.\"\n end",
"def update_form\n if !active_form.empty?\n session[:active_form_changed?] = false\n session[:active_form_errors] = Hash.new\n session[:active_form_error_flags] = Hash.new\n for field in active_form do\n old_value = field[:value]\n new_value = params[:\"#{field[:name]}\"]\n error = false\n# if old_value != new_value\n# require 'ruby-debug'\n# debugger\n# end\n # do validations\n if field[:required] && new_value == '' && field[:validation] != 'new_password'\n add_error(field[:name], t.u.error_required_field, 'missing')\n error = true\n elsif field[:validation] != nil && new_value != old_value # only validate fields that have changed.\n # we support email[, unique], username[, unique], password or username_or_email validation\n fv = field[:validation]\n case\n when fv.start_with?('email')\n if !validate_email(new_value)\n add_error(field[:name], t.u.error_invalid_email(new_value), 'invalid')\n error = true\n end\n if fv.end_with?('unique') && !validate_email_is_unique(new_value)\n add_error(field[:name], t.u.error_email_clash(new_value), 'unique')\n error = true\n end\n when fv.start_with?('username') && fv != 'username_or_email'\n if !validate_username(new_value)\n add_error(field[:name], t.u.error_invalid_username, 'invalid')\n error = true\n end\n if fv.end_with?('unique') && !validate_username_is_unique(new_value)\n add_error(field[:name], t.u.error_username_clash(new_value), 'unique')\n error = true\n end\n when fv.start_with?('role')\n if !validate_role_name(new_value)\n add_error(field[:name], t.u.error_invalid_role, 'invalid')\n error = true\n end\n if fv.end_with?('unique') && !validate_role_name_is_unique(new_value)\n add_error(field[:name], t.u.error_dupe_role_name(new_value), 'unique')\n error = true\n end\n when fv == 'password'\n if !validate_password(new_value)\n add_error(field[:name], t.u.error_invalid_password, 'invalid')\n error = true\n end \n when fv == 'new_password'\n return true unless new_value != ''\n if !validate_password(new_value)\n add_error(field[:name], t.u.error_invalid_new_password, 'invalid')\n error = true\n end\n when fv == 'username_or_email'\n if !(validate_username(new_value) || validate_email(new_value))\n add_error(field[:name], t.u.error_invalid_username_or_email, 'invalid')\n error = true\n end \n else\n # we don't recognise any other validations right now.\n end\n end\n\n if !error\n # update the field value\n field[:value] = new_value unless field[:type] == 'password' && new_value == ''\n \n # set the changed flag\n session[:active_form_changed?] ||= old_value != new_value\n end\n end\n end\n end",
"def record_data_in_form_fields_entries\n\t\tis_allowed=0\n\n\t\tif (!params.blank? && !params[:new].blank?)\n\t\t\tif params[:signup_form][:email].blank?\n\t\t\t\trender :text => \"<span class=\\\"response_status\\\">Email can't be blank.</span>\", :layout => \"fb_iframe_tab\"\n\t\t\t\treturn\n\t\t\tend\n\t\t\tis_allowed = email_check(params)\n\t\t\t\tlogger.debug \">>>>> is_allowed >>> #{is_allowed.inspect}\"\n\t\t\t\tdata = params[:signup_form][:model_name].constantize.find_by_id(params[:signup_form][:model_id])\n\n\t\t\t\tif !data.blank?\n\t\t\tif is_allowed == 0\n\n \t camp = data.mobile_campaign\n\t\t\t\tif !camp.blank?\n\t\t\t\t\tform_fields = FormField.find_by_model_name_and_model_id_and_campaign_id(params[:signup_form][:model_name],data.id,camp.id)\n\t\t\t\t\tif !form_fields.blank?\n\t\t\t\t\t\tentry = FormFieldEntry.find_by_form_field_id_and_email(form_fields.id,params[:signup_form][:email])\n\t\t\t\t\t\t\tentry_data = Hash.new\n\t\t\t\t\t\t\tparams[:new].each do |k,v|\n\t\t\t\t\t\t\t\tentry_data[k] = v if k != 'data'\n\t\t\t\t\t\t\tend\n#=begin\n\t\t\t\t\t\t\tif !params[:new][:from_id].blank?\n\t\t\t\t\t\t\t\tobj = FormFieldEntry.connection.execute(\"insert into form_field_entries(created_at, updated_at,form_field_id,model_name,model_id,campaign_id,email,entry_data,from_id) values(now(), now(), #{form_fields.id},'#{params[:signup_form][:model_name]}',#{params[:signup_form][:model_id]},#{camp.id},#{FormFieldEntry.sanitize(params[:signup_form][:email])},#{FormFieldEntry.sanitize(entry_data.to_json)},#{params[:new][:from_id]})\")\n\t\t\t\t\t\t\t\tMobileCampaign.connection.execute(\"update mobile_campaigns set leads = leads + 1 where model_name = '#{params[:signup_form][:model_name]}' and model_id = #{params[:signup_form][:model_id]}\")\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tobj = FormFieldEntry.connection.execute(\"insert into form_field_entries(created_at, updated_at,form_field_id,model_name,model_id,campaign_id,email,entry_data) values(now(), now(), #{form_fields.id},'#{params[:signup_form][:model_name]}',#{params[:signup_form][:model_id]},#{camp.id},#{FormFieldEntry.sanitize(params[:signup_form][:email])},#{FormFieldEntry.sanitize(entry_data.to_json)})\")\n\t\t\t\t\t\t\t\tMobileCampaign.connection.execute(\"update mobile_campaigns set leads = leads + 1 where model_name = '#{params[:signup_form][:model_name]}' and model_id = #{params[:signup_form][:model_id]}\")\n\t\t\t\t\t\t\tend\n#=end\n=begin\n\t\t\t\t\t\t\tobj = FormFieldEntry.new\n\t\t\t\t\t\t\tobj.created_at = Time.now\n\t\t\t\t\t\t\tobj.updated_at = Time.now\n\t\t\t\t\t\t\tobj.form_field_id = form_fields.id\n\t\t\t\t\t\t\tobj.model_name = params[:signup_form][:model_name]\n\t\t\t\t\t\t\tobj.model_id = params[:signup_form][:model_id]\n\t\t\t\t\t\t\tobj.campaign_id = camp.id\n\t\t\t\t\t\t\tobj.email = params[:signup_form][:email]\n\t\t\t\t\t\t\tobj.entry_data = FormFieldEntry.sanitize(entry_data.to_json)\n\t\t\t\t\t\t\tif !params[:new][:from_id].blank?\n\t\t\t\t\t\t\t\t\t obj.from_id = params[:new][:from_id]\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tobj.save\n=end\n=begin\n\t\t\t\t\t\t\th= Hash.new\n\t\t\t\t\t\t\th['1'] = 'test'\n\t\t\t\t\t\t\ttest = FormFieldEntry.new(:form_field_id => 2, :model_name => 'MobileCoupon' , :model_id => 3, :campaign_id => 3, :entry_data => '\"#{h.to_json}\"', :email => '[email protected]')\n\t\t\t\t\t\t\t\ttest.save\n=end\n\t\t\t\t\t\t\tif !params[:new][:data].blank?\n \t\t\tentry = FormFieldEntry.find_all_by_model_name_and_model_id(params[:signup_form][:model_name],params[:signup_form][:model_id])\n\t\t\t if !entry.blank?\n \t\t\t entry = entry.last\n\t \t\t entry.update_attribute(:data, params[:new][:data])\n \t\t\t end\n \t\t\t end\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tend\n\t\t\tif !params[:signup_form].blank? && !params[:signup_form][:model_name].blank? && params[:signup_form][:model_name] == \"MobileCoupon\"\n\t\t\t\trender :partial => \"/mobile/coupon/coupon\", :locals =>{:data => data, :message => is_allowed} , :layout => false\n\t\t\treturn\n\t\t\telse\n\t\t render :text => \"<span class=\\\"response_status\\\">Submission Successful!!</span>\", :layout => false\n\t \tend\n\t\tend\n return\n\tend",
"def save_form(values)\n mp values\n persist\n\n back_to_previous_screen\n end",
"def update_errors\n @errors = []\n @errors << 'One of the cards needs attention' unless cards.all?(&:valid?)\n if email\n @errors << 'Email is not in correct format' unless email_well_formed?\n else\n @errors << 'Email is a required field'\n end\n @errors << 'Wallet token is a required field' unless wallet_token\n @errors\n end",
"def spoofForm(val)\n @deltaflag = false\n @form = val\n end",
"def save_data\r\n form_fields = fields_on_form()\r\n return true if form_fields.size == 0\r\n\r\n form_fields.each do |v|\r\n session[:form_processing] = v['name'] # for debuging\r\n next if v['type'].nil? or v['name'].nil? or\r\n v['type'].match('embedded') or # don't wipe embedded types\r\n (params[:edit_only] and params[:edit_only] != v['name']) or # otherwise other fields would be wiped\r\n v['readonly'] or # fields with readonly option don't return value and would be wiped\r\n [email protected]_to?(v['name']) # there are temporary fields on the form\r\n # good to know! How to get type of field @record.fields[v['name']].type\r\n # return value from form field definition\r\n value = DrgcmsFormFields.const_get(v['type'].camelize).get_data(params, v['name'])\r\n @record.send(\"#{v['name']}=\", value)\r\n end\r\n\r\n # before_save callback\r\n if (m = callback_method('before_save') )\r\n ret = call_callback_method(m)\r\n # don't save if callback returns false\r\n return false if ret.class == FalseClass\r\n end\r\n\r\n # save data\r\n changes = @record.changes\r\n update_standards() if changes.size > 0 # update only if there has been some changes\r\n if (saved = @record.save)\r\n operation = @record.new_record? ? :new : :update\r\n save_journal(operation, @record.previous_changes)\r\n # after_save callback\r\n if (m = callback_method('after_save') ) then call_callback_method(m) end\r\n end\r\n saved\r\nend",
"def form_error(name, message)\n if respond_to?(:flash)\n old = flash[:form_errors] || {}\n flash[:form_errors] = old.merge(name.to_s => message.to_s)\n else\n form_errors[name.to_s] = message.to_s\n end\n end",
"def step_validation\n step_index = form_steps[:pages].index(form_step)\n\n if self.form_steps[:pages].index('title') <= step_index\n self.errors['name'] << 'You must enter a name for the dataset' if self.name.blank? || self.name.strip.blank?\n end\n\n if self.form_steps[:pages].index('connector') <= step_index\n self.errors['type'] << 'You must enter a connector type' unless CONNECTOR_TYPES.include? self.type\n self.errors['provider'] << 'You must enter a connector provider' unless CONNECTOR_PROVIDERS.include? self.provider\n self.errors['connector_url'] << 'You must enter a valid url' \\\n unless self.connector_url && !self.connector_url.blank? && valid_url?(self.connector_url)\n end\n\n if self.form_steps[:pages].index('labels') <= step_index\n unless self.legend && self.legend.is_a?(Hash)\n self.errors['legend'] << 'Labels not correctly defined'\n return\n end\n self.errors['legend'] << 'Latitude and Longitude have to be filled together' if\n self.legend[:lat].blank? ^ self.legend[:long].blank?\n self.errors['legend'] << 'Country and Region have to be filled together' if\n self.legend[:country].blank? ^ self.legend[:region].blank?\n end\n end",
"def set_errors\n @errors = []\n\n if self.name == nil || self.name == \"\"\n @errors << \"Name cannot be blank.\"\n end\n if self.username == nil || self.username == \"\"\n @errors << \"Username cannot be blank.\"\n end\n if self.email == nil || self.email == \"\"\n @errors << \"Email cannot be blank.\"\n end\n if self.password == nil || self.password == \"\"\n @errors << \"Password cannot be blank.\"\n end\n if self.budget == nil || self.budget == \"\"\n @errors << \"Budget cannot be blank.\"\n end\n end",
"def sanitize_input\n\t\t# to remove whitespace, use \n\t\t# self.<fieldname>.strip!\n\t\tself.homephone = self.homephone.gsub(/\\D/,'') if !self.homephone.blank?\n\t\tself.workphone = self.workphone.gsub(/\\D/,'') if !self.workphone.blank?\n\t\tself.cellphone = self.cellphone.gsub(/\\D/,'') if !self.cellphone.blank?\n\t\tself.fax = self.fax.gsub(/\\D/,'') if !self.fax.blank?\n\t\tself.prefcontactmethod = :Email if self.prefcontactmethod.blank?\n #\t\tself.email = self.email.downcase if self.email.present?\n\tend",
"def save\n perform_mapping\n unless self.errors[:data].present?\n self.record.save\n end\n end",
"def error_update(err)\n session[\"errorSubject\"] = err\n session[:oldAll] = params[:subject]\n redirect_to subject_path(@subject, :q => @q)\n end",
"def handle_inputs\n collect_inputs(form_model: :post)\n\n if state.post.has_errors?\n set_state post: state.post\n else\n state.post.create.then do |post|\n if post.has_errors?\n set_state post: post\n else\n $HISTORY.pushState(nil, \"/posts/#{post.id}\")\n end\n end\n end\n end",
"def save_form_fields\n @save_form_fields ||= collect_save_form_fields\n end",
"def validate_form(formdata: {})\n errtxt = nil\n begin\n if nil == formdata[COMMITTERID]\n errtxt = \"ERROR: Bogus submission, no COMMITTERID\"\n elsif ('' == formdata[JIRAHAS]) || ('' == formdata[CONFLUENCEHAS])\n errtxt = \"ERROR: You must answer Yes/No if you have JIRA or Confluence IDs\"\n elsif (formdata[JIRAHAS] =~ /(y|m)/) && ('' == formdata[JIRA])\n errtxt = \"ERROR: You must provide your JIRA ID\"\n elsif (formdata[CONFLUENCEHAS] =~ /(y|m)/) && ('' == formdata[CONFLUENCE])\n errtxt = \"ERROR: You must provide your Confluence ID\"\n elsif (formdata[JIRAHAS] =~ /n/) && ('' != formdata[JIRA])\n errtxt = \"ERROR: Do not provide JIRA ID if you answered No\"\n elsif (formdata[CONFLUENCEHAS] =~ /n/) && ('' != formdata[CONFLUENCE])\n errtxt = \"ERROR: Do not provide Confluence ID if you answered No\"\n end\n rescue StandardError => e\n errtxt = \"ERROR: validate_form threw: #{e}\"\n end\n if errtxt\n _div.alert.alert_danger role: 'alert' do\n _h4 errtxt\n end\n return false\n else\n return true\n end\nend",
"def edit_email\n @errors = {}\n end",
"def save\n !update_case.has_key?(\"error\")\n end",
"def sanitize_form_data_hash\n super.merge(account_email: user.email)\n end",
"def update_errors\n @errors = []\n @errors << 'Expiration date is a required field' unless expiration_date\n @errors << 'Expiration Date is not a valid date' unless expiration_date.is_a? Date\n @errors << 'Card type is a required field' unless card_type\n @errors << 'Card type is not supported' unless check_card_type\n @errors << 'Card number is not valid' unless card_number_valid?\n @errors\n end",
"def store_validations #:nodoc:\n return if @validations.size == 0\n\n @validations.each do |param|\n store_dv(\n param[:cells],\n param[:validate],\n param[:criteria],\n param[:value],\n param[:maximum],\n param[:input_title],\n param[:input_message],\n param[:error_title],\n param[:error_message],\n param[:error_type],\n param[:ignore_blank],\n param[:dropdown],\n param[:show_input],\n param[:show_error]\n )\n end\n end",
"def process_form(entry)\n\t\t# set flag variable\n\t\t@@processed = true\n\t\t# check for inclusion of ||\n\t\tif(entry.include?\"||\")\n\t\t\t# get form\n\t\t\t@@form = getForm(entry)\n\t\t\t# split by ||\n\t\t\tins = entry.split(\"||\")\n\t\t\t# get user input\n\t\t\t@@last = ins[1]\n\t\telse\n\t\t\t# change flag\n\t\t\t@@processed = false\n\t\t\t# specify error format\n\t\t\tputs \"You must specify a form in this format: 1||message\"\n\t\tend\n\tend",
"def validate_fields\n %w[email author].each do |field|\n value = self.send(field)\n abort \"Hoe #{field} value not set. aborting\" if value.nil? or value.empty?\n end\n end",
"def set_errors\n \t@errors = []\n\n \tif self.title == \"\"\n \t@errors << \"Title cannot be blank\"\n \tend\n\n if self.user_id == nil\n @errors << \"Must assign to a user\"\n end\n\n if self.category_id == nil\n @errors << \"Must assign to a category\"\n end\n \tend",
"def error_create(err)\n session[\"errorSubject\"] = err\n session[:oldAll] = params[:subject]\n redirect_to new_subject_path(:q => @q)\n end",
"def securityquestion_submit\n @securityhash = Hash.new()\n @securityhash[:security_answer] = BCrypt::Engine.hash_secret( user_params[:security_answer], @user[:salt])\n @securityhash[:security_question] = user_params[:security_question]\n if @user.update_attributes( @securityhash)\n flash[:notice] = \"Succeessfully Updated Your Security Question and Answer\"\n redirect_to(profile_user_path (@user))\n else\n flash[:error] = \"Could not save your security question and answer. Please try again\"\n puts @user.errors.inspect\n redirect_to securityquestion_user_path(@user)\n end\n end",
"def validate_lifeform\n words = lifeform.to_s.split.sort.uniq\n self.lifeform = words.any? ? \" #{words.join(\" \")} \" : \" \"\n unknown_words = words - ALL_LIFEFORMS\n return unless unknown_words.any?\n\n unknown_words = unknown_words.map(&:inspect).join(\", \")\n errors.add(:lifeform, :validate_invalid_lifeform.t(words: unknown_words))\n end",
"def preprocess_school_info(school_info_attr)\n # Suppress validation - all parts of this form are optional when accesssed through the registration form\n school_info_attr[:validation_type] = SchoolInfo::VALIDATION_NONE unless school_info_attr.nil?\n # students are never asked to fill out this data, so silently reject it for them\n student? || deduplicate_school_info(school_info_attr, self)\n end",
"def input_invalid_username\n fill_in(USERNAME_INPUT_ID, :with => 'Ruben12ddf')\n end",
"def incorrect_dates\n flash[:notice] = 'The dates you have entered are the wrong way around! Please try again.'\n redirect_back(fallback_location: root_path)\n end",
"def char_form_error(field)\n case field\n when :supername\n \"!! Must be between 3-25 characters.\" if [email protected][:supername].empty?\n when :secret_identity\n \"!! Must be between 3-50 characters.\" if [email protected][:secret_identity].empty?\n when :char_type\n \"!! Please choose a character type.\" if [email protected][:char_type].empty?\n when :alignment\n \"!! #{@char.errors[:alignment][0]}\" if [email protected][:alignment].empty?\n when :hp\n \"!! #{@char.errors[:hp][0]}\" if [email protected][:hp].empty?\n when :bio\n \"!! Bio is too long - max length: 400 characters. You have used #{@char.bio.length}/400 characters.\" if [email protected][:bio].empty?\n end\n end",
"def validate\r\n self.variables.each do |key, value|\r\n self.errors.add(\r\n :variables,\r\n \"<tt>#{key}</tt> can't be blank\"\r\n ) if value.blank?\r\n end\r\n end",
"def check_if_input_is_valid\n if params[:user] && warn_for_special_chars(params[:user][:name], 'Username')\n flash[:error] = 'Please enter valid user name'\n redirect_back fallback_location: root_path\n elsif params[:impersonate] && warn_for_special_chars(params[:impersonate][:name], 'Username')\n flash[:error] = 'Please enter valid user name'\n redirect_back fallback_location: root_path\n end\n end",
"def form_data\n @form_data ||= {\n \"c\" => [\"China\", \"Venezuela\", \"Brazil\", \"United States\", \"Thailand\", \"Ukraine\", \"Indonesia\", \"Nepal\", \"Russian Federation\", \"Argentina\", \"Czech Republic\", \"Korea, Republic of\", \"Colombia\", \"France\", \"Bangladesh\", \"Ghana\", \"Peru\", \"Slovakia\", \"Taiwan\", \"Hong Kong\", \"Taiwan\", \"Bulgaria\", \"Canada\", \"Netherlands\", \"Bolivia\", \"Serbia\", \"Azerbaijan\", \"Costa Rica\", \"Viet Nam\", \"Germany\", \"South Africa\", \"Iraq\", \"Italy\", \"Egypt\", \"Poland\", \"Chile\", \"Paraguay\", \"Australia\", \"Hungary\", \"Cambodia\", \"Europe\"],\n \"p\" => nil,\n \"pr\" => [0],\n \"a\" => [2,3,4],\n \"sp\" => [2,3],\n \"ct\" => [2,3],\n \"s\" => 0,\n \"o\" => 0,\n \"pp\" => 2,\n \"sortBy\" => \"date\"\n }\n end",
"def validate_before_update\n self.errors.clear\n if @password.blank?\n self.errors.add :password, \"This is a required field.\"\n else\n self.errors.add :password, \"Must be 6-32 characters.\" unless (6..32).include?(@password.length) unless self.errors.any? \n self.errors.add :password, \"Cannot be same as username.\" if @password == self.username unless self.errors.any? # i don't think this works. -amlw\n self.errors.add :password, \"Cannot contain spaces.\" if @password =~ /\\s/ unless self.errors.any? \n end\n self.errors.add :answer, 'Your Security Question answer is incorrect.' unless validate_answer(@answer) or self.errors.any?\n end",
"def validate_and_save(success_message, failure_template)\n unless @form.valid?\n render failure_template\n return\n end\n\n @form.save\n\n redirect_to index_path, :notice => success_message\n end",
"def validate(variables)\n form\tif @_content.empty? # password fields might write hints to the validator...\n clear\n @form_errors = {}\n p = variables\n p.delete(@submit_name)\n \n if @model.new_record? then \n @disabled_on_create.each { |d| p.delete(d) }\n @hidden_on_create.each { |d| p.delete(d) }\n else \n @disabled_on_update.each { |d| p.delete(d) }\n @hidden_on_update.each { |d| p.delete(d) }\n end\n\n # don't save empty passwords!!\n @password_fields ||= []\n @password_fields.each do |pwf|\n p.delete(pwf) if p[pwf].chomp.empty?\n end\n\n # remove possible additional data that model doesn't support to\n# p.delete_if { |k,v| [email protected]_to?(\"#{k}=\") }\n\n column_names = @model.class.columns.map { |c| c.name }\n p.each do |k,v|\n @model.send(\"#{k}=\".intern, v) if (column_names.include?(k) && @model.respond_to?(\"#{k}=\")) || @save_attribs.include?(k)\n end\n # @model.attributes = p\n \n return true if @model.valid?\n\n @model.errors.each do |k,v|\n @form_errors[k] = v\n end\n end",
"def get_form_vars\n @sm = @edit[:sm_id] ? StorageManager.find_by_id(@edit[:sm_id]) : StorageManager.new\n\n @edit[:new][:name] = params[:name] if params[:name]\n @edit[:new][:hostname] = params[:hostname] if params[:hostname]\n @edit[:new][:ipaddress] = params[:ipaddress] if params[:ipaddress]\n @edit[:new][:port] = params[:port] if params[:port]\n @edit[:new][:sm_type] = params[:sm_type] if params[:sm_type]\n # @edit[:new][:agent_type] = params[:agent_typ] if params[:agent_typ]\n @edit[:new][:zone] = params[:server_zone] if params[:server_zone]\n\n @edit[:new][:userid] = params[:userid] if params[:userid]\n @edit[:new][:password] = params[:password] if params[:password]\n @edit[:new][:verify] = params[:verify] if params[:verify]\n restore_password if params[:restore_password]\n set_verify_status\n end",
"def fill_out_form(hash)\n self.institution=hash[:institution]\n self.department=hash[:department]\n self.title_role=hash[:title]\n self.email=hash[:email]\n self.instant_messaging=hash[:im]\n self.phone=hash[:phone]\n self.mobile=hash[:mobile]\n self.fax=hash[:fax]\n self.address=hash[:address]\n self.city=hash[:city]\n self.state=hash[:state]\n self.postal_code=hash[:zip]\n self.country=hash[:country]\n end",
"def save(*args)\n \tsuper\n \t\trescue ActiveRecord::RecordNotUnique => error\n \t\terrors[:base] << \"Please select Different preferences\"\n \t\tfalse\n \t\tend",
"def set_error(error)\n session[:error] = error\nend",
"def validation_of_user_input(name, cohort, city, hobby)\n\n if !name.empty? && ( !cohort.empty? && @months.include?(\"#{cohort}\")) && !city.empty? && !hobby.empty?\n single_student = {month: \"#{cohort}\", name: name, city: city, hobby: hobby}\n @students << single_student\n list_or_continue_prompt\n elsif [email protected]?(\"#{cohort}\") && !name.empty? && !cohort.empty? && !city.empty? && !hobby.empty?\n puts \"You did´t enter a valid month, please try again!\\n\\n\"\n put_in_user\n#prompt when u haven´t entered all information, calls put_in_user\n else name.empty? && cohort.empty? && city.empty? && hobby.empty?\n puts \"Please fill in all fields\\n!\"\n list_or_continue_prompt\n end\nend",
"def check_against_input_for_specials(data)\r\n @field_names[1..-1].each do |f|\r\n raise(ArgumentError,\r\n 'You cannot input a value for this field: %s' % f) if \\\r\n @field_extras[@field_names.index(f)].has_key?('Calculated') \\\r\n or @field_extras[@field_names.index(f)].has_key?('Link_many') \\\r\n and not data[f].nil? \r\n end\r\n end",
"def save_finish_registration\n if current_user.update(params.require(:user).permit(:birthdate, :biography, :sex, :phone_number, :country, :country_code).merge(is_newbie: false))\n extract_hash_tags_from_params\n flash['notice_persist'] = \"Hello #{current_user.full_name}, welcome to our community. Please check your inbox.\"\n redirect_to news_feed_dashboard_users_path\n else\n render 'finish_registration'\n end\n end",
"def process_form(formdata: {}, wunderbar: {})\n statement = formdata['statement']\n\n _h3 'Copy of statement to put in an email (if necessary)'\n _pre statement\n\n _hr\n\n _h3 'Transcript of update to nomination file'\n uid = formdata['availid']\n entry = ASF::MemberFiles.make_member_nomination({\n availid: uid,\n nomby: $USER,\n secby: formdata['secby'],\n statement: statement\n })\n\n environ = Struct.new(:user, :password).new($USER, $PASSWORD)\n ASF::MemberFiles.update_member_nominees(environ, wunderbar, [entry], \"+= #{uid}\")\n return true\nend",
"def validate_form1\n errors = \"\"\n\n # First, clean up any malicious code.\n params[:form] = escape_html(params[:form])\n params[:dtop_id] = escape_html(params[:dtop_id])\n params[:ssn] = escape_html(params[:ssn])\n params[:passport] = escape_html(params[:passport])\n\n # Store the data so we can show it again in case of\n # errors, using the session.\n session[:form] = params[:form]\n session[:dtop_id] = params[:dtop_id]\n session[:ssn] = params[:ssn]\n session[:passport] = params[:passport]\n\n # perform server side validation of form1 data.\n # If the user selected to identify\n # using a dtop id or driver license:\n if(params[:form].to_s == \"dtop\" or params[:form].to_s == \"license\")\n if(params[:dtop_id].to_s.length == 0 or\n !validate_dtop_id(params[:dtop_id]))\n errors += \"&license=false\"\n end\n if(params[:ssn].to_s.length == 0 or\n !validate_ssn(params[:ssn]))\n errors += \"&ssn=false\"\n end\n # If the user selected to identify using\n # a passport:\n elsif(params[:form] == \"passport\")\n # if pass port number cannot be validated\n # later add password number validation\n # Normally passwords are 9 digits long, but\n # that could vary through countries. Let's\n # put a a limit on 20 for now.\n if(!validate_passport(params[:passport]))\n errors += \"&passport=false\"\n end\n # The user chose an unknown form type\n else\n errors += \"&invalid_form=true\"\n end\n\n # If any errors ocurred, do a redirect:\n redirect to (\"/form?errors=true#{errors}&form=#{params[:form]}\") if errors.length > 0\nend",
"def bindPostToExpirance\r\n errors ||= Array.new\r\n if params[:id].blank? ||params[:id].is_int\r\n errors.push(I18n.t(\"errors.messages.element_not_id\"))\r\n end\r\n if params[:ue_id].blank? ||params[:ue_id].is_int\r\n errors.push(I18n.t(\"errors.messages.element_not_id\"))\r\n end\r\n if params[:feeling_id].blank? ||params[:feeling_id].is_int\r\n errors.push(I18n.t(\"errors.messages.element_not_id\"))\r\n end\r\n if errors.length == 0 \r\n self.default_response\r\n else\r\n render :json => Api::Init.ShowErrorJson(API_CODE_ERRORS['Services']['Global']['formInputError'],I18n.t(\"errors.messages.feelike.input_error\"), errors).to_json\r\n end\r\n end",
"def validate_input\n\t\tif params['homepage']['email'].present? && params['homepage']['password'].present?\n\t\t\ttrue\n\t\telse\n\t\t\tflash.now[:danger] = 'Some fields are not filled properly'\n\t\t\trender 'index'\n\t\t\tfalse\n\t\tend\n\tend",
"def store_invalid_record(record)\n return unless InvalidRecord.table_exists?\n\n invalid_record = InvalidRecord.where(record: record).first\n invalid_record ||= InvalidRecord.new\n invalid_record.record = record\n invalid_record.validation_errors = record.errors.messages\n invalid_record.save!\n end",
"def invalid_message\r\n @invalid_message ||= 'Please enter Yes or No.'\r\n end",
"def save_form_data_to_database\n db = get_db\n db.execute 'INSERT INTO Messages (username, phone, email, option, comment)\n VALUES (?, ?, ?, ?, ?)', [@username, @phone, @email, @option, @comment]\n db.close\nend",
"def validate_form(formdata: {})\n uid = formdata['availid']\n chk = ASF::Person[uid]&.asf_member?\n chk.nil? and return \"Invalid availid: #{uid}\"\n chk and return \"Already a member: #{uid}\"\n already = ASF::MemberFiles.member_nominees\n return \"Already nominated: #{uid} by #{already[uid]['Nominated by']}\" if already.include? uid\n return 'OK'\nend",
"def fill_all_form_data()\n if verbose_messages\n p @fillable_form_fields\n p @current_page_data_object\n end\n\n @fillable_form_fields.each do |field|\n value = @current_page_data_object.retrieve_data_for(field)\n enter_element_value(field, value) if value and (value != \"nil\")\n end\n end",
"def after_form #:nodoc:\n params = self.params\n #cb_error \"Some error occurred.\"\n \"\"\n end",
"def save_form(form_name, params, keys, errors)\n form = {}\n keys.each do |k|\n form[k] = FormField.new(params[k], false)\n end\n\n errors.each do |e|\n form[e.attribute.to_sym].error = true\n end\n\n form_name = ('saved_form_' + form_name.to_s).to_sym\n @_env['rack.session'][form_name] = form\n end",
"def published_error(previous_entry)\n previous_entry.error = true\n previous_entry.complete = false\n previous_entry.current_status = 'Update Rejected'\n previous_entry.error_message = 'Cannot update this item, it has already been published.'\n previous_entry.save\n end",
"def add_field\n if request.get?\n @info = Hash.new\n @field_hash = Hash.new\n session[:count] = 1\n else\n @fields = []\n @field_hash = Hash.new\n session[:field_hash] = @field_hash\n form = DynamicForm.find(session[:form_id])\n @info = params[:info]\n if form.fields == \"To be Filled\"\n logger.info 'FIELDS TO BE FILLED'\n form.fields = {}\n else\n @fields = YAML::load(form.fields)\n logger.info \"Loading YAML {line 92}\"\n end \n @fields << @info\n form.fields = @fields.to_yaml\n form.save\n logger.info \"Returned: #{@info}\"\n redirect_to :action => 'add_fields'\n end\n end",
"def validate_signup(posted)\n errors = validate_required(posted, ['email', 'password'])\n email = posted['email']\n password = posted['password']\n\n errors['email'] ||= error_for_email(dealer_dao, email)\n errors['password'] ||= error_for_passwords(password, posted['password_confirm'])\n\n if (posted['agree_terms'].nil?)\n errors['agree_terms'] = \"You must agree to Terms & Conditions.\"\n end\n\n if (posted['stripeToken'].nil? || posted['stripeToken'].empty?)\n errors['stripeToken'] = \"Your card wasn't accepted.\"\n end\n\n errors.delete_if { |k,v| v.nil? }\n end",
"def invalid_data\n {\n :title => \"\",\n :description => nil,\n :parent_id => \"ss\"\n } \n end",
"def adjust_errors(form_errors)\n form_errors.each do |e|\n case e[:failed_attribute]\n when 'Required'\n e[:message].gsub!(\"The property '#/'\", 'The request')\n end\n e[:message].gsub!(\"The property '#/\", \"The property '\")\n e[:message] = e[:message][/.+?(?= in schema)/]\n end\n end",
"def add_validation_errors(value); end",
"def create\n\nif params[:commit] == \"survey\" then\n @value = params[:opinion]\n @opinion = current_user.opinions.new\n @opinion.question_id = @value[:question].to_i\n @opinion.save\n redirect_to(home_path(:question => @opinion.question_id))\nelse\n did_save = false\n @bp = current_user.bps.new(params[:bp])\n @measurement = current_user.measurements.new(params[:measurement])\n @food = current_user.foods.new(params[:foods])\n @sleep = current_user.sleeps.new(params[:sleep])\n \n # flash[:notice] = \"\"\n if [email protected]? && [email protected]? then \n did_save = @bp.save \n flash[:notice] =\"Records updated.\"\n end\n\n if @sleep.started_at != @sleep.woke_up_at then \n did_save = @sleep.save \n flash[:notice] =\"Records updated.\"\n end\n\n if !( @measurement.water_percent.blank? && @measurement.muscle_percent.blank? && @measurement.chest.blank? && @measurement.weight.blank? && @measurement.visceral_fat.blank? && @measurement.bicep.blank? && @measurement.belly.blank? && @measurement.hip.blank? && @measurement.thigh.blank? && @measurement.resting_metabolism.blank? && @measurement.fat_percent.blank? && @measurement.comment.blank? ) then\n did_save = @measurement.save\n flash[:notice] = \"Records updated.\"\n end\n\n if !(@food.name.blank? &&\n # @food.complex_carbs.blank? &&\n # @food.monounsaturated_fats.blank? &&\n # @food.category.blank? &&\n # @food.subcategory.blank? &&\n # @food.fiber.blank? &&\n # @food.simple_carbs.blank? &&\n @food.meal.blank? &&\n # @food.protein.blank? &&\n #@food.saturated_fats.blank? &&\n #@food.comment.blank? &&\n #@food.polyunsaturated_fats.blank? &&\n @food.calories_per_serving.blank? ) then \n did_save = @food.save\n flash[:notice] = \"Records updated\"\n end\n\n\n\n unless did_save then\n flash[:notice] = \"There were no updates, please fill out the required data and submit again.\"\n end \n \n redirect_to(home_path) \n\nend \n\nend",
"def save_additional_data\n end",
"def change_designation\n if params[:name] == \"\"\n update_old_data('change_job_title','disp_job_title',@user.designation)\n else\n @user.designation = params[:name]\n @user.ignore_password = true\n show_profile_err('emsg_designation',@user.errors['designation']) unless @user.save\n end\nend",
"def validate\n if !new_record? && current?\n errors.add('contact_name', 'Please provide a contact name for your enquiry') unless contact_name.present?\n errors.add('contact_phone', 'Please provide a phone number where we may contact you at about your enquiry') unless contact_phone.present?\n end\n end",
"def validate_billing_info\n errors = super.merge(validate_required(posted, ['password']))\n errors['password'] ||= error_for_passwords(posted['password'], posted['password_confirm'])\n errors.delete_if { |k,v| v.nil? }\n end",
"def validate_signup(posted)\n errors = validate_required(posted, ['email'])\n email = posted['email']\n\n errors['email'] ||= error_for_email(dealer_dao, email)\n if / is already taken.\\Z/.match(errors['email'])\n errors['email'] = nil\n end\n\n if (posted['agree_terms'].nil?)\n errors['agree_terms'] = \"You must agree to Terms & Conditions.\"\n end\n\n errors.delete_if { |k,v| v.nil? }\n end",
"def clean_error\n @error = nil\n @error_description = nil\n @error_attribute = nil\n end",
"def update\n current_user_id = cookies[:user_id]\n @current_trip = Trips.find(params[ :id ])\n @destination = params[ :required_destination]\n @location = params[ :required_location ]\n @travel_date = params[ :required_traveldate]\n @max_weight = params[ :required_num_weight ]\n data_validated = true\n if (@destination.length == 0 or !(@destination =~ /\\S/) or @location.length == 0 or !(@location =~ /\\S/) or @max_weight == nil or !(@max_weight =~ /\\S/) or @travel_date == nil or !(@travel_date =~ /\\S/) or !(is_numeric(@max_weight)))\n data_validated = false\n end\n if (@destination.length == 0 or !(@destination =~ /\\S/) or @location.length == 0 or !(@location =~ /\\S/) or @max_weight == nil or !(@max_weight =~ /\\S/) or @travel_date == nil or !(@travel_date =~ /\\S/))\n flash[:notice] = \"one or more inputs are not entered, please enter everything correctly and try again\" \n redirect_to(:action => 'edit', :id => @current_trip.id)\n elsif (!(is_numeric(@max_weight)))\n flash[:notice] = \"weight should be an integer\"\n redirect_to(:action => 'edit', :id => @current_trip.id)\n else\n Trips.edit_the_trip(@current_trip,@destination,@location,@max_weight,@travel_date,current_user_id)\n notification (current_user_id)\n flash[:notice] = \"your trip was successfully edited\" \n redirect_to(:action => 'index')\n end\n end",
"def submit\n if(session[:user_id] != nil)\n user = User.find_by_id(session[:user_id])\n \n user.update({\n email: params[:user][:email],\n zipcode: params[:user][:zipcode],\n bio: params[:user][:bio]\n })\n \n if user.errors.any?\n flash[:warning] = user.errors.full_messages.uniq\n redirect_to profile_edit_path and return\n else\n user.save!\n end\n \n redirect_to profile_path\n else\n redirect_to login_path\n end\n end",
"def sanitize_attributes!\n remove_invalid_subjects!\n remove_invalid_audiences!\n remove_invalid_levels!\n set_prices!\n nil\n end",
"def valid?\n validate_field_types\n # only do a database query if you have good enough data to check the database\n if @errors.length == 0\n if duplicate_user_assignment?\n @errors << \n {message: \n \"The database already has this user and assignment combination. It is record \n #{this_user_and_assignment.id}. Change this assignment or user or the assignment or user of that record.\", \n variabe: \"assignment_id, user_id\"}\n end\n end \n @errors.length == 0\n end",
"def sanitize_data\n sanitize_name\n sanitize_city\n sanitize_zip_code\n sanitize_address\n end",
"def sanitize_data\n sanitize_name\n sanitize_city\n sanitize_zip_code\n sanitize_address\n end",
"def check_for_nulls\n# if self.name.nil? && self.dynamic_type_id.nil?\n# flash[:notice] = \"You must fill in something !\"\n if self.dynamic_type_id.nil?\n self.dynamic_type_id = 3\n end\n if self.name.nil?\n self.name = \"please enter a name\"\n end\n# end\n end",
"def save_field_changes\n frm.button(:value=>\"Save Field Changes\").click\n if frm.div(:class=>\"alertMessage\").exist?\n AddEditFields.new(@browser)\n elsif frm.button(:value=>\"Back to Calendar\").exist?\n EventDetail.new(@browser)\n else\n Calendar.new(@browser)\n end\n end",
"def extra_validations\n success\n end",
"def displayinvalidinputerror\r\n\t\t\[email protected]('Invalid input.')\r\n\t\tend",
"def save\n import\n errors.none?\n end",
"def save\n valid?\n end",
"def validate_field_without_promotion\n return unless @designation_history.prev_designation_id.nil?\n begin\n if (@designation_history.new_designation_id != params[:designation_id].to_i) and (@designation_history.applicable_from == params[:designation_history][:applicable_from].to_date)\n flash.now[:error]= l(:designation_not_update_error)\n elsif (@designation_history.applicable_from != params[:designation_history][:applicable_from].to_date) and (@designation_history.new_designation_id == params[:designation_id].to_i)\n flash.now[:error] = l(:desgination_applicable_from_error)\n end\n rescue\n flash.now[:error] = l(:proper_date_error_message)\n end \n render 'systango_hrm_employees/edit' unless flash.now[:error].blank?\n end",
"def check_values(entry_hash)\n flag = 0\n feedback = \"\"\n detail = \"\"\n flag = 1 if duplicate_entry?(entry_hash)\n entry_hash.each do |column, value|\n flag = 2 if column == \"fname\" && value.length < 2\n flag = 3 if column == \"lname\" && value.length < 2\n flag = 4 if column == \"addr\" && value.split(\" \").length < 3\n (flag = 5; detail = column) if column =~ /fname|lname|addr/ && value.length > 50\n (flag = 5; detail = column) if column == \"city\" && value.length > 25\n flag = 6 if column == \"city\" && value.length < 2\n flag = 7 if column == \"zip\" && value.length != 5\n (flag = 8; detail = column) if column =~ /mobile|home|work/ && value.length.to_s !~ /0|10/\n flag = 9 if column == \"state\" && (!state_array.include? value.upcase)\n flag = 10 if column =~ /fname|lname/ && value =~ /[^a-zA-Z.\\- ]/\n flag = 11 if column == \"addr\" && value =~ /[^0-9a-zA-z.\\- ]/\n flag = 12 if column == \"city\" && value =~ /[^a-zA-Z.\\- ]/\n (flag = 13; detail = column) if column =~ /zip|mobile|home|work/ && value =~ /[^0-9]/\n end\n case flag\n when 1 then feedback = \"That entry already exists - please enter details for another entry.\"\n when 2 then feedback = \"The first name is too short - please enter at least two letters for the first name.\"\n when 3 then feedback = \"The last name is too short - please enter at least two letters for the last name.\"\n when 4 then feedback = \"Please specify a house number and a street name for the address.\"\n when 5 then feedback = \"The value for '#{detail}' is too long - please use a shorter value.\"\n when 6 then feedback = \"The city name is too short - please enter at least two letters for the city name.\"\n when 7 then feedback = \"Please enter five digits for the zip code.\"\n when 8 then feedback = \"Please enter ten digits for the #{detail} phone number.\"\n when 9 then feedback = \"Please use a valid two-letter abbreviation for the state name.\"\n when 10 then feedback = \"The name should only contain letters, hyphens or periods.\"\n when 11 then feedback = \"The street address should only contain numbers, letters, hyphens or periods.\"\n when 12 then feedback = \"The city name should only contain letters, hyphens or periods.\"\n when 13 then feedback = \"The value for '#{detail}' should only have numbers.\"\n end\n return feedback\nend",
"def test_invalidinput2\n @driver.navigate.to(@url)\n element = @driver.find_element(:id,'entry_1041466219')\n element.send_keys(\"Michael\") # Valid value for question 1\n element.submit # Submit without valid input for question 2\n elementError = @driver.find_element(:xpath,\"//form[@id='ss-form']/ol/div[2]/div/div/div[@class='required-message']\")\n assert_equal(elementError.text,\"This is a required question\") # Check if error message for question 2 shows up\n end",
"def validate\r\n @invalid=false\r\n end",
"def add_data\n\n if (!logged_in?)\n render_error(422)\n return\n end\n\n ext = current_user\n if (ext == nil)\n render_error(500)\n end\n\n if (ext.lastEntryTime + neccessaryEntryDelay > currentUnixTime)\n render_error(403)\n return\n end\n\n mood = Mood::new\n\n begin\n mood.userid = current_user.id;\n mood.city = params[:city]\n mood.mood = Integer(params[:mood])\n mood.sleep = Float(params[:sleep])\n mood.exercise = Float(params[:exercise])\n mood.overcast = OpenWeather::get_weather_data_for_city(mood.city).clouds\n\n keep_city = params[:keep_city] == \"1\"\n keep_sleep = params[:keep_sleep] == \"1\"\n keep_exercise = params[:keep_exercise] == \"1\"\n\n rescue Exception => e\n puts(e)\n render_error(500)\n return\n end\n\n if (keep_city)\n ext.update_attribute(:defaultCity, mood.city);\n end\n if (keep_sleep)\n ext.update_attribute(:defaultSleep, mood.sleep);\n end\n if (keep_exercise)\n ext.update_attribute(:defaultExercise, mood.exercise);\n end\n\n ext.update_attribute(:lastEntryTime, currentUnixTime());\n\n mood.save()\n\n redirect_to(\"/dataentry/index/?message_banner=Thank you for entering your data!\")\n\n end",
"def guardar_variable\n variable = Variable.find(params[:id])\n if variable.update_attributes(params[:variable])\n redirect_to(:back, :notice => \"Variable actualizada\")\n else\n redirect_to(:back, :notice => \"Error al intentar guardar variable, intentalo nuevamente\")\n end\n end",
"def record_submitted_entry\n session[:now] ||= {}\n session[:now][:submitted_entry] = [@content_type.slug, @entry._slug]\n end",
"def set_form_vars\n @edit = {}\n @edit[:sm_id] = @sm.id\n @edit[:key] = \"sm_edit__#{@sm.id || \"new\"}\"\n @edit[:new] = {}\n @edit[:current] = {}\n\n @edit[:new][:name] = @sm.name\n @edit[:sm_types] = StorageManager.storage_manager_types\n @edit[:new][:hostname] = @sm.hostname\n @edit[:new][:ipaddress] = @sm.ipaddress\n @edit[:new][:port] = @sm.port\n @edit[:new][:sm_type] = @sm.type_description\n # @edit[:new][:agent_type] = @sm.agent_type\n if @sm.zone.nil? || @sm.my_zone == \"\"\n @edit[:new][:zone] = \"default\"\n else\n @edit[:new][:zone] = @sm.my_zone\n end\n @edit[:server_zones] = []\n zones = Zone.all\n zones.each do |zone|\n @edit[:server_zones].push(zone.name)\n end\n\n @edit[:new][:userid] = @sm.authentication_userid\n @edit[:new][:password] = @sm.authentication_password\n @edit[:new][:verify] = @sm.authentication_password\n\n session[:verify_sm_status] = nil\n set_verify_status\n\n @edit[:current] = @edit[:new].dup\n session[:edit] = @edit\n end",
"def check_and_save(data)\n\n begin\n data.save!\n data\n rescue ActiveRecord::RecordInvalid\n data = data.refresh!\n data\n end\n \n end",
"def security_questions_presented\r\n input_names = form_dynamic_textinput_names\r\n ha = {}\r\n input_names.each do |name|\r\n case\r\n when name =~ /mother__/\r\n (pre,pos) = name.split(\"__\")\r\n ha[pre] = ha.has_key?(pre) ? ha[pre]+\",\"+pos : pos\r\n when name =~ /fattwn__/\r\n (pre,pos) = name.split(\"__\")\r\n ha[pre] = ha.has_key?(pre) ? ha[pre]+\",\"+pos : pos\r\n when name =~ /school__/\r\n (pre,pos) = name.split(\"__\")\r\n ha[pre] = ha.has_key?(pre) ? ha[pre]+\",\"+pos : pos\r\n when name =~ /town__/\r\n (pre,pos) = name.split(\"__\")\r\n ha[pre] = ha.has_key?(pre) ? ha[pre]+\",\"+pos : pos\r\n when name =~ /dob__/\r\n (pre,pos) = name.split(\"__\")\r\n ha[pre] = ha.has_key?(pre) ? ha[pre]+\",\"+pos : pos\r\n end\r\n end\r\n # join upper-cased keys and values with a + in between\r\n db_row=\"\"\r\n ha.each do |k,v|\r\n v.gsub!(/day/, \"1\")\r\n v.gsub!(/month/, \"2\")\r\n v.gsub!(/year/, \"3\")\r\n\r\n db_row << k.upcase + \"\\+\" + v + \"\\/\"\r\n end\r\n db_row.chomp(\"/\")\r\n end",
"def save!\n unless save\n errors = @model.errors.on(:preferences)\n errors = errors.join(\"\\n\") if errors.respond_to?(:join)\n raise PreferencesInvalid.new(\"Validation failed: \" + errors.to_s)\n end\n true\n end"
]
| [
"0.5970889",
"0.5915759",
"0.5806278",
"0.5710323",
"0.5621386",
"0.5597883",
"0.55682224",
"0.55341727",
"0.5475433",
"0.5446921",
"0.5413465",
"0.5412846",
"0.53921187",
"0.53308517",
"0.5308128",
"0.5276593",
"0.5228124",
"0.52257395",
"0.5215078",
"0.52000785",
"0.5194648",
"0.51780534",
"0.5170904",
"0.5168908",
"0.51481086",
"0.51452917",
"0.5138687",
"0.5134222",
"0.5119526",
"0.5097568",
"0.50642633",
"0.50605035",
"0.50587195",
"0.5055041",
"0.5054121",
"0.5035403",
"0.5030578",
"0.5030004",
"0.50273365",
"0.5024549",
"0.50155264",
"0.50089514",
"0.49991718",
"0.49924803",
"0.49822408",
"0.4975963",
"0.49692297",
"0.4962017",
"0.49459797",
"0.4931957",
"0.49304923",
"0.49249834",
"0.49184048",
"0.48970097",
"0.48964623",
"0.4890794",
"0.48705587",
"0.48693413",
"0.48663932",
"0.48564368",
"0.48564216",
"0.4849683",
"0.48440415",
"0.4841623",
"0.48365736",
"0.48356807",
"0.48331514",
"0.483028",
"0.48062834",
"0.47969356",
"0.4794241",
"0.47795025",
"0.47794247",
"0.47778714",
"0.47744113",
"0.4770506",
"0.47688007",
"0.476021",
"0.47526386",
"0.47391075",
"0.4736055",
"0.47356406",
"0.47356406",
"0.47337255",
"0.47274947",
"0.47266048",
"0.47197294",
"0.47146016",
"0.4708483",
"0.470756",
"0.4706186",
"0.4705378",
"0.47047365",
"0.46970785",
"0.46935472",
"0.4685909",
"0.4676844",
"0.46759054",
"0.46746027",
"0.46707705"
]
| 0.54940546 | 8 |
Delete stored form data that was entered incorrectly | def forget_form_data(type)
session.delete(type)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_forms_data\n @forms_data.nil? || @forms_data.clear\n end",
"def single_item_action_remove_form_fields(form, document)\n single_item_action_form_fields(form, document, 'remove')\n end",
"def delete_form handle_form_text\n click_to_handle_form handle_form_text\n delete_form_click\n end",
"def clear_fields\n\t\tend",
"def purge_nested_form\n self.target_hostnames.find_all{|r| r.marked_for_destruction?}.each do |c|\n c.delete\n end\n end",
"def destroy\n Field.where(unique_id: params[:unique_id]).destroy_all\n respond_to do |format|\n format.html { redirect_to '/dashboard', notice: 'Form was successfully deleted.' }\n end\n end",
"def confirm_delete\n @quality_rating_field = QualityRatingField.find(params[:id])\n\t @extraction_form = ExtractionForm.find(params[:extraction_form_id])\n\t @project = Project.find(@extraction_form.project_id)\n\t @has_study_data = QualityRatingField.has_study_data(@extraction_form.id)\t\t\n end",
"def remove plataform\n end",
"def clean\n end",
"def destroy\n @form = Form.find(params[:id])\n if @form.entries.count > 0\n #キャッシュスイープでエラーになるので手動で削除してもらう。\n flash[:error] = \"データが存在します\"\n redirect_to(forms_path)\n return\n end\n @form.destroy\n\n respond_to do |format|\n format.html { redirect_to(forms_url) }\n format.xml { head :ok }\n end\n end",
"def delete_field!(field_name); end",
"def delete_form(kind, secret)\n form = DB[:forms].where(kind: kind, secret: secret).first\n return false unless form\n\n DB[:forms].where(id: form[:id]).delete\n Solr::Server.new(host: CDO.solr_server).delete_by_id(form[:id]) if CDO.solr_server\n\n true\nend",
"def clean!; end",
"def clean_up\n @minefield = nil\n end",
"def delete(name)\n fields.delete(name.to_sym)\n end",
"def remove_field(key)\n @pdf_form.removeField(key.to_s)\n end",
"def clean\n\t\t\n\t\[email protected] 'twitter'\n\t\[email protected] 'rpg'\n\t\n\tend",
"def clean\n true\n end",
"def remove_old_answers\n if self.valid?\n self.choice_questions.includes(:choice_answers).each {|x| x.choice_answers.each(&:destroy)}\n end\n end",
"def delete_input(input_obj)\n new_inputs = inputs.delete_if do |input|\n input_obj.name == input.name\n end\n Base.redis.del(input_obj.instance_variable_get(:@redis_key)) # delete data\n Base.redis.hset(self.name, :inputs, Marshal.dump(new_inputs)) # dump current input names\n end",
"def sanitize_attributes!\n remove_invalid_subjects!\n remove_invalid_audiences!\n remove_invalid_levels!\n set_prices!\n nil\n end",
"def delete_existing_entry()\n\t# Print overview of existing entries\n\tentry_valid = 0\n\taddr_book_array = []\n\tAddr_book.each do |entry_name, entry|\n\t\taddr_book_array.push entry_name\n\tend\n\tputs \"---\"\n\taddr_book_array.each_with_index do |element, index|\n\t\tputs index.to_s + \" \" + element\n\tend\n\t# Prompt user for entry\n\twhile entry_valid == 0\n\t\tputs \"Which entry would you like to delete? <0, 1, 2, etc.>\"\n\t\tentry_to_delete = gets.chomp.to_i\n\t\tentry_name = addr_book_array[entry_to_delete]\n\t\tif Addr_book.key?(entry_name) == true\n\t\t\tAddr_book.delete(entry_name)\n\t\t\t#.delete(key) # delete from a hash using .delete(key). give it the key you want to delete.\n\t\t\t# delete_at deletes an element at a specific index. (use for an array usually)\n\t\t\tputs \"Entry deleted!\"\n\t\t\tputs \"---\"\n\t\t\tentry_valid = 1\n\t\telse \n\t\t\tputs \"That entry is bogus. Try again.\"\n\t\tend\n\tend\n\t# Exit this workflow and return to main menu\n\t\n\nend",
"def remove_old\n count = WrongAnswer.count(:all, :conditions => { :user_id => user.id })\n if count > APP_SETTINGS['wrong_answers_to_store']\n WrongAnswer.find(:first, :conditions => { :user_id => user.id }).destroy\n end\n end",
"def delete_information\n\t# Open connection\n\tdb = open_connection\n\t# Get user input\n\tprint \"Enter the barcode for the item you'd like to delete: \"\n\tbarcode = gets.strip\n\tbegin # Check if barcode exists\n\t\tdelete_item = db.prepare \"DELETE FROM #{$db_name}.#{$db_table_name} WHERE Barcode = ?\"\n\t\tdelete_item.execute barcode\n\t\tdelete_item.close\n\trescue # Catch any errors\n\t\tabort \"There was an error deleting item from the database. Please ensure that item exists.\"\n\tensure # Close the connection to the database\n\t\tdb.close\n\tend\n\tprint \"Information deleted successfully!\\n\"\n\thome_screen\nend",
"def partially_valid_clear\n @partially_valid_attributes = []\n end",
"def remove_sensitive_fields\n if params[:user] && [:admin, :pps_balance].any? { |p| params[:user].delete(p) }\n redirect_to user_root_path,\n :alert => t(\"flash.dont_even\")\n end\n end",
"def eliminar_asignaturas\n @seccion = \"Asignaturas\"\n #Primero se verifica que se enviaron datos a través de un formulario\n #Para esto basta con probar que la variable params[:docentes] existe\n unless params[:asignaturas] && params[:id] && __es_numero_entero?(params[:id])\n flash[:error] = \"Disculpe, no se especificó ninguna asignatura. Inténtelo nuevamente.\"\n redirect_to :action => \"asignaturas\"\n return\n end\n\n #Esta variable almacenara cuantos docentes (checkboxs) existian en el formulario\n car = params[:id].to_s\n cant = params[:asignaturas][\"cantidad_\"+car].to_i\n\n #se itera sobre cada posible docente eliminando el que haya sido seleccionado\n for i in 1..cant do\n #En rails solo los checkbox seleccionados son enviados por parametro al servidor, por lo que\n #si el parametro existe, entonces fue seleccionado y por ende debe ser eliminado\n if params[\"asignatura_check_box_\"+car+\"_\"+i.to_s]\n id = params[\"asignatura_check_box_\"+car+\"_\"+i.to_s]\n if asignatura = Asignatura.find(id)\n asignatura.destroy\n end\n end\n end\n\n flash[:exito] = \"Se eliminaron las asignaturas seleccionados exitosamente.\"\n redirect_to :action => \"asignaturas\"\n return\n end",
"def destroy\n @form = Form.find(params[:id])\n # don’t delete if form is critical or any course uses it\n cantdel = @form.critical? || !Course.find_by_form_id(params[:id]).nil?\n unless cantdel\n @form.destroy\n $loaded_yaml_sheets[params[:id].to_i] = nil if defined? $loaded_yaml_sheets\n end\n\n respond_to do |format|\n flash[:error] = 'Form was critical and has therefore not been destroyed.' if cantdel\n format.html { redirect_to(forms_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n scan_procedure_array =current_user.edit_low_scan_procedure_array.split(' ') #[:edit_low_scan_procedure_array]\n @questionform_question = QuestionformQuestion.find(params[:id])\n @questionform_question.destroy\n\n respond_to do |format|\n format.html { redirect_to(questionform_questions_url) }\n format.xml { head :ok }\n end\n end",
"def delete_datastore_form_attribute_definition(name, headers=default_headers)\n @logger.info(\"Deleting the \\\"#{name}\\\" Datastore Form Attribute Definition\")\n delete(\"#{@api_url}/datastoreFormAttributeDefinitions/#{encode(name)}\", headers)\n end",
"def delete(name = nil)\n if name\n store.delete_value(field_key(name.to_s))\n else\n self.class.fields.each do |field|\n store.delete_value(field_key(field[:name]))\n end\n end\n end",
"def clean_dirty_attributes!\n @dirty_attribute_keys = []\n end",
"def cleanup\n datas[:model_feature_values].each_pair { |model_key, feature_values| \n model = Model.find(model_key)\n feature_keys = []\n model.features_list { |feature| feature_keys << feature.key }\n values(model).delete_if { |feature_key, value| !feature_keys.include?(feature_key) }\n }\n end",
"def submit_edit\n id = params[:course_id]\n requires({'role' => ['admin','faculty'],'course_id'=>id})\n course_number = params[:number]\n course_term = params[:term]\n course_name = params[:name]\n course_section = params[:section]\n\n studentsToRemove = params[:students_to_remove]\n tasToRemove = params[:tas_to_remove]\n\n course = Course.find(id)\n \n\n\n course.course_number = course_number\n course.term = course_term\n course.name = course_name\n course.section = course_section\n course.save\n \n StudentInCourse.delete_all(:course_id => id, :user_id => studentsToRemove)\n TaForCourse.delete_all(:course_id => id, :user_id => tasToRemove)\n\n flash[:notice] = \"Changes saved.\"\n \n end",
"def delete_loan\n PropertyDebtSummary.delete_debt_summary_details(@property.id,params[:loan_number]) if params[:delete_form] != \"true\"\n form_hash_for_loan_details\n end",
"def clean_attributes\n attributes.delete(:bare_metal)\n attributes.delete(:flavor_id)\n attributes.delete(:ephemeral_storage)\n end",
"def clean_trash\n return unless self.active? == false and self.rank === MemberRank.find_by_name('Declined Applicant')\n\n # Don't care about what they want\n self.wishlists.destroy_all\n\n # Don't care about the achievements they mooched from us\n self.completed_achievements.destroy_all\n end",
"def destroy\n @q_data_form = QDataForm.find(params[:id])\n @q_data_form.destroy\n\n respond_to do |format|\n format.html { redirect_to(q_data_forms_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @submitted_exam_regis_form.destroy\n respond_to do |format|\n format.html { redirect_to submitted_exam_regis_forms_url, notice: 'Submitted exam regis form was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete \n @data = {} \n end",
"def clear_field(field_name)\n\t\tend",
"def clean_changes! = changes.delete_if { |_, values| values.all?(&:blank?) || values[0] == values[1] }",
"def process_trophy_removal\n params.keys.select { |k, _v| k.starts_with? 'remove_trophy_' }.each do |smash_trophy|\n smash_trophy = smash_trophy.sub(/^remove_trophy_/, '')\n current_user.trophies.where(work_id: smash_trophy).destroy_all\n end\n end",
"def delete_dirty?\n false\n end",
"def persist\n prepare do\n document.attributes.delete(field)\n execute(\"$unset\")\n end\n end",
"def delete_carousel_form\n carousel_index = Integer(params[:carousel_index], exception: false)\n if carousel_index && request.post?\n image_id = Seek::Config.home_carousel[carousel_index][:image]\n Seek::Config.home_carousel = array_remove_at(Seek::Config.home_carousel,carousel_index)\n Avatar.find(image_id).delete\n flash.now[:notice] = \"Carousel number #{carousel_index} deleted\"\n else\n flash.now[:error] = 'Must be a post'\n end\n redirect_to :home_settings_admin\n end",
"def test_delete_form_field\n filename = 'FormFilled.docx'\n remote_name = 'TestDeleteFormField.docx'\n index = 0\n\n st_request = PutCreateRequest.new remote_test_folder + test_folder + '/' + remote_name, File.open(local_test_folder + test_folder + '/' + filename, \"r\").read \n @storage_api.put_create st_request\n\n request = DeleteFormFieldRequest.new remote_name, index, remote_test_folder + test_folder, :node_path => 'sections/0'\n result = @words_api.delete_form_field request\n assert_equal 200, result.code\n end",
"def clean_data\n clean_attributes = {}\n attributes.each do |key, value|\n # clean user inputted strings\n value = value.downcase.strip if value.is_a?(String)\n\n clean_attributes[key.to_sym] = value\n end\n clean_attributes\n end",
"def clean_database\n\t\t\t\tbegin\n\t\t\t\t\tupdate_all(XSSF_VICTIM_DB, XSSF_VICTIM_HASH, {\"CURRENT_ATTACK_URL\" => nil, \"TUNNELED\" => false})\n\t\t\t\t\tdelete_all(XSSF_WAITING_ATTACKS_DB) \n\t\t\t\trescue\n\t\t\t\t\tprint_error(\"Error 10: #{$!}\") if (XSSF_MODE[0] =~ /^Debug$/i)\n\t\t\t\tend\n\t\t\tend",
"def delete_contact\n puts \"which Contact Would You Like to Remove?\"\n @contacts.delete(gets)\n puts \"Your Contact Has Been Removed\"\nend",
"def clean_students\n add_students_to_remove\n student_ids = @annotation.annotated_students.map(&:student_id)\n params[:annotated_students_attributes]&.delete_if do |h|\n student_ids.include? h[:student_id]\n end\n end",
"def clean_document!\n self.questions.destroy_all\n self.comments.destroy_all\n self.timeline_events().each{|event| event.destroy}\n self.document_items.each{|item| item.timeline_events.destroy_all}\n end",
"def save\n self.attributes.delete('customer')\n self.attributes.delete('product')\n self.attributes.delete('credit_card')\n super\n end",
"def delete_data(data_to_delete)\n if data_to_delete\n for data in data_to_delete do\n case data\n when \"todos\"\n self.todos.each{|todo| todo.destroy}\n when \"fittings\"\n self.fittings.each{|fitting| fitting.destroy}\n when \"services\"\n self.services.each{|service| service.destroy}\n when \"accessories\"\n self.accessories.each{|accessory| accessory.destroy if accessory.typ == :accessory}\n end\n end\n else\n return\n end\n end",
"def clean_up\n end",
"def clean_up\n end",
"def delete_field(var_name)\n @fields.delete(var_name)\n end",
"def audit_destroy\n user_submitted_names_need_notes( ignore_field_checks: true )\n throw( :abort ) unless errors.details[:audit_comment].blank?\n super\n end",
"def clean(data)\n cleaned = clean_content(data)\n clean_content(cleaned)\n end",
"def update_form!\n form_attributes = attributes.except 'form_id', 'user_id', 'id'\n form = self.form || Form.new\n form.update form_attributes\n # Don't need to retain the fields, since the draft will be deleted.\n # Just switch them over to belonging to the form.\n form.fields.delete_all\n fields.update_all form_draft_id: nil, form_id: form.id\n delete\n end",
"def hash_delete(field)\n choose do |menu|\n menu.prompt = \"Please select to remove: \"\n menu.index = :number\n menu.index_suffix = ') '\n menu.choice(:quit, 'Quit') {result = false}\n values = []\n AppConfig.config[field].each do |key, value|\n values << \"#{key} => #{value}\"\n end\n menu.choices(*values) do |value, details|\n if value =~ /(.*\\S)\\s+=>/\n AppConfig.config[field].delete($1)\n end\n end\n end\n end",
"def delete \n \t @data = {} \n \tend",
"def clean_raw_data(klass)\n\t\tputs \"Deleting all #{klass.name} records\"\n\t\tklass.delete_all\n\tend",
"def clean!\n @data = freezer(@data.merge(@dirty))\n @dirty.clear\n self\n end",
"def fill_fields(bf, ef)\n bf.each do |key, value|\n if value != \" \"\n ef.delete(key)\n end\n end\nend",
"def remove\r\n session_user.details.select { |d| d.key =~ /^cc_/ }.each { |d| d.destroy }\r\n render :text => \"Craftsman Club details wiped clean.\"\r\n end",
"def delete_existing\n Answer.delete_all\n Question.delete_all\n Knock.delete_all\n Door.delete_all\n Canvasser.delete_all\nend",
"def destroy\n @hospital[params[:id]] = nil\n @hospital.save\n respond_to do |format|\n format.html { redirect_to admin_hospital_fields_url, notice: t('field_destroyed') }\n format.json { head :no_content }\n end\n end",
"def delete_info_input(db)\n\tputs \"-\" * 50\n\tputs \"Delete Information: \"\n\tprint \"Enter the horse record you would like to delete: \"\n\thorse_selection = gets.chomp.capitalize\n\tdelete_info(db, horse_selection)\nend",
"def destroy\n if @form.status == 'draft'\n @form.questions.destroy_all\n @form.surveys.destroy_all\n @form.destroy\n render json: @form\n else\n render json: @form.errors, status: :unprocessable_entity\n end\n end",
"def manage_cars_remove_car_check\n @ui.manage_cars_remove_car_input_msg\n car_to_del_id = gets.chomp\n raise 'Unexisting car' unless cars.find { |car| car.id == car_to_del_id }\n car_del = cars.find { |car| car.car_id == car_to_del_id }\n @cars.delete(car_del)\n @cars_free.delete(car_del)\n @ui.manage_cars_remove_car_success_msg\n end",
"def clean_bad_data\n self.character_achievements.select{|ca| ca.achievement }.group_by{|ca| ca.achievement.armory_id }.each{|aid, cas|\n if cas.size > 1\n cas[1,1000].each{|c| c.destroy }\n end\n }\n end",
"def clean_up\n pathname.delete if pathname.exist?\n end",
"def clean_document(hash)\n hash.delete_if do |_k, v|\n v.blank? && v != false\n end\n end",
"def destroy\n clear\n save\n end",
"def delete_convention_data\n if self.metadata_file.present? && self.metadata_file.use_metadata_convention\n Rails.logger.info \"Removing convention data for #{self.accession} from BQ\"\n bq_dataset = ApplicationController.big_query_client.dataset CellMetadatum::BIGQUERY_DATASET\n bq_dataset.query \"DELETE FROM #{CellMetadatum::BIGQUERY_TABLE} WHERE study_accession = '#{self.accession}' AND file_id = '#{self.metadata_file.id}'\"\n Rails.logger.info \"BQ cleanup for #{self.accession} completed\"\n SearchFacet.delay.update_all_facet_filters\n end\n end",
"def delete!\n values.delete!\n end",
"def test_delete_form_field\n remote_file_name = 'TestDeleteFormField.docx'\n\n upload_file File.join(local_test_folder, field_folder + '/FormFilled.docx'), remote_data_folder + '/' + remote_file_name\n\n request = DeleteFormFieldRequest.new(name: remote_file_name, index: 0, node_path: 'sections/0', folder: remote_data_folder, dest_file_name: remote_test_out + '/' + remote_file_name)\n\n @words_api.delete_form_field(request)\n end",
"def incomplete_delete\n incomplete.delete_all\n end",
"def deleting_Records\n\t\tprint \"Do you want to delete all records or Particular Records \\n\"\n\t\tprint \"1. All Records \\n\"\n\t\tprint \"2. Particular Records \\n\"\n\t\tprint \"Enter your option: \\n\"\n\t\top1 = gets.chomp.to_i\n\t\t\tcase op1\n\t\t\t\twhen 1\n\t\t\t\t\tbegin\n\t\t\t\t\t\tcount = Products.delete_all()\n\t\t\t\t\t\tputs \"#{count} Records Deleted Succesfully ....\"\n\t\t\t\t\trescue\n\t\t\t\t\t\tputs \"Problem occur while deleting the records\"\n\t\t\t\t\tend\n\t\t\t\twhen 2\n\t\t\t\t\tbegin\n\t\t\t\t\t\tprint \"Enter Which record do you want to delete\"\n\t\t\t\t\t\tpar = gets.chomp.to_i\n\t\t\t\t\t\tcount = Products.delete(par)\n\t\t\t\t\t\tputs \"#{count} Record Deleted....\"\n\t\t\t\t\trescue\n\t\t\t\t\t\tputs \"Problem Occur while deleting record\"\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tputs \"Invalid Option\"\n\t\t\tend\n\tend",
"def check_entry(entry)\n return unless entry.methods.include?(\"title\".to_sym)\n if entry.title == \"\" or entry.title.nil? or\n entry.year == \"\" or entry.year.nil? or\n entry.author == \"\" or entry.author.nil?\n puts \"\\nBad entry:\\n#{entry}\"\n @input.delete(entry)\n end\nend",
"def destroy\n if @observation_field.observation_field_values.count > 0\n msg = t(:you_cant_delete_observation_fields_that_people_are_using)\n respond_to do |format|\n format.html do\n flash[:error] = msg\n redirect_to(observation_fields_url)\n end\n format.json { render :json => {:error => msg}, :status => :unprocessable_entity }\n end\n else\n @observation_field.destroy\n respond_to do |format|\n format.html { redirect_to(observation_fields_url) }\n format.json { head :ok }\n end\n end\n end",
"def destroy\n if params[:filled_form_key]\n @filled_form = FilledForm.where(:verification_key =>\n params[:filled_form_key]).first\n else\n @filled_form = @form.filled_forms.find(params[:id])\n end\n return unless filled_form_authorized!\n if (@filled_form.payment and\n @filled_form.payment.filled_forms.length == 1 and\n @filled_form.payment.cancellable?)\n @filled_form.payment.destroy\n end\n @filled_form.destroy\n\n respond_to do |format|\n format.html do\n if params[:filled_form_key]\n redirect_to friendly_page_url(@page)\n else\n @next_filled_form = @form.visible_filled_forms(current_user).first()\n if @next_filled_form\n redirect_to edit_form_fill_url(@form, @next_filled_form)\n else\n redirect_to new_form_fill_url(@form)\n end\n end\n end\n format.xml { head :ok }\n end\n end",
"def destroy\n @custom_input.destroy\n respond_to do |format|\n format.html { redirect_to custom_inputs_url }\n format.json { head :no_content }\n end\n end",
"def question_deleted(question)\r\n QuestionTextIndex.delete_all(['question_id=?',question.id])\r\n QuestionProfileMatch.delete_all(['question_id=?',question.id])\r\n QuestionProfileExcludeMatch.delete_all(['question_id=?',question.id])\r\n end",
"def destroy\n @filled_form = FilledForm.find(params[:id])\n @filled_form.destroy\n\n respond_to do |format|\n format.html { redirect_to form_templates_path }\n format.json { head :ok }\n end\n end",
"def delete_partial_data\n destroy :accounts\n destroy :bank_accounts\n destroy :currencies\n destroy :customers\n destroy :delivery_methods\n destroy :keywords\n destroy :menus\n destroy :parameter\n destroy :permissions # permissions need to be destroyed, even if we dont duplicate\n destroy :printers\n destroy :sum_levels\n destroy :terms_of_payments\n destroy :user_profiles\n destroy :users\n destroy :warehouses\n\n new_company.destroy\n end",
"def clean_up_data(rows)\n rows.delete_if { |row| row.any? { |value| value.length < 3 } }\n # Remove headers and trailing header\n rows.delete_at(0)\n rows.delete_at(-1)\n rows\nend",
"def removePersonalData(appHash)\n safeAppHash = appHash.dup\n \n safeAppHash.delete(\"appleId\")\n safeAppHash.delete(\"appleID\")\n safeAppHash.delete(\"AppleId\")\n safeAppHash.delete(\"AppleID\")\n \n if safeAppHash[\"com.apple.iTunesStore.downloadInfo\"]\n safeAppHash[\"com.apple.iTunesStore.downloadInfo\"] = safeAppHash[\"com.apple.iTunesStore.downloadInfo\"].dup\n safeAppHash[\"com.apple.iTunesStore.downloadInfo\"].delete(\"accountInfo\")\n end\n \n safeAppHash\n end",
"def delete_data key\n init_data\n\n Bot::DB[my_name].delete key\n end",
"def delete_data key\n init_data\n\n Bot::DB[my_name].delete key\n end",
"def clean_document(hash)\n hash.delete_if do |_k, v|\n begin\n v.nil? || v.empty?\n rescue\n false\n end\n end\n end",
"def clear\n @@fields.each do |field|\n self.instance_variable_set(\"@\"+field.to_s,nil)\n end\n end",
"def destroy\n @adminmatrixstorageform.destroy\n respond_to do |format|\n format.html { redirect_to adminmatrixstorageforms_url }\n format.json { head :no_content }\n end\n end",
"def remove(prep_id)\n\t\[email protected]_at(prep_id)\n\tend",
"def remove_blank_contacts\n self.details = details.select { |cd| !cd.value.blank? }\n end",
"def destroy\n\[email protected] do |clientesTamp|\n\t @campos_extra = CamposExtra.where('emailCliente = ?', clientesTamp.email)\n\t\tif @campos_extra.first != nil\n\t\t\t@campos_extra.each do |camposExtrasTamp|\n\t\t\t\tif camposExtrasTamp.nomeCampo == @form_primario.nomeCampo\n\t\t\t\t\tcamposExtrasTamp.destroy\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n \n @form_primario.destroy\n respond_to do |format|\n format.html { redirect_to form_primarios_url, notice: 'Form primario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def clean\n puts \"== removing all data from redis ==\"\n submission_keys = redis.lrange(SUBMISSIONS_KEY, 0, -1)\n redis.del(submission_keys) unless submission_keys.empty?\n redis.del(SUBMISSIONS_KEY)\n end",
"def clear!\n set_ds_field \"\"\n end",
"def clear!\n set_ds_field \"\"\n end"
]
| [
"0.63713485",
"0.6062579",
"0.6004183",
"0.5855256",
"0.5829446",
"0.5769565",
"0.57015496",
"0.56871647",
"0.5650975",
"0.56423175",
"0.5634057",
"0.5633094",
"0.55811006",
"0.555289",
"0.55388856",
"0.5536716",
"0.55052346",
"0.55005515",
"0.54896647",
"0.5480619",
"0.54691553",
"0.5452932",
"0.5435038",
"0.5417977",
"0.53962505",
"0.5392393",
"0.5380272",
"0.5360779",
"0.5340602",
"0.5331865",
"0.5325616",
"0.5322922",
"0.53130245",
"0.5312187",
"0.530585",
"0.53039175",
"0.52991086",
"0.5289797",
"0.52809864",
"0.5276428",
"0.527268",
"0.5248454",
"0.52474225",
"0.52463216",
"0.52378404",
"0.5236492",
"0.52337265",
"0.5221579",
"0.52182865",
"0.52130413",
"0.5206675",
"0.52059585",
"0.5203376",
"0.5200368",
"0.5190881",
"0.5190881",
"0.5190597",
"0.51879424",
"0.5174261",
"0.5170941",
"0.5168779",
"0.5164846",
"0.5157638",
"0.5149397",
"0.5146568",
"0.51451045",
"0.5141633",
"0.51312476",
"0.51254165",
"0.51223123",
"0.5121876",
"0.5114279",
"0.51114094",
"0.5103869",
"0.509353",
"0.50929534",
"0.5085767",
"0.50812715",
"0.507831",
"0.5077401",
"0.50752354",
"0.5073013",
"0.50716764",
"0.5068189",
"0.5059345",
"0.50561434",
"0.50536394",
"0.50477433",
"0.5045893",
"0.50353605",
"0.50353605",
"0.5034302",
"0.50336856",
"0.5033414",
"0.5025359",
"0.50226307",
"0.5021308",
"0.502109",
"0.50183064",
"0.50183064"
]
| 0.5654744 | 8 |
Get stored form data | def get_form_data(my_class,type)
my_class.new(session[type]) unless session[type].nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def form_data\n session[\"form_data\"].nil? ? params : JSON.parse(session[\"form_data\"])\n end",
"def form_field_data\n @attributes[:form_field_data]\n end",
"def form_data?; end",
"def data\n @field.widget.value_from_formdata(@form.data, @html_name)\n end",
"def form_data=(data)\n @form_data = data if data\n end",
"def data_dictionary\n @data_dictionary ||= form.data_dictionary\n end",
"def form_data\n @form_data ||= {\n \"c\" => [\"China\", \"Venezuela\", \"Brazil\", \"United States\", \"Thailand\", \"Ukraine\", \"Indonesia\", \"Nepal\", \"Russian Federation\", \"Argentina\", \"Czech Republic\", \"Korea, Republic of\", \"Colombia\", \"France\", \"Bangladesh\", \"Ghana\", \"Peru\", \"Slovakia\", \"Taiwan\", \"Hong Kong\", \"Taiwan\", \"Bulgaria\", \"Canada\", \"Netherlands\", \"Bolivia\", \"Serbia\", \"Azerbaijan\", \"Costa Rica\", \"Viet Nam\", \"Germany\", \"South Africa\", \"Iraq\", \"Italy\", \"Egypt\", \"Poland\", \"Chile\", \"Paraguay\", \"Australia\", \"Hungary\", \"Cambodia\", \"Europe\"],\n \"p\" => nil,\n \"pr\" => [0],\n \"a\" => [2,3,4],\n \"sp\" => [2,3],\n \"ct\" => [2,3],\n \"s\" => 0,\n \"o\" => 0,\n \"pp\" => 2,\n \"sortBy\" => \"date\"\n }\n end",
"def get_form_support_data\n @client.raw('get', '/content/forms/support-data')\n end",
"def get_form_vars\n @sm = @edit[:sm_id] ? StorageManager.find_by_id(@edit[:sm_id]) : StorageManager.new\n\n @edit[:new][:name] = params[:name] if params[:name]\n @edit[:new][:hostname] = params[:hostname] if params[:hostname]\n @edit[:new][:ipaddress] = params[:ipaddress] if params[:ipaddress]\n @edit[:new][:port] = params[:port] if params[:port]\n @edit[:new][:sm_type] = params[:sm_type] if params[:sm_type]\n # @edit[:new][:agent_type] = params[:agent_typ] if params[:agent_typ]\n @edit[:new][:zone] = params[:server_zone] if params[:server_zone]\n\n @edit[:new][:userid] = params[:userid] if params[:userid]\n @edit[:new][:password] = params[:password] if params[:password]\n @edit[:new][:verify] = params[:verify] if params[:verify]\n restore_password if params[:restore_password]\n set_verify_status\n end",
"def form_fields\n params\n end",
"def data\n filled_data = self.form.data\n filled_data.each do |form_item|\n report = field form_item.id\n if report.nil?\n report\n elsif form_item.form_media?\n report = serialized_report_file(report['assetId'])\n else\n report = report.report_value\n end\n form_item[:value] = report\n end\n ordered(filled_data)\n end",
"def form_params\n params[:form]\n end",
"def post_data\n @request[\"postData\"]\n end",
"def store_form_data(type,data)\n session[type] = data\n end",
"def forms; end",
"def form; end",
"def form_params\n params.fetch(:form, {})\n end",
"def save_form_fields\n @save_form_fields ||= collect_save_form_fields\n end",
"def data\n retrieve_data\n end",
"def from_form_data(params = {})\n from_params(params, false)\n end",
"def form_fragment\n parsed_json\n end",
"def form\n @form ||= Steps::FormObjectFactory.form_object_for(step, enrollment)\n end",
"def convertform(index)\n\t\t# return form binary value\n\t\treturn @@allForms[index][\"binary\"]\n\tend",
"def read_drg_cms_form\r\n table_name = decamelize_type(params[:table].strip)\r\n @tables = table_name.split(';').inject([]) { |r,v| r << [v.classify.constantize, v] }\r\n# split ids passed when embedded document\r\n ids = params[:ids].to_s.strip.downcase\r\n @ids = ids.split(';').inject([]) { |r,v| r << v }\r\n# formname defaults to last table specified\r\n formname = params[:formname] || @tables.last[1]\r\n @form = YAML.load_file( dc_find_form_file(formname) )\r\n# when form extends another form file. \r\n if @form['extend']\r\n form = YAML.load_file( dc_find_form_file(@form['extend']) )\r\n @form = forms_merge(form, @form)\r\n end\r\n# add readonly key to form if readonly parameter is passed in url\r\n @form['readonly'] = 1 if params['readonly'] #and %w(1 yes true).include?(params['readonly'].to_s.downcase.strip)\r\n# !!!!!! Always use strings for key names since @parms['table'] != @parms[:table]\r\n @parms = { 'table' => table_name, 'ids' => params[:ids], 'formname' => formname,\r\n 'return_to' => params['return_to'], 'edit_only' => params['edit_only'],\r\n 'readonly' => params['readonly'] \r\n }\r\nend",
"def form_field_set\n @attributes[:form_field_set]\n end",
"def stored_data; end",
"def builder\n form\n end",
"def fill_all_form_data()\n if verbose_messages\n p @fillable_form_fields\n p @current_page_data_object\n end\n\n @fillable_form_fields.each do |field|\n value = @current_page_data_object.retrieve_data_for(field)\n enter_element_value(field, value) if value and (value != \"nil\")\n end\n end",
"def toFormData\n formData = `new FormData()`\n each do |key, value|\n `#{formData}.append(#{key},#{value})`\n end\n formData\n end",
"def fill\n @attributes = params[:pdf_form]\n export\n end",
"def form_user(form)\r\n {\r\n :email => form['email'],\r\n :password => form['password'],\r\n :name => form['name'] # Make proper greetings if it's nil\r\n }\r\n end",
"def data\n @data\n end",
"def fields_on_form() #:nodoc:\r\n fields = []\r\n if @form['form']['fields']\r\n# read only field elements (key is Fixnum)\r\n @form['form']['fields'].each {|key,options| fields << options if key.class == Fixnum }\r\n else\r\n @form['form']['tabs'].keys.each do |tab|\r\n @form['form']['tabs'][tab].each {|key,options| fields << options if key.class == Fixnum }\r\n end \r\n end\r\n fields\r\nend",
"def data\n @data\n end",
"def data\n @data\n end",
"def data\n @data\n end",
"def fields\n @fields ||= form.fields\n end",
"def form\n @form.rbc_form\n end",
"def load_form( filename )\n\t\tdatafile = MIMEPARSER_DATADIR + filename\n\t\treturn datafile.open( 'r', encoding: 'ascii-8bit' )\n\tend",
"def data\n @data\n end",
"def data\n @data\n end",
"def data\n @data\n end",
"def save_data\r\n form_fields = fields_on_form()\r\n return true if form_fields.size == 0\r\n\r\n form_fields.each do |v|\r\n session[:form_processing] = v['name'] # for debuging\r\n next if v['type'].nil? or v['name'].nil? or\r\n v['type'].match('embedded') or # don't wipe embedded types\r\n (params[:edit_only] and params[:edit_only] != v['name']) or # otherwise other fields would be wiped\r\n v['readonly'] or # fields with readonly option don't return value and would be wiped\r\n [email protected]_to?(v['name']) # there are temporary fields on the form\r\n # good to know! How to get type of field @record.fields[v['name']].type\r\n # return value from form field definition\r\n value = DrgcmsFormFields.const_get(v['type'].camelize).get_data(params, v['name'])\r\n @record.send(\"#{v['name']}=\", value)\r\n end\r\n\r\n # before_save callback\r\n if (m = callback_method('before_save') )\r\n ret = call_callback_method(m)\r\n # don't save if callback returns false\r\n return false if ret.class == FalseClass\r\n end\r\n\r\n # save data\r\n changes = @record.changes\r\n update_standards() if changes.size > 0 # update only if there has been some changes\r\n if (saved = @record.save)\r\n operation = @record.new_record? ? :new : :update\r\n save_journal(operation, @record.previous_changes)\r\n # after_save callback\r\n if (m = callback_method('after_save') ) then call_callback_method(m) end\r\n end\r\n saved\r\nend",
"def data\n self[:data]\n end",
"def add_field\n if request.get?\n @info = Hash.new\n @field_hash = Hash.new\n session[:count] = 1\n else\n @fields = []\n @field_hash = Hash.new\n session[:field_hash] = @field_hash\n form = DynamicForm.find(session[:form_id])\n @info = params[:info]\n if form.fields == \"To be Filled\"\n logger.info 'FIELDS TO BE FILLED'\n form.fields = {}\n else\n @fields = YAML::load(form.fields)\n logger.info \"Loading YAML {line 92}\"\n end \n @fields << @info\n form.fields = @fields.to_yaml\n form.save\n logger.info \"Returned: #{@info}\"\n redirect_to :action => 'add_fields'\n end\n end",
"def data\n params.require(:data)\n end",
"def form\n end",
"def service_request\n @has_data = Settings.has_user_data\n @data = Settings.getSavedData\n end",
"def get_fields\n _fields = @config['form']['fields']\n _fields.map{|k,v| Field.new(k=>v)}\n end",
"def get_form_attributes(evt)\n [evt[\"#{dom_id}_form\".to_sym], evt[\"#{dom_id}_form_special\"]]\n end",
"def data\n @datas\n end",
"def form_fields\n self.class.fields.values.select { |field| field.form }\n end",
"def data\n @data\n end",
"def data\r\n @data\r\n end",
"def form_data\n [{\n cells: [\n {\n title: \"Title\",\n name: :title,\n type: :text\n },\n {\n title: \"Due Date\",\n name: :due_date,\n type: :datetime\n },\n {\n title: \"Completed\",\n name: :completed,\n type: :check\n }\n ]\n }]\n end",
"def data\n attributes.fetch(:data)\n end",
"def data\n attributes.fetch(:data)\n end",
"def fusion_form_params\n params.fetch(:fusion_form, {})\n end",
"def data\n self.load if @data.nil?\n @data\n end",
"def data\n attributes['data']\n end",
"def set_forminfo\n @forminfo = Forminfo.find(params[:id])\n end",
"def result_data(time_result)\n form_inputs.map do |field_name, _|\n time_result.public_send(field_name)\n end\n end",
"def deserialize_form_body( txn )\n\t\treturn txn.all_params\n\tend",
"def onSubmit(request, response, form, errors)\r\n\treturn form\r\n end",
"def get_forms(id)\n id = get_id(id) if id.is_a?(Symbol)\n return @data[id] || @data.first\n end",
"def fill_out_form(hash)\n self.main_title=hash[:main_title]\n self.main_author=hash[:main_author]\n self.co_authors=hash[:co_authors]\n self.publisher=hash[:publisher]\n self.place_of_publication=hash[:place]\n self.volume_title=hash[:volume_title]\n self.volume_information=hash[:volume_info]\n self.year=hash[:year]\n self.number=hash[:number]\n self.series_title=hash[:series]\n self.url=hash[:url]\n end",
"def fill_form(data)\n missing = data.to_h.keys - form_field_writers.to_a\n unless missing.empty?\n raise \"#{self.class.name} does not contain writer(s) for #{missing}\"\n end\n\n data.to_h.each_pair do |k, v|\n send(\"#{k}=\", v)\n end\n end",
"def read\n value = record.send(\"#{name}_data\")\n value unless value.nil? || value.empty?\n end",
"def form_field_params\n params[:form_field]\n end",
"def form_params\n params.fetch(:form, {}).permit(:key, :name)\n end",
"def get_data()\t\n\tend",
"def getFieldValue( name , formName = \"\" , frameName = \"\" )\n # returns the current value of the field\n \n fname = getFunctionName()\n log fname + ' Starting. getting value for field with name: ' + name if $debuglevel >=0\n\n begin # if there are 2 elements with the same name, we get an exception - so we need a different version of this method\n\n container = getObjectContainer( name , formName , frameName )\n\n o = nil\n v = \"\"\n container.all.each do |c|\n next unless o == nil\n begin\n if c.name.to_s == name \n #log 'Hack:: found the object. '\n o = c\n end\n rescue\n # probably no name\n end\n end\n if o != nil\n v = o.value.to_s\n else\n v = nil\n end\n\n rescue => e\n showException(e)\n v = nil \n end \n return v\n \n end",
"def data\r\n @obj.read_var(@name)\r\n end",
"def value\n res = form_object_value\n res = override_with_form_value(res)\n res\n end",
"def to_s; toDataMetaForm end",
"def to_s; toDataMetaForm end",
"def get_form(form_name)\r\n\t\t\tself.get_design_note(form_name, API::DFLAGPAT_FORM_OR_SIMILAR, Form)\r\n\t\tend",
"def action\n form_data['action']\n end",
"def save_form(values)\n mp values\n persist\n\n back_to_previous_screen\n end",
"def form\n ret = {}\n @elems.map do |x|\n name = x['name']\n id = x['id']\n next if (name.nil? && id.nil?)\n value = x['value']\n type = x['type']\n ret[name] = value\n ret[id] = value if ((id || name) != name)\n end\n return FormArray.new(ret)\n end",
"def getData type\n\t\t# get collection\n\t\tthings = @@db.collection(\"saves\")\n\t\t# find everything in collection\n\t\tcursor = things.find()\n\t\t\n\t\t# go through all documents in collection and display data\n\t\tcursor.each { |row| \n\t\t\tif(row[type] != nil)\n\t\t\t\tfrm = row[\"form\"]\n\t\t\t\tif(frm == nil)\n\t\t\t\t\tfrm = \"N/A\"\n\t\t\t\tend\n\t\t\t\tputs row[type] + \" || Form: \" + frm\n\t\t\tend\n\t\t} \n\tend",
"def params\n return FormArray.new(@cobj.cur.clop.to_form)\n end",
"def parseForm(form)\n # I'm using the format \"name value\" to be able to use the set_options method\n url = Array[\"\", \"url\", form[\"action\"]]\n method = Array[\"\", \"method\", form[\"method\"]]\n hidden_inputs = form.css(\"input[type='hidden']\")\n password_input = form.xpath(\"//input[@type='password']/@name\")\n\n # get the login input\n visible_inputs = form.css(\"input[type!='hidden']\")\n login_input = \"\"\n visible_inputs.each do |el|\n if el.to_s =~ /(login)|(email)|(username)|(user)/i\n login_input = el\n puts \"the login input est : #{el}\"\n break\n end\n end\n\n # create the string with all the hidden parameters\n body = \"\"\n hidden_inputs.each do |el|\n body = body + el[\"name\"] + \"=\" + el[\"value\"] + \"&\"\n end\n\n body = \"#{body}\" + \"#{login_input[\"name\"]}\" + \"=FILE0&\" + \"#{password_input}\" + \"=FILE1\"\n\n # add the question mark if get request\n if method == \"get\"\n body = \"?#{body}\"\n end\n body = Array[\"\", \"body\", body]\n\n\n # write the values in the json object \n options = JSON.parse(get_options(\"http_module\"))\n\n set_options(options, url)\n set_options(options, method)\n set_options(options, body)\nend",
"def fields_on_form #:nodoc:\r\n form_fields = []\r\n if @form['form']['fields']\r\n # read only field elements (key is Integer)\r\n @form['form']['fields'].each { |key, options| form_fields << options if key.class == Integer }\r\n else\r\n @form['form']['tabs'].keys.each do |tab|\r\n @form['form']['tabs'][tab].each { |key, options| form_fields << options if key.class == Integer }\r\n end \r\n end\r\n form_fields\r\nend",
"def get_form_model(form_name)\n get_form(form_name)[:model]\n end",
"def to_submission_data(user)\n form4142 = EVSS::DisabilityCompensationForm::Form4142.new(user, @form_hash.deep_dup).translate\n form0781 = EVSS::DisabilityCompensationForm::Form0781.new(user, @form_hash.deep_dup).translate\n form8940 = EVSS::DisabilityCompensationForm::Form8940.new(user, @form_hash.deep_dup).translate\n\n form526 = @form_hash.deep_dup\n\n form526_uploads = form526['form526'].delete('attachments')\n\n {\n FORM_526 => translate_data(user, form526, form4142.present?),\n FORM_526_UPLOADS => form526_uploads,\n FORM_4142 => form4142,\n FORM_0781 => form0781,\n FORM_8940 => form8940\n }.to_json\n end",
"def get_data(doctype,type=Hash)\n verify_doctype(doctype)\n Store.get_store(store_index(doctype)).get_data(docname(doctype), type)\n end",
"def data\n @data ||= {}\n end",
"def index\n @member = Member.find(params[:member_id])\n\n @forminfos = @member.forminfo\n end",
"def form\n find_parent_by_tag_name('FORM')\n end",
"def form\n find_parent_by_tag_name('FORM')\n end",
"def new\n load_form_data\n @book = Book.new\n end",
"def get_post_form\n {:cartridge => {:name => 'mysql-5.1', :type => 'embedded'},\n :application_id => with_testable_app.id,\n :domain_id => @domain.id}\n end",
"def fill_out_form(hash)\n self.institution=hash[:institution]\n self.department=hash[:department]\n self.title_role=hash[:title]\n self.email=hash[:email]\n self.instant_messaging=hash[:im]\n self.phone=hash[:phone]\n self.mobile=hash[:mobile]\n self.fax=hash[:fax]\n self.address=hash[:address]\n self.city=hash[:city]\n self.state=hash[:state]\n self.postal_code=hash[:zip]\n self.country=hash[:country]\n end",
"def form_fields\n values = super\n result = {}\n mappings.values.each { |field|\n result[field] = values[field] if values[field]\n }\n result\n end",
"def onSubmit(request, response, form, errors)\r\n return form\r\n end",
"def onSubmit(request, response, form, errors)\r\n return form\r\n end",
"def form_data\n\n [\n {\n title: 'Enter your flashcard informations',\n footer: 'Set up your flashcard information with the question and the answer to be able schedule it as a riminder',\n #options: [:insert, :delete, :reorder],\n cells: [\n {\n title: 'Question Label',\n name: :subjects,\n type: :selector_push,\n view_controller_class: FlashcardQuestionLabelTable,\n appearance: appearance_style\n \n # options: Hash[load_data.map do |subject|\n # [subject[:id], subject[:name]]\n # end]\n # on_change: -> (old_value, new_value) {\n # mp old_value: old_value,\n # new_value: new_value\n # }\n },\n {\n title: 'Question Object',\n name: :only_one,\n type: :text,\n #required: true,\n appearance: appearance_style({\n alignment: :right\n })\n },\n {\n # title: \"Question answer\",\n name: :description,\n type: :textview,\n placeholder: 'Enter your question answer'\n #required: true\n }\n ]\n },\n\n # Set the image cell to add image\n {\n title: '',\n name: 'Media',\n #options: [:insert, :delete, :reorder],\n cells: [\n {\n title: 'An image',\n name: :picture,\n type: :image,\n appearance: appearance_style,\n value: UIImage.imageNamed('[email protected]')\n },\n {\n title: 'Audio record',\n name: :audio_record,\n type: :image,\n appearance: appearance_style,\n value: UIImage.imageNamed('[email protected]')\n }\n ]\n },\n\n # Schedule section\n\n {\n title: 'Remind Schedule',\n footer: 'Some help text',\n #options: [:insert, :delete, :reorder],\n cells: [\n {\n title: 'Daily Frequency',\n name: :note_frequency,\n type: :selector_picker_view_inline,\n appearance: appearance_style,\n value: 'Once a day',\n options: {\n :one => \"Once a day\",\n :two => \"Twice a day\",\n :three => \"Three times a day\",\n :four => \"Four times a day\",\n }\n\n },\n {\n title: 'Remind me',\n name: :repeat_frequency,\n type: :multiple_selector,\n appearance: appearance_style,\n #value: \"Never\",\n options: {\n :sunday => \"Every Day\",\n :monday => \"Every Week\",\n :tuesday => \"Every 2 Weeks\",\n :wednesday => \"Every Month\",\n :wednesday => \"Every Year\"\n }\n\n },\n {\n title: 'Stop Remind',\n name: :stop_remind,\n type: :selector_push,\n appearance: appearance_style,\n cells: [\n {\n title: 'Repeat Forever',\n name: :reapet_forever,\n type: :check,\n value: true,\n appearance: appearance_style\n },\n {\n title: 'Stop date',\n name: :stop_remind_date,\n type: :date_inline,\n appearance: appearance_style\n }\n ]\n },\n {\n title: 'Turn off?',\n name: 'rimind_on',\n type: :switch,\n value: true, \n appearance: appearance_style\n }\n\n ]\n }\n\n ]\n\n end",
"def data\n @data ||= {}\n end",
"def data\n @data ||= {}\n end"
]
| [
"0.7457978",
"0.72240597",
"0.71780986",
"0.68642616",
"0.6664833",
"0.6656767",
"0.66216385",
"0.6374409",
"0.63553625",
"0.6313211",
"0.6298149",
"0.6247504",
"0.61912787",
"0.61226165",
"0.5964709",
"0.58886707",
"0.5871895",
"0.5852051",
"0.58491945",
"0.58333147",
"0.57593477",
"0.5755178",
"0.5737175",
"0.5733275",
"0.57238954",
"0.57183224",
"0.56945205",
"0.56931496",
"0.568744",
"0.5683839",
"0.56830204",
"0.56783825",
"0.5664337",
"0.5647281",
"0.5647281",
"0.5647281",
"0.56342417",
"0.5633923",
"0.5623682",
"0.56115454",
"0.56115454",
"0.56115454",
"0.5605936",
"0.55918354",
"0.55909455",
"0.5582994",
"0.55690295",
"0.5565553",
"0.55375093",
"0.5528474",
"0.55275995",
"0.55221176",
"0.5518061",
"0.5517493",
"0.55134666",
"0.5497284",
"0.5497284",
"0.54964834",
"0.54735434",
"0.54694045",
"0.5457669",
"0.54533434",
"0.54486984",
"0.5443018",
"0.5429278",
"0.54270977",
"0.54251796",
"0.541332",
"0.54064924",
"0.5406033",
"0.5400772",
"0.53983116",
"0.53976774",
"0.5385824",
"0.5379238",
"0.5379238",
"0.53776425",
"0.53749317",
"0.53697175",
"0.53642607",
"0.534609",
"0.5346041",
"0.534323",
"0.53276604",
"0.53207594",
"0.53200567",
"0.5319147",
"0.53134453",
"0.5308312",
"0.53061616",
"0.53061616",
"0.5303067",
"0.5300927",
"0.5299854",
"0.52898365",
"0.52837276",
"0.52837276",
"0.5282145",
"0.5277801",
"0.5277801"
]
| 0.552423 | 51 |
GET /brothers/1 GET /brothers/1.json | def show
@brother = Brother.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @brother }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @brothers = Brother.all\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @brother }\n end\n end",
"def index\n @brothers = Brother.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @brothers }\n end\n end",
"def get_brandings\n request :get, \"/v3/brandings.json\"\n end",
"def new\n @brother = Brother.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @brother }\n end\n end",
"def show\n @beer = BreweryDB.beer(params[:id]) \n render json: @beer\n end",
"def index\n @brochures = Brochure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brochures }\n end\n end",
"def show\n @brochure = Brochure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brochure }\n end\n end",
"def show\n if @bird\n respond_to do |format|\n format.json { render json: {required: @bird, properties: @bird.properties, families: @bird.families, title: \"POST /birds [request]\", description: \"Get bird by id\",:status => OK }}\n end\n else\n respond_to do |format|\n format.json { render json: {:status => NOT_FOUND} }\n end\n end\n end",
"def show\n @bowl = Bowl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bowl }\n end\n end",
"def show\n @broad = Broad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @broad }\n end\n end",
"def people\n Birdman::Requester.get(\"movies/#{id}/people\")\n end",
"def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end",
"def show\n @boat = Boat.find(params[:id])\n\n render json: @boat\n end",
"def show\n @json = Punk::API.one_beer!(params[:id])\n render json: {\n beer: @json\n }\n create(@json)\n end",
"def show\n @roadcrime = Roadcrime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @roadcrime }\n end\n end",
"def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end",
"def show\n @borrower = Borrower.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @borrower }\n end\n end",
"def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end",
"def show\n @herb = Herb.find_by_permalink(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @herb }\n end\n end",
"def show\n @bruschettum = Bruschettum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bruschettum }\n end\n end",
"def show\n @neighborhood = Neighborhood.find(params[:id])\n\n render json: @neighborhood\n end",
"def show\n @photo_booth = PhotoBooth.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo_booth }\n end\n end",
"def show\n @brewhouse = Brewhouse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brewhouse }\n end\n end",
"def show\n @borad = Borad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @borad }\n end\n end",
"def show\n @neighborhood = Neighborhood.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @neighborhood }\n end\n end",
"def show\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json {render json: @boat}\n end\n end",
"def get_batterie_by_building\n @battery = Battery.where(building_id: params[:building_id])\n respond_to do |format| \n format.json { render :json => @battery }\n end\n \n end",
"def index\n @brouchers = Broucher.all\n end",
"def show\n @begivenhed = Begivenhed.find(params[:id])\n @bruger = Bruger.find_by_id(current_user.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @begivenhed }\n end\n end",
"def show\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status }\n end\n end",
"def show_beer\n render json: BreweryDb::ShowBeer.new(params[:beerId]).results\n end",
"def index\n @cartridges = Cartridge.all\n\n respond_to do |format|\n format.html\n format.json { render json: @cartridges }\n end\n end",
"def show\n @baggage = Baggage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @baggage }\n end\n end",
"def index\n @breeds = Breed.all\n\n render json: @breeds\n end",
"def show\n @bet = Bet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bet }\n end\n end",
"def show\n @round_robin_promo = RoundRobinPromo.find(params[:id])\n \n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @round_robin_promo }\n end\n end",
"def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end",
"def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend",
"def show\n @breeding_pair = BreedingPair.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @breeding_pair }\n end\n end",
"def show\n @bb = Bb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bb }\n end\n end",
"def index\n @breeds = Breed.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @breeds }\n end\n end",
"def index\n @neighborhoods = Neighborhood.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @neighborhoods }\n end\n end",
"def index\n @chargers = Charger.all\n render json: @chargers\n end",
"def show\n @betraege = Betraege.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @betraege }\n end\n end",
"def show\n @verbo = Verbo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verbo }\n end\n end",
"def show\n @blast = Blast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blast }\n end\n end",
"def show\n @razmer_go = RazmerGo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @razmer_go }\n end\n end",
"def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end",
"def get_carriers\n @transporter = Transporter.find(params[:id])\n\n render json: @transporter.carriers\n end",
"def index\n @networkings = Networking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @networkings }\n end\n end",
"def show\n @mosttwo = Mosttwo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mosttwo }\n end\n end",
"def show\n @gitto = Gitto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gitto }\n end\n end",
"def get_beer\n beer_id = params['id'];\n response = HTTP.get('http://api.brewerydb.com/v2/beer/' + beer_id,\n :params=> {\n :key => ENV[\"BREWERYDB_BEERRATER_KEY\"],\n :withBreweries => \"y\"\n }\n )\n\n body = response.parse\n\n # check for success\n if body[\"status\"] == \"success\"\n data = body[\"data\"]\n unless data.nil?\n render json: {\n status: 200,\n message: \"#{params['id']} found\",\n data: data}\n else\n render json: {\n status: 200,\n message: \"#{params['id']} not found\",\n data: []\n }\n end\n else\n render json: { status: 401, message: body[\"errorMessage\"]}\n end\n end",
"def show\n @clonet = Clonet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clonet }\n end\n end",
"def set_brother\n @brother = Brother.find(params[:id])\n end",
"def show\n render \"api/v1/bounties/show\"\n end",
"def show\n @orden_cobro = OrdenCobro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orden_cobro }\n end\n end",
"def show\n @orden_cobro = OrdenCobro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orden_cobro }\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 bridges_list\n get \"bridges\"\n end",
"def show\n if [email protected]?\n render json: @bird\n else\n render json: \"\", status: 404\n end\n end",
"def index\n @buses = Bus.order('leaving_from_id')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @buses }\n end\n end",
"def index\n @cocktails = Cocktail.where(\"oficial = ?\", false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cocktails }\n end\n end",
"def find_bridges(params={}, headers=default_headers)\n @logger.info(\"Find Bridges.\")\n get(\"#{@api_url}/bridges\", params, headers)\n end",
"def index\n @bronies = Brony.all\n end",
"def index\n @neighborhoods = Neighborhood.alphabetical.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @neighborhoods }\n end\n end",
"def show\n @bottling = Bottling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bottling }\n end\n end",
"def show\n @bruger = Bruger.find_by_id(current_user.id)\n @onske = Onske.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @onske }\n end\n end",
"def index\n @bookings = Booking.all.map { |b| [b, b.contact, b.persons.first] }\n respond_to do |format|\n format.html\n format.json { render json: @bookings }\n end\n end",
"def show\n @railway = Railway.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @railway }\n end\n end",
"def show\n @beer = Beer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beer }\n end\n end",
"def show\n @bloque = Bloque.find(params[:id])\n\n render json: @bloque\n end",
"def show\n @social_contract = SocialContract.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @social_contract }\n end\n end",
"def show\n render json: Agent.find(params[:id]).buyers\n end",
"def show\n @breed = Breed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @breed }\n end\n end",
"def show\n @baton = Baton.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @baton }\n end\n end",
"def show\n @grocery = Grocery.find(params[:id])\n\n render json: @grocery\n end",
"def index\n @super_bowl_picks = SuperBowlPick.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @super_bowl_picks }\n end\n end",
"def show\n render json: @bike #serializer: Web::V1::BikeSerializer\n end",
"def show\n @climb = Climb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @climb }\n end\n end",
"def index\n @loves = Love.all\n render json: @loves\n end",
"def show\n @mostsmallroad = Mostsmallroad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallroad }\n end\n end",
"def show\n @bp = Bp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bp }\n end\n end",
"def index\n @money = Money.all\n require 'net/http'\n require 'json'\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @lookup_money = JSON.parse(@response)\n end",
"def show\n\tadd_breadcrumb \"Datos de la librería\", :librerias_path\n @libreria = Libreria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @libreria }\n end\n end",
"def show\n @bike = Bike.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bike }\n end\n end",
"def index\n @boredoms = Boredom.all\n end",
"def show\n @bordado = Bordado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bordado }\n end\n end",
"def show\n @bloom = Bloom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bloom }\n end\n end",
"def show\n @brewery = Brewery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brewery }\n end\n end",
"def index\n @birds = Bird.all.to_a\n begin\n respond_to do |format|\n format.json { render json: {items: @birds, description: \"List all visible birds in the registry\", additionalProperties: false, title: \"POST /birds [request]\",:status => OK } }\n end\n rescue => e\n render json: ({:status => INTERNAL_SERVER_ERROR})\n end\n end",
"def show\n @registro_bovino = RegistroBovino.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @registro_bovino }\n end\n end",
"def show\n @facebook_blast = FacebookBlast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @facebook_blast }\n end\n end",
"def postal_beers\n render json: BreweryDb::ShowBeers.new('postal', params[:postal]).results\n end",
"def index\n @bill_cargos = @bill.bill_cargos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bill_cargos }\n end\n end",
"def index\n @relationships = Relationship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @relationships }\n end\n end",
"def show\n render json: @bike_type\n end",
"def index\n @breeding_pairs = current_user.breeding_pairs.all\n\n respond_to do |format|\n format.json { render json: @breeding_pairs }\n end\n end",
"def show\n @networking = Networking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @networking }\n end\n end",
"def index\n @shop_section = ShopSection.find_by_short_url(\"brands\")\n @brands = Brand.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brands }\n end\n end"
]
| [
"0.67831814",
"0.6519778",
"0.6460452",
"0.64538556",
"0.64479095",
"0.6350875",
"0.6316107",
"0.62831056",
"0.62824655",
"0.62755793",
"0.6224052",
"0.6218453",
"0.6191556",
"0.6189039",
"0.61557543",
"0.615159",
"0.61464834",
"0.613041",
"0.6125705",
"0.6106855",
"0.61040074",
"0.6094657",
"0.6076581",
"0.6064629",
"0.606407",
"0.60583633",
"0.60529274",
"0.604964",
"0.6036237",
"0.60259706",
"0.60240686",
"0.6017221",
"0.60172087",
"0.6005549",
"0.6004542",
"0.5996188",
"0.59953797",
"0.59905297",
"0.59841615",
"0.59835017",
"0.5973794",
"0.5959794",
"0.59464484",
"0.5942232",
"0.59373313",
"0.59345084",
"0.59242165",
"0.5921425",
"0.5914595",
"0.58981276",
"0.5895833",
"0.5895528",
"0.5891164",
"0.58898693",
"0.5886531",
"0.58861357",
"0.5882014",
"0.5882014",
"0.58795464",
"0.58780056",
"0.58771235",
"0.5872837",
"0.5872187",
"0.5870757",
"0.58706737",
"0.58665514",
"0.5866383",
"0.5860864",
"0.5854893",
"0.5852189",
"0.5844795",
"0.5837944",
"0.5837438",
"0.5831749",
"0.5830999",
"0.5818032",
"0.5817614",
"0.58139503",
"0.5813019",
"0.58118236",
"0.5811375",
"0.58113474",
"0.5811103",
"0.5802779",
"0.5801825",
"0.5799756",
"0.57865083",
"0.57857555",
"0.5775021",
"0.5774341",
"0.57650024",
"0.57635945",
"0.57633996",
"0.57627827",
"0.57593054",
"0.575001",
"0.5748373",
"0.5739128",
"0.5737323",
"0.5736919"
]
| 0.7428551 | 0 |
GET /brothers/new GET /brothers/new.json | def new
@brother = Brother.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @brother }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @brother = Brother.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @brother }\n end\n end",
"def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood }\n end\n end",
"def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood }\n end\n end",
"def new\n @borrower = Borrower.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrower }\n end\n end",
"def new\n @borrower = Borrower.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrower }\n end\n end",
"def new\n @gitto = Gitto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gitto }\n end\n end",
"def new\n @borrow = Borrow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrow }\n end\n end",
"def new\n @broad = Broad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @broad }\n end\n end",
"def new\n @boat = Boat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json {render json: @boat}\n end\n end",
"def new\n @torneo = Torneo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @torneo }\n end\n end",
"def new\n @borrow_request = BorrowRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrow_request }\n end\n end",
"def new\n @clonet = Clonet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clonet }\n end\n end",
"def new\n @brochure = Brochure.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @brochure }\n end\n end",
"def new\n @baton = Baton.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @baton }\n end\n end",
"def new\n @title = t('view.banks.new_title')\n @bank = Bank.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bank }\n end\n end",
"def new\n @bounty = Bounty.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bounty }\n end\n end",
"def new\n @person = Person.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end",
"def new\n @railway = Railway.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @railway }\n end\n end",
"def new\n @borc = Borc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borc }\n end\n end",
"def new\n @breed = Breed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @breed }\n end\n end",
"def new\n @lost = Lost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost }\n end\n end",
"def new\n @breadcrumb = 'create'\n @bank = Bank.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bank }\n end\n end",
"def new\n @social_network = SocialNetwork.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @social_network }\n end\n end",
"def new\n @person = people_type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end",
"def new\n @brend = Brend.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @brend }\n end\n end",
"def create\n @brother = Brother.new(params[:brother])\n\n respond_to do |format|\n if @brother.save\n format.html { redirect_to @brother, notice: 'Cadastro atualizado com sucesso.' }\n format.json { render json: @brother, status: :created, location: @brother }\n else\n format.html { render action: \"new\" }\n format.json { render json: @brother.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @bp = Bp.new\n @bp.person_id = current_person.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bp }\n end\n end",
"def new\n @distro = Distro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @distro }\n end\n end",
"def new\n @distro = Distro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @distro }\n end\n end",
"def new\n @contractor_type = ContractorType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contractor_type }\n end\n end",
"def new\n @family = Family.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family }\n end\n end",
"def new\n @family_crest = FamilyCrest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_crest }\n end\n end",
"def new\n @roadcrime = Roadcrime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @roadcrime }\n end\n end",
"def new\n @verbo = Verbo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @verbo }\n end\n end",
"def new\n @bob = Bob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bob }\n end\n end",
"def new\n @lore = Lore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lore }\n end\n end",
"def new\n @trenton = Trenton.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trenton }\n end\n end",
"def new\n @thing = Thing.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end",
"def new\n normal_id = Priority.find_by_description(\"Normal\")\n @passenger = Passenger.new({:routing_id => params[:routing_id], \n :priority_id => normal_id.id})\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @passenger }\n end\n end",
"def new\n @bl = Bl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bl }\n end\n end",
"def new\n @bb = Bb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bb }\n end\n end",
"def new\n @borad = Borad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @borad }\n end\n end",
"def new\n @candidato = Candidato.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @candidato }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end",
"def new\n @stuff = Stuff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stuff }\n end\n end",
"def create\n @brother = Brother.new(params[:brother])\n\n respond_to do |format|\n if @brother.save\n flash[:notice] = 'Brother was successfully created.'\n format.html { render :back }\n format.xml { render :xml => @brother, :status => :created, :location => @brother }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @brother.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @fridge = Fridge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fridge }\n end\n end",
"def new\n @party = Party.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @party }\n end\n end",
"def new\n @loan = Loan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loan }\n end\n end",
"def new\n @title = \"New Book\"\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @pokeparty = Pokeparty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pokeparty }\n end\n end",
"def new\n @moose = Moose.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @moose }\n end\n end",
"def new\n @bid = Bid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bid }\n end\n end",
"def new\n @bid = Bid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bid }\n end\n end",
"def new\n @surname = Surname.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @surname }\n end\n end",
"def new\n @company = Company.new(:name => 'default')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @company }\n end\n end",
"def new\n @carpool = Carpool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @carpool }\n end\n end",
"def new\n @actore = Actore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @actore }\n end\n end",
"def new\n @crime = Crime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crime }\n end\n end",
"def new\n @pot = Pot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pot }\n end\n end",
"def new\n @bokin = Bokin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bokin }\n end\n end",
"def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end",
"def new\n @network = Network.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @network }\n end\n end",
"def new\n @beer = Beer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @beer }\n end\n end",
"def new\n @beer = Beer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @beer }\n end\n end",
"def new\n @bet = Bet.new(:odd_inflation => 10, :bid_amount => 1)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bet }\n end\n end",
"def new\n @ram = Ram.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ram }\n end\n end",
"def new\n @believer = Believer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @believer }\n end\n end",
"def new\n @personnage = Personnage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @personnage }\n end\n end",
"def new\n @bank = Bank.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bank }\n end\n end",
"def new\n @book = Book.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @business = Business.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @business }\n end\n end",
"def new\n @brand = Brand.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @brand }\n end\n end",
"def new\n @clue = Clue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clue }\n end\n end",
"def new\n @clue = Clue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clue }\n end\n end",
"def new\n @baggage = Baggage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @baggage }\n end\n end",
"def new\n @pto = Pto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pto }\n end\n end",
"def new\n @bruschettum = Bruschettum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bruschettum }\n end\n end",
"def new\n @owner = Owner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @owner }\n end\n end",
"def new\n @business = Business.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @business }\n end\n end",
"def new\n @bruger_id = current_user.id\n @bruger = Bruger.find_by_id(@bruger_id)\n @onske = Onske.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @onske }\n end\n end",
"def new\n @money = Money.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @money }\n end\n end",
"def new\n @potluck = Potluck.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @potluck }\n end\n end",
"def new\n @road = Road.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @road }\n end\n end",
"def new\n @benfeitor = Benfeitor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @benfeitor }\n end\n end",
"def new\n load_data\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @book }\n end\n end",
"def new\n @b = B.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @b }\n end\n end",
"def new\n @stalking = Stalking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stalking }\n end\n end",
"def new\n @what = What.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @what }\n end\n end",
"def new\n @dependent_relationship = DependentRelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dependent_relationship }\n end\n end",
"def new\n @brain = Brain.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @brain }\n end\n end",
"def new\n\t\t@person = Person.new\n\t\t# render json: @person #skips the view, and just renders out the json\n\tend",
"def new\n @business_type = BusinessType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @business_type }\n end\n end"
]
| [
"0.72790605",
"0.72424227",
"0.72424227",
"0.72308916",
"0.72308916",
"0.71890324",
"0.7178286",
"0.71629953",
"0.71312666",
"0.70962596",
"0.70483905",
"0.7040475",
"0.7011177",
"0.7010174",
"0.6997991",
"0.69556075",
"0.6937822",
"0.69256485",
"0.69250315",
"0.69229984",
"0.6919326",
"0.69189173",
"0.69081205",
"0.6906927",
"0.69047505",
"0.6900076",
"0.6897113",
"0.6894744",
"0.6894744",
"0.6892782",
"0.6882732",
"0.68817264",
"0.6870858",
"0.6868988",
"0.6866799",
"0.6864298",
"0.68635124",
"0.6858203",
"0.68581074",
"0.6857848",
"0.68543506",
"0.68516797",
"0.6846882",
"0.68467736",
"0.68467736",
"0.68467736",
"0.68467736",
"0.68467736",
"0.68467736",
"0.68467736",
"0.68462574",
"0.68417233",
"0.6838724",
"0.68381554",
"0.68329734",
"0.6827401",
"0.6823012",
"0.68216026",
"0.6816489",
"0.6816489",
"0.68156487",
"0.6809489",
"0.68040174",
"0.6802001",
"0.67852646",
"0.67826086",
"0.6781628",
"0.67780465",
"0.67764795",
"0.677178",
"0.677178",
"0.67707837",
"0.6769852",
"0.6764454",
"0.6763532",
"0.6763381",
"0.6763338",
"0.6763338",
"0.676038",
"0.6758662",
"0.67555785",
"0.67555785",
"0.6753826",
"0.6752699",
"0.67503583",
"0.674708",
"0.67467225",
"0.67465985",
"0.6744699",
"0.67403376",
"0.6739949",
"0.67360675",
"0.6734931",
"0.6734304",
"0.6732252",
"0.67277545",
"0.6727107",
"0.6724734",
"0.6724625",
"0.6724087"
]
| 0.80829954 | 0 |
POST /brothers POST /brothers.json | def create
@brother = Brother.new(params[:brother])
respond_to do |format|
if @brother.save
format.html { redirect_to @brother, notice: 'Cadastro atualizado com sucesso.' }
format.json { render json: @brother, status: :created, location: @brother }
else
format.html { render action: "new" }
format.json { render json: @brother.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @brother = Brother.new(params[:brother])\n\n respond_to do |format|\n if @brother.save\n flash[:notice] = 'Brother was successfully created.'\n format.html { render :back }\n format.xml { render :xml => @brother, :status => :created, :location => @brother }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @brother.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @brother = Brother.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @brother }\n end\n end",
"def create\n @broucher = current_user.company.stall.brouchers.build(broucher_params)\n\n respond_to do |format|\n if @broucher.save\n format.html { redirect_to @broucher.stall, notice: 'Broucher was successfully created.' }\n format.json { render :show, status: :created, location: @broucher }\n else\n format.html { render :new }\n format.json { render json: @broucher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @brodo = Brodo.new(brodo_params)\n\n respond_to do |format|\n if @brodo.save\n format.html { redirect_to @brodo, notice: 'Brodo was successfully created.' }\n format.json { render :show, status: :created, location: @brodo }\n else\n format.html { render :new }\n format.json { render json: @brodo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def bridges_create(params = {})\n post \"bridges\", params\n end",
"def create\n @herb = Herb.new(params[:herb])\n\n respond_to do |format|\n if @herb.save\n format.html { redirect_to @herb, notice: 'Herb was successfully created.' }\n format.json { render json: @herb, status: :created, location: @herb }\n else\n format.html { render action: \"new\" }\n format.json { render json: @herb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n passenger = Passenger.new(:name => params[:name], :contact_number => params[:contact_number], :nationality => params[:nationality], :meal_pref => params[:meal_pref])\n passenger.save\n render :json => passenger\n end",
"def create\n @bizcard = Bizcard.new(params[:bizcard])\n @bizcard.relationships.build(:user_id => current_user.id)\n\n respond_to do |format|\n if @bizcard.save\n format.html { redirect_to root_path, notice: 'Bizcard was successfully created.' }\n format.json { render json: @bizcard, status: :created, location: @bizcard }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bizcard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @robin = Robin.new(robin_params)\n\n respond_to do |format|\n if @robin.save\n format.html { redirect_to @robin, notice: 'Robin was successfully created.' }\n format.json { render :show, status: :created, location: @robin }\n else\n format.html { render :new }\n format.json { render json: @robin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @boredom = Boredom.new(boredom_params)\n\n respond_to do |format|\n if @boredom.save\n format.html { redirect_to @boredom, notice: 'Boredom was successfully created.' }\n format.json { render :show, status: :created, location: @boredom }\n else\n format.html { render :new }\n format.json { render json: @boredom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #bird name must be present\n if params[:name].blank?\n render json: {\n status: 400,\n message: \"Fågelns namn måste anges.\" \n }\n end\n \n #latin name must be present\n if params[:latin].blank?\n render json: {\n status: 400,\n message: \"Fågelns latinska namn måste anges.\" \n }\n end\n \n #regularity must be present\n if params[:regularity].blank?\n render json: {\n status: 400,\n message: \"Fågelns regularitet måste anges.\" \n }\n end\n \n #check if bird already exists\n if Api::V1::Bird.exists?(:bird_name => params[:name])\n render json: {\n status: 400,\n message: \"Fågeln finns redan\" \n }\n else\n @bird = Api::V1::Bird.create(:bird_name => params[:name], :latin_name => params[:latin], :regularity => params[:regularity])\n render json: {\n status: 201,\n message: \"Fågeln är registrerad och finns nu i listan.\", \n bird: Api::V1::BirdSerializer.new(@bird) \n }\n end\n end",
"def create\n @borad = Borad.new(params[:borad])\n\n respond_to do |format|\n if @borad.save\n format.html { redirect_to @borad, :notice => 'Borad was successfully created.' }\n format.json { render :json => @borad, :status => :created, :location => @borad }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @borad.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n relationship = Relationship.new(\n sender_id: current_user.id,\n recipient_id: params[:recipient_id]\n )\n if relationship.save\n render json: relationship\n else\n render json: { errors: relationship.errors.full_messages }, status: :unprocessable_entity\n end\n end",
"def create(params, membership)\n # Send payload to blip\n data = {\n initials: (params[4].nil? ? params[5][0] : params[4].tr('^a-zA-Z', '')),\n firstname: (params[5].nil? ? params[4][0] : params[5]),\n lastname: [params[6], params[7]].reject{|e| e.nil? or e.empty?}.join(' '),\n email: (params[3].nil? ? '[email protected]' : params[3]),\n gender: params[9] == 'Vrouw' ? 'F' : 'M',\n phone: params[14],\n mobile: params[2],\n phone_parents: params[24],\n address: [params[10], params[11], params[12]].join(' '),\n membership: membership,\n }\n begin\n unless params[15].nil?\n data[:dateofbirth] = Date.strptime(params[15], '%d-%m-%Y').strftime('%Y-%m-%d')\n end\n rescue\n $problems.write \"#{$index}, #{data[:firstname]} #{data[:lastname]}, Birthdate ignored\\n\"\n end\n blip = post('https://people.i.bolkhuis.nl/persons', data)\n\n # Grab uid\n unless blip == nil\n uid = blip['uid']\n\n # Send payload to operculum\n put(\"https://operculum.i.bolkhuis.nl/person/#{uid}\", {\n nickname: params[8],\n study: params[16],\n alive: params[17].nil?,\n inauguration: params[25],\n resignation_letter: params[26],\n resignation: params[27],\n })\n end\nend",
"def create\n @neighborhood = Neighborhood.new(params[:neighborhood])\n\n respond_to do |format|\n if @neighborhood.save\n format.html { redirect_to @neighborhood, notice: 'Neighborhood was successfully created.' }\n format.json { render json: @neighborhood, status: :created, location: @neighborhood }\n else\n format.html { render action: \"new\" }\n format.json { render json: @neighborhood.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @neighborhood = Neighborhood.new(params[:neighborhood])\n\n respond_to do |format|\n if @neighborhood.save\n format.html { redirect_to @neighborhood, notice: 'Neighborhood was successfully created.' }\n format.json { render json: @neighborhood, status: :created, location: @neighborhood }\n else\n format.html { render action: \"new\" }\n format.json { render json: @neighborhood.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @boat = Boat.new(boat_params)\n\n if @boat.save\n render json: @boat, status: :created, location: @boat\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end",
"def set_brother\n @brother = Brother.find(params[:id])\n end",
"def create\n @roulette = Roulette.new(roulette_params)\n\n respond_to do |format|\n if @roulette.save\n format.html { redirect_to @roulette, notice: 'Roulette was successfully created.' }\n format.json { render :show, status: :created, location: @roulette }\n else\n format.html { render :new }\n format.json { render json: @roulette.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @therapist = Therapist.new(therapist_params.merge({code: create_code}))\n if @therapist.save\n render :json => {\n id: @therapist.id,\n email: @therapist.email,\n firstName: @therapist.first_name,\n lastName: @therapist.last_name,\n prefix: @therapist.prefix,\n profession: @therapist.profession,\n code: @therapist.code,\n token: get_token(@therapist)\n }\n else\n render json: @therapist.errors, status: :unprocessable_entity\n # render json: @therapist.errors, status: :unprocessable_entity\n end\n end",
"def create\n @intranet_boleto = Intranet::Boleto.new(intranet_boleto_params)\n\n respond_to do |format|\n if @intranet_boleto.save\n format.html { redirect_to @intranet_boleto, notice: \"Boleto was successfully created.\" }\n format.json { render :show, status: :created, location: @intranet_boleto }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @intranet_boleto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @brochure = Brochure.new(params[:brochure])\n\n respond_to do |format|\n if @brochure.save\n format.html { redirect_to @brochure, notice: 'Brochure was successfully created.' }\n format.json { render json: @brochure, status: :created, location: @brochure }\n else\n format.html { render action: \"new\" }\n format.json { render json: @brochure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_voted_beer\n render json: BreweryDb::CreateVotedbeer.new(params[:beerId]).create\n end",
"def create\n @betraege = Betraege.new(params[:betraege])\n\n respond_to do |format|\n if @betraege.save\n format.html { redirect_to @betraege, :notice => 'Betraege was successfully created.' }\n format.json { render :json => @betraege, :status => :created, :location => @betraege }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @betraege.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @britt = Britt.new(britt_params)\n\n respond_to do |format|\n if @britt.save\n format.html { redirect_to @britt, notice: 'Britt was successfully created.' }\n format.json { render :show, status: :created, location: @britt }\n else\n format.html { render :new }\n format.json { render json: @britt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bingo = Bingo.new(bingo_params)\n\n respond_to do |format|\n if @bingo.save\n format.html { redirect_to @bingo, notice: \"Bingo was successfully created.\" }\n format.json { render :show, status: :created, location: @bingo }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bingo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @borrower = Borrower.new(params[:borrower])\n\n respond_to do |format|\n if @borrower.save\n format.html { redirect_to @borrower, notice: 'Borrower was successfully created.' }\n format.json { render json: @borrower, status: :created, location: @borrower }\n else\n format.html { render action: \"new\" }\n format.json { render json: @borrower.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\tboat = Boat.new(boat_params)\n \tif boat.save\n \t\trender json: boat, status: 201\n \tend\n\tend",
"def create\n @brend = Brend.new(params[:brend])\n\n respond_to do |format|\n if @brend.save\n format.html { redirect_to @brend, notice: 'Brend was successfully created.' }\n format.json { render json: @brend, status: :created, location: @brend }\n else\n format.html { render action: \"new\" }\n format.json { render json: @brend.errors, status: :unprocessable_entity }\n end\n end\n end",
"def createCharities\n\tcharity_list = [\"Direct Relief\", \"Catholic Medical Mission Board\", \"MAP International\", \"United Nations Foundation\", \"The Rotary Foundation of Rotary International\", \"Samaritan's Purse\", \"Institute of International Education\", \"International Rescue Committee\", \"Compassion International\", \"United States Fund for UNICEF\"]\n\tcharity_list.each do |charity|\n\t\tRestClient.post 'http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40', { \"name\": \"#{charity}\"}.to_json, :content_type => :json, :accept => :json\n\tend\nend",
"def create\n @borrower = Borrower.new(params[:borrower])\n respond_to do |format|\n if @borrower.save\n format.html { redirect_to @borrower, notice: 'Borrower was successfully created.' }\n format.json { render json: @borrower, status: :created, location: @borrower }\n else\n format.html { render action: \"new\" }\n format.json { render json: @borrower.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_create_transaction\n params = {\n bank_transaction: {\n bank_account_id: 1,\n date: Time.local(2012, 4, 16),\n amount: 55\n }\n }\n\n post '/api/banks/1/transactions', params\n data = ActiveSupport::JSON.decode last_response.body\n\n assert last_response.successful?\n assert_match('application/json', last_response.content_type)\n assert BankTransaction.find(data['id'])\n end",
"def create\n @neighbourhood = Neighbourhood.new(neighbourhood_params)\n\n respond_to do |format|\n if @neighbourhood.save\n format.html { redirect_to @neighbourhood, notice: 'Neighbourhood was successfully created.' }\n format.json { render :show, status: :created, location: @neighbourhood }\n else\n format.html { render :new }\n format.json { render json: @neighbourhood.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @berth_order = BerthOrder.new\n @berth_order.status = Status.find_by(status: \"Under behandling\")\n if berth_order_params[\"boat_id\"].blank?\n @boat = Boat.new\n @boat.name = params[:boat][:name]\n @boat.width = params[:boat][:width].gsub(',', '.')\n @boat.user = current_user\n @boat.save\n @berth_order.boat = @boat\n else\n @berth_order.boat_id = berth_order_params[:boat_id]\n end\n\n @berth_order.season_id = berth_order_params[:season_id]\n\n #.. And finally:\n respond_to do |format|\n if @berth_order.save\n format.html { redirect_to @berth_order, notice: 'Berth order was successfully created.' }\n format.json { render :show, status: :created, location: @berth_order }\n else\n format.html { render :new }\n format.json { render json: @berth_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bowler = Bowler.new(bowler_params)\n @bowler.save\n respond_with(@bowler)\n end",
"def make_brothers_with(person, attrs = {})\n year = born_in < person.born_in ? born_in : person.born_in\n $neo.batch [:create_relationship, 'brothers', @node, person.node, attrs.merge(since: year)],\n [:create_relationship, 'brothers', person.node, @node, attrs.merge(since: year)]\n end",
"def create\n @robo = Robo.new(robo_params)\n\n respond_to do |format|\n if @robo.save\n format.html { redirect_to @robo, notice: 'Robo was successfully created.' }\n format.json { render :show, status: :created, location: @robo }\n else\n format.html { render :new }\n format.json { render json: @robo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @my_boice = MyBoice.new(my_boice_params)\n\n respond_to do |format|\n if @my_boice.save\n format.html { redirect_to @my_boice, notice: 'My boice was successfully created.' }\n format.json { render :show, status: :created, location: @my_boice }\n else\n format.html { render :new }\n format.json { render json: @my_boice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @broad = Broad.new(params[:broad])\n\n respond_to do |format|\n if @broad.save\n format.html { redirect_to @broad, notice: 'Broad was successfully created.' }\n format.json { render json: @broad, status: :created, location: @broad }\n else\n format.html { render action: \"new\" }\n format.json { render json: @broad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reward = current_business.rewards.build(reward_params)\n\n respond_to do |format|\n if @reward.save\n format.html { redirect_to @reward, notice: 'Reward was successfully created.' }\n format.json { render :show, status: :created, location: @reward }\n else\n format.html { render :new }\n format.json { render json: @reward.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @breeding_pair = current_user.breeding_pair.new(params[:breeding_pair])\n\n respond_to do |format|\n if @breeding_pair.save\n format.json { render json: @breeding_pair, status: :created, location: @breeding_pair }\n else\n format.json { render json: @breeding_pair.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @boook = Boook.new(boook_params)\n\n respond_to do |format|\n if @boook.save\n format.html { redirect_to @boook, notice: 'Boook was successfully created.' }\n format.json { render :show, status: :created, location: @boook }\n else\n format.html { render :new }\n format.json { render json: @boook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @orden_cobro = OrdenCobro.new(params[:orden_cobro])\n\n respond_to do |format|\n if @orden_cobro.save\n format.html { redirect_to @orden_cobro, notice: 'Orden cobro was successfully created.' }\n format.json { render json: @orden_cobro, status: :created, location: @orden_cobro }\n else\n format.html { render action: \"new\" }\n format.json { render json: @orden_cobro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @friendship = current_person.friendships.build(:granter_id => params[:granter_id], :accepted => params[:accepted])\n\n respond_to do |format|\n if @friendship.save\n format.html { redirect_to people_url, notice: 'A friend request has been sent to ' + Person.find(params[:granter_id]).name }\n format.json { render :show, status: :created, location: @friendship }\n else\n format.html { render :new }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @borc = Borc.new(params[:borc])\n\n respond_to do |format|\n if @borc.save\n format.html { redirect_to @borc, notice: 'Borc was successfully created.' }\n format.json { render json: @borc, status: :created, location: @borc }\n else\n format.html { render action: \"new\" }\n format.json { render json: @borc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n begin\n @bird = Bird.new(bird_params)\n @bird.visible = false if @bird.visible.nil?\n @bird.added = Date.today\n @bird.continents = bird_params[:continents].uniq\n if @bird.save\n render json: @bird, status: :created, location: @bird\n else\n render json: @bird.errors, status: 400\n end\n rescue Exception => e\n render json: \"\", status: 400\n end\n end",
"def create\n @brewhouse = Brewhouse.new(params[:brewhouse])\n\n respond_to do |format|\n if @brewhouse.save\n format.html { redirect_to @brewhouse, notice: 'Brewhouse was successfully created.' }\n format.json { render json: @brewhouse, status: :created, location: @brewhouse }\n else\n format.html { render action: \"new\" }\n format.json { render json: @brewhouse.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @boat = @harbour.boats.build(boat_params)\n @boat.save\n redirect_to harbour_boats_path(@harbour)\n # respond_to do |format|\n # if @boat.save\n # format.html { redirect_to harbour_boats_path, notice: 'Boat was successfully created.' }\n # format.json { render :show, status: :created, location: @boat }\n # else\n # format.html { render :new }\n # format.json { render json: @boat.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n @burrito = Burrito.new(burrito_params)\n\n respond_to do |format|\n if @burrito.save\n format.html { redirect_to @burrito, notice: 'Burrito was successfully created.' }\n format.json { render action: 'show', status: :created, location: @burrito }\n else\n format.html { render action: 'new' }\n format.json { render json: @burrito.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bruschettum = Bruschettum.new(params[:bruschettum])\n params[:ingredient].each{|ingr|\n @bruschettum.ingredients << Ingredient.find_by_name(ingr)\n }\n\n\n respond_to do |format|\n if @bruschettum.save\n format.html { redirect_to @bruschettum, notice: 'Bruschetta è stata creata con successo.' }\n format.json { render json: @bruschettum, status: :created, location: @bruschettum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bruschettum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bordado = Bordado.new(params[:bordado])\n\n respond_to do |format|\n if @bordado.save\n format.html { redirect_to @bordado, notice: 'Bordado was successfully created.' }\n format.json { render json: @bordado, status: :created, location: @bordado }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bordado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brother }\n end\n end",
"def create\n @torneo = Torneo.new(params[:torneo])\n\n respond_to do |format|\n if @torneo.save\n format.html { redirect_to @torneo, notice: 'Torneo was successfully created.' }\n format.json { render json: @torneo, status: :created, location: @torneo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @torneo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n begin\n respond_to do |format|\n if @bird.save(bird_params)\n format.json { render json: {items: @birds, properties: @bird.properties, families: @bird.families, description: \"Add a new bird to the library\",:status => CREATED} }\n else\n format.json { render json: @bird.errors, :status => NOT_FOUND }\n end\n end\n else\n render json:({:status => INTERNAL_SERVER_ERROR})\n end\n end",
"def create\n @banco = Banco.new(banco_params)\n\n respond_to do |format|\n if @banco.save\n format.html { redirect_to(:bancos, :notice => t('activerecord.successful.messages.created', :model => @banco.class.model_name.human))}\n format.json { render :show, status: :created, location: @banco }\n else\n format.html { render :new }\n format.json { render :json => { :errors => @banco.errors.full_messages }, :status => 422 }\n end\n end\n end",
"def new\n @kebab = Kebab.new\n @kebab.build_promoter\n @kebab.transportations << Transportation.new\n @kebab.participations << Participation.new\n @kebab.comments << Comment.new\n @people = Person.all(:order => 'name asc')\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @kebab }\n end\n end",
"def create(bin_params)\n @rest.post('save', bin_params)\n end",
"def create\n @family_bond = FamilyBond.new(family_bond_params)\n\n respond_to do |format|\n if @family_bond.save\n format.html { redirect_to @family_bond, notice: 'Family bond was successfully created.' }\n format.json { render :show, status: :created, location: @family_bond }\n else\n format.html { render :new }\n format.json { render json: @family_bond.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bot_bingo_number = BotBingoNumber.new(bot_bingo_number_params)\n\n respond_to do |format|\n if @bot_bingo_number.save\n format.html { redirect_to @bot_bingo_number, notice: 'Bot bingo number was successfully created.' }\n format.json { render json: @bot_bingo_number, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @bot_bingo_number.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bok = Bok.new(bok_params)\n\n respond_to do |format|\n if @bok.save\n format.html { redirect_to @bok, notice: 'Bok was successfully created.' }\n format.json { render :show, status: :created, location: @bok }\n else\n format.html { render :new }\n format.json { render json: @bok.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @brother = Brother.find(params[:id])\n @brother.destroy\n\n respond_to do |format|\n format.html { redirect_to brothers_url }\n format.json { head :no_content }\n end\n end",
"def create\n @borrower_request = BorrowerRequest.new(borrower_request_params)\n\n respond_to do |format|\n if @borrower_request.save\n @borrower_request.update_attributes(place: JSON.parse(params[:borrower_request][:place]))\n format.html { redirect_to borrower_requests_url, notice: 'Borrower request was successfully created.' }\n format.json { render :show, status: :created, location: @borrower_request }\n else\n format.html { render :new }\n format.json { render json: @borrower_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@gift = Gift.new(gift_params)\n #create(giftname, gifturl, username)\n @id = gift_params[:giver]\n @user = Users.find_by(id: @id)\n puts params\n output = Gift.create(gift_params[:name], gift_params[:url], @user.username, params[:bio])\n render json: output\n # respond_to do |format|\n # if @gift.save\n # format.html { redirect_to @gift, notice: 'Gift was successfully created.' }\n # format.json { render :show, status: :created, location: @gift }\n # else\n # format.html { render :new }\n # format.json { render json: @gift.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n @bowl = Bowl.new(params[:bowl])\n\n respond_to do |format|\n if @bowl.save\n format.html { redirect_to(@bowl, :notice => 'Bowl was successfully created.') }\n format.xml { render :xml => @bowl, :status => :created, :location => @bowl }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n if params[:name].present?\n @json = Punk::API.beers_name!(params[:name])\n elsif params[:abv_gt].present?\n @json = Punk::API.beers_abv_gt!(params[:abv_gt])\n elsif params[:abv_lt].present?\n @json = Punk::API.beers_abv_lt!(params[:abv_lt])\n else\n @json = Punk::API.all_beers!(params)\n end\n\n render json: {\n beers: @json\n }\n create(@json)\n end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def create\n @roadcrime = Roadcrime.new(params[:roadcrime])\n\n respond_to do |format|\n if @roadcrime.save\n format.html { redirect_to @roadcrime, notice: 'Roadcrime was successfully created.' }\n format.json { render json: @roadcrime, status: :created, location: @roadcrime }\n else\n format.html { render action: \"new\" }\n format.json { render json: @roadcrime.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bunny = Bunny.new(bunny_params)\n\n respond_to do |format|\n if @bunny.save\n format.html { redirect_to @bunny, notice: 'Bunny was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bunny }\n else\n format.html { render action: 'new' }\n format.json { render json: @bunny.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@owner = Prover.find(params[:owner])\n\t\[email protected](Prover.find(params[:follows]))\n\n\t\trespond_to do |format|\n\t\t\tif @owner.follow(Prover.find(params[:follows]))\n\t\t\t\tformat.html { render :json => {prover_id: @owner.id, following_id: params[:follows]}.to_json }\n\t\t\telse\n\t\t\t\tformat.html { render :json => {it: \"BROKE\"}.to_json, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @breed = Breed.new(breed_params)\n @user = User.find(params[:user_id])\n @breed.user_id = @user.id\n# puts @breed\nlogger.info(@breed)\n\n if @breed.save!\n render json: @breed, status: :created\n else\n render json: @breed.errors, status: :unprocessable_entity\n end\n # render json: {breed: :breed_params}\n end",
"def new\n @brother = Brother.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @brother }\n end\n end",
"def create\n @bento = Bento.new(bento_params)\n\n respond_to do |format|\n if @bento.save\n format.html { redirect_to @bento, notice: 'Bento was successfully created.' }\n format.json { render :show, status: :created, location: @bento }\n else\n format.html { render :new }\n format.json { render json: @bento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @borrower = @mortgage.borrowers.new(borrower_params)\n\n respond_to do |format|\n if @borrower.save\n flash[:notice] = 'Borrower was successfully created.'\n format.html { redirect_to edit_borrower_path @borrower }\n format.json { render :show, status: :created, location: @borrower }\n else\n format.html { render :new }\n format.json { render json: @borrower.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @zoigl_beer = ZoiglBeer.new(zoigl_beer_params)\n\n respond_to do |format|\n if @zoigl_beer.save\n format.html { redirect_to @zoigl_beer, notice: 'Zoigl beer was successfully created.' }\n format.json { render :show, status: :created, location: @zoigl_beer }\n else\n format.html { render :new }\n format.json { render json: @zoigl_beer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @russian_roulette = RussianRoulette.new(russian_roulette_params)\n @russian_roulette.bulloc = @bulloc\n @russian_roulette.round = @round\n @russian_roulette.alive = @alive\n\n respond_to do |format|\n if @russian_roulette.save\n format.html { redirect_to @russian_roulette, notice: 'Russian roulette was successfully created.' }\n format.json { render :show, status: :created, location: @russian_roulette }\n else\n format.html { render :new }\n format.json { render json: @russian_roulette.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bird = Bird.new(bird_params)\n if @bird.save\n render json: @bird, status: :created\n else\n render json: @bird.errors, status: :unprocessable_entity\n end\n end",
"def create\n @bird = Bird.new(bird_params)\n if @bird.save\n render json: @bird, status: :created, location: @bird\n else\n render json: @bird.errors, status: :unprocessable_entity\n end\n end",
"def create\n @bond = Bond.new(bond_params)\n\n respond_to do |format|\n if @bond.save\n format.html { redirect_to bonds_path, notice: I18n.t('messages.created_with', item: @bond.company) }\n format.json { render :show, status: :created, location: @bond }\n else\n format.html { render :new }\n format.json { render json: @bond.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bingo_hall = BingoHall.new(name: bingo_hall_params[:name])\n\n respond_to do |format|\n if @bingo_hall.save\n bingo_board = @bingo_hall.bingo_boards.create\n Player.create(name: bingo_hall_params[:player_name], bingo_board: bingo_board)\n format.html { redirect_to @bingo_hall, notice: \"Bingo hall was successfully created.\" }\n format.json { render :show, status: :created, location: @bingo_hall }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bingo_hall.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @child_guardian_relationship = ChildGuardianRelationship.new(params[:child_guardian_relationship])\n\n respond_to do |format|\n if @child_guardian_relationship.save\n format.html { redirect_to @child_guardian_relationship, notice: 'Child guardian relationship was successfully created.' }\n format.json { render json: @child_guardian_relationship, status: :created, location: @child_guardian_relationship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @child_guardian_relationship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n require 'securerandom'\n #candidato_params += [\"key\" => SecureRandom.urlsafe_base64(10)]\n @candidato = Candidato.new(candidato_params)\n respond_to do |format|\n if @candidato.save\n format.html { redirect_to @candidato, notice: 'Candidato was successfully created.' }\n format.json { render :show, status: :created, location: @candidato }\n #ApplicationMailer.sendMail(@candidato.email.to_s, \"https://casd-adautobraz.c9users.io/\".concat(@candidato.key.to_s))\n else\n format.html { render :new }\n format.json { render json: @candidato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @relationshipneighbor = Relationshipneighbor.new(relationshipneighbor_params)\n\n respond_to do |format|\n if @relationshipneighbor.save\n format.html { redirect_to @relationshipneighbor, notice: 'Relationshipneighbor was successfully created.' }\n format.json { render :show, status: :created, location: @relationshipneighbor }\n else\n format.html { render :new }\n format.json { render json: @relationshipneighbor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n owner = User.find_or_create params[:owner_id]\n name = params[:name]\n\n lobby = Lobby.create! owner: owner, name: name\n render json: lobby.as_json( only: [:id, :name] )\n end",
"def create\n @mostsmallroad = Mostsmallroad.new(params[:mostsmallroad])\n\n respond_to do |format|\n if @mostsmallroad.save\n format.html { redirect_to @mostsmallroad, notice: 'Mostsmallroad was successfully created.' }\n format.json { render json: @mostsmallroad, status: :created, location: @mostsmallroad }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mostsmallroad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mother_son = MotherSon.new(mother_son_params)\n\n respond_to do |format|\n if @mother_son.save\n format.html { redirect_to @mother_son, notice: \"Mother son was successfully created.\" }\n format.json { render :show, status: :created, location: @mother_son }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @mother_son.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bourbon = Bourbon.new(bourbon_params)\n\n respond_to do |format|\n if @bourbon.save\n format.html { redirect_to @bourbon, notice: 'Bourbon was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bourbon }\n else\n format.html { render action: 'new' }\n format.json { render json: @bourbon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @brasseries = Brasserie.new(brasseries_params)\n\n respond_to do |format|\n if @brasseries.save\n format.html { redirect_to @brasseries, notice: 'Brasserie was successfully created.' }\n format.json { render :show, status: :created, location: @brasseries }\n else\n format.html { render :new }\n format.json { render json: @brasseries.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n reviews = []\n params[:scores].keys.each{ |name|\n score = params[:scores][name]\n peer_review = PeerReview.new(name:name, score:score, miniproject_id:params[:project][:id])\n peer_review.save\n reviews << peer_review\n }\n\n render json: reviews\n\n end",
"def create\n @car = Car.find(params[:car_id])\n @bid = @car.bids.create(bid_params)\n @bid.user = current_user\n\n respond_to do |format|\n if @car.save\n format.html { redirect_to cars_path notice: 'Car was successfully created.'}\n format.json { head :no_content }\n else\n format.html { render action: 'new' }\n format.json { render json: @car.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @brochure_interest = BrochureInterest.new(params[:brochure_interest])\n\n respond_to do |format|\n if @brochure_interest.save\n format.html { redirect_to(@brochure_interest, :notice => 'Brochure interest was successfully created.') }\n format.xml { render :xml => @brochure_interest, :status => :created, :location => @brochure_interest }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @brochure_interest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_twit(twit)\n RestClient.post configuration.base_url + '/twits',\n { twit: twit }.to_json,\n content_type: :json,\n accept: :json\n end",
"def create\n @social_contract = SocialContract.new(params[:social_contract])\n\n respond_to do |format|\n if @social_contract.save\n format.html { redirect_to @social_contract, notice: 'Social contract was successfully created.' }\n format.json { render json: @social_contract, status: :created, location: @social_contract }\n else\n format.html { render action: \"new\" }\n format.json { render json: @social_contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @nearby = Nearby.new(nearby_params)\n\n respond_to do |format|\n if @nearby.save\n format.html { redirect_to @nearby, notice: 'Nearby was successfully created.' }\n format.json { render :show, status: :created, location: @nearby }\n else\n format.html { render :new }\n format.json { render json: @nearby.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @prayer = Prayer.new(params[:prayer])\n\n respond_to do |format|\n if @prayer.save\n format.html { redirect_to @prayer, notice: 'Prayer was successfully created.' }\n format.json { render json: @prayer, status: :created, location: @prayer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bairro = Bairro.new(bairro_params)\n\n respond_to do |format|\n if @bairro.save\n format.html { redirect_to @bairro, notice: 'Bairro criado com sucesso.' }\n format.json { render :show, status: :created, location: @bairro }\n else\n format.html { render :new }\n format.json { render json: @bairro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @candidato = Candidato.new(params[:candidato])\n\n respond_to do |format|\n if @candidato.save\n format.html { redirect_to @candidato, notice: 'Candidato was successfully created.' }\n format.json { render json: @candidato, status: :created, location: @candidato }\n else\n format.html { render action: \"new\" }\n format.json { render json: @candidato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bread = Bread.new(bread_params)\n @bread.bread_store_id = current_bread_store_manager.bread_store.id\n\n respond_to do |format|\n if @bread.save\n format.html { redirect_to @bread, notice: 'パンを作成した.' }\n format.json { render action: 'show', status: :created, location: @bread }\n else\n format.html { render action: 'new' }\n format.json { render json: @bread.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pregnancy = Pregnancy.new(pregnancy_params)\n @rabbit = @pregnancy.rabbit\n @cage = @rabbit.cage\n\n respond_to do |format|\n if @pregnancy.save\n format.html { redirect_to rabbit_pregnancies_path(@rabbit), notice: 'Inizio gravidanza registrato' }\n format.json { render :show, status: :created, location: @pregnancy }\n else\n format.html { render :new }\n format.json { render json: @pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @binder_contractor = BinderContractor.new(params[:binder_contractor])\n @binder = Binder.find(@binder_contractor.binder_id)\n authorize! :create, @binder\n\n respond_to do |format|\n if @binder_contractor.save\n @binder_contractors = working_binder.binder_contractors\n format.html { redirect_to @binder_contractor, notice: 'Binder contractor was successfully created.' }\n format.json { render json: @binder_contractor, status: :created, location: @binder_contractor }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @binder_contractor.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def create\n @rest = Rest.new(rest_params)\n @rest.owners << current_owner\n respond_to do |format|\n if @rest.save\n format.html { redirect_to @rest, notice: 'Rest was successfully created.' }\n format.json { render :show, status: :created, location: @rest }\n else\n format.html { render :new }\n format.json { render json: @rest.errors, status: :unprocessable_entity }\n end\n end\n end"
]
| [
"0.6466032",
"0.6211106",
"0.60093606",
"0.59345394",
"0.5867465",
"0.5820366",
"0.5792608",
"0.57537764",
"0.5731565",
"0.57216257",
"0.56253964",
"0.5610201",
"0.5601729",
"0.5597856",
"0.5586489",
"0.5586489",
"0.55731267",
"0.55707574",
"0.5569151",
"0.5549769",
"0.55419457",
"0.55246353",
"0.5519672",
"0.55154794",
"0.5493977",
"0.5478956",
"0.54729027",
"0.5470606",
"0.54677975",
"0.54651403",
"0.5459864",
"0.545867",
"0.5448367",
"0.54454863",
"0.5444374",
"0.5444057",
"0.5441678",
"0.54388463",
"0.5427618",
"0.542237",
"0.54170954",
"0.54151744",
"0.541409",
"0.54036283",
"0.5401779",
"0.5400001",
"0.5399616",
"0.53898036",
"0.5388584",
"0.5380091",
"0.5378718",
"0.5367282",
"0.536532",
"0.5365272",
"0.53631413",
"0.53600144",
"0.53502834",
"0.5349302",
"0.5340277",
"0.53401834",
"0.5339841",
"0.53325146",
"0.5329193",
"0.5328551",
"0.5324501",
"0.53195435",
"0.53193873",
"0.5315163",
"0.5311491",
"0.52999747",
"0.52991545",
"0.5299096",
"0.52977014",
"0.52974063",
"0.52909243",
"0.5288761",
"0.52875656",
"0.5275789",
"0.5275286",
"0.527495",
"0.52747047",
"0.5273194",
"0.5272741",
"0.5271159",
"0.5270398",
"0.5268263",
"0.5261422",
"0.5253429",
"0.5253099",
"0.5246873",
"0.5243538",
"0.52422965",
"0.5239884",
"0.523882",
"0.52295434",
"0.5228705",
"0.52256364",
"0.5225467",
"0.5224022",
"0.522024"
]
| 0.6761459 | 0 |
PUT /brothers/1 PUT /brothers/1.json | def update
@brother = Brother.find(params[:id])
respond_to do |format|
if @brother.update_attributes(params[:brother])
format.html { redirect_to @brother, notice: 'Cadastro atualizado com sucesso.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @brother.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n if @brother.update_attributes(params[:brother])\n flash[:notice] = 'Brother was successfully updated.'\n format.html { redirect_to roster_show_path(@brother) }\n format.xml { head :ok }\n else\n #debugger\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @brother.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_brother\n @brother = Brother.find(params[:id])\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n respond_to do |format|\n if @broucher.update(broucher_params)\n format.html { redirect_to @broucher, notice: 'Broucher was successfully updated.' }\n format.json { render :show, status: :ok, location: @broucher }\n else\n format.html { render :edit }\n format.json { render json: @broucher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @robin.update(robin_params)\n format.html { redirect_to @robin, notice: 'Robin was successfully updated.' }\n format.json { render :show, status: :ok, location: @robin }\n else\n format.html { render :edit }\n format.json { render json: @robin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n respond_to do |format|\n if @brodo.update(brodo_params)\n format.html { redirect_to @brodo, notice: 'Brodo was successfully updated.' }\n format.json { render :show, status: :ok, location: @brodo }\n else\n format.html { render :edit }\n format.json { render json: @brodo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def restobooking\n @buchung = Buchung.find(params[:id])\n @buchung.status='B' \n \n respond_to do |format|\n if @buchung.update_attributes(params[:buchung])\n format.html { redirect_to @buchung, notice: 'Buchung wurde erfolgreich geaendert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @buchung.errors, status: :unprocessable_entity }\n end\n end \n end",
"def update\n respond_to do |format|\n if @boredom.update(boredom_params)\n format.html { redirect_to @boredom, notice: 'Boredom was successfully updated.' }\n format.json { render :show, status: :ok, location: @boredom }\n else\n format.html { render :edit }\n format.json { render json: @boredom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @boat.update(boat_params)\n head :no_content\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end",
"def update\n @broad = Broad.find(params[:id])\n\n respond_to do |format|\n if @broad.update_attributes(params[:broad])\n format.html { redirect_to @broad, notice: 'Broad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @broad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @robo.update(robo_params)\n format.html { redirect_to @robo, notice: 'Robo was successfully updated.' }\n format.json { render :show, status: :ok, location: @robo }\n else\n format.html { render :edit }\n format.json { render json: @robo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @bird.update(bird_params)\n render json: @bird, status: :ok, location: @bird\n else\n render json: @bird.errors, status: :unprocessable_entity\n end\n end",
"def update\n @brochure = Brochure.find(params[:id])\n\n respond_to do |format|\n if @brochure.update_attributes(params[:brochure])\n format.html { redirect_to @brochure, notice: 'Brochure was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @brochure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def create\n @brother = Brother.new(params[:brother])\n\n respond_to do |format|\n if @brother.save\n format.html { redirect_to @brother, notice: 'Cadastro atualizado com sucesso.' }\n format.json { render json: @brother, status: :created, location: @brother }\n else\n format.html { render action: \"new\" }\n format.json { render json: @brother.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(borrowernumber, params)\n #raise ArgumentError, \"need both priority and branchcode params!\" unless params[:priority] && params[:branchcode]\n headers = {\n 'Cookie' => @context[:koha_rest_api_cookie],\n 'Content-Type' => 'application/json'\n }\n http = Net::HTTP.new(\"xkoha\", 8081)\n uri = URI(\"#{intranet(:koha_rest_api)}patrons/#{borrowernumber}\")\n res = http.put(uri, params.to_json, headers)\n expect(res.code).to eq(\"200\"), \"got unexpected #{res.code} when updating patron.\\nResponse body: #{res.body}\"\n res.body\n end",
"def update_bridge_model(name, body={}, headers=default_headers)\n @logger.info(\"Updating the \\\"#{name}\\\" Bridge Model.\")\n put(\"#{@api_url}/models/#{encode(name)}\", body, headers)\n end",
"def update\n @bowl = Bowl.find(params[:id])\n\n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n format.html { redirect_to(@bowl, :notice => 'Bowl was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n respond_to do |format|\n if @brony.update(brony_params)\n format.html { redirect_to @brony, notice: 'Brony was successfully updated.' }\n format.json { render :show, status: :ok, location: @brony }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @brony.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @neighborhood = Neighborhood.find(params[:id])\n\n respond_to do |format|\n if @neighborhood.update_attributes(params[:neighborhood])\n format.html { redirect_to @neighborhood, notice: 'Neighborhood was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @neighborhood.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @neighborhood = Neighborhood.find(params[:id])\n\n respond_to do |format|\n if @neighborhood.update_attributes(params[:neighborhood])\n format.html { redirect_to @neighborhood, notice: 'Neighborhood was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @neighborhood.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @booth.update(booth_params)\n format.html { redirect_to event_booth_path(@booth), notice: 'Booth was successfully updated.' }\n format.json { render :show, status: :ok, location: @booth }\n else\n format.html { render :edit }\n format.json { render json: @booth.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @breeding_pair.update_attributes(params[:breeding_pair])\n format.json { head :no_content }\n else\n format.json { render json: @breeding_pair.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:book_shelf]['user'] = User.where(:id => params[:book_shelf]['user']).first\n params[:book_shelf]['book'] = Book.where(:id => params[:book_shelf]['book']).first\n @book_shelf = BookShelf.find(params[:id])\n respond_to do |format|\n if @book_shelf.update_attributes(params[:book_shelf])\n format.html { redirect_to @book_shelf, notice: 'Book shelf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_shelf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_put(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def destroy\n @brother = Brother.find(params[:id])\n @brother.destroy\n\n respond_to do |format|\n format.html { redirect_to brothers_url }\n format.json { head :no_content }\n end\n end",
"def update\n relationship = Relationships.find(params[:id])\n if relationship.update(relationship_params)\n render json: relationship, status: 200\n else\n render json: { errors: relationship.errors }, status: 422\n end\n end",
"def update\n respond_to do |format|\n if @my_boice.update(my_boice_params)\n format.html { redirect_to @my_boice, notice: 'My boice was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_boice }\n else\n format.html { render :edit }\n format.json { render json: @my_boice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end",
"def update\n @bowler.update(bowler_params)\n respond_with(@bowler)\n end",
"def put!\n request! :put\n end",
"def putBusiness( name, building_number, branch_name, address1, address2, address3, district, town, county, province, postcode, country, latitude, longitude, timezone, telephone_number, additional_telephone_number, email, website, category_id, category_type, do_not_display, referrer_url, referrer_name, destructive, delete_mode, master_entity_id)\n params = Hash.new\n params['name'] = name\n params['building_number'] = building_number\n params['branch_name'] = branch_name\n params['address1'] = address1\n params['address2'] = address2\n params['address3'] = address3\n params['district'] = district\n params['town'] = town\n params['county'] = county\n params['province'] = province\n params['postcode'] = postcode\n params['country'] = country\n params['latitude'] = latitude\n params['longitude'] = longitude\n params['timezone'] = timezone\n params['telephone_number'] = telephone_number\n params['additional_telephone_number'] = additional_telephone_number\n params['email'] = email\n params['website'] = website\n params['category_id'] = category_id\n params['category_type'] = category_type\n params['do_not_display'] = do_not_display\n params['referrer_url'] = referrer_url\n params['referrer_name'] = referrer_name\n params['destructive'] = destructive\n params['delete_mode'] = delete_mode\n params['master_entity_id'] = master_entity_id\n return doCurl(\"put\",\"/business\",params)\n end",
"def put(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.put(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end",
"def update\n respond_to do |format|\n if @bowler.update(bowler_params)\n\n @bowler.record :update, current_user, selected_tournament\n \n format.html { redirect_to @bowler, notice: \"Bowler [#{@bowler.full_name}] was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bowler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bingo.update(bingo_params)\n format.html { redirect_to @bingo, notice: \"Bingo was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bingo }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bingo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n sneaker = find_sneaker\n # update! exceptions will be handled by the rescue_from ActiveRecord::RecordInvalid code\n sneaker.update(sneaker_params)\n render json: sneaker\n end",
"def update\n @club = Club.find(params[:id])\n\n if @club.update_attributes(params[:club])\n head :no_content\n else\n render json: @club.errors, status: :unprocessable_entity\n end\n end",
"def put(*args)\n request :put, *args\n end",
"def update\n @serving = Serving.find(params[:id])\n\n respond_to do |format|\n if @serving.update_attributes(params[:serving])\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @binder_contractor = BinderContractor.find(params[:id])\n @binder = Binder.find(@binder_contractor.binder_id)\n authorize! :write, @binder\n\n respond_to do |format|\n if @binder_contractor.update_attributes(params[:binder_contractor])\n @binder_contractors = working_binder.binder_contractors\n format.html { redirect_to @binder_contractor, notice: 'Binder contractor was successfully updated.' }\n format.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @binder_contractor.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def update\n respond_to do |format|\n if @intranet_boleto.update(intranet_boleto_params)\n format.html { redirect_to @intranet_boleto, notice: \"Boleto was successfully updated.\" }\n format.json { render :show, status: :ok, location: @intranet_boleto }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @intranet_boleto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @brewhouse = Brewhouse.find(params[:id])\n\n respond_to do |format|\n if @brewhouse.update_attributes(params[:brewhouse])\n format.html { redirect_to @brewhouse, notice: 'Brewhouse was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @brewhouse.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bingo = Bingo.find(params[:id])\n\n respond_to do |format|\n if @bingo.update_attributes(params[:bingo])\n format.html { redirect_to(@bingo, :notice => 'Bingo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bingo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @orden_cobro = OrdenCobro.find(params[:id])\n\n respond_to do |format|\n if @orden_cobro.update_attributes(params[:orden_cobro])\n format.html { redirect_to @orden_cobro, notice: 'Orden cobro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @orden_cobro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n @beer_club = BeerClub.find(params[:id])\n\n respond_to do |format|\n if @beer_club.update_attributes(params[:beer_club])\n format.html { redirect_to @beer_club, notice: 'Beer club was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @beer_club.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @beer_club = BeerClub.find(params[:id])\n respond_to do |format|\n if @beer_club.update_attributes(params[:beer_club])\n format.html { redirect_to @beer_club, notice: 'Beer club was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @beer_club.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, params={})\n RestClient.put request_base+path, params\n end",
"def update\n @mostsmallroad = Mostsmallroad.find(params[:id])\n\n respond_to do |format|\n if @mostsmallroad.update_attributes(params[:mostsmallroad])\n format.html { redirect_to @mostsmallroad, notice: 'Mostsmallroad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mostsmallroad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n if params[:action] == \"RETURN_BOOK\" \n @book.return()\n elseif params[:action] == \"BORROW_BOOK\"\n @book.borrow()\n end\n \n if @book.update(book_params)\n head :no_content\n else\n render json: @book.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @hood.update(hood_params)\n format.html { redirect_to @hood, notice: 'Hood was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @hood.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boolio.update( boolio_params )\n format.html { redirect_to @boolio, notice: 'Boolio was successfully updated.' }\n format.json { render :show, status: :ok, location: @boolio }\n else\n format.html { render :edit }\n format.json { render json: @boolio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n \n format.json { render json: @book, status: :created, location: @book }\n else\n \n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fridge = Fridge.find(params[:id])\n\n respond_to do |format|\n if @fridge.update_attributes(params[:fridge])\n format.html { redirect_to @fridge, notice: 'Fridge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fridge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo_booth = PhotoBooth.find(params[:id])\n\n respond_to do |format|\n if @photo_booth.update_attributes(params[:photo_booth])\n format.html { redirect_to @photo_booth, notice: 'Photo booth was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo_booth.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brother }\n end\n end",
"def update\n respond_to do |format|\n if @family_bond.update(family_bond_params)\n format.html { redirect_to @family_bond, notice: 'Family bond was successfully updated.' }\n format.json { render :show, status: :ok, location: @family_bond }\n else\n format.html { render :edit }\n format.json { render json: @family_bond.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @verb = Verb.find(params[:id])\n\n if @verb.update(verb_params)\n head :no_content\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @borrower_request.update(borrower_request_params)\n @borrower_request.update_attributes(place: JSON.parse(params[:borrower_request][:place].gsub('=>', ':')))\n format.html { redirect_to @borrower_request, notice: 'Borrower request was successfully updated.' }\n format.json { render :show, status: :ok, location: @borrower_request }\n else\n format.html { render :edit }\n format.json { render json: @borrower_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end",
"def update\n @verbo = Verbo.find(params[:id])\n\n respond_to do |format|\n if @verbo.update_attributes(params[:verbo])\n format.html { redirect_to @verbo, notice: 'Verbo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @verbo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def update\n @bounty = Bounty.find(params[:id])\n @chore = Chore.find(@bounty.chore_id)\n if @chore.nil?\n puts \"OH GOD WHY JESUS USE VALIDATORS COME ON NOW SERRIOUSLY GUYS\"\n end\n @chore.value=params[:value][:val].to_i\n @chore.save\n respond_to do |format|\n if @bounty.save\n format.html { redirect_to @bounty, :notice => 'bounty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bounty.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @brasseries.update(brasseries_params)\n format.html { redirect_to @brasseries, notice: 'Brasserie was successfully updated.' }\n format.json { render :show, status: :ok, location: @brasseries }\n else\n format.html { render :edit }\n format.json { render json: @brasseries.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @surname = Surname.find(params[:id])\n\n respond_to do |format|\n if @surname.update_attributes(params[:surname])\n format.html { redirect_to @surname, notice: 'Surname was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @surname.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boook.update(boook_params)\n format.html { redirect_to @boook, notice: 'Boook was successfully updated.' }\n format.json { render :show, status: :ok, location: @boook }\n else\n format.html { render :edit }\n format.json { render json: @boook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bunny.update(bunny_params)\n format.html { redirect_to @bunny, notice: 'Bunny was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bunny.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @roulette.update(roulette_params)\n format.html { redirect_to @roulette, notice: 'Roulette was successfully updated.' }\n format.json { render :show, status: :ok, location: @roulette }\n else\n format.html { render :edit }\n format.json { render json: @roulette.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bruschettum = Bruschettum.find(params[:id])\n @bruschettum.ingredients.clear\n params[:ingredient].each{|ingr|\n @bruschettum.ingredients << Ingredient.find_by_name(ingr)\n }\n\n respond_to do |format|\n if @bruschettum.update_attributes(params[:bruschettum])\n format.html { redirect_to @bruschettum, notice: 'Bruschettum was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bruschettum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @brochure_interest = BrochureInterest.find(params[:id])\n\n respond_to do |format|\n if @brochure_interest.update_attributes(params[:brochure_interest])\n format.html { redirect_to(@brochure_interest, :notice => 'Brochure interest was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @brochure_interest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @round_robin_promo = RoundRobinPromo.find(params[:id])\n\n respond_to do |format|\n if @round_robin_promo.update_attributes(params[:round_robin_promo])\n format.html { redirect_to @round_robin_promo, notice: 'Round robin promo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @round_robin_promo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_reward.update(api_v1_reward_params)\n format.html { redirect_to @api_v1_reward, notice: 'Reward was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_reward }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_reward.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, body = nil, ctype = 'application/json')\n make_call(mk_conn(path, 'Content-Type': ctype,\n 'Accept': 'application/json'),\n :put, nil, body.to_json)\n end",
"def update\n @bouncer = Bouncer.find(params[:id])\n\n respond_to do |format|\n if @bouncer.update_attributes(params[:bouncer])\n format.html { redirect_to(@bouncer, :notice => 'URL was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bouncer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.find(params[:id])\n\n respond_to do |format|\n if @status.update_attributes(params[:roof_status])\n format.html { redirect_to @roof, notice: 'Status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @supermarket = Supermarket.find(params[:id]) \n respond_to do |format|\n if @supermarket.update(supermarket_params)\n format.json { render json: @supermarket, status: :ok }\n end\n end\n end",
"def update\n @contractor_type = ContractorType.find(params[:id])\n\n respond_to do |format|\n if @contractor_type.update_attributes(params[:contractor_type])\n format.html { redirect_to @contractor_type, notice: 'Contractor type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contractor_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @borc = Borc.find(params[:id])\n\n respond_to do |format|\n if @borc.update_attributes(params[:borc])\n format.html { redirect_to @borc, notice: 'Borc was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @borc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n contract = Contract.find_by_id(params[:id])\n (head :unauthorized unless contract) and return\n \n # try to update the attributes\n if contract.update_attributes(edit_contract_params)\n render json: contract\n else\n render json: { errors: contract.error.full_messages}\n end\n end",
"def update\n respond_to do |format|\n if @contractor.update(contractor_params)\n format.html { redirect_to @contractor, notice: 'Contractor was successfully updated.' }\n format.json { render :show, status: :ok, location: @contractor }\n else\n format.html { render :edit }\n format.json { render json: @contractor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @roast.update(roast_params)\n format.html { redirect_to @roast, notice: 'Roast was successfully updated.' }\n format.json { render :show, status: :ok, location: @roast }\n else\n format.html { render :edit }\n format.json { render json: @roast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # go to params hash and get the id\n the_id = params['id']\n\n # grab a single family based on the id\n family = Family.find_by(id: the_id)\n\n # update it\n if family.update!(\n first_name: params[:first_name],\n last_name: params[:last_name],\n email: params[:email],\n password: params[:password],\n phone_number: params[:phone_number],\n street_address: params[:street_address],\n secondary_address: params[:secondary_address],\n city: params[:city],\n state: params[:state],\n zip_code: params[:zip_code],\n photo: params[:photo])\n render json: family.as_json\n else\n render json: {errors: family.errors.full_messages}\n end\n end",
"def update\n respond_to do |format|\n if @therapist.update(therapist_params)\n format.html { redirect_to @therapist, notice: 'Therapist was successfully updated.' }\n format.json { render :show, status: :ok, location: @therapist }\n else\n format.html { render :edit }\n format.json { render json: @therapist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @therapist.update(therapist_params)\n format.html { redirect_to @therapist, notice: 'Therapist was successfully updated.' }\n format.json { render :show, status: :ok, location: @therapist }\n else\n format.html { render :edit }\n format.json { render json: @therapist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @therapist.update(therapist_params)\n format.html { redirect_to @therapist, notice: 'Therapist was successfully updated.' }\n format.json { render :show, status: :ok, location: @therapist }\n else\n format.html { render :edit }\n format.json { render json: @therapist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @roadcrime = Roadcrime.find(params[:id])\n\n respond_to do |format|\n if @roadcrime.update_attributes(params[:roadcrime])\n format.html { redirect_to @roadcrime, notice: 'Roadcrime was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @roadcrime.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to_update({thing: @author})\n end",
"def update\n @clonet = Clonet.find(params[:id])\n\n respond_to do |format|\n if @clonet.update_attributes(params[:clonet])\n format.html { redirect_to @clonet, notice: 'Clonet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clonet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @brend = Brend.find(params[:id])\n\n respond_to do |format|\n if @brend.update_attributes(params[:brend])\n format.html { redirect_to @brend, notice: 'Brend was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @brend.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @neighbourhood.update(neighbourhood_params)\n format.html { redirect_to @neighbourhood, notice: 'Neighbourhood was successfully updated.' }\n format.json { render :show, status: :ok, location: @neighbourhood }\n else\n format.html { render :edit }\n format.json { render json: @neighbourhood.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @type_bond.update(type_bond_params)\n format.html { redirect_to @type_bond, notice: 'Type bond was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_bond }\n else\n format.html { render :edit }\n format.json { render json: @type_bond.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 @cabinet_balancer.update(create_params)\n format.html { redirect_to cabinet_balancers_path, notice: I18n.t('updated') }\n format.json { render :show, status: :ok, location: @cabinet_balancer }\n else\n format.html { render :edit }\n format.json { render json: @cabinet_balancer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @binder = Binder.find(params[:id])\n \n authorize! :write, @binder\n\n respond_to do |format|\n if @binder.update_attributes(params[:binder])\n format.html { redirect_to @binder, notice: 'Binder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action:\"edit\" }\n format.json { render json: @binder.errors, status: :unprocessable_entity }\n end\n end\n end"
]
| [
"0.6104035",
"0.60589164",
"0.5952275",
"0.59332794",
"0.59122056",
"0.57768595",
"0.57257557",
"0.5720278",
"0.57149225",
"0.56968457",
"0.568262",
"0.5672292",
"0.5654336",
"0.56326383",
"0.56300616",
"0.56052566",
"0.55928266",
"0.5584219",
"0.55590075",
"0.554855",
"0.55453783",
"0.55319047",
"0.5527971",
"0.55272096",
"0.55272096",
"0.55113715",
"0.54895097",
"0.548482",
"0.54722685",
"0.54648983",
"0.54539937",
"0.5447555",
"0.5446009",
"0.5445006",
"0.5435554",
"0.54323334",
"0.5426073",
"0.5417182",
"0.5413232",
"0.54109156",
"0.54100376",
"0.54084456",
"0.54021555",
"0.53998387",
"0.5385729",
"0.53786874",
"0.53774047",
"0.5372658",
"0.5372647",
"0.53713804",
"0.53685015",
"0.5363982",
"0.5360489",
"0.53594357",
"0.53583527",
"0.53580815",
"0.53573096",
"0.53545976",
"0.53519696",
"0.5346827",
"0.53465295",
"0.5345104",
"0.5344335",
"0.5343913",
"0.5341081",
"0.5338106",
"0.5338106",
"0.53367853",
"0.5336207",
"0.5334795",
"0.5333779",
"0.53330374",
"0.53314096",
"0.5330851",
"0.5329685",
"0.53271496",
"0.5326478",
"0.53254247",
"0.53243685",
"0.5319873",
"0.53191113",
"0.53151006",
"0.53136826",
"0.53115785",
"0.5283742",
"0.52821636",
"0.5278479",
"0.5273751",
"0.5263492",
"0.5263492",
"0.5263475",
"0.5263396",
"0.5262425",
"0.52612174",
"0.5260053",
"0.5257376",
"0.52567524",
"0.5253168",
"0.5251617",
"0.5251565"
]
| 0.6645645 | 0 |
DELETE /brothers/1 DELETE /brothers/1.json | def destroy
@brother = Brother.find(params[:id])
@brother.destroy
respond_to do |format|
format.html { redirect_to brothers_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @brother = Brother.find(params[:id])\n @brother.destroy\n\n respond_to do |format|\n format.html { redirect_to(brothers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @brohoof = Brohoof.find(params[:id])\n @brohoof.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 @boat = Boat.find(params[:id])\n remove_reknro_from_berth\n @boat.destroy\n\n respond_to do |format|\n format.html { redirect_to boats_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @brodo.destroy\n respond_to do |format|\n format.html { redirect_to brodos_url, notice: 'Brodo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @broucher.destroy\n respond_to do |format|\n format.html { redirect_to brouchers_url, notice: 'Broucher was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @broad = Broad.find(params[:id])\n @broad.destroy\n\n respond_to do |format|\n format.html { redirect_to broads_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @bread.destroy\n respond_to do |format|\n format.html { redirect_to breads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @brochure = Brochure.find(params[:id])\n @brochure.destroy\n\n respond_to do |format|\n format.html { redirect_to brochures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boredom.destroy\n respond_to do |format|\n format.html { redirect_to boredoms_url, notice: 'Boredom was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @borc = Borc.find(params[:id])\n @borc.destroy\n\n respond_to do |format|\n format.html { redirect_to borcs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bustour.destroy\n respond_to do |format|\n format.html { redirect_to bustours_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bowl = Bowl.find(params[:id])\n @bowl.destroy\n\n respond_to do |format|\n format.html { redirect_to bowls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @baton = Baton.find(params[:id])\n @baton.destroy\n\n respond_to do |format|\n format.html { redirect_to batons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @brony.destroy\n respond_to do |format|\n format.html { redirect_to bronies_url, notice: 'Brony was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @roadcrime = Roadcrime.find(params[:id])\n @roadcrime.destroy\n\n respond_to do |format|\n format.html { redirect_to roadcrimes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ghb.destroy\n respond_to do |format|\n format.html { redirect_to ethers_url, notice: 'Ether was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bruschettum = Bruschettum.find(params[:id])\n @bruschettum.destroy\n\n respond_to do |format|\n format.html { redirect_to bruschetta_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @robin.destroy\n respond_to do |format|\n format.html { redirect_to robins_url, notice: 'Robin was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bow.destroy\n respond_to do |format|\n format.html { redirect_to bows_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 @robo.destroy\n respond_to do |format|\n format.html { redirect_to robos_url, notice: 'Robo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @brag = Brag.find(params[:id])\n @brag.destroy\n\n respond_to do |format|\n format.html { redirect_to brags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end",
"def destroy\n relationship = Relationships.find(params[:id])\n relationship.destroy\n head 204\n end",
"def destroy\n @borad = Borad.find(params[:id])\n @borad.destroy\n\n respond_to do |format|\n format.html { redirect_to borads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @verbo = Verbo.find(params[:id])\n @verbo.destroy\n\n respond_to do |format|\n format.html { redirect_to verbos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bounty.destroy\n respond_to do |format|\n format.html { redirect_to bounties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @orphan.destroy\n respond_to do |format|\n format.html { redirect_to orphans_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bloom = Bloom.find(params[:id])\n @bloom.destroy\n\n respond_to do |format|\n format.html { redirect_to blooms_url }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @bird.destroy\n \n begin\n respond_to do |format|\n format.json { render json:({:status => NO_CONTENT}) }\n end\n else\n render json: ({:status => INTERNAL_SERVER_ERROR})\n end\n end",
"def destroy\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n @loadbalancer.send_delete\n\n respond_to do |format|\n format.html { redirect_to loadbalancers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @brave_burst.destroy\n respond_to do |format|\n format.html { redirect_to brave_bursts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @herb = Herb.find_by_permalink(params[:id])\n @herb.destroy\n\n respond_to do |format|\n format.html { redirect_to herbs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bird.destroy\n head :no_content\n end",
"def destroy\n @breeding_pair.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @bouncer = Bouncer.find(params[:id])\n @bouncer.destroy\n\n respond_to do |format|\n format.html { redirect_to(bouncers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bourbon.destroy\n respond_to do |format|\n format.html { redirect_to bourbons_url }\n format.json { head :no_content }\n end\n end",
"def destroy_by_body\n @person = Person.find(person_delete_param[:id])\n id = @person.id\n\n if @person.destroy\n render json: { status: 'DELETE Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error deleting person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def destroy\n @betraege = Betraege.find(params[:id])\n @betraege.destroy\n\n respond_to do |format|\n format.html { redirect_to betraeges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bob = Bob.find(params[:id])\n @bob.destroy\n\n respond_to do |format|\n format.html { redirect_to bobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n name = @bowler.full_name\n @bowler.record :destroy, current_user, selected_tournament\n @bowler.destroy\n respond_to do |format|\n format.html { redirect_to bowlers_url, notice: \"Bowler #{name} has been successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bowl = Bowl.find(params[:id])\n @bowl.destroy\n\n respond_to do |format|\n format.html { redirect_to(bowls_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @razmer_go = RazmerGo.find(params[:id])\n @razmer_go.destroy\n\n respond_to do |format|\n format.html { redirect_to razmer_gos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if [email protected]?\n @bird.destroy\n render json: \"\", status: 200\n else\n render json: \"\", status: 404\n end\n end",
"def destroy\n @relay.destroy\n respond_to do |format|\n format.html { redirect_to relays_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @brewhouse = Brewhouse.find(params[:id])\n @brewhouse.destroy\n\n respond_to do |format|\n format.html { redirect_to brewhouses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rb.destroy\n respond_to do |format|\n format.html { redirect_to rbs_url, notice: 'Erfolgreich gelöscht.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @burrito.destroy\n respond_to do |format|\n format.html { redirect_to burritos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end",
"def delete(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 @railway = Railway.find(params[:id])\n @railway.destroy\n\n respond_to do |format|\n format.html { redirect_to railways_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @roadblock.destroy\n respond_to do |format|\n format.html { redirect_to \"/roadblocks-dash\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @orden_cobro = OrdenCobro.find(params[:id])\n @orden_cobro.destroy\n\n respond_to do |format|\n format.html { redirect_to orden_cobros_url }\n format.json { head :no_content }\n end\n end",
"def soccer_delete\n base_delete(params, \"Soccer\")\n end",
"def destroy\n @blast = Blast.find(params[:id])\n @blast.destroy\n\n respond_to do |format|\n format.html { redirect_to blasts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @brew.destroy\n respond_to do |format|\n format.html { redirect_to brews_url }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @breed = Breed.find(params[:id])\n @breed.destroy\n\n respond_to do |format|\n format.html { redirect_to breeds_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @my_boice.destroy\n respond_to do |format|\n format.html { redirect_to my_boices_url, notice: 'My boice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bunny.destroy\n respond_to do |format|\n format.html { redirect_to bunnies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @sivic_banco.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_bancos_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @beer_club = BeerClub.find(params[:id])\n @beer_club.destroy\n\n respond_to do |format|\n format.html { redirect_to beer_clubs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @beer_club = BeerClub.find(params[:id])\n @beer_club.destroy\n\n respond_to do |format|\n format.html { redirect_to beer_clubs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recibo = Recibo.find(params[:recibo_id])\n @renglon_recdetalle = @recibo.renglon_recdetalles.find(params[:id]).destroy\n\n respond_to do |format|\n format.html { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @photo_booth = PhotoBooth.find(params[:id])\n @photo_booth.destroy\n\n respond_to do |format|\n format.html { redirect_to photo_booths_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n @breet.destroy\n respond_to do |format|\n format.html { redirect_to breets_url, notice: 'Breet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bordado = Bordado.find(params[:id])\n @bordado.destroy\n\n respond_to do |format|\n format.html { redirect_to bordados_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n set_boat\n @boat.destroy\n respond_to do |format|\n format.html { redirect_to harbour_boats_path}\n format.json { head :no_content }\n end\n end",
"def destroy\n # @bill_quorum = BillQuorum.find(params[:id])\n @bill_quorum.destroy\n\n respond_to do |format|\n format.html { redirect_to bill_quorums_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bento.destroy\n respond_to do |format|\n format.html { redirect_to bentos_url, notice: 'Bento was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lob.destroy\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blar.destroy\n respond_to do |format|\n format.html { redirect_to blars_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bounty = Bounty.find(params[:id])\n @bounty.destroy\n respond_to do |format|\n format.html { redirect_to controller: 'home', action: 'bounty_market' }\n format.json { head :no_content }\n end\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def destroy\n @clonet = Clonet.find(params[:id])\n @clonet.destroy\n\n respond_to do |format|\n format.html { redirect_to clonets_url }\n format.json { head :no_content }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @club_path = ClubPath.find(params[:id])\n @club_path.destroy\n\n respond_to do |format|\n format.html { redirect_to club_paths_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boat = Boat.find(params[:id])\n @boat.destroy\n\n respond_to do |format|\n format.html {redirect_to boats_url}\n format.json {head :no_content}\n end\n end",
"def destroy\n @booth.destroy\n respond_to do |format|\n format.html { redirect_to event_booths_url, notice: 'Booth was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boite.destroy\n respond_to do |format|\n format.html { redirect_to boites_url, notice: 'Boite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @distro = Distro.find(params[:id])\n @distro.destroy\n\n respond_to do |format|\n format.html { redirect_to distros_url }\n format.json { head :no_content }\n end\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def destroy\n @round_robin_promo = RoundRobinPromo.find(params[:id])\n @round_robin_promo.destroy\n\n respond_to do |format|\n format.html { redirect_to round_robin_promos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bb = Bb.find(params[:id])\n @bb.destroy\n\n respond_to do |format|\n format.html { redirect_to bbs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @basin = Basin.find(params[:id])\n @basin.destroy\n\n respond_to do |format|\n format.html { redirect_to basins_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chaine = Chaine.find(params[:id])\n @chaine.destroy\n\n respond_to do |format|\n format.html { redirect_to chaines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.find(params[:id])\n @status.destroy\n\n respond_to do |format|\n format.html { redirect_to statuseses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @borrower = Borrower.find(params[:id])\n @borrower.destroy\n\n respond_to do |format|\n format.html { redirect_to borrowers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @borrower = Borrower.find(params[:id])\n @borrower.destroy\n\n respond_to do |format|\n format.html { redirect_to borrowers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @boat.destroy\n\n head :no_content\n end"
]
| [
"0.72989035",
"0.69535923",
"0.69262016",
"0.6899237",
"0.6887502",
"0.68759006",
"0.68281394",
"0.6821217",
"0.6782569",
"0.67393094",
"0.6728552",
"0.67242306",
"0.66811126",
"0.66722196",
"0.66638386",
"0.66624045",
"0.66524476",
"0.66489494",
"0.6648019",
"0.6642682",
"0.6625198",
"0.6616784",
"0.66011465",
"0.6592928",
"0.65919745",
"0.6591753",
"0.65833277",
"0.65773636",
"0.65763086",
"0.656166",
"0.65598434",
"0.6553909",
"0.65519685",
"0.6538591",
"0.6538029",
"0.652327",
"0.6522734",
"0.65211475",
"0.6511617",
"0.65115845",
"0.6495487",
"0.64882135",
"0.64829963",
"0.6477999",
"0.64773923",
"0.64726853",
"0.64710623",
"0.6467577",
"0.6467544",
"0.64643353",
"0.6459042",
"0.64555085",
"0.6451789",
"0.64506936",
"0.6447251",
"0.6447169",
"0.6446187",
"0.6442541",
"0.64381176",
"0.64343476",
"0.64340204",
"0.643063",
"0.6429651",
"0.6425793",
"0.642552",
"0.6421058",
"0.6421058",
"0.6420146",
"0.64158994",
"0.6414578",
"0.6409557",
"0.6408942",
"0.64054316",
"0.64047956",
"0.6404031",
"0.64039886",
"0.64035535",
"0.6401642",
"0.63987774",
"0.6396775",
"0.6395985",
"0.63949394",
"0.6391933",
"0.6391933",
"0.6391933",
"0.6391933",
"0.63910216",
"0.6386093",
"0.63856983",
"0.63729835",
"0.6371099",
"0.63699305",
"0.636945",
"0.63652474",
"0.6361556",
"0.63594115",
"0.6356929",
"0.6356121",
"0.6356121",
"0.63553905"
]
| 0.7612961 | 0 |
end user auth stuff | def currentHand #finds current hand during game
self.hands.last
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auth\n end",
"def auth\n end",
"def destroy_auth\n\t\tsession[:user_id] = nil\n\t\tredirect_to root_path\n\tend",
"def endscreen\n @user = nil\n login\nend",
"def auth_user\n redirect_to new_user_session_url unless user_signed_in?\n end",
"def after_custom_authentication; end",
"def teardown\n # Reset the password\n @s.trustedauth = false\n admin2 = User.new(\"admin\",\"2admin2\")\n\[email protected]_user(admin2)\n\[email protected](\"401 is Ok\")\n\[email protected]_get(@s.url_for(\"/var/cluster/user.json?performing_teardown\"))\n\[email protected](\"401 is Ok\")\n\tadmin2.change_password(@s,\"admin\")\n\tsuper\n end",
"def logout_auth_all\r\n\t\tsign_out current_user if(user_signed_in?)\r\n\t\tredirect_to SERVICE_AUTH_URL_SIGN_OUT\r\n\tend",
"def deauthenticate\n self.clear_current_user\n redirect_to :root\n end",
"def unauthenticated\n end",
"def auth_user\n redirect_to new_user_registration_url unless user_signed_in?\n end",
"def destroy\n __log_activity(\"LOGOUT #{current_user}\")\n __debug_route\n __debug_request\n user = current_user&.account&.dup\n opt = BS_AUTH ? { no_revoke: true?(params[:no_revoke]) } : {}\n delete_auth_data(**opt)\n super\n api_clear(user: user)\n set_flash_notice(user: user, clear: true)\n rescue => error\n auth_failure_redirect(message: error)\n end",
"def teardown\n @user = nil\n end",
"def log_out\n\t\tsuper\n\t\t@current_user = nil\n\tend",
"def auth_user\n if !current_user\n redirect_to root_url\n end\n end",
"def auth_user\n if !current_user\n redirect_to root_url\n end\n end",
"def auth_user\n if !current_user\n redirect_to root_url\n end\n end",
"def after_database_authentication; end",
"def auth_logout\n return unless logged_in?\n begin\n http = @http\n path = BSAPI+\"auth\"\n headers = get_default_headers\n http = @http\n resp = http.get(path, headers)\n rescue StandardError\n ensure\n set_logged_out\n end\n end",
"def auth_param; end",
"def auth_store; end",
"def no_auth\n puts 'Incorrect username or password!'.colorize(:red)\n sleep(1)\n if @count >= 3\n puts 'You have tried too many times! The application will now close..'.colorize(:light_red)\n exit\n end\n returning_user\n end",
"def auth(value); end",
"def after_custom_authentication\n\n end",
"def auth_after\n url = session[:auth_redirect] || root_path\n redirect_to url\n end",
"def user_authentication\n end",
"def verify_signed_out_user; end",
"def verify_signed_out_user; end",
"def verify_signed_out_user; end",
"def remove_auth(uri, realm = T.unsafe(nil)); end",
"def authorization; end",
"def amend_user\n # we should have a current user.\n user = current_user\n if (user)\n auth = request.env[\"omniauth.auth\"]\n # We should have at most one of these.\n oauths = Authentication.where(:provider => auth[\"provider\"],\n :uid => auth[\"uid\"],\n :user_id.ne => nil,\n :master_id => @master.id).order(\"create_at desc\").all\n oauth = nil\n oauths.each do |oa|\n if oa.user == user\n if oauth.nil?\n oauth = oa\n else # masters should all be the same\n # Be proactive resilience here and get rid of this one. We should not have multiples\n logger.error(\"sessions#ammend_customer: getting rid of multiple administrator authentications.\")\n oa.destroy()\n end\n else\n redirect_to edit_master_user_registration_path(user.master, user),\n :alert => \"This authentication belongs to different user.\"\n return\n end\n end\n if oauth\n if @master != oauth.user.master\n # This is really bad. Attempt a fix.\n logger.error \"sessions#amend_user: Authentication has mismatched master for user. Removing.\"\n oauth.destroy()\n end\n redirect_to edit_master_user_registration_path(user.master, user),\n :notice => \"This authentication has already been added.\"\n else\n oauth = Authentication.create_with_omniauth(auth)\n oauth.master = @master\n user.authentications << oauth\n user.save\n redirect_to edit_master_user_registration_path(user.master, user),\n :notice => \"Authentication added.\"\n end\n else\n redirect_to master_user_sign_in_path(@master),\n :alert => \"Need to sign in first.\"\n end\n end",
"def valid_user\n # unless (@user && @user.activated? && @user.authenticated?(:reset, params[:id])) \n unless(@user && @user.activated?)\n redirect_to root_url\n end\n end",
"def log_out\n if user_giving_test && current_user.count>0\n redirect_to users_finish_path\n elsif user_giving_test && current_user.count==0\n current_user.update_attributes(under_test: 0)\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n else\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end\nend",
"def after_auth(user)\n # Push the avatar (Just in case any clients support it)\n # AvatarUpdaterService.new(user).update\n\n # Set rooms, groups, etc.\n UserService.update(user).save\n\n # We're done here\n sign_in_and_redirect user\n end",
"def clear_current_user; end",
"def remove_all_authentications\n current_user.authentications = []\n current_user.save\n render :text => \"Your Auths Are Destroy\"\n end",
"def destroy\n @auth_user.destroy\n end",
"def auth\n {}\n end",
"def authenticate_user\n render_403 'Invalid user.' if @user.blank? || [email protected]?\n end",
"def require_auth\n\n # When no user is logged in, redirect the visitor to the login page\n if @user.nil?\n respond_to do |format|\n format.html { redirect_to :controller => :auth, :action => :login }\n end\n end\n\n end",
"def userauth_request(username, next_service, auth_method, *others); end",
"def verify\n @authentications = current_user.authentications if current_user\n if current_user\n # flash[:notice] = \"All signed in. Welcome back, #{current_user.handle}!\"\n redirect_to after_sign_in_path_for(current_user), notice: \"All signed in. Welcome back, #{current_user.handle}!\"\n end\n @auth_delete = true\n @auth_context = :manage\n smartrender\n end",
"def http_auth?; end",
"def use_oauth\n\t\t\t\n\t\tend",
"def authenticate_user!\n \tunless current_user?\n \trender status: :unauthorized\n \tend\n end",
"def reauthenticate \n\t\t\tself.login(@email, @password)\n\t\tend",
"def auth_user\n\t\t@user = User.find_by(id: params[:id] )\n\t\tif @user \n\t\t\tif current_user? @user \n\t\t\t\t@view = nil\n\t\t\telse\t#show @user \n\t\t\t\tflashs = { error: \"Insufficient priviledge on @#{@user.login}\" }\n\t\t\t\tuser_show(@user.to_slug, flashs)\n\t\t\tend\n\t\telse\n\t\t\tflashs = { error: \"Invalid user id : #{params[:id].to_i}\" }\n\t\t\tredirect_format(\"/\", flashs, params[:callback] )\n\t\tend\n\tend",
"def logoutUser\n\t\t# Clearing all data from Shared Preferences\n\t\[email protected]()\n\t\[email protected]()\n\t\t\n\t\t# After logout redirect user to Loing Activity\n\t\ti = android.content.Intent.new\n\t\ti.setClassName($package_name, 'org.ruboto.session.authentication_app.AuthenticationAppActivity')\n\t\[email protected](i);\n\t\[email protected]()\n\tend",
"def clean_up_passwords; end",
"def handle_unverified_request\n employee_sign_out\n company_sign_out\n super\n end",
"def after_token_authentication\n end",
"def after_token_authentication\n end",
"def check_auth\r\n if current_user == nil || @user.id != current_user.id\r\n redirect_to root_path , alert: \"Can't Access A Game That Does not belong to you.\"\r\n end\r\n end",
"def after_magic_link_authentication\n end",
"def auth\n #redirect to login page unless already logged in\n redirect_to new_user_session_path, alert: \"You must login to access that page\" unless logged_in?\n end",
"def after_crowd_authentication\n end",
"def authenticate_request\n @current_user = nil\n end",
"def abandon!\n authentication.abandon!\n end",
"def clear_auth_count\n @auth_count = 0\n end",
"def handle_unverified_request\n \tsign_out\n \tsuper\n end",
"def handle_unverified_request\n \tsign_out\n \tsuper\n end",
"def handle_unverified_request\n \tsign_out\n \tsuper\n end",
"def handle_unverified_request\n \tsign_out\n \tsuper\n end",
"def handle_unverified_request\n \tsign_out\n \tsuper\n end",
"def handle_unverified_request\n \tsign_out\n \tsuper\n end",
"def valid_auth\n if @user.auth == 0\n flash[:warning] = \"Your can not create Team\"\n redirect_to :action => \"index\"\n end\n end",
"def capable_login_auth?; end",
"def auth_methods; end",
"def after_hash_token_authentication\n end",
"def end_session\n if !User.find_by_id(session[:current_user_id]).blank? && !SuperUser.find_by_id(session[:current_super_user_id]).blank?\n flash[:error] = \"Don't be too smart.\"\n redirect_to ({:controller => :login, :action => :signout})\n end\n end",
"def login; end",
"def handle_unverified_request\n\t\t\tsign_out\n\t\t\tsuper\n\t\tend",
"def handle_unverified_request\n\t\tsign_out\n\t\tsuper\n\tend",
"def handle_unverified_request\n\t\tsign_out\n\t\tsuper\n\tend",
"def handle_unverified_request\n\t\tsign_out\n\t\tsuper\n\tend",
"def log_out\n current_user\n @current_user.auth_token = nil\n @current_user.save!\n @current_user = nil\n end",
"def handle_unverified_request\n\tsign_out\n\tsuper\nend",
"def force_auth\n\t\tlogger.debug \" Callback: force_auth\"\n\t\tsession[:last_ts] = nil\n\t\tCASClient::Frameworks::Rails::Filter.filter self unless @current_user\n\tend",
"def valid_user\n \tunless(@user && @user.activated? && @user.authenticated?(:reset, params[:id]))\n \t\tredirect_to root_url\n \tend\n end",
"def auth\n\n @user = current_user\n puts @user.email\n Rails.cache.write(\"user_id\", @user.id)\n flickr = FlickRaw::Flickr.new\n token = flickr.get_request_token(:oauth_callback => (\n \"http://localhost:3000/mob/flickr/callback\"))\n Rails.cache.write(\"oauth_token_secret\",token['oauth_token_secret'])\n auth_url = flickr.get_authorize_url(token['oauth_token'], :perms => 'read')\n redirect_to(auth_url)\n end",
"def authenticate!\n # Do nothing yet\n end",
"def verify_signed_out_user\n end",
"def custom_user_auth\n\t\t\tunless student_signed_in? || admin_signed_in?\n\t\t\t\tredirect_to root_path, notice: \"You have to sign in.\"\n\t\t\tend\n\t\tend",
"def valid_user\n\t\t\tunless (@user && @user.activated? && \n\t\t\t\t\t\t\[email protected]?(:reset, params[:id]))\n\t\t\t\tredirect_to root_url\n\t\t\tend\t\n\t\tend",
"def process_auth\n return if username.empty? || password.empty?\n \"#{username}:#{password}\"\n end",
"def authenticate\n begin\n if !session[:user_guid]\n redirect_to(root_path)\n elsif session[:user_guid] != User.find_by(id: session[:user_id].to_i).guid\n redirect_to(logout_user_path)\n end\n rescue\n redirect_to(logout_user_path)\n end\n end",
"def handle_inverified_request\n \tsignout\n \tsuper\n end",
"def authenticate_correct_user\n redirect_unauthorized unless current_user? @run.user_id\n end",
"def successful_authentication(user)\n set_brute_force_counter(user, 0)\n super\n end",
"def check_unlogin\n return unless curr_user\n redirect_to articles_path\n end",
"def valid_for_authentication?; end",
"def valid_for_authentication?; end",
"def auth\n session[:referer] = request.env['HTTP_REFERER'] if request.env['HTTP_REFERER']\n userparams = params[:user]\n @user = User.auth(userparams[:login],userparams[:password])\n #\n respond_to do |format|\n if @user.nil?\n logger.debug(\"User not found\")\n #login failed\n flash[:notice] = t('general.login_password_not_found')\n format.js { }\n format.xml { render :xml => {:auth => 'Failed', :description => flash[:notice]}.to_xml }\n format.html {redirect_to(:action=>'login')}\n elsif @user && [email protected]\n logger.debug(\"User is not active\")\n flash[:notice] = t('general.user_not_activated')\n format.js { }\n format.xml { render :xml => {:auth => 'Failed', :description => flash[:notice]}.to_xml }\n format.html {redirect_to(:action=>'login')}\n else\n #loged in\n session[:user] = @user.id\n logger.debug(session.inspect)\n @user.update_attribute(:updated_at, Time.now)\n format.js {}\n format.xml { render :xml => {:auth => 'OK', :user => @user}.to_xml }\n format.html {redirect_to(session[:referer] || '/')}\n end\n end\n \n end",
"def valid_user\n return if @user && @user.activated? && @user.authenticated?('reset', params[:id])\n redirect_to root_url\n end",
"def user_stray\n if !logged_in? || @user == nil\n flash[:alert] = \"You have been logged out of your session. Please log back in to continue.\"\n redirect \"/\"\n elsif @user.id != current_user.id\n flash[:alert] = \"You do not have permission to view or edit other users' content.\"\n redirect \"/\"\n end\n end",
"def valid_user\n unless ( @user && @user.activated? &&\n @user.authenticated?( :reset, params[ :id]))\n redirect_to root_url\n end\n end",
"def valid_user\n redirect_to root_url unless @user && @user.activated? && @user.authenticated?(:reset, params[:id])\n end",
"def verify_user\n ## redirect to appropriate path\n redirect_to root_url, notice: 'You have already signed out. Please sign in again.' unless !current_user.nil?\n end",
"def logout\n end",
"def logout\n end"
]
| [
"0.70541954",
"0.70541954",
"0.670564",
"0.657376",
"0.65385485",
"0.6523281",
"0.6472897",
"0.64707947",
"0.6462708",
"0.6431547",
"0.6421424",
"0.64102525",
"0.63444734",
"0.63045686",
"0.6300721",
"0.6300721",
"0.6300721",
"0.6287041",
"0.6286316",
"0.62838674",
"0.6267622",
"0.6251218",
"0.62461823",
"0.6198409",
"0.6185096",
"0.6182075",
"0.6180146",
"0.6180146",
"0.6180146",
"0.6175429",
"0.6171633",
"0.61650485",
"0.61484313",
"0.6145279",
"0.61435246",
"0.6135295",
"0.61101013",
"0.61082596",
"0.61066717",
"0.60853606",
"0.607389",
"0.6071848",
"0.6057649",
"0.6054944",
"0.60526645",
"0.6051203",
"0.604984",
"0.6049261",
"0.60373217",
"0.60353595",
"0.6030157",
"0.60197675",
"0.60197675",
"0.60173094",
"0.601355",
"0.60106033",
"0.60086054",
"0.6002213",
"0.6001714",
"0.600163",
"0.59985584",
"0.59985584",
"0.59985584",
"0.59985584",
"0.59985584",
"0.59985584",
"0.59959465",
"0.599525",
"0.59931755",
"0.59858936",
"0.598404",
"0.59807754",
"0.5969642",
"0.5966356",
"0.5966356",
"0.5966356",
"0.5965198",
"0.5958511",
"0.59566796",
"0.5947277",
"0.5946504",
"0.5941134",
"0.59380466",
"0.59376043",
"0.5928546",
"0.59278584",
"0.5925399",
"0.592523",
"0.592359",
"0.5923437",
"0.5922598",
"0.5917282",
"0.5917282",
"0.59152627",
"0.5913386",
"0.58940166",
"0.5894002",
"0.58934283",
"0.58823264",
"0.5875563",
"0.5875563"
]
| 0.0 | -1 |
Inspect the file referenced in the kubectl stderr to make it easier for developer to understand what's going on | def inspect_kubectl_out_for_files(stderr)
# Output example:
# Error from server (BadRequest): error when creating "/path/to/configmap-gqq5oh.yml20170411-33615-t0t3m":
match = stderr.match(%r{BadRequest.*"(?<path>\/\S+\.yml\S+)"})
return unless match
path = match[:path]
if path.present? && File.file?(path)
suspicious_file = File.read(path)
KubernetesDeploy.logger.warn("Inspecting the file mentioned in the error message (#{path})")
KubernetesDeploy.logger.warn(suspicious_file)
else
KubernetesDeploy.logger.warn("Detected a file (#{path.inspect}) referenced in the kubectl stderr " \
"but was unable to inspect it")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stderr\n \"#{dir}__job.stderr\"\n end",
"def chef_error(e)\n if e.is_a?(::RightScale::Exceptions::Exec)\n msg = \"External command error: \"\n if match = /RightScale::Exceptions::Exec: (.*)/.match(e.message)\n cmd_output = match[1]\n else\n cmd_output = e.message\n end\n msg += cmd_output\n msg += \"\\nThe command was run from \\\"#{e.path}\\\"\" if e.path\n elsif e.is_a?(::Chef::Exceptions::ValidationFailed) && (e.message =~ /Option action must be equal to one of:/)\n msg = \"[chef] recipe references an action that does not exist. #{e.message}\"\n elsif e.is_a?(::NoMethodError) && (missing_action_match = /undefined method .action_(\\S*)' for #<\\S*:\\S*>/.match(e.message)) && missing_action_match[1]\n msg = \"[chef] recipe references the action <#{missing_action_match[1]}> which is missing an implementation\"\n else\n msg = \"Execution error:\\n\"\n msg += e.message\n file, line, meth = e.backtrace[0].scan(BACKTRACE_LINE_REGEXP).flatten\n line_number = line.to_i\n if file && line && (line_number.to_s == line)\n dir = AgentConfig.cookbook_download_dir\n if file[0..dir.size - 1] == dir\n path = \"[COOKBOOKS]/\" + file[dir.size..file.size]\n else\n path = file\n end\n msg += \"\\n\\nThe error occurred line #{line} of #{path}\"\n msg += \" in method '#{meth}'\" if meth\n context = \"\"\n if File.readable?(file)\n File.open(file, 'r') do |f|\n lines = f.readlines\n lines_count = lines.size\n if lines_count >= line_number\n upper = [lines_count, line_number + 2].max\n padding = upper.to_s.size\n context += context_line(lines, line_number - 2, padding)\n context += context_line(lines, line_number - 1, padding)\n context += context_line(lines, line_number, padding, '*')\n context += context_line(lines, line_number + 1, padding)\n context += context_line(lines, line_number + 2, padding)\n end\n end\n end\n msg += \" while executing:\\n\\n#{context}\" unless context.empty?\n end\n end\n msg\n end",
"def failed_example_output(example)\n full_description = example.full_description\n location = example.location\n formatted_message = strip_message_from_whitespace(example.execution_result.exception.message)\n \n \"#{full_description} - #{location} \\n #{formatted_message}\"\n end",
"def failed_example_output(example)\n full_description = example.full_description\n location = example.location\n formatted_message = strip_message_from_whitespace(example.execution_result.exception.message)\n\n \"#{full_description} - #{location} \\n #{formatted_message}\"\n end",
"def display_err_file(err_file)\n if err_file.exist?\n $stderr.puts err_file.read\n else\n $stderr.puts \"MPASM failed but the ERR file was not found: #{err_file}\"\n end\nend",
"def failed_example_output example\n full_description = example.full_description\n location = example.location\n formatted_message = strip_message_from_whitespace(example.execution_result.exception.message)\n\n \"#{full_description} - #{location} \\n #{formatted_message}\"\n end",
"def inspect\n cocoapods_config\n .lockfile\n .to_hash[\"PODS\"]\n .map { |pod| pod.is_a?(Hash) ? pod.keys.first : pod }\n .inspect\n end",
"def show_resources_in_namespace(namespace, *resource_types)\n run \"kubectl get #{resource_types.join(',')} --namespace #{namespace} --output=wide\"\nend",
"def friendly_error(e)\n case e\n when Ncio::Support::RetryAction::RetryException::Timeout\n 'Timeout expired connecting to the console service. Verify it is up and running.'\n when OpenSSL::SSL::SSLError\n friendly_ssl_error(e)\n when Ncio::Api::V1::ApiAuthenticationError\n 'Make sure the --cert option value is listed in the certificate whitelist, '\\\n 'and you are able to run puppet agent --test on the master. '\\\n 'The certificate whitelist on the master is located at '\\\n '/etc/puppetlabs/console-services/rbac-certificate-whitelist'\n else\n e.message\n end\n end",
"def dev_error_filepath\n \"parse_logs/#{study_file.id}/log.txt\"\n end",
"def error_namespace; \"vagrant.errors\"; end",
"def stderr; end",
"def stderr; end",
"def stderr; end",
"def stderr; end",
"def error_io\n exit_code == -1 ? $stderr : $stdout\n end",
"def find_images_in_k8s_complete_demo\n images = []\n yaml_parts = File.read(REPO_ROOT.join(\"deploy\").join(\"kubernetes\").join(\"complete-demo.yaml\"))\\\n .split(\"---\\n\")\\\n .map { |part| YAML.load(part) }\n\n yaml_parts \\\n .select { |part| part[\"kind\"] == \"Deployment\" }\\\n .map { |part| part[\"spec\"][\"template\"][\"spec\"][\"containers\"].map { |c| c[\"image\"] } }.flatten\\\n .map { |name| if name.include?(\":\") then name; else name + \":latest\"; end }.uniq\nend",
"def write_error_info\n end",
"def stderr\n File.join(dir, 'stderr')\n end",
"def file_patterns_errors\n messages = []\n messages << \"The sources did not match any file\" if [email protected]_files.empty? && @pod.source_files.empty?\n messages << \"The resources did not match any file\" if [email protected]? && @pod.resource_files.empty?\n messages << \"The preserve_paths did not match any file\" if [email protected]_paths.empty? && @pod.preserve_files.empty?\n messages << \"The exclude_header_search_paths did not match any file\" if [email protected]_header_search_paths.empty? && @pod.headers_excluded_from_search_paths.empty?\n messages\n end",
"def diagnose(filename); end",
"def install_kubectl(version)\n cmd = ['yum', 'install', '-y', \"kubectl-#{version}-0\"]\n stdout, stderr, status = Open3.capture3(*cmd)\n raise Puppet::Error, _(\"stderr: '%{stderr}'\" % { stderr: stderr }) if status != 0\n { status: stdout.strip }\nend",
"def error_message\n if nagios_mode?\n puts \"CRIT: #{invalid_metadata_files.size} metadata files and #{invalid_packages.size} packages with invalid checksums\"\n else\n invalid_metadata_files.each do |metadata|\n msg metadata.explain_error\n end\n invalid_packages.each do |pkg|\n msg pkg.explain_error\n end\n end\n end",
"def stderr\n @cmd_result.stderr\n end",
"def stderr\n @result.stderr\n end",
"def status(target, json)\n begin\n out = JSON.parse(File.read(json))\n content = File.read(json)\n hostname = `hostname`.chomp\n content = content.gsub('localhost', hostname)\n File.open(json, 'w') { |file| file.write(content) }\n summary = out[\"summary\"]\n total = summary[\"example_count\"]\n failures = summary[\"failure_count\"]\n if failures > 0 then\n print (\"[%-3s/%-4s] \" % [failures, total]).yellow, target, \"\\n\"\n else\n print \"[OK] \".green, target, \"\\n\"\n end\n rescue Exception => e\n print \"[ERROR] \".red, target, \" (#{e.message})\", \"\\n\"\n end\n end",
"def print\n puts \"The following style guide issues have been found:\\n\"\n serial_number = 0\n @@errors.each do |filename, errors_list|\n next if errors_list.blank?\n computed_filename = filename.gsub(\"#{Rails.root}\", '')\n puts \"#{serial_number + 1}. #{computed_filename}\\n\"\n serial_number += 1\n errors_list.each_with_index do |error, i|\n puts \"\\t#{i+1}. #{RailsReview::Error::MAP[error.keys.first]} - line: #{error.values.first}\\n\"\n end\n puts \"\\n\"\n end\n end",
"def handle_error(cmd, stderr)\n summary = \"\\rError running \\`#{cmd}\\`\"\n details = readable_curr_time << \"\\n\\n\"\n details << \"**************************************************************\\n\"\n details << \"#{summary}\\n\"\n details << \"**************************************************************\\n\"\n details << stderr << \"\\n\\n\"\n File.open(@err_path, 'a') { |file| file.write(details) }\n summary\nend",
"def get_ingress_endpoint(namespace, ingress_name)\n stdout, _, _ = execute(\"kubectl get ingress #{ingress_name} -n #{namespace} -o json -o jsonpath='{.status.loadBalancer.ingress[0].hostname}'\")\n stdout\nend",
"def describe\n f = file!\n puts \"Current environment: #{f.basename}\"\n puts '*' * 70\n File.open(f).each do |line|\n puts \" #{line}\"\n end\n puts '*' * 70\n end",
"def print_pod_logs(pod)\n @output.puts \"LOGS:\"\n\n containers = (pod.containers + pod.init_containers).map { |c| c.fetch(:name) }\n containers.each do |container|\n @output.puts \"Container #{container}\" if containers.size > 1\n\n # Display the first and last n_lines of the log\n max = 50\n lines = (pod.logs(container) || \"No logs found\").split(\"\\n\")\n lines = lines.first(max / 2) + ['...'] + lines.last(max / 2) if lines.size > max\n lines.each { |line| @output.puts \" #{line}\" }\n end\n end",
"def output_yaml_errors\n File.open(@options['output-file'], 'w+') do |file|\n file.write YAML.dump(errors)\n end\n end",
"def describe_error(error)\n tell_user [\n nil,\n '!!!'.red,\n '!!! RUBY ERROR!'.red,\n \"#{'!!!'.red} #{error.message}\", '!!!'.red,\n error.backtrace.map{|m| \"#{'!!!'.red} #{m}\" },\n '!!!'.red\n ].flatten\n end",
"def stderr\n @output.stderr\n end",
"def dev_format(errors = @output[:raw_data])\n return if errors.blank?\n\n pretty_output = ''\n errors.each do |filename, error_list|\n filename = strip_working_dir(filename)\n pretty_output << \"\\n#{filename.color(:cyan).underline} \\n\"\n error_list.each do |message|\n pretty_output << severity_color(message['severity'])\n pretty_output << \" #{message['line'].to_s.color(:blue)} #{message['linter'].color(:green)}: #{message['reason']} \\n\"\n end\n end\n pretty_output << \"-----\\n\\n\"\n pretty_output\n end",
"def status(target, json)\n begin\n out = JSON.parse(File.read(json))\n summary = out[\"summary\"]\n total = summary[\"example_count\"]\n failures = summary[\"failure_count\"]\n if failures > 0 then\n print (\"[%-3s/%-4s] \" % [failures, total]).yellow, target, \"\\n\"\n else\n print \"[OK ] \".green, target, \"\\n\"\n end\n rescue Exception => e\n print \"[ERROR ] \".red, target, \" (#{e.message})\", \"\\n\"\n end\n end",
"def status(target, json)\n begin\n out = JSON.parse(File.read(json))\n summary = out[\"summary\"]\n total = summary[\"example_count\"]\n failures = summary[\"failure_count\"]\n if failures > 0 then\n print (\"[%-3s/%-4s] \" % [failures, total]).yellow, target, \"\\n\"\n else\n print \"[OK ] \".green, target, \"\\n\"\n end\n rescue Exception => e\n print \"[ERROR ] \".red, target, \" (#{e.message})\", \"\\n\"\n end\n end",
"def puppet_output(bolt_result)\n bolt_result.dig(0, 'value', 'stderr').to_s + \\\n bolt_result.dig(0, 'value', 'stdout').to_s\n end",
"def ccat_not_started_errata\n Errata.find(20044)\n end",
"def check_file(file_result)\n begin\n ::YAML.load(File.read(file_result.path))\n rescue Psych::SyntaxError => e\n file_result.add_issue(\n line_number: e.line,\n character: e.column,\n level: :error,\n raw_message: e.problem,\n )\n end\n end",
"def ccat_not_cdn_errata\n Errata.find(18917)\n end",
"def print_error\n puts @error_text if @error_text\n print_usage\n end",
"def file_patterns_errors_for_spec(spec, file, platform_name)\n Dir.chdir(config.project_pods_root + spec.name ) do\n messages = []\n messages += check_spec_files_exists(spec, :source_files, platform_name, '*.{h,m,mm,c,cpp}')\n messages += check_spec_files_exists(spec, :resources, platform_name)\n messages << \"license[:file] = '#{spec.license[:file]}' -> did not match any file\" if spec.license[:file] && Pathname.pwd.glob(spec.license[:file]).empty?\n messages.compact\n end\n end",
"def redshift(region)\n verbose_or_debug_msg(\"Checking Redshift resources in region #{region} for profile \\\"#{$profile}\\\"\")\n efs = Aws::Redshift::Client.new(region: region, credentials: $credentials)\n if $audit_mode\n opfile=File.open(\"#{$audit_dir}/#{region}/redshift\",\"w\")\n else\n opfile=$stdout\n end\n begin # Redshift is not supported by all regions\n efs.describe_clusters.each do |cluster|\n cluster.clusters.each do |c|\n if not $quiet\n # using a multiline broken string to preserve indentation:\n string=\"\\\"#{$profile}\\\",\\\"#{region}\\\",\\\"Redshift Cluster\\\",\\\"#{c.cluster_identifier}\\\",\\\"#{c.cluster_status}\\\",\\\"#{c.node_type}\\\",\\\"\"\\\n \"\\\"#{c.number_of_nodes}\\\",\\\"#{c.vpc_id}\\\"\"\n opfile.print string\n end \n $redshift_count+=1\n end\n end\n rescue => err\n # We ought to handle only the specific error of the region not having EFS, really.\n # print(\"Error in region #{region} #{err}\\n\")\n debug_msg(\"Error in region #{region} #{err}\\n\")\n end\nend",
"def err(message = '')\n @out_sections = [] unless defined?(@out_sections)\n message = \"#{' ' * @out_sections.size}#{message}\"\n # log_debug \"<Output> - #{message}\"\n message = \"#{message}\\n\" unless message.end_with?(\"\\n\")\n @logger_stderr << message\n end",
"def error\n get_ingest_run.error\n end",
"def print_errors\n puts \"\n#{\"== #{\"Ruby 2D Installation Errors\".error} =======================================\\n\"}\n #{$errors.join(\"\\n \")}\\n\n#{\"======================================================================\"}\"\nend",
"def print_errors\n puts \"\n#{\"== #{\"Ruby 2D Installation Errors\".error} =======================================\\n\"}\n #{$errors.join(\"\\n \")}\\n\n#{\"======================================================================\"}\"\nend",
"def usage\n puts <<EOF\nUsage:\n #{__FILE__} resource_type.resource_name resource_id [other terraform's parameters]\nEquivalent of:\n terraform import resource_type.resource_name resource_id [other parameters]\nIssues:\n Delete terraform.tfstate before run\nEOF\n exit 1\nend",
"def cookbook_resolution_failed(expanded_run_list, exception)\n description = Formatters::ErrorMapper.cookbook_resolution_failed(expanded_run_list, exception)\n @error_description = description.for_json\n end",
"def read_pods\n kubeclient = build_kube_client!\n\n kubeclient.get_pods(namespace: actual_namespace).as_json\n rescue Kubeclient::ResourceNotFoundError\n []\n end",
"def get_pod_name(namespace, index)\n `kubectl get pods -n #{namespace} | awk 'FNR == #{index + 1} {print $1}'`.chomp\nend",
"def trace_errors\n getErrors.each { |e|\n puts \"(#{e.object || ''}): #{e.error}\"\n }\n end",
"def error_message\n err = details[\"err\"] || details[\"errmsg\"] || details[\"$err\"]\n if code = details[\"code\"]\n \"failed with error #{code}: #{err.inspect}\\n\\n\" <<\n \"See #{ERROR_REFERENCE}\\nfor details about this error.\"\n elsif code = details[\"assertionCode\"]\n assertion = details[\"assertion\"]\n \"failed with error #{code}: #{assertion.inspect}\\n\\n\" <<\n \"See #{ERROR_REFERENCE}\\nfor details about this error.\"\n else\n \"failed with error #{err.inspect}\"\n end\n end",
"def config_error(path, error); end",
"def print_error(e)\n puts e.message\n puts e.backtrace if(trace)\n end",
"def describe\n\t\t\"Print the content of the file to the client\"\n\tend",
"def show_error_encountered(error)\n print \"\\033[31mError encountered:\\033[0m\\n\"\n print error.inspect\n end",
"def ccat_old_not_started_errata\n Errata.find(11129)\n end",
"def get_error_frame(trace)\n trace.reverse.find { |f| !f['filename'].start_with?('/usr/local/rvm/') }\nend",
"def describe\n f = file!\n puts \"Current target: #{f.basename}\"\n puts '*' * 70\n File.open(f).each do |line|\n puts \" #{line}\"\n end\n puts '*' * 70\n end",
"def error(fmt, *args)\n $stderr.printf(\"%s: %s\\n\", File.basename($0), sprintf(fmt, *args))\n exit(1)\nend",
"def format_rest_error(response)\n Array(Chef::JSONCompat.from_json(response.body)[\"error\"]).join(\"; \")\n rescue Exception\n response.body\n end",
"def print_error(message, file)\n @output.puts \"\\u{274c} #{file} - #{message}\"\n end",
"def print_error(message, file)\n @output.puts \"\\u{274c} #{file} - #{message}\"\n end",
"def errored_files\n @attributes[:errored_files]\n end",
"def preview\n project = Project.find params.require(:project_id)\n reference = project.release_branch.presence || \"master\"\n errors = []\n\n project.kubernetes_roles.not_deleted.each do |role|\n config = role.role_config_file(\n reference,\n project: project, ignore_missing: true, ignore_errors: false, deploy_group: nil\n )\n unless config\n errors << \"Unable to read #{role.config_file}\"\n next\n end\n\n config.elements.each do |element|\n kind = element[:kind]\n name = element.dig(:metadata, :name)\n\n # name was never changed\n next if Kubernetes::RoleValidator::IMMUTABLE_NAME_KINDS.include?(kind) ||\n Kubernetes::RoleValidator.keep_name?(element)\n\n # correct name was configured\n expected = (kind == \"Service\" ? role.service_name : role.resource_name)\n next if name == expected\n\n errors << \"Project config #{config.path} #{kind} #{name} would be duplicated with name #{expected}\"\n end\n end\n\n if errors.any?\n redirect_to({action: :index}, alert: helpers.simple_format(errors.join(\"\\n\")))\n else\n redirect_to({action: :index}, notice: \"No name change expected\")\n end\n end",
"def logs tail=nil\n f = tail ? '-f ' : ''\n\n if tail\n @prompter.print 'Fetching logs...'\n @prompter.print 'Use Ctrl-C to stop'\n end\n\n @cli.system_call \"kubectl logs #{f}#{self.name} --namespace=#{self.namespace} -c=#{self.app}\"\n end",
"def preview\n project = Project.find params.require(:project_id)\n reference = project.release_branch.presence || \"master\"\n errors = []\n\n project.kubernetes_roles.not_deleted.each do |role|\n config = role.role_config_file(reference, project: project, ignore_missing: true, deploy_group: nil)\n unless config\n errors << \"Unable to read #{role.config_file}\"\n next\n end\n\n config.elements.each do |element|\n kind = element[:kind]\n name = element.dig(:metadata, :name)\n\n # name was never changed\n next if Kubernetes::RoleValidator::IMMUTABLE_NAME_KINDS.include?(kind) ||\n Kubernetes::RoleValidator.keep_name?(element)\n\n # correct name was configured\n expected = (kind == \"Service\" ? role.service_name : role.resource_name)\n next if name == expected\n\n errors << \"Project config #{config.path} #{kind} #{name} would be duplicated with name #{expected}\"\n end\n end\n\n if errors.any?\n redirect_to({action: :index}, alert: helpers.simple_format(errors.join(\"\\n\")))\n else\n redirect_to({action: :index}, notice: \"No name change expected\")\n end\n end",
"def all_stderr\n aruba.command_monitor.all_stderr\n end",
"def handle_configuration_error(e)\n puts \"There is a configuration error with the current mongoid.yml.\"\n puts e.message\n end",
"def inspect\n string = \"#{self.class} running: #{command}\\n\"\n string << @standard_output.inspect.gsub(/^/, ' ')\n string << @standard_error.inspect.gsub(/^/, ' ')\n end",
"def be_verbose(index)\n puts \"\\n#{result_case} (#{index+1})- #{@testcase.unique_identifier} - \\\"#{@testcase.name}\\\"\"\n puts @error_message\n puts(\"Request runtime: #{@response.runtime}\")\n puts(\" More more more verbosity\\n\")\n puts(\" request method: #{@testcase.request['method']}\")\n puts(\" resource path: #{@testcase.request['path']}\")\n puts(\" request headers: #{@testcase.request['headers']}\")\n puts(\" JSON body sent: #{@testcase.request['body']}\")\n puts(\" expectation:\")\n puts(\" response status code: #{@testcase.response_expectation['status_code']}\")\n puts(\" response headers: #{@testcase.response_expectation['headers']}\")\n puts(\" response body: #{@testcase.response_expectation['body']}\")\n puts(\" result:\")\n puts(\" response status code: #{@response.code}\")\n puts(\" response headers: #{@response.headers}\")\n puts(\" response body: #{JSON.parse(@response.body) rescue nil}\")\n end",
"def log\n File.read(SPEC_LOG) rescue \"\"\n end",
"def record_error (error)\n\n path = get_path(error.fei)\n\n dirpath = File.dirname(path)\n\n FileUtils.mkdir_p(dirpath) unless File.exist?(dirpath)\n\n File.open(path, 'a+') do |f|\n f.puts(error.to_yaml)\n end\n end",
"def scaffold_error_raised\n DataMapper::ObjectNotFoundError\n end",
"def stderr\n instance.options[:stderr]\n end",
"def stderr\n instance.options[:stderr]\n end",
"def restart_kubelet\n cmd = ['systemctl', 'restart', 'kubelet.service']\n stdout, stderr, status = Open3.capture3(*cmd)\n raise Puppet::Error, _(\"stderr: '%{stderr}'\" % { stderr: stderr }) if status != 0\n { status: stdout.strip }\nend",
"def get_key_file_error(json_key_file)\n return nil if json_key_file.nil? || json_key_file == ''\n\n abs = ::File.absolute_path json_key_file\n unless abs == json_key_file\n return \"json_key_file must be an absolute path: #{json_key_file}\"\n end\n\n unless ::File.exist? json_key_file\n return \"json_key_file does not exist: #{json_key_file}\"\n end\n\n nil\n end",
"def debug_header(config)\n stderr.puts <<-EOF.strip\nruby: #{RUBY_DESCRIPTION}\nruby-lint: #{RubyLint::VERSION}\ndirectory: #{Dir.pwd}\ncaching: #{config.enable_cache}\ncache: #{config.cache_directory}\n EOF\n\n stderr.puts\n end",
"def checkErrorFile(file, logkey='')\n if File.file?(file)\n Mcmlln::Tools.deleteFile(file)\n else\n logstring = 'n-a'\n end\nrescue => logstring\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def error_details\n msg = ''\n @runner.failures.each do |checker|\n # msg << error(\"------- #{checker.name} -------\") << \"\\n\"\n # msg << error(\"#{checker.hint}\") << \"\\n\"\n checker.errors.details.each do |type, content|\n case type\n when :source\n content.each_line.with_index do |l, i|\n msg << yellow((i + 1).to_s.rjust(3)) << '|' << l\n end\n when Integer\n msg << info('Line: ') << yellow(type) << '|' << info(content)\n when Array\n msg << info('Pos: ') << yellow(type.join(',')) << '|' << info(content)\n when nil\n msg << info(content)\n end\n msg << \"\\n\"\n end\n end\n msg\n end",
"def cat( filename ) \r\n begin\r\n @ndev.rpc.file_show( :filename => filename ).text\r\n rescue => e\r\n raise IOError, e.rsp.xpath('rpc-error/error-message').text.strip\r\n end\r\n end",
"def print_undocumented_objects\n return if !@undoc_list || @undoc_list.empty?\n log.puts\n log.puts \"Undocumented Objects:\"\n\n # array needed for sort due to unstable sort\n objects = @undoc_list.sort_by {|o| [o.file.to_s, o.path] }\n max = objects.max {|a, b| a.path.length <=> b.path.length }.path.length\n if @compact\n objects.each do |object|\n log.puts(\"%-#{max}s (%s)\" % [object.path,\n [object.file || \"-unknown-\", object.line].compact.join(\":\")])\n end\n else\n last_file = nil\n objects.each do |object|\n if object.file != last_file\n log.puts\n log.puts \"(in file: #{object.file || \"-unknown-\"})\"\n end\n log.puts object.path\n last_file = object.file\n end\n end\n end",
"def err(msg)\n \"{\\\"description\\\":\\\"#{msg}\\\"}\"\nend",
"def debug_log(msg)\n Chef::Log.info(\"easybib_deploy_manager: #{msg}\")\nend",
"def cmd_debug_error(ex)\n if $verbose\n $stderr.puts \"error: #{$!.class}: #{$!.to_s}\"\n $!.backtrace.each {|b|\n $stderr.puts \" #{b}\"\n }\n $stderr.puts \"\"\n end\n end",
"def cmd_debug_error(ex)\n if $verbose\n $stderr.puts \"error: #{$!.class}: #{$!.to_s}\"\n $!.backtrace.each {|b|\n $stderr.puts \" #{b}\"\n }\n $stderr.puts \"\"\n end\n end",
"def usage\n puts \"Usage:\"\n puts \" tools/find-unused-labels.rb > unused-labels.txt\"\nend",
"def errors\n yaml_errors = nil\n begin\n YAML.safe_load(@text, [Symbol])\n rescue Psych::SyntaxError => e\n yaml_errors = {\n line: e.line,\n column: e.column,\n message: e.message\n }\n end\n yaml_errors\n end",
"def read_failing_log()\n failed_files = []\n\n # Read in the file\n file = File.readlines(@failing_log)\n\n # Get lines which begin with rspec\n file.each do |line|\n if line =~ /rspec \\.\\//\n # Get the file name only\n failed_files << get_error_info(line)\n end\n end\n\n return failed_files\n end",
"def print_error(error)\n puts \"Message: \" + error.message\n puts \"HTTP Status: \" + error.status.to_s\n puts \"Developer Message: \" + error.developer_message\n puts \"More Information: \" + error.more_info\n puts \"Error Code: \" + error.code.to_s\nend",
"def kubernetes_path_to_binaries\n kube_commands(kubernetes_bin_prefix)\n end",
"def cookbook_resolution_failed(expanded_run_list, exception)\n update_error_description(\n Formatters::ErrorMapper.cookbook_resolution_failed(\n expanded_run_list,\n exception\n ).for_json\n )\n end",
"def lint!\n all_valid = true\n @files.each do |file|\n file = file.realpath\n file_spec = Specification.from_file(file)\n\n specs = file_spec.recursive_subspecs.any? ? file_spec.recursive_subspecs : [file_spec]\n specs.each do |spec|\n # Show immediatly which pod is being processed.\n # This line will be overwritten once the result is known\n print \" -> #{spec}\\r\" unless config.silent? || @is_repo\n $stdout.flush\n\n # If the spec doesn't validate it raises and informative\n spec.validate!\n\n warnings = warnings_for_spec(spec, file)\n deprecations = deprecation_notices_for_spec(spec, file)\n build_messages, file_patterns_errors = [], []\n unless @is_repo || @quick\n platform_names(spec).each do |platform_name|\n set_up_lint_environment\n build_messages += build_errors_for_spec(spec, file, platform_name)\n file_patterns_errors += file_patterns_errors_for_spec(spec, file, platform_name)\n tear_down_lint_environment\n end\n end\n build_errors = build_messages.select {|msg| msg.include?('error')}\n build_warnings = build_messages - build_errors\n\n # Errors compromise the functionality of a spec, warnings can be ignored\n all = warnings + deprecations + build_messages + file_patterns_errors\n errors = file_patterns_errors + build_errors\n warnings = all - errors\n\n if @only_errors\n all_valid = false unless errors.empty?\n else\n # avoid to fail validation for xcode warnings\n all_valid = false unless (all - build_warnings).empty?\n end\n\n clean_duplicate_platfrom_messages(errors)\n clean_duplicate_platfrom_messages(warnings)\n\n # This overwrites the previously printed text\n unless config.silent?\n if errors.empty? && warnings.empty?\n puts \" -> \".green + \"#{spec} passed validation\" unless @is_repo\n elsif errors.empty?\n puts \" -> \".yellow + spec.to_s\n else\n puts \" -> \".red + spec.to_s\n end\n end\n\n warnings.each {|msg| puts \" - WARN | #{msg}\"} unless config.silent?\n errors.each {|msg| puts \" - ERROR | #{msg}\"} unless config.silent?\n puts unless config.silent? || ( @is_repo && all.flatten.empty? )\n end\n end\n all_valid\n end",
"def check\n\n # run a nuclei\n uri = _get_entity_name\n\n\n known_paths = <<-eos\n/api\n/api/v1\n/api/v1/namespaces\n/api/v1/nodes\n/api/v1/pods\n/apis\n/apis/admissionregistration.k8s.io/v1beta1\n/apis/apiextensions.k8s.io/v1beta1\n/apis/apiregistration.k8s.io/v1beta1\n/apis/apps/v1\n/apis/apps/v1beta1\n/apis/apps/v1beta2\n/apis/authentication.k8s.io/v1\n/apis/authentication.k8s.io/v1beta1\n/apis/authorization.k8s.io/v1\n/apis/authorization.k8s.io/v1beta1\n/apis/autoscaling/v1\n/apis/autoscaling/v2beta1\n/apis/batch/v1\n/apis/batch/v1beta1\n/apis/certificates.k8s.io/v1beta1\n/apis/events.k8s.io/v1beta1\n/apis/extensions/v1beta1\n/apis/extensions/v1beta1/podsecuritypolicies\n/apis/networking.k8s.io/v1\n/apis/policy/v1beta1\n/apis/rbac.authorization.k8s.io/v1\n/apis/rbac.authorization.k8s.io/v1beta1\n/apis/storage.k8s.io/v1\n/apis/storage.k8s.io/v1beta1\n/version\n/api/v1/namespaces/default/pods/\n/api/v1/namespaces/default/pods/test/status\n/api/v1/namespaces/default/secrets/\n/apis/extensions/v1beta1/namespaces/default/deployments\n/apis/extensions/v1beta1/namespaces/default/daemonsets\nca-key.pem\ntoken_auth.csv\nca.pem\nconfig.seen\ncloud-provider.yaml\napiserver.pem\n10-flannel.conf\nconfig.source\naudit.log\nconfig.hash\napiserver-key.pem\ncni-conf.json\nkube-proxy.log\napiserver-aggregator-ca.cert\napiserver-aggregator.cert\nserver.cert\nca.key\netcd-events.log\nkube-scheduler.log\nnode-role.kubernetes.io\nkube-apiserver.log\nbasic_auth.csv\ndns.alpha.kubernetes.io\napiserver-aggregator.key\netcd.log\nknown_tokens.csv\nkube-controller-manager.log\nca.crt\nserver.key\nrun.sh\netcd-apiserver-client.key\netcd-ca.crt\nadmission_controller_config.yaml\nserviceaccount.crt\napiserver-client.crt\nca-certificates.crt\napiserver.crt\nkube-addons.sh\ngce.conf\npv-recycler-template.yaml\netcd-apiserver-client.crt\nproxy_client.crt\napiserver.key\netcd-apiserver-server.crt\netcd-apiserver-ca.crt\netcd-apiserver-server.key\nserviceaccount.key\netcd-peer.key\naggr_ca.crt\nmigrate-if-needed.sh\napiserver-client.key\nproxy_client.key\netcd-peer.crt\nkube-addon-manager.log\nkube-apiserver-audit.log\nglbc.log\neos\n\n\n\n # default value for the check response\n out = false\n\n # first test that we can get something\n contents = http_get_body \"#{uri}\"\n _log_error \"failing, unable to get a response\" unless contents\n\n # get a missing page, and sha the dom\n benign_contents = http_get_body \"#{uri}/api/v1/namespaces/default/pods/#{rand(10000000000)}.aspx\"\n benign_content_sha = Digest::SHA1.hexdigest(html_dom_to_string(benign_contents))\n\n # check all paths for a non-error response\n known_paths.split(\"\\n\").each do |k8path|\n _log \"Getting: #{k8path}\"\n\n full_path = \"#{uri}#{k8path}\"\n\n # get the body and do the same thing as above\n contents = http_get_body full_path\n our_sha = Digest::SHA1.hexdigest(html_dom_to_string(contents))\n\n # now check them\n default_response = /default backend \\- 404/\n if our_sha != benign_content_sha && !contents =~ default_response\n heuristic_match = true\n _log \"Odd contents for #{full_path}!, flagging\"\n out = construct_positive_match(full_path, contents, benign_contents)\n else\n _log \"Got same content for missing page, probably okay\"\n end\n\n end\n\n out\n end",
"def parse_deploy_output(stdout, stderr)\n # In our case our bash scripts return the last line as a status, so use it.\n [{\n name: 'Install tool',\n status:\n case stdout.split(\"\\n\").last\n when 'OK'\n :identical\n else\n :changed\n end,\n diffs: stdout\n }]\n end",
"def sourcekitten_output(config)\n installation_root = Pathname(Dir.mktmpdir(['jazzy', podspec.name]))\n installation_root.rmtree if installation_root.exist?\n Pod::Config.instance.with_changes(installation_root: installation_root,\n verbose: false) do\n sandbox = Pod::Sandbox.new(Pod::Config.instance.sandbox_root)\n installer = Pod::Installer.new(sandbox, podfile(config))\n installer.install!\n stdout = Dir.chdir(sandbox.root) do\n targets = installer.pod_targets\n .select { |pt| pt.pod_name == podspec.root.name }\n .map(&:label)\n\n targets.map do |t|\n args = %W[doc --module-name #{podspec.module_name} -- -target #{t}]\n SourceKitten.run_sourcekitten(args)\n end\n end\n stdout.reduce([]) { |a, s| a + JSON.parse(s) }.to_json\n end\n end",
"def load_error(path)\n log.fatal(\"#{path} is either missing or formatted incorrectly!\")\n load_error = <<END\n#{path} is either missing or formatted incorrectly!\n\nTo run this script, you need to create a file named\n#{path} with your configuration in the following format:\n\n# Comment\n:key: 'value'\n:string: 'string value'\n:integer: 123\n:boolean: true/false\n:array:\n- '1st'\n- '2nd'\n:hash:\n-\n:sub_key: 'sub value'\n\nEND\n return load_error\n end"
]
| [
"0.56038433",
"0.54105234",
"0.5351739",
"0.5315673",
"0.5247662",
"0.5230266",
"0.52056587",
"0.51863414",
"0.5159915",
"0.50922036",
"0.50868344",
"0.5082352",
"0.5082352",
"0.5082352",
"0.5082352",
"0.5057147",
"0.5043923",
"0.5039056",
"0.50374234",
"0.50092894",
"0.5005131",
"0.49945956",
"0.4990048",
"0.49859935",
"0.4978112",
"0.4974869",
"0.49716598",
"0.49690524",
"0.49604577",
"0.4939475",
"0.4935167",
"0.49174204",
"0.4902193",
"0.4900721",
"0.4893917",
"0.48737708",
"0.48737708",
"0.487338",
"0.4854875",
"0.48380357",
"0.48054594",
"0.47988755",
"0.47962868",
"0.47931516",
"0.47807157",
"0.47668153",
"0.47644478",
"0.47644478",
"0.47632852",
"0.475939",
"0.474477",
"0.47434136",
"0.47413558",
"0.47374988",
"0.47364542",
"0.47346842",
"0.47335857",
"0.47314835",
"0.4725632",
"0.47213852",
"0.47099257",
"0.47006875",
"0.46892622",
"0.4686581",
"0.4686581",
"0.46850514",
"0.4680375",
"0.4674689",
"0.46722528",
"0.4668611",
"0.46581835",
"0.46525508",
"0.46464685",
"0.46304324",
"0.46240082",
"0.46238527",
"0.4622862",
"0.4622862",
"0.4618873",
"0.4616483",
"0.4613174",
"0.46126363",
"0.46054468",
"0.45993587",
"0.45931774",
"0.45919394",
"0.45874408",
"0.45825946",
"0.45825946",
"0.4581806",
"0.45789295",
"0.45779577",
"0.4576504",
"0.45705146",
"0.45676258",
"0.4564374",
"0.45621845",
"0.45572823",
"0.455288",
"0.45515558"
]
| 0.7479636 | 0 |
DISPLAY_BOARD Should accept a board as an argument and print out the current state of the board for the user. | def display_board(board)
puts " #{board[0]} " "|" " #{board[1]} " "|" " #{board[2]} "
puts "-----------"
puts " #{board[3]} " "|" " #{board[4]} " "|" " #{board[5]} "
puts "-----------"
puts " #{board[6]} " "|" " #{board[7]} " "|" " #{board[8]} "
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_board\n\t board =\" | | \\n-----------\\n | | \\n-----------\\n | | \"\n\t puts board\n\tend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\n end",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\n end",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"---+----+----\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"---+----+----\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\n end",
"def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"def board_display\n puts @board\n end",
"def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"---------------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"---------------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"def game_board_display(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\n\n end",
"def display_board\n puts\n puts \"Here is the current board:\"\n puts \n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"---+---+---\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"---+---+---\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n puts \n end",
"def display\n \"\\n=============COMPUTER BOARD=============\\n\" +\n \"#{@npc.board.render}\\n\" +\n \"==============PLAYER BOARD==============\\n\" +\n \"#{@user_board.render(true)}\\n\"\n end",
"def display_board\n\t\t\tsystem(\"cls\")\n\t\t\tprint \"\\n\"\n\t\t\t 7.downto(0).each_with_index{|x|\n\t\t\t\t print \"#{x+1}| \"\n\t\t\t\t\t8.times{|y|\n\t\t\t\t\tif y%2==0 && x%2 == 0 || y%2==1 && x%2 == 1\n\t\t\t\t\t\tif @board[y][x] != nil && @board[y][x].color == \"white\"\n\t\t\t\t\t\t\tprint @board[y][x].class.to_s[0].white.bold.on_red, \" \".on_red\n\t\t\t\t\t\telsif @board[y][x] != nil && @board[y][x].color == \"black\"\n\t\t\t\t\t\t\tprint @board[y][x].class.to_s[0].green.bold.on_red, \" \".on_red\n\t\t\t\t\t\telse \n\t\t\t\t\t\t\tprint \" \".on_red\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tif @board[y][x] != nil && @board[y][x].color == \"white\"\n\t\t\t\t\t\t\tprint @board[y][x].class.to_s[0].white.bold, \" \"\n\t\t\t\t\t\telsif @board[y][x] != nil && @board[y][x].color == \"black\"\n\t\t\t\t\t\t\tprint @board[y][x].class.to_s[0].green.bold, \" \"\n\t\t\t\t\t\telse \n\t\t\t\t\t\t\tprint \" \", \" \"\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\tprint \"\\n\"\n\t\t\t\t }\n\t\t\t print \"------------------\\n\"\n\t\t\t print \" a b c d e f g h\\n\\n\"\n\tend",
"def display_board()\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"def display_board()\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \" ----------- \"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \" ----------- \"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"def display_board\n\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \" ----------- \"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \" ----------- \"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n\n end",
"def display_board(board)\n\tputs \" #{board[0]} | #{board[1]} | #{board[2]} \"\n\tputs \"-----------\"\n\tputs \" #{board[3]} | #{board[4]} | #{board[5]} \"\n\tputs \"-----------\"\n\tputs \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"def display_board(board)\n system('cls')\n puts \"Player is #{PLAYER_MARKER}. Computer is #{COMPUTER_MARKER}.\"\n puts \"\"\n puts \" | |\"\n puts \" #{board[1]} | #{board[2]} | #{board[3]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{board[4]} | #{board[5]} | #{board[6]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{board[7]} | #{board[8]} | #{board[9]}\"\n puts \" | |\"\n puts \"\"\nend",
"def display_board\r\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\r\n puts \"-----------\"\r\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\r\n puts \"-----------\"\r\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\r\n end",
"def display_board\r\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\r\n puts \"-----------\"\r\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\r\n puts \"-----------\"\r\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\r\n end",
"def display_board\n\n puts \" #{@board[0].mark} | #{@board[1].mark} | #{@board[2].mark} \"\n puts \"-----------\"\n puts \" #{@board[3].mark} | #{@board[4].mark} | #{@board[5].mark} \"\n puts \"-----------\"\n puts \" #{@board[6].mark} | #{@board[7].mark} | #{@board[8].mark} \"\n end",
"def display_board\n board =\n \" _______ _______ _______\n | | | |\n A| #{@state[:A1]} | #{@state[:A2]} | #{@state[:A3]} |\n |_______|_______|_______|\n | | | |\n B| #{@state[:B1]} | #{@state[:B2]} | #{@state[:B3]} |\n |_______|_______|_______|\n | | | |\n C| #{@state[:C1]} | #{@state[:C2]} | #{@state[:C3]} |\n |_______|_______|_______|\n 1 2 3\n \"\n puts board\n end",
"def display_board(brd)\n system 'clear' || system('cls')\n puts \"You're a #{PLAYER_MARKER}. Computer is #{COMPUTER_MARKER}.\"\n puts \"\"\n puts \" | |\"\n puts \" #{brd[1]} | #{brd[2]} | #{brd[3]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[4]} | #{brd[5]} | #{brd[6]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[7]} | #{brd[8]} | #{brd[9]}\"\n puts \" | |\"\n puts \"\"\nend",
"def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts '---------------'\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts '---------------'\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"def display\n puts \"===Current Board Status===\"\n @bingo_board.each { |row| puts print row }\n end",
"def display_board(brd)\n puts green(\"You're #{PLAYER_MARKER}. Computer is #{COMPUTER_MARKER}.\")\n puts \"\"\n puts \" | |\"\n puts \" #{brd[1]} | #{brd[2]} | #{brd[3]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[4]} | #{brd[5]} | #{brd[6]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[7]} | #{brd[8]} | #{brd[9]}\"\n puts \" | |\"\n puts \"\"\nend",
"def display_board(brd)\n system \"clear\"\n puts \"You're #{PLAYER_MARKER}'s. Computer is #{COMPUTER_MARKER}'s\"\n puts \" | | \"\n puts \" #{brd[1]} | #{brd[2]} | #{brd[3]} \"\n puts \" | | \"\n puts \"=================\"\n puts \" | | \"\n puts \" #{brd[4]} | #{brd[5]} | #{brd[6]} \"\n puts \" | | \"\n puts \"=================\"\n puts \" | | \"\n puts \" #{brd[7]} | #{brd[8]} | #{brd[9]} \"\n puts \" | | \"\nend",
"def display_board(board)\n system 'clear'\n puts \"Player : #{PLAYER_MARKER}\"\n puts \"Computer: #{COMPUTER_MARKER}\"\n puts \"\"\n puts \" | |\"\n puts \" #{board[1]} | #{board[2]} | #{board[3]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{board[4]} | #{board[5]} | #{board[6]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{board[7]} | #{board[8]} | #{board[9]}\"\n puts \" | |\"\n puts \"\"\nend",
"def display_board(brd)\n system 'clear'\n puts \"You're a #{PLAYER_MARKER}. Computer is #{COMPUTER_MARKER}.\"\n puts \"\"\n puts \" | |\"\n puts \" #{brd[1]} | #{brd[2]} | #{brd[3]} \"\n puts \" | |\"\n puts \" -----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[4]} | #{brd[5]} | #{brd[6]} \"\n puts \" | |\"\n puts \" -----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[7]} | #{brd[8]} | #{brd[9]} \"\n puts \" | |\"\n puts \"\"\nend",
"def display_board(brd)\n system 'clear'\n puts \"You're a #{PLAYER_MARKER}. Computer is #{COMPUTER_MARKER}.\"\n puts \"\"\n puts \" | |\"\n puts \" #{brd[1]} | #{brd[2]} | #{brd[3]} \"\n puts \" | |\"\n puts \" -----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[4]} | #{brd[5]} | #{brd[6]} \"\n puts \" | |\"\n puts \" -----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[7]} | #{brd[8]} | #{brd[9]} \"\n puts \" | |\"\n puts \"\"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\\n\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\\n\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"def display_board\n board = \" | | \n-----------\n | | \n-----------\n | | \"\n puts board\nend",
"def display(board)\n @board = board\n render\n end",
"def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n\n end",
"def display_board\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\nend",
"def display_board\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\nend",
"def display_board\n\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n\n end",
"def display_board(board)\n puts \" #{board[0] } | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3] } | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6] } | #{board[7]} | #{board[8]} \"\nend",
"def display_board\n puts \" | | \"\n puts\"-----------\"\n puts \" | | \"\n puts\"-----------\"\n puts \" | | \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board(board)\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts \"-----------\"\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts \"-----------\"\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def display_board\n puts \"#{human.name}: #{human.marker}, #{computer.name}: #{computer.marker}\"\n puts \"Round #{@round}.\"\n puts \"Score: #{human.score} - #{computer.score}\"\n puts \"\"\n board.draw\n puts \"\"\n end",
"def display_board(brd)\n system 'clear'\n puts \"You'e a #{PLAYER_MARKER}. Computer is #{COMPUTER_MARKER}.\"\n puts \"\"\n puts \" | |\"\n puts \" #{brd[1]} | #{brd[2]} | #{brd[3]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[4]} | #{brd[5]} | #{brd[6]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[7]} | #{brd[8]} | #{brd[9]}\"\n puts \" | |\"\n puts \"\"\nend",
"def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"def display_board\n puts \" | | \" \n puts \"-----------\"\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\nend"
]
| [
"0.76173735",
"0.7579887",
"0.7579887",
"0.7548516",
"0.7545671",
"0.75404227",
"0.7484964",
"0.74778295",
"0.7472563",
"0.74558",
"0.744315",
"0.7424092",
"0.7424092",
"0.7376109",
"0.7361076",
"0.7348736",
"0.7341896",
"0.7341896",
"0.7341896",
"0.7341896",
"0.7341896",
"0.7341896",
"0.7341896",
"0.7341896",
"0.7341896",
"0.7341896",
"0.7341896",
"0.73318744",
"0.73159057",
"0.73159057",
"0.73142475",
"0.7309402",
"0.7293773",
"0.7281909",
"0.72678494",
"0.72604793",
"0.72518224",
"0.72497934",
"0.7239445",
"0.7233422",
"0.7233422",
"0.72159964",
"0.720545",
"0.71886355",
"0.7183978",
"0.7179967",
"0.7175458",
"0.7175458",
"0.7175247",
"0.7169397",
"0.71656126",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7162558",
"0.7161991",
"0.7160065",
"0.7149739",
"0.7146984",
"0.7146597"
]
| 0.0 | -1 |
INPUT_TO_INDEX convert input to index | def input_to_index(user_input)
index = user_input.to_i - 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def input_to_index(input)\n index = input.to_i - 1\n end",
"def input_to_index(input)\n index = input.to_i - 1\n end",
"def input_to_index(input)\n index = input.to_i - 1\n end",
"def input_to_index(input)\n input_int = input.to_i\n index = input_int - 1\nend",
"def input_to_index(input)\n #converts the user's input (a string) into an integer\n #converts the user's input from the user-friendly format (on a 1-9 scale) to the array-friendly format (where the first index starts at 0)\n input.to_i - 1\n end",
"def input_to_index (input)\n index = input.to_i\n index - 1\n end",
"def input_to_index(input)\n self.convert_to_i(input) - 1\n end",
"def input_to_index(input)\n return input.to_i - 1\n #idx = [inpu - 1]\n # return idx\nend",
"def input_to_index(input)\n @input = input.to_i - 1\n end",
"def input_to_index(input)\r\n index = input.to_i - 1\r\nend",
"def input_to_index(user_input)\n user_input = user_input.to_i # converts string into integer\n index = user_input - 1 # Change user input to array index.\nend",
"def input_to_index(input)\n input = input.to_i - 1\n end",
"def input_to_index(input)\n index = input.to_i - 1\nend",
"def input_to_index(input)\n index = input.to_i - 1\nend",
"def input_to_index(user_input)\n index = user_input.to_i - 1\n end",
"def input_to_index(user_input)\n index = user_input.to_i - 1\n end",
"def input_to_index(input)\n index = (input.to_i) - 1\nend",
"def input_to_index(input)\n\t\tinput.to_i - 1\n\tend",
"def input_to_index(user_input) \n #converts the user's input (a string) into an integer / would use .to_i\n #converts the user's input from the user-friendly format (on a 1-9 scale) to the array-friendly format (where the first index starts at 0) \n user_input.to_i - 1\n end",
"def input_to_index(user_input)\n index=(user_input .to_i) -1\nend",
"def input_to_index(input)\n input.to_i - 1\n end",
"def input_to_index(user_input)\n index = (user_input.to_i - 1)\n end",
"def input_to_index(input)\n index = input.to_i-1\nend",
"def to_index(input)\n input.to_i - 1\n end",
"def input_to_index(input)\n index = input.to_i\n index -= 1\nend",
"def input_to_index(input)\n newInput = input.to_i\n return newInput - 1\nend",
"def input_to_index(input)\r\n return input.to_i - 1\r\n end",
"def input_to_index(input)\n input = input.to_i\n input = input - 1\nend",
"def input_to_index(input)\n return input.to_i - 1\n end",
"def input_to_index(input)\n return index = input.to_i - 1\nend",
"def input_to_index(input)\n offset = input.to_i - 1\n return offset\nend",
"def input_to_index(user_input)\n user_input.to_i - 1 # user_input converted to an integer\n end",
"def input_to_index(index)\n return index.to_i - 1\nend",
"def input_to_index(index)\n return index.to_i - 1\nend",
"def input_to_index(input)\n index = input.to_i\n index = index-1\n return index\nend",
"def input_to_index(index)\n index = (index.to_i) - 1\nend",
"def input_to_index(input)\n index = input.to_i - 1\n return index\nend",
"def input_to_index(input)\n index = input.to_i\n index -= 1\n return index\nend",
"def input_to_index(user_input)\n index = user_input.to_i - 1\nend",
"def input_to_index(index)\n index.to_i - 1 \nend",
"def input_to_index(user_input)\nconverted_input = user_input.to_i - 1\nend",
"def input_to_index(input)\r\n input.to_i - 1 \r\nend",
"def input_to_index(user_input) #this method takes one argument (the users input)\n new_user_input = user_input.to_i #this specific .to converts the string into an intergeer\n new_user_input -= 1 #this subtracts it by 1 since arrays start with 0\nend",
"def input_to_index(user_input)\n index = (user_input.to_i - 1)\nend",
"def input_to_index(user_input)\n index = user_input.to_i - 1\n return index\n end",
"def input_to_index(input)\n input.to_i - 1\nend",
"def input_to_index(input)\n input.to_i - 1\nend",
"def input_to_index(input)\n input.to_i - 1\nend",
"def input_to_index(input)\n input.to_i - 1\nend",
"def input_to_index(input)\n input.to_i - 1\nend",
"def input_to_index(input)\n input.to_i - 1\nend",
"def input_to_index(input)\n input.to_i - 1\nend",
"def input_to_index(input)\n input.to_i - 1\nend",
"def input_to_index(input)\n input.to_i - 1\nend",
"def input_to_index(input)\n input.to_i - 1\nend",
"def input_to_index(input)\n input.to_i - 1\nend",
"def input_to_index(input)\n input.to_i - 1\nend",
"def input_to_index(input)\n input.to_i - 1\nend",
"def input_to_index(input)\n input.to_i - 1\nend",
"def input_to_index(input)\n input.to_i - 1\nend",
"def input_to_index(input)\n user_input=input.to_i\n user_input - 1\nend",
"def input_to_index(input)\n (input.to_i) - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1 # user_input converted to an integer\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\n return index\nend",
"def input_to_index(input)\n return input.to_i - 1\nend",
"def input_to_index(input)\n return input.to_i - 1\nend",
"def input_to_index(input)\n return input.to_i - 1\nend",
"def input_to_index(input)\n return input.to_i - 1\nend",
"def input_to_index(input)\n input=(input.to_i) - 1;\nend",
"def input_to_index(input)\n input = input.to_i - 1\nend",
"def input_to_index( user_input )\n user_input.to_i - 1\n end",
"def input_index\n @input_index ||= IndexAndMapping.new(settings[:input])\n end",
"def input_to_index(user_input)\nindex = user_input.to_i - 1 #convert to integer and covert to index\nreturn index #return index for use in other methods\nend",
"def input_to_index( position )\n position = position.to_i\n position = position - 1\nend",
"def input_to_index(user_input)\n user_input.to_i - 1\n end",
"def input_to_index(user_input)\n user_input.to_i - 1\n end",
"def input_to_index(user_input)\n user_input.to_i - 1\n end",
"def input_to_index(user_input)\n user_input.to_i - 1\n end",
"def input_to_index(user_input)\n user_input.to_i - 1\n end",
"def input_to_index(user_input)\n user_input.to_i - 1\n end",
"def input_to_index(user_input)\n user_input.to_i - 1\n end",
"def input_to_index(user_input)\n user_input.to_i - 1\n end",
"def input_to_index(user_input)\n user_input.to_i - 1\n end",
"def input_to_index(user_input)\n user_input.to_i - 1\n end",
"def input_to_index(user_input)\n user_input.to_i - 1\n end",
"def input_to_index(user_input)\n user_input.to_i - 1\n end",
"def input_to_index(input)\n input = (input.to_i - 1)\nend",
"def input_to_index(user_input)\n index = user_input.to_i\n index -= 1\nend",
"def input_to_index(position)\n index = position.to_i - 1\n end",
"def input_to_index(user_input)\n user_input = user_input.to_i\n index = user_input - 1\n return index\nend",
"def input_to_index(user_input = 0)\n index = (user_input.to_i - 1)\nend",
"def input_to_index(user_input)\n user_input = user_input.to_i\n user_input = user_input - 1\nend",
"def input_to_index(position)\n index = position.to_i - 1\nend",
"def input_to_index (input)\n return input.to_i - 1\n\nend",
"def input_to_index(input)\n input_one = input.to_i\n input_two = input_one - 1\n return input_two\n end",
"def input_to_index(user_input)\n arr_index = user_input.to_i - 1\n return arr_index\nend",
"def idx(input)\n @idx = input.to_i - 1\n end"
]
| [
"0.80348045",
"0.80348045",
"0.80348045",
"0.7754606",
"0.77542037",
"0.7719133",
"0.7689075",
"0.76875436",
"0.76393837",
"0.76328695",
"0.75974524",
"0.7592872",
"0.758357",
"0.758357",
"0.7532466",
"0.7532466",
"0.7528449",
"0.752264",
"0.75185645",
"0.7486758",
"0.74825084",
"0.747032",
"0.7456095",
"0.74523944",
"0.74253523",
"0.7423645",
"0.740129",
"0.7391625",
"0.73695666",
"0.7358079",
"0.7254107",
"0.7249514",
"0.7209227",
"0.7209227",
"0.72087985",
"0.72058105",
"0.7205572",
"0.72050405",
"0.7200212",
"0.7188362",
"0.7177617",
"0.71702415",
"0.71608543",
"0.715784",
"0.7155938",
"0.7155149",
"0.7155149",
"0.7155149",
"0.7155149",
"0.7155149",
"0.7155149",
"0.7155149",
"0.7155149",
"0.7155149",
"0.7155149",
"0.7155149",
"0.7155149",
"0.7155149",
"0.7155149",
"0.7155149",
"0.71415085",
"0.71318185",
"0.712907",
"0.71244305",
"0.71172696",
"0.71172696",
"0.71172696",
"0.71172696",
"0.7114336",
"0.71076846",
"0.71074545",
"0.71018565",
"0.70998",
"0.7096041",
"0.708401",
"0.708401",
"0.708401",
"0.708401",
"0.708401",
"0.708401",
"0.708401",
"0.7061469",
"0.7061469",
"0.70534736",
"0.70534736",
"0.70534736",
"0.7042288",
"0.7030992",
"0.70248294",
"0.70238143",
"0.7012641",
"0.69889593",
"0.6988439",
"0.6987641",
"0.6978944",
"0.69743156",
"0.69590014"
]
| 0.7231833 | 34 |
VALID_MOVE? Should accept a board and an index from the user and return true if the index is within the correct range of 08 and is currently unoccupied by an X or O token. Hint: While not explicitly required by this lab, you might want to encapsulate the logic to check if a position is occupied in its own method, perhaps position_taken? | def valid_move?(board, index)
if index.between?(0, 8)
# re-define your #position_taken? method here, so that you can use it in the #valid_move? method above.
def position_taken?(board, index)
if board[index] == " "
!false
elsif board[index] == ""
!false
elsif board[index] == nil
!false
elsif board[index] == "X" || board[index] == "O"
!true
end
end
position_taken?(board, index)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_move?(board, index)\n if position_taken?(board, index)\n false\n elsif index.between?(0, 8)\n true\n end\nend",
"def valid_move?(board, index)\n !position_taken?(board, index) && index.between?(0, 8)\nend",
"def valid_move?(board, index)\n if !position_taken?(board, index) && index.between?(0, 8)\n true #is valid move\n else\n false\n end\nend",
"def valid_move?(board,index)\n if position_taken?(board,index)\n false\n elsif index.between?(0, 8)\n true\n end\nend",
"def valid_move?(board, index)\n if position_taken?(board, index) then return false\n elsif index.between?(0, 8) then return true\n end\nend",
"def valid_move?(board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n !position_taken?(board, index) && index.between?(0, 8)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index) #if the position isn't taken and is on the board, the move must be valid\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n if !position_taken?(board, index) && index.between?(0, 8)\n true\n end\nend",
"def valid_move?(board, index)\n if index.between?(0, 8)\n !position_taken?(board, index)\n else\n false\n end\nend",
"def valid_move?(board, index)\n if index.between?(0,8)\n if !position_taken?(board, index)\n true\n end\n end\nend",
"def valid_move?(board, index)\n if index.between?(0,8)\n !position_taken?(board, index)\n else\n false\n end\nend",
"def valid_move?(board, index)\n return index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n if !(position_taken?(board, index)) && index.between?(0,8)\n true\n else\n false\n end\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board,index)\nend",
"def valid_move?(board, index)\n !(position_taken?(board,index)) && index.between?(0, 8)\nend",
"def valid_move?(board, index)\n if index.between?(0, 8) && !position_taken?(board, index)\n true\n else\n false\n end\nend",
"def valid_move? (board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\n end",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\n end",
"def valid_move?(board,index)\n if index.between?(0,8)\n return !position_taken?(board,index)\n end\n end",
"def valid_move?(board, index)\n if index.between?(0,8) && !position_taken?(board, index)\n true\n end\nend",
"def valid_move?(board,index)\n index.between?(0,8) && !position_taken?(board,index)\nend",
"def valid_move?(board, index)\n if !position_taken?(board, index) && index.between?(0, 8)\n return true\n else\n false\n end\nend",
"def valid_move?(board, index)\r\n index.between?(0,8) && !position_taken?(board, index)\r\nend",
"def valid_move?(board, index)\nif index.between?(0,8) && !position_taken?(board, index)\n true\n else\n false\n end\nend",
"def valid_move?(board,index)\n if !position_taken?(board, index) && index.between?(0,8)\n true\n\n end\n end",
"def valid_move?(board, index)\n if !position_taken?(board, index) && index.between?(0,8)\n return true\n else\n return false\n end\nend",
"def valid_move?(board,index)\n if position_taken?(board,index) == false && index.between?(0,8)\n true\n end \n end",
"def valid_move?(board, index)\n if !position_taken?(board, index) && index.between?(0, 8)\n return true\n else\n return false\n end\nend",
"def valid_move?(board, index)\n if !position_taken?(board, index) && (index).between?(0, 8)\n return true\n end\nend",
"def valid_move?(board,index)\n if index.between?(0,8) && position_taken?(board,index)\n true\n end\nend",
"def valid_move?(board, index)\n if position_taken?(board, index) == false && index.between?(0,8) == true\n true\n else\n false\n end\nend",
"def valid_move?(board, index)\nif index.between?(0,8) && !position_taken?(board, index)\n true\nelse\n false\nend\nend",
"def valid_move?(board, index)\n if !(index.between?(0,8))\n return false\n end\n if (position_taken?(board,index))\n return false\n end\n true\nend",
"def valid_move?(board, index)\n if position_taken?(board, index) == false && index.between?(0, 8) == true\n true\n else\n false\nend\nend",
"def valid_move?(board, index)\n position = index.to_i - 1\n if !position_taken? && position.between?(0-8)\n true\n else\n false\n end\nend",
"def valid_move?(board, index)\n if index.between?(0,8)\n if !position_taken?(board, index)\n return true\n end\n end\nend",
"def valid_move?(board,index)\n if index.between?(0, 8) && !(position_taken?(board, index))\n true\n else \n false\n end\nend",
"def valid_move?(board, index)\n if index.between?(0,8) && !position_taken?(board, index)\n return true\n else\n false\nend\nend",
"def valid_move?(board, index)\n position_taken?(board, index) == false && index.between?(0, 8) ? true : false\nend",
"def valid_move? (board, index)\n if index.between?(0,8) && !position_taken?(board, index)\n true\n end\nend",
"def valid_move?(board, index)\n if index.between?(0, 8) and not position_taken?(board, index)\n return true\n else\n return false\n end\nend",
"def valid_move?(board, index)\n if !index.between?(0,8)\n false\n elsif board[index] == \"X\" || board[index] == \"O\"\n false\n else\n true\n end\nend",
"def valid_move?(board, index)\n if index.between?(0, 8) && position_taken?(board, index) == false\n true\n else\n false\n end\nend",
"def valid_move?(board, index)\nif position_taken?(board, index)\nreturn false\nelsif !index.between?(0, 8)\n return false\n else\n return true\n end\nend",
"def valid_move?(board,index)\n if position_taken?(board,index) == FALSE && index.between?(0, 8) == TRUE\n TRUE\n else\n FALSE\n end\nend",
"def valid_move?(board, index)\n return index.between?(0, 8) && !position_taken?(board, index) ? true : false;\nend",
"def valid_move?(board, index)\r\n if index.between?(0, 8) && ! position_taken?(board, index)\r\n return TRUE\r\n else \r\n return FALSE\r\n end\r\nend",
"def valid_move?(board, index)\r\n if !position_taken?(board, index) && index.between?(0,8)\r\n return true\r\n else\r\n return false\r\n end\r\nend",
"def valid_move?(board, index)\n if index.between?(1,9)\n if !position_taken?(board, index)\n return true\n end\n end\n index.between?(0,8) && !position_taken?(board, index)\n return false\nend",
"def valid_move?(board, index)\n if index.between?(0,8) && board[index] != \"X\" && board[index] != \"O\"\n return TRUE\n end\nend",
"def valid_move?(board, index)\n index.between?(0, 8) && position_taken?(board, index) == false\n\nend",
"def valid_move?(board, index)\n if (index.between?(0, 8) && !position_taken?(board, index))\n return true\n else\n return false\n end\nend",
"def valid_move?(board, index)\n if index.between?(0, 8) && position_taken?(board, index) == false\n return true\n else\n return false\n end\nend",
"def valid_move?(board, index)\n if position_taken?(board, index)\n false\n elsif index > 8 || index < 0\n false\n else\n true\n end\nend",
"def valid_move? (board, index)\n if index.between?(0, 8) && !position_taken?(board, index)\n true \n end \nend",
"def valid_move?(board, index)\n if index.between?(0,8) && !position_taken?(board,index)\n return true\n else\n return false\n end\nend",
"def valid_move?(board,index)\n if index.between?(0,8) && !position_taken?(board,index)\n true\n else\n false\n end\n\nend",
"def valid_move?(board, idx)\n if position_taken?(board, idx) == false && idx.between?(0, 8)\n return true\n else\n return false\n end\nend",
"def valid_move?(board, index)\nif !(index.between?(0,8))\n return false\nelsif position_taken?(board, index)\n return false \nelse \n return true\n end\nend",
"def valid_move? (board, index)\n if position_taken?(board, index) == false && (index).between?(0,8)\n return true\n else\n return false\n end\nend",
"def valid_move?(board, index)\n\n # if (0..8).to_a.include?(!index)\n if !index.between?(0, 8)\n nil\n elsif position_taken?(board, index) == false\n true\n end\n\n # if !board[index]\n # false\n # end\n\nend",
"def valid_move?(board,index)\n if index < 0\n false\n else\n if index > 8\n false\n else\n !position_taken?(board,index)\n end\n end\nend",
"def valid_move?(board, index)\n if position_taken?(board, index) == true; false\n #elsif board[index] == \"X\" || board[index] == \"O\"; true\n elsif index > 9 || index < 0; false\n else; true\n end\n end",
"def valid_move? (board, index)\n if index.between?(0,8) && position_taken?(board, index) == true\n #position is between 0-8 (1-9) AND the position is available (#position_taken)\n true\n else\n false\n end\nend",
"def valid_move?(board, index)\n \nif position_taken?(board, index) === false && index.between?(0, 8)\n return true\nelse \n return false\nend\nend",
"def valid_move?(board, index)\n if index.between?(0, 8) && position_taken?(board, index) == false\n true\n else position_taken?(board, index) == true\n nil\n end\nend",
"def valid_move?(board, index)\n if board[index] == \" \" || board[index] == \"\"\n position_taken = false\n elsif board[index] == nil\n position_taken = false\n elsif board[index] == \"X\" || board[index] == \"O\"\n position_taken = true\n else\n position_taken = false\n end\n return index.between?(0,8) && !position_taken\nend",
"def valid_move?(board, index)\r\n index.between?(0, 8) && !position_taken(board, index) ? true : false \r\nend",
"def valid_move?(board, index)\n if index.between?(0,8) && !position_taken?(board, index)\n puts \"this is a valid move\"\n return true\n else\n return false\n end\nend",
"def valid_move?(board, index)\n if index.between?(1,9)\n if !position_taken?(board, index)\n true\n end\n end\nindex.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board,index = input_to_index(tato))\n if index.between?(0,8) && !position_taken?(board,index)\n true\n else\n false\n end\nend",
"def valid_move? (board, index)\n if index.between?(0, 8) == true && position_taken?(board, index) == false\n return true\n else return false\n end\nend",
"def valid_move?(board, index)\n if position_taken?(board, index) == true\n false\n elsif index > 8 || index < 0\n false\n else\n true\n end\nend",
"def valid_move?(board, index)\n if index.between?(0, 8) && board[index] == \" \"\n true\n else position_taken?(board, index) == nil && board[index] == \"X\"\n false\n end\nend",
"def valid_move?(board, indx)\n if position_taken?(board, indx)\n false \n elsif (indx < 0 || indx > 8)\n false\n else \n true \n end \nend",
"def valid_move? (board, index)\n if (index).between?(0,8) == true && position_taken?(board, index) == false\n return true\n else\n return false\n end\nend",
"def valid_move?(board, position)\n index = position.to_i\n if position_taken?(board, index) == false && index.between?(0, 8)\n return true\n else\n return false\n end\nend",
"def valid_move?(position) ### changed from index to position - ER 2017\n\n if (position > 9) || (position < 0) #if index (position on board entered by user) is greater than 9 or less than 0, return false\n false\n elsif position_taken?(position) ###otherwise, if position on board is taken, return false\n false\n else position.between?(0, 8) ###finally, if the position isn't taken, and the index (position on board entered by user) is between 0 and 8, return true\n true\n end # end if...elsif statements\n end",
"def valid_move?(board, index)\n if !position_taken?(board, index) && index.between?(0, 8)\n return true\n else\n return false\n end\n end",
"def valid_move?(board, index)\n if index.between?(0, 8) && (position_taken?(board, index) == false)\n true\n elsif (index.between?(0,8) == false) || (position_taken?(board, index) == true)\n false\n end\nend",
"def valid_move?(board,index)\n \n if position_taken?(board, index) == false && \n index.between?(0, 8) == true \n return true\n else \n false\n end\n \n \n\nend",
"def valid_move?(board, position)\n indexed_position = position.to_i - 1\n indexed_position.between?(0,8) && !position_taken?(board, indexed_position)\nend",
"def valid_move?( board, index )\n\n if (index.between?(0,8) ) && ( position_taken?(board, index) == false )\n return true\n else\n return false\n end\n\nend",
"def valid_move?(board, index)\n if (index.between?(0,8) == true) && (position_taken?(board, index) == false)\n return true \n else\n return false\n end\nend"
]
| [
"0.8777406",
"0.8740289",
"0.873629",
"0.87340057",
"0.873219",
"0.87258273",
"0.87258273",
"0.87258273",
"0.87243336",
"0.8723622",
"0.87199694",
"0.87199694",
"0.87199694",
"0.87199694",
"0.87199694",
"0.87199694",
"0.87199694",
"0.87199694",
"0.87199694",
"0.87199694",
"0.87199694",
"0.87199694",
"0.87199694",
"0.871672",
"0.8712512",
"0.87122273",
"0.87106",
"0.87079",
"0.87062967",
"0.86980337",
"0.8696539",
"0.8684068",
"0.86836326",
"0.86825895",
"0.86825895",
"0.8680139",
"0.86788243",
"0.86759293",
"0.86679626",
"0.8666875",
"0.8666543",
"0.86588186",
"0.86581933",
"0.8658006",
"0.8657537",
"0.8654716",
"0.86515343",
"0.8647678",
"0.8646235",
"0.8646135",
"0.86448413",
"0.86394376",
"0.86364156",
"0.86348534",
"0.8633813",
"0.863292",
"0.862827",
"0.86281705",
"0.8624372",
"0.86218715",
"0.8615978",
"0.86146843",
"0.8613516",
"0.86111796",
"0.8606488",
"0.8603051",
"0.860031",
"0.8600193",
"0.85990894",
"0.859726",
"0.85901797",
"0.8583832",
"0.8582525",
"0.8579806",
"0.85788286",
"0.8576468",
"0.85746217",
"0.8574256",
"0.8563621",
"0.8563098",
"0.8557332",
"0.85536534",
"0.855299",
"0.8537687",
"0.8534788",
"0.8531301",
"0.85280704",
"0.85264385",
"0.85245806",
"0.8520926",
"0.8515384",
"0.8512945",
"0.8506588",
"0.8504358",
"0.8494925",
"0.84892875",
"0.8487729",
"0.8478848",
"0.8476293",
"0.8470987",
"0.84703517"
]
| 0.0 | -1 |
Common intersected stop for all the three lines | def getCommonStation
@common_station
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_line(stop1, stop2)\n if @purple_line.include?(stop1) && @purple_line.include?(stop2)\n \"either\"\n elsif @purple_line.include?(stop1) && @blue_line_west.include?(stop2)\n \"blue\"\n elsif @purple_line.include?(stop1) && @red_line_only.include?(stop2)\n \"red\"\n elsif @red_line_only.include?(stop1)\n \"red\"\n elsif @blue_line_west.include?(stop1)\n \"blue\"\n end\n end",
"def intersect( v1, v2 )\n b1, b2 = bound( v1 ), bound( v2 )\n cr = []\n if b1 && b2 then\n\tres = 0\n elsif b1 then\n\tcr = cross( v1, v2 )\n\tres =1\n elsif b2 then \n\tcr = cross( v1, v2 )\n\tres =2\n else\n\tcr = cross( v1, v2 )\n\tif cr.size == 2 then\n\t res = 3\n\telse\n\t res = 4\n\tend\n end\n return res, cr\n end",
"def cross(v1, v2)\n dx, dy = v2[0] - v1[0], v2[1] - v1[1]\n cr = [] # array containing intersections\n\n if dx == 0 and dy ==0 then\n\tnc = 0\n elsif dx == 0 then\n\tt = ( 0.0 - v1[1] ) / dy # y = 0\n\tx , y = v1[0] + t * dx, v1[1] + t * dy\n cr.push( [x, y] ) if x >= 0 && x <= 1 && t >= 0 && t <= 1\n\tt = ( 1.0 - v1[1] ) / dy # y = 1\n\tx, y = v1[0] + t * dx, v1[1] + t * dy\n\tcr.push( [x, y] ) if x >= 0 && x <= 1 && t >= 0 && t <= 1\n elsif dy == 0 then\n\tt = ( 0.0 - v1[0] ) / dx # x = 0\n\tx, y = v1[0] + t * dx, v1[1] + t * dy\n\tcr.push( [x, y] ) if y >= 0 && y <= 1 && t >= 0 && t <= 1\n\tt = ( 1.0 - v1[0] ) / dx # x = 1\n\tx, y = v1[0] + t * dx, v1[1] + t * dy\n cr.push( [x, y] ) if y >= 0 && y <= 1 && t >= 0 && t <= 1\n else\n\tt = ( 0.0 - v1[1] ) / dy # y = 0\n\tx , y = v1[0] + t * dx, v1[1] + t * dy\n cr.push( [x, y] ) if x >= 0 && x <= 1 && t >= 0 && t <= 1\n\tt = ( 1.0 - v1[1] ) / dy # y = 1\n\tx, y = v1[0] + t * dx, v1[1] + t * dy\n\tcr.push( [x, y] ) if x >= 0 && x <= 1 && t >= 0 && t <= 1\n\tt = ( 0.0 - v1[0] ) / dx # x = 0\n\tx, y = v1[0] + t * dx, v1[1] + t * dy\n\tcr.push( [x, y] ) if y >= 0 && y <= 1 && t >= 0 && t <= 1\n\tt = ( 1.0 - v1[0] ) / dx # x = 1\n\tx, y = v1[0] + t * dx, v1[1] + t * dy \n cr.push( [x, y] ) if y >= 0 && y <= 1 && t >= 0 && t <= 1\n end\n return cr\n end",
"def line_line_intersection(l1s, l1e, l2s, l2e)\n seg1 = l1e - l1s\n seg2 = l2e - l2s\n\n d = (-seg2.x * seg1.y + seg1.x * seg2.y)\n\n s = (-seg1.y * (l1s.x - l2s.x) + seg1.x * (l1s.y - l2s.y)) / d;\n t = ( seg2.x * (l1s.y - l2s.y) - seg2.y * (l1s.x - l2s.x)) / d;\n\n if s > 0 && s < 1 && t > 0 && t < 1\n x = l1s.x + (t * seg1.x)\n y = l1s.y + (t * seg1.y)\n\n V.new(x, y)\n end\n end",
"def cull_overlap_for_list(list)\n offset = list.length/10\n i = offset\n while i < list.length-offset-1\n line1 = Curves::LineSegment.new(list[i], list[i+1])\n\n j = i+1\n while j < list.length-offset\n line2 = Curves::LineSegment.new(list[j], list[j+1])\n\n if (intersection = line1.intersection(line2))\n while i < j\n i += 1\n list[i] = intersection\n end\n return\n end\n\n j += 1\n end\n\n i += 1\n end\n end",
"def segments_intersect?(line_one, line_two)\n x1 = line_one[:x]\n y1 = line_one[:y]\n x2 = line_one[:x2]\n y2 = line_one[:y2]\n\n x3 = line_two[:x]\n y3 = line_two[:y]\n x4 = line_two[:x2]\n y4 = line_two[:y2]\n\n uA = ((x4-x3)*(y1-y3) - (y4-y3)*(x1-x3)) / ((y4-y3)*(x2-x1) - (x4-x3)*(y2-y1))\n uB = ((x2-x1)*(y1-y3) - (y2-y1)*(x1-x3)) / ((y4-y3)*(x2-x1) - (x4-x3)*(y2-y1))\n\n uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1\n end",
"def bisectors\n s = self.sides.map { |side| Line.new(side.p1, side.p2) }\n c = self.incenter\n\n inter1 = Line.new(self.vertices[0], c).intersection(s[1]).first\n inter2 = Line.new(self.vertices[1], c).intersection(s[2]).first\n inter3 = Line.new(self.vertices[2], c).intersection(s[0]).first\n\n {\n self.vertices[0] => Segment.new(self.vertices[0], inter1), \n self.vertices[1] => Segment.new(self.vertices[1], inter2),\n self.vertices[2] => Segment.new(self.vertices[2], inter3),\n }\n end",
"def lineIntersects _args\n \"lineIntersects _args;\" \n end",
"def line_intersect_line?(line_one, line_two)\n x1 = line_one[:x]\n y1 = line_one[:y]\n x2 = line_one[:x2]\n y2 = line_one[:y2]\n\n x3 = line_two[:x]\n y3 = line_two[:y]\n x4 = line_two[:x2]\n y4 = line_two[:y2]\n\n uA = ((x4-x3)*(y1-y3) - (y4-y3)*(x1-x3)) / ((y4-y3)*(x2-x1) - (x4-x3)*(y2-y1))\n uB = ((x2-x1)*(y1-y3) - (y2-y1)*(x1-x3)) / ((y4-y3)*(x2-x1) - (x4-x3)*(y2-y1))\n\n uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1\n end",
"def find_lines mta, start_station, end_station\n lines = [[],[]]\n mta.each do |line, stations|\n lines[0].push line if stations.include?(start_station)\n lines[1].push line if stations.include?(end_station)\n end\n\n if lines[0] & lines[1] != []\n common_line = lines[0] & lines[1]\n return [ common_line[0], common_line[0] ] # The 1st line both stations are on\n else\n return [ lines[0][0], lines[1][0] ] # The 1st line the staions are found on\n end\nend",
"def intersection(other)\n other = Point.new(other[0], other[1]) if other.is_a?(Array)\n\n # Other is a Point.\n if other.is_a?(Point)\n return [other] if self.contains?(other)\n return []\n end\n\n # Other is a LinearEntity\n if other.is_a?(LinearEntity)\n # break into cases based on whether\n # the lines are parallel, non-parallel intersecting, or skew\n rank = Point.affine_rank(self.p1, self.p2, other.p1, other.p2)\n if rank == 1\n # we're collinear\n return [other] if self.is_a?(Line)\n return [self] if other.is_a?(Line) \n \n if self.is_a?(Ray) && other.is_a?(Ray)\n return intersect_parallel_rays(self, other)\n end\n\n if self.is_a?(Ray) && other.is_a?(Segment)\n return intersect_parallel_ray_and_segment(self, other)\n end\n\n if self.is_a?(Segment) && other.is_a?(Ray)\n return intersect_parallel_ray_and_segment(other, self)\n end\n\n if self.is_a?(Segment) && other.is_a?(Segment)\n return intersect_parallel_segments(self, other)\n end\n\n elsif rank == 2\n # we're in the same plane\n l1 = Line.new(self.p1, self.p2)\n l2 = Line.new(other.p1, other.p2)\n\n # check to see if we're parallel. If we are, we can't\n # be intersecting, since the collinear case was already\n # handled\n return [] if l1.parallel_to?(l2)\n \n # Use Cramers rule:\n # https://en.wikipedia.org/wiki/Cramer%27s_rule\n det = l1.a * l2.b - l2.a * l1.b\n det = det\n x = (l1.b * l2.c - l1.c * l2.b) / det\n y = (l2.a * l1.c - l2.c * l1.a ) / det\n\n intersection_point = Point.new(x, y)\n\n # if we're both lines, we can skip a containment check\n return [intersection_point] if self.is_a?(Line) && other.is_a?(Line)\n \n if self.contains?(intersection_point) && other.contains?(intersection_point)\n return [intersection_point] \n end\n \n return []\n else\n # we're skew\n return []\n end\n end\n\n if other.respond_to?(:intersection)\n return other.intersection(self)\n end\n\n raise TypeError, \"Intersection between LinearEntity and #{ other.class } is not defined\"\n end",
"def line_line_intersect(pt_intersect, new_list, seg, new_seg)\n\n new_list << LineSeg.new(seg.pt1, pt_intersect)\n new_list << LineSeg.new(pt_intersect, seg.pt2)\n\n return [LineSeg.new(new_seg.pt1, pt_intersect), LineSeg.new(pt_intersect, new_seg.pt2)]\n\n end",
"def intersectLineSegment seg\n line_result = intersect(two_points_to_line(seg.x1,seg.y1,seg.x2,seg.y2))\n line_result.intersectWithSegmentAsLineResult seg\n end",
"def intersectLineSegment seg\n line_result = intersect(two_points_to_line(seg.x1,seg.y1,seg.x2,seg.y2))\n line_result.intersectWithSegmentAsLineResult seg\n end",
"def intersectLineSegment seg\n line_result = intersect(two_points_to_line(seg.x1,seg.y1,seg.x2,seg.y2))\n line_result.intersectWithSegmentAsLineResult seg\n end",
"def intersectWithSegmentAsLineResult seg\n # self is the intersection \n self\n end",
"def getting_stops on_line, on_stop, off_line, off_stop\n\tstops = []\n\n\tif is_same_line(on_line, off_line)\n\t\texit if on_line.index(on_stop) == on_line.index(off_stop) \n\t\t\t\n\t\tstops << (on_line[ on_line.index(on_stop)..on_line.index(off_stop) ]) \n\t\t\"you have to travel through: #{ stops.join(\" -> \") }\"\n\n\telse\n\t\tif is_left_to_union(on_line, on_stop, \"Union Square\")\n\t\t\tstops << on_line[on_line.index(on_stop)..on_line.index(\"Union Square\")]\n\n\t\telse\n\t\t\tstops << on_line[on_line.index(\"Union Square\")..on_line.index(on_stop)].reverse\n\t\tend\n\n\t\tif is_left_to_union(off_line, off_stop, \"Union Square\")\n\t\t\tstops << off_line[off_line.index(off_stop)..off_line.index(\"Union Square\")].reverse\n\n\t\telse\n\t\t\tstops << off_line[off_line.index(\"Union Square\")..off_line.index(off_stop)]\n\t\tend\n\n\t\t# delete \"Union Square\" from stops[1] as it is duplicate with stops[0]\n\t\tstops[1].shift\n\n\t\t\"You have to travel through: #{ stops[0].join(\" -> \") }\\n Change at: Union Square\\n Your travel continues through: #{ stops[1].join(\" -> \") }\\n The total number of stops you have to travel is: #{ stops.flatten.length }\"\n\tend\nend",
"def line_intersection(l1, l2)\n x1 = l1[0][0]; x2 = l1[1][0]; x3 = l2[0][0]; x4 = l2[1][0]\n y1 = l1[0][1]; y2 = l1[1][1]; y3 = l2[0][1]; y4 = l2[1][1]\n\n denominator = (x1-x2)*(y3-y4) - (y1-y2)*(x3-x4)\n return false if denominator == 0\n dxy12 = (x1*y2 - y1*x2)\n dxy34 = (x3*y4 - y3*x4)\n x = (dxy12*(x3-x4) - (x1-x2)*dxy34) / denominator\n y = (dxy12*(y3-y4) - (y1-y2)*dxy34) / denominator\n WorldGen::Vector[x.round, y.round]\n end",
"def lineIntersectsWith _args\n \"lineIntersectsWith _args;\" \n end",
"def terminus_line_intersect(pt_intersect, new_list, seg, new_seg)\n\n # Is the intersect at one of +new_seg+ terminii?\n # If so, split +seg+ into two segs at pt_intersect.\n if pt_intersect == new_seg.pt1 || pt_intersect == new_seg.pt2\n new_list << LineSeg.new(seg.pt1, pt_intersect)\n new_list << LineSeg.new(pt_intersect, seg.pt2)\n return []\n end\n\n # Does a +seg+ terminus lie along *new_seg+?\n #\n # If so, add +seg+ to the +new_list+ and return the two part of the slit +new_seg+\n if pt_intersect == seg.pt1 || pt_intersect == seg.pt2\n new_list << seg\n return [LineSeg.new(new_seg.pt1, pt_intersect), LineSeg.new(pt_intersect, new_seg.pt2)]\n end\n\n return nil\n end",
"def intersectWithSegmentAsLineResult seg\n self\n end",
"def intersectWithSegmentAsLineResult seg\n self\n end",
"def intersectWithSegmentAsLineResult seg\n self\n end",
"def intersection\n self.reduce(&:intersection)\n end",
"def iscrossing(pt1,pt2, theface)\r\n line = [pt1, pt2]\r\n theface.loops.each { |loop|\r\n edges = loop.edges\r\n edges.each { |e| #check each edge to see if it intersects line inside the edge\r\n l2 = [e.vertices[0].position, e.vertices[1].position] # make a line\r\n point = Geom.intersect_line_line(line, e.vertices) # find intersection\r\n if (point != nil)\r\n online1 = isonline(point, line[0], line[1]) # is the point on the line\r\n online2 = isonline(point, e.vertices[0].position, e.vertices[1].position) # is the point on the edge\r\n #ent.add_cpoint(point) if (online1 and online2)\r\n #puts \"online1 #{online1} #{online2}\"\r\n return true if (online1 and online2)\r\n # if (online1 and online2) then we can return true here, no need to process more\r\n end\r\n } # edges.each\r\n } # loops.each\r\n return false\r\n end",
"def line_intersection(x1, y1, x2, y2, x3, y3, x4, y4)\n # calculate vector products\n d1 = (x3 - x1) * (y4 - y1) - (x4 - x1) * (y3 - y1)\n d2 = (x3 - x2) * (y4 - y2) - (x4 - x2) * (y3 - y2)\n d3 = (x1 - x3) * (y2 - y3) - (x2 - x3) * (y1 - y3)\n d4 = (x1 - x4) * (y2 - y4) - (x2 - x4) * (y1 - y4)\n # check vector product results\n if (d1 > 0 && d2 < 0 || d1 < 0 && d2 > 0) &&\n (d3 > 0 && d4 < 0 || d3 < 0 && d4 > 0)\n # intersection exists\n return true\n end\n # if at least one point of one line lies on the other line\n if d1 == 0 && (x3 < x4 ? x3 : x4) <= x1 && x1 <= (x3 > x4 ? x3 : x4) &&\n (y3 < y4 ? y3 : y4) <= y1 && y1 <= (y3 > y4 ? y3 : y4) ||\n d2 == 0 && (x3 < x4 ? x3 : x4) <= x2 && x2 <= (x3 > x4 ? x3 : x4) &&\n (y3 < y4 ? y3 : y4) <= y2 && y2 <= (y3 > y4 ? y3 : y4) ||\n d3 == 0 && (x1 < x2 ? x1 : x2) <= x3 && x3 <= (x1 > x2 ? x1 : x2) &&\n (y1 < y2 ? y1 : y2) <= y3 && y3 <= (y1 > y2 ? y1 : y2) ||\n d4 == 0 && (x1 < x2 ? x1 : x2) <= x4 && x4 <= (x1 > x2 ? x1 : x2) &&\n (y1 < y2 ? y1 : y2) <= y4 && y4 <= (y1 > y2 ? y1 : y2)\n # intersection exists\n return true\n end\n # intersection does not exist\n return false\n end",
"def line x0, y0, x1, y1, c\n dx = (x1 - x0).abs\n sx = x0 < x1 ? 1 : -1\n dy = (y1 - y0).abs\n sy = y0 < y1 ? 1 : -1\n err = (dx > dy ? dx : -dy) / 2\n \n loop do\n set x0, y0, c\n break if x0 === x1 && y0 === y1\n e2 = err\n if e2 > -dx\n err -= dy\n x0 += sx\n end \n if e2 < dy\n err += dx\n y0 += sy \n end\n end \n end",
"def get_intersection\n end",
"def two_empty_in_line(marker)\n initial = Square::INITIAL_MARKER\n check_lines_for_constellation(marker, initial, initial)\n end",
"def intersectLineSegment seg\n line_result = intersect(two_points_to_line(seg.x1,seg.y1,seg.x2,seg.y2))\n line_result.intersectWithSegmentAsLineResult seg\n end",
"def intersectWithSegmentAsLineResult seg\n self\n end",
"def stops_between_stations (start_line,start_staion ,end_line, end_station )\n \n lines{\n red =[ 'South Station','Park Street', 'Kendall','Central','Harvard', 'Porter', 'Davis', 'Alewife']\ngreen = ['Government Center','Park Street','Boylston','Arlington','Copley','Hynes','Kenmore']\norange =['North Station','Haymarket','Park Street','State','Downtown Crossing','Chinatown','Back Bay','Forest Hills']\n }\n \n\n # return \"You have #{start_station - red_line.index(\"South Station\")} to go \" \n if start_line == end_line # Both dests are in in same line \n return start_line.index(start_staion) - end_line.index(stop_station) # i'd use abs = absloute here to avoid negative values \n\n else puts 'I have no clue what to do here -.-'\n \n end \n \n end",
"def intersection(a, b)\n negate(union(negate(a), negate(b)))\n end",
"def intersectLineSegment seg\n # this is the intersect defined in method calling on \n # intersectlinesegment\n line_result = intersect(two_points_to_line(seg.x1,seg.y1,seg.x2,seg.y2))\n line_result.intersectWithSegmentAsLineResult seg\n end",
"def intersection( to )\n cp = self.pos.to_gpos\n\n line = cp.to_vec( to )\n uline = line.unit\n radius = uline * size.x\n\n ( cp.to_vec + radius ).to_gpos\n end",
"def intersect(ray)\n return nil # FIX ME !!\n end",
"def wherecrossing(pt1,pt2, theface)\r\n line = [pt1, pt2]\r\n theface.loops.each { |loop|\r\n edges = loop.edges\r\n edges.each { |e| #check each edge to see if it intersects line inside the edge\r\n l2 = [e.vertices[0].position, e.vertices[1].position] # make a line\r\n point = Geom.intersect_line_line(line, e.vertices) # find intersection\r\n if (point != nil)\r\n online1 = isonline(point, line[0], line[1]) # is the point on the line\r\n online2 = isonline(point, e.vertices[0].position, e.vertices[1].position) # is the point on the edge\r\n #ent.add_cpoint(point) if (online1 and online2)\r\n #puts \"online1 #{online1} #{online2}\"\r\n return point if (online1 and online2)\r\n # if (online1 and online2) then we can return true here, no need to process more\r\n end\r\n } # edges.each\r\n } # loops.each\r\n return nil\r\n end",
"def lineIntersectsObjs _args\n \"lineIntersectsObjs _args;\" \n end",
"def win_line_with_uniform_markers\n populated_win_lines.select do |line|\n pos1 = squares[line[0]]\n pos2 = squares[line[1]]\n pos3 = squares[line[2]]\n [pos1.marker, pos2.marker, pos3.marker].uniq.length == 1\n end\n end",
"def stops_to(lines, start_stop, end_stop)\n\tstart_line = find_line(lines, start_stop)\n\tend_line = find_line(lines, end_stop)\n\n\tif start_line == end_line # Just calculate the one distance \n\t\treturn line_distance(lines, start_line, start_stop, end_stop)\n\t\n\telse # Calculate distance for each line and direction from US seperately then add\n\t\tfirst_distance = line_distance(lines, start_line, start_stop, \"Union Square\")\n\t\tsecond_distance = line_distance(lines, end_line, \"Union Square\", end_stop)\n\t\treturn first_distance[0] + second_distance[0], first_distance[1] + second_distance[1]\n\tend\nend",
"def stops_to(lines, start_stop, end_stop)\n\tstart_line = find_line(lines, start_stop)\n\tend_line = find_line(lines, end_stop)\n\n\tif start_line == end_line # Just calculate the one distance \n\t\treturn line_distance(lines, start_line, start_stop, end_stop)\n\t\n\telse # Calculate distance for each line and direction from US seperately then add\n\t\tfirst_distance = line_distance(lines, start_line, start_stop, \"Union Square\")\n\t\tsecond_distance = line_distance(lines, end_line, \"Union Square\", end_stop)\n\t\treturn first_distance[0] + second_distance[0], first_distance[1] + second_distance[1]\n\tend\nend",
"def intersection(another_transmembrane_domain_defintion)\n res = (@start..@stop).to_a & (another_transmembrane_domain_defintion.start..another_transmembrane_domain_defintion.stop).to_a\n res.empty? ? nil : (res.first..res.last)\n end",
"def intersection( to )\n cp = self.pos.to_gpos\n sp = self.size.to_gpos\n line = cp.to_vec( to )\n\n n = line.rad\n a = sp.x\n b = sp.y\n\n div = Math.sqrt( ( b*Math.cos(n) ) ** 2 + ( a*Math.sin(n) ) ** 2 )\n px = ( a * b * Math.cos(n) ) / div\n py = ( a * b * Math.sin(n) ) / div\n\n cp.to_vec + Gvec[ px, py ]\n end",
"def get_startstop_orfs \n get_codon_orfs2(\n Proc.new { | codon | STOP_CODONS.include?(codon) },\n Proc.new { | codon | START_CODONS.include?(codon) })\n end",
"def intersection_segment(pt1, pt2, pt3, pt4)\n pt = intersection(pt1, pt2, pt3, pt4)\n \n segment_length = pt3.dist_to(pt4)\n \n dist3 = pt.dist_to(pt3)\n dist4 = pt.dist_to(pt4)\n \n if dist3 + dist4 == segment_length\n pt\n else\n nil\n end\n \n # slope = pt4.slope_to(pt3)\n # \n # y1 = pt.x * slope + pt3.y\n # y2 = pt.x * slope + pt4.y\n # \n # y1 == pt.y or y2 == pt.y\n end",
"def terminus_terminus_intersect(pt_intersect, new_list, seg, new_seg)\n if (new_seg.pt1 == pt_intersect || new_seg.pt2 == pt_intersect) && \n (seg.pt1 == pt_intersect || seg.pt2 == pt_intersect)\n new_list << seg\n return true\n end\n return false\n end",
"def intersectNoPoints np\n np # could also have NoPoints.new here instead\n end",
"def intersectNoPoints np\n np # could also have NoPoints.new here instead\n end",
"def intersectNoPoints np\n np # could also have NoPoints.new here instead\n end",
"def common(x, y); end",
"def rec_intersection(r1, r2)\n p1 = [[r1[0][0],r2[0][0]].max , [r1[0][1],r2[0][1]].max]\n p2 = [[r1[1][0],r2[1][0]].min , [r1[1][1],r2[1][1]].min]\n if p1[0] < p2[0] && p1[1] < p2[1]\n return [p1,p2]\n else\n return nil\n end\nend",
"def segments_intersection(a, b, c, d)\n denominator = (b.y - a.y)*(d.x - c.x) - (a.x - b.x)*(c.y - d.y) \n return false if denominator == 0\n x = ( (b.x - a.x) * (d.x - c.x) * (c.y - a.y) + (b.y - a.y) * (d.x - c.x) * a.x - (d.y - c.y) * (b.x - a.x) * c.x ) / denominator\n y = -( (b.y - a.y) * (d.y - c.y) * (c.x - a.x) + (b.x - a.x) * (d.y - c.y) * a.y - (d.x - c.x) * (b.y - a.y) * c.y ) / denominator\n if (x - a.x) * (x - b.x) <= 0 && (y - a.y) * (y - b.y) <= 0 && (x - c.x) * (x - d.x) <= 0 && (y - c.y) * (y - d.y) <= 0 \n return true\n else\n return false\n end\n end",
"def intersection\n @grpc.intersection\n end",
"def get_stopstop_orfs \n get_codon_orfs1(Proc.new { | codon | STOP_CODONS.include?(codon) },false,true)\n end",
"def intersect(ray)\n # Must be overriden be subclasses\n end",
"def rec_intersection(rect1, rect2)\n x1 = [rect1[0][0],rect2[0][0]].max\n y1 = [rect1[0][1],rect2[0][1]].max\n y2 = [rect2[1][1],rect1[1][1]].min\n x2 = [rect2[1][0],rect1[1][0]].min\n if rect2[0][0] > rect1[1][0] || rect2[0][1] > rect1[1][1]\n return nil\n else\n return [[x1,y1],[x2,y2]]\n end\nend",
"def bbpLineIntersect(point_a, point_b, point_c, point_d, hit_point, second_hit_point)\n\n rise 'Method not implemented'\n end",
"def getStops(stopA, stopB, cL)\n $count += (stopA - stopB).abs;\n stopA < stopB ? cL[stopA..stopB][1..-1].join(\", \") : cL[stopB..stopA].reverse[1..-1].join(\", \") end",
"def checkSrepIntersection\n (0..$sreps.length-1).each do |j|\n (0..$sreps.length-1).each do |i|\n if i != j\n $sreps[j].checkIntersection($sreps[i])\n end\n end\n end\n end",
"def check_intersection(line1, line2)\n # Lines that share an endpoint cannot intersect; due to precision\n # issues, we need to make an explicit check for this, and stick\n # a delta on it besides\n if (check_endpoints(line1, line2, POINT_DELTA))\n return false\n end\n x1 = line1.start_point.x\n x2 = line1.end_point.x\n x3 = line2.start_point.x\n x4 = line2.end_point.x\n y1 = line1.start_point.y\n y2 = line1.end_point.y\n y3 = line2.start_point.y\n y4 = line2.end_point.y\n den = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4)\n point_x = (x1 * y2 - y1 * x2) * (x3 - x4) - (x1 - x2) * (x3 * y4 - x4 * y3)\n if (den == 0)\n return false\n end\n point_x = point_x / den\n if ((x1 > x2 && point_x >= x1) || (x1 < x2 && point_x <= x1) ||\n (x3 > x4 && point_x >= x3) || (x3 < x4 && point_x <= x3) ||\n (x1 > x2 && point_x <= x2) || (x1 < x2 && point_x >= x2) ||\n (x3 > x4 && point_x <= x4) || (x3 < x4 && point_x >= x4))\n return false\n end\n # The above fails for any perfectly (or, due to precision issues,\n # sufficiently) vertical lines that would intersect (if extended to)\n # the other line; check y instead in that case:\n if ((x1 + POINT_DELTA > x2 && x1 - POINT_DELTA < x2) ||\n (x3 + POINT_DELTA > x4 && x3 - POINT_DELTA < x4))\n point_y = (x1 * y2 - y1 * x2) * (y3 - y4) - (y1 - y2) * (x3 * y4 - x4 * y3)\n point_y = point_y / den\n if ((y1 > y2 && point_y >= y1) || (y1 < y2 && point_y <= y1) ||\n (y3 > y4 && point_y >= y3) || (y3 < y4 && point_y <= y3) ||\n (y1 > y2 && point_y <= y2) || (y1 < y2 && point_y >= y2) ||\n (y3 > y4 && point_y <= y4) || (y3 < y4 && point_y >= y4))\n return false\n end\n end\n return true\nend",
"def test_add_intersection\n # Intersection at (1,1)\n canon = CanonicalLineSegList.new\n canon.add(LineSeg.new(p(0,0), p(2,2)))\n canon.add(LineSeg.new(p(0,2), p(2,0)))\n assert_equal(4, canon.line_segs.size)\n expect(canon, \n [\n LineSeg.new(p(0,0), p(1,1)), LineSeg.new(p(1,1), p(2,2)),\n LineSeg.new(p(0,2), p(1,1)), LineSeg.new(p(1,1), p(2,0))\n ]\n )\n \n end",
"def supports_intersect_except?\n false\n end",
"def supports_intersect_except?\n false\n end",
"def intersection(other)\n # If rects don't overlap, then the line segments can't intersect.\n # Note that this handles the paralle case, as well as the case\n # where the intersection is outside the line segments.\n return nil unless rect_overlaps?(other)\n det = @a * other.b - other.a * @b\n # Shouldn't happen, but just in case.\n # Note: Everyting's an integer so far.\n return nil if det == 0\n\n x_float = (other.b * @c - @b * other.c).to_f / det.to_f\n y_float = (@a * other.c - other.a * @c).to_f / det.to_f\n \n intersect = Point.new(x_float.round, y_float.round)\n if rect.contains(intersect) && other.rect.contains(intersect)\n return intersect\n else\n return nil\n end\n end",
"def clip_intersection n\n # Sort the neighbors counter-clockwise\n ms = n.neighbors.sort_by{|m| (m.pos-n.pos).dir}\n\n ms.each_index do |i|\n m0 = ms[i]\n m1 = i+1 == ms.length ? ms[0] : ms[i+1]\n r0 = get_road(n.pos, m0.pos)\n r1 = get_road(n.pos, m1.pos)\n ang_delta = ((m1.pos-n.pos).dir - (m0.pos-n.pos).dir) % (2*Math::PI)\n bisect_ang = (m0.pos-n.pos).dir + ang_delta/2.0\n (r0.walls + r1.walls).each do |w|\n bisect_line = LineSegment.ray n.pos, Vector.unit(bisect_ang)\n pt = bisect_line.intersection LineSegment.line(w)\n n.pos.dist(w.p0) < n.pos.dist(w.p1) ? w.p0 = pt : w.p1 = pt unless pt.nil?\n end\n end\n end",
"def rec_intersection(rect1, rect2)\n\tx_min = [rect1[0][0],rect2[0][0]].max \n\tx_max = [rect1[1][0],rect2[1][0]].min \n\ty_min = [rect1[0][1],rect2[0][1]].max \n\ty_max = [rect1[1][1],rect2[1][1]].min \n\n\t(x_max < x_min) || (y_max < y_min) ? nil : [[x_min, y_min], [x_max, y_max]]\nend",
"def lct(hull1,hull2)\n hull = hull1 + hull2\n edge = [right_most(hull_points(hull1)),left_most(hull_points(hull2))]\n list = []\n list.push(edge)\n visited = [edge.first,edge.last]\n while lower_tangent(hull,edge) == false do\n while lower_tangent(hull1,edge) == false do\n edge = [next_clock_point(hull1, edge[0],visited),edge[1]]\n visited.push(edge.first)\n list.push(edge)\n end\n while lower_tangent(hull2,edge) == false do\n edge = [edge[0],next_anti_point(hull2, edge[1],visited)]\n visited.push(edge.last)\n list.push(edge)\n end\n end\n list.map {|x| visited.push(x[0],x[1])}\n visited.uniq #deletion canditatates\n return edge, visited\nend",
"def supports_intersect_except_all?\n false\n end",
"def offLine(c1,c2,c3)\n\n if equalCoordinates?(c1, c2)\n return equalCoordinates?(c1, c3) ? 0 : getGeoDistance(c1, c3)\n end\n\n if equalCoordinates?(c1, c3)\n return 0\n end\n # we get the difference Geodesic angles\n theta1 = getGeoAngle(c1, c2)\n theta2 = getGeoAngle(c1, c3)\n theta3 = theta2-theta1\n\n # buf buf\n # (--- c1 ----------------- c2 ---)\n # * |\n # H(c1-c3) * | H*Sin(theta3)\n # * |\n # c3\n hc1c3 = getGeoDistance(c1, c3)\n hc1c2 = getGeoDistance(c1, c2)\n #\n # if the point is with in a buffer's radius of C1 then it is on the line,\n # Otherwise, its distance from C1 must be less than the distance to C2\n # plus the buffer, and its distance to the C1-C2 line must be less than the buffer.\n # Furthermore this calculation only works if difference in angles is less than PI/2.\n # If the difference in angles is greater than that, then the point is not near\n # the line, unless it was within the buffer radius of C1.\n #\n result = abs(Math.sin(theta3) * hc1c3)\n\n return result\n end",
"def intersection(note_a, note_b)\n\n return (note_a[0] <= note_b[1] and note_a[1] >= note_b[0])\n\n end",
"def rule2\n c = V::ZERO\n\n hits = 0\n\n nearby.each do |b|\n next if self == b\n diff = b.position - self.position\n next unless diff.magnitude.abs < TOO_CLOSE\n hits += 1\n c -= diff if diff.magnitude.abs < TOO_CLOSE\n end\n\n c /= hits unless hits == 0 # average it out so they don't overdo it\n\n c / 8\n end",
"def test_crosses\n seg_h = LineSeg.new(p(0,1),p(3,1))\n seg_v1 = LineSeg.new(p(1,0), p(1,2))\n seg_v2 = LineSeg.new(p(2,0), p(2,2))\n expected = [\n LineSeg.new(p(0,1),p(1,1)), LineSeg.new(p(1,1),p(2,1)), LineSeg.new(p(2,1),p(3,1)),\n LineSeg.new(p(1,0),p(1,1)), LineSeg.new(p(1,1),p(1,2)),\n LineSeg.new(p(2,0),p(2,1)), LineSeg.new(p(2,1),p(2,2)),\n ]\n\n segs = [seg_h, seg_v1, seg_v2]\n\n canon = CanonicalLineSegList.new\n segs.each {|seg| canon.add(seg)}\n assert_equal(expected.size, canon.line_segs.size)\n expect(canon, expected)\n\n canon = CanonicalLineSegList.new\n segs = segs.rotate(1)\n segs.each {|seg| canon.add(seg)}\n assert_equal(expected.size, canon.line_segs.size)\n expect(canon, expected)\n\n canon = CanonicalLineSegList.new\n segs = segs.rotate(1)\n segs.each {|seg| canon.add(seg)}\n assert_equal(expected.size, canon.line_segs.size)\n expect(canon, expected)\n\n end",
"def tracing_lcs(lcs_grid, string1, string2, i, j)\n @lcss ||= []\n return if i < 0 or j < 0\n if string1[i-1] == string2[j-1]\n tracing_lcs(lcs_grid, string1, string2, i-1, j-1)\n @lcss << string1[i-1]\n else\n if lcs_grid[i-1][j] > lcs_grid[i][j-1]\n tracing_lcs(lcs_grid, string1, string2, i-1, j)\n else\n tracing_lcs(lcs_grid, string1, string2, i, j-1)\n end\n end\n return @lcss\nend",
"def total_stops(line_start, station_start, line_end, station_end)\n\t# if travelling on the same line the number of stops is the differential in array indexes\n if line_start == line_end\n \ttotal_stops = line_start.index(station_start) - line_end.index(station_end)\n\n\t# the next 3 are for when union station is a start or end point in the journey\t\n\t# if union is one of the stops then you onlyu need to calculate the number of stops to other station \t\n elsif\n \tstation_start == station_end\n \ttotal_stops = 0\n\n elsif station_start.include?(\"union\")\n \ttotal_stops = stops_from_union(station_end, line_end)\n\n elsif station_end.include?(\"union\")\n \ttotal_stops = stops_from_union(station_start, line_start)\n\n\t# when journey begins and ends on different lines you add the number of stops from union station\n else\n \ttotal_stops = stops_from_union(station_start, line_start) + stops_from_union(station_end, line_end)\n\n end\n\n\t# total stops needs to be an absolute value\n\ttotal_stops = total_stops.abs\nend",
"def travel_diff(line1, line2)\n\t\tputs \"You will need to change trains at UNION SQUARE!\"\n\t\tputs \"Board the train at #{$subway_station[$get_on - 1]}\"\n\t\tend_point_diff = line2.index $subway_station[$get_off - 1]\n\t\tstart_point_diff = line2.index $intersect\n\n\t\t### STARTING LINE IS WHICH?\n\t\tif line1 == $line_n\n\t\t\tlist_stops_int(4, line1, line2)\n\t\t\tdirection(start_point_diff, end_point_diff, line2)\n\n\t\telsif line1 == $line_l\n\t\t\tlist_stops_int(2, line1, line2)\n\t\t\tdirection(start_point_diff, end_point_diff, line2)\n\n\t\telsif line1 == $line_6\n\t\t\tlist_stops_int(3, line1, line2)\n\t\t\tdirection(start_point_diff, end_point_diff, line2)\n\t\tend\n\tend",
"def stops_between_stations(startLine, startPos, endLine, endPos)\n#defining the lines \nredline = [\"South Station\",\"Park Street\",\"Kendall\",\"Central\",\"Harvard\",\"Porter\",\"Davis\",\"Alewife\"]\ngreenline = [\"Government Center\",\"Park Street\",\"Boylston\",\"Arlington\",\"Copley\",\"Hynes\",\"Kenmore\"]\norangeline = [\"North Station\",\"Haymarket\",\"Park Street\",\"State\",\"Downtown Crossing\",\"Chinatown\",\"Back Bay\",\"Forest Hills\"]\n\nrefer = {\n\"Red\" => redline,\n\"Green\" => greenline,\n\"Orange\" => orangeline,\n} \n\n\n intro1 = \"You must travel through the following stops on the #{startLine}:\"\n intro2 = \"Your trip continues through the following stops on #{endLine}:\" \n\n\n #if you are in the same line then just count it onece \nif startLine == endLine\nsingleLine(refer[startLine], startPos, endPos)\nelse\np intro1\narr1 = singleLine(refer[startLine], startPos, \"Park Street\")\np arr1[0]\np intro2\narr2 = singleLine(refer[endLine], \"Park Street\", endPos)\np arr2[0]\np \"#{arr1[1]+arr2[1]} stops in total.\"\nend\n\n\nend",
"def intersect?(triangle, lines)\n line1 = [triangle[0], triangle[2]]\n line2 = [triangle[1], triangle[2]]\n \n lines.any? do |line|\n \n int1 = Geom.intersect_line_line line, line1\n int2 = Geom.intersect_line_line line, line2\n \n intersected = false\n \n if(!int1.nil?)\n puts \"#{line1.inspect} intersect #{line.inspect} at #{int1.inspect}\"\n intersected = true if(in_box(line1, int1) && in_box(line, int1))\n end\n \n if (!int2.nil?)\n puts \"#{line2.inspect} intersect #{line.inspect} at #{int2.inspect}\"\n intersected = true if(in_box(line2, int2) && in_box(line, int2))\n end\n \n intersected\n end\n end",
"def intersect(boundingbox)\n end",
"def complement_overlap\n self.overlap.to_cigar.complement\n end",
"def common_intervals(n)\n Enumerator.new do |y|\n common_ngrams(n).each_with_object(Set.new) do |(gram), intervals|\n indexes = indexes_of(gram)\n indexes[0..-2].each_with_index { |m, i| intervals.add(indexes[i + 1] - m) }\n\n y << intervals\n end\n fail StopIteration\n end\n end",
"def intersectNoPoints np\n np # could also have NoPoints.new here instead\n end",
"def intersectNoPoints np\n np # could also have NoPoints.new here instead\n end",
"def solution(a)\n # want to know the number of discs that start, stop\n # at each position. Then we can calculate how many\n # intersections there are.\n \n # create a hash with default start, stop values set to 0\n events = Hash.new{ |h, k| h[k] = {:start => 0, :stop => 0}}\n \n # store the start, stop vals for each element in a\n a.each_index do |i|\n events[i - a[i]][:start] += 1\n events[i + a[i]][:stop] += 1\n end\n \n # so now event[i][:start] is the start val for a[i]\n # sort the events\n sorted_events = events.sort_by { |index, val| index}\n sorted_events.map! {|n| n[1]}\n \n # so now sorted_events[i] tells us how many starts and stops occured at (i, 0).\n \n # iterate over our sorted array of hashes which tell us how many discs start and end at each position. There are two cases we need to worry about:\n # 1) how many discs are already going when the new disc starts: (e[:start] * past_start)\n # 2) if multiple discs start at the same position (e[:start] * (e[:start]-1) / 2)\n \n # 1) if there are 3 discs that we're in the middle of and a new disc starts, it intersects with all 3 of them. If there are 3 discs we're in the middle of and 2 new discs start, each of them will intersect with the 3 existing ones, making six interactions.\n # 2) If multiple discs start at the same location, some math is required. It's groups of 2, so the number of intersections at each index is n*(n-1)/2 - for if multiple discs start at that index - plus n*past_starts for when discs are already in progress when we start a new one. Add them all together and you have your solution.\n \n past_starts = 0\n intersects = 0\n sorted_events.each do |event|\n intersects += event[:start] * (event[:start]-1) / 2 + event[:start] * past_starts\n past_starts += event[:start]\n past_starts -= event[:stop]\n end\n \n intersects\n #puts \"events: #{events}\"\nend",
"def lcs(x, y, &block)\n x = [nil, *x]\n y = [nil, *y]\n block ||= proc {|a, b| a == b && a}\n lcs_backtrace(lcs_table(x, y, &block), x, y, x.size - 1, y.size - 1, &block)\n end",
"def intersection( to )\n\n # Bullet line between box center and to-point.\n bline = Gseg.new( self.pos.to_gpos, to )\n\n # Find which side of self intersects with bline.\n side = nil\n [ :r, :l, :u, :d ].each do |sidesym|\n trial = self.sideline_seg( sidesym )\n if trial.intersects_with?( bline )\n side = trial\n break\n end\n end\n\n side.intersection_point_with( bline )\n end",
"def is_left_to_union line, on_stop, changing_stop\n\tif line.index(on_stop) <= line.index(changing_stop)\n\t\ttrue\n\telse\n\t\tfalse\n\tend\nend",
"def get_stops (line, first_stop, last_stop)\n # puts \"line #{ line } stop #{ first_stop } -> stop #{ last_stop }\"\n first_index = lines[line.to_sym].index(first_stop)\n last_index = lines[line.to_sym].index(last_stop)\n if first_index <= last_index\n trip = lines[line.to_sym][first_index..last_index]\n else\n trip = lines[line.to_sym][last_index..first_index].reverse\n end\n trip.shift # remove first stop\n return trip\nend",
"def distance (hash, dep_station, line, intersect)\n # line = hash.fetch(line.to_sym)\n stops = line.each_index.select{|i| line[i] == intersect}.join.to_i - line.each_index.select{|i| line[i] == dep_station}.join.to_i \n if stops < 0\n return -stops\n else\n return stops\n end\nend",
"def rec_intersection(rect1, rect2)\n bot_x, bot_y = [rect1[0][0], rect2[0][0]].max, [rect1[0][1], rect2[0][1]].max\n top_x, top_y = [rect1[1][0], rect2[1][0]].min, [rect1[1][1], rect2[1][1]].min\n return nil if bot_x > top_x || bot_y > top_y\n [[bot_x, bot_y], [top_x, top_y]]\nend",
"def rec_intersection(rect1, rect2)\n x_min = [rect1[0][0], rect2[0][0]].max\n x_max = [rect1[1][0], rect2[1][0]].min\n\n y_min = [rect1[0][1], rect2[0][1]].max\n y_max = [rect1[1][1], rect2[1][1]].min\n\n return nil if ((x_max < x_min) || (y_max < y_min)) # no overlap\n return [[x_min, y_min], [x_max, y_max]]\nend",
"def direction_intersect(other)\n self.class.new.tap do |memo|\n unless other.keys.empty?\n a(memo, other)\n b(memo, other)\n end\n c(memo)\n d(memo, other)\n end\n end",
"def crosses_line_string?(rhs)\n self_ints = SweeplineIntersector.new(segments).proper_intersections\n self_ints += SweeplineIntersector.new(rhs.segments).proper_intersections\n overlay_ints = SweeplineIntersector.new(segments + rhs.segments).proper_intersections\n\n (overlay_ints - self_ints).each do |int|\n s1s = int.s1.s\n s1e = int.s1.e\n s2s = int.s2.s\n s2e = int.s2.e\n return true unless [s1s, s1e, s2s, s2e].include?(int.point)\n end\n\n false\n end",
"def intersect _obj, _args\n \"_obj intersect _args;\" \n end",
"def intersection(lat, lng, r)\n \n # Convert degrees to meters\n x1 = Segment.length([lat, lng], [lat, @a[1]]) # lng\n x1 *= -1 if lng > @a[1]\n\n y1 = Segment.length([lat, lng], [@a[0], lng]) # lat\n y1 *= -1 if lat > @a[0]\n \n x2 = Segment.length([lat, lng], [lat, @b[1]]) # lng\n x2 *= -1 if lng > @b[1]\n\n y2 = Segment.length([lat, lng], [@b[0], lng]) # lat\n y2 *= -1 if lat > @b[0]\n \n # Circle equation: lat**2 + lng**2 = r**2\n # Segment equation: lat = y1 + (lng-x1)/(x2-x1) * (y2-y1)\n # See also: http://mathworld.wolfram.com/Circle-LineIntersection.html\n \n dx = x2 - x1\n dy = y2 - y1\n dr = Math.sqrt(dx**2 + dy**2) # Caution: this is estimation\n d = x1*y2 - x2*y1 \n delta = r**2 * dr**2 - d**2 \n\n sgn = lambda{ |x| x < 0 ? -1 : 1 }\n coordinates = lambda do |sign|\n x = (d*dy + sign * sgn[dy] * dx * Math.sqrt(delta)) / dr**2\n y = (-d*dx + sign * dy.abs * Math.sqrt(delta)) / dr**2\n\n intersection_lat = 180*y / (Math::PI * R) + lat\n intersection_lng = x / ( Math.cos(intersection_lat*Rad)*R) * (180/Math::PI) + lng\n \n [intersection_lat, intersection_lng] if (@a[1]..@b[1]).include?(intersection_lng) || (@b[1]..@a[1]).include?(intersection_lng) and\n (@a[0]..@b[0]).include?(intersection_lat) || (@b[0]..@a[0]).include?(intersection_lat)\n end\n \n if delta > 0\n # Return closest point (to point @a) of two\n [-1, 1].map{ |sign| coordinates[sign] }.compact.sort_by{|x,y| y }.first\n elsif delta == 0\n # Tangent line: only one point\n coordinates[0]\n else\n # No intersecting points\n nil\n end\n end",
"def condensation\n sc = strong_components\n cg = DirectedMultiGraph.new\n map = sc.inject({}) do |a,c| \n c.each {|v| a[v] = c }; a\n end\n sc.each do |c|\n c.each do |v|\n adjacent(v).each {|v1| cg.add_edge!(c, map[v1]) unless cg.edge?(c, map[v1]) }\n end\n end; \n cg\n end",
"def intersection(other)\n [first, other.begin].max..[last, other.end].min\n end",
"def lcs(s1, s2); end",
"def find_edge_intersecting_with_line(poly_verts, line_start, line_end)\n count = poly_verts.count\n\n poly_verts.each_with_index do |face_start, i|\n face_end = poly_verts[(i+1) % count]\n\n contact_loc = line_line_intersection(face_start, face_end, line_start, line_end)\n\n if contact_loc\n edge = Edge.new(face_start, face_end)\n edge.contact_loc = contact_loc\n return edge\n end\n end\n\n nil\n end",
"def intersection_chk (x1, y1, x2, y2, center_x, center_y, radius)\n\n\t#check if the circle is in the bounding box rounded by sw_x, sw_y, ne_x, ne_y (southwest point and northeast point)\n\tif x1 < x2\n\t\tsw_x = x1\n\t\tne_x = x2\n\telse\n\t\tsw_x = x2\n\t\tne_x = x1\n\tend\n\n\tif y1 < y2\n\t\tsw_y = y1\n\t\tne_y = y2\n\telse\n\t\tsw_y = y2\n\t\tne_y = y1\n\tend\n\tsw_x = sw_x - radius\n\tsw_y = sw_y - radius\n\tne_x = ne_x + radius\n\tne_y = ne_y + radius\n\n\tif center_x > ne_x || center_x < sw_x || center_y > ne_y || center_y < sw_y\n\t\treturn -1\n\tend\n\n\t#offset the center to 0,0\n\tx1_ = x1 - center_x\n\ty1_ = y1 - center_y\n\tx2_ = x2 - center_x\n\ty2_ = y2 - center_y\n\n\t#check for intersection\n\tdx = x2_ - x1_\n\tdy = y2_ - y1_\n\tdr = Math.sqrt(dx*dx + dy*dy)\n\td = x1_*y2_ - x2_*y1_\n\tresult = radius*radius*dr*dr - (d*d)\n\tif result < 0\n\t\treturn -1\n\telse\n\t\treturn Math.sqrt(((center_x - x1)*(center_x - x1) + (center_y - y1)*(center_y - y1)).abs)\n\tend\nend",
"def critical_square(marker)\n initial = Square::INITIAL_MARKER\n check_lines_for_constellation(initial, marker, initial)\n end",
"def line(a, b)\n return [a] if a == b\n a = offset_to_cube a\n b = offset_to_cube b\n n = cube_distance a, b\n (0..n).each_with_object([]) do |i, results|\n cube_coords = cube_round cube_lerp(a, b, 1.0 / n * i)\n results << cube_to_offset(cube_coords)\n end\n end"
]
| [
"0.6422492",
"0.63610756",
"0.6301229",
"0.6251706",
"0.6182258",
"0.61659557",
"0.60998935",
"0.6080237",
"0.6048151",
"0.60255915",
"0.59983194",
"0.5922342",
"0.5824108",
"0.5824108",
"0.5824108",
"0.5821958",
"0.58083475",
"0.57616735",
"0.5754628",
"0.5747442",
"0.56872404",
"0.56872404",
"0.56872404",
"0.568322",
"0.56824684",
"0.56808585",
"0.56774163",
"0.5666203",
"0.5651968",
"0.56215",
"0.5609649",
"0.5595694",
"0.5576234",
"0.5574201",
"0.5572462",
"0.555809",
"0.5545784",
"0.55406636",
"0.55370265",
"0.5487819",
"0.5487819",
"0.54785717",
"0.54770726",
"0.54548055",
"0.5419976",
"0.54195297",
"0.54185665",
"0.54185665",
"0.54185665",
"0.54156053",
"0.5407252",
"0.5399874",
"0.53828156",
"0.53793716",
"0.5375928",
"0.5339895",
"0.53340775",
"0.5326862",
"0.5325362",
"0.53139794",
"0.53139687",
"0.5307877",
"0.5307877",
"0.52730405",
"0.52722716",
"0.52579135",
"0.5255604",
"0.5238103",
"0.52358115",
"0.52348155",
"0.5226145",
"0.52146524",
"0.5208983",
"0.52044964",
"0.52033734",
"0.5200978",
"0.51927024",
"0.51670647",
"0.51660043",
"0.5164979",
"0.5150003",
"0.5150003",
"0.51474535",
"0.51471937",
"0.5144695",
"0.51368165",
"0.5122758",
"0.51188904",
"0.51162827",
"0.5105723",
"0.5102624",
"0.510259",
"0.50773597",
"0.5073114",
"0.50727654",
"0.507173",
"0.50621307",
"0.5058662",
"0.50477403",
"0.5045432",
"0.5043957"
]
| 0.0 | -1 |
get the lines hash object | def getLines
@lines
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_hash\n Hash[ *(map { |line| [line.key, line] }).flatten ]\n end",
"def lines\n @lines ||= build_lines\n end",
"def lines\n @lines ||= line_codes.map {|l| Line.get(l)}\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 hashes(log)\n return log.split(\"\\n\").map{|line| parser(line) }\n end",
"def line_cache; 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 lines\n self\n end",
"def hashes\n return @hashes\n end",
"def lines\n load_data unless @lines\n @lines\n end",
"def line_diff\n return { :added => @added_lines, :removed => @removed_lines }\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 peer_record_to_hash(line)\n\t\t\tpeer_array_to_hash(line.split(DELIMITER))\n\t\tend",
"def lines; end",
"def lines; end",
"def list_lines(metro_hash)\n puts metro_hash.keys\n return \"all the lines\"\nend",
"def lineitems\n if @lineitems.nil?\n @lineitems = @hash['lineitems'].map { |li| Twocheckout::LineItem.new(li) }\n @lineitems.freeze\n end\n @lineitems\n end",
"def lineitem\n if @lineitem.nil?\n @lineitem = {}\n lineitems.each { |li| @lineitem[li.lineitem_id] = li }\n @lineitem.freeze\n end\n return @lineitem\n end",
"def hash\n rows.hash\n end",
"def hash\n [ref, from, to, chg, line, loc, min, sale, plsp, incl, pror, proadj, tran, serv, dbt, adj, adjm, disc, opt, prop, bill, cust, lfln, date, qty, glref].hash\n end",
"def diff_lines_for_serializer\n strong_memoize(:diff_lines_for_serializer) do\n lines = highlighted_diff_lines\n\n next if lines.empty?\n next if blob.nil?\n\n last_line = lines.last\n\n if last_line.new_pos < total_blob_lines(blob) && !deleted_file?\n match_line = Gitlab::Diff::Line.new(\"\", 'match', nil, last_line.old_pos, last_line.new_pos)\n lines.push(match_line)\n end\n\n lines\n end\n end",
"def le_arquivoH (arq)\n h = Hash.new()\n text = File.open(arq).read\n text.gsub!(/\\r\\n?/, \"\\n\")\n text.each_line do |line|\n s1, s2 = line.split(\" \")\n h[s1] = s2\n end\n return h\n end",
"def hash\n @hash ||= @client.get_hash(path)\n @hash\n end",
"def hash\n @hash ||= @client.get_hash(path)\n @hash\n end",
"def parse_references( lines )\n data = {}\n return data if lines == nil\n index = 1\n h = {}\n references_left = 0\n\n lines.each do |line|\n next if line[0].chr == '#' # Comment\n next if line[0..1] == '//' # End of entry marker\n line.chomp!\n\n if (1..7).include?( index )\n h[index] = line\n references_left = h[index].to_i if index == 7\n index += 1\n next\n end\n\n if index == 8\n h[index] ||= []\n h[index] << line\n references_left -= 1\n end\n\n if references_left == 0\n data[ h[1] ] = {\n :name => h[1],\n :organism => h[2],\n :isoschizomers => h[3],\n :methylation => h[4],\n :source => h[5],\n :suppliers => h[6],\n :number_of_references => h[7],\n :references => h[8]\n }\n index = 1\n h = {}\n end\n end # lines.each\n data\n end",
"def lines\n @lines ||= Vedeu::Editor::Lines.coerce(data)\n end",
"def lines\n result = Array.new\n @theLines.each { |l| result << String.new(l) }\n return result\n end",
"def get_ensmart_hash\n omim2ensp=Hash.new\n infile=File.new('mart_export2.txt','r')\n infile.each_line{|line|\n line.chomp!\n match_data=line.split(\" \")\n omim2ensp[match_data[1]]=match_data[0]\n }\n return omim2ensp\nend",
"def hash\n @content.hash\n end",
"def lines\n\t\tcontents.split(\"\\n\")\n\tend",
"def lines\n\t\tcontents.split(\"\\n\")\n\tend",
"def lines\n @stats ||= stats\n end",
"def extract_commit_hash(commit)\n return commit.lines.first.strip!\nend",
"def hash\n @hash\n end",
"def hash\n @hash.hash\n end",
"def line_items\n @line_items.dup.freeze\n end",
"def lines\n ret = [Attributes::HEADER]\n # Sort by name, but id goes first\n @attrs.sort_by{|x| x[:name] == 'id' ? '_' : x[:name]}.each do |row|\n line = \"# * #{row[:name]} [#{row[:type]}]#{row[:desc].to_s.empty? ? \"\" : \" - #{row[:desc]}\"}\"\n # split into lines that don't exceed 80 chars\n lt = wrap_text(line, MAX_CHARS_PER_LINE-3).split(\"\\n\")\n line = ([lt[0]] + lt[1..-1].map{|x| \"# #{x}\"}).join(\"\\n\")\n ret << line\n end\n ret\n end",
"def to_ary\n lines.take(1000).map { |l| { :number => l.filtered_number, :file => l.filtered_file, :method => l.filtered_method, :source => l.source } }\n end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def to_set\n @lines ||= load_from_file\n end",
"def keys\n map { |line| line.key }\n end",
"def lines\n # TODO: data should be required to be a String, no nils\n @lines ||= data ? data.split(\"\\n\", -1) : []\n end",
"def hash\n [channel_order_no, lines, created_at, updated_at, extra_data, track_trace_no, track_trace_url, return_track_trace_no, method, shipped_from_country_code, shipment_date].hash\n end",
"def content\n lines.uniq.join(\"\\n\").lstrip\n end",
"def field_array(lines)\n entries = []\n text = lines.join\n text.scan(/^>.+<(.+)>\\n(.+\\n)+\\n/) do |name, data| \n entries << [name, data.chomp]\n end\n Hash[entries]\n end",
"def getLine (key)\n lines = \n {\n \"N\": [\"Times Square\", \"34th\", \"28th\", \"23rd\", \"Union Square\", \"8th\"],\n \"L\": [\"8th\", \"6th\", \"Union Square\", \"3rd\", \"1st\"],\n \"6\": [\"Grand Central\", \"33rd\", \"28th\", \"23rd\", \"Union Square\", \"Astor Place\"]\n }\n return lines[key]\nend",
"def to_hash\n # Get buffer contents as a String\n s = lock {buf} rescue ''\n # Split into RECORD_SIZE character lines\n lines = s.scan(/.{#{RECORD_SIZE}}/o)\n # Skip END record\n lines.pop if lines[-1].start_with?('END ')\n\n # Parse lines into key and value\n h = {}\n lines.each do |l|\n key, value = l.split('=', 2)\n value ||= '' # In case no '='\n key.strip!\n value.strip!\n # If value is enclosed in single quotes, remove them and strip spaces\n value = value[1..-2].strip if /^'.*'$/ =~ value\n h[key] = value\n end\n h\n end",
"def to_a\n @lines.dup\n end",
"def hash \n @hash ||= CobraVsMongoose.xml_to_hash(file_content)\n end",
"def hash\n [].hash\n end",
"def line_to_hash(line, *cols)\n Hash[cols.zip(line.strip.split(/\\s+/, cols.size))]\n end",
"def lines\n old_order_lines\n end",
"def hash\n end",
"def hash\n end",
"def hash\n end",
"def hash\n data.hash\n end",
"def line\n lines.first\n end",
"def parse_into_hash(file_content)\n # apt-history file is seperated by double new line\n file_sections = file_content.split(\"\\n\\n\")\n\n # split the sections by line within them\n file_sections.map! { |section| section.split(\"\\n\") }\n\n # split each line of the sections by : seperator\n file_sections.map! do |section|\n section.map! do |line|\n line.partition(\": \").values_at(0, 2) # we don't need the seperator\n end\n section.to_h # Now make a hash of key-value pairs from 2-D array\n end\n end",
"def txt_hash(alternate_host=nil)\n fields = {}\n record = self.txt(alternate_host)\n return fields unless record\n\n record.split(/\\s*;\\s*/).each do |pair|\n (n,v) = pair.split(/\\s*=\\s*/)\n fields[n.to_sym] = v\n end\n fields\n end",
"def lines\n @lines\nend",
"def file_2_hash(f,lc=true)\n\t\tputs \"Loading records from file: #{f}\" if @verbose\n\t\tbegin\n\t\t\ths=Hash.new\n\t\t\tfile = File.open(f, \"r\")\n\t\t\tfile.each_line do |line|\n\t\t\t\tline=line.chomp.strip\n\t\t\t\tnext if line.nil?\n\t\t\t\tnext if line.empty?\n\t\t\t\tline=line.downcase if lc==true\n\t\t\t\tnext if line =~ /^\\s*#/\n\t\t\t\ths[line]=true unless hs.key?(line)\n\t\t\tend\n\t\t\tfile.close\n\t\t\treturn hs\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__} on #{f}: #{ee}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\tend",
"def hash\n @hash ||= self.to_a.hash\n end",
"def get_cert_lines()\n lines_str = get_config_data\n lines = lines_str.split(\"\\n\")\n lines\n end",
"def getLine\r\n\t\treturn @Line\r\n\tend",
"def lines\n @document.lines @line_numbers\n end",
"def lines\n return self.sale.file_content.lines[self.begins_at_line..self.ends_at_line]\n end",
"def lines\n @lines ||= begin\n code.gsub(/\\r/,'').split(\"\\n\").collect do |line|\n line.strip!\n next nil if line == \"\" || line.start_with?('#')\n line\n end.compact\n end\n end",
"def lineoffsets\n result = {}\n offsetlines.each do |offset, lines|\n lines.each do |line|\n result[line] ||= []\n result[line] << offset\n end\n end\n result\n end",
"def getLine(theLines, theIndex)\n\n\treturn theLines.fetch(theIndex, EMPTY_LINE);\n\nend",
"def lines\n @data.split(/^:/m)[1..-1].map do |line|\n \":#{line}\"\n end\n end",
"def get_entries(filename)\n lines = File.readlines(filename)\n hsh = lines.select { |s| s !~ /^#/ && s.strip != '' }.map do |lin|\n parts = lin.split('|')\n raise \"Bad line #{lin}\" unless parts.size == 5\n {\n raw: lin,\n rank: parts[0],\n word: parts[1],\n type: parts[2],\n translation: parts[3],\n sample: parts[4].strip\n }\n end\n hsh\n end",
"def to_hash\n {\n line: line,\n character: character\n }\n end",
"def line_maker\n @lines = File.readlines(path, chomp: true)\n end",
"def line\n @line ||= Line.get(@attrs['Line'])\n end",
"def lines; [to_s]; end",
"def hash_char_positions\n hash_positions= []\n @lines.each_with_index do |line, line_index|\n line.enum_for(:scan, /#/).each do\n hash_positions << [line_index, Regexp.last_match.begin(0)]\n end\n end\n if hash_positions.count != 2\n raise ArgumentError, \"Incorrect hash symbol number!!! except exactly two hash symbols.\"\n end\n hash_positions\n end",
"def process_hash_row(hsh)\n if @headers.any?\n keys_or_values = hsh.values\n @row_id = hsh[:row_id]\n else\n keys_or_values = hsh.keys.map(&:to_s)\n end\n\n file_line = keys_or_values.join(',')\n validated_line = utf_filter(check_utf(file_line))\n res = line_parse(validated_line)\n res\n end",
"def to_hash(description='String::to_hash() made by genious RCarlesso (give a better description if u dont like this!)')\n arr = Hash.new\n arr['_meta'] = Hash.new\n arr['_meta']['description'] = description\n arr['_meta']['time'] = Time.now\n self.split(\"\\n\").each{|line| \n k,v = line.split(': ') \n arr[k.strip] = v.strip \n } rescue arr['_meta']['errors'] = $! \n arr\n end",
"def output_hash; end",
"def cl_hash\n if @cl_hash\n return @cl_hash\n else\n courtlistener = CourtListener.new\n @cl_hash = courtlistener.case_by_cite(cite1)\n end\n end",
"def line\n @line ||= Line.get(@attrs['LineCode'])\n end",
"def lines\n return [] unless @value && text\n\n text.split(/\\r\\n|\\r|\\n/)\n end",
"def hash\r\n @_hash ||= _hash\r\n end",
"def lines(source); end",
"def read_summary(fname)\n hash={}\n # Read file\n File.open(fname,'r') do |f|\n # Loop over line\n f.each_line do |line|\n line.chomp!\n index,content = line.split(/\\s*==\\s*/)\n hash[index] = content # index:id, content:path\n end\n end\n return hash\nend",
"def txt_hash(alternate_host = nil)\n fields = {}\n record = txt(alternate_host)\n return fields unless record\n\n record.split(/\\s*;\\s*/).each do |pair|\n (n, v) = pair.split(/\\s*=\\s*/)\n fields[n.to_sym] = v\n end\n fields\n end",
"def lines_fetch(tag) \n unless @data[tag] \n @data[tag] = get(tag).split(/\\n/).map{ |l| tag_cut(l) } \n end \n @data[tag] \n end",
"def hash\n bytes.hash\n end",
"def buffer\n Readline::HISTORY.to_a\n end",
"def hash\n @orig.hash\n end",
"def hash\n @orig.hash\n end"
]
| [
"0.6546754",
"0.65418655",
"0.64126307",
"0.6276187",
"0.61619484",
"0.6139667",
"0.60879976",
"0.6072377",
"0.6065265",
"0.605903",
"0.6048124",
"0.60414183",
"0.6040343",
"0.60105085",
"0.60105085",
"0.59932464",
"0.5989374",
"0.5947223",
"0.59408617",
"0.58206403",
"0.58131486",
"0.58110327",
"0.58026904",
"0.58026904",
"0.579815",
"0.5783224",
"0.5771386",
"0.5766243",
"0.5763776",
"0.5760655",
"0.5760655",
"0.5759738",
"0.57512903",
"0.5743594",
"0.57339805",
"0.57100505",
"0.5698035",
"0.5691955",
"0.5672706",
"0.5672706",
"0.5672706",
"0.5672706",
"0.5672706",
"0.5672706",
"0.5672706",
"0.5672706",
"0.5672706",
"0.5672706",
"0.5662011",
"0.56602657",
"0.5655642",
"0.56504464",
"0.56386775",
"0.5638402",
"0.5637792",
"0.5623676",
"0.5588277",
"0.5557937",
"0.55485076",
"0.5541527",
"0.55400276",
"0.55364364",
"0.55364364",
"0.55364364",
"0.5535091",
"0.5533654",
"0.5529107",
"0.5528396",
"0.55226934",
"0.55192244",
"0.5514542",
"0.5506835",
"0.549678",
"0.5487388",
"0.5473039",
"0.54726624",
"0.54719007",
"0.5466583",
"0.546536",
"0.54600424",
"0.54384404",
"0.54361516",
"0.5434779",
"0.5423681",
"0.54138404",
"0.5413811",
"0.54134387",
"0.54099166",
"0.5408648",
"0.5399206",
"0.53938395",
"0.53930783",
"0.53875047",
"0.5385435",
"0.5382856",
"0.53736466",
"0.53716254",
"0.5366833",
"0.5366349",
"0.5366349"
]
| 0.61386997 | 6 |
the question max score is the max score of the questionnaire, except if the question is a true/false, in which case the max score is one. | def question_max_score
question = Question.find(self.question_id)
if question.type == "Checkbox"
return 1
elsif question.is_a? ScoredQuestion
@question_max_score
else
"N/A"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_maximum_score()\n max_score = 0\n\n self.scores.each { |score| max_score = max_score + score.question.questionnaire.max_question_score }\n\n max_score\n end",
"def max_score(creative_quality)\n max_score = 0\n self.question_responses\n .select{|el| max_score += el.question.question_choices.max{|el| el.score}.score if el.question_choice.creative_quality.name === creative_quality}\n max_score\n end",
"def max_mcq_score\n if self.exercise.is_mcq?\n sum = 0.0\n self.prompts.each do |question_prompt|\n question_prompt.specific.choices.each do |choice|\n sum += choice.value if choice.value > 0.0\n end\n end\n puts \"MAX MCQ SCORE\",sum,\"MAX MCQ SCORE\"\n return sum\n end\n end",
"def max\n @raw.max_by(&:score)\n end",
"def max_score\n @max_score ||= raw_response['response']['maxScore'].to_f\n end",
"def max_score\n return score if @state != STATE_OK\n\n next_boards.map(&:min_score).min\n end",
"def highest_total_score\n total_goals.max\n end",
"def accepted?\n score == max_score\n end",
"def max_score\n @solr_data[:max_score]\n end",
"def max_score\n problem.weight\n end",
"def max_total_score\n review_criterions.collect{|c| c.max_score}.sum\n end",
"def max_score\n @solr_data[:max_score]\n end",
"def max\n if valid?\n max_value\n end\n end",
"def max_score\n return nil if metrics.empty?\n metrics.sum(&:weighted_max_score)\n end",
"def max\n @max ||= define_min_and_max && @max\n end",
"def highest_player_score\n players.max_by{|player| player.score}.score\n end",
"def highest_word_score\n \t@scores_array.max\n end",
"def validate\n if offering_review_criterion && !score.blank? && score > max_score\n errors.add(:score, \"cannot be greater than the maximum score of #{max_score}\") \n end\n end",
"def highest_score\n sort\n all.first.score\n end",
"def max?\n @number == @max_num\n end",
"def get_max\n @max\n end",
"def highest_total_score\n @game_manager.highest_total_score\n end",
"def max\n @max\n end",
"def max\n @max\n end",
"def best_score\n submissions.min(:score)\n end",
"def get_best_question(asked_questions)\n questions = Question.where(entity_class: @entity_class) - asked_questions\n\n results = calc_questions_score(questions)\n\n results.sort_by! { |q| q[:score] }.reverse!\n\n if results.any?\n return results.first[:question]\n else\n return nil\n end\n end",
"def one_question_score(last_n=nil)\n answers = survey_questions.map(&:survey_answers).flatten\n answers = answers[last_n * -1, last_n] if last_n && answers.size >= last_n\n count = answers.size.to_f\n positive = answers.select{|a| [9,10].include?(a.answer.to_f) }.size.to_f\n negative = answers.select{|a| (1..6).include?(a.answer.to_f) }.size.to_f\n ((positive/count)-(negative/count)) * 100\n end",
"def get_max_score(list)\n max = list[0].value\n list.each do |l|\n max = l.value if l.value > max\n end\n return max\n end",
"def find_max()\r\n self.max\r\n end",
"def max_scores\n next_boards.map(&:max_score)\n end",
"def correctness_for(question, grade)\n grade >= question.maximum_grade\n end",
"def max\n\t\t@max || nil\n\tend",
"def max_grade\n graded_pictures_count = self.pictures.where(:is_deleted=> false, :is_graded => true).count\n if graded_pictures_count == 0 \n return nil\n else\n return self.pictures.\n where(:is_deleted=> false, :is_graded => true).\n maximum(\"score\")\n end\n end",
"def valid_score?\n if !(Test.find(test_id).max_score >= score)\n errors.add(:score,\"score is greater than maximum score for this test\")\n end\n end",
"def max\n @maxNumber\n end",
"def max\n end",
"def max\n end",
"def most_voted_answer_for_scenarios(scenarios)\n answers.max_by{|a| a.votes_in_scenarios(scenarios)}\n end",
"def optimal_answer?\n \tanswer_value == optimal_value\n end",
"def pass\n @score = @rubric_item.max_score\n end",
"def best_score(a_of_g)\n best_score = a_of_g.flatten.return_objects_with(:attempts, 0).max_attribute(:adjusted_goodness)\n end",
"def highest_score\n sorted_all_scores = self.leaderboard_entries.order(score: :DESC)\n sorted_all_scores[0]\n end",
"def maximum\n return @maximum\n end",
"def sendgrid_spamcheck_maxscore score\n @sg_spamcheck_score = score\n end",
"def get_max\n @max ||= calculate_max\n end",
"def sendgrid_spamcheck_maxscore score\n self.default_sg_spamcheck_score = score\n end",
"def maxvalue\n MAXVALUE\n end",
"def factor_max_labs\n \tfactors.map do |factor|\n \t\tfactor.max_score\n \tend\n end",
"def max\n self.class.max\n end",
"def eqp_r_max(item)\n end",
"def highest_predicted_localization\n @score_hash.max{ |a,b|\n a[1] <=> b[1]\n }[0]\n end",
"def max; end",
"def max; end",
"def max_score\n mapping.select{ |x,v| v.present? }.keys.map { |k| k.gsub(/#{MAP_KEY}/,'').to_i }.max || -1\n end",
"def latest_answer\n # TODO: latest answer should be the one finalised with grading...\n @answer ||= begin\n answers = answers_of_same_question.sort_by(&:created_at)\n finalised_answers = answers.select { |a| a.finalised }\n finalised_and_graded = finalised_answers.select { |a| a.assessment_answer_grading.present? }\n finalised_and_graded.last || finalised_answers.last || answers.last\n end\n end",
"def score\n handscore = possible_scores.sort.reverse\n handscore.detect { |value| value <= 21 } or handscore.last\n end",
"def get_max()\n end",
"def highest_word_score\n Scoring.score(highest_scoring_word)\n end",
"def getSpecialValue\n maxBonus\n end",
"def highest_scoring_word\n \tScoring.highest_score_from(@words_played)\n end",
"def score\n regions.map(&:score).max\n end",
"def weighted_max_score\n max_score * weight\n end",
"def max=\n end",
"def highest_word_score\n return highest_scoring_value = Scrabble::Scoring.score(highest_scoring_word)\n end",
"def high_score\n if self.end_date < Date.today\n self.teams.max_by { |team| team.score }.score\n end\n end",
"def max_sets_to_play\n case scoring.to_sym\n when :two_six_game_ten_point\n 3\n when :one_eight_game\n 1\n else # :three_six_game\n 3\n end\n end",
"def highest_voted_answers\n answers.sort_by {|answer| answer.vote_score}.reverse\n end",
"def highest_match_value\n values = @hand.select { |dice| @hand.count(dice) == highest_match_count }\n values.max\n end",
"def item_max() @item_max end",
"def pass_if(b)\n @score = b ? @rubric_item.max_score : 0.0\n end",
"def max_value(value, pdef)\n if(value.to_i <= pdef['MaxValue'].to_i)\n true\n else\n \"Value must not be greater than #{pdef['MaxValue']}\"\n end\n end",
"def max\n if self.root.right_child.nil?\n return {self.root.title => self.root.score}\n else\n recursive_max(self.root.right_child)\n end\n end",
"def score\n verdict ? (verdict.score * problem.weight / verdict.max_score.to_f) : 0\n end",
"def winner\n @players.max_by{ |player| player.score}\n end",
"def maximum_votes_per_participation\n return nil unless feature_settings.maximum_votes_per_participation.positive?\n feature_settings.maximum_votes_per_participation\n end",
"def highest_word_score\n Scrabble::Scoring.score(Scrabble::Scoring.highest_score_from(@plays_array))\n end",
"def is_max_number?()\n return @ucItemNumber.value == @ucItemNumber.max\n end",
"def maximum_value\n @maximum_value || store.max\n end",
"def scale_criterion_question(count, answer = nil, questionnaire_min, questionnaire_max)\n if size.nil? || size.blank?\n cols = '70'\n rows = '1'\n else\n cols = size.split(',')[0]\n rows = size.split(',')[1]\n end\n html = '<input id=\"responses_' + count.to_s + '_score\" name=\"responses[' + count.to_s + '][score]\" type=\"hidden\"'\n html += 'value=\"' + answer.answer.to_s + '\"' unless answer.nil?\n html += '><table><tr><td width=\"10%\"></td>'\n\n (questionnaire_min..questionnaire_max).each do |j|\n html += '<td width=\"10%\"><label>' + j.to_s + '</label></td>'\n end\n\n html += '<td width=\"10%\"></td></tr><tr><td width=\"10%\">'\n html += min_label unless min_label.nil?\n html += '</td>'\n\n (questionnaire_min..questionnaire_max).each do |j|\n html += '<td width=\"10%\"><input type=\"radio\" id=\"' + j.to_s + '\" value=\"' + j.to_s + '\" name=\"Radio_' + id.to_s + '\"'\n html += 'checked=\"checked\"' if (!answer.nil? && answer.answer == j) || (answer.nil? && questionnaire_min == j)\n html += '></td>'\n end\n html += '<script>jQuery(\"input[name=Radio_' + id.to_s + ']:radio\").change(function() {'\n html += 'var response_score = jQuery(\"#responses_' + count.to_s + '_score\");'\n html += 'var checked_value = jQuery(\"input[name=Radio_' + id.to_s + ']:checked\").val();'\n html += 'response_score.val(checked_value);});</script><td width=\"10%\">'\n html += max_label unless max_label.nil?\n html += '</td><td width=\"10%\"></td></tr></table>'\n html += '<textarea cols=' + cols + ' rows=' + rows + ' id=\"responses_' + count.to_s + '_comments\"' \\\n ' name=\"responses[' + count.to_s + '][comment]\" class=\"tinymce\">'\n html += answer.comments if !answer.nil? && !answer.comments.nil?\n html += '</textarea>'\n end",
"def last_unanswered_questionnaire\r\n last_unanswered = unanswered_questionnaires.last rescue nil\r\n the_very_last = Questionnaire.by_language_published(I18n.locale).last\r\n last_unanswered == the_very_last ? last_unanswered : nil\r\n end",
"def get_max\n\t\[email protected]\n\tend",
"def max\n data.max\n end",
"def max?\n percent >= 100\n end",
"def max_value\n max = 0\n\n @matrix.each do |row|\n row_max = row.max\n max = row_max if row_max > max\n end\n\n max\n end",
"def max\n self.reduce('lambda{|memo, item| memo > item ? memo : item }')\n end",
"def max(num1, num2, num3) #in the parentesis is specified the parameter.\n if num1 >= num2 and num1 >= num3 #this comparason is either true or false, so needs to use true or false to show comparison\n return num1\n elsif num2 > num1 and num2 >= num3\n return num2\n else \n return num3\n end \nend",
"def highest_word_score\n return Scrabble::Scoring.score(highest_scoring_word)\n end",
"def maxy\n main.maxy\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 mmax\n @opened ? @mmax : nil\n end",
"def score\n seconds_passed = Time.now.to_i - Integer(time_for_last_correct_answer || 0)\n wrong_answers = nr_of_answers - nr_of_correct_answers\n # Scores grow linearly with number of correct answers, but\n # geometrically with number of wrong answers. That's a way to\n # ensure that more attention is paid to problem areas.\n x = Integer(nr_of_correct_answers - wrong_answers ** 1.5)\n if x < 0\n x # Time is not a factor when the score is negative.\n else\n 10_000_000 * x / (seconds_passed + 500_000)\n end\n end",
"def largest_value\n values.max\n end",
"def find_max\n\t# Use method: stu_max = @students_list.max_by{|x| x.avg}\n\t max =0\n\t for i in 0..(@students_list.length-1) \n\t\tif @students_list[i].avg > max\n\t\t max = @students_list[i].avg\n\t\t stu_max = @students_list[i]\n\t\tend\n\t end\n\t puts \"Student who has max avg\".center(30)\n\t puts \"Name: #{stu_max.name}\".rjust(20)\n\t puts \"Birthday: #{stu_max.birthday}\".rjust(20)\n\t puts \"Math: #{stu_max.math}\".rjust(20)\n\t puts \"Literature: #{stu_max.liter}\".rjust(20)\n\t puts \"English: #{stu_max.eng}\".rjust(20)\n\t puts \"AVG: #{stu_max.avg}\".rjust(20)\n\tend",
"def best_answer\n\n answer = self.answers.order('up - down DESC').first\n\n #verifica se melhor resposta tem algum voto\n #se nao houver nenhum voto nao fica como melhor resposta\n if !answer.nil? && (( answer.up == 0 && answer.down == 0) || self.answers.first == answer || self.answers.count == 1 )\n answer = nil\n end\n\n return answer\n end",
"def highest_value\n @values.inject { |highest, val| highest = (val < 21 && val > highest) ? val : highest }\n end",
"def winner\n @players.max_by do |player|\n player.score\n end\n end",
"def max\n\t\tm = self.valor[0]\n\t\tfor i in (0...self.valor.size.to_i)\n\t\t\t\tif (self.valor[i]> m)\n\t\t\t\t\tm = self.valor[i]\n\t\t\t\tend\n\t\tend\n\t\treturn m\n\tend",
"def validate_questionnaire\n if max_question_score < 1\n errors.add(:max_question_score, \"The maximum question score must be a positive integer.\")\n end\n if min_question_score >= max_question_score\n errors.add(:min_question_score, \"The minimum question score must be less than the maximum\")\n end\n\n results = Questionnaire.where([\"id <> ? and name = ? and instructor_id = ?\", id, name, instructor_id])\n errors.add(:name, \"Questionnaire names must be unique.\") if results != nil and results.length > 0\n end",
"def highest_scoring_word\n Scoring.highest_score_from(plays)\n end"
]
| [
"0.79807544",
"0.7314736",
"0.71533525",
"0.70973194",
"0.7061899",
"0.702873",
"0.70216316",
"0.69702077",
"0.67640877",
"0.6742938",
"0.6736504",
"0.6735746",
"0.6650699",
"0.6577726",
"0.6536788",
"0.652327",
"0.6481408",
"0.6450408",
"0.63993376",
"0.6363122",
"0.63475907",
"0.6335283",
"0.633478",
"0.633478",
"0.63071865",
"0.629946",
"0.6293174",
"0.62902397",
"0.6278588",
"0.62610984",
"0.6240224",
"0.6221126",
"0.6217267",
"0.6202808",
"0.6197004",
"0.6177166",
"0.6177166",
"0.61603343",
"0.61533266",
"0.6137866",
"0.61197114",
"0.61189306",
"0.6108604",
"0.61009",
"0.6093221",
"0.6076126",
"0.6071668",
"0.6069328",
"0.60661656",
"0.60570246",
"0.60474724",
"0.60393906",
"0.60393906",
"0.6030174",
"0.60252416",
"0.60184467",
"0.60104275",
"0.6009776",
"0.6008758",
"0.6006854",
"0.5984609",
"0.59805715",
"0.5974484",
"0.5970673",
"0.59678096",
"0.59613746",
"0.5945513",
"0.5938092",
"0.59254277",
"0.5910523",
"0.59099734",
"0.5907078",
"0.5904824",
"0.5902364",
"0.58984995",
"0.5880866",
"0.5875906",
"0.5851358",
"0.58494914",
"0.5846352",
"0.5846111",
"0.58429694",
"0.58404213",
"0.5840122",
"0.5830481",
"0.58150995",
"0.58117473",
"0.5795485",
"0.57878006",
"0.5783831",
"0.5783268",
"0.5778609",
"0.5776669",
"0.57731414",
"0.5745232",
"0.5741906",
"0.573851",
"0.57323766",
"0.5731865"
]
| 0.8718923 | 1 |
Initialize an empty array of loaders. | def initialize
@roots = {}
@ordered = Array.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loaders\n @loaders ||= profile.loaders\n end",
"def initialize(parent_loader, loaders, module_name, path, loader_name, loadables = LOADABLE_KINDS)\n super\n @path_index = Set.new\n end",
"def instantiate_modules\n mods = Array(modules)\n mods = load!(mods) if callback?(:load)\n Array(mods).map do |klass|\n init!(klass) || klass.new(fetchable)\n end\n end",
"def initialize\n @loaded_constants = []\n load_all\n end",
"def initialize(processors)\n @processors = processors\n end",
"def loaders\n @loaders ||= LoggedChangeLoaders.new(session)\n end",
"def add_loader(loader)\n @loaders << loader\n end",
"def initialize\n @drawlist = []\n begin\n @drawlist.push @@loader.plugins.background\n rescue\n ; # No background plugin loaded\n end\n end",
"def initialize(parent_loader, loaders, module_name, path, loader_name, loadables)\n super(parent_loader, loader_name, loaders.environment)\n\n raise ArgumentError, 'path based loader cannot be instantiated without a path' if path.nil? || path.empty?\n\n @module_name = module_name\n @path = path\n @smart_paths = LoaderPaths::SmartPaths.new(self)\n @loaders = loaders\n @loadables = loadables\n unless (loadables - LOADABLE_KINDS).empty?\n #TRANSLATORS 'loadables' is a variable containing loadable modules and should not be translated\n raise ArgumentError, _('given loadables are not of supported loadable kind')\n end\n loaders.add_loader_by_name(self)\n end",
"def instantiate_plugins!\n ::Bicho::Plugins.constants.each do |cnt|\n pl_class = ::Bicho::Plugins.const_get(cnt)\n pl_instance = pl_class.new\n logger.debug(\"Loaded: #{pl_instance}\")\n @plugins << pl_instance\n end\n end",
"def environment_loaders\n name = compiler.loaders.public_environment_loader.loader_name\n end",
"def environment_loaders\n name = compiler.loaders.public_environment_loader.loader_name\n end",
"def eager_load_all\n Registry.loaders.each(&:eager_load)\n end",
"def initialize(loader)\n @loader = loader\n end",
"def initialize(loader)\n @loader = loader\n end",
"def load_all\n @internal_loader.load_all(self)\n end",
"def initialize(compilers = [])\n @method_compilers = nil\n compilers.each{|c| add_compiler(c)}\n end",
"def initialize_plugins\n plugins.each do |name, klass|\n msg = \"initialize_#{name}\"\n klass.send msg if klass.respond_to? msg\n end\n end",
"def initialize(services: [])\n setup!\n load_services(services)\n end",
"def create_loader(enabled_plugins)\n enabled_plugins = enabled_plugins.map do |p|\n if p.is_a?(Plugin)\n p\n else\n plugins.find {|plugin| p == plugin.module_name } or\n raise UnknownPluginError, p\n end\n end\n\n enabled_plugins.each do |p|\n log(\"activating #{p}\")\n p.activate!\n end\n\n log(\"enabled_plugins: #{enabled_plugins.inspect}\")\n\n Loader.new(enabled_plugins)\n end",
"def autoloaders; end",
"def initialize\n provider_builders = read_provider_builders\n @providers = Hash[provider_builders.map do |name, package_hash|\n packages = Hash[package_hash.map do |size, price|\n [size, Package.new(size, price)]\n end]\n [name, Provider.new(name, packages)]\n end]\n end",
"def plugins\n @plugins ||= []\n end",
"def initialize files=nil\n self.class.load_files files.to_a.concat(DEFAULT_TASK_FILES)\n end",
"def all_dirs\n Registry.loaders.flat_map(&:dirs).freeze\n end",
"def loaded_resources\n @_loaded_resources ||= []\n end",
"def init_plugins\n\t\t\tmethods.grep(/^init_plugin_/).each{|method_name| send(method_name) }\n\t\tend",
"def initialize(framework,types=MODULE_TYPES)\n\t\tself.module_paths = []\n\t\tself.module_history = {}\n\t\tself.module_history_mtime = {}\n\t\tself.module_sets = {}\n\t\tself.module_failed = {}\n\t\tself.enabled_types = {}\n\t\tself.framework = framework\n\n\t\ttypes.each { |type|\n\t\t\tself.enabled_types[type] = true\n\t\t\tcase type\n\t\t\t\twhen MODULE_PAYLOAD\n\t\t\t\t\tinstance = PayloadSet.new(self)\n\t\t\t\telse\n\t\t\t\t\tinstance = ModuleSet.new(type)\n\t\t\tend\n\n\t\t\tself.module_sets[type] = instance\n\n\t\t\t# Set the module set's framework reference\n\t\t\tinstance.framework = framework\n\t\t}\n\n\t\tsuper(nil)\n\t\t\n\t\t@modcache_invalidated = false\n\t\t@cached_counts = false\n\tend",
"def initialize(*files)\n @files = files\n\n @_config = Hash.new{ |h,k| h[k]=[] }\n #@_onload = Hash.new{ |h,k| h[k]=[] }\n\n load_files(*files)\n end",
"def initialize(loader)\n # This is a Puma::PluginLoader\n @loader = loader\n end",
"def initialize_regions\n @initialized_regions ||= []\n\n # The goal here is get all included and extended modules.\n modules = self.class.included_modules + (class << self; self end).included_modules\n modules.uniq!\n\n # Then each of those modules can be initialized.\n modules.each do |m|\n # First a check is made the that constructor is defined and that it has\n # not been called before.\n next if @initialized_regions.include?(m) || !m.instance_methods.include?(:initialize_region)\n\n m.instance_method(:initialize_region).bind(self).call\n\n @initialized_regions << m\n end\n end",
"def initialize\n @drivers = []\n end",
"def initialize\n @drivers = Array.new\n end",
"def initialize\n @preloader = Rendering::NoopPreloader\n @pretty = true\n @cache_templates = false\n @lookup_context = nil\n @using = []\n end",
"def initialize()\n @filters ||= []\n end",
"def initialize(resource_types = nil)\n resource_types = [] if resource_types.nil?\n resource_types = [resource_types] unless resource_types.is_a?(Array)\n super(resource_types)\n end",
"def load_all\n @leagues = @loader.load unless @loader.nil?\n end",
"def initialize(parsers: {}, filters: [])\n @filters = filters\n @parsers = parsers\n end",
"def initialize(parent_loader, loaders, module_name, gem_ref, loader_name, loadables = LOADABLE_KINDS)\n @gem_ref = gem_ref\n super parent_loader, loaders, module_name, gem_dir(gem_ref), loader_name, loadables\n end",
"def init_workers(servers)\n @w = []\n servers.each{|s|\n @w << Worker.new(s)\n }\n end",
"def loadall\n autoloader.loadall\n end",
"def resolve_paths(loaders)\n mod_resolver = loaders.instance_variable_get(:@module_resolver)\n all_mods = mod_resolver.instance_variable_get(:@all_module_loaders)\n end",
"def initialize(*runners)\n\t\t\t@runners = []\n\t\t\tr = runners[0]\n\t\t\tr.instance_variables.each do |v| \n\t\t\t\tinstance_variable_set(v, r.instance_variable_get(v))\n\t\t\tend\n\t\t\t@run_list = {}\n\t\t\trunners.each{|runner| add_runner(runner)}\n\t\tend",
"def initialize\n\t\t\tplugins.init(self)\n\t\tend",
"def initialize(array_clases=ObjectSpace.each_object(Class).to_a)\n @array_clases = array_clases\n @dynamic_classes = []\n @aspects = []\n define_listener_dynamic_methods\n end",
"def processors\n @@processors ||= @@processor_classes.collect {|processor| processor.instance}\n end",
"def initialize(*args)\n self.class.each_array_definition do |array_definition|\n initialize_arrays(array_definition.name)\n ArrayFu::ModuleRegistry.configure(self, array_definition) \n end\n end",
"def create_default_resources\n resources = [:timber, :iron, :gold, :copper, :diamond, :clay, :marble,\n :coal, :oil, :gas, :water, :uranium]\n @resources = []\n resources.each do |r|\n @resources << Resource.new(r, 1000)\n end\n end",
"def initialize()\n @tileset = Gosu::Image.load_tiles(\"media/tileset.png\", TILE_WIDTH, TILE_HEIGHT, tileable: true)\n\n # Load images here so they will only be loaded once per game\n @enemyAnimation = *Gosu::Image.load_tiles(\"media/enemy_char.png\", Enemy::WIDTH, Enemy::HEIGHT)\n @portalAnimation = *Gosu::Image.load_tiles(\"media/portal.png\", Portal::WIDTH, Portal::HEIGHT)\n @diamondImg = Gosu::Image.new(\"media/diamond.png\")\n\n # Load all the stages in to an array\n @stages = Dir.glob('stages/*').select { |e| File.file? e }\n @finalStage = false\n end",
"def initialize\n @@availableModules = Array.new\n @@cleanAvailableModules = Array.new \n @@availableModules = `ls | grep Module`\n @@availableModules.each do |m|\n #removes \"Module.rb\" from availableModules array and put new values in clean array\n @@cleanAvailableModules.push(m.chomp.gsub(/Module.rb/,\"\").downcase)\n #removes empty values\n @@cleanAvailableModules.reject! {|e| e.empty?}\n end\n #import all mods\n end",
"def loader\n\t\t@loader ||= self.class.get_loader\n\tend",
"def initialize(*sources)\n @sources = sources\n\n @list = []\n\n sources.each do |source|\n if File.file?(source)\n parse(source)\n else\n # ignore directories\n end\n end\n end",
"def autoloader\n unless @autoloader\n # Patched autoloader whith 'loadall' searching recursivelly\n @autoloader = Puppet::Util::Autoload.new(\n self, \"puppet/macros\", :wrap => false\n )\n class << @autoloader\n def loadall\n self.class.loadall(File.join(@path,\"**\"))\n end\n def files_to_load\n self.class.files_to_load(File.join(@path,\"**\"))\n end\n unless instance_methods.include?(:expand) or instance_methods.include?('expand')\n # Fix for puppet 2.7, which does not have the Autoload.expand\n # method\n def expand(name)\n ::File.join(@path, name.to_s)\n end\n end\n end\n end\n @autoloader\n end",
"def initialize\n @formats = []\n end",
"def initialize\n @uploaders = []\n @downloaded_images = []\n end",
"def initialize(listeners)\n @inspectors = INSPECTORS.map do |inspector|\n inspector.new(listeners)\n end\n end",
"def initTypes\n raise NotImplementedError\n # local = new ArrayList<>();\n # localContext = new ArrayList<>();\n # dynamic = new ArrayList<>();\n #\n # for(int i=0; i<v.length; ++i) {\n # Extractor e = v[i];\n # if(e.isLocal() && e.isDynamic())\n # throw new RuntimeException(\"Extractors can't both be local and dynamic!\");\n # if(e.isLocal()) {\n # local.add(Pair.makePair(i,e));\n # //localContext.put(i,e);\n # } else if(e.isDynamic()) {\n # dynamic.add(Pair.makePair(i,e));\n # } else {\n # localContext.add(Pair.makePair(i,e));\n # }\n # }\n # if(DEBUG) {\n # log.info(\"Extractors: \"+this);\n # System.err.printf(\"Local: %d extractors\\n\",local.size());\n # System.err.printf(\"Local context: %d extractors\\n\",localContext.size());\n # System.err.printf(\"Dynamic: %d extractors\\n\",dynamic.size());\n # }\n end",
"def add_loader(ext, loader)\n ext = \".#{ext}\" unless ext =~ /^\\./\n @loaders[ext] = loader\n end",
"def initialize(queue = nil, *processors)\n @queues = {\n nil => queue || Pigeon::Queue.new\n }\n \n processors.flatten!\n \n @processors = processors.empty? ? [ Pigeon::Processor.new(@queues[nil]) ] : processors\n end",
"def initialize\n @templates = Array.new\n end",
"def initialize_exchange_rate_adapters\n @exchange_rate_adapters ||= []\n if self.exchange_rate_adapter_names.kind_of?(Array) && self.exchange_rate_adapter_names\n self.exchange_rate_adapter_names.each do |adapter|\n begin\n @exchange_rate_adapters << Straight::ExchangeRate.const_get(\"#{adapter}Adapter\").instance\n rescue NameError\n StraightServer.logger.warn \"No exchange rate adapter with the name #{adapter} was found!\"\n end\n end\n end\n end",
"def initialize\n\t\t@classes = Array.new\n\t\t# A set instead of the hashes would be a nicer choice, but \n\t\t# RubyToDot should not depend on any library to allow more complete graphs.\n\t\t@modules = Hash.new\n\t\t@ignored = Hash.new\n\t\t@ignored_tree = Hash.new\n\t\tset_defaults\n\tend",
"def initialize(name, processors)\n @name, @processors = name, []\n processors.each(&method(:<<))\n end",
"def initialize(env, processors, &block)\n @env, @processors = env, []\n chain(processors)\n instance_eval(&block) if block\n end",
"def provider_list\n @provider_list ||= subclasses.inject([]) do |list, klass_name|\n klass = klass_name.constantize\n begin\n list << klass.instance\n rescue LoadError => exc\n logger.error \"#{klass} load error: #{exc}\"\n end\n list\n end\n end",
"def _preload_assets_array(assets)\n assets.map do |type|\n paths = assets_paths(type)\n type = type[0] if type.is_a?(Array)\n as = TYPE_AS[type]\n\n paths.map{|path| [path, as]}\n end.flatten(1)\n end",
"def initPlayers(names) # (names : string[]) : void\n names.each do |k|\n @players << Player.new(k)\n end\n end",
"def initialize_plugins\n Hoe.plugins.each do |plugin|\n msg = \"initialize_#{plugin}\"\n warn msg if $DEBUG\n send msg if self.respond_to? msg\n end\n end",
"def extension_loader\n ExtensionLoader.instance { |l| l.initializer = self }\n end",
"def initialize\n @lists = []\n bootstrap\n populate\n end",
"def init\n return unless options.init\n\n Cnfs::Core.asset_names.each do |asset|\n klass = asset.classify.constantize\n klass.init(context) if klass.respond_to?(:init)\n end\n end",
"def internal_load_paths(paths)\n load_paths = []\n unless paths.is_a? Array\n paths = [paths]\n end\n \n paths.each do |path|\n expanded_path = File.expand_path(path)\n if File.exists?( expanded_path )\n @class_loader.addPath( expanded_path )\n \n load_paths << expanded_path\n end\n end\n \n load_paths\n end",
"def initialize\n\t\t\n\t\t\t# Initialize processed artists array\n\t\t\t@artists = []\n\t\tend",
"def initialize\n super\n self.plugins = []\n if configuration['plugin']\n configuration['plugin'].each do |config|\n plugin_class = config['class'].split('::').inject(Object) {|mod, string| mod.const_get(string)}\n self.plugins << plugin_class.new(self, config['parameters'])\n end\n end\n self.store = self.class.store\n end",
"def setup_jobs\n JobLoader.call\n end",
"def initialize\n TYPES.each do |type|\n transform_files!(Files.type_files(type), type)\n end\n end",
"def instantiate_definitions(program, loader)\n program.definitions.each { |d| instantiate_definition(d, loader) }\n nil\n end",
"def plugins\n\n\t\tif @plugins.length == 0\n\t\t\treturn []\n\t\tend\n\n\t\treturn @plugins\n\tend",
"def init_players\r\n markers = MARKERS.dup\r\n (1..NUM_PLAYERS).each do |player_num|\r\n player_type = multiple_choice(\"Choose player #{player_num} type\",\r\n 'h' => Human, 'c' => Computer)\r\n @players << player_type.new(markers.pop)\r\n end\r\n end",
"def init_players(names)\n \n \n @dealer = CardDealer.instance\n \n #Inicializamos el array de jugadores\n @players = Array.new\n \n #Recorremos los nombres pasados y creamos tantos jugadores como nombres\n names.each do |s|\n\n players << Player.new(s)\n\n end\n end",
"def define_loader(klass)\n self\n end",
"def initialize_modules\n # NOTE: this gets called after all the module initializers complete\n end",
"def initialize(extrs)\n # v = new Extractor[extrs.length];\n # System.arraycopy(extrs, 0, v, 0, extrs.length);\n @v = extrs.dup\n initTypes\n end",
"def initialize(modules_array)\n @name = name\n end",
"def init\n if @dir_path\n @gen = Resource[@dir_path].entries.to_enum\n else\n @gen = [].each\n end\n end",
"def instance_loader(type)\n @autoloaders[type.intern]\n end",
"def initialize\n @files = []\n end",
"def load_plugins\n self.class.plugins.each do |plugin|\n n = plugin.short_name\n\n plugin.features.each do |f|\n feature_all_sym = f.to_sym\n feature_this_sym = \"#{f}_#{n}\"\n unless respond_to?(feature_all_sym)\n define_singleton_method(feature_all_sym, plugin.feature_all(f))\n end\n unless respond_to?(feature_this_sym)\n define_singleton_method(feature_this_sym, plugin.feature_this(f, n))\n end\n end\n\n define_singleton_method(n, -> { @plugins[n] }) unless respond_to?(n)\n @plugins[n] = plugin.new(self)\n end\n 0\n end",
"def initialize_classes_and_modules\n @classes = {}\n @modules = {}\n end",
"def initialize_servers\n @protocols.each do |protocol, _|\n server = @servers[protocol.protocol]\n block = server[:start]\n server[:server].start(server[:port], @routes[protocol.protocol], views: @views, channel: @channels[protocol.protocol], debug: @debug, &block)\n end\n end",
"def loader\n @loader ||= self.respond_to?(:load) ? self : instantiate(self.class.get_loader)\n end",
"def initialize_plugins options={}, defaults: {}\n @plugins.each do |plugin_name, klass|\n next if not klass.plugin_settings(:skip_auto_initialization).nil? and klass.plugin_settings(:skip_auto_initialization)\n next if not klass.plugin_settings(:disabled).nil? and klass.plugin_settings(:disabled)\n\n if options[plugin_name].kind_of? Hash\n begin\n @plugin_instances[plugin_name] = klass.new(defaults.merge(options[plugin_name]))\n rescue ArgumentError => exc\n @log and @log.debug exc.message\n end\n else\n begin\n @plugin_instances[plugin_name] = klass.new(defaults)\n rescue ArgumentError => exc\n @log and @log.debug exc.message\n end\n end\n end\n end",
"def providers\n @providers ||= load_hash 'config/providers.yml'\n end",
"def probe_sets\n @probe_sets ||= Array.new\n end",
"def load_mediasets\n []\n end",
"def createLayers()\n @layers_array = import() \n end",
"def pre_processors\n @pre_processors ||= []\n end",
"def providers\n @providers ||= {}\n end",
"def init_train_types\n @train_types ||= @config.fetch('trains').map do |train|\n major_allowance, minor_allowance = train.fetch('type').split('+')\n TrainType.new(\n Integer(major_allowance),\n Money.new(train.fetch('face_value')),\n minor_station_allowance: minor_allowance\n )\n end\n end",
"def collect_loaded_features\n @loaded_features = []\n $LOADED_FEATURES.each {|file|\n $LOAD_PATH.each {|dir|\n file_path = File.join(dir, file)\n if File.identical?(file_path, @me)\n next\n end\n if File.file?(file_path)\n @loaded_features << file_path\n next\n end\n }\n }\n end",
"def load_factories\n absolute_factories_paths.each do |path|\n load_factories_if_file(path)\n load_factories_if_directory(path)\n end\n end"
]
| [
"0.7213359",
"0.6257221",
"0.606636",
"0.5897861",
"0.5824166",
"0.58073574",
"0.5804754",
"0.5773121",
"0.5763127",
"0.56880045",
"0.56823254",
"0.56823254",
"0.5667685",
"0.55950236",
"0.5583014",
"0.5579116",
"0.55786663",
"0.5545126",
"0.55282784",
"0.5521089",
"0.5457819",
"0.54567164",
"0.5440369",
"0.54364693",
"0.54350644",
"0.5431579",
"0.5420337",
"0.5411602",
"0.54110426",
"0.53774995",
"0.53762895",
"0.5372905",
"0.53572667",
"0.5323054",
"0.5318979",
"0.5299244",
"0.5294298",
"0.528545",
"0.5282372",
"0.5277167",
"0.527653",
"0.5254838",
"0.5251425",
"0.52374345",
"0.5223039",
"0.51977396",
"0.51966125",
"0.5193413",
"0.5176118",
"0.5173518",
"0.5159118",
"0.5155804",
"0.5140279",
"0.5132581",
"0.5127598",
"0.5120808",
"0.50960815",
"0.50880677",
"0.5083919",
"0.5082071",
"0.5081725",
"0.508164",
"0.5073456",
"0.5070098",
"0.5069565",
"0.5068921",
"0.50644374",
"0.5055629",
"0.5055017",
"0.504137",
"0.5037412",
"0.50360996",
"0.50283194",
"0.50200546",
"0.5014399",
"0.49972185",
"0.4992681",
"0.498434",
"0.49775776",
"0.49768034",
"0.49751765",
"0.49734327",
"0.4966324",
"0.4963094",
"0.49620116",
"0.49603254",
"0.495961",
"0.49584362",
"0.4956791",
"0.49562684",
"0.495362",
"0.49480313",
"0.49470803",
"0.49392033",
"0.49381772",
"0.4934517",
"0.49337873",
"0.49303275",
"0.49065986",
"0.49056876",
"0.48974124"
]
| 0.0 | -1 |
Whether any loaders are defined. | def empty?
@ordered.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loading?\n !load_stack.empty?\n end",
"def loadable?\n %w(test development).include?(Rails.env) || !loaded?\n end",
"def has_classes_or_modules?\n has_classes? || has_modules?\n end",
"def has_assets?\n assets.none?\n end",
"def has_includes?\n @context.includes.length > 0\n end",
"def loaded?\n !!@loaded\n end",
"def loaded?\n !!@loaded\n end",
"def has_included_resources?\n @has_included_resources ||= included_resources.any?\n end",
"def has_included_resources?\n !self.included_resources.empty?\n end",
"def loaded?\n [email protected]?\n end",
"def has_constants?\n @context.constants.length > 0\n end",
"def extensions_present?\n\t\treturn !self.extensions.empty?\n\tend",
"def instance_loading?(type)\n defined?(@autoloaders) and @autoloaders.include?(type.intern)\n end",
"def loaded?\n not @hash.nil?\n end",
"def loaded?\n not @hash.nil?\n end",
"def loaded?\n !!@loaded\n end",
"def has_assets?\n #FIXME: requires a unit test\n !all_related_data_files.empty? || !all_related_models.empty?\n end",
"def loaded?\n !!@loaded\n end",
"def conficts_when_loaded_with?(list_of_specs) # :nodoc:\n result = list_of_specs.any? do |spec|\n spec.dependencies.any? {|dep| dep.runtime? && (dep.name == name) && !satisfies_requirement?(dep) }\n end\n result\n end",
"def use_placeholder_loader?\n !self[:instance_specific] && !self[:eager_graph]\n end",
"def loaded?\n true\n end",
"def loaded?\n @loaded ||= false\n end",
"def engine_initialized?\n\t\t\t\t\tsuper && sass_functions_initialized?\n\t\t\t\tend",
"def load_from_classloader?\n !!@resource_prefix\n end",
"def dependencies_satisfied?\n missing_dependencies.empty?\n end",
"def autoload?\n !!@autoload\n end",
"def complete?\n not @extensions.empty?\n end",
"def extension_loaded?\n !!extension_loaded\n end",
"def extension_loaded?\n !!extension_loaded\n end",
"def all_bundled?\n remaining_flowers.zero?\n end",
"def has_modules?\n m = @context.modules.find{|m| m.document_self}\n m ? true : false\n end",
"def defined_any?\n cassette_records.size > 0\n end",
"def loaded?\n @loaded ||= false\n end",
"def loaded_correctly?\n !!@module\n end",
"def loaded_correctly?\n !!@module\n end",
"def is_chain_loaded?\n loaded = self.loader_status\n if loaded[\"success\"]\n return loaded[\"loaded\"]\n else\n return nil\n end\n end",
"def loaded?\n @loaded\n end",
"def loaded?\n @loaded\n end",
"def loaded?\n @loaded\n end",
"def loaded?\n @loaded\n end",
"def loaded?\n @loaded\n end",
"def loaded?\n @loaded\n end",
"def loaded?\n return @loaded\n end",
"def system_load_ok?\n true\n end",
"def recognized?\n return !self.etypes.empty?\n end",
"def section_classes_all_there?\n section_classes_to_check.all?(&:all_there?)\n end",
"def dependencies_resolved?\n !@resolved_dependencies.nil?\n end",
"def handlers?\n registered_handlers.length > 0\n end",
"def loaded?(name)\n plugins.any? { |plugin| plugin.name == name }\n end",
"def includes_definition?\n includes_arguments? || runnable? || argument_parsing_disabled? ||\n includes_modules? || includes_description?\n end",
"def loaded?\n !!self.loaded\n end",
"def defined?\n false\n end",
"def loaded?\n @loaded\n end",
"def loaded?\n @loaded\n end",
"def is_loaded\n\t\tend",
"def sections_classes_all_there?\n sections_classes_to_check.flatten.all?(&:all_there?)\n end",
"def dom_loaded?\n !@dom_loaded.empty?\n end",
"def unresolved_call?\n callees.include?(\"__any__\")\n end",
"def has_included_resources?\n # Check nill\n if @include_param.nil?\n has_included_resources_is_false_when_nil\n else\n check_has_included_resources_is_true_or_false_with_wildcard_and_non_params_or_both\n end\n\n end",
"def autoload?(p0) end",
"def autoload?(p0) end",
"def hooks?\n !before_hooks.empty? || !after_hooks.empty?\n end",
"def complete?\n [email protected]?\n end",
"def loaded?\n @images.size > 0\n end",
"def deps_satisfied?(deps)\n deps.each do |dep|\n if dep.to_s =~ /^no_(.*)$/\n return false if @used_legos.include?( $1 )\n else\n return false unless @used_legos.include?( dep.to_s )\n end\n end\n\n true\nend",
"def empty?\n @dispatchers.empty?\n end",
"def loaded?\n\t\treturn @entry ? true : false\n\tend",
"def loaders\n @loaders ||= profile.loaders\n end",
"def loaded? feature\n $LOADED_FEATURES.any? do |path|\n path =~ /^#{feature}#{SUFFIX_RE}$/\n end\n end",
"def autoload?\n\n return true unless defined? @autoload\n return @autoload \n\n end",
"def includes_modules?\n @includes_modules\n end",
"def available?\n @backends.present?\n end",
"def msf_loaded?\n return @msf_loaded unless @msf_loaded.nil?\n # if we get here we must not have initialized yet\n\n if client.framework\n # We have a framework instance so the msf libraries should be\n # available. Load up the ones we're going to use\n require 'msf/base/serializer/readable_text'\n end\n @msf_loaded = !!(client.framework)\n @msf_loaded\n end",
"def loaded?\n self.response_data.present?\n end",
"def dependencies_installed?(builder)\n warn_if_gif2webp_missing builder\n cwebp_installed? builder\n end",
"def should_load?\n test_framework? || trace_observer_configured?\n end",
"def loaded?(constant)\n return loaded.include?(constant)\n end",
"def browserified?\n data.to_s.include?(\"define.amd\") || data.to_s.include?(\"_dereq_\")\n end",
"def processings?\n @processings.any?\n end",
"def dep_defined?\n @dep_defined\n end",
"def gemspec?\n !gemspecs.empty?\n end",
"def satisfied?\n dependencies.none? { |_, v| v.empty? }\n end",
"def has_classes?\n c = @context.classes.find{|c| c.document_self}\n c ? true : false\n end",
"def missing_extensions?\n return false if extensions.empty?\n return false if default_gem?\n return false if File.exist? gem_build_complete_path\n\n true\n end",
"def has_resources?\n return resources.count > 0\n end",
"def exist?\n !render_lines.nil?\n end",
"def loaded?(resource)\n resource.instance_variable_defined?(instance_variable_name)\n end",
"def loaded?\n !!@collection\n end",
"def included?\n @_included\n end",
"def nil?\n @nil or (not @loaded and load.nil?)\n end",
"def incomplete_install?\n builtin_module_list = %w[aggregate canary puppetdb_fact secure_env_vars puppet_connect]\n (Dir.children(Bolt::Config::Modulepath::MODULES_PATH) - builtin_module_list).empty?\n end",
"def dependency_forward_any?\n forward_dependencies.any?\n end",
"def dependencies_satisfied?(klass)\n plugin_keys = klass.included_plugins.map { |plugin| Plugins.lookup_name(plugin) }\n (dependencies.keys - plugin_keys).none?\n end",
"def bootstrap_required?\n entry_point.nil?\n end",
"def has_middleware?\n [email protected]? && [email protected]?\n end",
"def defined?\n not undefined?\n end",
"def dependencies_met?\n @dependencies_met ||= command_dependencies_met?(command_options)\n end",
"def has_dependencies?\n update_for.length > 0 or requires.length > 0\n end",
"def has_pre_tasks?\n !@pre_tasks.empty?\n end",
"def hcp_services?\n !hcp_proc_codes.empty?\n end",
"def autoload\n false\n end"
]
| [
"0.70104516",
"0.6803148",
"0.67900383",
"0.6699241",
"0.6563936",
"0.6551992",
"0.6551992",
"0.6534312",
"0.6500152",
"0.6497048",
"0.6460796",
"0.64527583",
"0.6450757",
"0.64465064",
"0.64465064",
"0.64439017",
"0.64380276",
"0.6425917",
"0.6421785",
"0.64194757",
"0.6413004",
"0.6408314",
"0.6401923",
"0.6381643",
"0.6381138",
"0.6369815",
"0.63643575",
"0.635222",
"0.635222",
"0.63334507",
"0.6318455",
"0.6317758",
"0.63145435",
"0.62977505",
"0.62977505",
"0.626403",
"0.62564796",
"0.62564796",
"0.62564796",
"0.62564796",
"0.62564796",
"0.62564796",
"0.6235552",
"0.62321794",
"0.6216987",
"0.62012094",
"0.6185261",
"0.6184409",
"0.6172584",
"0.6166787",
"0.61623156",
"0.6151803",
"0.6150071",
"0.6150071",
"0.61296874",
"0.61241215",
"0.61132115",
"0.6112901",
"0.6109132",
"0.6105776",
"0.6105776",
"0.60927707",
"0.60880214",
"0.6072808",
"0.60584575",
"0.6054356",
"0.6037784",
"0.6006819",
"0.6005687",
"0.59993345",
"0.5997132",
"0.59801805",
"0.5935383",
"0.5932769",
"0.5932165",
"0.59227246",
"0.5918734",
"0.5916002",
"0.59100455",
"0.5907297",
"0.58972573",
"0.5891931",
"0.5891738",
"0.58917195",
"0.5888184",
"0.5883291",
"0.5879917",
"0.58621657",
"0.58483225",
"0.5831992",
"0.58311665",
"0.5817694",
"0.58160156",
"0.5810336",
"0.58084214",
"0.5797157",
"0.57906085",
"0.5784768",
"0.5773427",
"0.5753151",
"0.57506526"
]
| 0.0 | -1 |
Add loaders according to the current working directory and loaded gems. | def append_defaults(working_directory)
# Load recipes from working directory:
self.append_path(working_directory)
# Load recipes from loaded gems:
self.append_from_gems
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_loader(loader)\n @loaders << loader\n end",
"def add_loader(ext, loader)\n ext = \".#{ext}\" unless ext =~ /^\\./\n @loaders[ext] = loader\n end",
"def loaders\n @loaders ||= profile.loaders\n end",
"def loader_for_gem(root_file)\n loaders_managing_gems[root_file] ||= begin\n Loader.new.tap do |loader|\n loader.tag = File.basename(root_file, \".rb\")\n loader.inflector = GemInflector.new(root_file)\n loader.push_dir(File.dirname(root_file))\n end\n end\n end",
"def push_component_dirs_to_loader(system, loader)\n system.config.component_dirs.each do |dir|\n dir.namespaces.each do |ns|\n loader.push_dir(\n system.root.join(dir.path, ns.path.to_s),\n namespace: module_for_namespace(ns, system.config.inflector)\n )\n end\n end\n\n loader\n end",
"def autoloaders; end",
"def resolve_paths(loaders)\n mod_resolver = loaders.instance_variable_get(:@module_resolver)\n all_mods = mod_resolver.instance_variable_get(:@all_module_loaders)\n end",
"def load_gems_in(*spec_dirs); end",
"def load_plugins\n super\n extension_loader.load_extensions\n end",
"def eager_load_all\n Registry.loaders.each(&:eager_load)\n end",
"def load_imports\n while fn = @pending_imports.shift\n next if @imported.member?(fn)\n ext = File.extname(fn)\n loader = @loaders[ext] || @default_loader\n loader.load(fn)\n @imported << fn\n end\n end",
"def add_plugins_from_lookup_folders\n @plugin_lookup_folders.each do |folder|\n if File.directory?(folder)\n #TODO: add gem root to load path ? and require short folder ?\n #$LOAD_PATH.push(folder) if i[:add_path]\n Dir.entries(folder).select{|file|file.end_with?(RUBY_FILE_EXT)}.each do |source|\n add_plugin_info(File.join(folder,source))\n end\n end\n end\n end",
"def load_extensions\n # Load the init.rb file\n require root('init.rb') if File.exists?(root('init.rb'))\n\n # Load the gems in the config file\n @config.gems.each { |gem| require gem }\n\n # Load the extensions\n ext_roots = Dir[root(:extensions, '*')].select { |d| File.directory? d }\n ext_roots.each do |dir|\n ext = File.basename(dir)\n\n # Try extensions/name/name.rb\n # Try extensions/name/lib/name.rb\n ext_files = [\n File.join(dir, \"#{ext}.rb\"),\n File.join(dir, 'lib', \"#{ext}.rb\")\n ]\n ext_files.reject! { |f| not File.exists? f }\n require ext_files[0] if ext_files[0]\n end\n end",
"def load_plugins(add_dir = nil)\n plugins_path(add_dir).each do |plugin_search_path|\n Dir.glob(File.join(plugin_search_path, '**', '*.rb')).sort.each do |plugin|\n require plugin\n end\n end\n\n Gem.find_latest_files('doing-plugin-*', true).sort.each do |plugin|\n load plugin\n end\n\n # Gem.path.each do |path|\n # $LOAD_PATH.unshift path\n # Dir.glob(File.join(path, 'gems', 'doing-plugin-*', 'lib', '*.rb')).sort.each do |plugin|\n # require plugin.sub(%r{#{path}/gems/(.*?)-[\\d.]+$}, '\\1')\n # end\n # end\n\n plugins\n end",
"def autoloader\n unless @autoloader\n # Patched autoloader whith 'loadall' searching recursivelly\n @autoloader = Puppet::Util::Autoload.new(\n self, \"puppet/macros\", :wrap => false\n )\n class << @autoloader\n def loadall\n self.class.loadall(File.join(@path,\"**\"))\n end\n def files_to_load\n self.class.files_to_load(File.join(@path,\"**\"))\n end\n unless instance_methods.include?(:expand) or instance_methods.include?('expand')\n # Fix for puppet 2.7, which does not have the Autoload.expand\n # method\n def expand(name)\n ::File.join(@path, name.to_s)\n end\n end\n end\n end\n @autoloader\n end",
"def load_gemfiles(directories)\n directories.each do |directory|\n gemfile = File.expand_path(File.join(directory, 'Gemfile'))\n eval(File.read(gemfile), binding) if File.exist?(gemfile)\n end\nend",
"def load_libs\n loadQueue = []\n Pathname.glob './lib/*.rb' do |script|\n require script.to_s\n scriptfolder = Pathname.new(script.to_s.gsub('.rb', ''))\n next if not scriptfolder.directory?\n\n loadQueue += scriptfolder.children(true).find_all {|file| file.to_s[-3..-1] == '.rb'}\n end\n \n # load the children\n loadQueue.each {|file| require file.to_s }\n end",
"def load_gem_plugins; end",
"def load_plugins!\n # Scan plugins\n plugin_glob = File.join(File.dirname(__FILE__), 'plugins', '*.rb')\n Dir.glob(plugin_glob).each do |plugin|\n logger.debug(\"Loading file: #{plugin}\")\n require plugin\n end\n end",
"def lookup!\n $LOAD_PATH.each do |base|\n Dir[File.join(base, *file_lookup_paths)].each do |path|\n path = path.delete_prefix(\"#{base}/\")\n require path\n rescue Exception\n # No problem\n end\n end\n end",
"def initialize(parent_loader, loaders, module_name, path, loader_name, loadables)\n super(parent_loader, loader_name, loaders.environment)\n\n raise ArgumentError, 'path based loader cannot be instantiated without a path' if path.nil? || path.empty?\n\n @module_name = module_name\n @path = path\n @smart_paths = LoaderPaths::SmartPaths.new(self)\n @loaders = loaders\n @loadables = loadables\n unless (loadables - LOADABLE_KINDS).empty?\n #TRANSLATORS 'loadables' is a variable containing loadable modules and should not be translated\n raise ArgumentError, _('given loadables are not of supported loadable kind')\n end\n loaders.add_loader_by_name(self)\n end",
"def inject_into_load_path\n \n # Add ALL paths under the engine root to the load path\n %w(app/controllers \n app/helpers \n app/models\n components\n lib).collect { |dir|\n File.join(root, dir)\n }.select { |dir| File.directory?(dir) }.each do |path|\n insert_into_load_path(path) \n end\n end",
"def add_to_load_path\n Gem.source_index.load_gems_in(*Gem::SourceIndex.installed_spec_directories | [ruby_spec_path, arch_spec_path])\n end",
"def initialize(parent_loader, loaders, module_name, gem_ref, loader_name, loadables = LOADABLE_KINDS)\n @gem_ref = gem_ref\n super parent_loader, loaders, module_name, gem_dir(gem_ref), loader_name, loadables\n end",
"def for_gem\n called_from = caller_locations(1, 1).first.path\n Registry.loader_for_gem(called_from)\n end",
"def do_bundler_extending\n vputs \"[**:#{@name}] #do_bundler_extending: #{@libraries}\"\n\n if defined?(::Bundler)\n vputs \"[**:#{@name}] #do_bundler_extending: Libraries: #{@libraries}\"\n\n all_global_gem_paths = Dir.glob(\"#{Gem.dir}/gems/*\")\n\n all_global_gem_paths.each do |p|\n next unless @libraries.any? { |l| p.include?(l) }\n gem_path = \"#{p}/lib\"\n # rubocop:disable Metrics/LineLength\n vputs \"[**:#{@name}] #do_bundler_extending: Adding to $LOAD_PATH: #{gem_path}\"\n # rubocop:enable\n $LOAD_PATH.unshift(gem_path)\n end\n else\n vputs %([**:#{@name}] #do_bundler_extending: Bundler not defined. Skipping.)\n end\n end",
"def initialize(parent_loader, loaders, module_name, path, loader_name, loadables = LOADABLE_KINDS)\n super\n @path_index = Set.new\n end",
"def add_to_load_path #:nodoc:\n $LOAD_PATH.insert($LOAD_PATH.index(\"#{RAILS_ROOT}/lib\") + 1, *load_paths)\n end",
"def load_expander(ext_name)\n %w(models helpers).each do |targets|\n Chanko::Loader.directories.each do |directory|\n Pathname.glob(directory.join(\"#{ext_name}/#{targets}/*.rb\")).sort.each do |target|\n require_dependency \"#{target.dirname}/#{target.basename}\"\n end\n end\n end\n\n ext_name.to_s.camelize.constantize.tap do |ext|\n ext.expand!\n end\n end",
"def load_paths=(dirs)\n dirs.each do |dir|\n directory = File.expand_path(dir)\n $LOAD_PATH.unshift(directory) unless $LOAD_PATH.include?(directory)\n Dir[\"#{directory}/*.rb\"].each { |file| require file }\n end\n end",
"def add_plugin_load_paths\r\n plugins.each do |plugin|\r\n plugin.load_paths.each do |path|\r\n $LOAD_PATH.insert(application_lib_index + 1, path)\r\n\r\n ActiveSupport::Dependencies.load_paths << path\r\n\r\n unless configuration.reload_plugins?\r\n ActiveSupport::Dependencies.load_once_paths << path\r\n end\r\n end\r\n end\r\n\r\n $LOAD_PATH.uniq!\r\n end",
"def add_to_dependency_load_paths #:nodoc:\n Dependencies.load_paths.concat(load_paths)\n end",
"def add_plugin_load_paths\n configuration.add_plugin_paths(extension_loader.paths(:plugin))\n super\n ActiveSupport::Dependencies.autoload_once_paths -= extension_loader.paths(:load)\n end",
"def internal_load_paths(paths)\n load_paths = []\n unless paths.is_a? Array\n paths = [paths]\n end\n \n paths.each do |path|\n expanded_path = File.expand_path(path)\n if File.exists?( expanded_path )\n @class_loader.addPath( expanded_path )\n \n load_paths << expanded_path\n end\n end\n \n load_paths\n end",
"def load_helpers\n @helpers_loaded ||= helper_loader.load_helpers\n end",
"def add_self_to_load_path\n return if default_gem?\n\n paths = full_require_paths\n\n Gem.add_to_load_path(*paths)\n end",
"def load_gems_in(*spec_dirs)\n @gems.clear\n specs = Dir.glob File.join(\"{#{spec_dirs.join(',')}}\", \"*.gemspec\")\n specs.each do |file_name|\n gemspec = self.class.load_specification(file_name.untaint)\n add_spec(gemspec) if gemspec\n end\n self\n end",
"def load_all\n @internal_loader.load_all(self)\n end",
"def load_yard_gems(*gems)\n Loader.load_yard_gems(*gems)\n end",
"def add_gem_paths; end",
"def from_gems_in(*spec_dirs)\n self.new.load_gems_in(*spec_dirs)\n end",
"def load_dependencies\r\n @local_gems.each do |gem_info|\r\n gem_file_name = gem_info.gem_file\r\n gem_name = installed_as_name_for( short_form_of_gem_name( gem_file_name ) )\r\n @required_gem_names.delete gem_file_name\r\n end\r\n @required_gem_paths.each do |gem_path|\r\n gem_short_name = short_form_of_gem_name gem_path\r\n if @required_gem_names.include? gem_short_name\r\n puts \"installing #{gem_path}\"\r\n installer = @force_require ? PreloadingInstaller.new( gem_path, @local_gems ) : Installer.new( gem_path )\r\n installer.install\r\n end\r\n end\r\n end",
"def load_helpers\n load_glob File.join(File.dirname(__FILE__), 'helpers', '*.rb')\n end",
"def load_helpers\n paths = Dir.glob @site.helpers_path.join(\"**.rb\")\n HelperLoader.new(paths: paths).extend_instance(self)\n end",
"def configure_loader(loader, system)\n loader.tag = system.config.name || system.name unless loader.tag\n loader.inflector = CompatInflector.new(system.config)\n loader.logger = method(:puts) if debug\n end",
"def load!\n # We can load plugins from multiple locations to make organisation easier.\n # Each file should contain one or more subclasses of `Globot::Plugin::Base`\n # which, when loaded, will automatically register the class with this\n # class, meaning we have a collection of all available plugins.\n paths = Globot.config.for_plugin('loadpath') || File.join(%w{ lib globot plugins })\n paths.each do |path|\n Globot.logger.debug \"Loading plugins from #{path}\"\n Dir[File.expand_path(File.join(path, '*.rb'), Globot.basepath)].collect { |p| load p }\n end\n\n # Once we've loaded and registered all plugins, we activate them all by\n # creating a new instance of each one.\n activate\n end",
"def environment_loaders\n name = compiler.loaders.public_environment_loader.loader_name\n end",
"def environment_loaders\n name = compiler.loaders.public_environment_loader.loader_name\n end",
"def loadExt(*names)\n\t\tnames.each { |name|\n\t\t\[email protected](name)\n\t\t}\n\tend",
"def require(paths, opts={}, &block)\n if @reloader\n @reloader.require_dependencies(paths, opts, &block)\n else\n Unreloader.expand_directory_paths(paths).each{|f| super(f)}\n end\n end",
"def update_load_path\n require 'bundler'\n Bundler.setup\n end",
"def load_factories_if_directory(path)\n if File.directory?(path)\n Dir[File.join(path, '**', '*.rb')].sort.each { |file| Kernel.load file }\n end\n end",
"def load_gems\n @bundler_loaded ||= Bundler.require :default, Rails.env\n end",
"def find_files_for_reload\n paths = [ './', *$LOAD_PATH ].uniq\n [ $0, *$LOADED_FEATURES ].uniq.map do |file|\n next if file =~ /\\.(so|bundle)$/\n yield(find(file, paths))\n end\n end",
"def add_autoload_paths_to_load_path=(_arg0); end",
"def add_autoload_paths_to_load_path=(_arg0); end",
"def asigna_loader\n nombre_loader = self.class.name.demodulize.downcase\n self.loader = Soulmate::Loader.new(nombre_loader)\n Rails.logger.debug \"[DEBUG] - Loader: #{loader.inspect}\"\n end",
"def load #:nodoc:\n @found ||= {}\n @loaded ||= {}\n @files ||= Gem.find_files('cartage/*.rb')\n\n @files.reverse.each do |path|\n name = File.basename(path, '.rb').to_sym\n @found[name] = path\n end\n\n :repeat while @found.map { |name, plugin|\n load_plugin(name, plugin)\n }.any?\n end",
"def includes_load_paths; end",
"def create_loader(enabled_plugins)\n enabled_plugins = enabled_plugins.map do |p|\n if p.is_a?(Plugin)\n p\n else\n plugins.find {|plugin| p == plugin.module_name } or\n raise UnknownPluginError, p\n end\n end\n\n enabled_plugins.each do |p|\n log(\"activating #{p}\")\n p.activate!\n end\n\n log(\"enabled_plugins: #{enabled_plugins.inspect}\")\n\n Loader.new(enabled_plugins)\n end",
"def autoloader; end",
"def inject_dependencies\n add_to_load_path\n add_to_dependency_load_paths\n add_to_dependency_load_once_paths\n add_to_mixable_app_types\n end",
"def collect_loaded_features\n @loaded_features = []\n $LOADED_FEATURES.each {|file|\n $LOAD_PATH.each {|dir|\n file_path = File.join(dir, file)\n if File.identical?(file_path, @me)\n next\n end\n if File.file?(file_path)\n @loaded_features << file_path\n next\n end\n }\n }\n end",
"def load_plugins\n Gem.find_latest_files(\"pantry/init.rb\").each do |path|\n begin\n gem_path = path.gsub(\"#{Gem.dir}/gems/\", '')\n Pantry.logger.debug(\"Installing plugin from #{gem_path}\")\n require path\n rescue Exception => ex\n Pantry.logger.warn(\"Unable to load plugin at #{gem_path}, #{ex.message}\")\n end\n end\n end",
"def define_loader(klass)\n self\n end",
"def load_plugins\n root = plugins_root\n if root.exist?\n root.children.each do |plugin|\n init_rb = plugin + 'init.rb'\n next unless init_rb.exist?\n Kernel.require init_rb\n end\n end\n end",
"def add_lib_to_load_path! # :nodoc:\n [root.join('lib'), root.join('vendor', 'lib'), root.join('app', 'lib')].each do |path|\n $LOAD_PATH.unshift(path.to_s) if File.exist?(path) && !$LOAD_PATH.include?(path.to_s)\n end\n end",
"def loadall\n autoloader.loadall\n end",
"def load_plugins\n return unless plugin_prefix\n files_to_require = if Gem.respond_to? :find_latest_files\n Gem.find_latest_files(\"#{plugin_prefix}_plugin\")\n else\n Gem.find_files(\"#{plugin_prefix}_plugin\")\n end\n files_to_require.each { |path| require_plugin_path(path) }\n end",
"def loadplugins\n @plugins.each do |p|\n Angelia::Util.debug(\"loading plugin angelia/plugin/#{p.downcase}.rb and registering Angelia::Plugin::#{p}\")\n\n Kernel.load(\"angelia/plugin/#{p.downcase}.rb\")\n eval(\"Angelia::Plugin::#{p}.register\")\n end\n end",
"def load_extensions(*exts)\r\n exts.each do |ext|\r\n load file_name(ext)\r\n sym = ext_sym(ext)\r\n cfg = @extcfg != nil ? @extcfg[ext] : nil\r\n obj = Object.const_get(sym).new(cfg, @extdb, @server, @irc_proto, @fn_registrar, @botstate, @udb, @cdb)\r\n obj.ext_load if obj.respond_to?(:ext_load)\r\n @extensions[sym] = obj\r\n end\r\n end",
"def load_plugins; end",
"def add_autoload_paths_to_load_path; end",
"def add_autoload_paths_to_load_path; end",
"def load_lab_app_lib_files\n libFiles = File.dirname(__FILE__) + \"/../lib/*.rb\"\n Dir[libFiles].each do |file|\n fullpath = File.expand_path(file)\n puts \"Loading your file #{fullpath}\"\n require fullpath\n end\n end",
"def prepare_load_paths\n t = @target\n t = @target.parent unless @target.parent.nil?\n unless t.is_a?(Fetchers::Local)\n return # no need to mess with load-paths if this is not on disk\n end\n\n rel_dirs = (@libraries.keys + @tests.keys)\n .map { |x| File.dirname(x) }.uniq\n\n abs_dirs = rel_dirs.map { |x| @target.abs_path(x) }\n .find_all { |x| File.directory?(x) }\n .map { |x| File.expand_path(x) }\n\n abs_dirs.each do |dir|\n $LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir)\n end\n end",
"def add_plugin_paths(install_dir)\n Dir.glob(File.join([install_dir, '*'])).each do |mod|\n $LOAD_PATH << File.join([mod, 'lib'])\n end\n end",
"def load_providers()\n @cookbook_loader.each do |cookbook|\n cookbook.load_providers\n end\n true\n end",
"def ruby_can_load(*files)\n # Always include rubygems first\n files = files.unshift('rubygems').collect { |x| \"require '#{x}'\" }\n \n @commands << \"ruby -e \\\"#{files.join(';')}\\\"\"\n end",
"def load_minimal_gems\r\n end",
"def load!\n activate!\n\n @require_paths.each do |path|\n begin\n require path\n rescue LoadError => error\n log \"dm-visualizer: unable to load #{path}\"\n log \"dm-visualizer: #{error.message}\"\n end\n end\n\n @require_globs.each do |glob|\n @include_dirs.each do |dir|\n Dir[File.join(dir,glob)].each do |path|\n relative_path = path[(dir.length + 1)..-1]\n\n begin\n require relative_path\n rescue LoadError => error\n log \"dm-visualizer: unable to load #{relative_path} from #{dir}\"\n log \"dm-visualizer: #{error.message}\"\n end\n end\n end\n end\n\n deactivate!\n return true\n end",
"def load_imports\n while fn = @pending_imports.shift\n next if @imported.member?(fn)\n if fn_task = lookup(fn)\n fn_task.invoke\n end\n load!(fn)\n @imported << fn\n end\n end",
"def ruby_can_load(*files)\n # Always include rubygems first\n files = files.unshift('rubygems').collect { |x| \"require '#{x}'\" }\n \n @commands << \"ruby -e \\\"#{files.join(';')}\\\"\"\n end",
"def compile_libraries\n events.library_load_start(count_files_by_segment(:libraries))\n cookbook_order.each do |cookbook|\n eager_load_libraries = cookbook_collection[cookbook].metadata.eager_load_libraries\n if eager_load_libraries == true # actually true, not truthy\n load_libraries_from_cookbook(cookbook)\n else\n $LOAD_PATH.unshift File.expand_path(\"libraries\", cookbook_collection[cookbook].root_dir)\n if eager_load_libraries # we have a String or Array<String> and not false\n load_libraries_from_cookbook(cookbook, eager_load_libraries)\n end\n end\n end\n events.library_load_complete\n end",
"def load_required\n Dir[\"#{folder}/**/*.rb\"].each{|m|load m}\n end",
"def parse_modules!\n configuration.additional_modules.each do |additional_module|\n module_file = File.join(File.dirname(__FILE__), 'modules', additional_module.to_s, 'hooks.rb')\n if File.exist?(module_file)\n instance_eval(File.read(module_file))\n end\n end\n self\n end",
"def load_modules\n Dir[\"./plugins/**/lib/*.rb\"].each do |file| \n require file.split(\".rb\")[0]\n file_name = File.basename(file, \".rb\").split('_').collect(&:capitalize).join\n self.class.send(:include, Object.const_get(file_name))\n bixsby_print \"Loading Module #{file_name}\"\n end\n end",
"def load_plugins\n plugins(@config.subsystems).each do |plugin|\n @ohai.require_plugin(plugin, true)\n end\n end",
"def extension_loader\n ExtensionLoader.instance { |l| l.initializer = self }\n end",
"def append_from_gems\n\t\t\t::Gem.loaded_specs.each do |name, spec|\n\t\t\t\tConsole.logger.debug(self) {\"Checking gem #{name}: #{spec.full_gem_path}...\"}\n\t\t\t\t\n\t\t\t\tif path = spec.full_gem_path and File.directory?(path)\n\t\t\t\t\tappend_path(path, name: spec.full_name)\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def loader; end",
"def require_files\n @load_paths.each do |path|\n Dir[\"#{path}/**/*\"].each do |f|\n require f\n end\n end\n end",
"def compile_lwrps\n lwrp_file_count = count_files_by_segment(:providers) + count_files_by_segment(:resources)\n events.lwrp_load_start(lwrp_file_count)\n cookbook_order.each do |cookbook|\n load_lwrps_from_cookbook(cookbook)\n end\n events.lwrp_load_complete\n end",
"def define_loader_for(name)\n define_method(\"full_#{name}\") do\n if send(\"has_loaded_#{name}?\")\n instance_variable_get(\"@#{name}\")\n else\n instance_variable_set(\"@#{name}_load_state\", true)\n instance_variable_set(\"@#{name}\", load_associated(name))\n end\n end\n end",
"def loaders\n @loaders ||= LoggedChangeLoaders.new(session)\n end",
"def build_extensions # :nodoc:\n return if extensions.empty?\n return if default_gem?\n return if File.exist? gem_build_complete_path\n return if !File.writable?(base_dir)\n return if !File.exist?(File.join(base_dir, 'extensions'))\n\n begin\n # We need to require things in $LOAD_PATH without looking for the\n # extension we are about to build.\n unresolved_deps = Gem::Specification.unresolved_deps.dup\n Gem::Specification.unresolved_deps.clear\n\n require_relative 'config_file'\n require_relative 'ext'\n require_relative 'user_interaction'\n\n ui = Gem::SilentUI.new\n Gem::DefaultUserInteraction.use_ui ui do\n builder = Gem::Ext::Builder.new self\n builder.build_extensions\n end\n ensure\n ui.close if ui\n Gem::Specification.unresolved_deps.replace unresolved_deps\n end\n end",
"def load_files(path)\n Dir[path].each {|file| require file}\nend",
"def load_plugins\n @loaded ||= {}\n found = {}\n\n Gem.find_files(File.join(plugin_path, '*.rb')).sort!.reverse_each do |path|\n name = File.basename(path, '.rb').to_sym\n found[name] = path unless found.key? name\n end\n\n :keep_on_truckin while found.map { |name, path|\n next unless plugin_names.empty? or plugin_names.include? name\n next if disregard_plugins.include? name\n next if @loaded[name]\n begin\n @loaded[name] = load path\n rescue ScriptError, StandardError => err\n warn \"Error loading #{path.inspect}: #{err.message}. skipping...\"\n end\n }.any?\n end",
"def load\n @provider_dir = Path.provider\n\n # load base\n base_services = load_all_json(Path.named_path([:service_config, '*'], Path.provider_base))\n base_tags = load_all_json(Path.named_path([:tag_config, '*'], Path.provider_base))\n base_common = load_json(Path.named_path(:common_config, Path.provider_base))\n base_provider = load_json(Path.named_path(:provider_config, Path.provider_base))\n\n # load provider\n provider_path = Path.named_path(:provider_config, @provider_dir)\n common_path = Path.named_path(:common_config, @provider_dir)\n Util::assert_files_exist!(provider_path, common_path)\n @services = load_all_json(Path.named_path([:service_config, '*'], @provider_dir))\n @tags = load_all_json(Path.named_path([:tag_config, '*'], @provider_dir))\n @nodes = load_all_json(Path.named_path([:node_config, '*'], @provider_dir))\n @common = load_json(common_path)\n @provider = load_json(provider_path)\n @secrets = load_json(Path.named_path(:secrets_config, @provider_dir))\n\n # inherit\n @services.inherit_from! base_services\n @tags.inherit_from! base_tags\n @common.inherit_from! base_common\n @provider.inherit_from! base_provider\n @nodes.each do |name, node|\n @nodes[name] = apply_inheritance(node)\n end\n\n # validate\n validate_provider(@provider)\n end",
"def load_backends(path = MDS::DEFAULT_BACKEND_PATHS)\r\n Dir.glob(File.expand_path(path)) do |path|\r\n begin\r\n require path\r\n rescue LoadError\r\n end\r\n end\r\n end",
"def load framework\n framework = framework.downcase\n dir = File.join(@path, framework)\n if Dir.exists? dir\n Dir.glob(File.join(dir, '**/*.rb')).each do |mapping|\n require mapping.chomp! '.rb'\n end\n end\n end"
]
| [
"0.6958738",
"0.6769579",
"0.67014104",
"0.6690688",
"0.6512384",
"0.6338011",
"0.6273093",
"0.6265319",
"0.6259796",
"0.61743593",
"0.6166281",
"0.61078006",
"0.6106352",
"0.5996599",
"0.5953585",
"0.5948297",
"0.5878427",
"0.5869075",
"0.58575153",
"0.5810175",
"0.58043027",
"0.5801633",
"0.5766841",
"0.57401824",
"0.5680735",
"0.5678823",
"0.56708854",
"0.56627095",
"0.56537163",
"0.5653531",
"0.5644437",
"0.5619734",
"0.56149775",
"0.561339",
"0.56123424",
"0.55956686",
"0.55928206",
"0.5577784",
"0.5571648",
"0.55636597",
"0.5562239",
"0.5546623",
"0.55350786",
"0.55348694",
"0.5510341",
"0.54897726",
"0.54842466",
"0.54842466",
"0.54708105",
"0.5469188",
"0.5468577",
"0.54640627",
"0.54448354",
"0.5443391",
"0.54399586",
"0.54399586",
"0.5434073",
"0.543386",
"0.54337305",
"0.5429416",
"0.5427716",
"0.5419094",
"0.5418051",
"0.5415713",
"0.5413506",
"0.5404105",
"0.53983635",
"0.5397275",
"0.5372565",
"0.53695554",
"0.53579396",
"0.5353203",
"0.534983",
"0.534983",
"0.5348006",
"0.53456354",
"0.53419673",
"0.53317714",
"0.5322051",
"0.53082424",
"0.53010625",
"0.5288537",
"0.5274517",
"0.5263176",
"0.52567154",
"0.5250803",
"0.52406484",
"0.5240072",
"0.5239379",
"0.52354",
"0.523162",
"0.5228057",
"0.5225447",
"0.5221973",
"0.5219798",
"0.52186644",
"0.52170306",
"0.5191226",
"0.5180677",
"0.5178839",
"0.5173677"
]
| 0.0 | -1 |
Enumerate the loaders in order. | def each(&block)
@ordered.each(&block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eager_load_all\n Registry.loaders.each(&:eager_load)\n end",
"def loaders\n @loaders ||= profile.loaders\n end",
"def enumerate_available path\n trace :loading, \"Enumerating under #{path.inspect}\" do\n Loadable.new(path).\n enumerate.\n map do |filename|\n begin\n require(pathname = path+\"/\"+filename)\n trace :loading, \"Loaded #{pathname}\"\n filename\n rescue LoadError => e\n trace :loading, \"Can't load #{pathname}: #{e.class}: #{e.message} #{e.backtrace[0]}\"\n nil\n rescue Exception => e\n $stderr.puts \"Can't load #{pathname}: #{e.class}: #{e.message} #{e.backtrace[0]}\"\n nil\n end\n end.compact\n end\n end",
"def load_imports\n while fn = @pending_imports.shift\n next if @imported.member?(fn)\n ext = File.extname(fn)\n loader = @loaders[ext] || @default_loader\n loader.load(fn)\n @imported << fn\n end\n end",
"def names\n $LOAD_MANAGER.keys\n end",
"def each(ordering=:precidence_order, &block)\n engines = (ordering == :load_order) ? @active.reverse : @active\n engines.each { |e| yield e }\n end",
"def load_all\n @internal_loader.load_all(self)\n end",
"def each_module(opts = {}, &block)\n demand_load_modules\n\n self.mod_sorted = self.sort\n\n each_module_list(mod_sorted, opts, &block)\n end",
"def yaml_parts_in_loading_order\n ordered_yaml_parts = []\n @yaml_parts.each do |lang_file_dir, parts_in_this_dir|\n parts_in_this_dir.sort_by{|part| File.basename(part, '.yml').split('.').size}.each do |part|\n ordered_yaml_parts << File.join(lang_file_dir, part)\n end\n end\n ordered_yaml_parts\n end",
"def list\n @processors.keys\n end",
"def each_module_ranked(opts = {}, &block)\n demand_load_modules\n\n self.mod_ranked = rank_modules\n\n each_module_list(mod_ranked, opts, &block)\n end",
"def prioritized_handlers\n Enumerator.new do |yielder|\n priorities = (registered_handlers.keys | block_handlers.keys).sort!\n priorities.uniq!\n priorities.each do |priority|\n if registered_handlers.key?(priority)\n collected_handlers = registered_handlers[priority].to_a\n end\n if block_handlers.key?(priority)\n temp_handlers = block_handlers[priority].to_a\n if collected_handlers\n collected_handlers.concat(temp_handlers)\n else\n collected_handlers = temp_handlers\n end\n end\n collected_handlers.sort_by!(&:name)\n collected_handlers.uniq!\n collected_handlers.each { |handler| yielder << handler }\n end\n end\n end",
"def importer_names\n importers.map{|e| e.const_name }\n end",
"def all_dirs\n Registry.loaders.flat_map(&:dirs).freeze\n end",
"def run\n loader = nil\n results = []\n begin\n loader = InputLoader.new(File.new(@path))\n while(loader.hasNext?)\n inst = loader.nextInstance\n results[results.count] = resolve(inst)\n end\n ensure\n loader.close if loader != nil\n end\n results\n end",
"def list_names\n names = $LOAD_MANAGER.keys.sort\n if names.empty?\n puts \"No libraries found.\"\n else\n max = names.map{ |name| name.size }.max + 4\n rows = ((names.size + 4) / 4).to_i\n cols = []\n names.each_with_index do |name, i|\n c = i % rows\n cols[c] ||= []\n cols[c] << name\n end\n out = \"\"\n cols.each do |row|\n row.each do |name|\n out << (\"%-#{max}s\" % [name])\n end\n out << \"\\n\"\n end\n puts out\n end\n end",
"def environment_loaders\n name = compiler.loaders.public_environment_loader.loader_name\n end",
"def environment_loaders\n name = compiler.loaders.public_environment_loader.loader_name\n end",
"def render_all\n @data_loader.pages.each { |p| render_page p }\n @data_loader.multi_pages.each { |m| render_multi m }\n end",
"def loadall\n autoloader.loadall\n end",
"def assemblers\n @assemblers.map { |t| t.name } \n end",
"def initialize(parent_loader, loaders, module_name, path, loader_name, loadables = LOADABLE_KINDS)\n super\n @path_index = Set.new\n end",
"def load_libs\n loadQueue = []\n Pathname.glob './lib/*.rb' do |script|\n require script.to_s\n scriptfolder = Pathname.new(script.to_s.gsub('.rb', ''))\n next if not scriptfolder.directory?\n\n loadQueue += scriptfolder.children(true).find_all {|file| file.to_s[-3..-1] == '.rb'}\n end\n \n # load the children\n loadQueue.each {|file| require file.to_s }\n end",
"def load_imports\n while fn = @pending_imports.shift\n next if @imported.member?(fn)\n if fn_task = lookup(fn)\n fn_task.invoke\n end\n load!(fn)\n @imported << fn\n end\n end",
"def list\n interceptors_mutex do\n @registry.map { |h| h[:klass] }\n end\n end",
"def process_files\n loaded_files = []\n files.each do |file|\n Async do |task|\n task.async do\n loaded_files << load_file(file[:path], file[:source])\n end\n end\n end\n loaded_files\n end",
"def list_known_classes names = []\n classes = []\n\n stores.each do |store|\n classes << store.module_names\n end\n\n classes = classes.flatten.uniq.sort\n\n unless names.empty? then\n filter = Regexp.union names.map { |name| /^#{name}/ }\n\n classes = classes.grep filter\n end\n\n page do |io|\n if paging? or io.tty? then\n if names.empty? then\n io.puts \"Classes and Modules known to ri:\"\n else\n io.puts \"Classes and Modules starting with #{names.join ', '}:\"\n end\n io.puts\n end\n\n io.puts classes.join(\"\\n\")\n end\n end",
"def modules\n @registry.values\n .sort_by { |x| x.respond_to?(:priority) ? x.priority : 0 }\n .reverse\n end",
"def autoloaders; end",
"def libraries_order\n order = [:Ruby_]\n order.unshift(:Statistics2_) if has_statistics2?\n order.unshift(:GSL_) if has_gsl?\n order.unshift(:Java_) if has_java?\n order\n end",
"def resolve_paths(loaders)\n mod_resolver = loaders.instance_variable_get(:@module_resolver)\n all_mods = mod_resolver.instance_variable_get(:@all_module_loaders)\n end",
"def collect_loaded_features\n @loaded_features = []\n $LOADED_FEATURES.each {|file|\n $LOAD_PATH.each {|dir|\n file_path = File.join(dir, file)\n if File.identical?(file_path, @me)\n next\n end\n if File.file?(file_path)\n @loaded_features << file_path\n next\n end\n }\n }\n end",
"def terminus_classes(indirection_name)\n setup_instance_loading indirection_name\n instance_loader(indirection_name).files_to_load.map do |file|\n File.basename(file).chomp(\".rb\").intern\n end\n end",
"def load_order\n @cache_load_order = read_load_order unless defined?(@cache_load_order)\n @cache_load_order\n end",
"def loaders\n @loaders ||= LoggedChangeLoaders.new(session)\n end",
"def names\n fs = []\n %w( NUMA L4_CACHE L3_CACHE L2_CACHE L1_CACHE NEXT_PARTITIONABLE ).each { |f|\n fs.push(f) if self.include?( self.class.const_get(f) )\n }\n return fs\n end",
"def plugins\r\n @plugins ||= all_plugins.select { |plugin| should_load?(plugin) }.sort { |p1, p2| order_plugins(p1, p2) }\r\n end",
"def resources\n Loader.resources.keys\n end",
"def all\n load_paths.inject([]) do |all_scenarios, load_path|\n Dir[ File.join(load_path, '**', '*.rb') ].each do |found_scenario_file|\n all_scenarios << EolScenario.new(found_scenario_file)\n end\n all_scenarios\n end\n end",
"def each_module(opts = {}, &block)\n\t\tdemand_load_modules\n\n\t\tself.mod_sorted = self.sort if (mod_sorted == nil)\n\t\t\n\t\teach_module_list(mod_sorted, opts, &block)\n\tend",
"def each(&proc)\n @modules.each(&proc)\n end",
"def processors\n @@processors ||= @@processor_classes.collect {|processor| processor.instance}\n end",
"def force_load_set\n\t\teach_module { |name, mod|\n\t\t}\n\tend",
"def add_loader(loader)\n @loaders << loader\n end",
"def load_all\n load_cache\n\n module_names.each do |module_name|\n mod = find_class_or_module(module_name) || load_class(module_name)\n\n # load method documentation since the loaded class/module does not have\n # it\n loaded_methods = mod.method_list.map do |method|\n load_method module_name, method.full_name\n end\n\n mod.method_list.replace loaded_methods\n\n loaded_attributes = mod.attributes.map do |attribute|\n load_method module_name, attribute.full_name\n end\n\n mod.attributes.replace loaded_attributes\n end\n\n all_classes_and_modules.each do |mod|\n descendent_re = /^#{mod.full_name}::[^:]+$/\n\n module_names.each do |name|\n next unless name =~ descendent_re\n\n descendent = find_class_or_module name\n\n case descendent\n when RDoc::NormalClass then\n mod.classes_hash[name] = descendent\n when RDoc::NormalModule then\n mod.modules_hash[name] = descendent\n end\n end\n end\n\n @cache[:pages].each do |page_name|\n page = load_page page_name\n @files_hash[page_name] = page\n @text_files_hash[page_name] = page if page.text?\n end\n end",
"def parse_in_order(*files)\n global_state = OpenStruct.new\n\n return if before_parse_list_callbacks.any? do |cb|\n cb.call(files, global_state) == false\n end\n\n OrderedParser.new(global_state, files).parse\n\n after_parse_list_callbacks.each do |cb|\n cb.call(files, global_state)\n end\n end",
"def parse_in_order(*files); end",
"def process_mixins\n controller = @tracker.controllers[@current_class]\n\n controller[:includes].each do |i|\n mixin = @tracker.libs[i]\n\n next unless mixin\n\n #Process methods in alphabetical order for consistency\n methods = mixin[:public].keys.map { |n| n.to_s }.sort.map { |n| n.to_sym }\n\n methods.each do |name|\n #Need to process the method like it was in a controller in order\n #to get the renders set\n processor = Brakeman::ControllerProcessor.new(@app_tree, @tracker)\n method = mixin[:public][name][:src].deep_clone\n\n if node_type? method, :methdef\n method = processor.process_defn method\n else\n #Should be a methdef, but this will catch other cases\n method = processor.process method\n end\n\n #Then process it like any other method in the controller\n process method\n end\n end\n end",
"def load_all\n @leagues = @loader.load unless @loader.nil?\n end",
"def locate_plugins\r\n configuration.plugin_locators.map do |locator|\r\n locator.new(initializer).plugins\r\n end.flatten\r\n # TODO: sorting based on config.plugins\r\n end",
"def load_all; end",
"def load_all; end",
"def load_all; end",
"def third_party_processors\n self.class.constants - [:KramdownParser, :PRIORITIES]\n end",
"def each(&block)\n return super(&block) unless @lazy_loading && @processors.any?\n self.keys.each { |k| block.(k, self[k]) }\n end",
"def poller_threads\n @pollers.synchronize { @pollers.size }\n end",
"def ordered_recipes\n return @ordered_recipes if @ordered_recipes\n names = Bundler.load.dependencies.map(&:name)\n\n # Setup a hash with the recipe name and the recipe class\n recipe_pool = recipes.dup.inject({}) {|memo,recipe| memo[recipe.gem_name] = recipe ; memo }\n\n # Go through the gems in the order they are in the Gemfile, then\n # add them to the ordered list\n @ordered_recipes = []\n names.each do |name|\n if recipe_pool[name]\n @ordered_recipes << recipe_pool[name]\n recipe_pool.delete(name)\n end\n end\n\n # Add the remaining recipes (load them after everything else)\n @ordered_recipes += recipe_pool.values\n\n return @ordered_recipes\n end",
"def unprocessed_files\n Dir.glob(@data_location + '/*.jl').sort\n end",
"def each(*names)\n names.map do |name|\n if name.class == Module\n yield(name) if block_given?\n name\n elsif mod = get(name)\n yield(mod) if block_given?\n mod\n elsif try_require(name)\n redo\n else\n raise LoadError, \"Helper #{name} not found\"\n end\n end\n end",
"def get_sorted_module_list classes\n classes.select do |klass|\n klass.display?\n end.sort\n end",
"def each(&block)\n manifest_entry.sort.each(&block)\n self\n end",
"def parsers_for type\n raise TypeMissing, \"You need to specify a type\" unless type\n\n parsers = @@parsers.select do |parser,prio|\n parser::TYPES.include?(type) \n end\n\n parsers = parsers.sort_by do |parser,prio|\n prio\n end\n\n parsers.to_h.keys\n end",
"def objects\n @static_libraries.map { |l| l.path }\n end",
"def each_module_ranked(opts = {}, &block)\n\t\tdemand_load_modules\n\n\t\tself.mod_ranked = rank_modules if (mod_ranked == nil)\n\n\t\teach_module_list(mod_ranked, opts, &block)\n\tend",
"def each &blk\n return enum_for(:each) unless blk\n each_catalog_preset.map{|l,d|l}.each(&blk)\n items = objects_to_index.flatten.select { |e| !e.is_a?(CatalogPreset) }\n until items.empty?\n stack = []\n items.each do |o|\n yield o\n stack += Array(o.objects_to_index) if o.respond_to? :objects_to_index\n end\n items = stack.flatten\n end\n end",
"def line_order\n [:controller_files, :model_files, :view_files, :lib_files, :controller_specs, :model_specs, :view_specs]\n end",
"def compile_libraries\n events.library_load_start(count_files_by_segment(:libraries))\n cookbook_order.each do |cookbook|\n eager_load_libraries = cookbook_collection[cookbook].metadata.eager_load_libraries\n if eager_load_libraries == true # actually true, not truthy\n load_libraries_from_cookbook(cookbook)\n else\n $LOAD_PATH.unshift File.expand_path(\"libraries\", cookbook_collection[cookbook].root_dir)\n if eager_load_libraries # we have a String or Array<String> and not false\n load_libraries_from_cookbook(cookbook, eager_load_libraries)\n end\n end\n end\n events.library_load_complete\n end",
"def provider_list\n @provider_list ||= subclasses.inject([]) do |list, klass_name|\n klass = klass_name.constantize\n begin\n list << klass.instance\n rescue LoadError => exc\n logger.error \"#{klass} load error: #{exc}\"\n end\n list\n end\n end",
"def iterate &block\r\n threads = []\r\n @providers.each do |browser|\r\n threads << Thread.new do\r\n yield browser\r\n end\r\n end\r\n threads.each {|thread| thread.join}\r\n end",
"def each_catalog_preset list = self.catalog_presets, depth = 0, &blk # :yields: CatalogPreset, depth\n return enum_for(:each_catalog_preset, list, depth) unless blk\n list.each do |preset|\n yield preset, depth\n children = preset.catalog_presets\n each_catalog_preset(children, depth + 1, &blk) if children\n end\n end",
"def load_all_plugins\r\n # a nil value implies we don't care about plugins; load 'em all in a reliable order\r\n find_plugins(configuration.plugin_paths).sort.each { |path| load_plugin path }\r\n end",
"def scan_resources!\n @resources = @lookups[:_default] = {}\n @resource_arguments = {}\n \n @default_order = []\n Dir[@resource_class.glob].each do |path|\n @default_order << basename = File.basename(path)\n \n @resource_arguments[basename] = resource_arguments = @resource_class.scan_file(path)\n\n instantiate_resource!(basename,resource_arguments)\n end\n end",
"def loader_method_names\n [\"country\",\"aircrafttype\",\"terminal\",\"user\",\"airline\",\"currency\",\n \"airport\",\"flight\",\"account\",\"plane\",\"quantity\",\"string\"] \n end",
"def process!\n process_previews! if self.class.preview?\n\n versions.each do |name, blk|\n path = File.join(@dir, \"#{name}_#{@filename}\")\n process_version!(path, &blk)\n @paths << path\n end\n\n @paths\n end",
"def paralell_each(*enums, &blk)\n # Note that to implement a lazy iterator we'd need\n # external iterators which don't work in Rubinius, are\n # implemented differently in Ruby < 1.8.7 and are slow.\n # So, for the time being we generate an array and then\n # iterate it.\n if block_given?\n zip(*enums).each(&blk)\n else\n enum_for(:paralell_each, *enums)\n end\n end",
"def force_load_set\n each_module { |name, mod| }\n end",
"def load #:nodoc:\n @found ||= {}\n @loaded ||= {}\n @files ||= Gem.find_files('cartage/*.rb')\n\n @files.reverse.each do |path|\n name = File.basename(path, '.rb').to_sym\n @found[name] = path\n end\n\n :repeat while @found.map { |name, plugin|\n load_plugin(name, plugin)\n }.any?\n end",
"def loader; end",
"def available_components\n components = []\n @components.each_key do |k|\n components << k if @components[k].registered?\n end\n components\n end",
"def available_plugins(type: :export)\n type = valid_type(type)\n plugins[type].keys.sort\n end",
"def get_loader(name)\n @loaders.each do |loader|\n return loader if loader.name == name\n end\n end",
"def list_modules\n pal.list_modules\n end",
"def wp_plugin_enumerator(site=@site, verbose=true)\n @wp_paths.each do |p|\n plugins_dir = site.sub(/\\/$/, '') + p + '/wp-content/plugins/'\n res = @http.get(plugins_dir)\n if res[0] =~ /<title>Index of.+\\/wp-content\\/plugins<\\/title>|<h1>Index of.+\\/wp-content\\/plugins<\\/h1>/i\n p1 = res[0].scan(/href=\"(.+)\\/\">?[a-z]/)\n p2 = res[0].scan(/href=\"(.+)\\/\"> ?[a-z]/)\n plugs = p1 + p2\n bad=['docs', 'inc', 'include', 'includes', 'locales' ] # Defaults and/or useless for our purposes...\n plugins=[]\n plugs.each {|x| plugins << x unless plugins.include?(x) or bad.include?(x) } \n print_good(\"Plugins Directory Located: #{p}/wp-content/plugins/\") if verbose\n print_good(\"Plugins Found: \") if verbose\n if verbose\n plugins.each do |x|\n # Check and see if we can find out the specific plugin version info too\n res = @http.get(site.sub(/\\/$/, '') + p + \"/wp-content/plugins/#{x}/readme.txt\")\n if res[0] =~ /^Stable tag: (.+)\\s+/i\n print_line(\" #{x}, version: #{$1.strip.chomp}\")\n else\n print_line(\" #{x}\")\n end\n end\n end\n return plugins.uniq\n end\n end\n return nil \n end",
"def list_known_classes names = []\n classes = []\n stores.each do |store|\n classes << store.modules\n end\n classes = classes.flatten.uniq.sort\n unless names.empty? then\n filter = Regexp.union names.map { |name| /^#{name}/ }\n classes = classes.grep filter\n end\n puts classes.join(\"\\n\")\n end",
"def providers\n before = ObjectSpace.each_object(Class).to_a\n filter_dir_contents(read_dir_contents).each { |f| require f }\n after = ObjectSpace.each_object(Class).to_a\n classes = (after - before).select { |c| c <= ProviderStrategy }\n @strategies.concat(classes.map(&:new))\n end",
"def each_dependency_provider(&block)\r\n @dependencies.keys.each do |provider|\r\n block.call(provider, @dependencies[provider])\r\n end\r\n end",
"def each(options={}, &block)\n each_loadpath(&block)\n each_rubygems(&block)\n self\n end",
"def processors_in_use\n procs = []\n Dir.glob(\"/proc/*/stat\") do |filename|\n next if File.directory?(filename)\n this_proc = []\n File.open(filename) {|file| this_proc = file.gets.split.values_at(2,38)}\n procs << this_proc[1].to_i if this_proc[0] == \"R\"\n end\n procs.uniq.length\n end",
"def loaded_resources\n @_loaded_resources ||= []\n end",
"def after_read_processors\n @after_read_processors ||= []\n end",
"def dependency_order\n result = []\n disabled = {}\n predecessors = build_predecessors\n while disabled.size < @specs.size\n\tcandidate = @specs.find { |spec|\n\t ! disabled[spec.full_name] &&\n\t active_count(predecessors[spec.full_name], disabled) == 0\n\t}\n\tif candidate\n\t disabled[candidate.full_name] = true\n\t result << candidate\n\telsif candidate = @specs.find { |spec| ! disabled[spec.full_name] }\n\t # This case handles circular dependencies. Just choose a\n\t # candidate and move on.\n\t disabled[candidate.full_name] = true\n\t result << candidate\n\telse\n\t # We should never get here, but just in case we will terminate \n\t # the loop.\n\t break\n\tend\n end\n result\n end",
"def preload_test_ids\n result = run_in_fork do\n paths = []\n config.file_sets[\"all\"].each do |glob|\n paths.concat(Dir.glob(glob))\n end\n\n paths.each { |path| require File.expand_path(path) }\n\n require File.join(File.dirname(__FILE__), \"minitest_handler\")\n MiniTestHandler.preload_elements\n end\n\n config.cache_test_ids(result) unless result.nil?\n end",
"def sorted_interfaces\n process if @interfaces.nil?\n\n sorter.sort.map { |name|\n @interfaces.find { |i| i.name == name } or puts \"ignoring interface: #{name}\"\n }.compact\n end",
"def enumerate_dependencies\n raise DependencyEnumerationNotImplementedError\n end",
"def each_classmodule(&block) # :yields: module\n classes_and_modules.sort.each(&block)\n end",
"def each_classmodule(&block) # :yields: module\n classes_and_modules.sort.each(&block)\n end",
"def find_files_for_reload\n paths = [ './', *$LOAD_PATH ].uniq\n [ $0, *$LOADED_FEATURES ].uniq.map do |file|\n next if file =~ /\\.(so|bundle)$/\n yield(find(file, paths))\n end\n end",
"def each\n _registry.each do |name, s|\n yield name, s\n end\n end",
"def load_dependencies\n dependencies.each { |dependency| dependency }\n end",
"def process_dependencies(data)\n import_paths = data.scan(IMPORT_SCANNER).flatten.compact.uniq\n import_paths.each do |path|\n pathname = begin\n #TODO: use resolve to partialize paths\n context.resolve(path)\n rescue Sprockets::FileNotFound\n nil\n end\n \n unless pathname.nil? || passthrough?(pathname)\n # mark dependency in Sprockets context\n context.depend_on(path)\n # recurse for more dependencies\n process_dependencies File.read(pathname)\n end\n end\n end",
"def each_include # :yields: include\n @includes.each do |i| yield i end\n end"
]
| [
"0.6469344",
"0.63590944",
"0.5967607",
"0.5807772",
"0.5679374",
"0.55955046",
"0.55936867",
"0.55761826",
"0.5503",
"0.54998714",
"0.5471823",
"0.5432709",
"0.54241973",
"0.53220826",
"0.52880293",
"0.52799827",
"0.5246397",
"0.5246397",
"0.5221942",
"0.5210524",
"0.51706976",
"0.51608974",
"0.5137559",
"0.5128583",
"0.51053625",
"0.51028216",
"0.50967366",
"0.508347",
"0.5069287",
"0.50640863",
"0.5056041",
"0.50545806",
"0.50523597",
"0.5046799",
"0.5032185",
"0.50197685",
"0.50186867",
"0.50150424",
"0.50064933",
"0.4975552",
"0.49740928",
"0.49739116",
"0.4969397",
"0.49262446",
"0.4924154",
"0.49200514",
"0.49181342",
"0.4910018",
"0.49029586",
"0.49003088",
"0.4899826",
"0.4899826",
"0.4899826",
"0.48817396",
"0.4880696",
"0.4869363",
"0.48600852",
"0.48441523",
"0.4824933",
"0.4824791",
"0.4812032",
"0.47877064",
"0.47867468",
"0.4784027",
"0.47790205",
"0.47686628",
"0.47682887",
"0.47452056",
"0.47413257",
"0.47409585",
"0.4731479",
"0.47280777",
"0.47263673",
"0.4724194",
"0.4721922",
"0.4716583",
"0.4704718",
"0.46987665",
"0.46966943",
"0.46965176",
"0.4693575",
"0.46835446",
"0.46826816",
"0.46823353",
"0.46614853",
"0.46605593",
"0.46593803",
"0.46526855",
"0.46455878",
"0.46371898",
"0.4632132",
"0.46302596",
"0.46287802",
"0.46276128",
"0.4622857",
"0.4622857",
"0.46194312",
"0.4617437",
"0.46112707",
"0.46015668",
"0.45974565"
]
| 0.0 | -1 |
Append a specific project path to the search path for recipes. The computed path will have `bake` appended to it. | def append_path(current = Dir.pwd, **options)
bake_path = File.join(current, "bake")
if File.directory?(bake_path)
return insert(bake_path, **options)
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_path(path)\n @paths.push(File.expand_path(path, root))\n end",
"def append_path(path)\n mutate_config(:paths) do |paths|\n path = File.expand_path(path, root).dup.freeze\n paths.push(path)\n end\n end",
"def recipe_path(recipe_name, target_name=recipe_name, mode=0700)\r\n _package_.build_recipe(target_name, recipe_name, mode)\r\n target_path target_name\r\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 module_search_path(path)\n\t\t\[email protected]_import_path(path)\n\t\tend",
"def path_append(path)\n path_set(path_components + [File.expand_path(path)])\n end",
"def append_paths\n @append_paths ||= begin\n Wedge::Opal.append_path method(:assets_url).source_location.first.sub('/wedge.rb', '')\n Wedge::Opal.append_path \"#{Dir.pwd}/#{config.app_dir}\"\n end\n end",
"def add_to_project(path)\n root_group = find_test_group_containing(path)\n\n # Find or create the group to contain the path.\n dir_rel_path = path.relative_path_from(root_group.real_path).dirname\n group = root_group.find_subpath(dir_rel_path.to_s, true)\n\n mark_change_in_group(relative_path(group))\n\n file_ref = group.new_file(path.to_s)\n\n puts \" #{basename(file_ref)} - added\"\n return file_ref\n end",
"def append_to_path(path)\n @path+= path\n end",
"def append_paths\n @append_paths ||= begin\n file = method(:components).source_location.first.sub('/wedge.rb', '')\n Wedge::Opal.append_path file\n Wedge::Opal.append_path Dir.pwd\n end\n end",
"def append_paths\n @append_paths ||= begin\n Wedge::Opal.append_path method(:assets_url).source_location.first.sub('/wedge.rb', '')\n Wedge::Opal.append_path \"#{Dir.pwd}/#{config.app_dir}\"\n\n true\n end\n end",
"def add_gem_paths; end",
"def expand_path(path)\n if Rscons.phony_target?(path)\n path\n elsif path.is_a?(Array)\n path.map do |path|\n expand_path(path)\n end\n else\n path.sub(%r{^\\^\\^(?=[\\\\/])}, Rscons.application.build_dir).sub(%r{^\\^(?=[\\\\/])}, @build_root).gsub(\"\\\\\", \"/\")\n end\n end",
"def project_path( *relative_path )\n project_root.join( *relative_path )\n end",
"def append_path(path)\n @trail.append_path(path)\n end",
"def add_search_path(search_path, high_priority: false)\n paths = []\n if @config_file_name\n file_path = ::File.join(search_path, @config_file_name)\n paths << file_path if !::File.directory?(file_path) && ::File.readable?(file_path)\n end\n if @config_dir_name\n dir_path = ::File.join(search_path, @config_dir_name)\n paths << dir_path if ::File.directory?(dir_path) && ::File.readable?(dir_path)\n end\n @loader.add_path(paths, high_priority: high_priority)\n self\n end",
"def recipe_path(recipe, group = '')\n File.join File.dirname(__FILE__), 'recipes', group.to_s, \"#{recipe.to_s}.rb\" \n end",
"def append_paths(*paths)\n self.paths.push(*paths)\n end",
"def add_framework_search_paths(project, name)\n\n ['iOS', 'macOS'].each do |platform|\n [true, false].each do |isTest|\n \tt = target(project, name, platform, isTest)\n\n \t# Add carthage build dir to framework search paths\n t.build_configuration_list.set_setting(\n 'FRAMEWORK_SEARCH_PATHS', \n \"$(SRCROOT)/#{carthage_build_dir_for_platform(platform)}\"\n )\n\n if isTest\n # Add carthage build dir to runpath search paths\n case platform\n when 'iOS'\n t.build_configuration_list.set_setting(\n 'LD_RUNPATH_SEARCH_PATHS',\n \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(SRCROOT)/Carthage/Build/iOS\"\n )\n when 'macOS'\n t.build_configuration_list.set_setting(\n 'LD_RUNPATH_SEARCH_PATHS',\n \"$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks $(SRCROOT)/Carthage/Build/Mac\"\n )\n end\n end\n end\n end\nend",
"def append_path(path)\n @app.sitemap.rebuild_resource_list!(:sprockets_paths)\n\n super\n end",
"def recipe_dir\n @recipe_dir ||= File.join( Crate.project.recipe_dir, name )\n end",
"def add_path_to_git_exclude\n return if check_if_work_dir_excluded\n\n if File.exists? work_dir\n say_status(:quiet, 'FATAL', \"Directory #{work_dir(true).inspect} already exists. Aborting.\", :red)\n exit\n end\n File.open('.git/info/exclude', 'a') { |f| f.puts work_dir(true) }\n end",
"def MakeRelativeTo(path)\n if(path == nil)\n return self\n end\n \n #puts \"Making path relative, self: \" + self.to_s + \", path: \" + path.to_s \n \n originalPathParts = PathParts()\n pathParts = path.PathParts()\n \n #puts \"original parts: #{originalPathParts}\"\n #puts \"input parts: #{pathParts}\"\n \n #newPath = ProjectPath.new({base: path.AbsolutePath()})\n \n minPartsNumber = [originalPathParts.length, pathParts.length].min\n commonPartsNumber = 0\n \n for i in 0..minPartsNumber-1\n if(originalPathParts[i] != pathParts[i])\n break\n end\n commonPartsNumber += 1\n end\n \n #puts \"Common parts: #{commonPartsNumber}\"\n \n # the paths are basically the same, so we return the path \".\"\n if(commonPartsNumber == originalPathParts.length && commonPartsNumber == pathParts.length)\n return ProjectPath.new({\n base: path.AbsolutePath(),\n relative: \".\"\n })\n end\n\n upSwitchesNumber = pathParts.length - commonPartsNumber\n for i in commonPartsNumber-1..pathParts.length-1\n if(pathParts[i] == '.' or pathParts[i] == '..')\n upSwitchesNumber -= 1\n end\n end\n \n upSwitches = Array.new(upSwitchesNumber, \"..\")\n \n return ProjectPath.new({\n base: path.AbsolutePath(),\n relative: JoinPaths(upSwitches + originalPathParts[commonPartsNumber..-1])\n })\n end",
"def add_to_load_path\n Gem.source_index.load_gems_in(*Gem::SourceIndex.installed_spec_directories | [ruby_spec_path, arch_spec_path])\n end",
"def prepend_path(path)\n @paths.unshift(File.expand_path(path, root))\n end",
"def add_spec_to_project\n mkdir_p('doc')\n cp(\"../#{@spec_filename}\", 'doc')\n end",
"def project_path path, strict=true\n path_under 'root', path, strict\n end",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"jumpstart-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/sleekr/rails_kickstart.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{jumpstart/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"jumpstart-\"))\n at_exit {FileUtils.remove_entry(tempdir)}\n git clone: [\n \"--quiet\",\n PROJECT_REPO,\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{jumpstart/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) {git checkout: branch}\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def add_template_repository_to_source_path\n source_paths.unshift(File.dirname(__FILE__))\nend",
"def project_root\n this_file_path.ascend do |p|\n rakefile = p.join( 'Rakefile' )\n return p if rakefile.exist?\n end\n end",
"def find_repository_and_basepath\n # zuerst lesen wir den Startpfad aus der Datei ein\n unless File.exists?(PATH_TMP_FILE) and (@basepath=IO.read(PATH_TMP_FILE).strip)\n NSRunInformationalAlertPanel('Invalid start directory!',\n \"No directory information could be found in the configuration file '#{PATH_TMP_FILE}'!\",\n 'OK',nil,nil)\n NSApp.stop(self)\n end\n\n # jetzt gehen wir max. 5 Ebenen nach oben und suchen\n # nach einem Rakefile im Verzeichnis\n path=@basepath\n (0..5).each do |step|\n Dir.entries(path).each do |entry|\n return path if entry=~/^(.git|.hg)$/\n end\n path+=\"/..\"\n end\n\n # no reasonable rakefile was found, let's just use\n # the current directory for the files\n @basepath # Dir.pwd\n end",
"def stage_install_paths(stage)\n select_existing_paths = proc do |cookbook_path, paths|\n paths.select {|from, _| cookbook_path.join(from).exist?}\n end\n\n common_paths = [['metadata.json', 'metadata.json']]\n\n Dir[vendor_path.join('*')]\n .map(&Pathname.method(:new))\n .map do |cookbook_path|\n cookbook_name = File.basename cookbook_path\n is_builder = (cookbook_name == name)\n is_dimod = cookbook_name.start_with? 'dimod-'\n dimod_enabled = is_dimod && enabled_modules.include?(cookbook_name)\n\n paths = if is_builder\n common_dapp_paths = select_existing_paths.call(\n cookbook_path,\n [\n *common_paths,\n [\"files/#{stage}/common\", 'files/default'],\n [\"templates/#{stage}/common\", 'templates/default'],\n *enabled_recipes.flat_map do |recipe|\n [[\"files/#{stage}/#{recipe}\", 'files/default'],\n [\"templates/#{stage}/#{recipe}\", 'templates/default']]\n end\n ]\n )\n\n recipe_paths = enabled_recipes\n .map {|recipe| [\"recipes/#{stage}/#{recipe}.rb\", \"recipes/#{recipe}.rb\"]}\n .select {|from, _| cookbook_path.join(from).exist?}\n\n if recipe_paths.any?\n [*recipe_paths, *common_dapp_paths]\n else\n [nil, *common_dapp_paths]\n end\n elsif is_dimod && dimod_enabled\n common_dimod_paths = select_existing_paths.call(\n cookbook_path,\n [\n *common_paths,\n [\"files/#{stage}\", 'files/default'],\n ['files/common', 'files/default'],\n [\"templates/#{stage}\", 'templates/default'],\n ['templates/common', 'templates/default'],\n [\"attributes/#{stage}.rb\", \"attributes/#{stage}.rb\"],\n ['attributes/common.rb', 'attributes/common.rb']\n ]\n )\n\n recipe_path = \"recipes/#{stage}.rb\"\n if cookbook_path.join(recipe_path).exist?\n [[recipe_path, recipe_path], *common_dimod_paths]\n else\n [nil, *common_dimod_paths]\n end\n elsif !is_dimod\n [['.', '.']]\n end\n\n [cookbook_path, paths] if paths && paths.any?\n end.compact\n end",
"def set_carthage_framework_search_paths_for_target(target, platform)\n target.build_configuration_list.set_setting(\n 'FRAMEWORK_SEARCH_PATHS', \"$(SRCROOT)/Carthage/Build/#{platform}\"\n )\nend",
"def append_header_search_path(target, *paths)\n setting = 'HEADER_SEARCH_PATHS'\n target.build_configurations.each do |config|\n config.build_settings[setting] ||= '$(inherited)'\n paths.each do |path|\n config.build_settings[setting] << ' '\n config.build_settings[setting] << path\n end\n end\nend",
"def add_load_path(path)\n full_path = \"#{ENV['HOME']}/.gem/#{path}\"\n\n if File.exists?(full_path)\n $: << full_path\n else\n raise(\"load path missing: #{full_path} (maybe you forgot to bundle?)\")\n end\nend",
"def add_template_repository_to_source_path\n if __FILE__.match? %r{\\Ahttps?://}\n require 'tmpdir'\n tempdir = Dir.mktmpdir 'jumpstart-'\n source_paths.unshift tempdir\n at_exit { FileUtils.remove_entry tempdir }\n git(clone: [\n '--quiet',\n 'https://github.com/cj/jumpstart.git',\n tempdir,\n ].map(&:shellescape).join(' '))\n\n if (branch = __FILE__[%r{jumpstart/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift File.dirname(__FILE__)\n end\nend",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"jumpstarter-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/whatapalaver/jumpstarter.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{jumpstarter/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def test_can_add_paths_to_library_path\n Crd::Spec.new 'Testing' do |s|\n s.library_path << 'test/fixtures'\n assert_equal( [ 'test/fixtures' ], s.library_path )\n end\n end",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require 'tmpdir'\n\n source_paths.unshift(tempdir = Dir.mktmpdir(DIR_NAME + '-'))\n at_exit { FileUtils.remove_entry(tempdir) }\n run(\"git clone --quiet #{GITHUB_PATH.shellescape} #{tempdir.shellescape}\")\n\n if (branch = __FILE__[%r{#{DIR_NAME}/(.+)/bridgetown.automation.rb}, 1])\n Dir.chdir(tempdir) { system(\"git checkout #{branch}\") }\n @current_dir = File.expand_path(tempdir)\n end\n else\n source_paths.unshift(DIR_NAME)\n end\nend",
"def add_template_repository_to_source_path\n template_dir =\n if __FILE__ =~ %r{\\Ahttps?://}\n clone_repo\n else\n File.dirname(__FILE__)\n end\n\n source_paths.unshift(template_dir)\n puts \"*** source_paths: (#{source_paths.join(\" \")})\"\n puts \"*** template_dir: (#{template_dir})\"\n template_dir\nend",
"def add_template_repository_to_source_path\n template_dir =\n if __FILE__ =~ %r{\\Ahttps?://}\n clone_repo\n else\n File.dirname(__FILE__)\n end\n\n source_paths.unshift(template_dir)\n puts \"*** source_paths: (#{source_paths.join(\" \")})\"\n puts \"*** template_dir: (#{template_dir})\"\n template_dir\nend",
"def add_path(path)\n @tree.add_path(path)\n self\n end",
"def append_path(*paths)\n @load_paths.push(*(paths.flatten))\n end",
"def addPath(path)\r\n\t\tif @paths.nil?\r\n\t\t\t@paths = [path]\r\n\t\telse\r\n\t\t\t@paths << path\r\n\t\tend\r\n\tend",
"def add_gem_paths\n require 'rubygems'\n gem_paths = []\n YARD::GemIndex.each do |spec|\n yfile = Registry.yardoc_file_for_gem(spec.name)\n next if yfile.nil?\n\n if spec.name =~ /^yard-doc-/\n gem_paths.unshift(yfile)\n else\n gem_paths.push(yfile)\n end\n end\n @search_paths += gem_paths\n rescue LoadError\n nil # noop\n end",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n tempdir = Dir.mktmpdir(\"template-tmp\")\n source_paths.unshift(tempdir + \"/rails/muffi_template\")\n at_exit {FileUtils.remove_entry(tempdir)}\n git clone: [\n \"--quiet\",\n \"https://github.com/abtion/guidelines.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"jumpstart-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/sikandartariq1/jumpstart.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{jumpstart/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def target_recipe_path\n key = Digest::MD5.hexdigest(config.recipe)\n File.join(config.upload_path, \"recipe-#{key}.rb\")\n end",
"def ruby_path\n File.join(%w(bindir RUBY_INSTALL_NAME).map{|k| RbConfig::CONFIG[k]})\n end",
"def ruby_path\n ext = ((RbConfig::CONFIG['ruby_install_name'] =~ /\\.(com|cmd|exe|bat|rb|sh)$/) ? \"\" : RbConfig::CONFIG['EXEEXT'])\n File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'] + ext).sub(/.*\\s.*/m, '\"\\&\"')\n end",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n source_paths.unshift(tempdir = Dir.mktmpdir(\"rails-app-template-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git :clone => [\n \"--quiet\",\n \"https://github.com/andersklenke/rails-app-template.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def install_path(val = NULL_ARG)\n unless val.equal?(NULL_ARG)\n @install_path = windows_safe_path(val)\n end\n @install_path || raise(MissingProjectConfiguration.new('install_path', '/opt/chef'))\n end",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require 'tmpdir'\n source_paths.unshift(temp_dir = Dir.mktmpdir('jumpstart-'))\n at_exit { FileUtils.remove_entry(temp_dir) }\n git clone: [\n '--quiet',\n 'https://github.com/drgcms/drg-portal-jumpstart.git',\n temp_dir\n ].map(&:shellescape).join(' ')\n\n if (branch = __FILE__[%r{jumpstart/(.+)/template.rb}, 1])\n Dir.chdir(temp_dir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require 'tmpdir'\n source_paths.unshift(tempdir = Dir.mktmpdir('herewego-'))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n '--quiet',\n 'https://github.com/Sanchezdav/herewego.git',\n tempdir\n ].map(&:shellescape).join(' ')\n\n if (branch = __FILE__[%r{herewego/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def expand_path(path)\n File.expand_path(\n path.gsub(\n 'CLIPPDIR', CLIPPDIR\n ).gsub(\n 'BUILDDIR', BUILDDIR\n )\n )\n end",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"vine-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/bmartel/vine.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{vine/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def prepend_path(path)\n mutate_config(:paths) do |paths|\n path = File.expand_path(path, root).dup.freeze\n paths.unshift(path)\n end\n end",
"def append(*paths)\n paths.each do |path|\n @paths << path.to_s\n end\n\n self\n end",
"def add_hardcoded_gem(path)\n # make sure gem dir has a gemspec\n gemspec = File.join path, File.basename(path) + '.gemspec'\n return unless File.exists? gemspec\n # make sure gem dir has a lib dir\n libpath = File.join path, 'lib'\n return unless File.exists? libpath\n # all is ok, so add to loadpath\n @paths << libpath\n end",
"def add_template_repository_to_source_path\n if __FILE__.match?(%r{\\Ahttps?://})\n require 'shellwords'\n require 'tmpdir'\n\n source_paths.unshift(temp_dir = Dir.mktmpdir('jt_tools-'))\n at_exit { FileUtils.remove_entry(temp_dir) }\n git clone: [\n '--quiet',\n 'https://github.com/jetthoughts/jt_tools.git',\n temp_dir\n ].map { |args| Shellwords.escape(args) }\n .join(' ')\n\n if (branch = __FILE__[%r{jt_tools/(.+)/template.rb}, 1])\n Dir.chdir(temp_dir) { git checkout: branch }\n end\n else\n source_paths.unshift(__dir__)\n end\nend",
"def setup_projects\n recipes.each do |rec_obj|\n rec_obj.setup_projects\n end\n end",
"def build_path\n @build_path ||= \"#{@ant_path}/#{@config[:build_name]}\"\n end",
"def test_can_add_paths_to_source_path\n Crd::Spec.new 'Testing' do |s|\n s.source_path << 'test/fixtures'\n assert_equal( [ 'test/fixtures' ], s.source_path )\n end\n end",
"def update(rubyOF_project=nil)\n\t\t# If you invoke with no arguments, provide useful help,\n\t\t# rather than the standard error message.\n\t\tif rubyOF_project.nil?\n\t\t\traise ArgumentError, \"<1 argument>: Need to specify project name, or relative path (relative to [GEM_ROOT]/bin/projects), or absolute path to project. Project must already exist in order to update it.\"\n\t\tend\n\t\t\n\t\t\n\t\tname, path = RubyOF::Build.load_project rubyOF_project\n\t\t\n\t\t# TODO: remove this once everything is updated to use Pathname\n\t\tproject_root = Pathname.new(path).expand_path\n\t\tgem_root = Pathname.new(GEM_ROOT)\n\t\t\n\t\tputs \"gem_root = #{gem_root}\"\n\t\tputs \"project_root = #{project_root}\"\n\t\t\n\t\t# === Update files where GEM_ROOT is declared.\n\t\ttarget_file = 'build_variables.rb'\n\t\t\n\t\t[\n\t\t\t(project_root/'config'/'build_variables.rb'),\n\t\t\t(project_root/'Gemfile')\n\t\t].each do |path|\n\t\t\t# Declare the new GEM_ROOT path\n\t\t\t# (use relative paths for projects inside the gem)\n\t\t\tpath_to_root = \n\t\t\t\tif path.to_s.start_with? gem_root.to_s\n\t\t\t\t\t# Relative path\n\t\t\t\t\t# (project is inside the default directory)\n\t\t\t\t\tgem_root.relative_path_from(path.dirname)\n\t\t\t\telse\n\t\t\t\t\t# Absolute path\n\t\t\t\t\t# (project is outside of the default directory)\n\t\t\t\t\tgem_root\n\t\t\t\tend\n\t\t\t\n\t\t\tputs path_to_root\n\t\t\t\n\t\t\t# Load the file\n\t\t\tunless path.exist?\n\t\t\t\traise \"ERROR: Could not find '#{path.basename}' @ path #{path}\"\n\t\t\tend\n\t\t\tfile_lines = File.readlines(path)\n\t\t\t# p file_lines\n\t\t\t\n\t\t\t# Find the line that sets GEM_ROOT\n\t\t\t# and replace it with the new declaration\n\t\t\tfile_lines.collect! do |line|\n\t\t\t\tif line.start_with? 'GEM_ROOT = '\n\t\t\t\t\t\"GEM_ROOT = Pathname.new('#{path_to_root}').expand_path\\n\"\n\t\t\t\telse\n\t\t\t\t\tline\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\t# Write the modified contents back into the file\n\t\t\tFile.open(path, \"w\") do |f|\n\t\t\t\tf.write file_lines.join\n\t\t\tend\n\t\tend\n\t\t\n\tend",
"def make_relative(path)\n Warp::Dir.relative(path)\n end",
"def add_rakefiles(*rakefiles)\n @rakefiles ||= ['merb-core/test/tasks/spectasks']\n @rakefiles += rakefiles\n end",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"siderail-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n YARG_REPO,\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{siderail/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def makePath\n\t\t\tbuildMgr.effective(filename).dirname.mkpath\n\t\tend",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require 'tmpdir'\n require 'fileutils'\n require 'shellwords'\n source_paths.unshift(tempdir = Dir.mktmpdir('rails-template-'))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n '--quiet',\n 'https://github.com/shota-yamashita/rails-template.git',\n tempdir\n ].map(&:shellescape).join(' ')\n\n if (branch = __FILE__[%r{rails-template/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def append_path(path)\n expire_index!\n @trail.append_path(path)\n end",
"def update_cookbook_path\n # both cookbook sequences and paths are listed in same order as\n # presented in repo UI. previous to RL v5.7 we received cookbook sequences\n # in an arbitrary order, but this has been fixed as of the release of v5.8\n # (we will not change the order for v5.7-).\n # for chef to execute repos and paths in the order listed, both of these\n # ordered lists need to be inserted in reverse order because the chef code\n # replaces cookbook paths as it reads the array from beginning to end.\n @cookbooks.reverse.each do |cookbook_sequence|\n local_basedir = File.join(@download_path, cookbook_sequence.hash)\n cookbook_sequence.paths.reverse.each do |path|\n dir = File.expand_path(File.join(local_basedir, path))\n unless Chef::Config[:cookbook_path].include?(dir)\n if File.directory?(dir)\n Chef::Config[:cookbook_path] << dir\n else\n RightScale::Log.info(\"Excluding #{path} from chef cookbooks_path because it was not downloaded\")\n end\n end\n end\n end\n RightScale::Log.info(\"Updated cookbook_path to: #{Chef::Config[:cookbook_path].join(\", \")}\")\n true\n end",
"def add_import_path(current_string, builder_mode)\n adjusted_import_path = if @import_path.present?\n path_has_leading_slash = @import_path[0] == '/'\n log_hint(BuilderHints::IMPORT_PATH_LEADING) if path_has_leading_slash\n builder_mode == BuilderMode::EXECUTE && path_has_leading_slash ? @import_path[1..-1] : @import_path\n else\n @import_path\n end\n add_if_present(@import_path, current_string, \" -import-path '#{adjusted_import_path}' \")\n end",
"def add_template_repo_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"springer-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/troyizzle/springer.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{springer/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"rails-template-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/RYLabs/rails-devcontainer-template.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{rails-devcontainer-template/(.+)/rails-postgres.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def project_dir\n File.expand_path(\"#{fetch_dir}/#{relative_path}\")\n end",
"def build_erb_path\n @build_erb_path ||= \"#{ANT_TEMPLATE_FILEPATH}/#{ANT_BUILD_ERBNAME}\"\n end",
"def runWithModifiedPath(new_path_entries, prependPath = false)\n new_path_entries = [new_path_entries] unless new_path_entries.is_a?(Array)\n\n old_path = ENV['PATH']\n\n onError 'Failed to get env path' if old_path.nil?\n\n separator = if OS.windows?\n ';'\n else\n ':'\n end\n\n newpath = if prependPath\n new_path_entries.join(separator) + separator + old_path\n else\n old_path + separator + new_path_entries.join(separator)\n end\n\n info \"Setting path to: #{newpath}\"\n ENV['PATH'] = newpath\n\n begin\n yield\n ensure\n info 'Restored old path'\n ENV['PATH'] = old_path\n end\nend",
"def add_input_path_to_script_phase(script_phase, name, platform)\n input_path = \"$(SRCROOT)/#{make_carthage_build_path(name, platform)}\"\n script_phase.input_paths << input_path\nend",
"def libraryPath(sourcePath)\n\t'../evothings-libraries/' + sourcePath\nend",
"def add(label, path, options={})\n if path.is_a?(Array)\n path.each{|p| add label, p, options} \n else\n repository_class = options[:class] || Qwandry::FlatRepository\n label = label.to_s\n @repositories[label] << repository_class.new(label, File.expand_path(path), options)\n end\n end",
"def ruby_relative_path\n ruby_pathname = Pathname.new(ruby)\n bindir_pathname = Pathname.new(target_bin_dir)\n ruby_pathname.relative_path_from(bindir_pathname).to_s\n end",
"def cp_gitignore\n system \"cp -fv ~/code/tmpl/gitignore-gem .gitignore\"\n end",
"def cp_gitignore\n system \"cp -fv ~/code/tmpl/gitignore-gem .gitignore\"\n end",
"def within_build_path(&block)\n Dir.chdir app.config.build_dir do\n yield\n end\n end",
"def install\n mkdir \"build\" do\n system \"cmake\", \"-DSPECIFY_RPATH=ON\", *std_cmake_args, \"..\"\n system \"make\"\n system \"make\", \"install\"\n end\n end",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n source_paths.unshift(tempdir = Dir.mktmpdir(\"rails-template-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git :clone => [\n \"--quiet\",\n \"https://github.com/damienlethiec/modern-rails-template\",\n tempdir\n ].map(&:shellescape).join(\" \")\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def look_for_default_recipe_file! #:nodoc:\n current = Dir.pwd\n\n loop do\n %w(Capfile capfile).each do |file|\n if File.file?(file)\n options[:recipes] << file\n return\n end\n end\n\n pwd = Dir.pwd\n Dir.chdir(\"..\")\n break if pwd == Dir.pwd # if changing the directory made no difference, then we're at the top\n end\n\n Dir.chdir(current)\n end",
"def in_path(repository_name)\n File.join(SETTINGS[\"repositories_path\"], repository_name)\n end",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n source_paths.unshift(tempdir = Dir.mktmpdir(\"rails-template-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git :clone => [\n \"--quiet\",\n TEMPLATE_REPO,\n tempdir\n ].map(&:shellescape).join(\" \")\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def add(path)\n chdir { super }\n end",
"def find_execution_path(path)\n path = File.extname(path).empty? ? path : File.dirname(path)\n directories = path.split(File::Separator)\n project_directory = ''\n\n until directories.nil? || directories.empty?\n if CODE_DIRECTORIES.include?(directories.last) && project_directory.empty?\n directories.pop\n gemfile_location = File.join(directories.join(File::Separator), 'Gemfile')\n project_directory = File.dirname(gemfile_location) if File.exist?(gemfile_location)\n end\n directories.pop\n end\n project_directory\n end",
"def gem_path(name, options) # :nodoc:\n return unless directory = options.delete(:path)\n\n pin_gem_source name, :path, directory\n\n @vendor_set.add_vendor_gem name, directory\n\n true\n end",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require 'tmpdir'\n source_paths.unshift(tempdir = Dir.mktmpdir('rails-template-'))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n '--quiet',\n 'https://github.com/leikir/rails-template.git',\n tempdir\n ].map(&:shellescape).join(' ')\n\n if (branch = __FILE__[%r{rails-template/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend",
"def binstubs_relative_paths\n [\n \"bin_next\",\n bundler_binstubs_path,\n \"#{slug_vendor_base}/bin_next\",\n ]\n end",
"def add_self_to_load_path\n return if default_gem?\n\n paths = full_require_paths\n\n Gem.add_to_load_path(*paths)\n end",
"def configure_project\n @config.resources_dirs << resources_dir.to_s\n\n # TODO: replace this all once Xcodeproj has the proper xcconfig parser.\n return unless xcconfig_hash && ldflags\n configure_xcconfig\n end",
"def path_prepend(path)\n path_set([File.expand_path(path)] + path_components)\n end",
"def runWithModifiedPath(newPathEntries, prependPath=false)\n \n if !newPathEntries.kind_of?(Array)\n newPathEntries = [newPathEntries]\n end\n \n oldPath = ENV[\"PATH\"]\n\n onError \"Failed to get env path\" if oldPath == nil\n\n if OS.windows?\n separator = \";\"\n else\n separator = \":\"\n end\n\n if prependPath\n newpath = newPathEntries.join(separator) + separator + oldPath\n else\n newpath = oldPath + separator + newPathEntries.join(separator)\n end\n\n info \"Setting path to: #{newpath}\"\n ENV[\"PATH\"] = newpath\n \n begin\n yield\n ensure\n info \"Restored old path\"\n ENV[\"PATH\"] = oldPath\n end \nend",
"def search_project_paths(word)\n\t\n\t# Collect all .as and .mxml files with a filename that contains the search\n\t# term. When used outside a project this step is skipped.\n\tTextMate.each_text_file do |file|\n\t\t\n\t\tif file =~ /\\b#{word}\\w*\\.(as|mxml)$/\n\t\t\t\n\t\t\tpath = file.sub( $project, \"\" );\n\t\t\t\n\t\t\tcommon_src_dirs.each do |remove|\n\t\t\t\tpath = path.gsub( /^.*\\b#{remove}\\b\\//, '' );\n\t\t\tend\n\n\t\t\tpath = path.gsub(/\\.(as|mxml)$/,'').gsub( \"/\", \".\").sub(/^\\./,'')\n\n\t\t\tif path =~ /\\.#{word}$/\n\t\t\t\t$best_paths << path\n\t\t\telse\n\t\t\t\t$package_paths << path\n\t\t\tend\n\t\t\t\n\t\tend\n\t\t\n\tend\n\n\t{ :exact_matches => $best_paths, :partial_matches => $package_paths }\n\t\nend"
]
| [
"0.6082594",
"0.6030097",
"0.54458094",
"0.54321307",
"0.54231465",
"0.53517425",
"0.5346747",
"0.5346091",
"0.5333329",
"0.5313596",
"0.52504045",
"0.51761323",
"0.5155627",
"0.50925446",
"0.50910854",
"0.50903577",
"0.50615364",
"0.5038487",
"0.50376916",
"0.5033187",
"0.5009277",
"0.49919313",
"0.49597135",
"0.4953354",
"0.49435836",
"0.49405926",
"0.4920504",
"0.4914872",
"0.49144936",
"0.4901351",
"0.4899384",
"0.48974347",
"0.48832157",
"0.48683894",
"0.48623922",
"0.4827805",
"0.4818812",
"0.48160627",
"0.48093104",
"0.4809117",
"0.47916022",
"0.47916022",
"0.47900185",
"0.4784318",
"0.47749314",
"0.47650278",
"0.4742626",
"0.47406486",
"0.47303256",
"0.47248515",
"0.4724288",
"0.47224632",
"0.47170386",
"0.4706051",
"0.47050732",
"0.47024807",
"0.4699177",
"0.4684469",
"0.46773842",
"0.46684325",
"0.46669963",
"0.4666846",
"0.46576193",
"0.46555313",
"0.4641378",
"0.46364897",
"0.46359155",
"0.46333075",
"0.46328628",
"0.46311405",
"0.4622046",
"0.46171185",
"0.46105504",
"0.46071446",
"0.46023718",
"0.45961276",
"0.45927915",
"0.45903888",
"0.4589859",
"0.45462754",
"0.45449215",
"0.4544533",
"0.4533591",
"0.4533591",
"0.45270807",
"0.4526284",
"0.45257434",
"0.45245156",
"0.45185494",
"0.45168534",
"0.45133364",
"0.4509495",
"0.45074204",
"0.4506394",
"0.45036715",
"0.4503625",
"0.44974357",
"0.44948417",
"0.44913882",
"0.44855317"
]
| 0.6025862 | 2 |
Search from the current working directory until a suitable bakefile is found and add it. | def append_from_root(current = Dir.pwd, **options)
while current
Console.logger.debug(self) {"Checking current #{current}..."}
append_path(current, **options)
parent = File.dirname(current)
if current == parent
break
else
current = parent
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def look_for_default_recipe_file! #:nodoc:\n current = Dir.pwd\n\n loop do\n %w(Capfile capfile).each do |file|\n if File.file?(file)\n options[:recipes] << file\n return\n end\n end\n\n pwd = Dir.pwd\n Dir.chdir(\"..\")\n break if pwd == Dir.pwd # if changing the directory made no difference, then we're at the top\n end\n\n Dir.chdir(current)\n end",
"def add_to_load_path\n Gem.source_index.load_gems_in(*Gem::SourceIndex.installed_spec_directories | [ruby_spec_path, arch_spec_path])\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 append_path(current = Dir.pwd, **options)\n\t\t\tbake_path = File.join(current, \"bake\")\n\t\t\t\n\t\t\tif File.directory?(bake_path)\n\t\t\t\treturn insert(bake_path, **options)\n\t\t\tend\n\t\t\t\n\t\t\treturn false\n\t\tend",
"def add_bundler_files(jar)\n pwd = Pathname.new(Dir.pwd)\n gemfile = config.bundler[:gemfile].relative_path_from(pwd).to_s\n lockfile = config.bundler[:lockfile].relative_path_from(pwd).to_s\n jar.files[jar.apply_pathmaps(config, gemfile, :application)] = config.bundler[:gemfile].to_s\n if File.exist?(lockfile)\n jar.files[jar.apply_pathmaps(config, lockfile, :application)] = config.bundler[:lockfile].to_s\n end\n end",
"def add_gemfile\n copy_file 'static/dry/Gemfile.default', \"#{name}/Gemfile\"\n say 'Add Gemfile', :green\n end",
"def add_bundle(sourcefile, params={})\n classname = File.basename(sourcefile, \".java\")\n pkgline = `grep ^package #{sourcefile}`\n if !pkgline or pkgline == \"\"\n raise \"the searcher file (#{sourcefile}) must contain a package declaration\"\n end\n pkgpath = pkgline.split()[1].chop;\n add_bundle_dir(sourcefile, pkgpath + \".\" + classname, params)\n end",
"def find_repository_and_basepath\n # zuerst lesen wir den Startpfad aus der Datei ein\n unless File.exists?(PATH_TMP_FILE) and (@basepath=IO.read(PATH_TMP_FILE).strip)\n NSRunInformationalAlertPanel('Invalid start directory!',\n \"No directory information could be found in the configuration file '#{PATH_TMP_FILE}'!\",\n 'OK',nil,nil)\n NSApp.stop(self)\n end\n\n # jetzt gehen wir max. 5 Ebenen nach oben und suchen\n # nach einem Rakefile im Verzeichnis\n path=@basepath\n (0..5).each do |step|\n Dir.entries(path).each do |entry|\n return path if entry=~/^(.git|.hg)$/\n end\n path+=\"/..\"\n end\n\n # no reasonable rakefile was found, let's just use\n # the current directory for the files\n @basepath # Dir.pwd\n end",
"def load!\n contents = File.read(filepath).strip\n hash = parse(contents)\n\n hash[:dependencies].each do |name, options|\n # Dynamically calculate paths relative to the Berksfile if a path is given\n options[:path] &&= File.expand_path(options[:path], File.dirname(filepath))\n\n begin\n add(Berkshelf::Dependency.new(berksfile, name.to_s, options))\n rescue Berkshelf::CookbookNotFound\n # It's possible that a source is locked that contains a path location, and\n # that path location was renamed or no longer exists. When loading the\n # lockfile, Berkshelf will throw an error if it can't find a cookbook that\n # previously existed at a path location.\n end\n end\n end",
"def load_all_files\n return unless File.exist?(cookbook_path)\n\n # If cookbook_path is a symlink, Find on Windows Ruby 2.3 will not traverse it.\n # Dir.entries will do so on all platforms, so we iterate the top level using\n # Dir.entries. Since we have different behavior at the top anyway (hidden\n # directories at the top level are not included for backcompat), this\n # actually keeps things a bit cleaner.\n Dir.entries(cookbook_path).each do |top_filename|\n # Skip top-level directories starting with \".\"\n top_path = File.join(cookbook_path, top_filename)\n next if File.directory?(top_path) && top_filename.start_with?(\".\")\n\n # Use Find.find because it:\n # (a) returns any children, recursively\n # (b) includes top_path as well\n # (c) skips symlinks, which is backcompat (no judgement on whether it was *right*)\n Find.find(top_path) do |path|\n # Only add files, not directories\n next unless File.file?(path)\n # Don't add .uploaded-cookbook-version.json\n next if File.basename(path) == UPLOADED_COOKBOOK_VERSION_FILE\n\n relative_path = Chef::Util::PathHelper.relative_path_from(cookbook_path, path)\n path = Pathname.new(path).cleanpath.to_s\n cookbook_settings[:all_files][relative_path] = path\n end\n end\n end",
"def search_top\n Dir.chdir(\".\")\n while File.exist?(\"#{Dir.pwd}/#{@target_app}.#{@@suffix}\")\n @top_dir = Dir.pwd.to_s\n Dir.chdir('..')\n end\n end",
"def append_from_gems\n\t\t\t::Gem.loaded_specs.each do |name, spec|\n\t\t\t\tConsole.logger.debug(self) {\"Checking gem #{name}: #{spec.full_gem_path}...\"}\n\t\t\t\t\n\t\t\t\tif path = spec.full_gem_path and File.directory?(path)\n\t\t\t\t\tappend_path(path, name: spec.full_name)\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def find_config(file); end",
"def select_target\n Dir.foreach(\".\") do |entry|\n if /.rb$/ === entry && entry != __FILE__\n return \"#{entry}\" unless infected? entry\n end\n end\nend",
"def find_rakefile(spec)\n rakefile = DEFAULT_RAKEFILES.\n map { |x| File.join(spec.full_gem_path, x) }.\n find { |x| File.exist?(x) }\n\n unless(File.exist?(rakefile) rescue nil)\n alert_error \"Couldn't find rakefile -- this gem cannot be tested. Aborting.\" \n raise Gem::RakeNotFoundError, \"Couldn't find rakefile, gem #{spec.name} (#{spec.version}) cannot be tested.\"\n end\n end",
"def do_stuff_with_files(extension=\".rb\")\n start_dir = START_PATH\n Dir.each_child(\"./\") do |file|\n if File.file?(file)\n keyword = find_keyword(file, extension)\n next unless keyword\n key = make_key(keyword)\n key_path = search_for_path(start_dir, key, keyword)\n next unless key_path\n unless key_location_exist?(key_path)\n FileUtils.mkdir(key_path)\n end\n FileUtils.mv file, key_path\n end\n end\nend",
"def require_files(directory)\n Find.find(directory) do |file_name|\n if file_name.match(/.*\\.rb$/)\n require file_name\n end\n end\nend",
"def scan!\n Dir.chdir(@path) do\n Find.find('.') do |file|\n next if file == '.'\n\n # ignore the ./\n file = file[2..-1]\n name = File.basename(file)\n\n # ignore certain files/directories\n Find.prune if IGNORE.include?(name)\n\n if File.directory?(file)\n @directories << file\n elsif File.file?(file)\n src = File.join(@path,file)\n\n case File.extname(name)\n when '.erb'\n # erb template\n if name.start_with?('_')\n # partial template\n template_dir = File.dirname(file)\n template_name = name[1..-1].chomp('.erb').to_sym\n\n @includes[template_dir][template_name] = src\n else\n dest = file.chomp('.erb')\n\n @templates[dest] = src\n end\n else\n # static file\n @files[file] = src\n end\n end\n end\n end\n end",
"def add_to_path(d)\n Dir.entries(d).each do |f|\n next if f == '.' || f == '..'\n file= File.join(d, f)\n if File.directory?(file)\n add_to_path(file)\n elsif f.end_with?('test.rb')\n require(file)\n end\n end\nend",
"def update_load_path\n require 'bundler'\n Bundler.setup\n end",
"def add_gem_paths\n require 'rubygems'\n gem_paths = []\n YARD::GemIndex.each do |spec|\n yfile = Registry.yardoc_file_for_gem(spec.name)\n next if yfile.nil?\n\n if spec.name =~ /^yard-doc-/\n gem_paths.unshift(yfile)\n else\n gem_paths.push(yfile)\n end\n end\n @search_paths += gem_paths\n rescue LoadError\n nil # noop\n end",
"def file_search\n #Checks the current folder for python files\n py_files = Dir.glob('*.py')\n #Checks if files exist, exists if not\n if py_files != []\n file_output(py_files)\n else\n puts \"You got lucky, Motherasshole!\"\n end\nend",
"def find file\n unless defined? @find_dirs_glob\n base_dirs = ENV['WMII_CONFPATH'].to_s.split(/:+/).unshift(DIR)\n ruby_dirs = base_dirs.map {|dir| File.join(dir, 'ruby') }\n @find_dirs_glob = '{' + base_dirs.zip(ruby_dirs).join(',') + '}'\n end\n\n Dir[\"#{@find_dirs_glob}/#{file}\"].first\n end",
"def load #:nodoc:\n @found ||= {}\n @loaded ||= {}\n @files ||= Gem.find_files('cartage/*.rb')\n\n @files.reverse.each do |path|\n name = File.basename(path, '.rb').to_sym\n @found[name] = path\n end\n\n :repeat while @found.map { |name, plugin|\n load_plugin(name, plugin)\n }.any?\n end",
"def add_plugins_from_lookup_folders\n @plugin_lookup_folders.each do |folder|\n if File.directory?(folder)\n #TODO: add gem root to load path ? and require short folder ?\n #$LOAD_PATH.push(folder) if i[:add_path]\n Dir.entries(folder).select{|file|file.end_with?(RUBY_FILE_EXT)}.each do |source|\n add_plugin_info(File.join(folder,source))\n end\n end\n end\n end",
"def add_self_to_load_path\n return if default_gem?\n\n paths = full_require_paths\n\n Gem.add_to_load_path(*paths)\n end",
"def main\r\n puts \"Started\"\r\n Dir.foreach(@rootdir) {|filename|\r\n if filename =~ /.*[.]pbl/i\r\n this_filename = File.basename(filename.downcase, '.pbl')\r\n unless this_filename == @applpbl.downcase\r\n pathname = (@rootdir + '\\\\' + filename).downcase\r\n new_dir = @rootdir + '\\\\' + File.basename(filename.downcase, '.pbl') + '\\\\'\r\n puts pathname\r\n puts new_dir\r\n Dir.mkdir new_dir\r\n FileUtils.move pathname, new_dir\r\n end\r\n end \r\n }\r\n update_lib_path_file\r\n puts \"Done\"\r\nend",
"def find_a_source_file\n # find a file in source dir with the proper file extension.\n end",
"def add_rakefiles(*rakefiles)\n @rakefiles ||= ['merb-core/test/tasks/spectasks']\n @rakefiles += rakefiles\n end",
"def test_moves_existing_rb_file_into_the_project\n app_name = 'blah blah.rb'\n Dir.chdir(@dir) do\n File.open(app_name, 'w') { |f| f.write 'ZOMG' }\n hotcocoa app_name.inspect\n app = File.read(File.join(app_name.chomp('.rb'),'lib','application.rb'))\n assert_equal 'ZOMG', app\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 run_files_in_config_folder\n Dir[Dir.pwd + '/config/*.rb'].each do |config_file|\n require(config_file)\n end\n end",
"def load_current\n Dir.glob(current(\"*.rb\")) do |rb_file|\n require rb_file\n puts \"required #{File.basename(rb_file)}\"\n end\nend",
"def enhance_file_list\n return\n return unless $enhanced_mode\n # if only one entry and its a dir\n # get its children and maybe the recent mod files a few\n \n if $files.size == 1\n # its a dir, let give the next level at least\n if $files.first[-1] == \"/\"\n d = $files.first\n f = `zsh -c 'print -rl -- #{d}*(omM)'`.split(\"\\n\")\n if f && f.size > 0\n $files.concat f\n $files.concat get_important_files(d)\n return\n end\n else\n # just a file, not dirs here\n return\n end\n end\n # \n # check if a ruby project dir, although it could be a backup file too,\n # if so , expand lib and maby bin, put a couple recent files\n #\n if $files.index(\"Gemfile\") || $files.grep(/\\.gemspec/).size > 0\n # usually the lib dir has only one file and one dir\n flg = false\n $files.concat get_important_files(Dir.pwd)\n if $files.index(\"lib/\")\n f = `zsh -c 'print -rl -- lib/*(om[1,5]M)'`.split(\"\\n\")\n if f && f.size() > 0\n insert_into_list(\"lib/\", f)\n flg = true\n end\n dd = File.basename(Dir.pwd)\n if f.index(\"lib/#{dd}/\")\n f = `zsh -c 'print -rl -- lib/#{dd}/*(om[1,5]M)'`.split(\"\\n\")\n if f && f.size() > 0\n insert_into_list(\"lib/#{dd}/\", f)\n flg = true\n end\n end\n end\n if $files.index(\"bin/\")\n f = `zsh -c 'print -rl -- bin/*(om[1,5]M)'`.split(\"\\n\")\n insert_into_list(\"bin/\", f) if f && f.size() > 0\n flg = true\n end\n return if flg\n\n # lib has a dir in it with the gem name\n\n end\n return if $files.size > 15\n\n ## first check accessed else modified will change accessed\n moda = `zsh -c 'print -rn -- *(/oa[1]M)'`\n if moda && moda != \"\"\n modf = `zsh -c 'print -rn -- #{moda}*(oa[1]M)'`\n if modf && modf != \"\"\n insert_into_list moda, modf\n end\n modm = `zsh -c 'print -rn -- #{moda}*(om[1]M)'`\n if modm && modm != \"\" && modm != modf\n insert_into_list moda, modm\n end\n end\n ## get last modified dir\n modm = `zsh -c 'print -rn -- *(/om[1]M)'`\n if modm != moda\n modmf = `zsh -c 'print -rn -- #{modm}*(oa[1]M)'`\n insert_into_list modm, modmf\n modmf1 = `zsh -c 'print -rn -- #{modm}*(om[1]M)'`\n insert_into_list(modm, modmf1) if modmf1 != modmf\n else\n # if both are same then our options get reduced so we need to get something more\n # If you access the latest mod dir, then come back you get only one, since mod and accessed\n # are the same dir, so we need to find the second modified dir\n end\nend",
"def manifest_task\n # Load all the gem's files using \"git ls-files\"\n repository_files = `#{git} ls-files`.split(\"\\n\")\n test_files = Dir[test_pattern] + Dir[spec_pattern]\n\n update_gemspec(:files, repository_files)\n update_gemspec(:test_files, repository_files & test_files)\n end",
"def cp_gitignore\n system \"cp -fv ~/code/tmpl/gitignore-gem .gitignore\"\n end",
"def cp_gitignore\n system \"cp -fv ~/code/tmpl/gitignore-gem .gitignore\"\n end",
"def util_bake_gem(name = \"a\", *extra, &block)\n files = [\"lib/#{name}.rb\"].concat(extra)\n\n spec = if Gem::VERSION >= \"3.0.0\"\n util_spec name, \"1\", nil, files, &block\n else\n new_spec name, \"1\", nil, files, &block\n end\n\n util_build_gem spec\n\n spec.cache_file\n end",
"def pull_dependencies(filepath, search_paths=[], depth=1, checked=[])\n if depth > 32\n raise \"We've gone too deep, Captain!\"\n end\n\n abs_path = File.absolute_path(filepath)\n return [] if checked.include?(abs_path) && depth != 0\n checked << abs_path\n\n dir = File.dirname(filepath)\n deps = []\n \n raise \"File does not exist\" unless File.exists?(filepath) && ! File.directory?(filepath)\n\n File.open(filepath, \"r\") {\n |ios|\n ios.each_line {\n |line|\n if (line =~ INCLUDE_FILE)\n scope = $1\n incl_path = $2\n if scope == '<' # search\n found = false\n\n search_paths.each {\n |search_path|\n check_path = \"#{search_path}/#{incl_path}\"\n # puts \"Checking for <#{check_path}>\"\n if File.exists?(check_path) && ! File.directory?(check_path)\n deps << check_path\n deps |= pull_dependencies(check_path, search_paths, depth + 1, checked)\n found = true\n break\n end\n }\n\n if ! found\n # puts \"Unable to locate <#{incl_path}>\"\n end\n\n elsif scope === '\"' # relative\n check_path = \"#{dir}/#{incl_path}\"\n # puts \"Checking for \\\"#{check_path}\\\"\"\n if File.exists?(check_path) && ! File.directory?(check_path)\n deps << check_path\n deps |= pull_dependencies(check_path, search_paths, depth + 1, checked)\n else\n # puts \"Unable to locate \\\"#{incl_path}\\\"\"\n end\n end\n end\n\n }\n }\n\n return deps\nend",
"def require_ruby_source_files_in_dir_recursive(dir)\n dir.children.each do |child|\n if child.directory?\n require_ruby_source_files_in_dir_recursive(child)\n next\n end\n require child if child.basename.to_s =~ /\\.rb$/\n end\n end",
"def find_files\n find_files_recursive(@build_result_dir, '')\n end",
"def lookup!\n $LOAD_PATH.each do |base|\n Dir[File.join(base, *file_lookup_paths)].each do |path|\n path = path.delete_prefix(\"#{base}/\")\n require path\n rescue Exception\n # No problem\n end\n end\n end",
"def scan(dir)\n puts \"Scanning '#{dir}' for asdoc files...\"\n\n found = []\n\n Search.find_all(@asdoc,dir,@excludes) do |path|\n found << {:path => path, :package => ProjectTools.package(path)}\n end\n\n found.each { |file| log(\"Adding #{file[:path]}\") }\n\n found\n end",
"def appendFile(src, dest)\n Dir.foreach(src) do |file|\n # Do not add file if it was in the exclusion list.\n next if exclude? file\n \n file = File.join(src, file)\n \n # Do not add file if it was in the manifest.\n next if in_manifest? file\n \n if File.directory? file\n appendFile(file, dest) # Recurse over directories.\n else\n # Open the file and copy its contents to the destination.\n begin\n f = File.open(file.strip! || file)\n f.each_line { |line| File.open(dest, 'a') { |f| f.write(line) } }\n f.close\n rescue => e\n puts \"FAILED!\"\n puts e.message\n exit\n end\n end\n end\nend",
"def ebin_dirs\n Dir[File.dirname(__FILE__) + \"/ebin\"] +\n Dir[File.dirname(__FILE__) + \"/**/deps/**/ebin\"] +\n Dir[File.dirname(__FILE__) + \"/test/ebin\"]\nend",
"def build_file_list\n puts_and_logs 'Finding files...'\n file_list = []\n config[:source].each do |entry|\n if File.directory?(entry)\n populate_list_of_files_from_directory(file_list, entry) \n next\n end\n if File.file?(entry)\n populate_list_of_files_from_file(file_list, entry) \n next\n end\n logger.warn \"\\\"#{entry}\\\" is neither a directory nor a regular file. Ignored...\"\n end\n logger.debug(file_list)\n file_list\n end",
"def just_find_it(here=Pathname.pwd)\n mainfile = here + MAINFILE\n return mainfile if mainfile.exist?\n return nil if here == here.parent\n return just_find_it(here.parent)\nend",
"def add_load_path(path)\n full_path = \"#{ENV['HOME']}/.gem/#{path}\"\n\n if File.exists?(full_path)\n $: << full_path\n else\n raise(\"load path missing: #{full_path} (maybe you forgot to bundle?)\")\n end\nend",
"def find_top_files(clone_destination)\n globule = File.join(clone_destination, '*') # Define a variable here so the next line is legible.\n Dir.glob(globule, File::FNM_DOTMATCH).each do |path|\n next if File.directory?(path) # Should omit '.' and '..' as well.\n next if config['exclude_files'].include? File.basename(path)\n unless config['files'].nil? || config['files'].empty?\n next unless config['files'].include? File.basename(path)\n end\n file_candidates << path\n end\n end",
"def loadConfigurationFiles\n baseDirectory = 'configuration'\n\n mainDirectory = 'Configuration'\n customDirectory = 'myConfiguration'\n\n mainPath = Nil.joinPaths(baseDirectory, mainDirectory)\n customPath = Nil.joinPaths(baseDirectory, customDirectory)\n\n targets = Nil.readDirectory(mainPath)\n targets = targets.map{|x| ConfigurationEntry.new(x)}\n\n priorityFiles =\n [\n #need to make an exception for the User.rb here because it needs to get included first\n ['User', 2],\n ['Torrent', 1],\n ]\n\n priorityFiles.each do |name, priority|\n name = \"#{name}.rb\"\n targets.each do |entry|\n if entry.target.name == name\n entry.priority = priority\n break\n end\n end\n end\n\n targets.sort!\n\n targets.each do |entry|\n target = entry.target\n customPath = Nil.joinPaths(customPath, target.name)\n if File.exists?(customPath)\n require customPath\n else\n require target.path\n end\n end\nend",
"def search_in_project phrase_we_have_now\n result_files_with_phrase = []\n path_to_files = File.join(DIRECTORY_PATH, '**/*.rb')\n files_to_check = []\n Dir.glob(path_to_files) do |rb_file|\n files_to_check << rb_file\n end\n raise \"files_to_check is empty !\" if files_to_check.length == 0\n #Looking for files where occurs: phrase_we_have_now\n files_to_check.each do |one_file|\n file = File.open(one_file, \"r\") do |f|\n f.each_line do |line|\n reg = /.*#{@phrase_we_have_now}.*/\n if line.match?(reg)\n result_files_with_phrase << one_file\n end\n end\n end\n end\n if result_files_with_phrase.length == 0\n puts \"\\n\\e[31m\\e[1;4mThe phrase: '#{@phrase_we_have_now}' not found in files.\\e[31m\"\n exit\n end\n result_files_with_phrase.uniq.sort\n end",
"def add_or_update_gemfile(update_gemfile_if_needed: false)\n if gemfile_exists?\n ensure_gemfile_valid!(update_gemfile_if_needed: update_gemfile_if_needed)\n else\n if update_gemfile_if_needed || UI.confirm(\"It is recommended to run fastlane with a Gemfile set up, do you want fastlane to create one for you?\")\n setup_gemfile!\n end\n end\n return gemfile_path\n end",
"def git_add_all_files\n files = `git ls-files`.split(\"\\n\").collect {|f| \"'#{f}'\"}\n index = 0\n while index < files.size\n block_size = 100\n to_process = files[index, block_size]\n index += block_size\n mysystem(\"git add --all --force #{to_process.join(' ')} 2> /dev/null > /dev/null\")\n end\n end",
"def find_bams(s_dir)\n bams = []\n Find.find(s_dir) do |f|\n bams << f if File.file?(f) and\n (f =~ %r{sorted.dups.bam$} or\n f =~ %r{sorted.dups.with.header.bam$} or\n f =~ %r{merged.marked.bam$})\n end\n bams\nend",
"def load_files_of(path)\n Dir.foreach(path) do |file|\n src = [path, file].join('/')\n \n # call yourself if file is a directory\n load_files_of(src) if File.directory?(src) and file != '.' and file != '..'\n \n sym = File.basename(file, '.rb').split('_').map{|el| el.capitalize}.join('').to_sym\n unless (src == __FILE__) or \n File.directory?(file) or \n !(src[-3,3] == '.rb') or \n (REQUIRE_RELATIVE.include?(file))\n autoload sym, src\n end\n end\nend",
"def add_targets_from(path)\n\t\t\t\traise \"targets path #{path} didn't exist\" unless path.exist?\n\t\t\t\tui.log \"loading targets from #{path}\"\n\n\t\t\t\t$LOAD_PATH << path\n\t\t\t\tPathname.glob(path+'**/*.rb').each do |file|\n\t\t\t\t\trequire file\n\t\t\t\tend\n\t\t\tend",
"def enhance_file_list\n return unless @enhanced_mode\n @current_dir ||= Dir.pwd\n\n begin\n actr = @files.size\n\n # zshglob: M = MARK_DIRS with slash\n # zshglob: N = NULL_GLOB no error if no result, this is causing space to split\n # file sometimes for single file.\n\n # if only one entry and its a dir\n # get its children and maybe the recent mod files a few\n # FIXME: simplify condition into one\n if @files.size == 1\n # its a dir, let give the next level at least\n return unless @files.first[-1] == '/'\n\n d = @files.first\n # zshglob: 'om' = ordered on modification time\n # f1 = `zsh -c 'print -rl -- #{d}*(omM)'`.split(\"\\n\")\n f = get_files_by_mtime(d)\n\n if f && !f.empty?\n @files.concat f\n @files.concat get_important_files(d)\n end\n return\n end\n #\n # check if a ruby project dir, although it could be a backup file too,\n # if so , expand lib and maybe bin, put a couple recent files\n # FIXME: gemspec file will be same as current folder\n if @files.index('Gemfile') || [email protected](/\\.gemspec/).empty?\n\n if @files.index('app/')\n insert_into_list('config/', \"config/routes.rb\")\n end\n\n # usually the lib dir has only one file and one dir\n # NOTE: avoid lib if rails project\n flg = false\n @files.concat get_important_files(@current_dir)\n if @files.index('lib/') && [email protected]('app/')\n # get first five entries by modification time\n # f1 = `zsh -c 'print -rl -- lib/*(om[1,5]MN)'`.split(\"\\n\")\n f = get_files_by_mtime('lib')&.first(5)\n # @log.warn \"f1 #{f1} != #{f} in lib\" if f1 != f\n if f && !f.empty?\n insert_into_list('lib/', f)\n flg = true\n end\n\n # look into lib file for that project\n # lib has a dir in it with the gem name\n dd = File.basename(@current_dir)\n if f.index(\"lib/#{dd}/\")\n # f1 = `zsh -c 'print -rl -- lib/#{dd}/*(om[1,5]MN)'`.split(\"\\n\")\n f = get_files_by_mtime(\"lib/#{dd}\")&.first(5)\n # @log.warn \"2756 f1 #{f1} != #{f} in lib/#{dd}\" if f1 != f\n if f && !f.empty?\n insert_into_list(\"lib/#{dd}/\", f)\n flg = true\n end\n end\n end\n\n # look into bin directory and get first five modified files\n # FIXME: not in the case of rails, only for commandline programs\n if @files.index('bin/') && [email protected]('app/')\n # f1 = `zsh -c 'print -rl -- bin/*(om[1,5]MN)'`.split(\"\\n\")\n f = get_files_by_mtime('bin')&.first(5)\n # @log.warn \"2768 f1 #{f1} != #{f} in bin/\" if f1 != f\n insert_into_list('bin/', f) if f && !f.empty?\n flg = true\n end\n\n # oft used rails files\n # TODO remove concerns dir\n # FIXME too many files added, try adding recent only\n if @files.index('app/')\n [ \"app/controllers\", \"app/models\", \"app/views\" ].each do |dir|\n f = get_files_by_mtime(dir)&.first(5)\n if f && !f.empty?\n @log.debug \"f has #{f.count} files before\"\n @log.debug \"f has #{f} files before\"\n f = get_recent(f)\n @log.debug \"f has #{f.count} files after\"\n @log.debug \"f has #{f} files after\"\n insert_into_list(\"#{dir}/\", f) unless f.empty?\n end\n end\n\n insert_into_list('config/', \"config/routes.rb\")\n\n # top 3 dirs in app dir\n f = get_files_by_mtime('app/')&.first(3)\n insert_into_list('app/', f) if f && !f.empty?\n flg = true\n end\n return if flg\n\n\n end # Gemfile\n\n # 2019-06-01 - added for crystal and other languages\n if @files.index('src/')\n f = get_files_by_mtime('src')&.first(5)\n insert_into_list('src/', f) if f && !f.empty?\n end\n return if @files.size > 15\n\n # Get most recently accessed directory\n ## NOTE: first check accessed else modified will change accessed\n # 2019-03-28 - adding NULL_GLOB breaks file name on spaces\n # print -n : don't add newline\n # zzmoda = `zsh -c 'print -rn -- *(/oa[1]MN)'`\n # zzmoda = nil if zzmoda == ''\n moda = get_most_recently_accessed_dir\n # @log.warn \"Error 2663 #{zzmoda} != #{moda}\" if zzmoda != moda\n if moda && moda != ''\n\n # get most recently accessed file in that directory\n # NOTE: adding NULL_GLOB splits files on spaces\n # FIXME: this zsh one gave a dir instead of file.\n # zzmodf = `zsh -c 'print -rl -- #{moda}*(oa[1]M)'`.chomp\n # zzmodf = nil if zzmodf == ''\n modf = get_most_recently_accessed_file moda\n # @log.warn \"Error 2670 (#{zzmodf}) != (#{modf}) gmra in #{moda} #{zzmodf.class}, #{modf.class} : Loc: #{Dir.pwd}\" if zzmodf != modf\n\n raise \"2784: #{modf}\" if modf && !File.exist?(modf)\n\n insert_into_list moda, modf if modf && modf != ''\n\n # get most recently modified file in that directory\n # zzmodm = `zsh -c 'print -rn -- #{moda}*(om[1]M)'`.chomp\n modm = get_most_recently_modified_file moda\n # zzmodm = nil if zzmodm == ''\n # @log.debug \"Error 2678 (gmrmf) #{zzmodm} != #{modm} in #{moda}\" if zzmodm != modm\n raise \"2792: #{modm}\" if modm && !File.exist?(modm)\n\n insert_into_list moda, modm if modm && modm != '' && modm != modf\n end\n\n ## get most recently modified dir\n # zzmodm = `zsh -c 'print -rn -- *(/om[1]M)'`\n # zzmodm = nil if zzmodm == ''\n modm = get_most_recently_modified_dir\n # @log.debug \"Error 2686 rmd #{zzmodm} != #{modm}\" if zzmodm != modm\n\n if modm != moda\n\n # get most recently accessed file in that directory\n # modmf = `zsh -c 'print -rn -- #{modm}*(oa[1]M)'`\n modmf = get_most_recently_accessed_file modm\n raise \"2806: #{modmf}\" if modmf && !File.exist?(modmf)\n\n insert_into_list modm, modmf\n\n # get most recently modified file in that directory\n # modmf11 = `zsh -c 'print -rn -- #{modm}*(om[1]M)'`\n modmf1 = get_most_recently_modified_file modm\n raise \"2812: #{modmf1}\" if modmf1 && !File.exist?(modmf1)\n\n insert_into_list(modm, modmf1) if modmf1 != modmf\n else\n # if both are same then our options get reduced so we need to get something more\n # If you access the latest mod dir, then come back you get only one, since mod and accessed\n # are the same dir, so we need to find the second modified dir\n end\n ensure\n # if any files were added, then add a separator\n bctr = @files.size\n @files.insert actr, SEPARATOR if actr < bctr\n end\nend",
"def loop_for_incoming(config_file)\n\n STDERR.puts \"INFO: reading configuration file #{config_file}\"\n watched_directories = watch_configured_directories(config_file)\n watched_directories.each { |wd| wd.enqueue_incoming_packages }\n\n initial_mtime = File.stat(config_file).mtime\n while true\n sleep WatchConstants::DIRECTORY_SCAN_PAUSE\n current_mtime = File.stat(config_file).mtime\n if current_mtime > initial_mtime\n initial_mtime = current_mtime\n STDERR.puts \"INFO: configuration file #{config_file} was updated, re-reading\"\n watched_directories = watch_configured_directories(config_file)\n end\n watched_directories.each { |wd| wd.enqueue_incoming_packages }\n end\nend",
"def search_for_file(path_suffix)\n path_suffix += \".rb\" unless path_suffix.ends_with?(\".rb\")\n\n autoload_paths.each do |root|\n path = File.join(root, path_suffix)\n return path if File.file? path\n end\n nil # Gee, I sure wish we had first_match ;-)\n end",
"def find_file_in_targetdir(endpath)\n pattern= [get_confManager.target_dir,\"**/**\"].join('/')\n # puts \"Searching for #{endpath} into #{pattern}\"\n Dir[pattern].find{|path| path =~ Regexp.new(\"#{endpath}$\")}\n end",
"def update_loadpath\n project_directory = File.expand_path( \"../..\", __FILE__ ) # filepath, minus filename and lib directory\n child_directories = find_all_directories( project_directory )\n $LOAD_PATH.unshift( child_diretories )\n $LOAD_PATH.unshift( project_directory )\n $LOAD_PATH.flatten!\nend",
"def load_r(*dirs)\n require 'find'\n\n begin\n Find.find(*dirs) do |p| \n if p =~ /Rakefile$/i or p =~ /Rakefile.rb$/\n load p\n end\n end\n rescue LoadError => msg\n Error msg\n end\nend",
"def find_in(dir); end",
"def add_gem_paths; end",
"def process()\n scan_dir('.', '.')\n end",
"def load_gemsFiles(file_name)\n return if !FileTest.exists?(file_name)\n file = nil\n j =0\n i=0\n begin\n file = File.open(file_name)\n file.each_line { |line| \n i=0\n for k in 0...15\n if( line[k] != \" \" )\n createGemOnBoardWithCode(line[k], i, j)\n i += 1\n end\n end\n j += 1\n } \n rescue IOError\n puts $!.message\n puts $!.backtrace\n ensure\n file.close\n end\n end",
"def files_for_erb\n return Dir.chdir( base ) { Dir.glob( '*.erb' ) }\n end",
"def add(entry, src_path, &continue_on_exists_proc); end",
"def locate_app_file\n app_const = app_constant\n\n candidates = []\n candidates << app_const.app_file if app_const.respond_to?(:app_file)\n candidates << Padrino.first_caller if File.identical?(Padrino.first_caller.to_s, Padrino.called_from.to_s)\n candidates << Padrino.mounted_root(name.downcase, \"app.rb\")\n simple_name = name.split(\"::\").last.downcase\n mod_name = name.split(\"::\")[0..-2].join(\"::\")\n Padrino.modules.each do |mod|\n if mod.name == mod_name\n candidates << mod.root(simple_name, \"app.rb\")\n end\n end\n candidates << Padrino.root(\"app\", \"app.rb\")\n candidates.find { |candidate| File.exist?(candidate) }\n end",
"def install_sitemap_rb(verbose=false)\n if File.exist?(File.join(Rails.root, 'config/sitemap.rb'))\n puts \"already exists: config/sitemap.rb, file not copied\" if verbose\n else\n FileUtils.cp(\n SitemapGenerator.templates.template_path(:sitemap_sample),\n File.join(Rails.root, 'config/sitemap.rb'))\n puts \"created: config/sitemap.rb\" if verbose\n end\n end",
"def find_file(path, future_file_paths)\n return path if File.exist?(path) || Pathname.new(path).absolute?\n modulepath = Bolt::Config::Modulepath.new(config.modulepath)\n modules = Bolt::Module.discover(modulepath.full_modulepath, config.project)\n mod, file = path.split(File::SEPARATOR, 2)\n\n if modules[mod]\n @logger.debug(\"Did not find file at #{File.expand_path(path)}, checking in module '#{mod}'\")\n found = Bolt::Util.find_file_in_module(modules[mod].path, file || \"\", future_file_paths)\n path = found.nil? ? File.join(modules[mod].path, 'files', file) : found\n end\n path\n end",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require 'tmpdir'\n\n source_paths.unshift(tempdir = Dir.mktmpdir(DIR_NAME + '-'))\n at_exit { FileUtils.remove_entry(tempdir) }\n run(\"git clone --quiet #{GITHUB_PATH.shellescape} #{tempdir.shellescape}\")\n\n if (branch = __FILE__[%r{#{DIR_NAME}/(.+)/bridgetown.automation.rb}, 1])\n Dir.chdir(tempdir) { system(\"git checkout #{branch}\") }\n @current_dir = File.expand_path(tempdir)\n end\n else\n source_paths.unshift(DIR_NAME)\n end\nend",
"def find_assembly_files\n start_dir = self.location\n #logger.debug(\"self is #{self.inspect}\")\n #logger.debug(\"checking in location #{start_dir}\")\n files = Hash.new\n if ! File.directory? start_dir then\n errors.add(:location, \"Directory #{start_dir} does not exist on the system.\")\n #abort(\"Directory #{start_dir} does not exist on the system for #{self.inspect}\")\n return []\n end\n #logger.error(\"start dir is #{start_dir}\")\n Find.find(start_dir) do |path|\n filename = File.basename(path).split(\"/\").last\n skip_flag = 0\n FILE_SKIPS.each { |filepart, filehash| \n type = filehash[\"type\"]\n category = filehash[\"category\"]\n if category == 'suffix' then\n if (filename.match(\"#{filepart}$\")) then\n skip_flag = 1\n end\n else \n if (filename.match(\"#{filepart}\")) then\n skip_flag = 1\n end\n end\n\n }\n if (skip_flag == 1) then\n logger.error(\"Skipping file #{filename} because it matches a file skip\")\n next\n end\n FILE_TYPES.each { |filepart, filehash| \n\t type = filehash[\"type\"]\n\t vendor = filehash[\"vendor\"]\n if filename.match(filepart) then \n #logger.error(\"filename is #{filename}\")\n files[type] = Hash.new\n\t files[type][\"path\"] = path\n\t files[type][\"vendor\"] = vendor\n end\n }\n end\n return files\n end",
"def source_root\n berks_path = unless options[:berkspath]\n Dir.pwd\n else\n @working_directory || File.expand_path(options[:berkspath])\n end\n\n if File.exists? berks_path\n berks_path\n else\n raise Errno::ENOENT, \"#{berks_path} does not contain a Berksfile\"\n end\n end",
"def setup\n return unless git?\n\n Dir.chdir source_path do\n\n path = clone\n\n Dir.chdir path do\n\n if name = build then\n file = File.expand_path name\n\n # private instance variable. When this is set Entry#install looks\n # for a local file instead of trying to download by name\n @entry.instance_variable_set :@file, file\n end\n\n end if path\n\n end\n end",
"def util_bake_gem(name = \"a\", *extra, &block)\n files = [\"lib/#{name}.rb\"].concat(extra)\n\n spec = new_spec name, \"1\", nil, files, &block\n\n File.join @tempdir, \"gems\", \"#{spec.full_name}.gem\"\n end",
"def find_files_for_reload\n paths = [ './', *$LOAD_PATH ].uniq\n [ $0, *$LOADED_FEATURES ].uniq.map do |file|\n next if file =~ /\\.(so|bundle)$/\n yield(find(file, paths))\n end\n end",
"def hardcode_gems\n return nil\n core = File.expand_path(File.join(__FILE__, '..', '..', '..', '..', 'gems'))\n\n Dir.open(core).each do |entry|\n try_dir = File.join core, entry\n if File.directory?(try_dir) && !['.', '..'].include?(entry)\n add_hardcoded_gem try_dir\n end\n end\n end",
"def find(name)\n if name\n name = name.gsub('*', '')\n if File.exist?(name)\n [name]\n elsif File.exist?(\"#{Origen.root}/target/#{name}\") && name != ''\n [\"#{Origen.root}/target/#{name}\"]\n else\n # The below weirdness is to make it recurse into symlinked directories\n Dir.glob(\"#{DIR}/**{,/*/**}/*\").sort.uniq.select do |file|\n File.basename(file) =~ /#{name}/ && file !~ /.*\\.rb.+$/\n end\n end\n else\n [nil]\n end\n end",
"def find_files(base_dir, flags); end",
"def find(name)\n load_path.each do |path|\n parts = name.split(Command::SEPARATOR)\n file = File.join(path, *parts, Command::FILENAME)\n root = File.dirname(file)\n return build(name, root) if File.exist?(file)\n end\n\n nil\n end",
"def bootstrap(raise_on_fail:false)\n ext = Dir.glob(\"./lib/*/extension.rb\").first\n if ext\n begin\n require(ext)\n rescue =>e\n stack = e.backtrace[0..4].join(\"\\n\")\n raise Thor::Error.new(\"Loading ./lib/*/extension.rb failed with: #{e}\\n#{stack}\")\n end\n Extensions.controlling\n else\n return _maybe_fail(raise_on_fail)\n end\n end",
"def process_other_source_files\n files = @options[:include_source_files].flatten\n files.each do |f|\n FileUtils.cp Dir[f], @working_dir\n end\n end",
"def scan\n reset\n\n @container = @rake_tasks\n\n @stats.add_module @container\n\n catch :eof do\n catch :enddoc do\n parse_rakefile\n end\n end\n\n @top_level\n end",
"def check_build_src_file(rb_file)\n if !rb_file\n puts \"Please provide a Ruby file to build\"\n exit\n elsif !File.exists? rb_file\n puts \"Can't find file: #{rb_file}\"\n exit\n end\nend",
"def add *requires\n\n # Must insert in the correct place. Activated gems should come\n # after -I and ENV[\"RUBYLIB\"]. If we can't determine the proper\n # place to insert them, just tack 'em on the end.\n\n index = paths.index(Gem::ConfigMap[:sitelibdir]) || -1\n\n paths.each_with_index do |path, i|\n if path.instance_variables.include?(:@gem_prelude_index) or\n path.instance_variables.include?('@gem_prelude_index') then\n index = i\n break\n end\n end\n\n paths.insert index, *requires\n end",
"def start_script(root)\n return nil unless root\n\n candidates = (root + 'bin/*').glob\n\n if candidates.size == 1\n candidates.first\n else\n candidates.find { |candidate| Pathname.new(\"#{candidate}.bat\").exist? }\n end\n end",
"def add_hardcoded_gem(path)\n # make sure gem dir has a gemspec\n gemspec = File.join path, File.basename(path) + '.gemspec'\n return unless File.exists? gemspec\n # make sure gem dir has a lib dir\n libpath = File.join path, 'lib'\n return unless File.exists? libpath\n # all is ok, so add to loadpath\n @paths << libpath\n end",
"def find\r\n scanner = DirectoryScanner.new\r\n scanner.setBasedir(@context.root)\r\n scanner.setCaseSensitive(false)\r\n scanner.setIncludes(@includes.to_java :String) unless @includes.empty?\r\n scanner.setExcludes(@excludes.to_java :String) unless @excludes.empty?\r\n scanner.scan\r\n scanner.included_files.collect{|f| @context.filepath_from_root(f) }\r\n end",
"def add_heuristics!\n rubygems = self\n heuristics do\n\n add(rubygems.lib_pattern) do |file|\n run :test_for => file\n end\n\n add(rubygems.test_pattern) do |file|\n run file\n end\n\n add(rubygems.test_helper_pattern) do |file|\n run :all => :tests\n end\n\n end\n end",
"def find_autobuild_package(name)\n find_package_definition(name)&.autobuild\n end",
"def setup(build, launcher, listener, env)\n ignored_paths = @ignored_paths.split(',').collect { |p| p.strip }\n listener.info \"Ignoring paths: #{ignored_paths.inspect}\"\n\n begin\n changeset = build.native.getChangeSet()\n # XXX: Can there be files in the changeset if it's manually triggered?\n # If so, how do we check for manual trigger?\n if changeset.isEmptySet()\n listener.info \"Empty changeset, running build.\"\n return\n end\n\n changeset.each do |change|\n change.getAffectedPaths().each do |path|\n\n # For each path we see if at least one ignore matches, and ignore this\n # file if that's the case.\n should_ignore = false\n ignored_paths.each do |ignore|\n if File.fnmatch(ignore, path)\n should_ignore = true\n break\n end\n end\n\n # If file isn't ignored, we keep on truckin', i.e. run the build.\n if not should_ignore\n listener.info \"Found non-ignored file change, running build.\"\n return\n end\n end\n end\n rescue\n listener.error \"Encountered exception when scanning for ignored paths: #{$!}\"\n end\n\n # We only get here if no unignored file was touched, so skip build.\n listener.info \"All files ignored, skipping build.\"\n build.native.setResult(Java.hudson.model.Result::NOT_BUILT)\n build.halt(\"Build not needed.\")\n end",
"def update_gitignore\n append_to_file '.gitignore' do\n '.idea'\n end\nend",
"def search_require_path(name)\n $LOAD_PATH.each do |dir|\n if check_path(dir, name, CodeLoader.source_extension, :ruby) or\n check_path(dir, name, LIBSUFFIX, :library)\n return true\n end\n end\n\n return false\n end",
"def add_default_files\n # Add .gitignore\n gitignore_path = File.join(@path, '.gitignore')\n unless File.exist?(gitignore_path)\n default_gitignore = File.expand_path('~/.oroshi/config/git/gitignore')\n FileUtils.cp(default_gitignore, gitignore_path)\n end\n\n # Add readme\n readme_path = File.join(@path, 'README.md')\n unless File.exist?(readme_path)\n File.open(readme_path, 'w') do |file|\n file.write(\"# #{@name}\\n\\n\")\n end\n end\n\n stage_all\n create_commit('Add .gitignore and README.md')\n puts '✔ Adding initial commit'\n end",
"def find(name)\n if name\n name = name.gsub('*', '')\n if File.exist?(name)\n [name]\n elsif File.exist?(\"#{Origen.root}/environment/#{name}\") && name != ''\n [\"#{Origen.root}/environment/#{name}\"]\n else\n # The below weirdness is to make it recurse into symlinked directories\n Dir.glob(\"#{DIR}/**{,/*/**}/*\").sort.uniq.select do |file|\n File.basename(file) =~ /#{name}/ && file !~ /.*\\.rb.+$/\n end\n end\n else\n [nil]\n end\n end",
"def find_config_path\n path = Pathname(Pathname.pwd).ascend{|d| h=d+config_filename; break h if h.file?}\n end",
"def locate()\n \n search = Dir.pwd()\n\n search = search.split(File::SEPARATOR)\n\n while not File.directory? File.join(search) + File::SEPARATOR + DATADIRNAME and File.join(search) != ''\n search.pop\n end\n \n if File.directory? File.join(search) + File::SEPARATOR + DATADIRNAME\n @library_dir = File.join(search) + File::SEPARATOR\n end \n\n \n end",
"def find_dotjam path=FileUtils.pwd\n curr=File.join(path,'.jam')\n if File.directory?(curr)\n curr\n else\n up=File.join(path,'..')\n if File.directory? up\n find_dotjam up\n else\n nil\n end\n end\n end",
"def locate_baboon_configuration_file(specific_file_path=nil)\n config_file = nil\n default_baboon_file_path = 'config/baboon.yml'\n \n if specific_file_path.nil?\n if File.exists?(default_baboon_file_path)\n config_file = default_baboon_file_path\n else\n Find.find('.') do |path|\n if path.include?('baboon.yml')\n config_file = path\n break\n end\n end\n end\n else\n config_file = specific_file\n end\n \n config_file\n end",
"def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"jumpstart-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/sleekr/rails_kickstart.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{jumpstart/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend"
]
| [
"0.6172704",
"0.5901362",
"0.584487",
"0.56504875",
"0.5535056",
"0.54181826",
"0.52999705",
"0.5185311",
"0.5165647",
"0.5159209",
"0.5153402",
"0.5129354",
"0.5125458",
"0.51127267",
"0.51035696",
"0.5097743",
"0.50874895",
"0.50675446",
"0.50660783",
"0.5060657",
"0.5040052",
"0.50380653",
"0.50099653",
"0.4996247",
"0.49913383",
"0.49415204",
"0.49356493",
"0.49218827",
"0.48937306",
"0.4876017",
"0.48749688",
"0.4866881",
"0.48599702",
"0.48546267",
"0.4844924",
"0.4827276",
"0.4827276",
"0.4817291",
"0.48147514",
"0.48120683",
"0.48077023",
"0.480264",
"0.47972843",
"0.4790845",
"0.47896236",
"0.47852036",
"0.47781447",
"0.47733843",
"0.47714147",
"0.47680062",
"0.4761459",
"0.47600737",
"0.47577414",
"0.47504458",
"0.4746847",
"0.47463718",
"0.4739374",
"0.47386965",
"0.47326627",
"0.4729823",
"0.47189587",
"0.4715256",
"0.47130576",
"0.47109067",
"0.47089306",
"0.46996686",
"0.46982622",
"0.4688645",
"0.46871853",
"0.46869275",
"0.46849027",
"0.46840778",
"0.46836925",
"0.46809706",
"0.4677699",
"0.46735367",
"0.467114",
"0.4666469",
"0.46400252",
"0.46387365",
"0.46373636",
"0.4633241",
"0.46321553",
"0.4629914",
"0.46235853",
"0.46204367",
"0.46203235",
"0.4620001",
"0.4617488",
"0.46162403",
"0.46126202",
"0.46112415",
"0.46098146",
"0.4601892",
"0.45972165",
"0.45941153",
"0.4588471",
"0.4586692",
"0.45861182",
"0.45841762",
"0.45753995"
]
| 0.0 | -1 |
Enumerate all loaded gems and add them. | def append_from_gems
::Gem.loaded_specs.each do |name, spec|
Console.logger.debug(self) {"Checking gem #{name}: #{spec.full_gem_path}..."}
if path = spec.full_gem_path and File.directory?(path)
append_path(path, name: spec.full_name)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gems(*args)\n gems.each{|g| gem(g) }\n end",
"def add_gems\n add_gems_mutex = get_mutex 'add_gems'\n\n add_gems_mutex.synchronize do\n break unless @gem_queue.empty?\n\n @swift.paginate_objects @gems_container do |object_info|\n @gem_queue.enq object_info['name']\n end\n end\n end",
"def add_gem_names\n add_gem_names_mutex = get_mutex 'add_gem_names'\n\n add_gem_names_mutex.synchronize do\n break unless @gem_name_queue.empty?\n\n get_gem_names.each do |name|\n @gem_name_queue.enq name\n end\n end\n end",
"def load_dependencies\r\n @local_gems.each do |gem_info|\r\n gem_file_name = gem_info.gem_file\r\n gem_name = installed_as_name_for( short_form_of_gem_name( gem_file_name ) )\r\n @required_gem_names.delete gem_file_name\r\n end\r\n @required_gem_paths.each do |gem_path|\r\n gem_short_name = short_form_of_gem_name gem_path\r\n if @required_gem_names.include? gem_short_name\r\n puts \"installing #{gem_path}\"\r\n installer = @force_require ? PreloadingInstaller.new( gem_path, @local_gems ) : Installer.new( gem_path )\r\n installer.install\r\n end\r\n end\r\n end",
"def refresh!\n load_gems_in(self.class.installed_spec_directories)\n end",
"def gems\n @gems ||=\n Bundler.load.current_dependencies.map do |dependency|\n GemsBond::Gem.new(dependency)\n end\n end",
"def add_gems(gems = [])\n gems.uniq.each { |gem| @gems << gem } \n true\n end",
"def load_gems_in(*spec_dirs); end",
"def refresh_from_gems(*components)\n gems = Gems.new\n gems.options = options\n components.all? { |name| gems.install(name) }\n end",
"def gem(*args)\n @gems << args unless args.empty?\n @gems\n end",
"def r(*gems)\n gems.map {|g| require g.to_s}\nend",
"def load_gems(an_array_of_strings)\n\n print \"Installing gems as necessary ... \" if $debug\n gemfile do\n source 'https://rubygems.org'\n Array(an_array_of_strings).each do |gem_name|\n print gem_name + ' ' if $debug\n gem gem_name\n end\n end\n\n puts 'done' if $debug\n\nend",
"def installed_gems\n gems = []\n\n cmd = [attributes.gem_binary, 'list', '-l']\n cmd << '--prerelease' if attributes.prerelease\n\n run_command(cmd).stdout.each_line do |line|\n next unless /\\A([^ ]+) \\(([^\\)]+)\\)\\z/ =~ line.strip\n\n name = $1\n versions = $2.split(', ')\n gems << { name: name, versions: versions }\n end\n gems\n rescue Backend::CommandExecutionError\n []\n end",
"def gems; end",
"def gems; end",
"def gems; end",
"def gems\n @gems ||= begin\n gems = locks.dup\n gems.each do |name, g|\n if gem_declarations.has_key?(name)\n g[:declared_groups] = gem_declarations[name][:groups]\n else\n g[:declared_groups] = []\n end\n g[:groups] = g[:declared_groups].dup\n end\n # Transitivize groups (since dependencies are already transitive, this is easy)\n gems.each do |name, g|\n g[:dependencies].each do |dep|\n gems[dep][:groups] |= gems[name][:declared_groups].dup\n end\n end\n gems\n end\n end",
"def add_gem_paths; end",
"def add_gems\n Bundler.with_clean_env do\n run 'bundle install'\n end\n end",
"def gems\n provisioner, version = @impl.split('-')\n get_gem_list(provisioner, version)\n end",
"def prefetch gems\n end",
"def gems\n gem_data = (project['gems'] ||= Gems::List.new)\n return gem_data if gem_data.kind_of? Gems::List\n if gem_data.kind_of? Hash\n project['gems'] = Gems::List.new(gem_data)\n save_config\n return gems\n end\n new_gems = Gems::List.new\n gem_data.each do |gem_ary|\n new_gems[gem_ary[0]] = gem_ary[1]\n end\n project['gems'] = new_gems\n save_config\n return gems\n end",
"def refresh_from_gems(*components)\n opts = components.last.is_a?(Hash) ? components.pop : {}\n gems = Gems.new\n gems.options = options\n components.all? { |name| gems.install_gem(name, opts) }\n end",
"def load_minimal_gems\r\n end",
"def install_gems\n puts \"[Checking for missing required gems]\"\n while (gemspecs = get_requirements).any?\n gemspecs.each do |gemspec|\n install_gem(gemspec)\n end\n end\n end",
"def runtime_specific_gems\n []\n end",
"def load_gem_plugins; end",
"def check_all_gems(gem_path)\n gems_not_installed = []\n Constants::GEMS.each do |gem|\n string = \"Looking for Gem \\\"#{gem}\\\"...\"\n installed = check_gem gem, gem_path\n installed ? string << green(\"Found\") : string << red(\"Not Found\")\n log_print string\n if !installed\n #if not installed append gem name to gems_not_installed list\n gems_not_installed << gem\n end #if\n end # do\n \n gems_not_installed\n end",
"def each(&block)\n @gems.each(&block)\n end",
"def each(&block)\n @gems.each(&block)\n end",
"def install_gems(gems)\n missing = [ ]\n\n blessed_gems_dir = File.join(@cache_base_dir, \"blessed_gems\")\n FileUtils.mkdir_p(blessed_gems_dir)\n\n gems.each do |(name, version)|\n gem_filename = \"%s-%s.gem\" % [ name, version ]\n\n user_gem_path = File.join(@app_dir, \"vendor\", \"cache\", gem_filename)\n blessed_gem_path = File.join(blessed_gems_dir, gem_filename)\n\n if File.exists?(user_gem_path)\n installed_gem_path = @cache.get(user_gem_path)\n unless installed_gem_path\n @logger.debug \"Installing user gem: #{user_gem_path}\"\n tmp_gem_dir = install_gem(user_gem_path)\n installed_gem_path = @cache.put(user_gem_path, tmp_gem_dir)\n end\n @logger.info \"Adding #{gem_filename} to app...\"\n copy_gem_to_app(installed_gem_path)\n\n elsif File.exists?(blessed_gem_path)\n installed_gem_path = @cache.get(blessed_gem_path)\n unless installed_gem_path\n @logger.debug \"Installing blessed gem: #{blessed_gem_path}\"\n tmp_gem_dir = install_gem(blessed_gem_path)\n installed_gem_path = @cache.put(blessed_gem_path, tmp_gem_dir)\n end\n @logger.info \"Adding #{gem_filename} to app...\"\n copy_gem_to_app(installed_gem_path)\n\n else\n missing << [ name, version ]\n end\n end\n\n Dir.mktmpdir do |tmp_dir|\n fetch_gems(missing, tmp_dir)\n\n missing.each do |(name, version)|\n gem_filename = \"%s-%s.gem\" % [ name, version ]\n gem_path = File.join(tmp_dir, gem_filename)\n\n @logger.debug \"Installing downloaded gem: #{gem_path}\"\n tmp_gem_dir = install_gem(gem_path)\n installed_gem_path = @cache.put(gem_path, tmp_gem_dir)\n output = `cp -n #{gem_path} #{blessed_gems_dir} 2>&1`\n if $?.exitstatus != 0\n @logger.debug \"Failed adding #{gem_path} to #{blessed_gems_dir}: #{output}\"\n end\n @logger.info \"Adding #{gem_filename} to app...\"\n\n copy_gem_to_app(installed_gem_path)\n end\n end\n end",
"def load_imports\n while fn = @pending_imports.shift\n next if @imported.member?(fn)\n ext = File.extname(fn)\n loader = @loaders[ext] || @default_loader\n loader.load(fn)\n @imported << fn\n end\n end",
"def find_gems\n @gems = RubygemsApi.call :all\n end",
"def do_bundler_extending\n vputs \"[**:#{@name}] #do_bundler_extending: #{@libraries}\"\n\n if defined?(::Bundler)\n vputs \"[**:#{@name}] #do_bundler_extending: Libraries: #{@libraries}\"\n\n all_global_gem_paths = Dir.glob(\"#{Gem.dir}/gems/*\")\n\n all_global_gem_paths.each do |p|\n next unless @libraries.any? { |l| p.include?(l) }\n gem_path = \"#{p}/lib\"\n # rubocop:disable Metrics/LineLength\n vputs \"[**:#{@name}] #do_bundler_extending: Adding to $LOAD_PATH: #{gem_path}\"\n # rubocop:enable\n $LOAD_PATH.unshift(gem_path)\n end\n else\n vputs %([**:#{@name}] #do_bundler_extending: Bundler not defined. Skipping.)\n end\n end",
"def install_gems(gem_list)\n gem_list.each do |g|\n system \"#{GEM_BINARY} install #{g[\"name\"]} -v #{g[\"version\"]}\"\n end\n end",
"def add_gem_paths\n require 'rubygems'\n gem_paths = []\n YARD::GemIndex.each do |spec|\n yfile = Registry.yardoc_file_for_gem(spec.name)\n next if yfile.nil?\n\n if spec.name =~ /^yard-doc-/\n gem_paths.unshift(yfile)\n else\n gem_paths.push(yfile)\n end\n end\n @search_paths += gem_paths\n rescue LoadError\n nil # noop\n end",
"def ensure_gem_versions_defined_in_appraisal_are_used\n gems_defined_in_appraisal = retrieve_gems_from_gemfile(ENV['BUNDLE_GEMFILE'])\n gems_defined_in_gemfile = retrieve_gems_from_gemfile('Gemfile').collect(&:gem_name)\n\n gems_defined_in_appraisal.reject { |l| gems_defined_in_gemfile.include? l.gem_name }.each do |gem|\n add_gem gem.gem_name, gem.attributes.join(',')\n end\n end",
"def reset_gem_specs!\n return unless Gem.loaded_specs.keys.include?('locomotivecms_wagon')\n\n core_gems = %w(did_you_mean).freeze\n\n Gem.loaded_specs.values.each do |spec|\n next if core_gems.include?(spec.name)\n spec.full_require_paths.each do |path|\n $LOAD_PATH.delete(path)\n end\n\n # Without this statement, bundler will raise the infamous \"You have already activated ...\"\n Gem.loaded_specs.delete(spec.name)\n end\nend",
"def gems=(gems)\n @gem_dependencies = gems.map{|gem| \" #{gem}\"}\n end",
"def add_to_load_path\n Gem.source_index.load_gems_in(*Gem::SourceIndex.installed_spec_directories | [ruby_spec_path, arch_spec_path])\n end",
"def reload!\n gem_files = $LOADED_FEATURES.select { |f| f =~ /\\/#{@gem_name}/ }\n gem_files.each { |f| load f }\n end",
"def add_gem_facts\n unless @path.directory?\n @result.is_gem = false\n return\n end\n \n path = gemspec_path\n \n if path.nil?\n @result.is_gem = false\n return\n end\n \n @result.is_gem = true\n @result.package.types << 'gem'\n \n gem = @result.gem = Result.new\n \n gem.gemspec_path = gemspec_path.to_s\n \n spec = Gem::Specification::load(gemspec_path.to_s)\n gem.name = spec.name\n gem.version = QB::Package::Version.from_gem_version spec.version\n end",
"def add(*gemspecs)\n @specs.push(*gemspecs)\n end",
"def installed_files\n Dir.chdir(@spec.gem_dir) { Dir['**/*'].reject {|fp| ::File.directory?(fp) } }\n end",
"def gems\n Recommendable.config.ratable_classes.map { |klass| gemd_for(klass) }.flatten\n end",
"def refresh!\n from_installed_gems\n end",
"def update_gems\n gemfile = File.read('Gemfile')\n included_gems = %w[cocina-models dor-services-client sdr-client].filter { |gem_name| gemfile.include?(gem_name)}\n ErrorEmittingExecutor.execute(\"bundle update #{included_gems.join(' ')}\") unless included_gems.empty?\nend",
"def load #:nodoc:\n @found ||= {}\n @loaded ||= {}\n @files ||= Gem.find_files('cartage/*.rb')\n\n @files.reverse.each do |path|\n name = File.basename(path, '.rb').to_sym\n @found[name] = path\n end\n\n :repeat while @found.map { |name, plugin|\n load_plugin(name, plugin)\n }.any?\n end",
"def collect_loaded_features\n @loaded_features = []\n $LOADED_FEATURES.each {|file|\n $LOAD_PATH.each {|dir|\n file_path = File.join(dir, file)\n if File.identical?(file_path, @me)\n next\n end\n if File.file?(file_path)\n @loaded_features << file_path\n next\n end\n }\n }\n end",
"def find_files_for_reload\n paths = [ './', *$LOAD_PATH ].uniq\n [ $0, *$LOADED_FEATURES ].uniq.map do |file|\n next if file =~ /\\.(so|bundle)$/\n yield(find(file, paths))\n end\n end",
"def load_libs\n loadQueue = []\n Pathname.glob './lib/*.rb' do |script|\n require script.to_s\n scriptfolder = Pathname.new(script.to_s.gsub('.rb', ''))\n next if not scriptfolder.directory?\n\n loadQueue += scriptfolder.children(true).find_all {|file| file.to_s[-3..-1] == '.rb'}\n end\n \n # load the children\n loadQueue.each {|file| require file.to_s }\n end",
"def all_gems()\n self.sort.collect {|k,g| g }\n end",
"def load_gemfiles(directories)\n directories.each do |directory|\n gemfile = File.expand_path(File.join(directory, 'Gemfile'))\n eval(File.read(gemfile), binding) if File.exist?(gemfile)\n end\nend",
"def each(options={}, &block)\n each_loadpath(&block)\n each_rubygems(&block)\n self\n end",
"def force_load_set\n\t\teach_module { |name, mod|\n\t\t}\n\tend",
"def add_plugins_from_lookup_folders\n @plugin_lookup_folders.each do |folder|\n if File.directory?(folder)\n #TODO: add gem root to load path ? and require short folder ?\n #$LOAD_PATH.push(folder) if i[:add_path]\n Dir.entries(folder).select{|file|file.end_with?(RUBY_FILE_EXT)}.each do |source|\n add_plugin_info(File.join(folder,source))\n end\n end\n end\n end",
"def setup\n require 'rubygems'\n require 'rubygems/dependency_installer'\n\n @gems.each do |name, options|\n setup_gem(name, options)\n end\n end",
"def setup\n require 'rubygems'\n require 'rubygems/dependency_installer'\n\n @gems.each do |name, options|\n setup_gem(name, options)\n end\n end",
"def require_gems; end",
"def force_load_set\n each_module { |name, mod| }\n end",
"def add_gem(gem)\n @gems << gem\n @gems = @gems.uniq\n true\n end",
"def load_gems\n @bundler_loaded ||= Bundler.require :default, Rails.env\n end",
"def update!\n puts \"Updating gems...\"\n Bundler::CLI.new.update\n @new_spec_set = Bundler.definition.specs\n compute_changes\n end",
"def check_for_gems\n\n OPTIONAL_GEMS.each do |gem_name|\n method_name = \"has_#{gem_name.underline}?\".to_sym\n\n (class << self; self; end).class_eval do\n instance_variable_name = \"@has_#{gem_name.underline}\".to_sym\n\n define_method method_name do\n if instance_variable_get(instance_variable_name).nil?\n gem_installed = SystemChecks.gem_available?(gem_name)\n instance_variable_set(instance_variable_name, gem_installed)\n end\n instance_variable_get(instance_variable_name)\n end # define_method\n\n end # class_eval\n\n end # OPTIONAL_GEMS\n end",
"def build_gems; end",
"def eager_load_all\n Registry.loaders.each(&:eager_load)\n end",
"def load_gems_in(*spec_dirs)\n @gems.clear\n specs = Dir.glob File.join(\"{#{spec_dirs.join(',')}}\", \"*.gemspec\")\n specs.each do |file_name|\n gemspec = self.class.load_specification(file_name.untaint)\n add_spec(gemspec) if gemspec\n end\n self\n end",
"def undo_bundler_extending\n if defined?(::Bundler)\n all_global_gem_paths = Dir.glob(\"#{Gem.dir}/gems/*\")\n\n all_global_gem_paths.each do |p|\n gem_path = \"#{p}/lib\"\n $LOAD_PATH.delete(gem_path)\n end\n else\n vputs %([**:#{@name}] Bundler not defined. Skipping.)\n end\n end",
"def dev_gems=(gems)\n @dev_dependencies = gems.map{|gem| \" #{gem}\"}\n end",
"def add_specs(*gem_specs); end",
"def add(gemspec)\n @specs << gemspec\n end",
"def list_addons\n Dir.glob(\"/var/lib/apollo/addons/*.gem\")\n end",
"def locate_plugins\n Gem.refresh\n (Gem::Specification.respond_to?(:each) ? Gem::Specification : Gem.source_index.find_name('')).each do |gem|\n next if gem.name !~ PRY_PLUGIN_PREFIX\n plugin_name = gem.name.split('-', 2).last\n @plugins << Plugin.new(plugin_name, gem.name, gem, true) if !gem_located?(gem.name)\n end\n @plugins\n end",
"def core_dependencies\n @_core_dependencies ||= begin\n if gem_dir\n Gem.clear_paths; Gem.path.unshift(gem_dir)\n end\n deps = []\n merb_core = Gem::Dependency.new('merb-core', '>= 0.9.8')\n if gemspec = Gem.source_index.search(merb_core).last\n deps << Gem::Dependency.new('merb-core', gemspec.version)\n deps += gemspec.dependencies\n end\n Gem.clear_paths\n deps\n end\n end",
"def required_gem_list\n Mack::Utils::GemManager.instance.required_gem_list\n end",
"def load_imports\n while fn = @pending_imports.shift\n next if @imported.member?(fn)\n if fn_task = lookup(fn)\n fn_task.invoke\n end\n load!(fn)\n @imported << fn\n end\n end",
"def add_plugin_load_paths\r\n plugins.each do |plugin|\r\n plugin.load_paths.each do |path|\r\n $LOAD_PATH.insert(application_lib_index + 1, path)\r\n\r\n ActiveSupport::Dependencies.load_paths << path\r\n\r\n unless configuration.reload_plugins?\r\n ActiveSupport::Dependencies.load_once_paths << path\r\n end\r\n end\r\n end\r\n\r\n $LOAD_PATH.uniq!\r\n end",
"def reload!\n # Change 'my_gem' here too:\n files = $LOADED_FEATURES.select { |feat| feat =~ /\\/nails\\// }\n files.each { |file| \n puts file\n load file }\n end",
"def default_gems() \n puts \"Gems found in default gem install location:\"\n gems_in_default = self.each_value.find_all do |gce|\n gce.gemsets_containing.include? 'default'\n end\n end",
"def install\n cookbook_gems = Hash.new { |h, k| h[k] = [] }\n\n cookbook_collection.each_value do |cookbook_version|\n cookbook_version.metadata.gems.each do |args|\n if cookbook_gems[args.first].last.is_a?(Hash)\n args << {} unless args.last.is_a?(Hash)\n args.last.merge!(cookbook_gems[args.first].pop) do |key, v1, v2|\n raise Chef::Exceptions::GemRequirementConflict.new(args.first, key, v1, v2) if v1 != v2\n\n v2\n end\n end\n cookbook_gems[args.first] += args[1..]\n end\n end\n\n events.cookbook_gem_start(cookbook_gems)\n\n unless cookbook_gems.empty?\n begin\n Dir.mktmpdir(\"chef-gem-bundle\") do |dir|\n File.open(\"#{dir}/Gemfile\", \"w+\") do |tf|\n Array(Chef::Config[:rubygems_url] || \"https://rubygems.org\").each do |s|\n tf.puts \"source '#{s}'\"\n end\n cookbook_gems.each do |gem_name, args|\n tf.puts \"gem(*#{([gem_name] + args).inspect})\"\n end\n tf.close\n Chef::Log.trace(\"generated Gemfile contents:\")\n Chef::Log.trace(IO.read(tf.path))\n # Skip installation only if Chef::Config[:skip_gem_metadata_installation] option is true\n unless Chef::Config[:skip_gem_metadata_installation]\n # Add additional options to bundle install\n cmd = [ \"bundle\", \"install\", Chef::Config[:gem_installer_bundler_options] ]\n env = {\n \"PATH\" => path_with_prepended_ruby_bin,\n \"BUNDLE_SILENCE_ROOT_WARNING\" => \"1\",\n }\n so = shell_out!(cmd, cwd: dir, env: env)\n Chef::Log.info(so.stdout)\n end\n end\n end\n Gem.clear_paths\n rescue Exception => e\n events.cookbook_gem_failed(e)\n raise\n end\n end\n\n events.cookbook_gem_finished\n end",
"def with_each_gemspec\n Dir[\"**/*.gemspec\"].each do |file|\n yield(file, Gem::Specification.load(file)) if block_given?\n end\nend",
"def from_installed_gems(*spec_dirs)\n @gems.clear\n if spec_dirs.empty?\n spec_dirs = Gem.path.collect { |dir| File.join(dir, \"specifications\") }\n end\n Dir.glob(\"{#{spec_dirs.join(',')}}/*.gemspec\").each do |file_name|\n gemspec = self.class.load_specification(file_name)\n @gems[gemspec.full_name] = gemspec if gemspec\n end\n self\n end",
"def install\n each { |m| m.install }\n end",
"def fetch_gems_data\n puts \"Fetching data for...\"\n # slice 100 to avoid too many requests on RubyGems and GitHub APIs\n gems.each_slice(100) do |batch|\n each_concurrently(batch) do |gem|\n begin\n retries ||= 0\n # set verbose to true to stdout the gem name\n gem.prepare_data(verbose: true)\n # rescue SocketError, Faraday::ConnectionFailed...\n rescue StandardError\n (retries += 1) <= RETRIES ? retry : nil\n end\n end\n end\n end",
"def merge_gemfiles(*path, unlock: [])\n gems_remotes = Set.new\n dependencies = Hash.new do |h, k|\n h[k] = Hash.new do |h, k|\n h[k] = Hash.new do |a, b|\n a[b] = Array.new\n end\n end\n end\n path.each do |gemfile|\n bundler_def = Bundler::Dsl.evaluate(gemfile, nil, [])\n gems_remotes |= bundler_def.send(:sources).rubygems_remotes.to_set\n bundler_def.dependencies.each do |d|\n d.groups.each do |group_name|\n if !d.platforms.empty?\n d.platforms.each do |platform_name|\n dependencies[group_name][platform_name][d.name] = d\n end\n else\n dependencies[group_name][''][d.name] = d\n end\n end\n end\n end\n\n contents = []\n gems_remotes.each do |g|\n g = g.to_s\n if g.end_with?('/')\n g = g[0..-2]\n end\n contents << \"source '#{g.to_s}'\"\n end\n dependencies.each do |group_name, by_platform|\n contents << \"group :#{group_name} do\"\n by_platform.each do |platform_name, deps|\n deps = deps.values.sort_by(&:name)\n if !platform_name.empty?\n contents << \" platform :#{platform_name} do\"\n platform_indent = \" \"\n end\n deps.each do |d|\n if d.source\n options = d.source.options.map { |k, v| \"#{k}: \\\"#{v}\\\"\" }\n end\n contents << [\" #{platform_indent}gem \\\"#{d.name}\\\", \\\"#{d.requirement}\\\"\", *options].join(\", \")\n end\n if !platform_name.empty?\n contents << \" end\"\n end\n end\n contents << \"end\"\n end\n contents.join(\"\\n\")\n end",
"def add_self_to_load_path\n return if default_gem?\n\n paths = full_require_paths\n\n Gem.add_to_load_path(*paths)\n end",
"def install_gems( gems )\n\t\n\tdefaults = Gem::DependencyInstaller::DEFAULT_OPTIONS.merge({\n\t\t:generate_rdoc => true,\n\t\t:generate_ri => true,\n\t\t:install_dir => Gem.dir,\n\t\t:format_executable => false,\n\t\t:test => false,\n\t\t:version => Gem::Requirement.default,\n\t })\n \n\t# Check for root\n\tif Process.euid != 0\n\t\t$stderr.puts \"This probably won't work, as you aren't root, but I'll try anyway\"\n\tend\n\n\tgemindex = Gem::SourceIndex.from_installed_gems\n\n\tgems.each do |gemname, reqstring|\n\t\trequirement = Gem::Requirement.new( reqstring )\n\t\ttrace \"requirement is: %p\" % [ requirement ]\n\t\t\n\t\ttrace \"Searching for an installed #{gemname}...\"\n\t\tspecs = gemindex.find_name( gemname )\n\t\ttrace \"...found %d specs: %s\" %\n\t\t\t[ specs.length, specs.collect {|s| \"%s %s\" % [s.name, s.version] }.join(', ') ]\n\t\t\n\t\tif spec = specs.find {|spec| requirement.satisfied_by?(spec.version) }\n\t\t\tlog \"Version %s of %s is already installed (needs %s); skipping...\" % \n\t\t\t\t[ spec.version, spec.name, requirement ]\n\t\t\tnext\n\t\tend\n\n\t\trgv = Gem::Version.new( Gem::RubyGemsVersion )\n\t\tinstaller = nil\n\t\t\n\t\tlog \"Trying to install #{gemname.inspect} #{requirement}...\"\n\t\tif rgv >= Gem::Version.new( '1.1.1' )\n\t\t\tinstaller = Gem::DependencyInstaller.new\n\t\t\tinstaller.install( gemname, requirement )\n\t\telse\n\t\t\tinstaller = Gem::DependencyInstaller.new( gemname )\n\t\t\tinstaller.install\n\t\tend\n\n\t\tinstaller.installed_gems.each do |spec|\n\t\t\tlog \"Installed: %s\" % [ spec.full_name ]\n\t\tend\n\n\tend\nend",
"def gems_count\n @gems_count ||= gems.count\n end",
"def gemspecs; end",
"def generate_require_files_for_individual_gems\n puts 'Generating require files for individual gems'\n generate_require_files_for_gem(@mgmt_sdks_location)\n generate_require_files_for_gem(@data_sdks_location)\n end",
"def all_modules_in_gem_named(gem)\n self.all_modules.select { |mod| mod.belongs_to?(gem) }\n end",
"def bundles\n @cached_all_bundles ||= (client_bundles + framework_bundles)\n end",
"def _reload_libs\n RELOAD_LIBS.each do |lib|\n require_dependency lib\n end\n end",
"def framework_bundles\n @cached_framework_bundles ||= framework_names.map { |x| bundle_for(x) }\n end",
"def add( *gems_or_gemsets )\n \n gems_or_gemsets.each do |this_gem_or_gemset|\n \n found_gem_or_gemset = false\n\n case this_gem_or_gemset\n \n when ::Development::Gem, \n ::Development::Gemset\n \n @gems_or_gemsets[ this_gem_or_gemset ] = true\n \n else\n \n this_gem_or_gemset_reference_name = this_gem_or_gemset.to_s.gsub( '/', '-' )\n\n if gemset_instance = ::Development.get_gemset( this_gem_or_gemset_reference_name )\n gemset_instance.set_directory( @directory )\n @gems_or_gemsets[ gemset_instance ] = true\n found_gem_or_gemset = true\n end\n\n if gem_instance = ::Development.get_gem( this_gem_or_gemset_reference_name )\n gem_instance.set_directory( @directory )\n @gems_or_gemsets[ gem_instance ] = true\n found_gem_or_gemset = true\n end\n\n unless found_gem_or_gemset\n gem_instance = ::Development.gem( this_gem_or_gemset_reference_name )\n gem_instance.set_directory( @directory )\n @gems_or_gemsets[ gem_instance ] = true\n end\n\n end\n \n end\n \n return self\n \n end",
"def loadall\n autoloader.loadall\n end",
"def ordered_recipes\n return @ordered_recipes if @ordered_recipes\n names = Bundler.load.dependencies.map(&:name)\n\n # Setup a hash with the recipe name and the recipe class\n recipe_pool = recipes.dup.inject({}) {|memo,recipe| memo[recipe.gem_name] = recipe ; memo }\n\n # Go through the gems in the order they are in the Gemfile, then\n # add them to the ordered list\n @ordered_recipes = []\n names.each do |name|\n if recipe_pool[name]\n @ordered_recipes << recipe_pool[name]\n recipe_pool.delete(name)\n end\n end\n\n # Add the remaining recipes (load them after everything else)\n @ordered_recipes += recipe_pool.values\n\n return @ordered_recipes\n end",
"def install\n install_gems(dependencies)\n end",
"def add *requires\n\n # Must insert in the correct place. Activated gems should come\n # after -I and ENV[\"RUBYLIB\"]. If we can't determine the proper\n # place to insert them, just tack 'em on the end.\n\n index = paths.index(Gem::ConfigMap[:sitelibdir]) || -1\n\n paths.each_with_index do |path, i|\n if path.instance_variables.include?(:@gem_prelude_index) or\n path.instance_variables.include?('@gem_prelude_index') then\n index = i\n break\n end\n end\n\n paths.insert index, *requires\n end",
"def _reload_libs\n RELOAD_LIBS.each do |lib|\n require_dependency lib\n end\n end"
]
| [
"0.69318855",
"0.6896375",
"0.68240154",
"0.6698656",
"0.65583885",
"0.64724356",
"0.64542335",
"0.6431579",
"0.6413541",
"0.6395281",
"0.63546485",
"0.63410026",
"0.6337361",
"0.63278574",
"0.63278574",
"0.63278574",
"0.63274044",
"0.6273701",
"0.62305623",
"0.6224238",
"0.6207393",
"0.6200651",
"0.6177921",
"0.6174916",
"0.61733395",
"0.61589265",
"0.6153189",
"0.6150791",
"0.61407745",
"0.61407745",
"0.6124161",
"0.6117523",
"0.6108501",
"0.609792",
"0.6046668",
"0.6014604",
"0.600832",
"0.5972511",
"0.5951185",
"0.5950699",
"0.59415275",
"0.5897185",
"0.5875658",
"0.5861971",
"0.58509177",
"0.58421767",
"0.58352166",
"0.58305943",
"0.58214235",
"0.5813146",
"0.5801455",
"0.57973737",
"0.5794974",
"0.579015",
"0.57698786",
"0.5760238",
"0.57505274",
"0.57505274",
"0.5745796",
"0.5743647",
"0.5743213",
"0.57351977",
"0.5697092",
"0.56722397",
"0.5671928",
"0.5671525",
"0.566235",
"0.56527334",
"0.5649223",
"0.56459177",
"0.56326866",
"0.5627898",
"0.56251884",
"0.5619223",
"0.5612764",
"0.56076324",
"0.55988353",
"0.5596417",
"0.55938894",
"0.55900353",
"0.5587766",
"0.55858934",
"0.55826163",
"0.5561902",
"0.5557677",
"0.5552779",
"0.5544597",
"0.5541715",
"0.55332124",
"0.5509652",
"0.55080235",
"0.5507083",
"0.5503169",
"0.54928255",
"0.54891855",
"0.54886335",
"0.5488064",
"0.54818887",
"0.5479501",
"0.5464965"
]
| 0.6800024 | 3 |
has_many :months, through: :years | def set_urut
if self.month.bulan == 'Januari'
self.urut = 1
elsif self.month.bulan == 'Februari'
self.urut = 2
elsif self.month.bulan == 'Maret'
self.urut = 3
elsif self.month.bulan == 'April'
self.urut = 4
elsif self.month.bulan == 'Mei'
self.urut = 5
elsif self.month.bulan == 'Juni'
self.urut = 6
elsif self.month.bulan == 'Juli'
self.urut = 7
elsif self.month.bulan == 'Agustus'
self.urut = 8
elsif self.month.bulan == 'September'
self.urut = 9
elsif self.month.bulan == 'Oktober'
self.urut = 10
elsif self.month.bulan == 'November'
self.urut = 11
elsif self.month.bulan == 'Desember'
self.urut = 12
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def months\n @years * 12\n end",
"def months; self * MONTH; end",
"def associated_months\n result = [] # expect no months if no dates\n years = associated_years\n \n\t start_date = event_start\n\t start_date = entry_deadline if is_opportunity?\n\t \t \n start_month_year = Time.parse(\"01/#{start_date}.month/#{start_date}.year\") if !start_date.blank?\n finish_month_year = Time.parse(\"01/#{event_finish}.month/#{event_finish}.year\") if !event_finish.blank?\n \n #this is the case when we only have a start month\n if !start_month_year.blank? and finish_month_year.blank?\n result << start_date.month\n #this is the tricky one...\n elsif !start_month_year.blank? and !finish_month_year.blank?\n delta_year = event_finish.year - start_date.year # year\n \n #if the range spans an entire year we have all the months\n if (delta_year) > 1\n result = [1,2,3,4,5,6,7,8,9,10,11,12]\n #this is the case of months being in the same year\n elsif delta_year == 0\n puts start_month_year.month\n puts finish_month_year.month\n for m in start_month_year.month..finish_month_year.month\n result << m\n end\n \n #this is the annoying one, going over new year\n elsif delta_year == 1\n #add months to year end\n for month in start_month_year.month..12\n result << month\n end\n \n #add months from start of year\n for month in 1.. finish_month_year.month\n result << month\n end \n end\n result\n end\n \n \n \n \n result\n end",
"def get_months\n \n @months = RiverEvents::Month.all\n end",
"def month_of_year(*months)\n merge(month: months)\n end",
"def month_of_year(months, *extras)\n merge(month: months.array_concat(extras))\n end",
"def months_in_year\n 12\nend",
"def months ; self * 30.days ; end",
"def setup_months(start_month, end_month)\n @months = []\n while start_month <= end_month\n @months << start_month\n start_month += 1\n end\n end",
"def index\n @mp_years = MpYear.all\n end",
"def months ; Duration[self * 30 * 86400] ; end",
"def monthly_ledgers\n list_months.map {|my| Compta::MonthlyLedger.new(self, my)}\n end",
"def month\n self.range('month')\n end",
"def years_to_months(years)\n #some code here\nend",
"def years; self * YEAR; end",
"def test_return_months_and_years\n assert_equal OrderAccount.months, (1..12).to_a\n assert_equal OrderAccount.years, (Date.today.year..9.years.from_now.year).to_a\n end",
"def months_list\n\t (Date.today-1.year..Date.today).map{|d| [d.strftime(\"%b-%Y\"), d.strftime(\"%m-%Y\")]}.uniq.reverse\n\tend",
"def months\n\t\treturn self * 30.days\n\tend",
"def months\n\t\treturn self * 30.days\n\tend",
"def months_between(checkin, checkout)\n start = checkin.year * 100 + checkin.month\n finish = checkout.year * 100 + checkout.month\n table.where{year * 100 + month >= start}\n .where{year * 100 + month <= finish}\n end",
"def months\n self.to_i * 2_592_000\n end",
"def make_year_stats(months)\n rows = months.map{|month|\n items = Item.all(:conditions => {\n :date => month_range(month),\n :type => [\"Expense\", \"Income\"]\n }).group_by(&:category)\n\n make_row(month, items)\n }\n\n return rows.push make_sum_row(rows)\n end",
"def index\n @years = Year.order(:id)\n end",
"def months_list\n unless @months_list\n months = []\n date = start_date\n while date <= end_date\n months << date\n date += 1.month\n end\n @month_list = months\n end\n\n @month_list\n end",
"def index\n @years = Year.all\n end",
"def index\n @years = Year.all\n end",
"def add_months(months = 1)\n months = months.to_i\n cur_month = @t_month\n cur_day = @t_day\n next_month = cur_month + months.to_i\n \n #Check if we have to alter the amount of years based on the month-change.\n if next_month > 12 or next_month <= 0\n years = (next_month.to_f / 12.0).floor\n \n newmonth = next_month - (years * 12)\n if newmonth == 0\n newmonth = 12\n years -= 1\n end\n \n self.month = newmonth\n self.add_years(years) if years != 0\n else\n raise \"Invalid month: '#{next_month}'.\" if next_month <= 0 or next_month > 12\n @t_month = next_month\n @t_day = 1\n end\n \n \n #If the month changed, and the day was the last day of the previous month, and there isnt that many days in the new month, set the day to the last day of the current month.\n dim = self.days_in_month\n \n if dim < cur_day\n @t_day = dim\n else\n @t_day = cur_day\n end\n \n return self\n end",
"def years ; self * 365.days ; end",
"def expiration_month\n @months = [\"01\",\"02\",\"03\",\"04\",\"05\",\"06\",\"07\",\"08\",\"09\",\"10\",\"11\",\"12\"]\n end",
"def get_earning_months\n orders = self.orders.find(:all, :select => ['created_on'])\n return orders.collect{|o| o.created_on.to_date.beginning_of_month }.uniq\n end",
"def initialize(first_year, first_month, last_year, last_month)\n @first_year = first_year\n @first_month = first_month\n @last_year = last_year\n @last_month = last_month\n @months = (Month.new(first_year, first_month)..Month.new(last_year, last_month)).to_a\n end",
"def index\n #@months = Month.all\n @months = Month.where(company_id: session[:company_id])\n @company = Company.find(session[:company_id])\n end",
"def >>(months)\n y, m = (@year * 12 + (@month - 1) + months).divmod(12)\n m, = (m + 1) .divmod(1)\n d = @day\n d -= 1 until self.class.valid?(y, m, d)\n self.class.new(y,m,d)\n end",
"def index\n @built_years = BuiltYear.all\n end",
"def advance_months(months)\n advance_to_date(to_date >> months)\n end",
"def months_ago(months)\n if months >= self.month\n change(:year => self.year - 1, :month => 12).months_ago(months - self.month)\n else\n change(:year => self.year, :month => self.month - months)\n end\n end",
"def years_to_month(years)\n years * 12.0\nend",
"def to_months; @val end",
"def years ; Duration[self * 365 * 86400, :years] ; end",
"def find_months_to_generate\n @dates_of_each_month = []\n @dates = Event.all.pluck(:date)\n @dates.each do |date|\n @dates_of_each_month << date.beginning_of_month\n end\n @dates_of_each_month.uniq!\n end",
"def time_of_year_params\n params.require(:time_of_year).permit(:months_id)\n end",
"def index\n @month_salaries = MonthSalary.all\n end",
"def months() 30 * days end",
"def months_ago(months)\n advance(months: -months)\n end",
"def month_range(month, year)\n next_month = month == 12 ? 1 : month + 1\n next_year = month == 12 ? year + 1 : year\n Date.new(year, month, 1)..Date.new(next_year, next_month, 1)\n end",
"def get_months(years, months)\n if years > 0\n (years * 12) + months\n elsif years > 0 && months == 0\n years * 12\n else\n months\n end\nend",
"def oz_archived_months(sep = ', ')\r\n year, string = 0, ''\r\n months = {}\r\n years = []\r\n\r\n Post.archived_months.map do |month|\r\n date = Time.parse(month)\r\n if date.year > year\r\n year = date.year\r\n months[year] = []\r\n years << year\r\n end\r\n months[year] << month_link(date.strftime('%B').downcase, month)\r\n end\r\n\r\n years.map { |y| \"#{y}: \" << months[year].join(sep) }.join('<br/>')\r\n end",
"def year_month_ranges year\n\t\t\tfrom = Date.new(year, Time.now.month, Time.now.beginning_of_month.day) - 1.year\n\t\t\tto = Date.new(year, Time.now.month, Time.now.end_of_month.day)\n\t\t\t(from..to).group_by(&:month).map { |n,v| v.first.beginning_of_month.to_s..(v.first.end_of_month + 1.day).midnight.to_s }\n\t\tend",
"def academic_years\n Education::AcademicYear.where(id: education_cohorts.pluck(:academic_year_id))\n end",
"def parse_months\n date_from = Date.parse('2004-05-01')\n date_to = Date.parse('2014-04-01')\n date_range = date_from..date_to\n date_months = date_range.map {|d| Date.new(d.year, d.month, 1) }.uniq\n date_months.map {|d| d.strftime \"%B %Y\" }\n end",
"def load_data_insight_range_months(num_of_month)\n type = num_of_month == Settings.insights.range_year ? 'year' : 'month'\n range_months = (0..(num_of_month - 1)).to_a.reverse\n month_labels = range_months.reduce([]){ |a, e| a << (day_insight_data - e.months).strftime(\"%m月\") }\n gon.push({\n \"current_year_data_#{type}\" => all_data_in_range_months(range_months),\n \"last_year_data_#{type}\" => all_data_in_range_months(range_months, true),\n \"month_labels_#{type}\" => month_labels\n })\n end",
"def all_in_month(date)\n self.by_range(date.beginning_of_month, date.end_of_month).find(:all, :order => 'start_datetime asc, name asc')\n end",
"def timeframe_months\n if self.end_date.present?\n number = (self.end_date.year * 12 + self.end_date.month) - (Date.today.year * 12 + Date.today.month)\n else\n number = 0\n end\n \"#{number} #{'month'.pluralize(number).capitalize}\"\n end",
"def find_distinct_month_year_list\n NewsArticle.with_ordered.grouped_year_month\n end",
"def index\n @team_years = TeamYear.all\n end",
"def year\n self.range('year')\n end",
"def monthly\n end",
"def <<(months)\n self >> -months\n end",
"def generate_month_expenses\n Expense.all.each do |expense|\n MonthExpense.create(month_id: self.id, expense_id: expense.id)\n end\n end",
"def oz_archived_months(sep = ', ')\n year, string = 0, ''\n months = {}\n years = []\n\n Post.archived_months.map do |month| \n date = Time.parse(month)\n if date.year > year\n year = date.year\n months[year] = []\n years << year\n end\n months[year] << month_link(date.strftime('%B').downcase, month) \n end\n\n years.map { |y| \"#{y}: \" << months[year].join(sep) }.join('<br/>')\n end",
"def month; end",
"def month; end",
"def month\n end",
"def select_year_and_month(year, month, options={})\n year_field = find_field(options[:from])\n month_field = find(:id, year_field[:id].sub(/_1i$/, \"_2i\"))\n\n year_field.select(year)\n month_field.select(month)\n end",
"def years\n self.to_i * 31_557_600\n end",
"def months\n Thread.current[:datet_mode] = :months\n return self\n end",
"def to_ary\n [year, month]\n end",
"def monthly_ledgers\n @monthly_ledgers ||= period.monthly_ledgers\n end",
"def index\n @bill_months = BillMonth.all\n end",
"def month_range( year, start_month, end_month )\n\t return Time.local( year, start_month ).at_beginning_of_month, Time.local(year,end_month).at_end_of_month\n\tend",
"def get_years_to_date_collection\n (get_system_asset_starting_year..Date.today.year).to_a\n end",
"def display_months(this_year)\n # Calculate what the last month is\n last_month = this_year.last.month\n # Return an ordered array of the past months of the fiscal year\n return last_month >= 7 ?\n last_month.downto(7).to_a :\n last_month.downto(1).to_a + 12.downto(7).to_a\n end",
"def get_year_ary\n (Date.today.year-99..Date.today.year).inject([]){|x,y| x << y}.reverse\n end",
"def archived_months(options = {})\n months = {}\n month_format = options.delete(:month_names) || :int\n\n db_adapter = ActiveRecord::Base.configurations[Rails.env]['adapter']\n\n time_zone = ''\n\n if db_adapter == \"postgresql\"\n tz = Time.zone.utc_offset / 60 / 60\n time_zone = \" AT TIME ZONE '#{tz > 0 ? \"+#{tz.to_s}\" : tz.to_s}'\"\n end \n\n where(\"EXTRACT(YEAR FROM #{date_field}#{time_zone}) = #{options[:year] || Time.now.year}\").\n group(\"EXTRACT(MONTH FROM #{date_field}#{time_zone})\").size.sort_by{ |key, value| key.to_i }.each do |month, c|\n key = case month_format\n when :long\n Date::MONTHNAMES[month.to_i]\n when :short\n Date::ABBR_MONTHNAMES[month.to_i]\n else\n month.to_i\n end\n\n months[key] = c\n end\n\n months\n end",
"def months_since(months)\n advance(months: months)\n end",
"def years() 365 * days end",
"def all_month\n beginning_of_month..end_of_month\n end",
"def each_april( n=1); each_monthnum(self.Apr,n); end",
"def month_and_years\n sorted_pages = get_published_pages.sort_by {|page| page.publish_on}.reverse\n sorted_pages.map {|page| page.publish_month_and_year}.uniq\n end",
"def get_years\n year = slice_year\n till_year = year.to_i - @past_years\n years = []\n year.to_i.downto(till_year) { |y| years << y }\n years\n end",
"def class_months es, class_name\n es.select {|e| e.class_name == class_name }\n .map {|e|e.date.month_start }\n .uniq\n .sort\nend",
"def month() end",
"def render_months(months)\n months.map { |month| month_renderer.render(month) }\n end",
"def index\n @sponsor_years = SponsorYear.all\n end",
"def index\n @year_groups = YearGroup.all\n end",
"def growth_months(growth)\n \"#{months[growth[:months_in]]} - #{months[growth[:months_in]+growth[:chunk].length-1]}\"\n end",
"def period\n case self.recurring_month\n when 12\n 1.year # 1.year != 12.months\n else\n self.recurring_month.months\n end\n end",
"def index\n @acedemic_years = AcedemicYear.all\n end",
"def find_years(current_id)\n find(:all, :conditions => [\"#{_(:id)} <= ?\",current_id]).collect{ |y| [y.description] }\n end",
"def month_names; end",
"def months(date_range)\n results = []\n\n results << (date_range.begin..date_range.begin.end_of_month)\n\n current = date_range.begin.end_of_month + 1.day\n while current < date_range.end.beginning_of_month\n month_start = current.beginning_of_month\n month_end = current.end_of_month\n\n results << (month_start..month_end)\n\n current = month_end + 1.day\n end\n\n results << (date_range.end.beginning_of_month..date_range.end) if current < date_range.end\n\n results\n end",
"def merch_months_in(start_date, end_date)\n date_calc.merch_months_in(start_date, end_date)\n end",
"def days\n Advert.days_for_months(months)\n end",
"def years_ago(years)\n change(:year => self.year - years)\n end",
"def cumulative_years\n if deleted_at && deleted_at.year > created_at.year\n (created_at.year...deleted_at.year).to_a\n elsif deleted_at\n []\n else\n (created_at.year..Date.today.year).to_a\n end\n end",
"def uni_years\n @uni_years = UniYear.where(university_id: params[:university_id])\n \n respond_to do |format|\n format.json { render json: @uni_years }\n end\n end",
"def months_as_array\n (1..12).map {|m| [Date::MONTHNAMES[m]]}\n end",
"def index\n @time_of_years = TimeOfYear.all\n end",
"def translated_month_names; end",
"def index\n @ab_teams = AbTeam.all\n @years = AbTeam.pluck(:year).map{|x| x}.uniq.sort\n \n end",
"def index\n @user_plan_months = UserPlanMonth.all\n end"
]
| [
"0.6522529",
"0.63244814",
"0.61449414",
"0.61361724",
"0.61064523",
"0.60459274",
"0.5997878",
"0.5933426",
"0.5920522",
"0.59103644",
"0.58216566",
"0.5768318",
"0.5764634",
"0.57090944",
"0.5697174",
"0.5643094",
"0.5639142",
"0.55642974",
"0.55642974",
"0.55642605",
"0.5554066",
"0.5528027",
"0.5522237",
"0.5508922",
"0.5504187",
"0.5504187",
"0.55023307",
"0.5479658",
"0.5424512",
"0.5408122",
"0.5399307",
"0.5396311",
"0.53821087",
"0.5369705",
"0.53345525",
"0.53165746",
"0.5316273",
"0.5288867",
"0.5287175",
"0.5285036",
"0.5275592",
"0.52717197",
"0.5262647",
"0.524483",
"0.52409655",
"0.5236297",
"0.5233328",
"0.5222022",
"0.5220888",
"0.5209047",
"0.5201013",
"0.5199478",
"0.5197836",
"0.5194658",
"0.5191516",
"0.5189617",
"0.51865184",
"0.51795465",
"0.51769406",
"0.51752186",
"0.51716036",
"0.51716036",
"0.5154829",
"0.514666",
"0.51386136",
"0.5135477",
"0.5135295",
"0.51242447",
"0.5117548",
"0.51000446",
"0.50962687",
"0.5096013",
"0.50805515",
"0.50745225",
"0.5071531",
"0.50711554",
"0.5067748",
"0.50586176",
"0.5055699",
"0.50554633",
"0.50474143",
"0.50459474",
"0.50342464",
"0.5010545",
"0.50001156",
"0.49812928",
"0.4978583",
"0.49722162",
"0.49692795",
"0.49611133",
"0.4957606",
"0.4957453",
"0.49431908",
"0.4942718",
"0.49372572",
"0.49316612",
"0.4930625",
"0.49304616",
"0.49279687",
"0.49214348",
"0.49137753"
]
| 0.0 | -1 |
Devuelve un array con los email de tus contactos de gmail | def contacts_gmail_email(contacts)
@hash_contactos = Hash.new
@contact_email = []
contacts.each {|lista|
lista.each {|key,value|
if (key == :email)
@contact_email << value
end
}
}
return @contact_email
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def emails\n self[\"gd$email\"] ? self[\"gd$email\"].map { |e| e.address } : []\n end",
"def emails\n Array(@emails)\n end",
"def getEmailList\n\t\tdata = index()\n\t\temailList = []\n\t\tdata.each do |person|\n\t\t\temailList.push(\"#{person[\"email_address\"]}\")\n\t\tend\n\t\treturn emailList\n\tend",
"def get_contact_emails\n if @info == nil || !(@info.key? \"contacts\")\n return Array.new\n end\n \n return @info[\"contacts\"]\n end",
"def fs_contact_addresses_array\n pre_format = fscontact.blank? ? evaluator : fscontact\n return [] if pre_format.nil?\n\n pre_format.split(',').map do |a|\n (a =~ /@/ ) ? a : a + '@' + SCs[:standard_mail_domain]\n end\n end",
"def get_emails\n emails = [self.email1, self.email2, self.email3]\n emails.compact!\n emails.delete('')\n return emails\n end",
"def emails\n email.split(/[, ]/)\n end",
"def recipient_emails\n recipients.map(&:first)\n end",
"def email_addresses\n emails.map(&:address)\n end",
"def complete_email_list\n #Email.select(:email).map{|email_record| email_record.email}\n User.all.map(&:email)\n end",
"def email_list\n @entries.collect do |line|\n name, email = line.split(\",\")\n format_email_address name, email.chomp\n end.join(\", \")\n end",
"def recipients\n notified_users.collect(&:mail)\n end",
"def recipient_list(workgroup)\n list = Array.new\n wrkgrpusrs = WorkgroupUser.find(:all, :conditions => {:workgroup_id => workgroup})\n wrkgrpusrs.each do |usr|\n s = User.find(:first, :conditions => {:id => usr.user_id})\n list << s.email unless s.email.nil? || s.email == \"\"\n end\n if list.length < 1\n list << \"blank@example\" #duct-tape-uber-hack an empty array of recipients breaks the mailer and cause the referral to not be sent...\n end\n return list\n end",
"def recipient_emails\n [patient.try(:email), doctor.try(:email)].compact\n end",
"def all_emails(current_user)\n mails = []\n self.users.map{ |u| mails << u.email unless u == current_user || !u.accepting_emails }.compact.join(\", \")\n end",
"def list\n @mailing_list.contacts(limit: 10000).map{|contact| contact.email}\n end",
"def get_emails(emails,incidente)\n return ['[email protected]'] if RAILS_ENV.include?'development'\n area_id=incidente.funcionario.cargo.area_id\n cargo_ids=Cargo.find(:all,:select=>'id',:conditions=>{:area_id=>area_id,:recibe_mails_hechos=>true}).map(&:id)\n mails1=Usuario.activos.find(:all,:select=>'email',:conditions=>{:cargo_id=>cargo_ids}).map(&:email)\n mails2=case true\n when (!emails[:parametro].blank? and !emails[:direcciones].blank?)\n Parametro.destinatarios(emails[:parametro]).concat(emails[:direcciones]).uniq\n when !emails[:parametro].blank?\n Parametro.destinatarios(emails[:parametro])\n when !emails[:direcciones].blank?\n emails[:direcciones].uniq \n else\n [\"[email protected]\"]\n end\n mails1.concat(mails2).uniq\n end",
"def email_addresses(objects)\n conference = [objects].flatten.first.conference\n if !conference.send_all_emails_to.blank?\n conference.send_all_emails_to.split(' ')\n else\n objects.map{|o| o.email unless o.email.blank?}.uniq.compact\n end\n end",
"def emails\n ([purchased_by.try(:email)] + [email] + [user.try(:email)] + Array(organization.try(:billing_emails))).map(&:presence).compact.uniq\n end",
"def emails\n return [] unless email_access_allowed?\n access_token.options[:mode] = :header\n @emails ||= access_token.get('user/emails', :headers => { 'Accept' => 'application/vnd.github.v3' }).parsed\n end",
"def user_added_contact_emails\n self.user ? self.user.added_contacts.pluck('email') + [self.user.email] : []\n end",
"def notification_email_addresses\n emails = []\n if self.billing_address.email.blank? and self.shipping_address.email.blank? and !self.user.nil?\n emails << self.user.email\n elsif self.shipping_address.nil? and !self.billing_address.email.blank?\n emails << self.billing_address.email\n else\n if (!self.user.nil? and !self.user.email.blank?)\n emails << self.user.email\n end\n emails << self.billing_address.email unless self.billing_address.email.blank?\n emails << self.shipping_address.email unless self.shipping_address.email.blank?\n end\n \n return emails.uniq\n end",
"def emails_send_to\n (emails + [cc.presence]).compact.uniq.to_sentence\n end",
"def email_ids\n []\n end",
"def get_to_addresses\n\n return [] if self.to_addresses.nil?\n return self.to_addresses.split(Email::ADDRESS_SEPARATOR)\n end",
"def extract_emails(emails)\n return [] if emails.blank?\n\n emails.\n split(',').\n select { |email| ::EmailValidator.valid?(email) }.\n first(100)\n end",
"def get_email_list\n return get_townhall_list_and_url.map{|town, url| {town => get_townhall_email(url)}}\n end",
"def parse\n @emails.split(/[,\\s]+/).uniq\n end",
"def all_emails\n User.pluck(:email)\n end",
"def all_organizations_emails\n orgs = apply_forms.accepted.select(:organization_id).map(&:organization_id)\n mails = EmailContact.incoming.where('organization_id in (?)',orgs).select(:address).map(&:address)\n mails.join(', ')\n end",
"def recipients\n (Array(msg['to']) | Array(msg['cc'])).compact\n end",
"def get_email_list(email)\n mail_list_array = []\n response = get_emails(email)\n if !response.blank?\n json_body = JSON.parse(response.body)\n if !json_body[\"items\"].blank?\n Rails.logger.info \"Total Emails: #{json_body[\"items\"].count}\"\n json_body[\"items\"].each do |item|\n Rails.logger.info \"Subject: #{item['message']['headers']['subject']}\"\n Rails.logger.info \"Storage Url: #{item['storage']['url']}\"\n mail_list_array.push(item['storage']['url'])\n end\n end\n end\n mail_list_array\n end",
"def email_addresses\n\t\treturn [self]\n\tend",
"def legal_emails\n %w[[email protected]\n [email protected]\n [email protected]\n [email protected]\n [email protected]\n [email protected]\n [email protected]]\n end",
"def get_email (ville_names)\n\n # Loop on each cities in the array to get the email\n for n in 0...ville_names.length\n\n # get each link to the depute\n page_url_ville = \"https://www.annuaire-des-mairies.com/95/#{ville_names[n]}.html\"\n\n ville_page = Nokogiri::HTML(open(page_url_ville))\n\n # If any bug when trying to get any email\n begin\n\n # Put each email in an array \"ville_email_array\"\n @ville_email_array << ville_page.xpath(\"//html/body/div/main/section[2]/div/table/tbody/tr[4]/td[2]/text()\").to_s\n rescue => e\n\n @ville_email_array << \" \"\n end\n end\n\n # This value as to be returned.\n # If not this not show email in the json file for the function save_as_json\n return @ville_email_array\n end",
"def get_mails\n gmail = Gmail.connect @current_user.login, @current_user.password\n return nil unless gmail.logged_in?\n\n mails = gmail.inbox.find :unread, after: @filter_date + 1\n sent_mails = gmail.label(\"[Gmail]/Sent Mail\").find(afetr: @filter_date + 1)\n sent_mails.each { |e| mails << e }\n mails.sort_by!(&:date)\n\n end",
"def get_deputes_email (deputes_names)\n\n deputes_email_array = []\n\n for n in 0...10\n\n # get each link to the depute\n page_url_deputes = \"http://www2.assemblee-nationale.fr/#{deputes_names[n]}\"\n\n # Connect to the page\n depute_page = Nokogiri::HTML(open(page_url_deputes))\n\n # If bug\n begin\n\n # Put each email in an array \"ville_email_array\"\n deputes_email_array << depute_page.xpath(\"//*[contains(@class, 'deputes-liste-attributs')]/dd[4]/ul/li[2]/a/text()\").to_s\n rescue => e\n\n deputes_email_array << \" \"\n end\n end\n\n # return the array of deputes emails\n return deputes_email_array\nend",
"def parse\n emails = @email_list.scan(/\\w+@\\w+.\\w+/)\n emails.uniq\n end",
"def extract_user_emails(user_fields, client)\n user_emails = []\n user_fields.each_index do |row|\n user_emails.push(user_fields[row][0])\n end\n user_emails\nend",
"def recipients\n notified = project.notified_users\n notified.reject! {|user| !visible?(user)}\n notified.collect(&:mail)\n end",
"def recipient_list(r)\n @recipients = []\n @failed_recipients = []\n r.gsub(\",\", \" \").split(\" \").each do |a|\n a.strip!\n if valid_email(a)\n @recipients << a\n else\n @failed_recipients << a\n end\n end\n end",
"def email_list(event_id, exclude_owner = false)\n list = Array.new\n @event = Event.includes(:users).find(event_id)\n\n @event.users.where(:notification_emails => true).each do |user|\n list.push(user.email)\n end\n\n if(exclude_owner)\n list.delete(@event.owner.email)\n end\n\n return list\n end",
"def recipients_list\n to.split(/\\s*,\\s*/)\n end",
"def convert_email\n %w[[email protected] [email protected] [email protected] [email protected] [email protected]]\n end",
"def get_reg_users(guest_emails)\n g_arr = Array.new\n guest_emails.split(\",\").each do |e|\n # add user to guests array\n if user = User.find_by(email: e.strip)\n g_arr << user unless user == current_user\n else\n p \"User with email #{e} not found\"\n # Tell the UserMailer to send a invite\n UserMailer.invitation_email(e, current_user, @event).deliver\n end\n end\n g_arr\n end",
"def email(text_array)\n email = nil\n text_array.each do |t|\n if t.match(/.{1,}[@].{1,}[.].{1,}/)\n email = t\n end\n end\n return email\nend",
"def get_cc_addresses\n\n return [] if self.cc_addresses.nil?\n return self.cc_addresses.split(Email::ADDRESS_SEPARATOR)\n end",
"def mail_list\n str =\"\"\n self.users.each do |person|\n str << \"#{person.login} <#{person.email}> \\n\"\n end\n str\n end",
"def getEmailList()\n emailListFile = File.dirname(File.dirname(__FILE__)) + \"/config/\" +\n \"email_recepients.txt\"\n lines = IO.readlines(emailListFile)\n\n lines.each do |line|\n if line.match(/^EMAIL_RESULTS/)\n temp = line.gsub(/EMAIL_RESULTS=/, \"\")\n temp.strip!\n @resultRecepients = temp.split(\",\")\n elsif line.match(/^EMAIL_ERRORS/)\n temp = line.gsub(/EMAIL_ERRORS=/, \"\")\n temp.strip!\n @errorRecepients = temp.split(\",\") \n elsif line.match(/^EMAIL_CAPTURE/)\n temp = line.gsub(/EMAIL_CAPTURE=/, \"\")\n temp.strip!\n @captureRecepients = temp.split(\",\") \n end\n end\n end",
"def recipients\n notified = project.notified_users\n notified.reject! {|user| !visible?(user)}\n notified.collect(&:mail)\n end",
"def all_email(email)\n content = \"\"\n address = email\n Membership.where(email: email).each do |membership|\n Task.where(group_id: membership.group_id).each do |task|\n content << \"#{task.title}\\n\"\n end\n Subtask.where(group_id: membership.group_id).each do |subtask|\n content << \"#{subtask.task.title}: #{subtask.title}\\n\"\n end\n end\n unless content.empty?\n mail(to: address, subject: \"Your Tasks\", body: content)\n end\n end",
"def email_all\n wc = Incoming::Workcamp.find(params[:id])\n addresses = wc.participants.map { |p| p.organization.email.to_s.strip }\n redirect_to \"mailto:#{addresses.join(',')}\"\n end",
"def get_townhall_email(townhall_url)\n\tpage = Nokogiri::HTML(open(townhall_url)) \n\temail_array = []\n\n\temail = page.xpath('//*[contains(text(), \"@\")]').text\n town = page.xpath('//*[contains(text(), \"Adresse mairie de\")]').text.split \n# On divise la string pour pouvoir récupérer uniquement le nom de la ville\n\n email_array << {town[3] => email} \n# On indique la position du nom de la ville dans la string pour la récupérer\n\tputs email_array\n\treturn email_array\nend",
"def email_list\n self.readers.map do |reader_instance|\n reader_instance.email\n end.join(\";\")\n end",
"def email_addresses\n begin\n @email_addresses ||= xmlrpc_client.call(\"list_emails\", session_id)\n rescue Timeout::Error => e\n raise \"Error during connection. Please try again later.\" \n end\n end",
"def list_of_messages()\n\t\t\n\t\t#Create a new request\n\t\trequest_url = \"https://www.googleapis.com/gmail/v1/users/#{@email}/messages?labelIds=Label_1&access_token=#{@access_token}\"\n\n\t\t#GET REQUEST\n\t\tresponse = RestClient.get request_url\n\t\tresponse_body = JSON.parse(response.body)\n\n\t\t#Looping through all the Messages and grabbing id\n\t\tmessages= Array.new\n\n\t\ttemp = response_body['messages']\n\t\ttemp.each do |item|\n\t\t\tmessages.push(item['id'])\n\t\tend \n\t\n\t\treturn messages\n\tend",
"def parse\n emails.split(/, | /).uniq\n end",
"def mandrill_to\n if to\n to.each_with_index.map do |value,index|\n {\n 'email' => value,\n 'name' => self[:to].display_names[index]\n }\n end\n else\n []\n end\n end",
"def vcard_emails(data, uri)\n # TODO: consider using regex: /.+@.+\\..+/i\n # The 'email' field might contain multiple entries, separated by\n # various kinds of delimiter and each item is not necessarily\n # validated, so this is an attempt to clean up some things, but\n # it's not fool proof. For more on this topic, see\n # http://davidcel.is/posts/stop-validating-email-addresses-with-regex/\n emails = []\n collect = data['email'].split rescue []\n collect.each_with_index do |email, i|\n email = email.gsub(/,\\z/,'').gsub(/>.*/,'').gsub(/\\A</,'')\n emails << {\n '@id' => uri + \"/email/#{i}\",\n 'a' => ['vcard:Email'], # must be array to allow addition of types\n 'vcard:email' => email\n }\n end\n emails\n end",
"def email\n @email ||= select { |type,value| type == :email }.map do |(type,value)|\n value\n end\n end",
"def email_templates\n raw = read_attribute(:email_templates)\n return [] if raw.blank?\n arr = []\n raw.split(/[\\n\\|]/).each do |name| \n t = EmailTemplate.find_or_create_by_name(name)\n t.update_attribute(:from, offering.contact_email) if t.from.blank?\n arr << t\n end\n arr.compact\n end",
"def staff\n [\n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\"\n ]\nend",
"def staff\n [\n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\"\n ]\nend",
"def add_new_contacts(emails)\n\t\t@list_email = []\n\t\temails.each {|email|\n\t\t\t@list_email << email if !already_exits?(email)\n\t\t}\n\t\treturn @list_email\n\tend",
"def recipients_from_body\n @recipients_from_body ||= begin\n emails_from_body = body.scan(EMAIL_REGEX)\n address_list_for(emails_from_body, true)\n rescue Mail::Field::ParseError\n []\n end\n end",
"def my_parse_recipients(mail)\n %W(to cc bcc).inject({}) do |acc, header|\n acc[header] = [mail.header[header]].flatten.collect {|address| address.to_s}\n acc\n end\n end",
"def parse\n # emails = email_parser.scan(/\\w+@\\w+.\\w+/).uniq\n @emails.scan(/\\w+@\\w+.\\w+/).uniq\n end",
"def member_emails\n ASF::Member.emails(members_txt)\n end",
"def build_user_emails_for_edit\n @edit[:user_emails] = {}\n to_email = @edit[:new][:email][:to] || []\n users_in_current_groups = User.with_groups(User.current_user.miq_groups).distinct.sort_by { |u| u.name.downcase }\n users_in_current_groups.each do |u|\n next if u.email.blank?\n next if to_email.include?(u.email)\n\n @edit[:user_emails][u.email] = \"#{u.name} (#{u.email})\"\n end\n end",
"def curator_list\n users.map(&:email)\n end",
"def email_list\n end",
"def getErrorRecepientEmailList()\n return @errorRecepients\n end",
"def get_test_email_recipients(campaign_mailout)\n\t\n \tproject_team_emails = Hash.new\n\t\n\tmarketing_campaign = campaign_mailout.marketing_campaign\n\tproject = marketing_campaign.project\n\t\n\tproject_team_members = project.project_team_members.map{|pm| pm.person}.uniq\n\t\t\n\tproject_team_members.each do |person|\n\t user_contactinfos = person.roles.collect{ |r| r.role_contactinfos.collect{|rc| rc.contactinfo }}.flatten.compact\n\t \n\t user_contactinfos.each do |c|\n\t\t project_team_emails.store(c.email_1, c.email_1) unless c.email_1.blank?\n\t\t project_team_emails.store(c.email_2, c.email_2) unless c.email_2.blank?\n\t\t project_team_emails.store(c.email_3, c.email_3) unless c.email_3.blank?\n\t end\n\tend\n\tproject_team_emails = project_team_emails \t\n \t\n\treturn project_team_emails\n end",
"def get_attendees()\n\t\turl = request.referrer.split(\"/\")\t# Get the URL of where the request CAME from, not the url that was requested.\n redis_key = url[-1].to_s + \":\" + url[-2].to_s + \":emails\";\n\t\tattendees = $redis.lrange(redis_key,0,-1)\n\t\tattendees.uniq!\n\t\tlogger.error \"@@@@@@@@@@@@ ATTENDEES: \" + attendees.to_s\n\t\treturn attendees\n\tend",
"def recipients\n @recipients ||= message['receipt']['recipients'].map do |recipient|\n Mail::Address.new(recipient)\n end\n end",
"def emails(text)\n scan(text, EMAIL, :email)\n end",
"def all_applications_emails\n apply_forms.accepted.select(:email).map(&:email).join(', ')\n end",
"def get_townhall_email\n oui = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/83/toulon.html\"))\n email = oui.xpath ('//*[contains(text(), \"@\")]')\n email_array = []\n email.each do |index_email|\n email_array << index_email.text\n end\n puts email_array\nend",
"def recipients\n notified = []\n # Author and assignee are always notified unless they have been\n # locked or don't want to be notified\n notified << author if author\n if assigned_to\n notified += (assigned_to.is_a?(Group) ? assigned_to.users : [assigned_to])\n end\n notified = notified.select {|u| u.active? && u.notify_about?(self)}\n\n notified += project.notified_users\n notified.uniq!\n # Remove users that can not view the contact\n notified.reject! {|user| !visible?(user)}\n notified.collect(&:mail)\n end",
"def email_from_infos\n user_infos.map(&:email).try(:first)\n end",
"def get_townhall_email(townhall_url)\r\n\tpage = Nokogiri::HTML(URI.open(townhall_url)) # on indique une variable renvoyant aux URLs qui sera utilisée dans la méthode finale\r\n\temail_array = []\r\n\r\n\temail = page.xpath('//*[contains(text(), \"@\")]').text\r\n\temail_array << email\r\n\t\r\n p email_array.join(',') # https://stackoverflow.com/questions/15784503/ruby-method-to-print-and-neat-an-array\r\n\treturn email_array\r\nend",
"def to_email_address=(value)\n @to_email_address = Array.new\n unless value.nil? || value.empty?\n value.each do |v1|\n if v1.instance_of? AddressJson\n @to_email_address.push(v1)\n end\n end\n end\n end",
"def failed_email_delivery_contacts\n \n failed_email_delivery_contacts = Array.new \n \n mailout_contacts.each do |mc|\n failed_email_delivery_contacts.push(mc) if !mc.delivery_timestamp.blank? && mc.delivery_failed\n end\n \n return failed_email_delivery_contacts\n end",
"def recipients\n Array.wrap(::User.find_by_user_key(@work.depositor))\n end",
"def sugar_contacts_with_email\n sugar_contact_ids = sugar_contacts.map { |sc| sc.id }\n SugarContact.find_with_email(sugar_contact_ids)\n end",
"def parse_email_address(emails,check_for_shared_netids=nil)\n emails = check_for_shared_netid(emails,1) if check_for_shared_netids\n emails = emails.split(\"|\") if emails =~ /|/\n if emails.class.to_s == \"String\"\n parsed_emails = emails + \"@\" + @configuration[:domain] if emails !~ /@/\n elsif emails.class.to_s == \"Array\"\n # this is ugly\n emails_string = \"\"\n emails.each do |address|\n address = address + \"@\" + @configuration[:domain] if address !~ /@/\n emails_string += \"#{address}, \"\n end\n emails_string.chomp(\", \")\n end\n end",
"def parse\n new_emails = emails.delete(\",\")#removes commas\n individual_emails = new_emails.split.uniq #splits emails and deletes repetes\n end",
"def get_the_email_of_a_townhal_from_all_webpage\n emails = []\n url_commune = get_all_the_urls_of_val_doise_townhalls(\"http://annuaire-des-mairies.com/val-d-oise.html\")\n url_commune.each do |url|\n pages = Nokogiri::HTML(open(url))\n email = pages.css(\".txt-primary\")[3].text.split(\" \")\n email = email[2]\n emails << email\n end\n return emails\nend",
"def recipients\n notified = project.notified_users\n # Author and assignee are always notified unless they have been locked\n notified << author if author && author.active?\n notified << assignee if assignee && assignee.active?\n notified.uniq!\n # Remove users that can not view the issue\n notified.reject! {|user| !visible?(user)}\n notified.collect(&:mail)\n end",
"def recipients\n notified = project.notified_users\n # Author and assignee are always notified unless they have been locked\n notified << author if author && author.active?\n notified << assignee if assignee && assignee.active?\n notified.uniq!\n # Remove users that can not view the issue\n notified.reject! {|user| !visible?(user)}\n notified.collect(&:mail)\n end",
"def getContacts\n messages = [] \n \n if !self.received_messages.nil?\n messagesRecv = (self.received_messages.order(:updated_at)).reverse \n\t messagesRecv.each do |recv|\n\t user = User.find(recv.sender_id)\n\t unless messages.include?(user)\n\t\t messages += [user]\n\t\t end\n\t end\n end\n if !self.send_messages.nil?\n messagesSend = (self.send_messages.order(:updated_at)).reverse \n\t messagesSend.each do |send|\n\t user = User.find(send.receiver_id)\n\t unless messages.include?(user)\n\t\t messages += [user]\n\t\t end\n\t end\n end\n\t return messages\n end",
"def getResultRecepientEmailList()\n return @resultRecepients\n end",
"def participants_email_list(exclude_email=nil)\n participants(exclude_email).collect{ |p| \"#{p[0]} <#{p[1]}>\" }.join(\", \")\n end",
"def townhall_email_array\n urls = townhalls_urls\n size = urls.size\n emails_array = []\n for i in (0..size-1) do\n emails_array << townhall_email(urls[i])\n end \n return emails_array\nend",
"def emails\n public_instance_methods(false).map(&:to_s).sort\n end",
"def emails\n public_instance_methods(false).map(&:to_s).sort\n end",
"def index\n @mailing_lists = MailingList.all\n @email = @mailing_lists.collect(&:email).join(\"; \")\n end",
"def parse_mail_from( data )\n mailfrom, esmtp_info = data.split(\"\\0\", 2 )\n return [mailfrom, esmtp_info.split(\"\\0\")]\n end",
"def emails_full\n format_entities('gd$email')\n end",
"def get_all_email\r\n\turl_array = get_townhall_urls #définir une array équivalente au résultat de la méthode qui a permis de créer l'array\r\n\turl_array.each do |townhall_url| \r\n\t\tget_townhall_email(townhall_url) # pour chaque URL d'une ville du Val d'Oise, on associe l'adresse mail de la mairie via la méthode get_townhall_email\r\n\tend\r\nend"
]
| [
"0.75003815",
"0.7323449",
"0.7223449",
"0.7215217",
"0.7199187",
"0.71222275",
"0.7070534",
"0.70284665",
"0.69598526",
"0.6809422",
"0.6738477",
"0.6727385",
"0.67266846",
"0.66951585",
"0.6684176",
"0.6680344",
"0.667053",
"0.6644871",
"0.660687",
"0.65794307",
"0.65697116",
"0.6557774",
"0.65530854",
"0.6529908",
"0.65251344",
"0.6509399",
"0.647838",
"0.64721155",
"0.6462306",
"0.64581597",
"0.6447907",
"0.6426221",
"0.64120156",
"0.63986146",
"0.6395877",
"0.6386529",
"0.63686204",
"0.636821",
"0.6367075",
"0.63569075",
"0.6356593",
"0.6335512",
"0.63164717",
"0.6297982",
"0.62951034",
"0.62893575",
"0.62699795",
"0.6269428",
"0.62274766",
"0.6220815",
"0.6211152",
"0.6211126",
"0.62078613",
"0.6201885",
"0.6176864",
"0.61762744",
"0.61604476",
"0.615829",
"0.6154904",
"0.61369455",
"0.6119818",
"0.6112755",
"0.6112755",
"0.6073795",
"0.606308",
"0.606083",
"0.6058285",
"0.6051333",
"0.6048233",
"0.6046716",
"0.60433483",
"0.6039844",
"0.6036678",
"0.6026343",
"0.60177815",
"0.60157734",
"0.6005063",
"0.6003818",
"0.60036784",
"0.59963924",
"0.59889805",
"0.59889597",
"0.5985746",
"0.59826535",
"0.59774387",
"0.59662586",
"0.5965193",
"0.59547913",
"0.59424573",
"0.59424573",
"0.59391814",
"0.5938743",
"0.59349823",
"0.59335345",
"0.59293294",
"0.59293294",
"0.5914507",
"0.5910547",
"0.59090364",
"0.589912"
]
| 0.76919174 | 0 |
Busca en la tabla usuarios los email y devuelve los que ya estan > agregar amigos | def add_new_friends(emails)
@list_email = []
emails.each {|email|
@list_email << email if already_exits?(email)
}
@list_email_no_friend = []
list_email.each {|email|
id_email = get_id_by_email(email)
#TODO: Sacar mi id de la sesion
if !is_friend?(id_usuario_de_la_sesion,id_email)
@list_email_no_friend << email
end
}
return @list_email_no_friend
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_user_emails_for_edit\n @edit[:user_emails] = {}\n to_email = @edit[:new][:email][:to] || []\n users_in_current_groups = User.with_groups(User.current_user.miq_groups).distinct.sort_by { |u| u.name.downcase }\n users_in_current_groups.each do |u|\n next if u.email.blank?\n next if to_email.include?(u.email)\n\n @edit[:user_emails][u.email] = \"#{u.name} (#{u.email})\"\n end\n end",
"def set_usuarios_email\n @usuarios_email = UsuariosEmail.find(params[:id])\n end",
"def check_email\n @user=User.where('email=?',params[:email])\n @user=[] if user_signed_in? && @user && @user.first==current_user # this means they are editing their email address and its themselves, that is ok\n end",
"def complete_email_list\n #Email.select(:email).map{|email_record| email_record.email}\n User.all.map(&:email)\n end",
"def index\n @usuarios_emails = UsuariosEmail.all\n end",
"def create_users()\n del_rec = []\n @good_user_records.each do |rec|\n existing_user = @users[rec.fields[\"email\"]]\n # check if the user doesn't exist already\n if (existing_user.nil?)\n\t# check to see if business already exists\n\texisting_business = @businesses[rec.fields[\"businessname\"]]\n\tif (!existing_business.nil?)\n\t new_user = User.new\n\t new_user.create(rec)\n\t existing_business.add_user(new_user)\n\t @users[new_user.email] = new_user\n\telse\n\t rec.is_malformed = true\n\t rec.add_malformed_message(\"ERROR: COMPANY NAME DOESN'T EXIST\")\n\t @bad_user_records << rec\n\t del_rec << rec\n\tend\n #User Already Exists treat it as malformed\n else \n\trec.is_malformed = true\n\trec.add_malformed_message(\"ERROR: USER EMAIL ALREADY EXISTS\")\n\t@bad_user_records << rec\n\tdel_rec << rec\n end\n end\n\n del_rec.each do |rec|\n @good_user_records.delete(rec)\n end\n \n end",
"def create\n nominee_params = params[:nominee][:user_id]\n nominee_split = nominee_params.split(\" \")\n\n # There could be spaces in the name. Safest assumption is first array item is partial firstname, and last array element is email\n # \"user_id\"=>\"User 14 Company2 ([email protected])\"}\n nominee_firstname = nominee_split.first rescue nil\n\n nominee_email1 = nominee_split.last\n nominee_email = nominee_email1.gsub(/[()]/, \"\") rescue nil\n nominee = User.where([\"firstname LIKE ? and email LIKE ? and admin_user_id = ?\", \"%#{nominee_firstname}%\",\"%#{nominee_email}%\", current_user.id])\n if nominee == nil || nominee.length == 0\n flash[:success] = \"Sorry, we couldn't locate that user.\"\n redirect_to :back\n end\n user_id = nominee[0].id\n email = nominee[0].email\n fullname = nominee[0].fullname\n firstname = nominee[0].firstname\n lastname = nominee[0].lastname\n @nominee = Nominee.new(params[:nominee])\n @nominee.user_id = user_id\n @nominee.email = email\n @nominee.fullname = fullname\n @nominee.firstname = firstname\n @nominee.lastname = lastname\n\n \n if nominee_params.present?\n nomineeemail = User.where('email = ?',nominee_email)\n if nomineeemail.present?\n if @nominee.save\n flash[:success] = \"User has been successfully nominated.\"\n redirect_to :back\n \n else\n redirect_to :back, :notice=> \"Please enter all the fields below.\"\n end\n else\n flash[:notice] = \"Sorry, we cannot find that person.\"\n redirect_to :back \n end\n else\n redirect_to :back, :notice=> \"Please enter all the fields below.\"\n end\nend",
"def invitable_users\n @title = \"Invitar usuario\"\n @invitable_users = GetInvitableUsers.call(@previa_group)\n end",
"def add_email_or_username(username_or_email)\n\t\temail_or_username_field.set(username_or_email)\n\tend",
"def usuarios_email_params\n params.require(:usuarios_email).permit(:nombre, :email, :identificador)\n end",
"def fill_users(name, phone, email, cpf)\r\n if @home_screen = page(HomeScreen)\r\n @home_screen.create_new_user\r\n else\r\n p 'try'\r\n end\r\n\r\n enter_text(\"* id:'#{user_name}'\", name)\r\n enter_text(\"* id:'#{user_phone}'\", phone)\r\n enter_text(\"* id:'#{user_email}'\", email)\r\n enter_text(\"* id:'#{user_cpf}'\", cpf)\r\n # enter_text(\"* id:'#{user_description}'\", description)\r\n end",
"def enter_pahma_users(test_data)\n users = test_data[UseOfCollections::USER_GRP.name] || [UseOfCollections.empty_user]\n prep_fieldsets_for_test_data([fieldset(UseOfCollections::USER_GRP.name)], users)\n\n users.each_with_index do |user, index|\n enter_auto_complete(user_name_input(index), user_name_options(index), user[UseOfCollections::USER.name], 'PAHMA Persons')\n wait_for_options_and_select(user_type_input(index), user_type_options(index), user[UseOfCollections::USER_INSTITUTION_ROLE.name])\n wait_for_options_and_select(user_role_input(index), user_role_options(index), user[UseOfCollections::USER_UOC_ROLE.name])\n enter_auto_complete(user_institution_input(index), user_institution_options(index), user[UseOfCollections::USER_INSTITUTION.name], 'PAHMA Organizations')\n end\n end",
"def registrar_usuario\n business_user = User.new\n business_user.email = self.email\n business_user.password = business_user.generar_password\n business_user.client_type = 'empresa'\n business_user.save\n update(user_id: business_user.id, user_created_id: business_user.id)\n #luego de registrar al usuario se almacena la contraseña en la tabla Historypassword\n #donde se almacenaran las 3 ultimas usadas\n password_business = HistoryPassword.new\n password_business.password = business_user.password\n password_business.user_id = business_user.id\n password_business.save\n end",
"def get_reg_users(guest_emails)\n g_arr = Array.new\n guest_emails.split(\",\").each do |e|\n # add user to guests array\n if user = User.find_by(email: e.strip)\n g_arr << user unless user == current_user\n else\n p \"User with email #{e} not found\"\n # Tell the UserMailer to send a invite\n UserMailer.invitation_email(e, current_user, @event).deliver\n end\n end\n g_arr\n end",
"def alta_profesores\n\t\t@tab = \"admin\"\n\t \tprof = params[:miembro]\n\t \t\n\t \t\tx = User.find(prof)\n\t \t\tx.profesor = true\t#se le dan derechos de profesor\n\t \t\tx.admin = false\n\t \t\tx.estudiante = false\n\t \t\tx.save\n\t \t\n\t \trespond_to do |format|\n\t\t format.html { redirect_to(alta_profesores_lista_path)}\n\t\t format.xml { head :ok }\n\t\tend\n\tend",
"def user_email_list\n @email_list = []\n\n EmailList.all.each do |email|\n if email.creator_id == current_user.id\n @email_list << email \n end\n end\n @email_list\n end",
"def add nick, email, jid\n\t\[email protected] Hash[\n\t\t\t'nick' => nick,\n\t\t\t'email' => email,\n\t\t\t'jid' => jid,\n\t\t\t'role' => 'user',\n\t\t\t'password' => 'NOTSET']\n\tend",
"def parse_user(name, email, trailer)\n link_to_user User.find_by_any_email(email),\n name: name,\n email: email,\n trailer: trailer\n end",
"def add_new_itemized_users(users)\n user = users.first\n\n unless user.user_group.nil?\n user_group_select.type_text(user.user_group)\n page.driver.execute_script(\"document.querySelector('img[alt=\\\"Search-button-icon\\\"]').click()\")\n wait_until { !loading_img.visible? }\n find(:xpath,\"//li[text()='#{user.user_group}']\").click unless user.user_group == ''\n wait_until {!(find(:xpath, \"//li[text()='#{user.user_group}']\").visible?) }\n end\n\n # name/email section\n nu_name_tb.type_text(user.name) unless user.name.nil?\n nu_email_tb.type_text(user.email) unless user.email.nil?\n # quota/device section\n nu_devices_server_tb.type_text(user.devices_server) unless user.devices_server.nil?\n nu_quota_server_tb.type_text(user.quota_server) unless user.quota_server.nil?\n nu_devices_desktop_tb.type_text(user.devices_desktop) unless user.devices_desktop.nil?\n nu_quota_desktop_tb.type_text(user.quota_desktop) unless user.quota_desktop.nil?\n\n unless user.enable_stash.nil?\n if user.enable_stash.downcase.eql?('yes')\n nu_enable_stash_cb.check\n else\n nu_enable_stash_cb.uncheck\n end\n end\n\n # default quota for stash?\n unless user.stash_quota.nil?\n if user.enable_stash.downcase.eql?('yes')\n if user.stash_quota.downcase.eql?('default')\n #its default\n else\n nu_stash_quota_tb.type_text(user.stash_quota) unless user.stash_quota.nil?\n end\n else\n end\n end\n\n # send stash invite emails?\n unless user.send_invite.nil?\n if user.send_invite.downcase.eql?('yes')\n nu_send_stash_inv_cb.check\n else\n nu_send_stash_inv_cb.uncheck\n end\n end\n\n # finishing up\n nu_create_btn.click\n #wait_until_bus_section_load\n end",
"def get_users(al)\n\t\t User.joins(:aliases, :groups).where(:'aliases.name' => al, :'aliases.active' => 1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t :'groups.name' => 'mail', :'users.active' => 1).pluck(:username)\n\tend",
"def invite_from_form(users)\n invite_users(users.map do |(_, value)|\n { name: value[:name], email: value[:email] }\n end)\n end",
"def alta_profesores_lista\n\t\t@profesores = []\n\t\t@tab = \"admin\"\n\t\tusuarios = User.select('id, matricula, nombre, apellido, admin, profesor').order(:matricula)\n\t\tusuarios.each do |usuario|\n\t\t\tif (usuario.matricula[0].chr == \"l\") || (usuario.matricula[0].chr == \"L\")\n\t\t\t#se checa primero que la matricula empiece con 'l'\n\t\t\t#'chr' se utiliza para leer el caracter tomando el ASCII\n\t\t\t\tif (!usuario.admin? && !usuario.profesor?)\n\t\t\t\t#checar que no sea admin ni profesor aun\n\t\t\t\t\t@profesores << usuario\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def mail_list\n str =\"\"\n self.users.each do |person|\n str << \"#{person.login} <#{person.email}> \\n\"\n end\n str\n end",
"def rebuild_accessibilities( emails=nil )\r\n emails ||= self.contact_people.collect{ |contact| contact.email }\r\n emails << self.email\r\n StoreUser.transaction do\r\n StoreUser.update_all( \"erp_account_number = NULL\", [\"erp_account_number = ?\", self.account_num] )\r\n StoreUser.update_all(\r\n \"erp_account_number = '#{self.account_num}'\",\r\n ['email_address in (?)', emails]\r\n ) unless emails.empty?\r\n end\r\n end",
"def preencher_usuario2 (nome, sobrenome, email, endereco, universidade, profissao, genero, idade)\n self.nome.set nome\n self.sobrenome.set sobrenome\n self.email.set email\n self.endereco.set endereco\n self.universidade.set universidade\n self.profissao.set profissao\n self.genero.set genero\n self.idade.set idade\n self.btn_criar.click\n end",
"def invite_users\n if GroupsController.group_owner? current_user.id, params[:id]\n set_group\n params[:users].each do |email|\n user = User.find_by_email(email) # TODO: only possible because email is unique. Should make magic assist to return user id's\n @group.users << user unless @group.users.include? user or user.nil?\n end unless params[:users].nil?\n respond_to do |format|\n format.html { redirect_to group_path(@group), alert: 'Invited users successfully.' }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to groups_path, alert: \"Not invited. You are not the group owner\" }\n format.json { render json: \"Only owners can add users to the respective group\", status: :unauthorized}\n end\n end\n end",
"def add_user_personal_info(email, first_name, last_name, phone=nil)\n user_email.set email\n user_first_name.set first_name\n user_last_name.set last_name\n user_phone.set phone if phone\n end",
"def add_admins_by_email(emails)\n # For users that already have accounts, add to role immediately\n existing_emails = User.where(email: emails).map do |u|\n u.add_role :admin, self\n u.email\n end\n # For new users, send invitation and add to role\n (emails - existing_emails).each do |email|\n u = User.invite!(email: email)\n u.add_role :admin, self\n end\n end",
"def invite_from_form(users)\n invite_users(users.map do |(_, value)|\n { name: value[:course_user][:name], email: value[:user_email][:email] }\n end)\n end",
"def registrar_usuario\n employee_user = User.new\n employee_user.email = self.email\n employee_user.password = employee_user.generar_password\n employee_user.username = asignar_username_con_opciones\n if asignar_username_con_opciones.present?\n employee_user.username = asignar_username_con_opciones\n else\n employee_user.username = self.usuario.downcase\n end\n employee_user.client_type = 'empleado'\n employee_user.save\n update(user_id: employee_user.id, user_created_id: employee_user.id) \n #luego de registrar al usuario se almacena la contraseña en la tabla Historypassword\n #donde se almacenaran las 3 ultimas usadas\n password_employee = HistoryPassword.new\n password_employee.password = employee_user.password\n password_employee.user_id = employee_user.id\n password_employee.save\n end",
"def prepare_contacts\n return unless defined? @user\n @user.user_default_emails.sort_by{|a| a.role_id.to_i}\n end",
"def ensure_user_byemail(email, name)\n users = db[:users]\n usr = users.first(:email => email)\n\n if usr.nil?\n\n u = retrieve_user_byemail(email, name)\n\n if u.nil? or u['login'].nil?\n warn \"Could not retrieve user #{email} through search API query\"\n login = (0...8).map { 65.+(rand(25)).chr }.join\n users.insert(:email => email,\n :name => name,\n :login => login,\n :fake => true,\n :deleted => false,\n :created_at => Time.now)\n info \"Added user fake #{login} -> #{email}\"\n users.first(:login => login)\n else\n in_db = users.first(:login => u['login'])\n geo = geolocate(location: u['location'])\n if in_db.nil?\n users.insert(:login => u['login'],\n :name => u['name'],\n :company => u['company'],\n :email => u['email'],\n :long => geo[:long],\n :lat => geo[:lat],\n :country_code => geo[:country_code],\n :state => geo[:state],\n :city => geo[:city],\n :fake => false,\n :deleted => false,\n :created_at => date(u['created_at']))\n info \"Added user #{u['login']} (#{email}) through search API query\"\n else\n in_db.update(:name => u['name'],\n :company => u['company'],\n :email => u['email'],\n :long => geo[:long],\n :lat => geo[:lat],\n :country_code => geo[:country_code],\n :state => geo[:state],\n :city => geo[:city],\n :fake => false,\n :deleted => false,\n :created_at => date(u['created_at']))\n debug \"User #{u['login']} with email #{email} exists\"\n end\n users.first(:login => u['login'])\n end\n else\n debug \"User with email #{email} exists\"\n usr\n end\n end",
"def tentarlogar(email, senha)\n campo_email.set email\n campo_senha.set senha\n botao_entrar.click\n end",
"def email_from_infos\n user_infos.map(&:email).try(:first)\n end",
"def create_user\n authorize! :update, @user, :message => t('errors.messages.not_authorized_as_manager')\n #@marina = Marina.find(params[:id])\n @marina = current_user.marina # try this\n anemail = params[:user_email]\n\n if User.exists?(email: anemail)\n redirect_to @marina, :alert => t('errors.messages.User_already_registered')\n else\n if anemail =~ /@/\n @marina.create_user(anemail)\n redirect_to @marina, notice: t('errors.messages.User_created_and_notified')\n else\n redirect_to @marina, :alert => t('errors.messages.User_created_and_notified')\n end\n end \n end",
"def extend_fields\n if username.blank?\n # Synthesize a unique username from the email address or fullname\n n = 0\n startname = handle if (startname = email.sub(/@.*/, '')).blank?\n self.username = startname\n until (User.where(username: username).empty?) do\n n += 1\n self.username = startname+n.to_s\n end\n end\n # Provide a random password if none exists already\n self.password = email if password.blank? # (0...8).map { (65 + rand(26)).chr }.join\n self.fullname = \"#{first_name} #{last_name}\" if fullname.blank? && !(first_name.blank? || last_name.blank?)\n end",
"def add_admin\n @email = :email\n User.invite!(:email => @email, :ngo => current_user.ngo)\n end",
"def invite_new_users(users)\n user_email_map = user_email_map(users.map { |user| user[:email] })\n\n users.map do |user|\n course_user = @current_course.course_users.build(name: user[:name], workflow_state: :invited,\n creator: @current_user,\n updater: @current_user)\n user_email = user_email_map[user[:email]] || User::Email.new(email: user[:email])\n user_email.skip_confirmation!\n course_user.build_invitation(user_email: user_email, creator: @current_user,\n updater: @current_user)\n end\n end",
"def search_users(wildcard_email_address)\n filter = Net::LDAP::Filter.eq(ENTITY_ATTR_MAPPING[:email].to_s, wildcard_email_address)\n return search_map_user_fields(filter)\n end",
"def add_member_email(email)\n\n end",
"def index\n if(current_user.entidade_id.nil?)\n @users = []\n @users.push User.find_by(email: current_user.email)\n else\n @users = User.where(entidade_id: current_user.entidade_id.to_int)\n end\n\n if(current_user.tipo.eql? 1)\n @users = User.where('tipo = 1 or tipo = 2 or tipo = 4')\n elsif(current_user.tipo.eql? 2)\n @users = User.distinct()\n .joins('left join reservas r on users.id = r.user_id')\n .where('(tipo in(2,3) and users.entidade_id=?) or (tipo = 4 and r.entidade_id=?)', current_user.entidade_id, current_user.entidade_id)\n elsif(current_user.tipo.eql? 3)\n @users = User.distinct()\n .joins('left join reservas r on users.id = r.user_id')\n .where('tipo = 4 and r.entidade_id=?', current_user.entidade_id)\n else \n end\n end",
"def set_entourage_user_hashes\n User.find_each do |user|\n email_hashes[hash(user.email)] = user.id\n phone_hashes[hash(user.phone)] = user.id\n end\n end",
"def add_mail\n user = User.find(2)\n admin = User.find_by(admin: true)\n UserMailer.add_mail(user, admin)\n end",
"def inicia_analista\n current_usuario = Usuario.create!(PRUEBA_USUARIO_AN)\n current_usuario.grupo_ids = [20]\n current_usuario.save\n return current_usuario\n end",
"def inicia_analista\n current_usuario = Usuario.create!(PRUEBA_USUARIO_AN)\n current_usuario.grupo_ids = [20]\n current_usuario.save\n return current_usuario\n end",
"def inicia_analista\n current_usuario = Usuario.create!(PRUEBA_USUARIO_AN)\n current_usuario.grupo_ids = [20]\n current_usuario.save\n return current_usuario\n end",
"def inicia_analista\n current_usuario = Usuario.create!(PRUEBA_USUARIO_AN)\n current_usuario.grupo_ids = [20]\n current_usuario.save\n return current_usuario\n end",
"def inicia_analista\n current_usuario = Usuario.create!(PRUEBA_USUARIO_AN)\n current_usuario.grupo_ids = [20]\n current_usuario.save\n return current_usuario\n end",
"def inicia_analista\n current_usuario = Usuario.create!(PRUEBA_USUARIO_AN)\n current_usuario.grupo_ids = [20]\n current_usuario.save\n return current_usuario\n end",
"def atualiza_uffmail(matricula, uffmail)\n CSV.open(\"temp.csv\", \"wb\") do |csv|\n CSV.foreach(@path,headers:true, return_headers:true)do |linha|\n if linha[\"matricula\"]== matricula\n linha[\"uffmail\"] = uffmail\n csv << linha\n else\n csv << linha\n end\n\n end\n end\n\n File.rename(\"temp.csv\", @path )\n puts \"UFFMail atualizado com sucesso.\"\n end",
"def curator_list\n users.map(&:email)\n end",
"def add_author_emails(people)\n people.each do |person|\n user = User.find_or_initialize_by(email: person[:email])\n user.save(validate: false) if user.new_record?\n record = AuthorPublication.find_or_initialize_by(email: person[:email], publication: self)\n record.attributes = person\n record.user = user\n record.claim_link ||= Digest::SHA2.hexdigest(\"#{to_param}#{person[:email]}\")\n record.save\n end\n end",
"def RepeticionEmailCreate(lista_usuario, email)\n val = true\n lista_usuario.each do |usuario|\n if usuario.email == email.downcase\n val = false\n break\n end\n end\n return val\n end",
"def create\n @user = User.new(params[:user])\n \n puts \"#{@user.name} - #{@user.email}\"\n \n if !@@invite.nil? && self.encrypt_word(@user.email).eql?(encrypt_word(@@invite.email))\n @user.active = true\n if @user.save\n @@invite.update_attributes(:active => true)\n flash[:notice] = \"Usuario cadastrado com sucesso.\"\n render :action => :show\n end\n else\n flash[:notice] = \"Email invalido.\"\n render :action => :new\n end\n end",
"def set_usuario\n @usuario = Usuario.find_by_email(current_usuario.email)\n end",
"def affro\r\n @users = User.all\r\n end",
"def make_user(params = {})\n self.user= account.users.build_with_fields params.reverse_merge(:email => email, :invitation => self)\n end",
"def send!\n self.to_csv.split(/\\n/).each do |line|\n user = User.find_by_email(line.split(/\\t/)[0])\n fields = line.strip.split(/\\t/)[1..-1]\n self.send_message(user, fields)\n end\n end",
"def set_usuario\n @user = Usuario.select('id,nombre,apellido,usuario,twitter').find(params[:id])\n end",
"def user_added_contact_emails\n self.user ? self.user.added_contacts.pluck('email') + [self.user.email] : []\n end",
"def index\n\t@form_primarios = FormPrimario.where('emailUsuario = ?', current_usuario.email)\n end",
"def set_usuario\n \n end",
"def sign_up_users(first_name, last_name, email, password)\n find_by_id('com.yelp.android:id/first_name').send_key first_name\n find_by_id('com.yelp.android:id/last_name').send_key last_name\n find_by_id('com.yelp.android:id/email_address').send_key email\n find_by_id('com.yelp.android:id/password').send_key password\n find_name('Gender')\n find_name('Male')\n end",
"def create\n users_params = params[:users] || {}\n emails = []\n users_params.each_value do |attrs|\n user = User.find_by(email: attrs['email'])\n if !user.present?\n user = User.new(email: attrs['email'], firm_id: current_user.firm_id, role: attrs['role'].to_i)\n user.skip_confirmation!\n end\n # if the user is in the system, then invite the person this way\n # @raw_invitation_token = Devise.token_generator.generate(User, :invitation_token)\n # logger.info \"@raw_invitation_token: #{@raw_invitation_token}\\n\\n\\n\"\n # user.invitation_token = @raw_invitation_token[1]\n # user.invitation_created_at = Time.now.utc\n # user.invitation_sent_at = user.invitation_created_at\n # user.invitation_role = attrs['role'].to_i\n # user.invited_by = current_user\n # options = {user: user, admin: current_user, token: @raw_invitation_token[0], role: User::USER_ROLES[attrs['role'].to_i]}\n # # puts \"ADMIN WHAT IS ADMIN ----------> \" + options.inspect\n # UserEmails.invite_existing_user(options).deliver if user.save(:validate => false)\n # else\n # # if the user is NOT in the system, then send out invite this way (it also creates a user)\n # puts \"IS THIS WHERE I AM ---------------------> \"\n # @raw_invitation_token = Devise.token_generator.generate(User, :invitation_token)\n # user = User.new(email: attrs['email'], firm_id: current_user.firm_id, role: attrs['role'].to_i)\n # options = {user: user, admin: current_user, token: @raw_invitation_token[0], role: [attrs['role'].to_i]}\n # #user.save!\n # UserEmails.invite_new_user(options).deliver if user.save(:validate => false)\n #user = User.invite!({email: attrs['email'], firm_id: current_user.firm_id, role: attrs['role'].to_i }, current_user)\n #end\n @raw_invitation_token = Devise.token_generator.generate(User, :invitation_token)\n logger.info \"@raw_invitation_token: #{@raw_invitation_token}\\n\\n\\n\"\n user.invitation_token = @raw_invitation_token[1]\n user.invitation_created_at = Time.now.utc\n user.invitation_sent_at = user.invitation_created_at\n user.invitation_role = attrs['role'].to_i\n user.firm = current_user.firm\n user.role = attrs['role'].to_i\n user.invited_by = current_user\n options = {user: user, admin: current_user, token: @raw_invitation_token[0], role: User::USER_ROLES[attrs['role'].to_i]}\n options[:firm_name] = request[:invitee_firm_name] if request[:invitee_firm_name]\n # puts \"ADMIN WHAT IS ADMIN ----------> \" + options.inspect\n UserEmails.invite_existing_user(options).deliver if user.save(:validate => false)\n\n emails << attrs['email']\n end\n\n if request.xhr?\n if emails.present?\n render json: {message: \"Invitations were sent to: #{emails.to_sentence}\"}, :status => 200\n else\n render json: {message: 'Email was not sent'}, :status => 500\n end\n else\n if emails.present?\n redirect_to root_path, notice: \"Invitations were sent to: #{emails.to_sentence}\"\n else\n flash[:notice] = 'Email was not sent'\n render :new\n end\n end\n end",
"def get_emails(emails,incidente)\n return ['[email protected]'] if RAILS_ENV.include?'development'\n area_id=incidente.funcionario.cargo.area_id\n cargo_ids=Cargo.find(:all,:select=>'id',:conditions=>{:area_id=>area_id,:recibe_mails_hechos=>true}).map(&:id)\n mails1=Usuario.activos.find(:all,:select=>'email',:conditions=>{:cargo_id=>cargo_ids}).map(&:email)\n mails2=case true\n when (!emails[:parametro].blank? and !emails[:direcciones].blank?)\n Parametro.destinatarios(emails[:parametro]).concat(emails[:direcciones]).uniq\n when !emails[:parametro].blank?\n Parametro.destinatarios(emails[:parametro])\n when !emails[:direcciones].blank?\n emails[:direcciones].uniq \n else\n [\"[email protected]\"]\n end\n mails1.concat(mails2).uniq\n end",
"def invite_new_users(users)\n invitations = users.map do |user|\n @current_course.invitations.build(name: user[:name], email: user[:email])\n end\n validate_new_invitation_emails(invitations)\n end",
"def login_as\n @page_title = _('Login_as')\n @page_icon = 'key.png'\n\n\n @users = User.select(\"*, #{SqlExport.nice_user_sql}\").where(hidden: 0).order(\"nice_user ASC\")\n\n end",
"def contacts_gmail_email(contacts)\n @hash_contactos = Hash.new\n \t\t@contact_email = []\n contacts.each {|lista|\n lista.each {|key,value|\n if (key == :email)\n @contact_email << value\n end\n }\n }\n return @contact_email\n\tend",
"def get_aliases\n # Connect to the database\n conn = PG.connect( dbname: DB_DATABASE_NAME, user: DB_USER, password: DB_PASSWORD )\n\n w = ''\n\n if $alias || $email\n w = \" WHERE\"\n w << \" address LIKE '#{$alias}'\" if $alias\n w << \" AND\" if $alias && $email\n w << \" userid LIKE '#{$email}'\" if $email\n end\n\n # Insert the user into the correct table\n res = conn.exec \"SELECT * FROM #{DB_ALIAS_TABLE}#{w}\"\n\n # Close the connection\n conn.close\n\n return res\nend",
"def search_user_by_email\n @users = User.get_all_users(current_user).where(email:params[:email], is_active: true).first\n get_tenants_user(@users)\n end",
"def refresh_mailing_list\n emails = MassEmail.all.map{|m|m.email_address}\n File.open(File.join(Rails.root, 'config', 'mailing_list.txt')).each_line do |e|\n e = e.chomp\n unless emails.include?(e)\n url_code = new_random_url_code\n m = MassEmail.new(email_address: e, url_code: url_code)\n m.save!\n end\n end\n\n emails = MassEmail.all.map{|m|m.email_address}\n User.all.map{|u| u.email}.each do |e| \n unless emails.include?(e)\n url_code = new_random_url_code\n m = MassEmail.new(email_address: e, url_code: url_code)\n m.save!\n end\n end\nend",
"def refresh_mailing_list\n emails = MassEmail.all.map{|m|m.email_address}\n File.open(File.join(Rails.root, 'config', 'mailing_list.txt')).each_line do |e|\n e = e.chomp\n unless emails.include?(e)\n url_code = new_random_url_code\n m = MassEmail.new(email_address: e, url_code: url_code)\n m.save!\n end\n end\n\n emails = MassEmail.all.map{|m|m.email_address}\n User.all.map{|u| u.email}.each do |e| \n unless emails.include?(e)\n url_code = new_random_url_code\n m = MassEmail.new(email_address: e, url_code: url_code)\n m.save!\n end\n end\nend",
"def register_user_to_fb\n\t #users = {:email => email, :account_id => id}\n\t #Facebooker::User.register([users])\n\t #self.email_hash = Facebooker::User.hash_email(email)\n\t #save(false)\n\tend",
"def agregar_alumnos\n @grupo = Grupo.find(params[:id])\n if request.get?\n @alumnos = Alumno.alumnos_sin_grupo(params[:buscar])\n end\n if request.put?\n unless params[:alumno_ids].nil?\n @alumnos = Alumno.find(params[:alumno_ids])\n for a in @alumnos\n @grupo.alumnos << a\n end\n flash[:notice] = \"Se agregaron los alumnos al grupo\" if @grupo.save\n end\n redirect_to grupo_path(@grupo)\n end\n end",
"def headers\n \t{\n \t :subject => \"Criação de Conta de Usuário tipo Representante Empresa\",\n \t :to => \"[email protected]\",\n \t :from => %{\"#{name}\" <#{email}>}\n \t}\n end",
"def index\n\t\tauthorize! :index, NotificacionEmail\n @notificacion_emailes = NotificacionEmail.all\n end",
"def user\n name = params[:name]\n number = params[:number]\n mail = params[:mail]\n id = params[:id]\n mail = \"#{mail}@gionee.com\" if mail.present? && mail.exclude?(\"@\")\n\n scope = User.all\n scope = scope.where(:id => id) if id.present?\n scope = scope.like(name) if name.present?\n scope = scope.where(:empId => number) if number.present?\n scope = scope.joins(:email_addresses).where(:email_addresses => {:address => mail}) if mail.present?\n\n users = scope.count == User.all.count ? [] : scope.limit(30)\n hash = users.map do |user|\n {\n :name => user.name,\n :id => user.id,\n :global_id => user.login,\n :number => user.empId,\n :mail => user.mail,\n :dept => user.dept_name,\n :dept_id => user.dept.try(:id)\n }\n end\n render :json => hash\n end",
"def invite_by_mail\n @user = User.find_by_id(params[:id])\n raise Kroogi::NotPermitted unless @user && @user.active? && permitted?(@user, :profile_edit) # @user is inviter\n\n begin\n invited = []\n Invite.transaction do\n params[:user_emails].split(',').each do |eml|\n eml = eml.strip\n next unless eml.match(User::EMAIL_REGEX)\n next if Invite.find_by_user_email_and_inviter_id(eml, @user.id)\n\n Locale.with_locale(params[:locale]) do\n @invite = Invite.new_for_mail(params[:invite].merge(:join_inviter_to_invited => true), @user, params[:locale])\n @invite.user_email = eml\n @invite.save!\n invited << @invite\n end\n end\n end\n if invited.empty?\n flash[:warning] = \"Unable to send any invites: couldn't parse emails or emails have already been invited\".t\n redirect_to :action => 'new', :id => @user, :user_emails => params[:user_emails], :locale => params[:locale], :invite => {:invitation => params[:invite][:invitation]}\n else\n flash[:success] = invited.size == 1 ? (\"Sent invite to %s\"/[invited.first.user_email]) : (\"Sent invites to: %s\"/[h(invited.map(& :user_email).to_sentence)])\n redirect_to :controller => 'kroogi', :action => 'show_pending', :id => @user, :type => Invite::TYPES[:site_invite][:id], :highlight_invite => invited.map(& :id).join('|')\n end\n rescue ActiveRecord::RecordInvalid\n do_find params\n render :action => 'find'\n end\n end",
"def admins\n [self.user.email, self.user_annotation_shares.can_edit, User.where(admin: true).pluck(:email)].flatten.uniq\n end",
"def select_user_information(mail)\n return get_db_as_hash().execute(\"SELECT * FROM user WHERE mail = ?\", mail).first\n end",
"def update_users\n\tusers = [['adoni','Biwi'],\n\t['biwi','Biwi'],\n\t['dyton','Biwi'],\n\t['bwalo','Bwalo 1'],\n\t['bwalo2','Bwalo 2'],\n\t['bwatha','Bwatha'],\n\t['zunguzeni','Bwatha'],\n\t['chagamba','Chagamba'],\n\t['kelvin','Chagamba'],\n\t['chakale','Chakala'],\n\t['chalasa','Chalasa'],\n\t['chaonya','Chaonya'],\n\t['kenivasi','Chaonya'],\n\t['chidalanda','Chidalanda'],\n\t['gilbert','Chidalanda'],\n\t['chembekezo','Chidzele'],\n\t['chigo','Chikamba'],\n\t['chikamba','Chikolokoto'],\n\t['abisoni','Chimphepo'],\n\t['chimphepo','Chimphepo'],\n\t['salimoni','Chimphepo'],\n\t['chisomba','Chisomba'],\n\t['rose','Chisomba'],\n\t['biliyati','Chitawa'],\n\t['liana','Chitawa'],\n\t['rihanna','Chitawa'],\n\t['chithengo','Chithengo'],\n\t['yoki','Chithengo'],\n\t['chitululu','Chitululu'],\n\t['chizumba','Chizumba'],\n\t['chule','Chule 1'],\n\t['kathumba','Chule 1'],\n\t['rodiwelo','Chule 1'],\n\t['chule2','Chule 2'],\n\t['kambizeni','Chule 2'],\n\t['dongo','Dongolosi'],\n\t['dongolosi','Dongolosi'],\n\t['fainda','Fainda'],\n\t['yolamu','Fainda'],\n\t['beatrice','Kabzyoko'],\n\t['kabzoko','Kabzyoko'],\n\t['kacheche','Kacheche'],\n\t['esawo','Kalulu'],\n\t['kamadzi','Kamadzi'],\n\t['steve','Kamadzi'],\n\t['kambira','Kambiri'],\n\t['kambulire','Kambulire 1'],\n\t['kambulire2','Kambulire 2'],\n\t['sankhani','Kambulire 2'],\n\t['kamphinga','Kamphinga'],\n\t['kaninga','Kaninga'],\n\t['kondwani','Kaninga'],\n\t['kanyoza','Kanyoza'],\n\t['bazale','Kanyoza'],\n\t['lotale','Kazinkambani'],\n\t['kholongo','Kholongo'],\n\t['david',\"M’maso\"],\n\t['davie',\"M’maso\"],\n\t['mayikolo','Malenga'],\n\t['mankhwazi','Mankhwazi'],\n\t['jenet','Maole'],\n\t['maole','Maole'],\n\t['maselero','Maselero'],\n\t['charles','Masumba'],\n\t['masumba','Masumba'],\n\t['weluzani','Masumba'],\n\t['matchakaza','Matchakaza'],\n\t['william','Matchakaza'],\n\t['mawunda','Maunda'],\n\t['mazira','Mazira'],\n\t['kazimkambani','Mbalame'],\n\t['mbalame','Mbalame'],\n\t['mblame','Mbalame'],\n\t['mbewa','Mbewa'],\n\t['mbulachisa','Mbulachisa'],\n\t['kasakula','Mchena'],\n\t['mchena','Mchena'],\n\t['nchazime','Mchezime'],\n\t['henry','Mdzoole'],\n\t['mdzoole','Mdzoole'],\n\t['mfuti','Mfuti'],\n\t['mgwadula','Mgwadula'],\n\t['misewu','Misewo'],\n\t['mkupeta','Mkupeta'],\n\t['mmaso','Mmaso'],\n\t['brino','Mndele'],\n\t['mphandu','Mphandu'],\n\t['mphonde','Mphonde'],\n\t['mseteza','Mseteza'],\n\t['jackson','Mtema 1'],\n\t['makombe','Mtema 1'],\n\t['mtema1','Mtema 1'],\n\t['fredrick','Mtema 2'],\n\t['mtsukwachikupa','Mtsukwa Chikupa'],\n\t['mtsukwakalonje','Mtsukwa Kalonje'],\n\t['mutu','Mutu'],\n\t['mwaza','Mwaza'],\n\t['mtsatsula','Mzingo'],\n\t['hezekia','Mzumanzi 1'],\n\t['mzumazi2','Mzumanzi 2'],\n\t['nzumazi2','Mzumanzi 2'],\n\t['nzumazi','Mzumazi 1'],\n\t['ndalama','Ndalama'],\n\t['ngoza','Ngoza'],\n\t['sitima','Ngoza'],\n\t['nkhadani1','Nkhadani 1'],\n\t['nkhadani2','Nkhadani 2'],\n\t['nkhanamba','Nkhanamba'],\n\t['konkha','Nkhonkha'],\n\t['amosi','Nkhutchi'],\n\t['chisisi','Nkhutchi'],\n\t['andrew','Nkhutchi'],\n\t['ezala','Nsanda'],\n\t['ezara','Nsanda'],\n\t['nsanda','Nsanda'],\n\t['pheleni','Pheleni'],\n\t['laston','Suntche 1'],\n\t['suntche1','Suntche 1'],\n\t['jonathani','Suntche 1'],\n\t['boston','Suntche 2'],\n\t['suntche2','Suntche 2'],\n\t['jonas','Taiza'],\n\t['kwimbayani','Taiza'],\n\t['taiza','Taiza'],\n\t['joseph','Wayakumseche']]\n\t\n\t#-----------------------------\n\t\n\t(users || []).each do |user|\n\t\tusername = user[0]\n\t\tvillage_name = user[1]\n\t\tuser_village = Village.find_by_name(village_name)\n\t\tif user_village.nil?\n\t\t\tputs \"#{user} failed to update. Moving on to next user\"\n\t\t\tnext\n\t\tend\n\t\t\n\t\tuser_district = District.find_by_name('Lilongwe')\n\t\t\n\t\tuser_update = User.find(username)\n\t\tnext if user_update.nil?\n\t\t\n\t\tuser_update.district_id = user_district.id\n\t\tuser_update.ta_id = user_village.ta_id\n\t\tuser_update.village_id = user_village.id\n\t\tuser_update.save\n\t\t\n\t\tputs \"Username #{user} updated successfully \\n\"\n\tend\nend",
"def selecionar_email_consulta(email_consulta)\n email_filtro_consulta_select.select(email_consulta)\n end",
"def add_new_users(users)\n user = users.first\n wait_until_bus_section_load\n user_group_select.select(user.user_group) unless user.user_group.nil?\n storage_type_select.select(user.storage_type) unless user.storage_type.nil?\n storage_max_tb.type_text(user.storage_limit) unless user.storage_limit.nil?\n device_tb.type_text(user.devices) unless user.devices.nil?\n\n unless user.enable_stash.nil?\n if user.enable_stash.downcase.eql?('yes')\n enable_stash_cb.check\n else\n enable_stash_cb.uncheck\n end\n end\n\n users.each_index do |index|\n Log.debug \"##########adding the #{index} user\"\n find(:id, \"user#{index+1}_name\").type_text(users[index].name)\n find(:id, \"user#{index+1}_username\").type_text(users[index].email)\n add_user_btn.click if index != users.length-1\n end\n\n unless user.send_email.nil?\n if user.send_email.downcase.eql?('yes')\n send_emails_cb.check\n else\n send_emails_cb.uncheck\n end\n end\n\n submit_btn.click\n wait_until_bus_section_load\n end",
"def check_new_mail\n if (params[:user][:email] != @user.email)\n if (User.where(:nick => params[:user][:email]).count > 0)\n false\n else\n true\n end\n else\n true\n end\n end",
"def link_to_invitations\n UserInvite.where(email: email).find_each do |invite|\n invite.user = self\n invite.save\n end\n end",
"def user_email\n msg['email'] || entry['email'] || reject['email']\n end",
"def emails(text)\n scan(text, EMAIL, :email)\n end",
"def seguir(otro_usuario)\n\t\t# siguiendo << otro_usuario\n\t\trelaciones_activas.create(seguido_id: otro_usuario.id)\n\tend",
"def new_user_email(user)\n @user = user\n User.where(admin: true).each do |admin|\n mail(to: admin.email, subject: \"A new user #{@user.email} has been added.\")\n end\n end",
"def index\n @openfire_users = OpenfireUser.where(\"mi_user_id = ?\", current_mi_user.id)\n @login_email=current_mi_user.email\n end",
"def submit(ms)\n @name = ms.user.first_name + ' ' + ms.user.last_name\n @link = 'http://' + dashboard_path(ms.id)\n \n ms.user.department.users.select do |u|\n if u.has_role? :dept_chief\n\t mail to: u.email, subject: 'Pontaj trimis spre aprobare'\n end\n end\n end",
"def add_email\n if params[:user] && params[:user][:email]\n current_user.email = params[:user][:email]\n current_user.skip_reconfirmation! # don't forget this if using Devise confirmable\n respond_to do |format|\n if current_user.save\n # TODO: i18n this notice\n format.html { redirect_to current_user, notice: 'Your email address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { }\n format.json { render json: current_user.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def menciones\n\t\tcontenido.scan(/@(#{Usuario::RegexNombre})/).flatten.map do |mencion|\n\t\t\tUsuario.find_by(nombre: mencion)\n\t\tend.compact\n\tend",
"def add_email\n @group = Group.find(params[:group][:id])\n @email = params[:user][:email].gsub(\" \",\"\")\n @user = User.find(:first, :conditions => {:email => @email, :account_status => 'active'})\n host_port = request.host_with_port\n @notice = \"User added successfully to crowd.\"\n if @email == @login_user.email\n @notice = \"Can't add yourself to crowd.\"\n elsif @user.present? && (@group.is_group_member?(@user.id) || @group.is_non_site_member?(@email))\n @notice = \"User already added to crowd.\"\n elsif @user.present?\n @added = true\n @disc_group_user = GroupUser.create(:group_id => @group.id, :user_id => @user.id)\n @following = FollowerFollowing.create(:follower_id => @login_user.id, :following_id => @user.id, :get_email_updates => true) unless @login_user.is_following?(@user.id) || @login_user.is_follower?(@user.id)\n elsif @group.is_non_site_member?(@email)\n @notice = \"User already added to crowd.\"\n else\n @added = true\n @non_site_user = NonSiteUser.create(:email => @email, :invitable_id => @group.id, :invitable_type => \"Group\")\n end\n respond_to do |format|\n format.js\n end\n end",
"def staff\n [\n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\"\n ]\nend",
"def staff\n [\n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\", \n \"[email protected]\"\n ]\nend",
"def email_list\n end",
"def add_email(e)\n emails << e\n end",
"def email\n @email ||= select { |type,value| type == :email }.map do |(type,value)|\n value\n end\n end",
"def sendemailtoattendees\n \t@users = ConferenceUser.where(:conference_id => Conference.active)\n \t@sub = params[:emailbody]\n\n @array = []\n\n @users.each do |u|\n @getname = @sub.sub(\"@@Name@@\", \"#{u.user[:first_name]} #{u.user[:last_name]}\" )\n @array << @getname\n end\n\n render :text => @array.to_json\n\n\n\n end"
]
| [
"0.616047",
"0.5944903",
"0.5830487",
"0.5655905",
"0.55667967",
"0.55326265",
"0.5519343",
"0.5499764",
"0.5458312",
"0.5456736",
"0.54508513",
"0.5449318",
"0.5449297",
"0.5445801",
"0.544288",
"0.5361915",
"0.5354674",
"0.5353646",
"0.5343716",
"0.53362054",
"0.53282547",
"0.5311516",
"0.53063035",
"0.53014857",
"0.5295462",
"0.5279874",
"0.52794373",
"0.5277391",
"0.5275289",
"0.52728295",
"0.5267848",
"0.52661556",
"0.5264567",
"0.5261104",
"0.52532893",
"0.52494085",
"0.52361506",
"0.5228995",
"0.5227423",
"0.5226761",
"0.5220166",
"0.5204961",
"0.5180155",
"0.5179714",
"0.5179714",
"0.5179714",
"0.5179714",
"0.5179714",
"0.5179714",
"0.517809",
"0.51748306",
"0.5170285",
"0.5160047",
"0.51557916",
"0.5154398",
"0.5146977",
"0.5142106",
"0.5127735",
"0.51235837",
"0.51215273",
"0.5096685",
"0.5095843",
"0.50937515",
"0.5092904",
"0.5085524",
"0.5079509",
"0.5074911",
"0.5074346",
"0.5072112",
"0.50720686",
"0.5056765",
"0.5056765",
"0.50533533",
"0.5051828",
"0.5049711",
"0.50469023",
"0.5039449",
"0.5038647",
"0.50377643",
"0.50355464",
"0.50298536",
"0.5028231",
"0.5019374",
"0.5016174",
"0.50089234",
"0.50084436",
"0.50075847",
"0.5006506",
"0.5006445",
"0.50020313",
"0.50004065",
"0.5000289",
"0.49997434",
"0.4997019",
"0.49963385",
"0.49963385",
"0.49943092",
"0.49891528",
"0.4987878",
"0.49876267"
]
| 0.5008871 | 85 |
Buscamos en la tabla usuarios los emails, devolvemos los que no esten > invitar personas | def add_new_contacts(emails)
@list_email = []
emails.each {|email|
@list_email << email if !already_exits?(email)
}
return @list_email
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def complete_email_list\n #Email.select(:email).map{|email_record| email_record.email}\n User.all.map(&:email)\n end",
"def index\n @usuarios_emails = UsuariosEmail.all\n end",
"def get_reg_users(guest_emails)\n g_arr = Array.new\n guest_emails.split(\",\").each do |e|\n # add user to guests array\n if user = User.find_by(email: e.strip)\n g_arr << user unless user == current_user\n else\n p \"User with email #{e} not found\"\n # Tell the UserMailer to send a invite\n UserMailer.invitation_email(e, current_user, @event).deliver\n end\n end\n g_arr\n end",
"def invitable_users\n @title = \"Invitar usuario\"\n @invitable_users = GetInvitableUsers.call(@previa_group)\n end",
"def get_emails(emails,incidente)\n return ['[email protected]'] if RAILS_ENV.include?'development'\n area_id=incidente.funcionario.cargo.area_id\n cargo_ids=Cargo.find(:all,:select=>'id',:conditions=>{:area_id=>area_id,:recibe_mails_hechos=>true}).map(&:id)\n mails1=Usuario.activos.find(:all,:select=>'email',:conditions=>{:cargo_id=>cargo_ids}).map(&:email)\n mails2=case true\n when (!emails[:parametro].blank? and !emails[:direcciones].blank?)\n Parametro.destinatarios(emails[:parametro]).concat(emails[:direcciones]).uniq\n when !emails[:parametro].blank?\n Parametro.destinatarios(emails[:parametro])\n when !emails[:direcciones].blank?\n emails[:direcciones].uniq \n else\n [\"[email protected]\"]\n end\n mails1.concat(mails2).uniq\n end",
"def build_user_emails_for_edit\n @edit[:user_emails] = {}\n to_email = @edit[:new][:email][:to] || []\n users_in_current_groups = User.with_groups(User.current_user.miq_groups).distinct.sort_by { |u| u.name.downcase }\n users_in_current_groups.each do |u|\n next if u.email.blank?\n next if to_email.include?(u.email)\n\n @edit[:user_emails][u.email] = \"#{u.name} (#{u.email})\"\n end\n end",
"def user_email_list\n @email_list = []\n\n EmailList.all.each do |email|\n if email.creator_id == current_user.id\n @email_list << email \n end\n end\n @email_list\n end",
"def send_all_invitations\n uu = User.all.reject{|u| u.bounced_at || u.test || u.email =~ /musicalretreat.org/ || u.has_current_registration}\n Rails.logger.info(\"Going to send #{uu.size} invitations\")\n uu.each do |u|\n begin\n RegistrationMailer.invitation(u)\n Rails.logger.info(\"Successfully sent to #{u.email}\")\n rescue StandardError => e\n Rails.logger.error(\"Failed to send to #{u.email} due to #{e}\")\n end\n end\n end",
"def mail_list\n str =\"\"\n self.users.each do |person|\n str << \"#{person.login} <#{person.email}> \\n\"\n end\n str\n end",
"def invite_by_mail\n @user = User.find_by_id(params[:id])\n raise Kroogi::NotPermitted unless @user && @user.active? && permitted?(@user, :profile_edit) # @user is inviter\n\n begin\n invited = []\n Invite.transaction do\n params[:user_emails].split(',').each do |eml|\n eml = eml.strip\n next unless eml.match(User::EMAIL_REGEX)\n next if Invite.find_by_user_email_and_inviter_id(eml, @user.id)\n\n Locale.with_locale(params[:locale]) do\n @invite = Invite.new_for_mail(params[:invite].merge(:join_inviter_to_invited => true), @user, params[:locale])\n @invite.user_email = eml\n @invite.save!\n invited << @invite\n end\n end\n end\n if invited.empty?\n flash[:warning] = \"Unable to send any invites: couldn't parse emails or emails have already been invited\".t\n redirect_to :action => 'new', :id => @user, :user_emails => params[:user_emails], :locale => params[:locale], :invite => {:invitation => params[:invite][:invitation]}\n else\n flash[:success] = invited.size == 1 ? (\"Sent invite to %s\"/[invited.first.user_email]) : (\"Sent invites to: %s\"/[h(invited.map(& :user_email).to_sentence)])\n redirect_to :controller => 'kroogi', :action => 'show_pending', :id => @user, :type => Invite::TYPES[:site_invite][:id], :highlight_invite => invited.map(& :id).join('|')\n end\n rescue ActiveRecord::RecordInvalid\n do_find params\n render :action => 'find'\n end\n end",
"def all_emails(current_user)\n mails = []\n self.users.map{ |u| mails << u.email unless u == current_user || !u.accepting_emails }.compact.join(\", \")\n end",
"def check_email\n @user=User.where('email=?',params[:email])\n @user=[] if user_signed_in? && @user && @user.first==current_user # this means they are editing their email address and its themselves, that is ok\n end",
"def send_invitation_emails(registered_users, invited_users)\n registered_users.each do |user|\n Course::Mailer.user_added_email(@current_course, user).deliver_later\n end\n invited_users.each do |user|\n Course::Mailer.user_invitation_email(@current_course, user).deliver_later\n end\n true\n end",
"def invite_new_users!(recipient_emails, invite_owner, personal_message)\n invite_errors = []\n blank_email_count = 0\n\n # strip out anything between quotes\n recipient_emails = self.strip_quotes(recipient_emails)\n\n # split the emails by looking for a comma\n recipient_emails = recipient_emails.split(',')\n\n # Process each split entity\n recipient_emails.each do |recipient_email|\n # Strip off leading/trailing whitespace and make everything lower case\n recipient_email = recipient_email.strip.downcase\n\n # Checks for and ignores a blank email address between commas\n if !recipient_email.blank?\n recipient_email = self.extract_email_address(recipient_email)\n if self.this_is_a_valid_email?(recipient_email)\n if User.where(:email => recipient_email).exists?\n invite_errors << \"#{recipient_email} is already a member of Brevidy\"\n else\n # check if we are doing a beta signup or if a current user is inviting new people\n if invite_owner.blank?\n # a new person is signing up for beta\n @invitation_link = InvitationLink.new(:email_asking_for_invite => recipient_email)\n \n if !@invitation_link.save\n invite_errors << @invitation_link.errors.full_messages\n end\n else\n # the current user is inviting someone new with their link\n @invitation_link = invite_owner.invitation_link\n UserMailer.delay(:priority => 40).invitation(@invitation_link, recipient_email, personal_message)\n end\n end\n else\n invite_errors << \"#{recipient_email} is an invalid email address\"\n end\n else\n # Keep track of all blank email addresses\n blank_email_count += 1\n end\n end\n\n # This checks for situation where only blank email addresses were detected.\n if blank_email_count == recipient_emails.size\n invite_errors << \"You have not specified any email addresses to invite\"\n end\n # return true unless there were errors and then return the errors\n return invite_errors.flatten unless invite_errors.empty?\n end",
"def send_invitation_emails(registered_users, invited_users)\n registered_users.each do |user|\n Course::Mailer.user_added_email(@current_course, user).deliver_later\n end\n resend_invitation_emails(invited_users)\n end",
"def index\n @user_emails = UserEmail.all\n end",
"def send!\n self.to_csv.split(/\\n/).each do |line|\n user = User.find_by_email(line.split(/\\t/)[0])\n fields = line.strip.split(/\\t/)[1..-1]\n self.send_message(user, fields)\n end\n end",
"def all_emails\n User.pluck(:email)\n end",
"def invitation_search(q, limit=10)\n if q.present? and q.length > 1\n already_exists_ids = []\n already_exists_emails = []\n # add owner\n already_exists_ids << self.id\n # add colaborators\n if self.members.present?\n already_exists_ids << self.members.map{|x| x.member_id}\n end\n # add invitations\n pending = Invitation.pending_from_user(self.id)\n if pending.present?\n already_exists_emails << pending.map{|x| x.to_email}\n end\n\n already_exists_ids.flatten!\n already_exists_emails.flatten!\n\n users = User.any_of({first_name: /#{q}/i}, {last_name: /#{q}/i}, {email_no_domain: /#{q}/i}).limit(limit)\n if already_exists_ids.present? && already_exists_emails.present?\n users = users.not_in({id: already_exists_ids.uniq, email: already_exists_emails.uniq})\n elsif already_exists_ids.present?\n users = users.not_in({id: already_exists_ids.uniq})\n elsif already_exists_emails.present?\n users = users.not_in({email: already_exists_emails.uniq})\n end\n\n return users\n end\n end",
"def expired_users_with_email\n @expired_users_with_email ||= User.expired.where.not(email: nil)\n end",
"def emails(params={})\n @api.get(\"#{@api.path}/User/Emails\", params: params)\n end",
"def set_usuarios_email\n @usuarios_email = UsuariosEmail.find(params[:id])\n end",
"def invalid_user_emails\n current_course.course_users.\n map { |course_user| course_user.invitation.try(:user_email) }.\n reject { |user_email| user_email.nil? || user_email.errors.empty? }\n end",
"def selecionar_email_consulta(email_consulta)\n email_filtro_consulta_select.select(email_consulta)\n end",
"def curator_list\n users.map(&:email)\n end",
"def index\n \n # puts \" begin \"\n # puts User.findUser(params[:user_email]).inspect #Message.where(reciever: params[:user_id])\n # puts \" end \"\n \n @messages = Message.where(reciever: User.findUser(params[:user_email]).id)\n end",
"def refused_users(users)\n emails = email_list(users.map(&:email))\n if users.count == 0\n nil\n else\n \"#{emails} indicated that they were not present for the meeting.\".html_safe\n end\n end",
"def invite_users(users_emails_to_invite, studygroup)\n # TODO: send e-mail invitation to user\n # TODO: How do we do error messages in a for loop?\n # TODO: ERROR HANDLING\n\n return_codes = GlobalConstants::SUCCESS\n\n if users_emails_to_invite == nil\n return GlobalConstants::SUCCESS\n end\n\n users_emails_to_invite.each do |email|\n user_to_invite = User.find_by(email: email)\n\n code = GlobalConstants::SUCCESS\n\n if user_to_invite == nil\n code = GlobalConstants::USER_DOES_NOT_EXIST\n else\n unless Validation.user_enrolled_in_course(studygroup.course, user_to_invite)\n code = GlobalConstants::USER_NOT_ALREADY_ENROLLED\n end\n\n unless Validation.user_in_studygroup(studygroup, user_to_invite)\n code = GlobalConstants::USER_ALREADY_IN_STUDYGROUP\n end\n end\n return_codes<< code\n\n if code == GlobalConstants::SUCCESS\n mail = UserMailer.invite_email(self, user_to_invite, studygroup)\n mail.deliver\n end\n end\n\n return_codes\n end",
"def send_self_eval_invitations\n users = User.all.select{|u| \n u.has_current_registration && \n u.current_registration.participant && \n !u.faculty && \n !u.test && \n !u.current_registration.has_complete_eval\n }\n users.each do |u| \n if u.bounced_at \n Rails.logger.error(\"Found bounced email #{u.email} in sending self eval_reminder\")\n else\n begin\n RegistrationMailer.self_eval_invitation(u)\n puts(\"Succeed on #{u.email}\")\n rescue => e\n puts(\"Failed on #{u.email}\")\n Rails.logger.error(\"Send eval throws #{e}, skipping #{u.email}\")\n end\n end\n end\n end",
"def RepeticionEmailCreate(lista_usuario, email)\n val = true\n lista_usuario.each do |usuario|\n if usuario.email == email.downcase\n val = false\n break\n end\n end\n return val\n end",
"def email_from_infos\n user_infos.map(&:email).try(:first)\n end",
"def search_user_by_email\n @users = User.get_all_users(current_user).where(email:params[:email], is_active: true).first\n get_tenants_user(@users)\n end",
"def invite_new_users(users)\n user_email_map = user_email_map(users.map { |user| user[:email] })\n\n users.map do |user|\n course_user = @current_course.course_users.build(name: user[:name], workflow_state: :invited,\n creator: @current_user,\n updater: @current_user)\n user_email = user_email_map[user[:email]] || User::Email.new(email: user[:email])\n user_email.skip_confirmation!\n course_user.build_invitation(user_email: user_email, creator: @current_user,\n updater: @current_user)\n end\n end",
"def send_emails(contacts)\n @valid_emails = contacts.select { |e| e =~ Devise.email_regexp }\n @bad_emails = contacts - @valid_emails\n current_user.increase_invites_count!(@valid_emails.count)\n @valid_emails.each do |email|\n EmailInvite.transaction do\n invite = EmailInvite.create(:from_user_id => current_user.id, :email => email)\n InviteEmail.invite(email, params[:message], current_user, invite.token).deliver\n end\n end\n end",
"def invitation(users)\n # making sure we only send in bulks of 1000 emails by the Sendgrid Api limits\n users = users[0..998]\n sendgrid_recipients users.collect {|user| user.email}\n sendgrid_substitute \"|name|\", users.collect {|user| user.name}\n mail :to => \"[email protected]\", :subject => \"Invitation to a demo app\"\n end",
"def create\n users_params = params[:users] || {}\n emails = []\n users_params.each_value do |attrs|\n user = User.find_by(email: attrs['email'])\n if !user.present?\n user = User.new(email: attrs['email'], firm_id: current_user.firm_id, role: attrs['role'].to_i)\n user.skip_confirmation!\n end\n # if the user is in the system, then invite the person this way\n # @raw_invitation_token = Devise.token_generator.generate(User, :invitation_token)\n # logger.info \"@raw_invitation_token: #{@raw_invitation_token}\\n\\n\\n\"\n # user.invitation_token = @raw_invitation_token[1]\n # user.invitation_created_at = Time.now.utc\n # user.invitation_sent_at = user.invitation_created_at\n # user.invitation_role = attrs['role'].to_i\n # user.invited_by = current_user\n # options = {user: user, admin: current_user, token: @raw_invitation_token[0], role: User::USER_ROLES[attrs['role'].to_i]}\n # # puts \"ADMIN WHAT IS ADMIN ----------> \" + options.inspect\n # UserEmails.invite_existing_user(options).deliver if user.save(:validate => false)\n # else\n # # if the user is NOT in the system, then send out invite this way (it also creates a user)\n # puts \"IS THIS WHERE I AM ---------------------> \"\n # @raw_invitation_token = Devise.token_generator.generate(User, :invitation_token)\n # user = User.new(email: attrs['email'], firm_id: current_user.firm_id, role: attrs['role'].to_i)\n # options = {user: user, admin: current_user, token: @raw_invitation_token[0], role: [attrs['role'].to_i]}\n # #user.save!\n # UserEmails.invite_new_user(options).deliver if user.save(:validate => false)\n #user = User.invite!({email: attrs['email'], firm_id: current_user.firm_id, role: attrs['role'].to_i }, current_user)\n #end\n @raw_invitation_token = Devise.token_generator.generate(User, :invitation_token)\n logger.info \"@raw_invitation_token: #{@raw_invitation_token}\\n\\n\\n\"\n user.invitation_token = @raw_invitation_token[1]\n user.invitation_created_at = Time.now.utc\n user.invitation_sent_at = user.invitation_created_at\n user.invitation_role = attrs['role'].to_i\n user.firm = current_user.firm\n user.role = attrs['role'].to_i\n user.invited_by = current_user\n options = {user: user, admin: current_user, token: @raw_invitation_token[0], role: User::USER_ROLES[attrs['role'].to_i]}\n options[:firm_name] = request[:invitee_firm_name] if request[:invitee_firm_name]\n # puts \"ADMIN WHAT IS ADMIN ----------> \" + options.inspect\n UserEmails.invite_existing_user(options).deliver if user.save(:validate => false)\n\n emails << attrs['email']\n end\n\n if request.xhr?\n if emails.present?\n render json: {message: \"Invitations were sent to: #{emails.to_sentence}\"}, :status => 200\n else\n render json: {message: 'Email was not sent'}, :status => 500\n end\n else\n if emails.present?\n redirect_to root_path, notice: \"Invitations were sent to: #{emails.to_sentence}\"\n else\n flash[:notice] = 'Email was not sent'\n render :new\n end\n end\n end",
"def all_without_email\n\n end",
"def emails(user_id = nil)\n url = user_id.to_i.zero? ? '/user/emails' : \"/users/#{user_id}/emails\"\n get(url)\n end",
"def fNotificationListFrom (email)\n @users.notificationListFrom(email)\n end",
"def index\n @users = User.not.in(_id: [current_user.id])\n \n if params.key?(:id)\n @another_user = User.find(params[:id])\n else\n @another_user = @users.first\n end\n\n @from_msg = Message.where({from_email: current_user.email, to_email: @another_user.email})\n @to_msg = Message.where({from_email: @another_user.email, to_email: current_user.email})\n \n @array = Array.new\n if @from_msg.size > @to_msg.size\n i = 0\n @to_msg.each do |m|\n @array.push(m, @from_msg[i])\n ++i\n end\n\n (i..@from_msg.size - 1).each do |m|\n @array.push(@from_msg[m])\n end\n\n else\n i = 0\n @from_msg.each do |m|\n @array.push(m, @to_msg[i])\n ++i\n end\n\n (i..@to_msg.size - 1).each do |m|\n @array.push(@to_msg[m])\n end\n end\n end",
"def all_email(email)\n content = \"\"\n address = email\n Membership.where(email: email).each do |membership|\n Task.where(group_id: membership.group_id).each do |task|\n content << \"#{task.title}\\n\"\n end\n Subtask.where(group_id: membership.group_id).each do |subtask|\n content << \"#{subtask.task.title}: #{subtask.title}\\n\"\n end\n end\n unless content.empty?\n mail(to: address, subject: \"Your Tasks\", body: content)\n end\n end",
"def email_list(event_id, exclude_owner = false)\n list = Array.new\n @event = Event.includes(:users).find(event_id)\n\n @event.users.where(:notification_emails => true).each do |user|\n list.push(user.email)\n end\n\n if(exclude_owner)\n list.delete(@event.owner.email)\n end\n\n return list\n end",
"def recipients\n notified_users.collect(&:mail)\n end",
"def people(convo)\n @recipients = convo.conversation.users.where('user_id <> ?', current_user)\n end",
"def index\n all_mail_users =\n case @type\n when 'applicable'\n @recipient_list.applicable_mail_users\n when 'included'\n @recipient_list.included_mail_users\n when 'excluded'\n @recipient_list.excluded_mail_users\n end&.order(:name)\n\n @mail_users =\n if params[:page] == 'all'\n all_mail_users&.page(nil)&.per(all_mail_users&.count)\n else\n all_mail_users&.page(params[:page])\n end\n\n flash.alert = '指定のリストはありません。' if @mail_users.nil?\n end",
"def invite_users\n if GroupsController.group_owner? current_user.id, params[:id]\n set_group\n params[:users].each do |email|\n user = User.find_by_email(email) # TODO: only possible because email is unique. Should make magic assist to return user id's\n @group.users << user unless @group.users.include? user or user.nil?\n end unless params[:users].nil?\n respond_to do |format|\n format.html { redirect_to group_path(@group), alert: 'Invited users successfully.' }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to groups_path, alert: \"Not invited. You are not the group owner\" }\n format.json { render json: \"Only owners can add users to the respective group\", status: :unauthorized}\n end\n end\n end",
"def prepare_contacts\n return unless defined? @user\n @user.user_default_emails.sort_by{|a| a.role_id.to_i}\n end",
"def invite_user_to_groups\n host_port = request.host_with_port\n @discussion_group = DiscussionGroup.find(params[:id])\n if params[:invite_to] == \"by_email\"\n @non_site_user_emails = params[:invite_user_to_groups][:email].split(',')\n if @non_site_user_emails.include?(@login_user.email)\n @notice = \"Can't sent a invitation to yourself.\"\n else\n @non_site_user_emails.each do |emails|\n user = User.find_by_email(emails)\n if !user.nil?\n disc_group_user = DiscussionGroupUser.new(:discussion_group_id => @discussion_group.id, :user_id => user.id, :is_member => 0)\n @notice = disc_group_user.save ? \"Invitation successfully sent.\" : activerecord_error_list(disc_group_user.errors)\n Notifier.delay.mail_to_private_group_user(user.email, @discussion_group.user.username, host_port, @discussion_group.name) if disc_group_user.save\n else\n private_group_user = NonSiteUser.new(:email => emails.gsub(/\\s+/, \"\"), :invitable_id => @discussion_group.id, :invitable_type => \"DiscussionGroup\")\n @notice = private_group_user.save ? \"Invitation successfully sent.\" : activerecord_error_list(private_group_user.errors)\n Notifier.delay.mail_to_non_site_user(private_group_user.email, @discussion_group.user.username, host_port, @discussion_group.name, private_group_user.id) if private_group_user.save\n end\n end if @non_site_user_emails\n end\n end\n\n if params[:invite_to] == \"by_username\"\n @usernames = params[:invite_user_to_groups][:username]\n @usernames = @usernames.split(\", \") if @usernames\n user_ids = Array.new\n @usernames.each do |user|\n user_ids = User.find(:first, :conditions=>[\"username=?\", user])\n if !user_ids.blank?\n disc_group_user = DiscussionGroupUser.new(:discussion_group_id => @discussion_group.id, :user_id => user_ids.id, :is_member => 0)\n @notice = disc_group_user.save ? \"Invitation successfully sent.\" : activerecord_error_list(disc_group_user.errors)\n Notifier.delay.mail_to_private_group_user(user_ids.email, @discussion_group.user.username, host_port, @discussion_group.name) if disc_group_user.save\n else\n @notice = \"Username does not exists!\"\n end\n end if @usernames\n end\n\n if params[:invite_to] == \"by_group\"\n @groups = params[:invite_user_to_groups][:groups]\n @groups = @groups.split(\", \") if @groups\n user_ids = Array.new\n @groups.each do |group|\n group_ids = DiscussionGroup.find(:first, :conditions=>[\"name=?\", group])\n if !group_ids.blank?\n user_ids = DiscussionGroupUser.find(:all, :conditions=>[\"discussion_group_id=? AND is_member=? AND user_id !=?\", group_ids.id, true, @login_user.id])\n user_ids.each do |u_id|\n disc_group_user = DiscussionGroupUser.new(:discussion_group_id => @discussion_group.id, :user_id => u_id.user_id, :is_member => 0)\n @notice = disc_group_user.save ? \"Invitation successfully sent.\" : activerecord_error_list(disc_group_user.errors)\n Notifier.delay.mail_to_private_group_user(u_id.user.email, @discussion_group.user.username, host_port, @discussion_group.name) if disc_group_user.save\n end if user_ids\n else\n @notice = \"Group does not exists!\"\n end\n end if @groups\n end\n\n respond_to do |format|\n format.js\n end\n end",
"def fetch_users_info(emails)\n endpoint = \"/api/#{@version}/user/info/\"\n custom_params = {\n 'emails' => emails.join(',')\n }\n make_get_request(endpoint, custom_params)\n end",
"def search\n # params[:query] populated by query text input field\n # here we search for users that match input email\n @users = User.where(email: params[:query])\n end",
"def invite_new_users(users)\n invitations = users.map do |user|\n @current_course.invitations.build(name: user[:name], email: user[:email])\n end\n validate_new_invitation_emails(invitations)\n end",
"def index\n if(current_user.entidade_id.nil?)\n @users = []\n @users.push User.find_by(email: current_user.email)\n else\n @users = User.where(entidade_id: current_user.entidade_id.to_int)\n end\n\n if(current_user.tipo.eql? 1)\n @users = User.where('tipo = 1 or tipo = 2 or tipo = 4')\n elsif(current_user.tipo.eql? 2)\n @users = User.distinct()\n .joins('left join reservas r on users.id = r.user_id')\n .where('(tipo in(2,3) and users.entidade_id=?) or (tipo = 4 and r.entidade_id=?)', current_user.entidade_id, current_user.entidade_id)\n elsif(current_user.tipo.eql? 3)\n @users = User.distinct()\n .joins('left join reservas r on users.id = r.user_id')\n .where('tipo = 4 and r.entidade_id=?', current_user.entidade_id)\n else \n end\n end",
"def create_users()\n del_rec = []\n @good_user_records.each do |rec|\n existing_user = @users[rec.fields[\"email\"]]\n # check if the user doesn't exist already\n if (existing_user.nil?)\n\t# check to see if business already exists\n\texisting_business = @businesses[rec.fields[\"businessname\"]]\n\tif (!existing_business.nil?)\n\t new_user = User.new\n\t new_user.create(rec)\n\t existing_business.add_user(new_user)\n\t @users[new_user.email] = new_user\n\telse\n\t rec.is_malformed = true\n\t rec.add_malformed_message(\"ERROR: COMPANY NAME DOESN'T EXIST\")\n\t @bad_user_records << rec\n\t del_rec << rec\n\tend\n #User Already Exists treat it as malformed\n else \n\trec.is_malformed = true\n\trec.add_malformed_message(\"ERROR: USER EMAIL ALREADY EXISTS\")\n\t@bad_user_records << rec\n\tdel_rec << rec\n end\n end\n\n del_rec.each do |rec|\n @good_user_records.delete(rec)\n end\n \n end",
"def invite_from_form(users)\n invite_users(users.map do |(_, value)|\n { name: value[:name], email: value[:email] }\n end)\n end",
"def invite_emails_to_group\n @emails = params[:user][:email] if !params[:user].blank?\n host_port = request.host_with_port\n @group = DiscussionGroup.find(params[:group][:id])\n for email in @emails\n user = User.find_by_email(email)\n if !user.nil?\n disc_group_user = DiscussionGroupUser.new(:discussion_group_id => @group.id, :user_id => user.id, :is_member => 0)\n @notice = disc_group_user.save ? \"Invitation successfully sent.\" : activerecord_error_list(disc_group_user.errors)\n @added = true if !disc_group_user.id.nil?\n Notifier.delay.mail_to_private_group_user(user.email, @group.user.username, host_port, @group.name) if disc_group_user.save\n else\n private_group_user = NonSiteUser.new(:email => email.gsub(/\\s+/, \"\"), :invitable_id => @group.id, :invitable_type => \"DiscussionGroup\", :invitation_type=>\"Invited\")\n @notice = private_group_user.save ? \"Invitation successfully sent.\" : activerecord_error_list(private_group_user.errors)\n @added = true if !private_group_user.id.nil?\n Notifier.delay.mail_to_non_site_user(private_group_user.email, @group.user.username, host_port, @group.name, private_group_user.id) if private_group_user.save\n end\n end if [email protected]?\n flash[:notice] = \"Invitation successfully sent.\" if @added\n end",
"def search_users(wildcard_email_address)\n filter = Net::LDAP::Filter.eq(ENTITY_ATTR_MAPPING[:email].to_s, wildcard_email_address)\n return search_map_user_fields(filter)\n end",
"def invite_from_form(users)\n invite_users(users.map do |(_, value)|\n { name: value[:course_user][:name], email: value[:user_email][:email] }\n end)\n end",
"def inviter\n invite = Invitation.find_by_recipient_email(login)\n User.find(invite.sender_id) unless invite.nil?\n end",
"def emails(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Emails\", params: params)\n end",
"def email_list\n end",
"def recipients\n Array.wrap(::User.find_by_user_key(@work.depositor))\n end",
"def for_user(user)\n find_by(user_email: user.emails)\n end",
"def notification_email_addresses\n emails = []\n if self.billing_address.email.blank? and self.shipping_address.email.blank? and !self.user.nil?\n emails << self.user.email\n elsif self.shipping_address.nil? and !self.billing_address.email.blank?\n emails << self.billing_address.email\n else\n if (!self.user.nil? and !self.user.email.blank?)\n emails << self.user.email\n end\n emails << self.billing_address.email unless self.billing_address.email.blank?\n emails << self.shipping_address.email unless self.shipping_address.email.blank?\n end\n \n return emails.uniq\n end",
"def recipients\n notified = project.notified_users\n notified.reject! {|user| !visible?(user)}\n notified.collect(&:mail)\n end",
"def check_invite_and_create_notifications\n if self.invitation_token\n all_invites = []\n\n # Invites for their specific token\n (Invitation.where(\"token = ?\", self.invitation_token)).each {|invite| all_invites << invite}\n\n # Any invites for their email (if their email was diff from the one they recieved an invite for)\n Invitation.where(\"token = ?\", Digest::MD5.hexdigest(self.email)).each {|invite| all_invites << invite}\n\n all_invites.each do |invite|\n Notification.create(user_id:self.id, kind:\"invite\", associated_id: invite.id)\n end\n end\n end",
"def find_registered_guests(id)\r\n @reg_guests = []\r\n @reg_guests << User.find(@event.user_id).username\r\n PrivateInvite.find_all_by_private_event_id(@event.id).each do |g|\r\n if User.find_by_email(g.email)\r\n @reg_guests << User.find_by_email(g.email).username\r\n end\r\n end\r\n @reg_guests \r\n end",
"def contacts_gmail_email(contacts)\n @hash_contactos = Hash.new\n \t\t@contact_email = []\n contacts.each {|lista|\n lista.each {|key,value|\n if (key == :email)\n @contact_email << value\n end\n }\n }\n return @contact_email\n\tend",
"def check_new_mail\n if (params[:user][:email] != @user.email)\n if (User.where(:nick => params[:user][:email]).count > 0)\n false\n else\n true\n end\n else\n true\n end\n end",
"def find_unregistered_guests(id)\r\n @unreg_guests = []\r\n PrivateInvite.find_all_by_private_event_id(@event.id).each do |g|\r\n if !User.find_by_email(g.email)\r\n @unreg_guests << g.email\r\n end\r\n end\r\n @unreg_guests \r\n end",
"def recipient_emails\n [patient.try(:email), doctor.try(:email)].compact\n end",
"def user_added_contact_emails\n self.user ? self.user.added_contacts.pluck('email') + [self.user.email] : []\n end",
"def recipients\n notified = project.notified_users\n notified.reject! {|user| !visible?(user)}\n notified.collect(&:mail)\n end",
"def emails(text)\n scan(text, EMAIL, :email)\n end",
"def index\n @email_accounts = current_user.email_accounts.all\n end",
"def extract_user_emails(user_fields, client)\n user_emails = []\n user_fields.each_index do |row|\n user_emails.push(user_fields[row][0])\n end\n user_emails\nend",
"def emails_with(other_user)\n Message.where(\n \"(sender_id = ? AND receiver_id = ?)\n OR (receiver_id = ? AND sender_id = ?)\",\n other_user.id, self.id, other_user.id, self.id)\n .order(:created_at)\n end",
"def emails\n respond_with_entity(api.get('/api/v1/profile/emails'),\n NexaasID::Entities::Profile::Emails)\n end",
"def filter_by_email\n Entry.joins(:user)\n .where('users.email = :email', email: email)\n .paginate(page: page_number)\n .order(checkin_at: :desc)\n end",
"def recipients\n notified = project.notified_users\n # Author and assignee are always notified unless they have been locked\n notified << author if author && author.active?\n notified << assignee if assignee && assignee.active?\n notified.uniq!\n # Remove users that can not view the issue\n notified.reject! {|user| !visible?(user)}\n notified.collect(&:mail)\n end",
"def recipients\n notified = project.notified_users\n # Author and assignee are always notified unless they have been locked\n notified << author if author && author.active?\n notified << assignee if assignee && assignee.active?\n notified.uniq!\n # Remove users that can not view the issue\n notified.reject! {|user| !visible?(user)}\n notified.collect(&:mail)\n end",
"def resend_activation_emails\n User.where.not(person: nil).where.not(activation_code: nil).each do |user|\n if user.person\n logs = user.person.activation_email_logs\n if logs.count < MAX_ACTIVATION_EMAILS && (logs.empty? || logs.last.created_at < RESEND_ACTIVATION_EMAIL_DELAY.ago)\n Mailer.activation_request(user).deliver_later\n MessageLog.log_activation_email(user.person)\n end\n else\n Rails.logger.info(\"User with invalid person - #{user.id}\")\n end \n end\n end",
"def index\n # @messages = Message.all\n # @messages = Message.where(user_id: session[:user_id])\n\n @messages = Message.where(recipient: current_user[:email])\n @sent_messages = Message.where(user_id: session[:user_id])\n @username = current_user[:email]\n end",
"def for_email(email)\n Iterable.request(conf, \"/users/#{email}\").get\n end",
"def email_ids\n []\n end",
"def emails\n ([purchased_by.try(:email)] + [email] + [user.try(:email)] + Array(organization.try(:billing_emails))).map(&:presence).compact.uniq\n end",
"def add_new_friends(emails)\n\t\t@list_email = []\n\t\temails.each {|email|\n\t\t\t@list_email << email if already_exits?(email)\n\t\t}\n @list_email_no_friend = []\n list_email.each {|email|\n id_email = get_id_by_email(email)\n #TODO: Sacar mi id de la sesion\n if !is_friend?(id_usuario_de_la_sesion,id_email)\n @list_email_no_friend << email\n end\n }\n\t\treturn @list_email_no_friend\n\tend",
"def invite_by_email\n\n @errors = ''\n emails = params[:emails].split(',')\n servicelisting = Servicelisting.find(params[:servicelisting_id])\n no_of_guests = servicelisting.no_of_guests.to_i\n invites = GuestList.where(:user_id => current_user.id, :product => params[:order_id])\n\n if(invites.size + emails.size <= no_of_guests)\n emails.each do |email|\n guest_list = GuestList.new({\n :email => email.strip,\n :user_id => current_user.id,\n :product => params[:order_id]\n })\n\n if guest_list.save\n Notifier.invite_friend_party(guest_list.email, params[:subject], params[:message], current_user.email).deliver\n end\n end\n else\n @errors = \"You can only invite #{no_of_guests} friends.\"\n end\n\n respond_to do |format|\n format.js\n end\n end",
"def index\n @organizations = Organization.all.alphabetical\n @participant = Participant.new\n @users = User.all.map{|user| user} #Individual.all.map{|indiv| indiv.user.id}\n @names_from_users = []\n @users.each do |user|\n # if user does not have an individual, then just use email\n if user.individual.nil?\n @names_from_users << [user.email, user.id]\n else\n @names_from_users << [user.individual.name, user.id]\n end\n end\n @names_from_users.sort!\n end",
"def list_by_email(email)\n params = Hash.new\n params[:email] = email\n self.list(params)\n end",
"def get_users(al)\n\t\t User.joins(:aliases, :groups).where(:'aliases.name' => al, :'aliases.active' => 1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t :'groups.name' => 'mail', :'users.active' => 1).pluck(:username)\n\tend",
"def getEmailList\n\t\tdata = index()\n\t\temailList = []\n\t\tdata.each do |person|\n\t\t\temailList.push(\"#{person[\"email_address\"]}\")\n\t\tend\n\t\treturn emailList\n\tend",
"def ensure_user_byemail(email, name)\n users = db[:users]\n usr = users.first(:email => email)\n\n if usr.nil?\n\n u = retrieve_user_byemail(email, name)\n\n if u.nil? or u['login'].nil?\n warn \"Could not retrieve user #{email} through search API query\"\n login = (0...8).map { 65.+(rand(25)).chr }.join\n users.insert(:email => email,\n :name => name,\n :login => login,\n :fake => true,\n :deleted => false,\n :created_at => Time.now)\n info \"Added user fake #{login} -> #{email}\"\n users.first(:login => login)\n else\n in_db = users.first(:login => u['login'])\n geo = geolocate(location: u['location'])\n if in_db.nil?\n users.insert(:login => u['login'],\n :name => u['name'],\n :company => u['company'],\n :email => u['email'],\n :long => geo[:long],\n :lat => geo[:lat],\n :country_code => geo[:country_code],\n :state => geo[:state],\n :city => geo[:city],\n :fake => false,\n :deleted => false,\n :created_at => date(u['created_at']))\n info \"Added user #{u['login']} (#{email}) through search API query\"\n else\n in_db.update(:name => u['name'],\n :company => u['company'],\n :email => u['email'],\n :long => geo[:long],\n :lat => geo[:lat],\n :country_code => geo[:country_code],\n :state => geo[:state],\n :city => geo[:city],\n :fake => false,\n :deleted => false,\n :created_at => date(u['created_at']))\n debug \"User #{u['login']} with email #{email} exists\"\n end\n users.first(:login => u['login'])\n end\n else\n debug \"User with email #{email} exists\"\n usr\n end\n end",
"def importing_update( email_list )\n @failed_registrations = FailedRegistration.all \n # email_list.each do | email | \n mail( :to => email_list, \n :subject => \"potoSchool | Tarumanegara Failed Registration #{Time.now}\" )\n # end\n end",
"def find_records(reference, email = nil)\n EmailSubmissionsAudit.where(reference: %W[user;#{reference} court;#{reference}]).select do |record|\n email.blank? || BCrypt::Password.new(record.to) == email\n end\n end",
"def recipient_list(workgroup)\n list = Array.new\n wrkgrpusrs = WorkgroupUser.find(:all, :conditions => {:workgroup_id => workgroup})\n wrkgrpusrs.each do |usr|\n s = User.find(:first, :conditions => {:id => usr.user_id})\n list << s.email unless s.email.nil? || s.email == \"\"\n end\n if list.length < 1\n list << \"blank@example\" #duct-tape-uber-hack an empty array of recipients breaks the mailer and cause the referral to not be sent...\n end\n return list\n end",
"def email_is_unique\n active_users = User.active.where(:email => self.email)\n active_users = active_users.exclude(self) unless self.new_record?\n errors.add :email, 'ya existe' if active_users.count(:id) > 0\n end",
"def link_to_invitations\n UserInvite.where(email: email).find_each do |invite|\n invite.user = self\n invite.save\n end\n end",
"def recipient_users\n User.active.where(id: recipient_user_ids).all\n end",
"def refresh_mailing_list\n emails = MassEmail.all.map{|m|m.email_address}\n File.open(File.join(Rails.root, 'config', 'mailing_list.txt')).each_line do |e|\n e = e.chomp\n unless emails.include?(e)\n url_code = new_random_url_code\n m = MassEmail.new(email_address: e, url_code: url_code)\n m.save!\n end\n end\n\n emails = MassEmail.all.map{|m|m.email_address}\n User.all.map{|u| u.email}.each do |e| \n unless emails.include?(e)\n url_code = new_random_url_code\n m = MassEmail.new(email_address: e, url_code: url_code)\n m.save!\n end\n end\nend",
"def refresh_mailing_list\n emails = MassEmail.all.map{|m|m.email_address}\n File.open(File.join(Rails.root, 'config', 'mailing_list.txt')).each_line do |e|\n e = e.chomp\n unless emails.include?(e)\n url_code = new_random_url_code\n m = MassEmail.new(email_address: e, url_code: url_code)\n m.save!\n end\n end\n\n emails = MassEmail.all.map{|m|m.email_address}\n User.all.map{|u| u.email}.each do |e| \n unless emails.include?(e)\n url_code = new_random_url_code\n m = MassEmail.new(email_address: e, url_code: url_code)\n m.save!\n end\n end\nend",
"def send_to_admins\n @all_recipients = User.where(:receive_admin_email => true)\n raise NoRecipients if @all_recipients.blank?\n @all_recipients.group_by(&:language).each do |lang, users|\n @recipients = users\n mail_with_locale users, lang\n end\n end"
]
| [
"0.6641623",
"0.64631045",
"0.6461937",
"0.6350435",
"0.6322121",
"0.63143635",
"0.6282568",
"0.6160918",
"0.6085946",
"0.6085378",
"0.60636866",
"0.60064137",
"0.6005424",
"0.6004359",
"0.5991073",
"0.5967878",
"0.59591496",
"0.5921857",
"0.5913721",
"0.58975244",
"0.58912605",
"0.5878903",
"0.5870893",
"0.58645564",
"0.58438754",
"0.58407485",
"0.5830192",
"0.58264625",
"0.581887",
"0.58056855",
"0.57849693",
"0.5768495",
"0.576763",
"0.5742502",
"0.5737795",
"0.57317257",
"0.5731299",
"0.5729723",
"0.57286084",
"0.5714801",
"0.5700856",
"0.5651294",
"0.5648603",
"0.5629257",
"0.56250143",
"0.56189525",
"0.5612534",
"0.56123924",
"0.5612128",
"0.56038344",
"0.56022257",
"0.56013477",
"0.55894315",
"0.55890495",
"0.55879176",
"0.5584204",
"0.55688363",
"0.55670863",
"0.5563689",
"0.55619407",
"0.5561651",
"0.5560832",
"0.55534554",
"0.5526524",
"0.5521786",
"0.5521179",
"0.55147403",
"0.55129904",
"0.5510542",
"0.55059505",
"0.5504378",
"0.5503375",
"0.5497037",
"0.54876435",
"0.5484601",
"0.54799557",
"0.5479142",
"0.5478234",
"0.5467527",
"0.5467527",
"0.54610735",
"0.5444497",
"0.5442068",
"0.5438186",
"0.54377437",
"0.54295075",
"0.5426561",
"0.54139805",
"0.54091835",
"0.5408417",
"0.54081196",
"0.5407146",
"0.5406106",
"0.5400522",
"0.5395911",
"0.53862333",
"0.5377381",
"0.53749526",
"0.5374586",
"0.5374586",
"0.5373733"
]
| 0.0 | -1 |
Devolver si es amigo o no | def is_friend?(follower_id,following_id)
Follow.where(follower_id: follower_id).where(following_id: following_id).exists?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def semact?; false; end",
"def placebo?; false end",
"def suivre; end",
"def positive?; end",
"def delicious?\n\t\treturn true\n\tend",
"def usable?; end",
"def used?; end",
"def isolated?; end",
"def isolated?; end",
"def delicious?\n #its automattically true\n true\n end",
"def absent?; end",
"def delicious?()\n\t\treturn TRUE\n\tend",
"def ordinary?\n raise \"Not implemented yet\"\n end",
"def no? ; false ; end",
"def aye?\n true\n end",
"def in_peril?; @in_peril; end",
"def celebration; end",
"def sharded?; false; end",
"def estConsomable()\n\t\treturn false\n\tend",
"def debo_ir_a_carcel\n return !tengo_carta_libertad\n end",
"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 needed_if_relevant?\n false\n end",
"def elide?\n false\n end",
"def negative?; end",
"def no? ; true ; end",
"def flag; end",
"def sos_piedra?() raise NotImplementedError end",
"def sticky?() end",
"def consigned?\n false\n end",
"def tengo_propietario\n return [email protected]?\n end",
"def needed_if_relevant?\n false\n end",
"def move_in_and_celebrate?\n nil\n end",
"def none?; end",
"def none?; end",
"def none?; end",
"def ignores; end",
"def deLigne?() return @type == @@LIGNE end",
"def sharded?; true; end",
"def internal?; end",
"def global?; end",
"def enotsup?() super; end",
"def pro?\n !!self.pro\n end",
"def missing?; false; end",
"def missing?; end",
"def nooriginal\n return @nooriginal\n end",
"def active?; end",
"def null?; false end",
"def left?; end",
"def sos_tijera?() raise NotImplementedError end",
"def ha_accedido?\n\t\t!usuario_actual.nil?\n\tend",
"def aint_nothin?\n self.aint.nil?\n end",
"def check ; true ; end",
"def hambriento?\n # Los nombres de los metodos pueden terminar en \"?\".\n # Generalmente, hacemos esto si el método debe\n # devolver verdadero o falso, como esto:\n @panzaLlena <= 2\n end",
"def hambriento?\n # Los nombres de los metodos pueden terminar en \"?\".\n # Generalmente, hacemos esto si el método debe\n # devolver verdadero o falso, como esto:\n @panzaLlena <= 2\n end",
"def ignored?()\n #This is a stub, used for indexing\n end",
"def suivi? ; self.abs_module.nombre_jours.nil? end",
"def issn; end",
"def missed?; end",
"def dormitory_present?\n false\n end",
"def scholarly?\n false\n end",
"def anchored; end",
"def global?; true end",
"def par?\n cuantos_pares >= 1\n end",
"def nonzero?; end",
"def used?\n true\n end",
"def quorate?\n\t\t@quorate\n\tend",
"def assemblea_in_corso?\n !!session[:assemblea_id]\n end",
"def soy_edificable\n return false\n end",
"def soy_edificable\n return false\n end",
"def debe_ser_encarcelado\n if is_encarcelado\n return false\n else\n if !tiene_salvoconducto\n return true\n else\n perder_salvoconducto\n Diario.instance.ocurre_evento(\"El jugador se libra de la cárcel\")\n return false\n end\n end\n end",
"def multi_arged?\n false\n end",
"def cumple_requisitos?\n propietario.hangar.nivel >= 4 && propietario.cuenta.tecnologia_energia.nivel >= 3 && propietario.cuenta.tecnologia_laser.nivel >= 6 && super\n end",
"def is_null()\n res = super(context,self)\n return res\n end",
"def se_movio?\n @se_movio\n end",
"def uncertain?\r\n @@maybes\r\n end",
"def !\n !__getobj__\n end",
"def is_pdc?\n false\n end",
"def stand_alone?; end",
"def stand_alone?; end",
"def centralize?\n false\n end",
"def optionality_implied?\n false\n end",
"def local?; end",
"def recommendable?() false end",
"def combat?; false; end",
"def need_to_go_out?\n\t\tif @poos_how_often == \"regularly\"\n\t\t\tfalse\n\t\telse\n\t\t\ttrue\n\t\tend\n\tend",
"def none?\n level == 0\n end",
"def present?; end",
"def composite?\n false\n end",
"def composite?\n false\n end",
"def explicit?; end",
"def conditionally(*) end",
"def conditionally(*) end",
"def final?; end",
"def inicio_sesion?\n usuario_id.blank?\n end",
"def imprime_dados()\n if @esq==-1 && @dir==-1\n puts 'no folha'\n else\n puts 'no interno ou raiz'\n puts @dir.to_s + '->' + @esq.to_s \n end\n end",
"def suitable_for_none?\n \treturn self.disciplines.empty?\n end",
"def can_be_undone?\n true\n end",
"def basic?\n false\n end",
"def do_not_thread\n true\n end",
"def assertive?\n true\n end",
"def if_needs_rekey?; end"
]
| [
"0.7175963",
"0.6922928",
"0.66088533",
"0.65619004",
"0.654149",
"0.6457825",
"0.6451403",
"0.64073837",
"0.64073837",
"0.6385908",
"0.6324781",
"0.6291342",
"0.6267003",
"0.62651056",
"0.62016547",
"0.6200845",
"0.6182826",
"0.6176957",
"0.61622536",
"0.61503667",
"0.6149335",
"0.6143676",
"0.6127739",
"0.6125984",
"0.60910743",
"0.6088202",
"0.60853994",
"0.60837185",
"0.60795426",
"0.60738945",
"0.6060039",
"0.60409915",
"0.60408145",
"0.60408145",
"0.60408145",
"0.6031195",
"0.6020602",
"0.60012937",
"0.5992977",
"0.5988851",
"0.5980441",
"0.5954094",
"0.59314585",
"0.5927184",
"0.5903451",
"0.58951205",
"0.58707756",
"0.58682215",
"0.5860713",
"0.5851207",
"0.5850487",
"0.5839233",
"0.5837386",
"0.5837386",
"0.582536",
"0.58161837",
"0.58126515",
"0.5812267",
"0.58074474",
"0.58009255",
"0.5794835",
"0.57907206",
"0.57903486",
"0.5781094",
"0.5767517",
"0.5767273",
"0.5762199",
"0.5761513",
"0.5761513",
"0.57530546",
"0.5732563",
"0.5716935",
"0.57119465",
"0.5706806",
"0.57032156",
"0.56899816",
"0.56840783",
"0.56840384",
"0.56840384",
"0.5675174",
"0.5668227",
"0.56661725",
"0.5661549",
"0.5655293",
"0.56464154",
"0.5645099",
"0.5637762",
"0.56369436",
"0.56369436",
"0.56363106",
"0.5627775",
"0.5627775",
"0.5627596",
"0.56224436",
"0.5619433",
"0.56101006",
"0.5606648",
"0.560544",
"0.55995226",
"0.55980945",
"0.55967355"
]
| 0.0 | -1 |
Sends an invite to a resident, from the given user Params: resident user | def deliver_invite_to_resident(resident, user)
enqueue(ResidentInvitation, resident.id, user.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deliver_invite_to_resident(resident, user)\n return\n end",
"def invite(user)\n participation = @tandem.participations.create(\n user:user,\n token: generate_token\n )\n\n send_invitation_mail participation\n true\n end",
"def invite(user, data = {})\n @user = user\n @url = invitation_url user.token\n \n from = data.delete(:from) || QuoVadis.from\n subject = data.delete(:subject) || I18n.t('quo_vadis.notifier.invite.subject')\n\n data.each { |k,v| instance_variable_set :\"@#{k}\", v }\n mail :to => user.email, :from => from, :subject => subject\n end",
"def invite_friend(user, invitation)\n @user = user\n @invitation = invitation\n\n mail to: @invitation.email, subject: \"Invitation to connect@ustksa\"\n end",
"def accepted_invite(user)\n @user = user\n mail(:to => user.email, :subject => \"Welcome to the Secret Santa Society.\")\n end",
"def invite(email, user)\n @recipients = \"#{email}\"\n @from = \"[email protected]\"\n @subject = \"#{user.name} has invited you to Meetronome!\"\n @sent_on = Time.now\n @body[:user] = user\n end",
"def invitation(user)\n @user = user\n mail to: user.email\n end",
"def invite_resource\n ## skip sending emails on invite\n u = resource_class.invite!(invite_params, current_inviter) do |u|\n u.skip_invitation = true\n u.invitation_sent_at = DateTime.now\n end\n flash[:link] = accept_user_invitation_url(:invitation_token => u.raw_invitation_token)\n u\n end",
"def resend_invitation\n user = User.find(params[:id])\n user.invite!\n respond_to do |format|\n format.js { flash.now[:notice] = \"Invitación reenviada con éxito a #{user.email}\" }\n end\n end",
"def invite\n service_response = AdminManagement::AdminUser::Invite::Send.new(params).perform\n render_api_response(service_response)\n end",
"def invite_user\n invited_user = User.find(params[:user_id])\n InviteUser.call(@previa_group, invited_user)\n\n respond_to do |format|\n format.html { redirect_to previa_group_invitable_users_path(@previa_group), notice: 'El usuario fue invitado con éxito.' }\n format.json { head :no_content }\n end\n end",
"def invite_member\n @organization = MnoEnterprise::Organization.find(params[:id])\n\n # Find or create a new user - We create it in the frontend as MnoHub will send confirmation instructions for newly\n # created users\n user = MnoEnterprise::User.find_by(email: user_params[:email]) || create_unconfirmed_user(user_params)\n\n # Create the invitation\n invite = @organization.org_invites.create(\n user_email: user.email,\n user_role: params[:user][:role],\n referrer_id: current_user.id,\n status: 'staged' # Will be updated to 'accepted' for unconfirmed users\n )\n\n @user = if user.confirmed?\n invite.accept!(user)\n invite.reload\n else\n user.reload\n end\n end",
"def invite!(user_from, user_to, note=\"\")\n Invite.send!(user_from, user_to, note, self)\n end",
"def call(user)\n return unless user.invite_token\n invite = Invite.find_by_invite_token(user.invite_token)\n invite.update!(grader_id: user.id) if invite\n end",
"def resend_invite\n service_response = AdminManagement::AdminUser::Invite::Resend.new(params).perform\n render_api_response(service_response)\n end",
"def invite(user, options = {})\n group = options[:to] or raise \"Must give a :to => group option\"\n if user.kind_of?(String)\n user = User.create! :login => user, :created_from_invite => true\n end\n Invite.create! :group => group, :user => user, :admin_accepted => self.is_admin_of?(group), :requestor => self\n end",
"def accepted(invite, user)\n @invite = invite\n @user = user\n mail(:to => invite.user.email, :subject => \"#{@user.name} has accepted your invitation to the \\\"#{invite.idea.name}\\\" idea\", :tag => 'invite-accepted') \n end",
"def invited_app_user(user)\n @user = user\n @subject = \"Invitation to Bunch\"\n @body = \"Bunch is a simple web dashboard that integrates with your teams’ calendars.\" \n mail(to: @user.email, subject: @subject)\n end",
"def accept_invite_for_user(user)\n invite = Invite.find(session[:invite_id])\n res = invite.accepted_by(user)\n session[:invite_id] = nil\n res\n end",
"def invite\n invitation_service.invite(invitation_params)\n end",
"def invite_user\n client.invite_user({\n email: user.email,\n group_names: \"\",\n custom_message: I18n.t(\"discourse_service.invite_custom_message\")\n })\n end",
"def invite\n @user = current_user\n UserMailer.invite_email(current_user, params[:email]).deliver\n redirect_to(kites_path, :notify => \"Your invitation has been sent\")\n end",
"def invite_user(user_id)\n user_id = user_id.id if user_id.is_a? MatrixSdk::User\n client.api.invite_user(id, user_id)\n true\n end",
"def invite_user(invitation,subject,message)\n @subject = subject\n @sign_up_url = new_user_registration_url(:token => invitation.token)\n @invitation = invitation\n @message = message\n mail( :from => invitation.user.email,\n :to => invitation.email,\n :subject => subject )\n end",
"def tracker_invite(user)\n\n\n to_list = user.email\n cc_list = []\n subject = \"Your login information for the PCB Design Tracker\"\n\n @reviewer = user\n\n mail( :to => to_list,\n :subject => subject,\n :cc => cc_list\n )\n\n end",
"def invite_to_mesa\n unless UserMission.exists?(params[:user_id],params[:mesa_id]).nil?\n user=User.find(params[:user_id])\n send_invite(user)\n end\n respond_to do |format|\n if @mission_invitation\n format.html { redirect_to @mission, notice: 'Mission was successfully created.' }\n format.json { render :json=> {:status => true} }\n else\n format.html { render :new }\n format.json { render :json=> {:error => 'Invalid user id,mesa id or duplicate invitation', :status => false} }\n end\n end\n end",
"def invite_email(user, emails)\n @user = user\n @friend_url = \"http://www.lacquerloveandlend.com/friendships/new?friend_id=#{@user.id}\"\n\n mail(to: emails, subject: \"#{user.name} wants to share with you on Lacquer Love&Lend!\", bcc: \"[email protected]\")\n\n headers['X-MC-Track'] = \"opens, clicks_all\"\n end",
"def resend\n \t@user = User.find(params[:id])\n \t \t\n \tif Notifier.user_invited(@user).deliver\n \t\[email protected]_attributes(:invitation_last_sent_at => Time.now, :invitation_last_sent_to => @user.email)\n \t\tflash[:notice] = \"Instructions have been sent to \" + @user.email\n \t\tredirect_to(:controller => 'users', :action => 'edit', :id => params[:id])\n \telse\n flash[:alert] = \"Invitation could not be resent.\"\n\t\t\tredirect_to(:controller => 'users', :action => 'edit', :id => params[:id])\n \tend\n end",
"def invite(invitee, inviter)\n @invitee = invitee\n @inviter = inviter\n\n mail to: invitee.email,\n subject: \"Invitation from #{inviter.first_name} to join a kinstagram family\"\n end",
"def invite\n invite = params[:invite]\n profile.update_attribute(:email, invite[:email])\n invite = Notifier.send_invite(profile, invite[:message])\n invite.deliver\n flash[:notice] = \"An invititation to join YentaFriend was sent to #{profile.name}. Check your dashboard for an update when they join!\"\n end",
"def invite\n if not user_signed_in?\n redirect_to new_user_session_path\n else\n User.find(params[:user_id]).invites << current_user\n redirect_to friends_path\n end\n end",
"def invite\n \n end",
"def group_invite(user, _current_inviter)\n @user = user\n @url = build_group_invitation_url(user)\n\n mail(to: @user.email, subject: \"You've been invited to a Group!\")\n end",
"def send_org_invite(user, invite)\n # Generate token if not generated\n user.send(:generate_confirmation_token!) if !user.confirmed? && user.confirmation_token.blank?\n\n MnoEnterprise::SystemNotificationMailer.organization_invite(invite).deliver_later\n\n # Update staged invite status\n invite.status = 'pending' if invite.status == 'staged'\n invite.notification_sent_at = Time.now unless invite.notification_sent_at.present?\n invite.save\n end",
"def invite_user(param)\n email_addresses.set param[:email]\n is_owner.set(true) if param[:owner] == 'true'\n unless nil_or_empty?(param[:apps])\n param[:apps].each_with_index do |item, index|\n app_drop_down.select item\n role_drop_down.select param[:roles][index] if param[:roles]\n site_drop_down.select param[:sites][index] if param[:sites]\n add_new_app.click\n end\n end\n invite_button.click\n end",
"def invite_user invitation, link\n\n @invitation = invitation\n @link = link\n\n mail :to => invitation.email, :subject => t('invitation_mailer.invite_user.subject')\n end",
"def invitation_email(user, pot)\n @user = user\n @pot = pot\n mail(subject: \"You're invited to contribute!\", to: user.email)\n end",
"def invite_resource(&block)\n resource_class.invite!(invite_params, current_inviter, &block) \n end",
"def sendEventInvite(e, u)\n if !isSignedIn\n redirect_to root_url, notice: \"You must be signed in to send invites.\"\n else\n @e = current_user.events.find_by(id: e)\n @u = User.find_by(id: u)\n\n if @e == nil\n redirect_to '/users/' + u, notice: \"You do not own this event.\"\n elsif @u == nil\n redirect_to root_url, notice: \"This user does not exist.\"\n elsif isAttending(e, u)\n redirect_to '/users/' + u, notice: \"This user is already attending this event.\"\n elsif isInvited(e, u)\n redirect_to '/users/' + u, notice: \"This user is already invited to this event.\"\n else\n @n = @u.notifications.build(:user_id => u, :title => 'New Event Invite', :desc => getName(u, current_user.id) + \" has invited you to attend their event \" + @e.name + \".\", :sender_id => e, :notification_type => 3)\n @n.save\n respond_to do |format|\n format.html { redirect_to '/users/' + u, notice: 'Invitation Sent.' }\n format.json { head :no_content }\n end\n end\n end\n end",
"def invited_user_registered(user)\n\t\t\tUserMailer.delay.user_registered_confirmation(user)\n\t\tend",
"def invite\n @meal = Meal.find(params[:meal_id])\n authorize @meal, :update?\n @user = if params[:user_id]\n User.find(params[:user_id])\n else\n User.find_by(name: params[:user_name])\n end\n @meal.invite_user @user\n redirect_to @meal\n end",
"def invite(user, group, mailto)\n @user = user\n @group = group\n mail(to: mailto, subject:'user.name invite you! Join GURUPU')\n end",
"def invite(user)\n return false if user == self || find_any_friendship_with(user)\n Amistad.friendship_class.new{ |f| f.friendable = self ; f.friend = user }.save\n end",
"def invite(invitation)\n @invitable = invitation.invitable\n @user = invitation.user\n # TODO: UPDATE the registration URL\n @registration_url = root_url\n\n view = 'invite'\n # invite_project or invite_board if available\n view += ('_%s' % invitation.invitable_type.parameterize) if @invitable\n\n title = @invitable.nil? ? Doers::Config.app_name : @invitable.title\n subject = _('%s invites you to work on %s.') % [invitation.user.name, title]\n\n mail(:to => invitation.email, :subject => subject, :template_name => view)\n end",
"def invite_user(username)\n pending_msg = \"The reviewer already has a pending invitation.\\n\\n#{username} please accept the invite here: #{invitations_url}\"\n collaborator_msg = \"#{username} already has access.\"\n added_msg = \"OK, invitation sent!\\n\\n#{username} please accept the invite here: #{invitations_url}\"\n error_msg = \"It was not possible to invite #{username}\"\n\n return pending_msg if is_invited? username\n return collaborator_msg if is_collaborator? username\n return added_msg if add_collaborator username\n return error_msg\n end",
"def invite_resource\n resource_class.invite!(invite_params, current_inviter) do |invitable|\n invitable.company_id = current_user.company_id\n invitable.is_admin = true\n invitable.require_email = true\n invitable.save\n end\n end",
"def invite(invitation)\n @invitation = invitation\n mail(to: invitation.email, subject: \"#{invitation.user.name} invite you to join GURUPU\")\n end",
"def invite(invite)\n @invite = invite\n mail(:to => invite.email, :subject => \"#{@invite.user.name} has invited you to the \\\"#{invite.idea.name}\\\" idea\", :tag => 'invite') \n end",
"def invitation_claimed(invitation, user)\n @invitation = invitation\n @user = user\n mail(:to => invitation.user.email, :subject => _('%s joined %s.') % [\n @user.nicename, Doers::Config.app_name])\n end",
"def send_invite_email(invite)\n @invite = invite\n log_email_sent(\"send invite\", @invite.email)\n mail(:to => @invite.email, :subject => \"You've been invited to a TrueGM League\")\n end",
"def invitation(user, project, email, invitation_token)\n @user = user\n @project = project\n @invitation_token = invitation_token\n\n mail to: email, subject: \"Team invitation\"\n end",
"def invite(user_params, email)\n raise StandardError, 'The account can not be activate' if email.nil?\n self.username = user_params[:username] # set the username\n self.passwd = user_params[:passwd] # set the password\n self.passwd_confirmation = user_params[:passwd_confirmation]\n\n # save user and activate\n User.save_user_and_email(self, email, true)\n end",
"def invite_friend\n friend = params[:invite_friend]\n profile = User.find_by_id(friend[:user_id])\n\n UserMailer.send_invitation(friend, profile).deliver\n redirect_to profile_path(profile)\n end",
"def invite\n parent = {coparent_email: '[email protected]', coparent_name: 'Vasco'}\n UserMailer.invite(parent)\n end",
"def invite(invited_jid,reason=\"no reason\",&blk)\n msg = connection.message_stanza(:to => jid) do\n x('x', 'xmlns' => Namespaces::MucUser) do\n x('invite', 'to' => invited_jid.to_s) do\n x('reason', reason) if reason\n end\n end\n end\n connection.send_stanza msg, &blk\n end",
"def invitation_used user, invitation\n if invitation\n @user = user\n @invitation = invitation\n mail( to: invitation.from,\n subject: \"Your invitation to #{invitation.to} was just used\"\n )\n end\n end",
"def showInvite\n @user = current_user\n end",
"def send_invites\n # Security stuff\n raise Kroogi::NotPermitted unless permitted?(@user, :profile_edit) # @user is inviter\n unless check_invites_quota(@user)\n redirect_to(:controller => 'invite', :action => 'find') and return\n end\n \n request = InviteRequest.find(params[:invite_id]) unless params[:invite_id].blank?\n\n # Ensure sufficient params\n unless params[:to_invite]\n flash[:warning] = 'No users selected to invite -- please try again'.t\n redirect_to(:controller => 'invite', :action => 'find') and return\n end\n unless params[:circle_id] && Invite.valid_circle_id?(params[:circle_id].to_i, :include_site_invite => true)\n flash[:warning] = 'Invalid circle id -- please try again'.t\n redirect_to(:controller => 'invite', :action => 'find') and return\n end\n\n invites_sent = Invite.send_invites(params, @user)\n\n # Set success or failure messages\n if invites_sent.empty?\n flash[:warning] = 'Unable to send any of the invites'.t\n redirect_to(:controller => 'invite', :action => 'find', :invitee_id => invites_sent.size == 1 && !invites_sent.first.user_id.blank? ? invites_sent.first.user_id : nil) and return\n else\n flash[:success] = (invites_sent.size == 1) ? (\"Successfully invited %s\" / [invites_sent.first.display_name]) : (\"Successfully sent %d invitations\" / [invites_sent.size])\n end\n\n question_of_some_target_user = invites_sent.find { |i| i.user && !i.user.public_questions.interactive_for(@user).empty? }\n PublicQuestionHelper::set_question_artist_id(question_of_some_target_user.user, self, :force_show => true) if question_of_some_target_user\n\n # OK, now redirect appropriately\n respond_to do |wants|\n wants.html do\n is_site_invite = params[:circle_id].to_i == Invite::TYPES[:site_invite][:id]\n redirect_to is_site_invite ? ({:controller => '/user', :action => 'founders', :id => @user}) : ({:controller => '/kroogi', :action => 'show_pending', :id => @user, :type => params[:circle_id], :highlight_invite => invites_sent.map(& :id).join('|')})\n end\n wants.js do\n render(:update) do |page|\n page.select(\".invite_#{request.id}_status\").each { |i| i.replace 'User added'.t }\n page.select(\".invite_#{request.id}_status\").each { |i| i.visual_effect :highlight }\n end\n end\n end\n # Shit... something went wrong. It shouldn't, so send admin alert out, too\n rescue ActiveRecord::RecordInvalid => e\n flash[:warning] = 'Unable to send some or all of your invites'.t\n just_notify(e)\n redirect_to :controller => 'invite', :action => 'find'\n end",
"def invite\n verifier = ActiveSupport::MessageVerifier.new(\"secret\")\n begin\n message = verifier.verify(::Base64.urlsafe_decode64(params[:token]))\n rescue ActiveSupport::MessageVerifier::InvalidSignature, ArgumentError\n logger.warn \"Invalid invite link: #{params[:token]}\"\n flash[:alert] = 'Invalid link'\n redirect_to new_registration_path and return\n end\n @user = User.find_by(id: message[:user_id])\n unless @user\n flash[:alert] = 'Invalid link'\n redirect_to new_registration_path and return\n end\n unless current_user.is_signed_in?\n session[:user_id] = @user.id\n flash[:notice] = \"Please select a username and password to complete your registration\"\n end\n end",
"def send_invitation\n DelayedJob.enqueue('UserInviter',\n Time.now+10.second,\n self.id.to_s,\n I18n.translate(:you_are_invited_by, :name => self.user.name),\n self.message\n )\n end",
"def invite(firm_name, firstname, lastname, email, phone)\n invite_params = vendor_params(firm_name, firstname, lastname, email, phone)\n @client.post(\"/#{@model}\", {}, invite_params)\n end",
"def invite_via_suggestion(invited_user, project_invite, authorised_by_user)\n return false unless (@invited_user = invited_user).receive_notifications?\n\n @organisation = project_invite.invited_organisation_resource\n @invited_user = project_invite.invited_user\n @authorised_by_user_name = authorised_by_user.first_name.blank? ? 'Someone' : authorised_by_user.first_name\n @authorised_by_user_email = authorised_by_user.email\n \n mail to: @invited_user.email, subject: \"You've been invited to join an organisation on DigitalSocialInnovation\"\n end",
"def event_invite(user_event)\n\t headers[\"Custom-header\"] = \"Bar\"\n\t @record = user_event\n\t \tmail(:to => user_event.user.email, :subject => \"Você foi convidado para o Evento #{user_event.event.title}\")\n\tend",
"def invite(nickname, channel)\n send_data(\"INVITE #{nickname} #{channel}\")\n end",
"def organization_invite(org_invite)\n new_user = !org_invite.user.confirmed?\n confirmation_link = new_user ? user_confirmation_url(confirmation_token: org_invite.user.confirmation_token) : org_invite_url(org_invite, token: org_invite.token)\n email_template = new_user ? 'organization-invite-new-user' : existing_user_template(org_invite)\n\n MnoEnterprise::MailClient.deliver(email_template,\n default_sender,\n recipient(org_invite.user,new_user),\n invite_vars(org_invite,new_user).merge(confirmation_link: confirmation_link)\n )\n end",
"def accepted_by(user)\n return false unless self.active?\n # assign user to startup unless they are already part of a startup\n relationship_role = nil\n\n if self.invite_type == Invite::TEAM_MEMBER\n user.startup_id = self.startup_id if !self.startup_id.blank? or !user.startup_id.blank?\n user.set_account_type(:entrepreneur)\n # Bypass forcing user to setup account if they were invited from startup that is setup, also don't suggest startups\n user.setup_complete! if self.startup.account_setup?\n elsif self.invite_type == Invite::STARTUP\n user.set_account_type(:entrepreneur)\n relationship_role = :startup_startup\n elsif self.invite_type == Invite::MENTOR || self.invite_type == Invite::NREDUCE_MENTOR # Add user as mentor to startup\n user.set_account_type(:mentor)\n user.roles << :nreduce_mentor if self.invite_type == Invite::NREDUCE_MENTOR\n relationship_role = :startup_mentor\n elsif self.invite_type == Invite::INVESTOR\n user.set_account_type(:investor)\n relationship_role = :startup_investor\n end\n\n # Add user to startup if invite came from startup\n if !self.startup.blank? and !relationship_role.blank?\n r = Relationship.start_between(user, self.startup, relationship_role, true)\n if r.blank?\n self.errors.add(:user_id, 'could not be added to startup')\n else\n self.errors.add(:user_id, 'could not be added to startup') unless r.approve!\n end\n end\n \n if user.save\n self.to = user\n self.accepted_at = Time.now\n self.save\n else\n false\n end\n end",
"def invite(n, c)\n @socket << \"INVITE #{n} #{c}\"\n end",
"def chat_invite(user, ticket, message)\n # set up all variables to be used within the message\n @user = user\n @ticket = ticket\n @message = message\n @auth = Ticket.find(ticket).auth_client\n @sign_up_url = access_sign_up_url\n @ticket_url = ticket_url id: @ticket.id\n @chat_url = Rails.configuration.sync.root + '/chat/' + @ticket.id.to_s + '?email=' + @user.email + '&auth=' + @auth\n\n # send the email\n mail to: @user.email, subject: \"Response about ##{@ticket.id}: #{@ticket.subject}\"\n end",
"def send_invite(invite, password=nil)\n @invite = invite\n @event = @invite.event\n @password = password\n @email = @invite.invited_email\n @photographer = @event.photographer\n @subject = @invite.invite_subject\n link_slug = Link.create(event_id: @event.id)\n unique_key = Shortener::ShortenedUrl.generate(event_path(link_slug, invited: 'true')).unique_key\n @link = (ENV['END_CLIENT_URL'] || Rails.application.secrets[:env]['END_CLIENT_URL']) + '/' + unique_key\n mail(to: @email, subject: @subject )\n end",
"def invite_friend(opts)\n unless opts[:email] || opts[:user_id]\n raise InvalidArgumentError.new \"invite_friend hash argument must include :email or :user_id\"\n end\n translated_options = {}\n translated_options[:invitedUserEmail] = opts[:email] if opts[:email]\n translated_options[:invitedUserId] = opts[:user_id] if opts[:user_id]\n post(\"/user/#{@user_id}/friends/invitations.json\", translated_options)\n end",
"def inviter\n invite = Invitation.find_by_recipient_email(login)\n User.find(invite.sender_id) unless invite.nil?\n end",
"def check_invite(user)\n if session[:token]\n invite = Invite.find_by(token: session[:token])\n if invite\n user.update(role: :user)\n session[:token] = nil\n invite.delete\n end\n end\n end",
"def notify\n @user = @organization.users.find(params[:uid])\n if @organization.invite_member(@user)\n flash[:notice] = \"Organization invite resent to #{@user.email}.\"\n else\n flash[:alert] = \"Organization invite failed to #{@user.email}.\"\n end\n redirect_to @organization\n end",
"def new_workplace_invite(sender, invite, recipient_email, recipient_name, workplace, token, workplace_id)\n @sender = sender\n @invite = invite\n @recipient_email = recipient_email\n @recipient_name = recipient_name\n @workplace = workplace \n @token = token\n @workplace_id = workplace_id\n mail(to: \"#{@recipient_email}\", subject: \"#{@sender.name} invited you to join Ossemble\")\n end",
"def inviter?(user)\n return user.id == inviter_user_id\n end",
"def invitar(otro_user)\n if user != otro_user and not cousers.include?(otro_user)\n participacions.create(user_id: otro_user.id)\n end\n end",
"def do_invite(invite)\n if invite.existing_user?\n deliver_email(InviteMailer.existing_user(invite))\n after_invite_existing_user(invite)\n invite.save\n else\n deliver_email(InviteMailer.new_user(invite))\n after_invite_new_user(invite)\n end\n end",
"def accept\n if self.check_user && self.check_owner_user\n\n @user = User.find(@invite[:user_id])\n @user[:guild_id] = @guild[:id]\n\n Invite.all.where(:user_id => @user[:id]).destroy_all\n @user.save\n\n head :no_content\n else\n render json: { }, status: :unprocessable_entity\n end\n end",
"def after_invite_existing_user(invite)\n # Add the user to the invitable resource/organization\n invite.invitable.add_invited_user(invite.recipient)\n end",
"def accept_invite(event)\n invite = Invite.where(user: self, event: event)\n invite.accept if invite.present?\n end",
"def invite(invitation)\n @invite = invitation\n mail :to => invitation.email,\n :subject => \"Welcome to the Panda\"\n end",
"def invite(invitation, www_host)\n @invitation = invitation\n @www_host = www_host\n \n mail :to => invitation.email_address\n end",
"def user_invite(body)\n raise ArgumentError unless body.is_a?(Array)\n raise ArgumentError unless body.first.is_a?(Hash)\n\n api.post('user/invite', body, 'application/json')\n end",
"def invite(player, message)\n @player = player\n @message = message\n mail to: @player.email\n end",
"def invite_user_with_http_info(invite_user_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.invite_user ...'\n end\n # verify the required parameter 'invite_user_request' is set\n if @api_client.config.client_side_validation && invite_user_request.nil?\n fail ArgumentError, \"Missing the required parameter 'invite_user_request' when calling UsersApi.invite_user\"\n end\n # resource path\n local_var_path = '/v2/users/invite'\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(invite_user_request)\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['OAuth2']\n\n new_options = opts.merge(\n :operation => :\"UsersApi.invite_user\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#invite_user\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def local_invite(body)\n peer = _pop_token(body)\n room = @var[:room] if body.length < 2\n _remote_control(peer, :invite, room)\n _notice \"#{peer} has been invited to #{room}\"\nend",
"def after_create(user)\n if user.invited_by_id?\n invitation = Invitation.new(sender: user.invited_by, friend: user)\n invitation.accept!\n else\n # TODO There's a potential exploit here where someone creates 100 dummy accounts, invites one account and collects all the free time on that one account.\n Invitation.where(email: user.email).each do |invitation|\n invitation.friend = user\n invitation.accept!\n end\n end\n end",
"def invited_user\n get_or_make_reference('User', @data, 'invited_user_id')\n end",
"def invitee?(user)\n return user.id == invitee_user_id\n end",
"def create\n self.resource = User.find_by(email: params[:user][:email]) || invite_resource\n\n # Set roles, whether they are a new user or not\n # safe because adding the same role twice is a noop\n site = Site.instance\n if params[:user][:roles].present?\n params[:user][:roles].split(',').each do |role|\n resource.add_role(role.strip, site)\n end\n end\n # end of override code\n\n yield resource if block_given?\n\n # Override destination as this was a success either way\n if is_flashing_format? && resource.invitation_sent_at\n set_flash_message :notice, :send_instructions, email: resource.email\n end\n if method(:after_invite_path_for).arity == 1\n respond_with resource, location: after_invite_path_for(current_inviter)\n else\n respond_with resource, location: after_invite_path_for(current_inviter, resource)\n end\n end",
"def invite_a_friend_to_track(user, email, the_body, the_subject) \n recipients email\n #bcc \"[email protected]\"\n from user.first_name + \" via habitforge <[email protected]>\"\n subject the_subject \n body the_body\n content_type \"text/html\"\n end",
"def send_request(user)\n @user = user\n mail(:to => ADMIN_MAIL, :subject => 'New User Registered')\n end",
"def existing_workplace_invite(sender, invite, recipient_email, recipient_name, workplace)\n @sender = sender\n @invite = invite\n @recipient_email = recipient_email\n @recipient_name = recipient_name\n @workplace = workplace \n mail(to: \"#{@recipient_email}\", subject: \"#{@sender.name} added you to an Ossemble Workplace\")\n end",
"def process_invite_token(new_user = nil)\n new_user = user_instance_variable if new_user.nil?\n token = params[:invite_token]\n new_user.claim_invite token if !token.nil? && !new_user.nil?\n end",
"def accept\n user = User.find_by(email: @invitation.email)\n if current_user == user\n @invitation.accept!(user.id)\n flash[:notice] = \"Invitation accepted!\"\n redirect_to admins_events_path\n else\n redirect_to admins_event_event_registrations_path, alert: \"Ups! Action not allowed for this user.\"\n end\n end",
"def resend_invitation\n @teammate = Teammate.find(params[:teammate_id])\n current_user_is_the_owner = @current_user.id == @teammate.pitch.user_id\n return redirect_to forbidden_path unless current_user_is_the_owner\n\n @teammate.resend_invitation_email\n return redirect_to pitch_teammate_path(@pitch, @teammate), flash: { notice: \"Convite re-enviado com sucesso para #{@teammate.user.name}\" }\n end",
"def accept_invite(requestor_id)\n respond_to_invite(requestor_id, true)\n end",
"def send_matches(user)\n @user = user\n mail(:to => user.email, :subject => \"Your Secret Santa Society match is ready.\")\n end",
"def resend_invite\n if commenter = @site.commenters_without_account.find { |c| c.id.to_s == params[:id] }\n if invite = commenter.invites.find_by_page_id(@site.home_page)\n Mailer.deliver_commenter_invite(invite)\n flash[:notice] = \"Invitation resent\"\n redirect_to admin_panel_commenters_path(@site)\n return\n end\n else\n flash[:error] = \"Could not resend invite to commenter\"\n render :template => \"admin_panel/invalid\"\n end\n end",
"def invited?(user)\n friendship = find_any_friendship_with(user)\n return false if friendship.nil?\n friendship.friend_id == user.id\n end"
]
| [
"0.7875361",
"0.7409569",
"0.72580934",
"0.71687394",
"0.7155036",
"0.7117217",
"0.7102348",
"0.70202494",
"0.6974214",
"0.69494957",
"0.69450635",
"0.68922514",
"0.6872253",
"0.6859638",
"0.6843247",
"0.68290806",
"0.68261147",
"0.6823207",
"0.6821242",
"0.6817716",
"0.67828244",
"0.6741028",
"0.6737367",
"0.67008054",
"0.66968006",
"0.6668792",
"0.6659762",
"0.66526777",
"0.6651874",
"0.6649635",
"0.6647736",
"0.66367275",
"0.6630169",
"0.6616911",
"0.661192",
"0.65959114",
"0.6569847",
"0.6541558",
"0.6536298",
"0.6530436",
"0.65262777",
"0.6490101",
"0.64878523",
"0.6487775",
"0.6486217",
"0.64747655",
"0.64560634",
"0.6439131",
"0.64010686",
"0.6391796",
"0.638565",
"0.6379776",
"0.6377695",
"0.6376173",
"0.6366727",
"0.6356864",
"0.6351697",
"0.63515556",
"0.63239527",
"0.6308782",
"0.62630224",
"0.6255473",
"0.6253263",
"0.6247066",
"0.62464035",
"0.6245647",
"0.62436575",
"0.62255704",
"0.6224951",
"0.6215954",
"0.62110114",
"0.6205308",
"0.61966765",
"0.6193895",
"0.61773646",
"0.6169296",
"0.6163004",
"0.6156726",
"0.6149887",
"0.6141902",
"0.61417407",
"0.6132377",
"0.6119054",
"0.6112459",
"0.6110965",
"0.6107826",
"0.61030483",
"0.6088584",
"0.60861826",
"0.60763776",
"0.60744345",
"0.6073154",
"0.6066147",
"0.6064728",
"0.6057653",
"0.6042764",
"0.60407805",
"0.6026744",
"0.6024011",
"0.60216486"
]
| 0.7767632 | 1 |
Select Children Entity of File Entity | def test_cases(email_id = nil, root_folder = nil)
file_selector(root_folder).email_id(email_id)
.map(&:test_cases).reject(&:empty?).flatten.unwrap
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def children\n c = file_log.children(file_node)\n c.map do |x|\n VersionedFile.new(@repo, @path, :file_id => x, :file_log => file_log)\n end \n end",
"def children\n# Dir[file_path + '/*'].map do |path|\n# child File.basename(path)\n# end\n @collection.find({:filename => /^#{Regexp.escape(@bson['filename'])}[^\\/]+\\/?$/}).map do |bson|\n child bson\n end\n end",
"def fetch_children\n @children = []\n for item in self.listex\n if item[\"type\"] == \"folder\" and item[\"id\"]!=@id #sharefile API includes self in list\n @children << Folder.new(item[\"id\"], @authid, @subdomain, false, item)\n elsif item[\"type\"] == \"file\"\n @children << File.new(item[\"id\"], @authid, @subdomain, item)\n end\n end\n end",
"def children(entity)\n self.all(:parent_id => entity.id)\n end",
"def children\n Feature.find(:all, :conditions => [ 'parent_id=?', self.id] )\n end",
"def get_child_entity_from_path_by(field, children)\n # the next child in the path\n child_value = children.shift\n # get the child entity\n child = self.send(:children).find {|child| child.send(field) == child_value}\n if child && children.size > 0\n # we have some recursion to do - we're not at the end of the array\n # so call this method again with a smaller set of children\n child.get_child_entity_from_path_by(field, children)\n else\n return child #this is the final thing in the array - return it\n end\n end",
"def children\n Dir[file_path + '/*'].map do |path|\n child ::File.basename(path)\n end\n end",
"def files()\n children.select { |c| c.file? }\n end",
"def children()\n #Ressource.filter(:parent_id => self.id, :parent_service_id => self.service_id).all\n end",
"def child_entities(entity_id)\n API::request(:get, \"entities/#{entity_id}/child_entities\")\n end",
"def getFiles(tree, name)\n files = []\n\n tree.each_tree do |subtree|\n path = name + subtree[:name] + '/'\n subfiles = getFiles($repo.lookup(subtree[:oid]), path)\n files.push(*subfiles)\n end\n\n tree.each_blob do |file|\n file[:name] = name + file[:name]\n files.push(file)\n end\n\n return files\nend",
"def children\n dataset.nested.filter(self.class.qualified_parent_column => self.id)\n end",
"def children\n\t\treturn self.search( :one, '(objectClass=*)' )\n\tend",
"def children(options={:type => nil, :get_dataset => false, :recursive => false, :keep_cache => true, :reload => false, :preconditions => {:hidden => false}})\n return @children_cache if @children_cache and !options[:get_dataset] and !options[:reload]\n klass = Ecore::db[:documents]\n if options[:type]\n raise(TypeError, \":type must be an Ecore::DocumentResource\") unless options[:type].respond_to?(:table_name)\n klass = Ecore::db[:\"#{options[:type].table_name}\"]\n end\n query = klass.store_preconditions((@user_obj || @group_ids || @user_id),nil,self,nil,(options[:preconditions] || {:hidden => false}))\n query = ( options[:recursive] ? query.where(:path.like(\"#{absolute_path}%\")) : query.where(:path => absolute_path) )\n return query if options[:get_dataset]\n children_cache = query.order(:position,:name).receive(:all)\n return children_cache if options[:keep_cache]\n @children_cache = children_cache\n end",
"def sub_tree\n files = ProjectFile.where(directory_id: id)\n files = files.nil? ? [] : files \n\n files.sort{|x,y| \n if x.is_directory and not y.is_directory\n -1\n elsif not x.is_directory and y.is_directory\n 1\n else\n x.name <=> y.name\n end\n }\n end",
"def multiple_children(paths)\n end",
"def files\n nodes_files = UserFile.where(id: nodes)\n nodes_user_files = UserFile.where(id: user_files)\n nodes_files.or(nodes_user_files).real_files\n end",
"def fetch_children\n @children = []\n for item in self.listex\n if item[\"type\"] == \"folder\" and item[\"id\"]!=@id #sharefile API includes self in list\n @children << ShareFolder.new(item[\"id\"], @authid, false, item)\n elsif item[\"type\"] == \"file\"\n @children << ShareFile.new(item[\"id\"], @authid, item)\n end\n end\n end",
"def file_sets_for(work)\n Hyrax.custom_queries.find_child_file_sets(resource: work)\n end",
"def find_selected_childentries(userid)\n @entries = Entry.find(:all, :conditions => [\"user_id=? and parent_id = ? \", userid, self.id])\n \n \n return @entries\n end",
"def all_children\n find_all_children_with_dotted_ids\n end",
"def direct_children_by_id(*args)\n scope = args.last.is_a?(Hash) ? args.pop : {}\n ids = args.flatten.compact.uniq\n self.class.find_in_nested_set(:all, { \n :conditions => [\"#{scope_condition} AND #{prefixed_parent_col_name} = #{self.id} AND #{self.class.table_name}.#{self.class.primary_key} IN (?)\", ids]\n }, scope) \n end",
"def children\n attributes.fetch(:children)\n end",
"def children\n @ref.children.to_ruby\n end",
"def get_file_instance(id)\n raise 'The primary key must be an integer.' unless id.instance_of? Integer\n name_list = []\n while true\n file = Fileinfo[id] \n break if id == file.parent_id\n name_list.push(file.name)\n id = file.parent_id\n end\n find_file(name_list.reverse, 1)\n end",
"def children()\n bag.ls(path).map { |pat| bag.get(pat) }.compact\n end",
"def related_files\n []\n end",
"def top_level_files\n program_files.where parent_id: 0\n end",
"def each_file_in_tree\n self.directories_in_tree.find_each do |directory|\n next if directory.nil?\n directory.cfs_files.find_each do |cfs_file|\n next if cfs_file.nil?\n\n yield cfs_file if block_given?\n end\n end\n end",
"def children\n self.class.find(:all, :conditions => \"#{acts_as_nested_set_options[:scope]} AND #{acts_as_nested_set_options[:parent_column]} = #{self.id}\", :order => acts_as_nested_set_options[:left_column])\n end",
"def child_items\n items = []\n if dir?\n @path.sort_files(@path.children).each do |child|\n if child.directory?\n child = Path.new(child.to_s)\n end\n items << Item.new(child)\n end\n return items\n end\n nil\n end",
"def children\n ie = index_entry\n ie.children.collect{ |child| child.resource } if ie\n end",
"def children\n files = if index?\n # about/index.html => about/*\n File.expand_path('../*', @file)\n else\n # products.html => products/*\n base = File.basename(@file, '.*')\n File.expand_path(\"../#{base}/*\", @file)\n end\n\n Set.new Dir[files].\n reject { |f| f == @file || project.ignored_files.include?(f) }.\n map { |f| self.class[f, project] }.\n compact.sort\n end",
"def get_children(params)\n scope_data_class(params) do\n params[:limit] = config[:rows_per_page] if config[:enable_pagination] && (params[:id].nil? || params[:id] == 'root')\n params[:scope] = config[:scope]\n data_adapter.get_records(params, final_columns)\n end\n end",
"def children\n \n TapirLogger.instance.log \"Finding children for #{self}\"\n children = []\n EntityMapping.all.each do |mapping| \n\n # Go through each associated entity mapping, and find mappings where the parent_id is us\n # which means that the child_id is some other entity, and it's a child\n \n # the to_s is important, otherwise self.id returns a :Moped::BSON::ObjectID\n children << mapping.get_child if mapping.parent_id == self.id.to_s\n\n # TODO - what happens if parent_id and child_id are the same. We'll\n # end up grabbing it. Could that break any assumptions?\n end\n \n children\n end",
"def children\n @id = fix_id(params[:id], params[:format], params[:extra])\n if params[:root]==\"source\" then\n @isRoot = true;\n @work = DcmWork.new(@id)\n @children = [@work.pi]\n else\n @isRoot = false;\n @children = get_children(\"nla.\"+params[:root])\n end\n render :action => \"children.json\"\n end",
"def children\n self.class.children(self) \n end",
"def children\n @resource.children\n end",
"def children\n entries\n end",
"def bundled_files\n self.study_files.where(:id.ne => self.parent&.id)\n end",
"def getAllChildren\n children = Tree.where(\"tree_type_id = ? AND version_id = ? AND subject_id = ? AND grade_band_id = ? AND code like ?\", tree_type_id, version_id, subject_id, grade_band_id, code+'.%')\n Rails.logger.debug(\"*** tree children: #{children.inspect}\")\n return children\n end",
"def files\n return unless session\n session.files.find_all_by_parent_folder_id(id)\n end",
"def children\n EarLogger.instance.log \"Finding children for #{self}\"\n ObjectManager.instance.find_children(self.id, self.class.to_s)\n end",
"def entity_objects\n ProjectMedia.where(id: self.entities).to_a\n end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children\n return [] if child_count <= 0\n with_cache(:children) do\n @od.request(\"#{api_path}/children?$top=1000\")['value'].map do |child|\n OneDriveItem.smart_new(@od, child)\n end\n end\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 get_children(directory)\n file = Pathname.new(directory)\n if file.directory?\n file.children\n else \n []\n end\nend",
"def getFile(tree, name, path = '')\n blob = nil\n\n tree.each_blob do |file|\n blob = file if file[:name] == name[/[^\\/]*/]\n blob[:name] = path + blob[:name]\n end\n\n if blob.nil?\n tree.each_tree do |subtree|\n if subtree[:name] == name[/[^\\/]*/]\n path += name.slice! name[/[^\\/]*/]\n name[0] = ''\n return getFile($repo.lookup(subtree[:oid]), name, path + '/')\n end\n end\n end\n\n return blob\nend",
"def children\n self.class.where('? = ANY(parent_ids)', id.to_s)\n end",
"def children\n @fieldset = DynamicFieldsets::Fieldset.find params[:id]\n\n respond_to do |format|\n format.html\n end\n end",
"def files; entries.find_all {|e| e.is_a? SiteFile} end",
"def find_images_and_attachments\n @image_content_nodes = []\n @attachment_nodes = []\n\n @node.children.accessible.with_content_type(%w(Image Attachment ContentCopy)).include_content.all.each do |node|\n node = node.content.copied_node if node.content_type == 'ContentCopy'\n if node.content_type == 'Image' && !node.content.is_for_header? && node.content.show_in_listing\n @image_content_nodes << node.content\n elsif node.content_type == 'Attachment'\n @attachment_nodes << node\n end\n end\n end",
"def find_files(file_set:)\n if file_set.respond_to?(:file_ids)\n return [] if file_set.file_ids.blank?\n query_service.custom_queries.find_many_file_metadata_by_ids(ids: file_set.file_ids)\n else\n raise ::Valkyrie::Persistence::ObjectNotFoundError,\n \"#{file_set.internal_resource} is not a `Hydra::FileSet` implementer\"\n end\n end",
"def children\n @children\n end",
"def children\n @children\n end",
"def list_children(path)\n path = \"#{Paths::VFS}/#{path}\" unless path.start_with?(Paths::VFS)\n path = sanitize_path(path)\n\n @api.get(path)\n end",
"def get_children\n @children\n end",
"def find_files(file_set:)\n if file_set.respond_to?(:file_ids)\n return [] unless file_set.file_ids.present?\n query_service.custom_queries.find_many_file_metadata_by_ids(ids: file_set.file_ids)\n else\n raise ::Valkyrie::Persistence::ObjectNotFoundError,\n \"#{file_set.internal_resource} is not a `Hydra::FileSet` implementer\"\n end\n end",
"def file_entities\n @world.plugins.reduce(core_file_entities) do |files, plugin|\n plugin.process(@world, files, @migration_id_generator)\n end\n end",
"def child_objects(valkyrie: false)\n af_objects = Wings::ActiveFedoraConverter.new(resource: self).convert.objects\n return af_objects unless valkyrie\n af_objects.map(&:valkyrie_resource)\n end",
"def filedocer\n suid = file_id\n Cofile.find(:all, :select => \"name\", :conditions => {:id => suid}).map(&:name)\nend",
"def project_files(project_id, query_params = nil)\n get_project_children(project_id, __method__, query_params)\n end",
"def children_get()\n @children\n end",
"def children\n base_set_class.find(:all, :conditions => \"#{scope_condition} AND #{parent_col_name} = #{self.id}\", :order => left_col_name)\n end",
"def all_children\n return @all_children if !@all_children.nil?\n @all_children = PhotoCollection.all_urls.find_all{|url| url[self.url] && url != self.url}.collect{|url| PhotoCollection.find_by_url(url)}\n end",
"def children\n return @children unless @children.nil?\n @children = if exists? && directory?\n Dir.glob( File.join(absolute_path,'*') ).sort.map do |entry|\n git_flow_repo.working_file(\n entry.gsub( /^#{Regexp.escape absolute_path}/, tree )\n )\n end\n else\n false\n end\n end",
"def vms(folder)\n children = []\n folder.childEntity.each do |x|\n name, junk = x.to_s.split('(')\n case name\n when \"Folder\"\n children.push(vms(x))\n when \"VirtualMachine\"\n children.push(x)\n end\n end\n\n children\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 children\n Brand.where(:parent => self.name).order('sort_order, name')\n end",
"def get_children\n \t@children\n end",
"def children\n [] if leaf?\n self.class.where('forestify_left_position > ?', self.forestify_left_position).where('forestify_right_position < ?', self.forestify_right_position)\n end",
"def children_of(page)\n children = (page_repository.children_of(page) || [])\n children\n .map { |child| decorate_page(child) }\n .select { |child| self.include_page?(child) }\n end",
"def children\n rows\n end",
"def children\n rows + tags\n end",
"def children\n params[:scope] ||= \"private\"\n\n children = if params[:scope] == Scopes::SCOPE_PRIVATE\n @folder&.children ||\n current_user.nodes.where(parent_folder_id: nil)\n elsif params[:scope] == Scopes::SCOPE_PUBLIC\n @folder&.children ||\n Node.where(scope: params[:scope], parent_folder_id: nil)\n end\n\n if [Scopes::SCOPE_PRIVATE, Scopes::SCOPE_PUBLIC].include?(params[:scope])\n children = children.where.not(sti_type: \"Asset\")\n end\n\n children = children.where(scope: params[:scope]).order(:sti_type, :name)\n\n render json: children, root: \"nodes\", adapter: :json\n end",
"def list\n FileOperations.find_all(self)\n end",
"def Files\n deep_copy(@tomerge)\n end",
"def children\n properties \n end",
"def files(treeish = nil)\n tree_list(treeish || @ref, false, true)\n end",
"def /(file)\n Tree.content_by_path(repo, id, file, commit_id, path)\n end",
"def get_the_individual_file_to_be_processed\n # p \"individual file selection\"\n files = GetFiles.get_all_of_the_filenames(@project.freecen_files_directory, @project.file_range)\n files\n end",
"def children\n return @children if [email protected]?\n @children = all_children.find_all{|collection| collection.url.count('/') == self.url.count('/') + 1}\n end",
"def children\n self.node.children.collect(&:content)\n end",
"def get_all_files()\n return $db.execute(\"SELECT users.username, files.* \n FROM files \n INNER JOIN users ON files.owner_id = users.user_id\")\nend",
"def children\n Product.unscoped.deleted.where(:parent_id=>self.id)\n end",
"def get_children(h, n)\n rr = h[n[:id]]\n if !rr.nil?\n rr[:children]\n else\n []\n end\n end",
"def get_children(h, n)\n rr = h[n[:id]]\n if !rr.nil?\n rr[:children]\n else\n []\n end\n end",
"def subquery_accessible entity\r\n result = []\r\n if entity.accessible?\r\n entity.children.each { |c|\r\n result.push c\r\n result.concat subquery_accessible(c)\r\n }\r\n end\r\n result\r\n end",
"def children(*args)\n self.class.send(:with_scope, :find=>{:conditions=>['parent_node_id=?', self.child_node_id]}) do\n self.class.find(:all, *args)\n end\n end"
]
| [
"0.65462726",
"0.62598735",
"0.6126877",
"0.6052726",
"0.59739906",
"0.58670396",
"0.5845405",
"0.5786994",
"0.57763016",
"0.57571495",
"0.5747008",
"0.57430923",
"0.5725942",
"0.5724671",
"0.5688765",
"0.56602407",
"0.5643537",
"0.56219006",
"0.5613663",
"0.55840254",
"0.55814487",
"0.5578483",
"0.5529339",
"0.55120313",
"0.5506763",
"0.54864067",
"0.5483538",
"0.54757667",
"0.54678744",
"0.5461863",
"0.54529184",
"0.5447478",
"0.5443616",
"0.5442259",
"0.5436762",
"0.5422491",
"0.5414926",
"0.5412272",
"0.5406954",
"0.54031277",
"0.5393108",
"0.5386566",
"0.53827983",
"0.5382115",
"0.53788614",
"0.53788614",
"0.53788614",
"0.53788614",
"0.53788614",
"0.53788614",
"0.53788614",
"0.53788614",
"0.53788614",
"0.53788614",
"0.53788614",
"0.53788614",
"0.5367069",
"0.5365521",
"0.5365446",
"0.5350908",
"0.5339156",
"0.5337513",
"0.533131",
"0.53205067",
"0.53042847",
"0.5303675",
"0.5303675",
"0.53022593",
"0.52896655",
"0.5284068",
"0.52827686",
"0.5280905",
"0.5276636",
"0.5268283",
"0.5261981",
"0.52478933",
"0.5244324",
"0.5230209",
"0.5224793",
"0.52195317",
"0.52069217",
"0.5204502",
"0.5204241",
"0.5203986",
"0.52024424",
"0.5195498",
"0.51947856",
"0.5189717",
"0.5183366",
"0.5162164",
"0.5158734",
"0.5155932",
"0.51516944",
"0.51511574",
"0.5148385",
"0.51434106",
"0.51413006",
"0.5136366",
"0.5136366",
"0.5128198",
"0.5126448"
]
| 0.0 | -1 |
def owned_methods(email_id, folder = nil) all_methods(nil, folder).select do |method| method.line_percentage[email_id].to_i >= threshold end end | def complexity_methods(email_id = nil)
file_selector.to_methods.too_complexity(15).unwrap.map do |method|
if email_id
1.0 * (method.line_percentage[email_id].to_f / 100)
else
1
end
end.sum.round
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filtered_methods\n @filtered_methods ||= []\n end",
"def filter_methods; end",
"def report_methods cm\n return if cm.method_list.empty?\n\n report = []\n\n cm.each_method do |method|\n next if method.documented? and @coverage_level.zero?\n\n if @coverage_level > 0 then\n params, undoc = undoc_params method\n\n @num_params += params\n\n unless undoc.empty? then\n @undoc_params += undoc.length\n\n undoc = undoc.map do |param| \"+#{param}+\" end\n param_report = \" # #{undoc.join ', '} is not documented\\n\"\n end\n end\n\n next if method.documented? and not param_report\n\n line = method.line ? \":#{method.line}\" : nil\n scope = method.singleton ? 'self.' : nil\n\n report << \" # in file #{method.file.full_name}#{line}\\n\"\n report << param_report if param_report\n report << \" def #{scope}#{method.name}#{method.params}; end\\n\"\n report << \"\\n\"\n end\n\n report\n end",
"def total_distance\n total = 0\n self.rides.each do { |ride| total += ride.distance }\n total\n end\n\n def self.mileage_cap(distance)\n self.all.select { |driver| driver.total_distance > distance }\n end\n\nend",
"def percent_reduction method_events\n non_deleted = method_events.select {|e| e.status != :deleted }\n return 0.0 if non_deleted.count == 0\n num_reductions = non_deleted.each_cons(2)\n .count {|before, after| after.method_length < before.method_length }\n num_reductions / non_deleted.count.to_f\nend",
"def check_only_methods\n end",
"def filter_for(method_name)\n methods = Array.new\n \n @filter_chain.each do |method_to_call, option|\n if option == true\n methods << method_to_call\n elsif option.has_key?(:only) && option[:only].include?(method_name.to_sym)\n methods << method_to_call \n elsif option.has_key?(:except) && !option[:except].include?(method_name.to_sym)\n methods << method_to_call \n end\n end\n\n return methods.uniq\n end",
"def refactoring_reduction_profile events\n events.group_by(&:method_name)\n .map {|_,e| percent_reduction(e) }\n .freq_by {|e| (e * 100 / 10).to_i }\nend",
"def resp_groups events\n es = method_events(events)\n es.group_by {|e| [e.class_name,e.day] }\n .map {|_,es| es.map(&:method_name).uniq.sort }\n .freq\n .select {|g| g.second >= 4 } # occurrences\n .select {|g| g.first.count >= 3 } # method group size\nend",
"def payees_with_usage; end",
"def gather_if(*methods, &block)\n add_gather_conditions(methods, block, true)\n end",
"def blocked_by(id, page_options = default_paging_options, scope = Amico.default_scope_key)\n members(\"#{Amico.namespace}:#{Amico.blocked_by_key}:#{scope}:#{id}\", page_options)\n end",
"def method_meters(klass,imethods=[],cmethods=[])\n res=nil\n begin\n imethods.each {|m| measure_instance_method(klass,m) }\n cmethods.each {|m| measure_class_method(klass,m) }\n res=yield\n ensure\n imethods.each {|m| restore_instance_method(klass,m) }\n cmethods.each {|m| restore_class_method(klass,m) }\n end\n res\n end",
"def filtered_recipients(method)\n recipients.each_with_object([]) do |recipient, array|\n array << recipient if recipient.preferences.methods.include?(method)\n end\n end",
"def receives_emails_for\n recips = user.things_i_track.email_delivery.tracked_item_is_user.map(&:tracked_item_id)\n recips = User.find(:all, :conditions => {:id => recips}) unless recips.blank?\n return recips.uniq.select {|u| user.is_self_or_owner?(u)}\n end",
"def unrequired_methods(*ids)\n @unreq ||= []\n @unreq += ids\n end",
"def messagable(number:, interests:)\n rv = []\n self.class.unmessaged(id).excluding(self.id).order('RAND()').find_in_batches(batch_size: 500) do |batch|\n batch.each do |profile|\n rv << profile if (profile.interests.to_a & interests.to_a).any?\n return rv if rv.size == number\n end\n end\n\n raise(NotEnoughMessagableProfiles, \"Couldn't find #{number} messagable profiles\")\n end",
"def methods_by events\n events.group_by(&:method_name).select {|_,es| yield(es) }\nend",
"def report_method_stuff(requested_method_name, methods)\n entries = methods.find_all {|m| m.name == requested_method_name and (\n !@onlyLoadedClasses or \n Object.class_eval \"defined? #{m.nameSpace.full_name}\" ) }\n case entries.size\n when 1\n method = @ri_reader.get_method(entries.first)\n @display.display_method_info(method)\n when 0\n puts \"No loaded methods matched your request\"\n else\n @display.display_method_list(entries)\n end\n end",
"def run_find_not_status_for(method_id, subject)\r\n unless subject.class.name == self.status_for_subject\r\n raise \"initialize_status_for is not defined for #{subject.class.name}\"\r\n end\r\n self.where(\"NOT idx(#{self.table_name}.#{method_id}_for, #{subject.id})::boolean\") \r\n end",
"def ownership_effect events\n events.group_by(&:method_name).map do |method_name, method_events|\n [method_name,\n method_events.map(&:committer).uniq.count,\n method_events.map(&:method_length).max]\n end\nend",
"def filter_methods found, name\n regexp = name_regexp name\n\n filtered = found.find_all do |store, methods|\n methods.any? { |method| method.full_name =~ regexp }\n end\n\n return filtered unless filtered.empty?\n\n found\n end",
"def calculate_recipients\n # TODO (Step 3) - Fix, not working\n SUBSCRIBERS.filter do |email|\n !UNSUBSCRIBED.include?(email)\n end\nend",
"def __list_check_methods\n methods.grep(/^#{@@checks_start_with}/) do |method|\n method.to_s\n end\n end",
"def paintings # Get a list of all the paintings by a specific(keywrod for instance method) artists\n Painting.all.select{|list| list.gallery == self}\n # binding.pry\n end",
"def filter_methods found, name\n regexp = name_regexp name\n filtered = found.find_all do |store, methods|\n methods.any? { |method| method.full_name =~ regexp }\n end\n return filtered unless filtered.empty?\n found\n end",
"def blocked(id, page_options = default_paging_options, scope = Amico.default_scope_key)\n members(\"#{Amico.namespace}:#{Amico.blocked_key}:#{scope}:#{id}\", page_options)\n end",
"def all_without_email\n\n end",
"def bornin2 _method, _class\n\n # the patten to grep for\n re = Regexp.new '^' + _method.to_s + '$'\n\n _class.ancestors.each do |ancestor|\n\n #- in methods?\n if ancestor.methods(false).grep(re).size==1\n return puts \"=> #{_method} : \" +\n\t\"..... born in #{ancestor} as a method\".green\n end\n\n #- in instance_methods?\n if ancestor.instance_methods(false).grep(re).size==1\n return puts \"=> #{_method} : \" +\n\t\"...... born in #{ancestor} as an instance method\".green\n end\n\n end # scanning ancestors\n\nend",
"def find_followers\n bloodoath_cults = BloodOath.all.select do |bloodoath_instance|\n bloodoath_instance.cult == self \n end\n bloodoath_cults.map do |cult|\n cult.follower \n end\n end",
"def method_length_freq es\n es.group_by(&:method_name)\n .map {|_,v| v.last }\n .reject {|e| e.status == :deleted }\n .map {|e| e.method_length }\n .freq\nend",
"def filter_advices(advices, method)\n advices.select do |advice|\n advice.match?(method, self)\n end\n end",
"def calculate_recipients\n # binding.pry\n # SUBSCRIBERS - UNSUBSCRIBED\n SUBSCRIBERS.select { |subscriber| !UNSUBSCRIBED.include?(subscriber) }\n # Using the SUBSCRIBERS and UNSUBSCRIBED arrays,\n # write a method that will return an array of only the subscribers who haven't unsubscribed\nend",
"def run_find_status_for(method_id, subject)\r\n unless subject.class.name == self.status_for_subject\r\n raise \"initialize_status_for is not defined for #{subject.class.name}\"\r\n end\r\n self.where(\"idx(#{self.table_name}.#{method_id}_for, #{subject.id})::boolean\")\r\n end",
"def disks_each(condition)\n res = []\n disks.each do |_id, disk|\n next unless disk.method(condition).call\n\n yield disk if block_given?\n\n res << disk\n end\n\n res\n end",
"def score_methods(meths, args)\n scores = meths.collect do |meth|\n score = meth.score_cached(args)\n if score \n score = [ score, meth ]\n else\n score = nil\n end\n\n score\n end\n\n scores.compact!\n scores.sort!\n \n $stderr.puts %{ score_methods(#{args.inspect}) => \\n#{scores.collect{|x| x.inspect}.join(\"\\n\")}} if @debug\n\n scores\n end",
"def have_an_outing( total, tip, *diners )\n cs = CheckSplitter.new( total, tip, diners.length )\n amount_per_person = cs.split_the_bill\n \n diners.each do |diner|\n if @members.has_key?( diner )\n p = @members[diner]\n p.spend( amount_per_person )\n else\n add_member(diner)\n p = @members[diner]\n p.spend( amount_per_person )\n end\n end\n @members\n end",
"def follow_criterias?(methods)\n all_pass = true\n if (not methods.is_a? Array) or methods.size < 0\n return false \n else\n for m in methods\n if self.class.method_defined? m\n # evaluate \n all_pass &&= self.send(m) \n return all_pass if not all_pass #break if one not pass\n else\n puts \"[Error] #{m} method is not defined!\"\n return false # fail criteria not defined\n end\n end\n return all_pass\n end\n end",
"def findAttachmentFiles()\n @attachments = Array.new\n pngFiles = Dir[\"*.png\"]\n\n pngFiles.each do |file|\n# if !file.match(/DistributionOfN.png/)\n @attachments << file\n# end\n end\n end",
"def sniff\n # TODO: Only checks instance methods!\n actual = context.node_instance_methods.length\n return [] if actual <= max_allowed_methods\n\n [smell_warning(\n lines: [source_line],\n message: \"has at least #{actual} methods\",\n parameters: { count: actual })]\n end",
"def amount_sum_for(meth)\n entries.select(&meth).map{ |entry| entry.amount.to_i }.compact.inject(&:+) || 0\n end",
"def my_photos\n Photo.all.select do |photo|\n photo.user == self\n end\n end",
"def reduction_multiple events\n event_list = method_events(events)\n event_list.group_by {|e| e.method_name }\n .select {|_,es| es.map(&:committer).uniq.count != 1 }\n .map {|_,es| percent_reduction(es) }\n .mean\nend",
"def filter_users_by_messages\n puts \"Calculating total messages sent by each person\"\n people = {}\n count = 0\n File.open(@source_filename,\"r\").each do |line|\n parts = line.split(' ', 4)\n p, c = parts[0].to_i, parts[2].to_i\n people[p] ||= 0\n people[p] += c\n count += 1\n print \".\" if count % 1000 == 0\n end\n \n # Write to base\n puts \"Writing to base...\"\n File.open(@people_base,\"w\") do |f|\n people.each { |k,v| f.puts \"#{k} #{v}\" }\n end\n \n puts \"Filtering people by >= #{@n}\"\n File.open(@people_filename+\"~\",\"w\") do |ofile|\n people.each do |k,v|\n ofile.puts \"#{k} #{v}\" if v >= @n\n end\n end\n File.rename(@people_filename+\"~\",@people_filename)\n end",
"def trending_methods events\n method_events(events).select {|e| e.status == :changed }\n .group_by {|e| month_from_date(e.date) }\n .to_a\n .last[1]\n .freq_by(&:method_name)\n .sort_by {|_,count| -count }\n .take(10)\nend",
"def finder_methods; end",
"def filter(players)\n players.reject do |player|\n player.send(self.class.points_method) < limit\n end\n end",
"def track_methods(trackable, methods)\n if trackable.is_a? Array\n trackable.each { |trackable| track_methods trackable, methods }\n else\n trackable.track_method_calls(references, *Array(methods))\n end\n end",
"def lifters\n # binding.pry\n memberships.map { |membership| membership.lifter }.uniq\n end",
"def filter(type_and_methods)\n type = type_and_methods.keys.first\n Array(type_and_methods[type]).each do |method|\n filters(type) <<\n case method\n when Symbol, String then proc { |message| send(method, message) } \n when Proc then method\n end\n end\n end",
"def list_methods_matching name\n found = []\n\n find_methods name do |store, klass, ancestor, types, method|\n if types == :instance or types == :both then\n methods = store.instance_methods[ancestor]\n\n if methods then\n matches = methods.grep(/^#{Regexp.escape method.to_s}/)\n\n matches = matches.map do |match|\n \"#{klass}##{match}\"\n end\n\n found.concat matches\n end\n end\n\n if types == :class or types == :both then\n methods = store.class_methods[ancestor]\n\n next unless methods\n matches = methods.grep(/^#{Regexp.escape method.to_s}/)\n\n matches = matches.map do |match|\n \"#{klass}::#{match}\"\n end\n\n found.concat matches\n end\n end\n\n found.uniq\n end",
"def profiles_with_revealed_emails\n profiles.where(id: revealed_ids)\n end",
"def reduction_single events\n event_list = method_events(events)\n event_list.group_by {|e| e.method_name }\n .select {|_,es| es.map(&:committer).uniq.count == 1 }\n .map {|_,es| percent_reduction(es) }\n .mean\nend",
"def get_mails()\n emails = Mail.find(:what => :first, :count => 20, :order => :asc)\n relevant = filter_mails emails\n parse_mails relevant\n end",
"def inherited_methods\n self.methods.select{|m| self.method(m).owner != self }\n end",
"def find_members \n Member.where(:user_guid => self.guid)\n end",
"def method_missing(meth, *args, &block)\n if meth.to_s =~ /^recent_(\\w+)$/\n recent_type = $1.singularize.camelize.constantize\n views = viewings.find(:all, :limit => AppConstants::RECENT_LIMIT, :order => \"created_at DESC\",\n :conditions => \"viewable_type = '#{recent_type}'\").map { |viewing| viewing.viewable }.uniq.compact\n # make sure the viewings are available to this contact\n views.reject { |v| !account_list.include?(v.account)}\n else\n super\n end\n end",
"def search_all\n r=[]\n [:find_histogram,:find_density,:find_statistics,:find_original, :find_classification, :find_im,:find_ct].each do |m|\n r << self.send(m)\n puts \"Done with #{m}\"\n end\n r.flatten\nend",
"def all_giraffes\n methods.select { |m| m =~ /_giraffe$/ }\n end",
"def run_checks\n methods.keep_if { |m| m.match(/^check_/) }.each do |check|\n send check.to_sym unless @skip.include? check.to_s.sub 'check_', ''\n end\n end",
"def finder_methods=(_arg0); end",
"def methods_profile events\n events.group_by {|e| week_from_date(e.date) }\n .map {|week,es| [week, method_count(es, :added), method_count(es, :changed), method_count(es, :deleted)] }\nend",
"def my_followers\n Bloodoath.all.select {|bloodoath| bloodoath.cult == self}\n end",
"def similar_methods(limit, sample_size)\n # TO_DO implement as non-gsl dependent\n # logger.info \"Similar Methods running for: #{self[:name]}\"\n # startTime = Time.now\n\n # methodsList = DesignMethod.where(\"design_methods.id != ?\", self[:id])\n # .order(\"RANDOM()\")\n # .limit(limit)\n\n # comparator = Corpus.new\n # comparingMethod = Document_Attach.new(self)\n # comparator << comparingMethod\n\n # methodsList.each do |dm|\n # comparator << Document_Attach.new(dm)\n # end\n\n # result = comparator.similar_documents(comparingMethod).sort {|tuple1, tuple2| tuple2[1] <=> tuple1[1] }\n # result = result.map {|tuple| tuple[0].obj}\n # result = result [1..sample_size]\n\n # endTime = Time.now\n # elapsed_time = endTime - startTime\n # logger.info \"Similar Methods took #{elapsed_time}s to query #{limit} random sample from db.\"\n # return result\n return []\n end",
"def callable_methods\n methods.grep(/^_\\w+[^_]$/)\n end",
"def list_contact_methods_parties\n\treturn if authorise_for_web(program_name?,'read') == false \n\n \tif params[:page]!= nil \n\n \t\tsession[:contact_methods_parties_page] = params['page']\n\n\t\t render_list_contact_methods_parties\n\n\t\t return \n\telse\n\t\tsession[:contact_methods_parties_page] = nil\n\tend\n\n\tlist_query = \"@contact_methods_party_pages = Paginator.new self, ContactMethodsParty.count, @@page_size,@current_page\n\t @contact_methods_parties = ContactMethodsParty.find(:all,\n\t\t\t\t :limit => @contact_methods_party_pages.items_per_page,\n\t\t\t\t :offset => @contact_methods_party_pages.current.offset)\"\n\tsession[:query] = list_query\n\trender_list_contact_methods_parties\nend",
"def covered_percentages; end",
"def covered_percentages\n map(&:covered_percent)\n end",
"def find_newly_added_collaborators\n emails = find_folder_members.collect{|m| m.email}\n @member_emails =[]\n params[:already_added_users] = params[:already_added_users].split(\",\").uniq - params[:deleted_users].split(\",\").uniq\n owner=find_folder_owner(params[:folder_id])\n params[:already_added_users].each do |m|\n @member_emails << m.strip if !emails.include?(m.strip) && m.strip != owner\n end\n end",
"def email_methods\n return @email_methods\n end",
"def email_methods=(value)\n @email_methods = value\n end",
"def company_payment_reminders\n check_company_usage_cycle\n company_monthly_payment_reminders\n end",
"def get_non_custom_lines\n message = Message.find(params[:message_id])\n\n # on landing page if custom line within distance then fetch all its non custom lines + All non custom lines created on Own custom line.\n # if not within distance then fetch only followed lines\n if params[:is_landing_page] == 'true'\n # check this message within 15 yards. if yes it means its all non custom lines are within distance\n # so fetch all non custom line messages\n # Get all non custom lines created on Own custom line.\n undercover_messages = [message]\n\n messages = Undercover::CheckNear.new(\n params[:post_code],\n params[:lng],\n params[:lat],\n current_user,\n undercover_messages\n ).perform\n\n if messages.length > 0 || message.user_id = current_user.id\n non_custom_lines = message.non_custom_lines\n\n non_custom_line_ids = non_custom_lines.map(&:id)\n non_custom_lines = Message.by_ids(non_custom_line_ids)\n .where.not('(public = false and locked = false)')\n else\n # Only get followed custom lines\n followed_messages = FollowedMessage.where(user_id: current_user)\n followed_message_ids = followed_messages.map(&:message_id)\n\n non_custom_line_messages = message.non_custom_lines\n custom_line_ids = non_custom_line_messages.map(&:id)\n\n # Get common elements from both array\n final_message_ids = followed_message_ids & custom_line_ids\n\n non_custom_lines = Message.by_ids(final_message_ids)\n .where.not('(public = false and locked = false)')\n end \n else\n non_custom_lines = message.non_custom_lines \n end\n\n render json: {\n messages: non_custom_lines.as_json(\n methods: %i[\n avatar_url image_urls video_urls like_by_user legendary_by_user user\n text_with_links post_url expire_at has_expired is_synced\n locked_by_user is_followed is_connected line_locked_by_user\n ],\n include: [\n :custom_line,:non_custom_lines\n ] \n )\n }\n end",
"def get_cvotes(contribution_id, cvote_id)\n Like.find_all_by_target_id_and_group_id(contribution_id, cvote_id).count\n end",
"def invested(domain)\n #identify unique rounds to this vc\n #go through my startups and identify the domain \n #if domain string == the startup domain, return the startup investment \n myStartupRound = FundingRound.all.select do |round|\n round.startup.domain == domain\n end\n myInvestment = myStartupRound.map do |round|\n round.investment\n end\n myInvestment.sum\n end",
"def get_all_unused_methods(access_control = nil)\n @methods.inject([]) do |unused_methods, (_class_name, methods)|\n unused_methods +=\n if access_control\n methods.select { |method| method.access_control == access_control && !method.used }\n else\n methods.reject(&:used)\n end\n end.reject { |method| method.access_control == 'public' && @possible_methods[method.method_name] }\n end",
"def print_methods(thread)\n total_time = thread.total_time\n methods = thread.methods.sort_by(&sort_method).reverse\n\n sum = 0\n methods.each do |method|\n total_percent = (method.total_time / total_time) * 100\n next if total_percent < min_percent\n next if total_percent > max_percent\n\n sum += method.self_time\n\n @output << \"%6.2f %9.3f %9.3f %9.3f %9.3f %8d %s%s\\n\" % [\n method.self_time / total_time * 100, # %self\n method.total_time, # total\n method.self_time, # self\n method.wait_time, # wait\n method.children_time, # children\n method.called, # calls\n method.recursive? ? \"*\" : \" \", # cycle\n method_name(method) # name\n ]\n end\n end",
"def get_metodo_a_ejecutar(method, *args)\n candidatos = partial_blocks_total[method].values.find_all { |block| block.matches(*args) }\n\n if candidatos.empty?\n raise ArgumentError, \"undefined multimethod '#{method}' for arguments #{args} in #{self}\"\n end\n candidatos.min_by { |block| block.distancia(*args) }\n end",
"def patients_in_ipp_and_greater\n Patient.find(gather_patient_ids).keep_if do |p|\n p.patient_relevant?(measures.pluck(:_id), ['IPP'])\n end.pluck(:_id)\n end",
"def pbHealAll\n return if !$Trainer\n for i in $Trainer.party\n i.heal\n end\nend",
"def invested(domain)\n #binding.pry\n funding_rounds.select{|fr| fr.startup.domain == domain}.map{|fr| fr.investment}.sum\n end",
"def warn_if_file_less_than(percentage:)\n filtered_items.each do |item|\n next unless item.total_percentage < percentage\n\n warn \"#{item.name} has less than #{percentage}% coverage\"\n end\n end",
"def exclude\n all - methods\n end",
"def check5(pmt)\n pmt > 5\nend",
"def _idiomatic_methods\n IDIOMS.select {|idiom| _sorted_methods.select { |meth| meth.to_s =~ /#{idiom}/ }.length == 2 }\n end",
"def cults_helper\n Bloodoath.all.select { |bloodoath| bloodoath.follower == self}\n end",
"def examine_context(ctx)\n max_copies = value(MAX_COPIES_KEY, ctx, DEFAULT_MAX_COPIES)\n min_clump_size = value(MIN_CLUMP_SIZE_KEY, ctx, DEFAULT_MIN_CLUMP_SIZE)\n MethodGroup.new(ctx, min_clump_size, max_copies).clumps.each do |clump, occurs|\n found(ctx, \"takes parameters #{DataClump.print_clump(clump)} to #{occurs} methods\",\n 'DataClump', {'parameters' => clump.map {|name| name.to_s}, 'occurrences' => occurs})\n # SMELL: name.to_s is becoming a nuisance\n # TODO: record the methods in [lines] and in the hash\n end\n end",
"def mechanics\n Mechanic.all.select do |mechanic_ob|\n #binding.pry\n mechanic_ob.specialty == self.classification\n end\nend",
"def nearby_profile_messages\n user_id = params[:user_id]\n\n messages = Message.by_messageable_type('Network')\n .locked_is(true)\n .by_user(user_id)\n .by_not_deleted\n .sort_by_last_messages(params[:limit], params[:offset])\n\n #if user have private message then only filter with 15 miles\n if messages.count > 0 && params[:is_distance_check] == 'true'\n # check does messages are within 15 miles\n messages = Undercover::CheckNear.new(\n params[:post_code],\n params[:lng],\n params[:lat],\n current_user,\n messages\n ).perform\n end\n\n render json: {\n messages: messages.as_json(\n methods: %i[\n avatar_url image_urls video_urls user\n text_with_links post_url expire_at has_expired line_locked_by_user\n ]\n )\n }\n end",
"def method_churns es\n method_events(es).select {|e| e.status == :changed }\n .freq_by(&:method_name)\n .sort_by(&:second)\n .reverse\nend",
"def divisible_by_5_and_3\n numbers = (1..100).to_a # this will create an array from 1 to 100. Check the Range class from Ruby - https://ruby-doc.org/core-2.5.1/Range.html\n\n numbers.select { |number| number % 3 == 0 && number % 5 == 0 }\nend",
"def percentage(reports, meth, value=nil)\n\t\treturn nil if\\\n\t\t\treports.empty?\n\t\t\n\t\tn = 0\n\t\treports.each do |report|\n\t\t\tv = report.send(meth)\n\t\t\tn += 1 if (value.nil? && v) || (value==v)\n\t\tend\n\t\n\t\t# calculate the percentage of reports for which\n\t\t# report.send(_meth_) was true, and crop it to\n\t\t# two decimal places. this belongs in the view :|\n\t\tratio = n.to_f / reports.length\n\t\tsprintf(\"%0.2f\", ratio * 100)\n\tend",
"def only_cell_method\n @groups.each(&:only_cell_method)\n end",
"def find_all_permission_methods\n self.methods.select do |method_name|\n method_name =~ /\\Acan_\\w+[^=]\\Z/\n end\n end",
"def meals\n Meal.all.select do | meal |\n meal.waiter == self\n end\n end",
"def get_received_bymethods( session_key)\n response_xml = self.call( :get_received_bymethods, message: {\n arg0: session_key\n })\n response = IssueCentre::Response.parse( response_xml)\n end",
"def long_planeteer_calls(planateer_calls)# code an argument here\n # Your code here\n planateer_calls.any? { |call| call.length >= 5 }\n \nend",
"def fAmountOfNotificationsFrom (email)\n @users.amountOfNotificationsFrom(email)\n end",
"def memberships \n Membership.all.select do |membership|\n membership.lifter == self\n end \nend",
"def accountability_objects\n case count_method_for_accountability.to_sym\n when :awardees then awardees\n when :presenters then presenters\n when :complete then complete\n else []\n end\n end"
]
| [
"0.5408398",
"0.528725",
"0.51977926",
"0.51311713",
"0.51252735",
"0.5055385",
"0.49779195",
"0.49562535",
"0.49326468",
"0.49144018",
"0.4911979",
"0.4907823",
"0.4881014",
"0.48604232",
"0.48261976",
"0.47978246",
"0.4793017",
"0.47929212",
"0.47819003",
"0.47785315",
"0.47584224",
"0.47557425",
"0.4748348",
"0.47376803",
"0.4736693",
"0.47332093",
"0.47322062",
"0.47314262",
"0.47293866",
"0.47194484",
"0.47159374",
"0.47146186",
"0.47065336",
"0.47034326",
"0.47022623",
"0.46961248",
"0.4683098",
"0.4675746",
"0.46691376",
"0.46657285",
"0.46554798",
"0.4653536",
"0.46521312",
"0.4652109",
"0.4649339",
"0.46397823",
"0.46376714",
"0.46371448",
"0.4632811",
"0.46280068",
"0.4624465",
"0.4622053",
"0.46213716",
"0.46205845",
"0.46165022",
"0.46128953",
"0.461018",
"0.46083772",
"0.46057647",
"0.4605241",
"0.46005526",
"0.45994073",
"0.45964918",
"0.45892954",
"0.45844197",
"0.45838204",
"0.4573392",
"0.45690075",
"0.45660818",
"0.4559319",
"0.45549378",
"0.45519513",
"0.45509237",
"0.45434237",
"0.45415354",
"0.45338017",
"0.4526852",
"0.45264715",
"0.45263374",
"0.4526159",
"0.452523",
"0.45224205",
"0.45211226",
"0.45176005",
"0.45088837",
"0.4506041",
"0.4505123",
"0.45032662",
"0.4502835",
"0.44984955",
"0.44893187",
"0.4487896",
"0.44846395",
"0.44793496",
"0.44786537",
"0.44777232",
"0.44767016",
"0.4476456",
"0.4473519",
"0.44725168"
]
| 0.6775092 | 0 |
maintains previous file number values while allowing for reseeding | def file_number_initial_value
@file_number ||= 100_000
# this seed file creates 40 new veterans on each run, 100 is sufficient margin to add more data
@file_number += 100 while Veteran.find_by(file_number: format("%<n>09d", n: @file_number))
@file_number
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_num_generate\n \t\t_random(6) + \"#{file_uid}\"\n\tend",
"def next_file_number\r\n most_recent_file_number + 1\r\n end",
"def auto_tracknumber\n i = 0\n @files.each { |file|\n next unless @selected_files.include? file\n file.set_values('TRACKNUMBER', (i+1).to_s)\n i += 1\n }\n end",
"def _file_num_generate\n\t\t_random(6) + \"#{_user[:uid]}\"\n\tend",
"def seq_new_num(filelist)\n\tinitial_num = 0\n\tfor i in 0 .. filelist.size-1\n\t\tif i == 0\n\t\t\tinitial_num = get_last_seq_num(filelist[i]) \n\t\t\ti += 1\n\t\telse\t\n\t\t\tFile.open(filelist[i]) do |f|\n\t\t\t\tout = \"\"\n\t\t\t\tlast_sequence_name = \"\"\n\t\t\t\tinitial_num += 1\n\t\t\t\tf.each do |line|\n\t\t\t\t\tline.chomp!\n\t\t\t\t\tif line.chars.first == \"@\"\n\t\t\t\t\telse\n\t\t\t\t\t\tnum = line.split(\"seq.\")[1].to_i \n\t\t\t\t\t\tlast_sequence_name = num if last_sequence_name == \"\"\n\t\t\t\t\t\tif last_sequence_name != num\n\t\t\t\t\t\t\tinitial_num += 1\n\t\t\t\t\t\t\tlast_sequence_name = num\n\t\t\t\t\t\tend\n\t\t\t\t\t\tsam_fields = line.split(\"\\t\")\n\t\t\t\t\t\tsam_fields[0] = sam_fields[0].gsub(num.to_s, initial_num.to_s)\n\t\t\t\t\t\tputs sam_fields.join(\"\\t\")\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\ti += 1\t\t\t\n\tend\nend",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def incremented_file_num(file)\n ext = File.extname(file)\n name_no_ext = File.basename(file, \".*\")\n number = get_dup_number(name_no_ext)\n file_no_paren = name_no_ext.split(/[(]\\d+[)]\\z/)[0]\n\n new_file_path = incremented_path(file_no_paren, number, ext)\n\n while File.exist?(new_file_path)\n number += 1\n new_file_path = incremented_path(file_no_paren, number, ext)\n end\n\n file_no_paren + \"(\" + number.to_s + \")\"\nend",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def next_number\n counter.call(files.last_number).to_s\n end",
"def reset_initial_version\n @initial_version = last_committed_sequence_number\n end",
"def counter(file,fixnum=0)\n p fixnum.class if $DEBUG\n if File.exist?(file)\n if fixnum.class!=Symbol\n now=File.read(file).to_f\n p now if $DEBUG\n if fixnum !=0\n res=now+fixnum\n p res if $DEBUG\n open(file,\"w\"){|io| io.print res.to_s}\n return res\n else\n return now\n end\n elsif fixnum==:reset\n open(file,\"w\"){|io| io.print \"0\"}\n return 0\n else\n #none ERROR\n p [file,fixnum,fixnum.class]\n end\n else\n #make file\n if fixnum==:reset\n fixnum=0\n end\n open(file,\"w\"){|io| io.print fixnum.to_s}\n return fixnum\n end\n end",
"def set_serial_number number\n appname = @appname\n pattern = Regexp.new \"^#{appname}:.*$\"\n filename = @app_serial_path || \"serial_numbers\"\n # during testing redo this file does not exist, so i get errors\n if !File.exists? filename\n get_serial_number\n end\n backup filename\n # from Sed\n change_row filename, pattern, \"#{appname}:#{number}\"\n end",
"def update_last_processed_block_number\n SaleGlobalVariable.last_block_processed.update_all(variable_data: @current_block_number.to_s)\n @last_processed_block_number = @current_block_number\n end",
"def update_current_file_and_current_id\n if @data_file[@current_id] && has_id_col? && @current_id != line_id\n @data_file[current_pid].close\n end\n\n @current_id = line_id\n\n if @data_file[@current_id] && @data_file[@current_id].closed?\n @data_file[@current_id].reopen(@data_file[@current_id].path, \"a\")\n elsif @current_id and @data_file[@current_id].nil? and not date.nil?\n set_datestamp\n # TODO: Make this configurable ---v\n filename = \"#{@match_buffer[\"_datestamp\"]}_#{@current_id}.data\"\n filename = File.join @options[:output_dir], filename\n\n puts \"creating new file: #{filename}\" if true || @options[:verbose]\n @data_file[@current_id] = File.open(filename, :mode => \"w\")\n end\n end",
"def increment_sequence_number\n @sequence_number += 1\n @sequence_number = 0 if @sequence_number > 0xFFFFFFFF\n end",
"def reset!\n @latest_block_number = nil\n end",
"def _set_serial_number number\n appname = @appname\n pattern = Regexp.new \"^#{appname}:.*$\"\n filename = @app_serial_path || \"serial_numbers\"\n # during testing redo this file does not exist, so i get errors\n if !File.exists? filename\n _get_serial_number\n end\n _backup filename\n change_row filename, pattern, \"#{appname}:#{number}\"\n end",
"def get_next_available_counter\n if @last_filename_counter\n @last_filename_counter + 1\n else\n last_used_counter + 1\n end\n end",
"def increment_downloads\n self.downloads = self.downloads+1\n self.save\n end",
"def increment_playcount(path)\n # sometimes files don't end up in the database, add them when played\n self.new_file(path)\n @files.filter(:path => path).update(:playcount => Sequel.expr(1) + :playcount)\n end",
"def increment_manuscript_rev_num\n if self.version && self.article\n num = self.manuscript_number \n rev = num.scan(/\\.R\\d+/)[0]\n if rev\n num.gsub!(/\\.R\\d+/,\"\")\n rev_num = rev.gsub(/\\.R/,\"\")\n rev_num = rev_num.to_i\n num+=\".R#{rev_num+1}\"\n else\n num = \"#{num}.R1\"\n end \n self.article.update_attribute(:manuscript_num,num)\n end\n end",
"def set_sequence\n if @file\n @job.sequence = \"\"\n @job.sequence << @file\n end\n @file = nil\n end",
"def current_number\n files = Dir[\"#{@dir}/*.json\"].map {|f| f.slice(/\\d+/) }.compact\n \"%04d\" % (files.last.to_i + 1)\n end",
"def tmpid\n @tmpid += 1\n end",
"def reset_counter; end",
"def reset\n\t\t@lineno = 0\n\t\t@filelineno = 0\n\t\t@filename = @files.first\n\t\t@index = 0\n\t\t@lines = nil\n\tend",
"def next_revision_number\n # Need to retrieve existing revision numbers to sort them as integers\n sql = \"SELECT revision FROM #{Changeset.table_name} \" \\\n \"WHERE repository_id = #{id} AND revision NOT LIKE 'tmp%'\"\n @current_revision_number ||= (self.class.connection.select_values(sql).collect(&:to_i).max || 0)\n @current_revision_number += 1\n end",
"def makeOldFiles(files)\n\t\tr = Random.new\n\t\ttotalOldFiles = r.rand(OLDFILES)\n\t\toldFiles = Array.new\n\t\tfor i in 1..totalOldFiles\n\t\t\tfileNumber = r.rand(0..files.size-1)\n\t\t\tname = files[fileNumber]\n\t\t\tif oldFiles.include?(name)\n\t\t\t\tredo\n\t\t\tend\n\t\t\tnow = Time.now\n\t\t\toldDate = now - (((60*60*24*365) * r.rand(1..5) + (60*60*24)))\n\t\t\tdateString = oldDate.strftime(\"%Y%m%d%H%M.%S\")\t\n\t\t\tcmd = \"touch -t #{dateString} #{name}\"\t\n\t\t\t`#{cmd}`\t\n\t\t\t#log \"Old file date:#{dateString}: #{name}\"\n\t\t\toldFiles << name\n\t\tend\n\t\treturn oldFiles\n\tend",
"def new_id\n @last_id ||= 0\n @last_id += 1\n end",
"def new_id\n @last_id ||= 0\n @last_id += 1\n end",
"def new_id\n @last_id ||= 0\n @last_id += 1\n end",
"def next_revision_number(existing_model)\n existing_model.revision_number + 1\n end",
"def masterfile_defaults\n {'seq_no' => 1}\n end",
"def assign_tx_seq_num\n self.update(tx_seq_num: Order.max_tx_seq_num + 1) \n end",
"def renumber_sequences\n first = 1\n for image in inline_images do\n image.sequence = first\n image.save!\n first += 1\n end\n end",
"def incremented_path(file, number, ext)\n incremented_file = file + \"(\" + number.to_s + \")\"\n File.join(data_path, File.basename(incremented_file + ext))\nend",
"def up_number\n unless number\n if Invoice.count == 0\n self.number = '001'\n else\n last_invoice = Invoice.order(:number).last\n self.number = last_invoice.number.succ\n end\n end\n end",
"def recreate_versions!\n with_callbacks(:recreate_versions, file) do\n versions.each { |name, v| v.store!(file) }\n end\n end",
"def reset\n @number = nil\n end",
"def keep_most_recent(number)\n @keep_most_recent = number\n end",
"def save\n self.id = (10 + Random.rand(99))\n FileOperations.add(self)\n puts 'Successfully Added'\n end",
"def next_auto_ref\n count = -1\n User.transaction do\n self.lock!\n count = self.image_ref_count + 1\n # for some reason update_attributes doesn't appear to work here\n self.image_ref_count = count\n self.save!\n end\n count\n end",
"def reset_counter\n @run_count = 0\n end",
"def generate_number(store)\n store.number = loop do\n random_number = Digest::SHA1.hexdigest([Time.now, rand].join)[0..5].upcase\n break random_number unless Store.exists?(number: random_number)\n end\n end",
"def invalidate\n clean_files\n @num = @laboratory = @pid = @profile = nil\n end",
"def most_recent_file_number\r\n file_dumps.collect {|x| number_from_name(x)}.compact.sort.last || 0\r\n end",
"def copy_to file\n file.puts \"# Revision #{@@outnum}<#{@num}>\" if $debug\n @newnum = @@outnum\n @@revision_number_mapping[@num] = @newnum\n @item[@item.type] = @newnum\n @@outnum += 1\n @item.copy_to file\n file.puts\n end",
"def increment\n if @seed < @max\n @seed += 1\n else\n @seed = 0\n end\nend",
"def get_new_random_number random_numbers\n random_number = 0\n begin\n random_number = rand @working_dataset.get_dataset_size\n end while (random_numbers.has_key?(random_number))\n random_numbers[random_number] = 1\n return random_number\n end",
"def increment_number\n @number_of_repos += 1\n end",
"def renumber_pages\n self.survey_version.pages\n .where(['page_number > ?', self.page_number])\n .update_all('pages.page_number = pages.page_number - 1')\n end",
"def last_used_counter\n directory_glob.inject(0) do |high_value, file|\n counter = get_counter_for_file(file)\n ((high_value <=> counter) == 1) ? high_value : counter\n end\n end",
"def next_temp_id\n @id ||= ASSET_GROUP_TEMPORARY_ID.to_i\n @id -= 1\nend",
"def update_os_process_counter_cache\n self.os_process_count.upto(self.os_processes.size - 1) do\n Fingerprint.increment_counter(:os_process_count, self.id)\n end\n end",
"def increment\n curr_value = counter\n self.counter = curr_value + 1\n save\n curr_value\n end",
"def reset_statistics!\n File.delete(previous_runs_filename) if File.exist?(previous_runs_filename)\n end",
"def reset(filename)\n @history = []\n @history_idx = -1\n\n unless filename.nil? or !File.exists? filename\n @history = File.readlines(filename).map { |l| l.rstrip }.reverse\n end\n\n @backend = File.open filename, \"a+\" unless filename.nil?\n end",
"def number\n @file_name.split('_').last[1..-1].to_i\n end",
"def set_version\n self.version ||= latest_version + 1\n end",
"def generate_new_filename(original_filename)\n s = Time.now.to_i.to_s + rand(999).to_s\n hash = Digest::MD5.hexdigest(s) \n original_filename = original_filename.gsub('#', '').gsub(/\\s+/, ' ')\n hash += ('-' + original_filename.sub(/\\A[a-z0-9]{32}-/, ''))\n hash.downcase \n end",
"def unique_temp\n \"$TMP_#{@unique += 1}\"\n end",
"def _next_id\n @@id -= 1\n @@id\n end",
"def add_download\n self.downloads += 1\n save(:validate => false)\n end",
"def add_download\n self.downloads += 1\n save(:validate => false)\n end",
"def create_or_update_previous_runs!\n if previously_ran?\n current_run.each do |description, elapsed|\n new_times = if previous_run[description.to_s]\n Array(previous_run[description.to_s]) << elapsed\n else\n Array(elapsed)\n end\n\n previous_run.store(description.to_s, new_times)\n end\n\n File.write(previous_runs_filename, previous_run.to_yaml)\n\n else\n\n File.write(previous_runs_filename, current_run.to_yaml)\n\n end\n end",
"def get_file_sequence\n sequence = 0\n @all_files ||= Bplmodels::Finder.getFiles(object_id)\n @all_files.each do |_file_type, files_array|\n files_array.each_with_index do |img, index|\n sequence = index if img['id'] == pid\n end\n end\n sequence\n end",
"def rollback_to_seed_data\n File.open(@database_config_path, \"w\") do |file|\n file.puts @original_database_config\n end\nend",
"def reset(value=0)\n @counter = value.to_i\n end",
"def store_results_file\r\n\taFile = File.new(\"./random_number_result.txt\", \"r+\")\r\n\taFile.truncate(0)\r\n\tnumber = generate_random_number\r\n\tputs aFile.syswrite(\"#{number}\")\r\nend",
"def change(number, file=nil)\n @number = Number.parse(number)\n save\n end",
"def inc_seq_no!()\n @seq_no += 1\n return(nil)\n end",
"def increment_and_save!\n update_and_save { self.last_value = (last_value || 0) + 1 }\n end",
"def update_data_version\n\t\t\t@data_version += 1\n\t\tend",
"def latest_file_index\n latest_index = 0\n latest_time = Time.at(0)\n (0..MAX_SAVE_SLOT-1).each do |i|\n filename = make_filename(i)\n next if !FileTest.exist?(filename)\n file_time = File.mtime(filename)\n if file_time > latest_time\n latest_time = file_time\n latest_index = i\n end\n end\n return latest_index\n end",
"def increment_version_code()\n path = '../app/build.gradle'\n re = /versionCode\\s+(\\d+)/\n \n s = File.read(path)\n versionCode = s[re, 1].to_i\n s[re, 1] = (versionCode + 1).to_s\n \n f = File.new(path, 'w')\n f.write(s)\n f.close\n end",
"def next_id\n self.latest_id += 1\n end",
"def set_default_number\n self.number ||= self.class.next_number repository\n end",
"def update_departure_sample_timestamps\n old_file_path = rename_original_file\n\n build_new_file(old_file_path: old_file_path)\n ensure\n File.delete(old_file_path)\n end",
"def upload_random_num_files(app, min: 1, max: 5)\n\n random_num_files = Random.rand(min..max)\n\n if app.uploaded_files.count < random_num_files\n\n (random_num_files - app.uploaded_files.count).times do | i |\n\n file_txt = File.open(File.join(FIXTURE_DIR, \"uploaded-#{i}.txt\"), 'w') do |f|\n f.puts \"This is a dummy file created to stand in for a file a user has uploaded with their SHF membership application.\"\n f.puts \"It was created by #{self.class.name}::#{__method__} [#{__FILE__} line #{__LINE__}]\"\n f.puts \"\\nThis can be added to git so that it is another 'uploaded file' that the mail preview and other spec tests can use.\"\n f.puts \"Or you can safely delete this file. (It will be recreated as needed by spec/mailers/previews/pick_random_helpers.rb )\"\n end\n\n uploaded_file = UploadedFile.create(actual_file: file_txt, shf_application: app, actual_file_file_name: \"uploaded-#{i}.txt\")\n app.uploaded_files << uploaded_file\n end\n\n end\n\n end",
"def id_counter\n\t\t@@new_id += 1\n\tend",
"def file_update\n File.open(\"fasta_files/#{@fasta_file_name}\", \"a\") do |file|\n file.puts \"\\n\"\n file.puts \"Most Frequent Sequences\"\n most_frequent_seq(range = 10).each do |seq|\n file.puts \"Sequence Count: #{seq.last}\"\n file.puts \"Sequence: #{seq.first}\"\n file.puts \"\\n\"\n end\n end\n end",
"def set_number\n return set_transaction_id if self.id\n #self.transaction_id = (Time.now.to_i).to_s(CHARACTERS_SEED)## fake number for friendly_id validator\n begin\n self.transaction_id = SecureRandom.random_number(FIXNUM_MAX)\n end while self.class.exists?(transaction_id: transaction_id)\n end",
"def reset!\n self.draft = find_original_file!.read\n save!\n end",
"def retrack_everything()\n\t\tputs \"******************* START RETRACKING ********************\"\n\t\[email protected]{ |number, file|\n\t\t\tputs \"#{number}. Processing \\\"#{file}\\\"...\"\n\t\t\ttagger = ID3Tagger.new( @tag )\n\n\t\t\t# special cases for track renumbering\n\t\t\tif( @renumber )\n\t\t\t\ttagger.track_number = transform_track_number( number )\n\t\t\tend\n\n\t\t\tif( @tag.title )\n\t\t\t\ttagger.title = transform_meta_chars( @tag.title, number )\n\t\t\tend\n\n\t\t\tif @preserve\n\t\t\t\t# preserve file times\n\t\t\t\tatime = File.stat( file ).atime\n\t\t\t\tmtime = File.stat( file ).mtime\n\t\t\tend\n\n\t\t\t# tag the track\n\t\t\ttagger.tag( file )\n\n\t\t\tif @preserve\n\t\t\t\t# preserve file times\n\t\t\t\tFile.utime( atime, mtime, file )\n\t\t\tend\n\t\t}\n\n\t\tputs \"\\t...done.\"\n\t\tputs \"******************* FINIS RETRACKING ********************\"\n\tend",
"def set_key\n last_key = Issue.find_by_sql('select max(issueId) as maxid from issue')[0].maxid\n self.issueId = last_key.to_i + 1\n end",
"def reset_sequence_numbers\n result = Database.connection.exec(\"SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';\")\n table_names = result.map { |row| row.values_at('table_name')[0] }\n\n table_names_with_id_column = table_names.select do |table_name|\n result = Database.connection.exec(\"SELECT column_name FROM information_schema.columns WHERE table_name = '#{table_name}';\")\n column_names = result.map { |row| row.values_at('column_name')[0] }\n column_names.include?('id')\n end\n\n table_names_with_id_column.each do |table_name|\n result = Database.connection.exec(\"SELECT pg_get_serial_sequence('#{table_name}', 'id');\")\n sequence_name = result.getvalue(0, 0)\n Database.connection.exec(\"SELECT setval('#{sequence_name}', (select MAX(id) from #{table_name}));\")\n end\n end",
"def set_student_directory_num\n return if directory_num && (directory_num >= 0)\n\n max_num = AssignmentTeam.where(parent_id: parent_id).order('directory_num desc').first.directory_num\n dir_num = max_num ? max_num + 1 : 0\n update_attributes(directory_num: dir_num)\n end",
"def test_05b\r\n db = build\r\n nm = db.fetch 'image-1.jpg',:width => 102 # Autogenerate\r\n t1 = File.new(nm).mtime\r\n nm2 = db.fetch 'image-1.jpg',:width => 103 # Autogenerate\r\n t2 = File.new(nm2).mtime\r\n Kernel.sleep 1\r\n db.update 'image-1.jpg' # Update everything.\r\n assert_not_equal t1,File.new(nm).mtime\r\n assert_not_equal t2,File.new(nm2).mtime\r\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 save!\n File.open(@config[\"state_file\"], \"r\") do |fl|\n fl.flock(File::LOCK_EX)\n\n sequence = (@state.key?(\"sequence\") ? @state[\"sequence\"] + 1 : 0)\n data_file = @config[\"data_dir\"] + format(\"/%03d/%03d/%03d.osm.gz\", sequence / 1000000, (sequence / 1000) % 1000, (sequence % 1000))\n tmp_state = @config[\"state_file\"] + \".tmp\"\n tmp_data = \"/tmp/changeset_data.osm.tmp\"\n # try and write the files to tmp locations and then\n # move them into place later, to avoid in-progress\n # clashes, or people seeing incomplete files.\n begin\n FileUtils.mkdir_p(File.dirname(data_file))\n Zlib::GzipWriter.open(tmp_data) do |fh|\n fh.write(changeset_dump(open_changesets))\n end\n @state[\"sequence\"] = sequence\n File.open(tmp_state, \"w\") do |fh|\n fh.write(YAML.dump(@state))\n end\n\n # sanity check: the files we're moving into place\n # should be non-empty.\n raise \"Temporary gzip file should exist, but doesn't.\" unless File.exist?(tmp_data)\n raise \"Temporary state file should exist, but doesn't.\" unless File.exist?(tmp_state)\n raise \"Temporary gzip file should be non-empty, but isn't.\" if File.zero?(tmp_data)\n raise \"Temporary state file should be non-empty, but isn't.\" if File.zero?(tmp_state)\n\n FileUtils.mv(tmp_data, data_file)\n FileUtils.mv(tmp_state, @config[\"state_file\"])\n fl.flock(File::LOCK_UN)\n\n rescue\n STDERR.puts(\"Error! Couldn't update state.\")\n fl.flock(File::LOCK_UN)\n raise\n end\n end\n end",
"def make_id\n new_id = @id\n @id += 1\n new_id\n end",
"def load_last_keychain_id!\n @last_keychain_id_file ||= build_keychain_path\n if File.exists?(@last_keychain_id_file)\n self.last_keychain_id = File.read(@last_keychain_id_file).to_i\n else\n self.last_keychain_id = 0\n save\n end\n end",
"def change(file)\n @previous = dup if change?(file)\n set(file)\n end"
]
| [
"0.66594434",
"0.6558658",
"0.65488243",
"0.64710116",
"0.63970584",
"0.6373229",
"0.6373229",
"0.6373229",
"0.6373229",
"0.6373229",
"0.6373229",
"0.6373229",
"0.6368856",
"0.63578445",
"0.63262576",
"0.61928105",
"0.60107714",
"0.5927393",
"0.590658",
"0.5809058",
"0.5795036",
"0.575668",
"0.57446474",
"0.5739475",
"0.5689814",
"0.568662",
"0.5677494",
"0.5675731",
"0.56594896",
"0.5657934",
"0.5657696",
"0.5656821",
"0.5619805",
"0.5601436",
"0.5600951",
"0.55845964",
"0.55797696",
"0.55797696",
"0.55631185",
"0.55609524",
"0.5548916",
"0.5539655",
"0.55300415",
"0.54976416",
"0.54883766",
"0.5486468",
"0.5479615",
"0.5479339",
"0.5465941",
"0.5463334",
"0.5434245",
"0.5432153",
"0.5395653",
"0.538643",
"0.5383658",
"0.53659743",
"0.5361308",
"0.5358486",
"0.5350722",
"0.53490126",
"0.5348114",
"0.5343411",
"0.5325022",
"0.53054535",
"0.5298924",
"0.529196",
"0.52736366",
"0.52719516",
"0.52616096",
"0.52569693",
"0.52569693",
"0.5252123",
"0.525179",
"0.5246604",
"0.5244438",
"0.52403754",
"0.52363664",
"0.5236191",
"0.52344584",
"0.52330965",
"0.5231252",
"0.5227838",
"0.5227721",
"0.5223332",
"0.5218277",
"0.52167445",
"0.52092206",
"0.5204399",
"0.52035314",
"0.51998687",
"0.5196304",
"0.5184452",
"0.51779133",
"0.5176003",
"0.51750463",
"0.515747",
"0.5149012",
"0.5147226",
"0.51374173",
"0.5135366"
]
| 0.71149606 | 0 |
rubocop:disable Metrics/MethodLength rubocop:disable Metrics/AbcSize | def vacate_at_attorney_review(mtv_judge, drafting_attorney, lit_support_user)
# These are ready to be reviewed by the decision drafting attorney on the vacate stream
3.times do
original_stream = create_decided_appeal(mtv_judge, drafting_attorney)
mtv_task = create_motion_to_vacate_mail_task(original_stream)
mtv_task.update!(status: "on_hold")
jam_task = send_mtv_to_judge(original_stream, mtv_judge, lit_support_user, mtv_task, "denied")
judge_addresses_mtv(jam_task, "denied", nil, lit_support_user)
end
3.times do
original_stream = create_decided_appeal(mtv_judge, drafting_attorney)
mtv_task = create_motion_to_vacate_mail_task(original_stream)
mtv_task.update!(status: "on_hold")
jam_task = send_mtv_to_judge(original_stream, mtv_judge, lit_support_user, mtv_task, "dismissed")
judge_addresses_mtv(jam_task, "dismissed", nil, lit_support_user)
end
3.times do
original_stream = create_decided_appeal(mtv_judge, drafting_attorney)
mtv_task = create_motion_to_vacate_mail_task(original_stream)
mtv_task.update!(status: "on_hold")
jam_task = send_mtv_to_judge(original_stream, mtv_judge, lit_support_user, mtv_task, "granted")
judge_addresses_mtv(jam_task, "granted", "straight_vacate", drafting_attorney)
end
3.times do
original_stream = create_decided_appeal(mtv_judge, drafting_attorney)
mtv_task = create_motion_to_vacate_mail_task(original_stream)
mtv_task.update!(status: "on_hold")
jam_task = send_mtv_to_judge(original_stream, mtv_judge, lit_support_user, mtv_task, "granted")
judge_addresses_mtv(jam_task, "granted", "vacate_and_readjudication", drafting_attorney)
end
3.times do
original_stream = create_decided_appeal(mtv_judge, drafting_attorney)
mtv_task = create_motion_to_vacate_mail_task(original_stream)
mtv_task.update!(status: "on_hold")
jam_task = send_mtv_to_judge(original_stream, mtv_judge, lit_support_user, mtv_task, "granted")
judge_addresses_mtv(jam_task, "granted", "vacate_and_de_novo", drafting_attorney)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def implementation; end",
"def implementation; end",
"def refutal()\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def schubert; end",
"def offences_by; end",
"def strategy; end",
"def used?; end",
"def custom; end",
"def custom; end",
"def isolated; end",
"def isolated; end",
"def private_method\n end",
"def suivre; end",
"def intensifier; end",
"def internal; end",
"def spec; end",
"def spec; end",
"def operations; end",
"def operations; end",
"def initialize\n \n end",
"def celebration; end",
"def initialize\n\n end",
"def initialize\n\n end",
"def initialize\n \n end",
"def missing; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def ignores; end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super()\n end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def extra; end",
"def initialize\n\t\t\n\tend",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def villian; end",
"def overrides; end",
"def internship_passed; end",
"def anchored; end",
"def initialize() end",
"def same; end",
"def ignore; end",
"def formation; end",
"def executor; end",
"def executor; end",
"def executor; end",
"def missing?; end",
"def weber; end",
"def apply\n end",
"def initialize\r\n\r\n end",
"def who_we_are\r\n end",
"def operation; end",
"def initialize\n # nothing here for now\n end",
"def identify; end",
"def wrapper; end",
"def requirements; end",
"def requirements; end",
"def requirements; end",
"def requirements; end",
"def used\n raise NotImplementedError\n end",
"def processor; end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def prepareForReuse; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end"
]
| [
"0.765617",
"0.6290868",
"0.6230358",
"0.6230358",
"0.61819583",
"0.6159073",
"0.6159073",
"0.6159073",
"0.6159073",
"0.61298186",
"0.59577805",
"0.5946047",
"0.5894433",
"0.5822073",
"0.5822073",
"0.58099234",
"0.58099234",
"0.5807123",
"0.57961935",
"0.5735039",
"0.5690081",
"0.56790024",
"0.56790024",
"0.5671252",
"0.5671252",
"0.56696594",
"0.56654894",
"0.5664344",
"0.5664344",
"0.5654956",
"0.56512046",
"0.5646629",
"0.5646629",
"0.5646629",
"0.5646629",
"0.5646629",
"0.5646629",
"0.5646629",
"0.5646629",
"0.5646629",
"0.5646629",
"0.5646629",
"0.56341213",
"0.56146806",
"0.56146806",
"0.56146806",
"0.5605397",
"0.5601701",
"0.5601701",
"0.55752456",
"0.55719453",
"0.5562515",
"0.5562515",
"0.5562515",
"0.5562515",
"0.5562515",
"0.5562515",
"0.5562515",
"0.5562515",
"0.5562515",
"0.5562515",
"0.5558232",
"0.55565995",
"0.55554324",
"0.5547892",
"0.55400634",
"0.552974",
"0.5526096",
"0.5511417",
"0.5509817",
"0.5509817",
"0.5509817",
"0.5505472",
"0.5498985",
"0.5498651",
"0.5497132",
"0.54937834",
"0.5486925",
"0.5479476",
"0.54761565",
"0.5473863",
"0.54725564",
"0.54725564",
"0.54725564",
"0.54725564",
"0.54682744",
"0.5467481",
"0.54628927",
"0.54628927",
"0.54628927",
"0.54571754",
"0.54571754",
"0.54571754",
"0.54571754",
"0.5442898",
"0.5437053",
"0.5437053",
"0.5437053",
"0.5437053",
"0.5437053",
"0.5437053"
]
| 0.0 | -1 |
rubocop:enable Metrics/MethodLength rubocop:enable Metrics/AbcSize rubocop:disable Metrics/MethodLength | def fully_processed_vacate_appeal(mtv_judge, drafting_attorney, lit_support_user)
3.times do
original_stream = create_decided_appeal(mtv_judge, drafting_attorney)
mtv_task = create_motion_to_vacate_mail_task(original_stream)
mtv_task.update!(status: "on_hold")
jam_task = send_mtv_to_judge(original_stream, mtv_judge, lit_support_user, mtv_task, "granted")
post_decision_motion = judge_addresses_mtv(jam_task, "granted", "vacate_and_de_novo", drafting_attorney)
vacate_stream = post_decision_motion.appeal
jdr_task = vacate_stream.tasks.find_by(type: "JudgeDecisionReviewTask")
attorney_task = jdr_task.children.find_by(type: "AttorneyTask")
[jdr_task, attorney_task].each { |t| t.update!(status: "completed") }
root_task = vacate_stream.tasks.find_by(type: "RootTask")
BvaDispatchTask.create_from_root_task(root_task)
dispatch_user = vacate_stream.tasks
.reload.assigned_to_any_user.find_by(type: "BvaDispatchTask").assigned_to
last_six = original_stream.veteran.file_number[-6..-1]
citation_number = "A19#{last_six}"
outcode_params = {
citation_number: citation_number,
decision_date: Time.zone.now,
redacted_document_location: "\\\\bvacofil1.dva.va.gov\\archdata$\\arch1901\\#{citation_number}.txt",
file: last_six
}
BvaDispatchTask.outcode(vacate_stream.reload, outcode_params, dispatch_user)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def implementation; end",
"def implementation; end",
"def schubert; end",
"def refutal()\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def custom; end",
"def custom; end",
"def strategy; end",
"def offences_by; end",
"def used?; end",
"def intensifier; end",
"def isolated; end",
"def isolated; end",
"def suivre; end",
"def private_method\n end",
"def internal; end",
"def celebration; end",
"def operations; end",
"def operations; end",
"def missing; end",
"def internship_passed; end",
"def spec; end",
"def spec; end",
"def initialize\n\n end",
"def initialize\n\n end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def anchored; end",
"def extra; end",
"def villian; end",
"def who_we_are\r\n end",
"def initialize\n \n end",
"def appraisals; end",
"def appraisals; end",
"def ignores; end",
"def requirements; end",
"def requirements; end",
"def requirements; end",
"def requirements; end",
"def initialize\n \n end",
"def formation; end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def weber; end",
"def common\n \n end",
"def initialize\n super()\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n\t\t\n\tend",
"def under_construction\n end",
"def overrides; end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize() end",
"def sitemaps; end",
"def initialize\n # nothing here for now\n end",
"def ignore; end",
"def apply\n end",
"def same; end",
"def operation; end",
"def executor; end",
"def executor; end",
"def executor; end",
"def missing?; end",
"def identify; end",
"def wrapper; end",
"def initialize\r\n\r\n end",
"def terpene; end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def checks; end",
"def berlioz; end",
"def code_of_conduct; end",
"def processor; end",
"def verdi; end",
"def methods; end"
]
| [
"0.76603997",
"0.64038944",
"0.6309454",
"0.6309454",
"0.62159014",
"0.6211626",
"0.6132683",
"0.6132683",
"0.6132683",
"0.6132683",
"0.5941469",
"0.5941469",
"0.5925082",
"0.5923184",
"0.59110045",
"0.5883552",
"0.587536",
"0.587536",
"0.5871816",
"0.5847384",
"0.58034223",
"0.57702374",
"0.57346565",
"0.57346565",
"0.57084405",
"0.570192",
"0.56985253",
"0.56985253",
"0.568388",
"0.568388",
"0.5683499",
"0.5683499",
"0.5683499",
"0.5683499",
"0.5683499",
"0.5683499",
"0.5683499",
"0.5683499",
"0.5683499",
"0.5683499",
"0.5683499",
"0.567958",
"0.56790715",
"0.56652665",
"0.56591195",
"0.56340563",
"0.5627003",
"0.5627003",
"0.5615822",
"0.5610608",
"0.5610608",
"0.5610608",
"0.5610608",
"0.5606979",
"0.56008476",
"0.5597029",
"0.5597029",
"0.55958736",
"0.5590574",
"0.55725497",
"0.5567732",
"0.5567732",
"0.5567732",
"0.5567732",
"0.5567732",
"0.5567732",
"0.5567732",
"0.5567732",
"0.5567732",
"0.5567732",
"0.5559226",
"0.55580175",
"0.5557384",
"0.55568814",
"0.55568814",
"0.55568814",
"0.55432653",
"0.55428725",
"0.55214596",
"0.5511124",
"0.55064857",
"0.550628",
"0.55034274",
"0.5502884",
"0.5502884",
"0.5502884",
"0.5496358",
"0.5494447",
"0.5492309",
"0.54893583",
"0.54887044",
"0.54885256",
"0.54885256",
"0.54885256",
"0.54885256",
"0.5484613",
"0.5484543",
"0.5474886",
"0.54656386",
"0.54649556",
"0.54615945"
]
| 0.0 | -1 |
GET /order_items GET /order_items.json | def index
@order_items = OrderItem.where(deal_id: params[:deal_id]).order("created_at DESC").page(params[:page]).per(5)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @order_items = OrderItem.all\n # render json: @order_item, status: :created\n # render json: @order_item.as_json(include: :item)\n\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(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 @line_items = @order.line_items\n\n render json: @line_items\n end",
"def index\n @order_item_extras = OrderItemExtra.all\n\n render json: @order_item_extras\n end",
"def index\n @order_items = OrderItem.all\n end",
"def index \n @order = Order.find(params[:order_id])\n @search = @order.order_items.search(params[:q])\n @order_items = @search.result.page(params[:page]).per(current_user.list_page_size)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @order_items }\n end\n end",
"def show\n @order = Order.includes(:items).find(params[:id])\n end",
"def items\n @items ||= data[\"items\"].map { |item| OrderItem.new(item) }\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 = 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 items_all\n @work_order_items = WorkOrderItem.by_id\n render json: serialized_work_order_items(@work_order_items)\n end",
"def show \n @order_items = OrderItem.where(order_id: params[:id])\n end",
"def order \n @items = Item.all\n @item = Item.find(params[:id])\n end",
"def show\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 show\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 show\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 get_order_item(id, options = nil)\r\n @client.raw('get', \"/ecommerce/order-items/#{id}\", options, nil, @contact_v1_url)\r\n end",
"def show\n @line_item = @order.line_items.find(params[:id])\n\n render json: @line_item\n end",
"def show\n render json: @order_item_extra\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 list\n order_items\n end",
"def index\n if params[:cart_id]\n get_cart\n @items = Item.where(cart: @cart)\n elsif params[:order_id]\n get_order\n @items = Item.where(order: @order)\n end\n render json: @items, status: 200\n end",
"def order_items_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrderItemsApi.order_items_list ...'\n end\n # resource path\n local_var_path = '/order-items/'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'InlineResponse2005' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\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: OrderItemsApi#order_items_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @order = Order.find(params[:id])\n @items = OrderItem.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @order }\n end\n end",
"def show\n @order_items = current_order.order_items\n end",
"def index\n @order = Order.find_by(id: params[:id].to_i)\n @order_items = @order.order_items\n\n if @order.nil?\n flash.now[:danger] = \"Cannot find the order #{params[:id]}\"\n render :not_found, status: :not_found\n end\n end",
"def index\n @orders = @restaurant.orders.where(state: Order::PRE_DELIVERED_STATES).includes(:order_items, :items)\n end",
"def show\n @purchaseorder = Purchaseorder.find(params[:id])\n @purchaseorder_items = @purchaseorder.purchaseorder_items.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchaseorder }\n end\n end",
"def index\n # @line_items = LineItem.all\n @line_items = LineItem.where(order_id:@order.id)\n end",
"def show\n @order = Order.find(params[:id])\n @user = current_or_guest_user\n\t @cartitems = @user.orders.find(@order.id).cart_items.where(:item_type=>\"order\") \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 = Order.all\n @order_item = current_order.order_items.new\n end",
"def get_orders\n orders\n end",
"def index\n @items = if params[:cart_id]\n Cart.find(params[:cart_id]).items\n elsif params[:customer_id]\n Customer.find(params[:customer_id]).items\n elsif params[:sort]\n case params[:sort]\n when 'cart_id'\n Item.order(\"cart_id #{params[:cart_sort_direction]}\")\n when 'product_color_id'\n Item.order(\"product_color_id #{params[:product_color_sort_direction]}\")\n when 'size_id'\n Item.order(\"size_id #{params[:size_sort_direction]}\")\n when 'purchased'\n Item.order(\"charges.result #{params[:purchased_sort_direction]}\").joins(:charges)\n when 'coupon'\n Item.order(\"coupons.name #{params[:coupon_sort_direction]}\").joins(:coupons)\n end\n else\n Item\n end.order('created_at desc').page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def index\n @items = Item.find(:all, :order => 'id ASC')\n # @items = Item.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def index\n @orders = Order.all\n render json: @orders\n end",
"def index\n @order = current_order\n @order_items = current_order.order_items\n @products = current_order.products\n end",
"def show\n render json: @order\n end",
"def show\n render json: @order\n end",
"def show\n @items = Item.find(params[:id])\n render json: @items\n end",
"def get_order_items_with_http_info(order_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrdersV0Api.get_order_items ...'\n end\n # verify the required parameter 'order_id' is set\n if @api_client.config.client_side_validation && order_id.nil?\n fail ArgumentError, \"Missing the required parameter 'order_id' when calling OrdersV0Api.get_order_items\"\n end\n # resource path\n local_var_path = '/orders/v0/orders/{orderId}/orderItems'.sub('{' + 'orderId' + '}', order_id.to_s)\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'NextToken'] = opts[:'next_token'] if !opts[:'next_token'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n return_type = opts[:return_type] || 'GetOrderItemsResponse' \n\n auth_names = opts[:auth_names] || []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type)\n\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrdersV0Api#get_order_items\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @store_order_items = StoreOrderItem.all\n end",
"def index\n @customer_order_items = CustomerOrderItem.all\n end",
"def items\n \tbegin\n \t@categories = Category.all.includes(items: [:dimensions])\n \t@ingredients = Ingredient.actives\n \trender 'api/v1/home/items', status: :ok\n \trescue Exception => e\n \t\terror_handling_bad_request(e)\n \tend\n\n\tend",
"def update_order_of_items\n result = Catalog.do_update_order_of_items(params[:sort_orders])\n \n # return a success message, wouldn't make sense to call this API method as html, but for debugging\n # just return json anyway\n respond_to do |format|\n format.html { render json: result}\n format.json { render json: result}\n end\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 index\n @orders = Order.all\n render json: @orders, status: 200\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 index\n @items = Item.includes(:user).order(created_at: :desc).all\n render json: @items\n end",
"def show\n @order = Order.find(params[:id])\n @search = Item.search(params[:search])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def get_items\n response_xml = http_get(@client, \"#{xero_url}/Items\")\n parse_response(response_xml, {}, {:request_signature => 'GET/items'})\n end",
"def index\n @items = Item.all\n\n set_order\n end",
"def orders\n authenticated_post(\"orders\").body\n end",
"def index\n #@items = Item.find_by_user_id(Session[user_id])\n @items = Item.all\n render json: @items\n end",
"def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end",
"def index\n \t@orders = Order.order('id desc')\n \t#since line items belong to orders, we don't have to do anything to specify line items\n end",
"def index\n @order_pack_items = OrderPackItem.all\n end",
"def items\n\t\tresponse = self.get('items').body\n\t\titems = JSON.parse(response)\n\t\tparse_items(items)\n\t\treturn items\n\tend",
"def get_items(product_id, params={})\n self.client.get(\"products/#{product_id}/items\", params)\n end",
"def get_orders\n return ShopifyAPI::Order.all\n end",
"def index\n @menu_items_orders = MenuItemsOrder.all\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 orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end",
"def get_items\n @items\n end",
"def index\n @lab_order_items = LabOrderItem.all\n end",
"def orders\n authenticated_post(\"auth/r/orders\").body\n end",
"def get_all_orders() \n\tputs \"Getting all orders\"\n\tresponse = request_get(\"/api/order\")\n\tputs response.body\nend",
"def show\n @manifest_item = ManifestItem.find(params[:id])\n @purchaseorders = @manifest_item.purchaseorders.paginate(page: params[:page])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manifest_item }\n end\n end",
"def show\n if session[:role]==\"Manager\"\n inbox\n elsif session[:role]==\"Admin\"\n unread\n end\n\n @item = Item.find(params[:id])\n order_id = @item.order_id\n @order = Order.find_by_id(order_id)\n @line_items = LineItem.find_by_order_id(@order)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\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 @ordered_item = OrderedItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ordered_item }\n format.json { render :json => @ordered_item }\n end\n end",
"def process_order\n order\n respond_to do |format|\n format.html # process_order.html.erb\n format.json { render json: order }\n end\n end",
"def show\n @product = Product.find(params[:id])\n @order_item = OrderItem.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @order = Order.find(params[:id])\n @total_price = 0\n @order.line_items.each do |item|\n @total_price += item.product.price \n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n unread\n\n @order = Order.find(params[:id])\n @cart = current_cart\n @line_items = LineItem.find_by_order_id(@order)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def getItems()\n return mergeWithAPI(@item_json)['data']\n end",
"def index\n @admin_orders = Order.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_orders }\n end\n end",
"def index\n @items = @deal.items\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def show\n @purchase_order_item = PurchaseOrderItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase_order_item }\n end\n end",
"def items\n response[\"items\"]\n end",
"def new\n @order = Order.find(request[:order_id])\n @order_item = @order.order_items.new\n @order_item.owner = current_user\n item_id = request[:item_id]\n unless item_id.nil?\n @order_item.item_id = item_id\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_item }\n end\n end",
"def show\n @line_items = @order.line_items\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 @order_items = OrderItem.where(:order_state.ne => \"received\").sort_by(&:state_int)\n end",
"def index\n\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 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 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 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 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 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 query_order(options)\n request :account, :get, 'order', options\n end",
"def index\n @items = Item.all\n @user = User.find_by_id(session[:user_id]) if session[:user_id]\n @bulk_orders = BulkOrder.all\n # @bulk_order_items = []\n # @bulk_orders.each do |bulk|\n # @bulk_order_items.push(bulk.item)\n # end\n end",
"def orders(options = {})\n perform_get_with_key_and_objects('/orders', options, :items, Epages::Order)\n end",
"def items\n @items ||= items_from_response\n end",
"def index\n @orders = Order.paginate page: params[:page], order: 'created_at desc', \n per_page: 10\n \n respond_to do |format|\n format.html\n format.json { render json: @orders } \n end\n end",
"def index\n @ordered_products = OrderedProduct.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ordered_products }\n end\n end",
"def show\n @order = Order.find(params[:id]) \n \n @search = @order.order_items.search(params[:q])\n @order_items = @search.result.page(params[:page]).per(current_user.list_page_size)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n format.xls {render :template => 'orders/order.xls.erb'}\n end\n end",
"def index\n @equipment_orders = EquipmentOrder.all\n respond_to do |format|\n format.json { render json: @equipment_orders }\n end\n end",
"def item(uuid)\n http.get \"/items/#{uuid}\"\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"
]
| [
"0.77639645",
"0.77324706",
"0.757844",
"0.7544158",
"0.7426385",
"0.7392113",
"0.7380861",
"0.7173808",
"0.7167277",
"0.7163156",
"0.7154946",
"0.7152882",
"0.7142722",
"0.7101051",
"0.7025074",
"0.7025074",
"0.7025074",
"0.7022062",
"0.7006934",
"0.69940186",
"0.6992866",
"0.6930594",
"0.68860686",
"0.6843564",
"0.6830905",
"0.6824666",
"0.6796255",
"0.6738645",
"0.6729747",
"0.6681664",
"0.6676168",
"0.6670272",
"0.6661961",
"0.6645188",
"0.66253245",
"0.6618419",
"0.66168493",
"0.6604194",
"0.6598745",
"0.6598745",
"0.6596491",
"0.65858334",
"0.6581582",
"0.6571158",
"0.65628135",
"0.65614766",
"0.65603864",
"0.65532714",
"0.6552046",
"0.6547492",
"0.65453386",
"0.65100664",
"0.6502829",
"0.6496516",
"0.6496019",
"0.64726555",
"0.6468734",
"0.6466156",
"0.6465398",
"0.6457681",
"0.64558214",
"0.64515007",
"0.64407337",
"0.64340556",
"0.6432031",
"0.642994",
"0.6425705",
"0.64117056",
"0.64043045",
"0.63908976",
"0.63756466",
"0.6374618",
"0.6363685",
"0.63578796",
"0.63575274",
"0.63571787",
"0.63295895",
"0.63142985",
"0.6312214",
"0.6308325",
"0.6299734",
"0.62996596",
"0.6297398",
"0.6290931",
"0.6283884",
"0.62806904",
"0.62751466",
"0.62751466",
"0.62751466",
"0.62751466",
"0.6274829",
"0.6269035",
"0.6265485",
"0.6263813",
"0.6258945",
"0.6258563",
"0.62575525",
"0.6248525",
"0.6243629",
"0.6242497",
"0.6235518"
]
| 0.0 | -1 |
GET /order_items/1 GET /order_items/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 @order_items = OrderItem.all\n # render json: @order_item, status: :created\n # render json: @order_item.as_json(include: :item)\n\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[: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 index\n @line_items = @order.line_items\n\n render json: @line_items\n end",
"def show\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 show\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 show\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 index\n @order_item_extras = OrderItemExtra.all\n\n render json: @order_item_extras\n end",
"def show\n @line_item = @order.line_items.find(params[:id])\n\n render json: @line_item\n end",
"def get_order_item(id, options = nil)\r\n @client.raw('get', \"/ecommerce/order-items/#{id}\", options, nil, @contact_v1_url)\r\n end",
"def show \n @order_items = OrderItem.where(order_id: params[:id])\n end",
"def show\n @order = Order.includes(:items).find(params[:id])\n end",
"def index\n @order_items = OrderItem.all\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 render json: @order_line_item\n end",
"def index \n @order = Order.find(params[:order_id])\n @search = @order.order_items.search(params[:q])\n @order_items = @search.result.page(params[:page]).per(current_user.list_page_size)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @order_items }\n end\n end",
"def show\n render json: @order_item_extra\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 @items = OrderItem.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @order }\n end\n end",
"def order \n @items = Item.all\n @item = Item.find(params[:id])\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 index\n @order = Order.find_by(id: params[:id].to_i)\n @order_items = @order.order_items\n\n if @order.nil?\n flash.now[:danger] = \"Cannot find the order #{params[:id]}\"\n render :not_found, status: :not_found\n end\n end",
"def show\n @purchaseorder = Purchaseorder.find(params[:id])\n @purchaseorder_items = @purchaseorder.purchaseorder_items.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchaseorder }\n end\n end",
"def show\n @purchase_order_item = PurchaseOrderItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase_order_item }\n end\n end",
"def show\n @order = Order.find(params[:id])\n @user = current_or_guest_user\n\t @cartitems = @user.orders.find(@order.id).cart_items.where(:item_type=>\"order\") \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 = Order.all\n @order_item = current_order.order_items.new\n end",
"def index\n if params[:cart_id]\n get_cart\n @items = Item.where(cart: @cart)\n elsif params[:order_id]\n get_order\n @items = Item.where(order: @order)\n end\n render json: @items, status: 200\n end",
"def show\n @items = Item.find(params[:id])\n render json: @items\n end",
"def show\n @product = Product.find(params[:id])\n @order_item = OrderItem.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def item(uuid)\n http.get \"/items/#{uuid}\"\n end",
"def new\n @order = Order.find(request[:order_id])\n @order_item = @order.order_items.new\n @order_item.owner = current_user\n item_id = request[:item_id]\n unless item_id.nil?\n @order_item.item_id = item_id\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_item }\n end\n end",
"def index\n # @line_items = LineItem.all\n @line_items = LineItem.where(order_id:@order.id)\n end",
"def show\n @order_items = current_order.order_items\n end",
"def new\n @order_item = OrderItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_item }\n end\n end",
"def new\n @order_item = OrderItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_item }\n end\n end",
"def show\n @manifest_item = ManifestItem.find(params[:id])\n @purchaseorders = @manifest_item.purchaseorders.paginate(page: params[:page])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manifest_item }\n end\n end",
"def show\n @ordered_item = OrderedItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ordered_item }\n format.json { render :json => @ordered_item }\n end\n end",
"def new\n @order_item = OrderItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_item}\n end\n end",
"def items_all\n @work_order_items = WorkOrderItem.by_id\n render json: serialized_work_order_items(@work_order_items)\n end",
"def show\n @order = Order.find(params[:id])\n @search = Item.search(params[:search])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def index\n @items = Item.find(:all, :order => 'id ASC')\n # @items = Item.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def show\n render json: @order\n end",
"def show\n render json: @order\n end",
"def show\n unread\n\n @order = Order.find(params[:id])\n @cart = current_cart\n @line_items = LineItem.find_by_order_id(@order)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\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 show\n if session[:role]==\"Manager\"\n inbox\n elsif session[:role]==\"Admin\"\n unread\n end\n\n @item = Item.find(params[:id])\n order_id = @item.order_id\n @order = Order.find_by_id(order_id)\n @line_items = LineItem.find_by_order_id(@order)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def get_order_items_with_http_info(order_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrdersV0Api.get_order_items ...'\n end\n # verify the required parameter 'order_id' is set\n if @api_client.config.client_side_validation && order_id.nil?\n fail ArgumentError, \"Missing the required parameter 'order_id' when calling OrdersV0Api.get_order_items\"\n end\n # resource path\n local_var_path = '/orders/v0/orders/{orderId}/orderItems'.sub('{' + 'orderId' + '}', order_id.to_s)\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'NextToken'] = opts[:'next_token'] if !opts[:'next_token'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n return_type = opts[:return_type] || 'GetOrderItemsResponse' \n\n auth_names = opts[:auth_names] || []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type)\n\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrdersV0Api#get_order_items\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @api_v1_items = Item.all\n render json: @api_v1_items\n end",
"def show\n order = Order.find(params[:id])\n render json: order\n end",
"def index\n @orders = @restaurant.orders.where(state: Order::PRE_DELIVERED_STATES).includes(:order_items, :items)\n end",
"def order_items_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrderItemsApi.order_items_list ...'\n end\n # resource path\n local_var_path = '/order-items/'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'InlineResponse2005' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\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: OrderItemsApi#order_items_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\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 index\n @orders = Order.all\n render json: @orders\n end",
"def index\n @orders = Order.all\n render json: @orders, status: 200\n end",
"def show\n item = Item.find(params[:id])\n render json: item\n end",
"def show\n @order = Order.find(params[:id])\n @total_price = 0\n @order.line_items.each do |item|\n @total_price += item.product.price \n end\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_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 @purchase = Purchase.find(params[:purchase_id])\n @purchase_item = @purchase.purchase_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase_item }\n end\n end",
"def index\n #@items = Item.find_by_user_id(Session[user_id])\n @items = Item.all\n render json: @items\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\n render json: @order\n end",
"def index\n @order = current_order\n @order_items = current_order.order_items\n @products = current_order.products\n end",
"def items\n @items ||= data[\"items\"].map { |item| OrderItem.new(item) }\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 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 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 @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 get_items(product_id, params={})\n self.client.get(\"products/#{product_id}/items\", params)\n end",
"def index\n @items = @deal.items\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def index\n @store_order_items = StoreOrderItem.all\n end",
"def show\n @order = Order.find(params[:id]) \n \n @search = @order.order_items.search(params[:q])\n @order_items = @search.result.page(params[:page]).per(current_user.list_page_size)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n format.xls {render :template => 'orders/order.xls.erb'}\n end\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 update_order_of_items\n result = Catalog.do_update_order_of_items(params[:sort_orders])\n \n # return a success message, wouldn't make sense to call this API method as html, but for debugging\n # just return json anyway\n respond_to do |format|\n format.html { render json: result}\n format.json { render json: result}\n end\n end",
"def show\n render json: Item.find(params[:id])\n end",
"def index\n @items = Item.includes(:user).order(created_at: :desc).all\n render json: @items\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_item\n @order_item = @order.order_items.find(params[:id])\n end",
"def show\n @item = @deal.items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def index\n \t@orders = Order.order('id desc')\n \t#since line items belong to orders, we don't have to do anything to specify line items\n end",
"def index\n @customer_order_items = CustomerOrderItem.all\n end",
"def create\n fail = false\n itemId = order_params[:itemId]\n customerId = order_params[:customerId]\n \n #logger.debug \"getting item\"\n self.class.base_uri \"http://localhost:8082\"\n uri = \"/items/%d\" % [itemId]\n response = self.class.get uri\n \n #Check if item of this id was fetched correctly\n if response.code == 200\n item = response.body\n else\n fail = true\n end\n #logger.debug item\n\n #logger.debug \"getting customer\"\n self.class.base_uri \"http://localhost:8081\"\n uri = \"/customers?id=%d\" % [customerId]\n response = self.class.get uri\n \n\n #Check if customer of this id was fetched correctly\n if response.code == 200\n customer = response.body\n else\n fail = true\n end\n #logger.debug customer\n \n #If item and customer are found, create the order, otherwise, give a 404 not found error\n if !fail\n #logger.debug \"success\"\n item = JSON.parse(item)\n description = item[\"description\"]\n \n price = item[\"price\"].to_f #to float, as it's parsed as a string for some reason\n logger.debug price\n customer = JSON.parse(customer)\n \n award = customer[\"award\"]\n total = price - award\n \n @order = Order.new({itemId: itemId, customerId: customerId, description: description, price: price, award: award, total: total})\n if @order.save\n render json: @order, status: 201\n \n # #raise ActiveRecord::Rollback, \"Rolling back changes\"\n else\n render json: @order.errors.messages, status: 400\n end\n else\n head 404\n end\n\n end",
"def list\n order_items\n end",
"def new\n @order = Order.new\n @items = OrderItem.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @order }\n end\n end",
"def set_order_item\n @order_item = OrderItem.find(params[:id])\n end",
"def index\n @items = if params[:cart_id]\n Cart.find(params[:cart_id]).items\n elsif params[:customer_id]\n Customer.find(params[:customer_id]).items\n elsif params[:sort]\n case params[:sort]\n when 'cart_id'\n Item.order(\"cart_id #{params[:cart_sort_direction]}\")\n when 'product_color_id'\n Item.order(\"product_color_id #{params[:product_color_sort_direction]}\")\n when 'size_id'\n Item.order(\"size_id #{params[:size_sort_direction]}\")\n when 'purchased'\n Item.order(\"charges.result #{params[:purchased_sort_direction]}\").joins(:charges)\n when 'coupon'\n Item.order(\"coupons.name #{params[:coupon_sort_direction]}\").joins(:coupons)\n end\n else\n Item\n end.order('created_at desc').page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\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 get_item( item )\n @session.base_url = \"http://cl.ly\"\n resp = @session.get( \"/\" + item )\n \n raise ItemNotFound if resp.status == 404\n Crack::JSON.parse(resp.body)\n end",
"def index\n @lab_order_items = LabOrderItem.all\n end",
"def get_all_orders() \n\tputs \"Getting all orders\"\n\tresponse = request_get(\"/api/order\")\n\tputs response.body\nend",
"def get_orders\n orders\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 get_item\n @item = Item.find_by_id(params[:id])\n if @item\n return @item\n else \n render json: {\"message\": {\"type\": \"error\", \"content\": \"The item could not be found!\"}}\n end\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 @line_items = @order.line_items\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 getOrderItemQuantity #input is user_id, product_id\n logger.info \"===================== getOrderItemQuantity ==========\"\n logger.info params\n quantity = 0\n orderitems = getItems params[:user_id]\n if orderitems.length > 0 \n product = Product.find params[:product_id]\n logger.info \"HERE ===== ===== ==== ======= ====== = = = =\" \n logger.info product.id\n i = 0;\n until i == orderitems.length\n if (orderitems[i].product_id == product.id)\n quantity = orderitems[i].quantity\n #return \n end\n i += 1\n end\n end\n logger.info \"quantity = \"\n logger.info quantity\n render json: {data: quantity}\n end",
"def index\n @order_pack_items = OrderPackItem.all\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"
]
| [
"0.77925336",
"0.75096756",
"0.746528",
"0.7419868",
"0.7324154",
"0.732138",
"0.732138",
"0.732138",
"0.7269875",
"0.72579354",
"0.7254903",
"0.71073955",
"0.71066314",
"0.70790046",
"0.70769566",
"0.7068799",
"0.7018789",
"0.69945437",
"0.69678044",
"0.6893998",
"0.67697597",
"0.67564183",
"0.67285997",
"0.6727709",
"0.6718626",
"0.6706223",
"0.66914564",
"0.6687702",
"0.66721624",
"0.6657",
"0.6623127",
"0.6614519",
"0.66081893",
"0.6581253",
"0.65803754",
"0.65803754",
"0.65585095",
"0.6555305",
"0.65520453",
"0.6545099",
"0.65420455",
"0.65333515",
"0.6519592",
"0.6519592",
"0.65034646",
"0.64918846",
"0.6476774",
"0.64407223",
"0.6433757",
"0.6418399",
"0.6409278",
"0.64089274",
"0.6403076",
"0.6392431",
"0.6384275",
"0.6375994",
"0.63732624",
"0.6367702",
"0.63597494",
"0.6351417",
"0.634778",
"0.63447845",
"0.63426334",
"0.63397586",
"0.6309705",
"0.62981856",
"0.62981856",
"0.629185",
"0.6289144",
"0.6285521",
"0.6284393",
"0.62702304",
"0.62668633",
"0.62650055",
"0.62629974",
"0.6256982",
"0.6236361",
"0.62355465",
"0.6233447",
"0.6229983",
"0.6225072",
"0.6217699",
"0.62081534",
"0.62062335",
"0.62029135",
"0.61983347",
"0.61983204",
"0.6196288",
"0.6193915",
"0.6190615",
"0.6185599",
"0.617984",
"0.6174264",
"0.6165912",
"0.6163681",
"0.61634135",
"0.61623067",
"0.61595803",
"0.61570525",
"0.6155602",
"0.6155602"
]
| 0.0 | -1 |
POST /order_items POST /order_items.json | def create
@order_item = OrderItem.new(order_item_params)
respond_to do |format|
if @order_item.save
format.html { redirect_to @order_item, notice: '成功创建订单项目!' }
format.json { render :show, status: :created, location: @order_item }
else
format.html { render :new }
format.json { render json: @order_item.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @order_item = OrderItem.new(order_items_params)\n\n respond_to do |format|\n if @order_item.save\n format.html { redirect_to @order_item, notice: \"Order item was successfully created.\" }\n format.json { render json: @order_item, status: :created, location: @order_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order_item.errors, status: :unprocessable_entry }\n end\n end\n end",
"def create\n @order = Order.find(request[:order_id])\n @order_item = OrderItem.new(params[:order_item])\n @order_item.order_id = @order.id\n @order_item.owner = current_user\n\n respond_to do |format|\n #if @order.order_items.push(@order_item)\n result = @order_item.save()\n if result\n format.html { redirect_to [@order, @order_item], notice: \"This item was successfully added to '#{@order.name}'.\" }\n format.json { render json: @order_item, status: :created, location: @order_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.order_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_order_items(order)\n raise NoOrderItemsGiven unless valid_order_items?\n\n Array(param(:order_items)).each do |order_item_params|\n order_item = build_order_item(order_item_params)\n order_item.save!\n end\n end",
"def processItemsOrder\n @id = params[:itemID]\n @description = params[:description]\n @price = params[:price]\n @award = params[:award]\n @item = Item.find_by(id: @id)\n \n if @item.save\n head 204\n else\n # test\n render json: @item.to_json, status: 400\n # originally\n #head 400\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 = current_order\n @order_item = @order.order_items.new(order_item_params)\n if @order.save\n session[:order_id] = @order.id\n end\n head :ok\n\n # @order_item = OrderItems.new(order_item_params)\n # respond_to do |format|\n # if @order_item.save\n # format.html { redirect_to @order_item, notice: 'Order item was successfully created.' }\n # format.json { render :show, status: :created, location: @order_item }\n # else\n # format.html { render :new }\n # format.json { render json: @order_item.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 order_params\n params.require(:order).permit(:item_id, :quantity, :note, :restaurant_id,\n :user_id, :user, :item_to_be_added, :finalize, :completed, :ordered_item, ordered_items_attributes: [:ordered_item_id, :restaurant_id, '_destroy', :item_id, :quantity, :note, :user_id])\n end",
"def create\n items = params[:items]\n filtered_items = []\n items.each do |item|\n item[:quantity].times do |order|\n filtered_items << {\"apiKey\" => item[:item_api], \"customizationChoices\" => [], \"comments\" => item[:instruction]}\n end\n end\n token = ENV[\"REACT_APP_EAT_STREET_TOKEN\"]\n uri = URI.parse(\"https://api.eatstreet.com/publicapi/v1/send-order\")\n request = Net::HTTP::Post.new(uri)\n request.content_type = \"application/json\"\n request[\"X-Access-Token\"] = token\n request.body = JSON.dump({\n \"restaurantApiKey\" => processing_params[:restaurant_api_key],\n \"items\" => filtered_items,\n \"method\" => \"delivery\",\n \"payment\" => \"cash\",\n \"test\" => false,\n \"comments\" => processing_params[:comments],\n \"card\" => {\n \"apiKey\" => nil\n },\n \"address\" => {\n \"apiKey\" => nil,\n \"streetAddress\" => processing_params[:address],\n \"latitude\" => processing_params[:latitude],\n \"longitude\" => processing_params[:longitude]\n },\n \"recipient\" => {\n \"apiKey\" => nil,\n \"firstName\" => processing_params[:username],\n \"lastName\" => processing_params[:username],\n \"phone\" => processing_params[:phone],\n 'email' => processing_params[:email]\n }\n })\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n }\n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n message = ''\n if response.code == 200\n message = {error: false, details: 'You Order Has Been Processed'}\n items.each do |item|\n order = Order.find(item[:id])\n order.ordered = true\n end\n\n else\n message = response.body\n end\n\n render json: message\n end",
"def submit_menu\n @order = Order.create! user_id: current_user.id, restaurant_id: @restaurant.id\n\n params[:order].each do |order_item|\n MenuItemOrder.create(order_id: @order.id, menu_item_id: params[:order][order_item][:item], quantity: params[:order][order_item][:quantity])\n end\n respond_to do |format|\n format.html { redirect_to new_order_path(@restaurant), notice: 'Menu items were successfully submitted.' }\n format.json { render :new, status: :created, location: @order }\n end\n end",
"def save_items_data\n @parsed[\"order_items\"].each do |i| \n external_code = i['item']['id']\n item = Item.find_or_create_by(external_code: external_code)\n item.order_id = @order.id\n item.external_code = i['item']['id']\n item.name = i['item']['title']\n item.price = i['unit_price']\n item.quantity = i['quantity']\n item.total = i['full_unit_price']\n @subItems = []\n item.save\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 order_params\n params.require(:order).permit(:amount, :user_id, :item_ids => [])\n end",
"def create\n @line_item = @order.line_items.new(line_item_params)\n\n if @line_item.save\n render json: @line_item, status: :created, location: [@order, @line_item]\n else\n render json: @line_item.errors, status: :unprocessable_entity\n end\n end",
"def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end",
"def order_item_params\n params.require(:order_item).permit(:order_id, :item_id, :quantity)\n end",
"def ordered_item_params\n params.require(:ordered_item).permit(:order_id, :item_id, :ordered_item[\"quantity_new\"])\n end",
"def create\n @order = Order.new(:customer_id => order_params[:customer_id])\n\n order_params[:line_items].each do |item|\n if !item.empty?\n @order.line_items.new(:product_id => item, :order_id => @order.id)\n @order.update(cost: @order.cost + @order.line_items[0].product.price)\n end\n end\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 @ordereditem = Ordereditem.new(ordereditem_params) \n respond_to do |format|\n if @ordereditem.save\n format.html { redirect_to @ordereditem, notice: 'Ordereditem was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ordereditem }\n else\n format.html { render action: 'new' }\n format.json { render json: @ordereditem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n order_data = order_params\n order_data[:user_id] = current_user.id\n total_amount = 0\n @order = Order.new(order_data)\n @basket.basket_items.each do |basket_item|\n order_item = OrderItem.new( {\n product_id: basket_item.product_id,\n quantity: basket_item.quantity,\n price: basket_item.price\n } )\n @order.order_items << order_item\n total_amount += basket_item.price.to_f * basket_item.quantity.to_i\n end\n\n @order[:total_amount] = total_amount\n\n respond_to do |format|\n if @order.save\n @basket.destroy\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 = current_user.orders.build(:order_date => DateTime.now, :status => 'Pending')\n\n respond_to do |format|\n if @order.save\n @cart.line_items.each do |line_item| \n\n @orderitem = @order.order_items.create!(\n record_id: line_item.record_id,\n quantity: line_item.quantity,\n title: line_item.record.title,\n artist: line_item.record.artist,\n price: line_item.record.price,\n year: line_item.record.year,\n )\n end\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 @ordered_item = OrderedItem.new(params[:ordered_item])\n\n respond_to do |format|\n if @ordered_item.save\n format.html { redirect_to(@ordered_item, :notice => 'Ordered item was successfully created.') }\n format.xml { render :xml => @ordered_item, :status => :created, :location => @ordered_item }\n format.json { render :json => @ordered_item, :status => :created, :location => @ordered_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ordered_item.errors, :status => :unprocessable_entity }\n format.json { render :json => @ordered_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n # puts \"params: #{params.to_hash}\"\n return_order_items = JSON.parse(params[:order][:items]) \n\n # puts \"Params: #{return_order_items}\"\n\n @order = Order.find(params[:id])\n\n\n ActiveRecord::Base.transaction do\n return_order_items.each do |item|\n if params[:order].has_key?(:supplier) \n @ordered_item = Item.find_by_id(item[\"id\"].to_i)\n @ordered_item.decrement!(:remaining_quantity, item[\"quantity\"].to_i)\n else\n @ordered_item = Item.find_by_id(item[\"id\"].to_i)\n @ordered_item.increment!(:remaining_quantity, item[\"quantity\"].to_i)\n end\n end\n\n @order.return = true\n if @order.save\n @current_user = current_user\n redirect_to :root, notice: 'Return Order was successfully created.'\n else\n render :new\n end\n end\n\n end",
"def create\n @order = Order.new(\n quantity:params[:order][:quantity],\n item_id:params[:order][:item_id],\n requester: current_member,\n requested_at:Time.now,\n approver:Member.find(1),\n approved_at: nil,\n deadline: nil,\n returned:false)\n\n respond_to do |format|\n if @order.save\n #it may become negative to simulate real life scenarios\n @item = @order.item\n @item.update(units:@[email protected])\n format.html { redirect_to orders_path, notice: \"Order was successfully created.\" }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t @order = Order.new\n\t code, customer = Customer.getCustomer(params[:email])\n\t \n\t if code != 200\n\t\t render json: { error: \"Customer email not found. #{params[:email]}\" }, status: 400\n\t\t return\n\t end\n\t \n\t code, item = Item.getItemById(params[:itemId])\n\t if code != 200\n\t\t render json: { error: \"Item id not found. #{params[:itemId]}\" }, status: 400\n\t\t return\n\t end\n\t \n\t if item[:stockQty] <= 0\n\t\t render json: { error: \"Item is out of stock.\"}, status: 400\n\t\t return\n\t end\n\t \n\t @order.itemId = item[:id]\n\t @order.description = item[:description]\n\t @order.customerId = customer[:id]\n\t @order.price = item[:price]\n\t @order.award = customer[:award]\n\t @order.total = @order.price - @order.award\n\t \n\t if @order.save\n \t\t# put order to customer and item subsystem to do their updates\n\t\t code = Customer.putOrder(@order)\n\t\t code = Item.putOrder(@order)\n\t\t render json: @order, status: 201\n\t else\n \t\trender json: @order.errors, status: 400\n \tend\n end",
"def index\n @order_items = OrderItem.all\n # render json: @order_item, status: :created\n # render json: @order_item.as_json(include: :item)\n\n end",
"def update_order_of_items\n result = Catalog.do_update_order_of_items(params[:sort_orders])\n \n # return a success message, wouldn't make sense to call this API method as html, but for debugging\n # just return json anyway\n respond_to do |format|\n format.html { render json: result}\n format.json { render json: result}\n end\n end",
"def add_items_to_order\n params[:order][:menu_item_ids]\n \n end",
"def order_item_params\n params.require(:order_item).permit(:order_id, :product_id, :amount)\n end",
"def order_item_params\n params.require(:order_item).permit(:description, :item_number, :unit_price, :quantity, :order_id, :user_id)\n end",
"def order_items_create_with_http_info(data, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrderItemsApi.order_items_create ...'\n end\n # verify the required parameter 'data' is set\n if @api_client.config.client_side_validation && data.nil?\n fail ArgumentError, \"Missing the required parameter 'data' when calling OrderItemsApi.order_items_create\"\n end\n # resource path\n local_var_path = '/order-items/'\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[:body] || @api_client.object_to_http_body(data) \n\n # return_type\n return_type = opts[:return_type] || 'OrderItem' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\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(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrderItemsApi#order_items_create\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def order_params\n params.require(:order).permit(:items, :total_price, :customer_name, :address, :note, :status)\n end",
"def create\n @store_order_item = StoreOrderItem.new(store_order_item_params)\n\n respond_to do |format|\n if @store_order_item.save\n format.html { redirect_to @store_order_item, notice: 'Store order item was successfully created.' }\n format.json { render :show, status: :created, location: @store_order_item }\n else\n format.html { render :new }\n format.json { render json: @store_order_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n item = Item.new(item_params)\n item.done = \"0\"\n item.trash = \"0\"\n\n if item.save\n render json: {data:item}, status: :created\n else\n render json: {data:item}, status: :unprocessable_entity\n end\n end",
"def submit_order()\n\tputs \"Submitting order\"\n\tdata = create_order()\n\tresponse = request_post(\"/api/order\", data)\n\tputs response.body\nend",
"def add_basket_items(items)\n items.each do |i|\n order_lines.build(\n product_id: i.product.id,\n product_sku: i.product.sku,\n product_name: i.product.name,\n product_rrp: i.product.rrp,\n product_price: i.product.price_ex_vat(i.quantity),\n product_weight: i.product.weight,\n vat_amount: i.product.vat_amount(i.quantity) * i.quantity,\n quantity: i.quantity,\n feature_descriptions: i.feature_descriptions\n )\n end\n end",
"def new\n @order = Order.find(request[:order_id])\n @order_item = @order.order_items.new\n @order_item.owner = current_user\n item_id = request[:item_id]\n unless item_id.nil?\n @order_item.item_id = item_id\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_item }\n end\n end",
"def create\n # Create the order \n @order = Order.new\n @email = params[:email]\n \n # Invoke the customer service to retrieve the customer id using the customers\n customerCode, customer = Customer_Service.getCustomerByEmail(@email)\n \n # Check to make sure the customer can be found\n if customerCode != 200\n render json: { error: \"Customer could not be found. \", status: 400 }\n return\n end\n \n # Invoke the item service to retrieve the item information\n orderCode, item = Item_Service.getItemById(params[:itemId])\n # Check to see if the item can be found\n if orderCode != 200\n render json: { error: \"Item could not be found\", status: 400 }\n return\n end\n # Check to see if the item is in stock\n if item[:stockQty] <= 0\n render json: { error: \"Item is out of stock\", status: 400 }\n return\n end\n \n \n # Construct the object\n @order.itemId = params[:itemId]\n @order.description = item[:description]\n @order.customerId = customer[:id]\n @order.price = item[:price]\n @order.award = customer[:award]\n @order.total = @order.price - @order.award\n \n # Check to see if the order can be saved\n if @order.save\n # Save the order to the customer and save it to the item\n tempCode = Customer_Service.postOrder(@order)\n tempCode = Item_Service.postOrder(@order)\n render json: @order, status: 201\n else\n render json: @order.errors, status: 400\n end\n \n end",
"def create\n respond_to do |format|\n result = OrdersHelper.process_order(request, params)\n @order = result[0]\n @customer = result[1]\n @address = result[2]\n @item = result[3]\n \n if !(@order.errors.any? or @customer.errors.any? or @address.errors.any? or @item.errors.any?) then\n format.json { render json: @item }\n format.html { redirect_to @order }\n else\n # Display error message\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end \n end",
"def order_params\n params.require(:order).permit(:item_id, :requester, :requested_at, :approver, :approved_at, :deadline, :returned, :quantity)\n end",
"def order \n @items = Item.all\n @item = Item.find(params[:id])\n end",
"def order_item_params\n params.require(:order_item).permit(:name, :product_id, :custom, :cost, :ordered, :requested, :delivered)\n end",
"def create\n create_params = item_params\n item = Item.new(\n name: create_params[:name], \n is_complete: false, #create_params[:is_complete], \n list_id: create_params[:list_id])\n\n item.save!\n render json: item\n end",
"def ordered_item_params\n params.require(:ordered_item).permit(:quantity, :item_id, :customer_id)\n #params.require(:ordered_item).permit(:quantity, :item_id)\n\n end",
"def order_params\n params.require(:order).permit(:item_id, :user_id, :duration, :status, :description)\n end",
"def create\n @request_item = RequestItem.new(request_item_params)\n @request_item.item = Item.new(name: params[:request_item][:item][:name])\n\n if @request_item.save\n render json: @request_item \n else\n render json: @request_item.errors, status: :bad_request\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 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 order_item_params\n params.require(:order_item).permit(:user_id, :order_id, :menu_item_id, :price, :quantity)\n end",
"def order_item_params\n params.require(:order_item).permit(:product_id, :quantity)\n end",
"def order_params\n # params.require(:order).permit(:restaurant_id, :table_id, :items => [])\n # strong params can't take an array of hashes :(\n # so as a hack for now we're gonna ignore it\n end",
"def update_order_item\n \n end",
"def order_item_params\n params.require(:order_item).permit(:name, :url, :mcmasterPartNumber, :order_state, :ordered_by_id, :requested_by_id, :price)\n end",
"def create\n @item = @client.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully added.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n res = HTTParty.get(\"http://localhost:8081/customers/?email=#{order_params['email'].to_s}\")\n codeCustomer = res.code\n dataCustomer = res.parsed_response\n p res\n res = HTTParty.get(\"http://localhost:8082/items/#{order_params['itemid'].to_s}.json\")\n #res = HTTParty.get(\"http://localhost:8082/items/#{order_params['itemid'].to_s}.json\")\n codeItem = res.code\n dataItem = res.parsed_response\n p dataItem\n if codeCustomer != 404 && codeItem != 404\n newParams = order_params\n newParams[\"award\"] = dataCustomer[\"award\"] \n newParams[\"price\"] = dataItem[\"price\"]\n newParams[\"total\"] = dataItem[\"price\"] - dataCustomer[\"award\"]\n p newParams\n \n #HTTParty.put(\"http://localhost:8081/customers/order?award=#{newParams['award']}&total=#{newParams[\"total\"]}&customerId=#{newParams['customerid']}\")\n end\n if codeCustomer == 404 || codeItem == 404\n if codeCustomer == 404 and codeItem == 404\n render json: {error: \"Customer and Item do not exist\"}, status: 400\n return\n end\n if codeCustomer == 404 and codeItem != 404\n render json: {error: \"Customer does not exist\"}, status: 400\n return\n end\n if codeCustomer != 404 and codeItem == 404\n render json: {error: \"Item does not exist\"}, status: 400\n return\n end\n else\n @order = Order.new\n @order.customerid = dataCustomer[\"id\"]\n @order.email = dataCustomer[\"email\"]\n @order.itemid = order_params[:itemid]\n @order.description = dataItem[\"description\"]\n @order.award = newParams[\"award\"]\n @order.total = newParams[\"total\"]\n @order.price = newParams[\"price\"]\n \n orderResult = HTTParty.put('http://localhost:8081/customers/order', \n :body => @order.to_json,\n :headers => {'Content-Type' => 'application/json', 'ACCEPT' => 'application/json'}\n )\n\n res = HTTParty.put(\"http://localhost:8082/items/#{order_params[:itemid]}?stockQty=#{dataItem['stockQty']-1}&description=#{dataItem['description']}&price=#{dataItem['price']}&id=#{order_params[:id]}\")\n p res\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 else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n order = Order.create(order_params)\n render json: order\nend",
"def test_create_order\n setup_new_order()\n @o.order_line_items << OrderLineItem.for_product(items(:small_stuff))\n assert @o.save\n end",
"def create\n @customer_order_item = CustomerOrderItem.new(customer_order_item_params)\n\n respond_to do |format|\n if @customer_order_item.save\n format.html { redirect_to @customer_order_item, notice: 'Customer order item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @customer_order_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer_order_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_item\n if @work_order_item.present?\n render json: :conflict, status: :conflict\n else\n @work_order_item = WorkOrderItem.new\n @work_order_item.assign_attributes(@json['data'])\n if !@json['data']['created_by']\n @work_order_item.created_by = current_user.id if !current_user.nil?\n end\n if @work_order_item.save\n render json: serialized_work_order_item(@work_order_item), status: :created\n else\n render json: format_errors(@work_order_item), status: :unprocessable_entity\n end\n end\n end",
"def update\n @order_item.update_attributes(order_item_params)\n @order_items = @order.order_items\n end",
"def create\n @purchase_order_item = PurchaseOrderItem.new(params[:purchase_order_item])\n\n respond_to do |format|\n if @purchase_order_item.save\n format.html { redirect_to @purchase_order_item, notice: 'Purchase order item was successfully created.' }\n format.json { render json: @purchase_order_item, status: :created, location: @purchase_order_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase_order_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_order(items, quantities, tweet_id, campaign_id)\r\n\r\n #Creates the new order in the table, with the passed parameters\r\n order = Order.new do |u|\r\n u.user_id = User.where(twitter_id: get_user_from_tweet(tweet_id)).pluck(:id).join\r\n u.tweet_id = tweet_id\r\n u.order_state_id = 1\r\n u.location_id = User.where(twitter_id: get_user_from_tweet(tweet_id)).pluck(:location_id).join\r\n if(campaign_id)\r\n u.campaign_id = campaign_id\r\n end\r\n end\r\n order.save\r\n\r\n #Creates each order_item in the Order linking table\r\n items.each_with_index do |item,i|\r\n order_item = OrderItem.new do |u|\r\n u.order_id = order.id\r\n u.item_id = Item.find_by(name: item).id\r\n u.quantity = quantities[i].to_i\r\n end\r\n order_item.save\r\n end\r\nend",
"def create\n ordered_item_from_table = OrderedItem.new(passed_parameters_from_items_index)\n order = Order.where(id: ordered_item_from_table.order_id, confirmed: false, user_id: current_user.id).last\n ordered_item_from_db = OrderedItem.where(order_id: order.id, item_id: ordered_item_from_table.item_id).last\n \n if ordered_item_from_db.present?\n item = Item.where(id: ordered_item_from_db.item_id).last\n if item.quantity > 0\n if ordered_item_from_db.update(quantity: ordered_item_from_db.quantity + 1) && item.update(quantity: item.quantity - 1)\n redirect_to items_path\n flash[:notice] = \"Item has been added to your order.\"\n else\n redirect_to items_path\n flash[:alert] = \"Item can not be added to your order.\"\n end\n else \n redirect_to items_path\n flash[:alert] = \"Item can not be added to your order.\"\n end\n \n\n else\n @ordered_item = OrderedItem.new(passed_parameters_from_items_index)\n @item = Item.find(@ordered_item.item_id)\n\n if @item.quantity > 0\n @item.quantity -= @ordered_item.quantity\n @item.update(quantity: @item.quantity )\n if @ordered_item.save\n redirect_to items_path\n flash[:notice] = \"Item has been added to your order.\"\n else\n redirect_to items_path\n flash[:alert] = \"Item can not be added to your order.\"\n end\n \n\n else\n flash[:alert] = \"Something went wrong! Item was not added to the cart\"\n redirect_to items_path\n end\n\n end\n end",
"def order_items_create(data, opts = {})\n data, _status_code, _headers = order_items_create_with_http_info(data, opts)\n data\n end",
"def index\n @order_line_items = @order.order_line_items\n\n render json: @order_line_items\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 create\n @order = Order.new(order_params)\n @order.add_line_items_from_cart(@cart)\n\n respond_to do |format|\n if @order.save\n\n @wine_title = \"[\"\n @cart.line_items.each do |line_item|\n @wine_title += line_item.quantity.to_s\n @wine_title += ' items: '\n @wine_title += line_item.product.title\n @wine_title += ';'\n end\n @wine_title += \"]\"\n\n data = {'name' => @order.name, 'address' => @order.address,\n 'email' => @order.email, 'phone' => @order.phone, \n 'wine' => @wine_title}\n\n url = URI.parse('http://localhost:8080/order')\n req = Net::HTTP::Post.new(url,nitheader = {'Content-Type' =>'application/js on'})\n req.set_form_data(data)\n req.body = data.to_json\n begin\n res = Net::HTTP.start(url.host, url.port) {|http|\n http.request(req)\n }\n rescue\n end\n\n Cart.destroy(session[:cart_id])\n session[:cart_id] = nil\n OrderNotifier.received(@order).deliver\n format.html { redirect_to store_url}\n format.json { render action: 'show', status: :created,\n 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 @menu_items_order = MenuItemsOrder.new(menu_items_order_params)\n\n respond_to do |format|\n if @menu_items_order.save\n format.html { redirect_to @menu_items_order, notice: 'Menu items order was successfully created.' }\n format.json { render :show, status: :created, location: @menu_items_order }\n else\n format.html { render :new }\n format.json { render json: @menu_items_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order_item = OrderItem.new(order_item_params)\n @order_item.requested_by = current_user\n\n respond_to do |format|\n if @order_item.save\n format.html { redirect_to @order_item, notice: 'Order item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @order_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @order_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(items: items, promocode: promocode_params[:promocode])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to new_order_path, 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 index\n @line_items = @order.line_items\n\n render json: @line_items\n end",
"def order_params\n\t\tparams.require(:order).permit(:order_items, :customer_id)\n end",
"def new_order_v1\n begin\n @parsed_json[\"order_items\"] ? order_items = @parsed_json[\"order_items\"] : nil\n @parsed_json[\"location_id\"] ? location_id = @parsed_json[\"location_id\"].to_i : nil\n location = Location.find_by_id(location_id)\n tax = location.tax #look up tax of location manually\n if location.nil? || location_id.nil? || order_items.nil? || tax.nil?\n return render :status => 404, :json => {:status => :failed, :error => \"Resource not found\"}\n end\n ActiveRecord::Base.transaction do\n if Order.is_current(@user.id, location)\n current_order = Order.find_by_user_id_and_location_id_and_is_paid_and_is_cancel(@user.id, location.id, 0, 0)\n ordered_date = current_order.created_at\n if current_order.order_items.length > 0\n ordered_date = Time.now.utc\n end\n\n order_item = OrderItem.add_new_item_v1(order_items, current_order)\n\n # re-calculate sub_price of order\n sub_price = Order.calculate_sub_price(current_order)\n fee = location.service_fee_type=='fixed'? location.fee : sub_price / 100 * location.fee\n\n if !order_item.prize_id.nil? && order_item.is_prize_item == 1\n current_order.update_attributes!(\n :location_id => location.id,\n :tax => tax,\n :fee => fee,\n :created_at => ordered_date,\n :status => 1,\n :sub_price => sub_price\n )\n else\n current_order.update_attributes!(\n :location_id => location.id,\n :tax => tax,\n :fee => fee,\n :created_at => ordered_date,\n :sub_price => sub_price\n )\n end\n\n if current_order.in_order?\n current_order.update_attributes!(:status => 2)\n end\n\n total_price = Order.calculate_total_price(current_order)\n current_order.update_attribute('total_price', total_price)\n\n return render :status => 200,\n :json => {\n :status => :success,\n :order_id => current_order.id,\n :order_item_id => order_item.id,\n :order_item_status => order_item.status\n }\n else # this is a brand-new Order\n today_orders = Order.where('created_at > ?', Time.now.strftime(\"%Y-%m-%d\")+\" 00:00:00\")\n\n new_order = Order.new\n new_order.user_id = @user.id\n new_order.tax = tax\n new_order.location_id = location.id\n new_order.timezone = location.timezone\n new_order.receipt_day_id = Order.next_receipt_no(location)\n new_order.ticket = today_orders.count+1\n order_item = OrderItem.add_new_item_v1(order_items, new_order)\n # if user added a prize item to cart, status of cart would be changed to ordered\n if !order_item.prize_id.nil? && order_item.is_prize_item == 1\n new_order.status = 1\n end\n sub_price = Order.calculate_sub_price(new_order)\n new_order.sub_price = sub_price\n new_order.total_tax = sub_price * tax\n new_order.total_tip = -2\n new_order.tip_percent = 0.16\n new_order.fee = location.service_fee_type=='fixed'? location.fee : sub_price / 100 * location.fee\n new_order.save!\n\n total_price = Order.calculate_total_price(new_order)\n new_order.update_attribute('total_price', total_price)\n # Automatically check the user in at this location (to allow item grading)\n @user.checkin_at(location, false)\n\n return render :status => 200,\n :json => {\n :status => :success,\n :order_id => new_order.id,\n :order_item_id => order_item.id,\n :order_item_status => order_item.status\n }\n end\n end\n rescue\n return render :status => 500, :json => {:status => :failed, :error => \"Internal Service Error\"}\n end\n end",
"def add_item\n item = params[:item]\n image = Image.find(item[:image_id])\n\n order = current_user.init_cart.order\n line_item = order.line_items.where(\n image_id: image.id,\n product_id: item[:product_id],\n product_option_id: item[:product_option_id]\n ).first\n\n if line_item.present?\n line_item.quantity += item[:quantity].to_i\n else\n line_item = order.line_items.build(item)\n end\n\n line_item.price = Product.find(line_item.product_id).price_for_tier(image.tier_id, image.owner?(current_user))\n line_item.tax = line_item.price * PER_TAX\n\n if line_item.save\n render json: line_item, status: :created\n else\n render json: { msg: line_item.errors.full_messages.to_sentence }, status: :bad_request\n end\n end",
"def create\n fail = false\n itemId = order_params[:itemId]\n customerId = order_params[:customerId]\n \n #logger.debug \"getting item\"\n self.class.base_uri \"http://localhost:8082\"\n uri = \"/items/%d\" % [itemId]\n response = self.class.get uri\n \n #Check if item of this id was fetched correctly\n if response.code == 200\n item = response.body\n else\n fail = true\n end\n #logger.debug item\n\n #logger.debug \"getting customer\"\n self.class.base_uri \"http://localhost:8081\"\n uri = \"/customers?id=%d\" % [customerId]\n response = self.class.get uri\n \n\n #Check if customer of this id was fetched correctly\n if response.code == 200\n customer = response.body\n else\n fail = true\n end\n #logger.debug customer\n \n #If item and customer are found, create the order, otherwise, give a 404 not found error\n if !fail\n #logger.debug \"success\"\n item = JSON.parse(item)\n description = item[\"description\"]\n \n price = item[\"price\"].to_f #to float, as it's parsed as a string for some reason\n logger.debug price\n customer = JSON.parse(customer)\n \n award = customer[\"award\"]\n total = price - award\n \n @order = Order.new({itemId: itemId, customerId: customerId, description: description, price: price, award: award, total: total})\n if @order.save\n render json: @order, status: 201\n \n # #raise ActiveRecord::Rollback, \"Rolling back changes\"\n else\n render json: @order.errors.messages, status: 400\n end\n else\n head 404\n end\n\n end",
"def order_item_params\n params.require(:order_item).permit(:product_id, :price, :tax_rate, :tax_amount, :order_id)\n end",
"def menu_items_order_params\n params.require(:menu_items_order).permit(:menu_item_id, :order_id)\n end",
"def create\n\t\titem = Item.create(item_params)\n\t\trender json: item\n\tend",
"def order_params\n params.require(:order).permit(:note, item_order_attributes: [:note, :quantity, :id])\n end",
"def order_item_params\n params.require(:order_item).permit(:cloth_id, :customer_id, :amount, :deliver_month, :deliver_period, :status)\n end",
"def order_item_params\n params.require(:order_item).permit(:deal_id, :serv_offer_id, :serv_offer_user_name, :serv_offer_titile, :lately_chat_content, :offer_user_id, :request_user_id)\n end",
"def create\n @order = current_user.orders.build(order_params)\n\n respond_to do |format|\n if @order.save_with_items(current_user)\n format.json { render json: @order, status: :created }\n format.html { redirect_to @order }\n else\n format.html do\n set_feed_back\n set_addresses_add_express_fee\n\n set_wx_cards\n\n flash.now[:error] = @order.errors.full_messages.join(', ')\n\n render :confirmation, status: :unprocessable_entity\n end\n\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n item = Item.new(item_params)\n item.user = current_user\n if item.save\n render json: item\n else\n render json: {errors: item.errors}, status: :unprocessable_entity\n end\n end",
"def create\n cart_uuid = params[:cart_id]\n @item = Item.new(item_params.merge(cart_uuid: cart_uuid))\n if @item.save\n render json: @item, status: 201\n else\n render_errors 400, @item.errors.full_messages\n end\n end",
"def create\n @order_pack_item = OrderPackItem.new(order_pack_item_params)\n\n respond_to do |format|\n if @order_pack_item.save\n format.html { redirect_to @order_pack_item, notice: 'Order pack item was successfully created.' }\n format.json { render :show, status: :created, location: @order_pack_item }\n else\n format.html { render :new }\n format.json { render json: @order_pack_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if @work_order_item.present?\n render json: :conflict, status: :conflict\n else\n @work_order_item = WorkOrderItem.new\n @work_order_item.assign_attributes(@json['data'])\n if !@json['data']['created_by']\n @work_order_item.created_by = current_user.id if !current_user.nil?\n end\n if @work_order_item.save\n render json: serialized_work_order(@work_order_item), status: :created\n else\n render json: format_errors(@work_order_item), status: :unprocessable_entity\n end\n end\n end",
"def order_params\n params.require(:order).permit(:itemid, :email)\n end",
"def create\n @custom_item = CustomItem.new(custom_item_params)\n\n respond_to do |format|\n if @custom_item.save\n format.html { redirect_to order_bill_path(@custom_item.bill.order, @custom_item.bill), notice: 'Custom item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @custom_item }\n else\n format.html { redirect_to order_bill_path(@custom_item.bill.order, @custom_item.bill) }\n format.json { render json: @custom_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def order_item_params\n params.require(:order_item).permit(:user_id, :dish_id)\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",
"def process_order\n order\n respond_to do |format|\n format.html # process_order.html.erb\n format.json { render json: order }\n end\n end",
"def create\n @order_item = OrderItem.new(order_item_params)\n authorize @order_item\n end",
"def order_params\n params.require(:order).permit(:collection_date, :contact_person, :marketing, :phone, :email, :email_confirmation, :status, :date_selector, :guid, :strip_id, :total, :permalink, orderitems_attributes:[:_destroy, :id, :order_id, :saleproduct_id, :quantity, :item_price, :total_price])\n end",
"def order_params\n params.require(:order).permit(:itemId, :customerId)\n end",
"def create\n # defined object to receive strict item_params including :description, :price, :stockQty ; else return 400\n @item = Item.new(item_params)\n \n if @item.save\n render json: @item.to_json, status: 201\n else\n head 400\n end\n end",
"def perform\n Magento2::Api.configure('dz4xnhhgfsfuyj00g6bkel0jq6mwdak2', 'hhjnlf59qh2m7an9sdpfcu0o9nox78y6', 'ie5iafduhqs1dydynidsjki582oti17w', 'mva5hldj17elic6muxmf53fq7zmm7xl5', \"https://mall2door.net\")\n orders = Magento2::Api.get(\"/rest/en/V1/orders\", {searchCriteria: 'all' })\n all_orders = orders[:items]\n all_orders.each do |order|\n unless order[:status].present?\n order_id = order[:increment_id]\n id = order[:entity_id]\n status = order[:state]\n params = {\n entity_id: id,\n increment_id: order_id,\n status: status,\n }\n if status\n Magento2::Api.put(\"/rest/en/V1/orders/create\", {entity: params})\n end\n end\n end\n end",
"def ordereditem_params\n params.require(:ordereditem).permit(:order_id, :sold_artwork_id, :quantity, :price, :category, :title, :imagepath, :description, :seller_name, :seller_email)\n end",
"def create\n\t\t@item = Item.new(item_params)\n\t\[email protected] = @receipt\n\t\tif @item.save\n\t\t\trender :json => @item.to_json(methods: [:total_cost])\n\t\telse\n\t\t\trender json: @item.errors, status: :unprocessable_entity\n\t\tend\n\tend",
"def update\n @order.line_items.destroy_all\n @order.update(cost: 0)\n\n order_params[:line_items].each do |item|\n if !item.empty?\n @order.line_items.create(:product_id => item, :order_id => @order.id)\n @order.update(cost: @order.cost + @order.line_items[0].product.price)\n end\n end\n\n respond_to do |format|\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n end\n end",
"def create\n @order = Order.new(params[:order])\n listing = Listing.find(params[:listing_id])\n event = Event.find(params[:event_id])\n addr = Address.find_or_create_by_street_address( params[:address][:street_address])\n\n addr.update_attributes(params[:address])\n\n order_attributes = {\n shipment_method: params[:shipment_method],\n payment_date: Time.now(),\n payment_method: 0, #TODO\n shipment_date: Time.now(),\n status: 0, #TODO\n shipment_fee: 0,\n service_fee: 0,\n total_amount: params[:tickets_amount].to_i * listing.list_price,\n tickets_amount: params[:tickets_amount].to_i\n }\n\n @order.update_attributes(order_attributes)\n\n @order.seller = listing.seller\n @order.buyer = current_user\n @order.shipment_address = addr\n\n # get tickets\n tickets = listing.get_some_available_tickets params[:tickets_amount].to_i\n\n listing.tickets.each do |t|\n @order.items.build({\n selling_price: 0,\n ticket_id: t.id\n })\n end\n\n respond_to do |format|\n if @order.save\n #format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.html { redirect_to success_order_url(@order) }\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"
]
| [
"0.7376621",
"0.7354197",
"0.73392534",
"0.7206495",
"0.7199507",
"0.71602315",
"0.7092501",
"0.6968247",
"0.6902384",
"0.68802124",
"0.68724215",
"0.6868365",
"0.6807257",
"0.6797156",
"0.6774272",
"0.67573595",
"0.67440546",
"0.6721686",
"0.666089",
"0.66552764",
"0.66211885",
"0.6597946",
"0.656535",
"0.6563805",
"0.65593934",
"0.65504766",
"0.6548973",
"0.6546454",
"0.6526292",
"0.65112567",
"0.64724034",
"0.6466446",
"0.6447593",
"0.64408684",
"0.6437797",
"0.64244795",
"0.6420107",
"0.64115036",
"0.63999104",
"0.63895106",
"0.6388151",
"0.6383052",
"0.63811666",
"0.6373878",
"0.63702613",
"0.6351106",
"0.6346963",
"0.6330347",
"0.6313848",
"0.63112277",
"0.63106674",
"0.63083804",
"0.6302406",
"0.6291048",
"0.6287199",
"0.6280673",
"0.6280057",
"0.62794507",
"0.6274127",
"0.6253828",
"0.6252831",
"0.6248538",
"0.62467265",
"0.6238449",
"0.62291014",
"0.62249064",
"0.62120736",
"0.6211949",
"0.6206772",
"0.6200427",
"0.6181165",
"0.6163383",
"0.616023",
"0.61531985",
"0.61509055",
"0.6134656",
"0.6132054",
"0.6127429",
"0.6122098",
"0.61104226",
"0.6101142",
"0.6099628",
"0.60988605",
"0.6097869",
"0.60961086",
"0.6086092",
"0.60815865",
"0.60761166",
"0.60472894",
"0.60455734",
"0.6043072",
"0.6042131",
"0.60396767",
"0.60334754",
"0.6028007",
"0.6009316",
"0.6006782",
"0.6001992",
"0.59956354",
"0.59808797"
]
| 0.64350766 | 35 |
PATCH/PUT /order_items/1 PATCH/PUT /order_items/1.json | def update
respond_to do |format|
if @order_item.update(order_item_params)
format.html { redirect_to @order_item, notice: '成功更新订单项目!' }
format.json { render :show, status: :ok, location: @order_item }
else
format.html { render :edit }
format.json { render json: @order_item.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @order = Order.find(request[:order_id])\n @order_item = @order.order_items.find(params[:id])\n\n respond_to do |format|\n if @order_item.update_attributes(params[:order_item])\n format.html { redirect_to [@order, @order_item], notice: 'Order Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.order_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order_item = OrderItem.find(params[:id])\n\n if @order_item.update(order_item_params)\n head :no_content\n else\n render json: @order_item.errors, status: :unprocessable_entity\n end\n end",
"def update_order_item\n \n end",
"def update\n @order_item = OrderItem.find(params[:id])\n\n respond_to do |format|\n if @order_item.update_attributes(order_items_params)\n format.html { redirect_to @order_item, notice: \"Order item was successfully updated.\"}\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order_item.errors, status: \"unprocessable_entry\" }\n end\n end\n end",
"def update\n @order_item.update_attributes(order_item_params)\n @order_items = @order.order_items\n end",
"def update\n @order_item = OrderItem.find(params[:id])\n\n respond_to do |format|\n if @order_item.update_attributes(params[:order_item])\n format.html { redirect_to @order_item, notice: 'Order item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order_item = OrderItem.find(params[:id])\n\n respond_to do |format|\n if @order_item.update_attributes(params[:order_item])\n format.html { redirect_to @order_item, notice: 'Order item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order_item.update(order_item_params)\n format.html { redirect_to @order_item, notice: 'Order item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order_item.update(order_item_params)\n format.html { redirect_to @order_item, notice: 'Order item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_order_of_items\n result = Catalog.do_update_order_of_items(params[:sort_orders])\n \n # return a success message, wouldn't make sense to call this API method as html, but for debugging\n # just return json anyway\n respond_to do |format|\n format.html { render json: result}\n format.json { render json: result}\n end\n end",
"def update\n @order_item_extra = OrderItemExtra.find(params[:id])\n\n if @order_item_extra.update(order_item_extra_params)\n head :no_content\n else\n render json: @order_item_extra.errors, status: :unprocessable_entity\n end\n end",
"def update\n @line_item = @order.line_items.find(params[:id])\n\n if @line_item.update(line_item_params)\n head :no_content\n else\n render json: @line_item.errors, status: :unprocessable_entity\n end\n end",
"def update\n @order_item.update_attributes(order_item_params)\n head :ok\n\n # respond_to do |format|\n # if @order_item.update(order_item_params)\n # format.html { redirect_to @order_item, notice: 'Order item was successfully updated.' }\n # format.json { render :show, status: :ok, location: @order_item }\n # else\n # format.html { render :edit }\n # format.json { render json: @order_item.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def update\n @order = current_order\n if @order.may_add?\n @order_item = @order.order_items.find(params[:id])\n @order_item.update_attributes(order_item_params)\n @order_items = @order.order_items\n end\n end",
"def update\n # Admin only\n if !current_user_is_admin\n respond_to do |format|\n format.html { redirect_to items_path }\n end\n return\n end\n\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 @ordered_item.update(ordered_item_params)\n format.html { redirect_to @ordered_item, notice: 'Ordered item was successfully updated.' }\n format.json { render :show, status: :ok, location: @ordered_item }\n else\n format.html { render :edit }\n format.json { render json: @ordered_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ordered_item = OrderedItem.find(params[:id])\n\n respond_to do |format|\n if @ordered_item.update_attributes(params[:ordered_item])\n format.html { redirect_to(@ordered_item, :notice => 'Ordered item was successfully updated.') }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ordered_item.errors, :status => :unprocessable_entity }\n format.json { render :json => @ordered_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @order.update(order_params)\n for x in [email protected]_orders.count\n @tmp = params.require(\"itemline#{x}\").permit(:id, :Item_id, :Sum, :GoDown_id)\n if (@tmp[:id] !=\"\")\n puts @tmp\n @sub_order =SubOrder.find(@tmp[:id])\n @sub_order.update(@tmp)\n end\n end\n\n\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 order_items_partial_update_with_http_info(id, data, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrderItemsApi.order_items_partial_update ...'\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 OrderItemsApi.order_items_partial_update\"\n end\n # verify the required parameter 'data' is set\n if @api_client.config.client_side_validation && data.nil?\n fail ArgumentError, \"Missing the required parameter 'data' when calling OrderItemsApi.order_items_partial_update\"\n end\n # resource path\n local_var_path = '/order-items/{id}/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n 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[:body] || @api_client.object_to_http_body(data) \n\n # return_type\n return_type = opts[:return_type] || 'OrderItem' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrderItemsApi#order_items_partial_update\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n order_items_params = {\n product_id: @order_item.product_id,\n order_id: @order_item.order_id,\n quantity: params[:quantity]\n} \n\nif @order_item.update(order_items_params)\n redirect_to order_path(@order_item.order_id)\n return\nend\nend",
"def update\n @order.line_items.destroy_all\n @order.update(cost: 0)\n\n order_params[:line_items].each do |item|\n if !item.empty?\n @order.line_items.create(:product_id => item, :order_id => @order.id)\n @order.update(cost: @order.cost + @order.line_items[0].product.price)\n end\n end\n\n respond_to do |format|\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n end\n end",
"def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end",
"def update\n @order_item_option = OrderItemOption.find(params[:id])\n\n if @order_item_option.update(order_item_option_params)\n head :no_content\n else\n render json: @order_item_option.errors, status: :unprocessable_entity\n end\n end",
"def update\n @order_line_item = OrderLineItem.find(params[:id])\n\n if @order_line_item.update(order_line_item_params)\n # set to manually completd\n @order_line_item.status = \"Manually Completed\"\n @order_line_item.save\n render json: @order_line_item\n else\n render json: @order_line_item.errors, status: :unprocessable_entity\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\n #update the item of request_item\n if (params[:request_item].present?)\n @request_item.item = params[:request_item][:item].present? ? Item.new(name: params[:request_item][:item][:name]) : @request_item.item\n end\n #update all other parameters\n if @request_item.update(request_item_params)\n render json: @request_item\n else\n render json: @request_item.errors, status: :bad_request\n end\n\n end",
"def update\n # puts \"params: #{params.to_hash}\"\n return_order_items = JSON.parse(params[:order][:items]) \n\n # puts \"Params: #{return_order_items}\"\n\n @order = Order.find(params[:id])\n\n\n ActiveRecord::Base.transaction do\n return_order_items.each do |item|\n if params[:order].has_key?(:supplier) \n @ordered_item = Item.find_by_id(item[\"id\"].to_i)\n @ordered_item.decrement!(:remaining_quantity, item[\"quantity\"].to_i)\n else\n @ordered_item = Item.find_by_id(item[\"id\"].to_i)\n @ordered_item.increment!(:remaining_quantity, item[\"quantity\"].to_i)\n end\n end\n\n @order.return = true\n if @order.save\n @current_user = current_user\n redirect_to :root, notice: 'Return Order was successfully created.'\n else\n render :new\n end\n end\n\n end",
"def update\n respond_to do |format|\n if @custom_item.update(custom_item_params)\n format.html { redirect_to order_bill_path(@custom_item.bill.order, @custom_item.bill), notice: 'Custom item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to order_bill_path(@custom_item.bill.order, @custom_item.bill) }\n format.json { render json: @custom_item.errors, status: :unprocessable_entity }\n end\n \n end\n end",
"def update\n respond_to do |format|\n if @store_order_item.update(store_order_item_params)\n format.html { redirect_to @store_order_item, notice: 'Store order item was successfully updated.' }\n format.json { render :show, status: :ok, location: @store_order_item }\n else\n format.html { render :edit }\n format.json { render json: @store_order_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n params[:order][:orders_wares_attributes].each do | item |\n product = OrdersWare.find(item[1][:id])\n product.update_attributes(quantity: item[1][:quantity], total: item[1][:total], observations: item[1][:observations])\n end\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 order_items_update_with_http_info(id, data, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrderItemsApi.order_items_update ...'\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 OrderItemsApi.order_items_update\"\n end\n # verify the required parameter 'data' is set\n if @api_client.config.client_side_validation && data.nil?\n fail ArgumentError, \"Missing the required parameter 'data' when calling OrderItemsApi.order_items_update\"\n end\n # resource path\n local_var_path = '/order-items/{id}/'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n 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[:body] || @api_client.object_to_http_body(data) \n\n # return_type\n return_type = opts[:return_type] || 'OrderItem' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrderItemsApi#order_items_update\\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 @order.update(order_params)\n format.html { redirect_to orders_path, notice: 'Add new item in your cart:' }\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 @item = @client.items.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n result = OrdersHelper.process_order(request, params)\n @order = result[0]\n @customer = result[1]\n @address = result[2]\n @item = result[3]\n\n if !(@order.errors.any? or @customer.errors.any? or @address.errors.any? or @item.errors.any?) then\n format.json { render json: @item }\n format.html { redirect_to @order }\n else\n # Display error message\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lab_order_item.update(lab_order_item_params)\n format.html { redirect_to @lab_order_item, notice: \"Lab order item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @lab_order_item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @lab_order_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def change_multiple_items\n @items = params[:items]\n\n @items.each do |item|\n @current_item = Item.find(item[:id])\n @current_item.update(quantity: item[:quantity])\n end\n\n render :json => @items.to_json\n end",
"def update\n\n if @api_v1_item.update(api_v1_item_params)\n render json: @api_v1_item\n else\n render json: @api_v1_item.errors\n end\n end",
"def item_inventory_update\n \n item = Item.find(params[:item_id])\n order= Order.find(params[:id])\n item_order = ItemOrder.where(item_id: item.id, order_id: order.id).first\n new_inventory = item.inventory - item_order.quantity\n item_order.update(status: \"fulfilled\")\n item.update(inventory: new_inventory)\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 @purchase_order_item = PurchaseOrderItem.find(params[:id])\n\n respond_to do |format|\n if @purchase_order_item.update_attributes(params[:purchase_order_item])\n format.html { redirect_to @purchase_order_item, notice: 'Purchase order item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @purchase_order_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update #saves and redirects, saves changes\n @line_item = LineItem.find(params[:id])\n @line_item.quantity = params[:quantity]\n @line_item.size_id = params[:size_id]\n @line_item.save\n render json: @line_item\n end",
"def update\n # too many issues trying to do strong parametesr.\n # TODO: implement strong params in the future\n params = request.parameters\n\n if !params.has_key?(:invoice_items) then\n flash[:error] = \"No items to update in invoice #{invoice.id}\"\n head status: :precondition_failed\n return\n end\n\n invoice = Invoice.find(params[:id])\n\n #just try to update the damn thing\n params[:invoice_items].each_pair do |key,value|\n InvoiceItem.find(key).update_attributes(value)\n end\n\n invoice.update_attribute(:total_billing, invoice.generate_total_billing)\n # update status\n if invoice.total_billing.zero? then\n invoice.update_attribute(:status, Invoice.statuses[\"settled\"])\n else\n invoice.update_attribute(:status, Invoice.statuses[\"outstanding\"])\n end\n\n flash[:notice] = \"Invoice #{invoice.id} updated\"\n render json: {message:\"Invoice #{invoice.id} updated\", invoice:invoice}, status: :ok\n end",
"def update_order_of_items_bulk\n @catalog = Catalog.find(params[:id])\n result = @catalog.do_update_order_of_items_bulk(params[:item_change][:moved_items], params[:item_change][:before_item]);\n \n # return a success message, wouldn't make sense to call this API method as html, but for debugging\n # just return json anyway\n respond_to do |format|\n format.html { render json: result}\n format.json { render json: result}\n end\n end",
"def update\n @v1_order = V1::Order.find(params[:id])\n\n case @v1_order.state\n when 0\n if @v1_order.update(v1_order_params)\n head :no_content\n else\n render json: @v1_order.errors, status: :unprocessable_entity\n end\n else\n render json: {message: 'Can be edited only when in draft(0) state'}, status: 400\n end\n \n end",
"def update\n @order = Order.find(params[:id])\n # shop = ShopifyAPI::Shop.current\n\n # f = ShopifyAPI::Fulfillment.new({order_id: @order.shopify_order_id,\n # location_id: @order.location_id,\n # line_items: @order.shopify_product_id,\n # tracking_number: @order.tracking_numbers})\n # f.prefix_options = { :order_id => @order.shopify_order_id }\n # f.save!\n # respond_to do |format|\n if @order.update(order_params)\n # ShopifyAPI::Fulfillment.new({order_number: @order.shopify_order_id,\n # location_id: @order.location_id,\n # line_items: @order.shopify_product_id,\n # tracking_numbers: @order.tracking_numbers})\n f = ShopifyAPI::Fulfillment.new(\n :location_id => \"#{@order.location_id}\",\n :line_item => \"#{@order.shopify_product_id}\",\n :tracking_number => \"#{@order.tracking_numbers}\",\n :tracking_company => \"USPS\",)\n f.prefix_options = { :order_id => \"#{@order.shopify_order_id}\" }\n f.save!\n # format.html { redirect_to '/', 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 @customer_order_item.update(customer_order_item_params)\n format.html { redirect_to @customer_order_item, notice: 'Customer order item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer_order_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @item.update_attributes(item_params)\n render json: @item, status: :ok\n else\n render_error(@item, :unprocessable_entity)\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_entry\" }\n end\n end\n end",
"def update_item\n order = current_user.init_cart.order\n line_item = order.line_items.find(params[:id])\n line_item.attributes = params[:item]\n image = line_item.image\n line_item.price = Product.find(line_item.product_id).price_for_tier(image.tier_id, image.owner?(current_user))\n line_item.tax = line_item.price * PER_TAX\n\n if line_item.save\n render json: line_item, status: :created\n else\n render json: { msg: line_item.errors.full_messages.to_sentence }, status: :bad_request\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order_item, notice: 'Drink has been 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 @ordered.update(ordered_params)\n format.html { redirect_to @ordered, notice: 'Ordered was successfully updated.' }\n format.json { render :show, status: :ok, location: @ordered }\n else\n format.html { render :edit }\n format.json { render json: @ordered.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: '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 @item.update(item_params)\n render json: @item, status: :ok\n else\n render json: @item.errors, status: :unprocessable_entity\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_url(@order), notice: I18n.t('orders.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 @power_order.update(power_order_params)\n render json: @power_order\n end",
"def update_order(order_id:,\n body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::PUT,\n '/v2/orders/{order_id}',\n 'default')\n .template_param(new_parameter(order_id, key: 'order_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def 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\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @order.update(order_params)\n\t\t\t\tformat.html { redirect_to @order, notice: 'Order was successfully updated.' }\n\t\t\t\tformat.mobile { redirect_to @order, notice: 'Order was successfully updated.' }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'edit' }\n\t\t\t\tformat.mobile { render action: 'edit' }\n\t\t\t\tformat.json { render json: @order.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"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!(**args)\n @items = args[:items] if args.key?(:items)\n @request_id = args[:request_id] if args.key?(:request_id)\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n @request_id = args[:request_id] if args.key?(:request_id)\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 { 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 @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"
]
| [
"0.73584485",
"0.73085594",
"0.7268084",
"0.7251094",
"0.7163649",
"0.7150832",
"0.71481746",
"0.7033415",
"0.7033415",
"0.7020219",
"0.69194925",
"0.68931943",
"0.6845944",
"0.68067646",
"0.67961067",
"0.6782734",
"0.67605895",
"0.6758097",
"0.6731265",
"0.6728509",
"0.6719145",
"0.6676044",
"0.66349065",
"0.6632001",
"0.6628811",
"0.65836227",
"0.65624535",
"0.6556698",
"0.6536908",
"0.65297383",
"0.6525881",
"0.6515398",
"0.6514483",
"0.65021956",
"0.6474472",
"0.646819",
"0.6466778",
"0.6443808",
"0.6432299",
"0.6432299",
"0.64152586",
"0.6404415",
"0.64009184",
"0.6397506",
"0.6388405",
"0.63763034",
"0.6365546",
"0.6362296",
"0.63577646",
"0.6348903",
"0.63478446",
"0.63448215",
"0.6303193",
"0.6300924",
"0.62938786",
"0.62923604",
"0.62900853",
"0.62885594",
"0.6284666",
"0.62721336",
"0.62681013",
"0.62670034",
"0.6248483",
"0.6248483",
"0.62458885",
"0.62458885",
"0.62458885",
"0.62458885",
"0.62458885",
"0.62458885",
"0.62458885",
"0.62458885",
"0.62458885",
"0.62458885",
"0.62458885",
"0.62458885",
"0.62458885",
"0.62458885",
"0.6243705",
"0.62416774",
"0.62416774",
"0.62416774",
"0.62416774",
"0.62416774",
"0.62416774",
"0.62416774",
"0.62416774",
"0.62416774",
"0.62416774",
"0.62416774",
"0.62416774",
"0.62416774",
"0.62416774",
"0.62416774",
"0.62416774",
"0.62416774",
"0.62416774",
"0.62416774",
"0.62416774",
"0.62416774"
]
| 0.64298946 | 40 |
DELETE /order_items/1 DELETE /order_items/1.json | def destroy
@order_item.destroy
respond_to do |format|
format.html { redirect_to order_items_url, notice: '成功删除订单项目!' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @order_item.destroy\n\n render json: { operation: 'OK' }, status: :ok\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 @order_item = OrderItem.find(params[:id])\n @order_item.destroy\n\n respond_to do |format|\n format.html { redirect_to order_items_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @order_item = OrderItem.find(params[:id])\n @order_item.destroy\n\n respond_to do |format|\n format.html { redirect_to order_items_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @order_item = OrderItem.find(params[:id])\n @order_item.destroy\n\n respond_to do |format|\n format.html { redirect_to order_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order_item.destroy\n respond_to do |format|\n format.html { redirect_to order_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order_item.destroy\n respond_to do |format|\n format.html { redirect_to order_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order_item = OrderItem.find(params[:id])\n @order_item.destroy\n\n head :no_content\n end",
"def destroy\n @order_item = OrderItem.find(params[:id])\n @order_item.destroy\n\n respond_to do |format|\n if @order_item.destroyed?\n format.html { redirect_to @order_item.order }\n format.json { render json: { id: @order_item.id }, status: 200 }\n else\n format.html { redirect_to @order_item.order }\n format.json { render json: @order_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @ordereditem.destroy\n respond_to do |format|\n format.html { redirect_to ordereditems_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = @order.line_items.find(params[:id])\n @line_item.destroy\n\n head :no_content\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n order = @custom_item.bill.order\n @custom_item.destroy\n respond_to do |format|\n format.html { redirect_to order_bill_path(@custom_item.bill.order, @custom_item.bill) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.line_items.clear\n respond_to do |format| \n format.html { redirect_to(edit_object_url) } \n end\n end",
"def destroy\n @ordered_item = OrderedItem.find(params[:id])\n @ordered_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(ordered_items_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @purchase_order_item = PurchaseOrderItem.find(params[:id])\n @purchase_order_item.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_order_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ordered_item.destroy\n respond_to do |format|\n format.html { redirect_to ordered_items_url, notice: 'Ordered item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(items)\n item_ids = items.collect { |item| item.id }\n args = {ids: item_ids.to_json}\n return @client.api_helper.command(args, \"item_delete\")\n end",
"def destroy\n @item = @client.items.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully removed from Inventory.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order_item_extra.destroy\n\n head :no_content\n end",
"def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end",
"def destroy\n @v1_order = V1::Order.find(params[:id])\n @v1_order.destroy\n\n head :no_content\n end",
"def delete_item(item_id)\n response = Unirest.delete CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS\n\n if response.code == 200\n puts 'Successfully deleted item'\n return response.body\n else\n puts 'Item deletion failed'\n puts response.body\n return nil\n end\nend",
"def destroy\n @order_item.destroy\n respond_to do |format|\n format.html { redirect_to @parent, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @store_order_item.destroy\n respond_to do |format|\n format.html { redirect_to store_order_items_url, notice: 'Store order item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @apiv1_item.destroy\n respond_to do |format|\n format.html { redirect_to apiv1_items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order_item.destroy\n redirect_to order_path(@order_item.order_id)\nend",
"def destroy\n render status: 200, json: @request_item.destroy\n end",
"def destroy\n @lab_order_item.destroy\n respond_to do |format|\n format.html { redirect_to lab_order_items_url, notice: \"Lab order item was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def drop_item\n @order.order_items.find(params[:id]).destroy\n\n refresh\n end",
"def destroy\n item = @order.item\n @order.destroy\n redirect_back(fallback_location: item_orders_path(item))\n end",
"def destroy\n @api_v1_item.destroy\n render json: {message: 'deletado com sucesso'}\n end",
"def destroy\n @sub1_line_item.destroy\n respond_to do |format|\n format.html { redirect_to sub1_line_items_url, notice: 'Sub1 line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n# @item = Item.get(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to({action: :index}, notice: 'Item was successfully deleted.') }\n format.json { head :ok }\n end\n end",
"def destroy\n @customer_order_item.destroy\n respond_to do |format|\n format.html { redirect_to customer_order_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order_item_option = OrderItemOption.find(params[:id])\n @order_item_option.destroy\n\n head :no_content\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @order = @line_item.order\n @line_item.destroy\n \n @order.total = @order.line_items.sum(:line_total)\n @order.update_attribute(:total, @order.total)\n\n respond_to do |format|\n format.html { redirect_to request.env[\"HTTP_REFERER\"] }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :ok }\n end\n end",
"def remove_item\n part = Part.find(params[:part_id])\n order = Order.find(params[:order_id])\n respond_to do |format|\n if part && order\n list_item = PartsInOrder.find_by({part_id: part.id, order_id: order.id})\n if list_item\n list_item.destroy!\n msg = { :status => \"ok\", :message => \"Success!\"}\n format.json { render json: msg }\n else\n msg = { :status => \"error\", :message => \"This Part is not in this order!\"}\n format.json { render json: msg }\n end\n else\n msg = { :status => \"error\", :message => \"Missing Part or Order in the DB!\"}\n format.json { render json: msg }\n end\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n for item in TransactionItem.all do\n if item.transactionOrder == @transaction_order\n item.destroy\n end\n end\n @transaction_order.destroy\n respond_to do |format|\n format.html { redirect_to transaction_orders_url, notice: 'Transaction 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 render json: {success: true, status: :ok} \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 @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @purchase = Purchase.find(params[:purchase_id])\n @purchase_item = @purchase.purchase_items.find(params[:id])\n @purchase_item.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_path(@purchase) }\n format.json { head :no_content }\n end\n end",
"def destroy\n item = @item.name\n @item.deleted = true\n @item.deleted_at = Time.now\n @item.save\n\n respond_to do |format|\n format.html { redirect_to items_url, notice: \"#{item} was successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase_order_item_line = PurchaseOrderItemLine.find(params[:id])\n @purchase_order_item_line.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_order_item_lines_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @menu_items_order.destroy\n respond_to do |format|\n format.html { redirect_to menu_items_orders_url, notice: 'Menu items order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_item = Admin::Item.find(params[:id])\n @admin_item.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_item = Admin::Item.find(params[:id])\n @admin_item.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lineitem.destroy\n respond_to do |format|\n format.html { redirect_to lineitems_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lineitem = Lineitem.find(params[:id])\n @lineitem.destroy\n\n respond_to do |format|\n format.html { redirect_to lineitems_url }\n format.json { head :ok }\n end\n end",
"def delete_purchase_order_items\n purchase_order_items.destroy_all\n end",
"def destroy\n li = @cart.line_items.find_by_id!(params[:id])\n li.destroy\n render json: {}, status: :ok\n end",
"def destroy\n @item = Item.find(@ordered_item.item_id)\n @item.quantity += @ordered_item.quantity\n @item.update(quantity: @item.quantity )\n @ordered_item.destroy\n respond_to do |format|\n format.html { redirect_to ordered_items_url, notice: 'Ordered item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = @user.items.find(params[:id])\n @item.destroy\n\n\n respond_to do |format|\n format.html { redirect_to user_items_path(@user) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url}\n format.json { head :no_content }\n end\n end",
"def destroy\n @operation_item.destroy\n respond_to do |format|\n format.html { redirect_to operation_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :ok }\n format.xml { head :ok }\n end\n end",
"def delete\n if logged_in?\n @item = Item.find(params[:item_id])\n @order = Order.find_by(item: @item)\n @order.destroy\n redirect_to '/cart'\n end\n end",
"def destroy\n raise \"Permission denied\" if (RemoveItemOrderTask.roles & @permissions).empty?\n OrderItem.transaction do\n item = @order.items.find(params[:id])\n item.destroy\n task_complete({ :data => { :product_id => item.product.id, :item_id => item.id } },\n RemoveItemOrderTask, [RemoveItemOrderTask])\n end\n redirect_to :back\n end",
"def destroy\n @item_line = ItemLine.find(params[:id])\n @item_line.destroy\n\n respond_to do |format|\n format.html { redirect_to item_lines_url }\n format.json { head :no_content }\n end\n end",
"def remove_item(id:)\n order.items.destroy(id)\n end"
]
| [
"0.7897787",
"0.7759607",
"0.7612084",
"0.7612084",
"0.76079386",
"0.751049",
"0.751049",
"0.7484588",
"0.73727953",
"0.7366761",
"0.72802234",
"0.72445196",
"0.72379076",
"0.7165061",
"0.7161339",
"0.7150915",
"0.71417683",
"0.7120653",
"0.7064155",
"0.70632917",
"0.7020535",
"0.70065063",
"0.7004428",
"0.69815713",
"0.69481266",
"0.6938685",
"0.6930366",
"0.69218343",
"0.6907893",
"0.6888399",
"0.68876415",
"0.6879863",
"0.6864431",
"0.68586075",
"0.68506783",
"0.6850242",
"0.6842289",
"0.68314403",
"0.68269163",
"0.68202347",
"0.6817047",
"0.6815663",
"0.6815172",
"0.6815172",
"0.6815172",
"0.6815172",
"0.6815172",
"0.6815172",
"0.6815172",
"0.6815172",
"0.6815172",
"0.6815172",
"0.6815172",
"0.6815172",
"0.6815172",
"0.6815172",
"0.6815172",
"0.68115747",
"0.6809309",
"0.6808953",
"0.6806986",
"0.67961544",
"0.6791494",
"0.6784404",
"0.6783826",
"0.6783826",
"0.6782896",
"0.6780944",
"0.67787445",
"0.6777462",
"0.6777462",
"0.6777462",
"0.6777462",
"0.67682",
"0.6767622",
"0.6767622",
"0.6757815",
"0.6757815",
"0.6757815",
"0.6757815",
"0.6757815",
"0.6757815",
"0.6757815",
"0.6757815",
"0.6757815",
"0.6757815",
"0.67566955",
"0.6751692",
"0.67507887",
"0.6749432",
"0.6744704",
"0.67378354",
"0.6729843",
"0.6724252",
"0.6714485",
"0.6713578",
"0.6713003",
"0.6701117",
"0.6700718",
"0.6699254"
]
| 0.69449836 | 25 |
Use callbacks to share common setup or constraints between actions. | def set_order_item
@order_item = OrderItem.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 order_item_params
params.require(:order_item).permit(:deal_id, :serv_offer_id, :serv_offer_user_name, :serv_offer_titile, :lately_chat_content, :offer_user_id, :request_user_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def valid_params_request?; end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def backend_user_params\n params.permit!\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
]
| [
"0.6981273",
"0.6783789",
"0.67460483",
"0.6742222",
"0.67354137",
"0.65934366",
"0.65028495",
"0.6497783",
"0.64826745",
"0.6479415",
"0.6456823",
"0.6440081",
"0.63800216",
"0.6376521",
"0.636652",
"0.6319898",
"0.6300256",
"0.62994003",
"0.6293621",
"0.6292629",
"0.6291586",
"0.629103",
"0.6282451",
"0.6243152",
"0.62413",
"0.6219024",
"0.6213724",
"0.62103724",
"0.61945",
"0.61786324",
"0.61755824",
"0.6173267",
"0.6163613",
"0.6153058",
"0.61521065",
"0.6147508",
"0.61234015",
"0.61168665",
"0.6107466",
"0.6106177",
"0.6091159",
"0.60817343",
"0.6071238",
"0.6062299",
"0.6021663",
"0.60182893",
"0.6014239",
"0.6011563",
"0.60080767",
"0.60080767",
"0.60028875",
"0.60005623",
"0.59964156",
"0.5993086",
"0.5992319",
"0.5992299",
"0.59801805",
"0.59676576",
"0.59606016",
"0.595966",
"0.59591126",
"0.59589803",
"0.5954058",
"0.5953234",
"0.5944434",
"0.5940526",
"0.59376484",
"0.59376484",
"0.5935253",
"0.5930846",
"0.5926387",
"0.59256274",
"0.5917907",
"0.5910841",
"0.590886",
"0.59086543",
"0.59060425",
"0.58981544",
"0.5898102",
"0.5896809",
"0.5895416",
"0.58947027",
"0.58923644",
"0.5887903",
"0.58830196",
"0.5880581",
"0.5873854",
"0.58697754",
"0.5869004",
"0.58669055",
"0.5866886",
"0.58664906",
"0.5864619",
"0.58630043",
"0.5862495",
"0.5861368",
"0.5859712",
"0.5855544",
"0.58551925",
"0.5851284",
"0.5850602"
]
| 0.0 | -1 |
Create a Customer using a predefined XML template as a REST request. | def create(name="Default name")
xml_req =
"<?xml version='1.0' encoding='UTF-8'?>
<customer>
<name>#{name}</name>
</customer>"
request = Net::HTTP::Post.new(@url)
request.add_field "Content-Type", "application/xml"
request.body = xml_req
http = Net::HTTP.new(@uri.host, @uri.port)
response = http.request(request)
response.body
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_customer(*args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = post(\"customers\",options)\n if response['success']\n return response['results']['customer']\n else\n return response\n end\n end",
"def create_customer(options = {})\n perform_post_with_object('/customers', options, Epages::Customer)\n end",
"def create_customer(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/customers',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def create\n @customer = @representative.customers.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n flash[:notice] = 'Customer was successfully created.'\n format.html { redirect_to(representative_customers_path(@representative)) }\n format.xml { render :xml => @customer, :status => :created, :location => @customer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create(payload)\n client.post(make_path('/customers'), payload)\n end",
"def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to(@customer, :notice => 'Customer was successfully created.') }\n format.xml { render :xml => @customer, :status => :created, :location => @customer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_create_customer()\n # Parameters for the API call\n body = APIHelper.json_deserialize(\n '{\"given_name\":\"Amelia\",\"family_name\":\"Earhart\",\"email_address\":\"Amelia.Ear'\\\n '[email protected]\",\"address\":{\"address_line_1\":\"500 Electric Ave\",\"address_l'\\\n 'ine_2\":\"Suite 600\",\"locality\":\"New York\"},\"phone_number\":\"1-212-555-4240\",\"'\\\n 'reference_id\":\"YOUR_REFERENCE_ID\",\"note\":\"a customer\"}'\n )\n\n # Perform the API call through the SDK function\n result = @controller.create_customer(body: body)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n end",
"def add_customer(xml, credit_card, options)\n requires!(options, :billing_address)\n address = options[:billing_address]\n xml.Customer do\n xml.Name do\n xml.Given credit_card.first_name\n xml.Family credit_card.last_name\n end\n xml.Address do\n xml.Street address[:address1].to_s\n xml.Zip address[:zip].to_s\n xml.City address[:city].to_s\n xml.State address[:state].to_s if address.has_key? :state\n xml.Country address[:country].to_s\n end\n xml.Contact do\n xml.Email options[:email] || '[email protected]'\n xml.Ip options[:ip] || '0.0.0.0'\n end\n end\n end",
"def create\n @self_service_customer = SelfService::Customer.new(params[:self_service_customer])\n\n respond_to do |format|\n if @self_service_customer.save\n format.html { redirect_to(@self_service_customer, :notice => 'Customer was successfully created.') }\n format.xml { render :xml => @self_service_customer, :status => :created, :location => @self_service_customer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @self_service_customer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_customer\n @customer = ::Customer.create!(client_id: @client.id,\n status: GlobalConstant::Customer.active_status,\n details: @customer_details\n )\n success\n end",
"def create(cust_token, data = {})\n pdata = build_payment_info(data)\n data = FiveDL.build_params(data.merge!(transtype: 'updatecustomer', token: cust_token).merge!(pdata))\n FiveDL::Response.new( FiveDL::Gateway.post('/Payments/Services_api.aspx', data) )\n end",
"def create_customer(params)\n r = validate_params(params, {optional: [:id, :first_name, :last_name, :comapny, :email, :phone, :fax, :website, :payment_method_nonce, :credit_card, :custom_fields]})\n return r unless r.success?\n result = @gateway.customer.create(params)\n success_with_data({result: result})\n end",
"def createCustomer(customer_properties)\n url_data = \"/api/customers/\"\n @json_customer_properties = customer_properties.to_json\n options = {\n :digest_auth => @auth_digest,\n :body => @json_customer_properties\n }\n url_request = \"#{url_data}\"\n postData(url_request, options)\n end",
"def create\n params[:customer][:admitted_on] = Chronic.parse(params[:customer][:admitted_on])\n params[:customer][:released_on] = Chronic.parse(params[:customer][:released_on])\n unless params[:customer][:program].nil?\n params[:customer][:program] = Program.find(params[:customer][:program])\n end\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n flash[:notice] = 'Customer was successfully created.'\n format.html { redirect_to new_customer_path }\n format.xml { render :xml => @customer, :status => :created, :location => @customer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create(attributes)\n id = attributes[:Guid].present? ? attributes[:Guid] : ''\n response = JSON.parse(@client.post(\"Customers/#{id}\", attributes).body)\n Unleashed::Customer.new(@client, response)\n end",
"def add_customer(xml, options)\n customer = options[:customer]\n return unless customer\n\n xml.tag!('customer') do\n xml.tag!('type', customer[:type]) if customer[:type]\n xml.tag!('id', customer[:id]) if customer[:id]\n xml.tag!('email', customer[:email]) if customer[:email]\n xml.tag!('phoneNumber', customer[:phone_number]) if customer[:phone_number]\n xml.tag!('faxNumber', customer[:fax_number]) if customer[:fax_number]\n add_drivers_license(xml, options)\n xml.tag!('taxId', customer[:tax_id]) if customer[:tax_id]\n end\n end",
"def create_customer(body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/customers'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.post(\n _query_url,\n headers: _headers,\n parameters: body.to_json\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end",
"def create_customer_with_http_info(customer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomersApi.create_customer ...'\n end\n # verify the required parameter 'customer' is set\n if @api_client.config.client_side_validation && customer.nil?\n fail ArgumentError, \"Missing the required parameter 'customer' when calling CustomersApi.create_customer\"\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/customers'\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/vnd.conekta-v2.1.0+json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\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(customer)\n\n # return_type\n return_type = opts[:debug_return_type] || 'CustomerResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"CustomersApi.create_customer\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomersApi#create_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: t(\"activerecord.controller_msg.customer.created\", :default => 'Customer was successfully created.') }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def customerCreate(options={})\n assert_valid_keys(options, :customerId, :freeParams)\n assert_keys_exists(options, :customerId)\n execute(:customerCreate, options)\n end",
"def customerCreate(options={})\n assert_valid_keys(options, :customerId, :freeParams)\n assert_keys_exists(options, :customerId)\n execute(:customerCreate, options)\n end",
"def create\n @customer = Customer.new(customer_params.map{|k,v| {k.to_sym => v.class == ActionController::Parameters ? [v.to_hash] : v.to_s}}.reduce({}, :merge))\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @customer = Customer.new(params[:customer])\r\n\r\n respond_to do |format|\r\n if @customer.save\r\n format.html { redirect_to '/auth/identity/register', :notice => 'Customer was successfully created.' }\r\n format.json { render :json => @customer, :status => :created, :location => @customer }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.json { render :json => @customer.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create(*args)\n set_customer_account!(args)\n email = args[0]\n post \"/\", customer: customer, identifier: account, email: email\n end",
"def create_customer\n begin\n customer = Stripe::Customer.create\n # Create customer successful - return its id\n log_info(\"Customer created with ID #{customer[:id]}\")\n rescue Stripe::StripeError => e\n return_error 402, \"Error creating customer #{e.message}\"\n end\n status 201\n { customer_id: customer.id }.to_json\n end",
"def create\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\t#LOG.debug (fname) {\"params=#{params.inspect}\"}\n\t\t@customer = Customer.new(params[:customer])\n\t\t@types = Typesobject.get_types(\"customer\")\n\t\t@status = Statusobject.find_for(@customer)\n\t\trespond_to do |format|\n\t\t\tif params[:fonct] == \"new_dup\"\n\t\t\t\tobject_orig=Customer.find(params[:object_orig_id])\n\t\t\t\tst = @customer.create_duplicate(object_orig)\n\t\t\telse\n\t\t\t\tst = @customer.save\n\t\t\tend\n\t\t\tif st\n\t\t\t\tst = ctrl_duplicate_links(params, @customer, current_user)\n\t\t\t\tflash[:notice] = t(:ctrl_object_created, :typeobj => t(:ctrl_customer), :ident => @customer.ident)\n\t\t\t\tformat.html { redirect_to(@customer) }\n\t\t\t\tformat.xml { render :xml => @customer, :status => :created, :location => @customer }\n\t\t\telse\n\t\t\t\tflash[:error] = t(:ctrl_object_not_created, :typeobj => t(:ctrl_customer), :msg => @customer.errors)\n\t\t\t\tformat.html { render :action => :new }\n\t\t\t\tformat.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to customers_path, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_customer(customer_data)\n ::Stripe::Customer.create(customer_data)\n end",
"def create_customer(customer_info, password)\n post_wrapper('/V1/customers',\n { customer: customer_info,\n password: password }.to_json,\n admin_headers)\n end",
"def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to action: \"index\", notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def customerCreate(options = {})\n assert_valid_keys(options, :accessKey, :testMode, :customerId, :freeParams)\n assert_keys_exists(options, :customerId)\n execute(:customerCreate, options)\n end",
"def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: \"Customer was successfully created.\" }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer = Customer.new(customer_params)\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_customer(body)\r\n begin\r\n @logger.info(\"create_customer called.\")\r\n\r\n # validate required parameters\r\n @logger.info(\"Validating required parameters for create_customer.\")\r\n validate_parameters({\r\n 'body' => body\r\n })\r\n\r\n # prepare query url\r\n @logger.info(\"Preparing query URL for create_customer.\")\r\n _query_builder = Configuration.get_base_uri().clone\r\n _query_builder << '/customers'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n @logger.info(\"Preparing headers for create_customer.\")\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n @logger.info('Preparing and executing HttpRequest for create_customer.')\r\n _request = @http_client.post _query_url, headers: _headers, parameters: body.to_json\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request, name: 'create_customer')\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n @logger.info(\"Returning response for create_customer.\")\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n return CustomerModel.from_hash(decoded)\r\n\r\n rescue Exception => e\r\n @logger.error(e)\r\n raise e\r\n end\r\n end",
"def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer = Customer.new(customer_params)\n \n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer = current_user.customers.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.xml { render :xml => @customer, :status => :created, :location => @customer }\n format.js\n else\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end",
"def call(_obj, args, _ctx)\n Customer.create!(\n name: args[:name],\n email: args[:email],\n )\n end",
"def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully added.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :index }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @address_customer = AddressCustomer.new(params[:address_customer])\n\n respond_to do |format|\n if @address_customer.save\n format.html { redirect_to @address_customer, notice: 'Address customer was successfully created.' }\n format.json { render json: @address_customer, status: :created, location: @address_customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @address_customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_customer(id)\n item = DirectedEdge::Item.new(@database, \"customer#{id}\")\n item.add_tag('customer')\n item.save\n end",
"def create_new_customer \n ForestOperations.link_parent_child_nodes_return_parent(\n ForestOperations.create_node(\n line_content[:sent_or_accepted_by],\n :accepted),\n ForestOperations.create_node(\n line_content[:recived_by]\n ) \n )\n end",
"def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to [:admin, @customer], notice: t('messages.created', model:Customer.model_name.human) }\n format.json { render action: 'show', status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def send_customer(customer)\n request(customer, \"customer\", :post, {method: \"add\"})\n end",
"def create\n @customer = @user.customers.build(customer_params)\n if @customer.save\n render json: @customer, status: :created\n else\n render json: @customer.errors, status: :unprocessable_entity\n end\n\n end",
"def create\n @customer = Customer.new(customer_params)\n\n if @customer.save\n render json: @customer, status: :created, location: @customer\n else\n ap errors(@customer.errors)\n render json: errors(@customer.errors), status: :unprocessable_entity\n end\n end",
"def create\n @customer_info = CustomerInfo.new(params[:customer_info])\n\n respond_to do |format|\n if @customer_info.save\n format.html { redirect_to(@customer_info, :notice => 'Customer info was successfully created.') }\n format.xml { render :xml => @customer_info, :status => :created, :location => @customer_info }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @customer_info.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_customer(email, token)\n raise \"Not implemented!\"\n end",
"def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to admin_customer_path(@customer), notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.new(params[:cust_contact])\n\n respond_to do |format|\n if @cust_contact.save\n format.html { redirect_to @cust_contact.customer, :notice => 'Contact was successfully created.' }\n format.json { render :json => @cust_contact, :status => :created, :location => @cust_contact }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cust_contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n UserMailer.welcome_customer(@customer).deliver\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer = current_user.customers.build(params[:customer])\n\n respond_to do |format|\n if @customer.save \n @customer.orders.create(:user_id => @customer.user.id, \n :total => params[:total], :name => @customer.name, :phone => @customer.phone,\n :address => @customer.address, :instruction => params[:instruction]) if params[:order] == 'true'\n format.html { redirect_to(@customer, :notice => 'Customer was successfully created.') }\n format.xml { render :xml => @customer, :status => :created, :location => @customer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def customer_create\n @customer = Person.new(person_params)\n respond_to do |format|\n if @customer.save\n format.html { redirect_to new_customer_path, notice: 'データが新規作成されました。' }\n format.json { render :customer_show, status: :created, location: @customer }\n else\n format.html { redirect_to new_customer_path }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer_customer = Customer::Customer.new(customer_customer_params)\n @customer_customer.admin = current_admin\n\n respond_to do |format|\n if @customer_customer.save\n format.html { redirect_to @customer_customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer_customer }\n else\n format.html { render :new }\n format.json { render json: @customer_customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_for_invoice\n @customer = @current_account.customers.build(params[:customer])\n @customer.build_address(params[:address])\n if @customer.save\n # To display this customer on the left header reusing partials.\n @invoice = Invoice.new\n @invoice.customer = @customer\n end\n end",
"def create\n @customer = Customer.new(params[:customer])\n @user = User.find(session[:user_id])\n @customer.created_by = @user.name\n respond_to do |format|\n if @customer.save\n format.html { redirect_to(customers_path, :notice => 'Customer was successfully created.') }\n format.xml { render :xml => @customer, :status => :created, :location => @customer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @cust = Cust.new(params[:cust])\n\n respond_to do |format|\n if @cust.save\n format.html { redirect_to @cust, notice: 'Cust was successfully created.' }\n format.json { render json: @cust, status: :created, location: @cust }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cust.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_customer request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_customer_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Channel::V1::Customer.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, \n notice: \"Customer #{@customer.email} was successfully created.\" }\n format.json { render action: \"show\", status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # whitelist params\n @customer = Customer.new(customer_params)\n respond_to do |format|\n if @customer.save\n format.html { redirect_to customers_path }\n format.json { render :show, status: :ok, location: @customer }\n format.json { render :json => @objects.map(&:attributes) }\n else\n format.html { render :new, warning: \"Customer record was NOT saved.\"}\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def retrieve_customer(customer_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/customers/{customer_id}',\n 'default')\n .template_param(new_parameter(customer_id, key: 'customer_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def create_customer_using_post_with_http_info(customer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.create_customer_using_post ...'\n end\n # verify the required parameter 'customer' is set\n if @api_client.config.client_side_validation && customer.nil?\n fail ArgumentError, \"Missing the required parameter 'customer' when calling CustomerApi.create_customer_using_post\"\n end\n # resource path\n local_var_path = '/customer'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(customer)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Customer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#create_customer_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_new_customer\n fill_in(\"First Name\", :with => \"Jackie\")\n fill_in(\"Last Name\", :with => \"Anderson\")\n fill_in(\"Address\", :with => \"111 First Street New York, NY 12345\")\n click_button(\"Create\")\n end",
"def create_customer(customer, opts = {})\n data, _status_code, _headers = create_customer_with_http_info(customer, opts)\n data\n end",
"def create\n @customer = customer_scope.new(customer_params)\n @customer.company_type_name = :customer\n\n puts \">>>>> Customer params\"\n puts customer_params.inspect\n\n respond_to do |format|\n if @customer.save\n CompanyRegisterMailer.send_request(@customer.id).deliver\n if customer_params[:plan_id].present?\n PlanRequest.upgrade(@customer.id, customer_params[:plan_id], current_user.id, true)\n end\n\n format.html {\n redirect = customer_path(@customer)\n redirect = company_reseller_path(current_company, @customer.parent_id) if params[:reseller_id]\n redirect = root_path() if params[:registration]\n redirect_to redirect, notice: I18n.t('customers.successfully_created')\n }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.build(params[:contact])\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to([@contact.customer, @contact], :notice => 'Contact was successfully created.') }\n format.json { render :json => @contact, :status => :created, :location => [@contact.customer, @contact] }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n authorize! :create, Customer\n @customer = Customer.new(customer_params)\n @customer.customer_admin = current_user\n\n if @customer.save\n render json: nil, status: :created\n else\n render json: @customer.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def new\n @customer = @representative.customers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @customer }\n end\n end",
"def create\n \n @customer = Customer.new(customer_params)\n @user = current_user\n respond_to do |format|\n if @customer.save\n @customer.update!(user_id: @user.id)\n format.html { redirect_to customers_path, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_customer\n @org = Organisation.find_by(permalink: params[:organisation_id])\n @customer = Customer.new\n\n Stripe.api_key = ENV[\"STRIPE_SECRET_KEY\"]\n end",
"def create\n #@customer = Customer.new(params[:customer].merge(:user_id => current_user.id))\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to customers_path, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer_detail = CustomerDetail.new(customer_detail_params)\n # When we make a new CustomerDetail, also make a Customer to go with it, using the Email from CustomerDetail\n customer_info = customer_detail_params['customer_attributes']\n customer_info['email'] = customer_detail_params['email']\n @customer = Customer.create(customer_info)\n @customer_detail.customer = @customer\n\n respond_to do |format|\n if @customer_detail.save\n format.html { redirect_to wines_url,\n notice: \"User #{@customer_detail.email} was successfully created. Please proceed to Login.\" }\n format.json { render :show, status: :created, location: @customer_detail }\n else\n format.html { render :new }\n format.json { render json: @customer_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(customer_id, attributes)\n id = commit(\"create\", customer_id, attributes)\n record = self.class.new(connection, attributes)\n record.id = id\n record\n end",
"def create\n @type_customer = TypeCustomer.new(params[:type_customer])\n\n respond_to do |format|\n if @type_customer.save\n format.html { redirect_to @type_customer, notice: 'Type customer was successfully created.' }\n format.json { render json: @type_customer, status: :created, location: @type_customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @type_customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_customer(user)\n customer = Mollie::Customer.create(\n email: user.email,\n api_key: get_preference(:api_key),\n )\n MollieLogger.debug(\"Created a Mollie Customer for Spree user with ID #{customer.id}\")\n customer\n end",
"def create\n @customer = Customer.new customer_params\n\n if @customer.save\n redirect_to @customer\n else\n render 'new'\n end\n end",
"def customer(params={})\n add_field(mappings[:customer][:email], params[:email])\n add_field(mappings[:customer][:phone], params[:phone])\n add_field('name', \"#{params[:first_name]} #{params[:last_name]}\")\n end",
"def create_customer(identity)\n customer = Stripe::Customer.create(\n card: posted['stripeToken'],\n plan: Lynr.config('app').fetch(:stripe, {}).plan,\n email: identity.email\n )\n end",
"def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Cliente cadastrado com sucesso!' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def customer(params={})\n add_field(mappings[:customer][:email], params[:email])\n add_field(mappings[:customer][:phone], params[:phone])\n add_field('name', \"#{params[:first_name]} #{params[:last_name]}\")\n end",
"def create_customer_card(customer_id:,\n body:)\n warn 'Endpoint create_customer_card in CustomersApi is deprecated'\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/customers/{customer_id}/cards',\n 'default')\n .template_param(new_parameter(customer_id, key: 'customer_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def create\n @customer = Customer.new(customer_params)\n if @customer.save\n redirect_to(action: \"show\", id: @customer)\n else\n render action: \"new\"\n end\n end",
"def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n migrate_to_dropbox\n format.html { redirect_to @customer, notice: \"Customer was successfully created.\" }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_or_create_customer\r\n email = @e.client_email\r\n (tl, fs, ls) = Customer.split_name(@e.client_name)\r\n\r\n @cust = Customer.find_by_email(email)\r\n if @cust == nil\r\n if @e.client_phone != nil\r\n home = @e.client_phone\r\n mobile = nil\r\n if home[0..1] == '07'\r\n mobile = home\r\n home = nil\r\n end\r\n else\r\n home = nil\r\n mobile = nil\r\n end\r\n\r\n @cust = Customer.create(\r\n :email => email,\r\n :title => tl,\r\n :firstname => fs,\r\n :lastname => ls,\r\n :phone_home => home,\r\n :phone_mobile => mobile,\r\n :active => true,\r\n :gets_fu => true\r\n )\r\n @log.debug \"Enquiry #{@i}: Created new customer\"\r\n end\r\n \r\n @log.info \"Enquiry #{@i}: Found/created customer - #{@cust.to_s}\"\r\n end",
"def create\n @customer_contact = CustomerContact.new(customer_contact_params)\n\n respond_to do |format|\n if @customer_contact.save\n format.html { redirect_to @customer_contact, notice: 'Customer contact was successfully created.' }\n format.json { render :show, status: :created, location: @customer_contact }\n else\n format.html { render :new }\n format.json { render json: @customer_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_customer\n input_param = params[:user] || params[:customer]\n if input_param\n input_param.delete(:password)\n input_param.delete(:password_confirmation)\n input_param.delete(:username)\n if current_user.is_a?(Referral) && input_param[:profile_attributes].present?\n input_param[:referral_category_id] = current_user.referral_category_id\n input_param[:profile_attributes][:referal_id] = current_user.code\n input_param[:profile_attributes][:referal] = current_user.referral_category.name if current_user.referral_category\n end\n end\n\n @customer = Customer.find_or_initialize_by_email(input_param[:email])\n @membership_order = Membership.find(session[:current_premium_id]) if session[:current_premium_id]\n \n if @customer.update_attributes(input_param)\n order.orderable = @customer\n # CustomerMailer.delay.welcome_email(@customer)\n CustomerMailer.delay.welcome_email_admin(@customer)\n \n if order.save && session[:current_premium_id].present?\n redirect_to extra_manage_orders_path\n else\n redirect_to premium_manage_orders_path\n end\n else\n @customer = Customer.new(input_param)\n flash[:errors] = @customer.errors.full_messages.uniq.join(', ')\n prepare_customer_form\n render :new\n end\n end",
"def setCustomerAttributes(customernumber, email, firstname, lastname, salutation, password, shopId, street, city, zipcode, country)\n #if string_country\n customer_properties = {\n :number => customernumber,\n :email => email,\n :firstname => firstname,\n :lastname => lastname,\n :salutation => salutation,\n :password => password,\n :shopId => shopId,\n :billing => {\n :firstname => firstname,\n :lastname => lastname,\n :salutation => salutation,\n :street => street,\n :city => city,\n :zipcode => zipcode,\n :country => country\n }\n }\n createCustomer(customer_properties)\n end",
"def create\n @customers_address = CustomersAddress.new(params[:customers_address])\n\n respond_to do |format|\n if @customers_address.save\n format.html { redirect_to @customers_address, notice: 'Customers address was successfully created.' }\n format.json { render json: @customers_address, status: :created, location: @customers_address }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customers_address.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer_address = CustomerAddress.new(customer_address_params)\n\n respond_to do |format|\n if @customer_address.save\n format.html { redirect_to @customer_address, notice: 'Customer address was successfully created.' }\n format.json { render :show, status: :created, location: @customer_address }\n else\n format.html { render :new }\n format.json { render json: @customer_address.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @contact = @customer.contacts.build(params[:contact])\n\n respond_to do |format|\n if @contact.save\n flash[:notice] = _('Contact was successfully created.')\n format.html { redirect_to(customer_contact_url(:customer_id => @customer.id, :id => @contact.id)) }\n format.js { render :text => \"contact added\", :layout => false }\n format.xml { render :xml => @contact, :status => :created, :location => @contact }\n else\n format.html { render :action => \"new\", :layout => request.xhr? }\n format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }\n end\n end\n\n end"
]
| [
"0.7364722",
"0.7239721",
"0.7223057",
"0.7203944",
"0.7150991",
"0.7072596",
"0.7033259",
"0.698657",
"0.697075",
"0.6887057",
"0.6811839",
"0.6810424",
"0.6802065",
"0.6773241",
"0.6728933",
"0.67265713",
"0.67158604",
"0.6685042",
"0.66801244",
"0.6666459",
"0.6666459",
"0.6659312",
"0.6659028",
"0.6659028",
"0.66494465",
"0.664709",
"0.6645544",
"0.6644337",
"0.6641806",
"0.6630909",
"0.662327",
"0.662327",
"0.662327",
"0.662327",
"0.662327",
"0.662327",
"0.6618369",
"0.66092974",
"0.6605713",
"0.6597354",
"0.65835804",
"0.65822965",
"0.65714836",
"0.6568991",
"0.65616703",
"0.6552312",
"0.6516295",
"0.6476955",
"0.6463826",
"0.6462368",
"0.6460448",
"0.6459901",
"0.6453299",
"0.6441885",
"0.64369845",
"0.643395",
"0.6427643",
"0.6424851",
"0.6414534",
"0.63950497",
"0.6374124",
"0.6368741",
"0.63662434",
"0.6355314",
"0.63541836",
"0.6347754",
"0.6316193",
"0.63126665",
"0.6311266",
"0.6292197",
"0.6287216",
"0.62786394",
"0.62761307",
"0.6273414",
"0.6251976",
"0.6241596",
"0.62361246",
"0.62268317",
"0.62104416",
"0.6198277",
"0.6195848",
"0.618009",
"0.6178531",
"0.6158617",
"0.61505353",
"0.6125056",
"0.61152005",
"0.6095061",
"0.60867316",
"0.6075942",
"0.60741884",
"0.6063447",
"0.60633653",
"0.60491955",
"0.6041813",
"0.6039893",
"0.6038209",
"0.60352993",
"0.6032316",
"0.60223037"
]
| 0.71268785 | 5 |
Read can get all customers with no arguments or get one customer with one argument. For example: customer_api = customer_api.new customer_api.read 2 => one customer customer_api.read => all customers | def read(id=nil)
request = Net::HTTP.new(@uri.host, @uri.port)
if id.nil?
response = request.get("#{@uri.path}.xml")
else
response = request.get("#{@uri.path}/#{id}.xml")
end
response.body
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_customer(id)\n get(\"customers/#{id}\")\n end",
"def get_customer(id)\n get(\"customers/#{id}\")\n end",
"def get_customer_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer_all_using_get ...'\n end\n # resource path\n local_var_path = '/customer'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageCustomer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#get_customer_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_customers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomerApi.get_customers ...\"\n end\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 10000000\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling CustomerApi.get_customers, must be smaller than or equal to 10000000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling CustomerApi.get_customers, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"size\"]\" when calling CustomerApi.get_customers, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"size\"]\" when calling CustomerApi.get_customers, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = \"/v1/customer\"\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'CustomerSearch')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#get_customers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def customer(options = nil)\n request = Request.new(@client)\n path = \"/authorization-requests/\" + CGI.escape(@id) + \"/customers\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"customer\"]\n customer = Customer(self._client)\n return_values.push(customer.fill_with_data(body))\n\n \n return_values[0]\n end",
"def retrieve_customer(customer_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/customers/{customer_id}',\n 'default')\n .template_param(new_parameter(customer_id, key: 'customer_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def customer(customer_id)\n client.get \"customers/#{inst_id}/#{customer_id}\"\n end",
"def retrieve(params = {})\n req = WebPay::CustomerIdRequest.create(params)\n raw_response = @client._request(:get, 'customers' + '/' + req.id.to_s, req)\n WebPay::CustomerResponse.new(raw_response)\n end",
"def get_customers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomersApi.get_customers ...'\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling CustomersApi.get_customers, must be smaller than or equal to 250.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling CustomersApi.get_customers, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/customers'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil?\n query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].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/vnd.conekta-v2.1.0+json'])\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\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] || 'CustomersResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"CustomersApi.get_customers\",\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: CustomersApi#get_customers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_customer_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer ...'\n end\n # unbox the parameters from the hash\n customer_id = opts[:'customer_id']\n # verify the required parameter 'customer_id' is set\n if @api_client.config.client_side_validation && customer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'customer_id' when calling CustomerApi.get_customer\"\n end\n # resource path\n local_var_path = '/customer/{customer_id}'.sub('{' + 'customer_id' + '}', CGI.escape(customer_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'CustomerResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"CustomerApi.get_customer\",\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: CustomerApi#get_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n customer = Customer.find(params[:id])\n authorize! :read, customer\n render json: customer\n end",
"def all(params = {})\n req = WebPay::BasicListRequest.create(params)\n raw_response = @client._request(:get, 'customers', req)\n WebPay::CustomerResponseList.new(raw_response)\n end",
"def customer\n @customer ||= fetcher.get(Customer, customer_id)\n end",
"def index\n if current_user.role == 'customer_admin'\n render json: current_user.customer and return\n else\n authorize! :read_all, Customer\n customers = Customer.order('name asc')\n render json: customers and return\n end\n end",
"def customers\n ShopifyAPI::Customer.all\n end",
"def get_customer_using_get_with_http_info(customer_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer_using_get ...'\n end\n # verify the required parameter 'customer_id' is set\n if @api_client.config.client_side_validation && customer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'customer_id' when calling CustomerApi.get_customer_using_get\"\n end\n # resource path\n local_var_path = '/customer/{customer_id}'.sub('{' + 'customer_id' + '}', customer_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Customer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#get_customer_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def customerGet(options={})\n assert_valid_keys(options, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:customerGet, options)\n end",
"def customerGet(options={})\n assert_valid_keys(options, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:customerGet, options)\n end",
"def get_customers\n return ShopifyAPI::Customer.all\n end",
"def retrieve_customer_with_http_info(authorization, customer_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomerApi.retrieve_customer ...\"\n end\n # verify the required parameter 'authorization' is set\n fail ArgumentError, \"Missing the required parameter 'authorization' when calling CustomerApi.retrieve_customer\" if authorization.nil?\n # verify the required parameter 'customer_id' is set\n fail ArgumentError, \"Missing the required parameter 'customer_id' when calling CustomerApi.retrieve_customer\" if customer_id.nil?\n # resource path\n local_var_path = \"/v2/customers/{customer_id}\".sub('{format}','json').sub('{' + 'customer_id' + '}', customer_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'Authorization'] = authorization\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'RetrieveCustomerResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#retrieve_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def read(id)\n # do not respond with anything\n end",
"def customerGet(options = {})\n assert_valid_keys(options, :accessKey, :testMode, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:customerGet, options)\n end",
"def customer_list\n perform_get_request('/customer/list')\n end",
"def index\n if params[:search_term]\n customers = Customer.search_customer(params[:search_term])\n else\n if read_from_cache(\"customers\")\n customers = read_from_cache(\"customers\")\n else\n customers = apply_scopes(Customer).all\n write_to_cache(\"customers\", customers)\n end\n end\n\n if params[:page_no]\n result = pagy(customers)\n else\n result = customers\n end\n render :json => result\n end",
"def get_customer_info(read_code,\r\n read_code_type,\r\n total_amount,\r\n total_vat_amount,\r\n currency,\r\n partner_id,\r\n branch_id,\r\n terminal_id)\r\n # Prepare query url.\r\n _path_url = '/v2/pos/customer_info'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_builder = APIHelper.append_url_with_query_parameters(\r\n _query_builder,\r\n {\r\n 'read_code' => read_code,\r\n 'read_code_type' => read_code_type,\r\n 'total_amount' => total_amount,\r\n 'total_vat_amount' => total_vat_amount,\r\n 'currency' => currency,\r\n 'partner_id' => partner_id,\r\n 'branch_id' => branch_id,\r\n 'terminal_id' => terminal_id\r\n },\r\n array_serialization: Configuration.array_serialization\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n OAuth2.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n GetCustomerInfoResponse.from_hash(decoded)\r\n end",
"def all(params = {})\n handle_all_request(\"/customers\", :customers, params)\n end",
"def get_all_customers\r\n begin\r\n @logger.info(\"get_all_customers called.\")\r\n\r\n # prepare query url\r\n @logger.info(\"Preparing query URL for get_all_customers.\")\r\n _query_builder = Configuration.get_base_uri().clone\r\n _query_builder << '/customers'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n @logger.info(\"Preparing headers for get_all_customers.\")\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n @logger.info('Preparing and executing HttpRequest for get_all_customers.')\r\n _request = @http_client.get _query_url, headers: _headers\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request, name: 'get_all_customers')\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n @logger.info(\"Returning response for get_all_customers.\")\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n return decoded.map{|element| CustomerModel.from_hash(element)}\r\n\r\n rescue Exception => e\r\n @logger.error(e)\r\n raise e\r\n end\r\n end",
"def index\n\n if (params[:show] == \"all\")\n @customers = Customer.all\n else\n @customers = Customer.find_active\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @customers }\n end\n end",
"def list_customer(custid = nil, email = nil)\r\n\r\n raise ArgumentError.new('Customer Id and email are nil.') if custid.nil? && email.nil?\r\n \r\n suburl = \"&action=list_customer&nodocs=1\" \r\n \r\n if !custid.nil? && email.nil?\r\n suburl << \"&custid=\" + custid.to_s\r\n elsif custid.nil? && !email.nil? \r\n suburl << \"&email=\" + email\r\n elsif !custid.nil? && !email.nil?\r\n suburl << \"&custid=\" + custid.to_s + \"&email=\" + email\r\n end\r\n\t \r\n call_target_url(suburl) # call private method\r\n\r\n end",
"def get_customer_by_id_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomersApi.get_customer_by_id ...'\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 CustomersApi.get_customer_by_id\"\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/customers/{id}'.sub('{' + 'id' + '}', CGI.escape(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/vnd.conekta-v2.1.0+json'])\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\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] || 'CustomerResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"CustomersApi.get_customer_by_id\",\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: CustomersApi#get_customer_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list_customer_full(custid = nil, email = nil)\r\n\r\n raise ArgumentError.new('Customer Id and email are nil.') if custid.nil? && email.nil?\r\n \r\n suburl = \"&action=list_customer\" \r\n \r\n if !custid.nil? && email.nil?\r\n suburl << \"&custid=\" + custid.to_s\r\n elsif custid.nil? && !email.nil? \r\n suburl << \"&email=\" + email\r\n elsif !custid.nil? && !email.nil?\r\n suburl << \"&custid=\" + custid.to_s + \"&email=\" + email\r\n end\r\n\t \r\n call_target_url(suburl) # call private method\r\n\r\n end",
"def list_customers_with_http_info(authorization, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomerApi.list_customers ...\"\n end\n # verify the required parameter 'authorization' is set\n fail ArgumentError, \"Missing the required parameter 'authorization' when calling CustomerApi.list_customers\" if authorization.nil?\n # resource path\n local_var_path = \"/v2/customers\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'Authorization'] = authorization\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ListCustomersResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#list_customers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def read(*args)\n #This is a stub, used for indexing\n end",
"def get_customers_by_attributes_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.get_customers_by_attributes ...'\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 ManagementApi.get_customers_by_attributes\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_customers_by_attributes, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_customers_by_attributes, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/v1/customer_search/no_total'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'sandbox'] = opts[:'sandbox'] if !opts[:'sandbox'].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 # 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[:body] || @api_client.object_to_http_body(body) \n\n # return_type\n return_type = opts[:return_type] || 'InlineResponse20023' \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(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementApi#get_customers_by_attributes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def customer(customer_id)\n perform_get_request(\"/customer/#{customer_id}\")\n end",
"def customers\n @customers ||= new_resource(self, :customer, :customers)\n end",
"def index\n\n @user = User.find(session[:user_id]).id\n \n if params[:search]\n @customers = Customer.search(params[:search]).order(\"created_at DESC\")\n elsif params[:customer]\n @customers = Customer.where(id: params[:id])\n elsif params[:cgroup]\n @customers = Customer.filter(params.slice(:cgroup))\n else\n @customers = Customer.all.order('customer_surname ASC')\n end\n end",
"def retrieve_customer(customer_id:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/customers/{customer_id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'customer_id' => { 'value' => customer_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end",
"def get_logged_in_customer_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.get_logged_in_customer ...'\n end\n # unbox the parameters from the hash\n # resource path\n local_var_path = '/current_customer'\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] || 'CustomerResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"CustomerApi.get_logged_in_customer\",\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: CustomerApi#get_logged_in_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def customers(options = {})\n perform_get_with_object('/customers', options, Epages::CustomersResponse)\n end",
"def index\n @single_customers = SingleCustomer.managed_by_users(current_user.direct_subordinates_with_self.collect(&:id)).page params[:page]\n end",
"def crates(); @crates || CrateAPI::Crates.new(); end",
"def customer(id)\n response = get(\"customers/#{id}\")\n response.customer\n end",
"def get_customer_revenue_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer_revenue_all_using_get ...'\n end\n # resource path\n local_var_path = '/customer_revenue'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageCustomerRevenue')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#get_customer_revenue_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @customer = customers.find(params[:id])\n end",
"def show\n @customer = Customer.find(params[:id])\t\n end",
"def customers\n Easybill::Api::Customers\n end",
"def list\n display_customers\n end",
"def show_customer\n @customer = Customer.find(params[:id])\n end",
"def find(id)\n response = JSON.parse(@client.get(\"Customers/#{id}\").body)\n Unleashed::Customer.new(@client, response)\n end",
"def index\n if params[:search] and params[:search] != ''\n @customers = Customer.search(params[:search]).page(params[:page]).per(25)\n else\n @customers = Customer.all.page(params[:page]).per(25)\n end\n end",
"def show\n @customer = Customer.find(params[:id])\n #@customer_types = CustomerType.find_all_by_customer_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"def show\n @customer = Customer.find(params[:id])\n end",
"def show\n @customer = Customer.find(params[:id])\n end",
"def index\n #data = HTTParty.get(\"http://localhost:8081/customers.json\")\n #p data.parsed_response[0]['email']\n if params[:customerId].present?\n @orders = Order.where(\"customerId\": params[:customerId].to_i)\n render json: @orders, status: 200\n elsif params[:id].present?\n @orders = Order.find_by id: params[:id]\n render json: @orders, status:200\n elsif params[:email].present?\n res = HTTParty.get(\"http://localhost:8081/customers/?email=#{params['email']}\")\n p res\n res = res.parsed_response\n @orders = Order.where(\"customerId\": res['id'].to_i)\n render json: @orders, status:200\n else\n @orders = Order.all\n end\n end",
"def index\n @customer = Customer.all\n authorize! :list, @customer\n end",
"def get; end",
"def index\n\t\t@customers = Customer.all\n\t\t@customer = Customer.new\n\tend",
"def test_read_all_info\n get '/v1/read_all?data=eyJOYW1lIjogIkVkdWFyZG8iLCAiQ291bnRyeSI6ICJCcmF6aWwiIH0%3D'\n assert last_response.ok?\n assert last_response.body.include?('Eduardo')\n assert last_response.body.include?('Brazil')\n end",
"def crud_get(resource_name, service_name, primary_key_name, api_options = {})\n api_options = get_defaults(api_options)\n get '/'+resource_name+'/:'+primary_key_name do\n service = settings.send(service_name)\n\n sanitize_params(params)\n return 400 unless service.valid_query?(params)\n\n record = service.get_one_by_query(params)\n return 404 if record.nil?\n JSON.fast_generate record\n end\n end",
"def get(data = {})\n call data, method: :get\n end",
"def show\n @customer_set = CustomerSet.find(params[:id])\n @customers = @customer_set.get_customers(current_user)\n @other_sets = @customer_set.get_all_but_existing\n end",
"def get(objs,type=nil,extras=nil)\n if not objs.is_a? Array\n objs = [objs]\n end\n method = 'get'\n cls = type\n args = {:keys=>Rdio::keys(objs)}\n args[:extras] = extras if extras\n json = call method,args\n if Rdio::log_json\n Rdio::log \"json: #{json}\"\n end\n create_object type,json,true\n end",
"def load_customer\n if read_from_cache(\"customers\")\n @customer = read_from_cache(\"customers\").find(params[:id])\n else\n @customer = Customer.find(params[:id])\n end\n end",
"def index\n @customers = Customer.where(order_id: params[:order_id])\n @order = Order.find(params[:order_id])\n end",
"def base_retrieve(params, document)\n log.debug(\"Processing by #{self.class}#retrieve\")\n log.debug(\" Parameters: #{params.inspect}\")\n end",
"def show\n if params[:smb_id].present?\n if current_user\n @customer = @selector.customers.find_by_auth_token(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @customer }\n end\n else\n flash[:error] = \"You must login first!\"\n redirect_to log_in_path\n end\n elsif params[:friend_id].present?\n @customer = @selector.customers.find_by_auth_token(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @customer }\n end\n else\n if admin?\n @customer = Customer.find_by_auth_token(params[:id])\n end\n end\n \n \n end",
"def read(_request)\n raise NotImplementedError, 'Implement this method in your strategy'\n end",
"def get(resource, id)\n Api.new.get(resource, id)\n end",
"def index\n if current_user.role == 'Party'\n @customers = current_user.customers\n else\n @customers = Customer.all\n end\n end",
"def get(*args, &block)\n end",
"def list\n # 1. Ask the repo to bring all customers #all\n customers = @customer_repo.all\n # 2. Pass the customers to the view to display them\n @customer_view.display_all(customers)\n end",
"def all(options = { page: 1, page_size: 10 })\n response = JSON.parse(@client.get('Customers', options).body)\n customers = response.key?('Items') ? response['Items'] : []\n customers.map { |attributes| Unleashed::Customer.new(@client, attributes) }\n end",
"def customer_by_ref(customer_ref)\n client.get \"customers/#{inst_id}/byRef?merchantRef=#{customer_ref}\"\n end",
"def exchanges_read_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CryptoApi.exchanges_read ...'\n end\n # resource path\n local_var_path = '/exchanges'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Object>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CryptoApi#exchanges_read\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @clients = Client.page(params[:page] || 1).per(10)\n end",
"def get_customer_invoice_with_http_info(purchase_order_number, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerInvoicesApi.get_customer_invoice ...'\n end\n # verify the required parameter 'purchase_order_number' is set\n if @api_client.config.client_side_validation && purchase_order_number.nil?\n fail ArgumentError, \"Missing the required parameter 'purchase_order_number' when calling CustomerInvoicesApi.get_customer_invoice\"\n end\n # resource path\n local_var_path = '/vendor/directFulfillment/shipping/v1/customerInvoices/{purchaseOrderNumber}'.sub('{' + 'purchaseOrderNumber' + '}', purchase_order_number.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 = opts[:return_type] || 'GetCustomerInvoiceResponse' \n\n auth_names = opts[:auth_names] || []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type)\n\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerInvoicesApi#get_customer_invoice\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @cust = Cust.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cust }\n end\n end",
"def _retrieve(options={})\n request :retrieve do |soap|\n soap.body = { :retrieve_request => options }\n end\n end",
"def search_customers(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/customers/search',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def show\n\t\tshow_\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @customer }\n\t\tend\n\tend",
"def get_all_client_cards_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CardApi.get_all_client_cards_using_get ...'\n end\n # resource path\n local_var_path = '/nucleus/v1/card/cardholder_overview'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'currency_conversion'] = opts[:'currency_conversion'] if !opts[:'currency_conversion'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageClientBusinessCardVO')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CardApi#get_all_client_cards_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get!(id, db = database)\n raise CouchRest::Model::DocumentNotFound if id.blank?\n\n doc = db.get id\n build_from_database(doc)\n rescue RestClient::ResourceNotFound\n raise CouchRest::Model::DocumentNotFound\n end",
"def find_customer\n if params[:customer_id]\n print \"I made it heree ))))))))))))))))))))))))))))\"\n @customer = Customer.find_by_id(params[:customer_id])\n end\n end",
"def get\n @get ||= Verb.new do |verb|\n verb.entity :air, :lodging, :car, :rail, :transport, \\\n :cruise, :restaurant, :activity, :note, :map, :directions, \\\n :points_program \\\n do |entity, id|\n do_request('get', entity, {:id=>id}, nil)\n end\n\n verb.entity :profile do |*args|\n entity = args[0]\n do_request('get', entity, nil, nil)\n end\n\n verb.entity :trip do |*args|\n entity, id, filter = args\n if filter.nil?\n filter = {}\n end\n filter[:id] = id\n do_request('get', entity, filter, nil)\n end\n end\n end",
"def index\n if current_user.role == 'Party'\n @customers = current_user.party.customers\n else\n @customers = Customer.all\n end\n end",
"def orchio_get\n if cache.enabled? and response = cache_request.get(id)\n if response.header.status == :cache\n doc = response.body.document\n end\n else\n response = client.send_request :get, inst_args if response.nil?\n doc = Document.new(\n response.body.to_hash,\n Metadata.new(\n :collection => ocollection,\n :key => @id,\n :ref => response.header.etag\n ))\n end\n Result.new(\n status: orchio_status(response, 200),\n response: response,\n results: [ doc ]\n )\n end",
"def index\n @customer_infos = CustomerInfo.all\n end",
"def get!(*args)\n @response = get(*args)\n end",
"def show\n @customers = Customer.all\n end",
"def show\n @customers = Customer.all\n end",
"def get_cdrs(account_number, page = 1, limit = 10, filter = nil)\r\n # the base uri for api requests\r\n query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n query_builder << '/accounts/{account_number}/cdrs'\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n 'account_number' => account_number\r\n }\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\r\n 'page' => if page.nil? then 1 else page end,\r\n 'limit' => if limit.nil? then 10 else limit end,\r\n 'filter' => filter\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'accept' => 'application/json',\r\n 'X-Auth-Token' => Configuration.x_auth_token\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.get query_url, headers: headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new 'You are not authenticated', 401, response.raw_body\r\n elsif response.code == 403\r\n raise APIException.new 'This action needs a valid WSSE header', 403, response.raw_body\r\n elsif response.code == 404\r\n raise APIException.new 'Resource not found', 404, response.raw_body\r\n elsif response.code == 400\r\n raise APIException.new 'Http bad request', 400, response.raw_body\r\n elsif !response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end",
"def index\n @user = current_user\n @customers = @user.customers\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end",
"def index\n\t@customers = Customer.all()\n end",
"def index\n @current_customer = sticky_param(:customer_id)\n @current_status = sticky_param(:status)\n if params[:search].present?\n @invoices = Invoice.quick_find(params[:search])\n else\n @invoices = Invoice.paginate_with_filters({\n :customer_id => @current_customer,\n :status => @current_status\n }, {:page => params[:page], :order=>'date desc,number'})\n end\n respond_to do |format|\n format.html {\n @customers = Customer.find_invoiced\n }\n format.xml { render :xml => @invoices.to_xml }\n end\n end",
"def crud *args\n @crud = args.first if args.size > 0\n end",
"def new\n\t\t#puts \"===CustomersController.new:\"+params.inspect+\" user=\"+@current_user.inspect\n\t\t@customer = Customer.new(user: current_user)\n\t\t@types = Typesobject.get_types(\"customer\")\n\t\t@status = Statusobject.find_for(\"customer\", 2)\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @customer }\n\t\tend\n\tend",
"def find_customer(c_id)\n Customer.find(:all,:conditions => {:C_Id => c_id})\n end",
"def customer(customer)\n id = epages_id(customer)\n perform_get_with_object(\"/customers/#{id}\", {}, Epages::Customer)\n end",
"def get(incoming={})\n opts = HttpClient::Helper.symbolize_keys(incoming)\n query = {\n :guid => HttpClient::Preconditions.assert_class_or_nil('guid', HttpClient::Helper.to_uuid(opts.delete(:guid)), String),\n :organization_key => HttpClient::Preconditions.assert_class_or_nil('organization_key', opts.delete(:organization_key), String),\n :user_guid => HttpClient::Preconditions.assert_class_or_nil('user_guid', HttpClient::Helper.to_uuid(opts.delete(:user_guid)), String),\n :publication => HttpClient::Preconditions.assert_class_or_nil('publication', opts[:publication].nil? ? nil : (opts[:publication].is_a?(Apidoc::Models::Publication) ? opts.delete(:publication) : Apidoc::Models::Publication.apply(opts.delete(:publication))), Apidoc::Models::Publication),\n :limit => HttpClient::Preconditions.assert_class_or_nil('limit', opts.delete(:limit), Integer),\n :offset => HttpClient::Preconditions.assert_class_or_nil('offset', opts.delete(:offset), Integer)\n }.delete_if { |k, v| v.nil? }\n @client.request(\"/subscriptions\").with_query(query).get.map { |hash| Apidoc::Models::Subscription.new(hash) }\n end",
"def get\n end"
]
| [
"0.66092145",
"0.66092145",
"0.6608839",
"0.64987445",
"0.62481326",
"0.62453616",
"0.6194944",
"0.6124262",
"0.6096411",
"0.60867864",
"0.5989913",
"0.59816",
"0.5981485",
"0.5968173",
"0.5959214",
"0.58885443",
"0.58872616",
"0.58872616",
"0.58567536",
"0.5851207",
"0.58401084",
"0.58365554",
"0.58315074",
"0.5817726",
"0.5817059",
"0.5813503",
"0.5796153",
"0.57953423",
"0.57539403",
"0.5752061",
"0.5749839",
"0.5731541",
"0.5728546",
"0.5717241",
"0.5691483",
"0.56891394",
"0.5671574",
"0.56593883",
"0.56385165",
"0.5616576",
"0.56138635",
"0.5606994",
"0.56059164",
"0.55944735",
"0.55914885",
"0.5590434",
"0.55631495",
"0.556112",
"0.5560379",
"0.55408406",
"0.553906",
"0.55283964",
"0.55098253",
"0.55098253",
"0.5507446",
"0.55012465",
"0.5501075",
"0.5486183",
"0.547573",
"0.54728365",
"0.5468509",
"0.54666525",
"0.5465093",
"0.54636174",
"0.5457096",
"0.5447815",
"0.54356396",
"0.5417463",
"0.54127765",
"0.54098547",
"0.539925",
"0.53959733",
"0.5386765",
"0.5384394",
"0.5377556",
"0.5366421",
"0.53552175",
"0.5347399",
"0.5345085",
"0.53445095",
"0.5344372",
"0.53387445",
"0.5338674",
"0.5336509",
"0.53344256",
"0.5321426",
"0.5321228",
"0.5313842",
"0.5313601",
"0.53121805",
"0.53121805",
"0.5309752",
"0.53086",
"0.530813",
"0.53073204",
"0.53072166",
"0.53042066",
"0.53039634",
"0.5303764",
"0.52985287",
"0.52977747"
]
| 0.0 | -1 |
Update a customer using a predefined XML template as a REST request. | def update(id, name= "Updated Name")
xml_req =
"<?xml version='1.0' encoding='UTF-8'?>
<customer>
<id type='integer'>#{id}</id>
<name>#{name}</name>
</customer>"
request = Net::HTTP::Put.new("#{@url}/#{id}.xml")
request.add_field "Content-Type", "application/xml"
request.body = xml_req
http = Net::HTTP.new(@uri.host, @uri.port)
response = http.request(request)
# no response body will be returned
case response
when Net::HTTPSuccess
return "#{response.code} OK"
else
return "#{response.code} ERROR"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_customer(id, data)\n put(\"customers/#{id}\", { body: data })\n end",
"def update(params = {})\n req = WebPay::CustomerRequestUpdate.create(params)\n raw_response = @client._request(:post, 'customers' + '/' + req.id.to_s, req)\n WebPay::CustomerResponse.new(raw_response)\n end",
"def update_customer(customer, id)\n request(customer, \"customer\", :post, {id: id, method: \"edit\"})\n end",
"def update_customer(customer_id:,\n body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::PUT,\n '/v2/customers/{customer_id}',\n 'default')\n .template_param(new_parameter(customer_id, key: 'customer_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def update_customer(customer, options = {})\n id = epages_id(customer)\n perform_patch_with_object(\"/customers/#{id}\", options, Epages::Customer)\n end",
"def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n flash[:notice] = 'Customer was successfully updated.'\n format.html { redirect_to(representative_customers_path(@representative)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to(@customer, :notice => 'Customer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(cust_token, data = {})\n pdata = build_payment_info(data)\n data = FiveDL.build_params(data.merge!(transtype: 'updatecustomer', token: cust_token).merge!(pdata))\n FiveDL::Response.new( FiveDL::Gateway.post('/Payments/Services_api.aspx', data) )\n end",
"def update_customer(customer)\n respond_with customer.to_vaulted_billing\n end",
"def update_customer(customer)\n respond_with customer.to_vaulted_billing\n end",
"def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to(:action => 'index', :notice => 'Customer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_customer_in_gateway\n resp = gateway_client.update_customer(update_params)\n return resp unless resp.success?\n\n puts(resp.inspect)\n\n success\n end",
"def update\n @self_service_customer = SelfService::Customer.find(params[:id])\n\n respond_to do |format|\n if @self_service_customer.update_attributes(params[:self_service_customer])\n format.html { redirect_to(@self_service_customer, :notice => 'Customer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @self_service_customer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_customer(managed_customer_id, customer_fields = {})\n log_operation(:update_customer, managed_customer_id, customer_fields)\n raise Error, 'customer_fields is not a Hash' unless customer_fields.class == Hash\n envelope = wrap_in_envelope do |xml|\n xml['man'].UpdateCustomer {\n xml['man'].managedCustomerID managed_customer_id\n CUSTOMER_REQUEST_FIELDS.each do |field|\n xml['man'].send(field, customer_fields[field]) if customer_fields[field]\n end\n }\n end\n response = post(envelope, 'UpdateCustomer')\n result = response.xpath('//man:UpdateCustomerResult', { 'man' => SERVICE_NAMESPACE }).first\n return result ? result.text == 'true' : false\n end",
"def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_customer(customer_id:,\n body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/customers/{customer_id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'customer_id' => { 'value' => customer_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.put(\n _query_url,\n headers: _headers,\n parameters: body.to_json\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end",
"def update_customer(params)\n r = validate_params(params, {mandatory: [:customer_id],\n optional: [:id, :first_name, :last_name, :comapny, :email, :phone, :fax, :website, :payment_method_nonce, :credit_card, :custom_fields]})\n return r unless r.success?\n result = @gateway.customer.update(params)\n success_with_data({result: result})\n end",
"def update\n @customer_info = CustomerInfo.find(params[:id])\n\n respond_to do |format|\n if @customer_info.update_attributes(params[:customer_info])\n format.html { redirect_to(@customer_info, :notice => 'Customer info was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @customer_info.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to action:\"index\", notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: t(\"activerecord.controller_msg.customer.updated\", :default => 'Customer was successfully updated.') }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @customer = current_user.customers.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.xml { head :ok }\n format.js\n else\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end",
"def update\n\n\n respond_to do |format|\n if @customer.update(customer_params)\n @@current_customer = @customer.id\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to customer_path(session[:customer_id]), notice: 'Your account was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer_customer.update(customer_customer_params)\n format.html { redirect_to @customer_customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer_customer }\n else\n format.html { render :edit }\n format.json { render json: @customer_customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @customer = Customer.find(params[:id])\n\n if @customer.update(customer_params)\n head :no_content\n else\n render json: @customer.errors, status: :unprocessable_entity\n end\n end",
"def update\n params[:customer][:admitted_on] = Chronic.parse(params[:customer][:admitted_on])\n params[:customer][:released_on] = Chronic.parse(params[:customer][:released_on])\n @customer = Customer.find(params[:id])\n unless params[:customer][:program].nil?\n params[:customer][:program] = Program.find(params[:customer][:program])\n end\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n flash[:notice] = 'Customer was successfully updated.'\n format.html { redirect_to(@customer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n #format.html { redirect_to customers_path }\n format.json { head :ok }\n else\n #format.html { render action: \"edit\" }\n format.json { render :json=> @customer.errors, :status=> :unprocessable_entity }\n end\n end\n end",
"def update\n @customer = current_user.customers.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n @customer.orders.create(:user_id => @customer.user.id, \n :total => params[:total], :name => @customer.name, :phone => @customer.phone,\n :address => @customer.address, :instruction => params[:instruction]) if params[:order] == 'true'\n format.html { redirect_to(@customer, :notice => 'Customer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\tLOG.debug (fname) {\"params=#{params.inspect}\"}\n\t\t@customer = Customer.find(params[:id])\n\t\t@types = Typesobject.get_types(:customer)\n\t\t@status = Statusobject.find_for(@customer)\n\t\[email protected]_accessor(current_user)\n\t\tif commit_promote?\n\t\t\tctrl_promote(@customer)\n\t\telse\n\t\t\trespond_to do |format|\n\t\t\t\tif @customer.update_attributes(params[:customer])\n\t\t\t\t\tflash[:notice] = t(:ctrl_object_updated, :typeobj => t(:ctrl_customer), :ident => @customer.ident)\n\t\t\t\t\tformat.html { redirect_to(@customer) }\n\t\t\t\t\tformat.xml { head :ok }\n\t\t\t\telse\n\t\t\t\t\tflash[:error] = t(:ctrl_object_notupdated, :typeobj => t(:ctrl_customer), :ident => @customer.ident)\n\t\t\t\t\tformat.html { render :action => :edit }\n\t\t\t\t\tformat.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to customers_path, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_customer(opts = {})\n data, _status_code, _headers = update_customer_with_http_info(opts)\n data\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Your Customer Account was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: \"Customer was successfully updated.\" }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @address_customer = AddressCustomer.find(params[:id])\n\n respond_to do |format|\n if @address_customer.update_attributes(params[:address_customer])\n format.html { redirect_to @address_customer, notice: 'Address customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address_customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @customer = customers.find(params[:id])\n\n if @customer.update_attributes(params[:customer])\n redirect_to customers_path, notice: '客户信息更新成功' \n else\n render action: \"edit\" \n end\n end",
"def update\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n\n respond_to do |format|\n if @cust_contact.update_attributes(params[:cust_contact])\n format.html { redirect_to customer_path(@customer), :notice => 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @cust_contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html {redirect_to customer_path(@customer), notice: 'Customer was successfully updated.'}\n format.json {render :show, status: :ok, location: @customer}\n else\n format.html {render :edit}\n format.json {render json: @customer.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, \n notice: \"Customer #{@customer.email} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @my_customer.update(my_customer_params)\n format.html { redirect_to @my_customer, notice: 'My customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_customer }\n else\n format.html { render :edit }\n format.json { render json: @my_customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.json { render action: 'show', status: :created, location: @customer }#format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :show }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to [:admin, @customer], notice: t('messages.updated', model:Customer.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @customer_order = CustomerOrder.find(params[:id])\n\n respond_to do |format|\n if @customer_order.update_attributes(params[:customer_order])\n format.html { redirect_to(@customer_order, :notice => 'Customer order was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @customer_order.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_customer_address\n authenticate_request!\n current_customer.assign_attributes(customer_address_params)\n\n if current_customer.save!\n json_response(current_customer)\n else\n json_response({ errors: customer.errors.full_messages }, status: :bad_request)\n end\n end",
"def update\n @customer = Customer.find(params[:id])\n @user = User.find(session[:user_id])\n @customer.modified_by = @user.name\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to(customers_path, :notice => 'Customer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @customer_name = args[:customer_name] if args.key?(:customer_name)\n @id = args[:id] if args.key?(:id)\n end",
"def update\n @cust = Cust.find(params[:id])\n\n respond_to do |format|\n if @cust.update_attributes(params[:cust])\n format.html { redirect_to @cust, notice: 'Cust was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cust.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @customer_order = CustomerOrder.find(params[:id])\n\n respond_to do |format|\n if @customer_order.update_attributes(params[:customer_order])\n flash[:notice] = 'CustomerOrder was successfully updated.'\n format.html { redirect_to(customer_orders_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @customer_order.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @customer.update customer_params\n redirect_to @customer\n else\n render 'edit'\n end\n end",
"def update\n authorize! :update, @customer\n update_customer_params = ( current_user.role == 'kanari_admin' ? admin_customer_params : customer_params)\n if @customer.update(update_customer_params)\n render json: nil, status: 200\n else\n render json: @customer.errors, status: :unprocessable_entity\n end\n end",
"def update!(**args)\n @customer_id = args[:customer_id] if args.key?(:customer_id)\n end",
"def update!(**args)\n @customer_id = args[:customer_id] if args.key?(:customer_id)\n end",
"def update!(**args)\n @customer_id = args[:customer_id] if args.key?(:customer_id)\n end",
"def update!(**args)\n @customer_id = args[:customer_id] if args.key?(:customer_id)\n end",
"def update\n @customer = Customer.find(params[:id])\n @customer.update_attributes(customer_params)\n redirect_to action: \"show\", id: @customer\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Personendaten wurden erfolgreich aktualisiert.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n \n if @customer.update(customer_params.keep_if{|p,q| q.class != ActionController::Parameters}) \n @customer.address.update(customer_params[:address_attributes])\n @customer.contact.update(customer_params[:contact_attributes])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to customers_path, success: \"Customer record updated\"}\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n migrate_to_dropbox\n format.html { redirect_to @customer, notice: \"Customer was successfully updated.\" }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer_info.update(customer_info_params)\n format.html { redirect_to @customer_info, notice: 'Customer info was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer_info }\n else\n format.html { render :edit }\n format.json { render json: @customer_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_customer_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.update_customer ...'\n end\n # unbox the parameters from the hash\n customer_id = opts[:'customer_id']\n # verify the required parameter 'customer_id' is set\n if @api_client.config.client_side_validation && customer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'customer_id' when calling CustomerApi.update_customer\"\n end\n allowable_values = [\"public\", \"private\"]\n if @api_client.config.client_side_validation && opts[:'billing_network_type'] && !allowable_values.include?(opts[:'billing_network_type'])\n fail ArgumentError, \"invalid value for \\\"billing_network_type\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/customer/{customer_id}'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n form_params['billing_contact_id'] = opts[:'billing_contact_id'] if !opts[:'billing_contact_id'].nil?\n form_params['billing_network_type'] = opts[:'billing_network_type'] if !opts[:'billing_network_type'].nil?\n form_params['billing_ref'] = opts[:'billing_ref'] if !opts[:'billing_ref'].nil?\n form_params['can_configure_wordpress'] = opts[:'can_configure_wordpress'] if !opts[:'can_configure_wordpress'].nil?\n form_params['can_reset_passwords'] = opts[:'can_reset_passwords'] if !opts[:'can_reset_passwords'].nil?\n form_params['can_upload_vcl'] = opts[:'can_upload_vcl'] if !opts[:'can_upload_vcl'].nil?\n form_params['force_2fa'] = opts[:'force_2fa'] if !opts[:'force_2fa'].nil?\n form_params['force_sso'] = opts[:'force_sso'] if !opts[:'force_sso'].nil?\n form_params['has_account_panel'] = opts[:'has_account_panel'] if !opts[:'has_account_panel'].nil?\n form_params['has_improved_events'] = opts[:'has_improved_events'] if !opts[:'has_improved_events'].nil?\n form_params['has_improved_ssl_config'] = opts[:'has_improved_ssl_config'] if !opts[:'has_improved_ssl_config'].nil?\n form_params['has_openstack_logging'] = opts[:'has_openstack_logging'] if !opts[:'has_openstack_logging'].nil?\n form_params['has_pci'] = opts[:'has_pci'] if !opts[:'has_pci'].nil?\n form_params['has_pci_passwords'] = opts[:'has_pci_passwords'] if !opts[:'has_pci_passwords'].nil?\n form_params['ip_whitelist'] = opts[:'ip_whitelist'] if !opts[:'ip_whitelist'].nil?\n form_params['legal_contact_id'] = opts[:'legal_contact_id'] if !opts[:'legal_contact_id'].nil?\n form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['owner_id'] = opts[:'owner_id'] if !opts[:'owner_id'].nil?\n form_params['phone_number'] = opts[:'phone_number'] if !opts[:'phone_number'].nil?\n form_params['postal_address'] = opts[:'postal_address'] if !opts[:'postal_address'].nil?\n form_params['pricing_plan'] = opts[:'pricing_plan'] if !opts[:'pricing_plan'].nil?\n form_params['pricing_plan_id'] = opts[:'pricing_plan_id'] if !opts[:'pricing_plan_id'].nil?\n form_params['security_contact_id'] = opts[:'security_contact_id'] if !opts[:'security_contact_id'].nil?\n form_params['technical_contact_id'] = opts[:'technical_contact_id'] if !opts[:'technical_contact_id'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'CustomerResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"CustomerApi.update_customer\",\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#update_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def edit\n return if request.get?\n @customer.attributes = params[:customer]\n @customer.address.attributes = params[:address]\n Customer.transaction do\n @customer.save!\n @customer.address.save!\n @customer.renew_login_token if params[:change_login_url_for_customer] == '1'\n redirect_to :action => 'show', :id => @customer\n end rescue nil\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Cliente editado com sucesso!' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sixmonth_customer = SixmonthCustomer.find(params[:id])\n\n respond_to do |format|\n if @sixmonth_customer.update_attributes(params[:sixmonth_customer])\n format.html { redirect_to action: :index }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sixmonth_customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_customer_address\n json_response({ message: 'NOT IMPLEMENTED' })\n end",
"def update\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to([@contact.customer, @contact], :notice => t('forms.update.sucess')) }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Cliente editado exitosamente.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n @customer = Customer.where(:id => params[:id], :company_id => current_user.company.id).first\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html {\n redirect_to @customer,\n notice: I18n.t(:successfully_updated, :model_name => Customer.model_name.human)\n }\n format.json { head :no_content }\n else\n @customer.errors.each do |name, error|\n flash[name] = error\n end\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find @customer.order_id\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n @type_customer = TypeCustomer.find(params[:id])\n\n respond_to do |format|\n if @type_customer.update_attributes(params[:type_customer])\n format.html { redirect_to @type_customer, notice: 'Type customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @type_customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @customers_address = CustomersAddress.find(params[:id])\n\n respond_to do |format|\n if @customers_address.update_attributes(params[:customers_address])\n format.html { redirect_to @customers_address, notice: 'Customers address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customers_address.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authenticate_customer!\n # We put this in the session in case the user adds an authentication.\n tpauth = Authentication.find session[:customer_oauth_id]\n if tpauth\n @customer = current_customer\n @customer.update_attributes(params[:customer])\n @customer.authentications << tpauth\n @customer.save\n redirect_to edit_customer_registration_path(@customer), :notice => \"Account Updated!\"\n else\n redirect_to customer_sign_in_path, \"You need to authenticate first.\"\n end\n end",
"def update # it is impossible for a customer to update a referral, so no need to modify.\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to [@selector, @customer], :notice => 'Customer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end"
]
| [
"0.7414512",
"0.7409766",
"0.7388895",
"0.731159",
"0.72316325",
"0.7102524",
"0.70180017",
"0.70110196",
"0.70047396",
"0.70047396",
"0.69754744",
"0.6951559",
"0.68436646",
"0.6773493",
"0.6772214",
"0.6771773",
"0.6771773",
"0.6771773",
"0.6771773",
"0.6771773",
"0.6771773",
"0.6771773",
"0.677117",
"0.6769959",
"0.6747037",
"0.6746804",
"0.6721634",
"0.6706122",
"0.6700967",
"0.6697994",
"0.66927224",
"0.66757005",
"0.6673713",
"0.66734886",
"0.6664279",
"0.665993",
"0.665993",
"0.665993",
"0.665993",
"0.665993",
"0.665993",
"0.665993",
"0.665993",
"0.665993",
"0.665993",
"0.665993",
"0.665993",
"0.665993",
"0.665993",
"0.665993",
"0.665993",
"0.665993",
"0.6643443",
"0.6640282",
"0.66353375",
"0.6627682",
"0.6619164",
"0.6619164",
"0.6619164",
"0.661133",
"0.65901476",
"0.65784335",
"0.6568034",
"0.65646803",
"0.6560052",
"0.65562904",
"0.6549966",
"0.6533328",
"0.65274435",
"0.6514657",
"0.6510711",
"0.64974207",
"0.64632046",
"0.64585316",
"0.6455295",
"0.64502376",
"0.644818",
"0.64379245",
"0.64379245",
"0.64379245",
"0.64379245",
"0.6427916",
"0.64277714",
"0.63610464",
"0.6358658",
"0.63570225",
"0.635028",
"0.6348683",
"0.63274765",
"0.6320214",
"0.6318644",
"0.63073605",
"0.6303966",
"0.62891126",
"0.6284109",
"0.627862",
"0.62765133",
"0.6264312",
"0.6228524",
"0.6228468"
]
| 0.6518837 | 69 |
Delete a customer with an ID using HTTP Delete | def delete(id)
request = Net::HTTP::Delete.new("#{@url}/#{id}.xml")
http = Net::HTTP.new(@uri.host, @uri.port)
response = http.request(request)
# no response body will be returned
case response
when Net::HTTPSuccess
return "#{response.code} OK"
else
return "#{response.code} ERROR"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(params = {})\n req = WebPay::CustomerIdRequest.create(params)\n raw_response = @client._request(:delete, 'customers' + '/' + req.id.to_s, req)\n WebPay::CustomerResponse.new(raw_response)\n end",
"def delete_customer_by_id(customer_id)\n host = Swagger.configuration.host\n api_key = Swagger.configuration.private_api_key\n\n conn = Faraday.new\n resp = conn.delete do |req|\n req.url \"https://#{host}/api/customer/#{customer_id}\"\n req.headers['Content-Type'] = 'application/json'\n req.headers['Authorization'] = 'Basic ' + [\"#{api_key}:\"].pack('m').delete(\"\\r\\n\")\n end\n body = JSON.parse(resp.body)\n Swagger::Response.new(resp.status, body)\n return body\n end",
"def delete(customer_id)\n response, status = BeyondApi::Request.delete(@session, \"/customers/#{customer_id}\")\n\n handle_response(response, status, respond_with_true: true)\n end",
"def delete_customer(customer_id:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/customers/{customer_id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'customer_id' => { 'value' => customer_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.delete(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n head :no_content\n end",
"def delete_customer(customer_id:,\n version: nil)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::DELETE,\n '/v2/customers/{customer_id}',\n 'default')\n .template_param(new_parameter(customer_id, key: 'customer_id')\n .should_encode(true))\n .query_param(new_parameter(version, key: 'version'))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def destroy\n \n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to user_customers_url(current_user) }\n format.json do\n render json: {\n customer: @customer,\n status: :deleted\n }.to_json\n end\n end\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :ok }\n end\n end",
"def delete_customer_using_delete_with_http_info(customer_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.delete_customer_using_delete ...'\n end\n # verify the required parameter 'customer_id' is set\n if @api_client.config.client_side_validation && customer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'customer_id' when calling CustomerApi.delete_customer_using_delete\"\n end\n # resource path\n local_var_path = '/customer/{customer_id}'.sub('{' + 'customer_id' + '}', customer_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#delete_customer_using_delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def destroy\r\n @customer = Customer.find(params[:id])\r\n @customer.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to customers_url }\r\n format.json { head :ok }\r\n end\r\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to(customers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to(customers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to(customers_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def destroy\n @cust = Cust.find(params[:id])\n @cust.destroy\n\n respond_to do |format|\n format.html { redirect_to custs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer = Customer.where(:id => params[:id], :company_id => current_user.company.id).first\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @customer, :destroy?\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t@customer = Customer.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tunless @customer.nil?\n\t\t\t\tif @customer.destroy\n\t\t\t\t\tflash[:notice] = t(:ctrl_object_deleted, :typeobj => t(:ctrl_customer), :ident => @customer.ident)\n\t\t\t\t\tformat.html { redirect_to(customers_url) }\n\t\t\t\t\tformat.xml { head :ok }\n\t\t\t\telse\n\t\t\t\t\tflash[:error] = t(:ctrl_object_not_deleted, :typeobj => t(:ctrl_customer), :ident => @customer.ident)\n\t\t\t\t\tindex_\n\t\t\t\t\tformat.html { render :action => \"index\" }\n\t\t\t\t\tformat.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tflash[:error] = t(:ctrl_object_not_deleted, :typeobj => t(:ctrl_customer), :ident => @customer.ident)\n\t\t\tend\n\t\tend\n\tend",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.destroy\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n else\n format.html { redirect_to customer_url(@customer), :notice => \"customer can't be destroyed\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end \n end\n end",
"def delete_customer_by_id_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomersApi.delete_customer_by_id ...'\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 CustomersApi.delete_customer_by_id\"\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/customers/{id}'.sub('{' + 'id' + '}', CGI.escape(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/vnd.conekta-v2.1.0+json'])\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\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] || 'CustomerResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"CustomersApi.delete_customer_by_id\",\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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomersApi#delete_customer_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def delete()\n sql = \"DELETE from customers WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\n# => Deleting customer record, nothing to return\n end",
"def delete_customer_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.delete_customer ...'\n end\n # unbox the parameters from the hash\n customer_id = opts[:'customer_id']\n # verify the required parameter 'customer_id' is set\n if @api_client.config.client_side_validation && customer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'customer_id' when calling CustomerApi.delete_customer\"\n end\n # resource path\n local_var_path = '/customer/{customer_id}'.sub('{' + 'customer_id' + '}', CGI.escape(customer_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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'InlineResponse200'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"CustomerApi.delete_customer\",\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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#delete_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def destroy\n @self_service_customer = SelfService::Customer.find(params[:id])\n @self_service_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to(self_service_customers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n find_customer\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to('/customers/overview') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n redirect_to(action: \"index\")\n end",
"def customer_destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'データが削除されました。' }\n format.json { head :no_content }\n end\n end",
"def delete_customer_with_http_info(authorization, customer_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomerApi.delete_customer ...\"\n end\n # verify the required parameter 'authorization' is set\n fail ArgumentError, \"Missing the required parameter 'authorization' when calling CustomerApi.delete_customer\" if authorization.nil?\n # verify the required parameter 'customer_id' is set\n fail ArgumentError, \"Missing the required parameter 'customer_id' when calling CustomerApi.delete_customer\" if customer_id.nil?\n # resource path\n local_var_path = \"/v2/customers/{customer_id}\".sub('{format}','json').sub('{' + 'customer_id' + '}', customer_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'Authorization'] = authorization\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DeleteCustomerResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#delete_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def destroy\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n @cust_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to customer_url(@customer) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'データが削除されました。' }\n format.json { head :no_content }\n end\n end",
"def delete\n authenticated('/account') do\n enforce_method! :POST\n assert_params :confirm, :custid\n if req.params[:confirm] && cust.custid == req.params[:custid]\n cust.destroy!\n res.delete_cookie :sess\n sess.destroy! :all\n @cust = Stella::Customer.anonymous\n @sess = Stella::Session.new\n Stella::Analytics.event \"Delete account\"\n res.redirect '/'\n else\n sess.add_info_message! \"Account was not deleted. You must click confirm.\"\n res.redirect '/account'\n end\n end\n end",
"def destroy\n @address_customer = AddressCustomer.find(params[:id])\n @address_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to address_customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @custo = Custo.find(params[:id])\n @custo.destroy\n\n respond_to do |format|\n format.html { redirect_to custos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url,flash[:success] = \"Customer record successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to admin_customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Cliente eliminado exitosamente.' }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: \"Customer was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: \"Customer was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_path, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer_customer.destroy\n respond_to do |format|\n format.html { redirect_to customer_customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @potential_customer = PotentialCustomer.find(params[:id])\n @potential_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to potential_customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_customer.destroy\n respond_to do |format|\n format.html { redirect_to my_customers_url, notice: 'My customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n #format.html { redirect_to customers_index_path }\n format.json { head :ok }\n format.js { render :nothing => true }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: t(\"activerecord.controller_msg.customer.destroyed\", :default => 'Customer was successfully destroyed.') }\n format.json { head :no_content }\n end\n end",
"def destroy\n Customer.destroy params #[not sure what to put in the params]\n redirect_to customers_path\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Person wurde erfolgreich gelöscht.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @single_customer.destroy\n respond_to do |format|\n format.html { redirect_to single_customers_url, notice: 'Single customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n end",
"def destroy\n # @customer.destroy\n # respond_to do |format|\n # format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end",
"def delete(id)\n # TODO: Implement this for Stripe webhooks\n end",
"def destroy\n @customer.destroy\n redirect_to customers_url\n end",
"def destroy\n @customer_info = CustomerInfo.find(params[:id])\n @customer_info.destroy\n\n respond_to do |format|\n format.html { redirect_to(customer_infos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n if params[:customers]\n customers.where(id: params[:customers].values).delete_all\n elsif params[:id]\n customers.find_by_id(params[:id]).try(:destroy)\n end\n redirect_to customers_url(search: params[:search])\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n\n @customer = Customer.find_by_id(params[:customer_id])\n #@invoice.customer_id = @customer.id\n\n\n\n @invoice.destroy\n\n# respond_to do |format|\n# format.html { redirect_to (customer_path(@invoice.customer_id), :notice => 'Invoice was successfully deleted.') }\n# format.xml { head :ok }\n# end\n end",
"def destroy\n @customer = current_user.customers.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.js\n end\n end",
"def destroy\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to customer_contacts_url(customer) }\n format.json { head :ok }\n end\n end",
"def delete!\n resource = RESOURCE % { account_id: account.id, id: id }\n response = Request.new(account.client, :delete, resource).perform\n from_response(response.body[:data])\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n end\n end",
"def delete_index\n @customer = Customer.with_deleted.find(params[:id])\n if params[:type]=='normal'\n @customer.delete\n elsif params[:type]=='restore'\n @customer.restore\n @customer.update(deleted_at: nil)\n end\n\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_path, notice: 'Customer was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n @client.make_request(:delete, \"carrier_accounts/#{id}\")\n\n # Return true if succeeds, an error will be thrown if it fails\n true\n end",
"def destroy\n @sixmonth_customer = SixmonthCustomer.find(params[:id])\n @sixmonth_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to sixmonth_customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type_customer = TypeCustomer.find(params[:id])\n @type_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to type_customers_url }\n format.json { head :no_content }\n end\n end",
"def delete(type, id)\n http_delete @target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\", @auth_header, @zone\n end"
]
| [
"0.83748233",
"0.821034",
"0.8065541",
"0.7861734",
"0.77919567",
"0.77881485",
"0.7708202",
"0.75335425",
"0.7529182",
"0.7529182",
"0.7529182",
"0.7529182",
"0.7529182",
"0.7529182",
"0.7529182",
"0.7526181",
"0.7526181",
"0.75032836",
"0.7492786",
"0.74036956",
"0.74036956",
"0.74036956",
"0.73558456",
"0.7354419",
"0.7354247",
"0.73519903",
"0.7300299",
"0.7276782",
"0.7276782",
"0.7276782",
"0.7276782",
"0.7276782",
"0.7276782",
"0.7276782",
"0.7276782",
"0.72705185",
"0.72676253",
"0.7261408",
"0.7243717",
"0.72411793",
"0.72380537",
"0.7220073",
"0.7176109",
"0.71659285",
"0.7142936",
"0.7137848",
"0.7130954",
"0.71071815",
"0.7099405",
"0.70766264",
"0.7075459",
"0.7066104",
"0.7051528",
"0.7051528",
"0.7051528",
"0.7051528",
"0.7051528",
"0.7051528",
"0.7051528",
"0.7051528",
"0.7051528",
"0.7051528",
"0.7051528",
"0.7051528",
"0.7051528",
"0.7051528",
"0.7051528",
"0.7051528",
"0.7051528",
"0.7051528",
"0.7051007",
"0.70509547",
"0.7048928",
"0.7048928",
"0.70417494",
"0.7037499",
"0.70345145",
"0.7032306",
"0.7025152",
"0.70218635",
"0.70186496",
"0.70145965",
"0.6979252",
"0.69742996",
"0.69689137",
"0.6953642",
"0.6948897",
"0.69443583",
"0.69393694",
"0.69379765",
"0.69331163",
"0.6932384",
"0.6910693",
"0.6908631",
"0.6899273",
"0.6864883",
"0.68546027",
"0.68529755",
"0.6848663",
"0.68374574",
"0.68349504"
]
| 0.0 | -1 |
switching on just for 1 hour a day | def update_mode(new_mode)
#return if new_mode == mode
#gateway = Eth485Gateway.new(ENV['ETH485_GATEWAY_IP'], ENV['ETH485_GATEWAY_PORT'].to_i)
gateway = SerialportGateway.new(ENV['SERIAL_PORT'])
meter = Mercury.new(gateway, ENV['METER_ADDRESS'].to_i)
result = {}
case new_mode
when HEATIN_CORD_OFF_MODE then
result = meter.disable_consumer
if result['status'] = 'OK'
self.update!(enable: false, mode: new_mode)
end
when HEATIN_CORD_MANUAL_ON_MODE then
result = meter.enable_consumer
if result['status'] = 'OK'
self.update!(enable: true, mode: new_mode)
end
when HEATIN_CORD_AUTOMATIC_1H_SWITCH_MODE, HEATIN_CORD_AUTOMATIC_1H_PER_DAY_MODE then
update!(mode: new_mode)
#puts meter.enable_consumer
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hour() end",
"def once_per_hour &block\n\tcurrent_hour = Time.now.hour\n\n\tblock.call\n\t\nend",
"def tick_tock\n @hour += 1\n @minute = 0\n @second = 0\n end",
"def tock\n @minute += 1\n end",
"def set_hour_created\n self.hour_created = Time.now.in_time_zone('Eastern Time (US & Canada)').hour\n end",
"def hour\n hour? ? at_hour : super\n end",
"def toggle\n client.time.toggle(@time_entry.harvest_id).timer_started_at.present?\n end",
"def beginning_of_day\n change(hour: 0)\n end",
"def beginning_of_hour\n change(min: 0)\n end",
"def beginning_of_hour\n change(min: 0)\n end",
"def middle_of_day\n change(hour: 12)\n end",
"def middle_of_day\n change(hour: 12)\n end",
"def beginning_of_day\n #(self - seconds_since_midnight).change(:usec => 0)\n change(:hour => 0)\n end",
"def change_time_to_beginning_of_hour\n self.starts_at = self.starts_at.beginning_of_hour()\n self.ends_at = self.starts_at.end_of_hour()\n end",
"def before_connected_to_strava_at(tt = 8.hours)\n dt = connected_to_strava_at\n dt -= tt if dt\n dt\n end",
"def local_middle_of_day\n change_local(hour: 12)\n end",
"def hour\n set_function_and_argument(:hour, nil)\n end",
"def change_time(hike_instance)\n system 'clear'\n puts \"-----MY HIKES-----\"\n hours = @prompt.ask(\"Enter time in hours: \", required: true, convert: :int) {|input| input.in('0-24')}\n minutes = 61\n while minutes > 60 || minutes < 0\n minutes = @prompt.ask(\"Enter time in minutes: \", required: true, convert: :int) {|input| input.in('0-60')}\n end\n hike_instance.time_hiked = (hours * 3600) + (minutes * 60)\n hike_instance.save\n puts \"New time saved.\"\n @prompt.keypress(\"Press any key to continue\")\n end",
"def time_hour; Time.now.hour; end",
"def within_hour?\n\t\tupdated_at >= 1.hour.ago\t\t\n\tend",
"def opening_hour\n 11 # 11am\n end",
"def atime() end",
"def atime() end",
"def hourly(options = {})\n branch options.merge(every: :hour)\n end",
"def hourly(options = {})\n branch options.merge(every: :hour)\n end",
"def lazy_hour=(newhour)\n newhour = newhour.to_f\n \n #Add days for every 24 hours given.\n if newhour > 24 or newhour < 0\n days = (newhour.to_f / 24.0).floor\n newhour -= (days.to_f * 24.0)\n self.add_days(days)\n end\n \n #Convert any decimals to setting minute.\n diff = newhour - newhour.floor\n self.lazy_min = diff * 60 if diff > 0.0\n \n #Set the actual hour.\n self.hour = newhour.floor\n \n self\n end",
"def set_day_if_discarded\n if @datetime && @options[:discard_day]\n @datetime = @datetime.change(day: 1)\n end\n end",
"def need_tock?\n if @second == 60\n @second = 0\n tock\n end\n end",
"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 zero_hour?\n # if the times differ more than 1 minute we probably have more important issues\n needs_view && (ends_at.to_i - updated_at.to_i) < 60\n end",
"def clock24?\n true\n end",
"def set_day_if_discarded; end",
"def open?\n return Time.now.hour >= 18 && Time.now.hour <= 22\n end",
"def set_for_time timestamp\n return nil unless @date\n case timestamp[0,2]\n when \"00\"\n @datetime.hour == 23 ? @date_add_1_hr : @date\n when \"23\"\n @datetime.hour == 00 ? @date_1_hr_ago : @date\n else\n @date\n end\n end",
"def succ\n next_hour = Hour.new(\"12 AM\")\n\n next_time = (@hour + 1) % 24\n next_hour.instance_eval { @hour = next_time }\n #puts \" succ called: next_hour is #{next_hour}, #{@hour}, #{next_time}\"\n next_hour\n end",
"def correct_time?\n now = Time.zone.now\n now.hour == 8 && now.min < 5\n end",
"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 sleepfor \n\ttimetorun = $hours * 60 * 60\n\tsleep(timetorun)\nend",
"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 first_hour=(hour)\n\t\tself.day_begins_at = Time.parse(hour)\n\tend",
"def determine_current_hour\n current_time = Time.new\n current_hour = current_time.hour\nend",
"def beginning_of_day\n change(hour: 0, min: 0, sec: 0)\n end",
"def hour() time[0] end",
"def determine_current_hour\n\tcurrent_time = Time.new\n\tcurrent_hour = current_time.hour\nend",
"def hours\n Thread.current[:datet_mode] = :hours\n return self\n end",
"def local_beginning_of_day\n change_local(hour: 0, min: 0, min: 0)\n end",
"def end_of_hour\n change(:min => 59, :sec => 59)\n end",
"def start\n update(underway_at: Time.current)\n end",
"def hour_out\n @hour_out ||= time_out.hour\n end",
"def start_time\n date.to_time + kickoff_time.hour.hours\n end",
"def set_default_times\n if !self.start\n return\n end\n\n if self.start.hour == 0 # hour set to 0 if not otherwise defined...\n self.start = self.start + 9.hours\n end\n\n if !self.end\n if self.online?\n self.end = self.start + 1.hour\n else\n diff = 17 - self.start.hour\n self.end = self.start + diff.hours\n end\n end\n # TODO: Set timezone for online events. Where to get it from, though?\n # TODO: Check events form to add timezone autocomplete.\n # Get timezones from: https://timezonedb.com/download\n\n end",
"def adjust_for_happy_hour(preference)\n\n\t\tif($happy_hour and preference.quantity >= 2)\n\t\t\tpreference.price = preference.price/2\n\t\t\tpreference.save\n\t\t\tself.price -= preference.price\n\t\tend\n\n\t\tself.hh_flag = $happy_hour\n\n\t\tself.save\n\tend",
"def ding &block\n tund = Time.new.hour\n tund.times do\n block.call \n end\nend",
"def hungry?(time_of_day_in_hours)\n if time_of_day_in_hours < 12\n puts \"Me not hungry.\"\n\tfalse\n else\n puts \"Me hungry.\"\n true\n end\nend",
"def opening_hour\n 11\n end",
"def tomorrow\n advance(days: 1)\n end",
"def processing_hub_24h?\n (dhs_pending? || ssa_pending?) && (workflow_state_transitions.first.transition_at + 24.hours) > DateTime.now\n end",
"def opening(day)\n Time.now.utc.midnight\n .advance(seconds: opening_second(day)).strftime('%H:%M')\n end",
"def extendbyfourteendays\n updated_at = Time.now\n end",
"def set_happy_hour\n @happy_hour = HappyHour.find(params[:id])\n end",
"def reset_date_for_time_now\n reset_date_for_time Time.now\n end",
"def day_changed?\n self.day != (self-1.hour).day\n end",
"def set_new_time\n @dt_in = time_in.to_datetime\n update_column(:time_in, @dt_in.change(hour: hour_in.to_i, min: min_in.to_i))\n \n @dt_out = time_out.to_datetime\n update_column(:time_out, @dt_out.change(hour: hour_out.to_i, min: min_out.to_i))\n end",
"def sleep_hours(db, current_date, current_hours, current_refreshed)\n db.execute(\"CREATE TABLE IF NOT EXISTS log (id INTEGER PRIMARY KEY, date VARCHAR (255), hours INTEGER, refreshed BOOLEAN)\")\n db.execute(\"INSERT INTO log (date, hours, refreshed) VALUES (?, ?, ?)\", [current_date, current_hours, current_refreshed])\nend",
"def time_greetings\n if 5 <= Time.now.hour && Time.now.hour <= 12 \n puts \"good morning!\"\nelsif 12 <= Time.now.hour && Time.now.hour <= 18 \n puts \"good afternoon!\"\nelsif 18 <= Time.now.hour && Time.now.hour <= 20 \n puts \"good evening!\"\nelsif 20 <= Time.now.hour || Time.now.hour <= 5\n puts \"salutations comrade!\"\n end\nend",
"def next_hour(time, time_source = nil)\n seconds_left = time.to_i % 3600\n \n time + (seconds_left > 0 ? seconds_left : 3600)\n end",
"def first_hour\n\t\tday_begins_at.strftime '%l%P'\n\tend",
"def push_next_try_at\r\n self.next_try_at = 15.minutes.from_now\r\n end",
"def lead_time\n 1\n end",
"def add_time\n if (date.hour == 0 or date.hour == 12) and date.min == 0 and date.sec == 0\n self.date = date + id \n end\n end",
"def modify_time(); @modify_time ||= Time.now; end",
"def this_hour\n hour(Time.now)\n end",
"def next_alert_time\n false\n end",
"def midnight_tonight\n (Time.now.to_date + 1).to_time\nend",
"def reschedule_at(current_time, attempts)\n current_time + ((attempts**4) + 1).hours\n end",
"def grandfather_clock &block\n current_hour = Time.new.hour\n if current_hour > 12\n current_hour = current_hour - 12\n current_hour.times do\n block.call\n end\n else\n current_hour.times do\n block.call\n end\n end\nend",
"def hours?\n @name == :hourly\n end",
"def enter_service(time)\n self.entered_service_at = time\n end",
"def advance_hours(hours)\n self + (hours * 60 * 60)\n end",
"def setHour(hour)\r\n\t\t\t\t\t@hour = hour\r\n\t\t\t\tend",
"def do_cash\n self.cashed_at = Time.now.utc\n end",
"def hour_thc\n hour = @t_hour\n hour -= 12 if hour > 12\n return hour\n end",
"def grandfather_clock &block\n hour = Time.new.hour\n if hour >= 13\n hour = hour - 12\n end\n if hour == 0\n hour = 12\n end\n hour.times do\n block.call\n end\nend",
"def modificar_hora\n # Hacemos la resta de horas que se solicita\n @tiempo = @tiempo + @zone.hour\n # Formateamos para el standar que se solicita\n @tiempo = @tiempo.strftime(\"%H:%M:%S\")\n # Devolvemos el json con un status 200\n render json: {response:{time: @tiempo, timezone: \"utc\"}}, status: :ok\n end",
"def timeless\n self.class.timestamping = false\n self\n end",
"def nap\n @awake = false\n time_passed\nend",
"def time_to_solve\n 1.hour\n end",
"def story_time\n touch(@@detailsheader)\n sleeper(30)\n end",
"def shared_time_off=(value)\n @shared_time_off = value\n end",
"def time_to_solve\n self.kase && self.kase.time_to_solve ? self.kase.time_to_solve : 1.hour\n end",
"def ready_time(time=Time.now)\n if time.hour >= 17 || time.hour < 8\n time.strftime(\"PT08H00M\")\n else\n time.strftime(\"PT%HH%MM\")\n end\n end",
"def set_mtimes(times)\n pm = false\n _24hr = true\n\n times_24 = []\n now = Time.now\n \n #convert to '24hr' for consistency\n #start backwards to make sure its am or pm\n times.reverse_each do |t|\n\n hr, min = t[0].to_s.split(':', 2)\n\n #change to pm\n if (min.include?(\"pm\"))\n pm = true\n _24hr = false\n end\n\n #change from pm to am\n if (min.include?(\"am\") && !_24hr)\n pm = false\n end\n\n #only am start - hackish\n if (min.include?(\"am\") && times.length < 3)\n _24hr = false\n end\n\n if (_24hr)\n augment =0\n if (hr.to_i == 12)\n augment = 12\n end\n\n t = Time.new(now.year, now.month, now.day,\n hr.to_i - augment, min[/[0-9]+/]) + 24*60*60 #add a day\n elsif (pm)\n augment = 0\n if hr.to_i != 12\n augment = 12\n end\n t = Time.new(now.year, now.month, now.day,\n hr.to_i + augment, min[/[0-9]+/])\n\n elsif (!pm & !_24hr)\n t = Time.new(now.year, now.month, now.day,\n hr.to_i, min[/[0-9]+/])\n end\n\n=begin\n #midnight seems to be latest\n if ((!pm && min.include?(\"am\") && hr.to_i == 12) ||\n ((!pm && hr.to_i == 12)))\n \n t = Time.new(now.year, now.month, now.day,\n hr.to_i - 12, min[/[0-9]+/]) + 24*60*60 #add a day\n\n elsif (!pm && min.include?(\"am\"))\n pm = false\n\n t = Time.new(now.year, now.month, now.day,\n hr.to_i, min[/[0-9]+/])\n\n elsif (pm || min.include?(\"pm\"))\n pm = true\n augment = 0\n if (hr.to_i != 12)\n augment = 12\n end\n\n t = Time.new(now.year, now.month, now.day,\n hr.to_i + augment, min[/[0-9]+/])\n\n end\n=end\n times_24.push t\n end\n\n self.mtimes = times_24\n\n end",
"def set_date\n gon.time_period = @verdict.time_period.strftime('%m/%d/%Y %H:%M') if [email protected]_period.nil?\n end",
"def remember_me_for(time)\n time = time / Merb::Const::DAY\n remember_me_until (DateTime.now + time)\n end",
"def end_of_hour\n change(min: 59, sec: 59.999)\n end",
"def tomorrow?\n time.tomorrow?\n end",
"def time_date_hm ; time_date && time_date.strftime(\"%H:%M\") ; end",
"def business_hours_later( hours)\n now = Time.now # freeze it here for this cycle of call, or it keeps changing every second\n wanted = (hours.to_i.hours / 1.second) # convert hours to seconds\n available = available_work_seconds( now) # how much available today\n # if we have enough time today, just tell the time possible today\n # if we will run out of time today, check next working day, add run-over seconds to the start-of-day\n (available > wanted) ? ( now + wanted.seconds) : ( next_workday(now) + (wanted - available).seconds)\n end",
"def grandfather_clock(&block)\n\tcurrent_hour = Time.now.hour\n\tif current_hour == 0\n\t\tcurrent_hour = 12\n\telsif current_hour >= 13\n\t\tcurrent_hour -= 12\n\tend\n\n\tcurrent_hour.times do\n\t\tblock.call\n\tend\nend",
"def add_hours(hours = 1)\n hours = hours.to_i\n cur_hour = @t_hour\n next_hour = cur_hour + hours\n \n if next_hour >= 24\n @t_hour = 0\n self.add_days(1)\n hours_left = (hours - 1) - (24 - cur_hour)\n self.add_hours(hours_left) if hours_left > 0\n elsif next_hour < 0\n @t_hour = 23\n self.add_days(-1)\n hours_left = hours + cur_hour + 1\n self.add_hours(hours_left) if hours_left < 0\n else\n @t_hour = next_hour\n end\n \n return self\n end",
"def update\r\n return if $BTEST\r\n @time = $game_variables[LTS::TIME_VARIABLE_ID]\r\n if @time >= 1440\r\n @time %= 1440\r\n end\r\n @hour = @time/60\r\n @minute = @time%60\r\n $game_variables[LTS::HOUR_VARIABLE_ID] = @hour unless LTS::HOUR_VARIABLE_ID == nil\r\n $lts_time = sprintf(\"%02d:%02d\", @hour, @minute)\r\n if $lts_event_tone\r\n update_tone(0) if $lts_map_data[$game_map.map_id].part_outside?\r\n else\r\n $game_map.screen.start_tone_change(Tone.new(0,0,0,0),0)\r\n update_tone(0) if $lts_map_data[$game_map.map_id].outside?\r\n end\r\n end"
]
| [
"0.6659656",
"0.65116674",
"0.6474604",
"0.64349383",
"0.64174885",
"0.639536",
"0.63817996",
"0.63180625",
"0.63003594",
"0.63003594",
"0.62766516",
"0.62766516",
"0.6272764",
"0.61520207",
"0.61097425",
"0.60934424",
"0.60471153",
"0.6046477",
"0.60246766",
"0.60157883",
"0.59709436",
"0.59645396",
"0.59645396",
"0.5939283",
"0.5939283",
"0.5932722",
"0.5930478",
"0.59163713",
"0.5909747",
"0.59070444",
"0.5893009",
"0.58743423",
"0.586421",
"0.585798",
"0.58509487",
"0.58353204",
"0.58277047",
"0.581333",
"0.5787432",
"0.5776019",
"0.5768973",
"0.57657707",
"0.5747009",
"0.57467973",
"0.5742619",
"0.57334876",
"0.573078",
"0.5726867",
"0.5725678",
"0.5724882",
"0.5722402",
"0.5689732",
"0.56779754",
"0.56678784",
"0.5656873",
"0.5656316",
"0.5648438",
"0.56446695",
"0.5632802",
"0.5620499",
"0.56154317",
"0.55919343",
"0.55895275",
"0.5580389",
"0.55709755",
"0.55699164",
"0.55610114",
"0.5551238",
"0.5550284",
"0.55469406",
"0.554103",
"0.55386585",
"0.5537285",
"0.5536985",
"0.5529671",
"0.5525109",
"0.5505291",
"0.5501097",
"0.5489198",
"0.54827285",
"0.5474617",
"0.54731345",
"0.5472434",
"0.54589474",
"0.54573226",
"0.5448816",
"0.5445737",
"0.54402924",
"0.54383016",
"0.5437779",
"0.5437757",
"0.54346514",
"0.5433585",
"0.5432411",
"0.5430665",
"0.5430455",
"0.54235166",
"0.5421797",
"0.541067",
"0.5409295",
"0.54070747"
]
| 0.0 | -1 |
POST /api/rests POST /api/rests.jsonb | def create
unless @rest = Rest.where(["report_id = ? AND ended_at IS NULL", params[:report_id]]).first
@rest = Rest.new(:report_id => params[:report_id],
:latitude => params[:latitude],
:longitude => params[:longitude],
:address => params[:address],
:started_at => Time.now()
)
end
respond_to do |format|
if @rest.save
@json = Hash[:rest => {
:id => @rest.id,
:report_id => @rest.report_id,
:latitude => @rest.latitude,
:longitude => @rest.longitude,
:address => @rest.address,
:started_at => @rest.started_at
}]
format.json { render json: @json, status: :created, location: @json }
else
format.json { render json: {:error => "Rest creation faild."}, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(url, data)\n RestClient.post ENV['APIBASE']+url, data, :content_type => :json\nend",
"def create\n @rest = Rest.new(rest_params)\n @rest.owners << current_owner\n respond_to do |format|\n if @rest.save\n format.html { redirect_to @rest, notice: 'Rest was successfully created.' }\n format.json { render :show, status: :created, location: @rest }\n else\n format.html { render :new }\n format.json { render json: @rest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rest_create(path, options={}, &blk)\n # Create\n post path do\n @object = yield\n rest_params.each { |k, v| @object.send :\"#{k}=\", v }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object.to_hash\n end\n end",
"def post_rest_api(endpoint, data, http)\n rest_api_endpoint = \"/classifier-api/v1/#{endpoint}\"\n\n # Create an HTTP POST request against the specified REST API endpoint\n request = Net::HTTP::Post.new(rest_api_endpoint)\n # Set the Content-Type and data of the HTTP POST request\n request.content_type = \"application/json\"\n request.body = data\n # Submit the request\n response = http.request(request)\n # Return the response bosy (JSON containing the result of the POST operation)\n response.body\nend",
"def rest_post(base_uri,json_payload,params)\n begin\n puts base_uri,json_payload\n @response = RestClient.post(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end",
"def post_data(body)\r\n raise ConfigError, 'no json_records' if body.empty?\r\n # Create REST request header\r\n header = get_header(body.bytesize)\r\n # Post REST request \r\n response = RestClient.post(@uri, body, header)\r\n\r\n return response\r\n end",
"def create(bin_params)\n @rest.post('save', bin_params)\n end",
"def post(endpoint, options)\n #Send request\n res = RestClient.post endpoint,\n options,\n content_type: :json\n\n #Process and return response\n return JSON.parse(res.body, object_class: OpenStruct)\nend",
"def post(*args)\n super(*wrap_for_json_api(*args))\n end",
"def rest_params\n params.require(:rest).permit(:name, :address, :description, :owner, :phone)\n end",
"def rest_endpoint; end",
"def data_to_api(snack_name, snack_location, snack_optional)\n RestClient.post ENV['NERDERY_API'], { name: snack_name,\n location: snack_location,\n optional: snack_optional\n }.to_json, content_type: :json\n end",
"def create\n seth_server_rest.post_rest(\"data\", self)\n self\n end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"def r(*args)\n @contents << Rest.new(*args)\n end",
"def rest_end_point; end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def test_create_transaction\n params = {\n bank_transaction: {\n bank_account_id: 1,\n date: Time.local(2012, 4, 16),\n amount: 55\n }\n }\n\n post '/api/banks/1/transactions', params\n data = ActiveSupport::JSON.decode last_response.body\n\n assert last_response.successful?\n assert_match('application/json', last_response.content_type)\n assert BankTransaction.find(data['id'])\n end",
"def add_weather_by_rest(auth,weather_json)\n rest_agent=RestClient::Resource.new(\"http://#{auth[:host]}:#{auth[:port]}/#{auth[:reststr]}/ry/weather\")\n rest_agent.post(weather_json, :content_type=>\"application/json;charset=utf-8\")\n end",
"def resource_way\n # TODO: make json default format?\n\n # try resource style\n #resources = RestClient::Resource.new(\"#{BASE_URL}/#{RESOURCE_NAME}\", \n #'[email protected]', 'please') #, :accept => :json)\n resources = RestClient::Resource.new(\"#{BASE_URL}/#{RESOURCE_NAME}\", 'b4j5qBqzYx5EukCM3Vri') #token\n # \n response = resources.get(:accept => :json)\n all_hosts = JSON.parse(response)\n puts \"EXISTING HOSTS: \" + all_hosts.inspect\n\n new_opts = {\n \"host_name\" => \"damian.np.dc1.eharmony.com\",\n \"alias\" => \"damian.np.dc1.eharmony.com\",\n \"address\" => \"damian.np.dc1.eharmony.com\",\n \"max_check_attempts\" => 3,\n \"notification_interval\" => 5,\n # 24x7\n \"notification_period\" => \"24x7\",\n #\"notification_period_id\" => \"5050cb9ebfa68e0903000001\",\n # 24x7\n \"check_period\" => \"24x7\",\n #\"check_period_id\" => \"5050cb9ebfa68e0903000001\",\n # just using first contact\n #\"contacts\" => [\"pat-obrien\"],\n \"contacts\" => [\"damian\"],\n #\"contact_ids\" => [\"5051283ebfa68e5757000002\"],\n }\n\n\n #puts resources['new'].post(NEW_OPTS.to_json, :content_type => :json, :accept \n #=> :json )\n # NOTE: even though this works and creates a new Host in DB - i still get 406 \n # Not Acceptable response\n #puts resources['new'].post({ RESOURCE_NAME.to_s => new_opts}, :accept => \n #:json )\n begin\n puts resources['new'].post({ RESOURCE_NAME.to_s => new_opts})\n rescue Exception => e\n puts \"ERROR: #{e} = #{e.inspect}\"\n end\n\n \n\n # now edit the resource ...\nend",
"def post url, payload\n RestClient::Request.execute(:method => :post, :url => url, :payload => payload, :headers => lbaas_headers, :timeout => @timeout, :open_timeout => @open_timeout)\n end",
"def post(href, additional_parameters = {})\n rest_connect do |base_uri, headers|\n href = \"#{base_uri}/#{href}\" unless begins_with_slash(href)\n res = Net::HTTP::Post.new(href , headers)\n unless additional_parameters.empty?\n res.set_content_type('application/json')\n res.body = additional_parameters.to_json\n end\n #res.set_form_data(additional_parameters, '&')\n res\n end\n end",
"def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts JSON.pretty_generate(result)\n result\nend",
"def post_json(location, json_data)\n response = RestClient::Request.new(\n :method => :post,\n :url => location,\n :user => $username,\n :password => $password,\n :headers => { :accept => :json,\n :content_type => :json},\n :payload => json_data\n ).execute\n results = JSON.parse(response.to_str)\n end",
"def post_json(location, json_data)\n response = RestClient::Request.new(\n :method => :post,\n :url => location,\n :user => $username,\n :password => $password,\n :headers => { :accept => :json,\n :content_type => :json},\n :payload => json_data\n ).execute\n results = JSON.parse(response.to_str)\n end",
"def post(path_part, payload, additional_headers = {}, &block)\n api_request { @rest.post('/REST/' + path_part, payload.to_json, additional_headers, &block) }\n end",
"def create\n @resto = Resto.new(resto_params)\n\n respond_to do |format|\n if @resto.save\n format.html { redirect_to @resto, notice: 'Entry was successfully created.' }\n format.json { render :show, status: :created, location: @resto }\n else\n format.html { render :new }\n format.json { render json: @resto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rest_api_params\n params.require(:rest_api).permit(:name, :request, :response, :method, :http_status_code, :webservice_id)\n end",
"def post_to_solr(params,commit=true)\n url=\"#{Blacklight.default_index.connection.options[:url]}/update?commit=#{commit}\"\n RestClient.post url, params,:content_type => :json, :accept=>:json\n end",
"def create\n #TODO we need to look into the need for transactions in mongodb\n #Api::V1::Result.with_session do |session|\n #session.start_transaction\n @results = []\n result_params = params.fetch(:result, {})\n\n result_params.each do |rp|\n permitted_rp = rp.permit(*Api::V1::Result::STRONG_PARAMETERS)\n result = Api::V1::Result.new(permitted_rp)\n result.save!\n\n @results << result\n end\n\n #session.commit_transaction\n #end\n\n render json: @results\n end",
"def add_weather_by_rest(auth,weather_json)\n rest_agent=RestClient::Resource.new(\"http://#{auth[:host]}:#{auth[:port]}/#{auth[:reststr]}/ry/weather\")\n rest_agent.post(weather_json, :content_type=>\"application/json;charset=utf-8\")\n end",
"def post_api(path, params={}, headers={})\n headers.merge!('CONTENT_TYPE' => \"application/json\")\n post path, params, headers\nend",
"def create\n @restconnection = Restconnection.new(restconnection_params)\n\n respond_to do |format|\n if @restconnection.save\n format.html { redirect_to @restconnection, notice: 'Restconnection was successfully created.' }\n format.json { render :show, status: :created, location: @restconnection }\n else\n format.html { render :new }\n format.json { render json: @restconnection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{uri}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend",
"def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend",
"def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids','itemids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end",
"def test_post_request_collection\n params = {\n size: 3,\n employmentTypeUris: ['/dk/atira/pure/person/employmenttypes/academic'],\n employmentStatus: 'ACTIVE'\n }\n response = client.persons.all_complex params: params\n assert_equal response.code, 200\n assert_instance_of HTTP::Response, response\n end",
"def post\n Salesforce.set_http(session[:accesstoken], session[:accessurl])\n \t@response = Salesforce.create_post(params)\n \trespond_to do |format|\n format.json { render :json => @response.to_json}\n # example of multiple reponses mapped to one object\n # format.json { render :json => {:data => @response, :meta => @describe}.to_json}\n \tend\n end",
"def create\n @webservice = Webservice.find(params[:webservice_id])\n @rest_api = @webservice.rest_apis.create(rest_api_params)\n redirect_to webservice_path(@webservice)\n end",
"def add_arrays_to_tenant(args = {}) \n post(\"/tenants.json/#{args[:tenantId]}/arrays\", args)\nend",
"def post_json(path, body)\n uri = build_uri(path)\n #puts \"🤖 POST #{path}\"\n #puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n #puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n #puts result[:result]\n result\nend",
"def api_gateway_post(path, params)\n api_gateway_body_fwd = params.to_json\n rack_input = StringIO.new(api_gateway_body_fwd)\n\n post path, real_params = {}, 'rack.input' => rack_input\nend",
"def post(json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name].compact.join('/')\n url += \"/\"\n return HTTParty.post(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"def post options\n rest_request({ method: :post }.merge(options))\n end",
"def post options\n rest_request({ method: :post }.merge(options))\n end",
"def service_type_name\n \"REST\"\n end",
"def POST; end",
"def http_post(uri, data)\n RestClient.post uri, data\n end",
"def post(url, query = {}, payload = {})\n restclient({\n method: :post,\n url: \"#{@scheme}://#{@host}/#{url}\",\n timeout: Timeout,\n open_timeout: OpenTimeout,\n payload: payload.to_json,\n headers: {\n authorization: @auth,\n content_type: :json,\n accept: :json,\n params: query\n }\n })\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def post_json(path, body)\n uri = build_uri(path)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n result = JSON.parse(response.body)\n puts result\n result\nend",
"def create\n #@widget.valid?\n request_body_Data= '{ \"widget\":\n {\n \"name\" : \"'+widget_params[:name]+'\",\n \"description\" : \"'+widget_params[:description]+'\",\n \"kind\" : \"'+widget_params[:kind]+'\"\n }}'\n response = RestClient::Request.new({\n method: :post,\n url: ENV['API_URL'] + '/widgets',\n payload: request_body_Data,\n headers: { Authorization: session[:access_token], content_type: 'application/json'}\n }).execute do |response, request, result|\n case response.code\n when 400\n [ :error, JSON.parse(response) ]\n when 200\n [ :success, JSON.parse(response) ]\n json=JSON.parse(response)\n @widget= Widget.new do |widget|\n widget.id=json[\"data\"][\"widget\"][\"id\"]\n widget.name=json[\"data\"][\"widget\"][\"name\"]\n widget.description=json[\"data\"][\"widget\"][\"description\"]\n widget.kind=json[\"data\"][\"widget\"][\"kind\"]\n widget.userid=json[\"data\"][\"widget\"][\"user\"][\"id\"]\n widget.username=json[\"data\"][\"widget\"][\"user\"][\"name\"]\n widget.owner=json[\"data\"][\"widget\"][\"owner\"]\n end\n else\n fail \"Invalid response #{response.to_str} received.\"\n end\n end\n\n respond_to do |format|\n if @widget\n format.html { redirect_to @widget, notice: 'Widget was successfully created.' }\n format.json { render :show, status: :created, location: @widget }\n else\n format.html { render :new }\n format.json { render json: @widget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rb = Rb.new(rb_params)\n respond_to do |format|\n if @rb.save\n format.html { redirect_to rbs_path, notice: 'Erfolgreich erstellt.' }\n format.json { render :show, status: :created, location: @rb }\n else\n format.html { render :new }\n format.json { render json: @rb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rest_post\n ##define the url path\n url =\"/post\"\n ##This is headers definition.\n headers = [\n ['Cached-Control', \"no-cache\" ],\n [\"Content-Type\", \"application/x-www-form-urlencoded; charset=UTF-8\"]\n ]\n input_body = {\"test_key\" =>\"test_value\"}\n\n begin\n #------------------------\n #Send Post Request\n #------------------------\n request, response = send_post(url, input_body.to_json, headers)\n\n if response.code.to_i == 200\n actual_value =JSON.parse(response.body)\n ## return the value need to be validated\n actual_value = actual_value['form']\n return actual_value.to_json\n else\n return false\n end\n rescue Exception => ex\n @log.error \"#### Response code is: #{response.code} #####\"\n @log.error ex.message\n puts \"#### Response code is: #{response.code} #####\"\n puts ex.message\n return false\n end\n end",
"def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end",
"def api_gateway_post(path, params)\n api_gateway_body_fwd = params.to_json\n rack_input = StringIO.new(api_gateway_body_fwd)\n\n post path, real_params = {}, {\"rack.input\" => rack_input}\nend",
"def rest_endpoint=(_arg0); end",
"def serialize_json(o)\n API_CLIENT.object_to_http_body(o)\nend",
"def post\n RestClient.post(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def convert_with_rest!(*args)\n raise NotImplementedError, \"Convert with rest not supported on platform.\"\n end",
"def post(url, payload, headers={})\n payload = MultiJson.encode(payload)\n headers = headers.merge({:content_type => 'application/json'})\n request(:post, url, payload, headers)\n end",
"def postEntityBulkJson( data)\n params = Hash.new\n params['data'] = data\n return doCurl(\"post\",\"/entity/bulk/json\",params)\n end",
"def create_rest\n @entry_item = EntryItem.new(params[:entry_item])\n\n respond_to do |format|\n if @entry_item.save\n flash[:notice] = 'EntryItem was successfully created.'\n #format.html { redirect_to(@entry_item) }\n format.xml { render :xml => @entry_item, :status => :created, :location => @entry_item }\n else\n #format.html { render :action => \"new\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def rest_params\n params.require(:rest).permit(:restaurant_name, :meal_name, :meal_price,\n :restaurant_area, :restaurant_address, :cuisine_type, :picture )\n end",
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"def sensor_list\n #this is making a post request by intializing the restclient gem with RestClient::Request.new to get sensors list\n #if the call is successful it provide the response.body\n #if fails and returns a 400 with the error.\n response = RestClient::Request.new({\n method: :post,\n url:\"https://api.samsara.com/v1/sensors/list?access_token=#{Rails.application.credentials.secret_key}\",\n payload:{ \"groupId\": 32780 }.to_json,\n headers: { :accept => :json, content_type: :json }\n }).execute do |response, request, result|\n case response.code\n when 400\n [ :error, (response.to_json) ]\n when 200\n [ :success, (response.to_json) ]\n else\n fail \"Invalid response #{response} received.\"\n end\n # here I setting the body to an elemnet that will be availble in the views.\n @sensor_list = response.body\n end\n end",
"def post(path, params={})\n RestClient.post request_base+path, params\n end",
"def created(object)\n render json: object, status: 201\n end",
"def create\n @restora = Restora.new(restora_params)\n\n respond_to do |format|\n if @restora.save\n format.html { redirect_to @restora, notice: 'Restora was successfully created.' }\n format.json { render :show, status: :created, location: @restora }\n else\n format.html { render :new }\n format.json { render json: @restora.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(url)\n response = RestClient::Request.new(\n method: :post,\n url: \"#{ENDPOINT_URL}/#{url}\",\n verify_ssl: false,\n headers: {\n 'Content-Type' => 'application/json',\n 'Authorization' => \"Basic #{authorization_hash}\"\n },\n payload: {user: user, pwd: password}.to_json\n ).execute\n\n # Parse the response to Ruby objects\n JSON.parse(response)\n end",
"def create_recipe_request(version, auth_headers, data = {})\n post \"/api/recipes\", params: data, headers: {'Content-Type' => \"application/json\", 'Accept' => \"application/vnd.ink.#{version}\" }.merge(auth_headers)\nend",
"def post(endpoint, body, headers = {})\n headers = { accept: :json, content_type: :json }.merge(headers)\n @rest_resource[endpoint].post body, headers\n end",
"def post_route(payload)\n with_rescue do\n payload = payload.to_json if payload.is_a?(Hash)\n connection.post do |request|\n request.url routes_path\n request.body = payload\n request.headers['Content-Type'] = 'application/json'\n end\n end\n end",
"def post(api, params)\n url2json(:POST, \"#{@endpoint}#{api}\", params)\n end",
"def create_rest\n @item_usage = ItemUsage.new(params[:item_usage])\n\n respond_to do |format|\n if @item_usage.save\n flash[:notice] = 'ItemUsage was successfully created.'\n format.html { redirect_to(@item_usage) }\n format.xml { render :xml => @item_usage, :status => :created, :location => @item_usage }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post(data)\n jss = self.get_structure() # For referencing purposes\n\n input = self.query_to_hash(data)\n bad_request = false\n resp = nil\n jss.each do |key, value|\n # Check if we have it on the query too\n unless input.has_key? key\n resp = MIDB::Interface::Server.json_error(400, \"Bad Request - Not enough data for a new resource\")\n @engine.http_status = 400\n bad_request = true\n end\n end\n input.each do |key, value|\n # Check if we have it on the structure too\n unless jss.has_key? key\n resp = MIDB::Interface::Server.json_error(400, \"Bad Request - Wrong argument #{key}\")\n @engine.http_status = 400\n bad_request = true\n end\n end\n \n\n # Insert the values if we have a good request\n unless bad_request\n fields = Hash.new\n inserts = Hash.new\n main_table = self.get_structure.values[0].split('/')[0]\n input.each do |key, value|\n struct = jss[key]\n table = struct.split(\"/\")[0]\n inserts[table] ||= []\n fields[table] ||= []\n inserts[table].push \"\\\"\" + value + \"\\\"\"\n fields[table].push struct.split(\"/\")[1]\n if struct.split(\"/\").length > 2\n match = struct.split(\"/\")[2]\n matching_field = match.split(\"->\")[0]\n row_field = match.split(\"->\")[1]\n fields[table].push matching_field\n if @engine.config[\"dbengine\"] == :mysql\n inserts[table].push \"(SELECT #{row_field} FROM #{main_table} WHERE id=(SELECT LAST_INSERT_ID()))\"\n else\n inserts[table].push \"(SELECT #{row_field} FROM #{main_table} WHERE id=(last_insert_rowid()))\"\n end\n end\n end\n queries = [] \n inserts.each do |table, values|\n queries.push \"INSERT INTO #{table}(#{fields[table].join(',')}) VALUES (#{inserts[table].join(',')});\"\n end\n # Connect to the database\n dbe = MIDB::API::Dbengine.new(@engine.config, @db)\n dblink = dbe.connect()\n results = []\n rid = nil\n # Find the ID to return in the response (only for the first query)\n queries.each do |q|\n results.push dbe.query(dblink, q)\n if @engine.config[\"dbengine\"] == :mysql\n rid ||= dbe.extract(dbe.query(dblink, \"SELECT id FROM #{main_table} WHERE id=(SELECT LAST_INSERT_ID());\"), \"id\")\n else\n rid ||= dbe.extract(dbe.query(dblink, \"SELECT id FROM #{main_table} WHERE id=(last_insert_rowid());\"), \"id\")\n end\n end\n @engine.http_status = \"201 Created\"\n resp = {status: \"201 created\", id: rid}\n end\n return resp\n end",
"def json_create(resource_params, resource_model)\n resource_obj = resource_model.new(resource_params)\n if resource_obj.save\n return render json: resource_obj, status: :ok\n else\n return render json: resource_obj.errors, status: :unprocessable_entity\n end\n end",
"def create\n streak, success = jsonapi_create.to_a\n\n if success\n render_jsonapi(streak, scope: false)\n else\n render_errors_for(streak)\n end\n end",
"def post\n resource.post(request, response)\n end",
"def rest_production(verb, url, payload)\n response = RestClient.send(verb, url, payload, request_headers)\n log_info(\"Response #{response.code}:\\n#{response.body.inspect}\\n\")\n response.code\n end",
"def create\n respond_to do |format|\n require 'rest-client'\n response = RestClient.post('localhost:3001/colores/', color_params.as_json, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'})\n if response.code == 200\n @color = JSON.parse(response.body)\n format.html { redirect_to @color, notice: \"Color was successfully created.\" }\n format.json { render :show, status: :created, location: @color }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post endpoint, data\n do_request :post, endpoint, data\n end",
"def consume_rest; end",
"def batch(*requests)\n body = requests.map do |request|\n {method: request[0], params: request[1..-1], jsonrpc: '2.0', id: SecureRandom.uuid}\n end\n parsed_response = parse_response(post(body))\n errors = parsed_response.select{|response| response[:error]}\n raise Error, errors if !errors.empty?\n parsed_response.map{|response| response[:result]}\n end",
"def create\n res = self.class.post('/', body: attrs)\n res.created?\n end",
"def create(object, path = nil)\n to_ostruct(post(sanitize!(path), object.to_json))\nend",
"def post(path, params={})\n params[:apikey] = self.api_key\n RestClient::Request.execute(\n :method => :post,\n :url => \"#{self.uri}#{path}\",\n :headers=> {},\n :payload=> params,\n :verify_ssl=> @ssl_verify )\n end",
"def create\n @rrb = Rrb.new(rrb_params)\n\n respond_to do |format|\n if @rrb.save\n format.html { redirect_to @rrb, notice: 'Rrb was successfully created.' }\n format.json { render :show, status: :created, location: @rrb }\n else\n format.html { render :new }\n format.json { render json: @rrb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def handle_post()\n make_response(201, \"New resource created\")\nend",
"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 create\n @api_book = Api::Book.new(api_book_params)\n\n if @api_book.save\n render json: @api_book, status: :created, location: @api_book\n else\n render json: @api_book.errors, status: :unprocessable_entity\n end\n end",
"def post(path, json, params = {})\n if path.include?('covid19')\n request = Net::HTTP::Post.new(path, @headers)\n else\n request = Net::HTTP::Post.new('/v2' + path, @headers)\n end\n request.add_field('Content-Type', 'application/json')\n request.body = json\n params.each do |k, v|\n request[k] = v\n end\n send_request(request)\n end",
"def list_instances\n puts \"OK, Listing instances..\"\n\n response = RestClient.post( \n $uri,\n 'Version' => '2010-12-30',\n 'ACSAccessKeyId' => $ACSAccessKeyId,\n 'Format' => 'json',\n 'Timestamp' => $current_time,\n 'Rndguid' => $rndguid,\n 'Signature' => calculate_signature($api_private_key, $rndguid, $current_time),\n 'Action' => \"list-instances\")\n\n puts response\n puts response.code\nend",
"def post_check(excon, body)\n excon.request(\n method: :post,\n path: '/check',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend",
"def create\n @restroom = Restroom.new(restroom_params)\n\n respond_to do |format|\n if @restroom.save\n format.html { redirect_to @restroom, notice: 'Restroom was successfully created.' }\n format.json { render action: 'show', status: :created, location: @restroom }\n else\n format.html { render action: 'new' }\n format.json { render json: @restroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n s = Spooge.new()\n create_status = s.save\n n = generate_random_name\n s.name = n\n s.email = \"#{n}@gmail.com\"\n s.touch_date = DateTime.now\n s.status = STATUS[rand(STATUS.length)]\n\n resp = {:create_status => create_status, :record => s}\n render :json => resp\n end",
"def index\n @service_bookings = ServiceBooking.all\n\n render json: @service_bookings\n end",
"def create\n #bird name must be present\n if params[:name].blank?\n render json: {\n status: 400,\n message: \"Fågelns namn måste anges.\" \n }\n end\n \n #latin name must be present\n if params[:latin].blank?\n render json: {\n status: 400,\n message: \"Fågelns latinska namn måste anges.\" \n }\n end\n \n #regularity must be present\n if params[:regularity].blank?\n render json: {\n status: 400,\n message: \"Fågelns regularitet måste anges.\" \n }\n end\n \n #check if bird already exists\n if Api::V1::Bird.exists?(:bird_name => params[:name])\n render json: {\n status: 400,\n message: \"Fågeln finns redan\" \n }\n else\n @bird = Api::V1::Bird.create(:bird_name => params[:name], :latin_name => params[:latin], :regularity => params[:regularity])\n render json: {\n status: 201,\n message: \"Fågeln är registrerad och finns nu i listan.\", \n bird: Api::V1::BirdSerializer.new(@bird) \n }\n end\n end",
"def createLeadFromRestApi() \n payload = @testDataJSON['LeadJSON'][0] \n puts \"*********************************\"\n puts payload.to_json\n puts \"*********************************\"\n\n getResponse = @objSFRest.postData(''+payload.to_json,\"#{@testDataJSON['ServiceURL'][0]['inboundlead']}\")\n puts \"*********************************\"\n puts getResponse\n puts \"*********************************\"\n return getResponse['lead_sfid']\n end",
"def build_rest(rest_resource, rest_action, rest_payload = nil, rest_auth_type = 'basic', rest_verify_ssl = false)\n # set rest url\n rest_url = URI.join(@rest_base_url, rest_resource).to_s\n log(:info, \"Used rest_base_url: <#{@rest_base_url}>, and rest_resource: <#{rest_resource}>, to generate rest_url: <#{rest_url}>\")\n\n # set params for api call\n params = {\n :method => rest_action,\n :url => rest_url,\n :verify_ssl => rest_verify_ssl,\n :headers => {\n :content_type => @rest_content_type,\n :accept => @rest_return_type\n }\n }\n\n # set the authorization header based on the type requested\n if rest_auth_type == 'basic'\n params[:headers][:authorization] = \"Basic #{Base64.strict_encode64(\"#{@rest_api_user}:#{@rest_api_password}\")}\"\n else\n #\n # code for extra rest_auth_types goes here. currently only supports basic authentication\n #\n end\n\n # generate payload data\n if @rest_content_type.to_s == 'json'\n # generate our body in JSON format\n params[:payload] = JSON.generate(rest_payload) unless rest_payload.nil?\n else\n # generate our body in XML format\n params[:payload] = Nokogiri::XML(rest_payload) unless rest_payload.nil?\n end\n\n # get the rest_response and set it on the parent object\n rest_results = execute_rest(rest_url, params)\n end"
]
| [
"0.63335425",
"0.59180254",
"0.5916169",
"0.5909367",
"0.58648837",
"0.58631915",
"0.58021826",
"0.5626741",
"0.55788445",
"0.5542703",
"0.5520616",
"0.5499403",
"0.5472638",
"0.54371214",
"0.54256797",
"0.5393185",
"0.53848064",
"0.5380046",
"0.53756267",
"0.5374399",
"0.5327338",
"0.53271306",
"0.5326443",
"0.53206885",
"0.53206885",
"0.5319104",
"0.5312318",
"0.5311999",
"0.5311424",
"0.5308535",
"0.5293831",
"0.5289998",
"0.52854055",
"0.52826446",
"0.5274836",
"0.5268788",
"0.5265719",
"0.52617556",
"0.5243262",
"0.5240835",
"0.523725",
"0.523529",
"0.52261394",
"0.5220295",
"0.5220295",
"0.5220031",
"0.5219473",
"0.52082705",
"0.5195404",
"0.5189258",
"0.5182909",
"0.5181322",
"0.51787055",
"0.51780826",
"0.5175383",
"0.5168808",
"0.5159139",
"0.5158386",
"0.51539475",
"0.51521426",
"0.5150562",
"0.5143786",
"0.5129497",
"0.5127742",
"0.5108315",
"0.5102961",
"0.5099292",
"0.5085631",
"0.50730634",
"0.5064823",
"0.50606734",
"0.50603724",
"0.5033016",
"0.5019813",
"0.50159156",
"0.5013005",
"0.5012693",
"0.50097084",
"0.500811",
"0.50062233",
"0.500169",
"0.4984082",
"0.49827337",
"0.49809095",
"0.4978201",
"0.49729276",
"0.49700007",
"0.49692658",
"0.4965696",
"0.49649984",
"0.49627152",
"0.49603313",
"0.49596968",
"0.49584123",
"0.4949904",
"0.49429265",
"0.493296",
"0.49293974",
"0.49237654",
"0.4923037"
]
| 0.5333968 | 20 |
PUT /api/rests/1 PUT /api/rests/1.json | def update
@rest = Rest.where(["id = ? AND report_id = ?" , params[:id], params[:report_id]]).first
if @rest
respond_to do |format|
if @rest.update_attributes({ :location => params[:location], :ended_at => DateTime.now })
@json = Hash[:rest => {
:id => @rest.id,
:report_id => @rest.report_id,
:location => @rest.location,
:latitude => @rest.latitude,
:longitude => @rest.longitude,
:address => @rest.address,
:started_at => @rest.started_at,
:ended_at => @rest.ended_at
}]
format.json { render json: @json }
else
format.json { render json: {:error => "Rest update failed."}, status: :unprocessable_entity }
end
end
else
respond_to do |format|
format.json { render json:{ :error => "Not Acceptable:rests#update", :status => 406 } }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"def update\n respond_to do |format|\n if @rest.update(rest_params)\n format.html { redirect_to @rest, notice: 'Rest was successfully updated.' }\n format.json { render :show, status: :ok, location: @rest }\n else\n format.html { render :edit }\n format.json { render json: @rest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n respond_to do |format|\n if @rest_api.update(rest_api_params)\n format.html { redirect_to @rest_api, notice: 'Rest api was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rest_api.errors, status: :unprocessable_entity }\n end\n end\n end",
"def 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 put\n RestClient.put(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def put(*args)\n request :put, *args\n end",
"def rest_resource(path, options={}, &blk)\n rest_get path, options, &blk\n rest_edit path, options, &blk\n rest_delete path, options, &blk\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 put options\n rest_request({ method: :put }.merge(options))\n end",
"def put options\n rest_request({ method: :put }.merge(options))\n end",
"def put(path_part, payload, additional_headers = {}, &block)\n api_request { @rest.put('/REST/' + path_part, payload.to_json, additional_headers, &block) }\n end",
"def put(path, params={})\n RestClient.put request_base+path, params\n end",
"def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end",
"def put(url, payload, headers={})\n RestClient.put url, payload, headers\n end",
"def set_rest_api\n @rest_api = RestApi.find(params[:id])\n end",
"def put(*args)\n request(:put, *args)\n end",
"def put url, payload\n RestClient::Request.execute(:method => :put, :url => url, :payload => payload, :headers => lbaas_headers, :timeout => @timeout, :open_timeout => @open_timeout)\n end",
"def 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 test_update\n #Again the delete feature from ActiveResource does not work out of the box.\n #Using custom delete function\n puts \"--create a new account--\"\n new_acct = Salesforce::Rest::Account.new(:Name => \"test numero uno\", :BillingStreet=> \"Fairway Meadows\",\n :BillingState => \"NY\", :ShippingCity => \"New York\")\n resp = new_acct.save()\n\n assert (resp.code == 201)\n j = ActiveSupport::JSON\n @sf_oid = j.decode(resp.body)[\"id\"]\n puts \"New Object created: id -> \" + @sf_oid\n\n puts \"--update that new account--\"\n serialized_json = '{\"BillingState\":\"WA\"}'\n #http = Net::HTTP.new(@rest_svr_url, 443)\n http = Net::HTTP.new('na7.salesforce.com', 443)\n http.use_ssl = true\n \n class_name = \"Account\"\n path = \"/services/data/v21.0/sobjects/#{class_name}/#{@sf_oid}\"\n headers = {\n 'Authorization' => \"OAuth \"+ @oauth_token,\n \"content-Type\" => 'application/json',\n }\n code = serialized_json\n\n \n req = Net::HTTPGenericRequest.new(\"PATCH\", true, true, path, headers)\n\n resp = http.request(req, code) { |response| }\n assert !resp.nil?\n\n puts resp.to_s\n end",
"def update options={}\n client.put(\"/#{id}\", options)\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 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 put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end",
"def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end",
"def set_rest\n @rest = Rest.find(params[:id])\n end",
"def set_rest\n @rest = Rest.find(params[:id])\n end",
"def put url, object = nil\n request url, HTTP::Put, object\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n request_body_Data= '{ \"widget\":\n {\n \"name\" : \"'+params[:name]+'\",\n \"description\" : \"'+params[:description]+'\"\n }}'\n response = RestClient::Request.new({\n method: :put,\n url: ENV['API_URL'] + '/widgets/' + params[:id],\n payload: request_body_Data,\n headers: { Authorization: session[:access_token], content_type: 'application/json'}\n }).execute do |response, request, result|\n case response.code\n when 400\n [ :error, JSON.parse(response) ]\n when 200\n [ :success, JSON.parse(response) ]\n json=JSON.parse(response)\n @widget= Widget.new do |widget|\n widget.id=json[\"data\"][\"widget\"][\"id\"]\n widget.name=json[\"data\"][\"widget\"][\"name\"]\n widget.description=json[\"data\"][\"widget\"][\"description\"]\n widget.kind=json[\"data\"][\"widget\"][\"kind\"]\n widget.userid=json[\"data\"][\"widget\"][\"user\"][\"id\"]\n widget.username=json[\"data\"][\"widget\"][\"user\"][\"name\"]\n widget.owner=json[\"data\"][\"widget\"][\"owner\"]\n end\n else\n fail \"Invalid response #{response.to_str} received.\"\n end\n end\n respond_to do |format|\n if @widget\n format.html { redirect_to @widget, notice: 'Widget was successfully updated.' }\n format.json { render :show, status: :ok, location: @widget }\n else\n format.html { render :edit }\n format.json { render json: @widget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end",
"def put(path, body = nil, ctype = 'application/json')\n make_call(mk_conn(path, 'Content-Type': ctype,\n 'Accept': 'application/json'),\n :put, nil, body.to_json)\n end",
"def create_method\n :http_put\n end",
"def create_method\n :http_put\n end",
"def put(url, payload = {}, headers = {})\n http :put, \"#{url}.json\", payload.to_json, headers\n end",
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update_rest\n @instrument_version = InstrumentVersion.find(params[:id])\n\n respond_to do |format|\n if @instrument_version.update_attributes(params[:instrument_version])\n flash[:notice] = 'InstrumentVersion was successfully updated.'\n format.html { redirect_to(@instrument_version) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @instrument_version.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(url, payload, headers={})\n payload = MultiJson.encode(payload)\n headers = headers.merge({:content_type => 'application/json'})\n request(:put, url, payload, headers)\n end",
"def put(api_version, resource, payload, query_parameters = nil,\n headers = nil)\n make_rest_call(:put, uri_builder(api_version, resource,\n query_parameters), payload, headers)\n end",
"def put(href, additional_parameters = {})\n rest_connect do |base_uri, headers|\n href = \"#{base_uri}/#{href}\" unless begins_with_slash(href)\n new_path = URI.escape(href)\n req = Net::HTTP::Put.new(new_path, headers) \n req.set_content_type('application/json')\n req.body = additional_parameters.to_json\n req\n end\n end",
"def update\n respond_to do |format|\n if @resto.update(resto_params)\n format.html { redirect_to @resto, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @resto }\n else\n format.html { render :edit }\n format.json { render json: @resto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put endpoint, data\n do_request :put, endpoint, data\n end",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", {\"passed\" => success}.to_json, :content_type => :json\nend",
"def put(path, data = {})\n request 'PUT', 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 create_method\n :put_json\n end",
"def put(url, body = {})\n call(url: url, action: :put, body: body)\n end",
"def update_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n if @entry_item.update_attributes(params[:entry_item])\n flash[:notice] = 'EntryItem was successfully updated.'\n #format.html { redirect_to(@entry_item) }\n format.xml { head :ok }\n else\n #format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put\n if(resource.collection?)\n Forbidden\n elsif(!resource.parent_exists? || !resource.parent_collection?)\n Conflict\n else\n resource.lock_check if resource.supports_locking?\n status = resource.put(request, response)\n response['Location'] = \"#{scheme}://#{host}:#{port}#{url_format(resource)}\" if status == Created\n response.body = response['Location']\n status\n end\n end",
"def update(resource,identifier,json)\n raise 'Not Yet Implemented'\n end",
"def put(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_put(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend",
"def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend",
"def put(payload = {})\n request! do\n api[url.path].put(to_payload(payload), API_HEADERS)\n end\n end",
"def put(path, params={}, options={})\n request(:put, api_path(path), params, options)\n end",
"def put(url, resource_name, options = {})\n build_response(resource_name) do\n connection.put do |req|\n req.url url\n req.body = options.to_json\n end\n end\n end",
"def resource_way\n # TODO: make json default format?\n\n # try resource style\n #resources = RestClient::Resource.new(\"#{BASE_URL}/#{RESOURCE_NAME}\", \n #'[email protected]', 'please') #, :accept => :json)\n resources = RestClient::Resource.new(\"#{BASE_URL}/#{RESOURCE_NAME}\", 'b4j5qBqzYx5EukCM3Vri') #token\n # \n response = resources.get(:accept => :json)\n all_hosts = JSON.parse(response)\n puts \"EXISTING HOSTS: \" + all_hosts.inspect\n\n new_opts = {\n \"host_name\" => \"damian.np.dc1.eharmony.com\",\n \"alias\" => \"damian.np.dc1.eharmony.com\",\n \"address\" => \"damian.np.dc1.eharmony.com\",\n \"max_check_attempts\" => 3,\n \"notification_interval\" => 5,\n # 24x7\n \"notification_period\" => \"24x7\",\n #\"notification_period_id\" => \"5050cb9ebfa68e0903000001\",\n # 24x7\n \"check_period\" => \"24x7\",\n #\"check_period_id\" => \"5050cb9ebfa68e0903000001\",\n # just using first contact\n #\"contacts\" => [\"pat-obrien\"],\n \"contacts\" => [\"damian\"],\n #\"contact_ids\" => [\"5051283ebfa68e5757000002\"],\n }\n\n\n #puts resources['new'].post(NEW_OPTS.to_json, :content_type => :json, :accept \n #=> :json )\n # NOTE: even though this works and creates a new Host in DB - i still get 406 \n # Not Acceptable response\n #puts resources['new'].post({ RESOURCE_NAME.to_s => new_opts}, :accept => \n #:json )\n begin\n puts resources['new'].post({ RESOURCE_NAME.to_s => new_opts})\n rescue Exception => e\n puts \"ERROR: #{e} = #{e.inspect}\"\n end\n\n \n\n # now edit the resource ...\nend",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"def update number, routes\r\n # the base uri for api requests\r\n query_builder = Configuration.BASE_URI.dup\r\n\r\n # prepare query string for API call\r\n query_builder << \"/tns/{number}\"\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n \"number\" => number,\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n \"user-agent\" => \"Flowroute SDK 1.0\",\r\n \"content-type\" => \"application/json; charset=utf-8\"\r\n }\r\n\r\n response = CustomAuthUtility.append_custom_auth_params method:'PATCH',\r\n query_url:query_url,\r\n body:\"{\\\"routes\\\": #{routes.to_json}}\",\r\n headers:headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new \"NOT AUTHORIZED\", 401, response.raw_body\r\n elsif response.code == 500\r\n raise APIException.new \"APPLICATION/SERVER ERROR\", 500, response.raw_body\r\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\r\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end",
"def 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_endpoint; end",
"def update\n # actions\n path = URI(@endpoint).path\n action = URI(@req.request_uri).path.sub(path, '').split('/')\n action -= ['']\n if action.include?('_history')\n @actions = [action[0], '_history']\n else\n @actions = [action[0]]\n end\n\n # search param\n req_query = URI(@req.request_uri).query\n unless req_query.nil?\n @req_params = URI::decode_www_form(req_query).to_h\n end\n\n # requst method\n if @req.request_method == \"GET\" and @actions.include? '_history'\n @req_method = 'vread'\n elsif @req.request_method == \"GET\" and @req_params != nil\n @req_method = 'search-type'\n elsif @req.request_method == \"PUT\"\n @req_method = 'update'\n elsif @req.request_method == \"POST\"\n @req_method = 'create'\n else\n @req_method = 'read'\n end\n\n # interaction\n int1 = Interaction.last type: @actions[0], code: @req_method\n if int1.nil?\n @present = 0\n else\n @present = int1.id\n @intCode = int1.valueCode\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 update\n respond_to do |format|\n if @restroom.update(restroom_params)\n format.html { redirect_to @restroom, notice: 'Restroom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @restroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end",
"def update\n put :update\n end",
"def update_rest\n @entry_instrument = EntryInstrument.find(params[:id])\n\n respond_to do |format|\n if @entry_instrument.update_attributes(params[:entry_instrument])\n flash[:notice] = 'EntryInstrument was successfully updated.'\n format.html { redirect_to(@entry_instrument) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_instrument.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put_path(base_path, payload)\n url = \"#{endpoint}/paths#{base_path}\"\n put_json(url, payload)\n end",
"def put(uri, parameters)\n response = Unirest.put uri, parameters: parameters\n response.body\n end",
"def update\n @restroom = Restroom.find(params[:id])\n authorize @restroom\n\n respond_to do |format|\n if @restroom.update_attributes(params[:restroom])\n format.html { redirect_to @restroom, notice: 'Restroom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @restroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(resource_path, body:, headers: {}, prefix: API_PREFIX)\n request(method: :put, resource_path: resource_path, headers: headers, body: body, prefix: prefix)\n end",
"def put(resource, body = \"\", headers = {})\n prepare_request(:put, resource, body, headers)\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 put(path, &block)\n route 'PUT', path, &block\n end",
"def rest_endpoint=(_arg0); end",
"def update(id: nil, body: nil)\n perform(:put, \"#{@resource_type}/#{id}\", body)\n end",
"def put(url, payload, options={}, &block)\n http_options = options.merge(@basic_options)\n if block_given?\n RestClient.put(url, payload, http_options, &block)\n else\n RestClient.put(url, payload, http_options)\n end\n\n end",
"def 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 put(request)\n error = validate(request)\n return error if error\n\n code =\n if data_store.exists?(request.rest_path)\n set_data(request, request.rest_path, request.body, :data_store_exceptions)\n 200\n else\n name = request.rest_path[4]\n data_store.create(request.rest_path[0..3], name, request.body, :create_dir)\n 201\n end\n already_json_response(code, request.body)\n end",
"def crud_put(resource_name, service_name, primary_key_name, api_options = {})\n api_options = get_defaults(api_options)\n put '/'+resource_name+'/:'+primary_key_name do\n service = settings.send(service_name)\n\n # Must Exist\n return 404 unless service.exists_by_primary_key?(params[primary_key_name.to_sym])\n\n # Get The Data\n begin\n data = JSON.parse(request.body.read)\n rescue Exception => e\n return 422\n end\n\n # Valid Update?\n return 422 unless service.valid_update?(data)\n\n # Do Update\n record = service.update_by_primary_key(params[primary_key_name.to_sym],data)\n\n # Other Error\n return 500 if record.nil?\n\n # Return new Region\n JSON.fast_generate record\n end\n end",
"def update\n @restroom = Restroom.find(params[:id])\n authorize! :update, @restroom\n\n respond_to do |format|\n if @restroom.update_attributes(params[:restroom])\n format.html { redirect_to @restroom, notice: 'Restroom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @restroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @restroom = Restroom.find(params[:id])\n authorize! :update, @restroom\n\n respond_to do |format|\n if @restroom.update_attributes(params[:restroom])\n format.html { redirect_to @restroom, notice: 'Restroom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @restroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, options={})\n url = build_url path, options\n body, mime = build_payload options\n headers = (options[:headers] || {}).merge :content_type => mime\n Response.new(@client[url].put body, headers)\n rescue RestClient::Exception => e\n Response.new e.response\n end",
"def put(path, options={})\n request :put, path, options\n end",
"def set_api_v1_resource\n @api_v1_resource = Api::V1::Resource.find(params[:id])\n end",
"def set_api_v1_todo\n @api_v1_todo = Todo.find(params[:id])\n end",
"def put(endpoint, params = {})\n\n path = build_connect_url(endpoint)\n headers = build_headers(endpoint, 'PUT', params)\n\n log \"PUT \" + path + \" \" + params.to_s\n log headers.to_s\n\n begin\n response = RestClient::Request.execute(method: :put, url: path, payload: params.to_json, headers: headers, timeout: 15)\n rescue RestClient::ExceptionWithResponse => e\n log e.http_code.to_s + \" \" + e.response.to_s\n return e.response\n end\n\n log response.code.to_s + \" \" + response.to_s\n\n response\n\n end",
"def update(attributes = {})\n set_all(attributes)\n ensure_client && ensure_uri\n response = @client.rest_put(@data['uri'], { 'Accept-Language' => 'en_US', 'body' => @data }, @api_version)\n @client.response_handler(response)\n self\n end",
"def put(header = {})\n url = \"#{ApiClient.config.path}#{self.class.resource_path}\"\n response = ApiClient::Dispatcher.put(url, self.to_hash, header)\n attributes = ApiClient::Parser.response(response, url)\n update_attributes(attributes)\n end",
"def test_put_success\n put \"/blah\", @test_obj do |response|\n assert response.ok?, \"Update test object failed\"\n end\n end",
"def 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 put(path, request_options = {}, resource_options = {})\n response(:put, resource(resource_options)[path], request_options)\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, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end"
]
| [
"0.71501756",
"0.68428665",
"0.6766224",
"0.6570423",
"0.6564734",
"0.6536515",
"0.6536515",
"0.65325564",
"0.63774365",
"0.623174",
"0.6210878",
"0.62084824",
"0.62084824",
"0.618625",
"0.6171196",
"0.6146451",
"0.6126203",
"0.6098457",
"0.60959095",
"0.6078001",
"0.6069012",
"0.60570985",
"0.604558",
"0.6042069",
"0.60395455",
"0.6023863",
"0.6019843",
"0.6004553",
"0.6004553",
"0.59733284",
"0.59557927",
"0.5947492",
"0.59433246",
"0.59373766",
"0.59365845",
"0.59365845",
"0.59092075",
"0.5905225",
"0.58964527",
"0.5895934",
"0.58895266",
"0.58737797",
"0.58654463",
"0.5860955",
"0.58595246",
"0.5845143",
"0.5841438",
"0.583344",
"0.58302903",
"0.58197975",
"0.5811618",
"0.5811287",
"0.5787739",
"0.5784211",
"0.5775273",
"0.5774437",
"0.5771521",
"0.576052",
"0.5758581",
"0.57583725",
"0.5740564",
"0.5740564",
"0.5740564",
"0.57388216",
"0.5715916",
"0.57123333",
"0.56936294",
"0.5681522",
"0.56806576",
"0.5671089",
"0.5668505",
"0.565662",
"0.5653849",
"0.56524307",
"0.56499493",
"0.5648656",
"0.56410366",
"0.5639578",
"0.5633455",
"0.56304586",
"0.5627174",
"0.56268585",
"0.5623569",
"0.5619521",
"0.5611221",
"0.56037027",
"0.56037027",
"0.5602447",
"0.5602432",
"0.5601638",
"0.55980146",
"0.55911195",
"0.55853266",
"0.5584428",
"0.55787677",
"0.5576496",
"0.5575846",
"0.5568792",
"0.555866",
"0.555866"
]
| 0.5647829 | 76 |
returns a copy of this Hash where all String keys are symbolized. | def with_symbolized_keys
inject({}) do |hash, (key, value)|
if key.is_a?(String)
hash.update key.to_sym => value
else
hash.update key => value
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_sym!\n self.keys.each do |key| \n self[key.to_sym] = self.delete key if key.class == String\n end\n return self\n end",
"def symbolize_keys!; self end",
"def symbolize_keys\n dup.symbolize_keys!\n end",
"def symbolize_keys!\n replace(self.symbolize_keys)\n end",
"def symbolize_keys!\r\n self.replace(self.symbolize_keys)\r\n end",
"def symbolize_keys!\n self.replace(self.symbolize_keys)\n end",
"def symbolize_keys!\n self.replace(self.symbolize_keys)\n end",
"def symbolize_keys!\n self.replace(self.symbolize_keys)\n end",
"def symbolize_keys!\n self.replace(self.symbolize_keys)\n end",
"def symbolize_keys!\n self.replace(self.symbolize_keys)\n end",
"def symbolize_keys!\n self.replace(self.symbolize_keys)\n end",
"def symbolize\n return self if symbolized?\n inject({}) do |options, (key, value)|\n key_sym = key.to_sym rescue key\n raise RuntimeError, \"duplicate key detected\" if options.has_key?(key_sym)\n options[key_sym || key] = (value.respond_to?(:symbolize) ? value.symbolize : value)\n next options\n end\n end",
"def symbolize\n return nil if self.nil?\n self.keys.each do |key|\n self[(key.to_sym rescue key) || key] = self.delete(key)\n end\n end",
"def symbolize\n Hash.new\n end",
"def symbolize_keys\n dup.symbolize_keys!\n end",
"def symbolize_keys\n dup.symbolize_keys!\n end",
"def symbolize_keys\n dup.symbolize_keys!\n end",
"def symbolize_keys!\n self.class.symbolize_keys(self)\n end",
"def symbolize_keys; end",
"def symbolize_keys!\n keys.each do |key|\n unless key.is_a?(Symbol)\n self[key.to_sym] = self[key]\n delete(key)\n end\n end\n self\n end",
"def symbolize_keys!\n replace symbolize_keys\n end",
"def symbolize_keys!\n transform_keys!{ |key| key.to_sym rescue key }\n end",
"def symbolize!\n return replace(symbolize)\n end",
"def symbolize\n convert do|k, v|\n [k.to_sym, v]\n end\n end",
"def symbolize\n self.collect {|value| value.respond_to?(:symbolize) ? value.symbolize : value }\n end",
"def symbolize_keys!\n transform_keys!{ |key| key.to_sym rescue key }\n end",
"def symbolize_keys!\n transform_keys!{ |key| key.to_sym rescue key }\n end",
"def symbolize_keys!\n transform_keys! { |key| key.to_sym rescue key }\n end",
"def symbolize_keys!\n transform_keys! { |key| key.to_sym rescue key }\n end",
"def symbolize_keys!\n transform_keys! { |key| key.to_sym rescue key }\n end",
"def hashie_stringify_keys!\n keys.each do |k|\n self[k.to_s] = delete(k) unless String === k\n end\n self\n end",
"def symbolize_keys!\n keys.each do |key|\n self[(key.to_sym rescue key) || key] = delete(key)\n end\n self\n end",
"def symbolize_keys!\n keys.each do |key|\n self[(key.to_sym rescue key) || key] = delete(key)\n end\n self\n end",
"def symbolize_keys!\n keys.each do |key|\n self[(key.to_sym rescue key) || key] = delete(key)\n end\n self\n end",
"def symbolize_keys!\n keys.each do |key|\n self[(key.to_sym rescue key) || key] = delete(key)\n end\n self\n end",
"def symbolize_keys!\n keys.each do |key|\n self[(key.to_sym rescue key) || key] = delete(key)\n end\n self\n end",
"def symbolize_keys!\n keys.each do |key|\n self[(key.to_sym rescue key) || key] = delete(key)\n end\n self\n end",
"def symbolize_keys\r\n inject({}) do |options, (key, value)|\r\n options[(key.to_sym rescue key) || key] = value\r\n options\r\n end\r\n end",
"def symbolize_hash hash\n hash.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}\n end",
"def symbolize_keys\n transform_keys { |key| key.to_sym rescue key }\n end",
"def symbolize_keys\n transform_keys { |key| key.to_sym rescue key }\n end",
"def symbolize_keys!(hash)\n transform_keys!(hash){ |key| key.to_sym rescue key }\n end",
"def symbolize_keys(hash)\n hash.inject({}) { |memo, (k, v)| memo[k.to_sym] = v; memo }\n end",
"def symbolize_keys_of(hash)\n hash2 = {}\n hash.each {|k,v| hash2[k.to_sym] = v}\n hash2\n end",
"def symbolize_keys(hash)\n h = hash.dup\n h.keys.each do |key|\n h[(key.to_sym rescue key) || key] = h.delete(key)\n end\n h\n end",
"def symbolize_hash_keys(hash); end",
"def symbolize_keys(hash)\n hash.inject({}){|result, (key, value)|\n new_key = case key\n when String then key.to_sym\n else key\n end\n new_value = case value\n when Hash then symbolize_keys(value)\n else value\n end\n result[new_key] = new_value\n result\n }\n end",
"def symbolize_keys(hash)\r\n target = hash.dup\r\n\r\n target.keys.each do |key|\r\n value = target.delete(key)\r\n if value.is_a? Hash\r\n value = symbolize_keys(value)\r\n end\r\n target[(key.to_sym rescue key) || key] = value\r\n end\r\n\r\n target\r\n end",
"def symbolize_all_keys!\n self.keys.map do |key|\n if self[key].is_a? Hash\n self[key].symbolize_all_keys!\n elsif self[key].is_a? Array\n # Find hashes to sort in the array.\n self[key].each do |v|\n v.symbolize_all_keys! if v.is_a? Hash\n end\n end\n self[key.to_sym] = self.delete(key)\n end\n self\n end",
"def symbolize_keys!(hash)\n map_keys!(hash, Transproc(:to_symbol).fn)\n end",
"def symbolize_keys(hash)\n hash.keys.each do |key| # rubocop:disable Style/HashEachMethods\n hash[(key.to_sym rescue key) || key] = hash.delete(key)\n end\n hash\n end",
"def symbolize_keys!(hash)\n new_hash = hash.inject({}){ |memo, (k, v)|\n memo[k.to_sym] = v\n if v.class.eql? ::Hash\n memo[k.to_sym] = symbolize_keys! v\n elsif v.class.eql? ::Array\n memo[k.to_sym] = symbolize_keys_of_hashs! v\n end\n memo\n }\n hash.replace new_hash\n end",
"def hashie_stringify_keys\n dup.stringify_keys!\n end",
"def symbolize_keys\n each_with_object({}) { |(k, v), hsh| hsh[k.to_sym] = v.is_a?(Hash) ? v.symbolize_keys : v }\n end",
"def symbolize_keys(hash)\n Hash[hash.map { |k, v| [k.to_sym, v] }]\n end",
"def keys_to_symbols()\n self.deep_convert_keys { |k| k.to_s.to_sym }\n end",
"def deep_symbolize_keys!\n deep_transform_keys!{ |key| key.to_sym rescue key }\n end",
"def symbolize_keys(hash)\n return hash unless hash.kind_of?(Hash)\n Hash[\n hash.map { |key, value|\n k = key.is_a?(String) ? key.to_sym : key\n v = symbolize_keys value\n [k,v]\n }]\n end",
"def stringify_keys\n dup.stringify_keys!\n end",
"def stringify_keys # :nodoc:\n dup\n end",
"def symbolize_hash(hash)\n HashKeys.deep_symbolize_keys(hash)\n end",
"def stringify_keys!\n\t\t\tself.each do |k,v|\n\t\t\t\tnext if k.kind_of? String\n\t\t\t\tself[k.to_s] = v\n\t\t\t\tself.delete k\n\t\t\tend\n\t\tend",
"def symbolize_keys\n inject({}) do |options, (key, value)|\n options[(key.to_sym rescue key) || key] = value\n options\n end\n end",
"def symbolize_keys\n inject({}) do |options, (key, value)|\n options[(key.to_sym rescue key) || key] = value\n options\n end\n end",
"def deep_symbolize_keys\n deep_transform_keys{ |key| key.to_sym rescue key }\n end",
"def symbolize_keys hsh\n new_hsh = Hash.new\n\n hsh.each_pair do |k,v|\n v = symbolize_keys v if v.is_a?(Hash)\n new_hsh[k.downcase.to_sym] = v\n end\n\n new_hsh\n end",
"def symbolize! hash\n hash.symbolize_keys!\n hash.values.select{|v| v.is_a? Hash}.each{|h| symbolize!(h)}\n end",
"def stringify_keys!; self end",
"def stringify_keys!; self end",
"def symbolize_hash(hash)\n hash.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }\n end",
"def stringify_keys!\n keys.each do |key|\n self[key.to_s] = delete key\n end\n self\n end",
"def stringify_keys!\n keys.each do |key|\n self[key.to_s] = delete(key)\n end\n self\n end",
"def stringify_keys!\n keys.each do |key|\n self[key.to_s] = delete(key)\n end\n self\n end",
"def stringify_keys!\n keys.each do |key|\n self[key.to_s] = delete(key)\n end\n self\n end",
"def stringify_keys!\n keys.each do |key|\n self[key.to_s] = delete(key)\n end\n self\n end",
"def stringify_keys!\n keys.each do |key|\n self[key.to_s] = delete(key)\n end\n self\n end",
"def stringify_keys!\n keys.each do |key|\n self[key.to_s] = delete(key)\n end\n self\n end",
"def stringify_keys!\n keys.each do |key|\n self[key.to_s] = delete(key)\n end\n self\n end",
"def stringify_keys!\n keys.each do |key|\n self[key.to_s] = delete(key)\n end\n self\n end",
"def symbolize(h)\n sym = {}\n h.each do |key, val|\n nk = key.respond_to?(:intern) ? key.intern : key\n sym[nk] = val\n end\n sym\n end",
"def symbolize(obj)\n return obj.inject({}){|memo,(k,v)| memo[k.to_sym] = symbolize(v); memo} if obj.is_a? Hash\n return obj.inject([]){|memo,v | memo << symbolize(v); memo} if obj.is_a? Array\n return obj\n end",
"def desymbolize(hash)\n new_hash = Hash.new\n hash.each do |k, v|\n new_hash[k.to_s] = v\n end\n new_hash\n end",
"def symbolize_keys(hash)\n if hash.is_a?(Hash)\n Hash[\n hash.map do |k, v|\n [k.respond_to?(:to_sym) ? k.to_sym : k, symbolize_keys(v)]\n end\n ]\n else\n hash\n end\n end",
"def symbolize_keys(recursive = false)\n to_hash.symbolize_keys(recursive)\n end",
"def stringify_keys\n dup.stringify_keys!\n end",
"def stringify_keys\n dup.stringify_keys!\n end",
"def stringify_keys\n dup.stringify_keys!\n end",
"def stringify_keys!\r\n keys.each do |key|\r\n self[key.to_s] = delete(key)\r\n end\r\n self\r\n end",
"def unsymbolise(hash)\n result = {}\n hash.keys.each do |key|\n result[key.to_s] = hash[key]\n end\n result\nend",
"def symbolize_keys(data)\n if data.is_a?(Hash)\n data.inject({}) do |options, (key, value)|\n options[(key.to_sym rescue key) || key] = value\n options\n end\n else\n data\n end\n end",
"def symbolize_hash_keys(object)\n symbolize_proc = proc(&:to_sym)\n apply_key_mutator(object, symbolize_proc)\n end",
"def deep_symbolize_keys!\n deep_transform_keys!{ |key| key.to_sym rescue key }\n end",
"def deep_symbolize_keys!\n deep_transform_keys!{ |key| key.to_sym rescue key }\n end",
"def deep_symbolize_keys!\n deep_transform_keys!{ |key| key.to_sym rescue key }\n end",
"def symbolize_keys(attributes)\n return attributes.reduce({}) do |attribute, (key, value)|\n attribute.tap { |a| a[key.to_sym] = symbolize_keys(value) }\n end if attributes.is_a? Hash\n\n return attributes.reduce([]) do |attribute, value|\n attribute << symbolize_keys(value); attribute\n end if attributes.is_a? Array\n\n attributes\n end",
"def symbolize_hash(old_hash)\n old_hash.each_with_object({}) { |(k, v), new_hash|\n new_hash[k.to_sym] = if v.is_a?(Hash)\n symbolize_hash(v)\n elsif v.is_a?(Array)\n v.map{ |h| h.is_a?(Hash) ? symbolize_hash(h) : h }\n else\n v\n end\n }\n end",
"def keys_to_sym clean: false\n self.inject({}){|memo,(k,v)| memo[clean ? k.to_s.to_clean_sym : k.to_s.to_sym] = (v.is_a?(Hash) || v.is_a?(Array) ? v.keys_to_sym(clean:clean) : v); memo}\n end",
"def deep_symbolize_keys!(hash)\n deep_transform_keys!(hash){ |key| key.to_sym rescue key }\n end",
"def deep_symbolize_keys!\n deep_transform_keys! { |key| key.to_sym rescue key }\n end",
"def deep_symbolize_keys!\n deep_transform_keys! { |key| key.to_sym rescue key }\n end"
]
| [
"0.7969364",
"0.7870518",
"0.78095144",
"0.778851",
"0.7737107",
"0.7574516",
"0.7574516",
"0.7574516",
"0.7574516",
"0.7574516",
"0.7574516",
"0.7555497",
"0.753237",
"0.7474813",
"0.7453979",
"0.7453979",
"0.7453979",
"0.7405228",
"0.7382833",
"0.731224",
"0.7284966",
"0.7241886",
"0.7128606",
"0.71225584",
"0.7059712",
"0.7039984",
"0.7039984",
"0.70092106",
"0.70092106",
"0.70092106",
"0.7006923",
"0.70050114",
"0.70050114",
"0.70050114",
"0.70050114",
"0.70050114",
"0.6992903",
"0.6972027",
"0.6943386",
"0.69145286",
"0.69145286",
"0.6909306",
"0.6891244",
"0.688264",
"0.68816346",
"0.6845095",
"0.682235",
"0.68080544",
"0.67497426",
"0.67490613",
"0.6747408",
"0.6743832",
"0.6729303",
"0.6715117",
"0.6688559",
"0.66343725",
"0.66199523",
"0.66194105",
"0.6612358",
"0.66067165",
"0.6587296",
"0.6570332",
"0.65562147",
"0.65562147",
"0.65412855",
"0.6538827",
"0.65276635",
"0.6494374",
"0.6494374",
"0.64903504",
"0.6475092",
"0.6470928",
"0.6470928",
"0.6470928",
"0.6470928",
"0.6470928",
"0.6470928",
"0.6470928",
"0.6470928",
"0.6460878",
"0.6422749",
"0.641693",
"0.6416018",
"0.6412716",
"0.63912773",
"0.63912773",
"0.63912773",
"0.6386388",
"0.63776994",
"0.6359961",
"0.6355847",
"0.6344964",
"0.6344964",
"0.63438517",
"0.6342244",
"0.6340478",
"0.6334287",
"0.6328665",
"0.63002825",
"0.63002825"
]
| 0.6350714 | 91 |
returns a copy of this Hash where all keys (including, e.g. Fixnums) are stringified. | def with_stringified_keys
inject({}) do |hash, (key, value)|
hash.update key.to_s => value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stringify_keys!\n\t\t\tself.each do |k,v|\n\t\t\t\tnext if k.kind_of? String\n\t\t\t\tself[k.to_s] = v\n\t\t\t\tself.delete k\n\t\t\tend\n\t\tend",
"def hashie_stringify_keys!\n keys.each do |k|\n self[k.to_s] = delete(k) unless String === k\n end\n self\n end",
"def stringify_keys!; self end",
"def stringify_keys!; self end",
"def hashie_stringify_keys\n dup.stringify_keys!\n end",
"def stringify_keys!\n transform_keys!(&:to_s)\n end",
"def stringify_keys\n each_with_object({}) { |(k, v), hsh| hsh[k.to_s] = v }\n end",
"def stringify_keys\n reduce({}) { |hsh,(k,v)| hsh.merge(k.to_s => v) }\n end",
"def stringify_keys!\n keys.each do |key|\n self[key.to_s] = delete key\n end\n self\n end",
"def stringify_keys\n reduce({}) { |hsh, (k, v)| hsh.merge(k.to_s => v) }\n end",
"def stringify_keys\n reduce({}) { |hsh, (k, v)| hsh.merge(k.to_s => v) }\n end",
"def stringify_keys\n reduce({}) { |hsh, (k, v)| hsh.merge(k.to_s => v) }\n end",
"def stringify_keys\n dup.stringify_keys!\n end",
"def stringified_keys; end",
"def deep_stringify_keys!\n deep_transform_keys!(&:to_s)\n end",
"def stringify_keys\n hsh = Hash.new(default)\n self.each do |key, val|\n hsh[key.to_s] = val\n end\n hsh\n end",
"def stringify_keys!\n transform_keys!{ |key| key.to_s }\n end",
"def stringify_keys!\n transform_keys!(&:to_s)\n end",
"def stringify_keys!\n transform_keys!(&:to_s)\n end",
"def stringify_keys!\n transform_keys!(&:to_s)\n end",
"def to_s\n @hash.inject(+'') do |memo, (k, v)|\n memo << k << '=' << v << ','\n end.chop! || ''\n end",
"def stringify_keys!\r\n keys.each do |key|\r\n self[key.to_s] = delete(key)\r\n end\r\n self\r\n end",
"def stringify_keys!\n keys.each do |key|\n self[key.to_s] = delete(key)\n end\n self\n end",
"def stringify_keys!\n keys.each do |key|\n self[key.to_s] = delete(key)\n end\n self\n end",
"def stringify_keys!\n keys.each do |key|\n self[key.to_s] = delete(key)\n end\n self\n end",
"def stringify_keys!\n keys.each do |key|\n self[key.to_s] = delete(key)\n end\n self\n end",
"def stringify_keys!\n keys.each do |key|\n self[key.to_s] = delete(key)\n end\n self\n end",
"def stringify_keys!\n keys.each do |key|\n self[key.to_s] = delete(key)\n end\n self\n end",
"def stringify_keys!\n keys.each do |key|\n self[key.to_s] = delete(key)\n end\n self\n end",
"def stringify_keys!\n keys.each do |key|\n self[key.to_s] = delete(key)\n end\n self\n end",
"def stringify_keys!\n keys.each{|k| \n v = delete(k)\n self[k.to_s] = v\n v.stringify_keys! if v.is_a?(Hash)\n v.each{|p| p.stringify_keys! if p.is_a?(Hash)} if v.is_a?(Array)\n }\n self\n end",
"def stringify_keys\n transform_keys(&:to_s)\n end",
"def deep_stringify_keys!\n deep_transform_keys!{ |key| key.to_s }\n end",
"def stringify_keys # :nodoc:\n dup\n end",
"def stringify_keys!(hash)\n hash.keys.each {|key| hash[key.to_s] = hash.delete(key)}\n end",
"def deep_stringify_keys!\n deep_transform_keys! { |key| key.to_s }\n end",
"def stringify_keys\n transform_keys { |key| key.to_s rescue key }\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end",
"def to_s\n to_hash.to_s\n end"
]
| [
"0.73330635",
"0.71148425",
"0.69609624",
"0.69609624",
"0.69243413",
"0.69144374",
"0.6893453",
"0.68298596",
"0.6828672",
"0.68169385",
"0.68169385",
"0.68169385",
"0.68151194",
"0.67741877",
"0.6757653",
"0.67398566",
"0.672602",
"0.6724877",
"0.6724877",
"0.6724877",
"0.6724587",
"0.67187464",
"0.67062205",
"0.67062205",
"0.67062205",
"0.67062205",
"0.67062205",
"0.67062205",
"0.67062205",
"0.67062205",
"0.66748875",
"0.66632247",
"0.6663185",
"0.6638185",
"0.6633273",
"0.6616828",
"0.6576282",
"0.65747285",
"0.6574579",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814",
"0.6573814"
]
| 0.66043335 | 36 |
tries to find and authenticate user to create a new session | def create
@user = User.find_by(email: params[:user][:email])
@user = @user.try(:authenticate, params[:user][:password])
if @user
session[:user_id] = @user.id
redirect_to contacts_path
else
flash.now[:alert] = "Invalid combination. Try again - or try logging in via Google"
render :new
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_session\n req_params = params[:user]\n unless req_params\n @msg = \"Login details not found\"\n render \"objects/msg.json\", status: :unauthorized and return\n end\n @user = User.find_by_email(req_params[:email])\n if @user && @user.authenticate(req_params[:password])\n session[:user_id] = @user.id\n render 'objects/user.json'\n else\n @msg = \"Email or password is invalid\"\n render \"objects/msg.json\", status: :unauthorized\n end\n end",
"def create\n # refactor this\n user = User.find_by(username: params[:session][:username_or_email].downcase) ||\n User.find_by(email: params[:session][:username_or_email].downcase)\n if authenticated_successfully?(user)\n login(user)\n redirect_to(session[:intended_url] || root_path)\n else\n flash.now[:danger] = \"Hmm... #{$SITE_TITLE} couldn't authenicate your account with those credentials.\"\n render 'new'\n end\n end",
"def create\n # logging in can be done via email or username interchangeably\n user = User.find_by email: params[:session][:username].downcase\n # ||= only runs the find command if the user was not set by the above\n user ||= User.find_by username: params[:session][:username].downcase\n\n if user && user.authenticate(params[:session][:password])\n # Log the user in and redirect to the user's show page\n log_in user\n flash[:success] = \"Logged in as #{user.username}\"\n redirect_to user_url(user)\n else\n # Flash an error message\n flash.now[:danger] = 'Invalid email or password'\n render 'new'\n end\n end",
"def create\n @user = User.find_or_create_from_auth_hash(auth_hash)\n # self.current_user = @user\n session[:user] = @user.id\n redirect_to '/'\n end",
"def create\n user = User::FindForAuthenticate.call(params)\n\n render(\n status: 422,\n json: { error: 'Invalid login or password' }\n ) and return unless user\n\n begin\n session = UserSession.create!(user: user)\n render status: 200, json: { auth_key: session.auth_key }\n rescue ActiveRecord::RecordNotUnique\n render status: 422, json: { error: 'You already logged in' }\n end\n end",
"def create_session\n # byebug\n user = User.find_by(\n email: params[:email],\n password: params[:password]\n )\n\n if (user.nil?)\n redirect_to action: \"sign_in\"\n else\n session[:user_id] = user.id\n\n redirect_to \"/users/#{user.id}\"\n end\n\n end",
"def create\n if user = User.authenticate_with_credentials(params_for_login)\n # a session cookie is assigned to logged users\n session[:user_id] = user.id\n redirect_to session[:return_to]\n else\n redirect_to session[:return_to], flash: { error: \"Invalid email address\" }\n end\n end",
"def create\n reset_session\n u = User.authenticate(params[:session][:login], params[:session][:password])\n \n if u\n reset_session\n session[:user_id] = u.id\n session[:user_login] = u.login\n @current_user = User.find(session[:user_id])\n flash[:notice] = 'hi, again!'\n redirect_to dashboard_url\n else\n flash[:error] = 'Invalid login or password.'\n redirect_to root_url\n end\n end",
"def create\n if SessionService.authenticate(@user, params[:password])\n # TODO Add successful log in message\n logger.debug \"#{@user.email} is trying to create a API session\"\n root_path\n else\n logger.error \"** Failure** Attempt to login as #{params[:user_name]} - rejected\"\n render text: 'Login failed', status: :unauthorized\n end\n end",
"def create\n #this references the funciton we made in user.rb\n user = User.authenticate(params[:session][:email], params[:session][:password])\n if user.nil?\n flash[:login_error] = \"Couldn't find a user with those credentials\"\n redirect_to new_session_path\n else\n redirect_to user\n end\n end",
"def create\n #gets the user\n user = User.find_by_credentials(params[:user][:email], params[:user][:password])\n \n # if we found it, generate a new session token, change it on the user\n # instance as well as the cookie\n if !user.nil?\n log_in_user!(user)\n flash.now[:success] = \"Login successful\"\n redirect_to user_url(user)\n else\n flash.now[:error] = \"Invalid email/password combo\"\n redirect_to :new\n end\n end",
"def create \n user = User.find_by(:email => params[:session][:email]) #make sure that they are saved as a user. if not, returns nil. if yes, returns user.\n if user && user.authenticate(params[:session][:password]) #if both of these work, log user in\n login(user)\n redirect_to user\n else \n redirect_to :back\n end\n end",
"def create \n #finds whatever user that is in the system with the email you pass up\n #then it tries to run the authenticate method with whatever password got sent up and if...\n #it all works, store in the variable\n user = User\n .find_by(email: params[\"user\"][\"email\"])\n .try(:authenticate, params[\"user\"][\"password\"])\n\n #if a user is created want to communicate with the session and set the user ID equal to the User ID you just found \n #okay so the user is successfully authenticated, want to make sure they now have a cookie on their system\n if user \n #says store the user id, and it goes encrypted into their client(browser/mobile device)\n session[:user_id] = user.id\n render json: {\n status: :created,\n logged_in: true,\n user: user #pass back the entire user that you have in the database and you can show/use anything\n }\n #if user not able to log in successfully\n #status 401 is the unauthorized code, the universal HTTP code want to use if a user is not authenticated\n else \n render json: {\n status: 401\n }\n end \n end",
"def create_session\n login, password = get_login_and_password\n create_session_with authenticate_user(login, password, :trace => true)\n end",
"def create\n user = User.find_by_email(sessions_params[:email])\n if user and user.authenticate(sessions_params[:password])\n login user\n end\n redirect_to rooth_path\n end",
"def create\n \tuser = User.find_by(email: params[:session][:email])\n \tif user && user.authenticate(params[:session][:password])\n \t\tlog_in user\n \t\tredirect_back_or user\n \telse\n \t\tredirect_to login_path, notice: \"Invalid email/password combination\"\n \tend\n end",
"def create\n @user = User.find_by(name: params[:username])\n if @user.authenticate(params[:password])\n session[:current_user_id] = @user.id\n end\n end",
"def create\n # find user from session cookie -> email, then authenticate\n @user = User.find_for_database_authentication(email: session_params[:email])\n if @user && @user.valid_password?(session_params[:password])\n sign_in(@user)\n # after signing in the user, refresh to show most updated saved user\n @user.reload\n render :show\n return\n end\n # return prevents login error\n invalid_login_attempt_error\n end",
"def create\n validate_params; return if performed?\n user = User.find_by(user_name: params[:session][:user_name])\n if user && user.authenticate(params[:session][:password])\n log_in user\n redirect_to root_path\n else\n flash.now[:error] = I18n.t('errors.log_in.create')\n render :new\n end\n end",
"def create \n user = User.find_by(username: params[:user][:username])\n if user && user.authenticate(params[:user][:password])\n session[:user_id] = user.id \n redirect_to user_path(user)\n else\n redirect_to '/login'\n end\n end",
"def new_user_session(user)\n session = new_session\n session.login!(user)\n return session\n end",
"def create\n user = User.find_by_username(user_login_params[:username])\n if user and user.authenticate(user_login_params[:password])\n session[:current_user_key] = user.key\n redirect_to '/home'\n else\n redirect_to login_url, alert: \"Invalid user/password combination\" \n end\n end",
"def create\n\n logger.debug \"### Processing new login details\"\n user = User.authenticate(params[:email], params[:password])\n\n if user\n\n logger.debug \"### Login details matched - creating login session\"\n session[:user_id] = user.id\n flash[:notice] = \"Logged in!\"\n redirect_to(session[:return_to] || home_index_path) \n session.delete(:return_to)\n else\n logger.debug \"### User details didn't match - login denied\"\n flash[:error] = \"Invalid email or password\"\n render \"new\"\n end\n\n end",
"def create\n\t\tuser = User.find_by(email: params[:login][:email])\n\n\t\tif user && user.authenticate(params[:login][:password])\n\t\t\tsession[:user_id] = user.id.to_s\n\t\t\tredirect_to root_path\n\t\telse\n\t\t\trender :new\n\t\tend\n\n\tend",
"def create\n user = User.find_by(username: params[:username])\n\n if user && user.authenticate(params[:password])\n\n session[:user_id] = user.id\n redirect_to(\"/\")\n else\n @failed_auth = true\n render(:new)\n end\n end",
"def create\n user = User.find_by(email: params[:session][:email].downcase)\n \n #if the user was found and the user.authenticate based on enetered password\n if user && user.authenticate(params[:session][:password])\n # we are saving user id into the session so the browsers cookies will handle this\n # this id will be used across sessions\n session[:user_id] = user.id\n \n # flash a success and redirect to the users page\n flash[:success] = \"You have successfully logged in\"\n redirect_to user_path(user)\n else\n # re render the login page, but since this is not a model backed form we wont have validation messages\n # add a message with flash\n flash.now[:danger] = \"Username or Password were incorrect\"\n render 'new'\n end\n end",
"def create\n # identifies user by provided email\n user = User.find_by_email(params[:email])\n\n # if the provided passord matches the user, session is established\n if user && user.authenticate(params[:password])\n session[:user_id] = user.id\n redirect_to user, notice: 'You have successfully logged in!'\n else\n # if password doesnt match, session is not established\n redirect_to :root\n end\n end",
"def create\n #binding.pry \n user = User.find_by(name: params[:user][:name])\n if user.try(:authenticate, params[:user][:password])\n session[:user_id] = user.id \n @user = user\n else \n redirect_to(controller: 'sessions', action: 'new')\n end\n end",
"def create\n @user = User.find_by(email: session_params[:email])\n if @user && @user.authenticate(session_params[:password])\n # Save the user ID in the session so it can be used in\n # subsequent requests\n session[:user_id] = @user.id\n flash[:notice] = \"Welcome, #{@user.email}!\"\n redirect_to statuses_path\n else\n flash[:alert] = \"Please log in again\"\n render \"new\"\n end\n end",
"def create\n user = User.find_by_credentials(params[:user][:name], params[:user][:password])\n if user \n #rails creates session cookie for us, session is a hash\n #generate new session token and set our session to that token\n login!(user)\n redirect_to chirps_url\n else\n # flash used for collecting errors \n # flash - lasts for now and the next response cycle, usually for redirects\n # flash.now - only persist for this response, usually for render\n\n #we want errors to render once but not again on refresh\n flash[:errors] = [\"Invalid username/password\"]\n # render :new\n redirect_to new_session_url\n end\n end",
"def create\n user = User.find_by(email: params[:session][:email].downcase)\n if user && user.authenticate(params[:session][:password])\n log_in user\n redirect_to home_path\n else\n flash.now[:danger] = 'Invalid email/password combination'\n render 'new'\n end\n end",
"def create\n if user = User.find_by_login(params[:login])\n # Save the user ID in the session so it can be used in subsequent requests\n session[:current_user_id] = user.id\n redirect_to root_url\n end\n end",
"def create\n user = User.find_by(username: params[:username])\n if user.authenticate(params[:password])\n session[:current_user] = user.id\n redirect_to users_path\n else\n redirect_to login_path\n end\n end",
"def create\n user = User.find_by_email(params[:session][:email].downcase)\n if user && user.authenticate(params[:session][:password]) && user.manager && !user.admin #syndicate manager\n sign_in user\n #redirect_back_or user\n redirect_back_or users_url\n #redirect_to users_url\n #sign in\n elsif user && user.authenticate(params[:session][:password]) && !user.manager && user.admin #superuser\n sign_in user\n #redirect_back_or user\n redirect_to admin_url\n else\n #error and re render sign in form\n flash[:error] = 'Invalid email/password combination'\n render 'new'\n end\n end",
"def create\n # Find the user by their name\n user = User.find_by(name: params[:session][:name].downcase)\n # If the user exists and the user credentials are correct\n if user && user.authenticate(params[:session][:password])\n # Log the user in\n login user\n # Take the user to their profile page\n redirect_to me_path\n else\n # Notify the user that their credentials are incorrect\n flash[:error] = 'Invalid email/password combination'\n # Redirect to the home page\n redirect_to root_path\n end\n end",
"def create\n\n user = current_instance.users.where(username: params[:username]).first\n if user && user.authenticate(params[:password])\n session[:user_id] = user.id\n redirect_to root_path, notice: 'You have been successfully logged in to Unify.'\n else\n flash[:error] = 'Invalid username and/or password.'\n render :new\n end\n\n end",
"def create\n #from has_secure_password docs -- try to find by the passed-in params of user, try and authetnicate the password\n @user = User.find_by(name: params[:user][:name]).try(:authenticate, params[:user][:password]) \n #redirect them back to the controller unless the above returned a truthy value (e.g. it knows what @user is)\n return redirect_to controller: 'users', action: 'new' unless !!@user\n #set the session user id to the found @user.id\n session[:user_id] = @user.id\n #then redirect them to the users controller, welcome\n redirect_to(controller: 'users', action: 'welcome')\n end",
"def create\n @user = User.find_by_credentials(params[:user][:email],params[:user][:password])\n\n if @user.nil?\n flash.now[:errors] = [\"incorrect email/password combination\"]\n render :log_in\n else\n @user.reset_session_token!\n session[:session_token] = @user.session_token\n # fail\n redirect_to user_url(@user)\n end\n end",
"def create\n\t\tuser = User.where(:email => params[:email]).first\n\t\tif user.present? && user.authenticate(params[:password])\n\t\t\tsession[:user_id] = user.id\n\t\t\tredirect_to root_path\n\t\telse \n\t\t\tredirect_to new_session_path\n\t\tend\n\n\tend",
"def create\n # Where do we want to redirect to with our new session\n path = cookies.encrypted[:continue] || success_path\n\n # Get auth hash from omniauth\n auth = request.env[OMNIAUTH]\n\n if auth.nil?\n return login_failure({})\n end\n\n # Find an authentication or create an authentication\n auth_model = ::Auth::Authentication.from_omniauth(auth)\n\n # adding a new auth to existing user\n if auth_model.nil? && signed_in?\n logger.info \"User signed in and re-authenticating\"\n\n ::Auth::Authentication.create_with_omniauth(auth, current_user.id)\n redirect_to path\n Auth::Authentication.after_login_block.call(current_user, auth[PROVIDER], auth)\n\n # new auth and new user\n elsif auth_model.nil?\n args = safe_params(auth.info)\n user = ::User.new(args)\n\n # Use last name and first name by preference\n fn = args[:first_name]\n if fn && !fn.empty?\n user.name = \"#{fn} #{args[:last_name]}\"\n end\n\n authority = current_authority\n\n existing = ::User.find_by_email(authority.id, user.email)\n user = existing if existing\n user.deleted = false if user.respond_to?(:deleted)\n\n user.authority_id = authority.id\n\n # now the user record is initialised (but not yet saved), give\n # the installation the opportunity to modify the user record or\n # reject the signup outright\n result = Auth::Authentication.before_signup_block.call(user, auth[PROVIDER], auth)\n\n logger.info \"Creating new user: #{result.inspect}\\n#{user.inspect}\"\n \n if result != false && user.save\n # user is created, associate an auth record or raise exception\n Auth::Authentication.create_with_omniauth(auth, user.id)\n\n # make the new user the currently logged in user\n remove_session\n new_session(user)\n\n # redirect the user to the page they were trying to access and\n # run any custom post-login actions\n redirect_to path\n Auth::Authentication.after_login_block.call(user, auth[PROVIDER], auth)\n else\n logger.info \"User save failed: #{user.errors.messages}\"\n\n # user save failed (db or validation error) or the before\n # signup block returned false. redirect back to a signup\n # page, where /signup is a required client side path.\n store_social(auth[UID], auth[PROVIDER])\n redirect_to '/signup/index.html?' + auth_params_string(auth.info)\n end\n\n # existing auth and existing user\n else\n begin\n # Log-in the user currently authenticating\n remove_session if signed_in?\n user = User.find_by_id(auth_model.user_id)\n new_session(user)\n redirect_to path\n Auth::Authentication.after_login_block.call(user, auth[PROVIDER], auth)\n rescue => e\n logger.error \"Error with user account. Possibly due to a database failure:\\nAuth model: #{auth_model.inspect}\\n#{e.inspect}\"\n raise e\n end\n end\n end",
"def create\n \tuser = User.find_by :email => params[:email]\n \tif user.present? && user.authenticate(params[:password])\n \t\tsession[:user_id] = user.id\n \t\tredirect_to root_path\n \telse\n \t\tredirect_to login_path\n \tend\n end",
"def attempt_signin(user_params)\n current_account.user_sessions.create(user_params)\n end",
"def create\n\t\t# method interacts with session > new.html.erb view\n\t\tuser = User.where(email: params[:user_email]).first\n\t\tif user && user.authenticate(params[:password])\n\t\t\tsession[:user_id] = user.id.to_s\n\t\t\tredirect_to '/'\n\t\telse\n\t\t\tredirect_to :back\n\t\tend\n\tend",
"def create_from_bookshelf\n @user = User.find_by(email: params[:email]) # Find user by email\n\n if @user && @user.authenticate(params[:password]) # If user exists and is authenticated, log them in by adding their ID to the session hash\n session[:user_id] = @user.id\n redirect_to user_path(@user)\n elsif !@user # If user doesn't exists flash error on signin page\n flash[:alert] = \"We don't have an account associated with that email.\" \n redirect_to signin_path\n else # If password is incorrect flash error on signin page\n flash[:alert] = \"Your password is incorrect - please try again.\" \n redirect_to signin_path\n end\n\n end",
"def create\n user = User\n .find_by(email: params[\"user\"][\"email\"])\n .try(:authenticate, params[\"user\"][\"password\"])\n # if the user was created, i.e., found an email password match, set session\n if user\n # sets an encrypted session cookie on the client side\n session[:user_id] = user.id\n render json: {\n status: :created,\n logged_in: true,\n user: user\n }\n else\n render json: { status: 401 }\n end\n end",
"def create\n # Get submitted email and password\n address = params[:session][:email]\n password = params[:session][:password]\n\n # Pull the user from the db\n user = User.find_by(email: address.downcase)\n\n # User exists and password is correct\n if user && user.authenticate(password)\n # Login user\n create_session user\n\n # Show user profile page\n redirect_to user\n\n # There were invalid credentials\n else\n # Show an error message\n flash.now[:warning] = \"You cocked up. Try again.\"\n\n # Show login page again\n render 'new'\n end\n end",
"def create\n reset_session\n params[:user] ||= {}\n username = params[:user][:username].to_s\n password = params[:user][:password].to_s\n user = User.where('username = ? and crypted_password = ?', username, User.encrypt(password)).first\n\n params[:client_uid] = 'Web Platform' if request.format.html?\n \n if user && params[:client_uid]\n session_obj = Session.create(user_id:user.id, client_uid:params[:client_uid])\n session[:app_session_id] = session_obj.id\n session[:user_id] = user.id\n\n if request.format.html?\n redirect_to controller: 'main'\n elsif request.format.json?\n render json: {success: true, session: session_obj.to_json}\n end\n else\n if request.format.html?\n flash[:alert] = \"Cannot login, please try again\"\n render action: 'new'\n elsif request.format.json?\n render json: {success: false, message: 'Cannot login, please try again'}\n end\n end\n end",
"def create\n user = User.find_by(username: params[:username])\n authenticated = user.try(:authenticate, params[:password])\n return head(:forbidden) unless authenticated\n @user = user\n session[:user_id] = @user.id\n end",
"def login_as(user)\n UserSession.create(users(user))\n end",
"def create\n begin\n if params[\"override\"]\n # just fake the session\n logger.debug(\"faking session with id #{params[\"username\"]}\")\n @els_identity = ElsFaker.new(params[\"username\"])\n else\n logger.debug(\"attempting to authenticate #{params[\"username\"]}\")\n token = authenticate(params[\"username\"],params[\"password\"])\n logger.debug(\"got token #{token}\")\n if token\n @els_identity = get_token_identity(token)\n flash[:notice] = \"cannot retrieve identity\" unless @els_identity\n else\n flash[:error] = \"unable to authenticate\"\n end\n end\n rescue Exception => e\n flash[:error] = \"Something went wrong #{e.message}\"\n end\n if @els_identity\n update_and_return\n else\n render :new\n end\n end",
"def create\n @user = User.find_by_email(params[:session][:email])\n if @user && @user.authenticate(params[:session][:password])\n session[:user_id] = @user.id\n owner = Owner.where(:user_id == @user.id)\n redirect_to user_owner_path(@user, owner)\n else\n flash[:alert] = \"Your username/password combination was invalid.\"\n redirect_to 'login'\n end\n end",
"def create\n #Try to find the user in the database\n user = User.find_by(email: params[:session][:email].downcase)\n #If the password matches, log the user in and redirect them to the user profile page\n if user && user.authenticate(params[:session][:password])\n log_in(user) #store id in cache\n redirect_to user_url(user)\n #Display error message and refresh the page if password is invalid\n else\n flash.now[:danger] = \"Invalid username or password\"\n #refresh the page\n render 'new'\n end\n end",
"def create\n user = User.find_by(email: params[:email])\n\n p user\n p params[:email]\n p params\n if user && user.authenticate(params[:password])\n session[:user_id] = user.id\n redirect_to user_path(user)\n else\n redirect_to authentication_index_path\n end\n end",
"def create\n # byebug\n user = User.find_by(email: user_params[:email])\n if user && user.authenticate(user_params[:password])\n # save the user's id into the session\n session[:user_id] = user.id\n #redirect to the show page\n redirect_to root_url\n else\n #there was an error logging the user in\n flash[:danger] = \"Invalid email/password combination\"\n render :new \n end\n end",
"def create\n user = User.find_by(name: params[:name])\n if user&.authenticate(params[:password])\n session[:user_id] = user.id\n redirect_to home_path\n else\n redirect_to login_path, alert: \"Invalid user/password combination\"\n end\n end",
"def create\n user = User.find_by_email(params[:email])\n\n if user && user.authenticate(params[:password])\n session[:user_id] = user.id\n redirect_to \"/users/#{user.id}\"\n else\n flash[:errors] = [\"Invalid combination\"]\n redirect_to new_session_path\n end\n\n end",
"def create\n user = User.find_by(:name => params[:name])\n if user && user.authenticate(params[:password])\n session[:user_id] = user.id\n redirect_to user_path(user)\n else\n render :new\n end\n end",
"def create\n @user = User.where(username: params[:session][:username]).first\n if @user.password == params[:session][:password]\n session[:user_id][email protected]\n log_in @user\n puts \"my sess = #{session[:user_id]}\"\n redirect_to @user\n else\n flash[:alert] = \"Invalid Username/Password. Please try again\"\n redirect_to login_path\n end\n end",
"def create\n user = User.find_by(email: params[:session][:email].downcase)\n\n # If the user exists and the password entered is valid\n if !user.blank? && user.authenticate(params[:session][:password])\n log_in user\n redirect_to root_path\n else\n flash[:error] = 'Your email or password is incorrect.'\n render 'new'\n end\n end",
"def create\n email = params[:email]\n password = params[:password]\n\n user = User.find_by(email: email)\n if user && user.authenticate(password)\n session[:user_id] = user.id\n redirect_to root_path\n # logged in!\n else\n # Nope, something went wrong\n redirect_to login_path\n end\n end",
"def create\n user = User.authenticate(params[:email], params[:password])\n if user\n session[:user_id] = user.id\n respond_to do |format|\n format.html { redirect_to admin_root_url }\n format.json { render :json => user, :status => :ok}\n end\n else\n flash.now.alert = t('flash.sessions.create.invalid_login')\n respond_to do |format|\n format.html { render :new }\n format.json { render :json => {'base' => t('flash.sessions.create.invalid_login')}, :status => :not_found}\n end\n end\n end",
"def create\n user = User.where(:username => params[:session][:username].downcase).first\n \n if user && user.authenticate(params[:session][:password])\n log_in user\n user['last_login'] = Time.now.to_datetime\n user.save\n flash[:success] = \"Welcome back #{user.username}!\"\n redirect_to home_path\n else\n # Otherwise, keep them on the login page.\n flash.now[:danger] = 'Invalid username or password'\n render 'new'\n end\n end",
"def create\n # Find the user\n user = User.find_by(email: params[:session][:email].downcase)\n # Get the password from the parameters\n password = params[:session][:password]\n # Try to authenticate the user\n if user && user.authenticate(password)\n flash[:success] = \"Welcome back #{user.username}\"\n # Store the user id in the session\n session[:user_id] = user.id\n # Redirect the user to its page\n redirect_to user_path(user)\n else\n # Since we are using render, there won't be another request, so we need to use flash.now\n flash.now[:danger] = \"Wrong email or password. Please try again.\"\n render :new\n end\n end",
"def create\n \t@user = User.find_by(e_mail: params[:session][:email].downcase)\n \tif @user && @user.authenticate(params[:session][:password])\n \t\t# Login successful, save user_id to session and redirect to user page\n \t\tlog_in @user\n \t\tredirect_to home_path\n \telse\n \t\t# Login unsuccessful, redirect to Log In Page and display an error message\n \t\tflash.now[:danger] = 'Invalid email/password combination'\n render \"new\"\n \tend\n end",
"def login_as(user)\n Session.create(users(user))\n end",
"def create\n if using_open_id?\n open_id_authentication(params[:openid_url])\n elsif params[:login]\n password_authentication(params[:login], params[:password])\n end\n# self.current_user = User.authenticate(params[:login], params[:password])\n# if logged_in?\n# session[:user] = User.find(self.current_user)\n# \n# redirect_to :controller => :users, :action => :show, :id => self.current_user\n# flash[:notice] = \"Logged in successfully\"\n# else\n# render :action => 'new'\n# end\n end",
"def create\n user = User.find_by(email: params[:session][:email].downcase)\n if user&.authenticate(params[:session][:password])\n reset_session\n log_in user\n redirect_to user\n else\n flash.now[:danger] = 'Invalid email password combo'\n render 'new'\n end\n end",
"def create\n user = User.find_by_email(params[:email])\n if user && user.authenticate(params[:password])\n session[:user_id] = user.id\n session[:authenticated] = true\n redirect_to root_url, :notice => \"Successfully logged in.\"\n return\n else\n flash.now.alert = \"Invalid email or password\"\n render 'new'\n end\n end",
"def create\n user = User.find_by_username(params[:username])\n \n if user && user.authenticate(params[:password])\n session[:event_id] = nil\n session[:family_id] = nil\n session[:user_id] = user.id\n redirect_to(:home)\n else\n flash[:notice] = \"Invalid username or password\"\n redirect_to(:new_login)\n end\n end",
"def create\n user = User.find_by(email: params[:email])\n if user && user.authenticate(params[:password])\n #if user exists (by their email) and their password is authenticated\n #then create a session with :user_id as the key and this particular users id as its value\n session[:user_id] = user.id\n redirect_to products_url, notice: \"You're logged in!\"\n else\n flash.now[:alert] = \"Invalid email or password\"\n render :new\n end\n end",
"def create\n user=ApiM8::Client::Account::Users.instance.login(params[:login], params[:password])\n puts user.current_user\n\n if user\n session[:current_user_id]=user.id\n redirect_to role_super_admin_dashboards_url, :notice => \"Logged in as #{params[:login]}!\"\n else\n flash[:danger] = 'Invalid email/password combination' # Not quite right!\n render \"new\"\n end\n\n\n end",
"def create\n user = Backend::User.authenticate(params[:session][:login],\n params[:session][:password])\n \n if user.nil?\n flash.now[:error] = I18n.translate('sessions.signin.flash.invalid')\n @title = I18n.translate('sessions.signin.title')\n render 'new'\n else \n sign_in_to_backend(user)\n if !user.admin? && !user.staff? && user.partner?\n redirect_to backend_partner_sites_path\n else\n redirect_to backend_dashboard_path\n end\n end \n\n end",
"def create\n user = User.find_by_email( params[:session][:email].downcase )\n\n if user and user.authenticate( params[:session][:password] )\n sign_in user \n redirect_to root_url\n else\n flash[:error] = \"invalid email/password\"\n render :action => 'new' \n end\n end",
"def create\n user = User.find_by_email(params[:email])\n if user && user.authenticate(params[:password]) && user.confirm\n session[:user_id] = user.id\n session[:expires_at] = Time.now + 120.minutes\n redirect_to main_url\n else\n flash[:error] = \"Invalid username or password\"\n render \"new\"\n end\n end",
"def create\n user = User.find_by(username: params[:session][:username])\n\n if user && user.authenticate(params[:session][:password])\n # Log the user in\n log_in user\n user.update_attribute(:is_login, true)\n redirect_to index_path\n else\n # Using render in case any error flash message is to shown in future. \n render 'new'\n end # END IF-ELSE login\n end",
"def create\n user = User.find_by :email => params[:email]\n if user.present? && user.authenticate(params[:password])\n session[:user_id] = user.id\n redirect_to dashboard_path\n else\n flash[:error] = \"Invalid email or password\"\n redirect_to login_path\n end\nend",
"def create\n # find the user based on email in params from post action. Downcase as all emails are downcased in database.\n user = User.find_by(email: params[:session][:email].downcase)\n # is user returned valid? If so, authenticate (.authenticate comes from bcrypt gem. Checks if the password matches.)\n if user && user.authenticate(params[:session][:password])\n # Save the user id in the session's hash (add a :user_id key & save the current user's id as the value)\n session[:user_id] = user.id\n # show success message & redirect to the logged in user's profile page\n flash[:success] = \"You have successfully logged in\"\n redirect_to user_path(user)\n # If either is false, then show fail message and render the login page again\n else\n flash.now[:danger] = \"There was something wrong with your login info\"\n render 'new'\n end\n end",
"def create\n email = params[:session][\"email\"] # both will work ->: will use less memory\n password = params[:session][:password]\n user = User.authenticate(email, password)\n \n if user # if auth is successful\n session[:user_id] = user.id # this is a session\n flash[:notice] = \"You are logged in.\"\n redirect_to session[:referrer] || :root # to whatever is the root of your webserver ()\n #:referrer -> send to page that started from (if tried to edit if not logged in)\n else # if wrong credentials\n flash[:error] = \"add to your FAIL blog and Please try again!\"\n render :action => \"new\" # just shows def new end (at the beginning again)\n end\n end",
"def create_session\n @user = User.new(nickname: User.temp_user_name)\n @user.save\n session[:user_id] = @user.id\n @user\n end",
"def create\n \n user = User.find_by_email(params[:email])\n Rails.logger.debug(\"Attempting to authenticate: #{user.inspect}\")\n if user && user.authenticate(params[:password])\n session[:user_id] = user.id\n redirect_to root_path, :notice => 'You have been successfully logged in.'\n else\n render 'new'\n end\n\n end",
"def create\n \tuser = User.find_by(email: params[:session][:email].downcase)\n \tif user and user.authenticate(params[:session][:password])\n \t\tlog_in(user)\n # redirect_to \"/users/#{user.id}\"\n redirect_to '/'\n \telse\n \t\tflash.now[:danger] = \"Invalid email/password confirmation!\"\n \t\trender 'new'\n \tend\n end",
"def authenticate\n unless session[:user_id]\n session['return_url'] = request.url\n logger.debug request.url\n # Recreate user abilities on each login\n @current_ability = nil\n redirect_to polymorphic_url(:new_user_session)\n end\n end",
"def create\n action = LogUserIn.new :web\n @session = Session.new params[:session]\n\n if user = action.run(@session.login, @session.password)\n previous_path = session[:login_redirect_to]\n set_new_user_session user, @session.remember_me\n\n redirect_to previous_path || root_path\n else\n flash.now[:login_error] = true\n render action: \"new\"\n end\n end",
"def create\n u = params[:username]\n p = params[:password]\n user_session = UserSession.new(:login => u, :password => p, :remember_me => true)\n if not user_session.save then\n return render :text => \"error\", :status => 401\n end\n\n ret = { :user => User.find_by_username_or_email(user_session.login) }\n ret[:redir] = URI.parse(session.delete(:return_to)).path if session.include? :return_to\n restful ret\n end",
"def create\n user = User.find_by(email: params[:session][:email].downcase)\n if user && user.authenticate(params[:session][:password])\n sign_in user\n redirect_back_or user\n else\n flash.now[:error] = 'Invalid email/password combination'\n render 'new'\n end\nend",
"def create\n #see if the user's name exists in the database and save it to an instance variable\n @user = User.find_by(name: params[:name])\n # byebug\n #if the user name does exist AND their authentification checks out using their submitted password, which is saved in the params, then we set session at a key of user_id to this user's object id (this is what allows their session to continually persist no matter which page they navigate to) then redirect them to their show page\n if @user && @user.authenticate(params[:password])\n\n session[:user_id] = @user.id\n redirect_to user_path(@user)\n #else we direct user back to the login page with the invalid message\n else\n flash[:message] = \"Invalid username or password\"\n redirect_to login_path\n end\n end",
"def create\n user = User.find_by_login(params[:session][:login])\n if user && user.authenticate(params[:session][:password])\n sign_in user\n redirect_back_or user_path(user.login)\n else\n flash.now[:error] = \"Ungültige Passwort / Login Kombination\"\n render 'new'\n end\n end",
"def login_from_session\n self.current_user = User.find_by_id( session[ :user_id ] ) if session[ :user_id ]\n end",
"def create\n \tuser = User.find_by(email: params[:session][:email])\n\n \tif user && user.authenticate(params[:session][:password])\n \t\trender text: user.auth_token, status: 200\n \t\telse\n \t\t\trender text: \"Invalid email or password\", status: 422\n \t\tend\t\n end",
"def create_session\n self.current_user = authenticate_user(params[:user][:login], params[:user][:password], :trace => true)\n \n # store remember me in token\n if logged_in?\n if params[:user][:remember_me] == \"1\"\n current_user.remember_me unless current_user.remember_token?\n cookies[cookie_auth_token] = {\n :value => self.current_user.remember_token, :expires => self.current_user.remember_token_expires_at\n }\n end\n \n # callback :after_authentication_success\n self.send(:after_authentication_success, self.current_user) if self.respond_to?(:after_authentication_success)\n \n if !performed? && request.xhr?\n render :update do |page|\n # JS code to close modal\n # update page header to show user information\n end\n elsif !performed?\n flash[:notice] = MESSAGE_LOGIN_SUCCESS\n redirect_back_or_default(authentication_success_url || '/')\n end\n else\n # callback :after_authentication_error\n self.send(:after_authentication_error, self.current_user) if self.respond_to?(:after_authentication_error)\n if !performed? && request.xhr?\n render :update do |page|\n # JS code to re-display login dialog\n end\n elsif !performed?\n flash[:error] = user_class.is_suspended?(params[:user][:login], params[:user][:password]) ? \n \"Login nicht möglich, da Benutzer gesperrt wurde.\" : \n MESSAGE_LOGIN_ERROR\n render :action => 'new'\n end\n end\n end",
"def create\n session[:enable_admin_pages] = false\n user = User.find_by(netid: auth_hash['extra']['netid'])\n if user\n session[:netid] = user.netid\n flash[:success] = \"Signed in as #{user.name}\"\n\n # Check auth for admin paths - in this case they have a user record, so set true\n # In other apps further permissions can be checked e.g. admin user type\n session[:enable_admin_pages] = true\n\n redirect_to session[:return_url] || root_path\n else\n redirect_to not_authorized_path\n end\n end",
"def create\n puts \"I am in sessions create method with params.inspect of #{params.inspect}\"\n puts \"I am in sessions create method with params for user of #{params[:user]}\"\n puts \"I am in sessions create method with params of user's email #{params[:user][:email]}\"\n\n #TEST with LOWER case (as when saved to database):\n email = params[:user][:email]\n email.downcase!\n @user=User.find_by_email(email).try(:authenticate, params[:user][:password])\n puts \"Printing response from try to authenticate in sessions create method (null or user, or false): #{@user}\"\n \n # THIS IS WHERE SESSION GETS SET:\n # ================================\n if @user #(if !null or !false)\n session[:user_id][email protected]\n # Authenticate is true\n # -> save user id to session\n # -> redirect_to users profile page (i.e. get 'users/:id')\n redirect_to \"/groups\"\n else\n puts \"...Authenticate must have not found user or not authenticated. Displaying two flash errors on redirect to login...\"\n # If authenticate false or null,\n # 1) add an error message:\n # ====================================\n # flash[:notice] = [\"Message 1\"]\n # flash[:notice] << \"Message 2\"\n # AND IN VIEW: \n # <%= flash[:notice].join(\"<br>\") %>\n # ====================================\n flash[:errors] = [\"Invalid Login.\"]\n flash[:errors] << \"Incorrect Email or Wrong Password detected!\"\n # NOTE: \"notice\" and \"alert\" are very common keys in flash:\n # *****************************************************************\n # redirect_to root_url, flash: { referral_code: 1234 }\n # redirect_to root_url, notice: \"You have successfully logged out.\" \n # redirect_to root_url, alert: \"You're stuck here!\"\n # ******************************************************************\n # 2) and redirect_to 'login' view:\n redirect_to '/sessions/main'\n # Can ALSO simply *render* on unsuccessful submit, with flash.now[:error]=[\"Invalid Login\"], \n # to display flash *now*, instead of on next redirect. \n # (NOTE: also use flash.keep to persist for yet another redirect if used on next action to *catch it*)\n # ( render 'new' # renders the 'new.html.erb' in the sessions controller.)\n end\n end",
"def create\n @user = User.find_by(email: params[:session][:email].downcase)\n if @user&.authenticate(params[:session][:password]) # & for safe navigation\n log_in @user\n params[:session][:remember_me] == '1' ? remember(@user) : forget(@user)\n redirect_back_or @user\n else\n flash.now[:danger] = 'Invalid email/password combination'\n render 'new'\n end\n end",
"def login_user\n\t @user_session = UserSession.new\t \n\tend",
"def create\n\t\t@user = User.find_by(email: user_params[:email])\n if @user && @user.authenticate(user_params[:password])\n\t\t\tsession[:user_id] = @user.id\n\t\t\tredirect_to user_url(@user)\n\t\telse\n\t\t\tflash.notice = \"Login failed. Try again.\"\n \t\tredirect_to root_url\n\t\tend\n\tend",
"def create\n \t# the params has has all the information needed to authenticate the user\n \tuser = User.find_by(email: params[:session][:email].downcase)\n\t\t#pulls the user out of the db based on the submitted email address.\n\n \t# params[:session][:email] is a hash for the submitted email\n if user && user.authenticate(params[:session][:password])\n \t# params[:session][:password] is a hast for the submitted password\n\n #Listing 8.13. The completed Sessions controller create action (not yet working). \n # Sign the user in and redirect to the user's show page. \n sign_in user\n\n #Listing 9.19: The Sessions create action with friendly forwarding.\n #redirect_to user\n redirect_back_or user\n #redirect_back_or user defined in /app/helpers/sessions_helper.rb\n else\n #Listing 8.12. Correct code for failed signin. Using flash.now\n flash.now[:error] = 'Invalid email/password combination' # Not quite right! \t\t\n # flash and error message\n render 'new'\n # render the /app/views/sessions/new.html.erb\n end\n end",
"def create\n if user = User.Authenticate(params[:login][:email], params[:login][:password])\n # Save the user ID in the session so it can be used in\n # subsequent requests\n session[:current_user_id] = user.id\n redirect_to root_url\n else\n \tflash[:error] = \"Email ou senha incorreto.\"\n \trender :index\n end\n end",
"def create\n unless session[:user_id].present?\n user = User.create_user\n session[:user_id] = user.id\n end\n end",
"def create\n\t\tuser = User.from_sso(cookies[:UTEP_SE], cookies[:UTEP_SA])\n\t\tlog_in(user) if user\n\t\tredirect_to root_url\n\tend",
"def create\n # super\n params[:user] = params[:user_session] if params[:user_session]\n resource = User.find_for_database_authentication(:email => params[:user][:email])\n return invalid_login_attempt unless resource\n if resource.valid_password?(params[:user][:password])\n sign_in(resource_name, resource)\n # render :json => {result: true, content: '登陆成功'}\n redirect_to '/', notice: '登陆成功.'\n return\n end\n invalid_login_attempt\n end",
"def create \n user = User.find_by(username: params[\"user\"][\"username\"]).try(:authenticate, params[\"user\"][\"password\"])\n\n if user \n session[:user_id] = user.id\n render json: {\n status: :created,\n logged_in: :true,\n user: user\n }\n else\n render json: { status: 401 }\n end\n\n end"
]
| [
"0.7728926",
"0.767955",
"0.76678735",
"0.7634079",
"0.76272017",
"0.7523402",
"0.74983436",
"0.7497016",
"0.74340916",
"0.7414648",
"0.74095887",
"0.74053264",
"0.7404066",
"0.73638254",
"0.73620033",
"0.7350743",
"0.73401463",
"0.7339073",
"0.7327648",
"0.7316882",
"0.7302812",
"0.72946227",
"0.7288201",
"0.72846687",
"0.7281694",
"0.7280214",
"0.72788215",
"0.7277482",
"0.72461635",
"0.7244918",
"0.7244761",
"0.7238903",
"0.7237939",
"0.723688",
"0.7232406",
"0.72318614",
"0.7227011",
"0.7226591",
"0.7224206",
"0.7223884",
"0.72169876",
"0.7191564",
"0.7188592",
"0.71837646",
"0.71811396",
"0.7177838",
"0.7176857",
"0.71763706",
"0.7175419",
"0.7161843",
"0.7151913",
"0.7150954",
"0.71501756",
"0.7149037",
"0.7148287",
"0.7138907",
"0.71330374",
"0.7129582",
"0.71295065",
"0.7127531",
"0.7120874",
"0.71205807",
"0.71177053",
"0.71161306",
"0.7111225",
"0.7109651",
"0.71047556",
"0.7099211",
"0.70978695",
"0.70977604",
"0.70971954",
"0.7096179",
"0.7095484",
"0.70915455",
"0.7091279",
"0.7088712",
"0.70836496",
"0.70779026",
"0.70768434",
"0.70699775",
"0.7069135",
"0.7050457",
"0.7041075",
"0.70393705",
"0.70373017",
"0.70335823",
"0.7027541",
"0.70236063",
"0.7022102",
"0.7015569",
"0.70124465",
"0.7010138",
"0.70036614",
"0.6996526",
"0.6995811",
"0.69897175",
"0.69887215",
"0.6982244",
"0.69822305",
"0.6975419",
"0.69753194"
]
| 0.0 | -1 |
uses googleAuth code to create a user from omniauth, set tokens, and set session id | def googleAuth
access_token = request.env["omniauth.auth"]
@user = User.from_omniauth(access_token)
@user.save
@user.google_token = access_token.credentials.token
refresh_token = access_token.credentials.refresh_token
@user.google_refresh_token = refresh_token if refresh_token.present?
session[:user_id] = @user.id
redirect_to contacts_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_google\n @user = GetOauthUser.new(:service_hash => omniauth_hash).call\n\n if @user\n establish_session @user\n redirect_to return_location\n else\n redirect_to sign_in_url, :notice => \"Error signing in\"\n end\n end",
"def omniauth\r\n @user = User.create_by_google_omniauth(auth)\r\n \r\n session[:user_id] = @user.id\r\n redirect_to user_path(@user)\r\n end",
"def create\n id_token = flash[:google_sign_in_token]\n if user = authenticate_with_google(id_token)\n cookies.signed[:user_id] = user.id\n else\n @user = User.new\n @user.name = GoogleSignIn::Identity.new(id_token).name\n @user.google_id = GoogleSignIn::Identity.new(id_token).user_id\n @user.save\n cookies.signed[:user_id] = @user.id\n end\n callback = cookies.signed[:callback]\n cookies.delete(:callback)\n redirect_to callback\n end",
"def create\n @user = User.new(google_auth_user_strong_params)\n @user.add_random_password\n\n if @user.valid?\n @user.save\n session[:user_id] = @user.id\n redirect_to root_path, notice: 'Account created with Google'\n else\n render 'google_auth/new'\n end\n end",
"def create_from_google(user_info)\n @user = User.find_or_create_by(uid: user_info[\"uid\"]) do |u|\n u.name = user_info[\"info\"][\"name\"]\n u.email = user_info[\"info\"][\"email\"]\n u.image_url = user_info[\"info\"][\"image\"]\n u.password = \"none\"\n end # Find or create user from Google data\n\n session[:user_id] = @user.id # Log user in by adding id to session hash\n redirect_to user_path(@user) # redirect to user show page\n end",
"def omniauth\n if params[:provider] == 'github'\n @user = User.find_or_create_by_github_omniauth(auth)\n else \n @user = User.find_or_create_by_google_omniauth(auth)\n end\n\n session[:user_id] = @user.id\n redirect_to user_path(@user)\n end",
"def google #find or create a user using the attrs sent by google\n @user = User.find_or_create_by(email: auth[\"info\"][\"email\"]) do |user|\n user.username = auth[\"info\"][\"first_name\"]\n user.password = SecureRandom.hex(10) #assigns random password to the user\n end \n if @user.save\n session[:user_id] = @user.id #set the session id which logs them in\n redirect_to user_path(@user.id)\n else \n flash[:message] = 'There was a problem signing you in through Google. Please register or try signing in later.'\n redirect_to '/login' #if user doesn't save redirect to homepage\n end \n end",
"def omniauth\n @user = User.from_omniauth(auth)\n @user.save\n session[:user_id] = @user.id\n puts \"You have been successfully logged in with Google\"\n redirect_to orders_path\n end",
"def create\n\n\t\t# grab the authentication return\n\t\tauth = request.env[\"omniauth.auth\"]\n\n\t\t# now create a temporary user with the auth element etc\n\t\tuser = User.omniauth_create auth\n\n\t\t# now set the session_id \n\t\tsession[:id] = user.id\n\n\t\t# redirect back to the root which can successfully switch the pages of the application etc\n\t\tredirect_to root_url, :notice => \"Successful Authentication\"\t\n\tend",
"def create\n @user = User.find_or_create_with_omniauth auth_hash\n session[:user_id] = @user.id\n redirect_to auth_path\n end",
"def create\n auth = request.env[\"omniauth.auth\"]\n user = User.find_by_provider_and_uid(auth[\"provider\"], auth[\"uid\"]) || User.create_with_omniauth(auth)\n session[:user_id] = user.id\n redirect_to app_path\n end",
"def omniauth \n\n @user = User.create_by_google_omniauth(auth)\n # @user = User.find_or_create_by(username: auth[:info][:email]) do |u| #moved this method to user model\n # u.password = SecureRandom.hex \n # end\n\n session[:user_id] = @user.id\n #if you havent set the password, it wont assign a userid, which means we won't have a user here to deal with\n redirect_to user_path(@user)\n\n #User.where(email: auth[:info][:email]).first_or_initialize\n #both .where method and .find_or_create_by method accomplish same thing\n \n end",
"def create\n user = User.from_omniauth(env[\"omniauth.auth\"])\n session[:user_id] = user.id\n \n redirect_to root_path\n end",
"def create_from_oauth\n if stored_anonymous_user?\n user, from_registration = update_from_omniauth(env[\"omniauth.auth\"], params[:provider])\n else\n user, from_registration = create_from_omniauth(env[\"omniauth.auth\"], params[:provider])\n end\n\n if user.errors.any?\n redirect_to_registration_page(user)\n else\n change_global_user_id(user.id)\n sign_in(user)\n fandom_play_login(user)\n \n if from_registration\n log_data = { 'form_data' => env[\"omniauth.auth\"], 'user_id' => current_user.id }\n log_synced(\"registration from oauth\", adjust_user_and_log_data_with_utm(user, log_data))\n\n set_account_up()\n cookies[:from_registration] = true \n end\n\n if $site.force_facebook_tab && !request_is_from_mobile_device?(request)\n redirect_to request.site.force_facebook_tab\n else\n redirect_after_oauth_successful_login()\n end\n end\n end",
"def create\n omniauth = env['omniauth.auth']\n\n user = User.find_by(uid: omniauth['uid'])\n unless user\n # New user registration\n user = User.new(uid: omniauth['uid'])\n end\n user.email = omniauth['info']['email']\n user.save\n\n # p omniauth\n\n # Currently storing all the info\n session[:user_id] = omniauth\n\n flash[:notice] = t(:successfully_logged_in)\n redirect_to root_path\n end",
"def create_from_omniauth\n auth_hash = request.env[\"omniauth.auth\"]\n authentication = Authentication.find_by_provider_and_uid(auth_hash[\"provider\"], auth_hash[\"uid\"]) || Authentication.create_with_omniauth(auth_hash)\n\n # if: previously already logged in with OAuth\n if authentication.user\n user = authentication.user\n authentication.update_token(auth_hash)\n @next = root_url\n @notice = \"Signed in!\"\n # else: user logs in with OAuth for the first time\n else\n user = User.create_with_auth_and_hash(authentication, auth_hash)\n # you are expected to have a path that leads to a page for editing user details\n @next = edit_user_path(user)\n @notice = \"User created. Please confirm or edit details\"\n end\n\n sign_in(user)\n redirect_to @next, :notice => @notice\n end",
"def create\n auth_hash = request.env['omniauth.auth']\n redirect to login_failure_path unless auth_hash['uid']\n\n @user = User.find_by(uid: auth_hash[:uid], provider: 'github')\n if @user.nil?\n # User doesn't match anything in the DB.\n # Attempt to create a new user.\n @user = User.build_from_github(auth_hash)\n unless @user.save\n render :creation_failure\n end\n # Save the user ID in the session\n end\n session[:user_id] = @user.id\n redirect_to user_path(@user.id)\n end",
"def amniauth_create\n user = User.find_or_create_by(:provider => auth_hash[:provider], :uid => auth_hash[:uid]) do |user|\n user.name = auth_hash[:info][:name]\n end\n\n session[:user_id] = user.id\n redirect_to user_path(user)\n end",
"def create\n user = User.from_omniauth(env[\"omniauth.auth\"])\n session[:user_id] = user.id\n redirect_to '/mindapp/pending'\n rescue\n redirect_to root_path, :alert=> \"Authentication failed, please try again.\"\n end",
"def create\n auth = request.env[\"omniauth.auth\"]\n user = User.find_by_provider_and_uid(auth[\"provider\"], auth[\"uid\"]) || User.create_with_omniauth(auth)\n User.update(user.id, :fb_nickname => auth[\"info\"][\"nickname\"])\n session[:user_id] = user.id\n redirect_to root_url\n end",
"def google_oauth2\nuser = User.from_omniauth(request.env[\"omniauth.auth\"])\nif user.persisted?\nflash.notice = \"Signed in Through Google!\"\nsign_in_and_redirect user\nelse\nsession[\"devise.user_attributes\"] = user.attributes\nflash.notice = \"You are almost Done! Please provide a password to finish setting up your account\"\nredirect_to new_user_registration_url\nend\nend",
"def create\n user = User.from_omniauth(env[\"omniauth.auth\"])\n session[:user_id] = user.id\n me=User.find(user.id)\n me.loggedin=true\n me.tutoring=false\n me.request=Request.new(class_name:\"3365f80a5cccb3e76443df3b736b26e8\")\n me.save\n render erb: :'sessions#create'\nend",
"def create\n omniauth = request.env['omniauth.auth']\n\n user = User.find_by_uid(omniauth['uid'])\n if not user\n # registruje novog usera\n user = User.new(:uid => omniauth['uid'])\n end\n user.email = omniauth['info']['email']\n user.save\n\n # sve info o useru u sesiji\n session[:user_id] = omniauth\n\n flash[:notice] = \"Successfully logged in\"\n redirect_to root_path\n end",
"def create\n \n \n user = User.from_omniauth(env[\"omniauth.auth\"])\n session[:user_id] = user.id\n \n redirect_to root_path\n \n #render :text => auth_hash.inspect\n #raise request.env[\"omniauth.auth\"].to_yaml\n \n #Original\n # user=Authorization.find_by_provider_and_uid(auth[\"provider\"],auth[\"uid\"]) || Authorization.create_with_omniauth(auth)\n # #session[:user_id] = user.id\n #redirect_to root_path\n \n end",
"def create_new_user_and_identity(auth, params)\n user = User.create!(\n first_name: auth.info[:first_name],\n last_name: auth.info[:last_name],\n email: auth.info[:email],\n oauth_signup: true,\n # referred_by_user_id => params.andand[\"rid\"]\n )\n user.confirm!\n create_new_identity(user, auth)\n end",
"def google_sign_in(user)\n\t\t# Already created user from google acc\n\t\tsession[:user_id]=user.id\n\t\t# directed back to session_controller.\n\tend",
"def google_login\n client.obtain_user_tokens(params['code'], Rails.application.secrets.auth0_callback_url, 'google-oauth2', 'openid')['id_token']\n end",
"def oauth_signup\n @user = User.new(\n nickname: params[:nickname],\n sex: params[:sex],\n phone: params[:phone],\n birthday: params[:birthday],\n province: params[:province],\n city: params[:city],\n area: params[:area] )\n @user.created_by_oauth = 'mobile'\n @user.authentications.build(\n uid: params[:oauth_uid],\n provider: params[:provider],\n access_token: params[:access_token])\n if @user.save\n @user.confirm!\n render :login\n else\n render json: {\n success: false,\n message: @user.errors.messages\n }\n end\n end",
"def google_oauth(access_token)\n user_info = access_token.extra.raw_info\n external_user_id = user_info.id\n email = user_info.email\n account = self.by_google_id(external_user_id).first || self.by_google_email(email).first\n if account.blank?\n account = self.new\n account.email = email\n account.provider = Provider::GOOGLE\n account.external_user_id = user_info.id\n account.skip_confirmation!\n account.build_profile :first_name => user_info.given_name, :last_name => user_info.family_name\n if user_info.gender.present?\n gender = Gender.enumeration[user_info.gender.to_sym]\n account.profile.gender = gender.first if gender\n end\n account.save\n end\n account\n end",
"def create_with_api\n @user = User.find_or_create_from_auth_hash(request.env[\"omniauth.auth\"])\n if @user\n session[:user_id] = @user.id\n redirect_to @user\n else \n flash.now[:danger] = \"Whoops, something went wrong!\"\n render 'new'\n end\n end",
"def google_callback\n tokens = get_tokens(params[\"code\"])\n\n @current_user.access_token = tokens[\"access_token\"]\n @current_user.save!\n \n flash[:notice] = \"Authorized\"\n \n redirect_to :root\n end",
"def create\n @user = User.find_by(username: params[:username])\n @auth = request.env[\"omniauth.auth\"]\n if @user == nil && @auth == nil\n reject_credentials\n else\n if @user != nil\n if @user.authenticate(params[:password])\n start_session(@user.id)\n else\n reject_credentials\n end\n elsif check_credentials(@auth.uid) != nil\n start_session(check_credentials(@auth.uid).id)\n else\n user = User.new_twitter_user(@auth)\n start_session(user.id)\n end\n end\n end",
"def google\n if params[:user_type_login].eql?(\"user\")\n @user, session[:new_register] = User.find_for_google_apps_oauth(env[\"omniauth.auth\"], current_user)\n else\n @user, session[:new_register] = Bar.find_for_google_apps_oauth(env[\"omniauth.auth\"], current_bar)\n end\n session[:google_user] = env[\"omniauth.auth\"][\"user_info\"]\n session[:google_email] = env[\"omniauth.auth\"][\"email\"]\n v_uid = env[\"omniauth.auth\"][\"uid\"].split(\"?id=\").last\n session[:google_uid] = v_uid\n\n if session[:new_register]\n flash[:notice] = \"Please Insert Your data for complete your profile via Google\"\n if params[:user_type_login].eql?(\"user\")\n session[:user_type_login] = nil\n return redirect_to '/users/sign_up'\n else\n session[:user_type_login] = nil\n return redirect_to '/bars/sign_up'\n end\n end\n\n if @user.persisted?\n flash[:notice] = I18n.t \"devise.omniauth_callbacks.success\", :kind => \"Google Apps\"\n sign_in @user\n redirect_to user_root_url if params[:user_type_login].eql?(\"user\")\n redirect_to bar_root_url if params[:user_type_login].eql?(\"bar\")\n else\n session[\"devise.google_apps_data\"] = env[\"omniauth.auth\"]\n if params[:user_type_login].eql?(\"user\")\n session[:user_type_login] = nil\n return redirect_to '/users/sign_up'\n else\n session[:user_type_login] = nil\n return redirect_to '/bars/sign_up'\n end\n end\n\n end",
"def auth_as_user(user)\n OmniAuth.config.mock_auth[:google_oauth2] = OmniAuth::AuthHash.new({\n :provider => 'google_oauth2',\n :uid => user.uid,\n :email => user.email\n })\nend",
"def create\n omniauth = request.env['omniauth.auth']\n # Check whether the Identity exists\n identity = Identity.from_omniauth(omniauth)\n if identity # If it does, sign the user in\n flash[:notice] = 'Welcome back!'\n sign_in_and_redirect(:user, identity.user)\n else\n handle_new_identity(omniauth)\n end\n end",
"def new\n auth_hash = request.env['omniauth.auth']\n session[:auth_provider] = auth_hash[:provider]\n\n # look up auth_field, auth_value of User by provider, from config/initializers/omniauth.rb\n # Currently CAS is our only provider\n auth_config = ResearchMatch::Application.config.auth_providers[session[:auth_provider].to_sym]\n if auth_config\n auth_field = auth_config[:auth_field].to_s\n auth_value = auth_hash[auth_config[:auth_value]].to_s\n session[:auth_field] = auth_field\n session[:auth_value] = auth_value\n else\n flash[:error] = \"There were problems identifying your auth provider. Please try again or contact support.\"\n redirect_to home_path\n return\n end\n\n\n user = User.where(auth_field => auth_value).first\n if user.present?\n UserSession.new(user).save\n session[:user_id] = user.id # TODO remove (use only @user_session)\n redirect_to dashboard_path\n else\n if session[:auth_provider].to_sym == :google_oauth2\n session[:info_hash] = auth_hash[:info]\n end\n puts 'redirect_to new_user_path'\n redirect_to new_user_path\n end\n end",
"def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n session[:user] = {id: @user.id, auth_token: @user.generate_auth_token!}\n format.html { redirect_to main_welcome_url, notice: 'User was successfully created.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"def create\n # Where do we want to redirect to with our new session\n path = cookies.encrypted[:continue] || success_path\n\n # Get auth hash from omniauth\n auth = request.env[OMNIAUTH]\n\n if auth.nil?\n return login_failure({})\n end\n\n # Find an authentication or create an authentication\n auth_model = ::Auth::Authentication.from_omniauth(auth)\n\n # adding a new auth to existing user\n if auth_model.nil? && signed_in?\n logger.info \"User signed in and re-authenticating\"\n\n ::Auth::Authentication.create_with_omniauth(auth, current_user.id)\n redirect_to path\n Auth::Authentication.after_login_block.call(current_user, auth[PROVIDER], auth)\n\n # new auth and new user\n elsif auth_model.nil?\n args = safe_params(auth.info)\n user = ::User.new(args)\n\n # Use last name and first name by preference\n fn = args[:first_name]\n if fn && !fn.empty?\n user.name = \"#{fn} #{args[:last_name]}\"\n end\n\n authority = current_authority\n\n existing = ::User.find_by_email(authority.id, user.email)\n user = existing if existing\n user.deleted = false if user.respond_to?(:deleted)\n\n user.authority_id = authority.id\n\n # now the user record is initialised (but not yet saved), give\n # the installation the opportunity to modify the user record or\n # reject the signup outright\n result = Auth::Authentication.before_signup_block.call(user, auth[PROVIDER], auth)\n\n logger.info \"Creating new user: #{result.inspect}\\n#{user.inspect}\"\n \n if result != false && user.save\n # user is created, associate an auth record or raise exception\n Auth::Authentication.create_with_omniauth(auth, user.id)\n\n # make the new user the currently logged in user\n remove_session\n new_session(user)\n\n # redirect the user to the page they were trying to access and\n # run any custom post-login actions\n redirect_to path\n Auth::Authentication.after_login_block.call(user, auth[PROVIDER], auth)\n else\n logger.info \"User save failed: #{user.errors.messages}\"\n\n # user save failed (db or validation error) or the before\n # signup block returned false. redirect back to a signup\n # page, where /signup is a required client side path.\n store_social(auth[UID], auth[PROVIDER])\n redirect_to '/signup/index.html?' + auth_params_string(auth.info)\n end\n\n # existing auth and existing user\n else\n begin\n # Log-in the user currently authenticating\n remove_session if signed_in?\n user = User.find_by_id(auth_model.user_id)\n new_session(user)\n redirect_to path\n Auth::Authentication.after_login_block.call(user, auth[PROVIDER], auth)\n rescue => e\n logger.error \"Error with user account. Possibly due to a database failure:\\nAuth model: #{auth_model.inspect}\\n#{e.inspect}\"\n raise e\n end\n end\n end",
"def new\n @user = env['omniauth.identity'] ||= User.new\n\n #if signed_in?\n #@user = User.new\n #else\n #auth = session['auth']\n #@user = User.create_with_omniauth(auth)\n #end\n end",
"def create\n user = User.authenticate(params[:email], params[:password])\n if user\n # token = (0...20).map { ('a'..'z').to_a[rand(26)] }.join\n #session[:token] = token\n session[:user_id] = user.id\n # user.update(session: token)\n redirect_to root_url, :notice => \"Logged in!\" \n else\n flash.now.alert = \"Invalid credentials.\"\n render \"new\"\n end\n end",
"def create\n data = request.env[\"omniauth.auth\"][:extra][:raw_info]\n attributes = { :github_data => data, :github_access_token => request.env[\"omniauth.auth\"][:credentials][:token] }\n user = User.find_or_create_by_username(data[:login], attributes)\n \n session[:user_id] = user.id\n redirect_to root_url, :notice => 'Successfully signed in via Github!'\n end",
"def create\n auth = request.env[\"omniauth.auth\"]\n user_info = auth[\"info\"] ? auth[\"info\"] : auth[\"user_info\"]\n authentication = Authorization.where(:provider => auth['provider'], :uid => auth['uid']).first\n authentication = Authorization.new(:provider => auth['provider'], :uid => auth['uid']) if !authentication\n session[:fb_token] = auth['credentials']['token'] if auth['credentials']['token'] != nil\n # if the user exists, but does not have a link with the social service\n if !authentication.user && current_user\n authentication.user = current_user\n authentication.save\n end\n # twitter only (gets no email)\n if !authentication.user && !user_info[\"email\"]\n flash[:notice] = \"No user linked to this account. Please sign in or create a new account\"\n redirect_to '/users/sign_up/'\n # if user doesnt exists, register user\n elsif !authentication.user\n user = User.where(email: user_info['email']).first\n if user\n authentication.user = user\n else\n new_user = User.new(email: user_info['email'], username: user_info['name'], first_name: user_info['first_name'], last_name: user_info['last_name'], role: \"registered\")\n new_user.save\n authentication.user = new_user\n end\n authentication.save\n end\n # if user exists, sign in. Gives a Mongoid glitch of not signing in after registration. So double sign in\n if authentication.user\n if !current_user\n sign_in authentication.user\n sign_out authentication.user\n sign_in authentication.user\n # raise \"user signed in? #{user_signed_in?.to_s}\".inspect\n flash[:notice] = \"Authorization successful.\"\n redirect_to root_path\n else\n flash[:notice] = \"Linked successfully.\"\n redirect_to '/users/'+current_user.id\n end\n end\n end",
"def create_authy_id\n authy = Authy::API.register_user(\n email: current_user.email,\n cellphone: current_user.phone_number,\n country_code: current_user.country_code\n )\n\n current_user.update(\n authy_id: authy.id\n )\n end",
"def google_oauth2\n\t\n\t\t#~ raise request.env[\"omniauth.auth\"].to_yaml\n\t\n # This method is implemented in app/models/user.rb\n @user = User.from_omniauth_google(request.env[\"omniauth.auth\"])\n\t\t\n if @user.persisted?\n sign_in_and_redirect @user, :event => :authentication #this will throw if @user is not activated\n set_flash_message(:notice, :success, :kind => \"Google\") if is_navigational_format?\n else\n session[\"devise.facebook_data\"] = request.env[\"omniauth.auth\"]\n redirect_to new_user_registration_url #redirects to sign up if unsuccessful\n end\n end",
"def create\n @user = User.find_by(email: params[:user][:email])\n @user = @user.try(:authenticate, params[:user][:password])\n if @user\n session[:user_id] = @user.id\n redirect_to contacts_path\n else\n flash.now[:alert] = \"Invalid combination. Try again - or try logging in via Google\"\n render :new\n end\n end",
"def create\n\t\t@user = User.find_or_create_from_auth_hash(request.env[\"omniauth.auth\"])\n\t\tredirect_to(@@extension_url + '?access_token=' + @user.oauth_token)\n\tend",
"def sign_in(user)\n user.create_new_auth_token\n end",
"def create\n @user = User.find_or_create_from_auth_hash(auth_hash)\n # self.current_user = @user\n session[:user] = @user.id\n redirect_to '/'\n end",
"def oauth\n profile = OAuthProfile.from_omniauth(env['omniauth.auth'])\n # TODO check for error\n # temp_password = SecureRandom.hex\n if !profile.user\n oauth_custom_params = request.env[\"omniauth.params\"] || {}\n session[:oauth_reason] = oauth_custom_params.fetch(\"dbdesigner_action\", \"\")\n session[:profile_id] = profile.id\n redirect_to new_registration_path\n # profile.user.create({\n # username: profile.username,\n # email: profile.email,\n # password: temp_password,\n # password_confirmation: temp_password\n # })\n else\n session[:user_id] = profile.user.id\n profile.user.record_login(request: request, oauth_profile: profile)\n redirect_to designer_path\n end\n end",
"def create\n\t\t#get the user info\n\t\t\n\t\tauth = request.env[\"omniauth.auth\"]\n\t\tif auth == nil and \n\t\t\tif session[:temp] == true\n\t\t\t auth = {:info => {:email => \"[email protected]\"} }\n\t\t\telse\n\t\t\t auth = {:info => {:email => \"[email protected]\"} }\t\n\t\t\tend\n\t\tend\n\t\t#whitelist \n\t\tif auth[:info][:email].to_s =~ /[email protected]/\n\t\t\tuser = User.find_by_uid(auth[\"uid\"]) || User.createUser(auth)\n\t\t\tsession[:user_id] = user.id \n\t\t\tsession[:admin] = user.admin\n\t\t\tsession[:authenticated] = true\n\t\t\tredirect_to links_path\n\t\telse\n\t\t\tsession[:authenticated] = false\n\t\t\tsession[:error] = \"Must have a wesleyan email address\"\n\t\t\tredirect_to root_path\n\t\tend\t\n\tend",
"def create_auth\n\t\t@auth = request.env['omniauth.auth']\n\t\tif User.where(:spotify_id => @auth[\"info\"][\"id\"]).first\n\t\t\t@user = User.where(:spotify_id => @auth[\"info\"][\"id\"]).first\n\t\telse\n\t\t\tif @auth[\"info\"][\"images\"][0][\"url\"] == \"\"\n\t\t\t\t@user = User.create(\n\t\t\t\t:display_name => @auth[\"info\"][\"display_name\"],\n\t\t\t\t:token => @auth[\"credentials\"][\"token\"],\n\t\t\t\t:refresh_token => @auth[\"credentials\"][\"refresh_token\"],\n\t\t\t\t:image_url => 'muziqala_logo.jpq',\n\t\t\t\t:spotify_id => @auth[\"info\"][\"id\"],\n\t\t\t\t:user_uri => @auth[\"info\"][\"uri\"]\n\t\t\t\t)\n\t\t\telse\n\t\t\t@user = User.create(\n\t\t\t\t:display_name => @auth[\"info\"][\"display_name\"],\n\t\t\t\t:token => @auth[\"credentials\"][\"token\"],\n\t\t\t\t:refresh_token => @auth[\"credentials\"][\"refresh_token\"],\n\t\t\t\t:image_url => @auth[\"info\"][\"images\"][0][\"url\"],\n\t\t\t\t:spotify_id => @auth[\"info\"][\"id\"],\n\t\t\t\t:user_uri => @auth[\"info\"][\"uri\"]\n\t\t\t\t)\n\t\t\tend\n\t\tend\n\t\tsession[:user_id] = @user.id\n\t\tredirect_to user_path(@user)\n\tend",
"def create\n auth_hash = request.env['omniauth.auth']\n\n @authorization = Authorization.find_by(\n provider: auth_hash[\"provider\"],\n uid: auth_hash[\"uid\"]\n )\n\n session[:user_id] = auth_hash[:uid]\n\n if @authorization\n redirect_to \"/games\"\n else\n @user = User.find_or_initialize_by(uid: auth_hash[:uid])\n @user.name = auth_hash[\"info\"][\"name\"]\n @user.save\n\n redirect_to games_url\n end\n end",
"def sign_in(user)\n @user.create_new_auth_token\n end",
"def new\n if logged_in?\n flash[:notice] = \"You are already signed in. If this is not your account, please 'Log Out'.\"\n redirect_to root_path\n else\n flash[:notice] = \"\"\n @new_user = User.new\n @google_user_info_hash = {\"name\" => \"\", \"username\" => \"\", \"uid\" => \"\", \"image\" => \"\"}\n if session[:googlelogin] == true\n @google_user_info_hash = session[:googleuser]\n session.delete(:googleuser)\n session.delete(:googlelogin)\n end\n end\n end",
"def create_oauth_user(name, email, token)\n User.from_omniauth(\n OpenStruct.new(\n info: OpenStruct.new(email: email, name: name), \n credentials: OpenStruct.new(refresh_token: token)\n )\n )\n end",
"def create\n user = AuthenticationManager.new(\n params.slice(%i[email first_name last_name password]).merge(is_profile_owner: true, password_confirmation: params[:password], tos_accepted: params.bool(:tos_accepted))\n ).register\n user = session_manager.login(user.email, params[:password], use_api_token: true)\n json_success user: api_response.current_user_data(user)\n end",
"def create\n auth = AuthService.where(:provider => @authhash[:provider], :uid => @authhash[:uid]).first\n\n if auth\n # signin existing user\n session[:user_id], session[:service_id] = auth.user_id, auth.id\n flash[:notice] = 'Signed in successfully via ' + @authhash[:provider].capitalize + '.'\n else\n # find or create user\n user = User.where(:email => @authhash[:email]).first || User.new(:email => @authhash[:email])\n user = user.apply_omniauth(@authhash)\n\n if user.save!\n session[:user_id], session[:service_id] = user.id, user.auth_services.where(:provider => @authhash[:provider]).first.id\n end\n flash[:notice] = 'Your account has been created and you have been signed in!'\n end\n unless session[:user_id]\n reset_session\n flash[:error] = 'There was an error while creating your account from which we were not able to recover.'\n end\n\n redirect_to root_url\n end",
"def facebook_create\n @new_user = User.find_or_create_by(uid: auth['uid']) do |u|\n u.name = auth['info']['name']\n u.email = auth['info']['email']\n u.image = auth['info']['image']\n u.password = User.generic_password\n end\n @new_user.save\n session[:user_id] = @new_user.id \n redirect_to home_path(@new_user)\n end",
"def create_user(mobile = nil)\n session[:user_id] = nil\n session[:user_oauth_id] = nil\n\n auth = request.env[\"omniauth.auth\"]\n\n oauths = Authentication.where(:provider => auth[\"provider\"],\n :uid => auth[\"uid\"],\n :user_id.ne => nil,\n :master_id => @master.id).order(\"created_at desc\").all\n oauth = oauths.first\n oauths.drop(1).each do |oa|\n logger.error \"sessions#create_user: Removing extra authentications\"\n oa.destroy()\n end\n\n session[:master_id] = @master.id\n if oauth\n user = oauth.user\n if user != nil\n if @master != user.master\n # This is really bad.\n logger.error \"sessions#create_user: Authentication has mismatched master for user. Removing.\"\n oauth.destroy()\n redirect_to params[:failure_path] || root_path, :notice => \"Session Expired or Invalid. Please retry to sign in.\"\n return\n end\n session[:user_oauth_id] = oauth.id\n session[:user_id] = user.id\n oauth.last_info = auth[\"info\"]\n oauth.save\n if mobile\n redirect_to \"busme://oauthresponse?access_token=#{current_user.get_access_token}&master=#{@master.slug}\"\n else\n redirect_to master_active_path(user.master), :notice => \"Signed in!\"\n end\n else\n session[:user_oauth_id] = oauth.id\n redirect_to new_master_user_registration_path(@master, :mobile => mobile),\n :notice => \"Could not find you. Please create an account.\"\n end\n else\n oauth = Authentication.create_with_omniauth(auth)\n oauth.master = @master\n oauth.save\n session[:user_oauth_id] = oauth.id\n redirect_to new_master_user_registration_path( @master, :mobile => mobile),\n :notice => \"Need to create an account.\"\n end\n end",
"def create\n #gets the user\n user = User.find_by_credentials(params[:user][:email], params[:user][:password])\n \n # if we found it, generate a new session token, change it on the user\n # instance as well as the cookie\n if !user.nil?\n log_in_user!(user)\n flash.now[:success] = \"Login successful\"\n redirect_to user_url(user)\n else\n flash.now[:error] = \"Invalid email/password combo\"\n redirect_to :new\n end\n end",
"def create \n # render :text => request.env[\"omniauth.auth\"].to_yaml\n omniauth = request.env[\"omniauth.auth\"]\n authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])\n if authentication\n flash[:notice] = \"Signed in successfully.\"\n sign_in_and_redirect(:user, authentication.user)\n elsif current_user # if user logged in but doesn't have this auth in DB\n current_user.authentications.create!(:provider => omniauth['provider'], :uid => omniauth['uid'])\n flash[:notice] = \"Authentication successful.\"\n redirect_to authentications_url\n else # if user doesn't exist\n user = User.new\n user.apply_omniauth(omniauth)\n if user.save #if validation passes\n flash[:notice] = \"Signed in successfully.\"\n sign_in_and_redirect(:user, user)\n else #if validation doesn't pass\n session[:omniauth] = omniauth.except('extra')\n redirect_to new_user_registration_url\n end\n end \n end",
"def set_user_session\n session[:access_token] = user_credentials.access_token\n session[:refresh_token] = user_credentials.refresh_token\n session[:expires_in] = user_credentials.expires_in\n session[:issued_at] = user_credentials.issued_at\nend",
"def create \n omniauth = request.env[\"omniauth.auth\"]\n \n authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])\n if authentication\n #directly sign in existing user with existing authentication\n flash[:notice] = \"signed in successfully\"\n sign_in_and_redirect(:user, authentication.user)\n elsif current_user\n #create a new authentication for currently signed in user\n current_user.authentications.create(:provider => omniauth['provider'], :uid => omniauth['uid']) \n flash[:notice] = \"Authentication successful.\" \n redirect_to authentications_url\n else\n # user does not have an account or is authenticated through a provider\n user = User.new\n user.apply_omniauth(omniauth) \n if user.save\n flash[:notice] = \"Signed in successfully.\" \n sign_in_and_redirect(:user, user) \n else\n session[:omniauth] = omniauth.except('extra') \n redirect_to new_user_registration_url\n end \n end\n end",
"def create\n unless session[:user_id].present?\n user = User.create_user\n session[:user_id] = user.id\n end\n end",
"def create\n omniauth = request.env['omniauth.auth']\n authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])\n if authentication\n flash[:notice] = \"Signed in successfully\"\n sign_in_and_redirect(:user, authentication.user)\n else\n user = User.new\n user.apply_omniauth(omniauth)\n user.login = omniauth['info'] && omniauth['info']['nickname']\n if user.save\n flash[:notice] = \"Successfully registered\"\n sign_in_and_redirect(:user, user)\n else\n session[:omniauth] = omniauth.except('extra')\n session[:omniauth_login] = user.login\n\n # Check if login already taken. If so, ask user to link_accounts\n if user.errors[:login][0] =~ /has already been taken/ # omniauth? TBD\n # fetch the user with this login id!\n user = User.find_by_login(user.login)\n return redirect_to link_accounts_url(user.id)\n end\n redirect_to new_user_registration_url\n end\n end\n end",
"def create_authentication(omniauth)\n authentications.create! do |a|\n a.provider = omniauth.provider\n a.uid = omniauth.uid\n end\n end",
"def callback\n auth = env['omniauth.auth']\n\n person = Person.find_by(email: auth.info.email)\n if person\n user = User.find_by(person: person)\n if not user\n user = User.new\n user.person = person\n end\n user.oauth_token = auth.credentials.token\n user.oauth_expires_at = Time.at(auth.credentials.expires_at)\n user.save!\n\n session[:user_id] = user.id\n if person.mentees.empty? && !person.admin?\n redirect_to root_path\n else\n redirect_to '/dashboard/'\n end\n\n else\n redirect_to google_unregistered_path\n end\n end",
"def create\n if params[:via_linkedin] == false\n # create the new user instance with params from sign up form\n user = User.create(user_params)\n else\n params[:user][:password] = SecureRandom.hex\n\n # find or create the new user instance via linkedin\n user = User.where(provider: user_params[:provider], uid: user_params[:uid])\n .first_or_create(user_params)\n end\n # check the user save ok\n if user.persisted?\n # use the Knock AuthToken model to create a token for us\n render json: { jwt: auth_token(user).token, user: UserSerializer.new(user) }, status: 200\n else\n # bad request\n render json: user, status: 400\n end\n end",
"def create\n access_token = AccountKit.access_token(params[:code])\n me = AccountKit.me(access_token)\n email = me[\"email\"][\"address\"]\n account_kit_id = me[\"id\"]\n\n @user = User.find_by(email: email)\n unless @user\n @user = User.create(email: email, account_kit_id: account_kit_id)\n end\n\n @session = @user.sessions.create\n\n cookies[:remember_token] = @session.remember_token\n\n if @user.name.nil?\n redirect_to update_profile_path(@user)\n else\n redirect_to root_path\n end\n end",
"def create\n omniauth = request.env[\"omniauth.auth\"]\n\n authentication = Authentication.find_by_provider_and_uid(\n omniauth['provider'],\n omniauth['uid']\n )\n\n if authentication\n\n sign_in_and_redirect(:user, authentication.user)\n\n elsif current_user\n current_user.authentications.create(:provider => omniauth['provider'],\n :uid => omniauth['uid'])\n flash[:notice] = \"Authentication with #{omniauth['provider']} was successful.\"\n redirect_to authentications_url\n else\n # New user\n user = User.new\n\n user.apply_omniauth(omniauth)\n if user.save\n check_event_entry user.authentications[0]\n sign_in_and_redirect(:user, user)\n else\n session[:omniauth] = omniauth.except('extra')\n redirect_to new_user_registration_url\n end\n end\n end",
"def create_authentication(omniauth)\n authentications.create! do |a|\n a.provider = omniauth.provider\n a.uid = omniauth.uid\n end\n end",
"def create\n \n if params['type'] === 'google_oauth2'\n binding.pry\n else\n user = User.find_by(:email => params[\"user\"][\"email\"]).try(:authenticate, params[\"user\"][\"password\"])\n user_found = User.find_by(:email => params[\"user\"][\"email\"])\n catches = Catch.all\n end\n \n\n\n \n\n \n \n if user\n session[:user_id] = user.id\n render json: {\n status: :created,\n logged_in: true,\n user: user,\n \n catches: catches,\n }\n elsif user_found\n render json: {status: 401, error: \"The password you entered was incorrect. Please double-check and try again.\"}\n else \n render json: {status: 401, error: \"The login information you entered was incorrect. Please double-check and try again.\"}\n end\n end",
"def sign_in_and_update(user)\n OmniAuth.config.mock_auth[:google_oauth2] = OmniAuth::AuthHash.new({\n :provider => 'google_oauth2',\n :uid => user.uid,\n :email => user.email\n })\n sign_in user\n user.update_last_access_at!\n end",
"def google_callback\n hash = request.env[\"omniauth.auth\"]\n if hash\n email = hash[\"info\"][\"email\"]\n split_email = email.split(\"@\")\n username = split_email[0]\n gender = hash[\"extra\"][\"raw_info\"][\"gender\"]\n provider = hash[\"provider\"]\n gid = hash[\"uid\"]\n token = hash[\"credentials\"][\"token\"]\n refresh_token = hash[\"credentials\"][\"refresh_token\"]\n auth = Authentication.find_by_provider_and_gid(provider, gid)\n if !gamer_signed_in?\n if auth\n if auth.gamer\n flash[:success] = t(:signed_in_google)\n sign_in_and_redirect(:gamer, auth.gamer)\n else\n flash[:error] = t(:no_account)\n redirect_to \"/gamers/sign_up\"\n end\n else\n gamer = Gamer.find_by_email(email)\n if gamer\n Authentication.create_with_omniauth(provider, gid,\n token, refresh_token, email, gamer.id)\n flash[:success] = t(:signed_in_google)\n sign_in_and_redirect(:gamer, gamer)\n else\n session[\"devise.token\"] = token\n session[\"devise.gid\"] = gid\n session[\"devise.token_secret\"] = refresh_token\n flash[:info] = t(:continue_reg_google)\n redirect_to controller: \"social_registrations\",\n action: \"new_social\", email: email, username: username,\n gender: gender, provider: provider\n end\n end\n else\n flash[:error] = t(:connected_to_google)\n redirect_to root_url\n end\n else\n flash[:error] = t(:oops_error_google)\n redirect_to root_url\n end\n end",
"def create\n unless can? :login, User\n render(:file => 'public/401', :format => :html, :status => :unauthorized) and return\n end\n\n # extract authentication data\n auth = request.env[\"omniauth.auth\"]\n provider = params['provider']\n identifier = auth.uid\n\n # try to sync user data from user database\n # if sync fails\n # - use cached user_data if it exists\n # - otherwise fail login\n user_data = Riyosha.find(identifier)\n if user_data\n user = User.create_or_update_with_user_data(provider, user_data)\n session[:user_id] = user.id\n else\n user = User.find_by_provider_and_identifier(provider, identifier)\n if user\n session[:user_id] = user.id\n logger.warn \"Could not get user data from Riyosha. Using cached data for user with identifier #{identifier}.\"\n else\n logger.error \"Could not get user data from Riyosha and could therefore not create new user. Login failed.\"\n redirect_to params[:url] || root_path, :alert => 'Login failed. We apologize for the inconvenience. Please try again later.' and return\n end\n end\n\n # Make CanCan re-initialize abilities based on new user id\n @current_ability = nil\n\n # Save session search history\n current_user.searches << searches_from_history\n current_user.save\n\n # Set shunting cookies\n cookies.permanent[:shunt] = cookies.permanent[:shunt_hint] = user.user_data[\"authenticator\"] unless current_user.walk_in?\n\n # redirect user to the requested url\n session_return_url = session.delete(:return_url)\n redirect_to params[:url] || session_return_url || root_path, :notice => 'You are now logged in'\n end",
"def googleAuth\n if session[:google_signup_user_type] == '3'\n if Student.exists?(email: request.env[\"omniauth.auth\"][\"info\"][\"email\"])\n user = Student.find_by_email(request.env[\"omniauth.auth\"][\"info\"][\"email\"])\n session[:user_id] = user.id\n session[:user_type] = TYPE_STUDENT\n redirect_to root_url, notice: \"Logged in!\"\n else\n flash[:notice] = \"You dont have a student account. Please sign up.\"\n redirect_to new_student_url(:name => request.env[\"omniauth.auth\"][\"info\"][\"name\"],\n :email => request.env[\"omniauth.auth\"][\"info\"][\"email\"],\n :without_password => 1)\n end\n elsif session[:google_signup_user_type] == '4'\n if Librarian.exists?(email: request.env[\"omniauth.auth\"][\"info\"][\"email\"])\n user = Librarian.find_by_email(request.env[\"omniauth.auth\"][\"info\"][\"email\"])\n if (user.is_approved == 0)\n flash.now[:alert] = \"You have not been approved by the admin yet\"\n render \"new\"\n else\n session[:user_id] = user.id\n session[:user_type] = TYPE_LIBRARIAN\n redirect_to root_url, notice: \"Logged in!\"\n end\n else\n redirect_to new_librarian_url(:name => request.env[\"omniauth.auth\"][\"info\"][\"name\"],\n :email => request.env[\"omniauth.auth\"][\"info\"][\"email\"],\n :without_password => 1),\n notice: \"You dont have a librarian account. Please sign up.\"\n end\n elsif session[:google_signup_user_type] == '1'\n if Student.exists?(email: request.env[\"omniauth.auth\"][\"info\"][\"email\"])\n user = Student.find_by_email(request.env[\"omniauth.auth\"][\"info\"][\"email\"])\n session[:user_id] = user.id\n session[:user_type] = TYPE_STUDENT\n redirect_to root_url, notice: \"You have already signed up!\"\n else\n redirect_to new_student_url(:name => request.env[\"omniauth.auth\"][\"info\"][\"name\"],\n :email => request.env[\"omniauth.auth\"][\"info\"][\"email\"])\n end\n elsif session[:google_signup_user_type] == '2'\n if Librarian.exists?(email: request.env[\"omniauth.auth\"][\"info\"][\"email\"])\n user = Librarian.find_by_email(request.env[\"omniauth.auth\"][\"info\"][\"email\"])\n if (user.is_approved == 0)\n flash.now[:alert] = \"You have already signed up and are waiting for admin approval\"\n render \"new\"\n else\n session[:user_id] = user.id\n session[:user_type] = TYPE_LIBRARIAN\n redirect_to root_url, notice: \"You have already signed up!\"\n end\n else\n redirect_to new_librarian_url(:name => request.env[\"omniauth.auth\"][\"info\"][\"name\"],\n :email => request.env[\"omniauth.auth\"][\"info\"][\"email\"])\n end\n else\n render \"new\"\n end\n end",
"def create_user\n OmniAuth.config.mock_auth[:github] = OmniAuth::AuthHash.new({\n \"provider\" => \"github\",\n \"uid\" => \"666\",\n \"credentials\" => {\n \"token\" => \"123123\"},\n \"info\" => {\n \"nickname\" => \"The Bease\",\n \"name\" => \"WilliamShatner\",\n \"email\" => \"[email protected]\",\n },\n \"extra\" => {\n \"raw_info\" => {\n \"avatar_url\" => \"123\",\n \"html_url\" => \"12312\",\n \"hireable\" => \"false\",\n \"followers\" => \"1\",\n \"following\" => \"1\",\n }\n },\n })\n end",
"def create\n @user = User.create! user_params\n logger.info \"New User with id #{@user.id} has been saved.\"\n #\n # log-in the user immediately after sign-up\n # issue a refresh token with that the\n # user will request an access token.\n set_refresh_token @user\n render :show, status: :created\n end",
"def from_omniauth auth\n user = User.find_by email: auth.info.email\n\n user = User.new unless user.present?\n user.name = auth.info.name.present? ? auth.info.name : auth.info.email\n user.email = auth.info.email\n user.provider = auth.provider\n user.password = User.generate_unique_secure_token if user.new_record?\n user.token = auth.credentials.token\n user.refresh_token = auth.credentials.refresh_token\n user.save\n user\n end",
"def google_oauth2\n # You need to implement the method below in your model (e.g. app/models/user.rb)\n @user = User.find_for_google_oauth2(request.env[\"omniauth.auth\"])\n\n if @user.persisted?\n #flash[:notice] = I18n.t \"devise.omniauth_callbacks.success\", :kind => \"Google\"\n sign_in_and_redirect @user, :event => :authentication\n else\n session[\"devise.google_data\"] = request.env[\"omniauth.auth\"]\n\n if !session['omniauth_error_return'].nil? && session['omniauth_error_return'] == 'log_in'\n redirect_to log_in_url\n else\n redirect_to sign_up_url\n end\n end\n end",
"def create_users_and_sign_in\n OmniAuth.config.mock_auth[:github] = OmniAuth::AuthHash.new({\n \"provider\" => \"github\",\n \"uid\" => \"666\",\n \"credentials\" => {\n \"token\" => \"123123\"},\n \"info\" => {\n \"nickname\" => \"The Bease\",\n \"name\" => \"WilliamShatner\",\n \"email\" => \"[email protected]\",\n },\n \"extra\" => {\n \"raw_info\" => {\n \"avatar_url\" => \"123\",\n \"html_url\" => \"12312\",\n \"hireable\" => \"false\",\n \"followers\" => \"1\",\n \"following\" => \"1\",\n }\n },\n })\n\n user = User.create(name: \"sexykitten123\", description: \"description\")\n user.languages.create(name: \"Ruby\")\n user = User.create(name: \"uglyplatypus321\", description: \"description2\")\n Match.create(user_id: 1, matchee_id: 2)\n Match.create(user_id: 1, matchee_id: 3)\n end",
"def generate_auth_token\n token = AuthToken.new(user: self)\n token if token.save\n end",
"def create\n if openid = request.env[Rack::OpenID::RESPONSE]\n case openid.status\n when :success\n ax = OpenID::AX::FetchResponse.from_success_response(openid)\n user = User.where(:identifier_url => openid.display_identifier).first\n user ||= User.find_by_email(ax.get_single('http://axschema.org/contact/email')) \n \n sign_in user\n if user.first_name.blank?\n redirect_to edit_user_path(user)\n else\n redirect_back_or(user)\n end\n when :failure\n render :action => 'problem'\n end\n else\n redirect_to new_session_path\n end\n end",
"def associate_user\n \tfbUserIdString = params[:idString]\t\n \tuser = User.new(fbUserId:fbUserIdString)\n \tif user.valid?\t\n\t\t\t user = User.create(fbUserId:fbUserIdString)\n\t\t\t success = true\n\t\t end\n\t\t start_session(fbUserIdString)\n end",
"def create_user\n # first insert into user_secrets and use it's id in users table\n @user_secret = UserSecret.using_client_shard(client: @client).create!(login_salt: @login_salt_hash[:ciphertext_blob])\n\n password_e = User.using_client_shard(client: @client).get_encrypted_password(@password, @login_salt_hash[:plaintext])\n\n @user = User.using_client_shard(client: @client).new(\n client_id: @client_id,\n email: @email,\n password: password_e,\n user_secret_id: @user_secret.id,\n status: GlobalConstant::User.active_status,\n last_logged_in_at: Time.now.to_i\n )\n\n @user.send(\"set_\" + GlobalConstant::User.doptin_mail_sent_property) if @client.is_verify_page_active_for_client?\n @user.save!\n end",
"def create\n auth = request.env[\"omniauth.auth\"]\n user = User.from_omniauth(auth)\n session[:user_id] = user.id\n if params.permit[:remember_me]\n cookies.permanent[:auth_token] = user.auth_token\n else\n cookies[:auth_token] = user.auth_token\n end\n # refresh_to root_path, :ma_notice => \"Logged in\" # Called by jinda_conroller\n redirect_to root_path\n\t\t# redirect_to articles_my_path\n\n rescue\n redirect_to root_path, :alert=> \"Authentication failed, please try again.\"\n end",
"def create\n auth_hash = request.env['omniauth.auth']\n if auth_hash and auth_hash[:uid]\n username = auth_hash[:uid].split('@').first\n user = User.new.tap do |u|\n u.username = username\n end\n # `admin` is used in development.\n if user.username == 'admin' or user.medusa_admin?\n return_url = clear_and_return_return_path\n sign_in user\n # We can access other information via auth_hash[:extra][:raw_info][key]\n # where key is one of the shibboleth* keys in shibboleth.yml\n # (which have to correspond to passed attributes).\n redirect_to return_url\n return\n end\n end\n flash['error'] = sprintf('Sign-in failed. Ensure that you are a member '\\\n 'of the %s AD group.',\n ::Configuration.instance.medusa_admins_group)\n redirect_to root_url\n end",
"def auth_login\n\t\tauth_hash = request.env['omniauth.auth']\n\t\tauth_response = Authorization.find_or_create(auth_hash)\n\t\t# Create a session\n\t\tuser = auth_response.user\n\t\tsession[:user_id] = user.id\n\t\tsession[:token] = auth_response.token\n\t\tsession[:secret] = auth_response.secret\n\t\tsession[:user_role] = USER\n\t\tuser_session = UserSession.create(user)\n\t\tuser_session.save\n\t\tflash.keep[:notice] = t(\"general.login_successful\")\n\t\tredirect_to root_url\n end",
"def create\n omniauth = request.env['omniauth.auth']\n authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])\n if authentication\n flash[:notice] = \"Signed in successfully\"\n sign_in_and_redirect(:user, authentication.user)\n else\n user = User.new\n user.apply_omniauth(omniauth)\n user.email = omniauth['extra'] && omniauth['extra']['user_hash'] && omniauth['extra']['user_hash']['email']\n if user.save\n flash[:notice] = \"Successfully registered\"\n sign_in_and_redirect(:user, user)\n else\n session[:omniauth] = omniauth.except('extra')\n session[:omniauth_email] = omniauth['extra'] && omniauth['extra']['user_hash'] && omniauth['extra']['user_hash']['email']\n\n # Check if email already taken. If so, ask user to link_accounts\n if user.errors[:email][0] =~ /has already been taken/ # omniauth? TBD\n # fetch the user with this email id!\n user = User.find_by_email(user.email)\n return redirect_to link_accounts_url(user.id)\n end\n redirect_to new_user_registration_url\n end\n end\n end",
"def create\n user = User.authenticate(params[:email], params[:password])\n if user\n session[:user_id] = user.id\n render :json => { :success=>'ok', :email=>user.email, :user_id => user.id}, :callback => params['callback'], :status=>200\n else\n render :json=> {:success=>false, :message=>\"Error with your login or password\"}, :callback => params['callback'], :status=>401\n\n end\n end",
"def create\n user = User.find_for_authentication(email: user_params[:email])\n\n if user && user.valid_password?(user_params[:password])\n user.generate_authentication_token\n\n expose({\n user_id: user.id,\n token: user.authentication_token\n })\n else\n error! :unauthenticated\n end\n end",
"def create\n @user = User.find_or_create_by(uid: auth['uid']) do |u|\n u.name = auth['info']['name']\n u.email = auth['info']['email']\n end\n\n session[:user_id] = @user.id\n\n render 'welcome/home'\n end",
"def authorize_code(authorization_code)\n api_client.authorization.code = authorization_code\n api_client.authorization.fetch_access_token!\n\n result = api_client.execute!(:api_method => settings.oauth2.userinfo.get)\n user = User.first_or_create(:email => result.data.email)\n api_client.authorization.refresh_token = (api_client.authorization.refresh_token || user.refresh_token)\n if user.refresh_token != api_client.authorization.refresh_token\n user.refresh_token = api_client.authorization.refresh_token\n user.save\n end\n session[:user_id] = user.id\nend",
"def make_user\n @user = User.new(session_token: params[:session_token])\n graph = Koala::Facebook::API.new(@user.session_token)\n id = graph.get_object(\"me\")[\"id\"]\n if id != params[:facebook_id]\n render json: [\"Invalid session token\"], status: 401\n return\n end\n @user.fill_user_data(graph)\n if @user.save\n # @user.add_friends(graph)\n render \"api/users/show\"\n else\n render json: @user.errors.full_messages, status: 422\n end\n end",
"def createF\r\n user = User.omniauth(env['omniauth.auth'])\r\n session[:user_id] = user.id\r\n Action.create(info: current_user.username + ' has logged in using facebook.', user_email: current_user.email)\r\n redirect_to user\r\n end",
"def create\n if auth\n email = auth['info']['email']\n email = \"#{auth['info']['nickname']}@github\" if email.nil?\n @user = User.find_or_create_by(handle: auth[:info][:nickname]) do |u|\n u.email = email\n u.password = auth['uid']\n end\n session[:user_id] = @user.id\n redirect_to \"/users/#{@user.id}\"\n else\n @user = User.find_by(handle: params[:user][:handle])\n if @user && @user.authenticate(params[:user][:password])\n session[:user_id] = @user.id\n redirect_to \"/users/#{@user.id}\"\n else\n flash[:error] = \"Sorry, your username or password was incorrect\"\n redirect_to '/login'\n end\n end\n end",
"def create\n @omniauth = request.env[\"omniauth.auth\"]\n \n authentication = Authentications.find_by_provider_and_uid(@omniauth['provider'], @omniauth['uid'])\n\n if(@@logingIn ==0) \n registering(authentication)\n elsif(@@logingIn ==1)\n signingIn(authentication)\n end\n\nend",
"def create\n\t\tauth_params = request.env['omniauth.auth']\n\t\tparams = request.env['omniauth.params']\n\n\t\tuser_tmp = User.find_by(uid: auth_params['uid'])\n\t\tuser = User.from_omniauth(auth_params)\n\t\treferer = User.find_by(id: params['referer'].to_i)\n\n\t\tif !user_tmp && user\n\t\t\tsend_notification_user(user, 25, 'You logged in for the first time!', '', '', false)\n\t\t\tuser.hasLoggedInThisRound = true\n\t\t\tuser.save\n\t\telsif !user.hasLoggedInThisRound\n\t\t\tsend_notification_user(user, 1, 'You logged in this round!', '', '', false)\n\t\t\tuser.points += 1\n\t\t\tuser.hasLoggedInThisRound = true\n\t\t\tuser.save\n\t\tend\n\n\t\tif user_tmp == nil && referer != nil && user.uid != referer.uid \n\t\t\tsend_notification_user(referer, 5, 'You refered ' + user.name + '!', '', '', false)\n\t\t\treferer.points += 5\n\t\t\treferer.save\n\t\tend\n\t\t\n\t\tsession[:user_id] = user.id\n\t\tsession[:return_to] ||= request.referer\n\n\t\tif (params['mobile'].to_i == 1)\n\t\t\tredirect_to '/mobile/login/'\n\t\telse\n\t\t\tredirect_to root_path\n\t\tend\n\tend",
"def create_google_email(password)\n return \"Empty email address\" if self.email.blank?\n logger.debug(\"Attempting to create google email account for \" + self.email)\n (username, domain) = switch_sv_to_west(self.email).split('@')\n \n if domain != GOOGLE_DOMAIN\n logger.debug(\"Domain (\" + domain + \") is not the same as the google domain (\" + GOOGLE_DOMAIN )\n return \"Domain (\" + domain + \") is not the same as the google domain (\" + GOOGLE_DOMAIN + \")\"\n end\n\n begin\n user = google_apps_connection.create_user(username,\n self.first_name,\n self.last_name,\n password)\n rescue GDataError => e\n#error code : 1300, invalid input : Andrew.Carngie, reason : EntityExists\n return pretty_print_google_error(e)\n end\n self.google_created = Time.now()\n self.save_without_session_maintenance\n return(user)\n end",
"def create\n @user = User.where_omniauth(auth_hash)\n sign_in @user\n redirect_to root_url, alert: \"You have been signed in successfully.\"\n end"
]
| [
"0.8297299",
"0.8058901",
"0.7720402",
"0.7710405",
"0.7607388",
"0.7527249",
"0.75107896",
"0.74775237",
"0.74680215",
"0.7454767",
"0.7301353",
"0.72472113",
"0.72195834",
"0.7186868",
"0.7171435",
"0.7079342",
"0.70787036",
"0.70184803",
"0.70133746",
"0.6966851",
"0.6951821",
"0.694488",
"0.69041646",
"0.6889",
"0.6875054",
"0.685163",
"0.6849216",
"0.68264735",
"0.6825015",
"0.68049204",
"0.6801573",
"0.67701054",
"0.67486477",
"0.6732006",
"0.6704041",
"0.67000556",
"0.6680985",
"0.66638124",
"0.66519624",
"0.6639126",
"0.66368914",
"0.66288036",
"0.66116786",
"0.65893173",
"0.65882915",
"0.6586625",
"0.65799654",
"0.6570263",
"0.656944",
"0.65586114",
"0.6533016",
"0.6528739",
"0.6525414",
"0.6511327",
"0.65072334",
"0.6498835",
"0.6487889",
"0.6457743",
"0.6456712",
"0.64454454",
"0.6398887",
"0.63692266",
"0.63690716",
"0.6368981",
"0.63689554",
"0.6368779",
"0.6368616",
"0.63669896",
"0.6357167",
"0.63555425",
"0.6345272",
"0.6342991",
"0.6339784",
"0.63350064",
"0.6327001",
"0.63240504",
"0.63189715",
"0.6312177",
"0.6308142",
"0.63046557",
"0.63032496",
"0.6300528",
"0.62927324",
"0.62891114",
"0.627781",
"0.6276645",
"0.6275399",
"0.6274599",
"0.62669384",
"0.625838",
"0.6257287",
"0.6249229",
"0.6247386",
"0.62405235",
"0.6238308",
"0.6234052",
"0.62261575",
"0.6226147",
"0.6223622",
"0.62102985"
]
| 0.75637466 | 5 |
Creates a new RubyToDot object. | def initialize
@classes = Array.new
# A set instead of the hashes would be a nicer choice, but
# RubyToDot should not depend on any library to allow more complete graphs.
@modules = Hash.new
@ignored = Hash.new
@ignored_tree = Hash.new
set_defaults
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dot(**options) = convert_to('dot', **options)",
"def to_dot\n Dot::Digraph.new(:fontsize => 10, :shape => :box, :size => 5) do |g|\n parse_tree.to_dot(g)\n end.to_dot\n end",
"def dotchart(*args)\n Dot.new(self, *args)\n end",
"def initialize(p='btex $\\bullet$ etex')\n @dot_type = p\n end",
"def to_dot\n i = 0\n dot = [\"digraph G {\", \"#{i} [label=\\\"self\\\"];\"]\n _to_dot(dot, \"\", i, self, i)\n dot << \"}\"\n dot.join(\"\\n\")\n end",
"def dot\n end",
"def dot\n RGL::DOT::Graph.new('elements' => dot_edges).to_s\n end",
"def builder(graph)\n @dot = self.class.builder(graph, @options[:layout])\n end",
"def to_dot(opts={})\n\n s = [ \"digraph \\\"process wfid #{wfid}\\\" {\" ]\n @expressions.each { |e| s.push(*e.send(:to_dot, opts)) }\n @errors.each { |e| s.push(*e.send(:to_dot, opts)) }\n s << '}'\n\n s.join(\"\\n\")\n end",
"def to_dot_graph (params = {})\n params['name'] ||= self.class.name.gsub(/:/,'_')\n fontsize = params['fontsize'] ? params['fontsize'] : '8'\n graph = (directed? ? DOT::DOTDigraph : DOT::DOTSubgraph).new(params)\n edge_klass = directed? ? DOT::DOTDirectedEdge : DOT::DOTEdge\n vertices.each do |v|\n name = v.to_s\n params = {'name' => '\"'+name+'\"',\n 'fontsize' => fontsize,\n 'label' => name}\n v_label = v.to_s\n params.merge!(v_label) if v_label and v_label.kind_of? Hash\n graph << DOT::DOTNode.new(params)\n end\n edges.each do |e|\n params = {'from' => '\"'+ e.source.to_s + '\"',\n 'to' => '\"'+ e.target.to_s + '\"',\n 'fontsize' => fontsize }\n e_label = e.to_s\n params.merge!(e_label) if e_label and e_label.kind_of? Hash\n graph << edge_klass.new(params)\n end\n graph\n end",
"def to_call_dot(filename)\n basename = File.basename(filename, \".dot\")\n basename=basename+\".ps\"\n \n dot_command1=\"dot -Tps \"+(filename)+ \" -o \"+basename\n system(dot_command1)\n end",
"def dot(&block)\n ext(Rule.for(DOT), block)\n end",
"def dot_code(io)\n # puts \"drawing record\"\n props\n portinfos = get_port_nodes.map do |n|\n OpenStruct.new(name: n.node_name,\n label: MFactor::dot_escape(n.dot_label)+(n.symbol ? \"(#{n.symbol})\":\"\"))\n end\n label= '\"{{'\n label << (portinfos.map do |p|\n \"<#{p.name}> #{p.label}\"\n end.join(\" | \"))\n label << '}}\"'\n attrs={:label => label}\n attr_string=attrs.map do |k,v|\n \"#{k.to_s}=#{v}\"\n end.join(\", \")\n io << node_name << ' ' << '[' << attr_string << \"]\\n\"\n end",
"def dotfile()\n end",
"def dotfile()\n end",
"def new_mono(*args)\n new(*args)\n end",
"def initialize # :notnew:\n evaluate PRELUDE, PRELUDE_PATH, 1\n global.Johnson.runtime = self\n global['Ruby'] = Object\n evaluate CORE, CORE_PATH, 1\n end",
"def do_dot\n message = pop\n object = pop\n\n\t\t# defer error handling for now\n\t\tcase object[:type]\n when :integer\n m = message[:value]\n\t\t\t@integer_msgs[m].call( object )\n when :string\n # ditto :integer\n when :frame # user defined object\n\t\t\[email protected]( object )\n\t\t\t# evaluate message in context of frame\n\n\t\t\tquote = Quote.new\n\t\t\tcase message[:type]\n when :quote\n\t\t\t quote.tree = message\n\t\t\t self.dot( quote )\n when :symbol\n # usr re-write rule: frame symbol . --> frame [ symbol # ] .\n\t\t\t\tquote.tree = { \n\t\t\t\t type: :quote,\n\t\t\t\t value: [ message, { type: :eval, value: \"#\" } ]\n\t\t\t\t}\n\n\t\t\t self.dot( quote )\n end\n\n\t\t\[email protected]\n else\n # error\n end\n end",
"def to_dot(graph)\n graph.node(self, :label => token)\n end",
"def new(options=nil)\n Tidyobj.new(options)\n end",
"def to_dot\n template = <<-eos\ndigraph \"<%= uid || 'graph' %>\" {\n node[ style = \"filled, solid\"];\n<% each_task do |task| -%>\n<% next unless task.name =~ dot_task_filter if dot_task_filter -%>\n<% next unless task.node.name =~ dot_node_filter if dot_node_filter and task.node -%>\n \"<%= task %>\" [label = \"<%= task %>\", fillcolor = \"<%= task.color %>\"];\n<% end -%>\n\n<% each_task do |task| -%>\n<% task.each_forward_dependency do |forward_task| -%>\n<% next unless task.name =~ dot_task_filter if dot_task_filter -%>\n<% next unless task.node.name =~ dot_node_filter if dot_node_filter and task.node -%>\n<% next unless forward_task.name =~ dot_task_filter if dot_task_filter -%>\n<% next unless forward_task.node.name =~ dot_node_filter if dot_node_filter and forward_task.node -%>\n \"<%= task %>\" -> \"<%= forward_task %>\";\n<% end -%>\n<% end -%>\n}\n eos\n ERB.new(template, nil, '-').result(binding)\n end",
"def to_ot\n Octothorpe.new(to_h)\n end",
"def dotty (params = {}, dotfile = 'graph.dot')\n File.open(dotfile, 'w') {|f| f << to_dot(params) }\n system('dotty', dotfile)\n end",
"def dotty (params = {}, dotfile = 'graph.dot')\n File.open(dotfile, 'w') {|f| f << to_dot(params) }\n system('dotty', dotfile)\n end",
"def dotfile()\nend",
"def to_dotfile(filename, *attrs, &block)\n File.open(filename,'w') { |file| file << to_dot(*attrs, &block) }\n end",
"def create_main_dot_rb(name)\n\tsystem(\"touch #{name}.rb\")\n\tfile = File.open(\"#{name}.rb\", 'w')\n\tfile.puts(\"require 'pry'\")\n\tfile.puts(\"require 'dotenv'\")\n\tfile.puts('')\n\tfile.puts(\"Dotenv.load('.env')\")\n\tfile.close\nend",
"def render_as_format(from, to, format)\n puts \"Hola, bon dia!!\"\n puts from\n puts to\n thefile = `iconv -f ISO8859-1 #{from}`\n dotfile = Tempfile.new('dot')\n begin\n model = T2Flow::Parser.new.parse(thefile)\n T2Flow::Dot.new.write_dot(dotfile, model)\n dotfile.close\n `dot -T#{format} -o\"#{to}\" #{dotfile.path}`\n ensure\n dotfile.unlink\n end\nend",
"def to_graphviz_cmd(filename, cmd, lang, *attrs, &block)\n case cmd.to_sym\n when :nop, :nop1\n cmd = 'neato -n'\n when :nop2\n cmd = 'neato -n2'\n end\n\n if GRAPHVIZ_PATH\n cmd = File.join(GRAPHVIZ_PATH, cmd)\n end\n\n if lang == :pspdf\n epstopdf(filename) do |tmpfile|\n IO.popen(\"#{cmd} -Tps -o \\\"#{tmpfile}\\\"\",\"w\") do |io| \n io << to_dot(*attrs, &block)\n end\n end\n else\n IO.popen(\"#{cmd} -T#{lang} -o \\\"#{filename}\\\"\",\"w\") do |io| \n io << to_dot(*attrs, &block)\n end\n end\n end",
"def to_dot(options = {})\r\n Dot::Digraph.new(:fontsize => 10, :shape => :box, :size => 5) do |g|\r\n states.each do |state|\r\n g.node(state, :label => state.items.values.collect{|item| item.to_s(options)}.join(\"\\n\"))\r\n @transitions[state].each do |symbol, dest_state|\r\n g.edge(state, dest_state, :label => symbol.name)\r\n end\r\n end\r\n end.to_dot\r\n end",
"def create_template_dot_rb\n\tsystem('touch template.rb')\n\tfile = File.open('template.rb', 'w')\n\tfile.puts(\"require 'pry'\")\n\tfile.puts(\"require 'dotenv'\")\n\tfile.puts('')\n\tfile.puts(\"Dotenv.load('.env')\")\n\tfile.close\nend",
"def _to_dot(dot, l, c, e, i)\n i += 1\n dot << \"#{c} -> #{i} [label=\\\"#{l}\\\"];\" if l\n c = i\n case e\n when LiteralString\n dot << \"#{i} [label=\\\"#{e.inspect.gsub('\"', '\\\\\"')}.lit\\\"];\"\n i\n when Symbol, Numeric, String, Class, TrueClass, FalseClass, NilClass\n dot << \"#{i} [label=\\\"#{e.inspect.gsub('\"', '\\\\\"')}\\\"];\"\n i\n when Array\n dot << \"#{i} [label=\\\"Array\\\"];\"\n e.each_with_index do |v, j|\n i = _to_dot(dot, j, c, v, i)\n end\n when Hash\n dot << \"#{i} [label=\\\"Hash\\\"];\"\n e.each do |k, v|\n i = _to_dot(dot, k, c, v, i)\n end\n when SQL::ComplexExpression \n dot << \"#{i} [label=\\\"ComplexExpression: #{e.op}\\\"];\"\n e.args.each_with_index do |v, j|\n i = _to_dot(dot, j, c, v, i)\n end\n when SQL::Identifier\n dot << \"#{i} [label=\\\"Identifier\\\"];\"\n i = _to_dot(dot, :value, c, e.value, i)\n when SQL::QualifiedIdentifier\n dot << \"#{i} [label=\\\"QualifiedIdentifier\\\"];\"\n i = _to_dot(dot, :table, c, e.table, i)\n i = _to_dot(dot, :column, c, e.column, i)\n when SQL::OrderedExpression\n dot << \"#{i} [label=\\\"OrderedExpression: #{e.descending ? :DESC : :ASC}#{\" NULLS #{e.nulls.to_s.upcase}\" if e.nulls}\\\"];\"\n i = _to_dot(dot, :expression, c, e.expression, i)\n when SQL::AliasedExpression\n dot << \"#{i} [label=\\\"AliasedExpression\\\"];\"\n i = _to_dot(dot, :expression, c, e.expression, i)\n i = _to_dot(dot, :alias, c, e.aliaz, i)\n when SQL::CaseExpression\n dot << \"#{i} [label=\\\"CaseExpression\\\"];\"\n i = _to_dot(dot, :expression, c, e.expression, i) if e.expression\n i = _to_dot(dot, :conditions, c, e.conditions, i)\n i = _to_dot(dot, :default, c, e.default, i)\n when SQL::Cast\n dot << \"#{i} [label=\\\"Cast\\\"];\"\n i = _to_dot(dot, :expr, c, e.expr, i)\n i = _to_dot(dot, :type, c, e.type, i)\n when SQL::Function\n dot << \"#{i} [label=\\\"Function: #{e.f}\\\"];\"\n e.args.each_with_index do |v, j|\n i = _to_dot(dot, j, c, v, i)\n end\n when SQL::Subscript \n dot << \"#{i} [label=\\\"Subscript: #{e.f}\\\"];\"\n i = _to_dot(dot, :f, c, e.f, i)\n i = _to_dot(dot, :sub, c, e.sub, i)\n when SQL::WindowFunction\n dot << \"#{i} [label=\\\"WindowFunction\\\"];\"\n i = _to_dot(dot, :function, c, e.function, i)\n i = _to_dot(dot, :window, c, e.window, i)\n when SQL::Window\n dot << \"#{i} [label=\\\"Window\\\"];\"\n i = _to_dot(dot, :opts, c, e.opts, i)\n when SQL::PlaceholderLiteralString\n str = e.str\n str = \"(#{str})\" if e.parens\n dot << \"#{i} [label=\\\"PlaceholderLiteralString: #{str.inspect.gsub('\"', '\\\\\"')}\\\"];\"\n i = _to_dot(dot, :args, c, e.args, i)\n when SQL::JoinClause\n str = \"#{e.join_type.to_s.upcase} JOIN\"\n if e.is_a?(SQL::JoinOnClause)\n str << \" ON\"\n elsif e.is_a?(SQL::JoinUsingClause)\n str << \" USING\"\n end\n dot << \"#{i} [label=\\\"#{str}\\\"];\"\n i = _to_dot(dot, :table, c, e.table, i)\n i = _to_dot(dot, :alias, c, e.table_alias, i) if e.table_alias\n if e.is_a?(SQL::JoinOnClause)\n i = _to_dot(dot, :on, c, e.on, i)\n elsif e.is_a?(SQL::JoinUsingClause)\n i = _to_dot(dot, :using, c, e.using, i)\n end\n when Dataset\n dot << \"#{i} [label=\\\"Dataset\\\"];\"\n TO_DOT_OPTIONS.each do |k|\n next unless e.opts[k]\n i = _to_dot(dot, k, c, e.opts[k], i)\n end\n else\n dot << \"#{i} [label=\\\"Unhandled: #{e.inspect.gsub('\"', \"''\")}\\\"];\"\n end\n i\n end",
"def testPositiveDots\n assert_raise( RangeError ) {\n dm = DotManager.new( 0, 0, 100, 1, 99 )\n }\n end",
"def dot!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 44 )\n\n\n\n type = DOT\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 65:6: '.'\n match( 0x2e )\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 44 )\n\n\n end",
"def new(string_or_io, options = T.unsafe(nil)); end",
"def new(string_or_io, options = T.unsafe(nil)); end",
"def dot(io)\n log \"drawing graph \"\n io << <<END\ndigraph test_definition {\ngraph [ rankdir=TB ]\nnode [shape=record,fontname=helvetica]\nedge [fontname=helvetica, arrowsize=0.5]\nEND\n # nodes,transitions = collect_nodes\n # transitions.to_a.flatten.to_set.each do |n|\n @nodes.each do |n|\n next if n.record # if we are a port, skip, record handles drawing\n if n.is_record? # if we are a record, call specialized function\n n.dot_code(io)\n else\n label_sym = (n.is_a?(JoinNode) ? :xlabel : :label)\n attrs={label_sym => '\"'+n.dot_label+'\"'}\n # if n.symbol\n # attrs[:xlabel]=n.symbol\n # end\n if n.respond_to? :dot_node_shape\n attrs[:shape]='\"'+n.dot_node_shape+'\"'\n end\n attr_string=attrs.map do |k,v|\n \"#{k.to_s}=#{v}\"\n end.join(\", \")\n io.puts \"#{n.node_name} [#{attr_string}]\"\n end\n end\n @control_edges.each do |s,d,label|\n log \"adding control edge: [#{s},#{d},#{label}]\"\n attrs={color:\"red\",fontcolor:\"red\"}\n attrs[:label] = '\"'+label.to_s+'\"' if label\n draw_transition(s,d,io,attrs)\n end\n @data_edges.each do |s,d|\n log \"adding data edge\"\n draw_transition(s,d,io,{color: \"green\"})\n end\n io.puts \"}\"\n self\n end",
"def to_dot (params={}) to_dot_graph(params).to_s; end",
"def to_dot (params={}) to_dot_graph(params).to_s; end",
"def new *args\n require 'zsteg/cli/cli'\n Cli.new(*args)\n end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def dot(other)\n self * other\n end",
"def new\n BikeObject.new(self, 'Object', @type, @name)\n end",
"def create_primitive(node, options = {})\n builder = DefinitionBuilder::Primitive.new(node, current_scope, options)\n\n return builder.build\n end",
"def dot v\n @x*v.x + @y*v.y\n end",
"def to_kit(name = $0)\n Kit.new name, build_commands(self.class.__commands)\n end",
"def new\n @bond = Bond.new\n end",
"def octokit\n @ok ||= Octokit.new(:auto_traversal=>true)\n end",
"def new\n raise('Sorry, modules cannot be instantiated!') if @is_module\n \n RObject.new self\n end",
"def to_dot_label(binding_)\n template_path = File.expand_path(\"callback.dothtml.erb\", __dir__)\n erb = ERB.new(File.read(template_path))\n erb.filename = template_path\n erb.result(binding)\n end",
"def initialize(dotignore = nil, additional_ignores = [], dotconfig = nil)\n @dotignore = dotignore\n @dotconfig = dotconfig\n @additional_ignores = additional_ignores\n\n @path2dotignore = {}\n @path2dotconfig = {}\n\n if !dotignore.nil?\n home_dotignore = \"#{HOME}#{File::SEPARATOR}#{dotignore}\"\n\n @path2dotignore[PARENT_OF_HOME] = []\n\n @path2dotignore[HOME] =\n if File.exist?(home_dotignore)\n open(home_dotignore).read.split(\"\\n\")\n else\n []\n end\n end\n\n if !dotconfig.nil?\n home_dotconfig = \"#{HOME}#{File::SEPARATOR}#{dotconfig}\"\n\n @path2dotconfig[PARENT_OF_HOME] = nil\n\n @path2dotconfig[HOME] =\n if File.exist?(home_dotconfig)\n open(home_dotconfig).read\n else\n nil\n end\n end\n end",
"def render_dot_generic2(graph_name,file_type, opts )\n @graph_data ||= RicGraph.get_dot(graph_name,opts)\n gv=IO.popen(\"/usr/bin/dot -q -T#{file_type}\",\"w+\")\n #gv.puts( Gr aph.to_dot(graph_name,opts) )\n gv.puts( @graph_data )\n gv.close_write\n @generic_svg = {\n :name => graph_name,\n :data => gv.read,\n }\n return @generic_svg[:data]\n end",
"def dot\n s = \"digraph query {\\n\"\n @operators.each { |op| \n desc = op.attributes.inspect.gsub(\"\\\"\", \"\\\\\\\"\")\n label = \"[#{op.index}] #{op.name}\"\n if op.performanceData\n duration = (op.performanceData[\"endTime\"] - op.performanceData[\"startTime\"]).to_f\n label += \" (#{duration} ms)\"\n end\n s += \" #{op.index} [label=\\\"#{label}\\n #{desc}\\\", shape=box];\\n\"\n op.dependencies.each { |dep|\n s += \" #{dep.index} -> #{op.index};\\n\"\n }\n } \n s += \"}\\n\"\n end",
"def to_dot\n return unless gv_object\n gv_object.to_s\n end",
"def slash_to_dot(path)\n dot = super\n dot.sub!(@useless,'')\n dot=dot[1..-1] if dot[0] == '.'\n dot\n end",
"def new(opts = {})\n klass.new(opts)\n end",
"def create(sketch, args)\n require_relative '../jruby_art/creators/creator'\n return Processing::Inner.new.create!(sketch, args) if @options.inner\n return Processing::ClassSketch.new.create!(sketch, args) if @options.wrap\n return Processing::EmacsSketch.new.create!(sketch, args) if @options.emacs\n Processing::BasicSketch.new.create!(sketch, args)\n end",
"def new( point, opts )\n @point = point\n @options = opts\n self\n end",
"def to_ruby(visitor = Psych::Visitors::ToRuby)\n visitor.create.accept self\n end",
"def dot v \n @x * v.x + @y * v.y + @z * v.z\n end",
"def to_dot(opts)\n\n i = fei()\n\n label = \"#{[ i.wfid, i.subid, i.expid].join(' ')} #{tree.first}\"\n label += \" (#{h.state})\" if h.state\n\n a = []\n a << \"\\\"#{i.to_storage_id}\\\" [ label=\\\"#{label}\\\" ];\"\n\n # parent\n\n if h.parent_id\n a << \"\\\"#{i.to_storage_id}\\\" -> \\\"#{parent_id.to_storage_id}\\\";\"\n end\n\n # children\n\n h.children.each do |cfei|\n a << \"\\\"#{i.to_storage_id}\\\" -> \\\"#{Ruote.to_storage_id(cfei)}\\\";\"\n end\n\n a\n end",
"def to_dot graph\n graph.node(self, :label => production)\n child_nodes.each do |child|\n graph.edge(self, child)\n child.to_dot(graph)\n end\n end",
"def create_dot_graph\r\n\r\n \t# Create the base object, then add edges/nodes later etc\r\n \tmy_graph = Graph.new\r\n \tmy_graph.name= \"State_Model\"\r\n \tmy_graph.node_style= :ellipse\r\n \tmy_graph.type = :digraph\r\n\r\n \t# For each entry in the Adjacency matrix extract the relationships and add the graph edges.\r\n \tself.adjacency_matrix.each_key do |table_key|\r\n \t\ttransition_list=self.adjacency_matrix[table_key]\r\n \t\ttransition_list.each do |transition|\r\n \t\t # is the action guarded?\r\n \t\t if self.guarded_actions !=nil\r\n \t\t guarded=self.guarded_actions.include? transition.action\r\n \t\t\tend # end if \r\n \t\t\t# add the edge...\r\n \t\t\tmy_graph.add_edge(transition.start_state, transition.end_state, \" #{transition.action} \", guarded)\r\n \t\tend # end add transitions\r\n \tend # end add nodes\r\n\r\n \treturn my_graph\r\n end",
"def dot\n print \".\"\n $stdout.flush\n end",
"def new(namespace, name, *args, &block); end",
"def to_patent\n OPS::OpsFamily.new(@patent, @text)\n end",
"def map_to_interface\n Octothorpe.new(to_h)\n end",
"def initialize(options = {})\n @options = {}\n @parser = RubyParser.new\n @scopes = {}\n end",
"def initialize(root = \".\")\n @root = Pathname.new(root).expand_path\n @paths = Paths.new(@root)\n @extensions = Extensions.new\n @aliases = Hash.new { |h, k| h[k] = Extensions.new }\n end",
"def to_ruby\n WSDL::SOAP::ClassDefCreator.new(@xsd, WSDL::SOAP::ClassNameCreator.new, @module_path).dump\n end",
"def toggle\n if @dot == nil then\n radius = 5\n pt = @intersector.getIntersection( @farItem.getCenter)\n @dot = UONDot.new( @editor.getModelCanvas,\n pt[0], pt[1], pt[0] + radius, pt[1] + radius, @editor)\n @dot.setCenter pt\n else\n @dot.destroy; @dot = nil\n end # @dot is nil?\n end",
"def dot!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 44 )\n\n type = DOT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 369:7: '.'\n match( 0x2e )\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__, 44 )\n\n end",
"def dot(v)\n @x * v.x + @y * v.y\n end",
"def from_ruby(&b)\n @from_ruby = b\n end",
"def create_eos(o = OpenStruct.new) \n class << (o)\n include EOS\n alias_method :_hash, :deep_inspect\n end unless o.respond_to? :deep_inspect\n o\n end",
"def initialize(opts = {})\n @dots = opts.delete(:dots) || []\n @width = opts.delete(:width) || 256\n @height = opts.delete(:height) || 256\n @radius = opts.delete(:radius) || 5\n colorize = opts.delete(:colorize)\n @colorize = colorize.nil? ? true : colorize\n end",
"def build\r\n return self unless prerelease?\r\n\r\n segments = self.segments.dup\r\n segments.pop while segments.any? { |s| String === s }\r\n segments[-1] = segments[-1].succ\r\n self.class.new segments.join('.')\r\n end",
"def dot_homework(a, b)\n begin\n puts \"#{a.val}・#{b.val} = #{dot(a, b).val}\"\n rescue InvalidCombError\n puts \"#{a.val}・#{b.val} -> 定義されない\"\n end\nend",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def dot!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 55 )\n\n type = DOT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 176:7: '.'\n match( 0x2e )\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__, 55 )\n\n end",
"def dot!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 20 )\n\n type = DOT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 154:7: '.'\n match( 0x2e )\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__, 20 )\n\n end",
"def initialize(label, values)\n @label = label\n @name = label.name\n @values = values\n @formats = Formats.new\n @drawings = Drawings.new\n\n add_commands(values)\n end",
"def get_dot(start_state)\n if ((start_state).nil?)\n return nil\n end\n # The output DOT graph for visualization\n dot = nil\n @marked_states = HashSet.new\n if (start_state.is_a?(DFAState))\n dot = self.attr_stlib.get_instance_of(\"org/antlr/tool/templates/dot/dfa\")\n dot.set_attribute(\"startState\", Utils.integer(start_state.attr_state_number))\n dot.set_attribute(\"useBox\", Boolean.value_of(Tool.attr_internal_option_show_nfaconfigs_in_dfa))\n walk_creating_dfadot(dot, start_state)\n else\n dot = self.attr_stlib.get_instance_of(\"org/antlr/tool/templates/dot/nfa\")\n dot.set_attribute(\"startState\", Utils.integer(start_state.attr_state_number))\n walk_rule_nfacreating_dot(dot, start_state)\n end\n dot.set_attribute(\"rankdir\", @rankdir)\n return dot.to_s\n end",
"def outputDot(podhash)\n # Random set of 16 colors ...\n colors = [0xFF00FF,0x9900FF,0x99CCFF,0x00CC99,\n 0x0000FF,0xFFCC00,0xFF9900,0xFF0000,\n 0xCC00CC,0x6666FF,0xFF99FF,0x6699FF,\n 0x993399,0xFFCCFF,0x6600FF,0xCC00FF,\n 0x00FF00,0xFF0033,0xFF0033,0xCCCCCC];\n\n puts \"digraph PodDeps {\"\n puts \"\\tsize=\\\"8,6\\\";\"\n puts \"\\tnode[fontsize=10];\"\n\n count = 0\n podhash.each do |k,v|\n # Only color if there are more than 2 edges from this node.\n if v.deps.length > 2\n colorstring = sprintf(\"\\\"\\#%06x\\\"\",colors[count%16])\n puts \"\\tedge [color=#{colorstring}];\"\n count = count + 1\n else\n colorstring = sprintf(\"\\\"\\#000000\\\"\")\n puts \"\\tedge [color=black];\"\n end\n v.deps.each do |d|\n puts \"\\t\\\"#{k} #{v.version}\\\" -> \\\"#{d.name} #{d.version}\\\";\"\n end\n puts \"\\t\\\"#{k} #{v.version}\\\" [color=#{colorstring}];\";\n end\n puts \"}\"\nend",
"def create(method, path)\n\t\tJayCutCommand.new(self, method, path)\t\t\n\tend",
"def create\n @dot = @map.dots.new(dot_params)\n\n respond_to do |format|\n if @dot.save\n format.html { redirect_to @dot, notice: 'Dot was successfully created.' }\n format.json { render :show, status: :created, location: @dot }\n else\n format.html { render :new }\n format.json { render json: @dot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_edge(label,points)\n\t\ttmp=MyEdge.new\n\t\ttmp.label=label\n\t\t\n\t\t# Points should be two strings, not the Vertex objects themselves\n\t\ttmp.points=points\n\t\treturn tmp\n\tend",
"def initialize(call=DefaultConverterPath)\n self.converter_call = call\n end"
]
| [
"0.6079827",
"0.5947084",
"0.58866173",
"0.58001757",
"0.5606832",
"0.5593928",
"0.53332484",
"0.5312729",
"0.5307401",
"0.52014214",
"0.5120336",
"0.5067539",
"0.50627553",
"0.505601",
"0.505601",
"0.50343364",
"0.5014287",
"0.50011337",
"0.5000201",
"0.49768192",
"0.49726945",
"0.49136096",
"0.49126238",
"0.49126238",
"0.4897774",
"0.48460343",
"0.4831111",
"0.4807779",
"0.4781051",
"0.47737968",
"0.47668076",
"0.47310764",
"0.47063294",
"0.46549186",
"0.4635191",
"0.4635191",
"0.46189907",
"0.4605784",
"0.4605784",
"0.45956868",
"0.45905408",
"0.45905408",
"0.45905408",
"0.45905408",
"0.45905408",
"0.45905408",
"0.45905408",
"0.45905408",
"0.45905408",
"0.4542402",
"0.4526215",
"0.45215467",
"0.45022315",
"0.45000282",
"0.44927186",
"0.44846907",
"0.4483198",
"0.4482315",
"0.44565302",
"0.44457334",
"0.4443768",
"0.44417483",
"0.443545",
"0.4415395",
"0.44090027",
"0.44050783",
"0.4384951",
"0.43833795",
"0.438296",
"0.43814036",
"0.43768594",
"0.43671724",
"0.43625864",
"0.4362143",
"0.43609998",
"0.43538693",
"0.4353312",
"0.4351276",
"0.43509433",
"0.43446398",
"0.43363228",
"0.4329183",
"0.43277767",
"0.43199337",
"0.43119615",
"0.4310759",
"0.43059725",
"0.43059725",
"0.43059725",
"0.43059725",
"0.43059725",
"0.43053007",
"0.43048164",
"0.43045923",
"0.4301087",
"0.4283931",
"0.42826074",
"0.4267798",
"0.4265835",
"0.42510265"
]
| 0.5252093 | 9 |
All currently loaded classes and modules will not be shown in the output graph. If new classes inherit one of these already existing classes, they will be shown in grey color. | def hide_current_state
@classes = Array.new
ObjectSpace.each_object(Class) do |klass|
@classes.push klass
end
@modules = Hash.new
ObjectSpace.each_object(Module) do |mod|
@modules[mod] = true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hide_tree(*classOrModules)\n\t\tclassOrModules.each do |classOrModule|\n\t\t\t@ignored_tree[classOrModule] = true\n\t\tend\n\tend",
"def hide(*classOrModules)\n\t\tclassOrModules.each do |classOrModule|\n\t\t\t@ignored[classOrModule] = true\n\t\tend\n\tend",
"def display_class name\n return if name =~ /#|\\./\n\n found, klasses, includes, extends =\n classes_and_includes_and_extends_for name\n\n context = klasses.reverse.inject do |merged, k|\n merged.merge k\n end\n\n return if found.empty?\n\n out = class_document name, found, klasses, includes, extends\n\n @history.go name, out, context\n\n display out, context\n end",
"def classes; end",
"def display_class_info\n end",
"def classes\n @_classes ||= vedeu_classes - vedeu_exceptions - ignored_classes\n end",
"def rails_mark_classes_for_reload\n ActiveSupport::DescendantsTracker.clear\n ActiveSupport::Dependencies.clear\n end",
"def inherited(clazz)\n GDI.debuggers << clazz\n super(clazz)\n end",
"def ignored_classes\n Set.new [\n # 'Vedeu::API',\n # 'Vedeu::Application',\n # 'Vedeu::Background',\n # 'Vedeu::Buffers',\n # 'Vedeu::Clear',\n 'Vedeu::Coercions',\n 'Vedeu::Colour',\n 'Vedeu::ColourTranslator',\n 'Vedeu::Common',\n # 'Vedeu::Composition',\n # 'Vedeu::Compositor',\n 'Vedeu::Configuration',\n # 'Vedeu::Cursor',\n # 'Vedeu::Cursors',\n 'Vedeu::Esc',\n 'Vedeu::Event',\n # 'Vedeu::Events',\n # 'Vedeu::Focus',\n # 'Vedeu::Foreground',\n 'Vedeu::Geometry',\n # 'Vedeu::Grid',\n # 'Vedeu::Groups',\n # 'Vedeu::Input',\n # 'Vedeu::Interface',\n # 'Vedeu::Interfaces',\n # 'Vedeu::Keymap',\n # 'Vedeu::Keymaps',\n # 'Vedeu::KeymapValidator',\n # 'Vedeu::Launcher',\n # 'Vedeu::Line',\n 'Vedeu::Log',\n # 'Vedeu::Menu',\n # 'Vedeu::Menus',\n 'Vedeu::MonoLogger',\n # 'Vedeu::Offset',\n # 'Vedeu::Offsets',\n 'Vedeu::Position',\n 'Vedeu::Presentation',\n # 'Vedeu::Refresh',\n # 'Vedeu::Registrar',\n # 'Vedeu::Render',\n 'Vedeu::Repository',\n 'Vedeu::Stream',\n 'Vedeu::Style',\n 'Vedeu::Terminal',\n 'Vedeu::Trace',\n # 'Vedeu::View',\n # 'Vedeu::Viewport',\n ]\n end",
"def get_sorted_module_list classes\n classes.select do |klass|\n klass.display?\n end.sort\n end",
"def complete min_visibility\n fix_basic_object_inheritance\n\n # cache included modules before they are removed from the documentation\n all_classes_and_modules.each { |cm| cm.ancestors }\n\n unless min_visibility == :nodoc then\n remove_nodoc @classes_hash\n remove_nodoc @modules_hash\n end\n\n @unique_classes = find_unique @classes_hash\n @unique_modules = find_unique @modules_hash\n\n unique_classes_and_modules.each do |cm|\n cm.complete min_visibility\n end\n\n @files_hash.each_key do |file_name|\n tl = @files_hash[file_name]\n\n unless tl.text? then\n tl.modules_hash.clear\n tl.classes_hash.clear\n\n tl.classes_or_modules.each do |cm|\n name = cm.full_name\n if cm.type == 'class' then\n tl.classes_hash[name] = cm if @classes_hash[name]\n else\n tl.modules_hash[name] = cm if @modules_hash[name]\n end\n end\n end\n end\n end",
"def slideClasses\n blacklist = ['bigtext']\n @classes.reject { |klass| blacklist.include? klass }\n end",
"def initialize\n\t\t@classes = Array.new\n\t\t# A set instead of the hashes would be a nicer choice, but \n\t\t# RubyToDot should not depend on any library to allow more complete graphs.\n\t\t@modules = Hash.new\n\t\t@ignored = Hash.new\n\t\t@ignored_tree = Hash.new\n\t\tset_defaults\n\tend",
"def classes\n @classes\n end",
"def none_found_class\n @libraries_subset.count > 0 ? 'hidden' : nil\n end",
"def generate(with_modules=true)\n\t\tstr = %Q|\ndigraph #{@graph_name} {\n\t#{\"rankdir=LR;\\n\" if @left_to_right}\n\t#{\"ordering=out;\\n\" if @sort_alphabetic}\n\tedge [color=\"#{@color_edge}\",fontname=\"#{@font}\",fontsize=#{font_size_edge}];\n\tnode [color=\"#{@color_hidden}\",fontcolor=\"#{@color_hidden}\",fontname=\"#{@font}\",fontsize=#{font_size},shape=#{shape_class},height=#{@height},width=#{@width}];\n|\n\t\t# get classes\n\t\tcurrent = Array.new\n\t\tObjectSpace.each_object(Class) do |klass|\n\t\t\tcurrent.push klass\n\t\tend\n\t\ttodo = current - @classes - @ignored.keys\n\n\t\t# remove all classes from ignore_tree\n\t\ttodo.delete_if do |klass|\n\t\t\tklass = klass.superclass while klass && !@ignored_tree[klass]\n\t\t\tklass\n\t\tend\n\t\t\n\t\ttodo = todo.sort_by { |klass| klass.to_s }\n\t\ttodo.each do |klass|\n\t\t\t# all classes black\n\t\t\tstr << %Q|\t\"#{klass}\" [height=#{@height},width=#{@width},color=\"#{@color}\",fontcolor=\"#{@color}\"];\\n|\n\t\tend\n\t\t\n\t\tcon = Hash.new\n\t\t# connections\n\t\ttodo.each do |klass|\n\t\t\twhile superclass = klass.superclass\n\t\t\t\tbreak if @ignored[superclass]\n\t\t\t\tcon[ [superclass, klass] ] = true\n\t\t\t\tklass = superclass\n\t\t\tend\n\t\tend\n\t\tcon.each_key do |superclass, klass|\n\t\t\tstr << %Q{\\t\"#{superclass}\" -> \"#{klass}\";\\n}\n\t\tend\n\t\tstr << \"\\n\"\n\t\t\n\t\tgen_modules(str, todo) if with_modules\t\t\t\n\t\t\n\t\tstr << \"}\"\n\t\tstr\n\tend",
"def record_class_definitions\n extant, novel = [], []\n ObjectSpace.each_object(Class) { |k| extant << k }\n yield\n ObjectSpace.each_object(Class) { |k| novel << k if !extant.include?(k) }\n novel\n end",
"def prune_dependencies\n class_names = @classes.map {|klass| klass.name}\n @classes.each do |klass|\n klass.dependencies = klass.dependencies.uniq.keep_if {|dep| class_names.include?(dep)}\n end\n end",
"def emit_page_classes\n @page_classes ||= default_page_classes\n @page_classes.flatten!\n @page_classes.compact_blank!\n @page_classes.map! { |c| c.to_s.gsub(/[^a-z_0-9-]/i, '_') }\n @page_classes.uniq!\n @page_classes.join(' ')\n end",
"def list_known_classes names = []\n classes = []\n\n stores.each do |store|\n classes << store.module_names\n end\n\n classes = classes.flatten.uniq.sort\n\n unless names.empty? then\n filter = Regexp.union names.map { |name| /^#{name}/ }\n\n classes = classes.grep filter\n end\n\n page do |io|\n if paging? or io.tty? then\n if names.empty? then\n io.puts \"Classes and Modules known to ri:\"\n else\n io.puts \"Classes and Modules starting with #{names.join ', '}:\"\n end\n io.puts\n end\n\n io.puts classes.join(\"\\n\")\n end\n end",
"def trim_classes\n deletions = 1\n while deletions > 0 do\n deletions = 0\n @classes.each do |cls, value|\n next unless value.fetch(:sub_classes, {}).empty? && !value.has_key?(:examples)\n deletions += 1\n @classes.delete(cls)\n sc = value[:super_class]\n next unless sc\n puts \"trim class #{cls}, super-class #{sc}\"\n @classes[sc][:sub_classes].delete(cls) if @classes.fetch(sc, {})[:sub_classes]\n end\n end\n end",
"def unique_classes_and_modules\n @unique_classes + @unique_modules\n end",
"def classes\n self\n end",
"def unique_classes\n @unique_classes\n end",
"def list_known_classes\n end",
"def classes\n\t\traise \"classes: Not Implemented\"\n\tend",
"def remove_classes_from_top_layer(*class_list)\n @lines.reject! {|l| l.is_a?(GLMObject) && class_list.include?(l[:class])}\n end",
"def add_class klass\n @display.print_class klass\n end",
"def remove_classes_and_modules\n initialize_classes_and_modules\n end",
"def print_classes(class_name=nil)\n\tif class_name == nil\n\t\t$class_map.each do |keyc, valuec|\n\t\t\tvaluec.print_calls\n\t\tend\t\n\telse\n\t\t$class_map[class_name].print_calls\n\tend\nend",
"def list_known_classes names = []\n classes = []\n stores.each do |store|\n classes << store.modules\n end\n classes = classes.flatten.uniq.sort\n unless names.empty? then\n filter = Regexp.union names.map { |name| /^#{name}/ }\n classes = classes.grep filter\n end\n puts classes.join(\"\\n\")\n end",
"def display_klasses(with_modules=false, show_internal=false, klasses=Thor::Base.subclasses)\n klasses -= [Thor, Main, ::Apipie::Client::CliCommand, ::Thor] unless show_internal\n\n show_modules if with_modules && !thor_yaml.empty?\n\n list = Hash.new { |h, k| h[k] = [] }\n groups = []\n\n # Get classes which inherit from Thor\n (klasses - groups).each { |k| list[k.namespace.split(\":\").first] += k.printable_tasks(false) }\n\n # Get classes which inherit from Thor::Base\n groups.map! { |k| k.printable_tasks(false).first }\n list[\"root\"] = groups\n\n # Order namespaces with default coming first\n list = list.sort { |a, b| a[0].sub(/^default/, '') <=> b[0].sub(/^default/, '') }\n list.each { |n, tasks| display_tasks(n, tasks) unless tasks.empty? }\n end",
"def show_classes\n classes = Rails.cache.fetch(\"#{current_user.cache_key}/allClasses\", expires_in: 1.hours) do\n keytechAPI.classes.loadAllClasses\n end\n\n # Filter only to files, office file and folders, ignore all CAD-related types\n @classes = []\n classes.each do |element_class|\n next unless element_class.classKey.ends_with?('_WF') ||\n element_class.classKey.ends_with?('_FD') ||\n element_class.classKey.ends_with?('_FILE') ||\n element_class.classKey.ends_with?('_WW') ||\n element_class.classKey.ends_with?('_XL') ||\n element_class.classKey.ends_with?('_PRJ')\n\n if !element_class.classKey.starts_with?('DEFAULT') && element_class.isActive\n @classes.push element_class\n end\n end\n\n response.headers['Cache-Control'] = 'public, max-age=60'\n respond_to do |format|\n format.json do\n render json: @classes\n end\n end\n end",
"def draw_model_inheritance # rubocop:disable Metrics/AbcSize\n return '' if @definition.superklass.empty? && @definition.inherited_modules.empty?\n\n xml = ''\n\n unless @definition.superklass.empty?\n xml += %(<generalization general=\"#{@definition.superklass.id}\" xmi:id=\"#{gen_id}\" xmi:type=\"uml:Generalization\">\n </generalization>)\n end\n\n return xml if @definition.inherited_modules.empty?\n\n @definition.inherited_modules.each do |m|\n next if m.empty?\n\n xml += %(<generalization general=\"#{m.id}\" xmi:id=\"#{gen_id}\" xmi:type=\"uml:Generalization\">\n </generalization>)\n end\n xml\n end",
"def all_classes\n @classes_hash.values\n end",
"def print_class(*) end",
"def makena_classes\n Rails.application.eager_load!\n pass = ActiveRecord::Base.descendants.map{|a| a.to_s}\n pass.shift\n pass\n end",
"def all_classes_and_modules\n @classes_hash.values + @modules_hash.values\n end",
"def classes\n @classes.values\n end",
"def classes\n @classes.values\n end",
"def boring_classes\n return [::Class, *::Class.included_modules,\n ::Module, *::Module.included_modules,\n ::Kernel, *::Kernel.included_modules,\n ::Object, *::Object.included_modules,\n ::BasicObject, *::BasicObject.included_modules].uniq\n end",
"def top_classes; [RDF::RDFS.Class]; end",
"def orbserved_classes\n\t\t\t@orbserved_classes ||= Set.new\n\t\tend",
"def skip_class?(klass)\n (klass.class.name != klass.base_class.class.name) || klass.abstract_class? ||\n (printed_tables.include? klass.table_name) || (DatabaseDocumenter.configuration.skipped_modules.include? klass.parent.name)\n end",
"def pretty_print_heirarchy(klass)\n begin\n print klass\n klass = klass.superclass\n print \" < \" if klass\n end while klass\nend",
"def remove_nodoc_children\n prefix = self.full_name + '::'\n\n modules_hash.each_key do |name|\n full_name = prefix + name\n modules_hash.delete name unless @store.modules_hash[full_name]\n end\n\n classes_hash.each_key do |name|\n full_name = prefix + name\n classes_hash.delete name unless @store.classes_hash[full_name]\n end\n end",
"def process_class(current_class)\n\n STDERR.print \"\\tProcessing #{current_class}\\n\" if @options.verbose\n\n generated = false\n \n # Is current_clas derived from ActiveRecord::Base?\n if current_class.respond_to?'reflect_on_all_associations'\n\n\n node_attribs = []\n if @options.brief || current_class.abstract_class?\n node_type = 'model-brief'\n else \n node_type = 'model'\n\n # Collect model's content columns\n\n\tcontent_columns = current_class.content_columns\n\t\n\tif @options.hide_magic \n # From patch #13351\n # http://wiki.rubyonrails.org/rails/pages/MagicFieldNames\n magic_fields = [\n \"created_at\", \"created_on\", \"updated_at\", \"updated_on\",\n \"lock_version\", \"type\", \"id\", \"position\", \"parent_id\", \"lft\", \n \"rgt\", \"quote\", \"template\"\n ]\n magic_fields << current_class.table_name + \"_count\" if current_class.respond_to? 'table_name' \n content_columns = current_class.content_columns.select {|c| ! magic_fields.include? c.name}\n else\n content_columns = current_class.content_columns\n end\n \n content_columns.each do |a|\n content_column = a.name\n content_column += ' :' + a.type.to_s unless @options.hide_types\n node_attribs << content_column\n end\n end\n @graph.add_node [node_type, current_class.name, node_attribs]\n generated = true\n # Process class associations\n associations = current_class.reflect_on_all_associations\n if @options.inheritance && ! @options.transitive\n superclass_associations = current_class.superclass.reflect_on_all_associations\n \n associations = associations.select{|a| ! superclass_associations.include? a} \n # This doesn't works!\n # associations -= current_class.superclass.reflect_on_all_associations\n end\n associations.each do |a|\n process_association current_class.name, a\n end\n elsif @options.all && (current_class.is_a? Class)\n # Not ActiveRecord::Base model\n node_type = @options.brief ? 'class-brief' : 'class'\n @graph.add_node [node_type, current_class.name]\n generated = true\n elsif @options.modules && (current_class.is_a? Module)\n @graph.add_node ['module', current_class.name]\n end\n\n # Only consider meaningful inheritance relations for generated classes\n if @options.inheritance && generated && \n (current_class.superclass != ActiveRecord::Base) &&\n (current_class.superclass != Object)\n @graph.add_edge ['is-a', current_class.superclass.name, current_class.name]\n end \n\n end",
"def display_class name\n return if name =~ /#|\\./\n\n found, klasses, includes, extends =\n classes_and_includes_and_extends_for name\n\n return if found.empty?\n\n out = class_document name, found, klasses, includes, extends\n\n display out\n end",
"def classes\n [self]\n end",
"def classes\n return @classes if @classes\n @classes = @context.classes.sort.find_all{|c| c.document_self}.collect{|c| R2Doc.all_references[c.full_name]}\n end",
"def new_classes(snapshot)\n self.classes do |klass|\n if !snapshot.include?(klass)\n klass\n end\n end\n end",
"def show\n\n set_tutor()\n @classes = BerkeleyClass.all\n @true_classes = BerkeleyClass.first.true_classes\n @all_classes = BerkeleyClass.first.all_classes \n\n end",
"def hidden_class\n model.is_hidden? ? [\"kono_utils-hidden\"] : []\n end",
"def flume_plugin_classes\n flume_collect_property( :classes )\n end",
"def class_tree(root, show_methods = true, colorize = true)\n # get children of root\n children = Hash.new()\n maxlength = root.to_s.length\n ObjectSpace.each_object(Class) do |aClass|\n if (root != aClass && aClass.ancestors.include?(root))\n children[aClass.superclass] = Array.new() if children[aClass.superclass] == nil\n children[aClass.superclass].push(aClass)\n maxlength = aClass.to_s.length if aClass.to_s.length > maxlength\n end\n end\n maxlength += 3\n\n # print nice ascii class inheritance tree\n indentation = \" \"*4\n c = Hash.new(\"\")\n if colorize\n c[:lines] = term_color :blue\n c[:dots] = term_color :red\n c[:classNames] = term_color :yellow\n c[:moduleNames] = term_color :green\n c[:methodNames] = term_color :default\n end\n\n recursePrint = proc do |current_root,prefixString|\n if show_methods # show methods (but don't show mixed in modules)\n puts(prefixString.tr('`','|'))\n methods = (current_root.instance_methods - (begin current_root.superclass.instance_methods; rescue NameError; []; end))\n strings = methods.sort.collect {|m|\n prefixString.tr('`',' ') +\n ( children[current_root] == nil ? \" \"*maxlength : c[:lines]+indentation+\"|\"+\" \"*(maxlength-indentation.length-1)) + \n c[:dots]+\":.. \" +\n c[:methodNames]+m.to_s\n }\n strings[0] = prefixString + c[:lines]+\"- \"+c[:classNames]+current_root.to_s\n strings[0] += \" \" + c[:dots]+\".\"*(maxlength-current_root.to_s.length) + \" \"+c[:methodNames]+methods[0].to_s if methods[0] != nil\n strings.each {|aString| puts(aString) }\n else\n string = \"#{prefixString}#{c[:lines]}-#{c[:classNames]}#{current_root.to_s}\"\n modules = current_root.included_modules - [Kernel]\n if modules.size > 0\n string += \" \"*(maxlength-current_root.to_s.length)+c[:lines]+\"[ \"+c[:moduleNames]+\n modules.join( c[:lines]+\", \"+c[:moduleNames]) +\n c[:lines]+\" ]\"\n end\n puts(string)\n end\n if children[current_root] != nil\n children[current_root].sort! {|a, b| a.to_s <=> b.to_s}\n children[current_root].each do |child|\n recursePrint.call(\n child,\n prefixString.tr('`',' ') + indentation + c[:lines]+(child == children[current_root].last ? \"`\":\"|\"))\n end\n end\n end\n\n recursePrint.call(root,\"\")\nend",
"def included_in_modules\n modules = []\n ObjectSpace.each_object(Module) { |k| modules << k if k.included_modules.include?(self) }\n\n modules.reverse.inject([]) do |unique_modules, klass|\n unique_modules << klass unless unique_modules.collect { |k| k.to_s }.include?(klass.to_s)\n unique_modules\n end\n end",
"def reset_global_classes\n SheetNames.instance.clear\n SharedStrings.instance.clear\n end",
"def clear\n @autoloaded_classes.to_a.reverse_each do |klass|\n RubyCodeAutoreloader::ClassLoader.remove_constant(klass)\n @autoloaded_classes.delete(klass)\n end\n\n @existing_modules_before_load.clear\n @autoloaded_files = []\n ActiveSupport::DescendantsTracker.clear\n ActiveSupport::Dependencies.clear\n end",
"def css_class\n result = [self.project.try(:css_class), self.try(:format).try(:css_class)].join(' ')\n result = 'other' unless CSS_CLASSES.include?(result)\n result += ' invisible' unless self.is_visible\n result\n end",
"def disgems\n Recommendable.config.ratable_classes.map { |klass| disgemd_for(klass) }.flatten\n end",
"def all_modules klass, trash = []\n trash = [*trash]\n trash += [klass]\n children = shallow(klass, trash)\n all = [klass, children.\n map { |x| all_modules x, trash + children }].\n flatten.select { |x| Module === x }\n all\n end",
"def _subclasses\n @_subclasses ||= []\n end",
"def visibleToScripts(class_name)\n false\n end",
"def generate_all_classes_index(site)\n puts \"55555555555555555555555555555555555555555555555555555555\"\n allClasses = AllClassesIndex.new(site, site.source, \"/pages/classes\")\n allClasses.render(site.layouts, site.site_payload)\n allClasses.write(site.dest)\n\n site.pages << allClasses\n site.static_files << allClasses\n end",
"def generate_class_and_module_files\n template_file = @template_dir + 'class-page.html.erb'\n debug_msg \"Generating class documentation\"\n @unique_classes_and_modules.each do |klass|\n debug_msg \" %s %s\" % [klass.type, klass.full_name]\n outfile = @output_dir + klass.path\n @class = klass\n self.render_template(template_file, binding(), outfile)\n end\n end",
"def classes_and_modules\n classes + modules\n end",
"def classes_and_modules\n classes + modules\n end",
"def use_with_class_names\n (\n DynamicModel.model_names +\n ExternalIdentifier.model_names +\n ActivityLog.model_names +\n Master::PrimaryAssociations\n )\n .map { |m| m.to_s.singularize }\n .select { |m| m != 'master' }\n end",
"def reload_classes_only_on_change; end",
"def reload_classes_only_on_change; end",
"def getStandardClassInfo(cls)\n cls.standardClass = cls.model.findClassModelByPluginName(\"standard\")\n\n if (cls.standardClass.namespace.hasItems?)\n ns = cls.standardClass.namespace.get(\"::\") + \"::\"\n else\n ns = \"\"\n end\n\n cls.standardClassType = ns + Utils.instance.getStyledClassName(cls.getUName())\n\n if (cls.standardClass != nil && cls.standardClass.plugName != \"enum\")\n cls.addInclude(cls.standardClass.namespace.get(\"/\"), Utils.instance.getStyledClassName(cls.getUName()))\n end\n\n return cls.standardClass\n end",
"def reload_classes_only_on_change=(_arg0); end",
"def reload_classes_only_on_change=(_arg0); end",
"def all_classes_and_modules\n result = []\n ObjectSpace.each_object(Module) { |m| result << m }\n result.sort_by {|m| m.name}\nend",
"def class_names\n return if @class_names.empty?\n @class_names.uniq.sort\n end",
"def simple_classes\n _simple_classes\n end",
"def hierarchy klass\n if klass.instance_of? Class\n begin\n print klass\n klass = klass.superclass\n print \" < \" if klass\n end while klass\n puts\n end\nend",
"def generate\n classes = registry.all(:class)\n classes.each do |c|\n data = methods(c)\n output(data, c.to_s)\n end\n end",
"def display_klasses(with_modules = false, show_internal = false, klasses = Foreman::Thor::Base.subclasses)\n klasses -= [Foreman::Thor, Foreman::Thor::Runner, Foreman::Thor::Group] unless show_internal\n\n raise Error, \"No Foreman::Thor commands available\" if klasses.empty?\n show_modules if with_modules && !thor_yaml.empty?\n\n list = Hash.new { |h, k| h[k] = [] }\n groups = klasses.select { |k| k.ancestors.include?(Foreman::Thor::Group) }\n\n # Get classes which inherit from Foreman::Thor\n (klasses - groups).each { |k| list[k.namespace.split(\":\").first] += k.printable_commands(false) }\n\n # Get classes which inherit from Foreman::Thor::Base\n groups.map! { |k| k.printable_commands(false).first }\n list[\"root\"] = groups\n\n # Order namespaces with default coming first\n list = list.sort { |a, b| a[0].sub(/^default/, \"\") <=> b[0].sub(/^default/, \"\") }\n list.each { |n, commands| display_commands(n, commands) unless commands.empty? }\n end",
"def print_class_and_superclasses(object)\n object.class.ancestors.each do |klass|\n puts klass\n end\nend",
"def derivative_classes\n\t\tself.derivatives.values.uniq\n\tend",
"def derivative_classes\n\t\tself.derivatives.values.uniq\n\tend",
"def without_class?(name)\n a = []\n \n each do |e|\n if !e.get(\"className\").split(\" \").index(name)\n a << e\n end\n end\n \n JS::Collection.new(a)\n end",
"def emit_classes_dictionary\n methods = emit_methods_arrays\n [nil, nil, methods, emit_dict_init]\n end",
"def validate_class_names\n bpmn_xml.modularized_class_names.each do |class_name|\n validate_constant_name(class_name.demodulize, module_name)\n end\n puts set_color(\"External tasks with the same topic name as the BPMN id will be created.\", :bold)\n colorized_class_names = bpmn_xml.modularized_class_names.map! { |class_name| set_color class_name, :red }\n puts colorized_class_names.join(\"\\n\")\n end",
"def list_known_classes(classes)\n raise NotImplementedError\n end",
"def class_tree\n @class_tree ||= generate_class_tree\n end",
"def database_classes system_classes: nil\n\t\t@actual_class_hash = get_classes('name', 'superClass') \n all_classes = get_classes('name').map(&:values).sort.flatten\n all_user_classes = all_classes - system_classes()\n\n all_user_classes.each{|x| ActiveOrient.database_classes[x] = \"unset\" unless ActiveOrient.database_classes.has_key?(x) }\n \n ActiveOrient.database_classes.keys # return an array of database-classnames\n end",
"def dump\n do_without_lazy_loader { super }\n end",
"def clear\n @class_formatters.clear\n @module_formatters.clear\n self\n end",
"def classes_hash\n @classes\n end",
"def classes_hash\n @classes\n end",
"def generate_all_classes(site)\n puts \"222222222222222222222222222222222222222222222222222222222222\"\n if Dir.exists?('src/_classes')\n puts \"3333333333\"\n Dir.chdir('src/_classes')\n\n Dir[\"*.yml\"].each do |path|\n puts \"444444444 \" + path\n name = File.basename(path, '.yml')\n self.generate_class_index(site, site.source, \"/pages/classes/\" + name, name, 'el')\n self.generate_class_index(site, site.source, \"/en/pages/classes/\" + name, name, 'en')\n end\n\n Dir.chdir(site.source)\n self.generate_all_classes_index(site)\n end\n end",
"def defaultInfo\r\n temp = @@currClass\r\n # set 1\r\n puts '1.Name of current class: ' + temp.class.name\r\n # set 2\r\n puts '2.Name of superclass: ' + temp.class.superclass.to_s\r\n\r\n # set 3\r\n puts '3.List of subclasses'\r\n subclasses = (ObjectSpace.each_object(Class).select { | kl | kl < temp.class})\r\n subclasses2 = convertObjectsArrToStringArr(subclasses)\r\n\r\n subclasses2 = mergeSort(subclasses2)\r\n if(subclasses2 == nil)\r\n subclasses2 = []\r\n end\r\n printListEnumerated(subclasses2)\r\n @@listSubclasses = subclasses2\r\n\r\n # set 4\r\n puts '4. List of methods'\r\n methods = temp.class.instance_methods(false)\r\n methods2 = convertObjectsArrToStringArr(methods)\r\n methods2 = mergeSort(methods2)\r\n if(methods2 == nil)\r\n methods2 = []\r\n end\r\n\r\n printListEnumerated(methods2)\r\n end",
"def to_scaffold\n\t\[email protected] { |klassname,klass| klass.to_scaffold( self) }\n\tend",
"def display_class name\n return if name =~ /#|\\./\n klasses = []\n includes = []\n found = @stores.map do |store|\n begin\n klass = store.load_class name\n klasses << klass\n includes << [klass.includes, store] if klass.includes\n [store, klass]\n rescue Errno::ENOENT\n end\n end.compact\n return if found.empty?\n also_in = []\n includes.reject! do |modules,| modules.empty? end\n out = RDoc::Markup::Document.new\n add_class out, name, klasses\n add_includes out, includes\n found.each do |store, klass|\n comment = klass.comment\n class_methods = store.class_methods[klass.full_name]\n instance_methods = store.instance_methods[klass.full_name]\n attributes = store.attributes[klass.full_name]\n\n if comment.empty? and !(instance_methods or class_methods) then\n also_in << store\n next\n end\n add_from out, store\n unless comment.empty? then\n out << RDoc::Markup::Rule.new(1)\n out << comment\n end\n if class_methods or instance_methods or not klass.constants.empty? then\n out << RDoc::Markup::Rule.new(1)\n end\n unless klass.constants.empty? then\n out << RDoc::Markup::Heading.new(1, \"Constants:\")\n out << RDoc::Markup::BlankLine.new\n list = RDoc::Markup::List.new :NOTE\n constants = klass.constants.sort_by { |constant| constant.name }\n list.push(*constants.map do |constant|\n parts = constant.comment.parts if constant.comment\n parts << RDoc::Markup::Paragraph.new('[not documented]') if\n parts.empty?\n RDoc::Markup::ListItem.new(constant.name, *parts)\n end)\n out << list\n end\n add_method_list(out, \n (class_methods || []).map {|x| \".#{x}\"}, \n 'Class methods')\n add_method_list(out, \n (instance_methods || []).map {|x| \"#{x}\"}, \n 'Instance methods')\n add_method_list out, attributes, 'Attributes'\n out << RDoc::Markup::BlankLine.new\n end\n add_also_in out, also_in\n display out\n end",
"def clear_gemed_theme\n @@gem_theme_classes = []\n clear_gemed_theme_instances\n end",
"def include_discovered(klass)\n # This should be nil already in most cases,\n # but if another class is defined in Runtime after a query was already run, we want to make sure this is reset\n @discovered_include_level = nil\n\n discovered_includes << klass unless discovered_includes.include?(klass)\n end",
"def cache_classes; end",
"def cache_classes; end"
]
| [
"0.6373043",
"0.61872894",
"0.5890121",
"0.58712715",
"0.58534676",
"0.581856",
"0.579209",
"0.5779362",
"0.5774515",
"0.57436",
"0.5743313",
"0.5741707",
"0.5731197",
"0.5730855",
"0.5725498",
"0.57057655",
"0.56915677",
"0.56719434",
"0.5658555",
"0.56471443",
"0.5629149",
"0.5617934",
"0.5607275",
"0.55933416",
"0.55741864",
"0.5573889",
"0.55688304",
"0.55541366",
"0.5546477",
"0.5542203",
"0.55307776",
"0.551248",
"0.5499211",
"0.54960376",
"0.54952395",
"0.54944754",
"0.5491543",
"0.5484411",
"0.5466535",
"0.5466535",
"0.5450413",
"0.5438126",
"0.54154134",
"0.5415297",
"0.5398291",
"0.537439",
"0.5363722",
"0.5358678",
"0.5354245",
"0.5352339",
"0.5348433",
"0.5346306",
"0.52868867",
"0.52723455",
"0.52560604",
"0.5255841",
"0.52416515",
"0.52387327",
"0.5235736",
"0.52257955",
"0.52209586",
"0.5214127",
"0.52090484",
"0.5208854",
"0.51994336",
"0.5193253",
"0.5193253",
"0.51897305",
"0.5186024",
"0.5186024",
"0.517497",
"0.5165256",
"0.5165256",
"0.51649284",
"0.5159677",
"0.51561934",
"0.51559967",
"0.51515716",
"0.5142409",
"0.5141671",
"0.5136656",
"0.5136656",
"0.5130883",
"0.5130307",
"0.51049113",
"0.50991964",
"0.50954163",
"0.50905716",
"0.5082279",
"0.508174",
"0.5074962",
"0.5074962",
"0.50661784",
"0.50654966",
"0.50616455",
"0.5051536",
"0.50308615",
"0.50292104",
"0.50276136",
"0.50276136"
]
| 0.6972091 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.