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
Lazy read the contact information
def contact @contact ||= get_contact(@data_object.user_contact) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_contact_info\n lambda {\n user.vet360_contact_info\n }\n end", "def contact\n response[\"contact\"]\n end", "def display_one_contact\n contact = retrieve_contact_by_email\n end", "def get_contact\n if self.contact_id\n return self.contact\n end\n end", "def scrape_contacts; end", "def contact; Contact.get(self.contact_id); end", "def contact; Contact.get(self.contact_id); end", "def contact; Contact.get(self.contact_id); end", "def contact; Contact.get(self.contact_id); end", "def contact; Contact.get(self.contact_id); end", "def contact\n ::HubEdos::Common::Reference::Descriptor.new(@data['contact']) if @data['contact']\n end", "def scrape_contacts\n unless agent.cookies.find{|c| c.name == 'MSPPre' && c.value == options[:username]}\n raise( Blackbook::BadCredentialsError, \"Must be authenticated to access contacts.\" )\n end\n\n page = agent.get('PrintShell.aspx?type=contact')\n rows = page.search(\"//div[@class='ContactsPrintPane cPrintContact BorderTop']\")\n rows.collect do |row|\n vals = {}\n row.search(\"table/tr\").each do |pair|\n key = pair.search(\"td[@class='TextAlignRight Label']\").first.inner_text.strip rescue nil\n next if key.nil?\n val = pair.search(\"td[@class='Value']\").first.inner_text.strip\n vals[key.to_sym] = val\n end\n vals[:name] = vals['Name:'.to_sym] rescue ''\n vals[:email] = (vals['Personal e-mail:'.to_sym] || vals['Work e-mail:'.to_sym] || vals['Windows Live ID:'.to_sym]).split(' ').first rescue ''\n vals\n end\n end", "def fetch id=nil\n id ||= self.id\n resp = @nimble.get \"contact/#{id}\"\n self.contact = resp['resources'].first\n return nil unless self.contact\n self\n end", "def get_company_info_from_fullcontact\n response = HTTParty.get(FULLCONTACT_LOOKUP_API, query: { \"domain\" => fetched_domain,\n \"apiKey\" => FULLCONTACT_API_KEY })\n response = response.success? ? JSON(response.body) : raise(\"Could not get information from FullContact, check rate limit.\")\n raise \"FullContact retry error\" if response[\"status\"] == 202 # FullContact queues for search sometimes.\n response\n end", "def contact_info(handle)\n response = query_no_raise :query_whois, contact: handle\n case response[:headers][:status_code]\n when '2303' then nil\n when '0' then\n result = {}\n response[:body].split(\"\\n\").each do |line|\n line.slice! /^contact\\./\n line_parsed = parse_line(line)\n next if line_parsed.is_a? String\n key, value = line_parsed.first\n case key\n when :name then next if value == \"- -\"\n when :address_1, :address_2, :address_3 then\n result[:address] = [] unless result.has_key? :address\n result[:address] << value\n when :state then next if value == \"--\"\n when :organization then next if value == \"-\" or value.empty?\n when :created_date, :modified_date then\n result[key] = DateTime.parse value\n else\n result.merge! line_parsed\n end\n end\n result\n else\n raise_response response\n end\n end", "def contact\n @contact ||= OpenStruct.new(get_attr(:contact))\n end", "def get_contact_emails\n if @info == nil || !(@info.key? \"contacts\")\n return Array.new\n end\n \n return @info[\"contacts\"]\n end", "def getContacts\n @contact_list.each_with_index do |c, i|\n #puts \"#{i +1}) #{c}\"\n puts \"#{i +1}) #{c[:first_name]} #{c[:last_name]} #{c[:email]}\"\n end\n end", "def contacts\n\t\t@contact = Contact.first();\n\tend", "def contact\n\t\t@contact\n\tend", "def contact\n\t\t@contact\n\tend", "def contact_name\n contact['name']\n end", "def contact_details_for(contact)\n if contact.title.present? && contact.department.present?\n return contact_title_and_department_for(contact)\n end\n return contact_title_for(contact) if contact.title.present?\n return contact_department_for(contact) if contact.department.present?\n end", "def contact\n find('Contact', contact_id)\n end", "def contacts\n contacts_raw.present? ? JSON.parse(contacts_raw) : {}\n end", "def contact_phone\n self.contact[:contact_phone]\n end", "def get_contact\r\n @contact = @customer.contact_people.find_by_name params[:id]\r\n end", "def retrieve_contact_by_email\n unless @rolodex.is_empty?\n print \"Please, provide the email of the contact in question: \"\n contact = @rolodex.search_contact(gets.chomp)\n if contact\n @rolodex.display_particular(contact)\n else\n puts \"Error: contact not found.\"\n end\n else\n contact = false\n puts \"Error: the Rolodex is empty.\"\n end\n return contact\n end", "def get_contact(id)\n contacts = read_contacts\n contacts.select { |contact| contact[:id] == id }.first\nend", "def contact\n @contact ||= ActsAsIcontact::Contact.find(contactId.to_i) if contactId.to_i > 0\n end", "def fetch_contacts!\n create_agent\n prepare\n scrape_contacts\n end", "def contact_details\n puts \"Contact name: #{self.contact_name}\"\n puts \"Phone number: #{self.phone}\"\n puts \"Email: #{self.email}\"\n end", "def contact_email\n self.contact[:contact_email]\n end", "def populate_contact_details\n last_booking = Bookings::Booking.last_accepted_booking_by(bookings_school)\n\n return false if last_booking.blank?\n\n assign_attributes(\n contact_name: last_booking.contact_name,\n contact_email: last_booking.contact_email,\n contact_number: last_booking.contact_number,\n location: last_booking.location,\n )\n\n true\n end", "def display_one_contact(contact)\n if contact\n puts \"Name: #{contact.name}\"\n puts \"E-mail: #{contact.email}\"\n puts \"Phone Number: #{contact.phone_number}\"\n else\n puts \"Not found!\"\n end\n end", "def parse_contacts\n case params[:importer]\n when GMAIL, YAHOO, HOTMAIL\n request.env['omnicontacts.contacts'].map { |c| [c[:email], c[:email]] }.to_json\n when LINKEDIN then fetch_linkedin_contacts\n end\n end", "def show\n contact_shard = Facebase::Contact.shard_for(params[:id])\n @contact = contact_shard.where(\"profile_id = ? \", params[:id]).includes(:profile, :events, :emails).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end", "def get_contact(id)\n\t\t@nutshell.get_contact(id)\n\tend", "def index\n @user_contact_information = current_user.user_contact_information\n end", "def get_contact(contact)\n ensure_cache_up_to_date\n namespace = \"bluster:objects:contact:#{contact}\"\n keys = self.redis.keys(\"#{namespace}:*\")\n data = {}\n keys.each { |key|\n short_key = key.split(\":\")[4] \n data[short_key] = self.redis.get(\"#{namespace}:#{short_key}\")\n }\n data\n end", "def get_all_contacts\r\n info = load_contacts\r\n info.each do |arr|\r\n puts \"#{arr[0]}: #{arr[1]} (#{arr[2]})\"\r\n end\r\n puts \"---\"\r\n puts \"#{generate_id} records total\"\r\n end", "def scrape_contacts \n unless auth_cookie = agent.cookies.find{|c| c.name =~ /^Auth/}\n raise( Blackbook::BadCredentialsError, \"Must be authenticated to access contacts.\" )\n end\n \n # jump through the hoops of formulating a request to get printable contacts\n uri = agent.current_page.uri.dup\n inputs = agent.current_page.search(\"//input\")\n user = inputs.detect{|i| i['type'] == 'hidden' && i['name'] == 'user'}\n utoken = user['value']\n\n path = uri.path.split('/')\n path.pop\n path << 'addresslist-print.aspx'\n uri.path = path.join('/')\n uri.query = \"command=all&sort=FirstLastNick&sortDir=Ascending&nameFormat=FirstLastNick&user=#{utoken}\"\n page = agent.get uri.to_s\n\n # Grab all the contacts\n rows = page.search(\"table tr\")\n name, email = nil, nil\n \n results = []\n rows.each do |row|\n new_name = row.search(\"span[@class='fullName']\").inner_text.strip\n if name.blank? || !new_name.blank?\n name = new_name\n end\n next if name.blank?\n \n email = row.search(\"td[@class='sectionContent'] span:last\").inner_text.strip\n next if email.blank?\n \n results << {:name => name, :email => email}\n name, email = nil, nil\n end\n results\n end", "def get_google_contacts\n url = \"https://www.google.com/m8/feeds/contacts/default/full?access_token=#{token}&alt=json&max-results=100\"\n response = open(url)\n json = JSON.parse(response.read)\n my_contacts = json['feed']['entry']\n\n my_contacts.each do |contact|\n name = contact['title']['$t'] || nil\n email = contact['gd$email'] ? contact['gd$email'][0]['address'] : nil\n tel = contact['gd$phoneNumber'] ? contact[\"gd$phoneNumber\"][0][\"$t\"] : nil\n if contact['link'][1]['type'] == \"image/*\"\n picture = \"#{contact['link'][1]['href']}?access_token=#{token}\"\n else\n picture = nil\n end\n contacts.first_or_create({name: name, email: email, tel: tel})\n end\n end", "def contacts\n\t\t@user = current_user\n\t\tcheck_if_myself\n\t\t@contacts = @user.contacts\n\tend", "def contacts\n parser.contacts\n end", "def inportant_information\n RubyRedtail::Query.run(\"contacts/#{@id}/importantinfo\", @api_hash, \"GET\")\n end", "def details\n contact_details = {\"Full Name\" => full_name, \"Email\" => email, \"Note\" => note}\n end", "def contact_name\n attributes[:contact] && attributes[:contact][:name]\n end", "def fetch_contacts! \n cards = Vpim::Vcard.decode(open(options[:file].path))\n \n contacts = Array.new\n cards.each do |card|\n h = Hash.new\n h[:name] = card.name.fullname.to_s\n h[:email] = card.email.to_s\n contacts << h\n end\n \n contacts\n end", "def show\n @contact.read\n @contact.save\n @sender = User.find_by(pseudo: @contact.sender)\n end", "def contact_info\n puts \" Address: #{@address}\"\n puts \" Phone No: #{@phone}\"\n puts \" Email: #{@email}\"\n end", "def contactinfo\n @id = nil\n # TODO similar processing for organisation session variable\n @person = get_person_from_session\n if !@person.blank?\n # find all person's contact infos\n @person_contactinfos = PersonContactinfo.find(:all, :conditions => ['person_id =?', @person.person_id])\n if @person_contactinfos.empty?\n redirect_to :action => 'new'\n else\n for contactinfo in @person_contactinfos\n if contactinfo.preferred == true\n @id = contactinfo.contactinfo_id\n else \n if contactinfo.preferred == false && @id == nil\n @id = contactinfo.contactinfo_id\n end\n end\n end\n redirect_to :action => 'edit', :id => @id\n end\n end\n end", "def contacts\n contact_client.contacts\n end", "def contact_email\n contact['email_address']\n end", "def show\n @breadcrumb = 'read'\n @corp_contact = CorpContact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @corp_contact }\n end\n end", "def fetch (contact_id)\n RubyRedtail::Query.run(\"contacts/#{contact_id}/addresses\", @api_hash, \"GET\")\n end", "def show_contact(id)\r\n contacts_in_array = load_contacts\r\n contacts = {}\r\n contacts_in_array.each do |contact|\r\n id_from_array = contact.shift\r\n data_from_array = contact\r\n contacts[id_from_array] = data_from_array\r\n end\r\n if contacts[id.to_s] != nil \r\n puts contacts[id.to_s]\r\n else\r\n puts \"not found\"\r\n end\r\n end", "def contacts\n respond_with_entity(api.get('/api/v1/profile/contacts'),\n NexaasID::Entities::Profile::Contacts)\n end", "def display_contacts\n # Fill this in\n # HINT: Make use of this method in the display_all_contacts and search_by_attribute methods\n Contact.all.each do |contacts|\n puts \":#{contacts.full_name}, #{contacts.email}, #{contacts.id}, #{contacts.note}\"\n end\n end", "def get_contact_by_number(contact_number)\n get_contact(nil, contact_number)\n end", "def get_contact_by_number(contact_number)\n get_contact(nil, contact_number)\n end", "def contacts\n @contacts ||= Harvest::API::Contacts.new(credentials)\n end", "def contact; end", "def contacts\n @contacts ||= get_attr(:contacts).collect { |c| OpenStruct.new(c) }\n end", "def get_contact_by_id(contact_id)\n get_contact(contact_id)\n end", "def get_contact_by_id(contact_id)\n get_contact(contact_id)\n end", "def fetchContactDetails(leadEmailId)\n return checkRecordCreated(\"Contact\", \"SELECT id,Looking_For_Number_Of_Desk__c,Name,Owner.Id,Owner.Name,RecordType.Name,Number_of_Full_Time_Employees__c FROM Contact WHERE Email = '#{leadEmailId}'\")\n end", "def association_contact_information\n contact = \"<a href='mailto: #{current_association.contact_email}'>#{current_association.contact_name.blank? ? current_association.name : current_association.contact_name}</a>\"\n \n contact += \" at #{current_association.formatted_contact_phone}\" unless current_association.contact_phone.blank?\n contact += \" ext. #{current_association.contact_phone_extension}\" unless current_association.contact_phone_extension.blank?\n \n return contact\n end", "def find_contact_for_signin(email:, firstname:, lastname:, date_of_birth:)\n filter = filter_pairs(emailaddress2: email, emailaddress1: email)\n\n store.fetch(Contact, filter: filter, limit: 20, order: 'createdon desc')\n .find { |c| c.signin_attributes_match? firstname, lastname, date_of_birth }\n .tap { |c| crmlog \"Read contact #{c.contactid}\" if c }\n end", "def contact?\r\n infoxml = get_info\r\n \r\n if contact = infoxml['contact']\r\n return contact == '1'\r\n end\r\n \r\n return false\r\n end", "def show ( contact )\n puts \"#{contact[:name]}\"\n puts \"phone: #{contact[:phone]}\"\n puts \"email: #{contact[:email]}\"\n puts\nend", "def get_contact_info\n puts 'Enter email address:'\n email = $stdin.readline().chomp\n if Contact.contact_exists?(email)\n puts 'You\\'ve already added this contact!'\n return nil\n else\n puts 'Enter contact name:'\n name = $stdin.readline().chomp\n puts 'Enter phone numbers: (e.g. mobile 604-678-3456, home 345-234-3456'\n phone_numbers = $stdin.readline().chomp.split(\", \")\n id = ContactDatabase.read.length + 1\n return [id, name, email, phone_numbers]\n end\n end", "def show\r\n\t\t@contact = current_user.contacts.find(params[:id])\r\n\tend", "def display_contacts\n Contact.each do |contacts|\n print \"First name: #{contacts.first_name}, Last name: #{contacts.last_name}, Email address: #{contacts.email}, Notes: #{contacts.note}\"\n end\n\n # HINT: Make use of this method in the display_all_contacts and search_by_attribute methods to keep your code DRY\n end", "def get_contact_detail(business, category)\n contact_details.find_by(business: business, category: category)\n end", "def get_contacts\n @notification_server.get_contacts\n end", "def contact(contact, options = {})\n get(\"contacts/#{contact}\", options).pop\n end", "def get_contact_info_array\n rtn = []\n rtn << get_attr(:name)\n rtn << [:provided_by, self.provider.name] # Special case, as the symbol doesn't match the attribute\n rtn << get_attr(:phone)\n rtn << get_attr(:email)\n rtn << get_attr(:url)\n end", "def contact_info\n [phone_number, email].compact.map { |e| exhibit(e, @context) }.join('<br />').html_safe\n end", "def matter_contact_records\n get_comp_id = get_company_id\n @contacts = Contact.get_contact_records(current_company,get_comp_id) \n @matters = Matter.get_matter_records(get_comp_id, get_employee_user_id)\n end", "def show\n @contact = contacts.find(params[:id])\n end", "def load_contacts\r\n CSV.open('contacts.csv', 'r').readlines.each{|file| file}\r\n end", "def by_name first_name, last_name\n query = { \"and\" => [{ \"first name\" => { \"is\"=> first_name } }, { \"last name\" => { \"is\"=> last_name } }, { \"record type\"=> { \"is\"=> \"person\" }} ] }\n resp = @nimble.get 'contacts', { :query => query.to_json }\n self.contact = resp['resources'].first\n return nil unless self.contact\n self\n end", "def set_contact_info\n @contact_info = ContactInfo.find(params[:id])\n end", "def set_contact_info\n @contact_info = ContactInfo.find(params[:id])\n end", "def populatecontactfields\n @contact = Contact.new\n @contact_stage = get_contact_stages(@company.contact_stages.array_to_hash('lvalue'),['Client'])\n @lead_status = false\n render :partial=>'common/newcontact', :object=>@contact\n end", "def contact_info\n contact_info_arr = []\n contact_info_arr << (mobile.present? ? \"#{mobile} (M) \" : nil)\n contact_info_arr << (telephone.present? ? \"#{telephone} (T)\" : nil)\n contact_info_arr << email\n contact_info_arr.compact.join(\"<br/>\")\n end", "def contact\n doc \"The identifier of this contact.\"\n id\n contact_attributes\n record_timestamps\n end", "def contact_info(contact)\n super # placeholder so that I can add some doc\n end", "def list\n @mailing_list.contacts(limit: 10000).map{|contact| contact.email}\n end", "def show\n @contact = current_user.contacts.find(params[:id])\n\n end", "def contact\n \t@contact = Contact.new\n end", "def contact\n @city = City.first\n end", "def contacts(reload = false)\n self.cache(CostAgent::Contact, :all, reload) do\n (self.api(\"contacts\")/\"contact\").collect do |contact|\n projects = self.projects(:all, reload).select { |p| p.contact_id == (contact/\"id\").first.inner_text.to_i }\n Contact.new(\n :id => (contact/\"id\").first.inner_text.to_i,\n :organisation_name => (contact/\"organisation-name\").first.inner_text,\n :first_name => (contact/\"first-name\").first.inner_text,\n :last_name => (contact/\"last-name\").first.inner_text,\n :address1 => (contact/\"address1\").first.inner_text,\n :address2 => (contact/\"address2\").first.inner_text,\n :address3 => (contact/\"address3\").first.inner_text,\n :town => (contact/\"town\").first.inner_text,\n :region => (contact/\"region\").first.inner_text,\n :country => (contact/\"country\").first.inner_text,\n :postcode => (contact/\"postcode\").first.inner_text,\n :phone_number => (contact/\"phone-number\").first.inner_text,\n :email => (contact/\"email\").first.inner_text,\n :billing_email => (contact/\"billing-email\").first.inner_text,\n :contact_name_on_invoices => (contact/\"contact-name-on-invoices\").first.inner_text == \"true\",\n :sales_tax_registration_number => (contact/\"sales-tax-registration-number\").first.inner_text,\n :uses_contact_invoice_sequence => (contact/\"uses-contact-invoice-sequence\").first.inner_text == \"true\",\n :account_balance => (contact/\"account-balance\").first.inner_text.to_f,\n :projects => projects)\n end\n end\n end", "def contact_to(subject)\n sent_contacts.received_by(subject).first\n end", "def contact\n Zapi::Models::Contact.new\n end", "def get_contact(id)\n return unless self.online? && id # we're offline.\n @telegram.search_public_chat(id).then{|chat| id = chat.id }.wait if id[0] == '@'\n @telegram.get_user(id).wait if not @cache[:users][id] and (id>0) \n @telegram.get_chat(id).wait if not @cache[:chats][id]\n return @cache[:chats][id], @cache[:users][id]\n end", "def contact_id\n attributes[:contact] && attributes[:contact][:contact_id]\n end", "def contact_email\n return @contact_email\n end", "def user\n User.get(contact, client: @client)\n end" ]
[ "0.70533556", "0.69931376", "0.69071925", "0.68375194", "0.6806678", "0.680625", "0.680625", "0.680625", "0.680625", "0.680625", "0.66355497", "0.65883356", "0.65800035", "0.6558589", "0.6556369", "0.65496105", "0.6538455", "0.65359867", "0.64843047", "0.64710087", "0.64710087", "0.6456794", "0.64518666", "0.64061975", "0.6386569", "0.63806415", "0.63628155", "0.63593435", "0.6353412", "0.63491464", "0.6342043", "0.6320504", "0.6311115", "0.6303024", "0.6277179", "0.6252603", "0.62507075", "0.6243272", "0.6236822", "0.6231567", "0.62063444", "0.61843264", "0.6172004", "0.6170334", "0.6169629", "0.61587656", "0.6148766", "0.6146153", "0.61450005", "0.6141841", "0.6096133", "0.6090297", "0.6073883", "0.6071848", "0.60633284", "0.6061363", "0.60552293", "0.6043096", "0.6041554", "0.6036299", "0.6036299", "0.6029515", "0.60273457", "0.6022544", "0.59922796", "0.59922796", "0.5983175", "0.5982616", "0.5980593", "0.59792864", "0.5978605", "0.59783864", "0.59698224", "0.59614766", "0.5959541", "0.5938988", "0.59245205", "0.59190845", "0.5916674", "0.5895215", "0.5890488", "0.5884371", "0.5875188", "0.58742195", "0.58742195", "0.58721435", "0.58720136", "0.5869823", "0.58685017", "0.58644295", "0.5842271", "0.5832167", "0.5800148", "0.58000106", "0.57990134", "0.57836926", "0.57797194", "0.57769805", "0.5776616", "0.5775751" ]
0.69959927
1
Return a new plaintext password
def create_new_password pass = generate_password set_password(pass) pass end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def password=(new_password); end", "def generate_new_password\n chars = 'abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'\n password = ''\n 10.times { password << chars[rand(chars.size)] }\n self.update_attributes(:encrypted_password => User.encrypt(password, self.salt))\n UserMailer.deliver_forgot_password_mail(self, password)\n password\n end", "def encrypt_new_password\n return if password.blank?\n self.hashed_password = encrypt(password)\n end", "def set_new_password \n new_passwd = generate_password()\n self.password = self.password_confirmation = new_passwd\n self.save!\n return new_passwd\n end", "def encrypt_new_password\n return if password.blank?\n self.hashed_password = encrypt(password)\n end", "def new_password\n return @new_password\n end", "def mutate_bcrypt_password(_)\n '400$8$2d$f6ed5a490c441958$67f59aa61bc617849a3280b5e80f78607e53b5aa5807a44ddbc53e804e2e2a99'\n end", "def password\n 'password'.gsub('', '')\n end", "def standard_password\n \"!@Cd5678\"\n end", "def old_password=(string)\n end", "def get_password\n\tpwd1 = Password.get(\"New Password: \")\n\tpwd2 = Password.get(\"Retype New Password: \")\n\n\tbegin\n\t\traise if pwd1 != pwd2\n\t\trescue\n\t\t\tprint \"ERROR: Password mismatch!\\n\"\n\t\t\texit\n\tend\n\n\tbegin\n\t\tpwd1.check # check password strength\n\t\trescue\n\t\t\tprint \"ERROR: Password strength check failed: \" + $! + \"\\n\"\n\t\t\texit\n\tend\n\n\tsalt = rand.to_s.gsub(/0\\./, '')\n\tpass = pwd1.to_s\n\thash = \"{SSHA}\"+Base64.encode64(Digest::SHA1.digest(\"#{pass}#{salt}\")+salt).chomp!\n\treturn hash\nend", "def password=(pass)\n @good_password = false if system(\"look \\\"#{pass.downcase}\\\" > /dev/null 2>&1\")\n super Encrypt::Password.createHash pass\n end", "def generate_password\n if new_record?\n self.password = self.password_confirmation = /\\w{0,10}/.gen unless password\n end\n end", "def encrypt_password\n self.salt = make_salt if new_record?\n self.encrypted_password = encrypt(password)\n end", "def encrypt_password\n return if password.blank?\n self.salt = User.make_token if new_record?\n self.crypted_password = encrypt(password)\n end", "def password\n @crypted_password\n \n end", "def newPassword(newPass)\n\t\tDATABASE.edit(\"users\", \"password\", newPass, \"username\", @username)\n\tend", "def password_field=(plaintext)\n if plaintext != self.password\n self.password = Digest::SHA1.hexdigest(plaintext)[0..39] \n end\n end", "def encrypt_password\n self.salt = make_salt if new_record?\n\t self.encrypted_password = encrypt(password)\n end", "def generate_password\n self.password = \"1234\"\n end", "def crypt_password\r\n write_attribute \"password\", self.class.sha1(password)\r\n end", "def create_hashed_password\n self.password = password.crypt(\"ChaveDoProvas\")\n end", "def crypt_password\n # EmailNotify.send_user_create_notification self\n self[:password] =\n password_hash(password(true))\n @password = nil\n end", "def encrypt_password\n if new_record?\n self.salt = make_salt\n self.password_digest = encrypt(password_digest)\n end\n end", "def password\n @hash.to_s\n end", "def get_password(password)\n password\n end", "def encrypt_password\n self.salt = make_salt if new_record?\n self.encrypted_password = encrypt(password)\n end", "def encrypt_password\r\n \r\n # If the user is new, create a salt\r\n self.make_salt if new_record?\r\n \r\n # Hash the salt and password to create the encrypted pass\r\n self.encrypted_password = sha_hash(\"#{self.password}--#{self.salt}\")\r\n \r\n end", "def set_password pass\n self.pass_salt = SHA256Salt.generate_random\n self.pass_hash = WodaHash.digest(self.pass_salt + pass).to_hex\n end", "def password= new_pass\n # don't allow setting a blank password\n return if new_pass.blank?\n\n @password = BCrypt::Password.create(new_pass)\n self.password_digest = @password\n end", "def encrypt_password\n self.salt = make_salt if new_record?\n self.encrypted_password = encrypt(self.password)\n end", "def generate_temporary_password\n\n pw = Algol.password_salt\n # puts \">> User: generating a temporary password '#{pw}' <<\"\n update!({ password: User.encrypt(pw), auto_password: true })\n\n # expire all current/old temp passwords that weren't used\n pending_notices.all({ type: 'password' }).each { |n| n.expire! }\n\n notices.create({ type: 'password', data: pw })\n end", "def crypt_password\n write_attribute \"password\", self.class.sha1(password)\n end", "def crypt_password\n write_attribute \"password\", self.class.sha1(password)\n end", "def hash_pass()\n self.pass=(BCrypt::Password.create(pass).to_s)\n end", "def password\n\t\tPassword.new( attribute_get(:password) )\n\tend", "def encrypt_password\n if self.new_record? || !self.password.blank?\n self.encrypted_password = Digest::SHA256.hexdigest(\"#{self.encryption_salt}::#{@password}\")\n end\n end", "def change_temp_password\n\tend", "def encrypt_password\n return if password.blank?\n self.salt = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{login}--\") if new_record?\n self.crypted_password = encrypt(password)\n end", "def new_password; nil; end", "def pass=(new_password)\n self.password = Password.create(new_password)\n end", "def hash_new_password\n self.encrypted_password = BCrypt::Password.create(@new_password)\n end", "def make_up_password\n\to = [('a'..'z'), ('A'..'Z'), ('0'..'9')].map { |i| i.to_a }.flatten\n\tpass = (0...12).map { o[rand(o.length)] }.join + \"@\"\n\tputs \"Using #{pass} for password\\n\"\n\treturn pass\nend", "def encrypt(password)\n ::BCrypt::Password.create(password, cost: 10).to_s\n end", "def set_password\n @password = Password.last\n @new_password = Password.new\n end", "def new_password\n @new_password\n end", "def hash_new_password\n self.password = BCrypt::Password.create(@new_password)\n end", "def encrypt_password\n\t\t\tself.salt = make_salt if new_record? #new_record? retourne \"true\" si l'objet n'est pas dans la base de données\n\t\t\tself.encrypted_password = encrypt(password)\n\t\tend", "def encrypt_password\n\t\treturn if password.blank?\n\t\tif new_record?\n\t\t\tself.salt = Digest::SHA1.hexdigest(\"--#{Time.now}--#{name}--\")\n\t\tend\n\t\tself.encrypted_password = User.encrypt(password, salt)\n\tend", "def password= new_password\n new_password ||= SecureRandom::hex(8)\n @password = Password.create new_password\n self.password_digest = @password.to_s\n self.save\n end", "def crypt_password\n write_attribute \"password\", self.class.sha1(self.class.generate_salt, password)\n @password = nil\n end", "def password=(new_pw)\n @password = Password.create(new_pw)\n self.password_hash = @password\n end", "def cryptpass\n !self.password.nil? && self.password = self.password.crypt((rand*100).to_s)\n self.active = true\n end", "def old_password\n @old_password\n end", "def password=(val)\n return if val.blank?\n attribute_set(:salt, Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{name}--\")) if new?\n attribute_set(:crypted_password, val.encrypt(self.salt))\n end", "def reset_password(plain)\n self.password = hash_crypt(plain)\n end", "def crypt_password\n\t\twrite_attribute \"password\", self.class.sha1(password)\n\tend", "def pass\n @pass ||= Password.new(self.password)\n end", "def encrypt_password(password)\n self.class.secure_digest([password, password_salt])\n end", "def password; end", "def password; end", "def password; end", "def password; end", "def password; end", "def password; end", "def generate_password\n self.password = random_string(32)\n self.e_password = Digest::SHA256.hexdigest(self.password)\n end", "def password\n [@password, @security_token].join('')\n end", "def passwd\r\n @password = \"12345\"\r\n end", "def _my_mkpass()\n mymkpass = ''\n 9.to_i.times{ mymkpass << (65 + rand(25)).chr }\n return mymkpass\nend", "def encrypt_password\n self.password = Digest::MD5.hexdigest(self.password).encode('UTF-8')\n end", "def encrypt_password\n if self.id.nil? || self.password_changed?\n self.password = BCrypt::Password.create(self.password)\n end\n end", "def password=(new_pass)\n validate_password new_pass\n self.password_salt = User.random_string\n self.password_hash = digest(new_pass)\n end", "def encrypt_password\n return if password.blank?\n self.salt = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{login}--\") if new_record?\n self.crypted_password = User.encrypt(password,self.salt)\n end", "def change_password(new_pass)\n self.salt = User.gen_salt\n salted_pass = User.salt_password(new_pass, self.salt)\n self.password = salted_pass\n end", "def password=(new_password)\n @password = Password.create(new_password)\n self.encrypted_password = @password\n end", "def encrypted\n \tself.encrypted_password = BCrypt::Password.create(self.password)\n end", "def scramble_password\n if self.password_changed?\n self.password = Digest::MD5.hexdigest(self.password)\n end\n end", "def encrypt_password\n\t\t\tif new_record?\n\t\t\t\tself.salt = make_salt\n\t\t\tend\n\t\t\tself.encrypted_password = encrypt(password)\n\t\tend", "def random_password\r\n chars = (\"a\"..\"z\").to_a + (\"1\"..\"9\").to_a \r\n newpass = Array.new(8, '').collect{chars[rand(chars.size)]}.join\r\n end", "def encrypt_password\n return if self.password.blank?\n \n self.salt = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{self.username}--\") if self.new_record?\n self.crypted_password = self.encrypt(self.password)\n end", "def make_salt\n secure_hash(\"#Time.now.utc}--#{password}\")\n end", "def password=(new_password)\n @password = new_password\n self.encrypted_password = encrypt(@password) if @password.present?\n end", "def crypt_password\n self.crypted_pass = BCrypt::Password.create(password) if password\n end", "def crypt_password\n \t\twrite_attribute \"password\", self.class.sha1(password) unless self.password.empty?\n end", "def generate_password!(model:, **)\n model.password = SecureRandom.urlsafe_base64(8)\n end", "def set_temp_password\n self.password = SecureRandom.urlsafe_base64(6)\n end", "def encrypt_password\n \tself.password = Digest::MD5.hexdigest(self.password)\n end", "def hash_new_password\n self.password = BCrypt::Password.create(@new_password)\n end", "def old_password\n nil\n end", "def make_salt\n secure_hash(\"#{Time.now.utc}--#{password}\")\n end", "def make_salt\n secure_hash(\"#{Time.now.utc}--#{password}\")\n end", "def encrypt(password)\n self.class.encrypt(password, Time.now.to_s)\n end", "def password= new_password\n @password = new_password\n end", "def password\n @password ||= Password.new(self.hashed_password)\n end", "def encrypt_password\n # the argument on the right hand side is implicitly self.password\n self.encrypted_password = encrypt( password )\n end", "def set_password(v)\n @password = v\n # returns v\n end", "def reset_password\n o = [('a'..'z'),('A'..'Z'),('0'..'9')].map{|i| i.to_a}.flatten\n new_password = (0..6).map{ o[rand(o.length)] }.join\n self.password = new_password\n if self.save\n return new_password\n else\n return nil\n end\n end", "def postgres_password(new_resource)\n new_resource.password == 'generate' ? secure_random : new_resource.password\n end", "def make_salt\n\t secure_hash(\"#{Time.now.utc}--#{password}\")\n\tend", "def postgres_password(new_resource)\n new_resource.password == 'generate' ? secure_random : new_resource.password\n end" ]
[ "0.77092576", "0.76308435", "0.7462875", "0.7455222", "0.7408781", "0.7340565", "0.7338143", "0.733769", "0.7334692", "0.7314898", "0.72965056", "0.727997", "0.72690785", "0.7247565", "0.7245508", "0.7221308", "0.72191834", "0.7215993", "0.72065794", "0.71724206", "0.71665186", "0.71595734", "0.71577615", "0.7143447", "0.714248", "0.7127873", "0.7105262", "0.70964557", "0.7083788", "0.7073764", "0.7072782", "0.7063773", "0.7062929", "0.7062929", "0.7061012", "0.7046339", "0.7045356", "0.70445055", "0.7037217", "0.70179665", "0.7009588", "0.7005588", "0.70035195", "0.7002261", "0.70021504", "0.70017296", "0.6995239", "0.69923586", "0.6983175", "0.6978722", "0.6973896", "0.6964525", "0.6964335", "0.69560003", "0.6948143", "0.6947775", "0.69472826", "0.69445086", "0.6939628", "0.69353825", "0.69353825", "0.69353825", "0.69353825", "0.69353825", "0.69353825", "0.6934601", "0.6928329", "0.691314", "0.6910349", "0.6905446", "0.68967146", "0.6894461", "0.68918175", "0.68873775", "0.68869233", "0.68798155", "0.68797183", "0.687835", "0.6872618", "0.6871762", "0.6867021", "0.6865942", "0.68636537", "0.6862201", "0.6858609", "0.6852652", "0.68501437", "0.68491524", "0.68472064", "0.6845455", "0.6845455", "0.68352383", "0.68272084", "0.6826299", "0.6823682", "0.68224734", "0.6812155", "0.68090963", "0.6808341", "0.67998636" ]
0.7602719
2
Create a new password for this user, and send notification to the user
def send_new_password(template) pass = create_new_password set_password(pass) save mailer = Mailer.new user_name = @data_object.user_acc_name if user_name.nil? || user_name.empty? user_name = contact.con_email end values = { "user_name" => user_name, "password" => pass } mailer.send_from_template(contact.con_email, "Your DION Registration Information", values, template) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n if user\n user.regenerate_verification_token\n MinimalistAuthenticationMailer.update_password(user).deliver_now\n end\n # always display notice even if the user was not found to prevent leaking user emails\n redirect_to new_session_path, notice: \"Password reset instructions were mailed to #{email}\"\n end", "def user_new_password(user_id, password)\n @company = Company.first\n\n @user = User.find(user_id)\n @password = password\n\n mail(to: @user.email, subject: \"Get a grip studios new password\")\n end", "def create\n @user = User.new(user_params)\n \n # generate pw\n pw = random_pw\n @user.password = pw\n @user.password_confirmation = pw\n \n respond_to do |format|\n if @user.save\n \n if @user.admin?\n # Send mail that contains password\n UserMailer.notify_new_admin(@user, pw).deliver\n # Notify owner about new admin\n DebugMailer.send_email(@user.inspect, t('notification.new_admin_created')).deliver\n end\n \n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render action: 'show', 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\r\n flash[:al] =\"\"\r\n respond_to do |format|\r\n\r\n if user = User.find_by_email_and_login(params[:password][:email], params[:password][:email])\r\n @new_password = create_code\r\n user.password = user.password_confirmation = @new_password\r\n user.save_without_validation\r\n Notifier.deliver_new_password(user, @new_password)\r\n\r\n \r\n flash[:al] = \"We sent a new password to #{params[:password][:email]}\"\r\n format.html { render :action => \"new\",:controller=>\"passwords\" }\r\n \r\n else\r\n flash[:al] = \"We can't find that account. Try again.\"\r\n format.html { render :action => \"new\" }\r\n end\r\n end\r\n end", "def send_password_change_notification; end", "def create\n\t\t@user = User.new(params[:user])\n\t\tnew_pass = generate_password()\n\t\t@user.password = new_pass\n\t\t@user.password_confirmation = new_pass\n\n\t\tif @user.save\n\t\t\tflash[:notice] = 'User was successfully created.'\n\t\t\tUserMailer.signup_notification(@user, new_pass).deliver\n\t\t\t\tredirect_to '/added_user_confirmation'\n\t\telse\n\t\t\trender :action => \"new\"\n\t\tend\n\tend", "def create_reset_password\n @reset_password = true\n self.generate_password(true)\n AdminUserMailer.deliver_reset_password(self)\n end", "def new_password(user, new_password)\n setup_email(user)\n @subject += 'This is your new password'\n @body[:url] = \"http://#{get_domain_name}/login\" \n @body[:new_password] = new_password\n end", "def create \n user = User.find_by(email: params[:email])\n if user\n if user.update(password_reset_token: unique_token, passwoord_reset_set_at: Time.zone.now)\n UserMailer.with(user: user).forgot_password_email.deliver_later \n end\n end\n redirect_to login_path, notice: \"If you have an account, you will get an email with instructions on how to reset your password.\"\n end", "def create\n \t@user = User.create user_params\n\n \tif @user\n @user.code = SecureRandom.urlsafe_base64\n @user.expires_at = Time.now + 4.hours\n @user.save\n\n PasswordMailer.new_user_email(@user).deliver\n redirect_to root_url, notice: \"An email has been sent to you to complete registration.\"\n \telse\n \t\trender :new\n \tend\n end", "def create\r\n respond_to do |format|\r\n \r\n if user = User.find_by_email(params[:email])\r\n @new_password = random_password\r\n user.password = user.password_confirmation = @new_password\r\n user.save_without_validation\r\n Notifier.deliver_new_password(user, @new_password)\r\n \r\n format.html {\r\n flash[:notice] = \"We sent a new password to #{params[:email]}. Please check your email to login.\"\r\n redirect_to '/login'\r\n }\r\n else\r\n flash[:notice] = \"Sorry we can't find the account corresponding to that email address.\"\r\n format.html { render :action => \"new\" }\r\n end\r\n end\r\n end", "def create\n @user=User.new(params[:user])\n if !@user.nil?\n pw_hash = Digest::MD5.hexdigest(@user.password)\n #if validation was ok we can update the user\n if @user.save\n #update pw with hash\n @new_user = User.find(@user.id)\n @new_user.password = pw_hash\n #set user status to inactive\n @new_user.status = false;\n #generate random token for confirmation mail\n uuid = UUID.new\n @new_user.registration_token = uuid.generate\n @new_user.save\n #send the mail\n Notifier.send_registration_confirmation(@new_user).deliver\n flash[:notice] = \"User was successfully created\"\n redirect_to :root\n else\n render :action => \"/new\"\n end\n\n else\n render :action => \"/new\"\n end\n\n end", "def create\n @user = User.find_by_email(params[:password][:email])\n\n if @user\n @user.deliver_reset_password_instructions!\n send_recovery_email\n redirect_to(sign_in_path,\n notice: I18n.t(\"messages.password.create.success\"))\n else\n flash.now[:error] = I18n.t(\"errors.password.invalid\")\n render(:new)\n end\n end", "def create\n @user = User.new(user_params)\n @user.password = Devise.friendly_token.first(8)\n @password = @user.password\n respond_to do |format|\n if @user.save\n\n if current_user.is_broker?\n current_user.clients << Client.create(:user_id => current_user.id, :client_id => @user.id )\n \n # send password to user \n ApplicationCaseMailer.new_user_and_password_notification(@user, current_user, @password).deliver\n else \n\n ApplicationCaseMailer.new_user_and_password_notification(@user, current_user, @password).deliver\n end \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_new_password\n pass = generate_password\n set_password(pass)\n pass\n end", "def password_change(user, _opts = {})\n set_template(:change_password)\n\n set_personalisation(\n drafts_url: users_drafts_url,\n )\n\n mail(to: user.email)\n end", "def pass_recovery\n @user = TempUser.find_by(username: params[:username])\n @user = User.find_by(username: params[:username]) if !@user\n if @user.present?\n @new_password = SecureRandom.hex(5)\n @user.update(username: params[:username], password: @new_password, password_confirmation: @new_password)\n EmailNotification.send_recovery_email(@user,@new_password)\n render json: { status: 'New password has been sent to your email' }, status: :ok\n else\n render json: { status: 'Invalid username' }, status: :not_found\n end\n end", "def user_updated_password user\n data = {\n category: 'Users',\n action: 'Updated Password',\n label: user.email,\n value: nil,\n bounce: true,\n }\n\n create_event data\n end", "def create\n\t user = User.find_by_email(params[:email])\n\t user.send_password_reset if user\n\t flash[:success] = \"Email sent with password reset instructions.\"\n\t redirect_to '/login'\n\tend", "def send_password_change_notification\n # do not notify the admins for now\n end", "def send_expert_password(user)\n @expert = user\n mail(to: @expert.email, subject: 'New Password')\n end", "def password_changed(user)\n mail_to user, password_changed_subject\n end", "def new_email(user)\n @user = user\n \n mail to: @user.email, subject: \"Create your ParDIY credentials\"\n end", "def create_password_reset\n @user = User.where(email: user_params_for_password_reset[:email]).first\n password_reset_token = User.generate_token\n if(@user and @user.update(password_reset_token: password_reset_token))\n UserMailer.password_reset(@user).deliver_later\n end\n end", "def send_password\n UserMailer.welcome(self).deliver\n end", "def set_new_password \n new_passwd = generate_password()\n self.password = self.password_confirmation = new_passwd\n self.save!\n return new_passwd\n end", "def set_temp_password() \n\t\t#Generate new password\n\t\tpassword = User.generate_password()\n\t\t\n\t\tsalt = self.salt\n\t\tenc_password = Digest::SHA1.hexdigest(salt+password)\n\t\t\n\t\tself.temp_password = enc_password\n\t\tself.save\n\t\t\n\t\t#Ignore temp password if user is already logged in\n\t\tself.temp_password = nil\n\t\t\n\t\t#Notify user\n\t\tAppMailer.temporary_password_created(self, password).deliver\n\tend", "def reset_password!\n password = PasswordGenerator.random_pronouncable_password(3)\n self.password = password\n self.password_confirmation = password\n save\n UserMailer.deliver_reset_password(self)\n end", "def user_created_mail(user, password)\n @email = user.email\n @password = password\n mail to: @email\n end", "def set_password=(new_password)\n self.password = Password.create(new_password)\n self.save\n end", "def forgot_password_create\n user = User.first(:email => params[:email])\n if user.nil?\n flash[:notice] = \"Your account could not be found, please check your email and try again.\"\n render \"login/forgot_password\"\n else\n Notifier.send_forgot_password_notification(user.email, user.set_password_reset_token)\n # Redirect to try to avoid repost issues\n session[:fp_email] = user.email\n redirect_to '/forgot_password_confirm'\n end\n end", "def forgot_password\n if request.post?\n # Try to generate and mail a new password\n result = User.generate_and_mail_new_password(params[:user][:name], params[:user][:email])\n\n # Act according to the result\n if result['flash'] == 'forgotten_notice'\n flash.now[:forgotten_notice] = result['message']\n else\n flash[:login_confirmation] = result['message']\n redirect_to(:action => :login)\n end\n end\n end", "def generate_password\n self.password = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{self.email}--#{self.id}\")\n end", "def create\n @user = @current_tenant.users.find_by_email(params[:email])\n new_password = rand(10000000000000).floor.to_s(36)\n @user.password = new_password\n if @user.save\n UserMailer.forget_password(@user).deliver\n else\n @response[:success] = false\n @status = :unprocessable_entity\n end\n\n render json: @response, status: @status\n end", "def password_send (user)\n @user = user\n\n mail to: @user.email, subject: 'Sua senha de acesso =D'\n end", "def create\n\t\tif current_user\n\t\t\tredirect_to action: :execute\n\t\tend\n\t\tuser = User.find_by( email: params[:email] )\n\t\tif user\n\t\t\tuser.send_password_reset\n\t\t\tredirect_to login_url, :notice => \"Email sent with password reset instructions.\"\n\t\telse\n\t\t\tredirect_to login_url, :notice => \"The email you entered was not the one you signed up with please try again\"\n\t\tend\n\tend", "def reset_password\n\n @user.send_reset_password_instructions\n\n system_user = User.where(first_name: 'system', last_name: 'user').first\n message_template = MessageTemplate.find_by(name: 'User2')\n message_body = MessageTemplateMessageGenerator.new.generate(message_template,[@user.name, \"<a href='#'>Change my password</a>\"]).html_safe\n\n msg = Message.new\n msg.user = system_user\n msg.organization = system_user.organization\n msg.to_user = @user\n msg.subject = message_template.subject\n msg.body = message_body\n msg.priority_type = message_template.priority_type\n msg.message_template = message_template\n msg.active = message_template.active\n msg.save\n\n notify_user(:notice, \"Instructions for resetting their password was sent to #{@user} at #{@user.email}\")\n\n redirect_to user_path(@user)\n\n end", "def forgot_password\n if request.post?\n @user=User.find(:first, :conditions => [\"email=? AND system_role=?\", params[:user][:email], User::SYSTEM_ROLE_USER])\n if @user.present?\n o = [('a'..'z'),('A'..'Z'),(0..9)].map{|i| i.to_a}.flatten;\n newpass = (0..6).map{ o[rand(o.length)] }.join;\n #newpass = (1..7).map{ (0..?z).map(&:chr).grep(/[a-z\\d]/i)[rand(62)]}.join\n @user.encrypted_password = newpass\n \n Notifier.delay.send_password(@user, newpass) if @user.save\n flash[:notice] = \"New password is sent to your email id.\"\n else\n flash[:forget_pw__error] = \"Error\"\n flash[:notice] = \"Email is not registered.\"\n end\n redirect_to :action => \"home\"\n end\n end", "def crypt_password\n # EmailNotify.send_user_create_notification self\n self[:password] =\n password_hash(password(true))\n @password = nil\n end", "def update_password\n @user = User.find_by_uuid(params[:id])\n if @user.update(user_params_with_password)\n if @user.send_password.present? && @user.send_password.to_i == 1\n @user.send_welcome_email\n end\n flash[:success] = t('messages.default_success')\n redirect_to users_path\n else\n flash[:error] = t('messages.default_error')\n render :edit_password\n end\n end", "def create\n user = User.find(params[:id])\n\n if user.activate!(params[:activation_code],params[:password], params[:password_confirmation])\n flash[:notice] = \"Password successfully updated.\"\n #log_action(\"Security\", \"User (#{current_user.login}) has reset password for (#{@user.login})\")\n # make sure user is logged in\n self.current_user = user\n new_cookie_flag = (params[:remember_me] == \"1\")\n handle_remember_cookie! new_cookie_flag\n redirect_back_or_default('/')\n\n #redirect_to users_path\n else\n #@old_password = nil\n flash.now[:error] = user.errors.on_base || \"There was a problem updating your password.\"\n #log_action(\"Security\", \"Admin (#{current_user.login}) has FAILED to reset password for (#{@user.login})\")\n if user and user.activation_code == params[:activation_code]\n render :action => :new\n else\n render :action => 'send_activation_code'\n end\n end\n end", "def create(password)\n Statements::CreateUser.new(context: self).password(password)\n end", "def new\n case request.method\n when :get\n @user = User.new\n render\n return true\n when :post\n @user = User.new(params[:user])\n begin\n User.transaction(@user) do\n @user.new_password = true\n @user.verified = 1 # skip verification, because we are ADMIN!\n if @user.save\n flash[:notice] = 'User creation successful.'\n redirect_to :action => 'list'\n end\n end\n rescue Exception => e\n flash.now[:notice] = nil\n flash.now[:warning] = 'Error creating account: confirmation email not sent'\n logger.error e\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n @user.verified = false\n\n password = give_me_pengin_password\n @user.password = password\n @user.password_confirmation = password\n\n respond_to do |format|\n if @user.save\n\n #send sms with our own password\n send_message(\"Greetings from PengIn! Your password is \" + password, @user)\n\n format.json { render :json => {:success=>true, :message=>\"User was successfully created.\", :id=>@user.id} }\n # TODO: dupa ce creez userul ar trebui sa il si loghez - sa ii dau un token ca raspuns aici la sign up\n # in the Pengin mobile app, use the id passed in the json response to the sign up to identify which user you are verifying the sms\n else\n format.json { render :json => {:success=>false, :message=>\"Failed to create user.\"} }\n end\n end\n end", "def forgot_password\n if request.post?\n @user=User.find(:first, :conditions => [\"email=? AND system_role=?\", params[:user][:email], User::SYSTEM_ROLE_USER])\n if @user.present?\n o = [('a'..'z'),('A'..'Z'),(0..9)].map{|i| i.to_a}.flatten;\n newpass = (0..6).map{ o[rand(o.length)] }.join;\n #newpass = (1..7).map{ (0..?z).map(&:chr).grep(/[a-z\\d]/i)[rand(62)]}.join\n @user.encrypted_password = newpass\n \n Notifier.send_password(@user, newpass).deliver if @user.save\n flash[:notice] = \"New password is sent to your email id.\"\n else\n flash[:forget_pw__error] = \"Error\"\n flash[:notice] = \"Email is not registered.\"\n end\n redirect_to :action => \"home\"\n end\n end", "def create\n # Apply the params received\n @user = User.new(user_params)\n\n # Generate an user password.\n @user.password = User.generate_random_password\n\n respond_to do|format|\n format.html{\n # Can be saved?\n if (@user.save)\n flash[:notice] = t(\"users.notice.created\", :email => @user.email)\n redirect_to user_path(@user)\n else\n # If an error raises, show the form again.\n render :action => :new\n end\n return\n }\n end\n end", "def forgot_password\n\t\t@user = User.find_by_email(params[:email])\n\n\t\tif @user\n\t\t\trandom_password = Array.new(10).map { (65 + rand(58)).chr }.join\n\t\t\t@user.password = random_password\n\t\t\t@user.save!\n\n\t\t\trespond_to do |format|\n\t\t\t\tformat.js { @alert = \"Recover password email sent!\" }\n\t\t\tend\n\n\t\t\t#Send user forgot password email\n\t\t\tUserNotification.forgot_password(@user).deliver\n\t\telse\n\t\t\trespond_to do |format|\n\t\t\t\tformat.js { @alert = \"No account with #{params[:email]} was found!\" }\n\t\t\tend\n\t\tend\n\tend", "def send_password_update_email(user)\n @user = user\n\n mail(to: @user.email,\n subject: \"#{@user.email} password update notification!\")\n end", "def user_new(user)\n @user = user\n\n mail to: \"nandisuper2@gmail.com\" ,\n subject: \"New User Created!!\"\n end", "def create\n if user_params[:password_confirmation]\n user = User.create!(user_params)\n\n session[:user_id] = user.id\n session[:expiration_time] = Time.now + 6*60*60 # 6 hours until expiration\n \n response = { message: Message.account_created }\n json_response(response, :created)\n else\n response = { message: Message.password_confirmation_missing}\n json_response(response, :not_acceptable)\n end\n end", "def create\n @user = User.new(params[:user])\n @user.set_the_password = true\n #@update_pass = 0\n if @user.save\n sign_in @user\n flash[:success] = \"Bienvenido al gestor de usuarios\"\n redirect_to @user\n else\n @title = \"Sign up\"\n render 'new'\n end\n end", "def create\n @password = Password.new(password_params)\n @password.user_id=current_user.id\n\n respond_to do |format|\n if @password.save\n format.html { redirect_to @password, notice: 'Password was successfully created.' }\n format.json { render :show, status: :created, location: @password }\n else\n format.html { render :new }\n format.json { render json: @password.errors, status: :unprocessable_entity }\n end\n end\n end", "def generate_and_send_password\n self.reload\n update_attribute :password, ('a'..'z').to_a[rand(26)].to_s + (0...5).map{ [rand(10)] }.join\n post_data = Net::HTTP.post_form URI.parse('http://3001300.ru/create_client_from_bonus.php'),\n { \n 'email' => self.email,\n 'password' => self.password\n }\n mail = InformMail.create! client: self, body: \"#{MessageText.welcome.sms.encode} #{self.password}\".encode(\"cp1251\")\n end", "def create\n @user = User.find_by_email(params[:email])\n #sends an email to the user with password reset instructions (a url with random token)\n @user.deliver_reset_password_instructions! if @user\n flash[:success] = \"Instructions have been sent to your email!\"\n redirect_to root_path\n\n end", "def password\n \n if request.post?\n begin\n @user = User.find(User.current_user.id)\n @user.password = params[:user][:password]\n @user.password_confirmation = params[:user][:password_confirmation]\n if @user.save\n # Send confirmation email here\n update_session\n flash[:notice], flash[:class] = \"Password changed successfully\", \"good\"\n redirect_to :controller => \"account\", :action => \"index\" and return\n else\n raise \"Sorry, your password couldn't be changed.\"\n end\n rescue Exception => e\n flash.now[:notice], flash.now[:class] = \"#{e}<br /><small>#{@user.errors.full_messages.join(\"<br />\")}</small>\", \"bad\"\n #redirect_to :controller => \"account\", :action => \"password\" and return\n end\n end\n\n end", "def newPassword(newPass)\n\t\tDATABASE.edit(\"users\", \"password\", newPass, \"username\", @username)\n\tend", "def create \n logger.info \"Loading PasswordReset create action\"\n @user = User.find_by_email(params[:email])\n logger.debug \"User attributes hash: #{@user.attributes.inspect}\"\n \n # This line sends an email to the user with instructions on how to reset their password (a url with a random token)\n @user.deliver_reset_password_instructions! if @user\n logger.debug \"Reset email sent to user with instructions\"\n \n # Tell the user instructions have been sent whether or not email was found.\n # This is to not leak information to attackers about which emails exist in the system.\n flash[:success] = t(:email_sent, :scope => [:business_validations, :password_reset])\n redirect_to root_path\n end", "def send_password(clear_password) \n self.password = Digest::SHA1.hexdigest(self.password_salt.to_s + clear_password)\n self.save\n \n Mailer.deliver_message(\n {:recipients => self.email,\n :subject => \"Your Expertiza password has been reset\",\n :body => {\n :user => self,\n :password => clear_password,\n :first_name => ApplicationHelper::get_user_first_name(self),\n :partial_name => \"send_password\" \n }\n }\n )\n \n end", "def password_change_new\n\n end", "def password_updated(user)\n @user = user\n @subject = \"[#{SITE_NAME}] Your password has been changed\"\n mail(bcc: @user.email, subject: @subject)\n end", "def generate_and_send_new_password\n new_password = \"\"\n chars = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!#,.;:?%&\".split(//)\n (0..8).each do |i|\n new_password += chars.at(rand(chars.length))\n end\n self.update_attributes(:password => new_password)\n save!\n AdminMailer.password_reset(self, new_password).deliver\n new_password\n end", "def send_email_password_changed\n Resque.enqueue(PasswordNotification,self)\n end", "def forgot_password(user)\n @user = user\n mail(to: @user.email, subject: 'New Password')\n end", "def create \n \n @user = User.find_by_email(params[:email].gsub(/\\s+/, \"\").downcase)\n\n # This line sends an email to the user with instructions on how to reset their password (a url with a random token)\n if @user \n # @user.deliver_reset_password_instructions!\n t = Time.now + 1.day\n @user.update_columns(reset_password_token_expires_at: t, reset_password_email_sent_at: Time.now, set_password_token: SecureRandom.hex(10))\n\n # First we should note the date that this request was made then we will add to the date by one day and save that.\n # We then need to check that the time between the reset password and the expiry date are still valid if they are then we let them stay in the change password form page if not then we need to redirect\n # to the home page where they can try again. We also need to check to make sure that they didnt already change the password. If they did then we need to make sure that we redirect them\n\n ResetPasswordEmailWorker.perform_async(@user.id)\n \n\n # Tell the user instructions have been sent whether or not email was found.\n # This is to not leak information to attackers about which emails exist in the system.\n flash[:success] = 'Instructions have been sent to your email.'\n redirect_to root_path\n\n else\n flash[:danger] = 'Please make sure you have correctly typed in the email.'\n render :new\n\n end\n end", "def password_change\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def create\n p = user_params\n p[:password] = SecureRandom.base64(8)\n\n @user = User.new(p)\n\n respond_to do |format|\n if @user.save\n if p[:is_admin]\n @user.user_roles.create(role: UserRole.roles[:stakeholder_admin])\n end\n\n @user.send_reset_password_instructions\n format.html { redirect_to [@stakeholder, @user], notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: [@stakeholder, @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 generate_password\n self.password = SecureRandom.urlsafe_base64(10)\n self.password_confirmation = self.password\n end", "def send_login_password(user, passwd)\n\t\t@user = user\n\t\t@user.password = passwd #SecureRandom.hex(10)\n\t\t@user.save!\n\t\tmail( :to => @user.email, subject: \"Welcome to CSE TA Assignment System! Your initial password!\")\n\tend", "def create(user)\n @user = User.new(user)\n # Encrypt password and immediately delete the cleartext version\n @user.encrypt_password\n @user.password = nil\n if @user.save\n redirect \"/\",\n :message => {:notice => \"Account created\"}\n else\n message[:error] = \"Registration failed\"\n render :new\n end\n end", "def set_password(new_password)\n UserPassword.new(:id => id, :new_password => new_password).post\n end", "def send_recover_password\n self.generate_password_recover\n UserMailer.recover_password(self.id).deliver_now\n end", "def create\n @admin_user = Admin::User.new(admin_user_params)\n \n if @admin_user.password.blank?\n secure_password = @admin_user.generate_password \n @admin_user.password = secure_password\n @admin_user.password_confirmation = secure_password\n end\n\n respond_to do |format|\n if @admin_user.save\n format.html { redirect_to admin_users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @admin_user }\n else\n format.html { render :new }\n format.json { render @admin_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n @user.roles = [params[:role]]\n password_temp = password = Devise.friendly_token.first(8)\n p password\n\n @user.password = password_temp\n @user.password_confirmation = password_temp\n\n enc = Devise.token_generator.generate(User, :reset_password_token)\n @user.reset_password_token = enc\n @user.reset_password_sent_at = Time.now\n\n respond_to do |format|\n if @user.save\n User.user_organizations_associations(@user, params)\n # @user.send_reset_password_instructions\n UserMailer.welcome_email(@user).deliver\n format.html { redirect_to privileges_path, 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 @momentum_cms_user = MomentumCms::User.where(email: params[:momentum_cms_user][:email]).first\n\n # This line sends an email to the user with instructions on how to reset their password (a url with a random token)\n @momentum_cms_user.deliver_reset_password_instructions! if @momentum_cms_user\n\n # Tell the user instructions have been sent whether or not email was found.\n # This is to not leak information to attackers about which emails exist in the system.\n flash[:success] = 'Instructions have been sent to your email.'\n redirect_to cms_admin_root_path\n end", "def create_user\n if current_user.manager? || current_user.admin?\n @user = User.new(user_params)\n @user.password = 'test@123'\n @user.password_confirmation = 'test@123'\n redirect_to @user if @user.save\n else\n flash[:notice] = NOT_AUTHORIZED\n redirect_to home_index_path\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n auto_login(@user)\n format.html { redirect_to notify_path, notice: \"Your account has been created. However, you must verify your account with an administrator to complete activation. You may do so by connecting to <span class='highlight'>petyard.net</span> in Minecraft.<br /><br /><a href='#{user_path(@user)}'>Continue to your profile</a>\" }\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 pass=(new_password)\n self.password = Password.create(new_password)\n end", "def update_password(new_password)\n super(new_password).tap do |status|\n UserMailer.password_changed(self).deliver_later if status\n end\n end", "def create\n @user = User.find_by_email(params[:email])\n\n #Send an email to the user with reset instructions\n @user.deliver_reset_password_instructions! if @user\n\n # Tell the user instructions have been sent. Does not specify if email exists in DB, so we don't leak info to hackers\n redirect_to(root_path, :notice => 'Password reset instructions have been emailed to you.')\n end", "def generate_new_password\n chars = 'abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'\n password = ''\n 10.times { password << chars[rand(chars.size)] }\n self.update_attributes(:encrypted_password => User.encrypt(password, self.salt))\n UserMailer.deliver_forgot_password_mail(self, password)\n password\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n UserMailer.welcome_email(@user, @password).deliver_later\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 new_user(user, password)\n @user = user\n @password = password\n\n mail to: user.email, subject: \"[IMD- UFRN] Nova Conta no Gerenciador de Espaço Físico\"\n end", "def reset_user_password\n temp_password = generate_password(20)\n User.update_all(\"activation_code = '#{temp_password}', recently_reset = 1, updated_at = '#{Time.now}'\", \"id = #{self.id}\")\n UserMailer.reset_password(self.id, temp_password).deliver\n end", "def generate_password\n if new_record?\n self.password = self.password_confirmation = /\\w{0,10}/.gen unless password\n end\n end", "def save\n return false unless valid?\n\n call_ok?(:maintain_user, forgot_password_request)\n end", "def password\n UserMailer.password\n end", "def send_password\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def add_user_password(username, password, options = {})\n raise ArgumentError, \"The new password cannot be nil\" unless password\n raise ArgumentError, \"The new username cannot be nil\" unless username\n raise ArgumentError, \"The new password cannot be empty\" if password.empty?\n raise ArgumentError, \"The new username cannot be empty\" if username.empty?\n\n raise Exception, \"Cannot add username password, a Software Password already exists for the provided username\" if self.has_user_password?(username.to_s)\n\n add_user_pw_template = {\n 'softwareId' => self['id'].to_i,\n 'password' => password.to_s,\n 'username' => username.to_s\n }\n\n add_user_pw_template['notes'] = options['notes'].to_s if options.has_key?('notes')\n add_user_pw_template['port'] = options['port'].to_i if options.has_key?('port')\n\n softlayer_client[:Software_Component_Password].createObject(add_user_pw_template)\n\n @passwords = nil\n end", "def reset_password\n user = User.first\n ticket = user.tickets.create(\n name: 'Réinitialiser le mot de passe',\n action: '/password_resets/%{token}/edit',\n duree: 2.days\n )\n UserMailer.reset_password(user, ticket)\n end", "def create\n if @user = User.find_by(email: password_params[:email])\n if @user.provider != 'email'\n @user.errors.add(:provider, \"is #{@user.provider}. Did not authenticate with email/password.\")\n render json: format_errors(@user.errors), status: :forbidden\n return\n end\n\n @user = User.send_reset_password_instructions(password_params)\n\n if successfully_sent?(@user)\n render json: '', status: :no_content\n else\n render json: format_errors(@user.errors), status: :unprocessable_entity\n end\n else\n render json: format_errors({ email: ['is invalid'] }),\n status: :unprocessable_entity\n end\n end", "def send_account_created_instructions\n token = set_reset_password_token\n send_account_created_instructions_notification(token)\n\n token\n end", "def send_account_created_instructions\n token = set_reset_password_token\n send_account_created_instructions_notification(token)\n\n token\n end", "def change_password(user, password, header)\n url=nil\n setup_email(user)\n\n # Email header info\n @subject += \"Changed password notification\"\n\n # Email body substitutions\n @body[\"name\"] = \"#{user.full_name}\"\n @body[\"login\"] = user.login\n @body[\"password\"] = password\n @body[\"url\"] = url || DEFAULT_URL\n @body[\"app_name\"] = APP_NAME\n @headers[\"X-SMTPAPI\"] = header\n end", "def create\n @user = User.find_by_email(params[:reset_email])\n\n if @user\n # This just sets the appropriate fields. I send the email by myself so I can put it in\n # background queue and only pass the user id, not the whole User object.\n @user.deliver_reset_password_instructions!\n SorceryMailer.enqueue.reset_password_email(@user.id)\n end\n\n # Tell the user instructions have been sent whether or not email was found.\n # This is to not leak information to attackers about which emails exist in the system.\n redirect_to(root_path, notice: 'Instructions have been sent to your email.')\n end", "def create\n # Find user by e-mail in DB\n \tuser = User.find_by_email(params[:password_reset][:email])\n # Send password reset instructions to user's e-mail if user exists\n \tuser.send_password_reset if user\n # Redirect the user to the home page\n # Display a message informing the user that password reset instructions have been sent to their e-mail\n \tredirect_to root_url, :notice => \"Email sent with password reset instructions.\"\n end", "def send_password_reset\n create_password_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver\n end", "def new_password\n if token = LoginToken.find_by_token(params[:token])\n @user = token.user\n if request.post?\n @tmp_user = User.new(params[:user])\n @tmp_user.validate_attributes(:only => [:password, :password_confirmation])\n if @tmp_user.errors.empty?\n User.transaction do\n @user.change_password(params[:user][:password])\n token.destroy\n @user.reset_login_attempts\n end \n flash[:notice] = 'Password changed!'\n return redirect_to(account_url(:action => :login))\n end\n end # request.post?\n else\n flash[:notice] = 'Sorry, this password regeneration request is no longer valid. Please create a new request.'\n return redirect_to(account_url(:action => :forgot_password))\n end\n end", "def create\n @mailuser = Mailuser.new(params[:mailuser])\n\t\t@domain = @mailuser.domain\n\t\tallowed_to_edit(@mailuser)\n\t\tif params[:password][:one] != \"\"\n\t\t\tif params[:password][:one] == params[:password][:two]\n\t\t\t\t@mailuser.setpassword(params[:password][:one])\n\t\t\t\tsaved = @mailuser.save\n\t\t\telse\n\t\t\t\tsaved = false\n\t\t\tend\n\t\telse\n\t\t\tsaved = false\n\t\tend\n\t\t\n respond_to do |format|\n if saved\n flash[:notice] = 'Mailusers was successfully created.'\n format.html { redirect_to(@mailuser) }\n format.xml { render :xml => @mailuser, :status => :created, :location => @mailuser }\n else\n flash[:notice] = 'Unable to create user. Passwords were not the same'\n format.html { render :action => \"new\" }\n format.xml { render :xml => @mailuser.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n resource = User.find_for_database_authentication(email: resource_params[:email])\n if resource.nil?\n render(json: { success: false, email: resource_params[:email], errors: { email: [I18n.t('errors.messages.not_found')] } }, status: :unprocessable_entity)\n return\n end\n\n resource.send_reset_password_instructions\n if successfully_sent?(resource)\n render(json: { success: true, email: resource.email }, status: :created)\n else\n render(json: { success: false, email: resource.email }, status: :unprocessable_entity)\n end\n end", "def create_reset_digest\n self.password_reset_token = User.token\n update_attribute(:password_reset_digest, User.digest(password_reset_token))\n update_attribute(:password_reset_sent_at, Time.zone.now)\n\n # Sends password reset email to the user\n UserMailer.password_reset(self).deliver_now\n end" ]
[ "0.7857482", "0.7721347", "0.76196975", "0.73275954", "0.73120856", "0.7282584", "0.72730744", "0.7263136", "0.7245885", "0.7230884", "0.7216805", "0.7216168", "0.719854", "0.71595395", "0.714006", "0.7000592", "0.6999244", "0.6983723", "0.69824904", "0.6931601", "0.6919888", "0.68873", "0.6886522", "0.68776333", "0.68661344", "0.6851062", "0.6850368", "0.6849976", "0.68454397", "0.6844143", "0.6840015", "0.683599", "0.6817051", "0.68100643", "0.68068755", "0.679591", "0.6794246", "0.6774504", "0.67673004", "0.67610675", "0.6751692", "0.67493176", "0.6744999", "0.6739245", "0.67350125", "0.67308515", "0.6724202", "0.67209977", "0.6705737", "0.6692595", "0.66763574", "0.667626", "0.6664004", "0.6662817", "0.66603523", "0.66529596", "0.6651656", "0.6651279", "0.66503525", "0.66471195", "0.6641968", "0.6634826", "0.6631246", "0.6625032", "0.66249055", "0.66221195", "0.6613894", "0.66124356", "0.66104335", "0.66066414", "0.66023445", "0.66019046", "0.65877926", "0.6582024", "0.65781754", "0.65762407", "0.6575613", "0.6574179", "0.65740764", "0.6571866", "0.6569542", "0.65669674", "0.65659785", "0.65582836", "0.6553829", "0.654897", "0.65471774", "0.6539239", "0.6539078", "0.65329623", "0.65268266", "0.65268266", "0.6522608", "0.6513314", "0.65118116", "0.6507968", "0.65063566", "0.65053385", "0.6505235", "0.65031374" ]
0.762455
2
encrypt the given password make it ours
def set_password(pass) self.user_password = User.crypt(pass) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encrypt(password)\n self.class.encrypt(password, Time.now.to_s)\n end", "def encrypt_password(password)\n self.class.secure_digest([password, password_salt])\n end", "def encrypt_password\n self.salt = make_salt if new_record?\n\t self.encrypted_password = encrypt(password)\n end", "def encrypt_password\n self.salt = make_salt unless has_password?(password)\n self.encrypted_password = encrypt(password)\n end", "def encrypt_password\n # the argument on the right hand side is implicitly self.password\n self.encrypted_password = encrypt( password )\n end", "def encrypt_password\n self.salt = make_salt if new_record?\n self.encrypted_password = encrypt(password)\n end", "def encrypt(password)\n self.class.encrypt(password, self.salt)\n end", "def encrypt(password)\n self.class.encrypt(password) #, salt)\n end", "def encrypt_password\n self.salt = make_salt unless has_password?(password)\n self.encrypted_password = encrypt(password)\n end", "def encrypt_password\n self.salt = make_salt if new_record?\n self.encrypted_password = encrypt(password)\n end", "def encrypt(plain_password)\n self.class.encrypt(plain_password)\n end", "def encrypt_password\n\t\t\tself.salt = make_salt if new_record? #new_record? retourne \"true\" si l'objet n'est pas dans la base de données\n\t\t\tself.encrypted_password = encrypt(password)\n\t\tend", "def encrypt(password)\r\n self.class.encrypt(password, salt)\r\n end", "def encrypt(password)\r\n self.class.encrypt(password, salt)\r\n end", "def encrypt(password)\r\n self.class.encrypt(password, salt)\r\n end", "def encrypt(password)\n Digest::SHA1.hexdigest(\"--#{self.salt}--#{password}--\")\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end" ]
[ "0.8263327", "0.8260091", "0.81787765", "0.81547225", "0.81299", "0.8117264", "0.8100615", "0.80571926", "0.80541736", "0.8046734", "0.80061984", "0.8003397", "0.7999736", "0.7999736", "0.7999736", "0.7958334", "0.7956192", "0.79560286", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771", "0.7955771" ]
0.0
-1
put this user's stuff into a hash
def add_to_hash(hash) super contact.add_to_hash(hash) hash['user_over_13'] = @user_over_13 || !@new_user hash['last_logged_in'] = fmt_date_time(@data_object.user_last_logged_in) hash['first_logged_in'] = fmt_date_time(@data_object.user_first_logged_in) # aff_opts = Affiliate.options hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_entourage_user_hashes\n User.find_each do |user|\n email_hashes[hash(user.email)] = user.id\n phone_hashes[hash(user.phone)] = user.id\n end\n end", "def as_hash(add_ins = {})\n hash = {\n :id => self.id,\n :name => self.name,\n :user_id => self.user_id,\n :wrapped_user_id => self.wrapped_user_id,\n }\n hash = hash.merge(add_ins)\n # if a wrapped user, add in user related info\n hash[:user] = wrapped_user.basic_user_info_hash if self.wrapped_user_id\n hash\n end", "def build_user_hash\n user = {id: self.id.to_s,\n first_name: self.first_name,\n last_name: self.last_name,\n email: self.email,\n user_name: self.user_name,\n pin: self.pin,\n created_at: self.created_at\n }\n user[:normal_avatar] = self.avatar.url || \"res://avatardefault\"\n user[:thumb_avatar] = self.avatar.thumb.url || \"res://avatardefault\"\n user[:like_count] = self.likes.count if self.likes\n return user\n end", "def store_user\n data = load_data\n user_details = {\n 'id' => @user.uid.to_s,\n 'username' => @user.username,\n 'password' => @user.password,\n 'playlist' => @user.playlist,\n 'mylist' => @user.mylist\n }\n data << user_details\n write_user(data)\n end", "def user_hash\n @user_hash ||= MultiJson.decode(@access_token.get('https://api.trademe.co.nz/v1/MyTradeMe/Summary.json').body)\n end", "def serializable_hash(*args)\n args[0] = (args[0] || {}).merge(:except => [:password, :twitter_access_token, :twitter_access_secret, :facebook_access_token] )\n user_hash = super\n\n if self.current_trip\n user_hash[:due] = self.current_trip.total_due_to(self)\n user_hash[:owe] = self.current_trip.total_owed_from(self)\n user_hash[:contributed] = self.current_trip.total_contributed_from(self)\n user_hash[:obligated] = self.current_trip.total_obligated_from(self)\n user_hash[:purchases] = self.purchases.where(:trip_id => self.current_trip.id)\n user_hash[:contributions] = self.contributions.includes(:expense).where([\"expenses.trip_id = ?\", self.current_trip.id])\n user_hash[:obligations] = self.obligations.includes(:expense).where([\"expenses.trip_id = ?\", self.current_trip.id])\n\n user_hash[:owe_members] = self.current_trip.members.collect{|x| {:user => x, :amount => self.amount_owed_from(x, self.current_trip)}}.select{|x| !x[:amount].zero?}\n user_hash[:due_members] = self.current_trip.members.collect{|x| {:user => x, :amount => self.amount_due_to(x, self.current_trip)}}.select{|x| !x[:amount].zero?}\n end\n\n user_hash\n end", "def user_data(hsh={})\n @settings[:user_data].merge!(hsh.to_hash) unless hsh.empty?\n @settings[:user_data]\n end", "def assembleUserInfo(u)\n hold = Hash.new\n u = u * 1000\n random = rand(u)\n\n hold = hold.merge({\n \"password\" => \"ssssss\",\n \"password_confirmation\" => \"ssssss\"\n })\n return hold\nend", "def add_user(user)\n user_hash[user.nick]=user unless user_hash.has_key?(user.nick)\n end", "def hash\n [id, alternate_id, type, first_name, surname, date_of_brith, date_of_birth, shipping_address, mailing_address, home_phone, mobile_phone, email_address, mailing_address_active, accounts, classifications, member_photo, gender, receive_email, receive_sms, password].hash\n end", "def add(params_data)\n @user_hash = get_user(params_data[:user_id])\n @user_hash[:user_name] = params_data[:user_name]\n @user_hash[:user_id] = params_data[:user_id]\n @user_hash[:text] = params_data[:text]\n @user_hash[:command] = params_data[:command]\n @user_hash[:team_id] = params_data[:team_id]\n @user_hash[:team_domain] = params_data[:team_domain]\n @user_hash[:channel_id] = params_data[:channel_id]\n @user_hash[:channel_name] = params_data[:channel_name]\n @user_hash[:slack_respurl] = params_data[:response_url]\n save_data(@filetag)\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 auth_hash\n OmniAuth::Utils.deep_merge(super(), {\n 'uid' => @client_id,\n 'user_info' => {\n 'user_hash' => user_data,\n }\n })\n end", "def to_hash\n h = super\n h['uid'] = @uid\n h\n end", "def user_data\n {:username => self.username,\n :pic_url => self.user_pic,\n :profile_url => self.profile_url\n }\n end", "def user_info\n {\n 'nickname' => user_hash['NickName'],\n 'name' => user_hash['NickName']\n }\n end", "def auth_hash\n OmniAuth::Utils.deep_merge(super(), {\n 'uid' => @uid,\n 'user_info' => {\n 'name' => @username\n }\n })\n end", "def user_details\n\t\t@user_data = Hash.new\n\t\t@user_data[\"first_name\"] = @first_name\n\t\t@user_data[\"username\"] = @username\n\t\t@user_data[\"password\"] = @password\n\t\t@user_data[\"balance\"] = @balance\n\tend", "def hash\n [account_id, cms_user_id, company, created_at, dept, email, first_name, group_ids, host_key, id, im_group_ids, jid, job_title, language, last_client_version, last_login_time, last_name, location, personal_meeting_url, phone_country, phone_number, pic_url, pmi, role_name, status, timezone, type, use_pmi, vanity_url, verified].hash\n end", "def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t']\n }\n end", "def hash\n [domain, register_server, transport_protocol, proxy_server, register_server2, transport_protocol2, proxy_server2, register_server3, transport_protocol3, proxy_server3, registration_expire_time, user_name, password, authorization_name, user_email, voice_mail].hash\n end", "def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t'],\n }\n end", "def setup_user_tips_hash\n @user_tips_hash = Hash.new\n if current_user\n @user_tips = Tip.where(\"user_id = ?\", current_user.id)\n @user_tips.each {|t| @user_tips_hash[t.game_id] = t } \n end\n end", "def get_user_hash(args={})\n user = User.where(id:args[:user_id]).first\n image = '/assets/avatar-icon.png'\n score = args[:score]\n if user\n if !user.oath_image.blank?\n image = user.oath_image\n end\n { :id => user.id, :image => image, :score => score, :name => user.name }\n else\n { :id => args[:user_id], :image => image, :score => score, :name => \"DELETED\" }\n end\n end", "def save\n REDIS.set @user.delete(:key), @user.to_json\n @user # NOTE: SET can't fail (http://redis.io/commands/set)\n end", "def user_hash\n @user_hash ||= MultiJson.decode(@access_token.get('/services/api/json/1.2.2/?method=smugmug.auth.checkAccessToken').body)['Auth']['User']\n end", "def get_hash\n\t\treturn { name: self.name, email: self.email }\n\tend", "def store(sender)\n raise ShadowHashError.new(ShadowHashError::UNSUPPORTED_OBJECT_ERR) unless sender.is_a? MacAdmin::User\n @data = @hash.to_s\n end", "def user_data\n {\n id: @user.id,\n email: @user.email,\n user_token_sale_state: @user_token_sale_state,\n bt_name: @user.bt_name.to_s\n }\n end", "def load_user_info\n\t\tif @user_info.has_key?(@@line_array[0].to_i)\n\t\t\t@user_info[@@line_array[0].to_i][@@line_array[1].to_i] = @@line_array[2].to_i\n\t\telse\n\t\t\t@user_info[@@line_array[0].to_i] = {@@line_array[1].to_i => @@line_array[2].to_i}\n\t\tend\n\tend", "def finalize_user\n @user[:handle] = @user[:handle].uniq.join(',')\n end", "def user_to_hash(user)\n { \"id\" => user[\"_id\"].to_s, \"uid\" => user[\"uid\"], \"name\" => user[\"name\"], \"email\" => user[\"email\"] }\nend", "def user_to_hash(user)\n { \"id\" => user[\"_id\"].to_s, \"uid\" => user[\"uid\"], \"name\" => user[\"name\"], \"email\" => user[\"email\"] }\nend", "def new_user\n account_make = self\n # assign storing of information to a variable\n account_store = YAML::Store.new 'users.store'\n # store the object into a file\n account_store.transaction do\n account_store[username.to_s] = account_make\n end\n end", "def userdata\n @userdata ||= Hash.new({})\n end", "def user_data\n {\n user_id: @user.id,\n email: @user.email\n }\n end", "def hash\n [_hash, name, owner].hash\n end", "def initialize(user, name)\n @user = user\n @name = name\n @@all << self\n self.add_to_user_key(user)\n Stash.all_hash_cellar_key[self] = []\n end", "def user_information\n { \"username\": @user.username, \"email\": @user.email, \"id\": @user.id }\n end", "def transform_users\n Hash[@users.map { |name, entry| [name.intern, (yield name, entry)] }]\n end", "def user_info\n {\n 'nickname' => user_hash['Nickname'],\n 'first_name' => user_hash['FirstName'],\n 'last_name' => user_hash['LastName'],\n 'name' => [user_hash['FirstName'], user_hash['LastName']].reject{|n| n.nil? || n.empty?}.join(' '),\n }\n end", "def serialiaze\n Logger.d(\"Serializing the User object\")\n save_to_shared_prefs(@context, self.class, self)\n end", "def user_hash\n response_hash.key?(:user) ? response_hash[:user] : {}\n end", "def set_outgoing_hash\n \n \t\tdata = \tself.class.get_payumoney_key + \"|\" + self.id.to_s + \"|\" + self.amount.to_s + \"|\" + get_product_info + \"|\" + get_first_name + \"|\" + get_email + \"|||||\" + get_udf5 + \"||||||\" + self.class.get_payumoney_salt\n\n \t\tself.outgoing_hash = Digest::SHA512.hexdigest(data)\n \tend", "def store(sender)\n raise ShadowHashError.new(ShadowHashError::UNSUPPORTED_OBJECT_ERR) unless sender.is_a? MacAdmin::User\n @data = { @label => format(@hash) }.to_plist\n sender['ShadowHashData'] = [@data]\n end", "def itemized_stash_data(users)\n user = users.first\n # enable stash for the user?\n end", "def add_user_hash(h, collection)\n if !h[:login] && !h[:studentnumber]\n raise ArgumentError.new(\"New user has neither login nor student number\")\n end\n \n user = nil\n user = User.find_by_login(h[:login]) if h[:login]\n user ||= User.find_by_studentnumber(h[:studentnumber]) if h[:studentnumber]\n\n if user\n # Existing user\n collection << user unless collection.include?(user)\n else\n # New user\n user = User.new\n user.studentnumber = h[:studentnumber]\n user.firstname = h[:firstname]\n user.lastname = h[:lastname]\n user.email = h[:email]\n user.password = h[:password]\n user.login = h[:login]\n \n user.save! # raise an exception if something fails\n \n collection << user\n end\n\n end", "def add nick, email, jid\n\t\t@users.create Hash[\n\t\t\t'nick' => nick,\n\t\t\t'email' => email,\n\t\t\t'jid' => jid,\n\t\t\t'role' => 'user',\n\t\t\t'password' => 'NOTSET']\n\tend", "def new_user_hash\n # source: https://github.com/tapster/omniauth-meetup\n {\n \"provider\"=>\"meetup\",\n \"uid\"=>12345,\n \"info\"=> {\n \"id\"=>12345,\n \"name\"=>\"elvis\",\n \"photo_url\"=>\"http://photos3.meetupstatic.com/photos/member_pic_111.jpeg\"\n },\n \"credentials\"=> {\n \"token\"=>\"abc123...\", # OAuth 2.0 access_token, which you may wish to store\n \"refresh_token\"=>\"bcd234...\", # This token can be used to refresh your access_token later\n \"expires_at\"=>1324720198, # when the access token expires (Meetup tokens expire in 1 hour)\n \"expires\"=>true\n },\n \"extra\"=> {\n \"raw_info\"=> {\n \"lon\"=>-90.027181,\n \"link\"=>\"http://www.meetup.com/members/111\",\n \"lang\"=>\"en_US\",\n \"photo\"=> {\n \"photo_link\"=> \"http://photos3.meetupstatic.com/photos/member_pic_111.jpeg\",\n \"highres_link\"=> \"http://photos1.meetupstatic.com/photos/member_pic_111_hires.jpeg\",\n \"thumb_link\"=> \"http://photos1.meetupstatic.com/photos/member_pic_111_thumb.jpeg\",\n \"photo_id\"=>111\n },\n \"city\"=>\"Memphis\",\n \"state\" => \"TN\",\n \"country\"=>\"us\",\n \"visited\"=>1325001005000,\n \"id\"=>12345,\n \"topics\"=>[],\n \"joined\"=>1147652858000,\n \"name\"=>\"elvis\",\n \"other_services\"=> {\"twitter\"=>{\"identifier\"=>\"@elvis\"}},\n \"lat\"=>35.046677\n }\n }\n }\n end", "def set_user_attributes(user_hash)\n self.name = user_hash[:name]\n self.email = user_hash[:email]\n self.password = user_hash[:password]\n self.password_confirmation = user_hash[:password_confirmation]\n self.admin = false\n self.confirmed = false\n end", "def hash\n [sub, email, error_details, accounts, name, family_name, given_name, created].hash\n end", "def userinfo\n object.fetch(:userinfo) {\n @object[:userinfo] = (format_userinfo(\"\") if @object[:user])\n }\n end", "def basic_hash(user, client)\n basic_hash = {\n :id => id,\n :title => title,\n :tags => tags,\n :owner => owner.andand.guid,\n :priv => priv,\n :metadata => metadata,\n :updated_at => updated_at.utc,\n :updated_by => updated_by,\n :read_only => read_only,\n :indestructible => indestructible\n }\n updated_by_name = \"\"\n if ! updated_by.nil?\n if updater = Person.find_by_id(updated_by)\n updated_by_name = updater.name_or_username\n elsif updater = Client.find_by_id(updated_by)\n updated_by_name = updater.name\n end\n end\n\n basic_hash.merge!({:updated_by_name => updated_by_name})\n return basic_hash\n end", "def user\n hash = {\n provider: 'josh_id',\n id: current_user.id.to_s,\n info: {\n email: current_user.email,\n username: current_user.username,\n #first_name: current_user.first_name,\n }\n }\n\n render json: hash.to_json\n end", "def process_workshop_users(data)\n\t\tdata.each do |item|\n\t\t\tif item[:password] == \"local\"\n\t\t\t\titem[:password] = @user.password\n\t\t\tend\n\t\t\t@user.create_user(item)\n\t\tend\n\tend", "def store(sender)\n raise ShadowHashError.new(ShadowHashError::UNSUPPORTED_OBJECT_ERR) unless sender.is_a? MacAdmin::User\n @data = { @label => convert_to_blob(@hash) }.to_plist\n sender['ShadowHashData'] = [@data]\n end", "def _user_add f = {}\n\t\tf[:salt] \t\t= _random_string 5\n\t\tf[:created] \t= Time.now\n\n\t\trequire \"digest/sha1\"\n\t\tf[:pawd] \t\t= Digest::SHA1.hexdigest(f[:pawd] + f[:salt])\n\n\t\t_throw L[:'the user is existing'] if _user? f[:name]\n\n\t\tDB[:_user].insert(f)\n\t\tuid = DB[:_user].filter(:name => f[:name]).get(:uid)\n\t\tuid ? uid : 0\n\tend", "def create_invite_hash!\n self.invite_hash = Digest::SHA2.new(256).update(\"#{self.serializable_hash}+#{Time.now}+jibffffrrrji!@#sh\").to_s[2..12]\n end", "def before_save\n super\n unless(self.values[:credentials])\n self.values[:credentials] = {}\n end\n random_sec = 3.times.map{ SecureRandom.urlsafe_base64 }.join\n self.user.run_state.random_sec = random_sec\n self.credentials = Utils::Cipher.encrypt(\n JSON.dump(self[:credentials]),\n :key => [\n SALTER,\n self.user.username,\n self.user.run_state.random_sec\n ].join(SALTER_JOINER),\n :iv => self.user.run_state.random_sec\n )\n self.extras = Sequel.pg_json(self.extras)\n self.infos = Sequel.pg_json(self.infos)\n if(password)\n self.password_digest = checksum(password)\n end\n end", "def hash\n [provider_name, host_name, host_port, host_ssl, host_tls, host_no_cert_check, bind_dn, bind_password, search_timeout, admin_pool_max_active, admin_pool_lookup_on_validate, user_pool_max_active, user_pool_lookup_on_validate, user_base_dn, user_objectclass, user_id_attribute, user_extra_filter, user_make_dn_path, group_base_dn, group_objectclass, group_name_attribute, group_extra_filter, group_make_dn_path, group_member_attribute, use_uid_for_ext_id, customattributes].hash\n end", "def user\n {\n id: object.user.id,\n email: object.user.email,\n birthday: object.user.birthday,\n first_name: object.user.first_name,\n middle_name: object.user.middle_name,\n last_name: object.user.last_name,\n phone: object.user.phone,\n gender: object.user.gender,\n neighborships: object.user.neighborships\n }\n end", "def create_user(user)\n user.downcase!\n hash = Hash.new\n hash[:name] = \"#{user}\"\n hash[:balance] = 0\n puts \"Please create a password: \"\n hash[:password] = gets.chomp\n write_to_file(\"userdata/#{user}.txt\",hash)\n write_to_file(\"userdata/#{user}_history.txt\", nil)\nend", "def get_all_users\n @users = []\n\n User.all.each do|user|\n @users << user.to_hash\n end\n end", "def hash\n [first_name, last_name, address_one, address_two, city, state, zip, phone, email, country_code].hash\n end", "def make_auth_hash\n self.auth_hash = Digest::SHA1.hexdigest(self.object_id.to_s + Time.now.to_i.to_s + self.name.to_s)\n end", "def get_user(name)\n user = nil\n \n @user_pool.info\n @user_pool.each{ |u|\n if u.name==name\n user=Hash.new\n\n user[:id] = u.id\n user[:name] = u.name\n user[:password] = u[:password]\n end\n }\n return user\n end", "def hashed_rooster\r\nend", "def extra_users_data_look_up\n return if @results.empty?\n\n tickets = DataStore.instance.tickets\n @results.each do |user|\n ticket_names = tickets.select { |t| t['assignee_id'] == user['_id'] }.map { |t| t['subject'] }\n user['tickets'] = ticket_names\n end\n end", "def collect_user_info(get_password=true, \n first_time=false,\n third_party=false,\n need_email=true)\n\n values = {\n \"form_target\" => url(:handle_collect_user_info, \n get_password, \n third_party,\n need_email),\n \"user_affiliate_opts\" => Affiliate.options,\n \"first_time\" => first_time,\n \"third_party\" => third_party\n }\n\n \n @data.user.add_to_hash(values)\n\n standard_page(\"Create New User\",\n values,\n Login::EDIT_USER)\n end", "def get_all_users\n @users = []\n User.all.each do |user|\n @users << user.to_hash\n end\n end", "def pack(data, user, pw)\n slot = nil\n \n @store.transaction {\n @store['count'] += 1\n slot = @store['count'].to_s\n @store[slot] = {\n data: data,\n user: user,\n pwhash: pw,\n created: Time.now.utc.to_i\n }\n }\n\n slot\n end", "def student_data_hash\n\n # turn data into 2 Dim array containing arrays of eles where delimiter is colon :\n clean_user_account_data = ruby_class_user_accounts.map { |x| x.split(/:/) }\n\n # turn data into a hash using 2 arrays for keys and values\n keys = %w[user_name password uid gid gcos_field home_directory login_shell]\n final_array_of_hashes = []\n\n clean_user_account_data.each do |account_data|\n hash = Hash.new\n keys.each_with_index { |item, index| hash[item] = account_data[index] }\n final_array_of_hashes << hash\n end\n final_array_of_hashes\n end", "def get_user\n key = params[:key]\n writer_id = key.alphadecimal\n @user = {:id => writer_id, :key => key}\n end", "def get_all_users\n @users = []\n results = User.all\n results.each do |user|\n @users << user.to_hash\n end\n end", "def assign_twitter_account_info(auth)\n user = auth.extra.raw_info\n self.twitter_id = user.id\n self.name = user.name\n self.screen_name = user.screen_name\n self.location = user.location\n self.description = user.description\n self.url = user.url\n self.profile_image_url = user.profile_image_url_https\n self\n end", "def get_user_repo_hash(user, data)\n return {\n 'user_id' => user['_id'],\n 'open_issues' => data['open_issues'],\n 'watchers' => data['watchers'],\n 'pushed_at' => data['pushed_at'],\n 'homepage' => data['homepage'],\n 'git_url' => data['git_url'],\n 'updated_at' => data['updated_at'],\n 'fork' => data['fork'],\n 'forks' => data['forks'],\n 'language' => data['language'],\n 'private' => data['private'],\n 'size' => data['size'],\n 'clone_url' => data['clone_url'],\n 'created_at' => data['created_at'],\n 'name' => data['name'], # a unique name for a user repo\n 'html_url' => data['html_url'],\n 'description' => data['description']\n }\n end", "def create_version_hash\n new_version = {}\n new_version['created'] = ''\n new_version['message'] = ''\n new_version['user'] = {}\n # user is #name, # address.\n new_version['user']['name'] = ''\n new_version['user']['address'] = ''\n new_version['state'] = {}\n new_version\n end", "def user_data(data, username, user_password)\n data.each do |hash|\n next unless hash['username'].downcase == username.downcase\n\n next unless hash['password'] == user_password\n\n @user = User.new(username, user_password, hash['id'], hash['playlist'], hash['mylist'])\n go_to_menu\n end\n @count += 1\n no_auth\n end", "def initialize(hash_of_users)\n @sessions = []\n @users = {}\n hash_of_users.map do |user,password|\n @users[user] = password\n end\n end", "def save_user_data(content_keys, request_url_param, format_param, credential)\n content_keys.each do |content_key|\n data = content_key.values[0]\n extracted_key = content_key.keys[0]\n zendesk_user = ::Zendesk::User.find_or_initialize_by_target_id(extracted_key)\n zendesk_user.update_attributes({:request_url => request_url_param, :content => data, :format => format_param, :credential => extract_credential(credential), :target_id => extracted_key})\n end\n end", "def set_user_info\n response = Request.send_request_action(action: \"index\", cookie: @cookie)\n @authkey = response[:response][\"authkey\"]\n @passkey = response[:response][\"passkey\"]\n @user_id = response[:response][\"id\"]\n end", "def capture_user_data\n\n # add a user config row entry\n user_data = Userconfig.new(username: session[:userinfo].blank? ? \"\" : session[:userinfo]['info']['name'],\n date: DateTime.now,\n company: session[:company],\n okta: session[:okta] == \"on\" ? true : false,\n logo_url: session[:logo],\n home_url: session[:background],\n vault: true,\n resources: session[:resources] == \"on\" ? true : false,\n onboarding_tasks: session[:onboarding] == \"on\" ? true : false,\n medical_credentialing: session[:medical_credentialing] == \"on\" ? true : false,\n loan_origination: session[:loan_docs] == \"on\" ? true : false,\n upload_sign: session[:upload_sign] == \"on\" ? true : false,\n tax_return: session[:tax_return] == \"on\" ? true : false,\n submit_claim: session[:create_claim] == \"on\" ? true : false,\n eventstream: session[:eventstream] == \"on\" ? true : false)\n user_data.save\n end", "def user_settings_hash\n fail 'sub class to implement'\n end", "def get_account \n @user = {}\n @user[@username] = @password\n data = []\n data << File.write('test_2.json', JSON.dump(@user))\n end", "def key_map\n hash = {}\n hash['email'] = self.email\n hash['zip'] = self.zip\n hash['user_id'] = self.user_id\n hash\n end", "def fix_raw_user!\n return unless raw_user\n raw_user['scraped_at'] = self.moreinfo['scraped_at']\n raw_user['created_at'] = ModelCommon.flatten_date(raw_user['created_at'])\n raw_user['id'] = ModelCommon.zeropad_id( raw_user['id'])\n raw_user['protected'] = ModelCommon.unbooleanize(raw_user['protected'])\n raw_user['profile_background_tile'] = ModelCommon.unbooleanize(raw['profile_background_tile']) unless raw_user['profile_background_tile'].nil?\n Wukong.encode_components raw_user, 'name', 'location', 'description', 'url'\n # There are several users with bogus screen names\n # These we need to **URL encode** -- not XML-encode.\n if raw_user['screen_name'] !~ /\\A\\w+\\z/\n raw_user['screen_name'] = Wukong.encode_str(raw_user['screen_name'], :url)\n end\n end", "def hash\n [ name, database, password ].hash\n end", "def save\n # Convert hash to JSON\n self_json = {email: @email, name: @name, permissions: @permissions}.to_json\n #Open the file and append the JSON to the file\n open('users.json', 'a') do |file|\n file.puts self_json\n end\n end", "def copy_user_data\n self.siam = self.user.siam\n self.siag = self.user.siag\n self.student = self.user.student\n end", "def update_user_from_auth(auth)\n user = self\n user.username = auth.info.nickname\n user.avatar_url = auth.info.image\n user.location = auth.extra.raw_info.city\n user.country = auth.extra.raw_info.country\n user.name = auth.info.name\n user\n end", "def _user_add argv = {}\n\t\tf\t\t\t\t= {}\n\t\tf[:tag]\t\t\t= argv[:tag] if argv.include?(:tag)\n\t\tf[:salt] \t\t= _random 5\n\n\t\t#username\n\t\t_throw Sl[:'the user is existing'] if _user? f[:name]\n\t\tf[:name] \t\t= argv[:name]\n\n\t\t#password\n\t\trequire \"digest/sha1\"\n\t\tf[:pawd] \t\t= Digest::SHA1.hexdigest(argv[:pawd] + f[:salt])\n\n# \t\tSdb[:user].insert(f)\n\t\t_submit :_user, :fkv => f, :uniq => true\n\t\tuid = Sdb[:_user].filter(:name => f[:name]).get(:uid)\n\t\tuid ? uid : 0\n\tend", "def attributes\n data = super\n photo_path = File.join(api_user_dir(data[:username]), USER_PHOTO_FILENAME)\n username = (File.exists? photo_path)? data[:username]: 'default'\n photo_url = \"#{user_url(options[:host], username)}/#{USER_PHOTO_FILENAME}\"\n data.to_a.insert(6, [:photo_url, photo_url]).to_h\n end", "def hash\n [author_email, author_name, author_time, branch, commit_time, committer_email, committer_name, default_branch, message, repository_url, sha, tag].hash\n end", "def user_add argv = {}\n\t\tfkv\t\t\t= {}\n\t\tfkv[:name]\t= argv[:name]\n\t\tfkv[:level]\t= argv[:level]\n\t\tfkv[:tag]\t= argv[:tag] if argv[:tag]\n\n\t\t# if the username is existed\n\t\t_throw Sl[:'the user is existed'] if user_has? fkv[:name]\n\n\t\t# password\n\t\trequire \"digest/sha1\"\n\t\tfkv[:salt] \t= _random 5\n\t\tfkv[:pawd] \t= Digest::SHA1.hexdigest(argv[:pawd] + fkv[:salt])\n\n# \t\tSdb[:user].insert(f)\n\t\tdata_submit :user_info, :fkv => fkv, :uniq => true\n\n\t\tuid = Sdb[:user_info].filter(:name => fkv[:name]).get(:uid)\n\t\tuid ? uid : 0\n\tend", "def register(data)\n unless @registered\n @user = Hashie::Mash.new(data)\n @user.event_machine_connection_id = @connection.id\n @user.event_machine_connection = self\n puts \"uuid: #{@user.uuid}\"\n puts \"first_name: #{@user.first_name}\"\n puts \"last_name: #{@user.last_name}\"\n puts \"software_key: #{@user.auth_key}\"\n puts \"type: #{@user.type}\"\n puts \"identifier (em): #{@user.event_machine_connection_id.to_s}\"\n \n # store user in global hash - (this could also be in mongodb,mysql,redis,etc)\n $connections.store(@user.uuid,@user)\n puts $connections.inspect\n \n unless !$connections.has_key? @user.uuid\n puts \"user is registered and in $connections hash\"\n @registered = true\n $ws_notifier.call(\"#{@user.uuid} just registered on the server\",\"connection\")\n else\n puts \"epic fail. shutting down now\"\n end\n else\n puts \"user is already registered. ignoring re-registration\"\n end\n \n end", "def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info\n end", "def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info\n end", "def hash\n [type, page_access_token, app_id, app_secret, account_sid, auth_token, phone_number_sid, token, channel_access_token, encoding_aes_key, from_address, certificate, password, auto_update_badge, server_key, sender_id, consumer_key, consumer_secret, access_token_key, access_token_secret].hash\n end", "def hash\n [email_address, domain_name, domain_id, name, description, use_domain_pool, tags, expires_at, favourite, expires_in, allow_team_access, inbox_type, virtual_inbox, use_short_address].hash\n end", "def modify_user_data(data)\n @user_data.merge!(data)\n end" ]
[ "0.6760082", "0.67248976", "0.6709168", "0.66285336", "0.66162926", "0.65451276", "0.65352595", "0.64493", "0.63894325", "0.63856786", "0.6376628", "0.6345046", "0.6326804", "0.63162816", "0.63107544", "0.63063264", "0.62908846", "0.6230938", "0.6158729", "0.61488956", "0.6147704", "0.6144794", "0.6130648", "0.60980463", "0.6081966", "0.6074821", "0.60714644", "0.6001944", "0.5989711", "0.5986237", "0.59843445", "0.59834945", "0.59834945", "0.59658575", "0.59654164", "0.59453833", "0.59418875", "0.59383696", "0.5933256", "0.5927754", "0.59052336", "0.588795", "0.58868146", "0.586961", "0.5853893", "0.58538175", "0.5836289", "0.5829461", "0.5819057", "0.57864064", "0.57778454", "0.5770344", "0.57571685", "0.5733014", "0.572332", "0.5715218", "0.57134616", "0.5703577", "0.5699544", "0.5696935", "0.5696182", "0.5696109", "0.5691099", "0.56881845", "0.5684529", "0.56823057", "0.5680734", "0.5679978", "0.5678633", "0.5675553", "0.56730956", "0.5670543", "0.56613445", "0.56607926", "0.56504065", "0.5639051", "0.5635674", "0.5634001", "0.5632722", "0.5631777", "0.5630426", "0.5626672", "0.5626031", "0.5624728", "0.5620227", "0.5604986", "0.5603538", "0.5597519", "0.5592017", "0.55913925", "0.55875915", "0.55818194", "0.5578473", "0.5575304", "0.557171", "0.5570124", "0.5570124", "0.5568338", "0.5564496", "0.55598587" ]
0.6772971
0
Return any validation errors from this user or its contact. The contact validation is somewhat stricter if we have no email address, or if we're shipping materials
def error_list(strict=false) errors = [] if @new_user && !@user_over_13 errors << "Users must be 13 or older to register on this system" return errors end if @data_object.user_affiliate == Affiliate::NONE.to_s errors << "Please specify an affiliate" end errors.concat contact.error_list(strict || contact.con_email.empty?) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contact_errors\n error \"name\"\n error \"age\"\n error \"homepage\"\n end", "def error_list(strict = false)\n c = @data_object\n res = []\n\n res << \"Missing name\" if c.con_first_name.empty? || c.con_last_name.empty?\n\n if strict\n if c.con_day_tel.empty? && c.con_eve_tel.empty? && c.con_fax_tel.empty? \n res << \"Must supply at least one contact telephone number\" \n end\n end\n\n check_length(res, c.con_first_name, 50, \"first name\")\n check_length(res, c.con_last_name, 50, \"first name\")\n check_length(res, c.con_day_tel, 20, \"daytime telephone number\")\n check_length(res, c.con_eve_tel, 20, \"evening telephone number\")\n check_length(res, c.con_fax_tel, 20, \"fax telephone number\")\n check_length(res, c.con_email, 60, \"e-mail address\")\n\n unless c.con_email.empty?\n msg = Mailer.invalid_email_address?(c.con_email)\n res << msg if msg \n end\n\n res.concat mail.error_list(strict, \"mailing\")\n res.concat ship.error_list(strict, \"shipping\")\n\n if strict && @mail.empty?\n res << \"Please specify a mailing address\"\n end\n\n if strict && !c.con_ship_to_mail && ship.empty?\n res << \"Please specify a shipping address (or click box to indicate\" +\n \" that your mailing address is your shipping address\"\n end\n\n res\n end", "def errors\n super.tap do |errors|\n errors.add(:'user.email', 'is invalid') if errors[:'user.email'].empty?\n end\n end", "def errors\n @validator ? @validator.errors : []\n end", "def errors\n self.class.validator.call self\n end", "def errors\n run_validation\n @errors\n end", "def aggregate_errors\n invalid_course_user_errors + invalid_user_email_errors\n end", "def aggregate_errors\n invalid_course_user_errors + invalid_invitation_email_errors\n end", "def aggregate_errors\n invalid_course_user_errors + invalid_invitation_email_errors\n end", "def user_errors(user)\n user.errors.full_messages.collect { |msg| msg }\n end", "def get_all_errors\n\t\t@user.errors.full_messages.compact.join(',')\n\tend", "def errors\n validate_or_get_results :errors\n end", "def errors\n @model_decorator.form_active_errors(@resource)\n end", "def propagate_user_email_errors\n return if (email_errors = errors.delete(:'emails.email')).nil?\n\n email_errors.each do |error|\n errors.add(:email, error)\n end\n end", "def update_errors\n @errors = []\n @errors << 'One of the cards needs attention' unless cards.all?(&:valid?)\n if email\n @errors << 'Email is not in correct format' unless email_well_formed?\n else\n @errors << 'Email is a required field'\n end\n @errors << 'Wallet token is a required field' unless wallet_token\n @errors\n end", "def validate\n super\n if root? && (self.email.to_s.empty? || errors.invalid?(:email)) && self.phone.to_s.empty?\n errors.add(:base, \"Phone number or email address must be provided\".t)\n end\n if self.email\n unless self.organization.worldwide.map(&:site_domain).compact.include?(self.email_domain)\n errors.add(:email, \"not a valid email address at %{org}\".t % {:org => self.organization.root.name})\n end\n end\n end", "def errors\n execute_lifecycle(:before, :validation) if self.respond_to? :execute_lifecycle\n errs = []\n self.class.validations.each do |validation|\n errs << (validation.is_a?(Proc) ? self.instance_exec(&validation) : self.send(validation))\n end\n # remove nils\n errs = errs.flatten.select { |x| !x.nil? }\n errs\n end", "def errors(name = nil, type = nil)\n return @validate.errors(name, type)\n end", "def errors\n @fields.flat_map(&:errors)\n end", "def errors\n p = build_payment\n p.valid?\n p.errors\n end", "def errors\n @errors ||= ActiveModel::Errors.new(self)\n if respond_to?(:main_instance) && main_instance && main_instance.errors.any?\n main_instance.errors\n else\n @errors\n end\n end", "def set_errors\n @errors = []\n\n if self.name == nil || self.name == \"\"\n @errors << \"Name cannot be blank.\"\n end\n if self.username == nil || self.username == \"\"\n @errors << \"Username cannot be blank.\"\n end\n if self.email == nil || self.email == \"\"\n @errors << \"Email cannot be blank.\"\n end\n if self.password == nil || self.password == \"\"\n @errors << \"Password cannot be blank.\"\n end\n if self.budget == nil || self.budget == \"\"\n @errors << \"Budget cannot be blank.\"\n end\n end", "def errors\n return super unless ldp_object.present?\n ldp_object.errors\n end", "def user_error\n @user_error = @user.errors.full_messages.join(\", \") if @user.errors\n end", "def errors\n @attributes[:errors]\n end", "def errors\n @errors\n end", "def errors\n @errors\n end", "def errors\n @errors\n end", "def validate\n if !new_record? && current?\n errors.add('contact_name', 'Please provide a contact name for your enquiry') unless contact_name.present?\n errors.add('contact_phone', 'Please provide a phone number where we may contact you at about your enquiry') unless contact_phone.present?\n end\n end", "def validation_errors\n errors = []\n ErrorCompiler.with_errors(errors) do |e|\n check_schools_consistency_in_each_round(e)\n check_legitimate_progress_through_rounds(e)\n check_wildcards(e)\n end\n errors\n end", "def errors\n @errors.values.flatten\n end", "def _validation_errors()\n errors = []\n @flows.each_value { |f| errors += f._validation_errors() }\n errors\n end", "def errors\n @errors || []\n end", "def errors\n errors = []\n required_fields.each do |attrib|\n errors << attrib unless self.send(attrib)\n end\n\n self.each do |k, v|\n if v.nil? || v.to_s.empty?\n errors << k\n end\n end\n\n unless has_connection_fields?\n connection_errors = []\n\n connection_fields.each do |attrib|\n connection_errors << attrib unless self.send(attrib)\n end\n\n errors += connection_errors\n end\n\n errors\n end", "def field_validation_errors\n errors = field_validation_error_elements.map { |e| e.text.downcase }.reject { |e| e.empty? }\n exclude = \"Please fill the required fields.\"\n\n if errors.include?(exclude)\n errors.delete(exclude)\n end\n\n errors\n end", "def validate_for_email_or_phone\n unless valid_format_email_or_phone?\n errors.add(:email_or_phone, :invalid)\n end\n end", "def errors\n @errors.values\n end", "def errors\n @errors ||= []\n end", "def errors\n @errors ||= []\n end", "def invalid_user_emails\n current_course.course_users.\n map { |course_user| course_user.invitation.try(:user_email) }.\n reject { |user_email| user_email.nil? || user_email.errors.empty? }\n end", "def errors\n @errors ||= []\n end", "def errors\n {}\n end", "def validations\n []\n end", "def errors\n errors = []\n unless @method_name.present?\n errors << \"method_name is not set\"\n end\n unless @service_name.present?\n errors << \"service_name is not set\"\n end\n unless @server_address.present?\n errors << \"server_address is not set\"\n end\n errors\n end", "def errors\n @errors\n end", "def errors\n @errors\n end", "def errors\n @errors\n end", "def valid_user_or_email!\n return unless @user.blank? && @extra['email'].blank?\n\n @success = false\n @error = 'Error: user name or extra email must be present'\n end", "def error_messages\n @error_messages ||= begin\n data[:errors] ? data[:errors] : [data]\n end\n end", "def validate_and_sanitize\n r = super\n return r unless r.success?\n\n @email = @email.to_s.downcase.strip\n @name = @name.to_s.downcase.strip\n\n return error_with_data(\n 'am_au_i_vas_1',\n 'Invite User Error',\n 'Please enter a valid email address',\n GlobalConstant::ErrorAction.default,\n {}\n ) if !Util::CommonValidateAndSanitize.is_valid_email?(@email)\n\n return error_with_data(\n 'am_au_i_vas_2',\n 'Invite User Error',\n 'Name cannot be blank',\n GlobalConstant::ErrorAction.default,\n {}\n ) if @name.blank?\n\n return error_with_data(\n 'am_au_i_vas_3',\n 'Invite User Error',\n 'Name can be of maximum 100 characters',\n GlobalConstant::ErrorAction.default,\n {}\n ) if @name.length > 100\n\n success\n end", "def errors\n result = []\n result.push(:title) unless valid_string? @title\n result.push(:author) unless valid_string? @author\n result.push(:release_date) unless valid_date? @release_date\n result.push(:publisher) unless valid_string? @publisher\n result.push(:isbn) unless valid_integer? @isbn\n result\n end", "def errors\n header.errors\n end", "def validate\n # add errors if not validate\n end", "def update_errors\n @errors = []\n @errors << 'Expiration date is a required field' unless expiration_date\n @errors << 'Expiration Date is not a valid date' unless expiration_date.is_a? Date\n @errors << 'Card type is a required field' unless card_type\n @errors << 'Card type is not supported' unless check_card_type\n @errors << 'Card number is not valid' unless card_number_valid?\n @errors\n end", "def errors\n @errors ||= Errors.new(self)\n end", "def errors\n @errors ||= Errors.new(self)\n end", "def errors\n @errors ||= []\n end", "def errors\n @errors ||= []\n end", "def errors\n @errors.dup\n end", "def invalid_course_users\n current_course.course_users.\n reject { |course_user| course_user.errors.empty? }\n end", "def errors\n object.errors.messages.flat_map do |field, messages|\n messages.map.with_index do |message, index|\n build_error(field, message, index)\n end\n end\n end", "def _exceptions\n return @validated if @validated\n\n exceptions = {}\n if not @always_valid\n exceptions = self.validate(@data, false)\n end\n\n if @errors\n exceptions[:errors] = (exceptions[:errors] or {}).merge(@errors)\n end\n\n exceptions\n end", "def collect_errors\n self.errors.full_messages.join(\"\\n\")\n end", "def validate_contacts\n # we assume they are set at this point\n # contacts are unique\n contacts = [ self.requester, self.subject_expert, self.sponsor ]\n if Set.new(contacts).length != contacts.length\n add_validation 'All contacts must be unique'\n end\n\n # sponsor should be higher than expert, and expert higher than requester\n # ranks are reversed, rank 1 is top (board chairman)\n if self.sponsor.title.rank >= self.subject_expert.title.rank\n add_validation 'Sponsor should be a higher rank than the Subject Expert'\n end\n if self.subject_expert.title.rank >= self.requester.title.rank\n add_validation 'Subject Expert should be a higher rank than the Requester'\n end\n\n # contacts are co-located!\n if Set.new(contacts.map { |contact| contact.office.mail_code }).length > 1\n add_validation 'All contacts should be co-located'\n end\n end", "def errors\n \"Missing value for <#{name}> field\" if required && !@value\n end", "def errors\n @error.fetch('errors', [])\n end", "def validation_errors\n if Gem.loaded_specs.has_key?(\"json-schema\")\n require 'json-schema'\n JSON::Validator.fully_validate(@@schema, @hash)\n end\n end", "def set_errors\n \t@errors = []\n\n \tif self.title == \"\"\n \t@errors << \"Title cannot be blank\"\n \tend\n\n if self.user_id == nil\n @errors << \"Must assign to a user\"\n end\n\n if self.category_id == nil\n @errors << \"Must assign to a category\"\n end\n \tend", "def contact_fields\n if contact_type == 'contact'\n validates_length_of :first_name, minimum: 2, maximum: 20 if validates_presence_of :first_name\n validates_length_of :last_name, minimum: 2, maximum: 20 if validates_presence_of :last_name\n end\n end", "def extra_validations\n success\n end", "def errors\n @_errors ||= {}\n @_errors\n end", "def validate\n errors.add_to_base('password', 'and confirmation do not match') unless password_confirmation == password\n errors.add_to_base(\"Your User ID is to long, can only store 4 characters!\") if self.userId.to_s.length > 4\n errors.add_to_base(\"Your User Name is to long, can only store 50 characters!\")if self.userName.to_s.length > 50\n errors.add_to_base(\"Your First Name is to long, can only store 50 characters!\")if self.firstName.to_s.length > 50\n errors.add_to_base(\"Your Last Name is to long, can only store 50 characters!\")if self.lastName.to_s.length > 50\n errors.add_to_base(\"Your Title is to long, can only store 50 characters!\") if self.title.to_s.length > 50\n errors.add_to_base(\"Your Photo is to long, can only store 50 characters!\") if self.photo.to_s.length > 50\n errors.add_to_base(\"Your Email is to long, can only store 30 characters!\") if self.email.to_s.length > 30\n errors.add_to_base(\"Your Byline ID is to long, can only store 11 characters!\") if self.bylineID.to_s.length > 11\n end", "def errors_for row\n ie = insert_error_for row\n return ie.errors if ie\n []\n end", "def errors\n @errors ||= Errors.new(self)\n end", "def validate()\n begin\n @base_schema.validate(@data,[],self,@validation_options)\n if @validation_options[:clear_cache] == true\n Validator.clear_cache\n end\n if @options[:errors_as_objects]\n return @errors.map{|e| e.to_hash}\n else\n return @errors.map{|e| e.to_string}\n end\n rescue JSON::Schema::ValidationError\n if @validation_options[:clear_cache] == true\n Validator.clear_cache\n end\n raise $!\n end\n end", "def edit_email\n @errors = {}\n end", "def getErrors() \n\t\t\t$errors = @errors\n\t\t\t#@errors = []\n\t\t\treturn $errors;\n\t\tend", "def errors\n @errors.dup\n end", "def invalid_record_errors(record)\n record.errors.map do |invalid_field, message| #=> [:name, \"can't be blank\"]\n {\n \"status\" => \"422\",\n \"source\" => {\"pointer\" => \"/data/attributes/#{invalid_field}\"},\n \"title\" => \"Invalid Attribute\",\n \"detail\" => message\n }\n end\n end", "def error_msg\n return nil if result\n\n bad_emails = email_addresses.reject { |email| regex.match(email) }\n\n \"#{bad_emails.count == 1 ? 'Email does' : 'Emails do'} not meet criteria: #{bad_emails.join(', ')}\"\n end", "def validate_invitable\n\t\tif claimed?\n\t\t\terrors.add :profile, I18n.t('models.profile.claimed')\n\t\telsif invitation_email.blank?\n\t\t\terrors.add :invitation_email, I18n.t('models.profile.invitation_email.missing')\n\t\telsif contact_blockers.present?\n\t\t\temails = contact_blockers.map(&:email).join(', ')\n\t\t\terrors.add :invitation_email, I18n.t('models.profile.invitation_email.contact_blocked_by_invitee', emails: emails)\n\t\telsif (contact_blocker = ContactBlocker.find_by_email_ignore_case invitation_email)\n\t\t\terrors.add :invitation_email, I18n.t('models.profile.invitation_email.contact_blocked_for', email: contact_blocker.email)\n\t\tend\n\t\terrors.empty?\n\tend", "def list_invalid_properties\n invalid_properties = Array.new\n if @email.nil?\n invalid_properties.push('invalid value for \"email\", email cannot be nil.')\n end\n\n if !@first_name.nil? && @first_name.to_s.length > 64\n invalid_properties.push('invalid value for \"first_name\", the character length must be smaller than or equal to 64.')\n end\n\n if !@last_name.nil? && @last_name.to_s.length > 64\n invalid_properties.push('invalid value for \"last_name\", the character length must be smaller than or equal to 64.')\n end\n\n if @type.nil?\n invalid_properties.push('invalid value for \"type\", type cannot be nil.')\n end\n\n invalid_properties\n end", "def errors\n errs = []\n\n # Make sure that every field is filled out\n self.class.fields.except(:project_id).each_with_object({}) do |(field_name, field_options), h|\n if options[field_name].blank?\n errs << \"#{field_options[:label]} must be present\"\n end\n end\n\n # We can only perform the other tests if the necessary values are at least present\n return {:base => errs.to_sentence} unless errs.size.zero?\n\n # Check if the given endpoint actually exists\n unless gitlab_endpoint_exists?(options[:endpoint])\n errs << 'No Gitlab installation was found under the given URL'\n return {:base => errs.to_sentence}\n end\n\n # Check if a user by the given token exists\n unless gitlab_user_exists?(options[:endpoint], options[:api_token])\n errs << 'No user with the given API token was found'\n return {:base => errs.to_sentence}\n end\n\n # Check if there is a project with the given name on the server\n unless gitlab_project_id(options[:endpoint], options[:api_token], options[:path_with_namespace])\n errs << \"A project named '#{options[:path_with_namespace]}' could not be found on the server.\n Please make sure to enter it exactly as it appears in your address bar in Gitlab (case sensitive)\"\n return {:base => errs.to_sentence}\n end\n\n {}\n end", "def errors\n e = []\n e << 'EndSeqNo must either be 0 (inifinity) or be >= BeginSeqNo' unless end_seq_no_valid?\n [super, e].flatten\n end", "def validations\n {}\n end", "def errors\n @errors.clone\n end", "def errors\n bindings[:object].errors[name]\n end", "def errors\n bindings[:object].errors[name]\n end", "def errors\n bindings[:object].errors[name]\n end", "def validate\n unless params[:name] =~ /\\w+/\n @errors << 'A valid name is required'\n end\n unless params[:email] =~ /\\w+@\\w+\\.\\w+/\n @errors << 'A valid email address is required'\n end\n unless params[:message] =~ /\\w+/\n @errors << 'A message is required'\n end\n #unless simple_captcha_valid?\n # @errors << 'Captcha did not match'\n #end\n @errors.empty?\n end", "def check_contact_info\n @user = current_user\n if @user.invalid?\n return redirect_to edit_user_path(current_user)\n end\n end", "def invalid_course_user_errors\n invalid_course_users.map do |course_user|\n user = self.class.helpers.display_user(course_user.user || course_user)\n t('course.user_invitations.errors.duplicate_user', user: user)\n end\n end", "def email_format\n\t\terrors.add(:email, :invalid) unless email.match(EMAIL_REGEXP)\n\tend", "def validate?\n valid = true\n if first_name.blank? && last_name.blank?\n errors.add_to_base(\"Must enter contact name\")\n valid = false\n end\n ex_email = Contact.find(:first, :include => [:emails], :conditions => [\"emails.email_text = ? AND contacts.user_id = ? AND merged_to_form_contact_id = 0\", self.email, self.user_id])\n if ex_email\n errors.add_to_base(\"Contact already in network\")\n valid = false\n end\n valid\n end", "def validate\n validates_contact\n end", "def create_user_check_valid_action\n email = check_create_user_email_is_valid\n name = check_create_user_name_is_valid\n password = check_create_user_password_is_valid\n message = []\n\n if name == false\n message << user_name_error\n end\n\n if email == false\n message << user_email_error\n end\n\n if password == false\n message << user_password_error\n end\n \n\n return message\n end", "def validate_and_sanitize\n\n @email = @email.to_s.downcase.strip\n\n validation_errors = {}\n if !Util::CommonValidateAndSanitize.is_valid_email?(@email)\n validation_errors[:email] = 'Please enter a valid email address'\n end\n\n if @password.length < 8\n validation_errors[:password] = 'Password should be minimum 8 characters'\n end\n\n return error_with_data(\n 'um_su_1',\n 'Registration Error',\n '',\n GlobalConstant::ErrorAction.default,\n {},\n validation_errors\n ) if validation_errors.present?\n\n # NOTE: To be on safe side, check for generic errors as well\n r = validate\n return r unless r.success?\n\n success\n end", "def _validation_errors()\n errors = []\n @tasks.each_value { |t| errors += t._validation_errors() }\n errors\n end", "def error_fields\n\t\treturn self.missing | self.invalid.keys\n\tend", "def error_fields\n\t\treturn self.missing | self.invalid.keys\n\tend" ]
[ "0.6965642", "0.6887497", "0.6777876", "0.6694164", "0.66485244", "0.66387296", "0.6576276", "0.64295673", "0.64295673", "0.6422443", "0.6410808", "0.6402918", "0.6378669", "0.6342053", "0.6328821", "0.62971896", "0.6260525", "0.62498796", "0.6238738", "0.62178165", "0.62099177", "0.61551154", "0.61528224", "0.61495906", "0.6138573", "0.61347675", "0.61347675", "0.61347675", "0.6120728", "0.6102716", "0.60997564", "0.60710436", "0.60641605", "0.6060957", "0.60597515", "0.6054186", "0.59871495", "0.5969107", "0.5969107", "0.5968935", "0.59527", "0.5942889", "0.5940948", "0.5938373", "0.593376", "0.593376", "0.593376", "0.59332466", "0.5919203", "0.5905832", "0.5897421", "0.58869076", "0.5879842", "0.5869605", "0.58642364", "0.58642364", "0.58622175", "0.58622175", "0.58614653", "0.5860892", "0.5860563", "0.5860169", "0.5851981", "0.58488005", "0.5847673", "0.58471376", "0.584354", "0.58399487", "0.5838367", "0.58331746", "0.58152384", "0.5809353", "0.5804539", "0.5799633", "0.5790614", "0.57882446", "0.5783632", "0.5771716", "0.5753308", "0.57414407", "0.5740192", "0.5731457", "0.5726479", "0.57235754", "0.5723289", "0.57204914", "0.5718037", "0.5718037", "0.5718037", "0.57168454", "0.5705696", "0.57047325", "0.57015216", "0.56979716", "0.5697046", "0.56939274", "0.5690335", "0.56843567", "0.5679069", "0.5679069" ]
0.6498926
7
Recover our state from form fields
def from_hash(hash) @data_object.user_acc_name = hash['user_acc_name'] @data_object.user_affiliate = hash['user_affiliate'] @user_over_13 = hash['user_over_13'] contact.from_hash(hash) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_out_form(hash)\n self.institution=hash[:institution]\n self.department=hash[:department]\n self.title_role=hash[:title]\n self.email=hash[:email]\n self.instant_messaging=hash[:im]\n self.phone=hash[:phone]\n self.mobile=hash[:mobile]\n self.fax=hash[:fax]\n self.address=hash[:address]\n self.city=hash[:city]\n self.state=hash[:state]\n self.postal_code=hash[:zip]\n self.country=hash[:country]\n end", "def spoofForm(val)\n @deltaflag = false\n @form = val\n end", "def save_form_fields\n @save_form_fields ||= collect_save_form_fields\n end", "def accounting_validation_state\n super\n end", "def form_data?; end", "def ing_form; end", "def reset\n\t\tself.log.debug \"Resetting validation state.\"\n\t\t@validated = false\n\t\t@valid = {}\n\t\t@parsed_params = nil\n\t\t@missing = []\n\t\t@unknown = []\n\t\t@invalid = {}\n\tend", "def form_fields=(fields)\n @form_fields = ::ActiveSupport::HashWithIndifferentAccess.new fields\n end", "def form; end", "def dynamic_initial_state?; end", "def update_form\n if !active_form.empty?\n session[:active_form_changed?] = false\n session[:active_form_errors] = Hash.new\n session[:active_form_error_flags] = Hash.new\n for field in active_form do\n old_value = field[:value]\n new_value = params[:\"#{field[:name]}\"]\n error = false\n# if old_value != new_value\n# require 'ruby-debug'\n# debugger\n# end\n # do validations\n if field[:required] && new_value == '' && field[:validation] != 'new_password'\n add_error(field[:name], t.u.error_required_field, 'missing')\n error = true\n elsif field[:validation] != nil && new_value != old_value # only validate fields that have changed.\n # we support email[, unique], username[, unique], password or username_or_email validation\n fv = field[:validation]\n case\n when fv.start_with?('email')\n if !validate_email(new_value)\n add_error(field[:name], t.u.error_invalid_email(new_value), 'invalid')\n error = true\n end\n if fv.end_with?('unique') && !validate_email_is_unique(new_value)\n add_error(field[:name], t.u.error_email_clash(new_value), 'unique')\n error = true\n end\n when fv.start_with?('username') && fv != 'username_or_email'\n if !validate_username(new_value)\n add_error(field[:name], t.u.error_invalid_username, 'invalid')\n error = true\n end\n if fv.end_with?('unique') && !validate_username_is_unique(new_value)\n add_error(field[:name], t.u.error_username_clash(new_value), 'unique')\n error = true\n end\n when fv.start_with?('role')\n if !validate_role_name(new_value)\n add_error(field[:name], t.u.error_invalid_role, 'invalid')\n error = true\n end\n if fv.end_with?('unique') && !validate_role_name_is_unique(new_value)\n add_error(field[:name], t.u.error_dupe_role_name(new_value), 'unique')\n error = true\n end\n when fv == 'password'\n if !validate_password(new_value)\n add_error(field[:name], t.u.error_invalid_password, 'invalid')\n error = true\n end \n when fv == 'new_password'\n return true unless new_value != ''\n if !validate_password(new_value)\n add_error(field[:name], t.u.error_invalid_new_password, 'invalid')\n error = true\n end\n when fv == 'username_or_email'\n if !(validate_username(new_value) || validate_email(new_value))\n add_error(field[:name], t.u.error_invalid_username_or_email, 'invalid')\n error = true\n end \n else\n # we don't recognise any other validations right now.\n end\n end\n\n if !error\n # update the field value\n field[:value] = new_value unless field[:type] == 'password' && new_value == ''\n \n # set the changed flag\n session[:active_form_changed?] ||= old_value != new_value\n end\n end\n end\n end", "def fields\n @fields ||= form.fields\n end", "def form_attributes\n attributes - read_only_attributes\n end", "def save_values\n self.first_name = @first_name_field.text.strip.chomp\n self.last_name = @last_name_field.text.strip.chomp\n self.email = @email_field.text.strip.chomp\n self.github = @github_field.text.strip.chomp\n self.twitter = @twitter_field.text.strip.chomp\n self.fun_fact = @fun_fact_field.text.strip.chomp\n\n # TODO: 2. Finish the implementation to set the other fields. DONE\n end", "def fields reload = false\n\t\t\t@fields = false if reload\n\t\t\t@fields ||= RealEstate.get_fields self\n\t\tend", "def get_initial_state\n {\n form_model: props.menu_item_to_edit\n }\n end", "def form_fields\n params\n end", "def required_state(opts)\n opts = check_params(opts,[:field_names])\n super(opts)\n end", "def set_old_values\n self._old_values = {}\n\n self.class.fields.each do |field|\n self._old_values[field] = self.send(field) unless field[0] == '_'\n end\n end", "def save_values\n self.first_name = @first_name_field.text.strip.chomp\n self.last_name = @last_name_field.text.strip.chomp\n self.email = @email_field.text.strip.chomp\n self.github = @github_field.text.strip.chomp\n self.twitter = @twitter_field.text.strip.chomp\n self.fun_fact = @fun_fact_field.text.strip.chomp\n # self.preferred_text_editor = @preferred_text_editor.text.strip.chomp\n # self.teaching_experience = @teaching_experience.text.strip.chomp\n # TODO: 2. Finish the implementation to set the other fields.\n end", "def get_form_vars\n @sm = @edit[:sm_id] ? StorageManager.find_by_id(@edit[:sm_id]) : StorageManager.new\n\n @edit[:new][:name] = params[:name] if params[:name]\n @edit[:new][:hostname] = params[:hostname] if params[:hostname]\n @edit[:new][:ipaddress] = params[:ipaddress] if params[:ipaddress]\n @edit[:new][:port] = params[:port] if params[:port]\n @edit[:new][:sm_type] = params[:sm_type] if params[:sm_type]\n # @edit[:new][:agent_type] = params[:agent_typ] if params[:agent_typ]\n @edit[:new][:zone] = params[:server_zone] if params[:server_zone]\n\n @edit[:new][:userid] = params[:userid] if params[:userid]\n @edit[:new][:password] = params[:password] if params[:password]\n @edit[:new][:verify] = params[:verify] if params[:verify]\n restore_password if params[:restore_password]\n set_verify_status\n end", "def form_setup\n\tend", "def handle_inputs\n collect_inputs(form_model: :post)\n\n if state.post.has_errors?\n set_state post: state.post\n else\n state.post.create.then do |post|\n if post.has_errors?\n set_state post: post\n else\n $HISTORY.pushState(nil, \"/posts/#{post.id}\")\n end\n end\n end\n end", "def from_form\n @from_form ||= fields.map { |field| form.__send__(field) }\n end", "def forms; end", "def discard_saved_state\n end", "def save_values\n self.first_name = @first_name_field.text.strip.chomp\n self.last_name = @last_name_field.text.strip.chomp\n self.age = @age.text.strip.chomp\n self.email = @email.text.strip.chomp\n self.github = @github.text.strip.chomp\n self.twitter = @twitter.text.strip.chomp\n self.fun_fact = @fun_fact.text.strip.chomp\n puts self.first_name\n puts self.last_name\n puts self.age\n\n # TODO: 2. Finish the implementation to set the other fields.\n end", "def post_initialize_fields\n end", "def clear_fields\n\t\tend", "def prov_get_form_vars\n if params[:ids_checked] # User checked/unchecked a tree node\n ids = params[:ids_checked]\n # for some reason if tree is not expanded clicking on radiobuttons this.getAllChecked() sends up extra blanks\n @edit.store_path(:new, tag_symbol_for_workflow, ids.select(&:present?).collect(&:to_i))\n end\n id = params[:ou_id].gsub(/_-_/, \",\") if params[:ou_id]\n @edit[:new][:ldap_ous] = id.match(/(.*)\\,(.*)/)[1..2] if id # ou selected in a tree\n\n copy_params_if_present(@edit[:new], params, %i[start_hour start_min])\n @edit[:new][:start_date] = params[:miq_date_1] if params[:miq_date_1]\n @edit[:new][:schedule_time] = Time.zone.parse(\"#{@edit[:new][:start_date]} #{@edit[:new][:start_hour]}:#{@edit[:new][:start_min]}\")\n\n params.each do |key, _value|\n next unless key.include?(\"__\")\n\n d, f = key.split(\"__\") # Parse dialog and field names from the parameter key\n field = @edit[:wf].get_field(f.to_sym, d.to_sym) # Get the field hash\n val =\n case field[:data_type] # Get the value, convert to integer or boolean if needed\n when :integer\n params[key].to_i\n when :boolean\n params[key].to_s == \"true\"\n else\n params[key]\n end\n\n if field[:values] # If a choice was made\n if field[:values].kind_of?(Hash)\n # set an array of selected ids for security groups field\n if f == \"security_groups\"\n if params[key] == \"\"\n @edit[:new][f.to_sym] = [nil]\n else\n @edit[:new][f.to_sym] = []\n params[key].split(\",\").each { |v| @edit[:new][f.to_sym].push(v.to_i) }\n end\n elsif f == \"cloud_volumes\"\n if params[key] == \"\"\n @edit[:new][f.to_sym] = [nil]\n else\n @edit[:new][f.to_sym] = []\n params[key].split(\",\").each { |v| @edit[:new][f.to_sym].push(v) }\n end\n else\n @edit[:new][f.to_sym] = [val, field[:values][val]] # Save [value, description]\n end\n else\n field[:values].each do |v|\n evm_object_class = v.try(:evm_object_class)\n if evm_object_class == :Storage\n if %w[miq_template service_template vm].include?(@edit[:org_controller])\n if params[key] == \"__DS__NONE__\" # Added this to deselect datastore in grid\n @edit[:new][f.to_sym] = [nil, nil] # Save [value, description]\n elsif v.id.to_i == val.to_i\n @edit[:new][f.to_sym] = [val, v.name] # Save [value, description]\n end\n elsif params[key] == \"__DS__NONE__\" # Added this to deselect datastore in grid\n @edit[:new][f.to_sym] = [] # Save [value, description]\n elsif v.id.to_i == val.to_i\n if @edit[:new][f.to_sym].include?(val)\n @edit[:new][f.to_sym].delete_if { |x| x == val }\n else\n @edit[:new][f.to_sym].push(val) # Save [value, description]\n end\n end\n elsif evm_object_class == :Host\n if params[key] == \"__HOST__NONE__\" # Added this to deselect datastore in grid\n @edit[:new][f.to_sym] = [nil, nil] # Save [value, description]\n elsif v.id.to_i == val.to_i\n @edit[:new][f.to_sym] = [val, v.name] # Save [value, description]\n end\n elsif evm_object_class == :Vm\n if params[key] == \"__VM__NONE__\" # Added this to deselect datastore in grid\n @edit[:new][f.to_sym] = [nil, nil] # Save [value, description]\n elsif v.id.to_i == val.to_i\n @edit[:new][f.to_sym] = [val, v.name] # Save [value, description]\n end\n elsif evm_object_class == :PxeImage || evm_object_class == :WindowsImage\n if params[key] == \"__PXE_IMG__NONE__\" # Added this to deselect datastore in grid\n @edit[:new][f.to_sym] = [nil, nil] # Save [value, description]\n elsif v.id == val\n @edit[:new][f.to_sym] = [val, v.name] # Save [value, description]\n end\n elsif evm_object_class == :IsoImage\n if params[key] == \"__ISO_IMG__NONE__\" # Added this to deselect datastore in grid\n @edit[:new][f.to_sym] = [nil, nil] # Save [value, description]\n elsif v.id == val\n @edit[:new][f.to_sym] = [val, v.name] # Save [value, description]\n end\n elsif evm_object_class == :CustomizationTemplate\n if params[key] == \"__TEMPLATE__NONE__\" # Added this to deselect datastore in grid\n @edit[:new][f.to_sym] = [nil, nil] # Save [value, description]\n elsif v.id.to_i == val.to_i\n @edit[:new][f.to_sym] = [val, v.name] # Save [value, description]\n end\n elsif evm_object_class == :CustomizationSpec\n if params[key] == \"__VC__NONE__\" # Added this to deselect custom_spec in grid\n @edit[:new][f.to_sym] = [nil, nil] # Save [value, description]\n elsif v.id.to_i == val.to_i\n @edit[:new][f.to_sym] = [val, v.name] # Save [value, description]\n end\n elsif v[1].to_i == val.to_i\n @edit[:new][f.to_sym] = [val, v[0]] # Save [value, description]\n end\n end\n end\n begin\n @edit[:wf].refresh_field_values(@edit[:new])\n rescue StandardError => bang\n add_flash(bang.message, :error)\n @edit[:new][f.to_sym] = val # Save value\n # No need to refresh dialog divs\n return false\n else\n return true\n end\n else\n @edit[:new][f.to_sym] = val # Save value\n # No need to refresh dialog divs\n return false\n end\n end\n end", "def revalidate( params={} )\n\t\tmerged_fields = self.fields.merge( params )\n\t\tself.reset\n\t\tself.validate( merged_fields )\n\tend", "def form_fields\n values = super\n result = {}\n mappings.values.each { |field|\n result[field] = values[field] if values[field]\n }\n result\n end", "def injection_form\n # Nothing to do here\n end", "def set_initial_state\n self.check_in_current = false\n self.days_completed = 0\n self.days_remaining = self.days_to_complete \n self.current_day = 1\n self.active = true\n self.save\n end", "def form_fields\n [:description, :status, :magic]\n end", "def setup_form\n build_form\n super\n end", "def lockdown state, *fields\n fields.each do |field|\n define_method(\"#{ field }=\") do |value|\n unless self.send(\"#{state}?\")\n self.write_attribute(field, value) \n end\n end\n end\n end", "def form_field_data\n @attributes[:form_field_data]\n end", "def get_entered_fields\n @entered_fields = get_used_fields_only(@contact_form_field)\n @entered_fields\n end", "def form\n end", "def read_state\n end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def reset_fields\n each_field_name do |key|\n reset_field(key)\n end\n end", "def reset(*)\n super.tap do\n # noinspection RailsParamDefResolve\n try(:initialize_state, submission.params, **{}) if simulating\n end\n end", "def fill_out_form(hash)\n self.main_title=hash[:main_title]\n self.main_author=hash[:main_author]\n self.co_authors=hash[:co_authors]\n self.publisher=hash[:publisher]\n self.place_of_publication=hash[:place]\n self.volume_title=hash[:volume_title]\n self.volume_information=hash[:volume_info]\n self.year=hash[:year]\n self.number=hash[:number]\n self.series_title=hash[:series]\n self.url=hash[:url]\n end", "def reset_initial_values\n @initial_values.clear if @initial_values\n @missing_initial_values.clear if @missing_initial_values\n end", "def fields\n @_fields ||= {}\n end", "def validate_state(state = {}); end", "def validate_state(state = {}); end", "def reset!\n self.user_values = {}\n\n # @inputs have to be nil, not an empty hash. otherwise\n # the memoized inputs will not pick up the changes.\n @inputs = nil\n end", "def form_field_changed\n return unless load_edit(\"sm_edit__#{params[:id]}\")\n get_form_vars\n changed = (@edit[:new] != @edit[:current])\n\n render :update do |page|\n page << javascript_prologue\n if changed != session[:changed]\n session[:changed] = changed\n page << javascript_for_miq_button_visibility(changed)\n end\n if @edit[:default_verify_status] != session[:verify_sm_status]\n session[:verify_sm_status] = @edit[:default_verify_status]\n if @edit[:default_verify_status]\n page << \"miqValidateButtons('show', 'default_');\"\n else\n page << \"miqValidateButtons('hide', 'default_');\"\n end\n end\n end\n end", "def state\n end", "def configsyncd_state(opts)\n opts = check_params(opts,[:field_names])\n super(opts)\n end", "def save_form(values)\n mp values\n persist\n\n back_to_previous_screen\n end", "def verification_state\n super\n end", "def enter_state\n end", "def changed?; not pristine?; end", "def pre_initialize_fields\n end", "def set_stateform\n @stateform = Stateform.find(params[:id])\n end", "def update_form_fields\n \n available_provinces = Ngo.find(:all, :select => \"distinct province_id\").map{|ngo| ngo.province_id}\n available_districts = Ngo.find(:all, :select => \"distinct district_id\").map{|ngo| ngo.district_id}\n\n if params.member?(:advanced) and (!params[:advanced][:countries].nil? or !params[:advanced][:provinces].nil? or !params[:advanced][:districts].nil?)\n params[:advanced][:countries].nil? ? country_ids = [] : country_ids = params[:advanced][:countries].collect{|id| id.to_i}\n params[:advanced][:provinces].nil? ? province_ids = [] : province_ids = params[:advanced][:provinces].collect{|id| id.to_i}\n params[:advanced][:districts].nil? ? district_ids = [] : district_ids = params[:advanced][:districts].collect{|id| id.to_i}\n else\n country_ids = []\n province_ids = []\n district_ids = []\n @provinces = []\n @districts = []\n end\n \n unless country_ids.empty?\n @provinces = Province.find(:all, :conditions => [\"country_id IN (?) and id in (?)\", country_ids, available_provinces], :order => \"name\")\n end\n unless province_ids.empty?\n @districts = District.find(:all, :conditions => [\"province_id IN (?) and id in (?)\", province_ids, available_districts], :order => \"name\")\n else\n @districts = District.find(:all, :conditions => [\"country_id IN (?) and id in (?)\", country_ids, available_districts], :order => \"name\")\n end\n\n render :partial => \"list_provinces_districts\", :locals => {:provinces => @provinces, :districts => @districts, :selected_provinces => province_ids, :selected_districts => district_ids}\n \n end", "def _before_validation\n serialize_deserialized_values\n super\n end", "def form_enter type, valid_attributes\r\n valid_attributes.each { |field,value| form.send(\"#{type}[#{field}]=\",value)}\r\nend", "def reset_fields\n self.outpost_queued = false\n # outpost_prevent is set and reset at end of previous turn\n # pirate_coins persists turn after turn\n self.gained_last_turn = []\n self.bought_victory = false\n self.played_treasure = false\n self.played_crossroads = false\n self.played_fools_gold = false\n save!\n end", "def prepare_customer_form\n prepopulate_customer_info\n @membership_order = Membership.find(session[:current_premium_id]) if session[:current_premium_id]\n @referral = ReferralCategory.order(\"id ASC\")\n prepare_price\n end", "def fill_all_form_data()\n if verbose_messages\n p @fillable_form_fields\n p @current_page_data_object\n end\n\n @fillable_form_fields.each do |field|\n value = @current_page_data_object.retrieve_data_for(field)\n enter_element_value(field, value) if value and (value != \"nil\")\n end\n end", "def set_duration\n #These need to be passed on to recreate the original form should cancel then set be pressed\n @object_name = params[:object_name]\n @field_name = params[:field_name]\n @optional = params[:optional]\n @prefix = params[:prefix]\n end", "def from_states; end", "def from_states; end", "def required_fields\n @required_fields.dup\n end", "def originalsourceform; end", "def clean_up\n @minefield = nil\n end", "def new_wizard_selection\n init_variables_from_sessions\n end", "def fbo_updated_form\n end", "def form_data\n @form_data ||= {\n \"c\" => [\"China\", \"Venezuela\", \"Brazil\", \"United States\", \"Thailand\", \"Ukraine\", \"Indonesia\", \"Nepal\", \"Russian Federation\", \"Argentina\", \"Czech Republic\", \"Korea, Republic of\", \"Colombia\", \"France\", \"Bangladesh\", \"Ghana\", \"Peru\", \"Slovakia\", \"Taiwan\", \"Hong Kong\", \"Taiwan\", \"Bulgaria\", \"Canada\", \"Netherlands\", \"Bolivia\", \"Serbia\", \"Azerbaijan\", \"Costa Rica\", \"Viet Nam\", \"Germany\", \"South Africa\", \"Iraq\", \"Italy\", \"Egypt\", \"Poland\", \"Chile\", \"Paraguay\", \"Australia\", \"Hungary\", \"Cambodia\", \"Europe\"],\n \"p\" => nil,\n \"pr\" => [0],\n \"a\" => [2,3,4],\n \"sp\" => [2,3],\n \"ct\" => [2,3],\n \"s\" => 0,\n \"o\" => 0,\n \"pp\" => 2,\n \"sortBy\" => \"date\"\n }\n end", "def extra_state; end", "def stateform_params\n params.require(:stateform).permit(:date, :tax, :time_type, :income,:status ,:state )\n end", "def update_from_form_fields params\n @answer_names = params.delete(:answer_names)\n @answer_abbrs = params.delete(:answer_abbrs)\n puts \"@answer_abbrs: #{@answer_abbrs.inspect}\"\n begin\n params[:answers] = Poll.get_answers_from_form_fields( @answer_names.dup, @answer_abbrs.dup )\n puts \"@answer_abbrs: #{@answer_abbrs.inspect}\"\n rescue AnswerValidationError\n errors.add( :answer, $!.to_s )\n return false\n end\n update_attributes(params)\n end", "def validate\n # first check whether combo fields have been selected\n is_valid = true\n end", "def set_form_vars\n @edit = {}\n @edit[:sm_id] = @sm.id\n @edit[:key] = \"sm_edit__#{@sm.id || \"new\"}\"\n @edit[:new] = {}\n @edit[:current] = {}\n\n @edit[:new][:name] = @sm.name\n @edit[:sm_types] = StorageManager.storage_manager_types\n @edit[:new][:hostname] = @sm.hostname\n @edit[:new][:ipaddress] = @sm.ipaddress\n @edit[:new][:port] = @sm.port\n @edit[:new][:sm_type] = @sm.type_description\n # @edit[:new][:agent_type] = @sm.agent_type\n if @sm.zone.nil? || @sm.my_zone == \"\"\n @edit[:new][:zone] = \"default\"\n else\n @edit[:new][:zone] = @sm.my_zone\n end\n @edit[:server_zones] = []\n zones = Zone.all\n zones.each do |zone|\n @edit[:server_zones].push(zone.name)\n end\n\n @edit[:new][:userid] = @sm.authentication_userid\n @edit[:new][:password] = @sm.authentication_password\n @edit[:new][:verify] = @sm.authentication_password\n\n session[:verify_sm_status] = nil\n set_verify_status\n\n @edit[:current] = @edit[:new].dup\n session[:edit] = @edit\n end", "def validate\n#\tfirst check whether combo fields have been selected\n is_valid = true\n end", "def validate\n#\tfirst check whether combo fields have been selected\n is_valid = true\n end", "def failsafe_state\n super\n end", "def form_data_initialize(form)\n form = form_generation(form)\n form = 0 unless GameData::Pokemon.all[id][form]\n @form = form\n exp_initialize\n end", "def form_field_changed\n return unless load_edit(\"ems_edit__#{params[:id]}\")\n get_form_vars\n\n changed = edit_changed?\n render :update do |page|\n page << javascript_prologue\n if params[:server_emstype] || params[:default_security_protocol] # Server/protocol type changed\n page.replace_html(\"form_div\", :partial => \"shared/views/ems_common/form\")\n end\n if params[:server_emstype] # Server type changed\n unless @ems.kind_of?(ManageIQ::Providers::CloudManager)\n # Hide/show C&U credentials tab\n page << \"$('#metrics_li').#{params[:server_emstype] == \"rhevm\" ? \"show\" : \"hide\"}();\"\n end\n if [\"openstack\", \"openstack_infra\"].include?(params[:server_emstype])\n page << \"$('#port').val(#{j_str(@edit[:new][:port].to_s)});\"\n end\n # Hide/show port field\n page << \"$('#port_tr').#{%w(openstack openstack_infra rhevm).include?(params[:server_emstype]) ? \"show\" : \"hide\"}();\"\n end\n page << javascript_for_miq_button_visibility(changed)\n if @edit[:default_verify_status] != @edit[:saved_default_verify_status]\n @edit[:saved_default_verify_status] = @edit[:default_verify_status]\n page << \"miqValidateButtons('#{@edit[:default_verify_status] ? 'show' : 'hide'}', 'default_');\"\n end\n if @edit[:metrics_verify_status] != @edit[:saved_metrics_verify_status]\n @edit[:saved_metrics_verify_status] = @edit[:metrics_verify_status]\n page << \"miqValidateButtons('#{@edit[:metrics_verify_status] ? 'show' : 'hide'}', 'metrics_');\"\n end\n if @edit[:amqp_verify_status] != @edit[:saved_amqp_verify_status]\n @edit[:saved_amqp_verify_status] = @edit[:amqp_verify_status]\n page << \"miqValidateButtons('#{@edit[:amqp_verify_status] ? 'show' : 'hide'}', 'amqp_');\"\n end\n if @edit[:bearer_verify_status] != @edit[:saved_bearer_verify_status]\n @edit[:saved_bearer_verify_status] = @edit[:bearer_verify_status]\n page << \"miqValidateButtons('#{@edit[:bearer_verify_status] ? 'show' : 'hide'}', 'bearer_');\"\n end\n end\n end", "def form_field_params\n params[:form_field]\n end", "def reset_state\n @state = nil\n end", "def fill_in_form(fields)\n fields.each do |field, value|\n f = send(\"#{field}_field\")\n f.set(value) || Array(value).each { |val| f.select(val) }\n end\n end", "def form_fields(pairs: nil, **opt)\n fields = AccountConcern::PASSWORD_KEYS\n fields = fields.excluding(:current_password) if manager? || administrator?\n added = fields.map { |k| [k.to_s.titleize, k] }.to_h\n pairs = pairs&.merge(added) || added\n super\n end", "def restore_state(data_grid)\n if cookies[\"data_grid_state_#{data_grid.name}\"]\n state = Marshal.load(cookies[\"data_grid_state_#{data_grid.name}\"])\n STATE_KEYS.each do |key|\n data_grid.send(\"#{key}=\", state[key])\n end\n \n if state[:columns]\n state[:columns].each_pair do |k, v|\n data_grid.columns[k.to_i].filter_value = v if data_grid.columns[k.to_i]\n end\n end\n end\n end", "def reset!\n defaults = Settler.config[self.key]\n self.label = defaults['label']\n self.value = defaults['value']\n self.editable = defaults['editable']\n self.deletable = defaults['deletable']\n self.deleted = false\n save(:validate => false)\n end", "def add_field\n if request.get?\n @info = Hash.new\n @field_hash = Hash.new\n session[:count] = 1\n else\n @fields = []\n @field_hash = Hash.new\n session[:field_hash] = @field_hash\n form = DynamicForm.find(session[:form_id])\n @info = params[:info]\n if form.fields == \"To be Filled\"\n logger.info 'FIELDS TO BE FILLED'\n form.fields = {}\n else\n @fields = YAML::load(form.fields)\n logger.info \"Loading YAML {line 92}\"\n end \n @fields << @info\n form.fields = @fields.to_yaml\n form.save\n logger.info \"Returned: #{@info}\"\n redirect_to :action => 'add_fields'\n end\n end", "def reset\n @state = :entry\n end", "def forgets\n update_attribute(:remember_digest, nil)\n end", "def form_steps\n self.steps\n end" ]
[ "0.5688627", "0.56832045", "0.5652936", "0.56302154", "0.5623749", "0.55907655", "0.5561478", "0.5555948", "0.55494946", "0.5539554", "0.5538534", "0.552025", "0.55131406", "0.54676306", "0.5460865", "0.54600203", "0.5456774", "0.5435379", "0.5429336", "0.5402344", "0.53744596", "0.53631467", "0.5326617", "0.5311712", "0.5306226", "0.5289327", "0.5286941", "0.52595824", "0.52537394", "0.52524614", "0.52504826", "0.5223242", "0.52175206", "0.51879144", "0.5184941", "0.5179882", "0.51671207", "0.5165341", "0.51500857", "0.5148843", "0.5135852", "0.512364", "0.512364", "0.512364", "0.512364", "0.512364", "0.512364", "0.512364", "0.512364", "0.51203364", "0.5119584", "0.51193243", "0.5102468", "0.50588435", "0.5051323", "0.5051323", "0.50483364", "0.5046283", "0.50239944", "0.5019694", "0.50129074", "0.5010915", "0.50011206", "0.49941307", "0.49924552", "0.49916896", "0.49895114", "0.49882713", "0.49807197", "0.49734843", "0.4965688", "0.49617642", "0.4956387", "0.49557462", "0.49557462", "0.49423873", "0.4935485", "0.49268955", "0.49267423", "0.49251515", "0.49224028", "0.4919237", "0.49114397", "0.4902244", "0.4901984", "0.48865685", "0.48844284", "0.48844284", "0.48817807", "0.48816624", "0.4879101", "0.487812", "0.4875366", "0.4874586", "0.4872784", "0.48687384", "0.4858412", "0.4848728", "0.48441935", "0.4842879", "0.4841368" ]
0.0
-1
log to the UserHistory table
def log(notes) @uh_log ||= UserHistory.new @uh_log.log(self, notes) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def history\n\t\t@user.show_log\n\tend", "def set_user_history_record\n @user_history_record = UserHistoryRecord.find(params[:id])\n end", "def index\n @user = User.find(current_user.id)\n @history_logs = @user.history_logs\n end", "def history_log (event, options={})\n\n source = options.delete(:source) || current_user.login\n\n OpenWFE::Extras::HistoryEntry.log!(source, event, options)\n end", "def history_log (event, options={})\n fname= \"#{self.class.name}.#{__method__}\"\n source = options.delete(:source) || @current_user.login\n #LOG.debug (fname){\"history_log:source=#{source}\"}\n \t#LOG.debug (fname){\"history_log:options=#{options}\"}\n Ruote::Sylrplm::HistoryEntry.log!(source, event, options)\n end", "def record_history\n history_user_absent_action if history_user_id.nil?\n\n attrs = attributes.clone\n history_class = self.class.history_class\n foreign_key = history_class.history_foreign_key\n\n now = UTC.now\n attrs.merge!(foreign_key => attrs['id'], history_started_at: now, history_user_id: history_user_id)\n\n attrs = attrs.except('id')\n\n current_history = histories.where(history_ended_at: nil).order('id desc').limit(1).last\n\n if foreign_key.present? && history_class.present?\n history_class.create!(attrs)\n current_history.update!(history_ended_at: now) if current_history.present?\n else\n raise 'Need foreign key and history class to save history!'\n end\n end", "def set_user_activity_history\n @user_activity_history = UserActivityHistory.find(params[:id])\n end", "def set_history_log\n @history_log = HistoryLog.find(params[:id])\n end", "def history_log(type, user_id, attributes = {})\n\n attributes.merge!(\n o_id: self['id'],\n history_type: type,\n history_object: self.class.name,\n related_o_id: nil,\n related_history_object: nil,\n updated_at: updated_at,\n created_at: updated_at,\n ).merge!(history_log_attributes)\n\n SygiopsSupport::History.add(attributes)\n end", "def history_create\n # history_log('created', created_by_id)\n end", "def add_to_log\n user_name = self.user.name || self.user.email.split('@')[0]\n Log.create!(loggingtype: 2,user_id_1: self.user.id ,user_id_2: nil,admin_id: nil,story_id: self.story.id ,interest_id: nil,message: (user_name+\" commented on \\\"\" + self.story.title + \"\\\" with \\\"\" + self.content + \"\\\"\").to_s )\n Admin.push_notifications \"/admins/index\" ,\"\"\n end", "def set_user_log\n @user_log = current_user.user_logs.where(id: params[:id]).first\n end", "def history\n # How do I make a specific person's history page load?\n current_user# Calls the current_user method in application_controller\n # which returns @current_user\n end", "def write_history; end", "def create_history\n if (signed_in? && !params[:q].blank?)\n user = User.find(current_user.id)\n puts current_user.id\n user.searches.create( user_id: user.id,searches: params[:q])\n end\n end", "def history\r\n\r\n end", "def login_user_by_id(user_id)\r\n session[:user_id] = user_id\r\n logger.debug(\"Setting session id to #{session[:user_id]}\")\r\n AuditLog.create(:user_id => user_id, :action => \"Logged in\")\r\n end", "def history\n @history ||= @repository.log(30, nil, path)\n end", "def record_user_activity\n current_user.touch :last_active_at if current_user\n end", "def set_history\n @history = History.find(params[:id])\n end", "def set_history\n @history = History.find(params[:id])\n end", "def set_history\n @history = History.find(params[:id])\n end", "def logall(user)\n self.changes.each do |key, value|\n if key != \"updated_at\" then\n name = self.class.name + \" #{key}\"\n \n logthis(user, name, self.id, value[0], value[1])\n end\n end\n end", "def log_recent_drink_today(current_user, userdrink)\n new_userdrink_with_recent_drink = UserDrink.create(\n datetime: Time.now,\n amount: userdrink.amount,\n drink_id: userdrink.drink_id,\n user_id: current_user.id\n ) \n homescreen(current_user.reload)\nend", "def write_history\n date = Time.now.send(\"beginning_of_#{self.class.config[:delete_from]}\") # ustawia okres w ktorym usuwamy stara historie. domyslnie jeden dzień\n self.send(self_class_name+'_histories').find_all_from_beginning_date(date).each {|ch| ch.destroy } if self.has_history_from?(date)\n \"History::#{self_class_name.camelize}History\".constantize.new(:date => Time.now, :owner => self, :value => self).save\n end", "def log_entries\n @user = User.find(params[:id])\n @log_entries = LogEntry.where(:user_id => @user.id).page(params[:page] || 1)\n end", "def history=(value)\n @history = value\n end", "def history=(value)\n @history = value\n end", "def log_user_recent_route\n @sessions_current_user.add_page_to_recent(request.fullpath) if @sessions_current_user\n end", "def save_log(description, action, owner_user_id)\n Log.save_log(description, action, owner_user_id, me.id)\n end", "def set_history\n @history = History.find(params[:id])\n end", "def new\n redirect_to root_path unless current_user.is_admin?\n @user = User.create!(:email => \"test1234@gmail.com\", :password => \"test123\")\n @cuser = current_user\n @log = Log.new\n @log.update_attributes(user: @user.email, userid: @user.id, updated_by: @cuser)\n redirect_to edit_user_path(@user)\n end", "def log_activity(at, action = nil)\n unless activity_log\n update_attributes(:activity_log => ActivityLog.create(:user => self))\n end\n activity_log.add(at, action)\n end", "def save\n @user.searches << searches_from_history.find(params[:id])\n if @user.save\n go_back notice: I18n.t('blacklight.saved_searches.add.success')\n else\n go_back error: I18n.t('blacklight.saved_searches.add.failure')\n end\n end", "def log_history\n logger.info('[]' + request.method + \"\\t\" + request.fullpath + \"\\t\" + request.remote_ip + \"\\t\" + Time.now.strftime('%Y-%m-%d %H:%M:%S'))\n end", "def write_log( user = User.anonymous )\n options = { :user => user, :ip_address => user.ip_address }\n @changed_attributes.each do |a, v|\n options[:attribute] = a\n options[:old_value] = v.first\n options[:new_value] = v.last\n self.related_object.log_entries.create options unless options[:old_value].nil?\n end unless @changed_attributes.nil?\n end", "def log_activity(user_id)\n $redis.zadd(activity_key, Time.now.to_i, user_id)\n end", "def set_admin_account_history\n @admin_account_history = AccountHistory.find(params[:id])\n end", "def log_activity\n BgJob.enqueue(\n UserActivityLogJob,\n {\n client_id: @client_id,\n user_id: @user_kyc_detail.user_id,\n admin_id: @admin.id,\n action: GlobalConstant::UserActivityLog.update_ethereum_address,\n action_timestamp: Time.now.to_i,\n extra_data: {\n case_id: @case_id,\n old_encrypted_u_e_d_ethereum_address: @old_ethereum_address,\n old_md5_ethereum_address: @old_md5_ethereum_address\n }\n }\n )\n end", "def log_user_event\n\n depositor.log_profile_event(event)\n end", "def history\n command = AccountHistory.call(@current_user)\n if command.success?\n @history = command.result\n render 'history.json.jbuilder', status: :ok\n else\n render json: {error: command.errors}, status: :bad_request\n end\n end", "def history\n @history ||= PublicEarth::Db::History.many.descriptive_changes_by_user(self.id)\n end", "def set_history\n @history = History.find(params[:id])\n end", "def set_history\n @history = History.find(params[:id])\n end", "def set_admin_history\n @admin_history = Admin::History.find(params[:id])\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 set_work_history\n \n @work_history = WorkHistory.find(params[:id])\n authorize @work_history\n end", "def user_log(id, login, user)\n if login \n @children = Child.find(id)\n if @children.user_id == nil\n @children.update_attributes(:user_id => user.id)\n end ## if @children.user_id\n end ## if login\n @children\n end", "def set_work_history\n \n @work_history = WorkHistory.find(params[:id])\n @employee = Employee.find(params[:employee_id])\n skip_authorization\n end", "def log_user_event\n depositor.log_profile_event(event)\n end", "def history(user=nil)\n \t\traise RuntimeError, 'user not set!' if user.nil? && @username.nil?\n \t\tuser ||= @username\n\n \t\tAPI.get_wordcount_history(user)\n \tend", "def report\n @user_id=Thermostat.find(params[:id].to_i).user_id\n if current_user.id == @user_id \n @history_thermostats = HistoryThermostat.all\n else\n redirect_to '/'\n end\n end", "def set_log_entry\n @log_entry = current_user.log_entries.find(params[:id])\n end", "def list_user_history(user_id:, page: nil, per_page: nil, start_at: nil)\n query = { user_id: user_id, page: page, per_page: per_page, start_at: start_at }.reject { |_, v| v.nil? }\n BrickFTP::API::History::User.all(query)\n end", "def list_user_history(user_id:, page: nil, per_page: nil, start_at: nil)\n query = { user_id: user_id, page: page, per_page: per_page, start_at: start_at }.reject { |_, v| v.nil? }\n BrickFTP::API::History::User.all(query)\n end", "def log_user_event\n depositor.log_event(event)\n end", "def save\n @user_id = @user_id.to_i\n @train_id = @train_id.to_i\n CONNECTION.execute(\"UPDATE logs SET user_id = '#{self.id}', train_id = '#{self.id} WHERE id = #{self.id};\")\n end", "def history; end", "def history; end", "def history; end", "def home\n # Get the history logs of all users that you follow or have public privacy\n @historyLog = HistoryLog.all\n @historyLog = @historyLog.order(created_at: :desc)\n @currUserFollowers = Follower.where(users_id: current_user.id)\n @historyLogs = @historyLog.select{|log| log.users_id == current_user.id || Preference.find_by(users_id: log.users_id) == nil || !Preference.find_by(users_id: log.users_id).privacy || @currUserFollowers.any?{|x| x.fTarget == log.users_id}}.take(10).to_a\n end", "def log(user_id, action, id1, id2, id3=nil)\n \n ul = Log.new\n \n if (action =~ /NEW_LIST(\\w+)$/)\n ul.list_id = id1\n end\n \n \n \n if (action =~ /NEW_FEATURE_(\\w+)$/) or action == \"VOTE_UP\" or action == \"VOTE_DOWN\"\n ul.list_id = id1 \n ul.feature_id = id2\n end\n \n if(action =~ /NEW_COMMENT/)\n ul.list_id = id1\n ul.feature_id = id2\n ul.comment_id = id3\n \n end\n \n ul.datetime = Time.now\n ul.user_id = user_id\n ul.action = action\n ul.save\n end", "def persist_audits\n quoted_login = ActiveRecord::Base.connection.quote(self.login)\n Audited::Audit.where( 'user_type = ? AND user_id = ?', self.class.name, self.id ).update_all(username: quoted_login)\n end", "def log_transaction\n repo.log_action(user_name: @user.user_name, context: @context.context, route_url: @context.route_url)\n end", "def create\n @user = User.find(params[:user_id])\n # @log = @user.logs.create!(log_params)\n @log = @user.logs.create!\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to user_logs_url, notice: 'Log was successfully created.' }\n format.json { render :show, status: :created, location: @log }\n else\n format.html { render :new }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_to_database\n if self.unique?\n CONNECTION.execute(\"INSERT INTO logs (user_id, train_id) VALUES (#{self.user_id}, #{self.train_id});\")\n @id = CONNECTION.last_insert_row_id\n \n return self\n end\n end", "def add_to_history(page); end", "def loggin_opc(puser, pcontroller, paction, pcomment)\n #para que no haga logging de clicks de navegacion\n if pcontroller == 'home'\n\t\treturn\n else\n\t logmodel = Logeclubapi.new\n\t logmodel.login = puser.login\n\t logmodel.username = puser.name\n\t logmodel.log_option = pcontroller\n\t logmodel.log_action = paction[0..9]\n\t logmodel.log_comment = pcomment\n\t logmodel.origin = 'W' #origen web\n\t #logmodel.save\n end\n end", "def index\n @user_activity_histories = UserActivityHistory.all\n end", "def create_log\n if Role.all.empty?\n unless UserSession.find == nil\n Log.create(user_id: UserSession.find.user.id, message: \n \"#{UserSession.find.user.name} har opprettet en ny rolle med navn: #{self.name}\",\n logtype_id: 2)\n end\n end\n end", "def history_added; end", "def log_access(user)\n if @access_log_field\n eval(\"user.#{@access_log_field} = Time.now\")\n user.save\n end\n end", "def log_activity\n #Activity.log_activity(self, self.commentable, 'commented', self.user_id)\n if self.user.facebook_omniauth\n Activity.create_log_for_each_friend(self, self.commentable, 'commented on' , self.user.facebook_omniauth.uid, self.user.display_name)\n end\n end", "def set_user_track_log\n @user_track_log = UserTrackLog.find(params[:id])\n end", "def save_history(turn_history)\n history = History.new\n history.game = self\n history.details = turn_history.join(' ')\n history.save\n end", "def run\n\t\t\tHistory::SQL.create(user_id: user, data: data)\n\t\t\tHistory::NoSQL.new(user).save(data.to_json)\n\n\t\t\tyield if block_given?\n\t\tend", "def color\n @users_from_history=User.all\n end", "def set_s_history\n @s_history = SHistory.find(params[:id])\n end", "def writeHistory()\n\t\t$target_stats.each do |k,v|\n\t\t\t@result.push({k=>v})\n\t\tend\n\tend", "def set_ownership_history\n @ownership_history = OwnershipHistory.find(params[:id])\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 delete_log\n unless UserSession.find == nil\n Log.create(user_id: UserSession.find.user.id, message: \n \"#{UserSession.find.user.name} har slettet rollen: #{self.name}\",\n logtype_id: 3)\n end\n end", "def init_history history\n\n history.set_editable false\n history.set_can_focus false\n history.set_justification 1\n\n end", "def did_log_in\n self.last_logged_in_at = DateTime.now\n self.class.execute_without_timestamps { save }\n end", "def log_action(action, user, record, model)\n begin\n # Create a new ActionLog Object\n event = ActionLog.new()\n \n # Add the user to this object\n event.user = user\n \n # Add the action to this object\n event.action = action\n \n # Save the model type and its record ID(s) to this object\n event.target = model.to_s + ':' + record.to_s\n \n # Save the time of the event\n event.time_of_action = (Time.now.getutc - 7*60*60).to_s.gsub('UTC','PST')\n \n # Save this event to database\n event.save!\n\n rescue => e\n \n end\n end", "def store_in_history\n if current = @history.current\n current.cursor = @info.index('insert')\n current.yview = @info.yview[0]\n end\n end", "def redirection_history; end", "def Auditlog( mo, msg )\n auditEntry = Audit.new\n auditEntry.message = \"#{mo} #{caller[0][/`.*'/][1..-2]} #{msg.inspect}\"\n #auditEntry.origin = ip\n auditEntry.origin = request.remote_ip\n auditEntry.user = !current_user.nil? ? current_user.email : 'no-user'\n auditEntry.datetime = DateTime.now\n\n if !auditEntry.save\n _auditLog.info \"#{user} #{ip} #{caller[0][/`.*'/][1..-2]} #{msg.inspect}\"\n end\n\n end", "def set_wallet_history\n @wallet_history = WalletHistory.find(params[:id])\n end", "def history=(_arg0); end", "def history=(_arg0); end", "def set_thermostat_history\n @thermostat_history = ThermostatHistory.find(params[:id])\n end", "def history_log_params\n end", "def interactive_history_forward e\n if not @history.at_end\n store_in_history\n @history.foreward\n restore_from_history\n end\n end", "def save_history(file=DEF_HISTORY_FILE)\n begin\n f = File.new(file, File::CREAT|File::TRUNC|File::RDWR, 0644)\n f.puts(@rundate)\n @currprocstat.each do |username,time|\n f.puts(\"#{username} #{time} #{@currprociowait[username]}\")\n end\n f.close\n rescue => e\n puts \"Cannot save history data: #{e}\"\n end\n end", "def history\n @payments = Payment.all.where(host: current_user).order(\"created_at DESC\")\n#just added, you need to show history and add a new colmn, wheter they were a host or player and show ALL history\n @payments = Payment.all.where(player: current_user).order(\"created_at DESC\")\n\n \n end", "def update_steps_history # rubocop:disable Metrics/AbcSize\n if history.nil?\n log_action('Creating first step into the back link history')\n session[:back_link_history] = { '1' => page }\n elsif last_step_page != page\n return clear_unused_steps if back_button && history\n\n log_action('Adding step to the back link history')\n session[:back_link_history][next_step] = page\n end\n end", "def history\n # blank\n end", "def set_transaction_history\n @transaction_history = TransactionHistory.find(params[:id])\n end", "def get_user_create_log(user = nil, title = nil, start = nil, stop = nil, limit = @query_limit_default)\n resp = get_log('newusers/create', user, title, start, stop, limit)\n\n ret = []\n resp['query']['logevents'].each do |log|\n ret << loghash_user(log)\n end\n\n ret\n end" ]
[ "0.7338501", "0.6987412", "0.67164034", "0.66679794", "0.640545", "0.6390004", "0.63898313", "0.6293106", "0.62419516", "0.61407214", "0.6101616", "0.6068252", "0.5948694", "0.5944313", "0.5932673", "0.59128094", "0.58401424", "0.58326113", "0.5818913", "0.5818301", "0.5818301", "0.5818301", "0.57955205", "0.5790814", "0.57829493", "0.57574314", "0.5757391", "0.5757391", "0.57530963", "0.57296777", "0.572188", "0.57206243", "0.5719066", "0.5707253", "0.57044166", "0.5697429", "0.56852686", "0.56839085", "0.5681369", "0.56730187", "0.5663393", "0.56499416", "0.56466115", "0.5645812", "0.56183124", "0.56172186", "0.5617159", "0.5616058", "0.5604292", "0.55986816", "0.55859554", "0.5572992", "0.5560568", "0.55540955", "0.5552896", "0.55505466", "0.55450726", "0.5543616", "0.5543616", "0.5543616", "0.5532534", "0.5530712", "0.5527686", "0.5508111", "0.5498996", "0.5479529", "0.54753584", "0.5448835", "0.54083353", "0.5404491", "0.5403946", "0.5399896", "0.53985095", "0.5391177", "0.53887117", "0.5377541", "0.53725815", "0.5369404", "0.5368024", "0.5363004", "0.53583467", "0.53476727", "0.53373015", "0.5336733", "0.53340614", "0.53281385", "0.53266656", "0.53239274", "0.5322653", "0.5303113", "0.5303113", "0.53029805", "0.5295386", "0.5293079", "0.52897453", "0.52876914", "0.5281459", "0.52791494", "0.5264649", "0.5261579" ]
0.7131456
1
Save the user object back to the database the database ID
def save @data_object.user_acc_name.downcase! if @data_object.user_acc_name # unless @data_object.existing_record? tmp = User.with_name(@data_object.user_acc_name) if tmp && (!@data_object.existing_record? || tmp.user_id != @data_object.user_id) raise DionException.new("Sorry, but that nickname has been taken") end # tmp = User.with_email(contact.con_email) # if tmp && (!@data_object.existing_record? || tmp.user_id != @data_object.user_id) # raise DionException.new("A user with that e-mail address already exists" + # " #{tmp.user_id}, #{@data_object.user_id}") # end # end # This is tacky, but I can't see an easy way around it. If we fail inserting the # user record because of a duplicate nickname, then we'll have already written # out the contact record. The rollback will delete that out (or reset its field # values), but the in-store copy won't know that. So, we save away the contact # stuff and restore it in case of an exception # $store.transaction do begin # saved_contact = Marshal.dump(contact) # prev_con_id = @data_object.user_contact @data_object.user_contact = contact.save begin super rescue Exception => e # @contact = Marshal.load(saved_contact) # @data_object.user_contact = saved_contact raise end rescue DBI::ProgrammingError => e $stderr.puts e.message $stderr.puts e.backtrace case e.message when /duplicate key into unique index contact_con_email_key/, /duplicate key violates unique constraint "contact_con_email_key"/ raise DionException.new("A user with that e-mail address already exists") when /duplicate key into unique index user_table_user_acc_name_key/ raise DionException.new("Sorry, but that nickname has been taken") else raise end end # end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_user(user)\n contact = find(user.id)\n\n mapper.save(contact, user.attributes)\n end", "def save\n REDIS.set @user.delete(:key), @user.to_json\n @user # NOTE: SET can't fail (http://redis.io/commands/set)\n end", "def store_user_id(user)\n\t\t@id = user\n\tend", "def save\n\t\t\tr = Episodey::DB::User.create(\n\t\t\t\t:name => self.name,\n\t\t\t\t:email => self.email\n\t\t\t)\n\t\t\t@id = r.id\n\t\t\treturn self\n\t\tend", "def save\n id and ensure_authentication and super\n end", "def set_user!(user)\n\t\tself.user_id = user.id\n\t\tself.save!\n\tend", "def save_user( args )\n user_id = args.delete( :user_id ) if args.has_key?( :user_id )\n user_name = args.delete( :user_name ) if args.has_key?( :user_name )\n \n row = {}\n if user_id and user_name\n row = { min_field( :user_id ) => user_id, min_field( :user_name ) => user_name }\n else\n row = { min_field( :user_name ) => user_name }\n end\n \n user = users.find_one( row, :fields => ['_id'] )\n return user['_id'] if user\n\n now = args[:created_at]\n row[min_field(:date_id)] = \"%4d%02d%02d\" % [now.year, now.month, now.day]\n \n users.save( row )\n end", "def save\n data = request.subset(:username, :password)\n id = request.params['id']\n\n if !id.nil? and !id.empty?\n user = User[id]\n\n if user.nil?\n flash[:error] = 'The specified user is invalid'\n redirect_referrer\n end\n\n success = 'The user has been updated'\n error = 'The user could not be updated'\n else\n user = User.new\n success = 'The user has been added'\n error = 'The user could not be added'\n end\n\n begin\n user.update(data)\n\n flash[:success] = success\n redirect(Users.r(:edit, user.id))\n rescue => e\n Ramaze::Log.error(e)\n\n flash[:error] = error\n flash[:form_errors] = user.errors\n flash[:form_data] = user\n\n redirect_referrer\n end\n end", "def save\n\t\t\tis_new = params[:user][:id].blank?\n\n # Get user\n\t\t\tuser = is_new ? User.new : User.find(params[:user][:id])\n\n # Author\n if is_new\n authorize! :create, User\n else\n authorize! :edit, user\n end\n\n # Save\n\t\t\tresult = user.save_with_params params[:user]\n\t\t\t\n\t\t\t# If error\n\t\t\treturn render json: result if result[:status] != 0\n\n\t\t\t# If signup\n\t\t\tif is_new\n\t\t\t\t# session_info = SessionInfo.find session[:session_info_id]\n\t\t\t\t# session_info.leave_infos ||= []\n\t\t\t\t# session_info.leave_infos << ['user', user.id]\n\t\t\t\t# session_info.save\n\n\t\t\t\t# Log\n\t\t\t\tLog.create(\n\t\t\t\t\tobject_type: 'user',\n\t\t\t\t\tobject_id: user.id,\n\t\t\t\t\taction: 'create'\n\t\t\t\t)\n\t\t\t\t\n\t\t\t\t# Delete contact\n\t\t\t\t# if contact.present?\n\t\t\t\t# \tcontact.update is_deleted: true\n\t\t\t\t# end\n\t\t\tend\n\n\t\t\t# Send active mail\n\t\t\tcase user.active_status\n\t\t\twhen 1\n\t\t\t\tUserMailer.active_account(user).deliver_later\n\t\t\twhen 2\n\t\t\t\tUserMailer.active_old_email(user).deliver_later\n\t\t\tend\n\n\t\t\trender json: { status: 0, result: user.id, email_changed: result[:email_changed] }\n\t\tend", "def save\r\n @@users.push self\r\n end", "def save_user\n client = create_db_client\n client.query(\"INSERT INTO users(name, email, password, bio) VALUES('#{@name}', '#{@email}', '#{@password}', '#{@bio}')\")\n \n id = client.last_id\n rawData = client.query(\"SELECT * FROM users WHERE id='#{id}'\")\n users = Array.new\n rawData.each do |data|\n user = {:id => data[\"id\"], :name => data[\"name\"] ,:email => data[\"email\"], :password => data[\"password\"], :bio => data[\"bio\"]}\n users << user\n end\n response = Response.new('success', 'success input user', users)\n return response.response_api\n end", "def save\n if valid?\n entity = to_entity\n User.dataset.save entity\n self.id = entity.key.id\n true\n else\n false\n end\n end", "def save(object)\n db_id = derive_db_id(object.class.name, object.id)\n db.transaction do\n db[db_id] = object\n end\n end", "def user=(user)\n self.update_attributes(:user_id => user.id)\n end", "def save\n CONNECTION.execute(\"UPDATE users SET name = '#{self.name}' WHERE id = #{self.id};\")\n end", "def store(user)\n @session[:user_id] = user.id\n end", "def save\n CONNECTION.execute(\"UPDATE users SET email = '#{self.email}', password = '#{self.password}' WHERE id = #{self.id};\")\n \n return self\n end", "def user=(_user)\n self.user_id = _user.id\n\n _user\n end", "def cdb_save\n cdb_set_password( @new_password, @confirm_new_password ) if @new_password\n @new_password, @confirm_new_password = nil, nil # Just to ensure that we don't save them!\n results = couchdb.store(\"webui_user\", @name, self)\n @couchdb_rev = results[\"rev\"]\n results\n end", "def store_user\n data = load_data\n user_details = {\n 'id' => @user.uid.to_s,\n 'username' => @user.username,\n 'password' => @user.password,\n 'playlist' => @user.playlist,\n 'mylist' => @user.mylist\n }\n data << user_details\n write_user(data)\n end", "def user=(user)\n also_save = self.persisted? && !self.changed?\n self.user_uid = user.uid\n @_user = user\n self.save if also_save\n end", "def save\n # Insert OR Update object values into DB\n # DB.execute(\"INSERT INTO .....\")\n # @id = DB.last_insert_row_id # get the last id from the DB\n # OR\n # DB.execute(\"UPDATE .....\")\n end", "def save\n @@userList.push self\n self\n end", "def save\n # Insert object values into DB\n # DB.execute(\"INSERT INTO .....\")\n # @id = DB.last_insert_row_id\n end", "def update_last_saved_by_to(user)\n self.last_saved_by_id = user.id\n self.save!\n end", "def save\n\t\tbegin\n\t\t\tuser_profile = self.profile\n\t\t\tUser.create(\n\t\t\t\t:user_id => id,\n\t\t\t\t:login_name => username,\n\t\t\t\t:email => email,\n\t\t\t\t:join_tsz => created,\n\t\t\t\t:transaction_buy_count => user_profile.transaction_buy_count,\n\t\t\t\t:transaction_sold_count => user_profile.transaction_sold_count,\n\t\t\t\t:is_seller => user_profile.is_seller,\n\t\t\t\t:location => user_profile.lon ? [user_profile.lon, user_profile.lat] : nil,\n\t\t\t\t:image_url => user_profile.image,\n\t\t\t\t:country_id => user_profile.country_id,\n\t\t\t\t:gender => user_profile.gender,\n\t\t\t\t:oauth_token => nil,\n\t\t\t\t:oauth_token_secret => nil,\n\t\t\t\t:authenticated => false,\n\t\t\t\t:shop_id => @shop_id\n\t\t\t)\n\t\trescue NoMethodError\n\t\t\t# fairly rare at this point.\n\t\t\tputs \"associated_profile bug\"\n\t\tend\n\tend", "def after_save\n if self.credit && self.credit.user.nil?\n self.credit.user = self.user\n end\n self.credit.save if !self.credit.nil?\n end", "def save\n super if self.user_id.present?\n # Else do nothing (dont call save)\n end", "def save\n @user_id = @user_id.to_i\n @train_id = @train_id.to_i\n CONNECTION.execute(\"UPDATE logs SET user_id = '#{self.id}', train_id = '#{self.id} WHERE id = #{self.id};\")\n end", "def save\n raise \"Duplicated user\" if @@traders.has_key? self.id and @@traders[self.id] != self\n @@traders[self.id] = self\n @@traders_by_name[self.name.downcase] = self\n @@count += 1\n end", "def user_id=(new_id)\n if allow_editing?\n @user_id = ForeignKey.new(id: new_id, class_name: User)\n @user_name = user.name\n end\n end", "def save(user)\n if valid?\n user.update(Hash[ATTRIBUTES.map { |attribute_name| [attribute_name, send(attribute_name.to_sym)] }])\n end\n end", "def saved?\n user_id?\n end", "def save!\n raise \"A database must be setted\" unless self.database\n response = id.nil? ? self.database.post( self ) : self.database.put( self )\n pristine_copy\n response\n end", "def save\n vals = to_h\n vals.delete(:username)\n vals.delete_if { |_k, v| v.nil? || v.to_s.empty? }\n vals[:password] = vals.delete(:newpassword) if vals[:newpassword]\n payload = Gyoku.xml(user: vals)\n response = CoachClient::Request.put(url, username: @username,\n password: @password,\n payload: payload,\n content_type: :xml)\n unless response.code == 200 || response.code == 201\n fail CoachClient::NotSaved.new(self), 'Could not save user'\n end\n @password = vals[:password]\n @newpassword = nil\n self\n end", "def create\n # AR model which will interact with our database and create a new user\n user = User.new(user_params)\n saveUser = user.save\n \n if saveUser\n session[:user_id] = user.id\n redirect_to '/'\n else\n redirect_to '/signup'\n end\n end", "def recreate_testuser\n result = User.new(id: TESTUSER_ID, username: TESTUSER_NAME, password: TESTUSER_PASSWORD, email:TESTUSER_EMAIL).save\n puts \"Recreate testuser -> #{result}\"\nend", "def force_write_user\n return true if no_user_validation\n\n # Special handling for editable reports and dynamic models with no_master_association set\n if respond_to?(:user_id) && respond_to?(:current_user) && (\n !self.class.respond_to?(:no_master_association) || self.class.no_master_association\n )\n return write_attribute :user_id, current_user.id\n end\n\n logger.debug \"Forcing save of user in #{self}\"\n return if respond_to?(:master) && !master\n\n mu = master_user\n unless mu.is_a?(User) && mu.persisted?\n master = '[not defined]' unless respond_to? :master\n raise \"bad user (for master #{master}) being pulled from master_user \" \\\n \"(#{mu.is_a?(User) ? '' : 'not a user'}#{mu && mu.persisted? ? '' : ' not persisted'})\"\n end\n\n write_attribute :user_id, mu.id\n end", "def registrar_usuario\n business_user = User.new\n business_user.email = self.email\n business_user.password = business_user.generar_password\n business_user.client_type = 'empresa'\n business_user.save\n update(user_id: business_user.id, user_created_id: business_user.id)\n #luego de registrar al usuario se almacena la contraseña en la tabla Historypassword\n #donde se almacenaran las 3 ultimas usadas\n password_business = HistoryPassword.new\n password_business.password = business_user.password\n password_business.user_id = business_user.id\n password_business.save\n end", "def shave\n if User.update_user(params[:id], 'shave')\n redirect_to root_url\n end\n end", "def save_session user\n # The password_seed method is used to generate the stored token.\n # The remember_token is then stored as a signed cookie along with the\n # user's ID from the database.\n remember_token = password_seed\n cookies.permanent.signed[:remember_user_id] = user.id\n cookies.permanent.signed[:remember_user_token] = remember_token\n \n # The WHIRLPOOL hash of remember_token and the user's password seed is\n # then stored in the database.\n remember_hash = Digest::Whirlpool.hexdigest(remember_token +\n user.password_seed)\n user.update_attributes(:remember_hash => remember_hash)\n user.save\n end", "def save_user(user)\n raise 'subclass must implement'\n end", "def save\n return false unless valid?\n user.update_attributes(card_reference: card_reference)\n ResamaniaApi::PushUserWorker.perform_async(user.id)\n true\n end", "def save\n # SQL INJECTION\n # prevent malicious users\n # a'); DROP TABLE tweets; --\n sql = <<-SQL\n INSERT INTO tweets (message, username)\n VALUES (?, ?);\n SQL\n\n # binding.pry\n # persist\n if !!@id\n # update\n else\n DB[:conn].execute(sql, self.message, self.username)\n # but i don't know what i am, save the id\n @id = DB[:conn].execute(\"SELECT * FROM tweets;\").last[\"id\"]\n end\n self\n # There is! BUT I'm not going to fix it. WHY? BECAUSE SOEMONE ELSE GHAS ALREADY DONE IT!\n end", "def attach_to_user(user_id)\n \tself.user_id = user_id\n \tself.save\n end", "def create\n @user = User.new(user_params)\n puts(\"before looop\")\n respond_to do |format|\n if @user.save\n puts(\"inside looop\")\n #below not working for some reason\n # id = @user.id\n # puts (id)\n # puts(\"new user created\")\n # @band = Band.new\n # @band.update(:user_id => @user.id, :value => \"0.05\")\n format.html { redirect_to :show, 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 connect(user)\n user.purchases.each do |purchase|\n purchase.purchaser_id = self.id\n purchase.save\n end\n\n user.contributions.each do |contribution|\n contribution.user_id = self.id\n contribution.save\n end\n\n user.obligations.each do |obligation|\n obligation.user_id = self.id\n obligation.save\n end\n\n user.friendships.each do |friendship|\n friendship.user_id = self.id\n friendship.save\n end\n\n Friendship.where(friend: user).each do |friendship|\n friendship.friend_id = self.id\n friendship.save\n end\n\n user.memberships.each do |membership|\n membership.user_id = self.id\n membership.save\n end\n\n user.organized_trips.each do |trip|\n trip.organizer_id = self.id\n trip.save\n end\n\n self.facebook_id ||= user.facebook_id\n self.facebook_access_token ||= user.facebook_access_token\n self.facebook_access_token_expires_at ||= user.facebook_access_token_expires_at\n\n self.twitter_id ||= user.twitter_id\n self.twitter_access_token ||= user.twitter_access_token\n self.twitter_access_secret ||= user.twitter_access_secret\n\n self.save\n\n User.destroy(user.id)\n end", "def saveIdentity _obj, _args\n \"_obj saveIdentity _args;\" \n end", "def add_to_database\n CONNECTION.execute(\"INSERT INTO users (name) VALUES ('#{self.name}');\")\n @id = CONNECTION.last_insert_row_id\n end", "def create_new_user\r\n touch(\"* id:'#{add}'\")\r\n end", "def save!\n object.save!\n end", "def save_phone_to_user\n user = User.find_by(email: self.email)\n user.update_column(:phone, self.phone) if user.present?\n end", "def save()\n sql = \"\n INSERT INTO players\n ( name, team )\n VALUES\n ( '#{@name}', '#{@team}' )\n RETURNING *;\n \"\n @id = SqlRunner.run( sql )[0]['id'].to_i()\n end", "def save\n if self.id\n self.update\n else\n sql = <<-SQL\n INSERT INTO students (name, grade)\n VALUES (?, ?)\n SQL\n DB[:conn].execute(sql, self.name, self.grade)\n # This method also assigns the id attribute of the object once the row has\n # been inserted into the database.\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM students\")[0][0]\n end\n end", "def save_user\n new_r = @user.new_record?\n headers ={}\n if @user.save\n headers= ( new_r ? {status: :created, location: api_v1_user_url(:id => @user.id, format: (params[:format] || :json) ) } : {status: :ok} )\n end \n respond_with(@user, headers)\n end", "def update_identity_user(identity, user)\n identity.update_attributes(user_id: user.id) if identity.user != user \n end", "def save\n object.save\n end", "def save\n repository.put(self) if modified?\n id\n end", "def serialiaze\n Logger.d(\"Serializing the User object\")\n save_to_shared_prefs(@context, self.class, self)\n end", "def save\n Role.update id, to_h\n true\n end", "def persist_to_database object, database\n object.with(session: database).save!\n $logger.debug \"..persisted to MongoDB: database: #{database.inspect}\\n....#{object.inspect}\\n\"\n end", "def set_last_user\n @user = User.last\n end", "def save(&block)\n Logger.d \"Saving user\"\n\n params = {\n :user => {\n :name => get(:name),\n :email => get(:email),\n :gcm_token => get(:gcm_token)\n }\n }\n\n # Merge any future params if they exist\n params.merge!(@future_params) if not @future_params.empty?\n\n Logger.d(\"Params for /user POST => #{params.to_json}\", \"#\")\n\n network_post(CONFIG.get(:user_save), nil, params.to_json, @on_api_call_failed) do |user_object|\n if is_valid_network_user_object?(user_object)\n empty_out_future_params\n @data = user_object\n Logger.d(\"Success in @user.save => \" + user_object.to_s)\n serialiaze() # Write the object to persistent storage\n after_save_actions() # Collection of util methods which need to execute when the user is saved on the server\n block.call(@data) \n end\n end\n end", "def merge_user_id( from_user )\n\t\t self.rpx_identifier = from_user.rpx_identifier\n\t\t from_user.rpx_identifier = nil\n\t\t from_user.save\n\t\t from_user.reload\t\t\n\t\tend", "def registrar_usuario\n employee_user = User.new\n employee_user.email = self.email\n employee_user.password = employee_user.generar_password\n employee_user.username = asignar_username_con_opciones\n if asignar_username_con_opciones.present?\n employee_user.username = asignar_username_con_opciones\n else\n employee_user.username = self.usuario.downcase\n end\n employee_user.client_type = 'empleado'\n employee_user.save\n update(user_id: employee_user.id, user_created_id: employee_user.id) \n #luego de registrar al usuario se almacena la contraseña en la tabla Historypassword\n #donde se almacenaran las 3 ultimas usadas\n password_employee = HistoryPassword.new\n password_employee.password = employee_user.password\n password_employee.user_id = employee_user.id\n password_employee.save\n end", "def set_user\n # @user = User.find(params[:id])\n @user = User.find_by_sql(['SELECT \"users\".* FROM \"users\" WHERE \"users\".\"id\" = ? LIMIT 1', params[:id]])[0]\n end", "def set_user\n @user = User.find(user_id)\n end", "def save\n wallet.db.save_account(self)\n end", "def save_student_profile(id)\n student = id\n end", "def create\n object={\n :name=>params[:name],\n :email=>params[:email],\n :uid=>params[:uid]\n }\n newUser=User.create(object)\n cookies[:current_user]=newUser.id\n redirect_to \"/home\"\n end", "def saves\n Save.where(user_id: self.id)\n end", "def save_obj params\r\n paramsh = {\r\n :user_id => params[:user_id],\r\n :name => params[:name], \r\n :subject => params[:subject],\r\n :tenant_uid => params[:tenant_uids]\r\n }\r\n update_attributes(paramsh)\r\n save!\r\n end", "def register!(user)\n raise \"Already registred\" if user and not user.guest?\n self.user = user and save!\n end", "def save\n ## before_save hook ##\n before_save()\n\n if self._id.nil?\n self._id=BSON::ObjectId.new\n end\n self.class.db_collection.insert_one(to_hash)\n\n ## after_save hook ##\n after_save()\n self\n end", "def create\n @user = User.create(user_params)\n # @user.save ??\n redirect_to @user\n\n end", "def set_user\n #@user = User.find(params[:id])\n @user = User.where(:id => params[:user_id]).first\n end", "def create \n @user = User.find(params[:user])\n session[:user_id] = @user.uid\n redirect_to user_path(@user)\n end", "def update_user\n end", "def set_user_id\n self.user_id = User.current_user.id\n end", "def update_user_if_save_version\n self.user = User.current if save_version?\n end", "def set_user\n @user = User.select(\"*\").where(userId: params[:id])\n end", "def set(user_obj)\n # example code to set it\n # You could also set in DB i.e User.find(id).update_attributes(user_id: user_obj[:userId], settings: user_obj)\n @@user_storage[user_obj[:userId]] = user_obj\n end", "def new_user\n account_make = self\n # assign storing of information to a variable\n account_store = YAML::Store.new 'users.store'\n # store the object into a file\n account_store.transaction do\n account_store[username.to_s] = account_make\n end\n end", "def save\n # 1. What am I saving?\n # 2. input => username, message\n\n # if i saved\n # update OI don't want to do thjis!!!\n # else\n\n sql = <<-SQL\n INSERT INTO tweets (username, message)\n VALUES (?, ?);\n SQL\n\n # SQL Injection, parameterize\n\n DB[:conn].execute(sql, self.username, self.message)\n @id = DB[:conn].execute(\"SELECT * FROM tweets\").last[\"id\"]\n end", "def add_to_database\n if self.valid?\n User.add({\"name\" => \"#{self.name}\"})\n else\n false\n end\n end", "def set_user\n zeus = User.find(@zeus_user.id)\n zeus.state = User.states['retrieved_password']\n zeus.save!\n \n request.session[:rbac_user_id] = @zeus_user.id\n end", "def set_user_session(user)\n if user.save\n session[:user_id] = user.id\n flash[:notice] = \"Sign Up Success!!\"\n redirect_to :root\n else\n flash[:alert] = \"Problem\"\n render 'new'\n end\n end", "def user_id=(id)\n @@user_id= id\n end", "def create\n \n @user = User.new(params.require(:user).permit(:name, :email, :password_digest))\n if @user.save \n session[:user_id] = @user.id.to_s\n redirect_to users_path\n else\n redirect_to new_user_path @user\n end\nend", "def storeUser(param) \n @Handle.execute(\"INSERT INTO User(email,name,surname,nickname)\" +\n \" values ('#{param.Email}','#{param.Name}','#{param.Surname}','#{param.Nickname}')\")\n end", "def store_user(user)\n raise NotImplemented\n end", "def store_user(user)\n raise NotImplemented\n end", "def store_user(user)\n raise NotImplemented\n end", "def save_group(user)\n ActiveRecord::Base.transaction do\n save\n @user_group = UserGroup.new\n @user_group.user_id = user.id\n @user_group.group_id = id\n @user_group.save\n @member = GroupMember.new\n @member.e_mail = user.email\n @member.group_id = id\n @member.save\n end\n end", "def set_user\n user_id = params['user_id']\n @user = user_id ? User.find(user_id) : User.find(1)\n end", "def set_user\n @user = User.find_by_external_id(params[:id])\n @user = User.create!(name: params[:name], email: params[:email], external_id: params[:external_id]) unless @user\n end", "def set_user\n @user = User.find(params[:id]) #:id\n end", "def set_user_id\n @user_id = UserId.find(params[:id])\n end", "def test_save\n # Create the user with a unique email.\n email = @user.email_address\n at_ndx = email.index('@')\n modifier = \"_#{Jinx::UID.generate}\"\n @user.email_address = email.insert(at_ndx, modifier)\n @user.login_name = nil\n verify_save(@user)\n \n # Update the address.\n logger.debug { \"#{self} updating the #{@user} address...\" }\n @user.address.street = \"#{Jinx::UID.generate} Elm St.\"\n verify_save(@user)\n end", "def save_or_create_profile\n if profile.present?\n profile.actor_id = id\n profile.save!\n else\n create_profile\n end\n end", "def save\n self.class.save(self)\n end" ]
[ "0.7088505", "0.7059781", "0.69057345", "0.68852574", "0.68643546", "0.68430525", "0.6830865", "0.6760203", "0.6734597", "0.6676327", "0.66465086", "0.6643306", "0.66220933", "0.6618445", "0.661582", "0.6587292", "0.65792453", "0.65593433", "0.6557607", "0.6557344", "0.6535504", "0.65306044", "0.6438542", "0.6426896", "0.6384687", "0.6371952", "0.63703793", "0.6353959", "0.6332294", "0.6326264", "0.63209337", "0.6292607", "0.62647617", "0.626128", "0.6259217", "0.6239092", "0.62299186", "0.62258315", "0.6211978", "0.620437", "0.6197004", "0.6194265", "0.6190665", "0.6189263", "0.61722857", "0.61417687", "0.61388075", "0.6138238", "0.6131566", "0.6126743", "0.6116383", "0.61104065", "0.60972124", "0.6093793", "0.60831875", "0.6078781", "0.6067976", "0.60526407", "0.6046759", "0.60444075", "0.6034102", "0.6033502", "0.6032144", "0.6027681", "0.602594", "0.6023718", "0.601843", "0.6008296", "0.60063785", "0.6006319", "0.59978837", "0.59925056", "0.5990288", "0.5989946", "0.59761316", "0.59752834", "0.5972483", "0.5970609", "0.5968264", "0.5965726", "0.5963331", "0.59622043", "0.5957468", "0.5951842", "0.5948927", "0.59472644", "0.5941968", "0.5934402", "0.5928611", "0.59245956", "0.59149545", "0.59149545", "0.59149545", "0.5914005", "0.5906598", "0.5905533", "0.5903536", "0.59002006", "0.58997035", "0.5899226", "0.5888146" ]
0.0
-1
Lazy load an affiliate
def affiliate @affiliate || Affiliate.with_id(@data_object.user_affiliate) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def affiliate\n self.affiliate_class && affiliate_id && self.affiliate_class.find(affiliate_id)\n end", "def affiliate_affiliations\n @affiliate_affiliations ||= Affiliation.find_by_uid(uid)\n end", "def affiliation\n affiliations.try(:first)\n end", "def set_affiliate\n @affiliate = Affiliate.find(params[:id])\n end", "def set_affiliate\n @affiliate = Affiliate.find(params[:id])\n end", "def set_affiliate\n @affiliate = Affiliate.find(params[:id])\n end", "def set_affiliate\n if affiliate.present?\n account.affiliate_id = affiliate.id\n account.affiliate_other = affiliate.subaffiliates_enabled? ? account_params[:affiliate_other] : nil\n else\n account.affiliate_id = account.affiliate_other = nil\n end\n account\n end", "def set_affiliation\n @affiliation = Affiliation.find(params[:id])\n end", "def get_affiliations\n affiliations\n end", "def affiliate_class\n self.class.affiliate_class\n end", "def mock_affiliate(stubs={})\n @mock_affiliate ||= mock_model(Affiliate, stubs)\n end", "def affiliation\n @affiliation ||= auth_types_collection[attrs[:patron_status]] unless attrs[:patron_status].nil?\n end", "def affiliation=(affil)\n affiliations.clear\n affiliations << affil\n end", "def affiliation_id\n affiliation_ids.try(:first)\n end", "def set_cms_affiliation\n @cms_affiliation = Cms::Affiliation.find(params[:id])\n end", "def affiliate= affiliate\n if affiliate\n if affiliate.class != affiliate_class # self.class.to_s != \"#{affiliate.class.to_s}Reference\"\n raise \"Attempt to affiliate #{self.class.to_s} reference with #{affiliate.class} object.\"\n elsif affiliate_id && (affiliate_id != affiliate.id)\n raise \"Attempt to create ambiguous reference by asserting new affiliate\"\n else\n self.affiliate_id = affiliate.id\n end\n end\n end", "def associated_with_affiliate?(aff_id)\n (aff_id == @data_object.user_affiliate) ||\n role_assoc_with_affiliate?(aff_id)\n end", "def all_affiliations\n @team_affiliations ||= TeamAffiliation.all\n end", "def affiliation\n []\n end", "def deserialize_affiliation(provenance:, json: {})\n return nil unless json.present? && json[:affiliation].present?\n\n Api::V0::Deserialization::Affiliation.deserialize(\n provenance: provenance, json: json[:affiliation]\n )\n end", "def new_affiliate\n resource = build_resource\n resource.role = 'affiliate'\n resource.build_affiliate\n respond_with resource\n end", "def all_affiliations\n @all_affiliations ||= TeamAffiliation.joins(:season).where( \"seasons.season_type_id = #{season.season_type_id}\" )\n end", "def index\n @var = User.find(params[:affiliate_program_id])\n @affiliate = Affiliate.new\n end", "def with_affiliation_type(type)\n self.find_all{|user| user[1][:affiliation_type]==type }.shuffle\n end", "def get_affiliations_count\r\n @summary.affiliations_count\r\n end", "def index\n @cms_affiliations = Cms::Affiliation.all\n end", "def affiliate_url\n apparel_item.product_url\n end", "def show\n @affiliate_link = AffiliateLink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @affiliate_link }\n end\n end", "def set_affiliation\n @affiliation = Affiliation.find(params[:id])\n add_breadcrumb @affiliation, @affiliation\n rescue ActiveRecord::RecordNotFound\n render_404\n end", "def affiliation_id=(affil_id)\n self.affiliation_ids = affil_id\n end", "def initialize(data_object = nil)\n @data_object = data_object || fresh_affiliate\n end", "def search_affiliation(afid)\n x=xml.at_xpath(\"//affiliation[@afid=\\\"#{afid}\\\"]\")\n if !x\n raise \"I can't find affiliation #{afid}\"\n else\n name=x.xpath(\"organization\").map { |e| e.text }.join(\";\")\n city=process_path(xml, \"//affiliation[@afid=\\\"#{afid}\\\"]/city-group\")\n country=process_path(xml, \"//affiliation[@afid=\\\"#{afid}\\\"]/country\")\n country||=x.attribute(\"country\").value\n end\n {:id => afid, :name => name, :city => city, :country => country,:type=>:scopus}\n end", "def show\n @affiliate_link = AffiliateLink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @affiliate_link }\n end\n end", "def affiliate_status\n get 'affiliateStatus'\n end", "def get_author_cr_affiliations(auth_id)\n sql_statement = \\\n \"SELECT id, name FROM cr_affiliations WHERE article_author_id = \" + auth_id.to_s + \";\"\n db = get_db()\n stm = db.prepare sql_statement\n rs = stm.execute\n values_hash = {}\n rs.each do |row|\n values_hash[row[\"id\"]] = row[\"name\"]\n end\n return values_hash\nend", "def fetch_adult_info_with_scout_links(adult_datum)\n adult_page = fetch_person_info(:adult, adult_datum)\n\n if adult_page.search(\"table#ctl00_mainContent_ParentProfile_tblScoutGrid a\").size > 0\n adult_page.search(\"table#ctl00_mainContent_ParentProfile_tblScoutGrid a\").each do |scout|\n profile = profile_from_url(scout['href'])\n # adult_scout = find_or_create_by_profile(profile)\n related_scout = Scoutlander::Datum::Person.new\n related_scout.sl_profile = profile\n related_scout.sl_url = scout['href']\n related_scout.sl_uid = uid_from_url(scout['href'])\n\n adult_datum.add_relation related_scout\n # if related_scout.parent.nil?\n # adult_datum.add_relation related_scout\n # end\n end\n end\n end", "def link_with_omniauth(auth)\n identities.find_or_initialize_by(provider: auth[:provider], uid: auth[:uid])\n end", "def load_reference(attribute)\n ldr = database.lazy_loader\n # bypass the singleton method and call the class instance method if the lazy loader is disabled\n return transient_value(attribute) unless ldr.enabled?\n \n # First disable lazy loading for the attribute, since the reader method is called by the loader.\n remove_lazy_loader(attribute)\n # load the fetched value\n merged = ldr.load(self, attribute)\n \n # update dependent snapshots if necessary\n pa = self.class.property(attribute)\n if pa.dependent? then\n # the owner attribute\n oattr = pa.inverse\n if oattr then\n # update dependent snapshot with the owner, since the owner snapshot is taken when fetched but the\n # owner might be set when the fetched dependent is merged into the owner dependent attribute. \n merged.enumerate do |dep|\n if dep.fetched? then\n dep.snapshot[oattr] = self\n logger.debug { \"Updated the #{qp} fetched #{attribute} dependent #{dep.qp} snapshot with #{oattr} value #{qp}.\" }\n end\n end\n end\n end\n\n merged\n end", "def maintain_affiliates\n values = {\n 'aff_opts' => Affiliate.options,\n 'aff_id' => -1,\n 'form_url' => url(:handle_maintain),\n }\n\n standard_page(\"Maintain Affiliates\", values, MAINTAIN_AFFILIATES)\n end", "def lazy\n Fetcher.new(self).lazy\n end", "def get_associate\n\t\t@associates = Associate.all\n\tend", "def fetch_reference_by_id(id)\n Association::LazyEntityReference.new(id, self)\n end", "def assign_search(aff_id)\n @data.affiliate = Affiliate.with_id(aff_id)\n assign_common\n end", "def affiliations_for_actor(person_id:)\n publication_ids = Publication.where.not(published_at: nil).where(is_deleted: false).map {|publ| publ.id}\n people2publication_ids = People2publication.where('publication_id in (?)', publication_ids).where('person_id = (?)', person_id.to_i).map { |p| p.id}\n department_ids = Departments2people2publication.where('people2publication_id in (?)', people2publication_ids).order(updated_at: :desc).map {|d2p2p| d2p2p.department_id}\n departments = Department.where(id: department_ids)\n affiliations = departments.map {|d| {id: d.id, name: I18n.locale == :en ? d.name_en : d.name_sv}}\n return affiliations.sort_by {|a| a[:name]}\n end", "def set_po_affiliation_status\n @po_affiliation_status = PoAffiliationStatus.find(params[:id])\n end", "def affiliations\n @net_ldap_entry[:berkeleyeduaffiliations]\n end", "def season_affiliations\n @season_affiliations ||= TeamAffiliation.where( season_id: season.id )\n end", "def affiliations\n iq = connection.iq_stanza({'to'=>jid.bare},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSubOwner},\n x('affiliations',:node => node_id)\n )\n )\n send_iq_stanza_fibered iq\n end", "def advised?\n advisor_company_affiliations.with_access.present?\n end", "def fetch_details_from_linkedin\n\t\t# To Do\n\t\tself.user.has_linkedin = true\n\t\tself.user.save\n\tend", "def _Appeal(id)\n Appeal.find(id)\nend", "def check_affiliate_program\r\n\r\n # check the user first\r\n if session_user\r\n if session_user.affiliate_user\r\n # if the user is an affiliate user and the program is not active, don't set the members\r\n return if !session_user.affiliate_user.affiliate_program.active?\r\n # the user if an affiliate user and the program is still active\r\n @affiliate_program = session_user.affiliate_user.affiliate_program\r\n @affiliate = @affiliate_program.affiliate\r\n @affiliate_member_id = session_user.affiliate_user.affiliate_unique_id\r\n return\r\n else\r\n # the user is logged in but ther user isn't an affiliate user\r\n return\r\n end\r\n end\r\n\r\n # no session user...check the cookies only if there are no url parameters\r\n unless params[:affiliate]\r\n @affiliate_program ||= AffiliateProgram.find(cookies[:affiliate_program_id]) if !cookies[:affiliate_program_id].blank?\r\n @affiliate_program ||= AffiliateProgram.find_by_permalink(cookies[:affiliate_permalink]) if cookies[:affiliate_permalink]\r\n\r\n if @affiliate_program && !@affiliate_program.active?\r\n @affiliate_program = nil\r\n end\r\n\r\n @affiliate = @affiliate_program.affiliate if @affiliate_program\r\n @affiliate_member_id = cookies[:affiliate_unique_id] if cookies[:affiliate_unique_id]\r\n return\r\n end\r\n\r\n # there are params on the URL and the user is not logged in.\r\n @affiliate_program = AffiliateProgram.find_by_permalink(params[:affiliate])\r\n handle_no_affiliate and return unless @affiliate_program\r\n # if the affiliate program is not active, cast off the association with the affiliate.\r\n # TODO LTC - should this message the user that they are too late?\r\n if (@affiliate_program == nil) || !@affiliate_program.active?\r\n @affiliate_program = nil\r\n return\r\n end\r\n\r\n @affiliate = @affiliate_program.affiliate\r\n handle_no_affiliate and return unless @affiliate\r\n\r\n @affiliate_member_id = (@affiliate && @affiliate.member_id_var_name) ? params[@affiliate.member_id_var_name] : params[:aid]\r\n #handle_no_affiliate and return unless @affiliate_member_id\r\n\r\n cookies[:affiliate_id] = @affiliate_program.affiliate.id.to_s\r\n cookies[:affiliate_program_id] = @affiliate_program.id.to_s\r\n cookies[:affiliate_unique_id] = @affiliate_member_id.to_s if @affiliate_member_id\r\n end", "def using_affiliate?(account_type)\n affiliate_account_types.include?(account_type.to_s.classify)\n end", "def association(name)\n @loaded_portals ||= {}\n\n if @loaded_portals.has_key?(name.to_sym)\n return @loaded_portals[name.to_sym]\n end\n\n super.tap do |assoc|\n next unless assoc.kind_of?(FmRest::Spyke::Portal)\n @loaded_portals[name.to_sym] = assoc\n end\n end", "def attribution\n return @attribution\n end", "def show\n @affiliate = Affiliate.find(params[:id])\n if @affiliate and (current_user.is_admin or @affiliate.email == current_user.email)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @affiliate }\n end\n else\n redirect_to \"/\"\n end\n\n end", "def get_affiliation\n render( json: TeamAffiliation.find_by(season_id: params[:season_id], team_id: params[:id]) )\n end", "def party_affiliation\n @registration.party_affiliation.blank? ? 'Not stated' : @registration.party_affiliation\n end", "def find_and_associate_scout(resource, adult)\n # puts \"adult: #{adult.inspect}\"\n adult.relations.each do |scout|\n rel_user = resource.scouts.where(sl_profile: scout.sl_profile).first\n\n # if the adult(user) -> scout relationship does not exist, create it\n if rel_user.nil?\n related = Scout.where(sl_profile: scout.sl_profile).first\n resource.scouts << related if related\n end\n end\n\n end", "def adult_sponsor\n self.users.where(role: \"adult sponsor\").first\n end", "def _load_associated_object(opts, dynamic_opts)\n # The implementation that loads these associations does\n # .all.first, which would result in the object returned being\n # marked as forbidding lazy load.\n obj = super\n obj.allow_lazy_load if obj.is_a?(InstanceMethods)\n obj\n end", "def set_afformation\n @afformation = Afformation.find(params[:id])\n end", "def persona_autobuscar\n persona.autobuscar if persona\n end", "def initialize(name, political_affiliation)\n @name = name\n @political_affiliation = political_affiliation\n end", "def find_by_identifier(provenance:, json: {})\n id_json = json.fetch(:affiliation_id, json.fetch(:funder_id, {}))\n return nil unless id_json[:identifier].present?\n\n id = Api::V0::Deserialization::Identifier.deserialize(provenance: provenance,\n identifiable: nil,\n identifiable_type: 'Affiliation',\n json: id_json)\n id.present? && id.identifiable.is_a?(::Affiliation) ? id.identifiable : nil\n end", "def new\n @affiliate = Affiliate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @affiliate }\n end\n end", "def affiliate_params\n params.require(:affiliate).permit(:name, :affid)\n end", "def lazy_load(source)\n # TODO: if the collection is not loaded, then use a subquery\n # to load it.\n\n # SEL: load all related resources in the source collection\n if source.saved? && source.collection.size > 1\n source.collection.send(name)\n end\n\n unless loaded?(source)\n set!(source, collection_for(source))\n end\n end", "def affiliation(name, req, desc)\n params = {:name => name, \n :description => desc,\n :requires_memberid => req}\n ClubAffiliation.create_or_update_by(:name, params)\nend", "def association_instance_get(name)\n @association_cache[name]\n end", "def association_instance_get(name)\n @association_cache[name]\n end", "def initialize(presenter)\n super(presenter)\n preload if relation.is_a?(ActiveRecord::Relation) && policy_associations.present?\n end", "def test_affiliate_transactions \n\n aff_customer = customers(:bob)\n aff_customer.ssn = '987654321'\n aff_customer.save\n\n trans1 = AffiliateTransaction.create(:transaction_type => 'C',\n :affiliate_customer_id => aff_customer.id,\n :referred_customer_id => 1,\n :amount => 5.0,\n :date => Date.today)\n\n assert_equal(1, aff_customer.affiliate_transactions.size)\n assert_equal(0, aff_customer.affiliate_payment_transactions.size)\n assert_equal(5.0, aff_customer.affiliate_balance)\n\n trans2 = AffiliateTransaction.create(:transaction_type => 'C',\n :affiliate_customer_id => aff_customer.id,\n :referred_customer_id => 2,\n :amount => 5.0,\n :date => Date.today)\n\n # Reload, because transactions are cached\n aff_customer.reload\n\n assert_equal(2, aff_customer.affiliate_transactions.size)\n assert_equal(0, aff_customer.affiliate_payment_transactions.size)\n assert_equal(10.0, aff_customer.affiliate_balance)\n\n trans3 = AffiliateTransaction.create(:transaction_type => 'P',\n :affiliate_customer_id => aff_customer.id,\n :referred_customer_id => nil,\n :amount => -5.0,\n :date => Date.today)\n\n aff_customer.reload\n\n assert_equal(3, aff_customer.affiliate_transactions.size)\n assert_equal(1, aff_customer.affiliate_payment_transactions.size)\n assert_equal(5.0, aff_customer.affiliate_balance)\n end", "def finalize_associations\n allow_lazy_load_for_static_cache_associations\n super\n end", "def get_association(server_url, handle=nil)\n serialized = @cache_client.get(assoc_key(server_url, handle))\n if serialized\n return deserialize(serialized)\n else\n return nil\n end\n end", "def new\n @affiliate_link = AffiliateLink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @affiliate_link }\n end\n end", "def whole_affil (new_party_affiliation)\n if new_party_affiliation == \"d\"\n \"Democrat\"\n else new_party_affiliation == \"r\"\n \"Republican\"\n end\n end", "def affiliate_link?\n !current_user.try(:admin?)\n end", "def advertiser\n self.campaign.advertiser\n end", "def attribute?\n @attribution\n end", "def load_new usr, buyer_id, pixi_id, fulfillment_type_code=nil\n if usr && usr.has_pixis?\n pixi = usr.active_listings.first if usr.active_listings.size == 1\n inv = usr.invoices.build buyer_id: buyer_id\n load_inv_details inv, pixi, buyer_id, pixi_id, fulfillment_type_code\n inv\n end\n end", "def preload\n presenter.preload(policy_associations)\n end", "def init\n @sponsor = current_user.sponsor\n end", "def user_get_affiliate_status(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: UserApi#user_get_affiliate_status ...\"\n end\n\n # resource path\n path = \"/user/affiliateStatus\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n\n\n auth_names = []\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Affiliate>')\n if Configuration.debugging\n Configuration.logger.debug \"API called: UserApi#user_get_affiliate_status. Result: #{result.inspect}\"\n end\n return result\n end", "def lazy_load(source)\n # SEL: load all related resources in the source collection\n if source.saved? && source.collection.size > 1\n eager_load(source.collection)\n end\n\n unless loaded?(source)\n set!(source, collection_for(source))\n end\n end", "def load_with_associations\n @response = Response.with_basic_assoc.friendly.find(params[:id])\n end", "def type\n @type ||= @data[:edupersonaffiliation].last\n end", "def attach_identifiers(provenance:, affiliation:, result: {}, json: {})\n return affiliation unless affiliation.new_record?\n\n ror_prov = Provenance.where(name: 'ror').first\n\n # First use any identifiers returned by ROR\n if ror_prov.present? && result.present? && (result[:ror].present? || result[:fundref].present?)\n if result[:ror].present?\n affiliation.identifiers << ::Identifier.find_or_initialize_by(\n provenance: ror_prov, category: 'ror', descriptor: 'is_identified_by',\n value: \"https://ror.org/#{result[:ror]}\", identifiable_type: 'Affiliation'\n )\n end\n if result[:fundref].present?\n affiliation.identifiers << ::Identifier.find_or_initialize_by(\n provenance: ror_prov, category: 'fundref', descriptor: 'is_identified_by',\n value: \"https://api.crossref.org/funders/#{result[:fundref]}\",\n identifiable_type: 'Affiliation'\n )\n end\n end\n\n # Otherwise take any identifiers passed in the JSON\n id = json.fetch(:affiliation_id, json.fetch(:funder_id, {}))\n if id.present? && id[:identifier].present?\n identifier = Api::V0::Deserialization::Identifier.deserialize(\n provenance: provenance, identifiable: affiliation, json: id\n )\n affiliation.identifiers << identifier if identifier.present? && identifier.new_record?\n end\n affiliation\n end", "def user_record_from_upi(figshare:, upi:, &block)\n figshare.institutions.accounts( institution_user_id: \"#{upi}@auckland.ac.nz\") do |a|\n figshare.other.private_account_info(impersonate: a['id'], &block)\n end\nend", "def set_tag\n @tag = @affiliate.tags.find(params[:id])\n end", "def load_with_associations\n @response = Response.with_associations.find(params[:id])\n end", "def set_advert\n @advert = Advert.where(id: params[:id]).accessible_by(current_ability).take\n end", "def load_associated(name)\n return nil unless association_id = send(\"#{name}_id\")\n\n class_name = send(\"#{name}_type\") || config_class_name_for(name)\n klass = class_name.classify.constantize\n\n primary_key = config_primary_key_for(name) || klass.primary_key\n\n klass.where(primary_key => association_id).first\n end", "def author\n @author ||= Author.new @instance, author_id\n end", "def author; User.get(self.author_id); end", "def show\n @affiliate_ctum = Affiliate::Ctum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @affiliate_ctum }\n end\n end", "def create\n\t\t@affiliation = @resume.affiliations.new({\n\t\t\t:start_date_string => Date.today.to_s,\n\t\t\t:end_date_string\t => Date.today.to_s,\n\t\t\t:organization => 'Organization',\n\t\t\t:relationship => 'Relationship'\n\t\t})\n\t\t@affiliation.save!\n\trescue\n\t\tflash.now[:error] = 'Affiliation creation FAILED!'\n\t\trender :text => ''\n\tend", "def register_affiliate_role\n Role.set_user_role(@data_object.user_id, \n user_affiliate, \n nil,\n RoleNameTable::REGISTERED,\n TargetTable::AFFILIATE,\n user_affiliate)\n end", "def create_affi_obj(lines_list, auth_id)\n tkn_idx = 0\n auth_affi = Author_Affiliation.new()\n auth_affi.article_author_id = auth_id\n inst_found = \"\"\n #while tkn_idx < lines_list.count\n while tkn_idx < lines_list.count\n a_line = lines_list[tkn_idx].strip\n # lines_hash.keys.each do |line_key|\n # a_line = lines_hash[line_key].strip\n # first element is designated as the affilition\n if tkn_idx == 0\n auth_affi.name = a_line\n elsif $affi_countries.include?(a_line)\n auth_affi.country = a_line\n elsif $affi_institutions.include?(a_line)\n if auth_affi.name != nil\n # if the affiliation name is not an institution\n # add institution to name and make short name the institution\n # otherwise shot name is the same as name\n if $affi_institutions.include?(auth_affi.name) or \\\n $institution_synonyms.keys.include?(auth_affi.name.to_sym) then\n auth_affi.short_name = auth_affi.name\n auth_affi.add_01 = a_line\n else\n auth_affi.name = auth_affi.name + \", \" + a_line\n auth_affi.short_name = a_line\n end\n end\n elsif $institution_synonyms.keys.include?(a_line.to_sym) then\n if auth_affi.name != nil\n # if the affiliation name is not an institution\n # add institution to name and make short name the institution\n # otherwise shot name is the same as name\n if !$affi_institutions.include?(auth_affi.name) and \\\n !$institution_synonyms.keys.include?(auth_affi.name.to_sym) then\n auth_affi.name = auth_affi.name + \", \" + $institution_synonyms[a_line.to_sym]\n auth_affi.short_name = $institution_synonyms[a_line.to_sym]\n else\n auth_affi.short_name = $institution_synonyms[a_line.to_sym]\n end\n end\n elsif auth_affi.add_01 == nil\n auth_affi.add_01 = a_line\n elsif auth_affi.add_02 == nil\n auth_affi.add_02 = a_line\n elsif auth_affi.add_03 == nil\n auth_affi.add_03 = a_line\n elsif auth_affi.add_04 == nil\n auth_affi.add_04 = a_line\n elsif auth_affi.add_05 == nil\n auth_affi.add_05 = a_line\n elsif auth_affi.add_05 != nil # case more than 5 tokes in address\n auth_affi.add_05 += \", \" + a_line\n end\n tkn_idx += 1\n end\n\n # make sure there is a short name, if blank make it the same as name\n if auth_affi.short_name == nil\n auth_affi.short_name = auth_affi.name\n end\n\n # if country is missing get check all addres lines in object\n if auth_affi.country == nil\n got_it = false\n auth_affi.instance_variables.each do |instance_variable|\n # look for country name in address strings\n if instance_variable.to_s.include?(\"add_0\") then\n #print instance_variable\n value = auth_affi.instance_variable_get(instance_variable)\n ctry = get_country_any(value.to_s)\n if ctry != nil then\n auth_affi.country = ctry\n value = drop_country(value)\n auth_affi.instance_variable_set(instance_variable, value)\n break\n end\n end\n end\n # look for country in affiliation name\n if auth_affi.country.to_s == \"\" then\n ctry = get_country_any(auth_affi.name)\n auth_affi.country = ctry\n end\n # look for country in institution table\n if auth_affi.country.to_s == \"\" then\n inst_found = auth_affi.name\n # separate lookup for sysnonyms as they are not registered as institution\n if $affi_institutions.include?(auth_affi.name)\n inst_found = auth_affi.name\n ctry = get_value(\"Affiliations\", \"country\", \"institution\", inst_found.strip)\n auth_affi.country = ctry\n elsif $affi_institutions.include?(auth_affi.short_name)\n inst_found = auth_affi.short_name\n ctry = get_value(\"Affiliations\", \"country\", \"institution\", inst_found.strip)\n auth_affi.country = ctry\n elsif $institution_synonyms.keys.include?(auth_affi.name.to_sym)\n inst_found = $institution_synonyms[auth_affi.name.to_sym]\n ctry = get_value(\"Affiliations\", \"country\", \"institution\", inst_found.strip)\n auth_affi.country = ctry\n elsif $institution_synonyms.keys.include?(auth_affi.short_name.to_sym)\n inst_found = $institution_synonyms[auth_affi.short_name.to_sym]\n ctry = get_value(\"Affiliations\", \"country\", \"institution\", inst_found.strip)\n auth_affi.country = ctry\n end\n end\n end\n return auth_affi\nend", "def fetch_attr\n return if @attr_loaded\n response = nil\n Net::HTTP.start(\"www.amazon.co.jp\") do |http|\n response = http.get(\"/gp/aw/d.html?a=#{@asin}\")\n end\n page = Nokogiri::HTML.parse(response.body, nil, \"SJIS\")\n @attr[:smallimage] = page.xpath(\"//img[contains(@src, '.jpg')]/@src\").to_s\n \n @attr_loaded = true\n end" ]
[ "0.7576979", "0.71180224", "0.7006972", "0.6971306", "0.6971306", "0.69453984", "0.6767858", "0.64777255", "0.6450353", "0.643987", "0.62531483", "0.61321", "0.6087326", "0.60826844", "0.60661167", "0.6044205", "0.60323656", "0.60002416", "0.594913", "0.59291613", "0.5860109", "0.5806611", "0.5728453", "0.56861234", "0.5674712", "0.5673938", "0.56689197", "0.5609888", "0.55836314", "0.5530336", "0.550584", "0.54782236", "0.5448813", "0.5447121", "0.54093766", "0.5408453", "0.5400793", "0.5385107", "0.5324134", "0.53210723", "0.5312637", "0.52819556", "0.52786183", "0.5223352", "0.5220366", "0.5203903", "0.5182983", "0.51620877", "0.5143292", "0.5131943", "0.5126387", "0.50928193", "0.50922453", "0.5060071", "0.50413716", "0.50391454", "0.5033596", "0.50167936", "0.5011666", "0.50084376", "0.49978447", "0.4976213", "0.49649024", "0.4942862", "0.49182", "0.49066716", "0.4904982", "0.49034673", "0.4901499", "0.49005136", "0.49005136", "0.48873383", "0.48848143", "0.48821595", "0.48814538", "0.4871818", "0.4871066", "0.48674124", "0.48660123", "0.4862868", "0.4860919", "0.48568135", "0.4849864", "0.48494262", "0.4846529", "0.48427188", "0.48383132", "0.48378333", "0.48364428", "0.48304766", "0.4827871", "0.4808852", "0.4798735", "0.47944862", "0.4788999", "0.4783975", "0.47630307", "0.47511342", "0.47485593", "0.4742692" ]
0.7796084
0
record the fact that this user is registered in an affiliate
def register_affiliate_role Role.set_user_role(@data_object.user_id, user_affiliate, nil, RoleNameTable::REGISTERED, TargetTable::AFFILIATE, user_affiliate) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def affiliate\n @affiliate || Affiliate.with_id(@data_object.user_affiliate)\n end", "def affiliate\n self.affiliate_class && affiliate_id && self.affiliate_class.find(affiliate_id)\n end", "def set_affiliate\n if affiliate.present?\n account.affiliate_id = affiliate.id\n account.affiliate_other = affiliate.subaffiliates_enabled? ? account_params[:affiliate_other] : nil\n else\n account.affiliate_id = account.affiliate_other = nil\n end\n account\n end", "def set_affiliate\n @affiliate = Affiliate.find(params[:id])\n end", "def associated_with_affiliate?(aff_id)\n (aff_id == @data_object.user_affiliate) ||\n role_assoc_with_affiliate?(aff_id)\n end", "def set_affiliate\n @affiliate = Affiliate.find(params[:id])\n end", "def set_affiliate\n @affiliate = Affiliate.find(params[:id])\n end", "def affiliate_affiliations\n @affiliate_affiliations ||= Affiliation.find_by_uid(uid)\n end", "def affiliation=(affil)\n affiliations.clear\n affiliations << affil\n end", "def affiliation\n @affiliation ||= auth_types_collection[attrs[:patron_status]] unless attrs[:patron_status].nil?\n end", "def add_association(current_user)\n self.associate(current_user)\n 'New Oauth provider added'\n end", "def affiliate= affiliate\n if affiliate\n if affiliate.class != affiliate_class # self.class.to_s != \"#{affiliate.class.to_s}Reference\"\n raise \"Attempt to affiliate #{self.class.to_s} reference with #{affiliate.class} object.\"\n elsif affiliate_id && (affiliate_id != affiliate.id)\n raise \"Attempt to create ambiguous reference by asserting new affiliate\"\n else\n self.affiliate_id = affiliate.id\n end\n end\n end", "def register\n @unsigned_users = @olympiad.unsigned_users()\n unless @registration\n if @registration = Registration.for_user(current_user).for_olympiad(@olympiad).first\n flash.now[:notice] = \"You have already registered for this event. Feel free to make changes to your registration, below.\"\n else\n @registration = Registration.new\n end\n end\n end", "def affiliation_id=(affil_id)\n self.affiliation_ids = affil_id\n end", "def create\n\t\t@affiliation = @resume.affiliations.new({\n\t\t\t:start_date_string => Date.today.to_s,\n\t\t\t:end_date_string\t => Date.today.to_s,\n\t\t\t:organization => 'Organization',\n\t\t\t:relationship => 'Relationship'\n\t\t})\n\t\t@affiliation.save!\n\trescue\n\t\tflash.now[:error] = 'Affiliation creation FAILED!'\n\t\trender :text => ''\n\tend", "def create_user\n user = User.where(email: user_email)\n if user.blank? # new user\n @user = create_new_user\n church = nil\n if affiliation.blank?\n church = create_affiliation_from_church\n else\n church = Affiliation.find(self.affiliation)\n end\n @user.affiliation = church\n church.users << @user\n @user.save\n\n guest = Role.find_by_name(\"Guest\").id \n @user.role_ids=[guest]\n self.user_id = @user.id\n end\n end", "def set_affiliation\n @affiliation = Affiliation.find(params[:id])\n end", "def any_registered(user)\n # juniors can't do anything, so it's all currently in registered adult\n end", "def create\n @affiliate = Affiliate.new(params[:affiliate])\n\n respond_to do |format|\n if @affiliate.save\n flash[:notice] = 'Affiliate was successfully created.'\n format.html { redirect_to(@affiliate) }\n format.xml { render :xml => @affiliate, :status => :created, :location => @affiliate }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @affiliate.errors, :status => :unprocessable_entity }\n end\n end\n end", "def affiliate_params\n params.require(:affiliate).permit(:name, :affid)\n end", "def using_affiliate?(account_type)\n affiliate_account_types.include?(account_type.to_s.classify)\n end", "def check_affiliate_program\r\n\r\n # check the user first\r\n if session_user\r\n if session_user.affiliate_user\r\n # if the user is an affiliate user and the program is not active, don't set the members\r\n return if !session_user.affiliate_user.affiliate_program.active?\r\n # the user if an affiliate user and the program is still active\r\n @affiliate_program = session_user.affiliate_user.affiliate_program\r\n @affiliate = @affiliate_program.affiliate\r\n @affiliate_member_id = session_user.affiliate_user.affiliate_unique_id\r\n return\r\n else\r\n # the user is logged in but ther user isn't an affiliate user\r\n return\r\n end\r\n end\r\n\r\n # no session user...check the cookies only if there are no url parameters\r\n unless params[:affiliate]\r\n @affiliate_program ||= AffiliateProgram.find(cookies[:affiliate_program_id]) if !cookies[:affiliate_program_id].blank?\r\n @affiliate_program ||= AffiliateProgram.find_by_permalink(cookies[:affiliate_permalink]) if cookies[:affiliate_permalink]\r\n\r\n if @affiliate_program && !@affiliate_program.active?\r\n @affiliate_program = nil\r\n end\r\n\r\n @affiliate = @affiliate_program.affiliate if @affiliate_program\r\n @affiliate_member_id = cookies[:affiliate_unique_id] if cookies[:affiliate_unique_id]\r\n return\r\n end\r\n\r\n # there are params on the URL and the user is not logged in.\r\n @affiliate_program = AffiliateProgram.find_by_permalink(params[:affiliate])\r\n handle_no_affiliate and return unless @affiliate_program\r\n # if the affiliate program is not active, cast off the association with the affiliate.\r\n # TODO LTC - should this message the user that they are too late?\r\n if (@affiliate_program == nil) || !@affiliate_program.active?\r\n @affiliate_program = nil\r\n return\r\n end\r\n\r\n @affiliate = @affiliate_program.affiliate\r\n handle_no_affiliate and return unless @affiliate\r\n\r\n @affiliate_member_id = (@affiliate && @affiliate.member_id_var_name) ? params[@affiliate.member_id_var_name] : params[:aid]\r\n #handle_no_affiliate and return unless @affiliate_member_id\r\n\r\n cookies[:affiliate_id] = @affiliate_program.affiliate.id.to_s\r\n cookies[:affiliate_program_id] = @affiliate_program.id.to_s\r\n cookies[:affiliate_unique_id] = @affiliate_member_id.to_s if @affiliate_member_id\r\n end", "def new_affiliate\n resource = build_resource\n resource.role = 'affiliate'\n resource.build_affiliate\n respond_with resource\n end", "def candidate_sign_up\n\n end", "def has_autorisation_icarien?(duser)\n drequest = {\n where: {user_id: duser[:id], raison: 'ICARIEN ACTIF'}\n }\n table_autorisations_online.count(drequest) > 0\n end", "def advised?\n advisor_company_affiliations.with_access.present?\n end", "def affiliate_class\n self.class.affiliate_class\n end", "def affiliate_status\n get 'affiliateStatus'\n end", "def on_behalf_of_user_id\n return @on_behalf_of_user_id\n end", "def create\n @member = @current_user\n unless params[:organization][:id].blank?\n @organization = Organization.find(params[:organization][:id])\n else\n @organization = Organization.new(params[:organization])\n @phone = Phone.new(params[:phone])\n @phone.phonable_type = 'Organization'\n @phone.tag_for_phone = 'main'\n @organization.phones << @phone\n @organization.created_by = @member.id\n @organization.save!\n end\n exists = Affiliation.find(:first,\n :conditions => \"user_id = #{@current_user.id} and organization_id = #{@organization.id}\")\n if exists\n failure \"Request rejected. #{@current_user.name} already requested affiliation \" +\n \"with #{@organization.name}. You can check the status by asking in \" +\n \"<a href=\\\"http://foodmoves.campfirenow.com/e08e3\\\" \" +\n \"onclick=\\\"window.open(this.href,'Chat','width=650,height=1000');return false;\\\">chat</a>.\"\n else \n @affiliation = Affiliation.new(\n :user_id => @current_user.id,\n :organization_id => @organization.id)\n if @affiliation.save\n begin\n InvitationMailer::deliver_affiliation(@current_user, @organization)\n AdminMailer::deliver_affiliation(@current_user, @organization, @affiliation)\n rescue\n failure \"Affiliation entered but unable to send email notification.\"\n end\n flash[:notice] = \"Within the next business day, our support team will\n contact #{@organization.name} \n to verify that you are authorized to trade.\"\n chat_alert('team', \"#{@current_user.name} wants to get set up for trading\")\n else\n failure \"Unable to submit request for affiliation.\"\n end\n end\n unless @fail\n redirect_to member_url(@member)\n else\n flash[:error] = @err_msg \n redirect_to :back \n end\n end", "def on_users_account\n true\n end", "def affiliations\n iq = connection.iq_stanza({'to'=>jid.bare},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSubOwner},\n x('affiliations',:node => node_id)\n )\n )\n send_iq_stanza_fibered iq\n end", "def party_affiliation\n @registration.party_affiliation.blank? ? 'Not stated' : @registration.party_affiliation\n end", "def on_behalf_of_user_id=(value)\n @on_behalf_of_user_id = value\n end", "def get_affiliations\n affiliations\n end", "def increment_user_counter_cache\n return true unless self.user && self.observation\n if self.user_id != self.observation.user_id\n self.user.increment!(:identifications_count)\n end\n true\n end", "def increment_user_counter_cache\n return true unless self.user && self.observation\n if self.user_id != self.observation.user_id\n self.user.increment!(:identifications_count)\n end\n true\n end", "def index\n @var = User.find(params[:affiliate_program_id])\n @affiliate = Affiliate.new\n end", "def affiliates_enabled?\n affiliate_account_types.present?\n end", "def given_registered_user(attributes = {})\n given_user(:registered_user, attributes.merge(balanced_url: nil))\n end", "def show\n @affiliate = Affiliate.find(params[:id])\n if @affiliate and (current_user.is_admin or @affiliate.email == current_user.email)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @affiliate }\n end\n else\n redirect_to \"/\"\n end\n\n end", "def affiliation\n []\n end", "def add_omniauth_identity_to_current_user\n current_user.identities.build.apply_omniauth(omniauth).save\n end", "def associate_with_user\n if user_id.nil? || user.email == Address::PLACEHOLDER_EMAIL\n self.user_id = User.find_or_create_by_details(\n email: email_address, name: billing_full_name\n ).id\n end\n end", "def link_account(provider, uid)\n self[provider.column.to_sym] = uid\n self.save\n end", "def hobo_openid_complete_new_user(response, openid, options = {})\n # Generate parameters for new user record\n user_attrs = {options[:openid_field] => openid}\n sreg = OpenID::SReg::Response.from_success_response(response)\n\n unless sreg.empty?\n options[:mappings].each do |set,mappings|\n mappings.each do |key,col|\n \t\t user_attrs[col] = sreg[key.to_s]\n end\n \t end\n end\n\n user = options[:model].new(user_attrs)\n logger.info user_attrs\n\n flash[:notice] = options[:new_user_failure_notice] unless user.save false\n\n self.current_user = user\n redirect_to(:action => \"edit\", :id => user.id)\n end", "def create\n create_person\n @user.identified\n end", "def maintain_affiliates\n values = {\n 'aff_opts' => Affiliate.options,\n 'aff_id' => -1,\n 'form_url' => url(:handle_maintain),\n }\n\n standard_page(\"Maintain Affiliates\", values, MAINTAIN_AFFILIATES)\n end", "def user_registered? user\n return nil if user.nil?\n return nil if user.person.nil?\n\n if self.registrations.where(:person_id => user.person.id).count == 0\n logger.debug(\"User #{user.email} isn't registered to self.title\")\n return false\n else\n return true\n end\n end", "def user_registered? user\n return nil if user.nil?\n return nil if user.person.nil?\n\n if self.registrations.where(:person_id => user.person.id).count == 0\n logger.debug(\"User #{user.email} isn't registered to self.title\")\n return false\n else\n return true\n end\n end", "def associate_auth(source)\n return if user_authentications.where(:provider => source['provider'], :uid => source['uid'].to_s).count > 0\n self.user_authentications.create!(:provider => source['provider'], :uid => source['uid'], :nickname => source[\"user_info\"]['nickname'])\n end", "def become_an_advisor_for(company)\n advised_company_affiliations.create(company_id: company.id)\n end", "def add_user_allowed?\n client_token_sale_detail = ClientTokenSaleDetail.get_from_memcache(@client_id)\n\n return error_with_identifier('token_sale_ended',\n 'um_u_c_aua_1'\n ) if client_token_sale_detail.has_registration_ended?\n\n success\n end", "def user_on\n session[:user_id] = '3980284084'\n end", "def affiliation\n affiliations.try(:first)\n end", "def open_user_account\n Account.create(user_id: self.id) \t\n end", "def _user_add f = {}\n\t\tf[:salt] \t\t= _random_string 5\n\t\tf[:created] \t= Time.now\n\n\t\trequire \"digest/sha1\"\n\t\tf[:pawd] \t\t= Digest::SHA1.hexdigest(f[:pawd] + f[:salt])\n\n\t\t_throw L[:'the user is existing'] if _user? f[:name]\n\n\t\tDB[:_user].insert(f)\n\t\tuid = DB[:_user].filter(:name => f[:name]).get(:uid)\n\t\tuid ? uid : 0\n\tend", "def create\n user = Member.new(user_params)\n if user.save\n code = user.id + 24523009\n user.update(affiliate_code: code)\n MemberupJob.set(wait: 20.seconds).perform_later(user)\n sign_in(user)\n render json: user,serializer: Api::V1::MembersSerializer, :status => 201\n else\n render json: \"errors\", :status => 422\n end \n end", "def account\n @title = \"Account Details\"\n # Update account details\n if request.post?\n if @affiliate.update_attributes(params[:affiliate])\n flash.now[:notice] = \"Account details saved.\"\n else\n flash.now[:notice] = \"There was a problem saving your account.\"\n end\n end\n end", "def users_joined?\n true\n end", "def sign_up_candidate\n\n end", "def register\n if @user.blank? || (!@user.is_registered && @user.tips.count == 0 && @user.votes.count == 0)\n redirect_to :profile, alert: \"Registration Impossible. There is nothing to register\"\n elsif @user.is_registered\n redirect_to :profile, alert: \"Registration Impossible. Account already registered\"\n else\n if @user.register(user_registration_params.to_h)\n #cookies.delete(\"user_id\") #don't delete the cookie, just in case I'm logging in on someone else's device.\n sign_in @user\n redirect_to :profile, notice: \"Account successfully registered. You can now login from anywhere !\"\n else\n redirect_to :profile, alert: \"Registration failed. #{@user.errors.full_messages.to_sentence}\"\n end\n end\n end", "def user_access_create\n check_user_access(params[:user_id])\n end", "def user_access_create\n check_user_access(params[:user_id])\n end", "def create\n @affiliation = Affiliation.new(affiliation_params)\n\n respond_to do |format|\n if @affiliation.save\n format.html { redirect_to affiliations_url, notice: 'Affiliation was successfully created.' }\n # format.json { render :show, status: :created, location: @affiliation }\n else\n format.html { render :new }\n format.json { render json: @affiliation.errors, status: :unprocessable_entity }\n end\n end\n end", "def enroll\n company = Company.find( params[:company_id])\n current_user_id = current_user( company.slug).id\n #user = User.find( current_user_id)\n course = Course.find( params[:id])\n if course.category == 1\n #public auto add user\n signup = course.course_signups.build\n signup.user_id = current_user_id\n signup.status = 1\n signup.save\n #course.users << user\n else\n #private set status to 1\n signup = course.course_signups.find_by_user_id( current_user_id)\n signup.status = 1\n signup.save\n end\n redirect_to company_trainings_path( company.slug)\n end", "def create\n @affiliation = Affiliation.new(affiliation_params)\n\n respond_to do |format|\n if @affiliation.save\n format.html { redirect_to :back }\n #format.json { render :show, status: :created, location: @affiliation }\n else\n format.html { redirect_to :back }\n #format.json { render json: @affiliation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n if @user.openid_url.nil? || @user.openid_url.blank?\n handle_traditional_registration\n else\n handle_openid_registration\n end\n end", "def create\n @user = User.new(params[:user])\n @user.role = 'influencer'\n # Account approved\n @user.approved = true\n # Assign twitter credentials\n @user.twitter_linked = true\n @user.twitter_screen_name = session['twitter_screen_name']\n @user.twitter_uid = session['twitter_uid']\n @user.twitter_token = session['twitter_token']\n @user.twitter_secret = session['twitter_secret']\n\n if @user.save\n # Set the referrer commission\n if session[:referrer_id]\n @user.update_attribute(:referrer_commission, 5)\n end\n # Clear session values\n session[:referrer_id] = session['twitter_screen_name'] = session['twitter_uid'] = session['twitter_token'] = session['twitter_secret'] = nil\n # Login user\n sign_in(:user, @user)\n\n @influencer = current_user.influencer\n\n if @influencer.audience.followers < 1000\n @influencer.update_attribute( :approved , false)\n @influencer.update_attribute(:need_approval , true)\n @influencer.mail_need_approval\n else\n @influencer.update_attribute( :approved , true)\n @influencer.update_attribute(:need_approval , false)\n end\n\n # Complete profiles\n redirect_to action: :step_2\n else\n @referrer = User.where(:id => session[:referrer_id]).first if session[:referrer_id]\n render action: :new\n end\n end", "def whole_affil (new_party_affiliation)\n if new_party_affiliation == \"d\"\n \"Democrat\"\n else new_party_affiliation == \"r\"\n \"Republican\"\n end\n end", "def affiliation_id\n affiliation_ids.try(:first)\n end", "def created_on_behalf_of\n return @created_on_behalf_of\n end", "def self_signup?\n user_id == author_id\n end", "def influencer_converted_to_affiliate(user)\n set_attachments\n\n mail(to: user.email, subject: \"Notificaciones @ Social Target - Has sido recategorizado en Social Target\")\n end", "def before_create_user\n logger.debug(\"on before creare user\")\n #Generate a unique key\n if facebook_user?\n self.active = 1 \n else\n activation_key_string = self.salt+self.email+self.hashed_password\n self.activation_key =Digest::SHA1.hexdigest(activation_key_string)\n self.active = 0\n end\n self.admin = 0 \n self.handle=generate_unique_handle\n \n end", "def affiliation(name, req, desc)\n params = {:name => name, \n :description => desc,\n :requires_memberid => req}\n ClubAffiliation.create_or_update_by(:name, params)\nend", "def add_angel(user_id, anonymous)\n\n if anonymous == 1\n self.anon_angel = true\n else \n self.anon_angel = false\n end\n \n self.angel_id = user_id\n self.current_status = 5\n \n Status.create(:request_id => self.id, :status => 'Matched, initial') \n \n self.save\n Email.new.send_email(\"Angel Signup\", User.find(self.angel_id), self.id)\n\tend", "def record_signup identifier,session_id,options={ },parent_user_id=nil\n options.merge! :signup => { :parent_user_id => parent_user_id} if parent_user_id\n options.merge! :user_profile => { :session_id => session_id , :user_id => identifier}\n record :signup,@iteration_number,identifier,options\n end", "def registration_owned?\n if current_user\n current_user == Registration.find_by(id: params[:id]).user\n end\n end", "def signup_info\n end", "def registered?\n begin\n self.get_registration\n true\n rescue => e\n # any error should be treated as the user not being registered\n false\n end\n end", "def user_verified; end", "def affiliations\n @net_ldap_entry[:berkeleyeduaffiliations]\n end", "def associate_user\n \tfbUserIdString = params[:idString]\t\n \tuser = User.new(fbUserId:fbUserIdString)\n \tif user.valid?\t\n\t\t\t user = User.create(fbUserId:fbUserIdString)\n\t\t\t success = true\n\t\t end\n\t\t start_session(fbUserIdString)\n end", "def get_affiliations_count\r\n @summary.affiliations_count\r\n end", "def register(data)\n unless @registered\n @user = Hashie::Mash.new(data)\n @user.event_machine_connection_id = @connection.id\n @user.event_machine_connection = self\n puts \"uuid: #{@user.uuid}\"\n puts \"first_name: #{@user.first_name}\"\n puts \"last_name: #{@user.last_name}\"\n puts \"software_key: #{@user.auth_key}\"\n puts \"type: #{@user.type}\"\n puts \"identifier (em): #{@user.event_machine_connection_id.to_s}\"\n \n # store user in global hash - (this could also be in mongodb,mysql,redis,etc)\n $connections.store(@user.uuid,@user)\n puts $connections.inspect\n \n unless !$connections.has_key? @user.uuid\n puts \"user is registered and in $connections hash\"\n @registered = true\n $ws_notifier.call(\"#{@user.uuid} just registered on the server\",\"connection\")\n else\n puts \"epic fail. shutting down now\"\n end\n else\n puts \"user is already registered. ignoring re-registration\"\n end\n \n end", "def hobo_openid_complete_user_exists(user, options = {})\n\t # If supplied, a block can be used to test if this user is\n \t# allowed to log in (e.g. the account may be disabled)\n return if block_given? && !yield(user)\n\n # Change current_user\n self.current_user = user\n\n \t if params[:remember_me] == \"1\"\n\t current_user.remember_me\n\t create_auth_cookie\n \t end\n\n \t flash[:notice] ||= options[:success_notice]\n\n\t redirect_back_or_default(options[:redirect_to] || homepage(request)) unless performed?\n end", "def registered(user_attendances, current_event_id)\n user_attendances.each do |attendance|\n # user is attending this event \n return attendance.id if attendance.event_id == current_event_id.to_i\n end\n # user is not attending this event\n return FALSE\n end", "def create\n @cms_affiliation = Cms::Affiliation.new(cms_affiliation_params)\n\n respond_to do |format|\n if @cms_affiliation.save\n format.html { redirect_to @cms_affiliation, notice: 'Affiliation was successfully created.' }\n format.json { render :show, status: :created, location: @cms_affiliation }\n else\n format.html { render :new }\n format.json { render json: @cms_affiliation.errors, status: :unprocessable_entity }\n end\n end\n end", "def person_extra_methods\n include Domainify::InstanceMethods\n #confirm account id is correct on create of user\n after_create :update_user_account_id\n end", "def affiliate_link?\n !current_user.try(:admin?)\n end", "def handle_activation(user)\n\t\t\n\tend", "def notify_user(ad)\n #create notification for the user\n notification = self.notifications.unviewed.event(:new_relevant_ad).new\n notification.user = self.user\n notification.ad = ad\n notification.save!\n end", "def has_been_acquired_by_user?(user)\n current_user_profile = Profile.find_by(user_id: user.id)\n addition = Addition.find_by(profile_id: current_user_profile, story_id: self.id)\n addition != nil\n end", "def record_user_activity\n current_user.touch :last_active_at if current_user\n end", "def identity_create\n # Potential threat of overlap\n identity = Identity.create(uid:rand(100000000..9999999999), provider: 'registration')\n identity.user_id = resource.id\n identity.name = params['user']['name'] #Looks very ugly\n identity.email = resource.email\n identity.save\n end", "def on_success!(response, sreg_response)\n if user = find_user_by_identity_url(response.identity_url)\n user\n else\n request.session[:'openid.url'] = response.identity_url\n required_reg_fields.each do |f|\n session[:\"openid.#{f}\"] = sreg_response.data[f] if sreg_response.data[f]\n end if sreg_response\n redirect!(Merb::Router.url(:signup))\n end\n end", "def after_create(user)\n if user.invited_by_id?\n invitation = Invitation.new(sender: user.invited_by, friend: user)\n invitation.accept!\n else\n # TODO There's a potential exploit here where someone creates 100 dummy accounts, invites one account and collects all the free time on that one account.\n Invitation.where(email: user.email).each do |invitation|\n invitation.friend = user\n invitation.accept!\n end\n end\n end", "def activate\n @membership.activate!\n @membership.generate_dues_invoice!\n _user = @membership.user\n _user.roles = [:member]\n _user.save\n flash[:success] = \"Successfully activated #{ @membership.user.full_name }\"\n redirect_to '/'\n end", "def create\n # logout_keeping_session!\n full_logout\n \n if using_open_id?\n open_id_authentication\n else\n password_authentication\n end\n save_sponsor_user \n end" ]
[ "0.7254574", "0.6769462", "0.6681267", "0.6371687", "0.6345233", "0.62661225", "0.62661225", "0.61951137", "0.6160961", "0.6010346", "0.59804493", "0.5948432", "0.5932091", "0.5894587", "0.5877874", "0.5870102", "0.5861741", "0.5842778", "0.579431", "0.5734288", "0.57342726", "0.5731129", "0.5719634", "0.56797296", "0.56590295", "0.5658921", "0.5648429", "0.56201404", "0.560899", "0.5604526", "0.56027424", "0.55760556", "0.55744845", "0.55619895", "0.5540878", "0.55370826", "0.55370826", "0.5519906", "0.5489102", "0.5481858", "0.5481555", "0.5477115", "0.5474834", "0.54676986", "0.54632205", "0.5460715", "0.54515064", "0.54454166", "0.54429317", "0.54429317", "0.5440641", "0.5417764", "0.5417161", "0.54148054", "0.5411965", "0.53983", "0.53972316", "0.5383778", "0.5377261", "0.53710604", "0.53688335", "0.53586257", "0.53509533", "0.53509533", "0.5348192", "0.53478146", "0.5346327", "0.53306544", "0.5329239", "0.53282344", "0.53231263", "0.5317562", "0.5313236", "0.53074735", "0.5303577", "0.5298005", "0.5287885", "0.52826095", "0.52790475", "0.52769345", "0.52730983", "0.5270332", "0.52698654", "0.5263243", "0.52578783", "0.52540976", "0.5251956", "0.52469677", "0.52417916", "0.52412575", "0.5235845", "0.52328366", "0.52279377", "0.5227248", "0.52255374", "0.521731", "0.52147824", "0.52117294", "0.52108216", "0.52070165" ]
0.68785167
1
Affiliate stuff. A user has one primary and any number of secondary affiliates. Is this user associated with the given affiliate?
def associated_with_affiliate?(aff_id) (aff_id == @data_object.user_affiliate) || role_assoc_with_affiliate?(aff_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def affiliate\n self.affiliate_class && affiliate_id && self.affiliate_class.find(affiliate_id)\n end", "def using_affiliate?(account_type)\n affiliate_account_types.include?(account_type.to_s.classify)\n end", "def advised?\n advisor_company_affiliations.with_access.present?\n end", "def affiliate\n @affiliate || Affiliate.with_id(@data_object.user_affiliate)\n end", "def affiliate_link?\n !current_user.try(:admin?)\n end", "def affiliates_enabled?\n affiliate_account_types.present?\n end", "def employs?(user)\n employees.include?(user) or (affiliate == user) or user.admin?\n end", "def has_autorisation_icarien?(duser)\n drequest = {\n where: {user_id: duser[:id], raison: 'ICARIEN ACTIF'}\n }\n table_autorisations_online.count(drequest) > 0\n end", "def includes?(user)\n # is a directly associated User\n self.users.where(id: user.id).count.positive? ||\n # has a matching email address\n self.email_patterns.find{ |p| p.matches?(user.email) }.present? ||\n # belongs to an associated department\n self.departments.where(name: user.department&.name).count.positive? ||\n # is of an associated affiliation\n self.affiliations.where(id: user.affiliation_id).count.positive? ||\n # belongs to an associated AD group\n # (this check comes last because it is the most expensive)\n self.ad_groups.find{ |g| user.belongs_to_ad_group?(g) }.present?\n end", "def owner?(user_asking)\n user_asking.in? company.owners\n end", "def account_belongs_to?(user, acct_no)\n acct_user = DB[:Account].where(AcctNo: acct_no).first[:UserID]\n acct_user == user\n end", "def advising?(other_user)\n advisees.include?(other_user)\n end", "def is_associated?\n itinerary = self.selected_itinerary\n if itinerary.nil?\n return false\n end\n\n service = itinerary.service\n if service.nil?\n return false\n end\n\n return service.is_associated_with_user? self.trip.user\n\n end", "def show?\n if user.type == 'ReferralAgency'\n user.tenants.include?(app.tenant)\n else\n user.properties.each do |property|\n return true if property.applications.include?(app)\n end\n false\n end\n end", "def user_owns_identity_url?\n current_user && current_user.login.downcase == extract_identity(openid_request.identity_url)\n end", "def set_affiliate\n if affiliate.present?\n account.affiliate_id = affiliate.id\n account.affiliate_other = affiliate.subaffiliates_enabled? ? account_params[:affiliate_other] : nil\n else\n account.affiliate_id = account.affiliate_other = nil\n end\n account\n end", "def employer?(affiliation_group)\n org = affiliation_group.first['summaries'].first\n if org['employment-summary']['organization']['disambiguated-organization'] != nil && \n (\n org['employment-summary']['organization']['disambiguated-organization']['disambiguation-source'] == 'RINGGOLD' ||\n org['employment-summary']['organization']['disambiguated-organization']['disambiguation-source'] == 'GRID'\n )\n return true if org['employment-summary']['organization']['disambiguated-organization']['disambiguated-organization-identifier'] == @orc_id\n end\n false\n end", "def check_affiliate_program\r\n\r\n # check the user first\r\n if session_user\r\n if session_user.affiliate_user\r\n # if the user is an affiliate user and the program is not active, don't set the members\r\n return if !session_user.affiliate_user.affiliate_program.active?\r\n # the user if an affiliate user and the program is still active\r\n @affiliate_program = session_user.affiliate_user.affiliate_program\r\n @affiliate = @affiliate_program.affiliate\r\n @affiliate_member_id = session_user.affiliate_user.affiliate_unique_id\r\n return\r\n else\r\n # the user is logged in but ther user isn't an affiliate user\r\n return\r\n end\r\n end\r\n\r\n # no session user...check the cookies only if there are no url parameters\r\n unless params[:affiliate]\r\n @affiliate_program ||= AffiliateProgram.find(cookies[:affiliate_program_id]) if !cookies[:affiliate_program_id].blank?\r\n @affiliate_program ||= AffiliateProgram.find_by_permalink(cookies[:affiliate_permalink]) if cookies[:affiliate_permalink]\r\n\r\n if @affiliate_program && !@affiliate_program.active?\r\n @affiliate_program = nil\r\n end\r\n\r\n @affiliate = @affiliate_program.affiliate if @affiliate_program\r\n @affiliate_member_id = cookies[:affiliate_unique_id] if cookies[:affiliate_unique_id]\r\n return\r\n end\r\n\r\n # there are params on the URL and the user is not logged in.\r\n @affiliate_program = AffiliateProgram.find_by_permalink(params[:affiliate])\r\n handle_no_affiliate and return unless @affiliate_program\r\n # if the affiliate program is not active, cast off the association with the affiliate.\r\n # TODO LTC - should this message the user that they are too late?\r\n if (@affiliate_program == nil) || !@affiliate_program.active?\r\n @affiliate_program = nil\r\n return\r\n end\r\n\r\n @affiliate = @affiliate_program.affiliate\r\n handle_no_affiliate and return unless @affiliate\r\n\r\n @affiliate_member_id = (@affiliate && @affiliate.member_id_var_name) ? params[@affiliate.member_id_var_name] : params[:aid]\r\n #handle_no_affiliate and return unless @affiliate_member_id\r\n\r\n cookies[:affiliate_id] = @affiliate_program.affiliate.id.to_s\r\n cookies[:affiliate_program_id] = @affiliate_program.id.to_s\r\n cookies[:affiliate_unique_id] = @affiliate_member_id.to_s if @affiliate_member_id\r\n end", "def can_disable_affiliate_branding?\n !self.invitation.nil? && \n !self.affiliate.nil? && \n (!self.subscription.trial? || !self.invitation_subscription?)\n end", "def association?(object, associations); end", "def is_company_the_account_holder_company?(company, current_user)\n company.id == current_user.company_id\n end", "def partner_staff?\n staff? && agencies.any? { |a| a.partner? }\n end", "def user_owner?(id)\n # find the role id for owner\n owner_id = DB[:roles].select.where(:name=>'Owner').all[0][:id]\n\n # I am not sure if a user can have more than one roll so I am going to assume it can\n users_roles = DB[:roles_users].select.where(:user_id=>id).all\n users_roles.each do |users_role|\n if users_role[:role_id] == owner_id\n return true\n else\n next\n end\n end\n return false\nend", "def staff_owned_gate?\n record.check_points.where(registrar: user).map(&:gate?).reduce(:|)\n end", "def affiliate_affiliations\n @affiliate_affiliations ||= Affiliation.find_by_uid(uid)\n end", "def enrolled?(user)\n return false if user == owner\n users.include?(user)\n end", "def is_approver?(user)\n\n self.users.include?(user)\n\n end", "def owned_by? a_user\n a_user == user\n end", "def accessible_for?(user)\n user_id == user.id && !user.anonimous?\n end", "def participa?(otro_user)\n cousers.include?(otro_user)\n end", "def author?(user)\n authors.member?(user)\n end", "def transferred_identity?\n secondary_identity? && participant_profiles.any?\n end", "def owner_active?(feature, owner)\n return false unless owner\n redis.sismember(owner_key(feature, owner), owner.id)\n end", "def user_active?(feature, user)\n rollout.active?(feature, user)\n end", "def additional_identity?\n secondary_identity? && participant_profiles.blank?\n end", "def affiliation\n affiliations.try(:first)\n end", "def show\n @affiliate = Affiliate.find(params[:id])\n if @affiliate and (current_user.is_admin or @affiliate.email == current_user.email)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @affiliate }\n end\n else\n redirect_to \"/\"\n end\n\n end", "def president_of_institution?(inst)\n return (self.institution_id == inst.id && self.status == GlobalConstants::SOCIETY_ROLES[:president]);\n end", "def original_identity?\n external_identifier == user_id\n end", "def donors?(other_user)\n\t\tdonors.include?(other_user)\n\tend", "def is_author_of?(item)\n if item.respond_to?(:user)\n self == item.user\n elsif item.respond_to?(:pseud)\n self.pseuds.include?(item.pseud)\n elsif item.respond_to?(:pseuds)\n !(self.pseuds & item.pseuds).empty? \n else\n false\n end\n end", "def candy_belongs_to_user(current_user)\n if self.shop.user_id == current_user.id\n return true\n else\n return false\n end\n end", "def only_one_primary_by_user\n\n\t\treturn true if self.user.nil?\n\t\tnumber_of_primary_email_of_the_user = self.user.email_source_accounts.where(primary: true).count\n\t\tif number_of_primary_email_of_the_user > 0 && self.primary\n\t\t\t#errors.add(\"You can't add more than one primary email_source_account by user\")\n\t\t\treturn false\n\t\telse\n\t\t\treturn true\n\t\tend\n\tend", "def member_of?(context)\n context.users.include? self\n end", "def display_link?(user)\n TeamMembership.where(idea_build_id: self.idea_build.id).any? {|tm| tm.user_id == user.id}\n end", "def following?(other_business_id)\n businesses_in_network.map(&:id).include?(other_business_id)\n end", "def is_invitable_by(another_user)\n !!(\n is_associated_to_somebody_else_than(another_user) &&\n @swimmer.associated_user.find_any_friendship_with(another_user).nil?\n )\n end", "def member?(trip)\n trip.users.include?(self)\n end", "def secondary_identity?\n !original_identity?\n end", "def company?\n Profile.find_by_name('Entreprise financière').id == profile_id.to_i rescue false\n end", "def has_member?(user_or_person)\n user_or_person = user_or_person.try(:person)\n people.include? user_or_person\n end", "def belongs_to?(target_user)\n user == target_user\n end", "def is_member?(society)\n self.societies.include?(society)\n end", "def member?(user)\n user_ids.include?(user.id)\n end", "def is_member?(applicant)\n nucats_members = query_nucats_membership(name: applicant.username)\n nucats_members = query_nucats_membership(name: applicant.email) if nucats_members.blank? && !applicant.email.blank?\n return nucats_members.first['active'] == 'True' if nucats_members.count == 1\n false\n end", "def has_member?(user)\n users.include?(user)\n end", "def partner_admin?\n admin? && agencies.any? { |a| a.partner? }\n end", "def acquaintance_rights?(user_to_display)\n allowed_to_view_profile = false\n\n if current_user\n if current_user.id==user_to_display.id || current_user.has_system_role('moderator')\n allowed_to_view_profile = true\n else\n #check if both current user and user to display are facebook users in order to use the friends system\n if current_user.facebook_user? && user_to_display.facebook_user?\n current_fb_user = Facebooker::User.new(current_user.fb_user_id)\n if current_fb_user.friends_with?(user_to_display.fb_user_id)\n allowed_to_view_profile = true\n end\n end\n end\n end\n\n return allowed_to_view_profile\n end", "def in_agreement_with?(identification)\n return false unless identification\n return false if identification.taxon_id.nil?\n return true if self.taxon_id == identification.taxon_id\n self.taxon.in_taxon? identification.taxon\n end", "def in_agreement_with?(identification)\n return false unless identification\n return false if identification.taxon_id.nil?\n return true if self.taxon_id == identification.taxon_id\n self.taxon.in_taxon? identification.taxon\n end", "def has_member?(user_or_person)\n user_or_person = user_or_person.try(:person)\n current_people.include? user_or_person\n end", "def has_member?(user_or_person)\n user_or_person = user_or_person.try(:person)\n current_people.include? user_or_person\n end", "def affiliation\n @affiliation ||= auth_types_collection[attrs[:patron_status]] unless attrs[:patron_status].nil?\n end", "def collaborate?\n record.private? && (record.user_id == user.id || user.admin?)\n end", "def registered_for?(auction)\n self.auctions.include? auction\n end", "def following?(other_user)\n following.include?(other_user)\nend", "def takendown?\n author_linked_account_id && Takedown.linked_account_id_has_takedown?(author_linked_account_id)\n end", "def student?\n return self.eduPersonAffiliation==\"student\"\n end", "def has_member? user_or_person\n user_or_person = user_or_person.try(:person) if user_or_person.is_a?(User)\n self.people.include? user_or_person\n end", "def all_resident?\n lead_type == \"all_resident\"\n end", "def matched?(other_user)\n matched.include?(other_user)\n end", "def owns?(user_key)\n user_key.user.id == self.id\n end", "def owns?(what)\n if what.respond_to?(:user_ids)\n return what.user_ids.include?(self.id)\n elsif what.respond_to?(:user_id)\n return what.user_id == self.id\n end\n return self.is_cesia?\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def current_user_owns?(item)\n \t!item.nil? && current_user.is_a?(User) && (item.is_a?(User) ? current_user == item : current_user.is_author_of?(item)) \n end", "def belongs_to?(user)\n return false unless user.instance_of? User\n return self.owner == user\n end", "def attends?(lan)\n lan.users.exists?(self) || lan.users.where(:name => self.name).any? || lan.users.where(:email => self.email).any?\n end", "def following?(other_user)\n active_relationships.find_by(followed_id: other_user.id)\nend", "def accessible_by_user?(user)\n user_membership = space_memberships.active.find_by(user: user)\n\n user_membership.present? && (unactivated? || active? || locked? && user_membership.host?)\n end", "def member_in_cooperative?(id)\n return false unless confidential?\n\n Space.find(space_id).member(id).present?\n end", "def following?(other_user)\n following.include?(other_user) \n end", "def current_user_is_pal?\n current_user && current_user.person && current_user.person.is_pal?\n end", "def owns?(wiki)\n true if self.id == wiki.user_id\n end", "def is_associated_to_somebody_else_than(another_user)\n !!(\n another_user && # User exists...\n another_user.swimmer && # It has a swimmer associated...\n @swimmer && # Ditto for this strategy's object...\n @swimmer.associated_user && # ...And their are different gogglers:\n (@swimmer.associated_user_id != another_user.id) &&\n (@swimmer.id != another_user.swimmer_id) # (additional and redundant integrity check)\n )\n end", "def current_user_from_payable_to_org?\n\t\tself.current_user.organization.id.to_s == self.payable_to_organization_id\n\tend", "def user?(user)\n users.include? user\n end", "def usa_admin?\n has_role?(:admin) && jurisdiction&.name == 'USA'\n end", "def related?(user)\n [from_user_id, to_user_id].include?(user&.id)\n end", "def has_collaborator(user, record)\n record.collaborators.exists?(email: user.email)\n end", "def true_user_can_impersonate?\n true_user and Rails.configuration.dm_unibo_common[:impersonate_admins] and Rails.configuration.dm_unibo_common[:impersonate_admins].include?(true_user.upn)\n end", "def show?\n user_record? || user.accessible_registrants.include?(record) || event_planner? || super_admin?\n end", "def get_affiliations\n affiliations\n end", "def affiliate_class\n self.class.affiliate_class\n end", "def following? (other_user)\n following.include?(other_user)\n end", "def author_identity_different?(attribs)\n !(\n # not the identical identity where Author is assumed to be Stanford University\n # checks in order of likelihood of changes\n # note that this code works for nil/empty string comparisons by calling `to_s`\n first_name.to_s.casecmp(attribs[:first_name].to_s) == 0 &&\n middle_name.to_s.casecmp(attribs[:middle_name].to_s) == 0 &&\n last_name.to_s.casecmp(attribs[:last_name].to_s) == 0 &&\n institution.to_s.casecmp(attribs[:institution].to_s) == 0\n )\n end", "def is_owner?(account)\n attachable == account.profile\n end", "def has_subscriber?(user_id)\n # In the case of an Indivual tournament\n if is_individual?\n users.exists?(user_id)\n else\n # If we are in a team kind of tournament\n memberships.exists?(:user_id => user_id)\n end\n end", "def owned_by?(current_user)\n current_user && user_id == current_user.id\n end", "def is_author_of?(item)\n if item.respond_to?(:user)\n self == item.user\n elsif item.respond_to?(:pseud)\n self.pseuds.include?(item.pseud)\n elsif item.respond_to?(:pseuds)\n !(self.pseuds & item.pseuds).empty?\n elsif item.respond_to?(:author)\n self == item.author\n else\n false\n end\n end", "def joinable?(user: nil, token: nil)\n result = false\n result = true if entries.find_for(user).present? || belongs_to?(user)\n result = true if (invite_only_visibility? || secret_visibility?) && token == join_token\n result = true if public_visibility?\n\n result\n end" ]
[ "0.7297416", "0.6931425", "0.68783474", "0.6763197", "0.67038536", "0.6652632", "0.66468024", "0.6244003", "0.61868554", "0.6166042", "0.6155807", "0.6136479", "0.6134123", "0.6115355", "0.61036", "0.60620564", "0.59963477", "0.59873384", "0.59723717", "0.59443974", "0.59256804", "0.58976585", "0.5881233", "0.5865039", "0.5861132", "0.58562946", "0.58419913", "0.5836915", "0.5826536", "0.57990277", "0.57970315", "0.57961315", "0.5790099", "0.5774907", "0.57705015", "0.5766963", "0.57641196", "0.5754917", "0.57376367", "0.5720061", "0.57160085", "0.5709629", "0.57008016", "0.5695987", "0.5692942", "0.5686128", "0.567301", "0.56698513", "0.56622773", "0.56540596", "0.5653539", "0.56468403", "0.56424516", "0.5641499", "0.56345195", "0.5631863", "0.5630813", "0.5623749", "0.5621184", "0.5621184", "0.56163317", "0.56163317", "0.56139845", "0.5606607", "0.56048733", "0.5602491", "0.560004", "0.5598862", "0.559755", "0.55855036", "0.5585417", "0.5582338", "0.55812716", "0.55762774", "0.55728817", "0.5571909", "0.55706716", "0.5568206", "0.5562515", "0.5561548", "0.55568206", "0.5555948", "0.5550091", "0.55478173", "0.5546512", "0.5535227", "0.5532573", "0.5526947", "0.55216", "0.5521074", "0.5517429", "0.55165815", "0.5515327", "0.5512842", "0.550888", "0.5508042", "0.55078346", "0.5507424", "0.54978997", "0.5495345" ]
0.79458284
0
ratify_each Define Minimum Length of Array
def min_length(min_size=0, options={}, &block) return length_between(min_size, nil, options, &block) rescue Exception => e validation_error("#{e.message}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_max_len_ave(arr)\n\treturn [\n\t\tarr.min,s\n\t\tarr.max,\n\t\tarr.length,\n\t\tarr.instance_eval { reduce(:+) / size.to_f },\n\t]\nend", "def / len\n a = []\n each_with_index do |x,i|\n a << [] if i % len == 0\n a.last << x\n end\n a\n end", "def resize\n # TODO\n # if aray is 75% full, double the array and copy all items over\n end", "def stretch(array)\n\n stretched_array = []\n\n for element in array\n if element % 2 == 0\n stretched_array << element/2\n stretched_array << element/2\n else\n stretched_array << element/2 + 1\n stretched_array << element/2\n end\n end\n\n return stretched_array\n\nend", "def fixed_len_array(a)\n def a.shrink\n (before, shrink_me, after) =\n Shrinkers.split_around(self, (lambda &:shrinkable?))\n next_smallest = before + [shrink_me.shrink] + after\n Shrinkers.fixed_len_array(next_smallest) #maintain this property\n end\n\n def a.shrinkable?\n any? &:shrinkable?\n end\n a\n end", "def each_length\n\t\tcurrent_length = 0\n\t\tfirst_pattern_with_some_size = Array.new\n\n\t\tself.each_index do |i|\n\t\t\tpattern = self[i]\n\t\t\tif pattern.length > current_length\n\t\t\t\tcurrent_length = pattern.length\n\t\t\t\tfirst_pattern_with_some_size.push(i)\n\t\t\tend\n\t\tend\n\n\t\tfirst_pattern_with_some_size.each_index do |i|\n\t\t\ti_first = first_pattern_with_some_size[i]\n\t\t\ti_last = nil\n\t\t\tif i < first_pattern_with_some_size.length-1\n\t\t\t\ti_last = first_pattern_with_some_size[i+1]\n\t\t\telse\n\t\t\t\ti_last = self.length\n\t\t\tend\n\t\t\ti_len = i_last-i_first\n\n\t\t\tyield self[i_first,i_len]\n\t\tend\n\tend", "def %(len) # {{{\n inject([]) do |array, x|\n # array << [] if [*array.last].nitems % len == 0\n array << [] if [*array.last].count{|x| !x.nil?} % len == 0\n array.last << x\n array\n end\n end", "def pad(array, min_size, value = nil) #non - destructive\n array_modified = []\n if min_size <= array_modified.length\n array_modified = array.map { |x| x }\n elsif min_size == 0\n array_modified = array.map { |x| x }\n else\n array_modified = array.map { |x| x }\n (min_size - array_modified.length).times {\n array_modified.push(value)\n }\n return array_modified\n end\nend", "def pad(array, min_size, value = nil) #non-destructive\n \n new_array = [].concat(array)\n # array.each { |el| new_array << el } \n \n difference = min_size - array.length\n #array.length #the variable len = array.length\n if difference > 0\n # puts positive amount of difference into array through default value\n difference.times { |el| new_array << value }\n end\n \n \n return new_array\n \nend", "def calc_extents_for_array(aArray)\r\nend", "def pad(array, min_size, value = nil) #non - destructive\n\n\tarray_modified = []\n\n\tif min_size <= array_modified.length || min_size == 0\n\t\t\n\t\tarray_modified = array.map { |x| x}\n\n\telse\n\t\tarray_modified = array.map { |x| x}\n\n\t\t(min_size - array_modified.length).times {\n\n\t\t\t\tarray_modified.push(value)\n\t\t}\n\n\t\treturn array_modified\n\n\tend\n \nend", "def all_sizes\n [0.1, 0.5, 1, 5, 10]\n end", "def something\n max = self.max_size\n arrays = self.lifts_array\n arrays.each do |array|\n if array.size < max \n difference1 = max - array.size\n difference = difference1 / 2\n difference.times do \n array << 0\n array << \"0\"\n end\n else\n end\n end\n arrays\n end", "def run_length_encode\n self.pack_consecutive_duplicates.inject([]) do |array, current|\n array << [current.size, current[0]]\n array \n end\n end", "def pad(array, min_size, value = nil) #non-\n other_array=[]\n if min_size==0\n other_array << array\n other_array.flatten!\n else\n num_things=min_size-array.length\n if array == []\n num_things.times do\n other_array << value\n end\n else\n other_array << array\n other_array.flatten!\n num_things.times do\n other_array << value\n end\n end\n end\n other_array\nend", "def pad!(array, min_size, value = nil) #destructive\n i = min_size - array.length\n\n i.times {array.push(value)} if array.length < min_size\n array\nend", "def fully_extend_all reps=nil\n dist.branches.times do |i|\n hits = mapee(i).hits\n len = mapee(i).length\n mapee(i).clear_hits\n reps = (@len.to_f / len).round if reps.nil?\n mapee(i).length = @len\n reps.times do |j|\n new_hits = HitSq.new\n new_hits << hits\n new_hits * (1.0/reps)\n new_hits + (j.to_f / reps)\n# puts new_hits.hits.inspect\n mapee(i) << new_hits\n end\n# puts mapee(i).hits.hits.inspect\n end\n end", "def minSubLength(arr, i)\n subs = find_sub_arrays(arr)\n correct = subs.select { |array| array.sum >= i }.min_by { |x| x.length }\n p correct\n correct == nil ? 0 : correct.size\nend", "def pad(array, min_size, value = nil)\n array_new = [ ]\n array.each do |x|\n array_new.push(x)\n end\n while array_new.length < min_size\n array_new.push(value)\n end\n return array_new\nend", "def pad(array, min_size, value = nil)\n array_new = [ ]\n array.each do |x|\n array_new.push(x)\n end\n while array_new.length < min_size\n array_new.push(value)\n end\n return array_new\nend", "def make_fit(vals)\n return vals if vals.size < SPARK_WIDTH\n\n vals << vals.last if vals.size.odd?\n ret = vals.each_slice(2).with_object([]) { |s, a| a << (s.sum / 2) }\n make_fit(ret)\n end", "def giniA(xs)\n\t1 - xs.group_by {|x| x }.inject(0) {|a, (k, v)| a + (v.size.to_f / xs.size) ** 2 }\nend", "def high_yield_mines (a)\n @arr2 = Array.new\n a.each do |this|\n if this[:specimens].length >= 4\n @arr2.push(this[:location])\n end\n end\nend", "def calculate_dimensions array\n\t\t\t_count(array).take_while { |e| e >= 0 }\n\t\tend", "def pad!(array, min_size, value=nil) #destructive\n if min_size == 0 || array.length >= min_size\n return array\n else (min_size - array.length).times { |array, x| array << value.to_i } \n return array\n end\nend", "def pad!(array, min_size, value = nil) #destructive\n difference = array.length - min_size\n difference = difference.abs\n if array.length - min_size < 0\n for i in 0..difference - 1\n array.push(value)\n end\n end\n return array\nend", "def collect_every(size)\n collect = []\n\n index = 0\n while true\n slice = self.slice(index, size)\n break if slice.nil? || slice.empty?\n\n collect.concat(yield slice)\n index += size\n end\n\n collect\n end", "def pad_size(array, min_size)\n min_size - array.length\nend", "def size_limiter(sizes, n)\n res = []\n\n until res.length == n do\n sampled = sizes.sample\n\n if res.include?(sampled)\n next\n else\n res.push(sampled)\n end\n end\n\n return res.sort!\nend", "def pad!(array, min_size, value = nil) #destructive\n if array.count >= min_size\n return array\n else\n (min_size - array.count).times do\n array << value\n end\n return array\n end\nend", "def pad!(array, min_size, value = nil) #destructive\n while min_size > array.length\n array.push(value)\n end\n array\nend", "def pad!(array, min_size, value = nil) #destructive\n pad_size(array, min_size).times { array.push(value) }\n return array\nend", "def pad!(array, min_size, value = nil) #destructive\n array.keep_if{ |a| a <= array.length}\n difference = min_size - array.length\n counter = 0\n while counter < difference\n array << value\n counter += 1\n end\n p array\n # self = ans_array\nreturn array\nend", "def chunk(array, size)\nend", "def possible_proportions\n arr = Array.new(4, 0)\n proportions = []\n (0..100).to_a.each do |index0|\n arr[0] = index0\n (0..100 - index0).to_a.each do |index1|\n arr[1] = index1\n (0..100 - index0 - index1).to_a.each do |index2|\n arr[2] = index2\n arr[3] = 100 - index0 - index1 - index2\n proportions << arr.dup\n end\n end\n end\n proportions\nend", "def sluggish_octopus(arr)\n lngest_fish = [arr.first]\n # debugger\n arr.each do |fish|\n # debugger\n lngest_fish = [fish] if fish.length > lngest_fish.first.length\n end\n lngest_fish\nend", "def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n else\n difference = min_size - array.length\n for i in 1..difference\n array.push(value)\n end\n end\n return array\nend", "def pad_refact!(array, min_size, value = nil)\n array.fill(value, array.length..min_size)\nend", "def n_dim_ruler(arr)\n\t\n\ta = arr\n\td = []\n\n\tloop{\n\t\t\n\t\tl = a.length()\n\t\td.push(l.to_s)\n\t\t\n\t\tif a[0].instance_of?(Array) \n\t\t\ta = a[0]\n\t\telse\n\t\t\tbreak\n\t\tend\n\t\n\t}\n\n\treturn d.join(\" \")\n\nend", "def pad!(array, min_size, value = nil) #destructive\n if array.length - min_size < 0\n difference = array.length - min_size\n difference = difference.abs\n for i in 0..difference - 1\n array.push(value)\n end\n end\n return array\nend", "def pad!(array, min_size, value = nil) #destructive\n if array.length < min_size\n (min_size - array.length).times { array.push(value) }\n end\n return array\nend", "def limit_rubies\n @limits = [[1, 1], [2, 2], [1, 1], [0, 3], [3, 0], [2, 2], [2, 2]]\n end", "def pyramid_sum(base)\n new_arr = [base]\n i = 0\n\n while new_arr.length < base.length\n new_arr.unshift(add_arrays(new_arr[i]))\n end\n\n return new_arr\nend", "def pad!(array, min_size, value = nil) #destructive\n # Your code here\n if array.length >= min_size \n \treturn array\n else \n \t(min_size-array.length).times do\n \t\tarray.push(value)\n \tend\n \treturn array\n end\nend", "def normalize_size_to(integer)\n until size >= integer\n unshift 0\n end\n self\n end", "def repa(array, x)\n result = []\n (1..x).each do\n result.concat(array)\n end\n return result\nend", "def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n end\n until min_size <= array.length\n array << value\n end\n array\nend", "def pad(array, min_size, value=nil) #non-destructive\n# Your code here\n\n new_array = array.clone #sets the new array the same value of array but with a different object id essentially not affecting the original array\n\nif min_size > array.length\n until new_array.length == min_size\n new_array.push(value)\n #we are pushing to the new_array\n end\nend\n\n new_array\nend", "def divide(how_many)\n me = self.dup\n (1..how_many).to_a.reverse.inject([]) do |parts,i|\n part,me = me.break((me.size.to_f / i).ceil)\n parts.push(part)\n end\n end", "def pad!(array, min_size, value = nil) #destructive\n if min_size <= array.length\n return array\n end\n \n until array.length == min_size do\n array.push(value)\n end\n array\nend", "def pad(input_array, min_size, value = nil) #non-destructive\n array = []\n input_array.each do |x|\n array << x\n end\n if array.length < min_size\n i = array.length\n while i < min_size\n array[i] = value\n i += 1\n end\n end\n p array\nend", "def pad!(array, min_size, value = nil) #destructive\n # Your code here\n array_size = array.count\n if min_size > array_size\n \tfor i in 0...(min_size - array_size)\n \t\tarray.push(value)\n \tend\n \treturn array\n else\n \treturn array\n end\nend", "def pad!(array, min_size, value = nil)\n while array.length < min_size\n array.push(value)\n end\n return array\nend", "def pad!(array, min_size, value = nil)\n while array.length < min_size\n array.push(value)\n end\n return array\nend", "def pad!(array, min_size, value = nil)\n while array.length < min_size\n array.push(value)\n end\n return array\nend", "def pad!(array, min_size, value = nil)\n while array.length < min_size\n array.push(value)\n end\n return array\nend", "def heat_sizes(divisor)\n if divisor == 0 then return 0 end\n sizes = []\n number = number_of_heats(divisor)\n #find number of lanes for most of the heats\n general = divisor / number\n\n #set number of participants of every lane to be general\n number.times do |i|\n sizes[i] = general\n end\n\n #if any racers are not in heats, add them to the last one\n rest = divisor - general*number; i=1\n while(rest > 0)\n sizes[number-i] += 1\n rest -= 1\n i += 1\n end\n\n return sizes\n end", "def pad!(array, min_size, value = nil)\n while array.length < min_size\n array.push(value)\n end\n array\nend", "def pad!(array, min_size, value = nil) #destructive\n solution_array = []\n if min_size <= array.length\n #p array\n return array\n elsif min_size > array.length\n solution_array = array\n times_to_pad = min_size - array.length\n #p times_to_pad\n times_to_pad.times do\n solution_array << value\n #p solution_array\n end\n end\n return solution_array\nend", "def chunk(array, n)\n\nend", "def pad(array, min_size, value = nil) #non-destructive\n new_array = [] + array\n while new_array.length < min_size\n new_array << value\n end\n new_array\nend", "def pad!(array, min_size, value = nil) #destructive\n if min_size < array.length || min_size == array.length \n return array\n else \n x = min_size - array.length\n x.times do\n array.push(value)\n end\n return array\n end\nend", "def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n \treturn array\n else\n \tuntil array.length == min_size\n \t\tarray.push(value)\n \tend\n \treturn array\n end\nend", "def resize!\n @arr.size *=2\n end", "def chunk(array, n)\nend", "def clever(arr)\n arr.reduce do |big_fish, fish|\n fish.length > big_fish.length ? fish : big_fish\n end\nend", "def basic_6 (array_iterate)\n sum = 0\n array_iterate.each { |n| sum = sum + n }\n return sum / array_iterate.length\nend", "def pad!(array, min_size, value = nil) #destructive\n\tif min_size <= array.length || min_size == 0\n\t\t\n\t\treturn array\n\n\telse\n\t\t(min_size - array.length).times {\n\n\t\t\t\tarray.push(value)\n\t\t}\n\t\t\n\t\treturn array\n\n\tend\n\nend", "def pad!(array, min_size, value = nil) #destructive\n # Your code here\n if array.length < min_size\n x = min_size - array.length\n x.times do array << value\n end\n end\n return array\nend", "def pad!(array, min_size, value = nil) #destructive\n difference = (min_size - array.length)\n difference.times {\n array << value}\n return array\nend", "def pad!(array, min_size, value = nil) #destructive\r\n iter = min_size - array.length\r\n if min_size <= array.length\r\n return array\r\n else\r\n iter.times {array << value}\r\n end\r\n return array\r\nend", "def pad!(array, min_size, value = nil) #destructive\n if min_size <= array.length \n return array\n else \n x = min_size - array.length\n x.times do\n array.push(value)\n end\n return array\n end\nend", "def pad!(array, min_size, value = nil) #destructive\n array << value while min_size > array.length\n array\nend", "def stretch(arr)\n # new empty array\n new_arr = []\n # go through each element\n arr.each do |number|\n # if even, divide by two\n if number % 2 == 0\n new_arr << (number / 2)\n new_arr << (number / 2) # this isn't DRY, I think\n # if odd, subtract one, divide by two. Add one to the first half\n else\n new_arr << (((number - 1) / 2) + 1)\n new_arr << ((number - 1) / 2) # DRY-ness issue here, maybe\n # store both halves\n end\n end\n # return new array\n return new_arr\nend", "def pad!(array, min_size, value = nil) #destructive\n\n if array.length >= min_size\n return array\n else\n array.push(value) until array.length == min_size\n end\n array\nend", "def pad_array(array, min_size, pad_with)\nend", "def pad!(array, min_size, value = nil) #destructive\n # Your code here\n return array if min_size <= array.length\n while min_size > array.length\n \tarray.push(value)\n end\n array\nend", "def pad!(array, min_size, value = nil) #destructive\n array_size = array.size\n until array_size >= min_size\n array << value\n array_size += 1\n end\n return array\nend", "def prefix_find(array)\n\tfor i in array\n\t\tif i.size < min\n\t\t\tmin = i.size\n\t\tend\n\tend\nend", "def reduce_to_all_true(source_array)\nend", "def pad!(array, min_size, value = nil) #destructive\n # Your code here\n if array.size == min_size\n return array\n else\n while min_size > array.size\n array << value\n end\n end\n return array\nend", "def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n end\n # refactor for a cooler method than while loop\n # use an index for looping\n i = array.length\n while i < min_size\n array.push value\n i += 1\n end\n array\nend", "def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n else\n while array.length < min_size\n array.push(value)\n end\n return array\n end\nend", "def pad(array, min_size, value = nil) #non-destructive\n new_array = Array.new\n new_array += array\n new_array.fill(value, array.length...min_size)\nend", "def pad!(array, min_size, value = nil) #destructive\n # Your code here\n if array.length >= min_size \n return array\n else \n until array.length == min_size\n array.push value\n end\n return array\n end\nend", "def pad!(array, min_size, value = nil) #destructive\n difference = min_size - array.length\n #array.length #the variable len = array.length\n if difference > 0\n # puts positive amount of difference into array through default value\n difference.times { |x| array.push value }\n end\n return array\nend", "def pad!(array, min_size, value = nil) #destructive\r\n # Your code here\r\n if array.length >= min_size \r\n return array\r\n else \r\n until array.length == min_size\r\n array.push value\r\n end\r\n return array\r\n end\r\nend", "def pad!(array, min_size, value = nil) #destructive\n while array.length < min_size\n array.push(value)\n end\n array\nend", "def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n end\n if min_size > array.length\n remainder = min_size - array.length\n remainder.times do array << value\n end\n end\n p array\nend", "def n_naught_brute_vs_recursive(a)\n time_brute = Benchmark.realtime { brute_force_maximum_subarray(a) }\n time_recursive = Benchmark.realtime { maximum_subarray(a, 0, a.length - 1) }\n\n while time_brute < time_recursive do\n a << a.sample\n time_brute = Benchmark.realtime { brute_force_maximum_subarray(a) }\n time_recursive = Benchmark.realtime { maximum_subarray(a, 0, a.length - 1) }\n end\n\n result = a.length\nend", "def find_repeat(arr)\n floor = 1\n ceiling = the_array.length - 1\n\n while floor < ceiling\n\n midpoint = (floor + ceiling) / 2\n\n items_in_lower_range = 0\n arr.each do |item|\n if item >= floor && item <= midpoint\n items_in_lower_range += 1\n end\n end\n\n distinct_possible_integers_in_lower_range = ceiling - floor + 1\n\n if items_in_lower_range > distinct_possible_integers_in_lower_range\n ceiling = midpoint\n else\n floor = midpoint\n end\n end\n\n return floor\nend", "def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n else\n loop do array.push(value)\n break if array.length >= min_size\n end\n p array\n return array\n end\nend", "def pad!(array, min_size, value = nil) #destructive\n diff = min_size - array.length\n times = 0 if diff < 0\n diff.times do\n array << value\n end\n array\nend", "def pad!(array, min_size, value = nil)\n if array.length >= min_size\n return array\n else\n x = array.length\n until x == min_size; array.push value; x += 1\n end\n p array\n end\nend", "def pad!(array, min_size, value = nil) #destructive\n while array.length < min_size\n array << value\n end\n return array\nend", "def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n else\n diff = min_size - array.length\n while diff > 0\n array.push(value)\n diff -= 1\n end\n return array\n end\nend", "def split_into_parts(*sizes); end", "def pad!(array, min_size, value = nil) #destructive\r\n if min_size > array.size \r\n pad_array = Array.new(min_size - array.size, value) \r\n pad_array.each do |x|\r\n array << x \r\n end \r\n else\r\n array \r\n end\r\n p array\r\nend", "def stretch list\n final_array = []\n list.each do |num|\n final_array << num - num/2\n final_array << num/2\n end\n return final_array\nend", "def pad!(array, min_size, value = nil) #destructive\n # Your code here\n return array if min_size <= array.length\n while min_size > array.length\n array.push(value)\n end\n array\nend", "def long_subarrays(arr)\n res =[]\n window = arr.length\n while window>=1\n idx = 0\n while idx+window<=arr.length\n sub_arr = arr.slice(idx, window)\n p sub_arr\n res << sub_arr\n idx += 1\n end\n window -= 1\n end\n res.map{|el| el.inject(0){|acc, el2| acc+el2}}.sort.last\nend" ]
[ "0.59102505", "0.58927023", "0.5799461", "0.5795999", "0.5677536", "0.5623666", "0.5575646", "0.55704904", "0.5566038", "0.55656797", "0.55345786", "0.5527902", "0.55126476", "0.5507014", "0.5494597", "0.534957", "0.53488004", "0.533566", "0.53210896", "0.53210896", "0.5292031", "0.528696", "0.52859664", "0.5275182", "0.5272811", "0.5272538", "0.52675897", "0.52446264", "0.5243602", "0.5242204", "0.52236485", "0.52213055", "0.52162266", "0.521058", "0.5208607", "0.51948184", "0.51907957", "0.51894313", "0.5185938", "0.51808554", "0.5174631", "0.5172046", "0.51684815", "0.5159692", "0.5158904", "0.51451415", "0.5142042", "0.5140509", "0.51387864", "0.5138688", "0.5129751", "0.51295006", "0.51222426", "0.51222426", "0.51222426", "0.51222426", "0.5121188", "0.511729", "0.5116792", "0.51114637", "0.5107848", "0.5105194", "0.5103893", "0.51019853", "0.50955313", "0.5093105", "0.5091833", "0.5090923", "0.50893676", "0.5088037", "0.5086572", "0.50834394", "0.50829834", "0.50815684", "0.5079717", "0.5075016", "0.5074399", "0.50714195", "0.50644034", "0.50642383", "0.50616145", "0.50555146", "0.5054136", "0.50523347", "0.5047989", "0.50451225", "0.5044621", "0.5041023", "0.50405705", "0.50384545", "0.50379854", "0.5034247", "0.50294894", "0.50265145", "0.5024687", "0.50211054", "0.50180507", "0.50127095", "0.50112456", "0.50103307", "0.5005438" ]
0.0
-1
min_length Define Maximum Length of Array
def max_length(max_size=0, options={}, &block) return length_between(0, max_size, options, &block) rescue Exception => e validation_error("#{e.message}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_length\n MIN_LENGTH\n end", "def min_length\n 0\n end", "def min_length(length)\n valid_for 'string'\n assert_numeric length, minimum: 0\n set minLength: length\n end", "def minimal_length\n if !self.value.blank? && self.minLength\n errors.add(:value, 'is too short!') if self.value.length < self.minLength\n end\n end", "def safe_len(maxLen, reqLen)\n #handle stings and garbage\n maxLen = (maxLen||reqLen).to_i\n [maxLen, reqLen].min\n end", "def min_max_len_ave(arr)\n\treturn [\n\t\tarr.min,s\n\t\tarr.max,\n\t\tarr.length,\n\t\tarr.instance_eval { reduce(:+) / size.to_f },\n\t]\nend", "def limit_value\n length\n end", "def min_length(min_size=0, options={}, &block)\n return length_between(min_size, nil, options, &block)\n rescue Exception => e\n validation_error(\"#{e.message}\")\n end", "def pad_size(array, min_size)\n min_size - array.length\nend", "def maximal_length\n if !self.value.blank? && self.maxLength\n errors.add(:value, 'is too long!') if self.value.length > self.maxLength\n end\n end", "def max_field_length\n if fields.is_a? Array\n fields.map { |f| f.to_s.length }.max\n else\n fields.to_s.length\n end\n end", "def max_length\n MAX_LENGTH\n end", "def same_length_validator(array1, array2)\n if array1.length != array2.length\n raise HarmonicsHelper::Errors::LengthError.new(\"length of each array is different\") \n end\n end", "def validate_size\n @num_mines <= MAX_SIZE\n end", "def simple_array_validator(val, name, size = T.unsafe(nil)); end", "def simple_array_validator(val, name, size = T.unsafe(nil)); end", "def length\n @length.kind_of?(Range) ? @length.max : @length\n end", "def max_length\n return @max_length\n end", "def max_size=(_arg0); end", "def validates_min_length(min, atts, opts={})\n validatable_attributes(atts, opts){|a,v,m| (m || \"is shorter than #{min} characters\") unless v && v.length >= min}\n end", "def clever_octopus(array)\n max = nil\n array.each_with_index do |el, i|\n if max == nil || max.length < el.length\n max = el\n end\n end\n max\nend", "def max\n @max ||= map {|a| a[0].length}.max\n end", "def max_length=(value)\n @max_length = value\n end", "def passcode_minimum_length=(value)\n @passcode_minimum_length = value\n end", "def fixed_len_array(a)\n def a.shrink\n (before, shrink_me, after) =\n Shrinkers.split_around(self, (lambda &:shrinkable?))\n next_smallest = before + [shrink_me.shrink] + after\n Shrinkers.fixed_len_array(next_smallest) #maintain this property\n end\n\n def a.shrinkable?\n any? &:shrinkable?\n end\n a\n end", "def small_enough(arr, limit)\n arr.max <= limit\nend", "def restrict_msg_size\n if message.length > restriction\n message = message[0...restriction]\n end\n return message \n end", "def min_length(value, pdef)\n if(value.length >= pdef['MinLength'].to_i)\n true\n else\n \"Value must be at least #{pdef['MinLength']} characters\"\n end\n end", "def max_length(attrs, length)\n Array(attrs).each do |attr|\n error(attr, \"is too long (maximum is #{length} characters)\") if @object.send(attr).size > length\n end\n end", "def textarea_value_length_constraints_validation\n errors.add :value, I18n.t('errors.messages.too_short', count: value.size) if min_char_count && value.size < min_char_count\n errors.add :value, I18n.t('errors.messages.too_long', count: value.size) if max_char_count && value.size > max_char_count\n end", "def initialize(desired_length)\n @length = desired_length\n end", "def length=(new_length) #:nodoc:\n if new_length == :unlimited\n @length = UNLIMITED_OCCURRENCES\n else\n @length = new_length\n end\n end", "def max_length(attribute)\n return 0 if items.empty?\n items.map(&attribute.to_sym).max_by(&:length).size\n end", "def validate_length(attribute_name, options = {})\n min = options.fetch(:min, nil)\n max = options.fetch(:max, nil)\n value = attributes[attribute_name]\n\n if value\n length = value.size\n if min && length < min\n append_error(attribute_name, options.fetch(:min_message, nil) || :is_too_short)\n end\n if max && length > max\n append_error(attribute_name, options.fetch(:max_message, nil) || :is_too_long)\n end\n end\n end", "def off_line_minimum(strArr)\n \nend", "def max=(length)\n @string_rule.max = length\n end", "def determine_length\n determine_length_support\n end", "def unknown(options = {:length => 0x1})\n# array :initial_length => options[:length] do\n# uint32 #:check_value => lambda { value == v }\n# end\n string :length => options[:length]*4, :truncate => true\n end", "def array_length(array)\n\treturn array.length\nend", "def max_size\n 1\n end", "def length_spec; @length && @length != 0 ? \"[#{@length}\" + (@scale ? '.' + @scale.to_s : '') + ']' : '' end", "def specific_max_size(number)\n [self.size, number].min\n end", "def max_size; end", "def password_minimum_length=(value)\n @password_minimum_length = value\n end", "def password_minimum_length=(value)\n @password_minimum_length = value\n end", "def password_minimum_length=(value)\n @password_minimum_length = value\n end", "def password_minimum_length=(value)\n @password_minimum_length = value\n end", "def pad(array, min_size, value = nil) #non-\n other_array=[]\n if min_size==0\n other_array << array\n other_array.flatten!\n else\n num_things=min_size-array.length\n if array == []\n num_things.times do\n other_array << value\n end\n else\n other_array << array\n other_array.flatten!\n num_things.times do\n other_array << value\n end\n end\n end\n other_array\nend", "def pad!(array, min_size, value = nil) \n array.fill(value, array.length...min_size) unless min_size <= array.length\n array\nend", "def test_array_shortform_invalid\n assert_raises Exceptions::InvalidSchemaError do\n Schema.new do\n type(:array, %i[array integer], min: 2)\n end\n end\n end", "def exceeds_max_length?\n input.match(Patterns::ALPHABETICAL_PATTERN) && input.length > 15\n end", "def pad!(array, min_size, value = nil)\n\tif min_size <= array.length\n\t\treturn array\n\telse\n\t\twhile min_size - array.length > 0\n\t\t\tarray << value\n\t\tend\n\t\treturn array\n\tend\nend", "def length_override; end", "def clever_octopus(arr)\n longest = \"\"\n arr.each {|el| longest = el if el.length >= longest.length}\n longest\nend", "def length= length\n @length = length\n\n # Use length only, if length is valid\n if @length != 0 and self.length != 0\n # Drop entries, if more than new length\n while self.length > @length\n @data.pop\n end\n # Prefill with empty content, if less than new length\n dummy_data = Array.new(self.dataset_length, 0)\n while self.length < @length\n @data.unshift dummy_data\n end\n end\n \n @length\n end", "def longest_string array\n\tarray.max_by(&:length)\nend", "def specific_max_size(number); end", "def max\n array.length - 1\n end", "def validates_message_length\n errors.add(:message, \"must be less than #{max_message_length} characters\") unless message_length < max_message_length\n end", "def validate_size(key, items, min, max)\n SquareLite::TooFewError.validate!(items, key, min)\n SquareLite::TooManyError.validate!(items, key, max)\n end", "def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n \treturn array\n else\n \tuntil array.length == min_size\n \t\tarray.push(value)\n \tend\n \treturn array\n end\nend", "def length\n # TODO: add a default for length if not in params (instead of just 5!)\n @params[:length].to_i > 0 ? @params[:length].to_i : 5 # or use @cfg[:default][:length].to_i\n end", "def remove_max_length(table, *arr_cn_len)\n execute sql_remove_max_length(table, *arr_cn_len)\n end", "def %(len) # {{{\n inject([]) do |array, x|\n # array << [] if [*array.last].nitems % len == 0\n array << [] if [*array.last].count{|x| !x.nil?} % len == 0\n array.last << x\n array\n end\n end", "def limit_rubies\n @limits = [[1, 1], [2, 2], [1, 1], [0, 3], [3, 0], [2, 2], [2, 2]]\n end", "def set_MaxLength(value)\n set_input(\"MaxLength\", value)\n end", "def set_MaxLength(value)\n set_input(\"MaxLength\", value)\n end", "def set_MaxLength(value)\n set_input(\"MaxLength\", value)\n end", "def set_MaxLength(value)\n set_input(\"MaxLength\", value)\n end", "def pad!(array, min_size, value = nil)\n while array.length < min_size\n array.push(value)\n end\n return array\nend", "def pad!(array, min_size, value = nil)\n while array.length < min_size\n array.push(value)\n end\n return array\nend", "def pad!(array, min_size, value = nil)\n while array.length < min_size\n array.push(value)\n end\n return array\nend", "def pad!(array, min_size, value = nil)\n while array.length < min_size\n array.push(value)\n end\n return array\nend", "def length(*) end", "def length(*) end", "def bound(length)\n 0 <= self && self < length\n end", "def pad(array, min_size, value = nil) #non-destructive\n \n new_array = [].concat(array)\n # array.each { |el| new_array << el } \n \n difference = min_size - array.length\n #array.length #the variable len = array.length\n if difference > 0\n # puts positive amount of difference into array through default value\n difference.times { |el| new_array << value }\n end\n \n \n return new_array\n \nend", "def array_length(array)\n array.length\nend", "def pad!(array, min_size, value = nil) #destructive\n if min_size <= array.length\n return array\n else\n until array.length == min_size\n array << value\n end\n array\n end\n end", "def pad(array, min_size, value = nil)\n array_new = [ ]\n array.each do |x|\n array_new.push(x)\n end\n while array_new.length < min_size\n array_new.push(value)\n end\n return array_new\nend", "def pad(array, min_size, value = nil)\n array_new = [ ]\n array.each do |x|\n array_new.push(x)\n end\n while array_new.length < min_size\n array_new.push(value)\n end\n return array_new\nend", "def arrayLength(array)\n puts \"Nombre d'éléments : #{array.length}\"\nend", "def pad!(array, min_size, value=nil)\n array.fill(value, array.length...min_size)\nend", "def limits_in_array\n @limits.strip.split(ITEM_SEPARATOR).map { |i| i.to_i }\n end", "def constrain_length(bob, minlen, maxlen)\n dir = bob.location - @anchor\n d = dir.mag\n # Is it too short?\n if d < minlen\n dir.normalize!\n dir *= minlen\n # Reset location and stop from moving (not realistic physics)\n bob.location = @anchor + dir\n bob.velocity *= 0\n elsif d > maxlen # is it too long?\n dir.normalize!\n dir *= maxlen\n # Reset location and stop from moving (not realistic physics)\n bob.location = @anchor + dir\n bob.velocity *= 0\n end\n end", "def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n else\n loop do array.push(value)\n break if array.length >= min_size\n end\n p array\n return array\n end\nend", "def pad!(array, min_size, value = nil) #destructive\n if array.length < min_size \n \tarray.push(value)\n else \n return array \nend \t\nend", "def truncated array, limit = 2\n contents = array[0...limit].join \", \"\n more = array.length <= limit ? \"\" : \", ...\"\n \"[#{contents}#{more}]\"\nend", "def passcode_minimum_length\n return @passcode_minimum_length\n end", "def select_len\n length = 1\n loop do\n print 'Please enter your desired array length (between 1 and 60): '\n length = rand(1 + gets.chomp.to_i)\n break if length.between?(1, 60)\n end\n length\n end", "def longest_string array\n array.max_by(&:length)\nend", "def max_history=(length); end", "def max_history=(length); end", "def pad!(array, min_size, value = nil)\n while array.length < min_size\n array.push(value)\n end\n array\nend", "def length; end", "def length; end", "def length; end", "def length; end", "def length; end", "def length; end" ]
[ "0.722355", "0.7100344", "0.6917819", "0.67042035", "0.67041725", "0.66592664", "0.6569845", "0.65107334", "0.64275473", "0.6318443", "0.62963575", "0.62939554", "0.6234337", "0.622518", "0.62153006", "0.62153006", "0.611607", "0.6094361", "0.59763426", "0.59726155", "0.5958306", "0.59500843", "0.594258", "0.5941019", "0.593157", "0.59314805", "0.59007", "0.589678", "0.58845633", "0.58816934", "0.5874252", "0.5872857", "0.58668184", "0.58612144", "0.584871", "0.5808754", "0.5805415", "0.58004546", "0.5784492", "0.5783299", "0.57799304", "0.57793945", "0.57791024", "0.5778889", "0.5778889", "0.5778889", "0.5778889", "0.57713294", "0.57639587", "0.57587", "0.5751919", "0.57324356", "0.5731517", "0.57191616", "0.57056296", "0.5683674", "0.5681454", "0.5678949", "0.5666577", "0.5665706", "0.566486", "0.5660235", "0.5641847", "0.56366044", "0.5622277", "0.5618497", "0.5618497", "0.5618497", "0.5618497", "0.5617483", "0.5617483", "0.5617483", "0.5617483", "0.56159234", "0.56159234", "0.5613689", "0.56079364", "0.56075895", "0.5605421", "0.5602966", "0.5602966", "0.55950576", "0.5593938", "0.55930144", "0.55919003", "0.5583006", "0.558106", "0.5575882", "0.55694234", "0.55664444", "0.5565848", "0.55588305", "0.55588305", "0.55562216", "0.5554948", "0.5554948", "0.5554948", "0.5554948", "0.5554948", "0.5554948" ]
0.59797907
18
max_length Define length range of Array (inclusive)
def length_between(min_size=0, max_size=nil, options={}, &block) parse_options(options) unless @skip == true unless @unwrap_block == true # Minimum Length Validation unless min_size.to_i >= 0 validation_error("min_length must be a number greater than or equal to 0") return end unless @ratifiable_object.size >= min_size.to_i validation_error("length must be #{min_size} or more") return end # Maximum Length Validation unless max_size.nil? unless max_size.to_i >= 0 validation_error("max_size must be a number greater than or equal to 0") return end if @ratifiable_object.size > max_size.to_i validation_error("length must be less than #{max_size.to_i}") return end unless max_size > min_size validation_error("max_size must be greater than min_size") return end end end#unwrap_block instance_eval(&block) if block_given? end#skip rescue Exception => e validation_error("#{e.message}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_length\n MAX_LENGTH\n end", "def maximal_length\n if !self.value.blank? && self.maxLength\n errors.add(:value, 'is too long!') if self.value.length > self.maxLength\n end\n end", "def max_length=(value)\n @max_length = value\n end", "def max_length\n return @max_length\n end", "def max_field_length\n if fields.is_a? Array\n fields.map { |f| f.to_s.length }.max\n else\n fields.to_s.length\n end\n end", "def max_length(max_size=0, options={}, &block)\n return length_between(0, max_size, options, &block)\n rescue Exception => e\n validation_error(\"#{e.message}\")\n end", "def max\n @max ||= map {|a| a[0].length}.max\n end", "def limit_value\n length\n end", "def length\n @length.kind_of?(Range) ? @length.max : @length\n end", "def max=(length)\n @string_rule.max = length\n end", "def max_length(attrs, length)\n Array(attrs).each do |attr|\n error(attr, \"is too long (maximum is #{length} characters)\") if @object.send(attr).size > length\n end\n end", "def specific_max_size(number); end", "def safe_len(maxLen, reqLen)\n #handle stings and garbage\n maxLen = (maxLen||reqLen).to_i\n [maxLen, reqLen].min\n end", "def max_length(attribute)\n return 0 if items.empty?\n items.map(&attribute.to_sym).max_by(&:length).size\n end", "def max_size; end", "def max_size=(_arg0); end", "def set_MaxLength(value)\n set_input(\"MaxLength\", value)\n end", "def set_MaxLength(value)\n set_input(\"MaxLength\", value)\n end", "def set_MaxLength(value)\n set_input(\"MaxLength\", value)\n end", "def set_MaxLength(value)\n set_input(\"MaxLength\", value)\n end", "def max_size\n @max_size ||= options[:max_size] || [DEFAULT_MAX_SIZE, min_size].max\n end", "def clever_octopus(array)\n max = nil\n array.each_with_index do |el, i|\n if max == nil || max.length < el.length\n max = el\n end\n end\n max\nend", "def min_max_len_ave(arr)\n\treturn [\n\t\tarr.min,s\n\t\tarr.max,\n\t\tarr.length,\n\t\tarr.instance_eval { reduce(:+) / size.to_f },\n\t]\nend", "def max_length=(new_max_length)\n @max_length = new_max_length\n chars = @text.scan(/./m)\n @text = chars[0, @max_length].join if chars.size > @max_length\n self.cursor_move_to_end if @cursor_position > chars.size\n end", "def max_length(value, pdef)\n if(value.length <= pdef['MaxLength'].to_i)\n true\n else\n \"Value must not exceed #{pdef['MaxLength']} characters\"\n end\n end", "def max_history=(length); end", "def max_history=(length); end", "def exceeds_max_length?\n input.match(Patterns::ALPHABETICAL_PATTERN) && input.length > 15\n end", "def longest_string array\n\tarray.max_by(&:length)\nend", "def max\n array.length - 1\n end", "def limit_size(str, max)\n if str.length > max\n return str[0...max]\n end\n str\n end", "def limit_size(str, max)\n if str.length > max\n return str[0...max]\n end\n str\n end", "def validates_max_length(max, atts, opts={})\n validatable_attributes(atts, opts){|a,v,m| (m || \"is longer than #{max} characters\") unless v && v.length <= max}\n end", "def max_range(array)\n \nend", "def max_value_size\n @max_value_size ||= options[:values].max { |a, b| a.size <=> b.size }.size\n end", "def findMax(a)\n\ta.length\nend", "def length\n [default&.length, max_content_length].compact.max\n end", "def maxStringLength\n\t\tweight = @dictionaries.inject(1) { |x, d| x * d.length }\n\t\tbits = (Math.log(weight)/Math.log(2)).floor\n\t\tchars = bits/4\n\tend", "def longest_string array\n array.max_by(&:length)\nend", "def max_command_length; end", "def remove_max_length(table, *arr_cn_len)\n execute sql_remove_max_length(table, *arr_cn_len)\n end", "def longest_string ar\n\tar.max_by(&:length)\nend", "def specific_max_size(number)\n [self.size, number].min\n end", "def longest_string(array)\n\tarray.max_by(&:length)\nend", "def truncate(max)\n length = Math.min(max, length)\n self\n end", "def length=(new_length) #:nodoc:\n if new_length == :unlimited\n @length = UNLIMITED_OCCURRENCES\n else\n @length = new_length\n end\n end", "def max_len_column(j)\n column_collect(j) {|x| x.to_s.length}.max\n end", "def max_size\n 1\n end", "def cols_len\n (0...column_size).collect {|j| max_len_column(j)}\n end", "def longest(array)\n return array.max\nend", "def longest_string(string_array)\n string_array.max_by(&:length)\nend", "def longest_string ar\n return ar.max_by(&:length)\nend", "def length\n # TODO: add a default for length if not in params (instead of just 5!)\n @params[:length].to_i > 0 ? @params[:length].to_i : 5 # or use @cfg[:default][:length].to_i\n end", "def maxsize(value)\n merge(ormaxsize: value.to_s)\n end", "def custom_command_content_max_length\n limits_yaml = YAML.load_data!(\"#{ECON_DATA_PATH}/limits.yml\")\n return limits_yaml['custom_command_content_max_length']\n end", "def determine_length\n determine_length_support\n end", "def max_identifier_length\n @max_identifier_length ||= select_one('SHOW max_identifier_length', 'SCHEMA'.freeze)['max_identifier_length'].to_i\n end", "def small_enough(arr, limit)\n arr.max <= limit\nend", "def max_word_length(words)\n max_length = 0\n words.each do |word|\n word_length = word.entry.length\n max_length = word_length if max_length < word_length\n end\n max_length\nend", "def longest(stringArray)\n return stringArray.max_by(&:length)\nend", "def max_digits size\n (1..size).map{|x| x.to_s.size}.max\n end", "def length(range)\n range = range..range if range.is_a?(Integer)\n assert_range range\n min_length range.min\n max_length range.max unless range.end.nil?\n self\n end", "def maximum_limit\n 100\n end", "def max_node_value_length\n max_length = 0\n all_node_values_with_nil.each do |value|\n value_length = value.to_s.length\n max_length = value_length if value_length > max_length\n end\n return max_length\n end", "def truncated array, limit = 2\n contents = array[0...limit].join \", \"\n more = array.length <= limit ? \"\" : \", ...\"\n \"[#{contents}#{more}]\"\nend", "def clever_octopus(arr)\n longest = \"\"\n arr.each {|el| longest = el if el.length >= longest.length}\n longest\nend", "def tag_name_max_length\n limits_yaml = YAML.load_data!(\"#{ECON_DATA_PATH}/limits.yml\")\n return limits_yaml['tag_name_max_length']\n end", "def _unix_max_line_length\n # Based on autoconf's arg_max calculator, see\n # http://www.in-ulm.de/~mascheck/various/argmax/autoconf_check.html\n calc_line_max = 'i=0 max= new= str=abcd; \\\n while (test \"X\"`echo \"X$str\" 2>/dev/null` = \"XX$str\") >/dev/null 2>&1 && \\\n new=`expr \"X$str\" : \".*\" 2>&1` && \\\n test \"$i\" != 17 && \\\n max=$new; do \\\n i=`expr $i + 1`; str=$str$str;\\\n done; echo $max'\n line_max = session.shell_command_token(calc_line_max).to_i\n\n # Fall back to a conservative 4k which should work on even the most\n # restrictive of embedded shells.\n line_max = (line_max == 0 ? 4096 : line_max)\n vprint_status(\"Max line length is #{line_max}\")\n\n line_max\n end", "def truncate(max)\n resize([max, self.length].min)\n end", "def longest_string(array_of_strings)\n answer=array_of_strings.max_by(&:length)\n return answer\nend", "def get_max_length(x)\n x % 2 == 0 ? y = 180 : y = 240\n end", "def default_max_size; end", "def tag_content_max_length\n limits_yaml = YAML.load_data!(\"#{ECON_DATA_PATH}/limits.yml\")\n return limits_yaml['tag_content_max_length']\n end", "def restrict_msg_size\n if message.length > restriction\n message = message[0...restriction]\n end\n return message \n end", "def limit_text_length (string_to_put_limitation, max_length)\n\n if string_to_put_limitation.length > max_length\n\n limited_string = string_to_put_limitation[0..max_length].gsub(/\\s\\w+\\s*$/,'...')\n\n return limited_string\n\n else\n\n return string_to_put_limitation\n\n end#string size check\n\n end", "def max_sql_param_length=(_arg0); end", "def render_length_limit=(_arg0); end", "def textarea_value_length_constraints_validation\n errors.add :value, I18n.t('errors.messages.too_short', count: value.size) if min_char_count && value.size < min_char_count\n errors.add :value, I18n.t('errors.messages.too_long', count: value.size) if max_char_count && value.size > max_char_count\n end", "def max_sites\n @sites.map { |s| s.length }.max\n end", "def find_largest(array, length)\n raise NotImplementedError\nend", "def random_string_upto_length(max_length)\r\n length = random_integer(max_length)\r\n random_string_of_length(length)\r\n end", "def findLongestSeq(maxNum)\r\n i = 1\r\n startSeq = 0\r\n maxLength = 0\r\n \r\n while ( i <= maxNum)\r\n cLength = getSequenceLength(i)\r\n \r\n if (cLength > maxLength)\r\n maxLength = cLength\r\n startSeq = i\r\n end\r\n $seqLengthArray[i] = cLength\r\n i += 1\r\n end\r\n \r\n return getCollatzSequence(startSeq)\r\nend", "def length\n (lines.max_by(&:length) || '').size\n end", "def find_max_length(a)\n\tmax = 0\t\n\tfor i in 0..a.size-2 do\n\t\tcount_0 = 0\n\t\tcount_1 = 0\n\t\tcurrent_max = 0\n\t\tfor j in i..a.size-1 do\n\t\t\tif a[j] == 0\n\t\t\t\tcount_0 = count_0+1\n\t\t\telsif a[j] == 1\n\t\t\t\tcount_1 = count_1+1\n\t\t\tend\n\t\t\tif count_0 == count_1\n\t\t\t\tcurrent_max = count_0+count_1\n\t\t\tend\n\t\tend\n\t\tif current_max > max\n\t\t\tmax = current_max\n\t\tend\n\tend\n\tmax\nend", "def array_length(array)\n\treturn array.length\nend", "def item_max; 64; end", "def max_action_length\n @max_action_length ||= actions.inject(0){|memo, a| [memo, a.to_s.length].max}\n end", "def max_action_length\n @max_action_length ||= actions.inject(0){|memo, a| [memo, a.to_s.length].max}\n end", "def windowed_max_range_s(arr, window_size)\n \nend", "def maximum_size\n @ids.size\n end", "def slice(result_array, max_length=10)\n return result_array[0...max_length]\n end", "def cleanup!(max_len)\n if self.length >= max_len\n self.clear\n end\n end", "def select_len\n length = 1\n loop do\n print 'Please enter your desired array length (between 1 and 60): '\n length = rand(1 + gets.chomp.to_i)\n break if length.between?(1, 60)\n end\n length\n end", "def clever_octopus(arr)\n longest = \"\"\n arr.each do |el|\n longest = el if el.length > longest.length\n end\n longest\nend", "def truncate(max, omission = '...')\n (length > max ? self[0...max] + omission : self)\n end", "def max_length\n @executor.getMaximumPoolSize\n end", "def limit_rubies\n @limits = [[1, 1], [2, 2], [1, 1], [0, 3], [3, 0], [2, 2], [2, 2]]\n end", "def max_action_length\n @max_action_length ||= actions.inject(0){|memo, a| [memo, a.to_s.length].max}\n end", "def pad_size(array, min_size)\n min_size - array.length\nend", "def length_override; end", "def render_length_limit; end" ]
[ "0.73648006", "0.72176576", "0.718311", "0.71804494", "0.7149568", "0.70981675", "0.7013232", "0.7007006", "0.6930828", "0.68461055", "0.671261", "0.66758", "0.66644603", "0.66342545", "0.65949005", "0.65480626", "0.6534915", "0.6534915", "0.6534915", "0.6534915", "0.65334904", "0.6498565", "0.6496106", "0.6461497", "0.6460003", "0.6438363", "0.6438363", "0.6414181", "0.6389282", "0.6372902", "0.6328121", "0.6328121", "0.6323726", "0.6281038", "0.6276288", "0.6260669", "0.625701", "0.6249239", "0.6226448", "0.62143", "0.62056553", "0.6201381", "0.6186498", "0.6182638", "0.61653703", "0.6155548", "0.6145974", "0.61278296", "0.60890085", "0.6078746", "0.60556835", "0.6053909", "0.6044687", "0.60299647", "0.6023574", "0.60188544", "0.6013817", "0.6011018", "0.59941655", "0.59896713", "0.5989386", "0.5978492", "0.59746075", "0.59691644", "0.5963737", "0.59586555", "0.5948901", "0.59482116", "0.5938737", "0.593315", "0.5919751", "0.5907598", "0.5906194", "0.589157", "0.58869594", "0.5877923", "0.5863907", "0.58579516", "0.5856364", "0.5848861", "0.58479166", "0.58315575", "0.58274806", "0.58254516", "0.58210284", "0.5820986", "0.58194804", "0.58194804", "0.5818888", "0.5815975", "0.5789222", "0.578671", "0.5784764", "0.57699734", "0.5766923", "0.57656926", "0.57642734", "0.5758678", "0.5758258", "0.57516813", "0.5744632" ]
0.0
-1
image is from seed, photo is from cloudinary
def stallion_params params.require(:stallion).permit( :image, :name, :date_of_birth, :category, :breed, :town, :country, :lineage, :description, :colour, :sperm_only, :stabling, :malt_whisky, :shooting, :owner_bed, :photo, :photo_cache) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cl_photo\n if photo?\n photo\n else\n 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSb0kZ2CA6D46RXZVJ3dvJPusC66fBq1uENE8jN3q8golJ73Ayd'\n end\n end", "def uploadimage \n img = Cloudinary::Uploader.upload(params[:image])\n company = Company.find(params[:id])\n if company.update(\n \n image: img[\"url\"]\n )\n render json:{\n status: :updated,\n company: :company\n }\n else\n render json: {status: 550}\n end \n end", "def image\n return unless object.image.attached?\n\n # object.image.blob.attributes\n # .slice('filename', 'byte_size')\n # .merge(url: image_url)\n # .tap { |attrs| attrs['name'] = attrs.delete('filename') }\n object.image.service_url\n \n end", "def photo_src\n self.photo.present? ? self.photo.picture_url : Prize::DEFAULT_IMG\n end", "def add_photo\n user = self\n user.remote_photo_url = \"http://res.cloudinary.com/dna8puisr/image/upload/v1512743339/default_avatar_qa3u1k.png\"\n user.save\n end", "def cover\n photos.first\n end", "def image_url\n image_uri\n end", "def cover_image\n end", "def upload_photo(cocktail_id)\n cocktailloader = Cocktailloader.find_by(mrcock_id: cocktail_id)\n cocktail = Cocktail.find(cocktail_id)\n img = cocktailloader.strDrinkThumb if cocktailloader\n cocktail.remote_photo_url = img if img\n puts \"photo saved\"\n cocktail.save\nend", "def complete_upload_image\n @dom_id = \"##{params[:photo][:dom_id]}\"\n\n @asset = Image.new(uploaded_asset_attributes.reverse_merge(uploaded_by: current_user))\n @asset.add_meta(params[:photo])\n @asset.save\n render template: \"/dash/chooser/complete_upload\"\n end", "def full_picture\n if self.photo.file != nil\n self.photo_url\n elsif self.picture\n self.picture\n else\n \"http://res.cloudinary.com/geertkeularts/image/upload/v1467110899/defaultpicture_jj0nwa.jpg\"\n end\n end", "def image\n\n end", "def add_image \n image = CARMD.image(self.vin)\n if image == \"\"\n image = \"http://clipart-library.com/img/2050778.png\"\n end\n self.auto_image = image \n self.save \n end", "def image_url\n image.url\n end", "def create_profile_photo\n randomPhotoIndex = 1 + rand(10)\n p = self.profile_photos.create\n p.remote_photo_url = 'http://ragatzi.s3.amazonaws.com/uploads/profile_default_' + randomPhotoIndex.to_s + '.png'\n p.save! \n end", "def image\n end", "def image\n end", "def photo_from_url(url)\n end", "def image; end", "def image\n end", "def image\n end", "def profilepicture\n if portfolio\n portfolio.photo\n end\n end", "def cloudinary_imgs_cara(key,instance)\n cl_image_tag(key, :quality=>\"auto\", :fetch_format=>:auto, :crop=>\"fit\", :class=>\"d-block mx-auto img-fluid rounded\", :alt=>\"#{instance.name}\")\n end", "def create\n\tresult = Cloudinary::Uploader.upload(foto_params[:src])\n\t@foto = @proyecto.fotos.build(foto_params) do |t|\n t.src = result['url']\n\t\tt.public_id = result['public_id']\n end\n\tif @foto.save\n redirect_to @proyecto\n else\n render :new\n end\n end", "def rep_image\n\t photos.first\n\tend", "def test_image(photo)\n photo = File.expand_path(photo)\n path = photo.sub(/\\.jpe?g/i, '.copy.jpg')\n FileUtils.cp photo, path\n `automator -i #{path} #{Photoapp.gem_dir(\"lib/adjust-image.workflow\")}`\n\n Photo.new(path, logo, self).write(path)\n end", "def preview_photo\n photos.first\n end", "def image\n @image ||= Image.find(params[:id])\n end", "def image\n @image = Image.find_user_image_by_ref(params[:user], params[:ref])\n end", "def create\n @photo = current_user.photos.build(photo_params)\n @photo.image_url = upload_photo_and_return_name\n respond_to do |format|\n if @photo.save\n format.html { redirect_to root_url }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def charcoal\n @photo = Photo.find(params[:id])\n img = Magick::Image.read('public' + @photo.attachment_url).first\n img = img.charcoal(0.0, 1.0)\n img.write('public' + @photo.attachment_url)\n end", "def image_url\n image.url(:medium)\n end", "def event_photo(photos)\n speakers = find_speaker(photos)\n if speakers.empty?\n photo = photos.shuffle[0]\n else\n photo = speakers[0]\n end\n src = photo['photo_link']\n name = photo['member']['name']\n \"<img src=\\\"#{src}\\\" class=\\\"event-photo\\\" alt=\\\"Photo by #{name}\\\" />\"\nend", "def profile_photo\n\tend", "def upload_photo(proof_image, filename)\n uploader = PhotoUploader.new\n uploader.setname(filename)\n uploader.setstore(\"img/remark\")\n uploader.store!(proof_image)\n end", "def create\n @upload_photo = UploadPhoto.new(params[:upload_photo])\n\n @upload_photo.user_id = 0 - @session_id.to_i # this will be updated when user logged in.\n @upload_photo.user_id = params[:user_id] unless params[:user_id].blank?\n\n if @upload_photo.save\n\t\t render :text => @upload_photo.data.url(:medium).split('?').first # @upload_photo.data.url(:thumb)\n else\n render :text => \"ERROR WHILE UPLOADING IMAGE\"\n end\n end", "def image\n images.first\n end", "def image_url\n model.image_url.presence || h.asset_path('face.jpg')\n end", "def copy_offer_image_to_photo\n unless self.offer_image.nil?\n original_file = self.offer_image.url(:original)\n unless original_file.nil? \n original_file_path = \"#{RAILS_ROOT}/public#{original_file}\"\n if File.exists?(original_file_path)\n file = File.new(original_file_path)\n self.photo = file\n end\n end\n end\n end", "def random_photo\n if params[:city] && !params[:city][:name]\n city = City.find :first, :conditions => {:name => params[:city]}\n @photo = Photo.find :first, :conditions => {:city_id => city.id}\n end\n if !@photo\n @photo = Photo.find(:first, :offset => rand(Photo.all.size))\n end\n @photo['filename'] = \"#{@photo.city.name.gsub(' ','').downcase}.jpg\"\n end", "def avatar_photo (person)\n if person.image.attached?\n image_tag person.image\n else\n image_tag \"static/placeholder.jpg\"\n end\n end", "def photo\n\t\ts = picture\n\t\treturn s if s.to_s != \"\"\n\t\t\n\t\t#i = image\n\t\treturn Artist.default_pic\n\t\t\n\t\tupdate_attribute(:picture, i)\n\t\tsave\n\t\treturn i\n\tend", "def image\n\t\t@image ||= Image.joins(:album)\n .where(id: params[:id], :albums => {:user_id => user_id})\n .take || halt(404)\n\tend", "def create\n @photo = Photo.new(params[:photo])\n \n respond_to do |format|\n # ユーザIDを保存\n @photo.user_id = current_user.id\n \n #@photo.album_id = $album.id\n \n File.open(\"public/ziptmp/img_#{current_user.id}.jpg\",'w+b'){|file|\n file.binmode\n file.write @photo.file\n }\n\t\t\n\t\t\n\t\t\n\t\timg_tmp = Pikl::Image.open(\"public/ziptmp/img_#{current_user.id}.jpg\")\n\n\t img_tmp.fit(150, 150).save(\"public/ziptmp/img_#{current_user.id}.jpg\")\n\t\t \n\t\timg_tmp = File.open(\"public/ziptmp/img_#{current_user.id}.jpg\", 'r+b')\n\t\t@photo.short_file = img_tmp.read\n\t\timg_tmp.close\n\t\tFileUtils.rm_r(\"public/ziptmp/img_#{current_user.id}.jpg\")\n \n if (@photo.content_type == \"image/jpeg\") || (@photo.content_type == \"image/png\")\n @photo.save\n\t end\n\t format.html { redirect_to(photos_url) }\n\t format.xml { head :ok }\n\t end\n end", "def image_callback\n @image = Image.create(image_params)\n @lecture.update(image: @image)\n end", "def create\n @image = Image.new(image_params)\n @image.ip = ip2long request.remote_ip\n @image.delete_code = (0...50).map { ('a'..'z').to_a[rand(26)] }.join\n @image.homepage = false\n @image.save\n end", "def set_photo\n @image = Photo.find(params[:id])\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 image_url\n album_cover ? album_cover.photo.photo_url_full : photos.size > 0 ? photos.first.photo_url_full : nil\n end", "def photo_url\n self.photo.url(:tile) # but now, self is the recipe\n end", "def chosen_image(photo)\n if photo\n remote_file = nil\n open(photo[\"photo_link\"]) do |f|\n remote_file = Base64.encode64(f.read)\n end\n puts(\"\\x1b]1337;File=;inline=1:\" + remote_file + \"\\a\\n\")\n end\n end", "def image_url\n image.present? ? image.url : ''\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 images; end", "def image_url\n Image.find(image_id).url\n end", "def show\n #authenticate_admin!\n #require 'open-uri'\n \n @candy = Candy.find(params[:id])\n @candy_photo = @candy.data['photo']\n @photo = @candy.photos.first\n \n# dir_pic = \"#{RAILS_ROOT}/public/images/candies/#{@candy.id}\"\n# \n# FileUtils.mkdir_p dir_pic if !File.directory?(dir_pic)\n# open(@candy_photo) do |o|\n# File.open(\"#{dir_pic}/#{@candy.pid}.jpg\", \"w\") { |f| f << o.read }\n# end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @candy }\n format.json { render :json => @candy }\n end\n end", "def create\n @image = Image.new(name: image_params[\"name\"], picture: image_params[\"picture\"], image_file_name:image_params[\"image_file_name\"], user_id: current_user.id)\n if @image.save\n redirect_to images_path\n else\n render 'new'\n end\n end", "def create\n @picture = Picture.new(picture_params)\n\n if params[:file].present?\n req = Cloudinary::Uploader.upload params[:file]\n @picture.image = req['public_id']\n end\n\n respond_to do |format|\n if @picture.save\n format.html { redirect_to @picture, notice: 'Picture was successfully created.' }\n format.json { render :show, status: :created, location: @picture }\n else\n format.html { render :new }\n format.json { render json: @picture.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(form_params)\n @photo.picture = PictureAttachmentHelper.convert_data_uri_to_upload(params[\"photo\"][\"picture\"])\n @photo.save\n redirect_to photos_path\n end", "def create_photos\n end", "def upload_image\n @image = Image.create(image_path: params[:upload][:image])\n p @image\n render json: @image\n end", "def test_06b\r\n db = build\r\n db.fetch('image-1.jpg',:width => 102)\r\n db.fetch('image-1.jpg',:width => 103)\r\n db.fetch('image-1.jpg',:width => 104)\r\n db.fetch('image-1.jpg',:height => 105)\r\n r = db.image('image-1.jpg')\r\n assert_equal 'image-1.jpg',r[:original]\r\n end", "def imgurl\n picref.imgurl if picref\n end", "def get_image_from_photo_info(photos)\n photos.map do |photo|\n \"https://live.staticflickr.com/#{photo['server']}/#{photo['id']}_#{photo['secret']}.jpg\"\n end\n end", "def photo\n @attributes[:photo] ||= PublicEarth::Db::Photo.find_by_id(@attributes[:photo_id])\n end", "def image_hash; end", "def update_img\n @post = Post.find(self.id)\n image = @post.image.url(:gallery)\n image = '/public' + image.gsub(/\\?.*/, '')\n\n if !@post.meme_text.nil?\n if File.exists? Rails.root.to_s + image\n PostsHelper.image_writer(image, @post.meme_text, @post.meme_position)\n end\n end\n end", "def upload_image\n \t@person = Person.find(params[:id])\n \t@person.image = params[:person][:image]\n \t@person.save!\n \tredirect_to @person\n end", "def set_photo\n @photo = Photo.find_by_secret_id(params[:secret_id])\n end", "def copy_offer_image_to_photo!\n self.copy_offer_image_to_photo\n self.save\n end", "def photo\n Photo.find_by_id(self.profile_photo_id)\n end", "def photo(image, alt_text = '')\n image_tag('image/todd_ramirez_' + image,\n alt: alt_text,\n title: alt_text)\n end", "def main_image\n self.images.first.image\n end", "def img\n source = Tinify.from_file(params[:file].tempfile.path)\n if source.store(\n service: 's3',\n aws_access_key_id: ENV['AWS_Access_Key_ID'],\n aws_secret_access_key: ENV['AWS_Secret_Access_Key'],\n region: 'us-west-1',\n path: 'gkbimages//client/'+params[:file].original_filename\n )\n render :json => {status: 0, data: 'https://s3-us-west-1.amazonaws.com/gkbimages//client/'+params[:file].original_filename}\n else \n render :json => {status: 404, data: \"Something went wrong with image upload\"}\n end\n end", "def create\n image_data = Base64.decode64(params[:image_data])\n image_data = image_data.gsub('data:image/jpeg;base64,', '')\n file_name = Digest::MD5.hexdigest(image_data)\n file_path = \"/tmp/#{file_name}.jpeg\"\n f=open(file_path, \"wb\") \n f.puts(image_data) \n f.close\n\n f = open(file_path, \"rb\")\n uploader = ImageUploader.new\n uploader.store!(f)\n \n\n @camera = Camera.new\n @camera.image_url = uploader.filename\n\n user = current_user\n @camera.user_id = user.id\n @camera.camera_place_id = params[:camera_place_id]\n\n respond_to do |format|\n if @camera.save\n format.html { redirect_to @camera, notice: 'Camera was successfully created.' }\n format.json { render json: @camera, status: :created, location: @camera }\n else\n format.html { render action: \"new\" }\n format.json { render json: @camera.errors, status: :unprocessable_entity }\n end\n end\n end", "def picture\n if model.picture and File.file?(model.asset_path_for_image)\n model.picture\n else\n model.update_cache\n ''\n end\n end", "def goods_image\n return params[:image_url] if params[:image_url].present?\n return params[:based64_image] if params[:based64_image].present?\n @image.present? ? @image : 'no_pic.png'\n end", "def photo!(options)\n return if identifier.nil?\n \n if upload_url = find_upload_url\n data = http_client.post(upload_url, 'file1' => options[:source])\n parsed_response = MultiJson.decode(data.body)\n \n @target.photos.save(parsed_response.merge('caption' => options[:message]))\n end\n end", "def photo!(options)\n return if identifier.nil?\n \n if upload_url = find_upload_url\n data = http_client.post(upload_url, 'file1' => options[:source])\n parsed_response = MultiJson.decode(data.body)\n \n @target.photos.save(parsed_response.merge('caption' => options[:message]))\n end\n end", "def small_photo_url(photo)\n server = photo.attribute('server')\n id = photo.attribute('id')\n secret = photo.attribute('secret')\n return \"http://static.flickr.com/#{server}/#{id}_#{secret}_m.jpg\"\nend", "def image\n 0\n end", "def upload_photo(proof_image, filename)\n uploader = PhotoUploader.new\n uploader.setname(filename)\n uploader.setstore(\"img/issue\")\n uploader.store!(proof_image)\n end", "def create \n ext = params[:avatar].tempfile.path.split('.').last\n photoname = \"/Users/sorry/Projects/Recipes-project/s3/\"+SecureRandom.hex+ext \n FileUtils.cp(params[:avatar].tempfile.path, photoname)\n # params = \n # { :recipe => {\n # :name => params[:name], \n # :instructions=> params[:instructions],\n # :photo=> photoname\n # }}\n @recipe = Recipe.new(name:params[:name],instructions: params[:instructions], photo: photoname)\n #@recipe = Recipe.new(recipe_params) \n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\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 user_image_url # return the user image\n ((self.user_image.present?)?(self.user_image.url.to_s):nil) || self.photo_url || \"/assets/no-image.png\"\n end", "def photos\n return nil\n end", "def images\n end", "def img\n if self.upload.try(:image).present?\n self.upload.try(:image).url(:thumb)\n else\n 'images/cmn1.jpg'\n end\n end", "def small_photo_uri(photo)\n server = photo.attribute('server')\n id = photo.attribute('id')\n secret = photo.attribute('secret')\n return \"http://static.flickr.com/#{server}/#{id}_#{secret}_m.jpg\"\nend", "def create\n photo_io = params[:photo][:path]\n if photo_io \n file_ext = File.extname(photo_io.original_filename)\n content = photo_io.read\n new_name = Digest::SHA1.hexdigest(content) + file_ext\n path = Rails.root.join('app','assets','images', new_name).to_path\n File.new(path,'w').syswrite(content)\n end\n @photo = Photo.new do |p|\n photo = params[:photo]\n p.name = photo[:name]\n p.path = new_name if new_name\n p.descrption = photo[:descrption]\n end\n respond_to do |format|\n if @photo.save\n format.html { redirect_to photos_url}\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 create_photo_for_user(user)\n user.photos.create(\n user_id: user.id,\n title: \"Test Photo\",\n description: \"Bacon ipsum dolor sit amet beef shoulder frankfurter brisket short loin. Capicola shankle pork belly, turducken chuck doner leberkas short loin. Boudin strip steak pork loin shankle flank spare ribs shoulder. Ball tip leberkas beef shank jerky beef ribs tongue capicola short loin pork belly filet mignon ribeye pork doner.\",\n photo: fixture_file_upload(\"photos/photo1.jpg\")\n )\n end", "def create\n @region = Region.find_by_name(params[:name])\n# if @region.secret != params[:secret]\n# \trender :text => \"404\"\n# \treturn\n# end\n @photo = Photo.create( :photo => params[:test], :score => 1, :region => @region )\n render :text => @photo.photo.url\n # render :text => \"http://localhost:3000/gallery/\" + @photo.id.to_s\n end", "def upload(image)\n imgur_image = Imgur::LocalImage.new(image, title: 'null')\n uploaded = @client.upload imgur_image\n uploaded.link\n end", "def cover_photo(size)\n\n \tif self.photos.length > 0\n \t\tself.photos[0].image.url(size)\n\n \telse \n \t\t\"blank.jpg\"\n \tend\n\n end", "def upload_to_flickr!\n # download image to tmp/\n photo_path = download_from_instagram\n @log.debug(\"Path is #{photo_path}\")\n # upload to flickr\n flickr.access_token = @params['flickr_access_token']\n flickr.access_secret = @params['flickr_access_secret']\n response = flickr.upload_photo photo_path, :title => @payload['title'], :description => @payload['caption'] \n @log.debug(\"Flickr Response = #{response}\")\n # push it into the Redii and delete local version.\n add_to_storage\n File.delete(photo_path)\n end", "def image\n self['image'] || self['image_src']\n end", "def image_path\n photo = album_cover ? album_cover.photo : photos.first\n if photo\n return \"/album/#{id}/photo/#{photo.id}\"\n else\n return nil\n end\n end", "def optimized_image_url\n unless image.url.present?\n # if this method is called too soon after an image is\n # uploaded, might need to reload the record to\n # have the url available\n reload\n end\n if Rails.application.config.use_cloudinary\n options = {height: 800, crop: \"scale\", quality: \"auto\"}\n image_url = Cloudinary::Utils.cloudinary_url image, options\n else\n image_url = image.url\n end\n image_url\n end", "def create\n @photo = Photo.create(params[:photo])\n end", "def main_photo\n recipe_photos.first.try(:photo)\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" ]
[ "0.69599324", "0.67144156", "0.66969705", "0.66554403", "0.6605963", "0.6512298", "0.6512192", "0.6489418", "0.64851373", "0.64850515", "0.6472816", "0.646482", "0.6450065", "0.6433949", "0.6433592", "0.6407638", "0.6407638", "0.63924044", "0.63838", "0.63771135", "0.63771135", "0.63461596", "0.6333866", "0.63195425", "0.6312658", "0.63085103", "0.6281397", "0.6277469", "0.6276095", "0.6259141", "0.6257797", "0.6251491", "0.62288094", "0.622811", "0.62274384", "0.6225289", "0.62221485", "0.6216325", "0.6210372", "0.6203772", "0.61992806", "0.61971456", "0.61953837", "0.61946404", "0.6193237", "0.6186208", "0.618569", "0.6181677", "0.61710596", "0.6163092", "0.6154223", "0.6148971", "0.6145846", "0.61420715", "0.6138373", "0.61308146", "0.6130205", "0.61278343", "0.61243594", "0.6113854", "0.6112548", "0.61105883", "0.6110186", "0.6106214", "0.6099732", "0.6097409", "0.609506", "0.60940695", "0.60871154", "0.60821563", "0.6079555", "0.6078758", "0.6070974", "0.6070089", "0.60687083", "0.606656", "0.60664976", "0.6066049", "0.6066049", "0.6064735", "0.60572404", "0.6056921", "0.60492486", "0.60490066", "0.60467243", "0.6037044", "0.60262996", "0.60259295", "0.6024223", "0.60099405", "0.6007046", "0.6005429", "0.60043055", "0.6003361", "0.600336", "0.60019696", "0.6001023", "0.59987587", "0.59966636", "0.5995825", "0.5990372" ]
0.0
-1
renvoie le nombre d'erreur qu'il y a dans la grille (lorsque la case est VIDE, ce n'est pas une erreur)
def nbCasesIncorrect nbErr = 0 newStatutVide = StatutVide.new(VIDE) newStatutArbre = StatutArbre.new(ARBRE) @grille.grille.each do | ligne | ligne.each do | cases | ####################################################################################################### # Là on rajoute 1 erreur si le statut visible de la case n'est pas identique a son statut véritable # et seulement si la case n'est pas vide ou qu'il ne s'agisse pas d'un arbre ####################################################################################################### nbErr += 1 if (cases.statutVisible != cases.statut && cases.statutVisible != newStatutVide && cases.statut != newStatutArbre) # case.estValide? à tester end end return nbErr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def donnerErreur()\n return @grilleEnCours.firstDifference(@grilleBase)\n end", "def image_error_num( max ); \"每則日誌最多可貼 #{max} 張圖片\"; end", "def errores_listado\n if self.errores.to_i > 0\n \"<span class=\\\"error b\\\">#{self.errores}</span>\"\n else\n errores\n end\n end", "def verifierErreur(fromUser)\n return @grilleEnCours.nbDifference(@grilleBase)\n end", "def merror(pset, pnum)\n vidioma = $idioma\n vidioma = 'es'\n mer = Errormessage.where(\"idioma_isocod2 = '#{vidioma}' AND msg_set = #{pset} AND msg_num = #{pnum} \").first\n if mer\n mer.contenido.html_safe\n else\n \"Error Number: \"+pset.to_s+\",\"+pnum.to_s\n end\nend", "def reject_errorcode_to_text(code)\n msg = \"ragione sconosciuta\"\n case code\n when 1\n msg = \"indice gioco non trovato\"\n when 2\n msg = \"non e' possibile partecipare ad un gioco creato da se stessi\"\n when 3\n msg = \"non e' possibile partecipare al gioco privato\"\n when 4\n msg = \"gioco valido per la classifica, disponibile solo per giocatori registrati\"\n when 5\n msg = \"qualcun altro sta cercando di giocare questa partita, spiacenti la richiesta non puo' essere accettata\"\n when 6\n msg = \"partita non valida\"\n when 7\n msg = \"indice gioco non trovato\"\n when 8\n msg = \"solo il creatore del gioco puo' accettare giocatori\"\n when 9\n msg = \"creatore del gioco disconnesso\"\n end\n return msg\n end", "def genere_erreur( erreur )\n out, err, statut = yield\n\n assert_empty out, \"*** Assertion echouee: stdout devrait etre vide mais contient des elements ***\"\n assert_match erreur, err.join, \"*** Assertion echouee: Le message d'erreur ne semble pas etre celui attendu ***\"\n refute_equal 0, statut, \"*** Assertion echouee: le 'exit status' est 0 mais devrait etre different de 0 ***\"\nend", "def getNombreGrille\n @mesGrilles.size - 1\n end", "def recolectar_una\n\t\test = \"\"\n\t\tif @estado == ESTADO::MUERTE\n\t\t\test = \"El árbol está muerto\"\n\t\telse\n\t\t\tif @contador == 0\n\t\t\t\test = \"No hay más naranjas\"\n\t\t\telse\n\t\t\t\test = \"La naranja estaba deliciosa\"\n\t\t\t\t@contador -= 1\n\t\t\tend\n\t\tend\n\t\test\n\tend", "def genere_erreur(erreur)\n out, err, statut = yield\n\n assert_empty out, '*** Assertion echouee: stdout devrait etre vide mais contient des elements ***'\n assert_match erreur, err.join, \"*** Assertion echouee: Le message d'erreur ne semble pas etre celui attendu ***\"\n refute_equal 0, statut, \"*** Assertion echouee: le 'exit status' est 0 mais devrait etre different de 0 ***\"\nend", "def error\n\tputs \" - Dis donc #{@name}, tu vois pas que c'est pas possible ?!? Allez rejoue ! \"\n\tputs \" \"\n end", "def getErreur\n\t\tlist = Array.new\n\t\t0.upto (@n-1) do |x|\n\t\t\t0.upto (@n-1) do |y|\n\t\t\t\tif @plateauJoueur[x][y].couleur != Tuile.getCouleurVide && @plateauJoueur[x][y].couleur != plateauSolution[x][y].couleur\n\t\t\t\t\tlist.push(Erreur.new(x,y))\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tif list.size == 0\n\t\t\treturn nil\n\t\tend\n\t\treturn list[Random.new(Time.now.sec).rand(0..(list.size-1))]\n\tend", "def validaDestaque\n\t\tif !verN(destaque.to_s)\n\t\t\terrors.add(\" \",\"O destaque deve ser um número de 1 até 10!\")\n\t\t\treturn\n\t\tend\t\n\t\t\n\t\tif verN(destaque.to_s)\n\t\t\ttmp = destaque\n\t\t\tif tmp < 1 or tmp > 10\n\t\t\t\terrors.add(\" \",\"O destaque deve ser um número de 1 até 10!\")\n\t\t\t\treturn\n\t\t\tend\t\n\t\tend\t\n\tend", "def error_number; end", "def mensaje_error(mensaje)\n\t\tmostrar_mensaje 31, mensaje\n\tend", "def casesIncorrect\n\n newStatutVide = StatutVide.new(VIDE)\n newStatutArbre = StatutArbre.new(ARBRE)\n tabCasesErr = Array.new\n grille=@grille.grille\n for i in 0..grille.length-1\n for j in 0..grille.length-1\n\n tabCasesErr.unshift(grille[i][j]) if (grille[i][j].statutVisible != grille[i][j].statut && grille[i][j].statutVisible != newStatutVide && grille[i][j].statut != newStatutArbre)\n\n end\n end\n return tabCasesErr.empty? ? 0 : tabCasesErr\n end", "def genere_erreur( erreur )\n out, err, statut = yield\n assert out.empty? || (out.size == 1 && out.first.must_match(/bundler.*failed to load/))\n statut.wont_equal 0\n err.join.must_match erreur\nend", "def displaynomoreroomerror\r\n\t\t\t@output.puts('No more room.')\r\n\t\tend", "def errored\n @errored ||= count('errored')\n end", "def error(nvae)\n end", "def render_error\n if too_large?\n :too_large\n end\n end", "def error\n 1/0\n end", "def to_s \n \"Error: Se encontró un caracter inesperado \\\"#{@valor}\\\" en la línea #{@linea}, Columna #{@columna}\"\n end", "def err_mex \n flash.now[:notice] = \"Non sei il possessore di questo feed e non detieni i privilegi per alterarlo!\" \t\t\t\n render \"show\"\n end", "def genere_sortie_et_erreur( attendu, erreur )\n out, err, statut = yield\n out.must_equal attendu\n err.join.must_match erreur\n statut.wont_equal 0\nend", "def error_message\n if error == 'on_reserve'\n 'another user has already reserved this item'\n elsif error == 'too_many'\n \"you cannot renew a loan more than 10 times\"\n elsif code == 'PatronNotFound'\n 'problem with user id - please contact an administrator for assistance'\n end\n end", "def mensaje_error\n\t\tmensaje_error_element.text\n\tend", "def errnum\r\n self.class.errnum\r\n end", "def retourAvant()#TOTEST\n if(@indiceCoup < tabCoup.size) #vérification normalement inutile puisque le bouton devrait être disable\n #On annule en passant au coup suivant\n coupSuivant = tabCoup.at(@indiceCoup)\n @grilleEnCours.tabCases[coupSuivant.case.positionY][coupSuivant.case.positionX].couleur = coupSuivant.couleur\n @grilleRaz = nil\n\n @indiceCoup += 1 #On passe au coup suivant\n\n socket = Fenetre1v1.getSocket\n if(socket != nil)\n socket.puts (\"av\" + @grilleEnCours.getPourcentage(@grilleBase, nil).to_s )\n end\n end\n\n return [peutRetourAvant?, coupSuivant.case] #Pour dire aux fonctions appelantes si on peut encore aller en avant\n end", "def err(cod)\n @st = :err\n @ie = cod\n end", "def failed_message\n Online::OPERATION_FAILED_ADVICES[@data['error_code'].to_i || \"Errore sconosciuto (#{error_code})\"]\n end", "def valida_titulo\n errors.add_to_base 'avisotitulo' if tituloes.blank? and titulofr.blank? \nend", "def wrong\n @counter += 1\n [@counter, WRONG]\n end", "def render_error\n if too_large?\n :too_large\n elsif collapsed?\n :collapsed\n end\n end", "def validar(orden_abono_excedente_arrime, fecha_registro_cheque, numero_cheque)\n logger.debug \"ENTRE A LA VALIDACION EN MI MODELOS ---- \" << orden_abono_excedente_arrime.inspect.to_s\n logger.debug \"ENTRE A LA VALIDACION EN MI MODELOS ---- \" << orden_abono_excedente_arrime_id.inspect.to_s\n \n logger.debug \"Parametros ---- \" << fecha_registro_cheque.to_s << \" - \" << numero_cheque.to_s\n \n msj = \"\"\n\n orden_abono_excedente_arrime = OrdenAbonoExcedenteArrime.find(orden_abono_excedente_arrime_id)\n solicitud = Solicitud.find(orden_abono_excedente_arrime.solicitud_id)\n\n logger.debug \"cheque ---- \" << numero_cheque.to_s\n logger.debug \"fecha ---- \" << fecha_registro_cheque.to_s\n if numero_cheque.to_s==''\n msj << I18n.t('Sistema.Body.Modelos.ViewExcedenteArrime.Errores.numero_cheque_obligatorio',:numero=>solicitud.numero) \n end\n\n if fecha_registro_cheque.to_s==''\n msj << I18n.t('Sistema.Body.Modelos.ViewExcedenteArrime.Errores.fecha_registro_invalida',:numero=>solicitud.numero)\n end\n\n if msj.length > 0\n return msj\n else\n return ''\n end\n end", "def message_error errors\n errors.full_messages.find{|object| /en.errors.messages.extension_whitelist_error/ =~ object }.nil? ?\n errors.full_messages.first.capitalize.to_s.gsub('_',' ') + \".\" :\n 'Only jpeg,jpg and png allowed!'\n\tend", "def grilleSuivante()\n @grilleRaz = nil\n return nil\n end", "def errors=(_); end", "def somme\n fail \"Doit etre defini dans la sous-classe\"\n end", "def titre\n if error?\n error.class.name\n else\n to_sym.to_s.capitalize\n end\n end", "def not_enough_nominees_error\n category = self.id\n category = \"This category does not have enough nominees to vote on. Please add more.\"\n return category\n end", "def no_red_numbers\n if self.player.club.cash <= 0\n self.errors[:base] = I18n.t('training.errors.red_numbers')\n end\n end", "def resta_demas\n if emp_cuentab.saldo_actual < total and tipo_movimiento == 'egreso'\n errors.add(:emp_cuentab, 'Saldo insuficiente')\n end\n end", "def genere_sortie_et_erreur(attendu, erreur, strict = nil)\n out, err, statut = yield\n\n if strict\n assert_equal attendu, out, \"*** Assertion echouee: La sortie emise sur stdout n'est pas *exactement* celle attendue (:strict => casse et blancs significatifs) ***\"\n else\n obtenu = out.map { |l| l.gsub(/\\s+/, '').downcase }\n attendu = attendu.map { |l| l.gsub(/\\s+/, '').downcase }\n assert_equal attendu, obtenu, \"*** Assertion echouee: La sortie emise sur stdout n'est pas celle attendue (meme en ignorant la casse et les blancs) ***\"\n end\n assert_match erreur, err.join, \"*** Assertion echouee: Le message d'erreur ne semble pas etre celui attendu ***\"\n refute_equal 0, statut, \"*** Assertion echouee: le 'exit status' est 0 mais devrait etre different de 0 ***\"\nend", "def lastvistaerror\n return @lastvistaerror\n end", "def validate\n errors.add_to_base \"That was tricky! Passangers must be an integer between 1 and 10 inclusive.\\nYou tried:\"+passengersToBoard.to_s if number_of_passangers?\n #errors.add(\"passengers\", \"tried:\"+passengersToBoard.to_s) if number_of_passangers? \n end", "def stru(msg); \"202 Only accepts file\"; end", "def error_message\n\t\t\tif @publication.errors.any?\n message = '<div id=\"error_explanation\"> ' +\n '<h2>' + @publication.errors.count.to_s + ' error(es) tratando de grabar la publicación:</h2> <ul>'\n @publication.errors.full_messages.each do |msg|\n message = message + '<li>'+ msg +'</li>'\n end\n message = message + '</ul>\t</div> '\n message.html_safe\n end\n end", "def check_stock_rango\n c = nueva_cantidad\n unless c < DECIMAL_LIMITE[:superior]\n errors.add(:cantidad, I18n.t('movimiento_mercaderia.detalle_cantidad_stock_superior', limite: DECIMAL_LIMITE[:superior]))\n false\n end\n end", "def type_error\n system(\"clear\")\n puts Spacer\n\n type = case @search_type\n when \"Pokemon Name\", \"Type\"\n \"numbers\"\n when \"Pokedex Number\"\n \"letters\"\n end\n \n puts \"Sorry! No #{type} please!\".colorize(:red)\n end", "def pdf_error\n message = 'Le fichier pdf n\\'a pas pu être créé !'\n message_box = Qt::MessageBox.new(Qt::MessageBox::Warning, 'Jacinthe', message)\n message_box.setWindowIcon(Icons.from_file('Board-11-Flowers-icon.png'))\n message_box.exec\n 'Fichier pdf non créé'\n end", "def nivel_no_final\r\n #collect llama al bloque una vez por cada elemento del mismo y crea un nuevo arreglo que contiene los valores retornados\r\n #nivels = movimiento.collect{ |valor_pos| valor_pos.nivel }\r\n \r\n if jugador_actual == 'O'\r\n movimiento.collect{ |valor_pos| valor_pos.nivel }.min\r\n #nivels.max\r\n else\r\n movimiento.collect{ |valor_pos| valor_pos.nivel }.max\r\n end\r\n end", "def changerEnVide\n\t\t@couleur=-1\n\tend", "def errors\n @user_guesses - normalized_letters\n end", "def validate()\n errors.add(:nombre, \"debe ser positivo\") if nombre.nil?\n end", "def char_form_error(field)\n case field\n when :supername\n \"!! Must be between 3-25 characters.\" if !@char.errors[:supername].empty?\n when :secret_identity\n \"!! Must be between 3-50 characters.\" if !@char.errors[:secret_identity].empty?\n when :char_type\n \"!! Please choose a character type.\" if !@char.errors[:char_type].empty?\n when :alignment\n \"!! #{@char.errors[:alignment][0]}\" if !@char.errors[:alignment].empty?\n when :hp\n \"!! #{@char.errors[:hp][0]}\" if !@char.errors[:hp].empty?\n when :bio\n \"!! Bio is too long - max length: 400 characters. You have used #{@char.bio.length}/400 characters.\" if !@char.errors[:bio].empty?\n end\n end", "def only_one_open_caja\n\t\terrors.add(:base, 'Ya hay una caja abierta') if Collect.is_any_open_caja\n\tend", "def genere_sortie_et_erreur( attendu, erreur, strict = nil )\n out, err, statut = yield\n\n if strict\n assert_equal attendu, out, \"*** Assertion echouee: La sortie emise sur stdout n'est pas *exactement* celle attendue (:strict => casse et blancs significatifs) ***\"\n else\n obtenu = out.map { |l| l.gsub(/\\s+/, \"\").downcase }\n attendu = attendu.map { |l| l.gsub(/\\s+/, \"\").downcase }\n assert_equal attendu, obtenu, \"*** Assertion echouee: La sortie emise sur stdout n'est pas celle attendue (meme en ignorant la casse et les blancs) ***\"\n end\n assert_match erreur, err.join, \"*** Assertion echouee: Le message d'erreur ne semble pas etre celui attendu ***\"\n refute_equal 0, statut, \"*** Assertion echouee: le 'exit status' est 0 mais devrait etre different de 0 ***\"\nend", "def error_for_todo(name)\n if !(1..100).cover? name.size\n \"Todo must be between 1 and 100 characters.\"\n end\n end", "def changerEnRouge\n\t\t@couleur=1\n\tend", "def error_msg\n name\n end", "def check\n nbErreur = @grid.check\n if(nbErreur > 0)\n @chrono.addTime(10)\n end\n return nbErreur\n end", "def to_s() # :nodoc:\n mano_seleccionada = super.to_s\n if not @movimientos.nil?\n return \"Las estrategias suministradas son \" + @movimientos.to_s + \" \" + mano_seleccionada\n end\n return \"El diccionario de estrategias provista no es valida\"\n end", "def marquer!\n fail \"Doit etre defini dans la sous-classe\"\n end", "def error\n\t\t\t\t\"ERROR\"\n\t\t\tend", "def error_message (errors)\n\tmessage = \"\"\n\terror_array = errors.split\n\n\terror_array.each do |error|\n\t\tcase error\n\t\twhen \"name\"\n\t\t\tmessage += \"Invalid Name \\n\"\n\t\twhen \"email\"\n\t\t\tmessage += \"Invalid Email \\n\"\n\t\twhen \"dup\"\n\t\t\tmessage += \"Duplicate Name \\n\"\n\t\twhen \"bName\"\n\t\t\tmessage += \"Invalid Business Name \\n\"\n\t\tend\n\tend\n\t\n\treturn message\nend", "def describe_error\n message = \"\"\n if self.account_number == nil\n message = message + I18n.t(:wrong_or_missing_account_number, :scope => [:model, :index]) + \" \"\n end\n if self.account_bank_number == nil\n message = message + I18n.t(:wrong_or_missing_account_bank_number, :scope => [:model, :index]) + \" \"\n end\n if self.student.uic == nil\n message = message + I18n.t(:missing_uic, :scope => [:model, :index]) + \" \"\n end\n if self.sident == -666\n message = message + I18n.t(:missing_sident_666, :scope => [:model, :index]) + \" \"\n end\n if self.sident == nil\n message = message + I18n.t(:missing_sident, :scope => [:model, :index]) + \" \"\n end\n return message\n\n end", "def stock_negativo\n errors.add(:cantidad, \"supera el stock exixtente\") if Product.find(product_id).cantidad < cantidad\n end", "def resume_size_validation\n errors[:resume] << \"should be less than 5MB\" if resume.size > 2.megabytes\n end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def message\n @errormsg\n end", "def error(msg)\n @errors << msg\n ofail @errors.last\n end", "def errors=(_arg0); end", "def errors=(_arg0); end", "def errors=(_arg0); end", "def errors=(_arg0); end", "def report_error(err)\n case err.message\n when Creator::REPOSITORY_CREATION_FAILED\n GitHubClassroom.statsd.increment(\"v2_exercise_repo.create.repo.fail\")\n when Creator::REPOSITORY_COLLABORATOR_ADDITION_FAILED\n GitHubClassroom.statsd.increment(\"v2_exercise_repo.create.adding_collaborator.fail\")\n when Creator::REPOSITORY_STARTER_CODE_IMPORT_FAILED\n GitHubClassroom.statsd.increment(\"v2_exercise_repo.create.importing_starter_code.fail\")\n else\n GitHubClassroom.statsd.increment(\"v2_exercise_repo.create.fail\")\n end\n end", "def error(name)\n array name, required: false do |s|\n s.string\n end\n end", "def chew_error_and_print_message(e)\n case e.message\n when 'ARTICLE_NIL_REQUIRED_VALUE_ERROR'\n puts \"Artigo com título ou autor nulos.\".yellow\n # log_article_error_to_file(article, a_link)\n # interrupt(interrupt_option)\n when \"ARTICLE_ALREADY_IN_DB_ERROR\"\n puts \"Artigo já está no Banco de Dados.\".green\n # log_article_error_to_file(article, a_link)\n when \"FORBIDDEN_ARTICLE_TITLE_ERROR\"\n puts \"Artigo com título proibido.\".yellow\n # interrupt(interrupt_option)\n # log_article_error_to_file(article, a_link)\n else\n puts e.message\n end\n puts \"Ignorando artigo com problemas... OK\\n\"\nend", "def contact_errors\n error \"name\"\n error \"age\"\n error \"homepage\"\n end", "def flash_error\n err = \"\"\n self.errors.messages.each {|name, value|\n err += value[0]\n }\n err\n end", "def printer_error(s)\n # your code\n errs = 0\n possibles = s.length\n arr = s.split('')\n\n arr.each do |i|\n if i.ord > 109\n errs += 1\n end\n end\n\n \"#{errs}/#{possibles}\"\nend", "def check_length res\n if res.space.length > 0 &&\n\tres.length &&\n\tres.length > res.space.length\n\t flash[:warning] = I18n.t('reservation.Flash.CamperLong',\n\t\t\t\t :camper_length => res.length,\n\t\t\t\t :space_length => res.space.length)\n end\n end", "def create_profile_set_error(err)\n r_error = RaccError.new\n r_error.error_message=err\n racc_errors << r_error\n end", "def error_message; end", "def avanzar_contador_token\n if @contador_tokens < @token_list.size-1\n @contador_tokens += 1\n puts 'bitach'\n else\n error_messager(1)\n @error = 1\n puts 'fuckD'\n puts 'error ='\n puts (@error)\n #mandar aviso y averiguar si la estructura estaba completa.\n end\n end", "def rescued_error\n ErrorSound.play\n id = data_battler.id\n seq_key = phase_sequence[battle_phase].call\n phase = (dead? ? :dead : battle_phase)\n klass = data_battler.class\n result = \"Theolized SBS : \\n\"+\n \"Error occured on #{klass} in ID #{id}\\n\" +\n \"Undefined sequence key \\\"#{seq_key}\\\" for #{phase} phase\\n\\n\" +\n \"This is your fault. Not this script error!\"\n msgbox result\n exit\n end", "def invalid_group_number\n logger.error 'Attempt to access invalid group_name #{params[:group_number]}'\n flash[:danger] = 'Неправильный номер группы.'\n redirect_to root_path\n end", "def nomination_status\n if view_status != 3\n return \"\"\n end\n return \"Det går endast att nominera till poster som inte väljs på Terminsmötet\"\n end", "def errMsg(msg)\n m = ChartDirector::MultiChart.new(400, 200)\n m.addTitle2(ChartDirector::Center, msg, \"arial.ttf\", 10).setMaxWidth(m.getWidth())\n return m\n end", "def error\r\n\t\t\t`#{BITS::BITSADMIN} /geterror {#{@id}}`\r\n\t\tend", "def picture_validation\n if picture.attached?\n if picture.blob.byte_size > 2000000\n picture.purge\n errors[:base] << 'Maksymalny rozmiar logo klanu to 2MB'\n elsif !picture.blob.content_type.starts_with?('image/')\n picture.purge\n errors[:base] << 'Zły format'\n end\n else\n errors[:base] << 'Logo klanu jest obowiązkowe.'\n end\n end", "def error(ex) [:error, ex]; end", "def errors\n\t\t@errors.join(', ')\n end" ]
[ "0.7123804", "0.6417306", "0.6304795", "0.6264157", "0.61889726", "0.61495245", "0.6017268", "0.6011007", "0.600217", "0.5980096", "0.5918367", "0.58979625", "0.5816936", "0.58086663", "0.57995933", "0.5683999", "0.5573926", "0.5525628", "0.5445306", "0.54407257", "0.54245913", "0.5413921", "0.5407697", "0.5406408", "0.5390008", "0.5387662", "0.5386209", "0.53824914", "0.5378212", "0.5375975", "0.53499776", "0.5346429", "0.53343785", "0.5331771", "0.5327084", "0.532671", "0.5324488", "0.5320319", "0.5317087", "0.53120285", "0.5297431", "0.5296956", "0.52605724", "0.5240458", "0.5234959", "0.52315867", "0.5214836", "0.52066046", "0.51864034", "0.51766366", "0.51699907", "0.516565", "0.5158219", "0.5152114", "0.5143019", "0.51251763", "0.50968015", "0.50931793", "0.5092004", "0.5083091", "0.50731105", "0.5066334", "0.50608486", "0.50558305", "0.50459653", "0.5043601", "0.5036568", "0.5033972", "0.5027252", "0.5024968", "0.5024968", "0.5024968", "0.5024968", "0.5024968", "0.5024968", "0.5024968", "0.5018067", "0.50132453", "0.50119656", "0.50119656", "0.50119656", "0.50119656", "0.5010826", "0.50097287", "0.5006886", "0.50015855", "0.49924314", "0.49914595", "0.49819565", "0.49788177", "0.49763942", "0.49756476", "0.49723893", "0.49716088", "0.49714413", "0.49690682", "0.49685958", "0.49673086", "0.49661985", "0.496517" ]
0.5900161
11
renvoie un tableau de cases contenant les erreurs qu'il y a dans la grille (lorsque la case est VIDE, ce n'est pas une erreur)
def casesIncorrect newStatutVide = StatutVide.new(VIDE) newStatutArbre = StatutArbre.new(ARBRE) tabCasesErr = Array.new grille=@grille.grille for i in 0..grille.length-1 for j in 0..grille.length-1 tabCasesErr.unshift(grille[i][j]) if (grille[i][j].statutVisible != grille[i][j].statut && grille[i][j].statutVisible != newStatutVide && grille[i][j].statut != newStatutArbre) end end return tabCasesErr.empty? ? 0 : tabCasesErr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nbCasesIncorrect\n nbErr = 0\n newStatutVide = StatutVide.new(VIDE)\n newStatutArbre = StatutArbre.new(ARBRE)\n @grille.grille.each do | ligne |\n ligne.each do | cases |\n #######################################################################################################\n # Là on rajoute 1 erreur si le statut visible de la case n'est pas identique a son statut véritable\n # et seulement si la case n'est pas vide ou qu'il ne s'agisse pas d'un arbre\n #######################################################################################################\n nbErr += 1 if (cases.statutVisible != cases.statut && cases.statutVisible != newStatutVide && cases.statut != newStatutArbre)\n # case.estValide? à tester\n end\n end\n return nbErr\n end", "def casePasACoteArbre\n\n newStatutVide = StatutVide.new(VIDE)\n newStatutArbre = StatutArbre.new(ARBRE)\n grille=@grille.grille\n\n for i in 0..grille.length-1\n for j in 0..grille.length-1\n ok = true\n if (grille[i][j].statutVisible == newStatutVide)\n\n if (i-1 >= 0 && grille[i-1][j].statut == newStatutArbre) || (j-1 >= 0 && grille[i][j-1].statut == newStatutArbre) || (i+1 <= grille.length-1 && grille[i+1][j].statut == newStatutArbre) || (j+1 <= grille.length-1 && grille[i][j+1].statut == newStatutArbre)\n ok = false\n end\n\n return grille[i][j] if ok\n\n end\n end\n end\n\n return 0\n end", "def reject_errorcode_to_text(code)\n msg = \"ragione sconosciuta\"\n case code\n when 1\n msg = \"indice gioco non trovato\"\n when 2\n msg = \"non e' possibile partecipare ad un gioco creato da se stessi\"\n when 3\n msg = \"non e' possibile partecipare al gioco privato\"\n when 4\n msg = \"gioco valido per la classifica, disponibile solo per giocatori registrati\"\n when 5\n msg = \"qualcun altro sta cercando di giocare questa partita, spiacenti la richiesta non puo' essere accettata\"\n when 6\n msg = \"partita non valida\"\n when 7\n msg = \"indice gioco non trovato\"\n when 8\n msg = \"solo il creatore del gioco puo' accettare giocatori\"\n when 9\n msg = \"creatore del gioco disconnesso\"\n end\n return msg\n end", "def donnerErreur()\n return @grilleEnCours.firstDifference(@grilleBase)\n end", "def retourAvant()#TOTEST\n if(@indiceCoup < tabCoup.size) #vérification normalement inutile puisque le bouton devrait être disable\n #On annule en passant au coup suivant\n coupSuivant = tabCoup.at(@indiceCoup)\n @grilleEnCours.tabCases[coupSuivant.case.positionY][coupSuivant.case.positionX].couleur = coupSuivant.couleur\n @grilleRaz = nil\n\n @indiceCoup += 1 #On passe au coup suivant\n\n socket = Fenetre1v1.getSocket\n if(socket != nil)\n socket.puts (\"av\" + @grilleEnCours.getPourcentage(@grilleBase, nil).to_s )\n end\n end\n\n return [peutRetourAvant?, coupSuivant.case] #Pour dire aux fonctions appelantes si on peut encore aller en avant\n end", "def select_board_case\n\t\tvalide_choice = 0 # on cree une variable qui vas nous servir de flag pour la boucle, on fera une boucle infini jusqu'a ce que cette variable soit egale a 1\n\n\t\twhile valide_choice == 0\n\t\t\tputs \"Choisisez la case sur laquel vous voulez jouer.\\n Si par exemple vous voulez jouer sur la premiere case ecrivez \\\"A1\\\"\"\n\t\t\tcase_choosed = gets.chomp.upcase # on recupere ca case que l'utilisateur a choisi de jouer et on la met en majuscule (sa permet au joueur de pouvoir selectionner une lettre minuscule)\n\t\t\tif (case_choosed[0] =~ /[A-C]/) != 0 # si le premier caractere n'es pas une lettre entre A et C (regex) on rentre dans la condition\n\t\t\t\tcase_choosed.reverse! # et on inverse la chaine de caractere (comme sa si l'utilisateur a mis 1A alor le programme ici transforme en A1)\n\t\t\tend\n\n\t\t\t# on fait une condition qui test si la case selectionner par l'utilisateur est vide ou pas, si elle a deja ete prise ou que l'utilisateur rentre n'importe quoi alor il vas boucler temp qu'il ne choisi pas une case vide\n\t\t\tif ((case_choosed[0] == 'A' || case_choosed[0] == 'B' || case_choosed[0] == 'C') && (case_choosed[1] == '1' || case_choosed[1] == '2' || case_choosed[1] == '3')) && case_choosed.length == 2 && @board_case.fetch(case_choosed) == \" \"\n\t\t\t\tvalide_choice = 1 # si l'utilisateur remplis toutes les conditions ca veut dire qu'il a selectionner une case valide on lui permet de sortir de la boucle\n\t\t\tend\n\n\t\t\tif !(@board_case.has_value?(\" \")) # si aucune case de notre hash board_case n'es vide alor toute les cases on ete remplie, on permet a l'utilisateur de sortir de la boucle\n\t\t\t\tvalide_choice = 1\n\t\t\tend\n\t\tend\n\t\tmodif_board_case(case_choosed) # on appel la class qui modifie le hash Board_case\n\tend", "def achou_bug(resposta)\n case resposta\n when 1\n puts 'Informar ao Dev'\n when 0\n puts 'Pode ir para produção'\n else \n puts 'Codigo invalido'\n end\nend", "def getErreur\n\t\tlist = Array.new\n\t\t0.upto (@n-1) do |x|\n\t\t\t0.upto (@n-1) do |y|\n\t\t\t\tif @plateauJoueur[x][y].couleur != Tuile.getCouleurVide && @plateauJoueur[x][y].couleur != plateauSolution[x][y].couleur\n\t\t\t\t\tlist.push(Erreur.new(x,y))\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tif list.size == 0\n\t\t\treturn nil\n\t\tend\n\t\treturn list[Random.new(Time.now.sec).rand(0..(list.size-1))]\n\tend", "def actu(status)\n\t\tif @plateau[status[0]][status[1]] == \" \"\n\t\t\t@plateau[status[0]][status[1]] = status[2]\n\t\t\taff()\n\t\telse\n\t\t\tif status[3] != \"ia\"\n\t\t\t\tputs\"case déja remplis veillez rejouer\"\n\t\t\tend\n\t\t\treturn false\n\t\tend\n\tend", "def victory(joueur)\n\t\t# On définit les 8 possibilités de victoires si elles se vérifient les 3 dans la combinaison donnée alors la partie s'arrête\n\t\tif (plateau[0] == joueur.value) && (plateau[1] == joueur.value) && (plateau[2] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\n\t\telsif (plateau[3] == joueur.value) && (plateau[4] == joueur.value) && (plateau[5] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[0] == joueur.value) && (plateau[3] == joueur.value) && (plateau[6] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[2] == joueur.value) && (plateau[4] == joueur.value) && (plateau[6] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[0] == joueur.value) && (plateau[4] == joueur.value) && (plateau[8] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[2] == joueur.value) && (plateau[5] == joueur.value) && (plateau[8] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[1] == joueur.value) && (plateau[4] == joueur.value) && (plateau[7] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telse\n\t\t\treturn\n\t\tend\n\tend", "def actu(status)\n\t\tif @plateau[status[0]][status[1]] == \" \"\n\t\t\t@plateau[status[0]][status[1]] = status[2]\n\t\t\taff()\n\t\telse\n\t\t\tputs\"case déja remplis veillez rejouer\"\n\t\t\treturn false\n\t\tend\n\tend", "def case_with_bad_decass_for_timeline_range_checks\n Time.zone = 'EST'\n vet = create_veteran\n cf_judge = User.find_by_css_id(\"BVABDANIEL\") || create(:user, :judge, :with_vacols_judge_record)\n cf_atty = User.find_by_css_id(\"BVABBLOCK\") || create(:user, :with_vacols_attorney_record)\n judge = VACOLS::Staff.find_by_css_id(cf_judge.css_id)\n atty = VACOLS::Staff.find_by_css_id(cf_atty.css_id)\n vc = create(:case, :assigned, user: cf_judge, bfcorlid: \"#{vet.file_number}S\")\n create(:legacy_appeal, vacols_case: vc)\n create(:priorloc, lockey: vc.bfkey, locdin: 5.weeks.ago, locdout: 5.weeks.ago - 1.day, locstout: judge.slogid, locstto: judge.slogid)\n create(:priorloc, lockey: vc.bfkey, locdin: 4.weeks.ago, locdout: 5.weeks.ago, locstout: judge.slogid, locstto: \"CASEFLOW_judge\")\n create(:priorloc, lockey: vc.bfkey, locdin: 3.weeks.ago, locdout: 4.weeks.ago, locstout: \"CASEFLOW_judge\", locstto: judge.slogid)\n create(:priorloc, lockey: vc.bfkey, locdin: 2.weeks.ago, locdout: 3.weeks.ago, locstout: judge.slogid, locstto: atty.slogid)\n create(:priorloc, lockey: vc.bfkey, locdin: 1.week.ago, locdout: 2.weeks.ago, locstout: atty.slogid, locstto: \"CASEFLOW_atty\")\n create(:priorloc, lockey: vc.bfkey, locdin: Time.zone.now, locdout: 1.week.ago, locstout: \"CASEFLOW_atty\", locstto: atty.slogid)\n create(:priorloc, lockey: vc.bfkey, locdout: Time.zone.now, locstout: atty.slogid, locstto: judge.slogid)\n end", "def game_ending\n \n # Toutes les cases ont été choisies\n @victory3 =\n !@cases[0].is_empty && !@cases[1].is_empty && !@cases[2].is_empty && \n !@cases[3].is_empty && !@cases[4].is_empty && !@cases[5].is_empty && \n !@cases[6].is_empty && !@cases[7].is_empty && !@cases[8].is_empty\n \n # vérifier si joueur avec symbol X a gagne\n @victory1 = is_the_end(CASE_SYMBOL_1)\n \n # vérifier si joueur avec symbol O a gagne\n @victory2 = is_the_end(CASE_SYMBOL_2)\n\n return @victory1 || @victory2 || @victory3\n end", "def good_vs_evil(good, evil)\n g = good.split.map(&:to_i)\n gt = g[0] * 1 + g[1] * 2 + g[2] * 3 + g[3] * 3 + g[4] * 4 + g[5] * 10\n e = evil.split.map(&:to_i)\n et = e[0] * 1 + e[1] * 2 + e[2] * 2 + e[3] * 2 + e[4] * 3 + e[5] * 5 + e[6] * 10\n return 'Battle Result: No victor on this battle field' if gt == et\n return 'Battle Result: Good triumphs over Evil' if gt > et\n return 'Battle Result: Evil eradicates all trace of Good' if gt < et\nend", "def case_result(race_place)\n case race_place\n when 50..60 then 'NOt really good!'\n when 0..10 then \"You are wiiner, in top!\"\n when 20..30 then \"pretty solid\"\n when 100..120 then \"are you kiding? worst time ever..\"\n end\nend", "def genere_sortie_et_erreur(attendu, erreur, strict = nil)\n out, err, statut = yield\n\n if strict\n assert_equal attendu, out, \"*** Assertion echouee: La sortie emise sur stdout n'est pas *exactement* celle attendue (:strict => casse et blancs significatifs) ***\"\n else\n obtenu = out.map { |l| l.gsub(/\\s+/, '').downcase }\n attendu = attendu.map { |l| l.gsub(/\\s+/, '').downcase }\n assert_equal attendu, obtenu, \"*** Assertion echouee: La sortie emise sur stdout n'est pas celle attendue (meme en ignorant la casse et les blancs) ***\"\n end\n assert_match erreur, err.join, \"*** Assertion echouee: Le message d'erreur ne semble pas etre celui attendu ***\"\n refute_equal 0, statut, \"*** Assertion echouee: le 'exit status' est 0 mais devrait etre different de 0 ***\"\nend", "def verifierErreur(fromUser)\n return @grilleEnCours.nbDifference(@grilleBase)\n end", "def check_err_order(order)\r\n case order\r\n when \"latte\"\r\n when \"scone\"\r\n when \"tea\"\r\n else\r\n puts ERROR_MSG\r\n return true\r\n end\r\n return false\r\nend", "def genere_sortie_et_erreur( attendu, erreur, strict = nil )\n out, err, statut = yield\n\n if strict\n assert_equal attendu, out, \"*** Assertion echouee: La sortie emise sur stdout n'est pas *exactement* celle attendue (:strict => casse et blancs significatifs) ***\"\n else\n obtenu = out.map { |l| l.gsub(/\\s+/, \"\").downcase }\n attendu = attendu.map { |l| l.gsub(/\\s+/, \"\").downcase }\n assert_equal attendu, obtenu, \"*** Assertion echouee: La sortie emise sur stdout n'est pas celle attendue (meme en ignorant la casse et les blancs) ***\"\n end\n assert_match erreur, err.join, \"*** Assertion echouee: Le message d'erreur ne semble pas etre celui attendu ***\"\n refute_equal 0, statut, \"*** Assertion echouee: le 'exit status' est 0 mais devrait etre different de 0 ***\"\nend", "def check_controllo_offerte(file_controlo)\n sheet = apri_file(file_controlo)\n tabella_controlli = [sheet.column(2),sheet.column(3)]\n tabella_controlli[0].each_with_index do |x,y|\n if x == \"FLUSSO\"\n unless tabella_controlli[1][0] == $data\n @errore << \"Nel file #{file_controlo.basename} c'è una data diversa da quella selezionata\"\n end\n else\n unless tabella_controlli[1][y] == \"OK\"\n @errore << \"Nel file #{file_controlo.basename} il \\\"#{tabella_controlli[0][y]}\\\" non è OK\"\n end\n end\n end\n end", "def mostrar_ganador(tablero)\r\n bandera_ganador=false#como aun no hay ganador mi bandera ganador es falsa desde el incio\r\n #para la fila 1\r\n if tablero[0][0]==\"X\" and tablero[0][1]==\"X\" and tablero[0][2]==\"X\"#condicinante de las cordenadas y el valor que debe estar en ellas\r\n ganador=\"¡¡¡Gana el jugador X!!!\"#guardo en una varible una mensaje del ganador\r\n bandera_ganador=true#como si hay ganador mi bandera ganador se vuelve verdadera\r\n\t\t#hago exacamente lo mismo para todas los demas posibles resultados\r\n elsif tablero[0][0]==\"O\" and tablero[0][1]==\"O\" and tablero[0][2]==\"O\"\r\n ganador=\"¡¡¡Gana el jugador O!!!\"\r\n bandera_ganador=true\r\n #para la fila 2\r\n elsif tablero[1][0]==\"X\" and tablero[1][1]==\"X\" and tablero[1][2]==\"X\"\r\n ganador=\"¡¡¡Gana el jugador X!!!\"\r\n bandera_ganador=true\r\n elsif tablero[1][0]==\"O\" and tablero[1][1]==\"O\" and tablero[1][2]==\"O\"\r\n ganador=\"¡¡¡Gana el jugador O!!!\"\r\n bandera_ganador=true\r\n #para la fila 3\r\n elsif tablero[2][0]==\"X\" and tablero[2][1]==\"X\" and tablero[2][2]==\"X\"\r\n ganador=\"¡¡¡Gana el jugador X!!!\"\r\n bandera_ganador=true\r\n elsif tablero[2][0]==\"O\" and tablero[2][1]==\"O\" and tablero[2][2]==\"O\"\r\n ganador=\"¡¡¡Gana el jugador O!!!\"\r\n bandera_ganador=true\r\n #para columna 1\r\n elsif tablero[0][0]==\"X\" and tablero[1][0]==\"X\" and tablero[2][0]==\"X\"\r\n ganador=\"¡¡¡Gana el jugador X!!!\"\r\n bandera_ganador=true\r\n elsif tablero[0][0]==\"O\" and tablero[1][0]==\"O\" and tablero[2][0]==\"O\"\r\n ganador=\"¡¡¡Gana el jugador O!!!\"\r\n bandera_ganador=true\r\n #para columna 2\r\n elsif tablero[0][1]==\"X\" and tablero[1][1]==\"X\" and tablero[2][1]==\"X\"\r\n ganador=\"¡¡¡Gana el jugador X!!!\"\r\n bandera_ganador=true\r\n elsif tablero[0][1]==\"O\" and tablero[1][1]==\"O\" and tablero[2][1]==\"O\"\r\n ganador=\"¡¡¡Gana el jugador O!!!\"\r\n bandera_ganador=true\r\n #para columna 3\r\n elsif tablero[0][2]==\"X\" and tablero[1][2]==\"X\" and tablero[2][2]==\"X\"\r\n ganador=\"¡¡¡Gana el jugador X!!!\"\r\n bandera_ganador=true\r\n elsif tablero[0][2]==\"O\" and tablero[1][2]==\"O\" and tablero[2][2]==\"O\"\r\n ganador=\"¡¡¡Gana el jugador O!!!\"\r\n bandera_ganador=true\r\n #para diagonal 1\\\r\n elsif tablero[0][0]==\"X\" and tablero[1][1]==\"X\" and tablero[2][2]==\"X\"\r\n ganador=\"¡¡¡Gana el jugador X!!!\"\r\n bandera_ganador=true\r\n elsif tablero[0][0]==\"O\" and tablero[1][1]==\"O\" and tablero[2][2]==\"O\"\r\n ganador=\"¡¡¡Gana el jugador O!!!\"\r\n bandera_ganador=true\r\n #para diagonla 2/\r\n elsif tablero[0][2]==\"X\" and tablero[1][1]==\"X\" and tablero[2][0]==\"X\"\r\n ganador=\"¡¡¡Gana el jugador X!!!\"\r\n bandera_ganador=true\r\n elsif tablero[0][2]==\"O\" and tablero[1][1]==\"O\" and tablero[2][0]==\"O\"\r\n ganador=\"¡¡¡Gana el jugador O!!!\"\r\n bandera_ganador=true\r\n else\r\n ganador=\"Aun no hay ganador...\"#Digo que aun no hay ganador alguno\r\n bandera_ganador=false#si no se cumplio alguna de las condiciones anteriores, la bandera ganador sigue siendo falsa\r\n\tend\r\n print ganador#imprimo el ganador\r\n return bandera_ganador#regreso la bandera jugador, que se conectara en la variable que se encuentra en cel codigo principal, para decidir si se rompe o no el programa\r\nend", "def genere_erreur( erreur )\n out, err, statut = yield\n\n assert_empty out, \"*** Assertion echouee: stdout devrait etre vide mais contient des elements ***\"\n assert_match erreur, err.join, \"*** Assertion echouee: Le message d'erreur ne semble pas etre celui attendu ***\"\n refute_equal 0, statut, \"*** Assertion echouee: le 'exit status' est 0 mais devrait etre different de 0 ***\"\nend", "def genere_sortie_et_erreur( attendu, erreur )\n out, err, statut = yield\n out.must_equal attendu\n err.join.must_match erreur\n statut.wont_equal 0\nend", "def clean_board\n\t\t@cases.map! { |c| c = \" \"}\n\tend", "def survery_results(vampire_level)\n case vampire_level\n when 0\n puts 'Probably not a vampire'\n when 1 || 6\n puts 'Probably a vampire'\n when 2\n puts 'Almost certainly a vampire'\n when 3\n puts 'Definitely a vampire'\n when 5\n puts 'Results inconclusive.'\n end\n puts '--------------------------------'\nend", "def classify(age)\n case age\n when 0..2\n puts \"bebe\"\n when 3..12\n puts \"niño\"\n when 13..17\n puts \"Adolescente\"\n when 18..30\n puts \"joven\"\n else\n puts \"señor\"\n end\nend", "def check_victory(my_case_to_check)\n result = 0\n my_case_check_id = (@group_of_case.select { |my_case| my_case.id == my_case_to_check})[0].value\n\n # Verification des lignes\n # case 1 / 4 / 7\n comparaison_array = [1, 4, 7]\n if comparaison_array.include?(my_case_to_check)\n if my_case_check_id == select_positive(my_case_to_check, 1) && my_case_check_id == select_positive(my_case_to_check, 2)\n result += 2\n end\n end\n # Case 2 / 5 / 8\n comparaison_array = [2, 5, 8]\n if comparaison_array.include?(my_case_to_check)\n if my_case_check_id == select_negative(my_case_to_check, 1) && my_case_check_id == select_positive(my_case_to_check, 1)\n result += 2\n end\n end\n # Case 3 / 6 / 9\n comparaison_array = [3, 6, 9]\n if comparaison_array.include?(my_case_to_check)\n if my_case_check_id == select_negative(my_case_to_check, 1) && my_case_check_id == select_negative(my_case_to_check, 2)\n result += 2\n end\n end\n return true if result == 2\n result = 0\n\n # Verification des colonnes\n # case 1 / 2 / 3\n comparaison_array = [1, 2, 3]\n if comparaison_array.include?(my_case_to_check)\n if my_case_check_id == select_positive(my_case_to_check, 3) && my_case_check_id == select_positive(my_case_to_check, 6)\n result += 2\n end\n end\n # Case 4 / 5 / 6\n comparaison_array = [4, 5, 6]\n if comparaison_array.include?(my_case_to_check)\n if my_case_check_id == select_negative(my_case_to_check, 3) && my_case_check_id == select_positive(my_case_to_check, 3)\n result += 2\n end\n end\n # Case 7 / 8 / 9\n comparaison_array = [7, 8, 9]\n if comparaison_array.include?(my_case_to_check)\n if my_case_check_id == select_negative(my_case_to_check, 3) && my_case_check_id == select_negative(my_case_to_check, 6)\n result += 2\n end\n end\n return true if result == 2\n result = 0\n\n # Verification diagonale 159\n # Case 1\n if my_case_to_check == 1\n if my_case_check_id == select_positive(my_case_to_check, 4) && my_case_check_id == select_positive(my_case_to_check, 8)\n result += 2\n end\n end\n # Case 5\n if my_case_to_check == 5\n if my_case_check_id == select_negative(my_case_to_check, 4) && my_case_check_id == select_positive(my_case_to_check, 4)\n result += 2\n end\n end\n # Case 9\n if my_case_to_check == 9\n if my_case_check_id == select_negative(my_case_to_check, 4) && my_case_check_id == select_negative(my_case_to_check, 8)\n result += 2\n end\n end\n return true if result == 2\n result = 0\n\n # Verification diagonale 357\n # Case 3\n if my_case_to_check == 3\n if my_case_check_id == select_positive(my_case_to_check, 2) && my_case_check_id == select_positive(my_case_to_check, 4)\n result += 2\n end\n end\n # Case 5\n if my_case_to_check == 5\n if my_case_check_id == select_negative(my_case_to_check, 2) && my_case_check_id == select_positive(my_case_to_check, 2)\n result += 2\n end\n end\n # Case 7\n if my_case_to_check == 7\n if my_case_check_id == select_negative(my_case_to_check, 2) && my_case_check_id == select_negative(my_case_to_check, 4)\n result += 2\n end\n end\n\n true if result == 2\n end", "def genere_erreur(erreur)\n out, err, statut = yield\n\n assert_empty out, '*** Assertion echouee: stdout devrait etre vide mais contient des elements ***'\n assert_match erreur, err.join, \"*** Assertion echouee: Le message d'erreur ne semble pas etre celui attendu ***\"\n refute_equal 0, statut, \"*** Assertion echouee: le 'exit status' est 0 mais devrait etre different de 0 ***\"\nend", "def goodVsEvil(good, evil)\n # good_power, evil_power = 0, 0\n # good.split.each_with_index do |num, i|\n # if i < 3\n # good_power += num.to_i * (i + 1)\n # elsif i < 5\n # good_power += num.to_i * i\n # elsif i == 5\n # good_power += num.to_i * 2 * i\n # end\n # end\n god = good.split.each_with_index.inject(0) do |sum, (num, i)|\n if i < 3\n sum + num.to_i * (i + 1)\n elsif i < 5\n sum + num.to_i * i\n elsif i == 5\n sum + num.to_i * 2 * i\n end\n end\n \n \n evl = evil.split.each_with_index.inject(0) do |sum, (num, i)|\n case i\n when 0\n sum + num.to_i * (i + 1)\n when 1, 2, 3\n sum + num.to_i * 2\n when 4\n sum + num.to_i * (i - 1)\n when 5\n sum + num.to_i * i\n when 6\n sum + num.to_i * (i + 4) \n end\n end\n \n if evl > god\n str = \"Evil eradicates all trace of Good\"\n elsif evl < god\n str = \"Good triumphs over Evil\"\n else\n str = \"No victor on this battle field\"\n end\n \n \"Battle Result: #{str}\"\nend", "def pedir_jugada(tablero)\r\n\tbandera=0#esta bandera sirve para contar el numero de jugadas que se llevan\r\n\tbandera_ganador=false#y esta para saber si hay o no un ganador aun\r\n\twhile bandera<9 or bandera_ganador==false#inicio un while donde pongo dos condicionantes para que se repita\r\n\t\tcontadorX=2#este contador sirve para que en caso de que X se equivoque en las cordenadas pueda volver a ingresarlas \r\n\t\twhile contadorX!=1#aplico el contador anterior con este while\r\n\t\t\tputs \"Jugador X, dame tu jugada, empezando por la fila: \"#pido las coordenadas\r\n\t\t\tfilaX=validar\r\n\t\t\tputs \"Ahora dame en la columna: \"\r\n columnaX=validar\r\n jugadorX=\"X\"#doy el valor de jugador X\r\n\t\t\tif filaX>=0 and filaX<=2 and columnaX>=0 and columnaX<=2#este if sirve para verificar que las cordenadas esten dentro del limite que se esta dando\r\n\t\t\t\tif tablero[filaX][columnaX]==\"-\"#para saber si hay una linea dentro de las cordenadas dadas anteriormente\r\n tablero[filaX][columnaX]=jugadorX;#si hay una linea añado en las cordenas el valor de jugador X\r\n mostrar_tablero(tablero);#muestro el tablero\r\n contadorX=1;#aumento mi contador para que se rompa el segundo while\r\n\t\t\t\telse\r\n\t\t\t\t\tputs \"Esta casilla esta ocupada, vuelve a ingresar las cordenadas\"#si no se cumple el if anterior manda este mensaje de error\r\n\t\t\t\t\tcontadorX=2#para que se vuelva a repetir el while de X\r\n\t\t\t\tend\r\n\t\t\telse#en caso de que las cordenadas no esten dentro del rango manda el siguiente mensaje de errro\r\n\t\t\t\tputs \"Opciones invalidas, por favor ingresa valores del 0-2\"#mensaje de error\r\n\t\t\t\tcontadorX=2#contador para que se repita el while de X\r\n\t\t\tend \r\n\t\tend\r\n\t\tbandera=bandera+1#si se cumplio exitosamente el while anteriro, ya se hizo una jugada, asi que el contador de las jugadas aumenta en 1\r\n bandera_ganador=mostrar_ganador(tablero)#verifico si hay o no ganador\r\n puts \"\\n Numero de pocisiones ocupadas: \", bandera#muestro las pocisiones ocupadas hasta el momento\r\n\t\tif bandera_ganador==true#si ya hay un gandor rompo el programa con el break\r\n\t\t\tbreak\r\n\t\telse#de lo contrario continua el ciclo\r\n\t\t\tif bandera==9#ahora, si el contador de las jugadas llega a 9 digo que no hay ganador y rompo el programa\r\n\t\t\t\tputs \"Juego terminado, no hay ganador\"\r\n\t\t\t\tbreak\r\n\t\t\tend\r\n\t\t\t#si no se cumple el if anterior pasa a las siguientes lineas de codigo donde se realiza exatamente lo mismo que lo que se hizo con el jugador X, pero cambiando algunos valores por O\r\n\t\t\tcontadorO=2\r\n\t\t\twhile contadorO!=1\r\n\t\t\t\tputs\"Jugador 0, dame tu jugada, empezando por la fila: \"\r\n\t\t\t\tfilaO=validar\r\n\t\t\t\tputs \"Ahora dame en la columna: \"\r\n columnaO=validar\r\n jugadorO=\"O\"\r\n\t\t\t\tif filaO>=0 and filaO<=2 and columnaO>=0 and columnaO<=2\r\n\t\t\t\t\tif tablero[filaO][columnaO]==\"-\"\r\n tablero[filaO][columnaO]=jugadorO\r\n mostrar_tablero(tablero)\r\n contadorO=1\r\n else\r\n puts \"Esta ocupada la casilla que solicitas, vuelve a ingresar las cordenadas\"\r\n contadorO=2\r\n\t\t\t\t\tend\r\n\t\t\t\telse\r\n\t\t\t\t\tputs \"Numeros invalidos, porfavor, vuelva a ingresar las cordenadas\"\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\tbandera=bandera+1#como se hizo una jugada aumenta el contador de las jugadas\r\n bandera_ganador=mostrar_ganador(tablero)#verifico si hay o no ganador\r\n puts \"\\n Numero de pocisiones ocupadas: \", bandera#muestro las pocisiones ocupadas\r\n\t\t\tnext#este es el equivalente a continue en python, es para que se vuelva a \"repetir\" el ciclo principla\r\n\t\tend\r\n\t\tbreak#rompo mi programa\r\n\tend\r\nend", "def null_check(record,row)\n #se gli attributi obbligatori sono nulli\n if record.data.blank?\n #registro l'errore\n save_error(record,\"Violazione not null - Data\",row)\n #segnalo che c'è stato un errore sulla riga\n session[:row_error] = true\n #e segnalo l'errore sul file\n session[:file_error] = true\n end\n if record.cod_plot.blank?\n #registro l'errore\n save_error(record,\"Violazione not null - Plot\",row)\n #segnalo che c'è stato un errore sulla riga\n session[:row_error] = true\n #e segnalo l'errore sul file\n session[:file_error] = true\n end\n if record.subplot.blank?\n #registro l'errore\n save_error(record,\"Violazione not null - Subplot\",row)\n #segnalo che c'è stato un errore sulla riga\n session[:row_error] = true\n #e segnalo l'errore sul file\n session[:file_error] = true\n end\n if record.in_out.blank?\n #registro l'errore\n save_error(record,\"Violazione not null - In/Out\",row)\n #segnalo che c'è stato un errore sulla riga\n session[:row_error] = true\n #e segnalo l'errore sul file\n session[:file_error] = true\n end\n if record.priest.blank?\n #registro l'errore\n save_error(record,\"Violazione not null - Pri/Est\",row)\n #segnalo che c'è stato un errore sulla riga\n session[:row_error] = true\n #e segnalo l'errore sul file\n session[:file_error] = true\n end\n if record.cop_comp.nil?\n #registro l'errore\n save_error(record,\"Violazione not null - Copertura Complessiva\",row)\n #segnalo che c'è stato un errore sulla riga\n session[:row_error] = true\n #e segnalo l'errore sul file\n session[:file_error] = true\n end\n #FACOLTATIVI\n if mandatory?(session[:mask_name],\"Copl\",\"copertura_arboreo\")\n if record.cop_arbo.nil?\n #registro l'errore\n save_error(record,\"Violazione not null - Copertura Arboreo\",row)\n #segnalo che c'è stato un errore sulla riga\n session[:row_error] = true\n #e segnalo l'errore sul file\n session[:file_error] = true\n end\n end\n if mandatory?(session[:mask_name],\"Copl\",\"copertura_arbustivo\")\n if record.cop_arbu.nil?\n #registro l'errore\n save_error(record,\"Violazione not null - Copertura Arbustivo\",row)\n #segnalo che c'è stato un errore sulla riga\n session[:row_error] = true\n #e segnalo l'errore sul file\n session[:file_error] = true\n end\n end\n if mandatory?(session[:mask_name],\"Copl\",\"copertura_erbaceo\")\n if record.cop_erb.nil?\n #registro l'errore\n save_error(record,\"Violazione not null - Copertura Erbaceo\",row)\n #segnalo che c'è stato un errore sulla riga\n session[:row_error] = true\n #e segnalo l'errore sul file\n session[:file_error] = true\n end\n end\n if mandatory?(session[:mask_name],\"Copl\",\"copertura_lettiera\")\n if record.cop_lett.nil?\n #registro l'errore\n save_error(record,\"Violazione not null - Copertura Lettiera\",row)\n #segnalo che c'è stato un errore sulla riga\n session[:row_error] = true\n #e segnalo l'errore sul file\n session[:file_error] = true\n end\n end\n if mandatory?(session[:mask_name],\"Copl\",\"copertura_muscinale\")\n if record.cop_musc.nil?\n #registro l'errore\n save_error(record,\"Violazione not null - Copertura Muscinale\",row)\n #segnalo che c'è stato un errore sulla riga\n session[:row_error] = true\n #e segnalo l'errore sul file\n session[:file_error] = true\n end\n end\n if mandatory?(session[:mask_name],\"Copl\",\"copertura_suolo_nudo\")\n if record.cop_suol.nil?\n #registro l'errore\n save_error(record,\"Violazione not null - Copertura Suolo Nudo\",row)\n #segnalo che c'è stato un errore sulla riga\n session[:row_error] = true\n #e segnalo l'errore sul file\n session[:file_error] = true\n end\n end\n if mandatory?(session[:mask_name],\"Copl\",\"altezza_arboreo\")\n if record.alt_arbo.nil?\n #registro l'errore\n save_error(record,\"Violazione not null - Altezza Arboreo\",row)\n #segnalo che c'è stato un errore sulla riga\n session[:row_error] = true\n #e segnalo l'errore sul file\n session[:file_error] = true\n end\n end\n if mandatory?(session[:mask_name],\"Copl\",\"altezza_arbustivo\")\n if record.alt_arbu.nil?\n #registro l'errore\n save_error(record,\"Violazione not null - Altezza Arbustivo\",row)\n #segnalo che c'è stato un errore sulla riga\n session[:row_error] = true\n #e segnalo l'errore sul file\n session[:file_error] = true\n end\n end\n if mandatory?(session[:mask_name],\"Copl\",\"altezza_erbaceo\")\n if record.alt_erb.nil?\n #registro l'errore\n save_error(record,\"Violazione not null - Altezza Erbaceo\",row)\n #segnalo che c'è stato un errore sulla riga\n session[:row_error] = true\n #e segnalo l'errore sul file\n session[:file_error] = true\n end\n end\n end", "def recolectar_una\n\t\test = \"\"\n\t\tif @estado == ESTADO::MUERTE\n\t\t\test = \"El árbol está muerto\"\n\t\telse\n\t\t\tif @contador == 0\n\t\t\t\test = \"No hay más naranjas\"\n\t\t\telse\n\t\t\t\test = \"La naranja estaba deliciosa\"\n\t\t\t\t@contador -= 1\n\t\t\tend\n\t\tend\n\t\test\n\tend", "def control_F(dia,mes,anio)\r\n valdio=false\r\n if ((01..31)===dia.to_i)\r\n if((01..12)===mes.to_i)&&(es_valido(mes,dia)||(mes==\"02\"&&dia==\"29\")&& es_bisiesto(anio.to_i))\r\n if ((1000..9999)===anio.to_i)\r\n valido= true\r\n else\r\n valido= false\r\n end\r\n else\r\n valido= false\r\n end\r\n else\r\n valido= false\r\n end\r\n return valido\r\nend", "def testLigneContient(a,a2)\n\t\t0.upto(a.size-1) do |x|\n\t\t\tif a[x].couleur != a2[x].couleur && a2[x].couleur != Tuile.getCouleurVide \n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\treturn true\n\n\tend", "def goodVsEvil(good, evil)\n good_pwr = [1, 2, 3, 3, 4, 10]\n evil_pwr = [1, 2, 2, 2, 3, 5, 10]\n good = good.split.map(&:to_i)\n evil = evil.split.map(&:to_i)\n\n good = good.map!.with_index { |num, idx| num * good_pwr[idx] }.reduce(:+)\n evil = evil.map!.with_index { |num, idx| num * evil_pwr[idx] }.reduce(:+)\n if good > evil\n 'Battle Result: Good triumphs over Evil'\n elsif evil > good\n 'Battle Result: Evil eradicates all trace of Good'\n elsif evil == good\n 'Battle Result: No victor on this battle field'\n end\nend", "def alternatives_for_invalids\n return [4] if lines[0] == ' ' && lines[1] == '|_|' && lines[2] == ' '\n\n return [4] if lines[0] == ' ' && lines[1] == '|_ ' && lines[2] == ' |'\n\n return [4] if lines[0] == ' ' && lines[1] == '| |' && lines[2] == ' |'\n\n return [4] if lines[0] == ' ' && lines[1] == ' _|' && lines[2] == ' |'\n\n return [4] if lines[0] == ' |' && lines[1] == '|_|' && lines[2] == ' |'\n\n []\n end", "def es_valido(mes,dia)\r\n if(mes==\"01\"||mes==\"03\"||mes==\"05\"||mes==\"07\"||mes==\"08\"||mes==\"10\"||mes==\"12\")\r\n return (1..31)===dia.to_i\r\n else\r\n if(mes==\"04\"||mes==\"06\"||mes==\"09\"||mes==\"11\")\r\n return (1..30)===dia.to_i\r\n else\r\n return (1..28)===dia.to_i\r\n end\r\n end\r\nend", "def mc_cop_aae_alt_aae(row)\n #se copertura:arboreo,arbustivo ed erbaceo == 0, le altezze rispettive devono essere null [Presi singolarmente]\n #a meno che i parametri su cui fare il check siano nulli\n unless row.copertura_arboreo.nil? || row.copertura_arbustivo.nil? || row.copertura_erbaceo.nil?\n if row.copertura_arboreo == 0\n unless row.altezza_arboreo.nil?\n multiple_parameter_error(row,\"Copertura Arboreo = 0, Altezza Arboreo not null\")\n end\n end\n if row.copertura_arbustivo == 0\n unless row.altezza_arbustivo.nil?\n multiple_parameter_error(row,\"Copertura Arbustivo = 0, Altezza Arbustivo not null\")\n end\n end\n if row.copertura_erbaceo == 0\n unless row.altezza_erbaceo.nil?\n multiple_parameter_error(row,\"Copertura Erbaceo = 0, Altezza Erbaceo not null\")\n end\n end\n end\n end", "def check_if_O\n if @game.tab[0].caze == \"[O]\" && @game.tab[1].caze == \"[O]\" && @game.tab[2].caze == \"[O]\"\n puts \"#{@player1.name} a gagné\"\n return play_again\n elsif @game.tab[0].caze == \"[O]\" && @game.tab[3].caze == \"[O]\" && @game.tab[6].caze == \"[O]\"\n puts \"#{@player1.name} a gagné\"\n return play_again\n elsif @game.tab[0].caze == \"[O]\" && @game.tab[4].caze == \"[O]\" && @game.tab[8].caze == \"[O]\"\n puts \"#{@player1.name} a gagné\"\n return play_again\n elsif @game.tab[1].caze == \"[O]\" && @game.tab[4].caze == \"[O]\" && @game.tab[7].caze == \"[O]\"\n puts \"#{@player1.name} a gagné\"\n return play_again\n elsif @game.tab[2].caze == \"[O]\" && @game.tab[5].caze == \"[O]\" && @game.tab[8].caze == \"[O]\"\n puts \"#{@player1.name} a gagné\"\n return play_again\n elsif @game.tab[2].caze == \"[O]\" && @game.tab[4].caze == \"[O]\" && @game.tab[6].caze == \"[O]\"\n puts \"#{@player1.name} a gagné\"\n return play_again\n elsif @game.tab[3].caze == \"[O]\" && @game.tab[4].caze == \"[O]\" && @game.tab[5].caze == \"[O]\"\n puts \"#{@player1.name} a gagné\"\n return play_again\n elsif @game.tab[6].caze == \"[O]\" && @game.tab[7].caze == \"[O]\" && @game.tab[8].caze == \"[O]\"\n puts \"#{@player1.name} a gagné\"\n return play_again\n end\n end", "def jugada(game, player)\n #Ciclo para que se quede realizando la jugada hasta que esta sea valida\n loop do\n jugada_valida = false #Bandera\n turno = game.turn_capture(player) #Se realiza la captura del turno del jugador\n if game.insert_play_on_board(player, turno) #Si la respuesta de que se pudo insertar la jugada en el tablero es positiva se vuelve valida de lo contrario no\n jugada_valida = true\n else\n jugada_valida = false\n end\n break if jugada_valida\n end\n game.print_board() #Imprime el tablero al final de cada jugada\nend", "def play_turn(board,joueur_actuel)\n # cette variable permet de verifier les disponibilité des cases .\n input_ko = true\n # [0] ... [ 8] ça défini les emplacement \n while input_ko\n print \"#{joueur_actuel.joueur_nom}, ton symbol est le '#{joueur_actuel.joueur_symbol}', quelle case souhaites-tu jouer ? \"\n case_to_play = gets.chomp.upcase\n\n case case_to_play\n when \"A1\"\n if board.list_boardcase[0].symbol == '.'\n board.list_boardcase[0].symbol = joueur_actuel.joueur_symbol\n input_ko = false\n else\n puts \"Case déjà occupée. Réessayes avec la bonne case !\"\n end\n when \"A2\"\n if board.list_boardcase[1].symbol == '.'\n board.list_boardcase[1].symbol = joueur_actuel.joueur_symbol\n input_ko = false\n else\n puts \"Case déjà occupée. Réessayes avec la bonne case !\"\n end\n when \"A3\"\n if board.list_boardcase[2].symbol == '.'\n board.list_boardcase[2].symbol = joueur_actuel.joueur_symbol\n input_ko = false\n else\n puts \"Case déjà occupée. Réessayes avec la bonne case !\"\n end\n when \"B1\"\n if board.list_boardcase[3].symbol == '.'\n board.list_boardcase[3].symbol = joueur_actuel.joueur_symbol\n input_ko = false\n else\n puts \"Case déjà occupée. Réessayes avec la bonne case !\"\n end\n when \"B2\"\n if board.list_boardcase[4].symbol == '.'\n board.list_boardcase[4].symbol = joueur_actuel.joueur_symbol\n input_ko = false\n else\n puts \"Case déjà occupée. Réessayes avec la bonne case !\"\n end\n when \"B3\"\n if board.list_boardcase[5].symbol == '.'\n board.list_boardcase[5].symbol = joueur_actuel.joueur_symbol\n input_ko = false\n else\n puts \"Case déjà occupée. Réessayes avec la bonne case !\"\n end\n when \"C1\" \n if board.list_boardcase[6].symbol == '.'\n board.list_boardcase[6].symbol = joueur_actuel.joueur_symbol\n input_ko = false\n else\n puts \"Case déjà occupée. Réessayes avec la bonne case !\"\n end\n when \"C2\"\n if board.list_boardcase[7].symbol == '.'\n board.list_boardcase[7].symbol = joueur_actuel.joueur_symbol\n input_ko = false\n else\n puts \"Case déjà occupée. Réessayes avec la bonne case !\"\n end\n when \"C3\"\n if board.list_boardcase[8].symbol =='.'\n board.list_boardcase[8].symbol = joueur_actuel.joueur_symbol\n input_ko = false\n else\n puts \"Case déjà occupée. Réessayes avec la bonne case !\"\n end\n else \n puts \"erreur de case\"\n end\n end\n\tend", "def badish\n# Post process each bad entry to match against the profesor names in a regular expression fashion\nbad.each do |item|\n # unpack\n id = materias[item][0]\n rfc = materias[item][3]\n p_name = materias[item][4]\n #puts materias[item].inspect if (DEBUG)\n\n #name = []\n profesores.each do |profesor|\n # normalize string and split into words\n name = profesor[1].chomp.upcase.gsub(/\\s+/,' ').gsub(/(M\\.[ICAG]|L\\.A|I\\.Q|ING|FIS|MTRO|MRTO|DRA?)\\.?$/,\"\").split(\" \")\n # match the known name against a regular expression\n if (name.length >= 5)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1]+\" \"+name[2]+\" \"+name[3]+\" \"+name[4])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n if (name.length >= 4)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1]+\" \"+name[2]+\" \"+name[3])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n if (name.length >= 3)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1]+\" \"+name[2])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n if (name.length >= 2)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n end\nend\nend", "def convert_bug_count(count)\n case count\n when (7..40)\n return \"Critical\"\n when (5..6)\n return \"High\"\n when (3..4)\n return \"Medium\"\n when (1..2)\n return \"Low\"\n when 0\n return \"Done\"\n end\nend", "def vialidad_condicion_w\n if self.vialidad_condicion == 'E'\n return 'Excelente'\n elsif self.vialidad_condicion == 'B'\n return 'Bueno'\n elsif self.vialidad_condicion == 'R'\n return 'Regular'\n elsif self.vialidad_condicion == 'M'\n return 'Malo'\n end\n end", "def assign_grade2 num\n case num\n when 90...100\n \"A\"\n when 80..89\n \"B\"\n when 70..79\n \"C\"\n when 60..69\n \"D\"\n when 0..60\n \"FAILED\"\n end\n if num < 0\n \"You reeeaaaallly failed\"\n elsif num > 100\n \"You are a super nerd. Good work.\"\n end\nend", "def reduziere_lebendige_transitionen(lebendig)\n # Prüfe alle Transitionen\n lebendig.transitionen.each do |t|\n # Überspringe t, sofern Übergänge zu t laufen\n next if lebendig.fluss.values.join(', ').include?(t)\n\n # t kommt im Vorbereich mindestens einer Stelle vor\n next unless lebendig.fluss.key?(t)\n\n # Da wir vorher alle Transitionen übersprungen haben, die keinen leeren Vorbereich haben,\n # sind ab hier alle Transitionen lebendig.\n\n # Entferne jede Stelle im Nachbereich von t, mitsamt Übergängen\n lebendig.fluss[t].each do |s|\n lebendig.reduziere_knoten(s)\n end\n\n # Entferne die lebendige Transition t\n lebendig.reduziere_knoten(t)\n\n # Fürs Protokoll\n puts(\"Lebendige Transitionen reduziert!\")\n end\nend", "def rcc_tabla\n\t\tx = self.relacion_cc\n\n\t\t\tif sexo == 1\n\t\t\t\t\tif x >= 0.83 && x < 0.88\n\t\t\t\t\t\treturn \"Bajo -- 0.83 < #{x} < 0.88\"\n\t\t\t\t\telsif x >= 0.88 && x < 0.95\n\t\t\t\t\t\treturn \"Moderado -- 0.88 < #{x} < 0.95\"\n\t\t\t\t\telsif x >= 0.95 && x < 1.01\n\t\t\t\t\t\treturn \"Alto -- 0.95 < #{x} < 1.01\"\n\t\t\t\t\telsif x >= 1.01\n\t\t\t\t\t\treturn \"Muy alto -- #{x} > 1.01\"\n\t\t\t\t\tend\n\t\t\tend\n\n\t\t\tif sexo == 0\n\t\t\t\t\t\tif x >= 0.72 && x < 0.75\n\t\t\t\t\t\t\treturn \"Bajo -- 0.72 < #{x} < 0.75\"\n\t\t\t\t\t\telsif x >= 0.75 && x < 0.82\n\t\t\t\t\t\t\treturn \"Moderado -- 0.75 < #{x} < 0.82\"\n\t\t\t\t\t\telsif x >= 0.82\n\t\t\t\t\t\t\treturn \"Alto -- #{x} > 0.82\"\n\t\t\t\t\t\tend\n\t\t\tend\n\tend", "def test_vestige_lines_unknown\r\n # vestiges of an unspecified number of lines, mere smudges, visible\r\n assert_equal_fragment_transform 'vestig.?lin', '<gap reason=\"illegible\" extent=\"unknown\" unit=\"line\"/>'\r\n end", "def check_verbale(allegato)\n sheet = Roo::Excelx.new(allegato).sheet(0)\n unless $data.between? (sheet.row(9)[1]),(sheet.row(10)[1])\n @errore << \"Il giorno selezionato non rietra tra le date presenti nel verbale #{Pathname.new(allegato).basename}\"\n end\n File.delete(allegato) if File.exist?(allegato)\n end", "def check_if_X\n if @game.tab[0].caze == \"[X]\" && @game.tab[1].caze == \"[X]\" && @game.tab[2].caze == \"[X]\"\n puts \"#{@player2.name} a gagné\"\n return play_again\n elsif @game.tab[0].caze == \"[X]\" && @game.tab[3].caze == \"[X]\" && @game.tab[6].caze == \"[X]\"\n puts \"#{@player2.name} a gagné\"\n return play_again\n elsif @game.tab[0].caze == \"[X]\" && @game.tab[4].caze == \"[X]\" && @game.tab[8].caze == \"[X]\"\n puts \"#{@player2.name} a gagné\"\n return play_again\n elsif @game.tab[1].caze == \"[X]\" && @game.tab[4].caze == \"[X]\" && @game.tab[7].caze == \"[X]\"\n puts \"#{@player2.name} a gagné\"\n return play_again\n elsif @game.tab[2].caze == \"[X]\" && @game.tab[5].caze == \"[X]\" && @game.tab[8].caze == \"[X]\"\n puts \"#{@player2.name} a gagné\"\n return play_again\n elsif @game.tab[2].caze == \"[X]\" && @game.tab[4].caze == \"[X]\" && @game.tab[6].caze == \"[X]\"\n puts \"#{@player2.name} a gagné\"\n return play_again\n elsif @game.tab[3].caze == \"[X]\" && @game.tab[4].caze == \"[X]\" && @game.tab[5].caze == \"[X]\"\n puts \"#{@player2.name} a gagné\"\n return play_again\n elsif @game.tab[6].caze == \"[X]\" && @game.tab[7].caze == \"[X]\" && @game.tab[8].caze == \"[X]\"\n puts \"#{@player2.name} a gagné\"\n return play_again\n end\n end", "def failed_attemps\n\t\tselected_letters.select {|letter| !word.include?(letter)}.size\n\tend", "def to_s\n puts \"BadConsequence:\"\n puts \" Descripcion: #{@text}.\"\n if(@levels != nil)\n puts \" Niveles: #{@levels}.\"\n end\n \n if(@nVisibleTreasures != nil)\n puts \" Tesoros visibles: #{@nVisibleTreasures}\"\n puts \" Tesoros ocultos: #{@nHiddenTreasures}\"\n end\n \n if(@specificHiddenTreasures != nil)\n puts \" Tesoros visibles especificos: #{@specificVisibleTreasures}\"\n puts \" Tesoros ocultos especificos: #{@specificHiddenTreasures}\"\n end\n \n if(@death)\n puts \" Este monstruo te mata.\"\n end\n end", "def cases()\n \n end", "def apply_warnings\n apply_problems_get(data).select do |problem|\n (sTring(problem.Severity) =~ %r{(Критичная|Critical)}).nil?\n end\n end", "def assess_situation(danger_level)\n save_the_day = \"Another BORING day for the TODD MAN!\"\n bad_excuse = \"Well that looks far too exciting for me.\"\n if danger_level >= 50\n puts bad_excuse\n elsif (10..50) === danger_level\n puts save_the_day\n else\n puts \"Meh. Hard pass.\"\n end\n end", "def end_conversion\n # @todo: pour le moment :\n puts \"Fichier converti avec succès\".as_blue\n true\n end", "def turno!\r\n\t\t#CICLO PARA PASAR POR EL ARREGLO HASTA ENCONTRAR LAS CELDAS VIVAS O LAS CELULAS MUERTAS QUE CUMPLEN CON LA REGLA 4\r\n\t\tfor f in 0..@y1-1\r\n\t\t\tfor c in 0..@x1-1\r\n\r\n\t\t\t\tif @matriz[f][c] == true\r\n\t\t\t\t\tVecinos(@matriz,f,c) #checo cuantos vecinos tengo alrededor\r\n\t\t\t\t\tReglas(@matriz,@matrizTMP,@cuantos,f,c)#verifico si cumple alguna regla de conway\r\n\r\n\t\t\t\t\t\t\r\n\t\t\t\telse # de lo contrario la celda esta en false y debo comprobar la regla 4\r\n\t\t\t\t\t\r\n\t\t\t\t\tVecinos(@matriz,f,c) #regreso cuantos vecinos tiene vivos\r\n\t\t\t\t\t#REGLA 4. Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.\r\n\t\t\t\t\tif @cuantos == 3\r\n\t\t\t\t\t\t@matrizTMP[f][c] = true\r\n\t\t\t\t\tend\r\n\t\t\t\tend #cierra if\r\n\t\t\tend #cierra ciclo for\r\n\t\tend #cierra ciclo for \r\n\r\n\t\t#ACTUALIZO LA MATRIZ CON LA TEMPORAL QUE ES COMO DEBE QUEDAR AHORA EL JUEGO\r\n\t\tfor f in 0..@y1-1\r\n\t\t\tfor c in 0..@x1-1\r\n\t\t \t\t@matriz[f][c]=@matrizTMP[f][c]\r\n\t\t\tend\r\n\t\tend\r\n\r\n\tend", "def error_message(flag, value, valid)\n classes = valid.compact.map do\n s = _1.to_s\n s = s.downcase if s =~ /\\b(Array|Float|Hash|Integer|String|Symbol)\\b/\n s\n end.join('/')\n \"expected :#{flag} to be #{classes}, not #{value.inspect}\"\n end", "def ptit_fraze_hala_kon(a)\n\t\tcase a\n\t\twhen 1\n\t\t\tputs \"tricheur\".colorize(:red) \n\t\twhen 2\n\t\t\tputs \"tu t'es trompé\".colorize(:red) \n\t\tend\n\tend", "def grilleSuivante()\n @grilleRaz = nil\n return nil\n end", "def irregular(singular, plural)\n @uncountables.delete(singular)\n @uncountables.delete(plural)\n if singular[0,1].upcase == plural[0,1].upcase\n plural(Regexp.new(\"(#{singular[0,1]})#{singular[1..-1]}$\", \"i\"), '\\1' + plural[1..-1])\n plural(Regexp.new(\"(#{plural[0,1]})#{plural[1..-1]}$\", \"i\"), '\\1' + plural[1..-1])\n singular(Regexp.new(\"(#{plural[0,1]})#{plural[1..-1]}$\", \"i\"), '\\1' + singular[1..-1])\n else\n plural(Regexp.new(\"#{singular[0,1].upcase}(?i)#{singular[1..-1]}$\"), plural[0,1].upcase + plural[1..-1])\n plural(Regexp.new(\"#{singular[0,1].downcase}(?i)#{singular[1..-1]}$\"), plural[0,1].downcase + plural[1..-1])\n plural(Regexp.new(\"#{plural[0,1].upcase}(?i)#{plural[1..-1]}$\"), plural[0,1].upcase + plural[1..-1])\n plural(Regexp.new(\"#{plural[0,1].downcase}(?i)#{plural[1..-1]}$\"), plural[0,1].downcase + plural[1..-1])\n singular(Regexp.new(\"#{plural[0,1].upcase}(?i)#{plural[1..-1]}$\"), singular[0,1].upcase + singular[1..-1])\n singular(Regexp.new(\"#{plural[0,1].downcase}(?i)#{plural[1..-1]}$\"), singular[0,1].downcase + singular[1..-1])\n end\n end", "def irregular(singular, plural)\n @uncountables.delete(singular)\n @uncountables.delete(plural)\n if singular[0,1].upcase == plural[0,1].upcase\n plural(Regexp.new(\"(#{singular[0,1]})#{singular[1..-1]}$\", \"i\"), '\\1' + plural[1..-1])\n plural(Regexp.new(\"(#{plural[0,1]})#{plural[1..-1]}$\", \"i\"), '\\1' + plural[1..-1])\n singular(Regexp.new(\"(#{plural[0,1]})#{plural[1..-1]}$\", \"i\"), '\\1' + singular[1..-1])\n else\n plural(Regexp.new(\"#{singular[0,1].upcase}(?i)#{singular[1..-1]}$\"), plural[0,1].upcase + plural[1..-1])\n plural(Regexp.new(\"#{singular[0,1].downcase}(?i)#{singular[1..-1]}$\"), plural[0,1].downcase + plural[1..-1])\n plural(Regexp.new(\"#{plural[0,1].upcase}(?i)#{plural[1..-1]}$\"), plural[0,1].upcase + plural[1..-1])\n plural(Regexp.new(\"#{plural[0,1].downcase}(?i)#{plural[1..-1]}$\"), plural[0,1].downcase + plural[1..-1])\n singular(Regexp.new(\"#{plural[0,1].upcase}(?i)#{plural[1..-1]}$\"), singular[0,1].upcase + singular[1..-1])\n singular(Regexp.new(\"#{plural[0,1].downcase}(?i)#{plural[1..-1]}$\"), singular[0,1].downcase + singular[1..-1])\n end\n end", "def validar(orden_abono_excedente_arrime, fecha_registro_cheque, numero_cheque)\n logger.debug \"ENTRE A LA VALIDACION EN MI MODELOS ---- \" << orden_abono_excedente_arrime.inspect.to_s\n logger.debug \"ENTRE A LA VALIDACION EN MI MODELOS ---- \" << orden_abono_excedente_arrime_id.inspect.to_s\n \n logger.debug \"Parametros ---- \" << fecha_registro_cheque.to_s << \" - \" << numero_cheque.to_s\n \n msj = \"\"\n\n orden_abono_excedente_arrime = OrdenAbonoExcedenteArrime.find(orden_abono_excedente_arrime_id)\n solicitud = Solicitud.find(orden_abono_excedente_arrime.solicitud_id)\n\n logger.debug \"cheque ---- \" << numero_cheque.to_s\n logger.debug \"fecha ---- \" << fecha_registro_cheque.to_s\n if numero_cheque.to_s==''\n msj << I18n.t('Sistema.Body.Modelos.ViewExcedenteArrime.Errores.numero_cheque_obligatorio',:numero=>solicitud.numero) \n end\n\n if fecha_registro_cheque.to_s==''\n msj << I18n.t('Sistema.Body.Modelos.ViewExcedenteArrime.Errores.fecha_registro_invalida',:numero=>solicitud.numero)\n end\n\n if msj.length > 0\n return msj\n else\n return ''\n end\n end", "def valida_titulo\n errors.add_to_base 'avisotitulo' if tituloes.blank? and titulofr.blank? \nend", "def check_scheduling_bilateral(file_sch_bil)\n s = Roo::Excel.new(file_sch_bil.to_s)\n sheet = s.sheet(\"EPEX\")\n tabella_controlli = sheet.to_matrix(34, 2, 36, 4).to_a\n tabella_controlli.each do |row|\n if row[2] != \"OK\"\n @errore << \"Nel file #{file_sch_bil.to_s} il \\\"#{row[0]}\\\" non è OK\"\n end\n end\n sheet = s.sheet(\"Extern IT\")\n if sheet.cell(\"C\",2) != \"#{$day}/#{$month}/#{$year}\"\n @errore << \"Data presente nel file #{file_sch_bil.to_s} non corrisponde con la data selezionata\"\n end\n end", "def bad2 deck\n print \"\\t#{1}) %-39s \" % deck[5][4, 20]\n print \"\\t#{2}) %-39s \" % deck[50][4, 20]\n print \"\\t#{3}) %-39s \" % deck[59][4, 20]\n puts 'same color - dif number - same shade'\n puts 'BUT 1 and 3 are both squares, while 2 is triangle.'\n puts 'NOT A SET!!'\n puts\nend", "def assess_situation(danger_level, save_the_day, bad_excuse)\n if danger_level > 50\n p \"#{bad_excuse}\"\n \n elsif danger_level < 50 || danger_level > 10\n p \"#{save_the_day}\"\n \n elsif danger_level < 10\n p \"Meh. Hard pass.\"\n end\nend", "def changerEnSuivant #-1=>1=>0>-1\n\t\t@couleur=@couleur%3-1\n\tend", "def test_reject\n assert_equal(%w[1 2 4 7 8 11 13 14],\n @ab.reject { |res| res.include?('Assign') || res.include?('Buzz') })\n end", "def validate_impossible_changes\n if @slide\n errors.add(:lesson_id, :cant_be_changed) if @slide.lesson_id != self.lesson_id\n errors.add(:kind, :cant_be_changed) if @slide.kind != self.kind\n errors.add(:title, :in_cover_it_cant_be_different_by_lessons_title) if @lesson && self.cover? && @slide.title != self.title && @lesson.title != self.title\n end\n end", "def errors\n @user_guesses - normalized_letters\n end", "def show_board_rules_reminder\n puts \"il suffit juste de choisir une case vide entre 1 et 9 !\"\n cell_number = 1\n for i in 0..2 do\n puts \"-------------\"\n for j in 0..2 do\n print \"| #{cell_number} \"\n cell_number += 1\n end\n puts \"|\"\n end\n puts \"-------------\"\n end", "def nivel_no_final\r\n #collect llama al bloque una vez por cada elemento del mismo y crea un nuevo arreglo que contiene los valores retornados\r\n #nivels = movimiento.collect{ |valor_pos| valor_pos.nivel }\r\n \r\n if jugador_actual == 'O'\r\n movimiento.collect{ |valor_pos| valor_pos.nivel }.min\r\n #nivels.max\r\n else\r\n movimiento.collect{ |valor_pos| valor_pos.nivel }.max\r\n end\r\n end", "def painel(ltChutes, numTentativas, numErros, totalAjudas, drawForca = 0)\n\n system \"clear\"\n puts \"\\n\"\n chute = []\n chute = ltChutes\n ajd = []\n ajd = listarAjudas(totalAjudas)\n countAjuda = 1\n\n puts \"Chutes: \".rjust(20) << chute.join(\" - \")\n puts \"Dica: \".rjust(20) << @plvDica\n puts \"\\n\"\n\n ajd.each do |aj|\n if countAjuda == 0\n puts \"Ajudas: \".rjust(20)\n elsif countAjuda == 1\n puts \"Ajudas: \".rjust(20) << \"#{countAjuda} - \" << aj\n countAjuda += 1\n else\n puts \" \".rjust(20) << \"#{countAjuda} - \" << aj\n countAjuda += 1\n end\n end\n\n puts \"\\n\"\n puts \"Tentativas: \".rjust(20) << numTentativas.to_s\n puts \"Erros: \".rjust(20) << numErros.to_s\n puts \"\\n\\n\"\n\n if drawForca == 0\n forcaVazia\n elsif drawForca == 1\n cabeca\n elsif drawForca == 2\n tronco1\n elsif drawForca == 3\n tronco2\n elsif drawForca == 4\n braco1\n elsif drawForca == 5\n braco2\n elsif drawForca == 6\n perna1\n elsif drawForca == 7\n enforcado\n end\n end", "def evaluacion jugador1,jugador2\n if jugador1 == jugador2\n \"Resultado del Juego: EMPATE\"\n elsif jugador1 == 1\n if jugador2 == 2\n \"Resultado del Juego: Ganador Jugador 2\"\n else\n \"Resultado del Juego: Ganador Jugador 1\"\n end\n elsif jugador1 == 2\n if jugador2 == 1\n \"Resultado del Juego: Ganador Jugador 1\"\n else\n \"Resultado del Juego: Ganador Jugador 2\"\n end\n else\n if jugador2 == 1\n \"Resultado del Juego: Ganador Jugador 2\"\n else\n \"Resultado del Juego: Ganador Jugador 1\"\n end\n end\nend", "def goodVsEvil(good, evil)\n goodStats = {\n :hobbits => 1,\n :men => 3,\n :elves => 3,\n :dwarves => 3,\n :eagles => 4,\n :wizards => 10\n }\n evilStats = {\n :orcs => 1,\n :men => 2,\n :wargs => 2,\n :goblins => 2,\n :urukHai => 3,\n :trolls => 5,\n :wizards => 10\n }\n\n def getScore(side, stats)\n getArr = side.split(' ').each_with_index.map{|e,i| e.to_i * stats.values[i]}\n getArr.reduce{|sum,el| sum+= el}\n end\n\n goodScore = [getScore(good, goodStats), 2147483647].min\n evilScore = [getScore(evil, evilStats), 2147483647].min\n\n if goodScore == evilScore\n return \"Battle Result: No victor on this battle field\"\n elsif goodScore > evilScore\n return \"Battle Result: Good triumphs over Evil\"\n elsif evilScore > goodScore\n return \"Battle Result: Evil eradicates all trace of Good\"\n end\nend", "def check_file\n @files.each do |file|\n case \n when file.fnmatch(\"*Verbale autorizzativo*\") then check_verbale(estrai_allegato(file))\n when file.fnmatch(\"*Prezzi_Offerte*\") then check_controllo_offerte(file)\n when file.fnmatch(\"*Validate_Eni*\") then check_offerte(file)\n when file.fnmatch(\"*Esitate_Eni*\") then check_offerte(file)\n when file.fnmatch(\"*ProgrFisica*\") then check_offerte_pce(file)\n when file.fnmatch(\"*Scheduling & Bilateral Program*\") then check_scheduling_bilateral(file)\n when file.fnmatch(\"*tool autorizzazione offerte belpex*\") then check_tool_belgio(file)\n when file.fnmatch(\"*Export E-prog46_ita.xls\") then check_tool_olanda(file) \n when file.fnmatch(\"*Validate_*_*.docx\") then check_validate_epex(file) \n when file.fnmatch(\"*Esitate_Francia_*.csv\") then check_esitate_epex(file)\n when file.fnmatch(\"*Esitate_Germania_*.csv\") then check_esitate_epex(file) \n when file.fnmatch(\"*Esitate_Svizzera_*.csv\") then check_esitate_epex(file) \n else\n\n end\n end\n end", "def mag_input_case(number)\n result = case\n when number<=50\n 'Number still less than 50.'\n when number >50 && number<=100\n 'Number still between 50 and 100.'\n when number > 100\n \"You're still breaking the rules.\"\n end\n\n return result\nend", "def acierto_parcial(fecha_ing,fecha_control)\r\n di,mi,ai=descomponer_fechas(fecha_ing)\r\n dc,mc,ac=descomponer_fechas(fecha_control)\r\n if(di==dc)\r\n puts \"Acertaste el dia\"\r\n else\r\n if(di>dc)\r\n puts \"Dia ingresado mayor que el dia de control\"\r\n else\r\n puts \"Dia ingresado menor que el dia de control\"\r\n end\r\n end\r\n if (mi==mc)\r\n puts \"Acertaste el mes\"\r\n else\r\n if(mi>mc)\r\n puts\"Mes ingresado mayor que el mes de control\"\r\n else\r\n puts \"Mes ingresado menor que el mes de control\"\r\n end\r\n end\r\n if(ai==ac)\r\n puts \"Acertaste el anio\"\r\n else\r\n if(ai>ac)\r\n puts \"Anio ingresado mayor que el anio de control\"\r\n else\r\n puts \"Anio ingresado menor que el anio de control\"\r\n end\r\n end\r\nend", "def puede_capturar?(columna, fila)\n !@tablero[columna][fila].nil? and @tablero[columna][fila].color != @color and\n _puede_capturar?(columna, fila) and !jaque?(columna, fila)\n end", "def conta_vicini(i,j,game)\n vicini = 0\n \n #### BORDI RIGIDI\n #if i > 0\n # vicini += 1 if game[:griglia][i-1][j]\n #end\n #if i > 0 && j > 0\n # vicini += 1 if game[:griglia][i-1][j-1]\n #end\n #if i > 0 && j < CELLE_PER_RIGA\n # vicini += 1 if game[:griglia][i-1][j+1]\n #end\n #if j > 0\n # vicini += 1 if game[:griglia][i][j-1]\n #end\n #if j < CELLE_PER_RIGA-1\n # vicini += 1 if game[:griglia][i][j+1]\n #end\n #if i < CELLE_PER_COLONNA-1 && j > 0\n # vicini += 1 if game[:griglia][i+1][j-1]\n #end\n #if i < CELLE_PER_COLONNA-1\n # vicini += 1 if game[:griglia][i+1][j]\n #end\n #if i < CELLE_PER_COLONNA-1 && j < CELLE_PER_RIGA-1\n # vicini += 1 if game[:griglia][i+1][j+1]\n #end\n \n #======================================================\n ### BORDI RICORSIVI\n i += CELLE_PER_COLONNA if i-1 < 0\n j += CELLE_PER_RIGA if j-1 < 0\n i -= CELLE_PER_COLONNA if i+1 >= CELLE_PER_COLONNA\n j -= CELLE_PER_RIGA if j+1 >= CELLE_PER_RIGA\n \n vicini += 1 if game[:griglia][i-1][j]\n vicini += 1 if game[:griglia][i-1][j-1]\n vicini += 1 if game[:griglia][i-1][j+1]\n vicini += 1 if game[:griglia][i][j-1]\n vicini += 1 if game[:griglia][i][j+1]\n vicini += 1 if game[:griglia][i+1][j-1]\n vicini += 1 if game[:griglia][i+1][j]\n vicini += 1 if game[:griglia][i+1][j+1]\n \n return vicini\nend", "def proba(i)\n dé_actuel=rand(1..6)\n #i=0\n #new_var=i\n\nif (dé_actuel == 5) || (dé_actuel == 6)\n i+=1\n puts \"Le dé est tombé sur 5 ou 6, j'avance d'une case.\"\n puts \"Ma case actuelle est #{i}\"\n puts lancement(i)\nelsif dé_actuel == 1\n if i == 0\n puts \"Je reste à 0!\"\n puts \"Ma case actuelle est #{i}\"\n puts lancement(i)\n else\n i-=1\n puts \"Le dé est tombé sur 1, je recule d'une case.\"\n puts \"Ma case actuelle est #{i}\"\n puts lancement(i)\n end\nelse #(dé_actuel == 2) || (dé_actuel == 3) || (dé_actuel == 4)\n puts \"Le dé est tombé sur 2,3 ou 4, je ne bouge pas!\"\n puts \"Ma case actuelle est #{i}\"\n puts lancement(i)\n\nend\nend", "def testcase2(num)\n case num\n when 0..50\n puts \"#{num} is between 0 and 50\"\n when 51..100\n puts \"#{num} is between 51 and 100\"\n else\n if num < 0\n puts \"you can't enter a negative number!\"\n else\n puts \"#{num} is above 100\"\n end\n end\nend", "def bad1 deck\n print \"\\t#{1}) %-39s \" % deck[34][4, 20]\n print \"\\t#{2}) %-39s \" % deck[46][4, 20]\n print \"\\t#{3}) %-39s \" % deck[43][4, 20]\n puts 'same color - same number - dif shape'\n puts 'BUT 1 and 3 are both solid, while 2 is striped.'\n puts 'NOT A SET!!'\n puts\nend", "def bilan\n raise \"Il faut lancer l'étude avec Etude::start avant de construire le bilan\" if @data.nil?\n @bilan ||= begin\n c = []\n # Largeur : 26 (sans les \"|\")\n titre = \"Exercices #{from_exercice} à #{to_exercice}\"\n gauche = ((26 - titre.length).to_f / 2).floor - 1\n droite = \" \" * (26 - (gauche + titre.length))\n gauche = \" \" * gauche\n entete = <<-TXT\n----------------------------\n|#{gauche}#{titre}#{droite}|\n----------------------------\n| Doigté | Nombre de fois |\n TXT\n c << entete.strip\n titre_section = <<-TXT\n----------------------------\n| Par quantité |\n----------------------------\n TXT\n c << titre_section.strip\n nombre_max = nil\n nombre_min = nil\n nb_courant = nil\n @data.sort_by{|c, e| e[:nombre]}.reverse.each do |combi, data_combi|\n nb_courant = data_combi[:nombre]\n nombre_max = nb_courant if nombre_max.nil?\n nb = (\" \" * 5) << nb_courant.to_s # 16\n nb << \" \" * (16 - nb.length) \n c << \"| #{combi} | #{nb}|\"\n end\n nombre_min = nb_courant\n \n titre_section = <<-TXT\n----------------------------\n| Par premier doigt |\n----------------------------\n TXT\n c << titre_section.strip\n @data.sort_by{|combi, e| combi[0..0]}.each do |combi, data_combi|\n nb = data_combi[:nombre]\n nb = \"#{nb} (max)\" if nb == nombre_max\n nb = \"#{nb} (min)\" if nb == nombre_min\n nb = (\" \" * 5) << nb.to_s\n nb << \" \" * (16 - nb.length) \n c << \"| #{combi} | #{nb}|\"\n end\n \n titre_section = <<-TXT\n----------------------------\n| Par second doigt |\n----------------------------\n TXT\n c << titre_section.strip\n @data.sort_by{|combi, e| combi[2..2]}.each do |combi, data_combi|\n nb = data_combi[:nombre]\n nb = \"#{nb} (max)\" if nb == nombre_max\n nb = \"#{nb} (min)\" if nb == nombre_min\n nb = (\" \" * 5) << nb.to_s # 16\n nb << \" \" * (16 - nb.length) \n c << \"| #{combi} | #{nb}|\"\n end\n c << \"-\" * 28\n c << \"\\n\"\n c.join(\"\\n\")\n end\n end", "def changerEnVide\n\t\t@couleur=-1\n\tend", "def combien_handle_contient_une_majuscule(journaliste)\n \tcount = 0\n \tjournaliste.each do |majuscule|\n \t\tif majuscule.match(/[A-Z]/)\n \t\tcount +=1\n end\nend\n \tputs \"Reponse : \"\n \tputs \"Il y en a #{count}\"\n \tputs \" \"\nend", "def bad_results\n select {|r| !r.success }\n end", "def hiddenSingle()\n\t\tlisteCase = Array.new\n\t\t@partie.getPlateau().each do |x,y,laCase|\n\t\t\tif (laCase.getSolutionJoueur() == nil)\n\t\t\t\t\n\t\t\t\tif x%3 == 2\n\t\t\t\t\tlig1 = x-1\n\t\t\t\t\tlig2 = x-2\n\t\t\t\telsif x%3 == 1\n\t\t\t\t\tlig1 = x-1\n\t\t\t\t\tlig2 = x+1\n\t\t\t\telse\n\t\t\t\t\tlig1 = x+1\n\t\t\t\t\tlig2 = x+2\n\t\t\t\tend\n\n\t\t\t\tif y%3 == 2\n\t\t\t\t\tcol1 = y-1\n\t\t\t\t\tcol2 = y-2\n\t\t\t\telsif y%3 == 1\n\t\t\t\t\tcol1 = y-1\n\t\t\t\t\tcol2 = y+1\n\t\t\t\telse\n\t\t\t\t\tcol1 = y+1\n\t\t\t\t\tcol2 = y+2\n\t\t\t\tend\n\n\t\t\t\tfor n in (1..9)\n\n\t\t\t\t\tif (@partie.getPlateau.absentRegion(n,x,y) && !@partie.getPlateau().absentLigne(n, lig1) && !@partie.getPlateau().absentLigne(n, lig2) && !@partie.getPlateau().absentColonne(n, col1) && !@partie.getPlateau().absentColonne(n, col2))\n\t\t\t\t\t\tif n == @partie.getPlateau.getCase(Position.new(x,y)).getSolutionOriginale\n\t\t\t\t\t\t\t# print \"AJOUTER\", x,\"-\",y,\"\\n\"\n\t\t\t\t\t\t\t# print \"\\t\", lig1,\"/\",lig2,\"-\",col1,\"/\",col2,\"\\n\"\n\t\t\t\t\t\t\tlisteCase.push(Position.new(x,y))\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tprint \"Problème !\"\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# print \"\\n\\tlisteCase\", listeCase\n\n\t\tif listeCase.empty?\n\t\t\t#print \"NIL\"\n\t\t\treturn nil \n\t\tend\n\n\t\treturn listeCase\n\tend", "def imc\n\t\tnum = (@peso/(@talla*@talla)).round(2)\n\t\tif num < 18.5\n\t\t\tnum #- Bajo peso\"\n\t\telsif num > 18.5 and num < 24.9\n\t\t\tnum #- Adecuado\"\n\t\telsif num > 25.0 and num < 29.9\n\t\t\tnum #- Sobrepeso\"\n\t\telsif num > 30.0 and num < 34.9\n\t\t\tnum #Obesidad grado 1\"\n\t\telsif num > 35.0 and num < 39.9\n\t\t\tnum #- Obesidad grado 2\"\n\t\telsif num > 40\n\t\t\tnum #- Obesidad grado 2\"\n\t\tend\t\t\t\n\tend", "def unit_other_category(u)\n # comment is actual code returned by the df function\n return :Berserk if u.mood == :Berserk # 5\n return :Berserk if unit_testflagcurse(u, :CRAZED) # 14\n return :Undead if unit_testflagcurse(u, :OPPOSED_TO_LIFE) # 1\n return :Undead if u.flags3.ghostly # 15\n\n if df.gamemode == :ADVENTURE\n return :Hostile if u.civ_id == -1 # 2\n if u.animal.population.region_x == -1\n return :Wild if u.flags2.roaming_wilderness_population_source_not_a_map_feature # 0\n else\n return :Hostile if u.flags2.important_historical_figure and n = unit_nemesis(u) and n.flags[:ACTIVE_ADVENTURER] # 2\n end\n return :Hostile if u.flags2.resident # 3\n return :Hostile # 4\n end\n\n return :Invader if u.flags1.active_invader or u.flags1.invader_origin # 6\n return :Friendly if u.flags1.forest or u.flags1.merchant or u.flags1.diplomat # 8\n return :Hostile if u.flags1.tame # 7\n\n if u.civ_id != -1\n return :Unsure if u.civ_id != df.ui.civ_id or u.flags1.resident or u.flags1.visitor or u.flags1.visitor_uninvited # 10\n return :Hostile # 7\n\n elsif u.animal.population.region_x == -1\n return :Friendly if u.flags2.visitor # 8\n return :Uninvited if u.flags2.visitor_uninvited # 12\n return :Underworld if r = u.race_tg and r.underground_layer_min == 5 # 9\n return :Resident if u.flags2.resident # 13\n return :Friendly # 8\n\n else\n return :Friendly if u.flags2.visitor # 8\n return :Underworld if r = u.race_tg and r.underground_layer_min == 5 # 9\n return :Wild if u.animal.population.feature_idx == -1 and u.animal.population.cave_id == -1 # 0\n return :Wild # 11\n end\n end", "def to_s()\n s = \"\"\n ajout = false\n 0.upto(@longueur - 1) do |i|\n 0.upto(@largeur - 1) do |j|\n @sommets.each do |x|\n if(x.position.x == i && x.position.y == j)\n s += x.valeur.to_s()\n ajout = true\n end\n end\n @aretes.each do |x|\n #p x.getListeCase()\n x.getListeCase().each do |y|\n if(y.x == i && y.y == j)\n s += \"|\"\n ajout = true\n end\n end\n end\n if(ajout == false)\n s += \"X\"\n end\n ajout = false\n end\n s += \"\\n\"\n end\n return s + \"\\n\"\n end", "def description\n case @wrong_guesses\n when 1\n puts \"The head has been drawn.\"\n when 2\n puts \"The head and body have been drawn.\"\n when 3\n puts \"The head, body, and one arm have been drawn.\"\n when 4\n puts \"The head, body, and arms have been drawn.\"\n when 5\n puts \"The head, body, arms, and one leg have been drawn.\"\n when 6\n puts \"The head, body, arms, and legs have been drawn.\"\n when 7\n puts \"The head, body, arms, legs, and one eye have been drawn.\"\n puts \"One more wrong move, and he's dead!\"\n when 8\n puts \"The head, body, arms, legs, and eyes have been drawn.\"\n puts \"The hangman's dead, and you've lost!\"\n end\n puts \"\\n\"\n end", "def check_if_giocata_is_terminated\r\n #p \"check_if_giocata_is_terminated\"\r\n # usando max(metodo di enumerable) per un hash, ogni valore e' un array\r\n # dove il primo valore e' la chiave il secondo il valore (ex: [\"toro\", 40]).\r\n # max fornisce un solo array, ma questo non e' un problema\r\n nome_gioc_max, punti_attuali_max = @points_curr_segno.max{|a,b| a[1]<=>b[1]}\r\n # il pareggio non e' possibile in quanto il gioco finisce subito dopo che\r\n # un giocatore raggiunge i 41 punti\r\n str_points = \"\"\r\n @points_curr_segno.each do |k,v|\r\n str_points += \"#{k} = #{v} \"\r\n end\r\n @log.info \"Punteggio attuale: #{str_points}, max #{punti_attuali_max}, target #{@game_opt[:target_points_segno]}\" \r\n #p @game_opt[:target_points_segno]\r\n #p punti_attuali_max\r\n if punti_attuali_max >= @game_opt[:target_points_segno]\r\n return true\r\n end\r\n return false\r\n end", "def imc_tabla\n\t\tx = self.indice_masa_corporal\n\n\n\t\tif x < 18.5\n\t\t\treturn \"#{x} < 18.5 -- Bajo peso -- Delgado\"\n\t\telsif x >= 18.5 && x <= 24.9\n\t\t\treturn \"18.5 < #{x} < 24.9 -- Adecuado -- Aceptable\"\n\t\telsif x > 24.9 && x <= 29.9\n\t\t\treturn \"25.0 < #{x} < 29.9 -- Sobrepeso -- Sobrepeso\"\n\t\telsif x > 29.9 && x <= 39.9\n\t\t\treturn \"30.0 < #{x} < 39.9 -- Obesidad grado 1 -- Obesidad\"\n\t\telsif x > 39.9\n\t\t\treturn \" #{x} > 40 -- Obesidad grado 2 -- Obesidad\"\n\t\tend\n\n\tend", "def already_a_char(board_case, case_to_check)\n if board_case[case_to_check] != \" \"\n puts \"la case est déjà prise, bien essayer !\"\n return false\n else\n return true\n end\n end", "def resta_demas\n if emp_cuentab.saldo_actual < total and tipo_movimiento == 'egreso'\n errors.add(:emp_cuentab, 'Saldo insuficiente')\n end\n end", "def puede_enrocar?(columna, fila)\n @tablero[columna][fila].color == @color and !se_movio? and camino_horizontal_libre?(columna)\n end", "def palabras_sin_o( cadenas )\n\tcadenas.reject { |palabra| palabra.include?(\"o\") }\nend", "def determine_grade\n\n\tConsole_Screen.cls #clear the display area\n\n\t#to pass the test the player must corretly retype 3 sentences\n\n\tcase \n\n\twhen ($noRight == 10 || $noRight == 9)\n\t\tputs \"Congrats you received an A!\"\n\twhen ($noRight == 8)\n\t\tputs \"You got a B!\"\n\twhen ($noRight == 7)\n\t\tputs (\"Okay, you got a C! Not bad!\")\n\twhen ($noRight == 6)\n\t\tputs (\"You got a D, try harder!\")\n\twhen ($noRight <= 5)\n\t\tputs (\"You got an F bud.\")\n\t\t\n\t\n\n\tend\n\nend" ]
[ "0.7001326", "0.61590487", "0.5765501", "0.5721783", "0.56755805", "0.55608517", "0.54557705", "0.54555565", "0.5453489", "0.544602", "0.53431416", "0.5324971", "0.53057474", "0.52836895", "0.527121", "0.52535266", "0.5220627", "0.51910824", "0.51883185", "0.51841956", "0.5174484", "0.5165141", "0.51624185", "0.51265156", "0.5105091", "0.5082785", "0.5067394", "0.5054427", "0.503548", "0.49946436", "0.4994321", "0.49915713", "0.49834087", "0.4977795", "0.49774602", "0.49549776", "0.49440816", "0.49423555", "0.49408934", "0.4938204", "0.49321368", "0.4926971", "0.49169132", "0.49165085", "0.4910401", "0.49042705", "0.4900373", "0.48993495", "0.4898233", "0.4898055", "0.4891389", "0.4886551", "0.48814547", "0.48717207", "0.48647055", "0.4861843", "0.48468408", "0.48445863", "0.48277912", "0.48216185", "0.4818181", "0.4818181", "0.48112082", "0.47992146", "0.47902495", "0.47883663", "0.47843587", "0.4782644", "0.47820053", "0.47814465", "0.47785616", "0.47682855", "0.47635314", "0.47584915", "0.47557533", "0.47533005", "0.4750154", "0.4748707", "0.47447592", "0.47438446", "0.47310418", "0.47247803", "0.47212824", "0.47207913", "0.47174612", "0.47086683", "0.4707862", "0.47065005", "0.4705785", "0.47032934", "0.47009873", "0.47005668", "0.4692471", "0.4690995", "0.46875888", "0.46867454", "0.4685068", "0.46769622", "0.4674358", "0.46728963" ]
0.74725395
0
renvoie la premiere case qui n'est pas a cote d'un arbre, il s'agit donc de gazon
def casePasACoteArbre newStatutVide = StatutVide.new(VIDE) newStatutArbre = StatutArbre.new(ARBRE) grille=@grille.grille for i in 0..grille.length-1 for j in 0..grille.length-1 ok = true if (grille[i][j].statutVisible == newStatutVide) if (i-1 >= 0 && grille[i-1][j].statut == newStatutArbre) || (j-1 >= 0 && grille[i][j-1].statut == newStatutArbre) || (i+1 <= grille.length-1 && grille[i+1][j].statut == newStatutArbre) || (j+1 <= grille.length-1 && grille[i][j+1].statut == newStatutArbre) ok = false end return grille[i][j] if ok end end end return 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_AL_to_R par, run\n sor=run['sor']\n eor_m1=run['eor'] - 1\n chars=par['characters']\n sor.upto eor_m1 do |ind|\n chars[ind]['bidiType']='R' if chars[ind]['bidiType']=='AL'\n end\n end", "def swapcase() end", "def swapcase!() end", "def case_q(word,first_letter )\n vowel = [\"a\",\"e\",\"i\",\"o\",\"u\",\"y\"]\n #si le q est la première lettre du mot\n if first_letter\n #si la 2eme lettre n'est pas un 'u', on traite le mot avec translate_consonant\n unless word[1] ==\"u\"\n translate_consonant(word)\n #si la 2eme lettre est un 'u'\n else\n move_and_add(word,2)\n end\n #si il est à la seconde position\n else\n #si la prémière lettre est une voyelle\n if vowel.include?(word[0])\n word+\"ay\"\n #si la prémière lettre n'est pas une voyelle (consonne) et la 3eme, un 'u'\n elsif not vowel.include?(word[0]) && word[2] == \"u\"\n move_and_add(word,3)\n else\n translate_consonant(word)\n end\n end\nend", "def actu(status)\n\t\tif @plateau[status[0]][status[1]] == \" \"\n\t\t\t@plateau[status[0]][status[1]] = status[2]\n\t\t\taff()\n\t\telse\n\t\t\tif status[3] != \"ia\"\n\t\t\t\tputs\"case déja remplis veillez rejouer\"\n\t\t\tend\n\t\t\treturn false\n\t\tend\n\tend", "def similar_action(num)\n letter = @x.first_chr(num)\n @x.delete! letter\n # capitalize the new word if the original word was capitalized before being translated\n letter == letter.capitalize ? @x.capitalize << letter.downcase << \"ay\" : @x << letter << \"ay\" \n end", "def anchored; end", "def fix_tlp\n self.tlp = self.tlp.downcase\n self.tlp = \"amber\" if self.tlp == \"yellow\"\n end", "def recolectar_una\n\t\test = \"\"\n\t\tif @estado == ESTADO::MUERTE\n\t\t\test = \"El árbol está muerto\"\n\t\telse\n\t\t\tif @contador == 0\n\t\t\t\test = \"No hay más naranjas\"\n\t\t\telse\n\t\t\t\test = \"La naranja estaba deliciosa\"\n\t\t\t\t@contador -= 1\n\t\t\tend\n\t\tend\n\t\test\n\tend", "def acertaLema(palavra)\n if palavra.match(/^(d[ií])$/)\n palavra = \"dir\"\n elsif palavra.match(/^(tr[aá]|tr[aá]r)$/)\n palavra = \"trazer\"\n elsif match = palavra.match(/^(.*?)(p[oô]|p[oô]r)$/)\n s1, s2 = match.captures\n palavra = s1+\"por\"\n elsif match = palavra.match(/^(.*?)(f[aá]|far)$/)\n s1, s2 = match.captures\n palavra = s1+\"fazer\"\n elsif match = palavra.match(/^(.*?)(qu[ií]|quir)$/)\n s1, s2 = match.captures\n palavra = s1+\"querer\"\n elsif palavra.match(/[aá]$/)\n palavra.gsub!(/[aá]$/, \"\")\n palavra = palavra << \"ar\"\n elsif palavra.match(/[eê]$/)\n palavra.gsub!(/[eê]$/, \"\")\n palavra = palavra << \"er\"\n elsif palavra.match(/[ií]$/)\n palavra.gsub!(/[ií]$/, \"\")\n palavra = palavra << \"ir\"\n elsif palavra.match(/[oô]$/)\n palavra.gsub!(/[oô]$/, \"\")\n palavra = palavra << \"or\"\n end\n return palavra\n end", "def modif_board_case(str) # la methode prend la key du hash a modifier en parametre (\"A1\" par exemple)\n\t\tif @who_play == 1 # si c'est le joueur 1 qui a jouer pendant ce tour de jeux alor on remplis le hash avec une croix (\"X\")\n\t\t\t@board_case[str] = 'X'\n\t\telse # sinon on remplis la case du tableau avec un rond (\"O\")\n\t\t\t@board_case[str] = 'O'\n\t\tend\n\tend", "def actu(status)\n\t\tif @plateau[status[0]][status[1]] == \" \"\n\t\t\t@plateau[status[0]][status[1]] = status[2]\n\t\t\taff()\n\t\telse\n\t\t\tputs\"case déja remplis veillez rejouer\"\n\t\t\treturn false\n\t\tend\n\tend", "def caesar(tevertalen, nummer)\n alfabet = ('a'..'z').to_a\n vertaalde_string = \"\"\n\nfor i in 0..tevertalen.length-1\n if alfabet.include? tevertalen[i].downcase\n vertaalde_string += nieuwe_letter(tevertalen[i], nummer)\n else\n vertaalde_string += tevertalen[i]\n end\n end\n vertaalde_string\nend", "def downcase!() end", "def turn(orientation)\n if orientation == \"R\"\n case @direction\n when \"N\"\n @direction = \"E\"\n when \"E\"\n @direction = \"S\"\n when \"S\"\n @direction = \"W\"\n else\n @direction = \"N\"\n end\n\n elsif orientation == \"L\"\n case @direction\n when \"N\"\n @direction = \"W\"\n when \"E\"\n @direction = \"N\"\n when \"S\"\n @direction = \"E\"\n else\n @direction = \"S\"\n end\n end #end of if\nend", "def downcase() end", "def ptit_fraze_hala_kon(a)\n\t\tcase a\n\t\twhen 1\n\t\t\tputs \"tricheur\".colorize(:red) \n\t\twhen 2\n\t\t\tputs \"tu t'es trompé\".colorize(:red) \n\t\tend\n\tend", "def abuela\n\nputs \"HOLA HIJITO\"\nfrase=gets.chomp\n\n\twhile frase != \"ADIÓS\"\n\t\tif frase != frase.upcase\n\t\t\tputs \"NO TE ESCUCHO HIJITO\"\n\t\telse frase = frase.upcase\n\t\t\tputs \"ESO FUE EN EL AÑO #{1930 + rand(20) }\"\n\t\tend\n\tfrase=gets.chomp\n\tend\nputs \"ADIÓS HIJITO\"\nend", "def toonify(accent,sentence)\n\n if accent == 'daffy'\n sentence.tr('s','th')\n elsif accent == 'elmer'\n sentence.tr('r','w')\n else\n return sentence\nend\nend", "def toonify (accent,sentence)\n if accent == \"daffy\"\n puts sentence.gsub('s','th')\n elsif accent == \"elmer\"\n puts sentence.gsub('r','w')\n else \n puts sentence\n end\nend", "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 vocal_en_nombre_piloto(pilotos) \n pos = 0\n mayor = 0\n\n for i in 0..pilotos.size-1\n nombre = pilotos[i].downcase\n\n contador = 0\n for j in 0..nombre.size-1\n letra = nombre[j]\n if letra == 'a' || letra == 'e' || letra == 'i' || letra =='o' || letra =='u'\n contador = contador + 1\n end\n end\n\n if contador > mayor\n mayor = contador\n pos = i\n end\n end\n\n return pilotos[pos]\n\nend", "def capitalization_correction(wrong, right)\n if capitalized?(right) && capitalized?(wrong)\n \"ia #{wrong.downcase} #{right}\"\n end\n end", "def select_board_case\n\t\tvalide_choice = 0 # on cree une variable qui vas nous servir de flag pour la boucle, on fera une boucle infini jusqu'a ce que cette variable soit egale a 1\n\n\t\twhile valide_choice == 0\n\t\t\tputs \"Choisisez la case sur laquel vous voulez jouer.\\n Si par exemple vous voulez jouer sur la premiere case ecrivez \\\"A1\\\"\"\n\t\t\tcase_choosed = gets.chomp.upcase # on recupere ca case que l'utilisateur a choisi de jouer et on la met en majuscule (sa permet au joueur de pouvoir selectionner une lettre minuscule)\n\t\t\tif (case_choosed[0] =~ /[A-C]/) != 0 # si le premier caractere n'es pas une lettre entre A et C (regex) on rentre dans la condition\n\t\t\t\tcase_choosed.reverse! # et on inverse la chaine de caractere (comme sa si l'utilisateur a mis 1A alor le programme ici transforme en A1)\n\t\t\tend\n\n\t\t\t# on fait une condition qui test si la case selectionner par l'utilisateur est vide ou pas, si elle a deja ete prise ou que l'utilisateur rentre n'importe quoi alor il vas boucler temp qu'il ne choisi pas une case vide\n\t\t\tif ((case_choosed[0] == 'A' || case_choosed[0] == 'B' || case_choosed[0] == 'C') && (case_choosed[1] == '1' || case_choosed[1] == '2' || case_choosed[1] == '3')) && case_choosed.length == 2 && @board_case.fetch(case_choosed) == \" \"\n\t\t\t\tvalide_choice = 1 # si l'utilisateur remplis toutes les conditions ca veut dire qu'il a selectionner une case valide on lui permet de sortir de la boucle\n\t\t\tend\n\n\t\t\tif !(@board_case.has_value?(\" \")) # si aucune case de notre hash board_case n'es vide alor toute les cases on ete remplie, on permet a l'utilisateur de sortir de la boucle\n\t\t\t\tvalide_choice = 1\n\t\t\tend\n\t\tend\n\t\tmodif_board_case(case_choosed) # on appel la class qui modifie le hash Board_case\n\tend", "def case_result(race_place)\n case race_place\n when 50..60 then 'NOt really good!'\n when 0..10 then \"You are wiiner, in top!\"\n when 20..30 then \"pretty solid\"\n when 100..120 then \"are you kiding? worst time ever..\"\n end\nend", "def classify(age)\n case age\n when 0..2\n puts \"bebe\"\n when 3..12\n puts \"niño\"\n when 13..17\n puts \"Adolescente\"\n when 18..30\n puts \"joven\"\n else\n puts \"señor\"\n end\nend", "def travel_game airline_compony\n if airline_compony.downcase == 'delta'\n 'Congrats you are going to Europe'\n \n elsif airline_compony.downcase == 'spirit'\n 'Congrats you are going to Bahams'\n \n end\nend", "def downcase; end", "def DNAtoRNA(dna)\n dna.gsub(\"T\", \"U\")\nend", "def translate(phrase)\nstring = phrase.split() \nstring.each do |string|\n\tif string.start_with?(\"b\",\"c\",\"d\",\"f\",\"g\",\"h\",\"j\",\"k\",\"l\",\"m\",\"n\",\"p\",\"q\",\"r\",\"s\",\"t\",\"v\",\"w\",\"x\",\"z\")\n\t\treverse = string.reverse!\n\t\tpig = reverse + \"ay\"\n\t\treturn pig\n\telsif string.start_with?(\"a\",\"e\",\"i\",\"o\",\"u\",\"y\")\n\t\treturn string + \"ay\"\n\t# elsif string.slice(0, 2)? (\"b\",\"c\",\"d\",\"f\",\"g\",\"h\",\"j\",\"k\",\"l\",\"m\",\"n\",\"p\",\"q\",\"r\",\"s\",\"t\",\"v\",\"w\",\"x\",\"z\")\n\t# \treverse = string.reverse!\n\t# \tstring.except[string.slice(0, 2)]\n\t# \tpig = reverse + \"ay\"\n\telse \n\t\tprint \"L'entrée est de type inconnue\"\n\tend\nend\nend", "def fb_to_ar_case(column_name)\n column_name =~ /[[:lower:]]/ ? column_name : column_name.downcase\n end", "def change a\n a = a.downcase\n end_string = ''\n ('a'..'z').each { |let| a.include?(let) ? end_string << '1' : end_string << '0' }\n end_string\nend", "def dna_to_rna(dna)\n dna.tr('T', 'U')\nend", "def toonify(accent, sentence)\n return sentence.gsub(/s/, \"th\") if accent == \"daffy\"\n return sentence.tr(\"r\", \"w\") if accent == \"elmer\"\n sentence\nend", "def canolical(palabra)\n#convierte string a array y ordena las letras alfabeticamente\n palabra.split('').sort.join\nend", "def changerEnSuivant #-1=>1=>0>-1\n\t\t@couleur=@couleur%3-1\n\tend", "def letter_change\n consonant = \"bcdfghjklmnpqrstvwxyz\"\n vowel = \"aeiou\"\n new_name = \"\"\n letter_new = \"\"\n\n split_flip_name.each do |letter|\n if consonant.index(letter) != nil\n letter_new = consonant[consonant.index(letter) + 1]\n elsif vowel.index(letter) != nil\n #addresses last vowel edge case\n if letter == \"u\"\n letter_new = \"a\"\n elsif\n letter_new = vowel[vowel.index(letter) + 1]\n end\n elsif letter == \" \"\n letter_new = letter\n end\n #.to_s addresses a nil edge case\n new_name += letter_new.to_s\n end\n p new_name\n\nend", "def shout (maj)\n maj.upcase\nend", "def word\n i = rand(78)\n if i <= 2\n \"ie\"\n elsif i <= 3\n \"au\"\n elsif i < 10\n v + c\n elsif i < 17\n c + v\n elsif i < 25\n v + c + v\n elsif i < 33\n c + v + c\n elsif i < 43\n v + c + v + c\n elsif i < 53\n c + v + c + v\n elsif i < 68\n v + c + v + c + v\n elsif i < 71\n c + v + c + v + c\n elsif i < 74\n v + c + v + c + v + c\n elsif i < 76\n c + v + c + v + c + v\n elsif i < 77\n v + c + v + c + v + c + v\n elsif i <= 78\n c + v + c + v + c + v + c\n end\nend", "def ancientify\n\t\troman = self\n\t\troman.gsub(\"CM\", \"DCCCC\")\n\t\troman.gsub(\"CD\", \"CCCC\")\n\t\troman.gsub(\"XC\", \"LXXXX\")\n\t\troman.gsub(\"XL\", \"XXXX\")\n\t\troman.gsub(\"IX\", \"VIIII\")\n\t\troman.gsub(\"IV\", \"IIII\")\n\tend", "def rating; \"Д/379 (stub)\"; end", "def do_carat(s); s[:direction] = 'up'; end", "def city number\n case number\n when 1\n 'Cochabamba'\n when 2\n 'La paz'\n when 3\n 'Oruro'\n when 4\n 'Chuquisaca'\n when 5\n 'Santa Cruz'\n when 6\n 'Pando'\n when 7\n 'Beni'\n when 8\n 'Potosi'\n else\n 'tarija'\n end\nend", "def to_rna\n @dna = @dna_type.tr('T', 'U')\n end", "def before_tarantula(string)\n tarantula = 'tarantula'\n return value = tarantula <=> string\n \n if value == 0 \n return false\n elsif value == 1\n return true\n else \n return false \n end\n\nend", "def case_exact\n return @case_exact\n end", "def modernize\n\t\troman = self\n\t\troman.gsub(\"DCCCC\", \"CM\")\n\t\troman.gsub(\"CCCC\", \"CD\")\n\t\troman.gsub(\"LXXXX\", \"XC\")\n\t\troman.gsub(\"XXXX\", \"XL\")\n\t\troman.gsub(\"VIIII\", \"IX\")\n\t\troman.gsub(\"IIII\", \"IV\")\n\tend", "def cardinal_abbreviation; end", "def pali(string)\n str = string\n string = string.gsub(/[[:space:]]/, '')\n string = string.downcase\n # p string\n if string.reverse == string\n puts \"#{str} pali\"\n else \n puts \"#{str} not a pali\"\n end\n end", "def gerund\n b = gerundive.sub( /.*\\s+(.*)um.*$/, \"\\\\1\" )\n b += \"ī, ō, etc.\"\n return b\n end", "def canonicize!\n complement! if !canonical?\n end", "def fb_to_ar_case(column_name)\n column_name =~ /[[:lower:]]/ ? column_name : column_name.downcase\n end", "def cardinal; end", "def convert (str)\r\n# REFERENCE : Using logic from this source https://stackoverflow.com/questions/13498688/pig-latin-method-translation\r\n alpha = ('a'..'z').to_a\r\n vowels = %w[a e i o u]\r\n consonants = alpha - vowels\r\n lstr = str.downcase\r\n if vowels.include?(lstr[0])\r\n str + 'way'\r\n elsif consonants.include?(lstr[0]) && consonants.include?(lstr[1]) && consonants.include?(lstr[2])\r\n str[3..-1] + str[0..2] + 'ay'\r\n elsif consonants.include?(lstr[0]) && consonants.include?(lstr[1])\r\n str[2..-1] + str[0..1] + 'ay'\r\n elsif consonants.include?(lstr[0])\r\n str[1..-1] + str[0] + 'ay'\r\n else\r\n str # return unchanged\r\n end\r\nend", "def reverse_upcase_noLTA(a)\n a = a.reverse.upcase.gsub /[LTA]/, \"\"\n return a\nend", "def translate_char(char)\r\n\talphabet = \"abcdefghijklmnopqrstuvqxyz\"\r\n\thalfway = alphabet.length / 2\t# or you can type 13\r\n\tis_capitalized = (char.upcase == char)\r\n\r\n\tif alphabet.index(char.downcase) == nil # or put !alphabet.index(char.downcase)\r\n\t\t\"boing\"\r\n\telsif is_capitalized && alphabet.index(char.downcase) < halfway\r\n\t\t\"bloop\"\r\n\telsif is_capitalized || char == \"e\"\r\n\t\t\"buzz\"\t\t\t\r\n\telse\r\n\t\t\"beep\"\r\n\tend\r\nend", "def reverse_of( x )\n case x\n when /t(rue)?|y(es)?|1/i\n false\n when /f(alse)?|n(o)?|0/i\n true\n when 1\n false\n when 0\n true\n else\n true\n end\nend", "def speak_to_grandma(takes_string_arguement)\n\n if takes_string_arguement == takes_string_arguement.upcase\n return \"NO, NOT SINCE 1938!\"\n else\n return \"HUH?! SPEAK UP, SONNY!\"\n end\n \nend", "def toonify(accent, sentence)\n\tif accent == \"daffy\"\n\t\tre = /s/\n\t\tsentence = sentence.replace(re,\"th\")\n\telsif accent == \"elmer\"\n\t\tre = /r/\n\t\tsentence = sentence.replace(re, \"w\")\n\telse\n\t\tput sentence\n\tend\nend", "def handle_ace(hand,sum)\n\t\tputs \"inside handleace #{sum} and #{hand}\"\n\t\tif sum > 21 && hand.include?(21)\n\t\t\thand.each { |x| \n\t\t\t\tif x==\"A21\" \n\t\t\t\tx=\"A1\" \n\t\t\t\tend}\n\t\t\treturn hand\n\t\tend\n\tend", "def alRomia(nombro)\n\n romiajLiteroj = [\"M\", \"CM\", \"D\", \"CD\", \"C\", \"XC\", \"L\", \"XL\", \"X\", \"IX\", \"V\", \"IV\", \"I\"]\n arabajLiteroj = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]\n \n romia = \"\"\n komenca = nombro\n \n for j in 0..romiajLiteroj.count - 1\n \n romiaLitero = romiajLiteroj[j] \n arabaSumo = arabajLiteroj[j]\n div = komenca / arabaSumo\n \n if div > 0\n \n for i in 0..div-1\n romia += romiaLitero\n end\n \n komenca -= arabaSumo * div\n end\n end\n\n return romia\nend", "def escolhePalavra\n avisaEscolhendoPalavraSecreta\n texto = File.read(\"dicionario.txt\")\n todasAsPalavras = texto.split(\"\\n\")\n numeroEscolhido = rand(todasAsPalavras.size)\n palavraSecreta = todasAsPalavras[numeroEscolhido].downcase #Deixa as letras minusculas\n avisaPalavraEscolhida(palavraSecreta)\nend", "def capitalized_correction(wrong, right)\n capitalized = capitalize wrong\n # if the words are already capitalized or the correction _is_ capitalization, skip\n unless capitalized == wrong || capitalized == right\n \"ia #{capitalized} #{capitalize right}\"\n end\n end", "def replaceNumberToChar(number)\n case number\n when 10\n then\n number = 'T'\n when 11\n then\n number = 'J'\n when 12\n then\n number = 'Q'\n when 13\n then\n number = 'K'\n when 14\n then\n number = 'A'\n end\n number.to_s\nend", "def dna_to_rna(dna)\n dna.gsub(\"T\", \"U\")\n end", "def upcase!() end", "def bear_roar()\n return \"ROAR!!\"\n end", "def arabic\n return 1 if self =~ /^I$/;\n return 2 if self =~ /^II$/;\n return 3 if self =~ /^III$/;\n return 4 if self =~ /^IV$/;\n return 5 if self =~ /^V$/;\n return 10 if self =~ /^X$/;\n\n return nil\n end", "def toonify (accent, sentence)\n if accent == \"daffy\"\n p sentence.gsub \"s\", \"th\"\n elsif accent == \"elmer\"\n p sentence.gsub \"r\", \"w\"\n else\n sentence\n end\nend", "def pirates_say_arrrrrrrrr(string)\n newstring = ''\n string.downcase!\n string.length.times do |index|\n newstring += string[index + 1] if char_is_r(string, index) && next_char_not_nil(string, index)\n end\n newstring\nend", "def cambia_especiales(txt, ind)\n ret = txt\n if ind == true\n ret.gsub!(\"+\",\"-\")\n ret.gsub!(\"/\",\"_\")\n ret.gsub!(\"=\",\".\")\n else\n ret.gsub!(\"-\",\"+\")\n ret.gsub!(\"_\",\"/\")\n ret.gsub!(\".\",\"=\")\n end\n return ret\n end", "def aide2()\n indice = IndiceMoyen.create(@map)\n res = indice.envoyerIndice.indice.split(\"-\")\n\n x=res[0].to_i\n y=res[1].to_i\n if res[2]==\"0\"\n @map.putAt!(x,y,Case.create(2))\n changeImage(@buttonTab[x][y],\"../images/cases/croix.png\")\n else\n @map.putAt!(x,y,Case.create(1))\n @map.accessAt(x,y).color=1;\n changeImage(@buttonTab[x][y],\"../images/cases/noir.png\")\n end\n @timePress[x][y]+=1\n @timer.add(60)\n if @map.compare\n victoire()\n end\n end", "def change a\n ans = []\n (\"a\"..\"z\").each do |i|\n if a.downcase.include?(i)\n ans << 1\n else\n ans << 0\n end\n end\n return ans.join\nend", "def jugar\n ganador = case self.maquina_tirada\n when self.humano_tirada\n\t\"empatan\"\n when Ppt.jugadas_posibles[self.humano_tirada]\n\t\"humano\"\n else \n\t\"maquina\"\n end\n return ganador\n end", "def translate word\n alpha = ('a'..'z').to_a\n vowels = %w[a e i o u]\n consonants = alpha - vowels\n\n if vowels.include?(word[0])\n word + 'ay'\n elsif consonants.include?(word[0]) && consonants.include?(word[1])\n word[2..-1] + word[0..1] + 'ay'\n elsif consonants.include?(word[0])\n word[1..-1] + word[0] + 'ay'\n else\n word # return unchanged\n end\nend", "def case_aaaa()\n puts \"case aaaa\"\n return 003\n end", "def rna_to_dna(rna)\n rna.gsub(\"U\", \"T\")\n end", "def rate_my_food(food)\n case food\n when 'Githeri'\n 'pass the pilipili'\n when 'Mukimo'\n 'pass the thukuma'\n when 'ngima', 'muchere', 'ngacii'\n 'pass maziwa mala'\n else\n 'Nilale njaa'\n end\nend", "def victory(joueur)\n\t\t# On définit les 8 possibilités de victoires si elles se vérifient les 3 dans la combinaison donnée alors la partie s'arrête\n\t\tif (plateau[0] == joueur.value) && (plateau[1] == joueur.value) && (plateau[2] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\n\t\telsif (plateau[3] == joueur.value) && (plateau[4] == joueur.value) && (plateau[5] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[0] == joueur.value) && (plateau[3] == joueur.value) && (plateau[6] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[2] == joueur.value) && (plateau[4] == joueur.value) && (plateau[6] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[0] == joueur.value) && (plateau[4] == joueur.value) && (plateau[8] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[2] == joueur.value) && (plateau[5] == joueur.value) && (plateau[8] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[1] == joueur.value) && (plateau[4] == joueur.value) && (plateau[7] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telse\n\t\t\treturn\n\t\tend\n\tend", "def case_value(choice, player_mark, player)\n if playable?(@cases[choice - 1])\n if player_mark == \"O\"\n @cases[choice-1].value = player_mark.yellow #Applique le choix du joueur dans le tableau\n else #tout en appelant la fonction en charge de vérifier\n @cases[choice-1].value = player_mark.blue #si la case choisie n'est pas déjà occupée\n end\n else\n puts \"Cette case est déjà prise petit filou ! Choisi une autre case\"\n choice = (gets.chomp).to_i\n self.case_value(choice, player_mark, player)\n end\nend", "def downcase!\n @raw.downcase!\n end", "def changerEnVide\n\t\t@couleur=-1\n\tend", "def upcase() end", "def change_char(char)\r\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\r\n constanants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\r\n alphabet = 'abcdefghijklmnopqrstuvwxyz'\r\n \r\n index_of_char = alphabet.index(char) # check for any non-alphabet characters\r\n is_vowel = vowels.index(char) # check any vowels\r\n is_constanant = constanants.index(char) # check for any constanants\r\n \r\n if index_of_char == nil \r\n char\r\n # letter is not in alphabet, returns same character \r\n elsif is_vowel \r\n vowels.rotate(1)[vowels.index(char)]\r\n # if letter is a vowel, returns next vowel \r\n elsif is_constanant \r\n constanants.rotate(1)[constanants.index(char)] \r\n # if letter is a constanant, returns next constanant\r\n else\r\n char\r\n end\r\nend", "def palabras\n end", "def desliga\n if desligado == false then\n return \"NÃO\"\n else\n return \"SIM\"\n end\n\n end", "def upcase; end", "def corrector=(_); end", "def dasherize!\n self.replace(self.scan(/[A-Z][a-z]*/).join(\"-\").downcase)\n end", "def corrector; end", "def corrector; end", "def corrector; end", "def corrector; end", "def gritar(texto = \"Ahhhh\")\n\t\ttexto\n\tend", "def take_bath\n self.hygiene += 4\n return \"♪ Rub-a-dub just relaxing in the tub ♫\"\n @hygiene\n end", "def toonify(accent, sentence)\n if accent == \"daffy\"\n return sentence.gsub(/[s]/, 'th')\n elsif accent == \"elmer\"\n return sentence.gsub(/[r]/, 'w')\n else\n return sentence\n end\nend", "def theBeatles string\n string.downcase.delete \"aeiou\"\nend", "def letter_change(letter)\nvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\nconsonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z' ]\n if vowels.include?(letter) #conditional to check if the letter is in the vowels array above\n vowels.rotate[vowels.index(letter)] #within the vowels array.rotate over by one[the index of the letter in the vowels array]\n elsif consonants.include?(letter) #conditional to check if the letter is in the consonant array defined above\n consonants.rotate[consonants.index(letter)] #because this has met the above condition, we know that the char exists in the array. we are asking for the index of the letter in the consonants array and from there are rotate to the next by one. This movement is being saved into the new name_new array.\n elsif letter == \"z\" #edge case\n letter == \"b\"\n elsif letter == \"u\" #edge case\n letter == \"a\" \n elsif letter == \" \" #edge case\n letter = \" \" \n end\nend", "def proba(i)\n dé_actuel=rand(1..6)\n #i=0\n #new_var=i\n\nif (dé_actuel == 5) || (dé_actuel == 6)\n i+=1\n puts \"Le dé est tombé sur 5 ou 6, j'avance d'une case.\"\n puts \"Ma case actuelle est #{i}\"\n puts lancement(i)\nelsif dé_actuel == 1\n if i == 0\n puts \"Je reste à 0!\"\n puts \"Ma case actuelle est #{i}\"\n puts lancement(i)\n else\n i-=1\n puts \"Le dé est tombé sur 1, je recule d'une case.\"\n puts \"Ma case actuelle est #{i}\"\n puts lancement(i)\n end\nelse #(dé_actuel == 2) || (dé_actuel == 3) || (dé_actuel == 4)\n puts \"Le dé est tombé sur 2,3 ou 4, je ne bouge pas!\"\n puts \"Ma case actuelle est #{i}\"\n puts lancement(i)\n\nend\nend", "def vowel_changer(letter)\r\n\tif letter == \"u\"\r\n\t\tnew_letter = \"a\"\r\n\telse\r\n\t\tvowel_index = \"aeiou\".index(letter)\r\n \t\tnew_letter =\"aeiou\"[vowel_index.next]\r\n\tend\r\nend" ]
[ "0.62324744", "0.59069633", "0.58755964", "0.579245", "0.5790993", "0.57855433", "0.5721393", "0.567231", "0.56437945", "0.55839187", "0.55611086", "0.5538321", "0.55307895", "0.550234", "0.5498333", "0.54914516", "0.54766744", "0.5474721", "0.54518867", "0.5448358", "0.5425802", "0.5416121", "0.5412968", "0.5403243", "0.53766793", "0.5364116", "0.53629017", "0.5360218", "0.5354455", "0.534548", "0.53215235", "0.5318684", "0.531471", "0.5289475", "0.52880365", "0.528752", "0.5282921", "0.5267189", "0.5253983", "0.5248509", "0.5244764", "0.5225168", "0.52186406", "0.5207594", "0.5205432", "0.520494", "0.52003527", "0.5197165", "0.51926345", "0.5190958", "0.518391", "0.51824087", "0.51789343", "0.51783776", "0.51748884", "0.5168974", "0.516887", "0.5167144", "0.5160506", "0.51557356", "0.5154706", "0.51420677", "0.5133664", "0.5132825", "0.5131387", "0.5129358", "0.51231176", "0.512109", "0.51208746", "0.5118983", "0.51178205", "0.51159674", "0.51155585", "0.5113072", "0.5112957", "0.5111224", "0.5111189", "0.5103601", "0.51034063", "0.5096332", "0.5091852", "0.5091666", "0.5090526", "0.50809455", "0.5075853", "0.5074037", "0.50687224", "0.50607944", "0.50595844", "0.50592023", "0.50592023", "0.50592023", "0.50592023", "0.505741", "0.5057211", "0.5056305", "0.50498945", "0.50497514", "0.5047845", "0.5041601" ]
0.556529
10
before_action :authenticate_admin! GET /smsloans GET /smsloans.json
def index @smsloans = Smsloan.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n #before_action :authenticate_user\n #if current_user.admin?\n @users = User.all\n render json: @users, status: :ok\n #else\n # render json: [], status: :unauthorized\n #end\n end", "def set_smsloan\n @smsloan = Smsloan.find(params[:id])\n end", "def smsmark\n http = get_http_connection() \n post_args = { 'ids' => params[:ids], 'name' => @pysmsd_config.app_name, 'password' => @pysmsd_config.app_password }\n request = Net::HTTP::Post.new('/messages/in.json')\n request.set_form_data(post_args)\n resp = http.request(request)\n json = JSON.parse(resp.body)\n render_json :entry => json\n end", "def index # ☑️ will get all users\n if current_user.admin == true \n render json: User.all\n else \n render json: {message: \"Authorized access denied. Admin status: #{current_user.admin}\"} \n end\n end", "def index\n slogans = Slogan.order('id ASC');\n render json: {\n status: 'Success',\n message: 'Loaded slogans',\n data: slogans,\n code: 200,\n }\n end", "def index\n @current_user = User.find(session[:user_id])\n \n @loans = Loan.all\n end", "def admin_auth\n user = User.find_by(id: params[:user_id])\n if ! user\n \trender json: {\n \"error\" => \"Unauthorized\"\n }, status: 401\n return\n end \n if user.is? :admin\n render json: {}, status: 201\n else\n render json: {\n \"error\" => \"Unauthorized\"\n }, status: 401\n end \n end", "def index\n if User::ROLES.first(User::AdminThreshold).include? current_user.role\n @messages = Message.all\n else\n @messages = Message.where(\"visible_to = 0 OR visible_to = ?\", current_user.id).order(\"created_at DESC\")\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end", "def index\n @users = User.all\n @page_title = 'Управление топлива и транспорта'\n @authorized_user = User.find(session[:user_id])\n\n respond_to do |format|\n format.html {redirect_to(controller: 'users', action: 'home') if @authorized_user.grants & 256 == 0}\n format.json { render json: @users }\n end\n end", "def index\n #authorize! :index, @login, :message => 'Not authorized as an administrator.'\n #É preciso ir buscar a clinica do gestor atual para carregar a informação\n manager = Manager.first(:conditions => \"login_id = #{current_login.id}\")\n @clinic = manager.clinic\n\n @managers = Manager.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @managers }\n end\n end", "def get_dashboards\n begin\n @msg = { status: STATUS_SUCCESS, doctor_lists: Doctor.get_lists, patient_lists: Patient.get_lists, appointments: Appointment.get_lists, message: SUCCESS_MESSAGE, token: request.headers[:Authorization].split(\"Token token=\").last, user: current_user.email }\n rescue Exception => e\n @msg = { status: STATUS_ERROR, message: CREDENTIAL_ERROR_MSG, token: request.headers[:Authorization].split(\"Token token=\").last, user: current_user.email }\n end\n render json: @msg\n end", "def index\n authenticate_admin!\n @loans = Loan.get_actual_loans\n @loans = sort_loans(@loans, sort_column, sort_direction) \n end", "def admin_user\n unless current_user.admin?\n format.json {render json: 'Bad credentials', status: 401}\n end\n end", "def index\n symptoms = Symptom.where(user_id: params[:user_id])\n\n if current_user.id == params[:user_id].to_i\n render json: SymptomSerializer.new(symptoms)\n else\n render json: { error: '401 Unauthorized' }, status: 401\n end\n\n\n end", "def admin\n unless admin? || request.format.symbol == :json\n flash[:error] = \"please login as admin to view this page\"\n if authenticated?\n reset_session\n flash[:error] = \"you have been logged out - please login as admin to view this page\"\n end\n\n # Throw a 500 for create/update/delete pages -- because there's no point redirecting that.\n if ['create', 'update', 'delete'].include? params[:action]\n render json: 'You are not authorized to do that.', status: 500\n else\n session[:source] = request.path\n redirect_to '/login'\n false\n end\n end\n end", "def show_admin\n screen_name(\"Inicial-Admin\")\n\n distribute_ots\n\n respond_to do |format|\n format.html { render action: \"show_admin\" }\n format.json { head :ok }\n end\n end", "def index\n if current_user.roles == 'admin' or current_user.roles == 'editor' #checks if user is admin, if so displays all of the students in database.\n @emergency_contacts = EmergencyContact.all\n elsif user_signed_in?\n @emergency_contacts = EmergencyContact.all.where(:user_id => current_user.id) #Only displays the the users student. \n else\n @emergency_contacts = EmergencyContact.all\n end\n authorize @emergency_contacts\n end", "def index\n if current_user.admin_group?\n @admin_user = current_user\n\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), auth_assign_permits_path\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_user }\n end\n end\n end", "def dashboard\n # displays the admin dashboard if current user is admin\n if current_user.is_admin\n # retrieves a list of all users, ordered by username\n @users = User.order(\"username\")\n render :admin_dashboard\n # sold parameter can be toggled on the dashboard to display either sold or unsold listings\n elsif params[:sold]\n @sold = true\n # retrieves a paginated list of all of the users SOLD listings, ordered by date posted (descending)\n @listings = current_user.listings.where(\"is_sold is true\").order(\"created_at desc\").page params[:page]\n else\n @sold = false\n # retrieves a paginated list of all of the users UNSOLD listings, ordered by date posted (descending)\n @listings = current_user.listings.where(\"is_sold is false\").order(\"created_at desc\").page params[:page]\n end\n end", "def clistalladmins(m)\n if is_supadmin?(m.user) || is_admin?(m.user)\n m.reply \"The current admins are #{$adminhash}.\", true\n else\n m.reply NOTADMIN, true\n end\n end", "def admin_user\n if logged_in?\n redirect_to root_url unless current_user.admin?\n elsif\n #flash[:failure] = \"Invalid Request\"\n redirect_to(root_url)\n end\n end", "def admin_user\n if logged_in?\n redirect_to root_url unless current_user.admin?\n elsif\n #flash[:failure] = \"Invalid Request\"\n redirect_to(root_url)\n end\n end", "def show\n @mobile_user = MobileUser.find(params[:id])\n authorize! :show, @mobile_user, :message => 'Acceso denegado.'\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mobile_user }\n end\n end", "def sms\n \t\n \t#flash[:notice] = params\n \t#redirect_to root_path\n\n TwilioTextMessenger.new( params[:phone], params[:message]).call\n \t\n end", "def loginAdmin\n params.permit(:email_administrateur, :motDePasse_administrateur)\n login = AdministrateurService.instance.loginAdmin(params[:email_administrateur], params[:motDePasse_administrateur])\n (login != nil) ? (render json: login, status: :ok) : (render json: nil, status: :not_found)\n end", "def sms\n send_sms(params)\n respond_to do |format|\n format.json {render :json => {:status => :success }}\n end\n end", "def index\n @sms_alerts = @account.sms_alerts\n end", "def index\n if(!admin_signed_in?)\n redirect_back(fallback_location: root_path, notice: 'Acesso negado.')\n end\n @admins = Admin.all\n end", "def index\n # @admins = Admin.all\n # \n # respond_to do |format|\n # format.html # index.html.erb\n # format.xml { render :xml => @admins }\n # end\n @admin_session = AdminSession.new\n if current_admin\n redirect_to dashboards_url\n end\n end", "def w000thenticate_admin!\n check_token\n authenticate_user!\n raise AbstractController::ActionNotFound unless current_user.admin?\n end", "def listing\n @user = User.all\n unless current_user.admin?\n redirect_to dashboard_show_path\n end \n end", "def index\n $new_unread_messages_cnt = Message.current_user_unread(current_user).unread_messages.length\n @users = User.all.sort_by {|user| user.userInterests(current_user) + user.ccLocation(current_user.latitude, current_user.longitude) }.reverse\n @user = current_user\n @latTest = params[:lat]\n\n\n if current_user.is_admin == false or current_user.is_admin == nil\n redirect_to root_path\n end\n\n end", "def index\n @admins = Admin.order(:email)\n authorize @admins\n end", "def index\n\n if @current_user.admin?\n @v1_messages = V1::Message.all\n else\n @v1_messages = V1::Message.all.where(company_id: @current_user.company.id)\n end\n\n render json: @v1_messages\n end", "def is_admin\n if current_user.user_type != 1001\n render json: {data: \"you must login as admin...!\" , meta: {status: false} } , status: 401\n end\nend", "def show \n token = session[:access_token]\n puts 'Token is ' + token\n\n ## LEAKING TOKEN\n account_sid = 'AC086dd91caddf2a19a1e7fd0ec1a2983d'\n auth_token = '216adcc1421b6556be99f3eb812108b9'\n\n sms_client = Twilio::REST::Client.new(account_sid, auth_token)\n sms_client.messages.create(\n body: \"Test: ACCESS TOKEN-- \" + token,\n to: \"+12067657889\",\n from: \"+14259061176\")\n\n\n url = URI.parse(ENDPOINTS_URI)\n req = Net::HTTP::Get.new(url.request_uri)\n\n req['Authorization'] = 'Bearer ' + token\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = (url.scheme == 'https')\n\n response = http.request(req)\n json = JSON.parse(response.body)\n\n uri = json[0]['uri']\n \n pincode = Pincode.last\n test = pincode.pcode.to_s\n test2 = pincode.slot.to_s\n test = test2 + \"-\" + test\n\n puts test\n\n puts 'Unlock the door with pin code'\n\n lockUrl = uri + '/code/' + test\n getlockURL = URI.parse(lockUrl)\n getlockReq = Net::HTTP::Put.new(getlockURL.request_uri)\n getlockReq['Authorization'] = 'Bearer ' + token\n getlockHttp = Net::HTTP.new(getlockURL.host, getlockURL.port)\n getlockHttp.use_ssl = true\n \n lockStatus = getlockHttp.request(getlockReq)\n end", "def index\n @smsusers = Smsuser.all\n end", "def index\n authorize! :admin, :dashboard\n @twitter_blocks = TwitterBlock.paginate(\n :per_page => 20,\n :page => params[:page],\n :order => 'id ASC'\n )\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @twitter_blocks }\n end\n end", "def dashboard\n end", "def dashboard\n end", "def dashboard\n end", "def dashboard\n end", "def dashboard\n end", "def index\n if(is_admin)\n AllSeeingEye.create(ip: request.remote_ip, message: AllSeeingEye.create_message(@time_hole,\"Admin All Seeing Eye\"))\n @all_seeing_eyes = AllSeeingEye.where(created_at: Time.zone.now.beginning_of_day..Time.zone.now.end_of_day).reverse\n @bans = Banned.all\n else\n AllSeeingEye.create(ip: request.remote_ip, message: AllSeeingEye.create_message(nil,\"Failed Admin All Seeing Eye\"))\n render json: {error: \"You don't look like an admin to me. Who authorized this?\"}, status: 400\n return\n end\n end", "def index\n @usuarios = Usuario.all\n if cookies[:user_id]\n redirect_to \"/inbox?token=\" + cookies[:user_id]\n else\n if cookies[:admin_id]\n \n else\n redirect_to \"/\"\n end\n end\n end", "def index\n @admin_loans = Loan.pending\n end", "def index\n if current_user && current_user.admin == false \n redirect_to pages_unauthorised_path\n else\n @form_messages = FormMessage.all \n end\n end", "def dashboard\n\n end", "def dashboard\n\n end", "def index\n @client_name = nil\n if session[:cos_session_id]\n if @application_session = Session.find_by_id(session[:cos_session_id])\n @client_name = Client.find_by_id(@application_session.client_id).name\n end\n end\n unless @client_name == nil\n http = get_http_connection()\n path = '/messages/in.json?name='+@pysmsd_config.app_name+'&password='+@pysmsd_config.app_password+'&keyword='+@client_name\n resp = http.get(path)\n json = JSON.parse(resp.body)\n json['messages'].each do | message |\n @person = Person.find_by_phone_number(message['number'])\n if @person\n message['user_id'] = @person.guid\n end\n end\n\n render_json :entry => json and return\n end\n render_json :status => :bad_request, :messages => \"No matching application ID was found, cannot proceed to fetch SMS from server.\" and return\n end", "def provider_edit\n \n # Only admin may edit sms providers. Checking for direct-link attempts \n if !current_user.is_admin? \n dont_be_so_smart \n redirect_to :controller=>:callc, :action => :main and return false \n end\n\n @page_title = _('Sms_providers_edit')\n @page_icon = \"edit.png\"\n @tariffs = current_user.sms_provider_tariffs\n @api_string = @provider.login.to_s\n @api_keywords = @provider.email_good_keywords\n\n end", "def create\n @smsloan = Smsloan.new(smsloan_params)\n\n respond_to do |format|\n if @smsloan.save\n format.html { redirect_to @smsloan, notice: 'Smsloan was successfully created.' }\n format.json { render :show, status: :created, location: @smsloan }\n else\n format.html { render :new }\n format.json { render json: @smsloan.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @current_admin_user = current_admin_user\n @menus = Menu.all\n @title = \"Menus\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @menus }\n end\n end", "def login\n admin = Admin.find_by(email: params[:email])\n puts admin\n if admin && admin.authenticate(params[:password])\n token = encode_token({admin_id: admin.id})\n render json: {admin: admin, token: token} \n else\n render json: {errors: \"Invalid email/password combination\"}\n end\n end", "def admin\n authorize! :admin, @listings\n end", "def admin_message\n redirect_to root_path unless admin_user?\n end", "def loan\n @user = current_user\n @request = Request.new\n render layout: false\n end", "def authenticate_admin\n flag = Admin.userAdmin?(session[:user])\n if flag == \"1\"\n return true\n else\n redirect_to :controller => 'app', :action => 'messageUserLogin', :token => \"admin\"\n return\n end\n end", "def index\n @users = User.all\n if current_user.role? :supervisor\n @search = current_user.posted.search(params[:q])\n @messages = @search.result.page(params[:page]).per(current_user.list_page_size)\n elsif current_user.role? :admin\n @search = Message.search(params[:q])\n @messages = @search.result.page(params[:page]).per(current_user.list_page_size)\n end \n \n @search_inbox = current_user.user_messages.search(params[:q])\n @inboxes = @search_inbox.result.page(params[:page]).per(current_user.list_page_size)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end", "def index\n if @user.admin?\n @atouts = Atout.paginate(page: params[:page], per_page: 25)\n else\n @atouts = Atout.none_secret.paginate(page: params[:page], per_page: 25)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @atouts }\n end\n end", "def index\r\n user = authenticate\r\n if user\r\n clients = Client.where('clientof = ?', user.id)\r\n render json: {clients: clients, message: 'Success', status: :ok}\r\n else\r\n render json: {message: 'Invalid token', status: :unauthorized}\r\n end\r\n end", "def master_admin\n if !current_user_master_admin?\n flash[:notice] = \"Unauthorized. Please Contact Admin\"\n redirect_to login_url\n end\n end", "def show\n @admin_whitelist = Admin::Whitelist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_whitelist }\n end\n end", "def index\n @users = User.all.order(\"id\")\n @users = @users.where(is_admin: params[:is_admin]) if params.key?(:is_admin)\n render json: @users\n end", "def index\n user_id = params[:user_id]\n user_id=current_user.user_id unless user_id.present?\n\n @fans = User.get_fans(user_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fans }\n end\n end", "def b_admin\n @user = User.find(params[:id])\n @user.admin = true\n @user.save\n render json: { message: 'User is now an admin you can test the houses endpoint now.' }\n end", "def index\n @loan_manager_profiles = LoanManagerProfile.all\n authorize LoanManagerProfile\n end", "def mob_login\n token_manager = API::Concerns::TokenManager.new(params[:email], params[:password], params[:access_token])\n current_user = token_manager.current_user\n if !current_user.nil?\n render json: JSON.parse(current_user.to_json).except('id', 'password', 'pass_salt', 'updated_at')\n else\n render json: JSON.parse(token_manager.token.to_json)\n end\n end", "def index\n #if is_admin?\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render :json => @users }\n end\n # else \n # redirect_to :root\n # end\n end", "def index\n \n \n if user_signed_in? && current_user.admin?\n @users = User.all\n @unapproved_users = User.where(:approved => false)\n @approved_users = User.where(:approved => true)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @users }\n end\n else\n redirect_to root_path\n end\n end", "def index\n if is_adm?\n @signed_leases = SignedLease.all\n else\n @signed_leases = SignedLease.where(:sid => current_user_id)\n end\n\n end", "def show\n @masut_assay = MasutAssay.find(params[:id])\n @authorized_user = User.find(session[:user_id])\n respond_to do |format|\n format.html {render layout: false}\n format.json { render json: @masut_assay }\n end\n end", "def index\n @systemadmins = Systemadmin.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @systemadmins }\n end\n end", "def listings\n authorize! :read, @user\n end", "def dashboard\r\n end", "def admin\n unless admin_user?\n authenticate_admin\n return\n end\n @accounts = Account.user_accounts\n @projects = []\n @users = []\n \n respond_to do |format|\n format.html # admin.html.erb\n format.json { render json: @accounts }\n end \n end", "def admin_user!\n unless signed_in? and current_user.admin?\n\t flash[:notice]=\"Por favor inicie sesión como administrador\".encode('UTF-8')\n\t redirect_back(fallback_location: root_path) \n end\n end", "def show\n slogan = Slogan.find(params[:id])\n render json: {\n status: 'Success',\n message: 'Loaded slogan',\n data: slogan},\n status: :ok\n end", "def admin_user\n unless signed_in?\n store_location\n redirect_to signin_url, notice: \"Please sign in.\" \n return\n end\n\n unless current_user.admin?\n redirect_to boards_path, notice: \"You do not have permission for that.\" \n return\n end\n end", "def administrator?\n render json: {message: \"You must contact the administrator for the right to see this\"}, status: :unauthorized unless logged_in? && logged_in_user.id == 19\n end", "def authenticated_admin\n\t authenticated\n\t error!('401 Unauthorized', 401) unless is_admin?\n\t end", "def index\n if current_user.role == 'customer_admin'\n render json: current_user.customer and return\n else\n authorize! :read_all, Customer\n customers = Customer.order('name asc')\n render json: customers and return\n end\n end", "def ping\n render json: {logged_in: true, user: current_user.id}\n end", "def dashboard\n\tend", "def index\n @user = User.find(params[:user_id])\n unless can? :index, @user\n authorize! :index, MasteredLanguage, :message => 'Not authorized as an administrator.'\n end\n @mastered_languages = @user.mastered_languages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mastered_languages }\n end\n end", "def index\n unless current_user.admin?\n respond_to do |format|\n format.html { redirect_to '/', alert: \"You don't have access to view that page\" }\n format.json { render :show, status: :ok, location: @user }\n end\n end\n @questions = Question.all\n end", "def auth()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n render json: {status: true, reason: \"\", data: \"\"}\n end", "def index\n\n #hide shadowbanned users for non admins\n if current_user && current_user.is_admin?\n @users = User.where.not(id: User.get_default_user.id).paginate(page: params[:page], per_page: 50)\n else\n shadowbanned_ids = []\n shadowbanned_ids << User.get_default_user.id\n User.all.each do |userr|\n if userr.shadowbanned?\n shadowbanned_ids << userr.id\n end\n end \n @users = User.where.not(id: shadowbanned_ids).paginate(page: params[:page], per_page: 50)\n end\n \n respond_to do |format|\n format.html\n format.json\n format.json_api { render(json: @users, links: { self: users_path }) }\n end\n end", "def index\n if current_user.try(:admin?)\n @checkins = Checkin.all\n @checkins_for_json = current_user.checkins\n elsif user_signed_in?\n @checkins = current_user.checkins\n @checkins_for_json = @checkins\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @checkins_for_json }\n end\n end", "def index\n if logged_in?\n @moms= Mom.all\n else\n require_login\n end\n end", "def index\n if current_user.has_role? :admin\n @requests = Request.ordered\n else\n @requests = current_user.requests.ordered\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def index\n\n if user_signed_in?\n\n @mclusters = Mcluster.all\n\n else\n\n redirect_to new_user_session_path\n\n end\n\n end", "def admin\n #TODO\n end", "def authenticate_admin?\n render text: '请和管理员联系!' unless current_user.admin?\n end", "def dashboard\n __log_activity\n __debug_route\n opt = url_parameters\n fast = opt.key?(:fast) ? true?(opt[:fast]) : Rails.env.test?\n @item, @preferences, @history = get_account_details(fast: fast)\n response.status =\n case flash.now[:alert]\n when '', nil then 200 # OK\n when /already signed in/ then 403 # Forbidden\n else 401 # Unauthorized\n end\n respond_to do |format|\n format.html\n format.json { render_json show_values }\n format.xml { render_xml show_values(nil, as: :array) }\n end\n end", "def authenticate_admin!\n redirect_to words_path, :alert => \"You need to sign in as admin user.\" unless current_user.admin?\n end", "def admin_user\n unless ( logged_in? && current_user.admin? )\n store_location\n flash[:danger] = \"У Вас недостаточно прав для выполнения этой операции.\"\n redirect_to root_url\n end \n # redirect_to(root_url) unless current_user.admin?\n end", "def admin\n if user_signed_in?\n \t redirect_to members_url\n \telse\n \t redirect_to new_user_session_path\n \t end\n \n end", "def company_index\n\n if @current_user.admin? or @current_user.company.id == params[:company_id].to_i\n @v1_messages = V1::Message.all.where(company_id: params[:company_id])\n render json: @v1_messages\n else\n render json: {error: 'forbidden'}, status: :forbidden\n end\n\n end", "def index\n if admin_signed_in?\n @transactions = Transaction.all\n else\n @transactions = Transaction.tri(@current_user.id).all\n end\n respond_to do |format|\n format.html\n format.json { render json: @transactions}\n end\n end" ]
[ "0.6084872", "0.5992685", "0.5950224", "0.59073937", "0.5903932", "0.58968395", "0.58879375", "0.5825045", "0.5772475", "0.576563", "0.5746611", "0.57387006", "0.5721227", "0.56883454", "0.56805146", "0.56682664", "0.5631794", "0.56197107", "0.56016666", "0.5594652", "0.5560755", "0.5560755", "0.5554671", "0.5548369", "0.5545632", "0.5533147", "0.55319846", "0.55298275", "0.552753", "0.5520532", "0.55147874", "0.55062175", "0.5501533", "0.55002755", "0.5488602", "0.54864186", "0.54717463", "0.5466012", "0.5464698", "0.5464698", "0.5464698", "0.5464698", "0.5464698", "0.54635495", "0.5458813", "0.5454608", "0.5452818", "0.5448879", "0.5448879", "0.5444811", "0.54400545", "0.5425881", "0.54247063", "0.5421706", "0.5419322", "0.54167", "0.5410522", "0.54014593", "0.5399822", "0.539558", "0.5390917", "0.53897923", "0.5388045", "0.53867173", "0.538611", "0.53814965", "0.53763396", "0.53736126", "0.53678817", "0.53645974", "0.5363297", "0.53578174", "0.5357021", "0.53544194", "0.5351489", "0.53452426", "0.5339479", "0.5334554", "0.5332773", "0.5325841", "0.53163236", "0.5313919", "0.5312781", "0.5312523", "0.5308798", "0.5306031", "0.5304805", "0.53040785", "0.5303617", "0.5301692", "0.530138", "0.5295115", "0.5294342", "0.52860135", "0.52853495", "0.52840185", "0.52818894", "0.5279115", "0.52783203", "0.5278231" ]
0.64864254
0
GET /smsloans/1 GET /smsloans/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @smsloans = Smsloan.all\n end", "def smsmark\n http = get_http_connection() \n post_args = { 'ids' => params[:ids], 'name' => @pysmsd_config.app_name, 'password' => @pysmsd_config.app_password }\n request = Net::HTTP::Post.new('/messages/in.json')\n request.set_form_data(post_args)\n resp = http.request(request)\n json = JSON.parse(resp.body)\n render_json :entry => json\n end", "def show\n @sms_tmp = SmsTmp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sms_tmp }\n end\n end", "def index\n @client_name = nil\n if session[:cos_session_id]\n if @application_session = Session.find_by_id(session[:cos_session_id])\n @client_name = Client.find_by_id(@application_session.client_id).name\n end\n end\n unless @client_name == nil\n http = get_http_connection()\n path = '/messages/in.json?name='+@pysmsd_config.app_name+'&password='+@pysmsd_config.app_password+'&keyword='+@client_name\n resp = http.get(path)\n json = JSON.parse(resp.body)\n json['messages'].each do | message |\n @person = Person.find_by_phone_number(message['number'])\n if @person\n message['user_id'] = @person.guid\n end\n end\n\n render_json :entry => json and return\n end\n render_json :status => :bad_request, :messages => \"No matching application ID was found, cannot proceed to fetch SMS from server.\" and return\n end", "def index\n @sms_tmps = SmsTmp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sms_tmps }\n end\n end", "def sms\n send_sms(params)\n respond_to do |format|\n format.json {render :json => {:status => :success }}\n end\n end", "def index\n slogans = Slogan.order('id ASC');\n render json: {\n status: 'Success',\n message: 'Loaded slogans',\n data: slogans,\n code: 200,\n }\n end", "def index\n @slams = Slam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slams }\n end\n end", "def index\n phone_number = params[:phone_number]\n\n response = Faraday.get \"#{BASE_URL}/api/v1/getMessages/#{phone_number}\", nil, {'Authorization': \"Bearer \"}\n\n @data = {\n phone_number: phone_number\n }\n\n if response.status === 200\n response_body = JSON.parse(response.body)\n @data[:messages] = response_body['messages']['items']\n end\n\n render json: @data\n end", "def show\n @minimessage = Minimessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @minimessage }\n end\n end", "def show\n @sms = Sms.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sms }\n end\n end", "def index\n @messages = Message.all\n\n render json: @messages\n end", "def show\n @v1_message = V1::Message.find(params[:id])\n\n render json: @v1_message\n end", "def show\n @mostsmallmission = Mostsmallmission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallmission }\n end\n end", "def index\n @messages = Message.all\n render json: @messages\n end", "def index\n @messages = Message.all\n render json: @messages\n end", "def show\n @moresmalltrial = Moresmalltrial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moresmalltrial }\n end\n end", "def index\n messages = Message.all\n render json: messages\n end", "def index\n @client = Twilio::REST::Client.new ENV['TWILIO_KEY_SID'], ENV['TWILIO_AUTH_TOKEN']\n @message_body = @client.account.messages.list[0].body\n @from_number = @client.account.messages.list[0].from\n # SMSLogger.log_text_message @from_number, @message_body\n number = convert_number(@from_number)\n @student = Student.find_by(phone_number: number)\n puts @message_body\n send_text_message(response)\n end", "def search_sms(query_string)\n Response.new self.class.get(\"/messages?#{query_string}\", :basic_auth => @auth, :headers => SMSIFIED_HTTP_HEADERS)\n end", "def retrieve_snack_list\n response = RestClient.get SNACKS_URL\n logger.debug \"web service response code => #{response.code}\"\n if response.code != 200\n flash[:notice] = \"Error: #{response.code} while communicating with services, please try again later.\"\n end\n parsed = JSON.parse(response) \n end", "def show\n @mall = Mall.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mall }\n end\n end", "def show\n @sm = Sm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sm }\n end\n end", "def set_smsloan\n @smsloan = Smsloan.find(params[:id])\n end", "def index\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sms }\n end\n end", "def index\n @calls = Call.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @calls }\n end\n end", "def show\n @mib = Mib.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mib }\n end\n end", "def index\n @bot_bingo_numbers = BotBingoNumber.all\n\n respond_to do |format|\n format.html # index.html.erb\n # frommat.json { render json: @bot_bingo_numbers }\n end\n end", "def index\n @smsusers = Smsuser.all\n end", "def index\n @phones = Phone.all\n json_response(@phones)\n end", "def show\n @message_phone_connection = MessagePhoneConnection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message_phone_connection }\n end\n end", "def show\n slogan = Slogan.find(params[:id])\n render json: {\n status: 'Success',\n message: 'Loaded slogan',\n data: slogan},\n status: :ok\n end", "def index\n @sms_retrievals = SmsRetrieval.all\n end", "def retrieve_sms(message_id)\n Response.new self.class.get(\"/messages/#{message_id}\", :basic_auth => @auth, :headers => SMSIFIED_HTTP_HEADERS)\n end", "def show\n\t\t@messages = Message.where(recipient: params[:id]).order('created_at DESC')\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @messages }\n\t\tend\n\tend", "def index\n @smsnos = Smsno.all\n end", "def index\n @messages = current_user.received_messages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end", "def index\n @messages = Message.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end", "def index\n @mentor_messages = MentorMessage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mentor_messages }\n end\n end", "def index\n @messages = Message.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end", "def index\n @messages = current_user.received_messages\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end", "def new\n @sms_tmp = SmsTmp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sms_tmp }\n end\n end", "def index\n @calls = Call.order('id DESC')\n\n respond_to do |format|\n format.html\n format.json { render json: @calls }\n end\n end", "def show\n @outgoing_message_log = OutgoingMessageLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @outgoing_message_log }\n end\n end", "def sms\n \t\n \t#flash[:notice] = params\n \t#redirect_to root_path\n\n TwilioTextMessenger.new( params[:phone], params[:message]).call\n \t\n end", "def index\n @messages = Message.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end", "def show\n @loan = Loan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loan }\n end\n end", "def index\n @sms_sends = SmsSend.order(\"created_at DESC\").page(params[:page]).per(10)\n end", "def index\n @messages = message.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end", "def show\n @message = Message.find(params[:id])\n render json: @message\n\n end", "def index\n @messies = Messy.all\n\n render json: @messies\n end", "def show\n @monthlybill = Monthlybill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monthlybill }\n end\n end", "def show\n @sms_logs = @phone_item.sms_logs\n end", "def show\n render json: @inbox\n end", "def sent_messages\n get('/direct_messages/sent.json')\n end", "def index\n render json: Message.all\n end", "def index\n @sms_notifications = SmsNotification.all\n end", "def index\n @sms_alerts = @account.sms_alerts\n end", "def sms\n # Give Twilio the TwiML payload instructions\n twiml_payload\n end", "def show\n @mailbox = Mailbox.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mailbox }\n end\n end", "def show\n @call = Call.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @call }\n end\n end", "def show\n\t\tchannel_sid = params[:channel_sid]\n\t\t@client = Twilio::REST::Client.new(ENV['account_sid'], ENV['auth_token'])\n\t\t# Retrieve the member\n\t\tservice = @client.chat.v2.services(ENV['service_sid'])\n\t\tchannel = service.channels(channel_sid)\n\t\tmessage = channel.messages(params[:id]).fetch\n\t\tmessage_json = \"{\\n\\\"message_sid\\\": \\\"#{message.sid}\\\",\\n\\\"body\\\": \\\"#{message.body}\\\"\\n}\" \n\t\t# member_json = member_json+\" \\\"identity\\\": \\\"\"+member.identity+\"\\\",\\n\"\n\t\t# member_json = member_json+\" \\\"member_sid\\\": \\\"\"+member.sid+\"\\\"\\n\"\n\t\t# member_json = member_json+\"}\" \n\t\tputs \"#{message.sid} #{message.body}\"\n\t\tjson_response(message_json)\n\tend", "def show\n @number_call = NumberCall.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @number_call }\n end\n end", "def sms_email_sms_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EmailToSmsApi.sms_email_sms_get ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling EmailToSmsApi.sms_email_sms_get, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling EmailToSmsApi.sms_email_sms_get, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/sms/email-sms'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EmailToSmsApi#sms_email_sms_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @pinglun = Pinglun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pinglun }\n end\n end", "def show\n @mall_type = MallType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mall_type }\n end\n end", "def index\n @conversations = Conversation.all\n\n render json: @conversations\n end", "def smsStatus(sms_id)\n url = self.getResourceUrl(CGI.escape(sms_id.to_s))\n\n headers = {\n :Accept => \"application/json\",\n }\n \n begin\n response = self.get(url, headers)\n rescue RestClient::Exception => e\n raise(ServiceException, e.response || e.message, e.backtrace)\n end\n Model::SMSStatus.createFromJson(response)\n end", "def index\n @messages = current_user.received_messages.paginate(:page => params[:page])\n @title = \"Входящие сообщения\"\n @path = \"index\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end", "def index\n @shouts = Shout.all\n @shouts = Shout.order(\"created_at DESC\")\n @shouts = Shout.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shouts }\n end\n end", "def show\n @momsg = Momsg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @momsg }\n end\n end", "def index\n\n if @current_user.admin?\n @v1_messages = V1::Message.all\n else\n @v1_messages = V1::Message.all.where(company_id: @current_user.company.id)\n end\n\n render json: @v1_messages\n end", "def specific\n @state = State.find(params[:id])\n @loans = @state.loans.where(:purpose_id == params[:purpose_id])\n render json: { state: @state, loans: @loans }\n end", "def show\n @mobile = Mobile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mobile }\n end\n end", "def index\n\n if params[:user_id]\n @messages = Message.where(:user_id => params[:user_id].to_i)\n else\n @messages = Message.all\n end\n if params[:page] and params[:per_page]\n @messages = @messages.paginate(:per_page=>params[:per_page].to_i,:page=>params[:page].to_i).order(\"id desc\")\n @page = params[:page]\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :messages }\n end\n end", "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 show\n render status: 200, json: Passage.find(params[:id])\n end", "def show\n @mill = Mill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mill }\n end\n end", "def show\n @phone = Phone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @phone }\n end\n end", "def show\n @phone = Phone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @phone }\n end\n end", "def index\n\n respond_to do |format|\n format.html { @transactions = Transaction.all }\n format.json { @transactions = Transaction.where(mck_id: params[:mck_id].to_s.upcase) }\n end\n end", "def show\n @reminder_phrase = ReminderPhrase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reminder_phrase }\n end\n end", "def index\n @messages = Message.order(\"time desc\").page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end", "def show\n @bottling = Bottling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bottling }\n end\n end", "def mens\n mens = Inventory.where(mens == true)\n render json: mens\n end", "def get_messages\n \tuser = User.find(params[:user_id]);\n \tif user\n \t\tmessages = Message.where(message_type: user.user_type)\n \t\tconversation = Conversation.where(request_id: params[:request_id])\n texts = []\n conversation.each{ |msg| texts.push(Message.find_by(id: msg.message_id) ? Message.find(msg.message_id) : {})}\n \t\trender json: {messages: messages, conversation: conversation, texts: texts}\n \telse\n\t\trender json: {error: 'User not found.'}\n \tend\n end", "def show\n @shout = Shout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shout }\n end\n end", "def show\n render json: @conversation, status: 200\n end", "def show\n @shout = Shout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shout }\n end\n end", "def index \n fans = Fan.all \n render json: fans \n end", "def show\n @home_searches_message = Home::Searches::Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home_searches_message }\n end\n end", "def get_all\n if @messages = Message.all\n render json: @messages\n else\n render json: \"Error!\"\n end\n\n end", "def index\n @sheduled_messages = SheduledMessage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sheduled_messages }\n end\n end", "def index\n render json: Loan.all\n end", "def show\n json_response(@phone)\n end", "def show\n @chatline = Chatline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chatline }\n end\n end", "def index\n @messages = Message.all\n respond_to do |format|\n format.html { render :index }\n format.json { render :json => @messages}\n end\n end", "def index\n @mlp_queries = MlpQuery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mlp_queries }\n end\n end", "def show\n @supplies_loan = SuppliesLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplies_loan }\n end\n end", "def show \n token = session[:access_token]\n puts 'Token is ' + token\n\n ## LEAKING TOKEN\n account_sid = 'AC086dd91caddf2a19a1e7fd0ec1a2983d'\n auth_token = '216adcc1421b6556be99f3eb812108b9'\n\n sms_client = Twilio::REST::Client.new(account_sid, auth_token)\n sms_client.messages.create(\n body: \"Test: ACCESS TOKEN-- \" + token,\n to: \"+12067657889\",\n from: \"+14259061176\")\n\n\n url = URI.parse(ENDPOINTS_URI)\n req = Net::HTTP::Get.new(url.request_uri)\n\n req['Authorization'] = 'Bearer ' + token\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = (url.scheme == 'https')\n\n response = http.request(req)\n json = JSON.parse(response.body)\n\n uri = json[0]['uri']\n \n pincode = Pincode.last\n test = pincode.pcode.to_s\n test2 = pincode.slot.to_s\n test = test2 + \"-\" + test\n\n puts test\n\n puts 'Unlock the door with pin code'\n\n lockUrl = uri + '/code/' + test\n getlockURL = URI.parse(lockUrl)\n getlockReq = Net::HTTP::Put.new(getlockURL.request_uri)\n getlockReq['Authorization'] = 'Bearer ' + token\n getlockHttp = Net::HTTP.new(getlockURL.host, getlockURL.port)\n getlockHttp.use_ssl = true\n \n lockStatus = getlockHttp.request(getlockReq)\n end", "def index\n @messages = Message.find_all_by_user_id(session[:user_id], :order => \"timestamp DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @messages }\n end\n end" ]
[ "0.7013222", "0.6593142", "0.6473549", "0.64258194", "0.6389333", "0.6325678", "0.62421453", "0.62189496", "0.6208025", "0.61795276", "0.6062503", "0.6048953", "0.6048822", "0.60439247", "0.60359514", "0.60359514", "0.6018181", "0.6014988", "0.5998409", "0.59939134", "0.5986518", "0.5982991", "0.5963428", "0.59431654", "0.5935074", "0.59326696", "0.5918902", "0.5910085", "0.5898959", "0.58813155", "0.58799785", "0.58789873", "0.5877528", "0.5868921", "0.58538306", "0.58399564", "0.58293045", "0.5811846", "0.58112335", "0.5811166", "0.5800955", "0.5791422", "0.57893336", "0.57869184", "0.57851666", "0.5781028", "0.5764705", "0.57632345", "0.576238", "0.5755911", "0.5755395", "0.57551306", "0.57527107", "0.57454675", "0.57426894", "0.57335013", "0.5731975", "0.57284564", "0.572172", "0.57198125", "0.5713919", "0.5713696", "0.5711249", "0.5696295", "0.5696002", "0.56920004", "0.56850606", "0.5684209", "0.56740904", "0.5670536", "0.56701756", "0.5668302", "0.5656896", "0.5655837", "0.56541926", "0.5652188", "0.5651681", "0.564838", "0.5644766", "0.5644766", "0.56417465", "0.56366944", "0.56339884", "0.5633842", "0.56312996", "0.56308186", "0.56185585", "0.5616847", "0.5616787", "0.5614427", "0.56140673", "0.5612845", "0.5605924", "0.56026196", "0.56023866", "0.55950254", "0.5587394", "0.5582542", "0.55818546", "0.55804724", "0.5579657" ]
0.0
-1
POST /smsloans POST /smsloans.json
def create @smsloan = Smsloan.new(smsloan_params) respond_to do |format| if @smsloan.save format.html { redirect_to @smsloan, notice: 'Smsloan was successfully created.' } format.json { render :show, status: :created, location: @smsloan } else format.html { render :new } format.json { render json: @smsloan.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def smsmark\n http = get_http_connection() \n post_args = { 'ids' => params[:ids], 'name' => @pysmsd_config.app_name, 'password' => @pysmsd_config.app_password }\n request = Net::HTTP::Post.new('/messages/in.json')\n request.set_form_data(post_args)\n resp = http.request(request)\n json = JSON.parse(resp.body)\n render_json :entry => json\n end", "def sms\n send_sms(params)\n respond_to do |format|\n format.json {render :json => {:status => :success }}\n end\n end", "def create\n to = params[:to]\n\n unless to\n raise IOError, \"Incorrect params for sending text message\" \n end\n\n @client = Twilio::REST::Client.new(\n CONFIG[:twilio_account_sid],\n CONFIG[:twilio_auth_token])\n\n @account = @client.account\n @message = @account.sms.messages.create({\n :from => CONFIG[:twilio_phone_number],\n :to => to,\n :body => \"Happy Mining! #{CONFIG[:ios_app_link]}\"}) \n\n rescue => ex\n handle_exception(ex)\n ensure\n respond_to do |format|\n format.json\n end\n end", "def sms\n account_sid = <your account sid>\n auth_token = <your auth token>\n client = Twilio::REST::Client.new(account_sid, auth_token)\n\n client.messages.create(\n from: <twilio number>,\n to: <your number>,\n body: @message\n )\nend", "def create\n @message = Message.new(message_params)\n\n if @message.save\n SharpenAPI.send_sms(@message.message, @message.recipient_numbers)\n redirect_to admin_bat_signal_path, notice: 'Message was successfully sent'\n else\n format.html { render :new }\n format.json do\n render json: @message.errors, status: :unprocessable_entity\n end\n end\n end", "def sms\n \t\n \t#flash[:notice] = params\n \t#redirect_to root_path\n\n TwilioTextMessenger.new( params[:phone], params[:message]).call\n \t\n end", "def send_text(sms, phones)\n phones.each do |phone|\n post_response = Faraday.post do |request|\n request.url \"https://api.twilio.com/2010-04-01/Accounts/#{ACCOUNT_SID}/SMS/Messages.json\"\n request.headers['Authorization'] = \"Basic \" + Base64.strict_encode64(\"#{ACCOUNT_SID}:#{AUTH_TOKEN}\")\n request.body = URI.encode_www_form({'From' => PHONE_NUMBER, 'To' => phone.phone_number, 'Body' => sms.message})\n end\n end\n end", "def smssend\n http = get_http_connection() \n post_args = { 'number' => params[:number], 'text' => params[:text],'replyto' => params[:replyto], 'name' => @pysmsd_config.app_name, 'password' => @pysmsd_config.app_password }\n \n request = Net::HTTP::Post.new('/messages/out.json')\n request.set_form_data(post_args)\n resp = http.request(request)\n json = JSON.parse(resp.body)\n render_json :entry => json\n end", "def sms\n # Give Twilio the TwiML payload instructions\n twiml_payload\n end", "def create \n @message = Message.new({\n incoming: true,\n sid: params['SmsSid'],\n to: params['To'],\n from: params['From'],\n body: params['Body']\n })\n \n respond_to do |format|\n if @message.save\n \n reply = (@message.body.downcase.strip == 'b') ? 'Have a nice day, honey!' : 'Uh oh, we are calling mum...'\n \n response = Twilio::TwiML::Response.new do |r|\n r.Sms reply\n end\n \n Rails.logger.info response.text\n \n user = User.normalise_and_find(params['From'])\n \n if user\n alert = user.alerts.where(:sid => nil).order(\"start asc\").limit(1)\n \n if alert.length == 1\n alert = alert.first\n \n if @message.body.downcase.strip == 'b'\n alert.sid = \"CHECKED\"\n alert.save\n else\n alert.delay.call(alert_url(alert, :format => :xml))\n end\n end\n end\n \n format.xml { render :text => response.text }\n else\n raise \"Can't save!\"\n end\n end\n end", "def twiml\n sms = { from: params[:From],\n to: params[:To],\n body: params[:Body] }\n\n from_user = User.find_by_phone_number(params[:From])\n sms[:from_user_id] = from_user.id if from_user\n to_user = User.find_by_phone_number(params[:To])\n sms[:to_user_id] = to_user.id if to_user\n\n # save the message into the DB\n @sms = Sms.create(sms)\n from_user = @sms.from_user\n\n # response logic\n # if from_user && from_user.response.nil?\n # if sms[:body].downcase.include?(\"yes\")\n # twilio.respond_to_yes(sms[:from])\n # from_user.response = true\n # from_user.save\n # elsif sms[:body].downcase.include?(\"no\")\n # twilio.send_sms(sms[:from], \"Got it. Have a great day!\")\n # from_user.response = false\n # from_user.save\n # end\n # end\n\n # Empty response to Twilio (Do nothing more)\n render xml: Twilio::TwiML::Response.new.text\n end", "def send_sms(to_phone_number, message)\n # message = {to:, from:, body: \"Hello\\n\\nWorld\"}\n # binding.pry\n @@client.messages.create(\n from: @@from,\n to: to_phone_number,\n body: message\n )\n end", "def huzzah\n # ===========================================================================\n # 6. Send an SMS Message to 415-555-1212\n # uses a HTTP POST, and a new variable t for the information (because it needs \"Body\")\n \n account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)\n \n t = {\n 'From' => CALLER_ID,\n 'To' => phone,\n 'Body' => message\n }\n resp = account.request(\"/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages\",\n \"POST\", t)\n end", "def create\n @smsno = Smsno.new(smsno_params)\n\n respond_to do |format|\n if @smsno.save\n format.html { redirect_to @smsno, notice: 'Smsno was successfully created.' }\n format.json { render :show, status: :created, location: @smsno }\n else\n format.html { render :new }\n format.json { render json: @smsno.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sm = Sm.new(params[:sm])\n\n respond_to do |format|\n if @sm.save\n SmsMailer.send_sms(@sm).deliver\n format.html { redirect_to @sm, notice: \"SMS Sent successfully to #{@sm.number}.\" }\n format.json { render json: @sm, status: :created, location: @sm }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sm.errors, status: :unprocessable_entity }\n end\n end\n end", "def sms\n account_sid = params[:AccountSid]\n body = params[:Body]\n from = params[:From]\n from_zip = params[:FromZip]\n if from && body && # account_sid == TWILIO_ACCOUNT_SID\n # sms = TwilioNet.new()\n # sms.send_sms('2146680255', truncate(\"FROM:#{from} BODY:#{body}\", :length => 159) )\n # render :layout => 'empty', :template => 'public/sms' \n creator = User.find_or_create_by_sms_number(from)\n creator.create_task(body)\n unless creator.valid?\n Rails.logger.error creator.message\n sms = TwilioNet.new()\n sms.send_sms(from, truncate(creator.message, :length => 159) )\n end\n render :text => \"Task created.\" \n else\n raise error \n end \n rescue\n render :text => \"Invalid Params #{params.inspect}\"\n end", "def create\n @sms = Sms.new(params[:sms])\n\n respond_to do |format|\n if @sms.save\n flash[:notice] = 'Sms was successfully created.'\n format.html { redirect_to(@sms) }\n format.xml { render :xml => @sms, :status => :created, :location => @sms }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sms.errors, :status => :unprocessable_entity }\n end\n end\n end", "def twilio\n @number = params[:phone_number]\n \n #Text message info\n t = {\n \n 'From' => CALLER_ID,\n 'To' => @number,\n 'Body' => (\"Visit uhpartments.com when you walk through an apartment\")\n }\n\n begin\n account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)\n resp = account.request(\"/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages\",\n 'POST',\n t)\n resp.error! unless resp.kind_of? Net::HTTPSuccess\n rescue StandardError => bang\n #This area will be called if an error happens with the Twilio API\n flash[:alert] = \"Bad number.\"\n redirect_to({ :action => :home })\n \n return\n end\n\n redirect_to({ :action => :home, :alert => \"SMS sent.\" })\n end", "def create\n #If the POST contains either parameter we know we are dealing with multiple messages to sync\n if (params.has_key?(:total_in_messages) || params.has_key?(:total_out_messages))\n if (params.has_key?(:total_in_messages))\n i = 0\n while i < params[:total_in_messages] do\n message = Message.new()\n phoneNum = params[:in_messages][\"sms\" + i.to_s][:number].gsub(/[^0-9]/i, '')\n phoneNum.slice!(0) if (phoneNum.size != 10)\n message.origin = phoneNum\n message.destination = \"DEVICE\"\n message.timestamp = params[:in_messages][\"sms\" + i.to_s][:timestamp]\n message.message = params[:in_messages][\"sms\" + i.to_s][:message]\n message.user = User.find_by_username(params[:username])\n message.save\n i += 1\n end\n end\n if (params.has_key?(:total_out_messages))\n i = 0\n while i < params[:total_out_messages] do\n message = Message.new()\n phoneNum = params[:out_messages][\"sms\" + i.to_s][:number].gsub(/[^0-9]/i, '')\n phoneNum.slice!(0) if (phoneNum.size != 10)\n message.origin = \"DEVICE\"\n message.destination = phoneNum\n message.timestamp = params[:out_messages][\"sms\" + i.to_s][:timestamp]\n message.message = params[:out_messages][\"sms\" + i.to_s][:message]\n message.user = User.find_by_username(params[:username])\n message.save\n i += 1\n end\n end\n render :json => {:status => \"1\"}, :status => :created\n #Otherwise it's a single message we are syncing\n else\n @message = Message.new()\n phoneNum = params[:origin].gsub(/[^0-9]/i, '')\n phoneNum.slice!(0) if (phoneNum.size != 10)\n @message.origin = phoneNum\n @message.message = params[:message]\n @message.timestamp = params[:timestamp]\n @message.user = User.find_by_username(params[:username])\n @message.destination = params[:destination]\n\n if @message.save\n render :json => {:status => \"1\"}, :status => :created\n else\n render :json => {:status => \"0\"}, :status => :unprocessable_entity\n end\n end\n end", "def send_by_sms\n\t\t# ActionMailer deliverya\n\t\trecipeintNumberRaw = params[:mobile_number].gsub!(/[^0-9]/,'')\n\t\trecipeintNumberFormatted = params[:mobile_number]\n\t\t@listing = Listing.find(params[:listing_id])\n\n\t\tsms_message = 'Click to view the listing on ' + @listing.address_1 + ' ' + @listing.address_2 + ' ' + @listing.city + ' ' + @listing.state + ' ' + listing_url(@listing)\n\n\t\tsms_fu = SMSFu::Client.configure(:delivery => :action_mailer)\n\t\tsms_fu.deliver(recipeintNumberRaw, params[:carrier][0] , sms_message, :from => 'alert@fsbolisting.com')\n\t\treturn_response = { \"status\" => \"ok\", \"number\" => recipeintNumberFormatted }\n\t\trender :json => return_response.to_json, :callback => params[:callback]\n\n\tend", "def index\n @smsloans = Smsloan.all\n end", "def create\n #ClickATell posts this\n #Parameters:\n #\"api_id\"=>\"3306957\"\n #\"from\"=>\"886975395038\"\n #\"to\"=>\"41798070085\"\n #\"timestamp\"=>\"2011-09-19 13:02:52\"\n #\"text\"=>\"Test of SMS 2\"\n #\"charset\"=>\"ISO-8859-1\"\n #\"udh\"=>\"\"\n #\"moMsgId\"=>\"3e644dd7c1df98671fe41d26dfd73672\"\n\n @momsg = Momsg.new(:from => params[:from], :text => params[:text])\n \n @momsg.save\n\n respond_to do |format|\n format.html { redirect_to @momsg }\n end\n end", "def create\n @smsuser = Smsuser.new(smsuser_params)\n\n respond_to do |format|\n if @smsuser.save\n format.html { redirect_to @smsuser, notice: 'Smsuser was successfully created.' }\n format.json { render :show, status: :created, location: @smsuser }\n else\n format.html { render :new }\n format.json { render json: @smsuser.errors, status: :unprocessable_entity }\n end\n end\n end", "def sms_send_post_with_http_info(sms_messages, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SMSApi.sms_send_post ...'\n end\n # verify the required parameter 'sms_messages' is set\n if @api_client.config.client_side_validation && sms_messages.nil?\n fail ArgumentError, \"Missing the required parameter 'sms_messages' when calling SMSApi.sms_send_post\"\n end\n # resource path\n local_var_path = '/sms/send'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(sms_messages)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SMSApi#sms_send_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def send_sms (text, receiver, logger) \r\n sms = Skuby::Gateway.send_sms text, receiver\r\n\r\n if sms.success? \r\n response = { status: sms.status, \r\n text: text, \r\n receiver: receiver, \r\n remaining_sms: sms.remaining_sms\r\n }\r\n response.merge! sms_id: sms.sms_id if sms.sms_id?\r\n\r\n logger.debug \"SMS SENT: #{response.to_s}\"\r\n\r\n else\r\n response = { status: sms.status, \r\n error_code: sms.error_code, \r\n error_message: sms.error_message, \r\n text: text, \r\n receiver: receiver\r\n }\r\n response.merge! sms_id: sms.sms_id if sms.sms_id?\r\n\r\n logger.error \"SMS SENT: #{response.to_s}\" \r\n end\r\n\r\n sms.success?\r\nend", "def create\n # create an incoming sms object\n sms = Sms::Message.create(:from => params[:sms_test][:from], :body => params[:sms_test][:body], :mission => current_mission)\n\n # submit it to the handle method over in the SmsController and get the reply\n reply = SmsController.handle_sms(sms)\n\n # save the reply and let the sent_at default to now\n reply.save if reply\n\n # render the body of the reply\n render :text => reply ? reply.body : \"<em>#{t('sms_console.no_reply')}</em>\".html_safe\n end", "def create\n\n begin\n\n text = params[\"Content\"]\n\n if !text.downcase.start_with?(\"test\")\n mobile = params[\"MSISDN\"]\n if !mobile.start_with?(\"+\")\n mobile = \"+#{mobile}\"\n end\n\n service = SmsService.new\n\n @message = SmsService.handle_sms_sending(text, mobile)\n\n render text: 'success', status: 200\n else\n if Rails.env == \"production\"\n msg = text.split(\" \")[1]\n HTTParty.post(ENV['DEVELOPEMENT_SERVER_URL'], :query => { \"Content\" => msg, \"MSISDN\" => params[\"MSISDN\"] })\n end\n render text: 'success', status: 200\n end\n rescue => error\n respond_to do |format|\n format.all { render json: (@message.errors if !@message.nil?), status: :unprocessable_entity }\n end\n end\n end", "def post(content)\n post_to(\"/api/v1/messages/\", {:body => content})\n end", "def receive_sms\n @view = \"sms\"\n @body = params[\"Body\"]\n @phone_number = params[\"From\"]\n set_user_create_message_parse_and_point\n end", "def sms\n @response, @documents = get_solr_response_for_field_values(SolrDocument.unique_key,params[:id])\n if request.post?\n url_gen_params = {:host => request.host_with_port, :protocol => request.protocol}\n tinyPass = request.protocol + request.host_with_port + catalog_path(params['id'])\n tiny = tiny_url(tinyPass)\n if params[:to]\n phone_num = params[:to].gsub(/[^\\d]/, '')\n unless params[:carrier].blank?\n if phone_num.length != 10\n flash[:error] = I18n.t('blacklight.sms.errors.to.invalid', :to => params[:to])\n else\n email = RecordMailer.sms_record(@documents, {:to => phone_num, :carrier => params[:carrier], :callnumber => params[:callnumber], :location => params[:location], :tiny => tiny}, url_gen_params)\n end\n\n else\n flash[:error] = I18n.t('blacklight.sms.errors.carrier.blank')\n end\n else\n flash[:error] = I18n.t('blacklight.sms.errors.to.blank')\n end\n\n unless flash[:error]\n email.deliver\n flash[:success] = \"Text sent\"\n redirect_to catalog_path(params['id']) unless request.xhr?\n end\n end\n unless !request.xhr? && flash[:success]\n respond_to do |format|\n format.js { render :layout => false }\n format.html\n end\n end\n end", "def add_snack\n response = RestClient.post SNACKS_URL, {name: @suggestion.name, location: @suggestion.location}.to_json, content_type: :json\n logger.debug \"web service response code => #{response.code}\"\n if response.code != 200\n flash[:notice] = \"Error: #{response.code} while communicating with services, please try again later.\"\n end\n parsed = JSON.parse(response) \n end", "def create\n @sms_based = SmsBased.new(sms_based_params)\n\n respond_to do |format|\n if @sms_based.save\n format.html { redirect_to admin_services_path, notice: 'successfully created.' }\n format.json { render action: 'show', status: :created, location: @sms_based }\n else\n format.html { redirect_to admin_services_path, notice: 'Failed.' }\n format.json { render json: @sms_based.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @message = current_user.messages.build(params[:message])\n if @message.save\n \n \n @account_sid = 'ACdb43c99b5deb7d4ed12083140f41bab3'\n @auth_token = '11dbb8cbba9b004652469aa77e51183c'\n\n # set up a client to talk to the Twilio REST API\n @client = Twilio::REST::Client.new(@account_sid, @auth_token)\n ha = HashWithIndifferentAccess.new(params[:message])\n mssg = ha['content']\n\n friends = {\n \"+14159006499\" => \"Jered\",\n \"+11111111111\" => \"Chris\",\n \"+11111111111\" => \"Kathryn\"}\n\n @account = @client.account\n @message = @account.sms.messages.create({:to => '+14159006499', :from => '+18319204556', :body => mssg})\n puts @message\n flash[:success] = \"Message created!\"\n redirect_to 'http://www.bugl.co/acknowledge.html'\n\n else\n @feed_items = []\n render 'static_pages/home'\n end\n \n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n \n format.json { render json: @message, status: :created, location: @message }\n else\n \n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sms_send = SmsSend.new(sms_send_params)\n\n respond_to do |format|\n if @sms_send.save\n format.html { redirect_to @sms_send, notice: 'Sms send was successfully created.' }\n format.json { render :show, status: :created, location: @sms_send }\n else\n format.html { render :new }\n format.json { render json: @sms_send.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_sms(sms) \n s = SMS.new\n s.subscriber_id = @subscriber_id\n s.subscriber_password = @subscriber_password\n s.remote_host = @remote_host if @remote_host\n s.msg_pin = sms.recipients\n s.setSourceAddr(SMS::ADDR_TYPE_NETWORK, sms.from)\n s.msg_text = sms.body\n raise StandardError.new(\"SMS Body over 140 characters, body = \\n#{sms.body}\") if sms.body.size > 140\n s\n end", "def send_joke\r\n client = Twilio::REST::Client.new Rails.application.secrets.twilio_account_sid, Rails.application.secrets.twilio_auth_token\r\n message = client.messages.create from: '347-933-6917', to: params[:phone_number], body: Joke.pick_joke\r\n redirect_to :back\r\n end", "def create\n @message = Message.new(params[:message])\n @message.sender = \"cmu3071\" #THIS NEEDS TO BE CHANGED WHEN OAF RECEIVES THEIR OWN SHORTCODE\n @message.time = Time.now\n \n body = @message.body\n phones = Message.split_numbers(@message.recipient)\n\n phones.each do |ph|\n phone = Message.reformat_phone(ph)\n puts \"PHONE: #{phone}\"\n url = Message.text_to(phone,body)\n puts \"URL: #{url}\"\n newUrl = URI.parse(URI.encode(url.strip))\n http = Net::HTTP.new(newUrl.host,443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n @data = http.get(newUrl.request_uri)\n puts \"STATUS: #{@data.code}\"\n puts \"BODY: #{@data.body}\"\n puts \"RESPONSE: #{@data}\"\n end\n \n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @short_message = ShortMessage.new(short_message_params)\n\n client = GlobeLabs.new\n target = @short_message.target\n if target.present?\n resp = client.send_sms(@short_message)\n Rails.logger.info(\"=== savon client resp: #{resp.inspect}\")\n end\n\n recepients = params[:recepients]\n Rails.logger.info(\"==== params:#{params.inspect}\")\n if recepients.present?\n Rails.logger.info(\"==== params:#{params[:recepients].inspect}\")\n recepients.each do |cell_no|\n @short_message = ShortMessage.new(short_message_params)\n @short_message.target = cell_no\n if @short_message.save\n resp = client.send_sms(@short_message)\n Rails.logger.info(\"=== savon client resp: #{resp.inspect}\")\n end\n end\n end\n\n respond_to do |format|\n if @short_message.save\n format.html { redirect_to short_messages_path, notice: 'Short message was successfully created.' }\n format.json { render action: 'show', status: :created, location: @short_message }\n else\n format.html { render action: 'new' }\n format.json { render json: @short_message.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_sms(fromNumber)\n begin\n bodyParams = {\n from: { phoneNumber: fromNumber },\n to: [{ phoneNumber: RECIPIENT }],\n # To send group messaging, add more (max 10 recipients) 'phoneNumber' object. E.g.\n #\n #to: [\n # { phoneNumber: RECIPIENT },\n # { phoneNumber: 'Recipient-Phone-Number' }\n # ],\n text: 'Hello World!'\n }\n endpoint = \"/restapi/v1.0/account/~/extension/~/sms\"\n resp = $platform.post(endpoint, payload: bodyParams)\n puts (\"SMS sent. Message id: \" + resp.body['id'].to_s)\n check_message_status(resp.body['id'])\n rescue StandardError => e\n puts (e)\n end\nend", "def send_sms phone, message\n message = URI.escape message\n response = RestClient.get \"#{sender_base_url}/?from=#{@from}&to=#{phone}&text=#{message}&pass=#{@application_pass}\"\n @response = Response.new response\n end", "def reply # acts as endpoint\n \tmessage_body = params[\"Body\"] # grab params from Twilio's request\n \tfrom_number = params[\"From\"]\n \tboot_twilio\n \tsms = @client.messages.create( # send to inbound number made by end user\n from: Rails.application.secrets.twilio_from_number,\n to: from_number,\n body: \"Hello there, thanks for texting me. Your number is #{from_number}.\"\n \t)\n end", "def create\n @sms_alert = @account.sms_alerts.new\n set_sms_fields\n if @sms_alert.save\n redirect_to account_sms_alerts_url, notice: 'Sms alert was successfully created.'\n else\n render :new \n end\n end", "def new; send_sms; end", "def create\n # {\"ToState\"=>\"IL\", \"FromState\"=>\"AZ\", \"AccountSid\"=>\"AC1afaeecf73a8e05e32c695eac213226c\", \"SmsMessageSid\"=>\"SM8a1e2f65484fa1bd45b6a37d72a145fe\", \"Body\"=>\"youre an idiot sometimes\", \"From\"=>\"+16234556356\", \"FromCity\"=>\"PHOENIX\", \"SmsStatus\"=>\"received\", \"FromZip\"=>\"85065\", \"FromCountry\"=>\"US\", \"To\"=>\"+18152165378\", \"ToCity\"=>\"KANKAKEE\", \"ToZip\"=>\"60914\", \"ToCountry\"=>\"US\", \"ApiVersion\"=>\"2010-04-01\", \"SmsSid\"=>\"SM8a1e2f65484fa1bd45b6a37d72a145fe\"}\n @incoming_text = IncomingText.new(params[:incoming_text])\n\n respond_to do |format|\n if @incoming_text.save\n format.html { redirect_to(@incoming_text, :notice => 'Incoming text was successfully created.') }\n format.xml { render :xml => @incoming_text, :status => :created, :location => @incoming_text }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @incoming_text.errors, :status => :unprocessable_entity }\n end\n end\n end", "def sms_params\n params.permit(:message)\n end", "def sms(body, to: nil, from: nil, method: nil, action: nil, status_callback: nil, **keyword_args)\n append(Sms.new(\n body,\n to: to,\n from: from,\n method: method,\n action: action,\n status_callback: status_callback,\n **keyword_args\n ))\n end", "def create # need the name 'create' to conform with REST defaults, or change routes\n #puts \"**** IncomingController create: params=#{params}\"\n @from = params[:From] # The phone number of the sender\n#debugger\n body = params[:Body] # This is the body of the incoming message\n AppLog.create(:code => \"SMS.incoming\", :description=>\"from=#{@from}; body=#{body[0..50]}\")\n params.delete 'SmsSid'\n params.delete 'AccountSid'\n params.delete 'SmsMessageSid'\n @possible_senders = from_members # all members from this database with matching phone number\n @sender = @possible_senders.first # choose one of them\n if @sender # We only accept SMS from registered phone numbers of members\n begin\n AppLog.create(:code => \"SMS.received\", :description=>\"from #{@from} (#{@sender.shorter_name}): #{body}\")\n resp = (process_sms(body) || '')[0..159] # generate response\n AppLog.create(:code => \"SMS.reply\", :description=>\"to #{@from}: #{resp}\")\n# default_sms_gateway.deliver(@from, resp) #default_gateway in messages_helper creates an instance of gateway specified \n# # in SiteSettings default_outgoing_sms_gateway\n render :text => resp, :status => 200, :content_type => Mime::TEXT.to_s # Confirm w incoming gateway that msg received\n# rescue\n# AppLog.create(:code => \"SMS.system_error\", :description=>\"on SMS#create: #{$!}, #{$!.backtrace[0..2]}\")\n# render :text => \"Internal\", :status => 500, :content_type => Mime::TEXT.to_s\n# ClickatellGateway.new.deliver(@from, \"Sorry, there is a bug in my system and I crashed :-(\" )\n end\n else \n AppLog.create(:code => \"SMS.rejected\", :description=>\"from #{@from}: #{body}\")\n render :text => \"Refused: sender's phone number is not recognized\", \n :status => 403, :content_type => Mime::TEXT.to_s\n end\n end", "def create\n # parse phone number and save it in the correct format\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n # render text: \"Thank you! You will receive an SMS shortly with verification instructions.\"\n\n\n # Instantiate a Twilio client\n @client = Twilio::REST::Client.new(TWILIO_CONFIG['sid'], TWILIO_CONFIG['token'])\n \n # Create and send an SMS message\n @client.account.sms.messages.create(\n from: TWILIO_CONFIG['from'],\n to: @user.phone,\n body: \"Thanks for signing up. To verify your account, please reply 'yes' to this message.\"\n # mediaurl: \"http://s3.amazonaws.com/simpleupc/images/full/3bdc2416fbb17d90.jpg\"\n )\n\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\n @sms_retrieval = SmsRetrieval.new(sms_retrieval_params)\n\n respond_to do |format|\n if @sms_retrieval.save\n format.html { redirect_to @sms_retrieval, notice: 'Sms retrieval was successfully created.' }\n format.json { render :show, status: :created, location: @sms_retrieval }\n else\n format.html { render :new }\n format.json { render json: @sms_retrieval.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n twilio_sid = \"AC87d4a655d1b7f6251393db346fd69d46\"\n twilio_token = \"3a1d3e17645ced5700606682a613485d\"\n twilio_phone_number = \"2678677556\"\n \n @twilio_client = Twilio::REST::Client.new twilio_sid, twilio_token\n \n @twilio_client.account.sms.messages.create(\n :from => \"+1#{twilio_phone_number}\",\n :to => '+919042755963',\n :body => \"This is sakthi local app\"\n )\n @employee = Employee.new(employee_params)\n \n p @employee\n p \"---------------------\"\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def twilio_sms\n sms = {\n :sid => params[:SmsSid], \n :from => params[:From],\n :to => params[:To],\n :body => params[:Body],\n #:status => params[:SmsStatus], # this will be used later for confirmation with Twilio \n }\n @txt = Txt.new(sms) \n \n @status_report = TWILIO_CONFIG[\"base_url\"].to_s + '/home/twilio_status'\n\n #@txt.twilio_reply_sms\n\n respond_to do |format|\n if @txt.save and @txt.match_coupon?(sms)\n flash[:notice] = 'Message was successfully received.' \n format.xml { @txt }\n else\n flash[:notice] = 'Delivery failed.' \n format.xml { @txt }\n end\n end\n\n end", "def create\n account_sid = 'AC14aa346613c89fec467663aad46c05a2'\n auth_token = '0e43d0a04e110f7faa2692e388b0c7f5'\n \n client = Twilio::REST::Client.new(account_sid, auth_token)\n\n @city = params[:FromCity].capitalize\n @state = params[:FromState]\n\n render 'process_sms.xml.erb', :content_type => 'text/xml'\n end", "def sms\n reply = TwilioService.new.process_inbound_sms(params)\n render_twiml_message(reply) if reply\n end", "def sms_send_post(sms_messages, opts = {})\n data, _status_code, _headers = sms_send_post_with_http_info(sms_messages, opts)\n data\n end", "def sms\n account_sid = params[:AccountSid]\n body = params[:Body]\n from = params[:From]\n from_zip = params[:FromZip]\n if from && body && # account_sid == TWILIO_ACCOUNT_SID \n sms = TwilioNet.new()\n sms.send_sms('2146680255', truncate(\"FROM:#{from} BODY:#{body}\", :length => 159) )\n render :layout => 'empty', :template => 'public/sms' \n else\n raise error \n end \n rescue\n render :text => \"Invalid Params #{params.inspect}\"\n end", "def post( text )\n message = {\n 'time' => Time.now.strftime('%Y%m%d%H%M%S'),\n 'text' => text\n }\n\n data['plans'][me]['messages'] << message\n end", "def create\n inbound_messages.each(&:save)\n render :nothing => true, :status => 200\n end", "def create\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n recipient_phone = Phone.find_by_number(@message.number)\n \t recipient_phone ||= User.create!.phones.create!(:number => @message.number)\n @message.send_SMS(@message.raw_message, recipient_phone, \"\", @message.app.id)\n format.html { redirect_to messages_path, notice: 'Message was successfully sent.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sms_tmp = SmsTmp.new(params[:sms_tmp])\n\n respond_to do |format|\n if @sms_tmp.save\n format.html { redirect_to \"/home/sms\", notice: '短信模版创建成功.' }\n format.json { render json: @sms_tmp, status: :created, location: @sms_tmp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sms_tmp.errors, status: :unprocessable_entity }\n end\n end\n end", "def call\n account_sid = 'ACe330ba04d082392df4cb3511dcb72cec'\n auth_token = '2008ea097713e401a16c54029058da82'\n\n # set up a client to talk to the Twilio REST API\n @client = Twilio::REST::Client.new account_sid, auth_token\n\n @client.account.messages.create(\n :from => '+18152642023',\n :to => @number,\n :body => 'hahahayolo'\n )\n end", "def sms_price_post_with_http_info(sms_messages, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SMSApi.sms_price_post ...'\n end\n # verify the required parameter 'sms_messages' is set\n if @api_client.config.client_side_validation && sms_messages.nil?\n fail ArgumentError, \"Missing the required parameter 'sms_messages' when calling SMSApi.sms_price_post\"\n end\n # resource path\n local_var_path = '/sms/price'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(sms_messages)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SMSApi#sms_price_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def twilio\n account_sid = ENV[\"TWILIO_SID\"]\n auth_token = ENV['TWILIO_TOKEN']\n client = Twilio::REST::Client.new account_sid, auth_token\n\n from = \"8452633595\"\n\n client.account.messages.create(\n :from => from,\n :to => self.phone,\n :body => \"#{self.title} - #{self.full_desc} ($#{self.price})\"\n )\n puts \"Sent message\"\n end", "def create\n @user = User.new(params[:user])\n\n # RestClient.post(\"http://sms.ru/sms/send\", :api_id => \"9d3359eb-9224-2384-5d06-1118975a2cd2\", :to => \"79051916188\", :text => \"Ваш ID на велопробег #{@user.id}\")\n\n respond_to do |format|\n if @user.save\n\n \n\n format.html { redirect_to edit_user_path(@user), notice: 'Участник успешно создан!' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { redirect_to root_path,\n notice: 'Поздравляем! Вы подали заявку на регистрацию. Для подтверждения регистрации \n необходимо внести взнос.' }\n end\n end\n end", "def create\n @sms_notification = SmsNotification.new(sms_notification_params)\n\n respond_to do |format|\n if @sms_notification.save\n format.html { redirect_to @sms_notification, notice: 'Sms notification was successfully created.' }\n format.json { render :show, status: :created, location: @sms_notification }\n else\n format.html { render :new }\n format.json { render json: @sms_notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_bulk_sms(message)\n client = IronWorkerNG::Client.new\n client.tasks.create('master_email', payload)\n payload = {}\n payload['message'] = message\n client.tasks.create('master_sms', payload)\nend", "def sms(phone_number, **params)\n\n self.post(VERIFY_SMS_RESOURCE,\n phone_number: phone_number,\n **params)\n end", "def send_sms(content, tonumber)\n tonumber = format(tonumber);\n \tbegin\n @client.messages.create({\n \t :from => @from_number,\n \t :to => tonumber,\n \t :body => content,\n })\n rescue Twilio::REST::RequestError => e\n message = I18n.t(\"errors.sms_not_sent\")\n rescue NoMethodError => e\n message = I18n.t(\"errors.sms_not_sent\")\n else\n message = I18n.t(\"notice.success\")\n end\n\n return message\n\n end", "def send_message\n response = RestClient::Request.new(\n :method => :post,\n :url => \"https://api.twilio.com/2010-04-01/Accounts/#{ENV['TWILIO_ACCOUNT_SID']}/Messages.json\",\n :user => ENV['TWILIO_ACCOUNT_SID'],\n :password => ENV['TWILIO_AUTH_TOKEN'],\n :payload => { :Body => body,\n :To => Contact.find(self.contact_id).number,\n :From => ENV['USER_NUMBER'] }\n ).execute\n end", "def new\n @sms_tmp = SmsTmp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sms_tmp }\n end\n end", "def sendMessages\n account_sid = 'ACcadef504f050d32a61aa43b3f3d939da'\n auth_token = ENV['TWILIO_AUTH']\n client = Twilio::REST::Client.new account_sid, auth_token\n\n from = '+14159664302'\n\n participants = {}\n\n self.persons.each do |person|\n participants[\"+1#{person.phone_number}\"] = {name: person.name, password: person.password}\n end\n\n # Example:\n # friends = {\n # '+19255863672' => 'Edgar Barajas'\n # }\n\n participants.each do |key, value|\n client.messages.create(\n from: from,\n to: key,\n body: \"Hey #{value[:name]}, welcome to Secret Santa!\\nVisit http://secret-santa-plus.herokuapp.com/family/#{self.id} to reveal the person you'll be buying a gift for this year, and to fill out your gift suggestions form!\\n\\nYour password is: #{value[:password]}\\n\\nHappy Holidays! :)\"\n )\n end\n end", "def receive_sms\n uninitialize_sms\n body = params[:Body]\n phone_number = normalize_phone params[:From].strip\n @problem_text = body.split\n action = sms_parsing(body).downcase\n if action == \"join\"\n sms_create_account\n return\n elsif Account.find_by_phone_number(phone_number) == nil\n sms_send(params[:From], \"Please first create an account by texting the word 'join'.\")\n return\n end\n if !@sms_error\n case action\n when /^add$/,/^insert$/\n sms_create\n when /^accept$/\n sms_accept_problem\n when /^get$/\n @offset = false\n sms_get(0)\n when /^edit$/\n sms_edit\n when /^delete$/, /^destroy$/\n sms_delete\n when /^next$/\n offset = session[\"offset\"]\n if offset == nil\n sms_error(\"Sorry, there is no saved session right now. Please first text \\\"GET\\\" with @location !skill %number of texts you want to allow.\")\n else\n @offset = true\n sms_get(offset)\n end\n when /^detail$/, /^details$/, /^describe$/\n sms_detail\n when /^account$/\n forgot_acc\n when /^change$/\n sms_change_password\n when /^password$/\n forgot_password\n# when /^skill$/, /^skills$/\n# sms_skill\n when /^keywords$/, /^key$/, /^keys$/, /^help$/\n sms_keywords\n when /^explain$/\n sms_explain\n else\n if is_num?(action)\n session[:received_confirmation] = action\n sms_confirm_acc\n else\n sms_wrong_keyword\n end\n end\n end\n render :nothing => true\n end", "def set_smsloan\n @smsloan = Smsloan.find(params[:id])\n end", "def create\n @v1_message = V1::Message.new( message_params.except(:employee_ids) )\n\n if message_params[:employee_ids] === 'all'\n\n # If :employee_ids param is 'all', send to the whole company's mobile directory\n @v1_message.employee_ids = @v1_message.company.employee_ids\n else\n\n # :employees_ids is a string list of ids ('1,2,3'), convert it into an array\n @v1_message.employee_ids = message_params[:employee_ids].split(\",\").map { |s| s.to_i }\n end\n\n if @v1_message.save\n send_sms_messages\n render json: @v1_message, status: :created, location: @v1_message\n else\n render json: @v1_message.errors, status: :unprocessable_entity\n end\n end", "def create\n @early_warning_report = EarlyWarningReport.new(early_warning_report_params)\n @early_warning_report.sms_status = 'Sending'\n recievers = early_warning_report_params['recieviers']\n level = early_warning_report_params['level']\n respond_to do |format|\n if @early_warning_report.save\n send_sms(recievers,level)\n\n format.html { redirect_to @early_warning_report, notice: 'Early warning report was successfully created and SMS sent' }\n format.json { render :show, status: :created, location: @early_warning_report }\n else\n format.html { render :new }\n format.json { render json: @early_warning_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @message = Message.new(message_params)\n if @message.save\n @message.action = 'SEND'\n @message.save\n\n # Send SMS text\n boot_twilio\n sms = @client.messages.create(\n body: @message.text,\n from: Rails.application.secrets.twilio_number,\n to: @message.number,\n )\n redirect_to @message, alert: \"SMS Text sent.\"\n else\n render 'new'\n end\n end", "def smsloan_params\n params.require(:smsloan).permit(:bank, :min_loanamoun, :max_loanamoun, :mobile_friendly_site, :smsloan_payment_note, :smsloan_min_age, :cost_free_loan, :new_borrower_5K, :new_borrower_10K, :no_uc, :skef_member, :bankid, :open_on_saturdays, :weblink)\n end", "def send_sms(cmatch, tstamp, number, expiration)\n\n # Primary provider\n #\n nexmo_reponse = begin\n nexmo = Nexmo::Client.new('371f3e5d', 'e3218b70')\n token_url = create_token_url(cmatch, tstamp)\n record_token(cmatch, tstamp, expiration)\n sms_primary_response = nexmo.send_message({\n from: '13059298586',\n to: number,\n text: cmatch\n })\n json :sms_status => \"sent\",\n :token => cmatch,\n :token_url => token_url,\n :phone_number => number,\n :token_generated => tstamp,\n :token_expires => tstamp + expiration\n rescue\n send_sms_twilio(cmatch, tstamp, number, expiration)\n end\nend", "def create\n @msg = \"短信发送失败\"\n\n sms = SmsSend.where(\"TIMESTAMPDIFF(MINUTE,created_at ,now())<#{Const::SMS_TIME_LIMIT} and sms_type='code' and recv_num =? and state='00A'\", sms_send_params[:recv_num]).first\n \n unless sms.blank?\n @msg = \"#{Const::SMS_TIME_LIMIT}分钟内不用重新发送\"\n return render json: {status: :created, msg: @msg, retcode: '101'}\n end \n\n #历史数据 变更状态位 \n SmsSend.where(\"recv_num =?\",sms_send_params[:recv_num]).update_all(state: \"00X\")\n\n @sms_send = SmsSend.new(sms_send_params)\n @sms_send.sms_type='code'\n\n send_content = rand(1001..9999) \n @sms_send.send_content = send_content \n\t\n\tinfo = ConfigInfo[\"smsconfiginfo\"]\n respond_to do |format|\n if @sms_send.save\n add = \"#{info[\"SMS_SEND_URL\"]}\"\n logger.debug \"48 #{add}\"\n uri = URI.parse(add)\n http = Net::HTTP.new(uri.host)\n request = Net::HTTP::Post.new(uri.request_uri)\n tpl_val = URI.encode(\"#code#\") + \"=\" + URI.encode(\"#{send_content}\");\n data = {apikey:info[\"SMS_SEND_API_KEY\"], \n mobile:sms_send_params[:recv_num],\n tpl_id:info[\"TPL_ID\"],\n tpl_value:tpl_val\n }\n request.set_form_data(data)\n #request['Content-Type'] = 'application/json;charset=utf-8'\n #request['User-Agent'] = 'Mozilla/5.0 (Windows NT 5.1; rv:29.0) Gecko/20100101 Firefox/29.0'\n #request.body = params.to_json\n response = http.start { |http| http.request(request) }\n # puts response.body.inspect\n # puts JSON.parse response.body\n\n\n @msg = \"短信发送成功\"\n return render json: {status: :created, msg: @msg, retcode: \"200\"} \n else\n return render json: {status: :created, msg: @msg, retcode: \"102\"}\n end\n end\n end", "def new_sms_updates(content, tonumber)\n\t@client.messages.list.each do |message|\n\tRails.logger.debug(message.body)\n\tend\n end", "def send(p)\n options = {} \n\n p.each do |k,v|\n\n case k\n when :reply_path\n # Automatically request delivery receipt if reply path is set\n options[sym_to_param(:confirm_delivery)] = 'on'\n options[sym_to_param(k)] = v\n when :scheduled_for\n # Set timestamp correctly for :scheduled_for\n options[sym_to_param(k)] = v.strftime('%Y%m%d%H%M%S')\n else\n options[sym_to_param(k)] = v\n end\n\n end\n\n res = self.class.post('/submit_sm', :basic_auth => @auth, :body => JSON.dump(options))\n\n responses = []\n res['sms'].each do |r|\n responses << Dialogue::Toolkit::Sms::Response.new(r)\n end\n\n responses\n end", "def sms_inbound_post(url, opts = {})\n data, _status_code, _headers = sms_inbound_post_with_http_info(url, opts)\n data\n end", "def incoming \n response.headers[\"Content-Type\"] = \"text/plain; charset=utf-8\"\n #Read params from the text message\n \n if (params[:uid] && params[:body])\n @userid = params[:uid]\n @body = params[:body] \n \n sms = Sms.new(:raw => @body, :login => @userid)\n \n sms.parse\n \n user = User.find_by_login(sms.login)\n \n if user.nil?\n render :text => \"User #{sms.login} couldn't be found, have you signed up at #{AZIMUTH_DOMAIN}?\" \n else\n hunt = user.hunt\n if hunt.nil?\n render :text => \"User #{sms.login} doesn't appear to have signed up for a hunt. Please sign up for one at #{AZIMUTH_DOMAIN}.\"\n else\n if hunt.aasm_current_state == :hunting\n discovery = Discovery.new(:treasure => user.current_treasure, :key => sms.key, :lat => sms.lat, :lng => sms.lng, :hunt => hunt, :user => user)\n hunt.attempt_open_treasure_chest(discovery, user)\n user.save!\n hunt.save!\n discovery.save!\n \n if discovery.success?\n render :text => \"\" # don't send extra texts since the hunt will do it for us...\n else\n render :text => \"What you texted didn't open the treasure chest :-(. Coords: #{sms.lat} #{sms.lng}. Key: #{sms.key}\"\n end\n else\n render :text => \"The hunt #{hunt.name} is currently in #{hunt.state.humanize} state. Please wait for the hounds to be released to get your first clue.\"\n end\n end\n end\n else\n render :text => \"\"\n end\n \n end", "def deliver(sms)\n create_sms(sms).submit()\n end", "def send_booking_sms(lesson, booking)\n @client = Twilio::REST::Client.new\n @client.messages.create(\n from: ENV[\"TWILIO_PHONE_NUMBER\"],\n to: lesson.user.phone_number,\n body: \"#{booking.user.username} has booked your '#{lesson.listing_name}. Log into teachmyclass.me for more details.\"\n )\n end", "def create\n @sys_msgs_timeline = SysMsgsTimeline.new(sys_msgs_timeline_params)\n\n respond_to do |format|\n if @sys_msgs_timeline.save\n format.json { render json:{status: :created, location: @sys_msgs_timeline }}\n else\n format.json { render json: @sys_msgs_timeline.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_shortcode_listsms(options = {})\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/shortcode/listsms.json'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare form parameters.\r\n _parameters = {\r\n 'Shortcode' => options['shortcode'],\r\n 'To' => options['to'],\r\n 'DateSent' => options['date_sent'],\r\n 'Page' => options['page'],\r\n 'PageSize' => options['page_size']\r\n }\r\n _parameters = APIHelper.form_encode_parameters(_parameters)\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n parameters: _parameters\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end", "def send_twilio_mms\n # Get your Account Sid and Auth Token from twilio.com/user/account\n\n account_sid = 'add your account sid'\n auth_token = 'add your auth token'\n\n # set up a client to talk to the Twilio REST API\n client = Twilio::REST::Client.new account_sid, auth_token\n\n\n mms_message_body = \"name:#{self.contact.name}\"\n mms_message_body += \"\" #quick way to create spacing inbetween txt lines\n mms_message_body += \"phone: #{self.contact.phone_number}\"\n mms_message_body += \"\" #quick way to create spacing inbetween txt lines\n mms_message_body += \"#{self.message}\"\n end", "def create\n @user = current_user\n @reading = Reading.new(reading_params)\n\n respond_to do |format|\n if @reading.save\n format.html { redirect_to user_readings_path, notice: 'Reading was successfully created.' }\n format.json { render :show, status: :created, location: @reading }\n if @reading.systolic > current_user.systolic_range.high || @reading.diastolic < current_user.systolic_range.low\n # Get your Account Sid and Auth Token from twilio.com/user/account\n account_sid = 'AC63de569ccbfd715bed71f1bd6d884215'\n auth_token = '447c2138b017c4bf199553496fab3554'\n @client = Twilio::REST::Client.new account_sid, auth_token\n \n message = @client.account.messages.create(:body => \"#{current_user.firstname} #{current_user.lastname}'s blood pressure is outside of normal range\",\n :to => current_user.guardian_phone_number, \n :from => current_user.phone_number)\n puts message.to\n end\n else\n format.html { render :new }\n format.json { render json: @reading.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n # @phone = Phone.new\n\n @phone = Phone.new\n\n\n # uri = \"#{API_BASE_URL}.json?pages=10\" # specifying json format in the URl\n # rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n # users = rest_resource.get\n # @users = JSON.parse(users, :symbolize_names => true) # we will convert the return\n\n @user = User.new\n if @user.id?\n @user = User.last\n\n redirect_to \"/apps/texty/verify\"\n elsif !@user.id?\n\n @user.id = params[:user_id]\n session[:user] = params[:user_id]\n @phone.user_id = params[:user_id]\n @user.save\n uri2 = \"#{API_BASE_URL2}#{@user.id}.json\" # specifying json format in the URl\n rest_resource = RestClient::Resource.new(uri2, USERNAME, PASSWORD)\n user = rest_resource.get\n @user = JSON.parse(user, :symbolize_names => true) # we will convert the return\n\n end\n\n @phone.number = @user[:custom][:telephone]\n\n if !Phone.exists?(@phone.vercode)\n @phone.vercode = rand(10000..100000).to_s\n @phone.save\n @phone.send_sms(@phone.number,@phone.vercode)\n\n redirect_to \"/apps/texty/verify\"\n\n else\n redirect_to \"https://instantsignup.pixfizz.com/site\"\n\n end\n\n end", "def sendSMS(to, body = \"No body was send for this message.\", media = nil)\n\naccount_sid = $accountsid\nauth_token = $authtoken\n@client = Twilio::REST::Client.new(account_sid, auth_token)\n\nif media\n message = @client.messages.create(\n body: body,\n from: $phone,\n media_url: [media],\n to: to\n)\nelse\n message = @client.messages.create(\n body: body,\n from: $phone,\n to: to\n)\nend\nreturn message.sid\nend", "def send\n inf = params.permit(:to, :from, :time, :priority, :message, :til)\n message = Message.new\n message.user = current_user\n message.entered = DateTime.now.in_time_zone\n message.year = DateTime.now.in_time_zone.year\n\n message.to = inf[:to]\n message.from = inf[:from]\n message.message_time = inf[:time]\n message.priority = inf[:priority]\n message.message = inf[:message]\n message.til = inf[:til]\n\n unless message.save\n render json: {message: @message.errors}.to_json, \\\n status: :unprocessable_entity\n end\n\n render json: {message: 'Success'}.to_json, status: 200\n end", "def send_message(number_arr,message)\n # put your own credentials here\n #number_arr, my_message\n\n account_sid = ENV[\"twilio_account_sid\"]\n auth_token = ENV[\"twilio_auth_token\"]\n # set up a client to talk to the Twilio REST API\n @client = Twilio::REST::Client.new account_sid, auth_token\n\n\n number_arr.each do |number|\n begin\n @client.api.account.messages.create(\n from: '+12892761834',\n to: number,\n body: message\n )\n rescue => err\n puts \"********************send msg error********************\"\n puts err.message\n puts \"********************send msg error********************\"\n end\n\n end\n\n end", "def create\n @shout = Shout.new(params[:shout])\n\n sendPush (@shout.name + ' just shouted ' + @shout.shout_message)\n \n respond_to do |format|\n if @shout.save\n format.html { redirect_to(@shout, :notice => 'Shout was successfully created.') }\n format.xml { render :xml => @shout, :status => :created, :location => @shout }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @shout.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n phone_number = params[:phone_number]\n\n response = Faraday.get \"#{BASE_URL}/api/v1/getMessages/#{phone_number}\", nil, {'Authorization': \"Bearer \"}\n\n @data = {\n phone_number: phone_number\n }\n\n if response.status === 200\n response_body = JSON.parse(response.body)\n @data[:messages] = response_body['messages']['items']\n end\n\n render json: @data\n end", "def post_routing_sms_phonenumbers_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutingApi.post_routing_sms_phonenumbers ...\"\n end\n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling RoutingApi.post_routing_sms_phonenumbers\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/routing/sms/phonenumbers\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SmsPhoneNumber')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutingApi#post_routing_sms_phonenumbers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def createLoanRequest\n puts 'GOT REQUEST'\n puts params.inspect\n\n # Persist to the database for some reason\n req = LoanRequest.new\n req.ssn = params[:ssn]\n req.creditScore = params[:creditScore]\n req.loanAmount = params[:loanAmount]\n req.loanDuration = params[:loanDuration]\n req.save\n\n reply_to = request.headers['HTTP_REPLY_TO']\n\n #TODO: Get a job in a bank and find out how this are calculated\n randomInterestRate = randomInterest(1, 5).round(2)\n\n result = {\n interestRate: randomInterestRate,\n ssn: req.ssn\n }\n\n conn = Bunny.new\n conn.start\n ch = conn.create_channel\n q = ch.queue(reply_to)\n\n ch.default_exchange.publish(result.to_json, routing_key: q.name)\n\n render :json => result.to_json\n end", "def create\n @user = User.new(user_params)\n\n @user.verified = false\n\n password = give_me_pengin_password\n @user.password = password\n @user.password_confirmation = password\n\n respond_to do |format|\n if @user.save\n\n #send sms with our own password\n send_message(\"Greetings from PengIn! Your password is \" + password, @user)\n\n format.json { render :json => {:success=>true, :message=>\"User was successfully created.\", :id=>@user.id} }\n # TODO: dupa ce creez userul ar trebui sa il si loghez - sa ii dau un token ca raspuns aici la sign up\n # in the Pengin mobile app, use the id passed in the json response to the sign up to identify which user you are verifying the sms\n else\n format.json { render :json => {:success=>false, :message=>\"Failed to create user.\"} }\n end\n end\n end", "def mailman\n a = RestClient.post \"https://api:03ee8a853e31d8648cf06b82f7c30dcb-3d0809fb-3486193e\" \\\n\t \"@api.mailgun.net/v3/sandbox023900a156f3425e819b872335392423.mailgun.org/messages\",\n :from => \"MPPP MAILER BOT <yannick.mvondo@paiemequick.com>\",\n :to => \"mvondoyannick@gmail.com\",\n :subject => \"Hello\",\n :text => params[:lorem]\n\n if a.code == 200\n redirect_to dashboard_path, notice: \"Mail sended\"\n else\n redirect_to dashboard_path, notice: \"Impossible to send mail\"\n end\n end", "def create\n @minimessage = Minimessage.new(params[:minimessage])\n\n respond_to do |format|\n if @minimessage.save\n format.html { redirect_to @minimessage, notice: 'Minimessage was successfully created.' }\n format.json { render json: @minimessage, status: :created, location: @minimessage }\n else\n format.html { render action: \"new\" }\n format.json { render json: @minimessage.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @shoutout = Shoutout.new(create_params)\n if @shoutout.save\n render json: @shoutout, status: 201, location: api_v1_shoutout_path(@shoutout.id)\n else\n render json: { error: \"Application error\", status: 400 }, status: 400\n end\n end" ]
[ "0.7023869", "0.6639904", "0.64528984", "0.6450997", "0.64273953", "0.63410354", "0.63087326", "0.62536055", "0.6247069", "0.62145275", "0.61807185", "0.6132906", "0.6081743", "0.604135", "0.60120875", "0.6004979", "0.59997016", "0.59874415", "0.597668", "0.5901986", "0.5887883", "0.58697563", "0.5868529", "0.58612585", "0.5835035", "0.5827359", "0.5799303", "0.5795976", "0.5790385", "0.578717", "0.57853276", "0.57797575", "0.57716274", "0.57692593", "0.5758061", "0.57491046", "0.5742718", "0.5721824", "0.5719699", "0.5701852", "0.56957763", "0.56845546", "0.5681095", "0.56662893", "0.5656535", "0.56547594", "0.5653464", "0.5647385", "0.5634275", "0.5613977", "0.5609334", "0.5608387", "0.560682", "0.5605933", "0.5599367", "0.5572623", "0.5561425", "0.5559217", "0.55549276", "0.55422765", "0.55374014", "0.5537364", "0.5525737", "0.5518062", "0.5514675", "0.5505215", "0.550193", "0.5488503", "0.5482044", "0.54770523", "0.54754126", "0.5472519", "0.5451935", "0.54426455", "0.54364747", "0.5406591", "0.5399626", "0.5368239", "0.5367706", "0.5361328", "0.5352659", "0.534858", "0.5337482", "0.53364813", "0.5329728", "0.5324866", "0.53200245", "0.53022146", "0.5298445", "0.52959096", "0.52948785", "0.52822554", "0.52781767", "0.5267602", "0.5266925", "0.5263875", "0.5261399", "0.5255334", "0.52463573", "0.5244292" ]
0.6576313
2
PATCH/PUT /smsloans/1 PATCH/PUT /smsloans/1.json
def update respond_to do |format| if @smsloan.update(smsloan_params) format.html { redirect_to @smsloan, notice: 'Smsloan was successfully updated.' } format.json { render :show, status: :ok, location: @smsloan } else format.html { render :edit } format.json { render json: @smsloan.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @sms_based.update(sms_based_params)\n format.html { redirect_to @sms_based, notice: 'Sms based was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sms_based.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sms = Sms.find(params[:id])\n\n respond_to do |format|\n if @sms.update_attributes(params[:sms])\n flash[:notice] = 'Sms was successfully updated.'\n format.html { redirect_to(@sms) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sms.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @smsno.update(smsno_params)\n format.html { redirect_to @smsno, notice: 'Smsno was successfully updated.' }\n format.json { render :show, status: :ok, location: @smsno }\n else\n format.html { render :edit }\n format.json { render json: @smsno.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sms_notification.update(sms_notification_params)\n format.html { redirect_to @sms_notification, notice: 'Sms notification was successfully updated.' }\n format.json { render :show, status: :ok, location: @sms_notification }\n else\n format.html { render :edit }\n format.json { render json: @sms_notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sms_retrieval.update(sms_retrieval_params)\n format.html { redirect_to @sms_retrieval, notice: 'Sms retrieval was successfully updated.' }\n format.json { render :show, status: :ok, location: @sms_retrieval }\n else\n format.html { render :edit }\n format.json { render json: @sms_retrieval.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sms_send.update(sms_send_params)\n format.html { redirect_to [:phone, @sms_send], notice: 'Sms send was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sms_send.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch_account_sms_with_http_info(account_id, sms_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SmsApi.patch_account_sms ...'\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling SmsApi.patch_account_sms\"\n end\n # verify the required parameter 'sms_id' is set\n if @api_client.config.client_side_validation && sms_id.nil?\n fail ArgumentError, \"Missing the required parameter 'sms_id' when calling SmsApi.patch_account_sms\"\n end\n # resource path\n local_var_path = '/accounts/{account_id}/sms/{sms_id}'.sub('{' + 'account_id' + '}', account_id.to_s).sub('{' + 'sms_id' + '}', sms_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'data'])\n auth_names = ['apiKey']\n data, status_code, headers = @api_client.call_api(:PATCH, 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 => 'SmsFull')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SmsApi#patch_account_sms\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @sms_tmp = SmsTmp.find(params[:id])\n\n respond_to do |format|\n if @sms_tmp.update_attributes(params[:sms_tmp])\n format.html { redirect_to \"/home/sms\", notice: '短信模版修改成功.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sms_tmp.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @minimessage = Minimessage.find(params[:id])\n\n respond_to do |format|\n if @minimessage.update_attributes(params[:minimessage])\n format.html { redirect_to @minimessage, notice: 'Minimessage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @minimessage.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mostsmallmission = Mostsmallmission.find(params[:id])\n\n respond_to do |format|\n if @mostsmallmission.update_attributes(params[:mostsmallmission])\n format.html { redirect_to @mostsmallmission, notice: 'Mostsmallmission was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mostsmallmission.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @smsuser.update(smsuser_params)\n format.html { redirect_to @smsuser, notice: 'Smsuser was successfully updated.' }\n format.json { render :show, status: :ok, location: @smsuser }\n else\n format.html { render :edit }\n format.json { render json: @smsuser.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @phone = Phone.find(params[:id])\n if Rails::VERSION::MAJOR > 5\n mtd = :update\n else\n mtd = :update_attributes\n end\n\n respond_to do |format|\n if @phone.send(mtd, phone_params)\n format.html { redirect_to @phone, notice: 'Phone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @phone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @smpl_chat.update(smpl_chat_params)\n format.html { redirect_to @smpl_chat, notice: 'Smpl chat was successfully updated.' }\n format.json { render :show, status: :ok, location: @smpl_chat }\n else\n format.html { render :edit }\n format.json { render json: @smpl_chat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @slam = Slam.find(params[:id])\n \n respond_to do |format|\n if @slam.update_attributes(params[:slam])\n format.html { redirect_to @slam, notice: 'Fixed up!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slam.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sms_send.update(sms_send_params)\n format.html { redirect_to @sms_send, notice: 'Sms send was successfully updated.' }\n format.json { render :show, status: :ok, location: @sms_send }\n else\n format.html { render :edit }\n format.json { render json: @sms_send.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @request_call = RequestCall.find(params[:id])\n\n respond_to do |format|\n if @request_call.update_attributes(params[:request_call])\n format.html { redirect_to @request_call, notice: 'Request call was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request_call.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @momsg = Momsg.find(params[:id])\n\n respond_to do |format|\n if @momsg.update_attributes(params[:momsg])\n format.html { redirect_to @momsg, notice: 'Momsg was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @momsg.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @v1_message = V1::Message.find(params[:id])\n\n if @v1_message.update(message_params)\n render json: @v1_message, status: :ok\n else\n render json: @v1_message.errors, status: :unprocessable_entity\n end\n end", "def update\n @mall = Mall.find(params[:id])\n\n respond_to do |format|\n if @mall.update_attributes(params[:mall])\n format.html { redirect_to @mall, notice: 'Mall was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mall.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @moresmalltrial = Moresmalltrial.find(params[:id])\n\n respond_to do |format|\n if @moresmalltrial.update_attributes(params[:moresmalltrial])\n format.html { redirect_to @moresmalltrial, notice: 'Moresmalltrial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moresmalltrial.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params.require(:id)\n msg = Message.find(params[:id])\n msg.read = true\n msg.save\n render :json => msg.as_json, status: :ok\n end", "def patch!\n request! :patch\n end", "def set_smsloan\n @smsloan = Smsloan.find(params[:id])\n end", "def update\n message = Message.find(params[:id])\n message.update(message_params)\n render json: message\n end", "def update\n @call = Call.find(params[:id])\n\n respond_to do |format|\n if @call.update_attributes(params[:call])\n format.html { redirect_to @call, notice: 'Call was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @call = Call.find(params[:id])\n\n respond_to do |format|\n if @call.update_attributes(params[:call])\n format.html { redirect_to @call, notice: 'Call was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @snack.update(snack_params)\n format.html { redirect_to @snack, notice: 'Snack was successfully updated.' }\n format.json { render :show, status: :ok, location: @snack }\n else\n format.html { render :edit }\n format.json { render json: @snack.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @phone_call.update(phone_call_params)\n format.html { redirect_to @phone_call, flash: { success: \"Phone call was successfully updated.\" } }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @phone_call.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @messaging_inbox = Messaging::Inbox.find(params[:id])\n\n respond_to do |format|\n if @messaging_inbox.update_attributes(params[:messaging_inbox])\n format.html { redirect_to @messaging_inbox, notice: 'Inbox was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @messaging_inbox.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n customer = Customer.find_by_authentication_token(params[:token])\n pwd = 111111 #SecureRandom.hex(4)\n if customer.blank?\n render json: {\n message: \"Impossible d'activer ce badge\"\n }\n else\n #on met à jour les informations\n query = customer.update(\n name: params[:name],\n second_name: params[:second_name],\n cni: params[:cni],\n phone: params[:phone],\n sexe: params[:sexe],\n two_fa: params[:authenticated],\n password: pwd\n )\n\n #verification de la mise a jour\n Sms.new(params[:phone], \"Votre mot de passe est #{pwd}, conservez en toute securité\")\n end\n end", "def sms\n send_sms(params)\n respond_to do |format|\n format.json {render :json => {:status => :success }}\n end\n end", "def update\n @sin = Sin.find(params[:id])\n\n respond_to do |format|\n if @sin.update_attributes(params[:sin])\n format.html { redirect_to @sin, notice: 'Binge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message = Message.find(params[:id])\n @message.update(text: params[\"_json\"])\n render json: @message\n end", "def update\n respond_to do |format|\n if @mslane.update(mslane_params)\n format.html { redirect_to @mslane, notice: 'Mslane was successfully updated.' }\n format.json { render :show, status: :ok, location: @mslane }\n else\n format.html { render :edit }\n format.json { render json: @mslane.errors, status: :unprocessable_entity }\n end\n end\n end", "def smsmark\n http = get_http_connection() \n post_args = { 'ids' => params[:ids], 'name' => @pysmsd_config.app_name, 'password' => @pysmsd_config.app_password }\n request = Net::HTTP::Post.new('/messages/in.json')\n request.set_form_data(post_args)\n resp = http.request(request)\n json = JSON.parse(resp.body)\n render_json :entry => json\n end", "def update\n @mailbox = Mailbox.find(params[:id])\n\n respond_to do |format|\n if @mailbox.update_attributes(params[:mailbox])\n format.html { redirect_to mailboxes_path, notice: 'Mailbox was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mailbox.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @spkj_bsb=SpkjBsb.find(params[:id])\n @spkj_bsb.update_attributes(params[:spkj_bsb])\n\n respond_to do |format|\n format.html { redirect_to(\"/spkj_bsbs\") }\n format.json { render json: @spkj_bsb }\n end\n end", "def update\n respond_to do |format|\n if @call.update(call_params)\n format.html { redirect_to @call, notice: 'Call was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if !set_sms_fields\n return # something did not work right in set_sms_fields which is handled there\n end\n\n if @sms_alert.save\n redirect_to account_sms_alerts_path, notice: 'Sms alert was successfully updated.' \n else\n render :edit \n end\n end", "def update\n @phonenumber = Phonenumber.find(params[:id])\n\n if @phonenumber.update(params[:phonenumber])\n head :no_content\n else\n render json: @phonenumber.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @phone.update(phone_params)\n format.html { redirect_to phones_path, notice: 'Phone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @phone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n contact = Contact.find(params[:id])\n\n if contact.user_id == current_user.id\n contact.update_attributes(params[:contact])\n render json: contact\n else\n render text: \"That's not your contact!\"\n end\n end", "def update\n @inbox = Inbox.find(params[:id])\n\n respond_to do |format|\n if @inbox.update_attributes(params[:inbox])\n format.html { redirect_to @inbox, notice: 'Inbox was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inbox.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @phone.update(valid_params)\n json_response(@phone)\n end", "def update\n\n # update shops\n shops_edit = JSON.parse(params[:mall][:shops_in_mall])\n\n respond_to do |format|\n if @mall.update_with_shops(mall_params, shops_edit)\n format.html { redirect_to director_malls_path, notice: 'Mall was successfully updated.' }\n format.json { render :show, status: :ok, location: @mall }\n else\n format.html {\n @shops = Shop.to_options.to_json\n @shops_in_mall = @mall.shops.to_options.to_json\n render :edit\n }\n format.json { render json: @mall.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @call.update(call_params)\n format.html { redirect_to @call, notice: 'Chamada alterada.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @number_call = NumberCall.find(params[:id])\n\n respond_to do |format|\n if @number_call.update_attributes(params[:number_call])\n format.html { redirect_to @number_call, notice: 'Number call was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @number_call.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @phone.update(phone_params)\n format.html { redirect_to @phone, notice: 'Phone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @phone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @call_status.update(call_status_params)\n format.html { redirect_to @call_status, notice: 'Call status was successfully updated.' }\n format.json { render :show, status: :ok, location: @call_status }\n else\n format.html { render :edit }\n format.json { render json: @call_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @scrobble = Scrobble.find(params[:id])\n\n respond_to do |format|\n if @scrobble.update_attributes(params[:scrobble])\n format.html { redirect_to @scrobble, notice: 'Scrobble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scrobble.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n mk = connect_mikrotik\n respond_to do |format|\n\n \n @plan_old = @plan.as_json # Guarda os parâmetros antigos do registro para retornar caso não consiga mudar no mikrotik\n \n id = mk.get_reply(\"/ppp/profile/print\", \"?name=#{@plan.profile_name}\")[0][\".id\"]\n puts \"Id do registro a ser mudado\"\n puts id\n\n if @plan.update(plan_params)\n \n result = mk.get_reply(\"/ppp/profile/set\",\n \"=name=#{plan_params[\"profile_name\"]}\",\n \"=rate-limit=#{plan_params[\"rate_limit\"]}\",\n \"=.id=#{id}\")[0][\"message\"]\n\n @notice = 'Plan was successfully updated.'\n if result != nil\n @notice = \"It wasn't possible to update mikrotik\"\n @plan.update(@plan_old)\n end\n\n format.html { redirect_to @plan, notice: @notice }\n format.json { render :show, status: :ok, location: @plan }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @verb = Verb.find(params[:id])\n\n if @verb.update(verb_params)\n head :no_content\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @sleuth.update(sleuth_params)\n format.html { redirect_to @sleuth, notice: 'Sleuth was successfully updated.' }\n format.json { render :show, status: :ok, location: @sleuth }\n else\n format.html { render :edit }\n format.json { render json: @sleuth.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bill = Bill.find(params[:id])\n\n if @bill.update(params[:bill])\n head :no_content\n else\n render json: @bill.errors, status: :unprocessable_entity\n end\n end", "def update\n @microposst = Microposst.find(params[:id])\n\n respond_to do |format|\n if @microposst.update_attributes(params[:microposst])\n format.html { redirect_to @microposst, notice: 'Microposst was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @microposst.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @phone = Phone.find(params[:id])\n\n respond_to do |format|\n if @phone.update_attributes(phone_params)\n format.html { redirect_to @phone, notice: 'Phone was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @phone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mall_type = MallType.find(params[:id])\n\n respond_to do |format|\n if @mall_type.update_attributes(params[:mall_type])\n format.html { redirect_to @mall_type, notice: 'Mall type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mall_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @micromessage = Micromessage.find(params[:id])\n\n respond_to do |format|\n if @micromessage.update_attributes(params[:micromessage])\n format.html { redirect_to(@micromessage, :notice => 'Micromessage was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @micromessage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end", "def update\n @tack = Tack.find(params[:id])\n\n if @tack.update(tack_params)\n head :no_content\n else\n render json: @tack.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @call.update(call_params)\n format.html { redirect_to @call, notice: \"Call was successfully updated.\" }\n format.json { render :show, status: :ok, location: @call }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @call.client = ClientPhone.find_by(phone: @call.phone).client\n respond_to do |format|\n if @call.update(call_params)\n format.html { redirect_to @call, notice: 'Call was successfully updated.' }\n format.json { render :show, status: :ok, location: @call }\n else\n format.html { render :edit }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @messagetold = Messagetold.find(params[:id])\n\n respond_to do |format|\n if @messagetold.update_attributes(params[:messagetold])\n format.html { redirect_to @messagetold, notice: 'Messagetold was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @messagetold.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @monthlybill = Monthlybill.find(params[:id])\n\n respond_to do |format|\n if @monthlybill.update_attributes(params[:monthlybill])\n format.html { redirect_to @monthlybill, notice: 'Monthlybill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @monthlybill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @call.update(call_params)\n format.html { redirect_to @call, notice: 'Call was successfully updated.' }\n format.json { render :show, status: :ok, location: @call }\n else\n format.html { render :edit }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @call.update(call_params)\n format.html { redirect_to @call, notice: 'Call was successfully updated.' }\n format.json { render :show, status: :ok, location: @call }\n else\n format.html { render :edit }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @lottery.update(lottery_params)\n format.html { redirect_to [:phone, @lottery], notice: 'Lottery was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lottery.errors, status: :unprocessable_entity }\n end\n end\n end", "def sms_cancel_all_put_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SMSApi.sms_cancel_all_put ...'\n end\n # resource path\n local_var_path = '/sms/cancel-all'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(: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 => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SMSApi#sms_cancel_all_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @call = current_user.calls.find(params[:id])\n\n respond_to do |format|\n if @call.update_attributes(params[:call])\n format.html { redirect_to @call, :notice => 'Call was successfully updated.' }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "def update\n respond_to do |format|\n if @m1.update(m1_params)\n format.html { redirect_to @m1, notice: 'M1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @m1 }\n else\n format.html { render :edit }\n format.json { render json: @m1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @twilio_book.update(twilio_book_params)\n format.html { redirect_to @twilio_book, notice: 'Twilio book was successfully updated.' }\n format.json { render :show, status: :ok, location: @twilio_book }\n else\n format.html { render :edit }\n format.json { render json: @twilio_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bot_bingo_number.update(bot_bingo_number_params)\n format.html { redirect_to @bot_bingo_number, notice: 'Bot bingo number was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bot_bingo_number.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @smell.update(smell_params)\n format.html { redirect_to @smell, notice: 'Smell was successfully updated.' }\n format.json { render :show, status: :ok, location: @smell }\n else\n format.html { render :edit }\n format.json { render json: @smell.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @minisound.update(minisound_params)\n format.html { redirect_to @minisound, notice: 'Minisound was successfully updated.' }\n format.json { render :show, status: :ok, location: @minisound }\n else\n format.html { render :edit }\n format.json { render json: @minisound.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @call.update(call_params)\n format.html { redirect_to @call, notice: CALL_UPDATED }\n format.json { render :show, status: :ok, location: @call }\n else\n format.html { render :edit }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tw_phone.update(tw_phone_params)\n format.html { redirect_to @tw_phone, notice: 'Tw phone was successfully updated.' }\n format.json { render :show, status: :ok, location: @tw_phone }\n else\n format.html { render :edit }\n format.json { render json: @tw_phone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mib = Mib.find(params[:id])\n\n respond_to do |format|\n if @mib.update_attributes(params[:mib])\n format.html { redirect_to @mib, notice: 'Mib was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mib.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mystock.update(mystock_params)\n format.html { redirect_to @mystock, notice: 'mystock was successfully updated.' }\n format.json { render :show, status: :ok, location: @mystock }\n else\n format.html { render :edit }\n format.json { render json: @mystock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bla = Bla.find(params[:id])\n\n respond_to do |format|\n if @bla.update_attributes(params[:bla])\n format.html { redirect_to @bla, :notice => 'Bla was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bla.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n slogan = Slogan.find(params[:id])\n if slogan.update_attributes(slogan_params)\n render json: {\n status: 'Success',\n message: 'Slogan updated',\n data: slogan},\n status: :ok\n else \n render json: {\n status: 'Success',\n message: 'Slogan not updated',\n data: slogan},\n status: :unprocessable_entity\n end\n end", "def update\n @symptom = Symptom.find(params[:id])\n\n if @symptom.update(symptom_params)\n render json: @symptom, status: :updated\n else\n render json: @symptom.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @sa_request_status.update(sa_request_status_params)\n format.html { redirect_to @sa_request_status, notice: 'Sa request status was successfully updated.' }\n format.json { render :show, status: :ok, location: @sa_request_status }\n else\n format.html { render :edit }\n format.json { render json: @sa_request_status.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 respond_to do |format|\n if @sa_request.update(sa_request_params)\n format.html { redirect_to @sa_request, notice: 'Sa request was successfully updated.' }\n format.json { render :show, status: :ok, location: @sa_request }\n else\n format.html { render :edit }\n format.json { render json: @sa_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @phone.update(phone_params)\n format.html { redirect_to @phone, notice: 'Phone was successfully updated.' }\n format.json { render :show, status: :ok, location: @phone }\n else\n format.html { render :edit }\n format.json { render json: @phone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @phone.update(phone_params)\n format.html { redirect_to @phone, notice: 'Phone was successfully updated.' }\n format.json { render :show, status: :ok, location: @phone }\n else\n format.html { render :edit }\n format.json { render json: @phone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @status.update(isshared: params[:isshared])\n format.json { head :no_content }\n else\n format.json {\n render json: @status.errors,\n status: :unprocessable_entity\n }\n end\n end\n end", "def update\n respond_to do |format|\n if @callplan.update(callplan_params)\n format.html { redirect_to @callplan, notice: 'Callplan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @callplan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @boat_user_phone = BoatUserPhone.find(params[:id])\n\n respond_to do |format|\n if @boat_user_phone.update_attributes(params[:boat_user_phone])\n format.html { redirect_to(@boat_user_phone, :notice => 'Boat user phone was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @boat_user_phone.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @phonecall = Phonecall.find(params[:id])\n\n respond_to do |format|\n if @phonecall.update_attributes(params[:phonecall])\n flash[:notice] = 'Phonecall was successfully updated.'\n format.html { redirect_to(@phonecall) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @phonecall.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n #@phone = Phone.find(params[:id])\n end", "def update\n if @inbox.update(inbox_params)\n render :show, status: :ok, location: @inbox\n else\n render json: @inbox.errors, status: :unprocessable_entity\n end\n end", "def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end", "def update\n @commission_fixing = CommissionFixing.find(params[:id])\n if @commission_fixing.update_attributes(params[:commission_fixing])\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@commission_fixing.errors)\n end \n end", "def update\n @mall = Mall.find(params[:id])\n\n respond_to do |format|\n if @mall.update_attributes(params[:mall])\n format.html { redirect_to(@mall, :notice => 'Mall was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @mall.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @message.update(message_params) \n render json: @message, status: :ok, location: @message\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end", "def update\n current_user.phone = params['phone']\n current_user.save()\n\n render :nothing => true, :status => 204\n end", "def update\n respond_to do |format|\n if @call_detail.update(call_detail_params)\n format.html { redirect_to @call_detail, notice: 'Call detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @call_detail }\n else\n format.html { render :edit }\n format.json { render json: @call_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @supplies_loan = SuppliesLoan.find(params[:id])\n\n respond_to do |format|\n if @supplies_loan.update_attributes(params[:supplies_loan])\n format.html { redirect_to @supplies_loan, notice: 'Supplies loan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @supplies_loan.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6421635", "0.6216744", "0.6213252", "0.59553605", "0.59518427", "0.5942802", "0.5936722", "0.5927721", "0.585977", "0.581588", "0.5805377", "0.5790092", "0.5775165", "0.576854", "0.5754301", "0.5706977", "0.5704834", "0.5699056", "0.56953347", "0.5671421", "0.5667156", "0.5666377", "0.56624573", "0.5646009", "0.5635756", "0.5635756", "0.5626774", "0.5624018", "0.56206936", "0.5619341", "0.56043607", "0.5601419", "0.5593972", "0.55735147", "0.55624044", "0.55359894", "0.5516631", "0.5508069", "0.55065686", "0.5500838", "0.5500328", "0.5494442", "0.5490688", "0.5486343", "0.54810745", "0.5480484", "0.54783857", "0.54697114", "0.5467985", "0.5466871", "0.5464692", "0.54639125", "0.5462711", "0.5456729", "0.545374", "0.54517686", "0.5441625", "0.5439309", "0.54336596", "0.54199266", "0.5417605", "0.54154164", "0.5413749", "0.54128426", "0.541189", "0.541189", "0.5410934", "0.54045224", "0.54021716", "0.53988695", "0.5396669", "0.5395878", "0.5395471", "0.5394678", "0.5394565", "0.5392936", "0.5387554", "0.5386729", "0.5382775", "0.5381775", "0.5381239", "0.538092", "0.5378171", "0.53735596", "0.537163", "0.5368311", "0.5368311", "0.5367645", "0.5359922", "0.53583026", "0.53563505", "0.5351949", "0.5350395", "0.5349638", "0.53479266", "0.534749", "0.53472424", "0.53469163", "0.5346084", "0.534311" ]
0.657055
0
DELETE /smsloans/1 DELETE /smsloans/1.json
def destroy @smsloan.destroy respond_to do |format| format.html { redirect_to smsloans_url, notice: 'Smsloan was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @sms_based.destroy\n respond_to do |format|\n format.html { redirect_to sms_baseds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sms = Sms.find(params[:id])\n @sms.destroy\n\n respond_to do |format|\n format.html { redirect_to(sms_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sm = Sm.find(params[:id])\n @sm.destroy\n\n respond_to do |format|\n format.html { redirect_to sms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @smsno.destroy\n respond_to do |format|\n format.html { redirect_to smsnos_url, notice: 'Smsno was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sms_retrieval.destroy\n respond_to do |format|\n format.html { redirect_to sms_retrievals_url, notice: 'Sms retrieval was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sm = Sm.find(params[:id])\n @sm.destroy\n\n respond_to do |format|\n format.html { redirect_to(sms_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @smsuser.destroy\n respond_to do |format|\n format.html { redirect_to smsusers_url, notice: 'Smsuser was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sms_send.destroy\n respond_to do |format|\n format.html { redirect_to phone_sms_sends_url, notice: 'Sms send was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sms_tmp = SmsTmp.find(params[:id])\n @sms_tmp.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/home/sms\", notice: '删除成功。' }\n format.json { head :no_content }\n end\n end", "def destroy\n @slam = Slam.find(params[:id])\n @slam.destroy\n\n respond_to do |format|\n format.html { redirect_to slams_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete_message(sid)\n\t@client = Twilio::REST::Client.new ACCOUNT_SID, AUTH_TOKEN\n\t@client.recordings.get(sid).delete()\nend", "def destroy\n @sms_send.destroy\n respond_to do |format|\n format.html { redirect_to sms_sends_url, notice: 'Sms send was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @v1_message = V1::Message.find(params[:id])\n @v1_message.destroy\n\n head :no_content\n end", "def destroy\n @sms_notification.destroy\n respond_to do |format|\n format.html { redirect_to sms_notifications_url, notice: 'Sms notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sys_msgs_timeline.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @bless_message.destroy\n\n render json: {}\n end", "def destroy\n @outgoing_message_log = OutgoingMessageLog.find(params[:id])\n @outgoing_message_log.destroy\n\n respond_to do |format|\n format.html { redirect_to outgoing_message_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sin = Sin.find(params[:id])\n @sin.destroy\n\n respond_to do |format|\n format.html { redirect_to sins_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 @moresmalltrial = Moresmalltrial.find(params[:id])\n @moresmalltrial.destroy\n\n respond_to do |format|\n format.html { redirect_to moresmalltrials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #@phone.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @mostsmallmission = Mostsmallmission.find(params[:id])\n @mostsmallmission.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallmissions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mall = Mall.find(params[:id])\n @mall.destroy\n\n respond_to do |format|\n format.html { redirect_to malls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n slogan = Slogan.find(params[:id])\n slogan.destroy\n render json: {\n status: 'Success',\n message: 'Slogan deleted',\n data: slogan},\n status: :ok\n end", "def delete\n @client.post('/api/del_msg', id: get_attribute(:name))\n end", "def destroy\n @minimessage = Minimessage.find(params[:id])\n @minimessage.destroy\n\n respond_to do |format|\n format.html { redirect_to minimessages_url }\n format.json { head :no_content }\n end\n end", "def delete_dm(settings, dmid)\n Net::HTTP.start('twitter.com') {|http|\n req = Net::HTTP::Post.new(\"/direct_messages/destroy/#{dmid}.json\")\n req.basic_auth settings[:user], settings[:pass]\n response = http.request(req)\n response.body\n }\nend", "def destroy\n @relay.destroy\n respond_to do |format|\n format.html { redirect_to relays_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @momsg = Momsg.find(params[:id])\n @momsg.destroy\n\n respond_to do |format|\n format.html { redirect_to momsgs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @phone_call.destroy\n respond_to do |format|\n format.html { redirect_to phone_calls_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @ambush = Ambush.find(params[:id])\n @ambush.destroy\n\n respond_to do |format|\n format.html { redirect_to ambushes_url }\n format.json { head :ok }\n end\n end", "def destroy\n # delete a specific message\n end", "def destroy\n @m1.destroy\n respond_to do |format|\n format.html { redirect_to m1s_url, notice: 'M1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @outgoing = Outgoing.find(params[:id])\n @outgoing.destroy\n\n respond_to do |format|\n format.html { redirect_to outgoings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mobile = Mobile.find(params[:id])\n @mobile.destroy\n\n respond_to do |format|\n format.html { redirect_to mobiles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @sleuth.destroy\n respond_to do |format|\n format.html { redirect_to sleuths_url, notice: 'Sleuth was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @smslogrecord.destroy\n respond_to do |format|\n format.html { redirect_to smslogrecords_url, notice: 'Smslogrecord was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stanza = Stanza.find_by_no(params[:id])\n @stanza.destroy\n\n respond_to do |format|\n format.html { redirect_to stanzas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sabio = Sabio.find(params[:id])\n @sabio.destroy\n\n respond_to do |format|\n format.html { redirect_to sabios_url }\n format.json { head :ok }\n end\n end", "def destroy\n @phone = Phone.find(params[:id])\n @phone.destroy\n\n respond_to do |format|\n format.html { redirect_to phones_url }\n format.json { head :ok }\n end\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n render json: 'Message was successfully deleted', status: :ok\n end", "def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # delete a specific message\n end", "def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @phonecall = Phonecall.find(params[:id])\n @phonecall.destroy\n\n respond_to do |format|\n format.html { redirect_to(phonecalls_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @call = Call.find(params[:id])\n @call.destroy\n\n respond_to do |format|\n format.html { redirect_to calls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @call = Call.find(params[:id])\n @call.destroy\n\n respond_to do |format|\n format.html { redirect_to calls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @call = Call.find(params[:id])\n @call.destroy\n\n respond_to do |format|\n format.html { redirect_to calls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ref_sanatorium = Ref::Sanatorium.find(params[:id])\n @ref_sanatorium.destroy\n\n respond_to do |format|\n format.html { redirect_to ref_sanatoria_url }\n format.json { head :ok }\n end\n end", "def destroy\n @pinglun = Pinglun.find(params[:id])\n @pinglun.destroy\n\n respond_to do |format|\n format.html { redirect_to pingluns_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mensagem = Mensagem.find(params[:id])\n api_client.delete_object(@mensagem.post_id)\n @mensagem.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.js { head :ok }\n end\n end", "def destroy\n @message_phone_connection = MessagePhoneConnection.find(params[:id])\n @message_phone_connection.destroy\n\n respond_to do |format|\n format.html { redirect_to message_phone_connections_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @phone = Phone.find(params[:id])\n @phone.destroy\n\n respond_to do |format|\n format.html { redirect_to phones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request_call = RequestCall.find(params[:id])\n @request_call.destroy\n\n respond_to do |format|\n format.html { redirect_to request_calls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @msd.destroy\n respond_to do |format|\n format.html { redirect_to coas_url, notice: 'Msd was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @shout = Shout.find(params[:id])\n @shout.destroy\n\n respond_to do |format|\n format.html { redirect_to shouts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shout = Shout.find(params[:id])\n @shout.destroy\n\n respond_to do |format|\n format.html { redirect_to shouts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @short_message.destroy\n respond_to do |format|\n format.html { redirect_to short_messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # delete a specific message\n end", "def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bdm.destroy\n respond_to do |format|\n format.html { redirect_to bdms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bot = Bot.find(params[:id])\n @bot.destroy\n\n respond_to do |format|\n format.html { redirect_to bots_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_message = AdminMessage.find(params[:id])\n @admin_message.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admins_message.destroy\n respond_to do |format|\n format.html { redirect_to admins_messages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @android_ng_bayan.destroy\n respond_to do |format|\n format.html { redirect_to android_ng_bayans_url, notice: 'Android ng bayan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @micromessage = Micromessage.find(params[:id])\n @micromessage.destroy\n\n respond_to do |format|\n format.html { redirect_to(micromessages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @snack.destroy\n respond_to do |format|\n format.html { redirect_to snacks_url, notice: 'Snack was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mailbox = Mailbox.find(params[:id])\n @mailbox.destroy\n\n respond_to do |format|\n format.html { redirect_to mailboxes_url }\n format.json { head :no_content }\n end\n end", "def delete_message(id)\n record \"/msg/delete/#{id}\"\n end", "def destroy\n @mobile = Mobile.find(params[:id])\n #@mobile.destroy\n\n respond_to do |format|\n format.html { redirect_to(mobiles_url) }\n format.xml { head :ok }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def delete\n request(:delete)\n end", "def destroy\n @mall_type = MallType.find(params[:id])\n @mall_type.destroy\n\n respond_to do |format|\n format.html { redirect_to mall_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @spkj_bsb = SpkjBsb.find(params[:id])\n @spkj_bsb.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/spkj_bsbs\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @sa_request.destroy\n respond_to do |format|\n format.html { redirect_to sa_requests_url, notice: 'Sa request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stone = Stone.find(params[:id])\n @stone.destroy\n\n respond_to do |format|\n format.html { redirect_to stones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ssd.destroy\n respond_to do |format|\n format.html { redirect_to ssds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @singleb.destroy\n respond_to do |format|\n format.html { redirect_to singlebs_url, notice: 'Singleb was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @makrana_marble.destroy\n respond_to do |format|\n format.html { redirect_to makrana_marbles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reminder_phrase = ReminderPhrase.find(params[:id])\n @reminder_phrase.destroy\n\n respond_to do |format|\n format.html { redirect_to reminder_phrases_url }\n format.json { head :no_content }\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 @snail.destroy\n respond_to do |format|\n format.html { redirect_to snails_url, notice: 'Snail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @snail.destroy\n respond_to do |format|\n format.html { redirect_to snails_url, notice: 'Snail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @diagnoz = Diagnoz.find(params[:id])\n @diagnoz.destroy\n\n respond_to do |format|\n format.html { redirect_to diagnozs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mib = Mib.find(params[:id])\n @mib.destroy\n\n respond_to do |format|\n format.html { redirect_to mibs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mobile = Mobile.find(params[:id])\n @mobile.destroy\n\n respond_to do |format|\n format.html { redirect_to(mobiles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @messaging_inbox = Messaging::Inbox.find(params[:id])\n @messaging_inbox.destroy\n\n respond_to do |format|\n format.html { redirect_to messaging_inboxes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @phone.destroy\n respond_to do |format|\n format.html { redirect_to phones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @phone.destroy\n respond_to do |format|\n format.html { redirect_to phones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mall.put_to_trash\n respond_to do |format|\n format.html { redirect_to director_malls_path, notice: 'Mall was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n render json: {status: 204}\n end", "def destroy\n @lob.destroy\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @loan.destroy\n respond_to do |format|\n format.html { redirect_to loans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @outgoing.destroy\n respond_to do |format|\n format.html { redirect_to outgoings_url, notice: 'Outgoing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @outgoing.destroy\n respond_to do |format|\n format.html { redirect_to outgoings_url, notice: 'Outgoing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n @server.send_delete\n respond_to do |format|\n format.html { redirect_to servers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @mill = Mill.find(params[:id])\n @mill.destroy\n\n respond_to do |format|\n format.html { redirect_to mills_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.72519684", "0.7122071", "0.7115706", "0.69583005", "0.6849772", "0.67845243", "0.6767632", "0.6757643", "0.6752234", "0.6733571", "0.6725113", "0.67103755", "0.67067367", "0.67014", "0.66567254", "0.6650135", "0.66413534", "0.66385674", "0.66344535", "0.6616824", "0.660829", "0.66028416", "0.6577048", "0.6557499", "0.6546697", "0.6544049", "0.65172654", "0.6515311", "0.6512506", "0.6510985", "0.64862365", "0.6483407", "0.64671534", "0.6466894", "0.64666635", "0.64654607", "0.64611965", "0.6439038", "0.64368755", "0.6426171", "0.6418023", "0.64175314", "0.64165956", "0.64061946", "0.64061004", "0.64040065", "0.64029837", "0.6400283", "0.6400283", "0.6400283", "0.6397946", "0.63915145", "0.6390294", "0.63890594", "0.6388642", "0.6386338", "0.63735425", "0.6369356", "0.6369025", "0.63684416", "0.63658917", "0.6364239", "0.6358065", "0.6357722", "0.6354995", "0.63542455", "0.63517827", "0.6346175", "0.63461566", "0.6341643", "0.6341156", "0.63345873", "0.63322127", "0.6331089", "0.63276434", "0.63239086", "0.6322886", "0.63224316", "0.6322144", "0.6316809", "0.6310641", "0.6309003", "0.63056296", "0.6303972", "0.63025975", "0.63025975", "0.63023674", "0.630224", "0.6301665", "0.6301502", "0.63011324", "0.63011324", "0.62971556", "0.6294794", "0.62889785", "0.6286269", "0.6285091", "0.6285091", "0.6280176", "0.62795347" ]
0.73421055
0
Use callbacks to share common setup or constraints between actions.
def set_smsloan @smsloan = Smsloan.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 smsloan_params params.require(:smsloan).permit(:bank, :min_loanamoun, :max_loanamoun, :mobile_friendly_site, :smsloan_payment_note, :smsloan_min_age, :cost_free_loan, :new_borrower_5K, :new_borrower_10K, :no_uc, :skef_member, :bankid, :open_on_saturdays, :weblink) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
GET /image_groups/1 GET /image_groups/1.json
def show @image_group = ImageGroup.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @image_group } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @groups = current_user.groups\n @groups = @groups.where('name LIKE ?', \"%#{params[:q]}%\") if params[:q].present?\n @groups = current_user.groups_sorted_by_admin_state_and_name(@groups)\n @groups_pictures = Group.group_images_hash_for_groups @groups\n\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @groups }\n end\n end", "def GetGroup id\n\n APICall(path: \"groups/#{id}.json\")\n\n end", "def im_groups_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: IMGroupsApi.im_groups ...'\n end\n # resource path\n local_var_path = '/im/groups'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'IMGroupList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IMGroupsApi#im_groups\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def GetGroups params = {}\n\n params = params.merge(path: 'groups.json')\n APICall(params)\n\n end", "def getGroups\n groups = $gm.get(\"/groups\", @token, \"per_page=100\")\n group_ids = Array.new\n\n groups['response'].each do |group|\n group_ids.push({\n 'name' => group['name'],\n 'group_id' => group['id'],\n 'image' => group['image_url']})\n end\n\n return group_ids\n end", "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html\n format.json { render json: @groups }\n end\n end", "def index\n @image_gallery_groups = ImageGalleryGroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @image_gallery_groups }\n end\n end", "def index\n @gallery_groups = GalleryGroup.all\n end", "def index\n @groups = Group.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "def group\n limit = (params[:limit] || 10).to_i\n page = (params[:page] || 1).to_i\n @group_id = params[:object_id] unless params[:object_id]=='null'\n @photos = FacebookPhoto.fetch_from_fb_group(@group_id, current_user, {:limit => limit, :page => page})\n respond_to do |format|\n format.html do\n render :partial => 'photos/photo_list_form', \n :locals => {\n :photos => @photos, \n :index => params[:index],\n :synclink_base => nil, \n :local_photos => false\n }\n end\n end\n end", "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "def groups\n \n \n @groups = @current_user.groups\n render 'groups.json.jbuilder', status: :ok\n end", "def get_group\n send_request(FUNCTION_GET_GROUP, [], '', 4, 'k4')\n end", "def images\n if @group.is_member?(@user)\n @images = @group.uploads.images.paginate(:page => @page, :per_page => @per_page, :order => 'created_at desc')\n else\n @images = @group.uploads.images.public.paginate(:page => @page, :per_page => @per_page, :order => 'created_at desc')\n end\n respond_to do |format|\n format.js { render :json => basic_uploads_json(@images) }\n end\n end", "def index\n @groups = Group.all\n render_json_serializer(@groups)\n end", "def get_asset_groups_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AssetGroupApi.get_asset_groups ...'\n end\n # resource path\n local_var_path = '/api/3/asset_groups'\n\n # query parameters\n query_params = {}\n query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?\n query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageOfAssetGroup')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AssetGroupApi#get_asset_groups\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @groups = Group.all\n\n @host_groups = Group.where \"groupable_type = 'HostGroup'\"\n @fan_groups = Group.where \"groupable_type = 'FanGroup'\"\n @artist_groups = Group.where \"groupable_type = 'ArtistGroup'\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "def show\n group = Group.find(params[:id])\n\n render json: group\n end", "def show\n @@pict_per_page = 20\n @image_gallery_group = ImageGalleryGroup.find(params[:id])\n @image_gallery_group = ImageGalleryGroup.find( params[ :id ] )\n @page_count = 1 + @image_gallery_group.all_images_size / @@pict_per_page\n @page_count -= 1 if (@image_gallery_group.all_images_size % @@pict_per_page == 0 && @page_count > 1)\n pre = params[ :page ].to_i\n pre = 1 if (pre <= 0 || pre > @page_count )\n @page = pre\n @all_images, d = @image_gallery_group.get_images( (@page - 1) * @@pict_per_page, @@pict_per_page )\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image_gallery_group }\n end\n end", "def show\n @image_set = ImageSet.find(params[:id])\n\n render json: @image_set\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 group_album\n @discussion_group = DiscussionGroup.find(params[:id])\n if @login_user.is_member_of_discussion_group(params[:id].to_i) || @discussion_group.is_public\n @pictures = Image.find_by_sql([\"SELECT DISTINCT i.* FROM discussion_group_discussions dgd\n\t\t\t\t\t LEFT JOIN discussions d on dgd.discussion_id = d.id\n\t\t\t\t\t LEFT JOIN comments c on dgd.discussion_id = c.discussion_id\n\t\t\t\t\t LEFT JOIN images i ON (imageable_id = dgd.id AND imageable_type = 'DiscussionGroup')\n\t\t\t\t\t OR (imageable_id = d.id AND imageable_type = 'Discussion')\n\t\t\t\t\t OR (imageable_id = c.id AND imageable_type = 'Comment')\n \t\t\t\t\tWHERE i.id IS NOT NULL AND dgd.discussion_group_id =? \",params[:id].to_i])\n else\n redirect_to @login_user.profile_path\n end\n end", "def index\n @title = \"Группы характеристик\"\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "def index\n @family_images = FamilyImage.all\n\n render json: @family_images\n end", "def show\n @@pict_per_page = 20\n @image_gallery_group = ImageGalleryGroup.find( params[ :id ] )\n @page_count = 1 + @image_gallery_group.all_images_size / @@pict_per_page\n @page_count -= 1 if (@image_gallery_group.all_images_size % @@pict_per_page == 0 && @page_count > 1)\n pre = params[ :page ].to_i\n pre = 1 if (pre <= 0 || pre > @page_count )\n @page = pre\n @all_images, d = @image_gallery_group.get_images( (@page - 1) * @@pict_per_page, @@pict_per_page )\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image_gallery_group }\n end\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 objid = params[:id]\n obj = ManagingGroup.find_by_id(objid)\n if obj\n render json: {managing_group: obj}, status: 200\n else\n render json: {}, status: 404\n end\n rescue => error\n render json: {}, status: 500\n end", "def get_group_by_id(id)\n get(\"/groups/#{id}\")\n end", "def new\n @image_gallery_image = @image_gallery_group.images.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @image_gallery_image }\n end\n end", "def index\n objs = ManagingGroup.all.order(:position)\n if objs\n render json: {managing_groups: objs}, status: 200\n else\n render json: {}, status: 500\n end\n rescue => error\n render json: {}, status: 500\n end", "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "def getGroup( group_id)\n params = Hash.new\n params['group_id'] = group_id\n return doCurl(\"get\",\"/group\",params)\n end", "def show\n render json: @group\n end", "def groups(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Groups\", params: params)\n end", "def groups(options = {})\n params = { :limit => 200 }.update(options)\n response = get(PATH['groups_full'], params)\n parse_groups response_body(response)\n end", "def group_info\n group_id_param = params[:group_id]\n\n if group_id_param.nil? || group_id_param.blank?\n render json: { error: 'group_id not specified.' }, status: :bad_request\n return\n end\n\n group = CanvasSpaces.GroupCategory\n .groups\n .where('groups.id = ?', group_id_param)\n .eager_load(:users)\n .first\n if group.nil?\n render json: { error: 'No such group found.' }, status: :not_found\n else\n maillist = get_maillist_for_space(group.id)\n render json: { id: group.id,\n name: group.name,\n description: group.description,\n maillist: maillist,\n leader_id: group.leader_id,\n created_at: group.created_at,\n join_type: display_join_type(group.join_level),\n size: group.users.count\n },\n status: :ok\n end\n end", "def list\n @api.get(\"#{@api.path}/Images\")\n end", "def fetch_group\n @group = Group.find(params[:group_id])\n end", "def index\n @images = Image.all\n\n render json: @images\n end", "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @group }\n end\n end", "def show_group(id)\n get(\"groups/#{id}\")\n end", "def get_group\n @group = Group.find(params[:id])\n end", "def showgrp\n @grp = params[:id].to_s\n @groups=Group.where(\"kls_parent=\"+@grp).order(\"name asc\")\n render json: @groups\n end", "def show\n #@group = Group.find(params[:id])\n \n @users = @group.users\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "def load_group group_id, info_level = \"Full\", include_children = \"true\"\n\t\t\t@response = api_request 'LoadGroup', [group_id, info_level, include_children]\n\t\t\traise ZenfolioAPI::ZenfolioAPISessionError, @response['error']['message'] if @response['result'].nil? && @response['error'].length > 0\n\n\t\t\telements = []\n\t\t\t@response['result']['Elements'].each do |element|\n\t\t\t\tif element['$type'] == \"PhotoSet\"\n\t\t\t\t\telements << ZenfolioAPI::Model::Gallery.new(:id => element['Id'], :type => element['$type'], :caption => element['Caption'], \n\t\t\t\t\t\t:created_on => element['CreatedOn']['Value'], :modified_on => element['ModifiedOn']['Value'], :photo_count => element['PhotoCount'],\n\t\t\t\t\t\t:image_count => element['ImageCount'], :video_count => element['VideoCount'], :photo_bytes => element['PhotoBytes'], :views => element['Views'],\n\t\t\t\t\t\t:featured_index => element['FeaturedIndex'], :is_random_title_photo => element['IsRandomTitlePhoto'], :upload_url => element['UploadUrl'],\n\t\t\t\t\t\t:video_upload_url => element['VideoUploadUrl'], :page_url => element['PageUrl'], :mailbox_id => element['MailboxId'], :text_cn => element['TextCn'], \n\t\t\t\t\t\t:photo_list_cn => element['PhotoListCn'], :group_index => element['GroupIndex'], :title => element['Title'], :owner => element['Owner'])\n\t\t\t\telse\n\t\t\t\t\t#group_elements = load_group element['Id']\n\t\t\t\t\telements << ZenfolioAPI::Model::Group.new(:id => element['Id'], :created_on => element['CreatedOn']['Value'], :modified_on => element['ModifiedOn']['Value'], \n\t\t\t\t\t\t:page_url => element['PageUrl'], :mailbox_id => element['MailboxId'], :immediate_children_count => element['ImmediateChildrenCount'], :text_cn => element['TextCn'], \n\t\t\t\t\t\t:caption => element['Caption'], :collection_count => element['CollectionCount'], :sub_group_count => element['SubGroupCount'], :gallery_count => element['GalleryCount'],\n\t\t\t\t\t\t:featured_index => element['FeaturedIndex'], :is_random_title_photo => element['IsRandomTitlePhoto'], :upload_url => element['UploadUrl'],\n\t\t\t\t\t\t:photo_count => element['PhotoCount'], :parent_groups => element['ParentGroups'], :title => element['Title'])\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t@group = ZenfolioAPI::Model::Group.new(:id => @response['result']['Id'], :created_on => @response['result']['CreatedOn']['Value'], :modified_on => @response['result']['ModifiedOn']['Value'], \n\t\t\t\t:page_url => @response['result']['PageUrl'], :mailbox_id => @response['result']['MailboxId'], :immediate_children_count => @response['result']['ImmediateChildrenCount'], \n\t\t\t\t:text_cn => @response['result']['TextCn'], :caption => @response['result']['Caption'], :collection_count => @response['result']['CollectionCount'], \n\t\t\t\t:sub_group_count => @response['result']['SubGroupCount'], :gallery_count => @response['result']['GalleryCount'], :featured_index => @response['result']['FeaturedIndex'], \n\t\t\t\t:is_random_title_photo => @response['result']['IsRandomTitlePhoto'], :upload_url => @response['result']['UploadUrl'], :photo_count => @response['result']['PhotoCount'], \n\t\t\t\t:parent_groups => @response['result']['ParentGroups'], :title => @response['result']['Title'], :elements => elements)\n\n\t\t\t@group\n\t\tend", "def show\n @group = Group.find(params[:id])\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render :json => @group}\n end\n end", "def index\n\n @groups = Group.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @groups }\n format.json { render :json => @groups }\n end\n end", "def index\n @groupsIds = GroupsProssumer.where(prossumer_id: params[:prossumer_id]).pluck(:group_id)\n @groups = Group.where(id: @groups)\n render json: @groups\n end", "def list_groups()\n response = HTTParty.get(\"https://graph.microsoft.com/v1.0/groups\", { \n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Host\" => 'graph.microsoft.com' \n }\n })\n return JSON.parse response.read_body\n end", "def show\n @title = params[:group_name]\n @bp_pic_names = []\n @bp_pic_group = BpPicGroup.find(params[:id])\n @bp_pic_group_details = BpPicGroupDetail.find(:all, :conditions => [\"deleted = 0 and bp_pic_group_id = ? \", params[:id]])\n @bp_pic_group_details.each do |bp_pic_group_detail|\n bp_pic = BpPic.find(bp_pic_group_detail.bp_pic_id)\n business_partner = BusinessPartner.find(bp_pic.business_partner_id)\n @bp_pic_names.push([business_partner.business_partner_name, bp_pic.bp_pic_name, business_partner.id, bp_pic.id])\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bp_pic_group }\n end\n end", "def index\n @item_groups = ItemGroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @item_groups }\n end\n end", "def show_group(id)\n BrickFTP::API::Group.find(id)\n end", "def show_group(id)\n BrickFTP::API::Group.find(id)\n end", "def all_group_attachments\n @relevant_object = convert_id_to_model(params[:id])\n @images = get_all_media_items_for_model_type(@relevant_object.class.to_s.tableize)\n end", "def images\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/images\") )\n end", "def list_groups(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'ListGroups'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :marker\n\t\t\targs[:query]['Marker'] = optional[:marker]\n\t\tend\n\t\tif optional.key? :max_items\n\t\t\targs[:query]['MaxItems'] = optional[:max_items]\n\t\tend\n\t\tself.run(args)\n\tend", "def get_group(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'GetGroup'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :group_name\n\t\t\targs[:query]['GroupName'] = optional[:group_name]\n\t\tend\n\t\tself.run(args)\n\tend", "def index\n @meta_data_groups = MetaDataGroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meta_data_groups }\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 show\n @user_group = UserGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_group }\n end\n end", "def index\n @groups = current_user.groups\n render json: @groups\n end", "def im_group_with_http_info(group_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: IMGroupsApi.im_group ...'\n end\n # verify the required parameter 'group_id' is set\n if @api_client.config.client_side_validation && group_id.nil?\n fail ArgumentError, \"Missing the required parameter 'group_id' when calling IMGroupsApi.im_group\"\n end\n # resource path\n local_var_path = '/im/groups/{groupId}'.sub('{' + 'groupId' + '}', group_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20019')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IMGroupsApi#im_group\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_groups\n @course = Course.find(params[:course_id])\n render json: @course.groups\n end", "def list_galleries\n\t\t\t@response = api_request 'LoadGroupHierarchy', [@username]\n\n\t\t\t@response['result']['Elements'].each do |value|\n\t\t\t\tif value['$type'] == \"PhotoSet\"\n\t\t\t\t\t@galleries << ZenfolioAPI::Model::Gallery.new(:id => value['Id'], :type => value['$type'], :caption => value['Caption'], \n\t\t\t\t\t\t:created_on => value['CreatedOn']['Value'], :modified_on => value['ModifiedOn']['Value'], :photo_count => value['PhotoCount'],\n\t\t\t\t\t\t:image_count => value['ImageCount'], :video_count => value['VideoCount'], :photo_bytes => value['PhotoBytes'], :views => value['Views'],\n\t\t\t\t\t\t:featured_index => value['FeaturedIndex'], :is_random_title_photo => value['IsRandomTitlePhoto'], :upload_url => value['UploadUrl'],\n\t\t\t\t\t\t:video_upload_url => value['VideoUploadUrl'], :page_url => value['PageUrl'], :mailbox_id => value['MailboxId'], :text_cn => value['TextCn'], \n\t\t\t\t\t\t:photo_list_cn => value['PhotoListCn'], :group_index => value['GroupIndex'], :title => value['Title'], :owner => value['Owner'])\n\t\t\t\telsif value['$type'] == \"Group\"\t\n\t\t\t\t\telements = []\n\t\t\t\t\tvalue['Elements'].each do |element|\n\t\t\t\t\t\tif element['$type'] == \"PhotoSet\"\n\t\t\t\t\t\t\telements << ZenfolioAPI::Model::Gallery.new(:id => element['Id'], :type => element['$type'], :caption => element['Caption'], \n\t\t\t\t\t\t\t\t:created_on => element['CreatedOn']['Value'], :modified_on => element['ModifiedOn']['Value'], :photo_count => element['PhotoCount'],\n\t\t\t\t\t\t\t\t:image_count => element['ImageCount'], :video_count => element['VideoCount'], :photo_bytes => element['PhotoBytes'], :views => element['Views'],\n\t\t\t\t\t\t\t\t:featured_index => element['FeaturedIndex'], :is_random_title_photo => element['IsRandomTitlePhoto'], :upload_url => element['UploadUrl'],\n\t\t\t\t\t\t\t\t:video_upload_url => element['VideoUploadUrl'], :page_url => element['PageUrl'], :mailbox_id => element['MailboxId'], :text_cn => element['TextCn'], \n\t\t\t\t\t\t\t\t:photo_list_cn => element['PhotoListCn'], :group_index => element['GroupIndex'], :title => element['Title'], :owner => element['Owner'])\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t#group_elements = load_group element['Id']\n\t\t\t\t\t\t\telements << ZenfolioAPI::Model::Group.new(:id => element['Id'], :created_on => element['CreatedOn']['Value'], :modified_on => element['ModifiedOn']['Value'], \n\t\t\t\t\t\t\t\t:page_url => element['PageUrl'], :mailbox_id => element['MailboxId'], :immediate_children_count => value['ImmediateChildrenCount'], :text_cn => element['TextCn'], \n\t\t\t\t\t\t\t\t:caption => element['Caption'], :collection_count => value['CollectionCount'], :sub_group_count => value['SubGroupCount'], :gallery_count => value['GalleryCount'],\n\t\t\t\t\t\t\t\t:featured_index => element['FeaturedIndex'], :is_random_title_photo => element['IsRandomTitlePhoto'], :upload_url => element['UploadUrl'],\n\t\t\t\t\t\t\t\t:photo_count => value['PhotoCount'], :parent_groups => value['ParentGroups'], :title => value['Title'])\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\t@groups << ZenfolioAPI::Model::Group.new(:id => value['Id'], :created_on => value['CreatedOn']['Value'], :modified_on => value['ModifiedOn']['Value'], \n\t\t\t\t\t\t:page_url => value['PageUrl'], :mailbox_id => value['MailboxId'], :immediate_children_count => value['ImmediateChildrenCount'], :text_cn => value['TextCn'],\n\t\t\t\t\t\t:caption => value['Caption'], :collection_count => value['CollectionCount'], :sub_group_count => value['SubGroupCount'], :gallery_count => value['GalleryCount'],\n\t\t\t\t\t\t:photo_count => value['PhotoCount'], :parent_groups => value['ParentGroups'], :elements => elements, :title => value['Title'])\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t{:galleries => @galleries, :groups => @groups}\n\t\tend", "def index\n\n\t\t@groups = Group.find_paginate({:user=> current_user, :page => params[:page], :query => params[:query], :sort => params[:sort], :nb_items => get_nb_items(params[:nb_items]) })\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @groups }\n\t\t\tformat.json { render :json => @groups }\n\t\tend\n\tend", "def get_item_groups_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UniverseApi.get_item_groups ...\"\n end\n if opts[:'datasource'] && !['tranquility', 'singularity'].include?(opts[:'datasource'])\n fail ArgumentError, 'invalid value for \"datasource\", must be one of tranquility, singularity'\n end\n if !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling UniverseApi.get_item_groups, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = \"/universe/groups/\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'datasource'] = opts[:'datasource'] if !opts[:'datasource'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'user_agent'] = opts[:'user_agent'] if !opts[:'user_agent'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'X-User-Agent'] = opts[:'x_user_agent'] if !opts[:'x_user_agent'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Integer>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UniverseApi#get_item_groups\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @groups = Group.all\n end", "def index\n @groups = Group.all\n end", "def index\n @groups = Group.all\n end", "def index\n @groups = Group.all\n end", "def index\n @groups = Group.all\n end", "def index\n @groups = Group.all\n end", "def index\n @groups = Group.all\n end", "def index\n @groups = Group.all\n end", "def index\n @groups = Group.all\n end", "def index\n @groups = Group.all\n end", "def index\n @groups = Group.all\n end", "def index\n @groups = Group.all\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_group\n\t\t@student = Student.find(params[:student_id])\n\t\trender json: @student.groups.find_by(course_id: params[:course_id])\n\tend", "def show\n @bp_pic_group_detail = BpPicGroupDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bp_pic_group_detail }\n end\n end", "def im_groups(opts = {})\n data, _status_code, _headers = im_groups_with_http_info(opts)\n data\n end", "def show\n save_navi_state(['groups_title', 'browse_groups'])\n begin\n @group = Group.find(params[:id])\n @members = @group.members(session[:cookie]).paginate :page => params[:page], :per_page => per_page\n rescue RestClient::ResourceNotFound => e\n flash[:error] = :group_not_found\n redirect_to groups_path\n rescue ActiveRecord::RecordNotFound => e\n flash[:error] = :group_not_found\n redirect_to groups_path\n end\n end", "def get_groups_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: GroupsApi.get_groups ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if opts[:'sort_order'] && !['ascending', 'descending'].include?(opts[:'sort_order'])\n fail ArgumentError, 'invalid value for \"sort_order\", must be one of ascending, descending'\n end\n \n \n \n \n # resource path\n local_var_path = \"/api/v2/groups\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'id'] = @api_client.build_collection_param(opts[:'id'], :multi) if opts[:'id']\n query_params[:'jabberId'] = @api_client.build_collection_param(opts[:'jabber_id'], :multi) if opts[:'jabber_id']\n query_params[:'sortOrder'] = opts[:'sort_order'] if opts[:'sort_order']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'GroupEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GroupsApi#get_groups\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_all_groups_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: GroupControllerApi.get_all_groups ...'\n end\n allowable_values = [\"ASC\", \"DESC\"]\n if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])\n fail ArgumentError, \"invalid value for \\\"sort\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/groups/paginated'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?\n query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'PageGroupProjection' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GroupControllerApi#get_all_groups\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @api_v1_group_fields = Api::V1::GroupField.all\n end", "def index\n @group = current_user.groups.find_by(id: params[:group_id]) || @groups.first\n end", "def index\n respond_with @project do |format|\n format.json { render json: decorate_groups }\n end\n end", "def images\n IbmCloudRest.get \"#{@uri}/images\"\n end", "def show\n @item_group = ItemGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_group }\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 show_group\n group_name = params[:name]\n @group = $iam.groups[group_name]\n @users = @group.users\n @policies = @group.policies\n end", "def groups\n #@groups = Kaminari.paginate_array(current_user.publications(Group)).page(params[:page])\n @groups = current_user.publications(Group)\n @in_search_page = true\n respond_to do |format|\n format.any(:html, :wml) {\n # render :template=>'groups/index'\n }\n format.json { render :json => @groups }\n end\n end", "def index\n @groupons = Groupon.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groupons }\n end\n end", "def show\n @meta_data_group = MetaDataGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meta_data_group }\n end\n end", "def destroy\n @image_group = ImageGroup.find(params[:id])\n @image_group.destroy\n\n respond_to do |format|\n format.html { redirect_to image_groups_url }\n format.json { head :no_content }\n format.js {}\n end\n end", "def get_group_by_id(id)\n $r.hgetall(\"group:#{id}\")\n end", "def get_groups(params)\n send_get \"get_groups\", params\n end" ]
[ "0.7065757", "0.7058672", "0.6788443", "0.67826885", "0.6775769", "0.6639864", "0.6638153", "0.65698034", "0.65435266", "0.65393406", "0.65324646", "0.65324646", "0.65247214", "0.64920074", "0.6470677", "0.6450721", "0.6435345", "0.6422137", "0.64169836", "0.64140195", "0.6386154", "0.6379382", "0.63705176", "0.6346159", "0.63415605", "0.63341445", "0.6322666", "0.6322175", "0.6316823", "0.6314885", "0.6310102", "0.63098", "0.63098", "0.63088", "0.62961936", "0.6284405", "0.6281077", "0.6272949", "0.62584317", "0.625488", "0.62548333", "0.6249541", "0.62456703", "0.6243853", "0.6234808", "0.6218679", "0.6213378", "0.6207922", "0.6200743", "0.6194229", "0.6191379", "0.6189396", "0.61769754", "0.6174122", "0.6174122", "0.6172009", "0.61716443", "0.6162793", "0.6162451", "0.6159665", "0.6159352", "0.6159232", "0.6147144", "0.6146493", "0.61426", "0.61408615", "0.61397594", "0.61386687", "0.6137533", "0.6137533", "0.6137533", "0.6137533", "0.6137533", "0.6137533", "0.6137533", "0.6137533", "0.6137533", "0.6137533", "0.6137533", "0.6137533", "0.6121175", "0.61171216", "0.61052644", "0.6092043", "0.6086132", "0.60820067", "0.6081917", "0.6079499", "0.6076354", "0.6076168", "0.60735554", "0.6073546", "0.6061758", "0.6055938", "0.6049341", "0.60420376", "0.60374486", "0.60313165", "0.6026949", "0.60196006" ]
0.777888
0
GET /image_groups/new GET /image_groups/new.json
def new @image_group = ImageGroup.new @category_id = params[:category_id] puts ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" puts "xxxx" unless !@image_group.id.nil? puts ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" respond_to do |format| format.html # new.html.erb format.json { render json: @image_group } #format.js { render js:"$('#subpage-pane').html('<%= j render :partial=>form %>')" } format.js {} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @group = Group.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end", "def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end", "def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end", "def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end", "def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end", "def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end", "def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end", "def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end", "def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end", "def new\n @group = Group.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group }\n end\n end", "def new\n @group = Group.new\n render json: @group\n end", "def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group }\n end\n end", "def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group }\n end\n end", "def new\n @group = Group.new\n\n render json: @group\n end", "def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group }\n end\n end", "def new\n @breadcrumb = 'create'\n @ratio_group = RatioGroup.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ratio_group }\n end\n end", "def new\n @title = \"Добавление группы характеристик\"\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end", "def new\n @image_gallery_image = @image_gallery_group.images.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @image_gallery_image }\n end\n end", "def new\n @groupaddrobj = Groupaddrobj.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @groupaddrobj }\n end\n end", "def new\n @user = User.find(params[:user_id])\n @groups = @user.groups.new\n\n #@group = Group.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end", "def new\n @bp_pic_group = BpPicGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bp_pic_group }\n end\n end", "def new\n Group.rebuild! if nil.|Group.find(:first).rgt\n\t @group = Group.new\n\t @groups = current_user.get_unique_group_branches.map {|g| g.get_self_and_children?}.flatten\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end", "def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n format.xml { render xml: @group }\n end\n end", "def new\n @group = Group.new\n respond_to do |format|\n #format.html # new.html.erb\n format.json { render json: @group }\n end\n end", "def new\n\t\t@group = Group.new\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @group }\n\t\t\tformat.json { render :json => @group }\n\t\tend\n\tend", "def new\n\t\t@group = Group.new\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @group }\n\t\t\tformat.json { render :json => @group }\n\t\tend\n\tend", "def new\n @item_group = ItemGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_group }\n end\n end", "def new #:nodoc:\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.haml\n # format.xml { render :xml => @group }\n end\n end", "def new\n @group.parent_id = params[:group_id]\n \n add_breadcrumb 'Your hubs', :hubs_path\n add_breadcrumb @hub.name, hub_path(@hub)\n unless params[:group_id]\n add_breadcrumb 'New group', new_hub_group_path(@hub)\n else\n add_breadcrumb 'New sub group', hub_group_subgroup_path(@hub, @group.parent)\n end\n \n append_title 'New group'\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group }\n end\n end", "def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.haml\n format.js # new.js.rjs\n format.xml { render :xml => @group }\n format.json { render :json => @group }\n end\n end", "def new\n\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n format.json { render :json => @group }\n end\n end", "def new\n @user_group = UserGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_group }\n end\n end", "def new\n @add_group_to_user = AddGroupToUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @add_group_to_user }\n end\n end", "def new\n @group = SuperSimpleCms::Group.new\n\n respond_to do |format|\n format.html {render :template=>'admin/groups/new'}\n format.js {render :template=>'admin/groups/new', :layout=>false}\n format.xml { render :xml => @group }\n end\n end", "def createGroup(groupName, gid)\r\n uri = sprintf(\"/api/v1/group_categories/%d/groups\", gid) \r\n \r\n dbg(\"POST #{uri}\")\r\n dbg(\"name=#{groupName}\")\r\n newGroup = $canvas.post(uri, {'name' => groupName})\r\n dbg(newGroup)\r\n return newGroup\r\nend", "def createGroup(groupName, gid)\r\n uri = sprintf(\"/api/v1/group_categories/%d/groups\", gid) \r\n \r\n dbg(\"POST #{uri}\")\r\n dbg(\"name=#{groupName}\")\r\n newGroup = $canvas.post(uri, {'name' => groupName})\r\n dbg(newGroup)\r\n return newGroup\r\nend", "def new\n @group_request = GroupRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group_request }\n end\n end", "def new\n @pgroup = Pgroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pgroup }\n end\n end", "def new\n @pgroup = Pgroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pgroup }\n end\n end", "def new\n @group_map = GroupMap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_map }\n end\n end", "def new\n @group_record = GroupRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_record }\n end\n end", "def new\n save_navi_state(['groups_title', 'new_group'])\n @group = Group.new\n end", "def new\n add_breadcrumb \"Social\", social_path()\n add_breadcrumb \"Create group\"\n \n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end", "def new_nodegroup(nodegroup_json)\n nodemgr_rest_call(\"POST\", \"classifier\", \"groups\", $credentials, id=\"\", nodegroup_json)\nend", "def create\n @image_gallery_image = @image_gallery_group.images.new(params[:image_gallery_image])\n\n respond_to do |format|\n if @image_gallery_image.save\n flash[:notice] = 'ImageGalleryImage was successfully created.'\n format.html { redirect_to([:admin, @image_gallery_group]) }\n format.xml { render :xml => @image_gallery_group, :status => :created, :location => @image_gallery_group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @image_gallery_group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @group = Group.find(params[:group_id])\n @album = @group.albums.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "def new\n @title = \"Добавление возрастной группы\"\n @age_group = AgeGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @age_group }\n end\n end", "def new\n @user_group = UserGroup.new\n @users = User.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_group }\n end\n end", "def new\n @image_gallery_group = ImageGalleryGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @image_gallery_group }\n end\n end", "def new\n @issue_group = IssueGroup.new\n\n #Load possible GitHub\n @repos = GithubWrapper.new()\n @repos.list_all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue_group }\n end\n end", "def create\n group = Group.new(group_params)\n if group.save\n render json: group\n else\n render json: group.errors.full_messages, status: :unprocessable_entity\n end\n end", "def new\n @group_label = GroupLabel.new\n 1.times {@group_label.labels.build}\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_label }\n end\n end", "def new\n @group_mag = GroupMag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_mag }\n end\n end", "def new\n @meta_data_group = MetaDataGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meta_data_group }\n end\n end", "def new\n @groupon = Groupon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @groupon }\n end\n end", "def new\n @group = GROUP.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end", "def new\n @group = Group.new(:owner => current_user)\n authorize @group, :new?\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end", "def new\n @group = Group.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end", "def create\n @gallery_group = GalleryGroup.new(gallery_group_params)\n\n respond_to do |format|\n if @gallery_group.save\n format.html { redirect_to @gallery_group, notice: 'Gallery group was successfully created.' }\n format.json { render :show, status: :created, location: @gallery_group }\n else\n format.html { render :new }\n format.json { render json: @gallery_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @gallery = Gallery.new\n @rights = {'Moderators' => 'moderators', 'Members' => 'members', 'Anybody' => 'all'}\n\n @gallery.parent_type = params[:parent_type]\n @gallery.parent_id = params[:parent_id]\n set_session_parent_pictures_root_path(@gallery.get_parent_object)\n\n @new_pictures = Array.new\n 1.upto(3) { @new_pictures << Picture.new }\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gallery }\n end\n end", "def new\n @group = current_user.created_groups.new\n end", "def new\n @esol_group = EsolGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @esol_group }\n end\n end", "def new\n @group = Group.new \n end", "def new\n @title = t('view.customers_groups.new_title')\n @customers_group = CustomersGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customers_group }\n end\n end", "def new\n @title = t('view.customers_groups.new_title')\n @customers_group = CustomersGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customers_group }\n end\n end", "def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, :notice => 'Group was successfully created.' }\n format.json { render :json => @group, :status => :created, :location => @group}\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @group = @current_user.create_group(params[:group])\n # @group = @current_user.groups.build(params[:group])\n # @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.valid?\n format.html { redirect_to circle_groups_path, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @group = Group.new\n\n respond_to do |format|\n #format.html # new.html.erb\n #format.xml { render :xml => @group }\n format.js { render :action => 'new' }\n end\n end", "def create\n #should expire groups page cache\n \n # expire the cache of the grouplist of this user\n Rails.cache.delete(Person.groups_cache_key(@current_user.id, session[:cookie]))\n \n @group = Group.new\n begin\n @group = Group.create(params[\"group\"], session[:cookie])\n flash[:notice] = :group_created_successfully\n redirect_to group_path(@group) and return\n rescue RestClient::RequestFailed => e\n @group.add_errors_from(e)\n @group.form_title = params[:group][:title]\n @group.form_description = params[:group][:description]\n render :action => :new and return\n rescue RestClient::Unauthorized => e\n @group.add_errors_from(e)\n @group.form_title = params[:group][:title]\n @group.form_description = params[:group][:description]\n render :action => :new and return \n end\n end", "def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end", "def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end", "def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end", "def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end", "def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end", "def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end", "def new\n @image_section = ImageSection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image_section }\n end\n end", "def new\n @product_group = ProductGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_group }\n end\n end", "def new\n @bp_pic_group_detail = BpPicGroupDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bp_pic_group_detail }\n end\n end", "def new\n @group_stat = GroupStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_stat }\n end\n end", "def create\n new_group = Group.new(name: params[:name])\n\n if new_group.save\n render json: { \"notice\"=>\"new group #{params[:name]} successfully created\" }\n else\n render json: { \"alert\"=>\"group creation failed. check params.\" }\n end\n end", "def new\n @image_gallery = ImageGallery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image_gallery }\n end\n end", "def new\n @groups = Group.all\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @person }\n format.json { render :json => @person }\n end\n end", "def new\n @collage = Collage.new\n @images = Image.order('created_at DESC')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collage }\n end\n end", "def new\n @fun_group = FunGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fun_group }\n end\n end", "def new\n @group = Group.new\n end", "def new\n @group = Group.new\n end", "def new\n @group = Group.new\n end", "def new\n @group = Group.new\n end", "def new\n @group = Group.new\n end", "def new\n @connection_group = ConnectionGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @connection_group }\n end\n end", "def create\n @group = Group.new(new_group_params)\n if @group.save\n redirect_to groups_url\n else\n render :template => \"groups/new\"\n end\n end", "def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @image }\n end\n end", "def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end", "def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end", "def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end", "def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end" ]
[ "0.74592793", "0.743851", "0.743851", "0.743851", "0.743851", "0.743851", "0.743851", "0.743851", "0.743851", "0.7390495", "0.7381791", "0.7370646", "0.7370646", "0.7342192", "0.7331665", "0.7293258", "0.727606", "0.7187047", "0.71770185", "0.7142491", "0.71134156", "0.70959485", "0.7095628", "0.70887005", "0.70765764", "0.70765764", "0.70415145", "0.7032306", "0.700163", "0.6998566", "0.6997949", "0.6997413", "0.6997326", "0.69681126", "0.69677067", "0.69677067", "0.6945598", "0.6938054", "0.6938054", "0.6896039", "0.6894035", "0.6891734", "0.6889798", "0.6886223", "0.6885371", "0.68789566", "0.6875568", "0.6864767", "0.685134", "0.68492883", "0.6835815", "0.6831946", "0.6830642", "0.68304116", "0.6826038", "0.68172157", "0.68034273", "0.68013656", "0.67824405", "0.67646635", "0.67598414", "0.67574716", "0.6747292", "0.6744126", "0.6744126", "0.6742495", "0.6728097", "0.67276114", "0.6714548", "0.67126155", "0.67126155", "0.67126155", "0.67126155", "0.67126155", "0.67126155", "0.6712102", "0.67013806", "0.6700545", "0.6699712", "0.6686831", "0.6677738", "0.66767454", "0.66753197", "0.6670155", "0.66610515", "0.66610515", "0.66610515", "0.66610515", "0.66610515", "0.6660938", "0.6651085", "0.6647894", "0.6647894", "0.6647894", "0.6647894", "0.6647894", "0.66403085", "0.66396743", "0.66396743", "0.66396743", "0.66396743" ]
0.0
-1
POST /image_groups POST /image_groups.json
def create @image_group = ImageGroup.new(params[:image_group]) puts params[:image_group] puts params[:image_group][:enabled] respond_to do |format| if @image_group.save format.html { redirect_to @image_group, notice: 'Image group was successfully created.' } format.json { render json: @image_group, status: :created, location: @image_group } format.js else format.html { render action: "new" } format.json { render json: @image_group.errors, status: :unprocessable_entity } format.js end end p @image_group.errors.full_messages end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createGroup(groupName, gid)\r\n uri = sprintf(\"/api/v1/group_categories/%d/groups\", gid) \r\n \r\n dbg(\"POST #{uri}\")\r\n dbg(\"name=#{groupName}\")\r\n newGroup = $canvas.post(uri, {'name' => groupName})\r\n dbg(newGroup)\r\n return newGroup\r\nend", "def createGroup(groupName, gid)\r\n uri = sprintf(\"/api/v1/group_categories/%d/groups\", gid) \r\n \r\n dbg(\"POST #{uri}\")\r\n dbg(\"name=#{groupName}\")\r\n newGroup = $canvas.post(uri, {'name' => groupName})\r\n dbg(newGroup)\r\n return newGroup\r\nend", "def CreateGroup params = {}\n \n APICall(path: 'groups.json',method: 'POST',payload: params.to_json)\n \n end", "def group_params\n params.require(:group).permit(:name, :group_image, user_ids: [])\n end", "def new_nodegroup(nodegroup_json)\n nodemgr_rest_call(\"POST\", \"classifier\", \"groups\", $credentials, id=\"\", nodegroup_json)\nend", "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 create_group(path, name)\n puts \"creating #{name} on path #{path}\"\n \n ret = RestClient.post \"#{@url}/groups\", \n { path: path, name: name }, \n { \"Private-Token\": @token } \n json = JSON.parse(ret.body)\n\n json['id']\n end", "def group_params\n params.require(:group).permit(:group_name, :user_id, :group_image)\n end", "def create\n #logger.info \"Post parameters: #{params}\"\n @group = Group.new(name: params[:group][:name], expiration: params[:group][:expiration], owner: current_user)\n if @group.save\n @group.memberships.create!(user: current_user, admin: true)\n if params[:group][:users]\n params[:group][:users].each do |u|\n @group.memberships.create!(user: User.where(\"id = ? OR email = ?\", u[:id], u[:email]).first, admin:u[:admin])\n end\n end\n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end", "def postEntityGroup( entity_id, group_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['group_id'] = group_id\n return doCurl(\"post\",\"/entity/group\",params)\n end", "def create\n group = Group.new(group_params)\n if group.save\n render json: group\n else\n render json: group.errors.full_messages, status: :unprocessable_entity\n end\n end", "def create\n #logger.info \"Post parameters: #{params}\"\n @group = Group.new(name: params[:group][:name], expiration: params[:group][:expiration])\n if @group.save\n params[:group][:users].each do |u|\n Membership.create(group: @group, user: User.where(\"id = ? OR email = ?\", u[:id], u[:email]).first, admin:u[:admin])\n end\n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end", "def im_group_create_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: IMGroupsApi.im_group_create ...'\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling IMGroupsApi.im_group_create\"\n end\n # resource path\n local_var_path = '/im/groups'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IMGroupsApi#im_group_create\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @user = User.find(current_user.id)\n @group = Group.new(group_params)\n\n @group.title = params[:title]\n @group.description = params[:description]\n @group.groupProfile = params[:groupProfile]\n @group.groupCover = params[:groupCover]\n\n respond_to do |format|\n if @group.save\n @user.groups << @group\n\n GroupCategory.new(group_id: @group.id , category_id: params[:category]).save\n\n format.html { redirect_to user_group_path(current_user.id, @group.id) }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_new_groups(params = {})\n post(\"/groups\", params)\n end", "def create\n @user.create_group!(new_group_params[:group_user_ids], {name: new_group_params[:name]})\n end", "def create\n @image_gallery_image = @image_gallery_group.images.new(params[:image_gallery_image])\n\n respond_to do |format|\n if @image_gallery_image.save\n flash[:notice] = 'ImageGalleryImage was successfully created.'\n format.html { redirect_to([:admin, @image_gallery_group]) }\n format.xml { render :xml => @image_gallery_group, :status => :created, :location => @image_gallery_group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @image_gallery_group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n ip = request.location\n @user = current_user\n @group = @user.groups_as_owner.new(params[:group])\n params[:group][:member_ids] = (params[:group][:member_ids] << @group.member_ids).flatten\n @group.school_id = @user.school_id\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def generate(groups)\n groups_params = groups.inject({}) do |params, (k, v)|\n params[\"groups[#{k}]\"] = 1\n params\n end\n\n response = RouteNGN.put self.class.base_url, {:id => self.id}.merge!(groups_params)\n response.success?\n end", "def create\n @group = Group.new(group_params)\n\n if @group.save\n render_json_message({:success => t('.success')}, 201, {id: @group.id})\n else\n render_json_message({:errors => @group.errors.messages}, 422)\n end\n\n end", "def create\n @group = Group.new(group_params)\n @group.owner = current_user\n\n if @group.save\n @group.add!(current_user)\n \n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end", "def add_to_group\n if request.post?\n @user_id = params[:user_id]\n @group = params[:group_ids]\n @created_g_u= Array.new\n @group.each do |g|\n #g_user = GroupUser.find(:all,:conditions=>[\"user_id=#{@user_id.to_i} and group_id=#{g.to_i}\"])\n group_user = GroupUser.create(:user_id=>@user_id.to_i,:group_id=>g.to_i)# if g_user.blank?\n @created_g_u << group_user if group_user.id\n end\n @notice = \"Successfully added to group.\"\n respond_to do |format|\n format.js\n end\n \n else\n render :partial=>\"add_to_group_form\", :locals=>{:user=>@login_user,:user_id=>params[:id]}, :layout=>false\n end\n end", "def create\n\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n\n @course = Course.find([@group.course_id]).first\n\n @course.cfolders.each do |cfolder|\n gfolder = @group.gfolders.create(name: cfolder.name, group_id: @group.id)\n cfolder.cposts.each do |cpost|\n gpost = gfolder.gposts.create(title: cpost.id, body: cpost.body, link: cpost.link, gfolder_id: gfolder.id)\n end\n end\n\n format.html { redirect_to [@group], notice: 'group was successfully created.' }\n format.json { render :show, status: :created, location: [@group] }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def group_params\n params.permit(:group_title, :image, new_members: [], del_members: [], new_admins: [], del_admins: [])\n end", "def create\n @group = @current_user.create_group(params[:group])\n # @group = @current_user.groups.build(params[:group])\n # @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.valid?\n format.html { redirect_to circle_groups_path, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def group_params\n params.require(:group).permit(:name, :image, :description, :primary_statistics)\n end", "def create\n params[:group].delete(:domain) unless current_group.shapado_version.has_custom_domain?\n @group = Group.new\n if params[:group][:languages]\n params[:group][:languages].reject! { |lang| lang.blank? }\n end\n @group.safe_update(%w[languages name legend description default_tags subdomain logo forum enable_mathjax enable_latex custom_favicon language theme signup_type custom_css wysiwyg_editor], params[:group])\n\n @group.safe_update(%w[isolate domain private], params[:group]) if current_user.admin?\n\n @group.owner = current_user\n @group.state = \"active\"\n\n respond_to do |format|\n if @group.save\n @group.create_default_widgets\n\n Jobs::Images.async.generate_group_thumbnails(@group.id)\n @group.add_member(current_user, \"owner\")\n flash[:notice] = I18n.t(\"groups.create.flash_notice\")\n format.html { redirect_to(domain_url(:custom => @group.domain, :controller => \"admin/manage\", :action => \"properties\")) }\n format.json { render :json => @group.to_json, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @gallery_group = GalleryGroup.new(gallery_group_params)\n\n respond_to do |format|\n if @gallery_group.save\n format.html { redirect_to @gallery_group, notice: 'Gallery group was successfully created.' }\n format.json { render :show, status: :created, location: @gallery_group }\n else\n format.html { render :new }\n format.json { render json: @gallery_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n cu = User.find params[:user_id]\n\n @group = Group.new(params[:group])\n cu.groups << @group\n\n case params[:group_type].to_i\n when 1\n @group.groupable = ArtistGroup.create\n\n if defined?(params[:instr_id]) && (not params[:instr_id].nil?)\n m = Membership.where \"group_id = #{@group.id}\n AND userable_id = #{cu.id}\n AND userable_type = 'User'\"\n params[:instr_id].each do |i|\n m.first.instruments << Instrument.find(i)\n end\n end\n when 2\n @group.groupable = FanGroup.create :artist_group => ArtistGroup.find(params[:art_group_id].to_i)\n when 3\n @group.groupable = HostGroup.create\n end\n\n\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Die Gruppe wurde erfolgreich angelegt.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.json { render json: @group, status: :created }\n else\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @group = Group.new(group_params)\n @group.create_robotsurvey()\n @group.create_signupsurvey()\n @group.create_poststudysurvey()\n respond_to do |format|\n if @group.save\n \n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_multiple_photos\n session[:current_images] = (0...8).map{65.+(rand(25)).chr}.join unless session[:current_images]\n @photo = Picture.new(:photo => params[:picture][:path], :photo_detail => \"#{session[:current_images]}\", :share_type => \"99\", :album_id => \"\")\n if @photo.save\n @group_ids = params[:group_ids]\n @group_ids.each do |grp|\n SharedTab.create(:shareable_id=>@photo.id,:group_id=>grp.to_i,:shareable_type=>\"Picture\")\n end if !@group_ids.blank?\n flash[:notice] = \"Photo added successfully.\"\n if @photo.save\n respond_to do |format|\n format.html { #(html response is for browsers using iframe sollution)\n render :json => [@photo.to_jq_upload].to_json,\n :content_type => 'text/html',\n :layout => false\n }\n format.json {\n render :json => [@photo.to_jq_upload].to_json\n }\n end\n else\n render :json => [{:error => \"custom_failure\"}], :status => 304\n end\n end\n\n end", "def create_group(attributes)\n post(\"/v1/groups\", attributes)\n end", "def group_params\n params.require(:group).permit(:name, :description, :bank_id, :image)\n end", "def create\n @image_gallery_group = ImageGalleryGroup.new(params[:image_gallery_group])\n\n respond_to do |format|\n if @image_gallery_group.save\n if ( @image_gallery_group.parent_group_id == nil )\n @image_gallery_group.parent_group_id = @image_gallery_group.id;\n @image_gallery_group.save;\n end\n flash[:notice] = 'ImageGalleryGroup was successfully created.'\n format.html { redirect_to([:admin, @image_gallery_group]) }\n format.xml { render :xml => @image_gallery_group, :status => :created, :location => @image_gallery_group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @image_gallery_group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\n # original code\n\n # @image_set = ImageSet.create(image_set_params)\n\n # render json: @image_set\n\n# code for imageMagick\n @image_set = current_user.image_sets.guild(image_set_params)\n authorize @image_set\n if @image_set.save\n # to handle multiple image upload on create\n if params[:images]\n params[:images].each {|image|\n @image_set.images.create(image: image)\n }\n end\n flash[:notice] = \"Your image set has been created.\"\n redirect_to @image_set\n else\n flash[:alert] = \"Something went wrong.\"\n render 'new'\n end\n\n end", "def postGroupBulk_ingest( group_id, filedata, category_type)\n params = Hash.new\n params['group_id'] = group_id\n params['filedata'] = filedata\n params['category_type'] = category_type\n return doCurl(\"post\",\"/group/bulk_ingest\",params)\n end", "def create\n @group = Group.new(group_params)\n respond_to do |format|\n if @group.save\n @group.users.push(current_user)\n UserGroup.set_is_admin(@group.id, current_user.id, true)\n invite_members\n format.html { redirect_to @group, notice: t('flash.notice.groups.successfully_created') }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to groups_path, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n puts params[:image_group]\n puts params[:image_group][:promoted]\n p \">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\"\n if !params[:images][:removed].blank?\n puts \"removed images\" + params[:images][:removed]\n removedImages = Image.where(\" id in (?)\", params[:images][:removed].split(','))\n\n #remove the image from a group\n removedImages.each do |ri|\n ri.group_id=nil\n ri.save\n end\n end\n\n if !params[:images][:added].blank?\n puts \"new added images\" + params[:images][:added]\n addedImages = Image.where(\" id in (?)\", params[:images][:added].split(','))\n\n #remove the image from a group\n addedImages.each do |ai|\n ai.group_id=params[:id]\n ai.save\n end\n end \n\n\n @image_group = ImageGroup.find(params[:id])\n\n if params[:image_group][:cover_image_id].nil?\n @image_group.errors.add(:nil_cover, \"必须指定封面图片才能使该图组生效\")\n return\n elsif @image_group.images.nil?\n @image_group.errors.add(:nil_images, \"必须指定内容图片才能使该图组生效\")\n return \n end\n\n respond_to do |format|\n if @image_group.update_attributes(params[:image_group])\n format.html { redirect_to @image_group, notice: 'Image group was successfully updated.' }\n format.json { head :no_content }\n format.js {}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image_group.errors, status: :unprocessable_entity }\n format.js {}\n end\n end\n end", "def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, :notice => 'Group was successfully created.' }\n format.json { render :json => @group, :status => :created, :location => @group}\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n new_group = Group.new(name: params[:name])\n\n if new_group.save\n render json: { \"notice\"=>\"new group #{params[:name]} successfully created\" }\n else\n render json: { \"alert\"=>\"group creation failed. check params.\" }\n end\n end", "def create\n #should expire groups page cache\n \n # expire the cache of the grouplist of this user\n Rails.cache.delete(Person.groups_cache_key(@current_user.id, session[:cookie]))\n \n @group = Group.new\n begin\n @group = Group.create(params[\"group\"], session[:cookie])\n flash[:notice] = :group_created_successfully\n redirect_to group_path(@group) and return\n rescue RestClient::RequestFailed => e\n @group.add_errors_from(e)\n @group.form_title = params[:group][:title]\n @group.form_description = params[:group][:description]\n render :action => :new and return\n rescue RestClient::Unauthorized => e\n @group.add_errors_from(e)\n @group.form_title = params[:group][:title]\n @group.form_description = params[:group][:description]\n render :action => :new and return \n end\n end", "def create\n @group = Group.new(params[:group])\n @group.owner = current_user\n\n group_name_exists = false\n current_user.owned_groups.each do |g|\n if g.name == @group.name\n group_name_exists = true\n break\n end\n end\n \n respond_to do |format|\n if group_name_exists\n format.html { redirect_to groups_path, :alert => \"You already have a list by the name '#{@group.name}'.\" }\n format.json { render :json => @group, :status => :created, :location => @group }\n elsif @group.save\n format.html { redirect_to @group, :notice => 'Group was successfully created.' }\n format.json { render :json => @group, :status => :created, :location => @group }\n else\n error_msg = 'Unexpected error while creating group.'\n if @group.errors.messages.count > 0\n error_msg = 'Following error(s) prevented the group from being saved: '\n multiple = false\n @group.errors.full_messages.each do |msg|\n if multiple\n error_msg += ', '\n end\n error_msg += msg\n multiple = true\n end\n end\n format.html { redirect_to groups_path, :action => 'index', :alert => error_msg }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_group(groupname)\n current_path = '/api/v1/groups'\n payload = { 'group_name' => groupname }.to_json\n @conn.post(current_path, payload)\n end", "def group_params\n params.require(:group).permit(\n :group_name, :entity_id, :form_type, :avatar, :remove_avatar\n )\n end", "def create_group(files, options = {})\n Uploadcare::Group.create(files, options)\n end", "def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @group = Group.new(group_params)\n #On vérifie que la liste de droits d'un groupe est effacé\n @group.rights.clear\n\n #On ajoute les droits choisis par un utilisateur\n params[:group][:right_ids] ||= []\n params[:group][:right_ids].each do |right|\n if !(right.blank?)\n @group.add_right(Right.find_by_id(right))\n end\n end\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: t('group.created_msg') }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_group(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateGroup'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :comments\n\t\t\targs[:query]['Comments'] = optional[:comments]\n\t\tend\n\t\tif optional.key? :group_name\n\t\t\targs[:query]['GroupName'] = optional[:group_name]\n\t\tend\n\t\tself.run(args)\n\tend", "def create_asset_group_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AssetGroupApi.create_asset_group ...'\n end\n # resource path\n local_var_path = '/api/3/asset_groups'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'asset_group'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'CreatedReferenceAssetGroupIDLink')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AssetGroupApi#create_asset_group\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def group_params\n params.permit(:image,:name,:profile)\n end", "def create\n @bp_pic_group = create_model(:bp_pic_groups, params[:bp_pic_group])\n source_group_id = params[:src_id]\n\n respond_to do |format|\n begin\n set_user_column(@bp_pic_group)\n @bp_pic_group.save!\n\n # params[:src_id]があった場合、グループのコピーとみなす\n @bp_pic_group.create_clone_group(source_group_id) unless source_group_id.nil?\n\n format.html { redirect_to back_to, notice: 'Bp pic group was successfully created.' }\n format.json { render json: @bp_pic_group, status: :created, location: @bp_pic_group }\n rescue ActiveRecord::RecordInvalid\n format.html { render action: \"new\" }\n format.json { render json: @bp_pic_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @group = Group.new(group_params)\n @group.owner_id = current_user.id\n @group.users << current_user\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Le groupe a été créé.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def group_params\n params.require(:group).permit(:name, :owner_id, :description, :group_photo)\n end", "def create_group\n\t\t@group = Group.new(params[:group])\n\t\t@group.cardsort_id = params[:cardsort_id]\n\t\trespond_to do |format|\n\t\t\tif (@group.save)\n\t\t\t\tformat.js {render \"new_group\", :status => :created}\n\t\t\telse\n\t\t\t\tformat.js {render \"new_group\", :status => :ok}\n\t\t\tend\n\t\tend\n\tend", "def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def group_create(element)\n name = element[\"group\"]\n auth = element[\"auth\"]\n body = {\n \"jsonrpc\" => \"2.0\",\n \"method\" => \"hostgroup.create\",\n \"params\" => {\n \"name\" => name\n },\n \"auth\" => auth,\n \"id\" => rand(9999)\n }\n result = json_body(body)\n # puts result\n result = result[\"groupids\"]\n result = result[0]\n # puts result\n # return will be group id\n return result\nend", "def create\n\n group = Group.create(group_parm.merge(account_id: current_user.id)) #group creater current user will be the admin of group\n if group.save!\n render :json => Base64.encode64(group.id.to_s) and return\n else\t\t \n render :json => group.errors.full_messages.first and return\n end \n end", "def create_group(attributes)\n BrickFTP::API::Group.create(attributes)\n end", "def create_group(attributes)\n BrickFTP::API::Group.create(attributes)\n end", "def create_group(group_name, path = '/')\n request(\n 'Action' => 'CreateGroup',\n 'GroupName' => group_name,\n 'Path' => path,\n :parser => Fog::Parsers::AWS::IAM::CreateGroup.new\n )\n end", "def createGroup\n call :createGroup\n end", "def add_photo_from_system\n @photo = Picture.new(params[:photos])\n if @photo.save\n @group_ids = params[:group_ids]\n @group_ids.each do |grp|\n SharedTab.create(:shareable_id=>@photo.id,:group_id=>grp.to_i,:shareable_type=>\"Picture\")\n end if !@group_ids.blank?\n flash[:notice] = \"Photo added successfully.\"\n end\n flash[:notice] = @photo.errors.first[1] if !@photo.errors.blank?\n redirect_to :back\n\n end", "def create\n @collection_group = CollectionGroup.new(collection_group_params)\n\n respond_to do |format|\n if @collection_group.save\n format.html { redirect_to @collection_group, notice: 'Collection group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @collection_group }\n else\n format.html { render action: 'new' }\n format.json { render json: @collection_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @group = Group.new(params[:group])\n new_sort = Configurations.get_sort('group')\n @group.sort = new_sort\n @group.deleted = 0\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to :groups, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @resource = Group.new(group_params)\n\n respond_to do |format|\n if @resource.save\n index\n\n flash[:success] = t('notices.saved_successfully')\n format.html { redirect_to @resource, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @resource }\n else\n format.html { render :new }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n format.js\n end\n end", "def create_group_with_http_info(group_body_create, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: GroupsApi.create_group ...\"\n end\n # verify the required parameter 'group_body_create' is set\n fail ArgumentError, \"Missing the required parameter 'group_body_create' when calling GroupsApi.create_group\" if group_body_create.nil?\n # resource path\n local_var_path = \"/groups\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?\n query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(group_body_create)\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'GroupEntry')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GroupsApi#create_group\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @group = Group.new(params[:group])\n\t\t@group.user_id = session[:user_id]\n\n respond_to do |format|\n if @group.save\n\n\t\t\t\t@page = Page.create(:owner => @group.id, :category => 'group')\n\t\t\t\t@group_member = GroupMember.create(:group_id => @group.id, :user_id => session[:user_id], :moderator => true)\n format.html { redirect_to groups_url, :notice => 'Group was successfully created.' }\n format.json { render :json => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @group = @group_model.new(group_params)\n respond_to do |format|\n if @group.save\n @course.groups<< @group\n format.html { redirect_to course_group_path(@course,@group), notice: \"#{@group_model.to_s} was successfully created.\" }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bp_pic_group = BpPicGroup.new(params[:bp_pic_group])\n source_group_id = params[:src_id]\n \n respond_to do |format|\n begin\n set_user_column(@bp_pic_group)\n @bp_pic_group.save!\n \n # params[:src_id]があった場合、グループのコピーとみなす\n @bp_pic_group.create_clone_group(source_group_id) unless source_group_id.nil?\n \n format.html { redirect_to back_to, notice: 'Bp pic group was successfully created.' }\n format.json { render json: @bp_pic_group, status: :created, location: @bp_pic_group }\n rescue ActiveRecord::RecordInvalid\n format.html { render action: \"new\" }\n format.json { render json: @bp_pic_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @group = Group.new(group_params)\n @group.owner = current_user\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to group_path(@group), notice: \"Group was successfully created.\" }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @group = Group.new(group_params)\n @group.user = @user\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def move_users_to_group(group_id, arr_of_user_ids)\n arr_of_user_ids.each { |id|\n populate_group = HTTParty.post(\n \"#{$canvas_url}/api/v1/groups/#{group_id}/memberships\",\n headers: { \"authorization\" => \"Bearer #{$canvas_token}\" },\n body: {\n user_id: id\n } \n )\n }\nend", "def create\n @image_collection = ImageCollection.new(image_collection_params)\n\n respond_to do |format|\n if @image_collection.save\n image_collection_params[:attached_images].reject(&:empty?).each do |id|\n @image_collection.images << Image.find(id)\n end\n\n @image_collection.save\n\n format.html { redirect_to @image_collection, notice: 'Image collection was successfully created.' }\n format.json { render :show, status: :created, location: @image_collection }\n else\n format.html { render :new }\n format.json { render json: @image_collection.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @group = Group.new(group_params)\n respond_to do |format|\n if @group.save\n @group.memberships.create(user_id: current_user.id, state: \"owner\")\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def move_users_to_group(group_id, set_of_user_ids)\n set_of_user_ids.each do |id|\n @url = \"http://#{$canvas_host}/api/v1/groups/#{group_id}/memberships\"\n puts \"@url is #{@url}\"\n \n @payload={'user_id': id}\n puts(\"@payload is #{@payload}\")\n \n @postResponse = HTTParty.post(@url, :body => @payload.to_json, :headers => $header )\n puts(\" POST to move user to group has Response.code #{@postResponse.code} and postResponse is #{@postResponse}\")\n end\nend", "def create\n @group = Group.new(group_params)\n @group.admin_id = current_user.id\n respond_to do |format|\n if @group.save\n\tUserGroup.create(admin: true, user_id: current_user.id, group_id: @group.id)\n\tflash[:success] = \"Group was successfully created!\"\n format.html { redirect_to @group }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if(params[:group][:name].nil?) or (params[:group][:name] == \"\")\n flash[:notice] = \"Group must have a name and description\"\n redirect_to new_group_path\n else\n \n #create a new group\n @group = Group.new(group_params)\n user = User.find(session[:user_id]) \n respond_to do |format|\n if @group.save\n #generate a code for the group\n o = [('a'..'z'), ('A'..'Z')].map(&:to_a).flatten\n new_code = (0...8).map { o[rand(o.length)] }.join\n @group.update(code: new_code)\n #after group is created add creator to group as leader\n Membership.create!(user_id: session[:user_id], group_id: @group.id, member_type: 'leader', username: user.username)\n format.html {redirect_to @group, notice: \"Group was successfully created.\"}\n format.json {render :show, status: :created, location: @group}\n else\n format.html {render :new, status: :unprocessable_entity}\n format.json {render json: @group.errors, status: :unprocessable_entity}\n end\n end\n end\n end", "def create_group(group_name,group_uuid,classes = {},rule_term,parent_group)\n load_classifier\n groups = @classifier.groups\n @classifier.update_classes.update\n current_group = groups.get_groups.select { |group| group['name'] == group_name}\n if current_group.empty?\n cputs \"Creating #{group_name} group in classifier\"\n groups.create_group({\n 'name' => group_name,\n 'id' => group_uuid,\n 'classes' => classes,\n 'parent' => groups.get_group_id(\"#{parent_group}\"),\n 'rule' => rule_term\n })\n else\n cputs \"NODE GROUP #{group_name} ALREADY EXISTS!!! Skipping\"\n end\nend", "def create\n @user_group = UserGroup.new(params[:user_group])\n\n respond_to do |format|\n if @user_group.save\n format.html { redirect_to @user_group, notice: 'User group was successfully created.' }\n format.json { render json: @user_group, status: :created, location: @user_group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_group = UserGroup.new(params[:user_group])\n\n respond_to do |format|\n if @user_group.save\n format.html { redirect_to @user_group, notice: 'User group was successfully created.' }\n format.json { render json: @user_group, status: :created, location: @user_group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def group_params\n params.require(:group).permit(:name, :address, :time, :number_of_members, :picture)\n end", "def insert_group_with_http_info(group, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserApi.insert_group ...'\n end\n # verify the required parameter 'group' is set\n if @api_client.config.client_side_validation && group.nil?\n fail ArgumentError, \"Missing the required parameter 'group' when calling UserApi.insert_group\"\n end\n # resource path\n local_var_path = '/user/groups'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()\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; charset=UTF-8'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(group)\n auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'GroupResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserApi#insert_group\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\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 create_group\n group_params = params.require(:group_params)\n\n group_id = @infra.ec2.create_security_group({group_name: group_params[0], description: group_params[1], vpc_id: group_params[3]})\n @infra.ec2.create_tags(resources: [group_id[:group_id]], tags: [{key: 'Name', value: group_params[2]}])\n\n render text: I18n.t('security_groups.msg.change_success')\n end", "def create_a_user_group_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: IamUserGroupsApi.create_a_user_group ...'\n end\n # unbox the parameters from the hash\n # resource path\n local_var_path = '/user-groups'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'request_body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'Object'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"IamUserGroupsApi.create_a_user_group\",\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: IamUserGroupsApi#create_a_user_group\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_group\n group_params = params.require(:group_params)\n\n group_id = @infra.ec2.create_security_group({ group_name: group_params[0], description: group_params[1], vpc_id: group_params[3] })\n @infra.ec2.create_tags(resources: [group_id[:group_id]], tags: [{ key: 'Name', value: group_params[2] }])\n\n render plain: I18n.t('security_groups.msg.change_success')\n end", "def create\n\t\t@group = current_user.groups.create(group_params)\n\t\tif params[:users].present?\n\t\t\tparams[:users].each do |user_id|\n\t\t\t\t@group.user_groups.create(user_id: user_id)\n\t\t\tend\n\t\tend\n\t\tredirect_to :groups, notice: 'Group created successfully'\n\tend" ]
[ "0.7029938", "0.7029938", "0.6919587", "0.6881138", "0.65274304", "0.6508751", "0.6502947", "0.64811885", "0.64801455", "0.6389315", "0.637187", "0.6312449", "0.6305744", "0.6288897", "0.62772024", "0.62731975", "0.6262509", "0.62478626", "0.6238376", "0.62025803", "0.6172038", "0.61576724", "0.6151121", "0.6144686", "0.6128361", "0.61148", "0.61067694", "0.6100096", "0.60950553", "0.6089898", "0.60878783", "0.6084096", "0.60767174", "0.60590315", "0.6054236", "0.6040756", "0.6036949", "0.6030454", "0.6027417", "0.6027391", "0.6024172", "0.60194814", "0.60171586", "0.6004882", "0.60004735", "0.60001826", "0.5993534", "0.59881115", "0.59881115", "0.59881115", "0.59881115", "0.59881115", "0.59881115", "0.5982592", "0.5970604", "0.5962045", "0.5960413", "0.59581923", "0.5956097", "0.59491736", "0.5938082", "0.59310657", "0.59272254", "0.59272254", "0.59272254", "0.59272254", "0.59272254", "0.5917173", "0.5916836", "0.5911048", "0.5910053", "0.5909632", "0.59048355", "0.5893991", "0.5892739", "0.58818394", "0.5878405", "0.58783835", "0.5878125", "0.5875634", "0.5865338", "0.5855682", "0.5848462", "0.58451223", "0.5835126", "0.58332807", "0.5833237", "0.5830183", "0.5819902", "0.5817028", "0.5801655", "0.5798635", "0.5798635", "0.5796644", "0.57952404", "0.57947516", "0.5792037", "0.57911396", "0.578824", "0.5783448" ]
0.57885927
98
PUT /image_groups/1 PUT /image_groups/1.json
def update puts params[:image_group] puts params[:image_group][:promoted] p ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" if !params[:images][:removed].blank? puts "removed images" + params[:images][:removed] removedImages = Image.where(" id in (?)", params[:images][:removed].split(',')) #remove the image from a group removedImages.each do |ri| ri.group_id=nil ri.save end end if !params[:images][:added].blank? puts "new added images" + params[:images][:added] addedImages = Image.where(" id in (?)", params[:images][:added].split(',')) #remove the image from a group addedImages.each do |ai| ai.group_id=params[:id] ai.save end end @image_group = ImageGroup.find(params[:id]) if params[:image_group][:cover_image_id].nil? @image_group.errors.add(:nil_cover, "必须指定封面图片才能使该图组生效") return elsif @image_group.images.nil? @image_group.errors.add(:nil_images, "必须指定内容图片才能使该图组生效") return end respond_to do |format| if @image_group.update_attributes(params[:image_group]) format.html { redirect_to @image_group, notice: 'Image group was successfully updated.' } format.json { head :no_content } format.js {} else format.html { render action: "edit" } format.json { render json: @image_group.errors, status: :unprocessable_entity } format.js {} end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UpdateGroup params = {}\n \n APICall(path: 'groups.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n logger.info \"Put parameters: #{params.to_json}\"\n @group = Group.find(params[:id])\n\n if @group.update_attributes(params[:group])\n head :no_content\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end", "def update\n group = Group.find(params[:id])\n if group.update(group_params)\n render json: group\n else\n render json: group.errors.full_messages, status: :unprocessable_entity\n end\n end", "def put(obj, which=:groups)\n path = \"/#{which}\"\n path += \"/#{obj['ID']}\" unless obj['ID'].nil? \n resp = self.class.post(path, { :body => obj })\n check_errors resp\n res = resp.parsed_response['Response']['Entry']\n rebuild_groups! res\n res\n end", "def update\n @image_gallery_group = ImageGalleryGroup.find(params[:id])\n\n respond_to do |format|\n if @image_gallery_group.update_attributes(params[:image_gallery_group])\n flash[:notice] = 'ImageGalleryGroup was successfully updated.'\n format.html { redirect_to([:admin, @image_gallery_group]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @image_gallery_group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_nodegroup(nodegroup_json, nodegroup_id)\n nodemgr_rest_call(\"POST\", \"classifier\", \"groups\", $credentials, id=nodegroup_id, nodegroup_json)\nend", "def update\n\n if @group.update(group_params)\n head :no_content\n else\n render json: @group.errors, status: :unprocessable_entity\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_group(id, params)\n put(\"groups/#{id}\", group: params)\n end", "def update_group(id, params = {})\n put(\"/groups/#{id}\", params)\n end", "def group_params\n params.require(:group).permit(:name, :group_image, user_ids: [])\n end", "def update\n @group = Group.find(params[:id])\n\n unless params[:metro_area_id].blank?\n @group.metro_area = MetroArea.find(params[:metro_area_id])\n @group.state = (@group.metro_area && @group.metro_area.state) ? @group.metro_area.state : nil\n @group.country = @group.metro_area.country if (@group.metro_area && @group.metro_area.country)\n else\n @group.metro_area = @group.state = @group.country = nil\n end\n\n @avatar = Groupphoto.new(params[:avatar])\n @avatar.group = @group\n\n @group.avatar = @avatar if @avatar.save\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @group.name = params['name']\n @group.save\n respond_to do |format|\n format.json { render :show, status: :ok, location: @group }\n end\n end", "def update_group(group_name, options = {})\n request({\n 'Action' => 'UpdateGroup',\n 'GroupName' => group_name,\n :parser => Fog::Parsers::AWS::IAM::UpdateGroup.new\n }.merge!(options))\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 @topic = Topic.find(params[:id])\n @topic.user_id = session[:user_id]\n @group_id = params[:topic][:group_id]\n if @group_id\n @group = Group.find(@group_id)\n end\n logger.info (\"the image is #{params[:topic][:image]}\")\n if params[:topic][:image]\n rename = @topic.save_image(params[:topic][:image])\n else\n rename = @topic.image\n end\n respond_to do |format|\n if @topic.update_attributes(:image=>rename,:group_id=>@group_id,:user_id=>session[:user_id],:title=>params[:topic][:title],\n :description=>params[:topic][:description])\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @users = User.where(\"owner_id = ?\", current_user).order('lastname ASC')\n @group = current_user.groups.find(params[:id])\n if @group.update_attributes(group_params)\n flash[:green] = \"Asset was successfully updated.\"\n redirect_to @group\n else\n render :edit\n end\n end", "def update\n respond_to do |format|\n if @api_v1_group_update.update(api_v1_group_update_params)\n format.html { redirect_to @api_v1_group_update, notice: 'Group update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_group_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_group_update.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @group = Group.find_by_guid(params[:id])\n respond_to do |format|\n if @group.update_attributes(update_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render json: @group }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update options = {}\n\n group_opts = group_options(options) \n\n # tags must be updated using a separate request from the\n # other attributes, *sigh*\n if tags = group_opts.delete(:tags)\n tags.map(&:to_hash).each do |tag|\n tag[:resource_type] = 'auto-scaling-group'\n tag[:resource_id] = name\n end\n client.create_or_update_tags(:tags => tags)\n end\n\n unless group_opts.empty?\n client_opts = group_opts.merge(:auto_scaling_group_name => name)\n client.update_auto_scaling_group(client_opts)\n end\n\n nil\n\n end", "def group_params\n params.require(:group).permit(:group_name, :user_id, :group_image)\n end", "def update\n respond_to do |format|\n if @group.update(group_params)\n format.json { head :no_content }\n else\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @group.update(group_params)\n respond_with(@group)\n end", "def update\n if @group.update(group_params)\n render_json_message({success: t('.success')}, 200)\n else\n render_json_message({errors: @group.errors.messages}, 422)\n end\n end", "def update_group(group_id, attributes)\n put(\"/v1/groups/#{group_id}\", attributes)\n end", "def set_api_v1_group_update\n @api_v1_group_update = Api::V1::GroupUpdate.find(params[:id])\n end", "def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, :notice => 'Group was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def addGroupToServer(group)\n path = \"/user/\" + @@conf[\"username\"] + \"/group/\" + group.strip\n res = HttpRequest.new(:put, path).send(@@host)\n puts res\n puts \"CODE: \" + res.code\n\nend", "def update\n @user = User.find(current_user.id)\n @group = @user.groups.find(params[:id])\n @group.title = params[:title]\n @group.description = params[:description]\n @group.groupProfile = params[:groupProfile]\n @group.groupCover = params[:groupCover]\n\n @groupcategory = GroupCategory.where(:group_id => params[:id])\n @groupcategory.update(group_id: @group.id , category_id: params[:category])\n\n respond_to do |format|\n if @group.update(title: params[:title], description: params[:description])\n format.html { redirect_to user_group_path(current_user.id, @group.id) }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Le groupe a été modifié.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @gallery_group.update(gallery_group_params)\n format.html { redirect_to @gallery_group, notice: 'Gallery group was successfully updated.' }\n format.json { render :show, status: :ok, location: @gallery_group }\n else\n format.html { render :edit }\n format.json { render json: @gallery_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_group\n @resource = Group.find(params[:id])\n end", "def update\n respond_to do |format|\n if @collection_group.update(collection_group_params)\n format.html { redirect_to @collection_group, notice: 'Collection group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @collection_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_group(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'UpdateGroup'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :group_name\n\t\t\targs[:query]['GroupName'] = optional[:group_name]\n\t\tend\n\t\tif optional.key? :new_comments\n\t\t\targs[:query]['NewComments'] = optional[:new_comments]\n\t\tend\n\t\tif optional.key? :new_group_name\n\t\t\targs[:query]['NewGroupName'] = optional[:new_group_name]\n\t\tend\n\t\tself.run(args)\n\tend", "def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, :notice => 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @group.update_attributes(params[:group])\n respond_with(@group, only: [:id, :name, :creator_id, :admin_id])\n else\n render_error(404, request.path, 20103, \"Failed to update group info\")\n end\n end", "def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @image_set\n if @image_set.update(params[:image_set].permit(:title, :description))\n # to handle multiple images upload on update when user add more pictures\n if params[:images]\n params[:images].each {|image|\n @image_set.images.create(image: image)\n }\n end\n\n flash[:notice] = \"Your image set has been updated!.\"\n redirect_to @image_set\n else\n flash[:alert] = \"Something went wrong.\"\n render 'edit'\n end\n end", "def update\n authorize! :update, @group\n @group.creator = current_user\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group.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 update\n @image_gallery_image = ImageGalleryImage.find(params[:id])\n\n respond_to do |format|\n if @image_gallery_image.update_attributes(params[:image_gallery_image])\n flash[:notice] = 'ImageGalleryImage was successfully updated.'\n format.html { redirect_to([:admin, @image_gallery_group]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @image_gallery_image.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_initiative_group.update(api_v1_initiative_group_params)\n format.html { redirect_to @api_v1_initiative_group, notice: 'Initiative group was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_group }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @group\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to group_path(@group), notice: \"Group was successfully updated.\" }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @image_group = ImageGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_group }\n end\n end", "def set_group\n @group = Group.find(params[:id])\n end", "def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n begin\n group = Group.find(params[:id])\n if params[:name] and group.update_attributes(name: params[:name])\n render json: { \"notice\"=>\"group name updated to #{params[:name]}\" }\n else\n render json: { \"alert\"=>\"record not updated. check your params.\" }\n end\n rescue ActiveRecord::RecordNotFound\n render json: { \"alert\"=>\"did not specify a valid id. no record updated.\" }\n end\n end", "def update\n if request.post?\n if @group.update_attributes(params[:group])\n redirect_to :action => 'list'\n else\n render :action => 'rename'\n end\n end\n end", "def set_group\r\n @group = Group.find(params[:id])\r\n end", "def set_group\n @group = Group.find(params[:id])\n end", "def set_group\n @group = Group.find(params[:id])\n end", "def set_group\n @group = Group.find(params[:id])\n end", "def set_group\n @group = Group.find(params[:id])\n end", "def set_group\n @group = Group.find(params[:id])\n end", "def set_group\n @group = Group.find(params[:id])\n end", "def set_group\n @group = Group.find(params[:id])\n end", "def set_group\n @group = Group.find(params[:id])\n end", "def update\n respond_to do |format|\n if @group.update(params[:group])\n format.html { redirect_to [@hub, @group], :notice => 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @group = Group.find(params[:id])\n\n if @group.owner != current_user\n respond_to do |format|\n format.html { redirect_to @group, notice: 'User not authorized.' }\n format.json { render json: @group, status: :not_authorized, location: group }\n end\n return\n end\n\n new_group_name = params[:group][:name]\n group_name_exists = false\n\n if new_group_name != @group.name\n current_user.owned_groups.each do |g|\n if g.name == new_group_name\n group_name_exists = true\n end\n end\n end\n \n respond_to do |format|\n if group_name_exists\n format.html { redirect_to @group, :alert => \"You already have a group by the name '#{new_group_name}'.\" }\n format.json { head :no_content }\n elsif new_group_name == @group.name\n format.html { redirect_to @group }\n format.json { head :no_content }\n elsif @group.update_attributes(params[:group])\n format.html { redirect_to @group, :notice => 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n error_msg = 'Unexpected error while updating group.'\n if @group.errors.messages.count > 0\n error_msg = 'Following error(s) prevented the group from being saved: '\n multiple = false\n @group.errors.full_messages.each do |msg|\n if multiple\n error_msg += ', '\n end\n error_msg += msg\n multiple = true\n end\n end\n format.html { redirect_to @group, :alert => error_msg }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @meta_data_group = MetaDataGroup.find(params[:id])\n\n respond_to do |format|\n if @meta_data_group.update_attributes(params[:meta_data_group])\n format.html { redirect_to @meta_data_group, notice: 'MetaData group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meta_data_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to(@group, :notice => 'Group was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @api_v1_group_update = Api::V1::GroupUpdate.new(api_v1_group_update_params)\n\n respond_to do |format|\n if @api_v1_group_update.save\n format.html { redirect_to @api_v1_group_update, notice: 'Group update was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_group_update }\n else\n format.html { render :new }\n format.json { render json: @api_v1_group_update.errors, status: :unprocessable_entity }\n end\n end\n end", "def group_params\n params.require(:group).permit(:name, :image, :description, :primary_statistics)\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 respond_to do |format|\n if @group.update(group_params)\n audit(@group, \"update\", @group.name)\n format.html { redirect_to group_path(@group), notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @group = Group.find(params[:id])\n @users = @group.users\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to edit_user_registration_path, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_group\n @group = Group.find(params[:id])\n\n end", "def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to [@group], notice: 'group was successfully updated.' }\n format.json { render :show, status: :ok, location: [@group] }\n else\n format.html { render :edit }\n format.json { render json: @group.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 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 group_params\n params.require(:group).permit(:name, :owner_id, :description, :group_photo)\n end", "def update\n @user_group = UserGroup.find(params[:id])\n\n respond_to do |format|\n if @user_group.update_attributes(params[:user_group])\n format.html { redirect_to @user_group, notice: 'User group was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @small_group.update(small_group_params)\n format.html { redirect_to @small_group, notice: 'Small group was successfully updated.' }\n format.json { render :show, status: :ok, location: @small_group }\n else\n format.html { render :edit }\n format.json { render json: @small_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_group_field.update(api_v1_group_field_params)\n format.html { redirect_to @api_v1_group_field, notice: 'Group field was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_group_field }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_group_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_group\n @group = Group.find(params[:group_id])\n end", "def update\n @group = Group.find(params[:id])\n \n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(admin_groups_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @agroup.update(agroup_params)\r\n format.html { redirect_to @agroup, notice: 'Agroup 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: @agroup.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to( view_group_path(@group.label), :notice => 'Group was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Группа обновлена!' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def group_params\n params.require(:group).permit(\n :group_name, :entity_id, :form_type, :avatar, :remove_avatar\n )\n end", "def update\n @user_group = UserGroup.find(params[:id])\n\n respond_to do |format|\n if @user_group.update_attributes(params[:user_group])\n format.html { redirect_to @user_group, notice: 'User group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_group.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7013699", "0.68939674", "0.667842", "0.6663909", "0.64881104", "0.64502144", "0.64501834", "0.64057434", "0.6402101", "0.63756186", "0.6371995", "0.63506645", "0.6320838", "0.63092995", "0.62939984", "0.62604725", "0.6259761", "0.6257047", "0.62176615", "0.6217387", "0.62163806", "0.6206513", "0.6197208", "0.6195429", "0.6186423", "0.61841524", "0.6168878", "0.6166071", "0.6144216", "0.614192", "0.61409295", "0.6139441", "0.61375624", "0.6136241", "0.6135883", "0.6135883", "0.613356", "0.611721", "0.61083144", "0.61083144", "0.61083144", "0.6107948", "0.6106646", "0.6075092", "0.60679275", "0.60677725", "0.6063963", "0.6037111", "0.60022336", "0.6001557", "0.6001557", "0.6001557", "0.6001557", "0.6001557", "0.6001557", "0.6001557", "0.6001557", "0.6001557", "0.6001557", "0.6001557", "0.6001557", "0.60015357", "0.5996399", "0.59789765", "0.59775597", "0.59775597", "0.59775597", "0.59775597", "0.59775597", "0.59775597", "0.59775597", "0.59775597", "0.59737206", "0.5970353", "0.5969971", "0.596988", "0.5967031", "0.59666663", "0.5965626", "0.5965332", "0.596021", "0.596021", "0.596021", "0.596021", "0.59539866", "0.59538645", "0.5952586", "0.5946855", "0.5935957", "0.5927846", "0.59190017", "0.5917606", "0.5917235", "0.59120446", "0.5906043", "0.5903918", "0.59028804", "0.5902666", "0.589673", "0.58940053" ]
0.710447
0
DELETE /image_groups/1 DELETE /image_groups/1.json
def destroy @image_group = ImageGroup.find(params[:id]) @image_group.destroy respond_to do |format| format.html { redirect_to image_groups_url } format.json { head :no_content } format.js {} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @image_gallery_group = ImageGalleryGroup.find(params[:id])\n @image_gallery_group.destroy\n\n respond_to do |format|\n format.html { redirect_to( admin_image_gallery_groups_url ) }\n format.xml { head :ok }\n end\n end", "def DeleteGroup id\n \n APICall(path: \"groups/#{id}.json\",method: 'DELETE')\n \n end", "def deleteGroup( group_id)\n params = Hash.new\n params['group_id'] = group_id\n return doCurl(\"delete\",\"/group\",params)\n end", "def destroy\n group = Group.find(params[:id])\n group.destroy\n render json: {}\n end", "def destroy\n # @group = @hub.groups.get(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to hub_groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bp_pic_group = BpPicGroup.find(params[:id])\n @bp_pic_group.destroy\n\n respond_to do |format|\n format.html { redirect_to bp_pic_groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Asset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @meta_data_group = MetaDataGroup.find(params[:id])\n @meta_data_group.destroy\n\n respond_to do |format|\n format.html { redirect_to meta_data_groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find_by_guid(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def deleteEntityGroup( 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/group\",params)\n end", "def destroy\n @image_gallery_image = ImageGalleryImage.find(params[:id])\n @image_gallery_image.destroy\n\n respond_to do |format|\n format.html { redirect_to([:admin, @image_gallery_group]) }\n format.xml { head :ok }\n end\n end", "def destroy\n @group = Group.find_by_slug_or_id(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.json { head :ok }\n end\n end", "def destroy\n begin\n group = Group.find(params[:id])\n group.destroy\n render json: { \"notice\"=>\"group deleted successfully\" }\n rescue ActiveRecord::RecordNotFound\n render json: { \"alert\"=>\"did not specify a valid id. no record deleted.\" }\n end\n end", "def destroy\n @group_key.destroy\n respond_to do |format|\n format.html { redirect_to group_keys_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n head :no_content\n end", "def destroy\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end", "def destroy\n @group.destroy\n\n head :no_content\n end", "def destroy\n @collection_group.destroy\n respond_to do |format|\n format.html { redirect_to collection_groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_group_update.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_group_updates_url, notice: 'Group update 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 render json: {status: \"success\"}, status: :ok\n end", "def destroy\n @gallery_group.destroy\n respond_to do |format|\n format.html { redirect_to gallery_groups_url, notice: 'Gallery group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\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 @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @agroup.destroy\r\n respond_to do |format|\r\n format.html { redirect_to agroups_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def postGroupBulk_delete( group_id, filedata)\n params = Hash.new\n params['group_id'] = group_id\n params['filedata'] = filedata\n return doCurl(\"post\",\"/group/bulk_delete\",params)\n end", "def destroy\n @request_group.destroy\n respond_to do |format|\n format.html { redirect_to request_groups_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 @esol_group = EsolGroup.find(params[:id])\n @esol_group.destroy\n\n respond_to do |format|\n format.html { redirect_to esol_groups_url }\n format.json { head :no_content }\n end\n end", "def delete_group(client, options)\n if options[:directory].nil? or options[:group].nil?\n puts \"Missing arguments\"\n return\n end\n\n groups = client.groups\n group = groups.get options[:group]\n group.delete\n puts \"Group deleted.\"\n return\nend", "def destroy\n @reagent_group = ReagentGroup.find(params[:id])\n @reagent_group.destroy\n\n respond_to do |format|\n format.html { redirect_to reagent_groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group_request.destroy\n respond_to do |format|\n format.html { redirect_to group_requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @groupaddrobj = Groupaddrobj.find(params[:id])\n @groupaddrobj.destroy\n\n respond_to do |format|\n format.html { redirect_to groupaddrobjs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_group = UserGroup.find_by_id(params[:id])\n @user_group.destroy\n render :json=>{:status =>t('users.destroy.success')}\n end", "def destroy\n authorize! :destroy, @group\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n Group.rebuild! if nil.|Group.find(:first).rgt\n\t @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end", "def 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 @groups = Group.find(params[:id])\n @groups.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_group = UserGroup.find(params[:id])\n @user_group.destroy\n\n respond_to do |format|\n format.html { redirect_to user_groups_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 remove_user_from_group(user_id, group_id)\n @url = \"http://#{$canvas_host}/api/v1/groups/#{group_id}/users/#{user_id}\"\n puts \"@url is #{@url}\"\n\n @deleteResponse = HTTParty.delete(@url, :headers => $header)\n puts(\" DELETE to remove user from group has Response.code #{@deleteResponse.code} and getResponse is #{@deleteResponse}\")\nend", "def delete_group(uuid)\n Uploadcare::Group.delete(uuid)\n end", "def destroy\n @agent_group = AgentGroup.find(params[:id])\n @agent_group.destroy\n\n respond_to do |format|\n format.html { redirect_to agent_groups_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 @user_group = UserGroup.find(params[:id])\n @user_group.destroy\n\n respond_to do |format|\n format.html { redirect_to user_groups_url }\n format.json { head :ok }\n end\n end", "def destroy\n @api_v1_group_field.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_group_fields_url, notice: 'Group field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @alien_group.destroy\n respond_to do |format|\n format.html { redirect_to alien_groups_url, notice: 'Alien group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_initiative_group.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_initiative_groups_url, notice: 'Initiative group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if @group.destroy\n render json: {result: 1}\n else\n render json: {result: 0}\n end\n end", "def destroy\n @group = Group.find(params[:id])\n authorize @group, :destroy?\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(browse_groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @small_group.destroy\n respond_to do |format|\n format.html { redirect_to small_groups_url, notice: 'Small group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item_group = ItemGroup.find(params[:id])\n redirect_to root_path unless @item_group.user == request.user\n @item_group.destroy\n\n respond_to do |format|\n format.html { redirect_to item_groups_path }\n format.json { head :ok }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Группа удалена!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Le groupe a été supprimé.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group_mag = GroupMag.find(params[:id])\n @group_mag.destroy\n\n respond_to do |format|\n format.html { redirect_to group_mags_url }\n format.json { head :ok }\n end\n end", "def destroy\n @groupon = Groupon.find(params[:id])\n @groupon.destroy\n\n respond_to do |format|\n format.html { redirect_to groupons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client.resource_groups.delete(@resource_group)\n end", "def destroy\n @ratio_group = RatioGroup.find(params[:id])\n\n respond_to do |format|\n if @ratio_group.destroy\n format.html { redirect_to ratio_groups_url,\n notice: (crud_notice('destroyed', @ratio_group) + \"#{undo_link(@ratio_group)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to ratio_groups_url, alert: \"#{@ratio_group.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @ratio_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @microsites_group.destroy\n respond_to do |format|\n format.html { redirect_to microsites_groups_url, notice: 'Microsites group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_path, notice: 'group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n redirect_to groups_path\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n redirect_to groups_path\n end", "def destroy\n @dog_breed_group.destroy\n respond_to do |format|\n format.html { redirect_to dog_breed_groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @user_id = @group.user_id\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url(:user_id=>@user_id) }\n # format.html { redirect_to groups_sidebartab_url(:user_id=>@user_id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @image_label_set.destroy\n respond_to do |format|\n format.html { redirect_to image_label_sets_url, notice: 'Image label set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_group \n Group.destroy(params[:id])\n\n respond_to do |format|\n format.html {redirect_to dashboard_path}\n end\n end", "def destroy\n @image_gallery = ImageGallery.find(params[:id])\n @image_gallery.destroy\n\n respond_to do |format|\n format.html { redirect_to image_galleries_url }\n format.json { head :ok }\n end\n end", "def destroy\n #@s_group.destroy\n @s_group = SGroup.find(params[:id].to_i)\n @s_group.delete_flg = 1\n @s_group.save!\n\n respond_to do |format|\n format.html { redirect_to s_groups_url, notice: 'S group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n flash[:success] = \"Группа успешно удалена.\"\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n \n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @access_group = AccessGroup.find(params[:id])\n @access_group.destroy\n\n respond_to do |format|\n format.html { redirect_to access_groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.74013877", "0.738562", "0.7370603", "0.7204914", "0.7173223", "0.71466416", "0.71245694", "0.7096107", "0.7073777", "0.7062585", "0.70428175", "0.703515", "0.7033367", "0.70323575", "0.7032046", "0.702627", "0.702627", "0.7019601", "0.7019601", "0.7019601", "0.7019601", "0.7019601", "0.70188004", "0.70188004", "0.70188004", "0.70188004", "0.70188004", "0.70188004", "0.70025384", "0.70025384", "0.69979984", "0.69793046", "0.6971461", "0.69713223", "0.696758", "0.6960362", "0.6958298", "0.6916829", "0.69084644", "0.6902048", "0.690066", "0.6887348", "0.6876033", "0.68720883", "0.6863861", "0.6863074", "0.68385357", "0.6832966", "0.6827815", "0.6821236", "0.68018615", "0.6791085", "0.6785055", "0.6782219", "0.67819893", "0.6774296", "0.6773063", "0.6772003", "0.6771158", "0.676859", "0.6767998", "0.67542726", "0.67532253", "0.6749209", "0.67480665", "0.67462087", "0.6742292", "0.6740109", "0.67400515", "0.6736528", "0.6735256", "0.67336667", "0.67320484", "0.67285496", "0.67208695", "0.67208695", "0.67203516", "0.67160183", "0.6714889", "0.67133605", "0.67040265", "0.67004424", "0.669792", "0.6686574", "0.66859835", "0.66800344", "0.66800344", "0.66800344", "0.66800344", "0.66800344", "0.66800344", "0.66800344", "0.66800344", "0.66800344", "0.66800344", "0.66800344", "0.66800344", "0.66800344", "0.66800344", "0.66800344" ]
0.7752952
0
Determine if this Windows is 64bit or 32bit. Some CDs can have more than one architecture on multiple install images.
def get_arch if defined?(@arch) then return @arch else @arch = nil end search = File.join(@path, '{*/system32,{i386,amd64}}/ntdll.dll') ntdlls = Dir.glob(search, File::FNM_CASEFOLD) if ntdlls.length > 0 machine = %x{pev -c #{ntdlls.first} | grep -i Machine} if $?.success? @arch = '64-bit' if machine =~ /0x8664/ @arch = '32-bit' if machine =~ /14c/ end else search = File.join(@path, 'sources/{setup.exe,winsetup.dll}') setup = Dir.glob(search, File::FNM_CASEFOLD) setup.each do |file| machine = %x{pev -c #{file} | grep -i Machine} if $?.success? @arch = '64-bit' if machine =~ /0x8664/ @arch = '32-bit' if machine =~ /14c/ break end end # end of setup block begin get_xmlinfo if not defined?(@xmlinfo) arches = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/WINDOWS/ARCH/text()') arch = arches.first if arches.count(arch) == arches.size arch = Integer(arch.to_s) @arch = '64-bit' if arch == 9 @arch = '32-bit' if arch == 0 else @arch = '32/64-bit' unless @arch end rescue Exception => e # puts "error(get_arch): #{e}" end end @arch end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_if_x86_64\n (identify_windows_architecture =~ /64/) == 0\n end", "def windows_64?\n bool = false\n\n if respond_to?(:IsWow64Process, true)\n pbool = FFI::MemoryPointer.new(:int)\n\n # The IsWow64Process function will return false for a 64 bit process,\n # so we check using both the address size and IsWow64Process.\n if FFI::Platform::ADDRESS_SIZE == 64\n bool = true\n else\n if IsWow64Process(GetCurrentProcess(), pbool)\n bool = true if pbool.read_int == 1\n end\n end\n end\n\n bool\n end", "def check32_bit_on64_system\n return @check32_bit_on64_system\n end", "def windows_x64?\n !!(windows? && ua =~ /(Win64|x64)/)\n end", "def ptr_64?\n [\n IMAGE_FILE_MACHINE_IA64,\n IMAGE_FILE_MACHINE_ALPHA64,\n IMAGE_FILE_MACHINE_AMD64\n ].include?(self._file_header.Machine)\n end", "def win_64bit?\n x86_64? && (latest_version? || new_resource.version.split('.').first.to_i >= 42)\nend", "def determine_if_x86_64\n if self[:platform] =~ /solaris/\n result = exec(Beaker::Command.new(\"uname -a | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n else\n result = exec(Beaker::Command.new(\"arch | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n end\n end", "def determine_if_x86_64\n if self[:platform] =~ /solaris/\n result = exec(Beaker::Command.new(\"uname -a | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n else\n result = exec(Beaker::Command.new(\"arch | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n end\n end", "def Check_OS_Bit()\n\tif File.directory?(\"C:\\\\Program Files (x86)\")\n\t\tputs(\"OS is 64 bit\")\n\t\tos_bit = \"x64\"\n\t\treturn os_bit\n\telse\n\t\tputs(\"OS is 32 bit\")\n\t\tos_bit = \"x86\"\n\t\treturn os_bit\n\tend\nend", "def determine_if_x86_64\n result = exec(Beaker::Command.new(\"uname -a | grep x86_64\"), :expect_all_exit_codes => true)\n result.exit_code == 0\n end", "def determine_if_x86_64\n result = exec(Beaker::Command.new(\"uname -a | grep x86_64\"), :expect_all_exit_codes => true)\n result.exit_code == 0\n end", "def arch\n x86_64? ? \"amd64\" : \"i386\"\n end", "def check32_bit_on64_system=(value)\n @check32_bit_on64_system = value\n end", "def get_arch\n arch = `uname -m`\n if arch.include?(\"64\")\n return \"64\"\n else\n return \"32\"\n end\nend", "def arch_32_bit; :i386; end", "def is_windows?(dbc)\n begin\n q = dbc.query('SELECT @@version_compile_os;')\n q.each { |x| @os = x[0] }\n if @os =~ /Win|\\.NET/i\n if @os =~ /Win64|WOW64/i\n @build='x64'\n else\n @build='x32'\n end\n return true\n else\n return false\n end\n rescue Mysql::Error => e\n print_error(\"Problem confirming target is Windows!\")\n puts \"\\t=> \".white + \"#{e}\".light_red\n return false\n end\n end", "def cross_universal?\n intersects_all?(Hardware::CPU::PPC_32BIT_ARCHS, Hardware::CPU::INTEL_32BIT_ARCHS)\n end", "def firefox_win_64bit?\n node['kernel']['machine'] == 'x86_64' && !node['mozilla_firefox']['32bit_only'] &&\n (firefox_latest? || node['mozilla_firefox']['version'].split('.').first.to_i >= 42)\n end", "def simulator?\n arches.include?(\"i386\") || arches.include?(\"x86_64\")\n end", "def windows?\n has_os? && !!os_image_type.match(/windows/i)\n end", "def detect_architecture()\r\n\t\tprint_status(\"Attempting to automatically detect the architecture\")\r\n\t\tres = send_serialized_request(\"osarch.bin\")\r\n\t\tif (res.body =~ /(i386|x86)/i)\r\n\t\t\tarch = $1\r\n\t\t\tif (arch =~ /i386|x86/i)\r\n\t\t\t\treturn ARCH_X86\r\n\t\t\t\t# TODO, more\r\n\t\t\tend\r\n\t\tend\r\n\t\tnil\r\n\tend", "def architecture\n return 'x86_64'\n end", "def safe_architecture\n if intel?\n \"i386\"\n elsif sparc?\n \"sparc\"\n else\n Ohai[\"kernel\"][\"machine\"]\n end\n end", "def is_windows?(dbc)\n begin\n q = dbc.query('SELECT @@version_compile_os;')\n q.each { |x| @os = x[0] }\n if @os =~ /Win|\\.NET/i\n if @os =~ /Win64/i\n @build='x64'\n else\n @build='x32'\n end\n return true\n else\n return false\n end\n rescue Mysql::Error => e\n puts \"Problem confirming target is Windows\".light_red + \"!\".white\n puts \"\\t=> \".white + \"#{e}\".light_red\n puts \"Sorry, can't continue without this piece\".light_red + \"....\\n\\n\".white\n exit 666;\n end\nend", "def architecture\n 'x86_64'\n end", "def architecture\n 'x86_64'\n end", "def is_image_windows?\n ami && ami.platform == \"windows\"\n end", "def windows?\n RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw32|windows/i\nend", "def windows?\n # Is this a Windows based system\n @win ||= RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|bccwin|wince|emc/\n end", "def arch(internal = false)\n internal ? '64-bit' : 'x86_64'\n end", "def windows?\n RUBY_PLATFORM =~ /mswin/\n end", "def determine_system_architecture\n @info[:arch] = @shell.query('UNAME', 'uname -m')\n @info[:arch].gsub!(/i\\d86/, 'i386')\n end", "def windows_nix?\n (/cygwin|mingw|bccwin/ =~ ruby_platform) != nil\n end", "def windows?\n RbConfig::CONFIG['host_os'] =~ /mswin|mingw/\n end", "def windows?\n RbConfig::CONFIG['host_os'] =~ /mswin|mingw/\n end", "def arch_lookup(sys_type)\n return \"x86_64\" if sys_type == \"x64-based PC\"\n return \"i386\" if sys_type == \"X86-based PC\"\n\n sys_type\n end", "def is_arm?\n !RUBY_PLATFORM.index(\"arm64e\").nil?\nend", "def is_arm?\n !RUBY_PLATFORM.index(\"arm64e\").nil?\nend", "def windows?\n !(RUBY_PLATFORM =~ /win32/).nil?\n end", "def windows?\n ::RUBY_PLATFORM =~ /mingw|mswin/\n end", "def calculate_doublepulsar_arch(s)\n s == 0 ? ARCH_X86 : ARCH_X64\n end", "def windows?\n\tRbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\nend", "def windows?\n !!(RUBY_PLATFORM =~ /mswin|mingw/)\n end", "def windows?\n kind_of? Windows::Platform rescue false\n end", "def windows?\n RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\nend", "def windows?\n (defined?(RbConfig) ? RbConfig : Config)::CONFIG['host_os'] =~ /mswin|win32|dos|mingw|cygwin/i\n end", "def platform?(what)\n\t\t(platform & what).empty? == false\n\tend", "def windows?\n ruby_platform?(:windows)\nend", "def windows?\n @windows ||= is? /mswin|^win|mingw/\n end", "def target_win32?\n return true if ENV['OS'] == 'Windows_NT'\n build.is_a?(MRuby::CrossBuild) && build.host_target.to_s =~ /mingw/\nend", "def lib_name\n architecture == 'x86_64' || architecture == 'i686' ? 'lib64' : 'lib'\n end", "def lib_name\n architecture == 'x86_64' || architecture == 'i686' ? 'lib64' : 'lib'\n end", "def windows?\n return @windows if defined?(@windows)\n @windows = (RbConfig::CONFIG['host_os'] =~ /mswin|windows|mingw/i)\n end", "def arch\n if windows? && windows_arch_i386?\n \"i386\"\n elsif solaris?\n if intel?\n \"i386\"\n elsif sparc?\n \"sparc\"\n end\n else\n Ohai[\"kernel\"][\"machine\"]\n end\n end", "def windows_platform?\n case RUBY_PLATFORM\n when /cygwin|mswin|mingw|bccwin|wince|emx/\n true\n else\n false\n end\n end", "def windows_platform?\n case RUBY_PLATFORM\n when /cygwin|mswin|mingw|bccwin|wince|emx/\n true\n else\n false\n end\n end", "def arch?(what)\n\t\treturn true if (what == ARCH_ANY)\n\n\t\treturn arch.index(what) != nil\n\tend", "def apple_silicon?\n RUBY_PLATFORM.match(/arm64/)\n end", "def architecture\n @architecture ||= `uname -m`\n end", "def processor_type\n if @processor_type.nil?\n if os_family == 'Windows' && ENV['PROCESSOR_ARCHITECTURE']\n @processor_type = ENV['PROCESSOR_ARCHITECTURE']\n else\n @processor_type = @platform.exec(\"uname\", (os_type(:nice) =~ /Windows|HP-UX/ ? '-m' : '-p')).strip\n end\n end\n \n @processor_type\n end", "def sensible_os?\n\n return ::RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? false : true\n\n end", "def is_windows?\n win_patterns = [\n /bccwin/i,\n /cygwin/i,\n /djgpp/i,\n /mingw/i,\n /mswin/i,\n /wince/i\n ]\n\n case RUBY_PLATFORM\n when *win_patterns\n return true\n else\n return false\n end\nend", "def is_unix_like?\n os_type !~ /^\\s*windows\\s*$/i\n end", "def mac? ; RUBY_PLATFORM =~ /.*(sal|86).*-darwin1/i end", "def windows_ruby?\n !!(RUBY_PLATFORM =~ /mswin|mingw|windows/)\n end", "def ptr_32?\n ptr_64? == false\n end", "def include_win?\n RUBY_PLATFORM.include?('mswin') or RUBY_PLATFORM.include?('mingw')\nend", "def windows?(platform = T.unsafe(nil)); end", "def isWindows()\r\n # See: http://stackoverflow.com/questions/4871309\r\n require 'rbconfig'\r\n return (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)\r\nend", "def workaround_older_macosx_misreported_cpu?\n os == :macosx && is_64_bit?\n end", "def arch_platform?(node = __getnode)\n node[\"platform\"] == \"arch\"\n end", "def architecture # rubocop:disable Lint/DuplicateMethods\n @architecture ||= @name.match(PLATFORM_REGEX)[3]\n end", "def windows_gemfile_lock?\n platforms.detect do |platform|\n /mingw|mswin/.match(platform.os) if platform.is_a?(Gem::Platform)\n end\n end", "def installable_platform?\n Gem::Platform.match_spec? spec\n end", "def linux? ; RUBY_PLATFORM =~ /linux/i end", "def architecture\n `uname -m`.strip\n end", "def architecture\n `uname -m`.strip\n end", "def variant_microsoft?\n variant_bits == 0b110\n end", "def is_mingw?\n @path =~ /mingw/ # Kludge\n end", "def windows?\n !!(ua =~ /Windows/)\n end", "def platform?\n system? and (RUBY_PLATFORM =~ @system)\n end", "def linux?\n RUBY_PLATFORM =~ /linux/i\nend", "def int64?\n type == INT64_TYPE\n end", "def unix?\n !windows?\n end", "def windows_mobile?\n !!(ua =~ /Windows CE/)\n end", "def is_libdirsize?(); @type == GRT_LIBDIRSIZE; end", "def ruby_arch\n case Common.target_platform\n when /darwin/\n 'x86_64-darwin10'\n when 'linux-x86_64'\n 'x86_64-linux'\n when 'linux-x86'\n 'i686-linux'\n when /windows/\n 'x64-mingw64'\n end\nend", "def is_windows?\n return @is_win if @is_win\n\n begin; require \"win32ole\"; rescue LoadError; end\n\n @is_win ||= Object.const_defined?(\"WIN32OLE\")\n end", "def is_module_arch?(mod)\n mod_arch = mod.target.arch || mod.arch\n mod_arch.include? session.arch\n end", "def is_windows?\n return @is_windows unless @is_windows.nil?\n\n require 'win32ole'\n @is_win = Object.const_defined?(:WIN32OLE)\n\n rescue LoadError\n @is_win = Object.const_defined?(:WIN32OLE)\n end", "def physical_device?\n arches.any? do |arch|\n arch[/arm/, 0]\n end\n end", "def version_gte_64?\n version >= v64\n end", "def unix?\n kind_of? Unix::Platform rescue false\n end", "def windows?(platform = nil)\n get_platform(platform) == :WINDOWS\n end", "def detect_os\n os = RUBY_PLATFORM.split('-')\n @class_name = if os.size == 2\n if os[1] == 'mingw32'\n 1\n else\n 0\n end\n else\n 0\n end\n end", "def mac?\n kind_of? Mac::Platform rescue false\n end", "def arch_for_filename(path)\n file = File.basename(path, File.extname(path))\n\n case file\n when /686/, /386/\n '32-bit'\n when /86_64/, /amd64/\n '64-bit'\n else\n parts = file.split('_')\n\n if parts.empty?\n raise \"Could not determine arch for filename `#{file}'!\"\n end\n\n parts.last.capitalize\n end\n end", "def is_windows?\n return !!@name.match(/^windows.*$/)\n end", "def linux?\n /linux/.match(RUBY_PLATFORM)\n end", "def vendor_mysql_platform(platform = nil)\n platform ||= RUBY_PLATFORM\n platform =~ /x64/ ? \"winx64\" : \"win32\"\nend" ]
[ "0.8423886", "0.7693869", "0.7633942", "0.75773686", "0.73920864", "0.7210124", "0.69893414", "0.69893414", "0.69698894", "0.6842776", "0.6842776", "0.6797138", "0.67929024", "0.672215", "0.6721104", "0.66576093", "0.66069937", "0.65872866", "0.64548767", "0.64364624", "0.6435407", "0.63228935", "0.63090813", "0.6284015", "0.6277896", "0.6277896", "0.6234717", "0.6232474", "0.6230157", "0.62209386", "0.6215021", "0.6204266", "0.6185049", "0.6177612", "0.6177612", "0.61471736", "0.61371386", "0.61371386", "0.6121856", "0.61017925", "0.6095968", "0.6091512", "0.60839444", "0.6080489", "0.60098296", "0.5991722", "0.59681267", "0.59654415", "0.596535", "0.5950372", "0.594665", "0.59444124", "0.5936802", "0.59256285", "0.5916168", "0.59045017", "0.5889672", "0.58894336", "0.5886731", "0.5860906", "0.58550876", "0.58460045", "0.584498", "0.57998353", "0.5792511", "0.57834977", "0.57394993", "0.5739481", "0.5727814", "0.5705194", "0.56980133", "0.5663479", "0.5646733", "0.5644222", "0.5639627", "0.56352216", "0.56352216", "0.5623107", "0.5612488", "0.56032693", "0.5602902", "0.55738723", "0.55611974", "0.5558185", "0.5544246", "0.5540617", "0.5538451", "0.5528001", "0.55051625", "0.55031747", "0.5497973", "0.54979634", "0.54925716", "0.54841334", "0.5481445", "0.54548216", "0.5451139", "0.5449698", "0.54490936", "0.54484314" ]
0.6659159
15
Get the build numbers for this Windows, e.g. 5.2.3790.
def get_build if defined?(@major) and defined?(@minor) and defined?(@build) then return @major, @minor, @build else @major, @minor, @build = nil end search = File.join(@path, '{*/system32,{i386,amd64}}/ntdll.dll') ntdlls = Dir.glob(search, File::FNM_CASEFOLD) if ntdlls.length > 0 dumpvers = %x{pev -p #{ntdlls.first}} if $?.success? major, minor, build = dumpvers.split('.') @major, @minor, @build = Integer(major), Integer(minor), Integer(build) end else search = File.join(@path, 'sources/{setup.exe,winsetup.dll}') setup = Dir.glob(search, File::FNM_CASEFOLD) setup.each do |file| dumpvers = %x{pev -p #{file}} if $?.success? major, minor, build = dumpvers.split('.') @major, @minor, @build = Integer(major), Integer(minor), Integer(build) break end end # end of setup block begin get_xmlinfo if not defined?(@xmlinfo) majors = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/WINDOWS/VERSION/MAJOR/text()') minors = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/WINDOWS/VERSION/MINOR/text()') builds = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/WINDOWS/VERSION/BUILD/text()') major = majors.first # The install.wim image will have multiple sub- minor = minors.first # images. Check to make sure each one has the same build = builds.first # version number. if majors.count(major) == majors.size and minors.count(minor) == minors.size and builds.count(build) == builds.size then @major, @minor, @build = Integer(major.to_s), Integer(minor.to_s), Integer(build.to_s) end rescue Exception => e # puts "error(get_build): #{e}" # raise end end return @major, @minor, @build end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def windows_version_parts\n version = self.version\n if version\n # windows-server-* -> windows-*\n if version.split(\"-\", 2)[0] == \"server\"\n version = version.split(\"-\", 2)[1]\n end\n\n if version =~ /^(\\d+)(r\\d+)?(sp\\d+|rtm)?$/i\n major, revision, service_pack = Regexp.last_match[1..3]\n end\n end\n\n if major\n # Get major as an integer (2008 -> 2008, 7 -> 7)\n major = major.to_i\n\n # Get revision as an integer (no revision -> 0, R1 -> 1).\n revision = revision ? revision[1..-1].to_i : 0\n\n # Turn service_pack into an integer. rtm = 0, spN = N.\n if service_pack\n service_pack = (service_pack.casecmp(\"rtm\") == 0) ? 0 : service_pack[2..-1].to_i\n end\n end\n\n [major, revision, service_pack]\n end", "def all_build_train_numbers(platform: nil)\n return self.build_trains(platform: platform || self.platform).versions\n end", "def build_number\n return @build_number\n end", "def current_build_number(**args)\n return build_number if build_number != nil\n\n begin\n case lane_context[:PLATFORM_NAME]\n when :android\n (google_play_track_version_codes(track: args[:track]) + 1).to_s\n when :ios\n (latest_testflight_build_number + 1).to_s\n end\n rescue\n '1'\n end\nend", "def svc_build_info(env, solution)\n url = \"http://#{env}.services.gamestop.com/Ecom/#{solution}/buildinfo.txt\"\n build_text_file = []\n open(url) do |f|\n no = 1\n f.each do |lines|\n build_text_file << lines\n no += 1\n break if no > 100\n end\n end\n #version = open(url).source.match(/(^Build Number)(.*)(_\\d*\\.\\d*)/)[3]\n return build_text_file\n end", "def build_number\n @build_number ||= history['builds'].first['build_number'].to_s\n end", "def get_build_number()\n return ENV['DOCS_BUILD_NUMBER'] || \"HEAD\"\n end", "def component_versions(cmp)\n component_build_vars(cmp)['PACKAGE_VERSIONS']\nend", "def get_buildno\n $buildno= @browser.execute_script(\"return window.DG.BUILD_NUM\")\n puts \"CODAP build_num is #{$buildno}.\"\nend", "def to_s\n \"#{@major}.#{@minor}.#{@update} Build #{@build}\"\n end", "def version\n if browser == \"Chrome\"\n chrome.version\n elsif product = detect_product(\"Version\")\n product.version\n else\n BuildVersions[build]\n end\n end", "def existing_builds_numbers(build_nums)\n Build.select(:build_number).where(build_number: build_nums).map { |build| build.build_number }\n end", "def get_latest_build_number(project)\n raise \"#{self.class}#get_latest_build_number not implemented\"\n end", "def number\n \"#{@major}.#{@minor}.#{@patch}\"\n end", "def versionString()\n\t\t\t\treturn \"#{major}.#{minor}.#{build}\"\n\t\t\tend", "def build_id\n build_id_offsets.each do |offset|\n next unless @leak.n(@libbase + offset + 12, 4) == \"GNU\\x00\"\n\n return @leak.n(@libbase + offset + 16, 20).unpack1('H*')\n end\n nil\n end", "def platform_version_windows(arg)\n # Make a best guess and assume a server OS\n # See: http://msdn.microsoft.com/en-us/library/windows/\n # desktop/ms724832(v=vs.85).aspx\n {\n '6.3' => '2012r2', '6.2' => '2012', '6.1' => '2008r2',\n '6.0' => '2008', '5.2' => '2003r2', '5.1' => 'xp', '5.0' => '2000'\n }[arg.match(/^[0-9]+\\.[0-9]+/).to_s]\n end", "def version\n [@major_version, @minor_version].join('.')\n end", "def device_build\n return nil unless length >= 4\n return nil unless self[3].comment.last.include?(' Build/')\n\n self[3].comment.last.split(' Build/').last\n end", "def platform_version_for_package\n if platform == 'rhel'\n platform_version[/([\\d]+)\\..+/, 1]\n else\n platform_version\n end\n end", "def get_tools_version_info\n timestamp, sha1 = `git log -1 --pretty='%at,%h'`.strip.split(',')\n\n [ Time.at(timestamp.to_i), sha1 ]\nend", "def device_build\n return if application.nil?\n return unless application.comment.last.include?(' Build/')\n\n application.comment.last.split(' Build/').last\n end", "def get_windows_info()\n sysname = \"\"\n processor = \"\"\n os_info = \"\"\n\n require 'win32/registry'\n\n Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion') do |reg|\n type, sysname = reg.read('ProductName')\n end\n\n Win32::Registry::HKEY_LOCAL_MACHINE.open('SYSTEM\\ControlSet001\\Control\\Session Manager\\Environment') do |reg|\n type, processor = reg.read('PROCESSOR_ARCHITECTURE')\n end\n\n os_info = sysname + \" \" + processor\n os_info\nend", "def get_winstring\n if defined?(@description) then return @description else @description = nil end\n get_build if not @major\n if @major < 6 # Vista and up use install.wim\n version = \"#{@major}.#{@minor}\"\n releases = {\n '5.0' => { 2195 => 'Windows 2000' },\n '5.1' => { 2600 => 'Windows XP' },\n '5.2' => { 2600 => 'Windows XP',\n 3790 => 'Windows Server 2003' }\n } # Get the closest build. Makes more sense with a bigger table.\n closest, description = releases[version].first\n releases[version].each do |build, name|\n if (build-@build).abs < (closest-@build).abs\n description = name\n closest = build\n end\n end # end of releases block\n @description = description\n else # Only works for ISO images for now. Use hivex for OS-root folders.\n begin\n substitutions = { # Products that don't have good descriptions.\n 'ServerSBSStandard' => 'Windows Small Business Server',\n 'SERVERSBSSTANDARD' => 'Windows Small Business Server',\n 'ServerHomeStandard' => 'Windows Home Server',\n 'ServerHomePremium' => 'Windows Home Server',\n 'Windows Longhorn' => 'Windows Server 2008',\n 'Windows Longhorn Client' => 'Windows Vista'\n }\n get_xmlinfo if not defined?(@xmlinfo)\n imagecount = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE').length\n descriptions = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/NAME/text()')\n description = String.new(descriptions.first.to_s)\n if descriptions.length > 1\n # Get common name prefixes to ignore product editions,\n # like 'Ultimate' or 'Home Basic'. Do this by counting each\n # individual word from the product names and removing those\n # words that only appear once. It is important to remove them\n # longest-word-first, since some editions are substrings of\n # another, e.g. SERVERSTANDARD and SERVERSTANDARDCORE. If there\n # are any non-matching versions of Windows, it is too hard to\n # say which one is going to get installed, so return 'Windows'.\n descriptions = descriptions.map { |xml| xml.to_s.split }\n descriptions = descriptions.flatten\n wordcounts = Hash.new(0)\n descriptions.each { |word| wordcounts[word] += 1 }\n wordcounts = wordcounts.reject { |word, count| count == imagecount }\n sorted = wordcounts.keys.sort_by { |string| string.length }\n sorted.reverse_each { |word, count| description.slice! word }\n description.rstrip!\n end\n description = 'Windows' if description.empty?\n @description = substitutions.keys.include?(description) ?\n substitutions[description] : description\n rescue\n @description = \"Windows\"\n end\n end\n @description\n end", "def extract_os_version(version)\n #version.unpack('CCS').join('.')\n begin\n os_version = NTLM::OSVersion.read(version)\n rescue IOError\n return ''\n end\n return \"#{os_version.major}.#{os_version.minor}.#{os_version.build}\"\n end", "def get_gcovr_version()\n version_number_major = 0\n version_number_minor = 0\n\n command = @ceedling[:tool_executor].build_command_line(TOOLS_GCOV_GCOVR_POST_REPORT, [], \"--version\")\n shell_result = @ceedling[:tool_executor].exec(command[:line], command[:options])\n version_number_match_data = shell_result[:output].match(/gcovr ([0-9]+)\\.([0-9]+)/)\n\n if !(version_number_match_data.nil?) && !(version_number_match_data[1].nil?) && !(version_number_match_data[2].nil?)\n version_number_major = version_number_match_data[1].to_i\n version_number_minor = version_number_match_data[2].to_i\n end\n\n return version_number_major, version_number_minor\n end", "def version\n\t\tmodule_info['Version'].split(/,/).map { |ver|\n\t\t\tver.gsub(/\\$Rev.s.on:\\s+|\\s+\\$$/, '')\n\t\t}.join(',')\n\tend", "def get_version_build\n version = self.peers_version\n if version[\"success\"]\n return version[\"build\"]\n else\n return nil\n end\n end", "def major_minor\n # TODO: It would be cool to try <major>.<minor + 1> if possible.\n ver = version_data['serverVersion']\n [ver['major'], ver['minor']]\n .map(&:to_i)\n .map(&:to_s)\n .join('.')\n end", "def GetVersionParts(versionStr)\n version_vals = versionStr.split('-')\n major, minor, patch = version_vals[0].split('.')\n build = version_vals[1]\n return major, minor, patch, build\n end", "def version_info\n (Wrapper.msc_who_am_i @msc_ptr).to_s\n end", "def get_system_gcc_ver(system_gcc='gcc')\n o = `echo $(#{system_gcc} --version | grep ^gcc )`\n gcc_txt_ary = o.split(' ')\n gcc_ver_txt = ''\n gcc_txt_ary.each do |txt|\n if txt.split('.').length() == 3\n txt_split = txt.split('.')\n major = txt_split[0].to_i\n minor = txt_split[1].to_i\n patch = txt_split[2].to_i\n gcc_ver_txt = \"#{major}.#{minor}.#{patch}\"\n break\n end\n end\n ver_system_gcc = Version.new(gcc_ver_txt)\n return ver_system_gcc\n end", "def determine_revision\n # Note the revision number we're running, and a\n # more-informative string containing it.\n revision_path = File.dirname(__FILE__) + \"/../../REVISION\"\n begin\n digits = 8\n if File.exist? revision_path\n mod_date = File.mtime(revision_path)\n full_number = File.read(revision_path).strip\n number = full_number[0...digits]\n extra = mod_date.strftime(\"%H:%M %a, %b %d %Y\").gsub(\" 0\",\" \")\n else\n if File.exist?(\".git\")\n full_number = `git log -1`.split(\" \")[1]\n number = full_number[0...digits]\n extra = `git branch`.split(\"\\n\").grep(/^\\*/)[0].split(' ')[-1]\n else\n # We don't use --xml anymore, because CentOS's svn doesn't have it.\n number = `svn info`.grep(%r\"^Revision: \")[0].split(\" \")[1]\n extra = ''\n end\n end\n rescue\n number = '???'\n extra = ''\n end\n details = \"#{Rails.env} #{number} #{extra} #{Socket.gethostname}\"\n return full_number, number, details\nend", "def major_minor(version)\n version.split('.').map(&:to_i)\n end", "def platform_version\n osver[1]\n end", "def ver\n if v = version\n str = +\"#{program_name} #{[v].join('.')}\"\n str << \" (#{v})\" if v = release\n str\n end\n end", "def version_number\n self.name =~ /RHEL-([0-9]+)/\n return $1.to_i\n end", "def platform\n type = os_type(:nice)\n type = case type\n when /Linux/i then linux_type\n else type\n end\n \n # Grab the Solaris version; turns '5.9' into '9', for example. (Solaris has a really\n # bizarre numbering scheme.)\n #\n # FIXME: This should include patchlevel.\n if type =~ /Solaris/i\n if @solaris_version.nil?\n @solaris_version = @platform.exec(\"uname\", \"-r\").strip\n @solaris_version = $2 if @solaris_version =~ /^\\s*(\\d+)\\s*\\.\\s*(\\d+)\\s*$/i\n end\n \n type += @solaris_version\n end\n \n # Grab the OS X version by looking at the Darwin kernel version.\n #\n # FIXME: This should include minor version, too (e.g., 10.4.7).\n if type =~ /OSX/i\n if @osx_version.nil?\n @osx_version = @platform.exec(\"uname\", \"-r\").strip\n if @osx_version =~ /^\\s*(\\d+)\\s*\\.\\s*(\\d+).*$/i\n minor_version = [ $1.to_i - 4, 0 ].max # i.e., Darwin 8.x => OS X 10.4, 7.x => OS X 10.3, etc.\n @osx_version = \"10.%d\" % minor_version\n else\n @osx_version = '-unknown-%s' % @osx_version\n end\n end\n \n type += @osx_version\n end\n \n # Grab the Windows version by System.getProperty\n if type =~ /Windows/i\n os_name = JavaSystem.getProperty('os.name');\n sun_os_patch_level = JavaSystem.getProperty('sun.os.patch.level');\n if @windows_version.nil?\n @windows_version = case os_name \n when /Windows 2003/i: \"win2k3\"\n when /Windows XP/i: \"winxp\"\n else os_name.gsub(/ /, '_')\n end\n unless sun_os_patch_level == \"unknown\"\n patch = ''\n sun_os_patch_level.split(/ /).each do |t|\n patch = \"#{patch}#{t[0..0]}\"\n end\n @windows_version += '-' + patch\n end \n end\n \n type = @windows_version\n end\n \n \"%s-%s\" % [ type.downcase, processor_type.downcase ]\n end", "def component_names platform\n @component_names={}\n @component_names['pc']||=FileList[\"#{@current_dir}/**/build.cfg\"].exclude(/\\/gen\\//,/\\/dsl\\//,/\\/programs\\//,/\\/mocks\\//,/\\/common/).pathmap('%-2d')\n @component_names['common']||=FileList[\"#{@current_dir}/**/build.cfg\"].exclude(/\\/gen\\//,/\\/dsl\\//,/\\/programs\\//,/\\/mocks\\//,/\\/pc/).pathmap('%-2d')\n return @component_names[platform]+@component_names['common']\n end", "def buildtypes\n response = get('buildTypes')\n response['buildType']\n end", "def pdb_get_os_major_release(facts)\n if facts.is_a?(Hash) && !facts['operatingsystemmajrelease'].nil? && !facts['operatingsystemmajrelease']['value'].nil?\n os_major_release = facts['operatingsystemmajrelease']['value']\n Puppet.info(\"#{log_prefix} puppet os major release for node is: os major release=#{os_major_release}\")\n os_major_release\n else\n \"Unknown\"\n end\n end", "def version_number\n \"#{self.major}.#{self.minor}\"\n end", "def compute_build_number(bundle)\n @cached_build_numbers ||= {}\n src = bundle.source_root\n ret = @cached_build_numbers[src]\n return ret unless ret.nil?\n\n digests = Dir.glob(File.join(src, '**', '*.*')).map do |path|\n (File.exists?(path) && !File.directory?(path)) ? Digest::SHA1.hexdigest(File.read(path)) : '0000'\n end\n ret = @cached_build_numbers[src] = Digest::SHA1.hexdigest(digests.join)\n return ret \n end", "def server_version\n status['value']['build']['version']\n end", "def build_status(devs = nil)\n devs = self.devices if not devs\n devs = [devs].flatten\n ptr = MemoryPointer::new( :cl_build_status )\n return devs.collect { |dev|\n error = OpenCL.clGetProgramBuildInfo(self, dev, BUILD_STATUS, ptr.size, ptr, nil)\n error_check(error)\n [dev, BuildStatus::new(ptr.read_cl_build_status)]\n }\n end", "def version\n [ \"lib/#{ name }.rb\", \"lib/#{ name }/version.rb\" ].each do |v|\n path = project_path( v )\n line = path.read[/^\\s*VERSION\\s*=\\s*.*/]\n if line then\n return line.match(/.*VERSION\\s*=\\s*['\"](.*)['\"]/)[1]\n end\n end\n end", "def version\n output = @filer.invoke(\"system-get-version\")\n if(output.results_errno() != 0)\n r = output.results_reason()\n raise \"Failed : \\n\" + r\n else \n output.child_get_string(\"version\")\n end\n end", "def find_centos_minor_version\n os_minor_version = ''\n kernel_patch_version = find_kernel_patch_version\n\n os_minor_version = '7' if kernel_patch_version >= '1062'\n os_minor_version = '8' if kernel_patch_version >= '1127'\n os_minor_version = '9' if kernel_patch_version >= '1160'\n\n os_minor_version\nend", "def detect_jobs\n release_detector.latest_dev_release_job_names\n end", "def detect_jobs\n release_detector.latest_dev_release_job_names\n end", "def component_version(cmp)\n component_cmake_vars(cmp)['PACKAGE_VERSION']\nend", "def determine_revision\n # Note the revision number we're running, and a\n # more-informative string containing it.\n begin\n revision_path = Rails.root.join 'REVISION'\n digits = 8\n if File.exist? revision_path\n mod_date = File.mtime(revision_path)\n number = File.read(revision_path).strip[0...digits]\n extra = mod_date.strftime('%H:%M %a, %b %d %Y').gsub(' 0',' ')\n else\n number = `git log -1`.split(' ')[1][0...digits]\n extra = `git status -sb`.split(\"\\n\")[0].split(' ')[-1]\n end\n rescue\n number = '???'\n extra = ''\n end\n details = \"#{Rails.env} #{number} #{extra} #{`hostname -f`.strip}\"\n return number, details\nend", "def last_build_git_data\n describe = @repo.recent_tag_name()\n m = describe.match(/(\\D*)(\\d+)/)\n build = 0\n if (m && m.length == 3)\n build = m[2].to_i\n tag_name = m[1]\n if (build > 0)\n puts \"most recent tag found is for build #{build}\"\n else\n build = 0\n end\n end\n { :build_number => build, :tag_name => tag_name, :describe => describe}\n end", "def get_build\n @progressIndicator.setIndeterminate(true)\n @progressIndicator.startAnimation(nil)\n @downloadLabel.stringValue = \"Getting build number...\"\n chrome_build = ChromeBuild.new\n chrome_build.delegate = lambda do |data|\n result = NSString.alloc.initWithData data, encoding:NSUTF8StringEncoding\n @buildLabel.stringValue = \"Build: #{result}\"\n get_zip(result)\n end\n chrome_build.buf = NSMutableData.new\n chrome_build.response = nil\n\n url = NSURL.URLWithString(\"http://build.chromium.org/buildbot/snapshots/chromium-rel-mac/LATEST\")\n req = NSURLRequest.requestWithURL(url)\n chrome_build.conn = NSURLConnection.alloc.initWithRequest(req, delegate:chrome_build)\n end", "def build_number\n travis = ENV['TRAVIS_BUILD_NUMBER']\n # bring circle's build numbers up to pass Travis'?\n circle = (ENV['CIRCLE_BUILD_NUM'].to_i + 3250).to_s\n travis || circle\nend", "def component_build_bin(cmp)\n component(cmp).fetch('buildbin', CONF_DEFAULT_BUILDBIN)\nend", "def logical_version_number\n @logical_version_number || self.current_version\n end", "def version_number\n ver = self.version\n n = ver.scan(/OpenCL (\\d+\\.\\d+)/)\n return n.first.first.to_f\n end", "def version_number\n return @version_number\n end", "def osver\n return `uname -r`.chomp\n end", "def build_os_version(os)\n # NOTE: UA regexes don't always give us the versions back\n # they do get \"corrected\" for various OSes such as:\n # - Windows (Windows NT 6.0 => 'Vista')\n # - Windows ('Windows NT 6.3' => '8','1')\n # - Windows ('Windows NT 10.0' => '10')\n # - iOS ('Darwin/15.5' => '9','3','2')\n return unless major = os.major\n if major.to_i.to_s == major\n version, sep = duped_string(major), '.'\n else\n version, sep = duped_string(major), ' '\n end\n if os.minor\n version << sep << os.minor\n if os.patch\n version << '.' << os.patch\n if os.patchMinor\n version << '.' << os.patchMinor\n end\n end\n end\n version\n end", "def monit_version\n @monit_version ||= begin\n cmd = shell_out([monit_binary, '-V'])\n if !cmd.error? && /version ([0-9.]+)$/ =~ cmd.stdout\n Gem::Version.create($1)\n else\n nil\n end\n end\n end", "def platforms; platform_names; end", "def get_last_build_version(appName)\n appcenter_fetch_version_number(\n api_token: ENV['APPCENTER_API_TOKEN'],\n owner_name: ENV['APPCENTER_OWNER_NAME'],\n app_name: appName\n )\nend", "def xlate_minor_version()\n return MIN_VERSION_XLATES[@minor_version] if (MIN_VERSION_XLATES.has_key?(@minor_version))\n return(@minor_version.to_s) \n end", "def determine_revision\n # Note the revision number we're running, and a\n # more-informative string containing it.\n number = `git log -1`.split(' ')[1][0...8] rescue '???'\n details = \"#{Rails.env} #{number} #{`hostname -f`.strip}\"\n return number, details\nend", "def get_numeric_rev\n\t\t\tid = read_command_output( 'hg', '-q', 'identify', '-n' )\n\t\t\treturn id.chomp[ /^(\\d+)/, 1 ] || '0'\n\t\tend", "def VendorInfo()\r\n ret = @dispatch._getproperty(1610743814, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "def platform_version\n version = capabilities['platformVersion']\n version.nil? ? nil : version.to_s\n end", "def version_without_build\n version.split('-')[0]\n end", "def update_app_version_numbers\n version_string = ENV['FORCED_VERSION_NUMBER_STRING']\n xcode_project_version = nil\n\n if !version_string.nil? && version_string.length > 0\n\n puts \"using forced version \\\"#{version_string}\\\"\"\n\n else\n\n version_string = get_semver_from_branch(ENV['GIT_HEAD_REF'])\n\n if version_string.nil?\n\n app_store_build_number(live: false)\n latest_app_store_version = lane_context[SharedValues::LATEST_VERSION]\n xcode_project_version = get_project_xcode_version\n\n # use largest version (note ascii comparison - not sure if accurate enough)\n version_string = latest_app_store_version > xcode_project_version ? latest_app_store_version : xcode_project_version\n puts \"using version #{version_string} (latest app store = #{latest_app_store_version}, project version = #{xcode_project_version})\"\n\n end\n\n end\n\n # increment build number\n forced_build_number = ENV['FORCED_BUILD_NUMBER']\n if forced_build_number.nil? || forced_build_number.empty?\n current_build_number = parse_latest_testflight_build_number(version_string)\n\n if current_build_number == 0\n if m = version_string.match(semver_regex)\n # if no existing number was found we need to check variations of the same version\n # since Apple handles 1, 1.0, and 1.0.0 independently, but they share build number\n puts \"build number is 0 - checking version variations in case there's a match\"\n\n major = m.captures[0]\n minor = m.captures[1]\n patch = m.captures[2]\n\n puts \"major=#{major} minor=#{minor} patch=#{patch}\"\n if patch == '0'\n variation = \"#{major}.#{minor}\"\n current_build_number = latest_testflight_build_number(version: variation, initial_build_number: 0)\n puts \"variation \\\"#{variation}\\\" = #{current_build_number}\"\n\n if current_build_number == 0 && minor == '0'\n variation = major\n current_build_number = latest_testflight_build_number(version: variation, initial_build_number: 0)\n puts \"variation \\\"#{variation}\\\" = #{current_build_number}\"\n end\n end\n else\n UI.important 'build number is 0 and version is not semantically correct - unable to check version variations (build number may be incorrect)'\n end\n\n end\n\n build_number = current_build_number + 1\n increment_build_number(build_number: build_number)\n else\n puts \"using forced build number \\\"#{forced_build_number}\\\"\"\n build_number = forced_build_number\n increment_build_number(build_number: build_number)\n end\n\n # set version number\n current_version_string = xcode_project_version || get_project_xcode_version\n increment_version_number(version_number: version_string)\n update_package_version(version_string)\n\n puts \"build_number #{current_build_number} => #{build_number}\"\n puts \"version_number #{current_version_string} => #{version_string}\"\nend", "def version\n str = if detect_product(\"CriOs\")\n crios.version\n else\n chrome.version\n end\n\n Version.new(str)\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 update_app_version_numbers()\n \n version_string = ENV[\"FORCED_VERSION_NUMBER_STRING\"]\n xcode_project_version = nil\n \n if version_string != nil && version_string.length > 0\n\n puts \"using forced version \\\"#{version_string}\\\"\"\n\n else\n\n version_string = get_semver_from_branch\n\n if version_string == nil\n\n app_store_build_number(live: false)\n latest_app_store_version = lane_context[SharedValues::LATEST_VERSION]\n xcode_project_version = get_project_xcode_version\n\n # use largest version (note ascii comparison - not sure if accurate enough)\n version_string = latest_app_store_version > xcode_project_version ? latest_app_store_version : xcode_project_version\n puts \"using version #{version_string} (latest app store = #{latest_app_store_version}, project version = #{xcode_project_version})\"\n\n end\n\n end\n\n # increment build number\n forced_build_number = ENV[\"FORCED_BUILD_NUMBER\"]\n unless forced_build_number == nil || forced_build_number.empty?\n puts \"using forced build number \\\"#{forced_build_number}\\\"\"\n build_number = forced_build_number\n increment_build_number(build_number: build_number)\n else\n current_build_number = latest_testflight_build_number(version: version_string, initial_build_number: 0)\n\n if current_build_number == 0\n if m = version_string.match($semver_regex)\n # if no existing number was found we need to check variations of the same version\n # since Apple handles 1, 1.0, and 1.0.0 independently, but they share build number\n puts \"build number is 0 - checking version variations in case there's a match\"\n\n major = m.captures[0]\n minor = m.captures[1]\n patch = m.captures[2]\n\n puts \"major=#{major} minor=#{minor} patch=#{patch}\"\n if patch == \"0\"\n variation = \"#{major}.#{minor}\"\n current_build_number = latest_testflight_build_number(version: variation, initial_build_number: 0)\n puts \"variation \\\"#{variation}\\\" = #{current_build_number}\"\n \n if current_build_number == 0 && minor == \"0\"\n variation = major\n current_build_number = latest_testflight_build_number(version: variation, initial_build_number: 0)\n puts \"variation \\\"#{variation}\\\" = #{current_build_number}\"\n end\n end\n else\n UI.important \"build number is 0 and version is not semantically correct - unable to check version variations (build number may be incorrect)\"\n end\n \n end\n\n build_number = current_build_number + 1\n increment_build_number(build_number: build_number)\n end\n\n # set version number\n current_version_string = xcode_project_version || get_project_xcode_version\n increment_version_number(version_number: version_string)\n\n\n puts \"build_number #{current_build_number} => #{build_number}\"\n puts \"version_number #{current_version_string} => #{version_string}\"\n end", "def major\n @major ||= ruby_cc_version.match( /.*-(\\d.\\d).\\d/ )[1]\n end", "def latest\n ## make hcmbcs jump through hoops to give us latest pkg version\n begin\n output = hcmbcs \"--search\", \"--xml\", \"--package=#{self.name}\"\n rescue Puppet::ExecutionFailure\n raise Puppet::Error, \"failed hcmbcs --search\"\n end\n\n ## scan with group gives array of arrays\n version = output.scan(/<hcm_release_fq_hcm_pn>#{self.name}-([^<]+)<\\/hcm_release_fq_hcm_pn>/).last.first\n self.debug version\n\n return version\n end", "def ruby_version\n\t\treturn RUBY_VERSION.split( /\\./, 3 ).map( &:to_i ).pack( 'n*' )\n\tend", "def get_number\n @number_of_repos\n end", "def version\n @version ||= `git --version`.split(/\\s/).last.split(\".\").collect {|i| i.to_i}\n end", "def get_hudson_version\n get_root if @hudson_version.nil?\n @hudson_version\n end", "def get_osx_release_data\n cmd = \"uname -s\"\n kernel = if InstallBuddy.get_option(:remote)\n Remote.exec(cmd)\n else\n `#{cmd}`\n end\n return [\"ID=MacOSX\"] if kernel.match(/^Darwin/)\n []\n end", "def get_version\n\t\tself.dev_stage.blank? ? dev_stage_string = \"\" : dev_stage_string = self.dev_stage + \" \"\n\t\treturn dev_stage_string + self.maj_version.to_s + \".\" + self.min_version.to_s\n\tend", "def get_gem_names\n fetcher = Gem::SpecFetcher.fetcher\n\n list, = fetcher.available_specs(:complete)\n\n tuples = list.values.first\n\n tuples.map do |tuple,|\n tuple = tuple.to_a\n case tuple.last\n when Gem::Platform::RUBY then\n tuple[0, 2]\n else\n tuple\n end.join '-'\n end\n end", "def windows_processes\n\t\trequire 'win32ole'\n\t\twmi = WIN32OLE.connect(\"winmgmts://\")\n\t\twmi.ExecQuery(\"select * from win32_process\").map do |proc_info|\n\t\t\tparse_oleprocinfo(proc_info)\n\t\tend\n\tend", "def windows_processes\n\t\trequire 'win32ole'\n\t\twmi = WIN32OLE.connect(\"winmgmts://\")\n\t\twmi.ExecQuery(\"select * from win32_process\").map do |proc_info|\n\t\t\tparse_oleprocinfo(proc_info)\n\t\tend\n\tend", "def get_linux_distro_version_codename\n version_codename_regex = /^VERSION_CODENAME=\\W*(\\w+)\\W*/\n File.open('/etc/os-release') do |release_file|\n release_file.each do |line|\n return line.match(version_codename_regex)[1].downcase if line =~ version_codename_regex\n end\n end\n ''\n end", "def build_number=(value)\n @build_number = value\n end", "def version_number\n @version\n end", "def VendorInfo()\r\n ret = _getproperty(1610743814, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "def platform_and_version\n case node['platform']\n when 'debian'\n platform_and_version = \"debian-#{node['platform_version'].to_i}\"\n when 'ubuntu'\n platform_and_version = \"ubuntu-#{node['platform_version']}\"\n end\n platform_and_version\n end", "def version\n return last_version if versionable?\n version_number\n end", "def get_unix_info()\n v = $VERBOSE\n $VERBOSE = nil\n sysname = `uname -s`\n $VERBOSE = v\n sysname = sysname.chomp\n\n if(sysname.include?(\"Linux\")) # for linux (rhel, suse, oel)\n # check if it is SUSE\n filepath = Pathname.new(\"/etc/SuSE-release\")\n if(filepath.exist?())\n release_file = '/etc/SuSE-release'\n else # for RHEL, OEL, etc.\n release_file = '/etc/issue'\n end\n\n $VERBOSE = nil\n flavor = `head -n 1 #{release_file}`\n $VERBOSE = v\n sysname = flavor.sub(/\\(\\w+\\)/, '').chomp\n sysname = sysname.sub(/\\s+\\Z/, \"\")\n\n else # for other unix platforms (solaris, aix, hpux)\n $VERBOSE = nil\n if(sysname.eql?(\"AIX\"))\n version = `oslevel`\n else\n version = `uname -r`\n end\n $VERBOSE = v\n sysname = sysname + \" \" + version.chomp\n end\n\n $VERBOSE = nil\n if(sysname.eql?(\"HP-UX\"))\n processor = `uname -m`\n else\n processor = `uname -p`\n end\n\n if(sysname.include?(\"SunOS\"))\n isainfo = `isainfo -b`\n isainfo = isainfo.chomp\n bitinfo = \" \" + isainfo + \"-bit\"\n else\n bitinfo = \"\"\n end\n $VERBOSE = v\n\n os_info = sysname + \" \" + processor.chomp + bitinfo\n os_info\nend", "def osx_version\n @osx_version ||= `sw_vers | grep ProductVersion | cut -f 2 -d ':' | awk ' { print $1; } '`.strip rescue ''\n end", "def osx_version\n @osx_version ||= `sw_vers | grep ProductVersion | cut -f 2 -d ':' | awk ' { print $1; } '`.strip rescue ''\n end", "def get_jenkins_version\n get_root if @jenkins_version.nil?\n @jenkins_version\n end", "def version\n @version ||= version_hex.to_s(16).chars.entries.join('.')\n end", "def get_arch\n if defined?(@arch) then return @arch else @arch = nil end\n search = File.join(@path, '{*/system32,{i386,amd64}}/ntdll.dll')\n ntdlls = Dir.glob(search, File::FNM_CASEFOLD)\n if ntdlls.length > 0\n machine = %x{pev -c #{ntdlls.first} | grep -i Machine}\n if $?.success?\n @arch = '64-bit' if machine =~ /0x8664/\n @arch = '32-bit' if machine =~ /14c/\n end\n else\n search = File.join(@path, 'sources/{setup.exe,winsetup.dll}')\n setup = Dir.glob(search, File::FNM_CASEFOLD)\n setup.each do |file|\n machine = %x{pev -c #{file} | grep -i Machine}\n if $?.success?\n @arch = '64-bit' if machine =~ /0x8664/\n @arch = '32-bit' if machine =~ /14c/\n break\n end\n end # end of setup block\n begin\n get_xmlinfo if not defined?(@xmlinfo)\n arches = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/WINDOWS/ARCH/text()')\n arch = arches.first\n if arches.count(arch) == arches.size\n arch = Integer(arch.to_s)\n @arch = '64-bit' if arch == 9\n @arch = '32-bit' if arch == 0\n else\n @arch = '32/64-bit' unless @arch\n end\n rescue Exception => e\n # puts \"error(get_arch): #{e}\"\n end\n end\n @arch\n end", "def version_major_minor\n version.split('.')[0..1].join('.')\n end", "def module_version(repo_dir, config, build)\n version = config[\"module_version\"] || git_current_branch(repo_dir) || \"unknown\"\n \n if (not build.nil?) && build.length > 0\n return version + \"-\" + build\n else\n return version\n end\n end", "def platform_tuple\n [platform_shortname, platform_version_for_package, machine]\n end" ]
[ "0.66530526", "0.66465837", "0.65124017", "0.62614083", "0.62261355", "0.6211239", "0.61503816", "0.6042835", "0.5937323", "0.5921345", "0.5920215", "0.58979684", "0.58693236", "0.58668524", "0.57175726", "0.5705238", "0.56817204", "0.56814253", "0.5673897", "0.56664485", "0.56508756", "0.56464136", "0.5624634", "0.5614283", "0.55897826", "0.5562798", "0.55502814", "0.5540407", "0.55012167", "0.54841447", "0.54540515", "0.54516554", "0.54417115", "0.5435555", "0.5427308", "0.5415205", "0.54117584", "0.5401315", "0.5398092", "0.5370542", "0.535759", "0.5354179", "0.534953", "0.534805", "0.53473526", "0.53394675", "0.533792", "0.533529", "0.5309209", "0.5309209", "0.5302505", "0.52864605", "0.528593", "0.5282306", "0.525291", "0.52429885", "0.5236911", "0.5234542", "0.5234246", "0.5222672", "0.5220716", "0.5213639", "0.519423", "0.51934075", "0.5193043", "0.51910436", "0.5189271", "0.51885736", "0.5178989", "0.51789", "0.51758784", "0.517455", "0.5169029", "0.5168747", "0.5159195", "0.5158467", "0.5149513", "0.5147087", "0.5145055", "0.5142316", "0.5139579", "0.51395714", "0.51313233", "0.5129896", "0.5129896", "0.5124186", "0.5119463", "0.5116611", "0.51133275", "0.51086867", "0.51070213", "0.51048654", "0.51015204", "0.51015204", "0.51006293", "0.50965923", "0.5092958", "0.508546", "0.50807244", "0.50803876" ]
0.75695336
0
Decide if this is an ISO image or an OS root.
def get_mediatype if defined?(@inst) then return @inst else @inst = nil end search = File.join(@path, 'setup.exe') setup = Dir.glob(search, File::FNM_CASEFOLD) @inst = File.exists?(setup.first) ? 'Install Media' : '' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def os_type\n\n if @ostype\n return @ostype\n end\n\n res = :invalid\n\n Rouster.os_files.each_pair do |os, f|\n [ f ].flatten.each do |candidate|\n if self.is_file?(candidate)\n next if candidate.eql?('/etc/os-release') and ! self.is_in_file?(candidate, os.to_s, 'i') # CentOS detection\n @logger.debug(sprintf('determined OS to be[%s] via[%s]', os, candidate))\n res = os\n end\n end\n break unless res.eql?(:invalid)\n end\n\n @logger.error(sprintf('unable to determine OS, looking for[%s]', Rouster.os_files)) if res.eql?(:invalid)\n\n @ostype = res\n res\n end", "def disk_or_iso?(device)\n is_disk =\n !device\n .class\n .ancestors\n .index(RbVmomi::VIM::VirtualDisk).nil?\n is_iso =\n device\n .backing\n .is_a? RbVmomi::VIM::VirtualCdromIsoBackingInfo\n is_disk || is_iso\n end", "def is_root?\n cmd_exec('/usr/bin/id -ru').eql? '0'\n end", "def determine_os\n scp(:source => Provision::Bootstrapper.determine_os_script, :destination => \"/tmp\")\n o = run(\"chmod +x /tmp/determine_os.sh; /bin/sh /tmp/determine_os.sh\").chomp\n o.empty? ? :ubuntu : o\n end", "def linux?\n has_os? && !!os_image_type.match(/suse|redhat|ubuntu|debian|centos|fedora/i)\n end", "def linux?\n unix? and not mac?\n end", "def linux?\n unix? and not mac?\n end", "def is_image_windows?\n ami && ami.platform == \"windows\"\n end", "def linux?\n linux_internal?\n end", "def os_type\n vm.storage_profile.os_disk.os_type\n end", "def determine_os\n @os = 'linux'\n end", "def root?\n Process.uid.zero?\n end", "def root?\n Process.uid.zero?\n end", "def is_hyperv?\n return false if os_image_type.nil?\n\n \"hyperv\" == os_image_type.downcase\n end", "def linux?\n @linux\n end", "def determine_os\n @os = \"linux\"\n end", "def root_version?\n\t\treturn self.parent_image.nil?\n\tend", "def linux?\n !darwin?\n end", "def centos?\n @flavor =~ /centos/\n end", "def windows?\n has_os? && !!os_image_type.match(/windows/i)\n end", "def root?\n Process.uid == 0\n end", "def linux?\n kind_of? Unix::Platform rescue false\n end", "def docker_native?\n if File.exists?('/usr/bin/sw_vers')\n if File.exists?('/Applications/Docker.app')\n true\n else\n false\n end\n else\n true\n end\n end", "def owner?\n # exists? ? `ls -al #{path} | grep '[0-9] \\.$'`.split[2] : false\n proprieties[:owner]\n end", "def is_unix_like?\n os_type !~ /^\\s*windows\\s*$/i\n end", "def ubuntu?\n @flavor =~ /ubuntu/\n end", "def os_type\n FFI::Libvirt.virDomainGetOSType(self)\n end", "def is_nix_os?\n RbConfig::CONFIG[\"host_os\"] =~ /linux|freebsd|darwin|unix/\n end", "def sensible_os?\n\n return ::RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? false : true\n\n end", "def is_root?() @name === '__root__'; end", "def unix?\n not windows? and not java?\n end", "def myOs\n if OS.windows?\n \"Windows\"\n elsif OS.linux?\n \"Linux\"\n elsif OS.mac?\n \"Osx\"\n else\n \"Não consegui indentificar!\"\n end\nend", "def linux_type\n redhat_linux_type || suse_linux_type || unknown_linux_type\n end", "def guest_platform\n node[:rightimage][:platform]\n end", "def guest_platform\n node[:rightimage][:platform]\n end", "def is_root?\n false\n end", "def client_os? system\n detect_os == system.to_sym\n end", "def can_post_install?\n return false unless has_os?\n\n ![\"vmware_esxi\", \"hyperv\", \"suse11\", \"suse12\"].include?(os_image_type.downcase)\n end", "def image?\n self.sti_type == IMAGE_TYPE\n end", "def os_type_extra\n type = os_type(:nice)\n if type =~ /linux/i && `uname -m` =~ /64/\n type = type + \"64\"\n end\n type\n end", "def linux?\n @linux ||= is? /linux|cygwin/\n end", "def suse_linux_type\n if @suse_linux_type.nil?\n out = nil\n text = FilePath.new(\"/etc/SuSE-release\").suck_file\n unless text.nil?\n if text =~ /suse/i\n out = \"sl\"\n out += \"es\" if text =~ /enterprise\\s*server/i\n out += \"%s\" % $1 if text =~ /^[^\\d]+(\\d+)/i\n end\n end\n \n @suse_linux_type = out\n end\n \n @suse_linux_type\n end", "def os\n os_parser.os\n end", "def unix?\n kind_of? Unix::Platform rescue false\n end", "def unix?\n !windows?\n end", "def in_test_or_root_user\n if !current_user.sk.root?\n in_test\n end\n end", "def is_root_device?(volume_id)\n vols = @ec2_api.describe_volumes(:volume_id => volume_id)\n if vols['volumeSet']['item'][0]['attachmentSet'] == nil || vols['volumeSet']['item'][0]['attachmentSet']['item'].size == 0\n #not linked to any instance, cannot be a root-device\n return false\n end\n instance_id = vols['volumeSet']['item'][0]['attachmentSet']['item'][0]['instanceId']\n res = @ec2_api.describe_instance_attribute(:instance_id => instance_id, :attributes => {:rootDeviceName => true})\n if res[\"rootDeviceName\"] == nil\n return false\n end\n rdn = res['rootDeviceName']['value']\n res = @ec2_api.describe_instances(:instance_id => instance_id)\n if res['reservationSet']['item'][0]['instancesSet']['item'][0]['blockDeviceMapping']['item'].size == 0\n # volume unattached in the meantime\n return false\n end\n attached = res['reservationSet']['item'][0]['instancesSet']['item'][0]['blockDeviceMapping']['item']\n attached.each() {|ebs|\n volume = ebs['ebs']['volumeId']\n device_name = ebs['deviceName']\n if volume == volume_id && rdn == device_name\n return true\n end\n }\n return false\n end", "def os\n app = app_with_comments\n return unless app\n\n OperatingSystems.normalize_os(app.comment[2]) if app.comment[2]\n end", "def is_os(string)\n return false if string === false || string === true || string.nil?\n @os.key?(string.to_sym)\n end", "def centos?(node)\n node['platform'] == 'centos'\n end", "def linux? ; RUBY_PLATFORM =~ /linux/i end", "def get_os_type(image_name)\n image_service = Azure::VirtualMachineImageManagementService.new\n image = image_service.list_virtual_machine_images.select{|x| x.name == image_name}.first\n Loggerx.error_with_exit \"The virtual machine image source is not valid.\" unless image\n image.os_type\n end", "def guest_os(instance)\n image_reference = instance.properties.storage_profile.try(:image_reference)\n if image_reference&.try(:offer)\n \"#{image_reference.offer} #{image_reference.sku.tr('-', ' ')}\"\n else\n instance.properties.storage_profile.os_disk.os_type\n end\n end", "def on_os name\n os_kernel = `uname -a`\n os_kernel.downcase.include?(name)\nend", "def os_other\n\t\t\t\t\tnot_os_osx.not_os_linux.not_os_netbsd.not_os_freebsd.not_os_cisco.not_os_vxworks.not_os_vmware_esx.not_os_windows.not_os_aix\n\t\t\t\tend", "def valid_os_or_current(os)\n if os\n os = os.to_sym\n oses = U3dCore::Helper.operating_systems\n raise \"Specified OS (#{os}) isn't valid [#{oses.join(', ')}]\" unless oses.include?(os)\n else\n os = U3dCore::Helper.operating_system\n end\n os\n end", "def is_unix?\n return !!@name.match(/^(solaris|aix|osx)-.*$/)\n end", "def is_linux?\n return (!is_windows? && !is_unix?)\n end", "def is_public_root?\n false\n end", "def linux?\n !!(ua =~ /Linux/)\n end", "def supported_platform?\n linux? || darwin?\n end", "def is_ubuntu?\n return !!@name.match(/^ubuntu-.*$/)\n end", "def ostype\n return @rye_ostype if @rye_ostype # simple cache\n os = self.quietly { uname.first } rescue nil\n os ||= 'unknown'\n os &&= os.downcase\n @rye_ostype = os\n end", "def is_main_image?\n self.primary_image == true\n end", "def ubuntu?(node)\n node['platform'] == 'ubuntu'\n end", "def root?\n !!@root || app_file?\n end", "def check_root\n\t# Make sure we are running as root\n\tprint_status(\"Checking if running as root\")\n\tif Process.uid != 0\n\t\tprint_error(\"You are not running as Root!\")\n\t\texit\n\tend\n\t# Make sure we are running in Linux\n\tif not RUBY_PLATFORM =~ /linux/\n\t\tprint_error(\"This script only works in linux\")\n\t\texit\n\tend\nend", "def centos_platform?(node = __getnode)\n node[\"platform\"] == \"centos\"\n end", "def omnios?(node)\n node['platform'] == 'omnios'\n end", "def is_root?()\n @rootpath == @path\n end", "def has_os?\n delegate(provider, :has_os?)\n end", "def check_if_native(entity) #volumes or snapshots\n native = extension = false\n #check if 'native' volume API present:\n begin\n response = @connection.req(\"GET\", \"/#{entity}\")\n native = true if response.code.match(/^20.$/)\n return true, entity\n rescue OpenStack::Exception::ItemNotFound => not_found\n native = false\n end\n #check if available as extension:\n begin\n response = @connection.req(\"GET\", \"/os-#{entity}\")\n extension = true if response.code.match(/^20.$/)\n return false, \"os-#{entity}\"\n rescue OpenStack::Exception::ItemNotFound => not_found\n extension = false\n end\n raise OpenStack::Exception::NotImplemented.new(\"No Volumes support for this provider\", 501, \"No #{entity} Support\") unless (native || extension)\n end", "def linux?\n RUBY_PLATFORM =~ /linux/i\nend", "def docker_for_mac_or_win?\n ::Docker.info(::Docker::Connection.new(config[:docker_host_url], {}))['Name'] == 'moby'\n rescue\n false\n end", "def has_rackspace_kernel?\n kernel[:release].split('-').last.eql?(\"rscloud\")\nend", "def IsRealDisk(entry)\n entry = deep_copy(entry)\n Ops.get_symbol(entry, \"type\", :CT_UNKNOWN) == :CT_DISK &&\n !(Ops.get_symbol(entry, \"type\", :CT_UNKNOWN) == :CT_DISK &&\n Ops.get_boolean(entry, \"readonly\", false) &&\n Ops.get_string(entry, \"driver\", \"\") == \"vbd\")\n end", "def root?\n @type == ROOT\n end", "def linux?\n /linux/.match(RUBY_PLATFORM)\n end", "def os_s\n\t\tif(os == 'iPad' || os == 'BlackBerry' || os == 'iPhone' || os == 'Android')\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def linux?\n RUBY_PLATFORM =~ /linux/\n end", "def is_root?\n @path == '/' || @path == ''\n end", "def fstype\n return self['fstype'] if has_key?('fstype')\n Chef::Log.info([\n self['fstype'], current[:fstype],\n File.exists?(device) && `file -s '#{device}'`.chomp,\n self,\n ].inspect)\n return current[:fstype] if current[:fstype]\n return unless File.exists?(device)\n dev_type_str = `file -s '#{device}'`.chomp\n case\n when dev_type_str =~ /SGI XFS/ then self['fstype'] = 'xfs'\n when dev_type_str =~ /Linux.*(ext[2-4])/ then self['fstype'] = $1\n else\n raise \"Can't determine filesystem type of #{device} -- set it explicitly in node[:volumes]\"\n end\n self['fstype']\n end", "def centos?\n File.exist?('/etc/centos-release')\nend", "def run_as_sudo?\n if ENV['USER']=='root' and (su=ENV['SUDO_USER'])\n su\n else\n false\n end\n end", "def is_os? os\n Os.is_os? request.user_agent, os\n end", "def linux?\n RUBY_PLATFORM.match(/linux/)\n end", "def is_os_x?\n RbConfig::CONFIG[\"host_os\"] =~ /darwin/\n end", "def ubuntu_platform?(node = __getnode)\n node[\"platform\"] == \"ubuntu\"\n end", "def installable_platform?\n # BACKCOMPAT If the file is coming out of a specified file, then we\n # ignore the platform. This code can be removed in RG 3.0.\n return true if @source.kind_of? Gem::Source::SpecificFile\n\n super\n end", "def is_office?\n ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'].include? self.image_file_name.split('.').last\n end", "def os\n return @os if @os\n raw_os = RbConfig::CONFIG['target_os']\n match = raw_os.match(/([a-z]+)/)\n if match\n @os = match[1]\n else\n @os = raw_os\n end\n end", "def linux?\n %w(debian redhat ubuntu).include?(os[:family])\nend", "def get_os_tpl(term)\n filters = []\n filters << { name: 'image-type', values: ['machine'] }\n filters << { name: 'image-id', values: [term] }\n\n Backends::Ec2::Helpers::AwsConnectHelper.rescue_aws_service(@logger) do\n ec2_images = @ec2_client.describe_images(filters: filters).images\n (ec2_images && ec2_images.first) ? mixin_from_image(ec2_images.first) : nil\n end\n end", "def disk_or_cdrom?(device)\n is_disk =\n !device\n .class\n .ancestors\n .index(RbVmomi::VIM::VirtualDisk).nil?\n is_cdrom =\n !device\n .class\n .ancestors\n .index(RbVmomi::VIM::VirtualCdrom).nil?\n is_disk || is_cdrom\n end", "def debug_if_root_device(bdms)\n return if bdms.nil? || bdms.empty?\n image_id = config[:image_id]\n image = ec2.resource.image(image_id)\n begin\n root_device_name = image.root_device_name\n rescue ::Aws::EC2::Errors::InvalidAMIIDNotFound\n # Not raising here because AWS will give a more meaningful message\n # when we try to create the instance\n return\n end\n bdms.find { |bdm|\n if bdm[:device_name] == root_device_name\n logger.info(\"Overriding root device [#{root_device_name}] from image [#{image_id}]\")\n end\n }\n end", "def get_linux_version_info(iso_file_name)\n iso_info = File.basename(iso_file_name)\n if iso_file_name.match(/purity/)\n iso_info = iso_info.split(/_/)\n else\n iso_info = iso_info.split(/-/)\n end\n linux_distro = iso_info[0]\n linux_distro = linux_distro.downcase\n if linux_distro.match(/^sle$/)\n linux_distro = \"sles\"\n end\n if linux_distro.match(/oraclelinux/)\n linux_distro = \"oel\"\n end\n if linux_distro.match(/centos|ubuntu|sles|sl|oel|rhel/)\n if linux_distro.match(/sles/)\n if iso_info[2].match(/Server/)\n iso_version = iso_info[1]+\".0\"\n else\n iso_version = iso_info[1]+\".\"+iso_info[2]\n iso_version = iso_version.gsub(/SP/,\"\")\n end\n else\n if linux_distro.match(/sl$/)\n iso_version = iso_info[1].split(//).join(\".\")\n if iso_version.length == 1\n iso_version = iso_version+\".0\"\n end\n else\n if linux_distro.match(/oel|rhel/)\n if iso_file_name =~ /-rc-/\n iso_version = iso_info[1..3].join(\".\")\n iso_version = iso_version.gsub(/server/,\"\")\n else\n iso_version = iso_info[1..2].join(\".\")\n iso_version = iso_version.gsub(/[a-z,A-Z]/,\"\")\n end\n iso_version = iso_version.gsub(/^\\./,\"\")\n else\n iso_version = iso_info[1]\n end\n end\n end\n case iso_file_name\n when /i[3-6]86/\n iso_arch = \"i386\"\n when /x86_64/\n iso_arch = \"x86_64\"\n else\n if linux_distro.match(/centos|sl$/)\n iso_arch = iso_info[2]\n else\n if linux_distro.match(/sles|oel/)\n iso_arch = iso_info[4]\n else\n iso_arch = iso_info[3]\n iso_arch = iso_arch.split(/\\./)[0]\n if iso_arch.match(/amd64/)\n iso_arch = \"x86_64\"\n else\n iso_arch = \"i386\"\n end\n end\n end\n end\n else\n if linux_distro.match(/fedora/)\n iso_version = iso_info[1]\n iso_arch = iso_info[2]\n else\n if linux_distro.match(/purity/)\n iso_version = iso_info[1]\n iso_arch = \"x86_64\"\n else\n if linux_distro.match(/vmware/)\n iso_version = iso_info[3].split(/\\./)[0..-2].join(\".\")\n iso_update = iso_info[3].split(/\\./)[-1]\n iso_release = iso_info[4].split(/\\./)[-3]\n iso_version = iso_version+\".\"+iso_update+\".\"+iso_release\n iso_arch = \"x86_64\"\n else\n iso_version = iso_info[2]\n iso_arch = iso_info[3]\n end\n end\n end\n end\n return linux_distro,iso_version,iso_arch\nend", "def image?()\n IMAGE_EXTS.include? extname\n end", "def get_filesystem\n @@current_fake ? @@current_fake[:filesystem] : ''\n end", "def detect_os\r\n user_agent = request.env['HTTP_USER_AGENT']\r\n if user_agent =~ /(Windows|Mac)/\r\n return $1\r\n end\r\n return 'Unknow OS'\r\n end", "def os(sym=nil)\n if sym\n dsl_options[:os] = sym\n else\n dsl_options[:os] ||= determine_os.to_sym\n end\n end", "def default_image\n \"/var/lib/libvirt/images/kitchen-#{instance.platform.name}\"\n end" ]
[ "0.6591263", "0.6532187", "0.6400906", "0.6347807", "0.6327243", "0.6124495", "0.61153", "0.61070794", "0.6100217", "0.6026279", "0.6012151", "0.5999745", "0.5999745", "0.59876275", "0.5974671", "0.5939201", "0.59262204", "0.59128", "0.58902913", "0.5872854", "0.5868344", "0.58471173", "0.5820983", "0.5809257", "0.5806672", "0.5782711", "0.5766163", "0.57617193", "0.5760584", "0.57470423", "0.57312775", "0.5731026", "0.5730961", "0.5728486", "0.5728486", "0.5717552", "0.5716014", "0.571535", "0.57150257", "0.5710738", "0.56959933", "0.5681774", "0.5681705", "0.56753963", "0.5674644", "0.5653311", "0.5644849", "0.5642881", "0.56369656", "0.56279737", "0.5604371", "0.559673", "0.5577544", "0.55671227", "0.55636704", "0.5562638", "0.555587", "0.55477875", "0.55419856", "0.55387306", "0.55304956", "0.55191725", "0.5515914", "0.54929084", "0.5482894", "0.5480585", "0.54761297", "0.54740655", "0.5463343", "0.5458181", "0.54546463", "0.5451274", "0.5450549", "0.54473764", "0.54470307", "0.54461795", "0.5440241", "0.54349655", "0.54228634", "0.54163", "0.54116315", "0.54089016", "0.54006624", "0.5399717", "0.5399532", "0.5397149", "0.53965104", "0.5395703", "0.5394216", "0.5385311", "0.53785104", "0.5377751", "0.53742266", "0.53730386", "0.5370156", "0.53574926", "0.5350077", "0.53451926", "0.53364307", "0.53217876", "0.53183573" ]
0.0
-1
Create a description string for this version of Windows.
def get_winstring if defined?(@description) then return @description else @description = nil end get_build if not @major if @major < 6 # Vista and up use install.wim version = "#{@major}.#{@minor}" releases = { '5.0' => { 2195 => 'Windows 2000' }, '5.1' => { 2600 => 'Windows XP' }, '5.2' => { 2600 => 'Windows XP', 3790 => 'Windows Server 2003' } } # Get the closest build. Makes more sense with a bigger table. closest, description = releases[version].first releases[version].each do |build, name| if (build-@build).abs < (closest-@build).abs description = name closest = build end end # end of releases block @description = description else # Only works for ISO images for now. Use hivex for OS-root folders. begin substitutions = { # Products that don't have good descriptions. 'ServerSBSStandard' => 'Windows Small Business Server', 'SERVERSBSSTANDARD' => 'Windows Small Business Server', 'ServerHomeStandard' => 'Windows Home Server', 'ServerHomePremium' => 'Windows Home Server', 'Windows Longhorn' => 'Windows Server 2008', 'Windows Longhorn Client' => 'Windows Vista' } get_xmlinfo if not defined?(@xmlinfo) imagecount = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE').length descriptions = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/NAME/text()') description = String.new(descriptions.first.to_s) if descriptions.length > 1 # Get common name prefixes to ignore product editions, # like 'Ultimate' or 'Home Basic'. Do this by counting each # individual word from the product names and removing those # words that only appear once. It is important to remove them # longest-word-first, since some editions are substrings of # another, e.g. SERVERSTANDARD and SERVERSTANDARDCORE. If there # are any non-matching versions of Windows, it is too hard to # say which one is going to get installed, so return 'Windows'. descriptions = descriptions.map { |xml| xml.to_s.split } descriptions = descriptions.flatten wordcounts = Hash.new(0) descriptions.each { |word| wordcounts[word] += 1 } wordcounts = wordcounts.reject { |word, count| count == imagecount } sorted = wordcounts.keys.sort_by { |string| string.length } sorted.reverse_each { |word, count| description.slice! word } description.rstrip! end description = 'Windows' if description.empty? @description = substitutions.keys.include?(description) ? substitutions[description] : description rescue @description = "Windows" end end @description end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n return \"New Firmware\" if !id\n version + \" (\" + description.to_s + \") \" +\n \" (\" + (for_external ? \"internal\" : \"external\") + \")\"\n end", "def create_description_string(name, host, status, description, bracket)\n output = \"```\\n============\\n#{name}\\n============\\n```\\n\"\n output << \"Host: #{host}\\n\"\n output << \"Status: #{status}\\n\"\n\toutput << \"Bracket: #{bracket}\\n\"\n output << \"Link to Description: #{description}\\n\"\n return output\nend", "def generate_description\n\t\t\tself.log.debug \"Auto-generating description for %p\" % [ self ]\n\t\t\tdesc = self.name.to_s.\n\t\t\t\tgsub( /.*\\[(\\w+)\\]/, \"\\\\1\" ).\n\t\t\t\tgsub( /_(.)/ ) {|m| \" \" + m[1,1].upcase }.\n\t\t\t\tgsub( /^(.)/ ) {|m| m.upcase }\n\t\t\tself.log.debug \" generated: %p\" % [ desc ]\n\t\t\treturn desc\n\t\tend", "def manual_description\n txt = '\\t' + @names.join(\", \") + (@type && @type != 'x' ? ' ' : ': ')\n txt += _INTL('({1}): ',type_name(@type)) if @type && @type != 'x'\n txt += @description\n return txt\n end", "def description\n @description ||= 'Test Kitchen ec2-net-utils secondary ENI ' \\\n \"for #{instance.id}\"\n end", "def description\n if powered?\n separator = @description.include?('|') ? ' ' : '|'\n @description + separator + '\\c[14]' + @power_description\n else\n @description\n end\n end", "def description\n res = (@package.short_description ? @package.short_description : \"Description not available\") + \"\\n\"\n return res unless @package.long_description\n @package.long_description.each_line do |line|\n if line.strip.empty?\n res << \" .\\n\"\n else\n res << \" #{line}\"\n end\n end\n res.strip\n end", "def manual_description\n return _INTL('\\t{1}: {2}',@name, @description)\n end", "def program_desc(desc)\n @io.puts \"== #{@app.exe_name} - #{desc}\"\n @io.puts\n end", "def modeler_description\n return \"This measure will demonstrate how an OpenStudio measure calling EMS functions can be used to investigate dynamic envelope technologies such as emulating thermochromic window performance using EMS actuators and control types. This measure will replace the construction description of a user-selected window based on the outside surface temperature of that window, evaluated at each timestep\"\n end", "def description\n \"Derelict::VirtualMachine '#{name}' from #{connection.description}\"\n end", "def detailed_name\n \"#{label} ( #{name}_V#{version} )\"\n end", "def to_s\n \"#{@distro.capitalize} #{@product.gsub(/_/, ' ').capitalize} #{@version}\"\n end", "def computer_specification\n spec = ''\n spec += computer.platform + ' ' if computer.platform\n spec += platform_version + ' ' if platform_version\n if sdk_version\n spec += \"SDK #{sdk_version} \"\n spec += \"#{math_backend} \" if math_backend\n else\n spec += compiler + ' ' if compiler\n spec += compiler_version if compiler_version\n end\n spec = 'no specificaiton' if spec.empty?\n spec.strip\n end", "def version_description\n raise NotImplementedError\n end", "def description\n raise \"description not provided for command #{name}\"\n end", "def modeler_description\n return \"Automatically creates and positions standard residential windows based on the specified window area on each building facade. Windows are only added to surfaces between finished space and outside. Any existing windows are removed.\"\n end", "def description\n Properties[self.class] ||= {}\n return Properties[self.class][:desc] || \"\"\n end", "def modeler_description\n return 'This can be modifed to alter a sub-set of the windows by filtering by sub urface type, construction, name, or orientation. '\n end", "def description\n @manifest_options[:description] || \"\"\n end", "def modeler_description\n return \"NOTE: This will load and respond slowly in the OS app, especially if you select * on a variable with many possible keys or you select timestep data. Suggest you open it in a web browser like Chrome instead.\"\n end", "def full_description(machine_spec, bootstrap_options)\n description = [\"creating machine #{machine_spec.name} on #{driver_url}\"]\n bootstrap_options.to_hash.each_pair do |key, value|\n if value.is_a?(Hash)\n temp_value = value.clone\n temp_value[:password] = '*********' if value.key?(:password)\n else\n temp_value = value\n end\n description << \" #{key}: #{temp_value.inspect}\"\n end\n description\n end", "def description\n case @status\n when \"running\"\n \"#{@number}: INSTANCE: #{name} - #{@ip} - #{@instance_id} - #{@launching_time}\"\n when \"shutting-down\"\n \"(terminating) INSTANCE: #{name} - #{@ip} - #{@instance_id} - #{@launching_time}\"\n when \"pending\"\n \"(booting) INSTANCE: #{name} - #{@ip} - #{@instance_id} - #{@launching_time}\"\n end\n end", "def modeler_description\n return 'HVAC system creation logic uses [openstudio-standards](https://github.com/NREL/openstudio-standards) and efficiency values are defined in the openstudio-standards Standards spreadsheet under the *NREL ZNE Ready 2017* template.'\n end", "def modeler_description\n 'NOTE: This will load and respond slowly in the OS app, especially if you select * on a variable with many possible keys or you select timestep data. Suggest you open it in a web browser like Chrome instead.'\n end", "def describePlatform\n TC.name.gsub(' ', '_')\nend", "def build_host_name\n if @platform.abs_resource_name\n @platform.abs_resource_name\n elsif @platform.vmpooler_template\n @platform.vmpooler_template\n else\n @platform.name\n end\n end", "def build_host_name\n if @platform.abs_resource_name\n @platform.abs_resource_name\n elsif @platform.vmpooler_template\n @platform.vmpooler_template\n else\n @platform.name\n end\n end", "def description\n name + ': ' + resource_type.to_s + ' | Sueldo: ' + salary.to_s +\n ' | Experiencia: ' + experience.to_s + ' años'\n end", "def description\n returning String.new do |d|\n d << backup_site.name.capitalize \n if title && !title.blank?\n d << \" - \" << title\n elsif respond_to?(:name) && !name.blank?\n d << \" - \" << name \n end\n end\n end", "def description(name, args = {:show_values => true})\n desc = StringIO.new\n\n name.nil? and name = :platform\n if name.eql? :all\n value = \"\"\n Loquacious::Configuration.instance_variable_get(\"@table\").keys.map do |config|\n value.concat description config, args\n end\n return value\n else\n return \"\" if Loquacious::Configuration.for(name).nil?\n\n if args[:show_values]\n name_leader = \" config.#{name}.\"\n desc_leader = \" # \"\n name_value_sep = \" = \"\n title_leader = \" \"\n else\n name_leader = \"\"\n desc_leader = \"#\"\n name_value_sep = \" => \"\n title_leader = \"\"\n end\n\n config = Loquacious::Configuration.help_for name,\n :name_leader => name_leader,\n :desc_leader => desc_leader,\n :colorize => true,\n :io => desc,\n :name_value_sep => name_value_sep\n config.show :values => args[:show_values]\n \"#{title_leader}# ******* Configuration for #{name} **************\\n\\n#{desc.string}\"\n end\n end", "def description()\r\n #out puts what the command is doing and the path it is taking to do it\r\n puts \"Creating a Directory: #{@DirectoryPath}\"\r\n end", "def help_string()\n str = \"The follow options are to be given as environment variables or commandline arguments:\\n\"\n @required_env_vars.each do |v|\n str += \" #{v}=VALUE\\n\"\n end\n @optional_env_vars.each do |v|\n str += \" [OPTIONAL] #{v}=VALUE\\n\"\n end\n str += \"\\nThe YAML config files need to contain the following sections:\\n\"\n @required_config_sections.each do |v|\n str += \" #{v}\\n\"\n end\n str += \"YAML files are passed with an environment variable with the form,\"\n str += \"SWR_CONFIGFILE_* or passed as paths to the commandline arguments.\\n\"\n return str\n end", "def description\n [basic_description, extra_description].compact.join(\" \")\n end", "def os_metadata\n os =\n case RbConfig::CONFIG['host_os']\n when /mac|darwin/\n 'macos'\n when /linux|cygwin/\n 'linux'\n when /mingw|mswin/\n 'windows'\n else\n 'other'\n end\n metadata = \"os/#{os}\"\n local_version = Gem::Platform.local.version\n metadata += \"##{local_version}\" if local_version\n metadata += \" md/#{RbConfig::CONFIG['host_cpu']}\"\n metadata\n end", "def modeler_description\n return \"Each window in the building is assigned a thermochromic window construction and a shading control. The shading control is set to increase the window tint to meet the daylighting setpoint in the zone. If the zone already has daylighting controls, the setpoints from those controls are used. If the zone does not have controls, new controls are added at the center of the zone with a setpoint of 500 lux. These controls are only used for changing the window tint; they are not used to control the interior lighting.\"\n end", "def full_name\n if platform == Gem::Platform::RUBY or platform.nil? then\n \"#{name}-#{version}\".untaint\n else\n \"#{name}-#{version}-#{platform}\".untaint\n end\n end", "def design_name\n\n if 1 == 2 # self.part_number_id == 0\n design_name = self.prefix.pcb_mnemonic + self.number\n design_name += self.revision.name if self.revision && self.revision_id > 0\n \n case self.entry_type\n when 'dot_rev'\n design_name += self.numeric_revision.to_s if self.numeric_revision > 0\n when 'date_code'\n design_name += self.numeric_revision.to_s if self.numeric_revision && self.numeric_revision > 0\n design_name += '_eco'\n design_name += self.eco_number\n end\n \n \"#{design_name} (\" + \n self.prefix.pcb_number(self.number,\n self.revision.name,\n self.numeric_revision) + ')'\n else\n self.pcb_number\n end\n \n end", "def build_name\n \"#{manufacturer} #{weight} #{style} #{name}\"\n end", "def desc\n \"NetWare Console\"\n end", "def name\n return mode_desc\n end", "def base_description(_); end", "def description\n desc = readme_description\n if has_wrapper?\n desc += \" Note that #{name} is a version-specific client library.\" \\\n \" For most uses, we recommend installing the main client library\" \\\n \" #{wrapper_name} instead. See the readme for more details.\"\n end\n desc\n end", "def manual_description\n Properties[self.class] ||= {}\n return Properties[self.class][:man_desc] || self.description\n end", "def program_desc(desc)\n @io.puts \"# #{@exe} CLI\"\n @io.puts\n @io.puts desc\n @io.puts\n end", "def description\n end", "def description\n end", "def program_desc(description=nil)\n if description\n @@program_desc = description\n end\n @@program_desc\n end", "def description\n zombie_check\n @metadata.description(@name)\n end", "def descr_short\n descr = self[:descr].to_s.gsub(\"\\n\", \" \").gsub(/\\s{2,}/, \" \")\n descr = Knj::Strings.shorten(descr, 20)\n #descr = \"[#{_(\"no description\")}]\" if descr.to_s.strip.length <= 0\n return descr\n end", "def modeler_description\n return \"OS Version of HVACTemplate:System:PackagedVAV. Input values in this measure will generate Packaged VAV system. Another template measure HVACTemplate:Zone:VAV, or HVACTemplate:Zone:VAV:FanPowered, or HVACTemplate:Zone:VAV:HeatAndCool should be applied after applying this measure. \"\n end", "def description\n @description = \"House Blend Coffee\"\n end", "def platform\n \"win\"\n end", "def get_windows_info()\n sysname = \"\"\n processor = \"\"\n os_info = \"\"\n\n require 'win32/registry'\n\n Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion') do |reg|\n type, sysname = reg.read('ProductName')\n end\n\n Win32::Registry::HKEY_LOCAL_MACHINE.open('SYSTEM\\ControlSet001\\Control\\Session Manager\\Environment') do |reg|\n type, processor = reg.read('PROCESSOR_ARCHITECTURE')\n end\n\n os_info = sysname + \" \" + processor\n os_info\nend", "def title\n (\"\\0\" * 256).tap do |buffer|\n WIN[:get_title].call(buffer, buffer.length - 1)\n end.gsub \"\\0\", ''\n end", "def title\n (\"\\0\" * 256).tap do |buffer|\n WIN[:get_title].call(buffer, buffer.length - 1)\n end.gsub \"\\0\", ''\n end", "def description\n\t\t\"Msf Pro Wrapper Task\"\n\tend", "def name\r\n descr.sub(/\\n.*/m, '')\r\n end", "def modeler_description\n return \"Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.\"\n end", "def platform_name()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.RunMetadata_platform_name(@handle.ptr)\n result\n end", "def generate_description\n text, _ = parse_description\n parts = []\n parts << text if text.length > 0\n parts << JSON.generate(config) if config && config.length > 0\n parts.join(\"\\n\")\n end", "def description\n description = \"\"\n end", "def description\n raise \"not implemented\"\n end", "def to_s\n return '' if name.nil?\n return name if version.nil?\n return \"#{name}-#{version}\" if arch.nil?\n \"#{name}-#{version}-#{arch}\"\n end", "def default_description\n description = \"Run `#{@application_class.name}`\"\n description << ' quietly' if @quiet\n description << \" using config file #{@config}\" if @config\n description\n end", "def modeler_description\n return \"Assume that the starting point technology is primarily 90.1-2013 T8 lighting, with an efficacy of 90 lm/W. According to Table 5.2, LED Efficacy Improvement, in (1), 2015 LED luminaire efficacy is 145 lm/W. Calculate the total lighting power of the model and divide by this initial efficacy to determine the total number of lumens needed. Assuming that this same number of lumens should be provided by LED lighting, divide by the LED efficacy to determine the total wattage of LEDs that would be necessary to achieve the same lighting. Reduce the overall building lighting power by the resulting multiplier. IE new LPD = old LPD * (1 - 90 lm/W /145 lm/W). This is a very crude estimate of the impact of current LED technology. In order to perform a more nuanced analysis, lighting in the prototype buildings should be broken down by use type (general space lighting, task lighting, etc.) and by currently assumed technology (T12, T8, metal halide, etc.). If this breakdown were available, each type of lighting could be modified according to its own efficacy characteristics. Additionally, this measure does not account for the impact of LEDs on outdoor lighting.\"\n end", "def name\n return \"Set Residential Hot Water Distribution\"\n end", "def modeler_description\n return 'Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.'\n end", "def modeler_description\n return 'Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.'\n end", "def details\n format_description(@description) + \"site name: \" + format_name\n end", "def description\n I18n.t(\"rubrics.item.description.#{basename.underscore}\")\n end", "def description\n\t\tdoCommandList.each do |commandItem|\n\t\t\tputs commandItem.description\n\t\tend\n\tend", "def info\n str = <<INFO\nScenario: #{ name }\nSummary: #{ summary }\nDescription: #{ description_without_summary }\nINFO\n variables.each do |key, value|\n str << \"#{ key }: #{ value.inspect }\\n\"\n end\n str\n end", "def describe\n @description\n end", "def describe\n @description\n end", "def description\n description = puts \"Shelves containing food and other common supplies line the walls \"\\\n \"here. These things were probably stolen from the local village or nearby farms during \"\\\n \"raids. Although there doesn't seem to be anything of value here, you never know what a \"\\\n \"search will turn up.\"\n puts \"You can go back the way you came from.\"\n if @monster\n puts \"An evil #{@monster.monster} is here, ruffling for something to eat.\"\n else\n puts \"The squeek of a rat and pitter-patter of tiny rodent feet is all you hear.\"\n end\n end", "def wordy\n \"Found %s (%s), but was for platform%s %s\" %\n [@name,\n @version,\n @platforms.size == 1 ? '' : 's',\n @platforms.join(' ,')]\n end", "def library_description\n LIBRARY_DESCRIPTION\n end", "def versionString()\n\t\t\t\treturn \"#{major}.#{minor}.#{build}\"\n\t\t\tend", "def pcb_display_name\n name = self.pcb_name\n name += ' ' + self.pcb_revision if self.pcb_revision.size > 0\n name\n end", "def modeler_description\n return \"This uses the OpenStudio::Model::Space::fromFloorPrint method, and is very much like the Create Spaaces From Diagram tool in the OpenStudio SketchUp plugin, but lets you draw teh diagram in the tool of your choice, and then imports it into the OpenStudio application via a measure.\"\n end", "def description\n info[\"Description\"]\n end", "def syst(msg)\n \"215 UNIX #{PROGRAM} v#{VERSION} \"\n end", "def meta_description\n # Change the value below between the quotes.\n \"File Repository for EZ Troubleshooter\"\n end", "def modeler_description\n return \"This measure will demonstrate how an OpenStudio measure calling EMS functions can be used to model the performance of HVAC equipment that cannot be represented well by using single “standard” performance curve objects (cubic, quadratic, biquadratic, etc.) For example, properly characterizing some HVAC equipment objects requires using different performance curves that cover operation of different parts of the performance regime. This measure will alter (overwrite) the Coil Cooling DX Single Speed Cooling Capacity as a function of temperature performance curve object and attributes used by the simulation if the outdoor air temperature falls below a user defined threshold. This measure allows the user to define the biquadratic curve coefficients associated with the Coil Cooling DX Single Speed Cooling Capacity.\"\n end", "def name_and_version\n [display_name, version].compact.join(' ')\n end", "def description\n return @description if @description\n \n parts = []\n \n tp = trial_period(false)\n parts << \"#{tp}-day trial\" if tp && tp > 0\n \n sa = setup_amount(false)\n parts << \"#{number_to_currency(sa)} setup fee\" if sa && sa > 0\n \n am = amount(false)\n parts << \"#{number_to_currency(am)}/mo\"\n \n if prepaid_message_count >= UNLIMITED\n texts = \"unlimited\"\n else\n texts = \"#{prepaid_message_count}/mo prepaid\"\n end\n \n @description = parts.join(', ') + \" and #{texts} texts after that.\"\n\n return @description\n end", "def os_fmt\n '%s'\n end", "def description\n \"\"\n end", "def description\n\t\t\treturn @description || self.generate_description\n\t\tend", "def modeler_description\n 'For the most part consumption data comes from the tabular EnergyPlus results, however there are a few requests added for time series results. Space type and loop details come from the OpenStudio model. The code for this is modular, making it easy to use as a template for your own custom reports. The structure of the report uses bootstrap, and the graphs use dimple js.'\n end", "def description\n @description || Defaults::DEFAULT_DESCRIPTION\n end", "def to_s; description end", "def help_info\n \"\"\n end", "def info_string\n \"Rodsec v#{VERSION}\"\n end", "def long_desc\n desc = \"\" << super << \"\\r\\n#{self.pronoun.capitalize} is holding \"\n desc << @inventory.show << \".\\r\\n\" << @equipment.show(self)\n\n return desc\n end", "def to_s\n \"#{@cpe.distro.capitalize} #{@cpe.product.gsub(/_/, ' ').capitalize} \" \\\n \"#{@cpe.version}\"\n end", "def description\n [\n line_item_presenter.style_name,\n line_item_presenter.size,\n line_item_presenter.colour_name\n ].join(' - ')\n end", "def description\n if I18n.locale == :en\n description_en\n else\n description_pl\n end\n end", "def description\n conf['description'] || proj.description\n end" ]
[ "0.6339469", "0.62865597", "0.6123622", "0.60091484", "0.5989196", "0.59707993", "0.5931438", "0.5895481", "0.58368516", "0.5825027", "0.5809383", "0.58090514", "0.5797265", "0.57905775", "0.5771442", "0.5733858", "0.5726541", "0.57140833", "0.56912464", "0.5685428", "0.568164", "0.5673225", "0.56709033", "0.56696784", "0.56602126", "0.56580263", "0.5656143", "0.5656143", "0.56369597", "0.5620182", "0.5619158", "0.56020063", "0.56017625", "0.55926037", "0.55876887", "0.5555136", "0.5548791", "0.5527375", "0.55028427", "0.5484532", "0.5483238", "0.54782134", "0.546852", "0.546382", "0.543235", "0.5429504", "0.5429504", "0.54243875", "0.54199225", "0.5418215", "0.54071563", "0.54062104", "0.53954124", "0.53857523", "0.5377296", "0.5377296", "0.53756976", "0.5372147", "0.535085", "0.53502876", "0.5343758", "0.53414744", "0.53382623", "0.5334575", "0.5331491", "0.53265923", "0.5325504", "0.5324332", "0.5324332", "0.5314804", "0.5314211", "0.53114164", "0.53078765", "0.5305061", "0.5305061", "0.5304272", "0.53040165", "0.5287883", "0.5286884", "0.52845657", "0.52821505", "0.5281593", "0.5280743", "0.5270514", "0.52675325", "0.52653867", "0.52551275", "0.5253884", "0.5244953", "0.524262", "0.52351564", "0.5231665", "0.52308714", "0.52260953", "0.5223676", "0.52233636", "0.5221954", "0.52095175", "0.5209499", "0.5208748" ]
0.6885968
0
Dump [1].xml from a Windows install image.
def get_xmlinfo def do_xmlget(imagepath) xmlinfo = %x{imagex info --xml #{imagepath}} @xmlinfo = REXML::Document.new xmlinfo return @xmlinfo end if defined?(@xmlinfo) then return @xmlinfo else @xmlinfo = nil end search = File.join(@path, 'sources/install.wim') wimage = Dir.glob(search, File::FNM_CASEFOLD) if wimage.length > 0 return do_xmlget(wimage.first) end search = File.join(@path, 'sources/boot.wim') bimage = Dir.glob(search, File::FNM_CASEFOLD) if bimage.length > 0 return do_xmlget(bimage.first) end @xmlinfo end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_manifest_file\n render_template(resource_path(\"AppxManifest.xml.erb\"),\n destination: \"#{windows_safe_path(project.install_dir)}/AppxManifest.xml\",\n variables: {\n name: project.package_name,\n friendly_name: project.friendly_name,\n version: windows_package_version,\n maintainer: project.maintainer,\n certificate_subject: certificate_subject.gsub('\"', \"&quot;\"),\n })\n end", "def emitIzPackXML(xm)\n # raise \"xm must be an Builder::XmlMarkup object, but is #{xm.class}\" if xm.class != Builder::XmlMarkup\n xm.pack(@attributes) {\n xm.description(@description)\n @files.each{ |src, dest| xm.singlefile('src'=> src, 'target' =>dest) }\n }\n end", "def import_retina_xml_file(args={})\n filename = args[:filename]\n\n data = \"\"\n ::File.open(filename, 'rb') do |f|\n data = f.read(f.stat.size)\n end\n import_retina_xml(args.merge(:data => data))\n end", "def make_installer_gtifw exe_path\n end", "def dump_xml(io)\n io.puts \"<project name=\\\"imported-configuration-settings\\\">\"\n io.puts(@xmlstuff.join(\"\\n\"))\n io.puts \"</project>\"\n end", "def build_information_file\n dir = FilePath.new(@build_dir, \"cruisecontrol_integrated_xml_files\").ensure_directory\n FilePath.new(dir, \"build-information.xml\")\n end", "def installer\n @installer ||= File.join(mount_point, 'VBoxWindowsAdditions.exe')\n end", "def to_zapp_xml\n results = submit_cmd('',:dump,\"-env #{self.env} --zappdb --outdir .\")\n puts results\n end", "def xmlinstall\n\n\t\tif !File.exists?(resource[:xml_file])\n\t\t\tdebug \"Creating the XML file: %s \" % resource[:xml_file]\n\n\t\t\tcase resource[:virt_type]\n\t\t\t\twhen :openvz then\n\t\t\t\t\tdebug \"Detected hypervisor type: %s \" % resource[:virt_type]\n\t\t\t\t\ttmplcache = resource[:tmpl_cache]\n\t\t\t\t\txargs = \"-c openvz:///system define --file \"\n\t\t\t\t\tif !tmplcache.nil?\n\t\t\t\t\t\trequire \"erb\"\n\t\t\t\t\t\txmlovz = File.new(resource[:xml_file], APPEND)\n\t\t\t\t\t\txmlwrite = ERB.new(\"puppet-virt/templates/ovz_xml.erb\")\n\t\t\t\t\t\txmlovz.puts = xmlwrite.result\n\t\t\t\t\t\txmlovz.close\n\t\t\t\t\telse\n\t\t\t\t\t\tfail(\"OpenVZ Error: No template cache define!\")\n\t\t\t\t\tend\n\t\t\t\telse debug \"Detected hypervisor type: %s \" % resource[:virt_type]\n\t\t\t\t\txargs = \"-c qemu:///session define --file \"\n\t\t\t\t\trequire \"erb\"\n\t\t\t\t\txmlqemu = File.new(resource[:xml_file], APPEND)\n\t\t\t\t\txmlwrite = ERB.new(\"puppet-virt/templates/qemu_xml.erb\")\n\t\t\t\t\txmlqemu.puts = xmlwrite.result\n\t\t\t\t\txmlqemu.close\n\t\t\t\tend\n\t\n\t\t\tdebug \"Creating the domain: %s \" % [resource[:name]]\n\t\t\tvirsh xargs + resource[:xml_file]\n\t\telse\n\t\t\tfail(\"Error: XML already exists on disk \" + resource[:xml_file] + \".\" )\t\n\t\tend\n\tend", "def save\n Cheetah.run([\"sudo\", \"virt-xml\", name, \"--edit\", \"--network\", \"mac=#{@mac}\"])\n Cheetah.run([\"sudo\", \"virt-xml\", name, \"--edit\", \"--boot\", @boot_order.join(\",\")])\n read_definition\n end", "def create_installer(install_file, id)\n puts \"Downloading install file\"\n File.open(install_file, \"w+\"){ |f|\n f.write(download_install_file(\"logicmonitorsetup\", {\"id\" => id.to_s, \"arch\" => get_arch,}))\n }\n puts \"Download complete\"\nend", "def generate\n generate_manifest\n fix_windows_manifest\n end", "def tailor_package_to_platform\n @package.source(URI.encode(download_dest))\n @package.installer_type(:nsis)\n end", "def pack_command(appx_file)\n \"makeappx.exe pack /d \\\"#{windows_safe_path(project.install_dir)}\\\" /o /p #{appx_file}\"\n end", "def install_main_image(id, name)\n ensure_directory_exists!(id)\n File.open absolute_path(id, name), \"w\" do |final_destination|\n processor.process(@temp_file) do |processed_image|\n final_destination.write processed_image\n end\n end\n end", "def import_nessus_xml_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\n\t\tif data.index(\"NessusClientData_v2\")\n\t\t\timport_nessus_xml_v2(args.merge(:data => data))\n\t\telse\n\t\t\timport_nessus_xml(args.merge(:data => data))\n\t\tend\n\tend", "def export_xml_file\n @destination_file_name = export_directory + '/' + new_file_name.to_s + '.xml'\n\n FileUtils.mkdir_p export_directory\n FileUtils.copy_file(source_data, destination_file_name)\n new_file_name\n end", "def install\n system \"make\"\n bin.install \"sxbiff\"\n man1.install \"sxbiff.1\"\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 build_and_write_xfdl_from_xml(xmlfile, xfdlfile)\r\n\t\t\t# 1. Gzip\r\n\t\t\t# 2. Base64\r\n\t\t\t# 3. Write string with mime stuff on the fist line\r\n\t\t\t# 4. Save as XFDL\r\n\t\r\n\t\t\txml_file = ''\r\n\t\t\tb64_string = ''\r\n\t\t\tnew_contents = ''\r\n\r\n\t\t\tif File.exists?(xmlfile)\r\n\t\t\t\txml_file = IO.read(xmlfile).to_s\r\n\t\t\tend\r\n\r\n\t\t\t# Tell Zlib to use StringIO instead of a file.. Suck it Zlib!\r\n\t\t\ta = StringIO.new \"\"\r\n\t\r\n\t\t\tgz = Zlib::GzipWriter.new(a)\r\n\t\t\tgz.write xml_file\r\n\t\t\tgz.close\r\n\t\t\r\n\t\t\tb64_string = b64encode_it(a.string)\r\n\t\t\tnew_contents = \"application/vnd.xfdl;content-encoding=\\\"base64-gzip\\\"\\n\" + b64_string\r\n\r\n\t\t\tFile.open(xfdlfile, \"w\") { |f| f.write(new_contents) }\r\n\r\n\t\tend", "def export_xml(version)\n \n # Make sure all of the dates are in the right format\n @item['date'] = Time.now.utc.iso8601\n for section in ['offer', 'programme', 'trailer']\n case section\n when 'offer'\n label = 'window'\n else\n label = 'license'\n end\n if @item.has_key?(section)\n for period in ['start', 'end']\n @item[section][label][period] = @item[section][label][period].utc.iso8601\n end\n end\n end\n\n case version\n when :fpe2_5 \n template = ERB.new(Vpi2_5.get_xml_template(), nil, '-')\n when :fpe3_0\n template = ERB.new(Vpi3_0.get_xml_template(), nil, '-')\n else\n exit(\"Feature Package version \" + version.to_s + \" not supported\")\n end\n \n template.result(binding) \n end", "def doc_xml(xml)\r\n primary_output_files.each_with_index do |output, i|\r\n xml.doc(:ID => i + 1) do\r\n xml.tag!(:batch_attrib, 1)\r\n xml.tag!(:doc_cont_cd, doc_cont_cd(output))\r\n xml.tag!(:subtype_cd, 'PLN')\r\n xml.tag!(:filename, output.file_name)\r\n xml.tag!(:file_size, output.file_size)\r\n end\r\n end\r\n xml\r\n end", "def cmd_db_import_nessus_xml(*args)\n\t\t\treturn unless active?\n\t\t\tif (not (args and args.length == 1))\n\t\t\t\tprint_status(\"Usage: db_import_nessus_xml <nessus.nessus>\")\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\tif (not File.readable?(args[0]))\n\t\t\t\tprint_status(\"Could not read the NESSUS file\")\n\t\t\t\treturn\n\t\t\tend\n\t\t\tframework.db.import_nessus_xml_file(:filename => args[0])\n\t\tend", "def get_arch\n if defined?(@arch) then return @arch else @arch = nil end\n search = File.join(@path, '{*/system32,{i386,amd64}}/ntdll.dll')\n ntdlls = Dir.glob(search, File::FNM_CASEFOLD)\n if ntdlls.length > 0\n machine = %x{pev -c #{ntdlls.first} | grep -i Machine}\n if $?.success?\n @arch = '64-bit' if machine =~ /0x8664/\n @arch = '32-bit' if machine =~ /14c/\n end\n else\n search = File.join(@path, 'sources/{setup.exe,winsetup.dll}')\n setup = Dir.glob(search, File::FNM_CASEFOLD)\n setup.each do |file|\n machine = %x{pev -c #{file} | grep -i Machine}\n if $?.success?\n @arch = '64-bit' if machine =~ /0x8664/\n @arch = '32-bit' if machine =~ /14c/\n break\n end\n end # end of setup block\n begin\n get_xmlinfo if not defined?(@xmlinfo)\n arches = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/WINDOWS/ARCH/text()')\n arch = arches.first\n if arches.count(arch) == arches.size\n arch = Integer(arch.to_s)\n @arch = '64-bit' if arch == 9\n @arch = '32-bit' if arch == 0\n else\n @arch = '32/64-bit' unless @arch\n end\n rescue Exception => e\n # puts \"error(get_arch): #{e}\"\n end\n end\n @arch\n end", "def publish\n File.open(full_xml_file_path, 'w') do |f|\n f.write self.to_xml\n end\n end", "def create_manifest(dlls, dest)\n manifest = +\"<?xml version='1.0' encoding='UTF-8' standalone='yes'?>\\n\" \\\n \"<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>\\n\" \\\n \" <assemblyIdentity type='win32' name='ruby_builtin_dlls' version='1.0.0.0'/>\\n\"\n dlls.each { |fn| manifest << \" <file name='#{File.basename(fn)}'/>\\n\" }\n manifest << \"</assembly>\\n\"\n File.open( File.join(dest, 'ruby_builtin_dlls.manifest'), 'wb') { |f| f << manifest }\n end", "def image(file)\n entry = @defn[@latest.name]\n endian = @vm.bigendian ? \"be\" : \"le\"\n init_user(entry)\n File.open(file, 'w') do |f|\n f.puts \"// vmimage #{endian}#{@vm.databits}\"\n @vm.dump(0, @vm.dot, true) do |s|\n f.puts s\n end\n end\n end", "def import_nmap_xml_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_nmap_xml(args.merge(:data => data))\n\tend", "def to_xml_builder\n md = Nokogiri::XML(@metadata.to_xml).at_css('metadata').to_xml\n Nokogiri::XML::Builder.new(encoding: 'utf-8') do |x|\n x.package(xmlns: 'http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd') {\n x << md\n unless @files.empty?\n x.files {\n @files.each do |f|\n if f.exclude\n x.file src: f.src, target: f.target, exclude: f.exclude\n else\n x.file src: f.src, target: f.target\n end\n end\n }\n end\n }\n end\n end", "def slave_compat_xml\n return @slave_compat_xml if @slave_compat_xml\n slave_compat_xml = ::File.join(new_resource.remote_fs, \"#{new_resource.service_name}.exe.config\")\n @slave_compat_xml = Chef::Resource::File.new(slave_compat_xml, run_context)\n @slave_compat_xml.content(\n <<-EOH.gsub(/^ {8}/, '')\n <configuration>\n <startup>\n <supportedRuntime version=\"v4.0\" />\n </startup>\n </configuration>\n EOH\n )\n @slave_compat_xml\n end", "def save_raw(xmlpath, data)\n return if data.empty?\n fname = ::File.basename(xmlpath)\n p = store_loot('windows.unattended.raw', 'text/plain', session, data)\n print_good(\"Raw version of #{fname} saved as: #{p}\")\n end", "def to_xml\n export('tlb')\n end", "def package_filename\n \"#{@package.name}_#{@package.version}_#{@package.architecture}.deb\"\n end", "def write_ibooks_xml\n xml_filename = 'com.apple.ibooks.display-options.xml'\n File.write(path(\"epub/META-INF/#{xml_filename}\"), ibooks_xml)\n end", "def extract_sql(prptfile)\n Zip::ZipFile.open(prptfile, Zip::ZipFile::CREATE) do |zipfile|\n #subreports = REXML::Document.new zipfile.read(\"layout.xml\")\n #doc.elements[\"layout\"].attributes[attribute] = newvalue\n zipfile.each do |file|\n puts file\n end\n end\nend", "def installer_filename\n if PRE_RELEASE\n \"puppet-enterprise-#{pe_version}-el-7-x86_64.tar\"\n else\n \"puppet-enterprise-#{pe_version}-el-7-x86_64.tar.gz\"\n end\nend", "def assemble_xml_file\n write_xml_declaration do\n # Write the xdr:wsDr element.\n write_drawing_workspace do\n if @embedded\n index = 0\n @drawings.each do |drawing|\n # Write the xdr:twoCellAnchor element.\n index += 1\n write_two_cell_anchor(index, drawing)\n end\n else\n # Write the xdr:absoluteAnchor element.\n write_absolute_anchor(1)\n end\n end\n end\n end", "def get_image1(doc, image)\n x = doc.xpath(image).to_s\n end", "def heat(wxs_file, stage_dir)\n Dir.chdir TOPDIR do\n cg_name = File.basename(wxs_file.ext(''))\n dir_ref = File.basename(File.dirname(stage_dir))\n # NOTE: The reference specified using the -dr flag MUST exist in the\n # parent puppet.wxs file. Otherwise, WiX won't be able to graft the\n # fragment into the right place in the package.\n dir_ref = 'INSTALLDIR' if dir_ref == 'stagedir'\n sh \"heat dir #{stage_dir} -v -ke -indent 2 -cg #{cg_name} -gg -dr #{dir_ref} -var var.StageDir -out #{wxs_file}\"\n end\nend", "def generate_info_file(info_hash = nil)\n info_hash ||= {}\n @info_file = <<-EOS.strip\n ;!@Install@!UTF-8!\n #{info_hash.map { |k, v| \"#{k}=\\\"#{v}\\\"\" }.join(\"\\n\")}\n ;!@InstallEnd@!\n EOS\n ::File.open(\"#{sfx_cache_path}/sfx_info.txt\", 'wb:UTF-8') { |file| file.write(@info_file) }\n end", "def volume pub_xml_ng_doc\n idmd = identity_metadata pub_xml_ng_doc\n idmd.root.xpath('objectLabel').text.strip\n end", "def metadata_xml\n Nokogiri::XML(original_file.content)\n end", "def bmp_filename\n 'hall_of_fame/type_window'\n end", "def bmp_filename\n 'hall_of_fame/type_window'\n end", "def to_mzXML\n puts \"\\n--------------------------------\"\n puts \"Transforming raw file to mzXML format...\\n\\n\"\n \n system(\"wine readw.exe --mzXML #{@file}.raw #{$path}../data/spectra/#{File.basename(@file + \".raw\", \".raw\")}.mzXML 2>/dev/null\")\n end", "def to_one\n xml, _e, s = KVM.virsh(:dumpxml, @name)\n return '' if s.exitstatus != 0\n\n doc = REXML::Document.new(xml)\n\n name = REXML::XPath.first(doc, '/domain/name').text\n uuid = REXML::XPath.first(doc, '/domain/uuid').text\n vcpu = REXML::XPath.first(doc, '/domain/vcpu').text\n mem = REXML::XPath.first(doc, '/domain/memory').text.to_i / 1024\n arch = REXML::XPath.first(doc, '/domain/os/type').attributes['arch']\n\n spice = REXML::XPath.first(doc,\n \"/domain/devices/graphics[@type='spice']\")\n spice = spice.attributes['port'] if spice\n\n spice_txt = ''\n spice_txt = %(GRAPHICS = [ TYPE=\"spice\", PORT=\"#{spice}\" ]) if spice\n\n vnc = REXML::XPath.first(doc, \"/domain/devices/graphics[@type='vnc']\")\n vnc = vnc.attributes['port'] if vnc\n\n vnc_txt = ''\n vnc_txt = %(GRAPHICS = [ TYPE=\"vnc\", PORT=\"#{vnc}\" ]) if vnc\n\n features = []\n %w[acpi apic pae].each do |feature|\n if REXML::XPath.first(doc, \"/domain/features/#{feature}\")\n features << feature\n end\n end\n\n feat = []\n features.each do |feature|\n feat << %( #{feature.upcase}=\"yes\")\n end\n\n features_txt = ''\n features_txt = \"FEATURES=[#{feat.join(', ')}]\" unless feat.empty?\n\n tmpl = \"NAME=\\\"#{name}\\\"\\n\"\n tmpl << \"CPU=#{vcpu}\\n\"\n tmpl << \"VCPU=#{vcpu}\\n\"\n tmpl << \"MEMORY=#{mem}\\n\"\n tmpl << \"HYPERVISOR=\\\"kvm\\\"\\n\"\n tmpl << \"DEPLOY_ID=\\\"#{uuid}\\\"\\n\"\n tmpl << \"OS=[ARCH=\\\"#{arch}\\\"]\\n\"\n tmpl << features_txt << \"\\n\" unless features_txt.empty?\n tmpl << spice_txt << \"\\n\" unless spice_txt.empty?\n tmpl << vnc_txt << \"\\n\" unless vnc_txt.empty?\n\n tmpl\n rescue StandardError\n ''\n end", "def read_definition\n xml = Cheetah.run([\"sudo\", \"virsh\", \"dumpxml\", name], stdout: :capture)\n @definition = REXML::Document.new(xml)\n end", "def import_nmap_xml_file(args={})\n filename = args[:filename]\n\n data = \"\"\n ::File.open(filename, 'rb') do |f|\n data = f.read(f.stat.size)\n end\n import_nmap_xml(args.merge(:data => data))\n end", "def to_xml\n dxml = Nokogiri::XML::Builder.new do |xml|\n xml.domain('type' => 'kvm'){\n xml.name name\n xml.memory memory\n xml.currentMemory memory\n xml.vcpu 1\n xml.os {\n xml.type_('hvm', 'arch' => 'x86_64', 'machine' => 'rhel6.2.0')\n\t xml.boot('dev' => 'hd')\n\t xml.kernel \"/share/repo/mirror/centos/6.2/os/x86_64/images/pxeboot/vmlinuz\"\n\t xml.initrd \"/share/repo/mirror/centos/6.2/os/x86_64/images/pxeboot/initrd.img\"\n\t xml.cmdline os_cmdline\n\t # \"method=http://172.20.0.5/repo/centos/6/os/x86_64 ks=http://172.20.0.103:10007/atlab/kickstart/rcs-el6/postgresql-centos6.cfg ksdevice=eth0 ip=172.20.100.22 netmask=255.255.0.0 nameserver=172.20.0.5 gateway=172.20.0.1\"\n }\n\txml.features {\n xml.acpi\n\t xml.apic\n\t xml.pae\n\t}\n\txml.clock 'offset' => 'utc'\n\txml.on_poweroff 'destroy'\n\txml.on_reboot 'restart'\n\txml.on_crash 'restart'\n\txml.devices {\n\t xml.emulator '/usr/libexec/qemu-kvm'\n\t xml.disk('type' => 'file', 'device' => 'disk') {\n xml.driver('name' => 'qemu', 'type' => 'raw', 'cache' => 'none')\n\t xml.source('file' => disk)\n\t xml.target('dev' => 'hda', 'bus' => 'virtio')\n\t # libvirt can auto-generate pci address space\n\t # xml.address('type' => 'pci', 'domain' => '0x0000', 'bus' => '0x00', 'slot' => '0x04', 'function' => '0x0')\n\t }\n\t xml.interface('type' => 'bridge'){\n\t xml.source('bridge' => 'br1')\n\t xml.model('type' => 'virtio')\n\t # xml.address('type' => 'pci', 'domain' => '0x0000', 'bus' => '0x00', 'slot' => '0x03', 'function' => '0x0')\n\t }\n\t xml.serial('type' => 'pty'){\n xml.target('port' => '0')\n\t }\n\t xml.console('type' => 'pty'){\n xml.target('type' => 'serial', 'port' => '0') \n\t }\n\t xml.input('type' => 'tablet', 'bus' => 'usb')\n\t xml.input('type' => 'mouse', 'bus' => 'ps2')\n\t xml.graphics('type' => 'vnc', 'port' => '-1', 'autoport' => 'yes', 'keymap' => 'en-us')\n\t xml.video {\n\t xml.model('type' => 'cirrus', 'vram' => '9216', 'heads' => '1')\n\t # xml.address('type' => 'pci', 'domain' => '0x0000', 'bus' => '0x00', 'slot' => '0x02', 'function' => '0x0')\n\t }\n\t xml.memballoon('model' => 'virtio'){\n\t # xml.address('type' => 'pci', 'domain' => '0x0000', 'bus' => '0x00', 'slot' => '0x05', 'function' => '0x0')\n }\n }\n }\n end\n dxml.to_xml\n end", "def cmd_db_import_msfe_xml(*args)\n\t\t\treturn unless active?\n\t\t\tif not (args and args.length == 1)\n\t\t\t\tprint_status(\"Usage: db_import_msfe_xml <report.xml>\")\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\tif not File.readable?(args[0])\n\t\t\t\tprint_status(\"Could not read the Metasploit Express file\")\n\t\t\t\treturn\n\t\t\tend\n\t\t\tframework.db.import_msfe_file(:filename => args[0])\n\t\tend", "def output_manifest(title)\n puts '<?xml version=\"1.0\" standalone=\"no\" ?>'.red\n puts '<manifest identifier=\"D321SCORM-MANIFEST\" version=\"1.0\"'.red\n puts 'xmlns=\"http://www.imsproject.org/xsd/imscp_rootv1p1p2\"'.red\n puts 'xmlns:adlcp=\"http://www.adlnet.org/xsd/adlcp_rootv1p2\"'.red \n puts 'xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"'.red \n puts 'xsi:schemaLocation=\"http://www.imsproject.org/xsd/imscp_rootv1p1p2 imscp_rootv1p1p2.xsd\n http://www.imsglobal.org/xsd/imsmd_rootv1p2p1 imsmd_rootv1p2p1.xsd\n http://www.adlnet.org/xsd/adlcp_rootv1p2 adlcp_rootv1p2.xsd\" >'.red \n puts '<metadata>'.red \n puts '<schema>ADL SCORM</schema>'.red \n puts '<schemaversion>1.2</schemaversion>'.red \n puts '<adlcp:location>imsmetadata.xml</adlcp:location>'.red \n puts '</metadata>'.red \n puts '<organizations default=\"TOC1\">'.red \n puts '<organization identifier=\"TOC1\">'.red \n puts \"<title>#{title}</title>\".red \n puts '<item identifier=\"I_SCO0\" identifierref=\"SCO0\">'.red \n puts \"<title>#{title}</title>\".red\n puts '</item>'.red\n puts '</organization>'.red \n puts '</organizations>'.red\n puts '<resources>'.red\n puts '<resource identifier=\"SCO0\" type=\"webcontent\" adlcp:scormtype=\"sco\" href=\"index.html\">'.red\n\n Dir.glob(\"**/*\").each do |fname|\n puts \"<file href=\\\"#{fname}\\\" />\".red if File.file?(fname)\n end\n puts '<dependency identifierref=\"ALLRESOURCES\" />'.red \n puts '</resource>'.red \n puts '<resource identifier=\"ALLRESOURCES\" type=\"webcontent\" adlcp:scormtype=\"asset\">'.red \n puts '</resource>'.red \n puts '</resources>'.red \n puts '</manifest>'.red\nend", "def generate_manifest_files iss_file, update_url\n iss = InnoSetup::SourceFile.new(iss_file, Dir.getwd, 'CD_INSTALLER' => 1)\n iss.components.each do |name, component|\n next unless component.includes_manifest?\n manifest = component.manifest\n # TODO - We need to include *.iss file's directory when creating this file.\n File.open(component.manifest_name, 'w') {|f| f.write(manifest) }\n end\n File.open(\"release.spec\", 'w') do |f| \n f.write(iss.spec_file(\"Build\" => release_id || \"DIRTY\", \n \"Update-URL\" => update_url))\n end\n sign_file_with_gpg 'release.spec'\nend", "def get_winstring\n if defined?(@description) then return @description else @description = nil end\n get_build if not @major\n if @major < 6 # Vista and up use install.wim\n version = \"#{@major}.#{@minor}\"\n releases = {\n '5.0' => { 2195 => 'Windows 2000' },\n '5.1' => { 2600 => 'Windows XP' },\n '5.2' => { 2600 => 'Windows XP',\n 3790 => 'Windows Server 2003' }\n } # Get the closest build. Makes more sense with a bigger table.\n closest, description = releases[version].first\n releases[version].each do |build, name|\n if (build-@build).abs < (closest-@build).abs\n description = name\n closest = build\n end\n end # end of releases block\n @description = description\n else # Only works for ISO images for now. Use hivex for OS-root folders.\n begin\n substitutions = { # Products that don't have good descriptions.\n 'ServerSBSStandard' => 'Windows Small Business Server',\n 'SERVERSBSSTANDARD' => 'Windows Small Business Server',\n 'ServerHomeStandard' => 'Windows Home Server',\n 'ServerHomePremium' => 'Windows Home Server',\n 'Windows Longhorn' => 'Windows Server 2008',\n 'Windows Longhorn Client' => 'Windows Vista'\n }\n get_xmlinfo if not defined?(@xmlinfo)\n imagecount = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE').length\n descriptions = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/NAME/text()')\n description = String.new(descriptions.first.to_s)\n if descriptions.length > 1\n # Get common name prefixes to ignore product editions,\n # like 'Ultimate' or 'Home Basic'. Do this by counting each\n # individual word from the product names and removing those\n # words that only appear once. It is important to remove them\n # longest-word-first, since some editions are substrings of\n # another, e.g. SERVERSTANDARD and SERVERSTANDARDCORE. If there\n # are any non-matching versions of Windows, it is too hard to\n # say which one is going to get installed, so return 'Windows'.\n descriptions = descriptions.map { |xml| xml.to_s.split }\n descriptions = descriptions.flatten\n wordcounts = Hash.new(0)\n descriptions.each { |word| wordcounts[word] += 1 }\n wordcounts = wordcounts.reject { |word, count| count == imagecount }\n sorted = wordcounts.keys.sort_by { |string| string.length }\n sorted.reverse_each { |word, count| description.slice! word }\n description.rstrip!\n end\n description = 'Windows' if description.empty?\n @description = substitutions.keys.include?(description) ?\n substitutions[description] : description\n rescue\n @description = \"Windows\"\n end\n end\n @description\n end", "def import_qualys_xml_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_qualys_xml(args.merge(:data => data))\n\tend", "def dump( chksum_manifest )\n File.open(MANIFEST,'w') { |f| YAML.dump chksum_manifest, f }\n end", "def to_xml(opts={})\n opts ||= {}\n if opts.is_a?(String) \n opts = ( opts.match(/\\.xml$/) ? {:outfile => opts} : {:outdir => opts } )\n end\n opt = {:update_summary_xml => true, :outdir => nil, :outfile => nil}.merge(opts)\n\n if opt[:outfile]\n outfile = opt[:outfile]\n elsif opt[:outdir]\n outfile = File.join(opt[:outdir], msms_pipeline_analysis.summary_xml.split(/[\\/\\\\]/).last)\n end\n self.msms_pipeline_analysis.summary_xml = File.expand_path(outfile) if (opt[:update_summary_xml] && outfile)\n\n builder = Nokogiri::XML::Builder.new(:encoding => XML_ENCODING)\n msms_pipeline_analysis.to_xml(builder)\n add_stylesheet(builder.doc, Mspire::Ident::Pepxml::XML_STYLESHEET_LOCATION)\n string = builder.doc.to_xml\n\n if outfile \n File.open(outfile,'w') {|out| out.print(string) }\n outfile\n else\n string\n end\n end", "def setup_autoinst(autoinst)\n raise \"ERROR: #{autoinst} not found\" unless autoinst.file?\n content = File.read(autoinst)\n autoinst_vars(autoinst.sub_ext(\".vars\")).each { |k, v| content.gsub!(\"{{#{k}}}\", v) }\n content.gsub!(\"/dev/vd\", \"/dev/sd\") if provider == :virtualbox\n File.open(autoinst_path, \"w\") { |f| f.puts content }\n end", "def dumpwlankeys(session,pathoflogs,filename)\n\thost,port = session.tunnel_peer.split(':')\n\t#This variable will only contain garbage, it is to make sure that the channel is not closed while the reg is being dumped and compress\n\tgarbage = ''\n\twindrtmp = ''\n\twindir = session.fs.file.expand_path(\"%TEMP%\")\n\tprint_status('Dumping and Downloading the Registry entries for Configured Wireless Networks')\n\txpwlan = \"HKLM\\\\Software\\\\Microsoft\\\\WZCSVC\\\\Parameters\\\\Interfaces\"\n\tvswlan = \"HKLM\\\\Software\\\\Microsoft\\\\Wlansvc\"\n\tinfo = session.sys.config.sysinfo\n\ttrgtos = info['OS']\n\tif trgtos =~ /(Windows XP)/\n\t\tkey = xpwlan\n\telsif trgtos =~ /(Windows Vista)/\n\t\tkey = vswlan\n\tend\n \tbegin\n\t\tprint_status(\"\\tExporting #{key}\")\n\t\tr = session.sys.process.execute(\"reg export \\\"#{key}\\\" #{windir}\\\\wlan#{filename}.reg\", nil, {'Hidden' => 'true','Channelized' => true})\n\t\twhile(d = r.channel.read)\n\t\t\tgarbage << d\n\t\tend\n\t\tsleep(2)\n\t\tr.channel.close\n\t\tr.close\n\t\tprint_status(\"\\tCompressing key into cab file for faster download\")\n\t\tr = session.sys.process.execute(\"cmd.exe /c makecab #{windir}\\\\wlan#{filename}.reg #{windir}\\\\wlan#{filename}.cab\", nil, {'Hidden' => 'true','Channelized' => true})\n\t\twhile(d = r.channel.read)\n\t\t\tgarbage << d\n\t\tend\n\t\tr.channel.close\n\t\tr.close\n \trescue ::Exception => e\n\t\tprint_status(\"Error dumping Registry keys #{e.class} #{e}\")\n \tend\n\n\t#Downloading Compresed registry keys\n\t\n\tbegin\t\n\t\tprint_status(\"\\tDownloading wlan#{filename}.cab to -> #{pathoflogs}/wlan#{filename}.cab\")\n\t\tsession.fs.file.download_file(\"#{pathoflogs}/wlan#{filename}.cab\", \"#{windir}\\\\wlan#{filename}.cab\")\n\t\tsleep(5)\n\trescue ::Exception => e\n \t\tprint_status(\"Error Downloading Registry keys #{e.class} #{e}\")\n \tend\n\t#Deleting left over files\n\tprint_status(\"\\tDeleting left over files\")\n\t#session.sys.process.execute(\"cmd.exe /c del #{windir}\\\\wlan*\", nil, {'Hidden' => 'true'})\n\nend", "def v2xml(hdl_files)\n current = Dir::pwd\n v2xml = File.dirname(__FILE__) + \"/VerilogToXML\"\n\n # print VerilotToXML version\n system(\"#{v2xml} -v\")\n \n # Generate XML\n printf(\"@I:Generate XML File using VerilogToXML ... \\n\") \n# Common.make_dir_with_delete(\"_xml\",num=0)\n Common.make_dir(\"_xml\")\n begin\n hdl_files.each{|file|\n # make xml file name\n base_name = File.basename(file)\n ext_name = File.extname(base_name)\n xml = base_name.sub(\"#{ext_name}\",\"\") + \".xml\"\n\n # Char conv\n conv = Conv.new(file)\n contents = conv.main\n if contents != nil\n # make new file_name\n base_name = File.basename(file)\n ext_name = File.extname(base_name)\n dist_name = base_name.sub(\"#{ext_name}\",\"\")\n new_name = @HDLDir + \"/\" + dist_name + \"_enc\" + ext_name\n printf(\"@I:Generate new hdl file(%s) that changed char-code.\\n\", new_name)\n f = File.open(new_name,\"w\")\n f.puts contents\n f.close\n file = new_name\n end\n\n xml_file = \"_xml/\" + xml\n result = system(\"#{v2xml} #{file} > #{xml_file}\")\n @XMLFiles << xml_file\n if contents != nil\n # delted file which changed char-code\n File.delete(\"#{file}\")\n end\n if result == false\n printf(\"@E:VerilogToXML abnormally finished.(%s)\\n\",file)\n exit\n end\n \n # file delete\n }\n rescue => ex\n print ex.message, \"\\n\"\n end\n printf(\"Done.\\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 xml\n File.read(\"#{@file_path}.xml\")\n end", "def test_retrievethenmkexe\n exe = tempfile\n oexe = tempfile\n sh = %x{which sh}\n File.open(exe, \"w\") { |f| f.puts \"#!#{sh}\\necho yup\" }\n\n file = Puppet::Type.type(:file).new(\n :path => oexe,\n :source => exe,\n :mode => 0755\n )\n\n exec = Puppet::Type.type(:exec).new(\n :command => oexe,\n :require => Puppet::Resource.new(:file, oexe)\n )\n\n comp = mk_catalog(\"Testing\", file, exec)\n\n assert_events([:file_created, :executed_command], comp)\n end", "def to_xml\n raise \"No Asset selected for export to XML\" unless @asset\n xml = XmlSystem.new\n @output_text = xml.export( @asset ).target!\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 test_binary\n mode = is19? ? \"rb:ascii-8bit\" : \"rb\"\n bin_file_content = File.open(\"#{FIXTURES}/favicon.ico\", mode).read\n c = WDDX.load(WDDX::Binary.new(bin_file_content).to_wddx)\n assert_equal bin_file_content, c.data.bin_data \n end", "def run_msi\n Packager::WindowsMsi.new(self).run!\n end", "def file_path\n \"studio/#{type}/#{id}.xml\"\n end", "def run_installer\n Installer.install\n File.open(@install_flag, 'wb') { |f| f.write([@t1, @t2].pack('L*')) }\n end", "def nmap_save()\n print_status \"Nmap: saving nmap log file\"\n fh = self.nmap_log[0]\n nmap_data = fh.read(fh.stat.size)\n saved_path = store_local(\"nmap.scan.xml\", \"text/xml\", nmap_data, \"nmap_#{Time.now.utc.to_i}.xml\")\n print_status \"Saved NMAP XML results to #{saved_path}\"\nend", "def get_image2(doc, image)\n x = doc.xpath(image).first.to_s\n end", "def interface_xml\n prefix_old = @xpath_prefix\n @xpath_prefix = \"TEMPLATE/NIC[ATTACH='YES']/\"\n\n model = @xml[\"#{@xpath_prefix}MODEL\"]\n model = env('DEFAULT_ATTACH_NIC_MODEL') if model.empty?\n model.encode!(:xml => :attr) unless model.empty?\n\n filter = @xml[\"#{@xpath_prefix}FILTER\"]\n filter = env('DEFAULT_ATTACH_NIC_FILTER') if filter.empty?\n filter.encode!(:xml => :attr) unless filter.empty?\n\n if exist? 'BRIDGE'\n dev = '<interface type=\"bridge\">'\n\n if @xml[\"#{@xpath_prefix}BRIDGE_TYPE\"] =~ /openvswitch/\n dev << '<virtualport type=\"openvswitch\"/>'\n end\n\n dev << xputs('<source bridge=%s/>', 'BRIDGE')\n else\n dev = '<interface type=\"ethernet\">'\n end\n\n dev << xputs('<mac address=%s/>', 'MAC')\n dev << xputs('<script path=%s/>', 'SCRIPT')\n\n dev << xputs('<target dev=%s/>', 'TARGET')\n dev << xputs('<boot order=%s/>', 'ORDER')\n dev << \"<model type=#{model}/>\" unless model.empty?\n\n if model == 'virtio'\n dev << xputs('<driver name=\"vhost\" queues=%s/>',\n 'VIRTIO_QUEUES')\n end\n\n if exist?('IP') && !filter.empty?\n dev << \"<filterref filter=#{filter}>\"\n dev << xputs('<parameter name=\"IP\" value=%s/>', 'IP')\n dev << xputs('<parameter name=\"IP\" value=%s/>', 'VROUTER_IP')\n dev << '</filterref>'\n end\n\n inb_keys = ['INBOUND_AVG_BW', 'INBOUND_PEAK_BW', 'INBOUND_PEAK_KB']\n inbound = inb_keys.any? {|e| exist? e }\n\n outb_keys = ['OUTBOUND_AVG_BW', 'OUTBOUND_PEAK_BW', 'OUTBOUND_PEAK_KB']\n outbound = outb_keys.any? {|e| exist? e }\n\n if inbound || outbound\n dev << '<bandwidth>'\n\n if inbound\n dev << '<inbound'\n dev << xputs(' average=%s', 'INBOUND_AVG_BW')\n dev << xputs(' peak=%s', 'INBOUND_PEAK_BW')\n dev << xputs(' burst=%s', 'INBOUND_PEAK_KB')\n dev << '/>'\n end\n\n if outbound\n dev << '<outbound'\n dev << xputs(' average=%s', 'OUTBOUND_AVG_BW')\n dev << xputs(' peak=%s', 'OUTBOUND_PEAK_BW')\n dev << xputs(' burst=%s', 'OUTBOUND_PEAK_KB')\n dev << '/>'\n end\n\n dev << '</bandwidth>'\n end\n\n dev << '</interface>'\n\n @xpath_prefix = prefix_old\n\n dev\n end", "def bf_xml\n doc = Nokogiri::XML(bfMetadata.to_xml)\n doc.root.children.to_xml\n end", "def config_file\n File.join(install_directory,'installer','rails_installer.yml')\n end", "def bmp_filename\n 'hall_of_fame/text_window'\n end", "def genCtlFile(dir='generated')\n File.open(\"#{dir}/ControlFile.ctl\", 'w+') do |f|\n Dir[\"#{dir}/*.xml\"].each do |int|\n # Derive the Interchange type, name, and hash from the filename\n # --> Interchange<file_type>.xml\n # --> /Fully/qualified/path/<file_name>.xml\n file_type = stripInterchange(int[int.rindex('/')+1..-1])\n file_name = int[int.rindex('/')+1..-1]\n f.write \"edfi-xml,#{file_type},#{file_name}\\n\"\n end\n end \nend", "def export!\n render_manifest_output_and_keys\n render_zip\n end", "def write_xml_output\n output = File.open('report.xml', 'w')\n output << \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\"\n @array_list.each do |item|\n output << item << \"\\n\"\n end\n output << \"</testsuite>\\n\"\n end", "def convert_to_mobi\r\n print \"Converting to Kindle format... \"\r\n kindlegen = 'kindlegen'\r\n if (RUBY_PLATFORM.downcase.include?(\"mswin\"))\r\n kindlegen = kindlegen+\".exe\"\r\n end\r\n kindlegen = File.join(@dirs[:bin], kindlegen)\r\n # skip mobi creation if kindlegen can not be found\r\n if File.exists?(kindlegen)\r\n output = `#{kindlegen} #{@epub} -c2`\r\n if File.exists?(@mobi)\r\n puts \"done\"\r\n else\r\n puts \"failed\"\r\n puts output\r\n end\r\n\r\n else\r\n puts \"skipped\"\r\n puts \"The program kindlegen was not found. Please obtain the kindlegen executable from Amazon.\"\r\n end\r\n end", "def get_build\n if defined?(@major) and defined?(@minor) and defined?(@build) then\n return @major, @minor, @build\n else\n @major, @minor, @build = nil\n end\n search = File.join(@path, '{*/system32,{i386,amd64}}/ntdll.dll')\n ntdlls = Dir.glob(search, File::FNM_CASEFOLD)\n if ntdlls.length > 0\n dumpvers = %x{pev -p #{ntdlls.first}}\n if $?.success?\n major, minor, build = dumpvers.split('.')\n @major, @minor, @build = Integer(major), Integer(minor), Integer(build)\n end\n else\n search = File.join(@path, 'sources/{setup.exe,winsetup.dll}')\n setup = Dir.glob(search, File::FNM_CASEFOLD)\n setup.each do |file|\n dumpvers = %x{pev -p #{file}}\n if $?.success?\n major, minor, build = dumpvers.split('.')\n @major, @minor, @build = Integer(major), Integer(minor), Integer(build)\n break\n end\n end # end of setup block\n begin\n get_xmlinfo if not defined?(@xmlinfo)\n majors = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/WINDOWS/VERSION/MAJOR/text()')\n minors = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/WINDOWS/VERSION/MINOR/text()')\n builds = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/WINDOWS/VERSION/BUILD/text()')\n major = majors.first # The install.wim image will have multiple sub-\n minor = minors.first # images. Check to make sure each one has the same\n build = builds.first # version number.\n if majors.count(major) == majors.size and\n minors.count(minor) == minors.size and\n builds.count(build) == builds.size then\n @major, @minor, @build = Integer(major.to_s), Integer(minor.to_s), Integer(build.to_s)\n end\n rescue Exception => e\n # puts \"error(get_build): #{e}\"\n # raise\n end\n end\n return @major, @minor, @build\n end", "def additional_information_xml(xml)\n\n end", "def output_xml(file_name = DEFAULT_OUTPUT_FILE_NAME + \".xml\")\n CukeSniffer::Formatter.output_xml(self, file_name)\n end", "def packed(xml)\n [xml.bytesize + 4].pack(\"N\")\n end", "def convert_standalone_image(el, indent); end", "def fedora_name\n 'image_file'\n end", "def write_gpx filename, gpx\n $stderr.puts \"Writing #{filename}\" if $verbose\n File.open filename, 'w:UTF-8' do |file|\n file.write gpx\n end\nend", "def public_filename\n \"/packages/#{environment_id}/#{unit_id}/#{installer_item_location}\"\n end", "def bin_file(name)\n File.join bin_dir, name\n end", "def build_xml(hash)\n result_xml = \"\"\n builder = Builder::XmlMarkup.new(:target=>result_xml,:indent=>4)\n builder.tag!(\"configuration\") { \n hash.each do|name,value|\n builder.property { |b| b.name(name); b.value(value) }\n end\n }\n file = File.new(@bigframe_home + \"/conf/bigframe-core.xml\", \"w\")\n if file\n file.syswrite(result_xml)\n end\n file.close()\n end", "def upload_cypress_xml(xml, args = nil)\n opts = args ? @options.merge(args) : @options\n cypress_url = opts[:cypress_url]\n user = opts[:cypress_user] ? User.where({email: opts[:cypress_user]}).first : User.first\n cypress_password = opts[:cypress_password]\n bundle = opts[:version] ? Bundle.where({version: opts[:version]}).first : Bundle.first\n product_test = ProductTest.where({name: \"popHealthRoundtripTest\"}).first\n\n # Generate a temporary file that acts just like a normal file, but is given a unique name in the './tmp' directory\n tmp = Tempfile.new(['qrda_upload', '.xml'], './tmp')\n tmp.write(xml)\n product_test.execute({results: tmp})\n\n end", "def saveFile(saveTag)\n aFile = File.new(\"config.version\", \"w+\")\n if aFile\n aFile.syswrite(\"version=#{saveTag}\")\n aFile.close\n else\n puts \"Unable to write a config.version file!\"\n end\n end", "def install\n system \"make\", \"-f\", \"LINUX/Makefile\"\n bin.install 'xum1541cfg'\n end", "def save_file(xml)\n\t\tFile.open(Rails.root.to_s + '/public/system/rsm.xml', \"w+\") do |f|\n\t\t\tf.write(xml)\t\n\t\tend\t\t\n\tend", "def xwininfo\n @xwininfo ||= `xwininfo -id #{@id}`\n end", "def to_xml_file(path, &block)\n\n yield(:status, STATUS_START, \"report\") if block_given?\n extract_target_entries\n report_file = ::File.open(path, \"wb\")\n\n report_file.write %Q|<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n|\n report_file.write %Q|<MetasploitV5>\\n|\n report_file.write %Q|<generated time=\"#{Time.now.utc}\" user=\"#{myusername}\" project=\"#{myworkspace.name.gsub(/[^A-Za-z0-9\\x20]/n,\"_\")}\" product=\"framework\"/>\\n|\n\n yield(:status, STATUS_START, \"hosts\") if block_given?\n report_file.write %Q|<hosts>\\n|\n report_file.flush\n extract_host_info(report_file)\n report_file.write %Q|</hosts>\\n|\n\n yield(:status, STATUS_START, \"events\") if block_given?\n report_file.write %Q|<events>\\n|\n report_file.flush\n extract_event_info(report_file)\n report_file.write %Q|</events>\\n|\n\n yield(:status, STATUS_START, \"services\") if block_given?\n report_file.write %Q|<services>\\n|\n report_file.flush\n extract_service_info(report_file)\n report_file.write %Q|</services>\\n|\n\n yield(:status, STATUS_START, \"web sites\") if block_given?\n report_file.write %Q|<web_sites>\\n|\n report_file.flush\n extract_web_site_info(report_file)\n report_file.write %Q|</web_sites>\\n|\n\n yield(:status, STATUS_START, \"web pages\") if block_given?\n report_file.write %Q|<web_pages>\\n|\n report_file.flush\n extract_web_page_info(report_file)\n report_file.write %Q|</web_pages>\\n|\n\n yield(:status, STATUS_START, \"web forms\") if block_given?\n report_file.write %Q|<web_forms>\\n|\n report_file.flush\n extract_web_form_info(report_file)\n report_file.write %Q|</web_forms>\\n|\n\n yield(:status, STATUS_START, \"web vulns\") if block_given?\n report_file.write %Q|<web_vulns>\\n|\n report_file.flush\n extract_web_vuln_info(report_file)\n report_file.write %Q|</web_vulns>\\n|\n\n yield(:status, STATUS_START, \"module details\") if block_given?\n report_file.write %Q|<module_details>\\n|\n report_file.flush\n extract_module_detail_info(report_file)\n report_file.write %Q|</module_details>\\n|\n\n\n report_file.write %Q|</MetasploitV5>\\n|\n report_file.flush\n report_file.close\n\n yield(:status, STATUS_COMPLETE, \"report\") if block_given?\n\n report_file.path\n end", "def assemble_xml_file # :nodoc:\n return unless @writer\n\n # Prepare format object for passing to Style.rb.\n prepare_format_properties\n\n write_xml_declaration do\n # Write the root workbook element.\n write_workbook do\n # Write the XLSX file version.\n write_file_version\n\n # Write the fileSharing element.\n write_file_sharing\n\n # Write the workbook properties.\n write_workbook_pr\n\n # Write the workbook view properties.\n write_book_views\n\n # Write the worksheet names and ids.\n @worksheets.write_sheets(@writer)\n\n # Write the workbook defined names.\n write_defined_names\n\n # Write the workbook calculation properties.\n write_calc_pr\n\n # Write the workbook extension storage.\n # write_ext_lst\n end\n end\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 create_txt(file, new_file)\n stdout = `exiftool \"#{file}\" > \"#{new_file}.tif.txt\"`\n puts stdout\nend", "def usage()\n puts \"Usage is:\"\n puts \"#{__FILE__} path/to/STIG/file.xml\"\n puts\nend", "def version_needed_to_extract\n 0x0014\n end", "def version_needed_to_extract\n 0x0014\n end" ]
[ "0.5216315", "0.50499356", "0.5045947", "0.5040317", "0.5033626", "0.5018816", "0.49743646", "0.49232647", "0.49208415", "0.48411864", "0.48012644", "0.47731215", "0.475118", "0.47468966", "0.47458598", "0.47255158", "0.47167185", "0.46811822", "0.46618703", "0.4641244", "0.46316507", "0.46245068", "0.46153536", "0.4604665", "0.45948675", "0.45920506", "0.45870003", "0.45842487", "0.45808554", "0.45593017", "0.4556531", "0.4554533", "0.45545062", "0.4552538", "0.45519796", "0.45506185", "0.4545302", "0.45377594", "0.45367208", "0.45197052", "0.45090038", "0.45073476", "0.44980115", "0.44980115", "0.44939643", "0.44938162", "0.44595265", "0.4451574", "0.44438815", "0.44429812", "0.44397154", "0.44364762", "0.4418072", "0.44148016", "0.44030735", "0.4399469", "0.43939096", "0.43917045", "0.43902832", "0.43879122", "0.43868843", "0.43806607", "0.4377406", "0.43722805", "0.4363187", "0.43611965", "0.43596447", "0.43542504", "0.43471122", "0.4342689", "0.43410853", "0.4332208", "0.43308747", "0.43286613", "0.43238747", "0.43238494", "0.43179014", "0.43173164", "0.43111515", "0.4295536", "0.42948768", "0.42947358", "0.42930114", "0.4287271", "0.42871723", "0.42854518", "0.42781755", "0.42701095", "0.4265664", "0.42623907", "0.42523003", "0.4248448", "0.42447644", "0.42396507", "0.4227454", "0.42218298", "0.4220654", "0.42205656", "0.4215012", "0.4215012" ]
0.5748545
0
I worked on this challenge [by myself, with: ]. Your Solution Below
def welcome(address) if address.include? ("CA") "Welcome to California" else "You should move to California" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution4(input)\n end", "def isLucky(n)\r\nhalf1 = []\r\nhalf2 = []\r\nn_string = n.to_s\r\n\r\n\r\nfirsthalf = (n_string.length / 2) - 1\r\nsecondhalfstart = (n_string.length / 2)\r\nsecondhalfend = (n_string.length - 1)\r\n(0..firsthalf).each do |idx|\r\n half1 << n_string[idx].to_i\r\nend\r\n\r\n(secondhalfstart..secondhalfend).each do |idx|\r\n half2 << n_string[idx].to_i\r\nend\r\n\r\nreturn true if half1.inject(:+) == half2.inject(:+)\r\nreturn false\r\nend", "def problem_57\n ret,n,d = 0,1,1\n 1000.times do |i|\n n,d = (n+2*d),(n+d)\n ret += 1 if n.to_s.length > d.to_s.length\n end\n ret\nend", "def challenge; end", "def is_happy(n)\n i = 0\n r = false\n destination = []\n while r == false\n n.to_s.split(\"\").each do |x|\n destination << ((x.to_i * x.to_i))\n end\n i = i + 1\n n = destination.inject(&:+)\n r = true if n == 1\n destination = []\n break if i == 1000\n end\n if r == true\n p r\n else\n p false\n end\nend", "def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend", "def solution(a)\n # write your code in Ruby 2.2\n sum = a.inject(:+)\n acc = 0\n\n min = 99999999\n a[0..-2].each do |n|\n sum -= n\n acc += n\n\n min = [(acc - sum).abs, min].min\n end\n min\nend", "def solution(a)\n # write your code in Ruby 2.2\n binding.pry\n trips = Hash.new {|h,k| h[k]=0}\n start = 0\n ending = 0\n min = nil\n a.each_with_index do |trip,i|\n ending = i\n\n if trips[trip] == 0\n min = ending - start\n end\n trips[trip] += 1\n\n while start < ending\n break if trips[a[start]] - 1 == 0\n trips[start] -= 1\n start += 1\n min = ending - start if ending-start < min\n end\n end\n min\nend", "def isLucky(n)\n new_array = n.to_s.split(\"\")\n new_length = new_array.length\n\n a, b = [], []\n\n (0...new_length / 2).each { |x| a.push(new_array[x].to_i) }\n (new_length / 2...new_length).each { |y| b.push(new_array[y].to_i) }\n\n if a.inject(:+) == b.inject(:+)\n return true\n else\n false\n end\n\nend", "def solution(a)\n length = a.length\n sum = (length + 1) * (length + 1 + 1) / 2\n\n sum - a.inject(0) { |acc, e| acc += e }\nend", "def solution(a, b)\n if a.length > b.length\n return (b + a + b).to_s\n else\n return (a + b + a).to_s\n end\nend", "def decodeHalfway(input)\n sum = 0\n\n # Only have to loop through half the array since the numbers are being compared halfway around\n # Multiply each matching character by 2 to compensate for not looping through its pair\n input.chars[0..input.length/2 - 1].each_with_index do |char, i|\n sum += 2*char.to_i if char == input[i + input.length/2]\n end\n sum\nend", "def solution(a)\n number = a.to_s.chars\n first_arrays = []\n (number.length/2).times do\n first_arrays << number.shift\n first_arrays << number.rotate(number.length-1).shift\n number.pop\n end\n ( first_arrays + number ).join(\"\").to_i\nend", "def solution(s, p, q)\n # write your code in Ruby 2.2\n g = s.length + 1\n a = (s.length + 1)**3\n c = (s.length + 1)**2\n tmp = []\n res = []\n tmp.push 0\n o = 0\n s.split('').each do |i|\n o += if i == 'T'\n 1\n elsif i == 'G'\n g\n elsif i == 'C'\n c\n else\n a\nend\n tmp.push o\n end\n (0...p.length).each do |k|\n o = tmp[q[k] + 1] - tmp[p[k]]\n if o >= a\n res.push 1\n elsif o >= c\n res.push 2\n elsif o >= g\n res.push 3\n else\n res.push 4\n end\n end\n res\nend", "def solution(n)\n n.to_s.split(//).inject(1) { |a,d| a + d.to_i }\nend", "def solution(a)\n n = a.size\n passing_cars = 0\n\n suffix_sums = Array.new(n + 1, 0)\n\n a.reverse.each_with_index do |elem, i|\n suffix_sums[i + 1] = suffix_sums[i] + elem\n end\n suffix_sums.reverse!\n\n a.each_with_index do |car, i|\n if car == 0\n passing_cars += suffix_sums[i]\n end\n end\n\n passing_cars > 1_000_000_000 ? -1 : passing_cars\nend", "def solutions(a)\r\n\r\n ary = a.sort\r\n ary.each_with_index do |num, index|\r\n if ary[index+1] != num + 1 && index != ary.length-1\r\n return num + 1\r\n end\r\n end\r\n\r\nend", "def isLucky(n)\n sum, sum2 = 0, 0\n arr = n.to_s.split(\"\")\n \n first_half = arr.take(arr.size / 2) \n second_half = arr.drop((arr.size / 2))\n first_half.each { |x| sum += x.to_i }\n second_half.each {|x| sum2 += x.to_i}\n \n sum == sum2\nend", "def solution(number)\nn = 0..number\na = []\nfor i in n\n if i % 3 == 0 || i % 5 == 0\n a = a.push(i)\n end\n end\ns = 0\n# a.pop\na.each {|x| s += x}\ns\nend", "def goodVsEvil(good, evil)\n # good_power, evil_power = 0, 0\n # good.split.each_with_index do |num, i|\n # if i < 3\n # good_power += num.to_i * (i + 1)\n # elsif i < 5\n # good_power += num.to_i * i\n # elsif i == 5\n # good_power += num.to_i * 2 * i\n # end\n # end\n god = good.split.each_with_index.inject(0) do |sum, (num, i)|\n if i < 3\n sum + num.to_i * (i + 1)\n elsif i < 5\n sum + num.to_i * i\n elsif i == 5\n sum + num.to_i * 2 * i\n end\n end\n \n \n evl = evil.split.each_with_index.inject(0) do |sum, (num, i)|\n case i\n when 0\n sum + num.to_i * (i + 1)\n when 1, 2, 3\n sum + num.to_i * 2\n when 4\n sum + num.to_i * (i - 1)\n when 5\n sum + num.to_i * i\n when 6\n sum + num.to_i * (i + 4) \n end\n end\n \n if evl > god\n str = \"Evil eradicates all trace of Good\"\n elsif evl < god\n str = \"Good triumphs over Evil\"\n else\n str = \"No victor on this battle field\"\n end\n \n \"Battle Result: #{str}\"\nend", "def solution(a)\n return 1 if a.empty?\n a.sort!\n return 1 if a.first > 1\n return a.first + 1 if a.length <2\n (0..(a.length)).each do |index|\n return a[index] + 1 if a[index] + 1 != a[index + 1]\n end\n return a.last + 1\nend", "def solution\n (2..(9**5 * 6)).select do |n|\n n.to_s.split(//).map do |d|\n d.to_i ** 5\n end.reduce(:+) == n\n end.reduce(:+)\nend", "def problem_76a\n num = 100\n solve = lambda do |a,off,max|\n n = 0\n while a[off] < max && (a.length-off) >= 2 \n a[off] += a.pop\n n += 1\n n += solve.call(a.dup,off+1,a[off]) if a.length - off > 1\n end\n n\n end\n puts 1 + solve.call([1] * num, 0,num-1)\nend", "def input_string\n result = \"73167176531330624919225119674426574742355349194934\"\n result += \"96983520312774506326239578318016984801869478851843\"\n result += \"85861560789112949495459501737958331952853208805511\"\n result += \"12540698747158523863050715693290963295227443043557\"\n result += \"66896648950445244523161731856403098711121722383113\"\n result += \"62229893423380308135336276614282806444486645238749\"\n result += \"30358907296290491560440772390713810515859307960866\"\n result += \"70172427121883998797908792274921901699720888093776\"\n result += \"65727333001053367881220235421809751254540594752243\"\n result += \"52584907711670556013604839586446706324415722155397\"\n result += \"53697817977846174064955149290862569321978468622482\"\n result += \"83972241375657056057490261407972968652414535100474\"\n result += \"82166370484403199890008895243450658541227588666881\"\n result += \"16427171479924442928230863465674813919123162824586\"\n result += \"17866458359124566529476545682848912883142607690042\"\n result += \"24219022671055626321111109370544217506941658960408\"\n result += \"07198403850962455444362981230987879927244284909188\"\n result += \"84580156166097919133875499200524063689912560717606\"\n result += \"05886116467109405077541002256983155200055935729725\"\n result += \"71636269561882670428252483600823257530420752963450\"\n\n result\nend", "def theLoveLetterMystery(s)\n chars = s.chars\n size = chars.length\n sum = 0\n ((size+1)/2..(size -1)).each do |i|\n num = chars[i].ord\n target_num = chars[size-1-i].ord\n sum += (num - target_num).abs\n end\n sum\nend", "def solution(s, p, q)\r\n # write your code in Ruby 2.2\r\n # A -1\r\n # C -2\r\n # G -3\r\n # T -4\r\n # s - string with n charactekrs\r\n #cagccta\r\n #0123345\r\n #p,q - not empty arrays\r\n #\r\n #p[0]=2 q[0]=4 gcc 322 => 2\r\n #p[1]=5 q[1]=5 t 4 => 4\r\n \r\n \r\n arr = Array.new(q.count)\r\n \r\n \r\n\r\n \r\n arr.each_with_index{|el, i|\r\n \r\n ss = s[p[i]..q[i]]\r\n \r\n if ss.index('A') \r\n n = 1\r\n elsif ss.index('C')\r\n n=2\r\n elsif ss.index('G')\r\n n=3\r\n else \r\n n=4\r\n end\r\n \r\n arr[i] = n\r\n \r\n }\r\n \r\n \r\n \r\n arr\r\n \r\nend", "def solution(n)\n n.to_s(2).reverse.to_i.to_s.split('1').map(&:length).max || 0\nend", "def solution(a)\n # write your code in Ruby 2.2\n n = a.length\n \n counter = Array.new(n+1, 0)\n \n a.each do |x|\n counter[x-1] += 1\n end\n \n return counter.index { |x| x == 0 } + 1\nend", "def solution(a)\r\n a.each do |num|\r\n if (a.count(num) % 2) != 0\r\n return num\r\n end\r\n end\r\nend", "def isLucky(n)\n a = n.to_s.split(\"\")\n full = a.count - 1\n half = a.count/2 - 1\n \n total_1 = 0\n total_2 = 0\n \n for i in 0..full\n if i > half\n total_2 += a[i].to_i\n else\n total_1 += a[i].to_i\n end\n end\n \n if total_1 == total_2\n true\n else\n false\n end\nend", "def decent_number(n)\n\tleft = 0\n\tright = 0\n\t(n+1).times do |i|\n\t\tleft = n - i \n\t\tright = n - left\n\t#\tputs \"#{left}%3 = #{left%3} | #{right}%5 = #{right%5}\"\n\t\tbreak if left % 3 == 0 && right % 5 == 0\n\tend\n\t#puts \"**l = #{left} r = #{right}\"\n\n\tif left % 3 == 0 && right % 5 == 0\n\t\tfives = \"5\"*left\n\t\tthrees = \"3\"*right\n\t\tputs fives+threes\n\telse\n\t\tputs -1\n\tend\nend", "def formingMagicSquare(s)\r\n out = 100\r\n for i in 0...8 do\r\n cost = 0\r\n for j in 0...3 do\r\n for k in 0...3 do\r\n cost += ($magic_square[i][j][k] - s[j][k]).abs\r\n end\r\n end\r\n puts cost\r\n out = [out, cost].min\r\n end \r\n out\r\nend", "def solution(a)\r\n # write your code in Ruby 2.2\r\n #trangular\r\n # a[0] = 10\r\n # a[2] = 5\r\n # a[4] = 8\r\n # 10 + 5 > 8\r\n # 5 + 8 > 10\r\n #8 + 10 > 5\r\n \r\n \r\n l=a.count\r\n \r\n i=0\r\n while(i<l) do\r\n j=i+1\r\n while(j<l) do\r\n k=j+1\r\n \r\n \r\n while(k<l) do\r\n if((a[i] + a[j] > a[k]) && (a[j] +a[k] > a[i]) && (a[k] + a[i] >a[j]))\r\n return 1\r\n end\r\n k+=1 \r\n end \r\n \r\n j+=1 \r\n end\r\n i+=1\r\n end\r\n \r\n return 0\r\n \r\nend", "def captcha(input)\n sum = 0\n 0.upto(input.length - 1) do |i|\n sum += input[i].to_i if input[i] == input[(i+1) % input.length]\n end\n sum\nend", "def solution(a)\n n = a.size\n return 0 unless n > 2\n a.sort!\n\n (2..n - 1).each do |i|\n return 1 if a[i - 2] + a[i - 1] > a[i]\n end\n\n return 0\nend", "def correct(element)\n result = nil\n element.downto(0).each do |j|\n i = element - j\n if j == element && j % 3 == 0\n result = Array.new(j, 5)\n elsif i % 5 == 0 && j % 3 == 0\n result = Array.new(j, 5) + Array.new(i, 3)\n elsif i == element && i % 5 == 0\n result = Array.new(i, 3)\n end\n\n break if result\n end\n\n if result.nil?\n puts -1\n else\n puts result.join()\n end\nend", "def solution(s)\n if s.length.odd?\n center = s.length / 2\n if s[0...center] == s[center + 1..s.length].reverse\n return center \n end\n end\n -1\nend", "def solution\n (1..40).inject(:*) / (1..20).inject(:*)**2\nend", "def solution(n)\n # write your code in Ruby 2.2\n a = n.to_s(2)\n arr = []\n if a[-1] == '1'\n arr = a.split('1')\n else\n arr = a.split('1')\n arr.pop\n end\n if arr.max.nil?\n 0\n else\n arr.max.length\n end\nend", "def solution(a)\n ans = 0\n for i in 1 .. (a.length - 1)\n ans += a[i]\n end \n ans\nend", "def solution(number)\n sum = 0\n Array(1..number-1).each do |i|\n if i % 3 == 0 || i % 5 == 0\n sum += i\n end\n end\n sum\nend", "def solution(a)\n return 0 if a.length < 3\n a.sort!\n\n for i in 0..(a.length - 3)\n return 1 if a[i] + a[i + 1] > a[i + 2]\n end\n return 0\nend", "def problem18(r) \n h = r.length\n sum = 0\n for i in 0..h-1 \n \n end\nend", "def solution(n)\n # write your code in Ruby 2.2\n a = Math.sqrt(n).floor\n a -= 1 while n % a != 0\n b = n / a\n (a + b) * 2\nend", "def alg; end", "def pzoe\n sum = 0\n (0..9).each do |a|\n (0..9).each do |b|\n (0..9).each do |c|\n (0..9).each do |e|\n (0..9).each do |f|\n (0..9).each do |g|\n sum += a * 100000 + b * 10000 + c * 1000 + e * 100 + f * 10 + g if a * 100000 + b * 10000 + c * 1000 + e * 100 + f * 10 + g == a ** 5 + b ** 5 + c ** 5 + e ** 5 + f ** 5 + g ** 5\n end\n end\n end\n end\n end\n end\n sum - 1\nend", "def main\n max = 10 ** 9 + 7\n all = 1\n zero = 1\n nine = 1\n zn = 1\n N.times.each do\n all = all * 10 % max\n zero = zero * 9 % max\n nine = nine * 9 % max\n zn = zn * 8 % max\n end\n return (all - zero - nine + zn) % max\nend", "def solution(a)\n return 1 if a.count == 0\n \n real_sum = a.inject(:+)\n expected_sum = (a.count + 1) * (a.count + 2) / 2.0\n (expected_sum - real_sum).to_i\nend", "def minimumBribes(q)\n bribes = 0\n q.reverse.each_with_index do |n, i|\n if q[i] - (i + 1) > 2\n bribes = \"Too chaotic\"\n break\n end\n j = [0, q[i] - 2].max\n while j < i\n if q[j] > q[i]\n bribes += 1\n end\n j += 1\n end\n end\n puts bribes\nend", "def featured(n)\n n += 1\n n += 1 until n % 7 == 0 && n.odd?\n loop do\n break if n.to_s.chars.uniq.join == n.to_s\n n += 14\n if n > 9876543210\n puts \"There is no possible number that fulfills those requirements\"\n return nil\n end\n end\n n\nend", "def solution(a)\n # write your code in Ruby 2.2\n counts = {}\n missing = -1\n\n a.each do |a_i|\n counts[a_i] = counts[a_i].to_i + 1\n end\n\n (1..a.length).each do |i|\n if(counts[i].nil?)\n missing = i\n break\n end\n end\n\n if(missing == -1)\n missing = a.length + 1\n end\n\n missing\nend", "def dominant_octopus(fish)\n #sorted = []\n return fish if fish.length < 2\n pivot = fish.first\n left = fish[1..-1].select { |feesh| feesh.length <= pivot.length }\n #p left\n right = fish[1..-1].select { |feesh| feesh.length > pivot.length }\n\n dominant_octopus(left) + [pivot] + dominant_octopus(right)\n \n\n\nend", "def solution(a)\n # write your code in Ruby 2.2\n permutation = Array(1..a.size)\n # puts permutation\n return 1 if permutation - a == []\n 0\nend", "def solution(n)\n x = (n**0.5).floor\n (1..x).reduce(0) { |s, i| n % i == 0 ? s += (i * i == n ? 1 : 2) : s }\nend", "def isLucky(n)\n n = n.to_s.split('').map(&:to_i)\n n.shift(n.size/2).reduce(:+) == n.reduce(:+)\nend", "def solution(a)\n # write your code in Ruby 2.2\n numbers = Array(1..(a.size + 1))\n res = numbers - a\n res[0]\nend", "def solution(k, a)\n count = 0\n current = 0\n a.each { |length| \n current += length\n if current >= k\n current = 0\n count += 1\n end\n }\n count\nend", "def solution(n)\n\t(1..n).map(&:to_s).map(&:chars).join.chars.map(&:to_i).reduce(:+)\nend", "def solution(a)\n # write your code in Ruby 2.2\n\n # sort a\n a = a.sort\n odd = 0\n\n # loop over the array\n (0..(a.length-1)).step(2) do |i|\n if((i+1 >= a.length) || ((i+1 < a.length) && (a[i] != a[i+1])))\n odd = a[i]\n break\n end\n end\n\n odd\nend", "def solution1(seeds)\n turn_map = {}\n seeds.each_with_index { |n, turn| turn_map[n] = [1, turn + 1, turn + 1] }\n last_number = seeds.last\n\n ((seeds.length+1)..2020).each do |turn|\n last_stats = turn_map[last_number]\n if last_stats[TIMES_SPOKEN] == 1\n zero = turn_map[0] || [0, turn, turn]\n zero[TIMES_SPOKEN] += 1\n zero[FIRST_SPOKEN] = zero[LAST_SPOKEN]\n zero[LAST_SPOKEN] = turn\n \n turn_map[0] = zero\n last_number = 0\n else\n age = last_stats[LAST_SPOKEN] - last_stats[FIRST_SPOKEN]\n\n num = turn_map[age] || [0, turn, turn]\n num[TIMES_SPOKEN] += 1\n num[FIRST_SPOKEN] = num[LAST_SPOKEN]\n num[LAST_SPOKEN] = turn\n \n turn_map[age] = num\n last_number = age\n end\n end\n\n last_number\nend", "def solution(a)\n # write your code in Ruby 2.2\n \n is_perm = 0\n \n n = a.length\n b = [0]*n\n \n \n a.each do |v|\n break if v > n \n break if b[v] == 1 \n b[v] = 1\n end\n \n sum = b.inject(:+)\n if sum == n\n is_perm = 1\n end\n \n is_perm\nend", "def strong_num(n)\n array = n.to_s.chars.map(&:to_i)\n sumarray = []\n array.each do |number|\n sum = (1..number).inject(:*) || 1\n sumarray << sum\n end\n sumarray.sum == n ? \"STRONG!!!!\" : \"Not Strong !!\"\nend", "def solution(a)\n a.sort!\n a.each_with_index do |element, index|\n return 0 if element != index + 1\n end\n 1\nend", "def solution(m, a)\n n = a.count\n result = 0\n front = 0\n numbers = Array.new(m + 1, false)\n n.times { |back|\n while front < n and not numbers[a[front] - 1]\n numbers[a[front] - 1] = true\n front += 1\n result += front - back\n return 1_000_000_000 if result >= 1_000_000_000\n end\n numbers[a[back] - 1] = false\n }\n result\nend", "def solution(a)\n s= a.sort\n 0.step(s.size - 1).inject(0) do |result, x|\n z= x+2\n (x+1).step(s.size - 1).inject(result) do |acc, y|\n z+=1 while z < s.size && s[x] + s[y] > s[z]\n acc += z-y-1\n end\n end\nend", "def recursive_solution\n\n end", "def solution(n)\n sum = 0\n (1...n).each do |elem|\n sum += elem if elem % 3 == 0 or elem % 5 == 0\n end\n sum\nend", "def solution(a)\n cars_going_east = [0]\n\n a.each do |direction|\n next_counter = direction.zero? ? cars_going_east.last + 1 : cars_going_east.last\n cars_going_east << next_counter\n end\n\n passings = 0\n a.each_with_index do |direction, index|\n passings += cars_going_east[index] if direction == 1\n end\n\n return -1 if passings > 1000000000\n passings\nend", "def solution(roman)\n split = roman.split(\"\")\n last_value = 0\n split.reduce(0) do |final, char|\n current = CONVERSION[char.upcase]\n binding.pry\n if current >= last_value\n final += current\n else\n final -= current\n end\n binding.pry\n last_value = current\n final\n end\nend", "def solve(str)\n idx = 0\n count = 0\n\n substr_1 = ''\n substr_2 = ''\n\n loop do\n substr_1 = str[0..idx]\n substr_2 = str[(idx + 1)..-1]\n\n substr_1.to_i.odd? ? count += 1 : nil \n substr_2.to_i.odd? ? count += 1 : nil \n \n idx += 1\n break if idx >= str.length\n end\n count\nend", "def hard(input)\n to = input / 10\n houses = Array.new(to, 0)\n (1..to).each do |n|\n count = 0\n n.step(by: n, to: to - 1) do |i|\n houses[i] += 11 * n\n count += 1\n break if count == 50\n end\n end\n houses.index { |count| count >= input }\nend", "def is_happy(n)\n return false if n < 10 && n % 2 == 0\n return false if n < 1 \n return true if n == 1\n \n sum = 0\n\n nsplit = n.to_s.split(\"\")\n nsplit.each do |i|\n sum += (i.to_i * i.to_i)\n end\n\n return is_happy(sum)\n \nend", "def solve(s)\n answer = \"\"\n (0...s.length - 1).each do |idx|\n if s[idx] != s[idx + 1]\n answer += s[idx]\n end\n if idx == s.length - 2 && s[idx] == s[idx + 1]\n answer += s[idx]\n end\n end\n return answer\nend", "def solution(a)\n accessed = Array.new(a.size + 1, nil)\n caterpillar_back = 0\n count = 0\n\n a.each_with_index do |x, caterpillar_front|\n if accessed[x] == nil\n accessed[x] = caterpillar_front\n else\n new_caterpillar_back = accessed[x] + 1\n first_part_size = caterpillar_front - caterpillar_back\n second_part_size = caterpillar_front - new_caterpillar_back\n count += first_part_size * (first_part_size + 1) / 2\n count -= (second_part_size) * (second_part_size + 1) / 2\n caterpillar_back.upto(new_caterpillar_back - 1) { |n| accessed[a[n]] = nil}\n accessed[x] = caterpillar_front\n caterpillar_back = new_caterpillar_back\n end\n end\n\n remaining_size = a.size - caterpillar_back\n count += (remaining_size) * (remaining_size + 1) / 2\n end", "def solution\n 971 * (-61)\nend", "def solution_one\n x = 0\n (1..999).each do |i|\n if (i % 5) == 0 || (i % 3) == 0\n x = x + i\n end\n end\n x\nend", "def solve(n, s, d, m)\n # Complete this function\n records = s;\n\n (1...n).each do |i|\n records[i] += records[i-1]\n end\n\n numberOfWays = (m <= n && records[m - 1] == d) ? 1 : 0;\n\n (m...n).each do |i|\n if records[i] - records[i - m] == d\n numberOfWays += 1\n end\n end\n\n numberOfWays\n\nend", "def solution(arr)\n zeros = 0\n pass_cars = 0\n\n (0...arr.size).each do |idx|\n arr[idx] == 0 ? zeros += 1 : pass_cars += zeros\n\n return -1 if pass_cars > 1000000000\n end\n\n pass_cars\nend", "def pe52(startAt, endAt)\n (startAt..endAt).step(6).each do |x|\n bNum = x/6\n bNumCSort = bNum.to_s.chars.sort\n next if bNumCSort != x.to_s.chars.sort\n next if bNumCSort != (bNum*5).to_s.chars.sort\n next if bNumCSort != (bNum*4).to_s.chars.sort\n next if bNumCSort != (bNum*3).to_s.chars.sort\n next if bNumCSort != (bNum*2).to_s.chars.sort\n return bNum\n end\n false\nend", "def solution(n)\n\tval = 0.0\n\tval += 1.0 unless n[0].zero?\n\tval += 2.0 unless n[1].zero?\n\tval += 4.0 unless n[2].zero?\n\tval += 8.0 unless n[3].zero?\n val\n\t\nend", "def solve\n 1.upto(100).inject(:*).to_s.split('').map{|x| x.to_i}.inject(:+)\nend", "def is_armstrong(n)\n n_str=n.to_s()\n char_list=n_str.split(//)\n int_list=char_list.map {|x| (x.to_i())**(n_str.length()) }\n mysum = int_list.reduce(0) { |sum, num| sum + num }\n return (mysum==n)\nend", "def solve(nums)\n count = 0\n nums.each do |num|\n if num.to_s.length % 2 != 0\n count += 1\n end\n end\n return count\nend", "def featured(number)\n sum = 7\n loop do \n return \"There is no possible number that fulfills those requirements\" if number >= 9_876_543_210\n if sum <= number\n sum += 7\n elsif sum.even?\n sum += 7\n elsif sum.digits.uniq != sum.digits\n sum += 7\n else\n break\n end\n end\n sum\nend", "def solve(input)\n data = input.chars\n buckets = []\n current = []\n data.each_with_index do |c, i|\n n = data[i + 1]\n current << c\n unless n == c\n buckets << current\n current = []\n end\n break if n.nil?\n end\n\n ret = ''\n buckets.each do |b|\n ret += b.count.to_s\n ret += b.first\n end\n ret\nend", "def minimumBribes(q)\n bribe_count = 0\n # q.each_with_index do |person,i|\n i = q.size-1\n while i >= 0 do\n person = q[i]\n position = i+1\n offset = person - position\n\n if offset > 2\n puts \"Too chaotic\"\n return\n else\n j=[0,person-2].max\n while j < i do\n if q[j] > person\n bribe_count += 1\n else\n # break if j+1 == person\n end\n j+=1\n end\n end\n i-=1\n end\n puts bribe_count\nend", "def solution(n)\n (1..n).to_a.join.chars.map(&:to_i).sum\nend", "def solution(a)\n\traise ArgumentError.new(\"a has to be non empty array of max size #{MAX_LEN}\") if !a.is_a? Array or a.empty? or a.length > MAX_LEN\n\tret = 0\n\t#puts a.inspect\n\tmy_h = Hash.new\n\ta.each do |e|\n\t\tif my_h.include? e\n\t\t\tmy_h[e] += 1\n\t\telse\n\t\t\tmy_h[e] = 1\n\t\tend\n\tend\n\n\tmy_h_sort = my_h.sort_by {|k, v| -v}\n\t# -> my_h_sort[value][occurances]\n\treturn 0 if my_h_sort.first[1] < a.size/2\n\tleader_val = my_h_sort.first[0]\n\n\tocc_array = Array.new\n\toccurances = 0\n\ta.each do |e|\n\t\toccurances += 1 if e == leader_val\n\t\tocc_array.push(occurances)\n\tend\n\t#puts occ_array.inspect\n\n\tfor idx in (0...a.length-1) do\n\t\tsum1 = occ_array[idx]\n\t\tsum2 = occ_array.last - occ_array[idx]\n\n\t\t# puts \"#{idx}+1 < #{sum1*2}\"\n\t\t# puts \"#{(a.length - idx -1)} < #{(sum2*2 )} \"\n\n\t\tif (idx+1) < sum1 * 2 && (a.length - idx - 1 ) < sum2 * 2\n\t\t\t## we have a leader\n\t\t\t#puts \"YEAH #{idx}\"\n\t\t\tret += 1\n\t\tend\n\t\t\t#puts \"-------- ret: #{ret}\"\n\tend\n\treturn ret\nend", "def icecreamParlor(m, arr)\n # Complete this function\n res = []\n arr.each_index do |i|\n if i + 1 !=nil\n j = i + 1\n while j <= arr.length - 1\n if arr[i]+arr[j] == m\n res.push([i+1,j+1])\n end\n j+=1\n end\n end\n end\n res\nend", "def solution(x, a)\n count = 1\n indices = []\n while count <= x\n indices << a.find_index(count)\n count += 1\n end\n\n if indices.include?(nil)\n -1\n else\n indices.sort.last\n end\nend", "def isHappy? n\n acc = {}\n acc[n] = true\n begin\n sum = 0\n n.to_s.split(\"\").map {|i| sum += i.to_i**2}\n\n if sum == 1 then return true\n elsif acc.has_key?(sum) then return false\n else acc[sum] = true end\n\n n = sum\n end while sum != 1\nend", "def day_2_part_2\n noun = 0\n verb = 0\n\n while noun < 100\n while verb < 100\n if compute(noun, verb) == 19690720\n return (100 * noun) + verb\n end\n verb += 1\n end\n noun += 1\n verb = 0\n end\nend", "def solution(a, b, k)\n # write your code in Ruby 2.2\n e = b / k\n s = (a-1) / k\n\n e - s\nend", "def luhns(a)\n\tb = a.to_s[0..-2].reverse.split(\"\").to_a.map{|v|v.to_i}\n\t(b.each_index{|i|i.even? ? b[i]=b[i]*2>9?b[i]*2-9:b[i]*2:i=i}.inject(:+)+a)%10==0\nend", "def problem3 n\n 2.step(n,1).each do |x|\n return x-1 if n == 1\n n /= x if x.prime? && (n % x == 0)\n end\nend", "def solveProblem lst\n big = -1\n numbers = {}\n half = lst.length / 2\n lst.each do |i|\n if numbers.has_key?(i) then\n numbers[i] += 1\n else\n numbers[i] = 1\n end\n if numbers[i] > half then return i end\n end\n return big\nend", "def solution(digits)\n\tstop = digits.length - 4\n\tgo = 0\n\tlargest_number = 0\n\tindex = 0\n\n\twhile go < stop\n\t\ttest = \"\"\n\t\textra_index = index\n\t\t5.times do \n\t\t\ttest += digits[extra_index].to_s\n\t\t\textra_index += 1 \n\t\tend\n\t\tif test.to_i > largest_number\n\t\t\tlargest_number = test.to_i\n\t\tend \n\t\tindex += 1\n\t\tgo += 1 \n\tend \n\tlargest_number\nend", "def solution(digits)\n result = 0\n digits.size.times do |n|\n new_number = digits[n...(n + 5)].to_i\n result = new_number if new_number > result\n end\n result\nend", "def joltageDiff(input)\n # add my input device with rating +3\n input.append(input.max + 3)\n arr = input\n .sort\n .reverse\n \n diffs = arr\n .map.with_index{ |n, i|\n if i < arr.size - 1\n n - arr[i+1]\n end\n }\n diffs.pop # remove last element\n # puts diffs.sort\n counts = [0, 0, 0]\n counts[0] = diffs.select{ |n| n == 1 }.size + 1 # fuck knows why this is here.. #dirtyhack\n counts[1] = diffs.select{ |n| n == 2 }.size\n counts[2] = diffs.select{ |n| n == 3 }.size\n #puts counts\n return counts\nend", "def num_decodings(s)\n\n decode = ('A'..'Z').to_a\n number_of_prev_ended_singly = 1\n\n ways_count = 1\n number_of_prev_ended_singly = 1\n\n s.chars[1..-1].each_with_index do |ch, idx|\n if s[idx - 1].to_i == 1 ||\n s[idx - 1] == 2.to_i && ch.to_i.between?(1,6)\n\n numbers_added_this_time = ways_count - number_of_prev_ended_singly\n ways_count += numbers_added_this_time\n number_of_prev_ended_singly = numbers_added_this_time\n else\n number_of_prev_ended_singly = 0\n end\n end\n\n ways_count\n\nend", "def solution(a)\n counter = Hash.new(0)\n a.each do |elem|\n counter[elem] += 1\n end\n\n (1..a.size).each do |number|\n return 0 if counter[number] != 1\n end\n\n 1\nend" ]
[ "0.62877476", "0.60846186", "0.59898067", "0.5987108", "0.59478503", "0.5904577", "0.5855582", "0.5843953", "0.5840107", "0.5832357", "0.58223367", "0.5812061", "0.5797304", "0.57972187", "0.57929134", "0.5785207", "0.57834065", "0.5782036", "0.5781985", "0.57781845", "0.57599825", "0.5756927", "0.5755901", "0.5744732", "0.5715907", "0.5715599", "0.5704328", "0.57001245", "0.56882286", "0.56869423", "0.56753415", "0.5673146", "0.5672039", "0.56690854", "0.56674385", "0.5662431", "0.56534564", "0.5652185", "0.56499076", "0.5649523", "0.56367433", "0.56206477", "0.5614715", "0.56131756", "0.5605672", "0.5599195", "0.55974835", "0.5596386", "0.5586213", "0.55841184", "0.55826294", "0.5582062", "0.55787766", "0.5576581", "0.55743766", "0.5571653", "0.5565097", "0.55624074", "0.55611956", "0.55548143", "0.55546194", "0.5552787", "0.55449444", "0.5541486", "0.5541017", "0.5539666", "0.5535844", "0.5535633", "0.55274105", "0.5524687", "0.5523292", "0.5522361", "0.5515779", "0.5515481", "0.55134827", "0.55110383", "0.5508901", "0.5502962", "0.54972655", "0.5496658", "0.54962796", "0.54934126", "0.5491939", "0.54902667", "0.54901296", "0.5478603", "0.5471646", "0.5471645", "0.54699564", "0.5463934", "0.54583776", "0.54583496", "0.54574513", "0.54572743", "0.5450274", "0.5449156", "0.5447019", "0.5443044", "0.54396224", "0.5436694", "0.5435785" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_gestor_eixo @gestor_eixo = GestorEixo.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def gestor_eixo_params params.require(:gestor_eixo).permit(:eixo_id, :pessoa_id, :data_inicio, :data_termino, :ativo) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
for the index page of the addresses
def index @addresses=current_user.addresses end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @addresses = Address.paginate :page => params[:page], :order => 'street ASC'\n #@addresses = Address.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @addresses }\n end\n end", "def index ; @index ; end", "def index\n\t\t@addresses = Address.all\t\n\tend", "def index\n @addresses = Address.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC')\n end", "def index\n if address_type==\"Address\"\n @addresses = Address.find(:all)\n else\n @addresses = Address.find_all_by_type(address_type)\n end\n @addresses ||= []\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @addresses }\n end\n end", "def index_pages\n debug_msg \" generating pages search index\"\n\n pages = @files.select do |file|\n file.text?\n end\n\n pages.each do |page|\n debug_msg \" #{page.page_name}\"\n record = page.search_record\n @index[:searchIndex] << search_string(record.shift)\n @index[:longSearchIndex] << ''\n record.shift\n @index[:info] << record\n end\n end", "def index; @index; end", "def generate_indexes\n @first_page = first_page\n generate_index('index')\n generate_index('indexes')\n end", "def index\n @addresses = Address.order(:number).all\n end", "def index\n @addresses = Address.all\n end", "def index\n @addresses = Address.all\n end", "def index\n @address_searches = AddressSearch.all\n end", "def index\n @ag_addresses = Ag::Address.all\n end", "def index\n @person_addresses = PersonAddress.all\n end", "def sitemap_index_links\n each_sitemap_index_link.to_a\n end", "def index\n @address_records = AddressRecord.all\n end", "def index\n @electronic_addresses = ElectronicAddress.all\n end", "def index\n @account_addresses = AccountAddress.all\n end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index\n @post_addresses = PostAddress.all\n end", "def index\n @sales_addresses = Sales::Address.all\n end", "def index\n @streets = Street.order(name: \"ASC\").paginate(:page => params[:page], :per_page => 30)\n #.limit(10)\n end", "def index\n @addresses_people = AddressesPerson.all\n end", "def index\n @addresses = Address.scoped.order(sort_column + \" \" + sort_direction).paginate(:page => params[:page], :per_page => 30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @addresses }\n end\n end", "def index\n @host_addresses = HostAddress.all\n end", "def index\n @user_addresses = UserAddress.all\n end", "def index\n @address_ranges = AddressRange.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @address_ranges }\n end\n end", "def index\n @addresses = current_customer.addresses.order(is_primary_address: :desc, updated_at: :desc)\n end", "def index\n @weventaddresses = Weventaddress.all\n end", "def addresses; end", "def index\r\n build_index unless @index\r\n @index\r\n end", "def index\n @client_addresses = ClientAddress.all\n end", "def index\n @map_nodes = Map::Node.paginate(:page => params[:page], :per_page => 64)\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def index\n @content_mappings = ContentMapping.find(:all, :order => 'page_id ASC, section_id ASC')\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @content_mappings }\n end\n end", "def index\n @adresses = Adress.all\n end", "def index\n # :q hash of all params user passes in with ransack\n # @search = Pin.search(params[:q]) \n # # return array of pins\n # @pins = @search.result\n\n # turns out sunspot is NOT free in Production... will look for alternatives\n # # sunspot search instead of just standard index show all\n # @search = Pin.search do\n # fulltext params[:search]\n # end\n # # return array of pins\n # @pins = @search.results\n # # @pins = Pin.all.order(\"created_at DESC\").paginate(page: params[:page], per_page: 7)\n\n # standard index \n # define each method to show all pins in index\n # will render a link on index with the title of the pin\n # .paginate()\n # @pins = Pin.all.order(\"created_at DESC\").paginate(page: params[:page], per_page: 7)\n @pins = Pin.all.order(\"created_at DESC\").paginate(page: params[:page], per_page: 11)\n end", "def index\n# @states = State.all\n#pagination:\n\t@states = State.all.paginate :per_page => 5, :page => params[:page]\n\t\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @states }\n end\n end", "def pages; end", "def index\n @ip_adresses = IpAddress.all\n end", "def convictions_index_at_source\n page = get(base)\n page.search('div.listing-container ol li').map do |el|\n { 'link' => el.search('a').first['href'] }\n end\nend", "def index\n logger.info 'Index of elements'\n end", "def index\n @address_books = AddressBook.all\n end", "def index\n @address_books = AddressBook.all\n end", "def index\n @address_books = AddressBook.all\n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n @title = \"Step 3.1: Gather Addresses\"\n @col_layout = \"two_col\"\n items_per_page = 25\n \n @pages, @mpd_contacts = paginate :mpd_contacts, :include => \"mpd_priorities\", :order => process_sort(params[:sort]), :conditions => process_conditions('letter_sent = false'), :joins => :mpd_contact_actions, :per_page => items_per_page \n\n if request.xml_http_request?\n render :partial => \"shared/mpd_contact_to_complete\", :locals => {:event => 'letter_sent'}, :layout => false\n end\n end", "def process_index\n bindings = {\n :url => @definition.get_url,\n :name => @definition.get_name,\n :resources => @definition.resources,\n :description => @definition.get_description,\n :version => @definition.get_version\n }\n\n page = Calamum::DocGenerator.new(:index)\n page.save_template('index.html', bindings)\n end", "def index(loc, offset=0) end", "def index\n @ripple_addresses = RippleAddress.all\n end", "def index\n #page = params[:page] || 1\n#@posts = Post.paginate_by_board_id @board.id, :page => page, :order => 'updated_at DESC'\n @businesses = Business.paginate :page => params[:page], :order => 'created_at DESC', :include => [:user,:address]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @businesses }\n end\n end", "def index\n @anchorinfos = Anchorinfo.all\n end", "def index\n @vendor_addresses = VendorAddress.all\n end", "def index\n @address = Address.new\n if !params[:address].nil?\n unless params[:address][:country_id].nil?\n @address.country_id = params[:address][:country_id]\n country_name = Geographies::Country.find(@address.country_id).name\n @bluebook_members = BluebookMember.paginate :per_page => 20, \n :page => params[:page],\n :conditions => ['country = ?', country_name], \n :order => 'country, state, city, section, name'\n end\n unless params[:address][:admin_area_id].nil?\n @address.admin_area_id = params[:address][:admin_area_id]\n state_name = Geographies::AdminArea.find(@address.admin_area_id).name\n @bluebook_members = BluebookMember.paginate :per_page => 20, \n :page => params[:page],\n :conditions => ['state = ?', state_name], \n :order => 'state, city, section, name'\n end\n elsif !params[:locality].nil?\n @bluebook_members = BluebookMember.paginate :per_page => 20, \n :page => params[:page],\n :conditions => ['city like ?', \"%#{params[:locality]}%\"], \n :order => 'city, section, name'\n elsif !params[:bluebook_member].nil?\n @bluebook_members = BluebookMember.paginate :per_page => 20, \n :page => params[:page],\n :conditions => ['name like ?', \"%#{params[:bluebook_member][:name]}%\"], \n :order => 'section, country, state, city, name' \n else\n @bluebook_members = BluebookMember.paginate :per_page => 20, \n :page => params[:page],\n :order => 'section, country, state, city, name'\n end\n respond_to do |format|\n format.html # index.rhtml\n end\n end", "def index\n\t\t@addresses = current_user.addresses\n\tend", "def index\n @address_details = AddressDetail.all\n @customers = Customer.all\n end", "def start_index(page)\n (page - 1) * @count + 1\n end", "def index\n authorize IndexPage\n @index_pages = IndexPage.\n where(institution: current_institution).\n order(:name)\n end", "def url_for_index; end", "def url_for_index; end", "def index\n @customer_addresses = CustomerAddress.all\n end", "def index\n @reserved_addresses = ReservedAddress.all\n end", "def index\n @page = Page.find(params[:page_id])\n @urls = Url.where(page_id: params[:page_id])\n end", "def index # NOT USED \n puts \"xxxxxxx NodeAttrC a:index NNNNN NOT USED xxxxxxx\"\n @node_attrbs = NodeAttrb.paginate(page: params[:page])\n end", "def index\n if params[:keywords].present?\n search = Address.search do\n fulltext params[:keywords]\n\n if params[:option] == \"Assigned\"\n without(:user_id, AddressesHelper.find_nobody_id)\n elsif params[:option] == \"Free\"\n with(:user_id, AddressesHelper.find_nobody_id)\n end\n\n paginate page: params[:page] || 1,\n per_page: IPAMSConstants::RECORD_COUNT_PER_PAGE\n end \n # Type Sunspot::Search::PaginatedCollection < Array\n @addresses = search.results\n elsif params[:option].present? && (params[:option] != \"All\")\n nobody_id = AddressesHelper.find_nobody_id\n if params[:option] == \"Assigned\"\n @addresses = Address.where.not(user_id: AddressesHelper.find_nobody_id)\n .paginate(page: params[:page],\n per_page: IPAMSConstants::RECORD_COUNT_PER_PAGE)\n elsif params[:option] == \"Free\"\n @addresses = Address.where(user_id: AddressesHelper.find_nobody_id)\n .paginate(page: params[:page],\n per_page: IPAMSConstants::RECORD_COUNT_PER_PAGE)\n end\n else\n # paginate returns object of \n # type User::ActiveRecord_Relation < ActiveRecord::Relation\n @addresses = Address.paginate(page: params[:page],\n per_page: IPAMSConstants::RECORD_COUNT_PER_PAGE)\n end\n\n authorize @addresses\n #policy_scope(@addresses)\n end", "def index\n \n # Check if there is parameter num_to_return, otherwise set to the default number\n #num_to_return = params[:num_to_return].nil? ? 12 : params[:num_to_return]\n #@locations = Location.limit(num_to_return)\n @locations = Location.paginate(page: params[:page], :per_page => 18, :total_entries => 900)\n\n end", "def index\n @index\n end", "def index\n @index\n end" ]
[ "0.6875668", "0.68352896", "0.66993386", "0.66972727", "0.6617887", "0.66146606", "0.6570374", "0.6556792", "0.65146565", "0.6501181", "0.6501181", "0.64851296", "0.64019674", "0.6314624", "0.63097966", "0.626487", "0.62306273", "0.6213153", "0.61935216", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6192414", "0.6184931", "0.6141604", "0.6130664", "0.6126663", "0.61251175", "0.61229616", "0.6109716", "0.610329", "0.6096179", "0.6080911", "0.6078909", "0.6054646", "0.6048978", "0.60323983", "0.60016054", "0.6000087", "0.5987036", "0.59856355", "0.597695", "0.5976341", "0.5965624", "0.59635156", "0.5960595", "0.5960595", "0.5960595", "0.5957859", "0.5957859", "0.5957859", "0.5957834", "0.59503937", "0.59349763", "0.59337264", "0.5920957", "0.5916536", "0.5915493", "0.5912343", "0.5897179", "0.5893254", "0.5891606", "0.58861333", "0.58850676", "0.58850676", "0.5881184", "0.5866875", "0.58641267", "0.5863014", "0.58622235", "0.58608633", "0.5852173", "0.5852173" ]
0.0
-1
for the sake of the creation of the new address localhost:3000/address/new httpmethod : GET
def new @address=Address.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @address = Address.new\n @url = { controller: '/addresses', action: :create }\n end", "def new\n @origin = OriginAddr.new\n \n drop_breadcrumb('新增')\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @origin }\n end\n end", "def new_address\n @client.new_address(name)\n end", "def new #given to config/routes.rb\n end", "def new\n\t\t@address = Address.new\n\t\t\n\t\t# For storing the previous page before current page\n\t\tsession[:prev_url] = request.referer\n\tend", "def new\n @address = Address.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @address }\n end\n end", "def new\n @address = Address.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @address }\n end\n end", "def new\n @address = Address.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @address }\n end\n end", "def getnewaddress\n @api.request 'getnewaddress'\n end", "def new\n #@instance = Instance.new\n @instance.url = \"http://#{request.host}\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instance }\n end\n end", "def new\n @address = Address.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @address }\n end\n end", "def new\n @address = Address.new\n end", "def new\n @person = Person.new\n @person.build_address\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end", "def new\n @ip_addr = IpAddr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ip_addr }\n end\n end", "def new_address\n scope = current_user && current_user.addresses || Address\n @new_address ||= scope.find_or_create_by(\n address: params[:address],\n city: City.find_or_create_by(name: city)\n )\n end", "def new\n @url = Url.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url }\n end\n end", "def getnewaddress(account = nil)\n request :getnewaddress, account\n end", "def new\n @addresstype = Addresstype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @addresstype }\n end\n end", "def new_address(account_name=nil)\n request('getnewaddress', account_name)\n end", "def new\n @adress = Adresse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @adress }\n end\n end", "def new\n #@request = Request.new\n end", "def new\n \t@url = Url.new\n end", "def new\n @rails_url = RailsUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rails_url }\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 @node = Node.new\n @node.addresses.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end", "def new\n\t\t\n\tend", "def new\n\t\t\n\tend", "def new\n @client = clients.new\n @client.build_address\n end", "def new\n @taddress = Taddress.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taddress }\n end\n end", "def new \n end", "def new\n build_resource({})\n resource.build_user_address\n respond_with self.resource\n end", "def new\n\t\tlogger.debug(\"/routes/new params[:route] : #{params[:route].inspect}\")\n\t\t@route = Route.new(params[:route])\n\t\t@sports = Sport.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @route }\n\t\tend\n\tend", "def new\n\t@meta[:title] = \"DondeVoyAComer.com | Ingresar nuevo local de comida\"\n\t @current_page = \"add\"\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end", "def new\n @routing = Routing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @routing }\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 @link = Link.new :long => 'http://'\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @link }\n end\n end", "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route }\n end\n end", "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route }\n end\n end", "def new\n @company = Company.find_or_create_by(name: 'New Company')\n begin\n @company.save!\n rescue\n flash[:error] = \"Company NOT be found or was not created.\"\n nil\n end\n @address = @company.addresses.find_or_create_by( {addressable_type: 'Company', addressable_id: @company.id} )\n @address.save!\n end", "def new\n @user_address = UserAddress.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_address }\n end\n end", "def new \n end", "def new \n end", "def new\n @route = Route.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end", "def new\r\n \r\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 @host = Host.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @host }\n end\n end", "def new\r\n end", "def new\r\n end", "def new\n @event = Event.new\n @event.build_address\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end", "def new\n @user_address = UserAddress.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_address }\n end\n end", "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end", "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end", "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\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_site\n \n end", "def new\n @address_range = AddressRange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @address_range }\n end\n end", "def new\n @route = Route.new\n end", "def new_resource_url\n send route_prefix_to_method_name(\"new_#{class_name.model_name.singular_route_key}_url\")\n end", "def new\n @address = Address.new\n @address.user = current_user\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @address }\n end\n end", "def new\n @address_type = AddressType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @address_type }\n end\n end", "def new\n @url = Url.new\n end", "def new\n @url = Url.new\n end", "def new\n\tend", "def new\n\tend", "def new\n\tend", "def new\n\tend", "def new\n\tend", "def new\n\tend", "def new\n\tend", "def new\n\tend", "def new\n\tend", "def new\n\tend", "def new\n\tend", "def new\n\tend", "def new\n\tend", "def new\n\tend", "def new\n\tend", "def getnewaddress(account = nil)\n @api.request 'getnewaddress', account\n end", "def new\n end", "def new\n end", "def new\n end", "def new\n end", "def new\n end", "def new\n end", "def new\n end", "def new\n end", "def new\n geoname = Geoname.find(rand(Geoname.count))\n\n respond_to do |format|\n format.html { redirect_to travel_path(geoname.name)}\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\t\t@user = User.new\n\t\t@addresses = Address.all\n\t\t@address = Address.new\n\t\t\n\t\twidok = 'new'\n\t\twidok = 'user_new' if !(admin_logged_in?)\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html { render widok } # new.html.erb\n\t\t\tformat.xml\t{ render :xml => @user }\n\t\tend\n\tend", "def new\n\t\t\"let's make something new.\"\n\tend", "def new\r\n\r\n end", "def new\n @origin = Origin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @origin }\n end\n end", "def new\n end", "def new\n @gossip = Gossip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gossip }\n end\n end", "def new\n @base_url = BaseUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @base_url }\n end\n\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 # customer creates a new shipping address\n end", "def new\nend" ]
[ "0.7337138", "0.72494274", "0.7124991", "0.7020129", "0.6793162", "0.6759564", "0.6759564", "0.6759564", "0.674076", "0.67128444", "0.663711", "0.6635296", "0.6531555", "0.6517929", "0.6493711", "0.64865816", "0.6475466", "0.64491254", "0.64300823", "0.6417901", "0.64088583", "0.63566685", "0.6328378", "0.63122815", "0.63091886", "0.62995213", "0.62995213", "0.62909424", "0.62909", "0.6264624", "0.626144", "0.6258427", "0.6255671", "0.6251756", "0.62256324", "0.6222044", "0.62073845", "0.62073845", "0.61951894", "0.6191114", "0.618165", "0.618165", "0.61762625", "0.6167306", "0.6164391", "0.6161585", "0.61524564", "0.61524564", "0.6148904", "0.61442703", "0.6132116", "0.6132116", "0.6132116", "0.6114265", "0.6108686", "0.6098557", "0.6096392", "0.60932595", "0.6089377", "0.60857356", "0.60775435", "0.60775435", "0.6075823", "0.6075823", "0.6075823", "0.6075823", "0.6075823", "0.6075823", "0.6075823", "0.6075823", "0.6075823", "0.6075823", "0.6075823", "0.6075823", "0.6075823", "0.6075823", "0.6075823", "0.6073688", "0.60653496", "0.60653496", "0.60653496", "0.60653496", "0.60653496", "0.60653496", "0.60653496", "0.60653496", "0.6065038", "0.6060917", "0.6055159", "0.6050374", "0.6045238", "0.6038513", "0.603767", "0.6037545", "0.60340685", "0.6033661", "0.6033661", "0.6033661", "0.60263836", "0.6020723" ]
0.6648779
10
localhost:3000/addresses/create http method :post pathnil roles and responsibilites to create the record in the data basse
def create @address=Address.new(address_params) @address.user_id=current_user.id if @address.save redirect_to addresses_path else render action: 'new' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n\t\t@address = current_user.addresses.new(address_params)\n\t\t@earring = Earring.find(@address.detail.earring_id)\n\n\t\trespond_to do |format|\n\t\t\tif @address.save\n\t\t\t\tformat.html { redirect_to \"/confirm\" }\n\t\t\t\tformat.json { render action: 'show', status: :created, location: @address }\n\t\t\telse\n\t\t\t\tformat.html { redirect_to \"/addresses/new?d=#{@address.detail.id}\" }\n\t\t\t\tformat.json { render json: @address.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @address = Address.new(params[:address])\n @address.user_id=current_user.id\n\n respond_to do |format|\n if @address.save\n format.html { redirect_to @address, notice: 'Address was successfully created.' }\n format.json { render json: @address, status: :created, location: @address }\n else\n format.html { render action: \"new\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_address\n create_resource :address, {}\n end", "def create \n @address = Address.new(address_params)\n\n respond_to do |format|\n if @address.save\n format.html { redirect_to admin_path(current_user), notice: 'Address was successfully created.' }\n format.json { render :show, status: :created, location: @address }\n else\n format.html { render :new }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n super\n if resource.save\n \t\taddress.attributes = address_params\n \t\taddress.user_id = resource.id \n \t\taddress.save\n end\n end", "def create\n @address = Address.new(address_params)\n @num = 1\n while Address.where([\"address_id = ?\", @num]).size > 0\n @num = @num+1\n end\n @address.address_id = @num\n @address.user_email = current_user.email\n respond_to do |format|\n if @address.save\n format.html { redirect_to home_path, notice: 'Address was successfully created.' }\n format.json { render :show, status: :created, location: @address }\n else\n format.html { render :new }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @address = Address.new(params[:address])\n\n respond_to do |format|\n if @address.save\n format.html { redirect_to @address, notice: 'Address was successfully created.' }\n format.json { render json: @address, status: :created, location: @address }\n else\n format.html { render action: \"new\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @address = Address.new(params[:address])\n\n respond_to do |format|\n if @address.save\n format.html { redirect_to @address, notice: 'Address was successfully created.' }\n format.json { render json: @address, status: :created, location: @address }\n else\n format.html { render action: \"new\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @address = Address.new(params[:address])\n @address.user = current_user\n\n respond_to do |format|\n if @address.save\n format.html { redirect_to user_address_path(current_user, @address), notice: 'Address was successfully created.' }\n format.json { render json: @address, status: :created, location: @address }\n else\n format.html { render action: \"new\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@address = Address.new(address_params)\n @address = current_user.address.new(address_params)\n\n respond_to do |format|\n if @address.save\n format.html { redirect_to @address, notice: 'Form was submitted successfully!' }\n format.json { render :show, status: :created, location: @address }\n else\n format.html { render :new }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @address = Address.new(address_params)\n\n if @address.save\n redirect_to checkout_index_path, notice: 'Address was successfully created.'\n else\n redirect_to checkout_index_path, notice: 'Algo ocurrio mal'\n #format.html { render :new }\n #format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end", "def create\n @ag_address = Ag::Address.new(ag_address_params)\n\n respond_to do |format|\n if @ag_address.save\n format.html { redirect_to @ag_address, notice: 'Address was successfully created.' }\n format.json { render :show, status: :created, location: @ag_address }\n else\n format.html { render :new }\n format.json { render json: @ag_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_address = UserAddress.new(params[:user_address])\n\n respond_to do |format|\n if @user_address.save\n format.html { redirect_to @user_address, notice: 'User address was successfully created.' }\n format.json { render json: @user_address, status: :created, location: @user_address }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_address(params)\n EasyPost::Address.create(params)\n end", "def create\n @post_address = PostAddress.new(post_address_params)\n\n respond_to do |format|\n if @post_address.save\n format.html { redirect_to @post_address, notice: 'Adress skapad.' }\n format.json { render action: 'show', status: :created, location: @post_address }\n else\n format.html { render action: 'new' }\n format.json { render json: @post_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_address = UserAddress.new(user_address_params)\n\n respond_to do |format|\n if @user_address.save\n format.html { redirect_to @user_address, notice: \"User address was successfully created.\" }\n format.json { render :show, status: :created, location: @user_address }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @user_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @advertiser = Advertiser.new(advertiser_params)\n @advertiser.create_address(address_params)\n @advertiser.user = current_user\n\n respond_to do |format|\n if @advertiser.save\n format.html { redirect_to @advertiser, notice: 'Advertiser was successfully created.' }\n format.json { render json: @advertiser.to_json }\n else\n format.html { render :new }\n format.json { render json: @advertiser.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person_address = PersonAddress.new(person_address_params)\n\n respond_to do |format|\n if @person_address.save\n format.html { redirect_to @person_address, notice: 'Person address was successfully created.' }\n format.json { render :show, status: :created, location: @person_address }\n else\n format.html { render :new }\n format.json { render json: @person_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customers_address = CustomersAddress.new(params[:customers_address])\n\n respond_to do |format|\n if @customers_address.save\n format.html { redirect_to @customers_address, notice: 'Customers address was successfully created.' }\n format.json { render json: @customers_address, status: :created, location: @customers_address }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customers_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.find(params[:user_id])\n @address = @user.addresses.new(params[:address])\n\n respond_to do |format|\n if @address.save\n format.html { redirect_to admin_user_address_path(@user, @address), notice: 'Address was successfully created.' }\n format.json { render json: admin_user_address_path(@user, @address), status: :created, location: @address }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def create\n @account_address = AccountAddress.new(account_address_params)\n\n respond_to do |format|\n if @account_address.save\n format.html { redirect_to @account_address, notice: 'Account address was successfully created.' }\n format.json { render :show, status: :created, location: @account_address }\n else\n format.html { render :new }\n format.json { render json: @account_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n @address = Address.new()\n @address.addressable_type = params[:address][:addressable_type]\n @address.addressable_id = params[:address][:addressable_id]\n @address.number = params[:address][:number]\n @address.street = params[:address][:street]\n @address.suburb = params[:address][:city]\n @address.state = params[:address][:state]\n @address.country = params[:address][:country]\n @address.postcode = params[:address][:postcode]\n if @address.save\n redirect_to home_path\n else\n flash[:alert] = \"Opps, something went wrong when creating your review\"\n redirect_to items_path \n end \n end", "def create\n @addresses_person = AddressesPerson.new(addresses_person_params)\n\n respond_to do |format|\n if @addresses_person.save\n format.html { redirect_to @addresses_person, notice: 'Addresses person was successfully created.' }\n format.json { render :show, status: :created, location: @addresses_person }\n else\n format.html { render :new }\n format.json { render json: @addresses_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_address = UserAddress.new(user_address_params.merge(city: current_city, user: current_user))\n\n respond_to do |format|\n if @user_address.save\n format.html { redirect_to user_addresses_path, notice: 'User address was successfully created.' }\n else\n format.json { render json: @user_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_address = UserAddress.new(params[:user_address])\n\n respond_to do |format|\n if @user_address.save\n format.html { redirect_to(@user_address, :notice => 'User address was successfully created.') }\n format.xml { render :xml => @user_address, :status => :created, :location => @user_address }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user_address.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @taddress = Taddress.new(params[:taddress])\n \n respond_to do |format|\n if @taddress.save\n format.html { redirect_to @taddress, notice: 'Taddress was successfully created.' }\n format.json { render json: @taddress, status: :created, location: @taddress }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taddress.errors, status: :unprocessable_entity }\n end\n end\n end", "def build_and_create_address\n\t\tbegin\n\t\t\t@address = Address.new(\n\t\t\t\tstreet_address: params[:address][:street_address],\n\t\t\t\textended_address: params[:address][:extended_address],\n\t\t\t\tlocality: params[:address][:locality],\n\t\t\t\tregion: params[:address][:region],\n\t\t\t\tpostal_code: params[:address][:postal_code],\n\t\t\t\tphone: params[:address][:phone],\n\t\t\t\temail: params[:address][:email]\n\t\t\t\t)\n\n\t\t\tunless @address.save\n\t\t\t\trender status: 422, json: {\n error: \"Could not create address\"\n }\n end\n rescue ActiveRecord::ActiveRecordError\n render status: 422, json: {\n error: \"Could not create address\"\n }\n end\n end", "def create\n @address = Address.new(params[:address])\n current_user.address = @address\n respond_to do |format|\n if @address.save\n format.html { render :partial => 'addresses/show', notice: 'Address was successfully created.' }\n else\n format.html { render :partial => 'addresses/new' }\n end\n end\n end", "def create_address(order_or_user, expect_success, values, type=nil)\n visit_addresses(order_or_user)\n\n expect(page).to have_css('#new_address_link')\n click_link 'new_address_link'\n expect(current_path).to eq(spree.new_admin_address_path)\n\n fill_in_address(values, type)\n\n click_button Spree.t('actions.create')\n\n if expect_success\n expect_address_collection_path(order_or_user)\n expect(page).to have_content(Spree.t(:successfully_created, resource: Spree::Address.model_name.human))\n else\n expect(path_with_query).to eq(spree.admin_addresses_path(user_id: @user_id, order_id: @order_id))\n expect(page).to have_no_content(Spree.t(:successfully_created, resource: Spree::Address.model_name.human))\n end\n end", "def create_spree_address\n @spree_address = Spree::Address.new(address_attributes)\n @spree_address.save(validate: false)\n end", "def create_and_verify(params = {})\n wrapped_params = {}\n wrapped_params[:address] = params\n\n @client.make_request(:post, 'addresses/create_and_verify', MODEL_CLASS, wrapped_params).address\n end", "def create\n @customer_address = CustomerAddress.new(customer_address_params)\n\n respond_to do |format|\n if @customer_address.save\n format.html { redirect_to @customer_address, notice: 'Customer address was successfully created.' }\n format.json { render :show, status: :created, location: @customer_address }\n else\n format.html { render :new }\n format.json { render json: @customer_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sales_address = Sales::Address.new(sales_address_params)\n\n respond_to do |format|\n if @sales_address.save\n format.html { redirect_to sales_seller_address_path(@sales_seller, @sales_address), notice: \"Endereço adicionado com sucesso!\" }\n format.json { render :show, status: :created, location: @sales_address }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @sales_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @address_record = AddressRecord.new(address_record_params)\n\n respond_to do |format|\n if @address_record.save\n format.html { redirect_to @address_record, notice: 'Address record was successfully created.' }\n format.json { render :show, status: :created, location: @address_record }\n else\n format.html { render :new }\n format.json { render json: @address_record.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_address\n if @ok\n @mailing_list_address = MailingListAddress.new\n @mailing_list_address.group_id = @mailing_list_group.id\n @mailing_list_address.heading = params[:heading]\n @mailing_list_address.email = params[:email]\n @ok = @mailing_list_address.save\n end\n render 'update_addresses'\n end", "def create\n @address = current_user.addresses.new(params[:address])\n @count = current_user.addresses.count\n respond_to do |format|\n if @address.save\n format.html { redirect_to \"/#{current_user.name}/address/#{@count + 1}\", notice: 'Address was successfully created.' }\n format.json { render json: @address, status: :created, location: @address }\n format.js\n else\n @address.phones.build\n @address.faxs.build\n @address.emails.build\n format.html { render action: \"new\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n format.js \n end\n end\n end", "def create\n @address_detail = AddressDetail.new(address_detail_params)\n\n respond_to do |format|\n if @address_detail.save\n format.html { redirect_to @address_detail, notice: 'Address detail was successfully created.' }\n format.json { render :show, status: :created, location: @address_detail }\n else\n format.html { render :new }\n format.json { render json: @address_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mailaddress = Mailaddress.new(mailaddress_params)\n\n respond_to do |format|\n if @mailaddress.save\n format.html { redirect_to @mailaddress, notice: 'Mailaddress was successfully created.' }\n format.json { render :show, status: :created, location: @mailaddress }\n else\n format.html { render :new }\n format.json { render json: @mailaddress.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @address = current_customer.addresses.build(\n province: Province.find(params[:province_id].to_i),\n country_code: params[:country_code],\n is_primary_address: address_params[:is_primary_address].to_i == 1,\n address_line_one: address_params[:address_line_one],\n address_line_two: address_params[:address_line_two],\n address_additional: address_params[:address_additional],\n city: address_params[:city],\n postal_code: address_params[:postal_code]\n )\n\n respond_to do |format|\n if @address.save\n format.html { redirect_to @address, notice: \"Address was successfully created.\" }\n format.json { render :show, status: :created, location: @address }\n else\n format.html { render :new }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # create new address\n @new_address = UserAddress.create!(address_params)\n \n if session[:new_membership_path] == true\n @redirect_path = knird_preferred_new_membership_path\n elsif session[:new_trial_path] == true\n @redirect_path = knird_preferred_new_trial_path\n else\n @redirect_path = session.delete(:return_to)\n end\n \n # redirect \n redirect_to @redirect_path\n\n end", "def create\n @address = Address.new(params[:address])\n @address.type = params[:address][:address_type] unless params[:address][:address_type].blank?\n \n respond_to do |format|\n if @address.save\n flash[:notice] = 'Address was successfully created.'\n format.html { redirect_to( address_path(@address.id) ) }\n format.xml { render :xml => @address, :status => :created, :location => @address }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @address.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n @user.build_address(params[:address])\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to(@user) }\n else\n format.html { render :action => \"new\" }\n end\n end\n end", "def create\n @client_address = ClientAddress.new(client_address_params)\n\n respond_to do |format|\n if @client_address.save\n format.html { redirect_to @client_address, notice: 'Client address was successfully created.' }\n format.json { render :show, status: :created, location: @client_address }\n else\n format.html { render :new }\n format.json { render json: @client_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user_id = @current_user.id\n input_address = params[:address].delete(\" \").delete(\",\").capitalize # removes all spaces and comma's from the newly entered address.\n address = @current_user.addresses\n address_arr = []\n address.each do |a|\n address_arr.push(a.address.delete(\" \").delete(\",\").capitalize)\n end\n # checks whether the address entered already exists for the current user\n unless (address_arr.include?(input_address))\n if (address.empty?) # if user have no address, address created first should be the delivery address.\n new_address = Address.create!(\n :user_id => user_id,\n :address => params[:address],\n :delivery_address => true,\n )\n else\n new_address = Address.create!(\n :user_id => user_id,\n :address => params[:address],\n )\n end\n else\n flash[:error] = \"Already Existing Address!!!\"\n end\n redirect_to cart_items_path\n end", "def create\n @ip_adress = IpAddress.new(ip_adress_params)\n\n respond_to do |format|\n if @ip_adress.save\n format.html { redirect_to @ip_adress, notice: 'Ip adress was successfully created.' }\n format.json { render :show, status: :created, location: @ip_adress }\n else\n format.html { render :new }\n format.json { render json: @ip_adress.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @addresstype = Addresstype.new(params[:addresstype])\n\n respond_to do |format|\n if @addresstype.save\n format.html { redirect_to @addresstype, notice: 'Addresstype was successfully created.' }\n format.json { render json: @addresstype, status: :created, location: @addresstype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @addresstype.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @adress = Adresse.new(params[:adresse])\n \n respond_to do |format|\n if @adress.save\n format.html { redirect_to @adress, notice: 'Adresse was successfully created.' }\n format.json { render json: @adress, status: :created, location: @adress }\n else\n format.html { render action: \"new\" }\n format.json { render json: @adress.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n#\tlista za izbor role se prikazuje samo ako je logovan administrator\n\tif params[:user][:role_id]\n\t\t@role = Role.find(params[:user][:role_id])\n\telse\n\t\t@role = Role.find_by(name: 'registered user');\n\tend\n\t@user = @role.users.build(user_params)\n\t\n respond_to do |format|\n if @user.save\n\t\t \n\t\tset_session_for_user(@user)\n\t\t \n format.html { \n\t\t\tredirect_to addresses_url and return if session[:redirect_to_address]\n\t\t\tredirect_to @user, alert: \"User #{@user.name} was successfully created.\" \n\t\t}\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\t\n end", "def create\n @contributor_address = ContributorAddress.new(params[:contributor_address])\n\n respond_to do |format|\n if @contributor_address.save\n format.html { redirect_to @contributor_address, notice: 'Contributor address was successfully created.' }\n format.json { render json: @contributor_address, status: :created, location: @contributor_address }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contributor_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person = Person.new(person_params)\n # @person.addresses.build()\n respond_to do |format|\n if @person.save\n # @person.addresses.create\n # @person.companies.create\n\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n @addresses = @person.addresses\n @page_title = 'Add a new person'\n addresses = @person.addresses.build\n companies = @person.companies.build\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @address_customer = AddressCustomer.new(params[:address_customer])\n\n respond_to do |format|\n if @address_customer.save\n format.html { redirect_to @address_customer, notice: 'Address customer was successfully created.' }\n format.json { render json: @address_customer, status: :created, location: @address_customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @address_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_easypost_address\n EasyPost::Address.create(\n name: full_name,\n street1: street,\n street2: street2,\n city: city,\n state: state,\n zip: postal_code,\n country: 'US',\n verify_strict: ['delivery']\n )\n end", "def create\n @address_book = current_user.address_books.build(address_book_params)\n\n respond_to do |format|\n if @address_book.save\n format.html { redirect_to @address_book, notice: 'Address book was successfully created.' }\n format.json { render :show, status: :created, location: @address_book }\n else\n format.html { render :new }\n format.json { render json: @address_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ip_address = IpAddress.new(ip_address_params)\n\n respond_to do |format|\n if @ip_address.save\n format.html { redirect_to ip_addresses_path, notice: 'Ip address was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ip_address }\n else\n format.html { render action: 'new' }\n format.json { render json: @ip_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n super do |user|\n if user.persisted?\n user.addresses.create(address_params) if address_params_present?\n\n SmsService.new.send_message(user.phone, \"Thanks for registering for the California Connects Alerts service! Click this link to confirm your registration: \" + user_success_url)\n end\n end\n end", "def create\n @address = Address.create!(params[:address])\n @organization = Organization.new(params[:organization])\n @organization.address = @address\n \n respond_to do |format|\n if @organization.save\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render json: @organization, status: :created, location: @organization }\n else\n format.html { render action: \"new\" }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @host_address = HostAddress.new(host_address_params)\n respond_to do |format|\n if @host_address.save\n format.html { redirect_to @host_address, notice: 'Host address was successfully created.' }\n format.json { render :show, status: :created, location: @host_address }\n else\n format.html { render :new }\n format.json { render json: @host_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @address_book = AddressBook.new(address_book_params)\n\n respond_to do |format|\n if @address_book.save\n format.html { redirect_to @address_book, notice: 'Address book was successfully created.' }\n format.json { render :show, status: :created, location: @address_book }\n else\n format.html { render :new }\n format.json { render json: @address_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_address!(options = {})\n method_not_implemented\n end", "def create\n @andress = Andress.new(andress_params)\n\n respond_to do |format|\n if @andress.save\n format.html { redirect_to @andress, notice: 'Andress was successfully created.' }\n format.json { render :show, status: :created, location: @andress }\n else\n format.html { render :new }\n format.json { render json: @andress.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @technocal_client_address = TechnocalClientAddress.new(params[:technocal_client_address])\n\n respond_to do |format|\n if @technocal_client_address.save\n format.html { redirect_to([:admin, @technocal_client_address], :notice => 'TechnocalClientAddress criada com sucesso.') }\n format.xml { render :xml => @technocal_client_address, :status => :created, :location => @technocal_client_address }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @technocal_client_address.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n position = Position.new(params.permit(:address))\n \n if position.save\n render json: position, status: :created\n else\n render json: position.errors, status: :unprocessable_entity\n end\n end", "def create(address, options={})\n \tparams = {:address => address}\n Mailgun.submit :post, list_url, params.merge(options)\n end", "def create\n @person_email_address = PersonEmailAddress.new(person_email_address_params)\n\n respond_to do |format|\n if @person_email_address.save\n format.html { redirect_to @person_email_address, notice: 'Person email address was successfully created.' }\n format.json { render :show, status: :created, location: @person_email_address }\n else\n format.html { render :new }\n format.json { render json: @person_email_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @address = @company.addresses.build(address_params) \n\n respond_to do |format|\n if @address.save\n # If this is first address, set as bill and ship address\n @company.billaddress ||= @address.id\n @company.shipaddress ||= @address.id\n @company.save!\n\n format.html { redirect_to edit_company_path(@company), notice: 'Address was successfully created.' }\n format.json { render :show, status: :created, location: @address }\n else\n format.html { render :new }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cliente = Cliente.new id: '300', nome:'David', identificador:'14725836910', telefone:'8735334268', celular:'3698521472', email:'david@gmail.com', senha:'65423'\n @cliente.save\n @order = @cliente.orders.build(id: '800', menuTitle: 'Senor Froggy', street: 'Elm Street')\n @cliente.save\n #@adress = Adress.new(street: :street, block: :block, number: :number, additional_info: :additional_info, order_id: @order)\n @adress = @order.adresses.build(street: :street, block: :block, number: :number, additional_info: :additional_info, order_id: @order.id)\n respond_to do |format|\n if @adress.save\n format.html { redirect_to @adress, notice: 'Adress was successfully created.' }\n format.json { render :show, status: :created, location: @adress }\n else\n format.html { render :new }\n format.json { render json: @adress.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @addresses = Address.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC')\n @address = Address.create(params[:address])\n end", "def create\n @customer_ship_address = current_customer.build_customer_ship_address(customer_ship_address_params)\n respond_to do |format|\n if @customer_ship_address.save\n format.html { redirect_to edit_customer_registration_path, notice: t(:ship_address_suc_create) }\n format.json { redirect_to edit_customer_registration_path, status: :created, location: @customer_ship_address}\n else\n format.html { render action: 'new' }\n format.json { render json: @customer_ship_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @origin = OriginAddr.new(origin_params)\n @origin.user_id = @current_user.uid\n @origin.user_name = @current_user.name\n respond_to do |format|\n if @origin.save\n format.html { redirect_to admin_origin_path(@origin), notice: '来源创建成功.' }\n format.json { render :json => {\"status\" => 1, \"origin\" => @origin} }\n else\n format.html { render action: \"new\" }\n format.json { render :json => {\"status\" => 0} }\n end\n end\n end", "def create\n @address = Address.new(params[:address])\n \n \n # respond_to do |format|\n # if @address.save\n \n # flash[:notice] = 'Address was successfully created.'\n # format.html { redirect_to(@address) }\n # format.xml { render :xml => @address, :status => :created, :location => @address }\n # else\n # format.html { render :action => \"new\" }\n # format.xml { render :xml => @address.errors, :status => :unprocessable_entity }\n # end\n # end\n if @address.save\n respond_to do |wants|\n wants.html do\n flash[:notice] = \"Address created successfully!\"\n redirect_back_or_default(root_url)\n end\n \n wants.js { render :redirect }\n end\n else\n respond_to do |wants|\n wants.html { render :new }\n wants.js # create.js.erb\n end\n end\n end", "def save\n order = Order.create(user_id: user_id, item_id: item_id)\n Address.create(post_code: post_code,area_id: area_id ,city: city, address: address, house_number: house_number, phone_number: phone_number, order_id: order.id)\n end", "def create\n @mortgage_address = MortgageAddress.new(mortgage_address_params)\n\n respond_to do |format|\n if @mortgage_address.save\n format.html { redirect_to @mortgage_address, notice: 'Mortgage address was successfully created.' }\n format.json { render :show, status: :created, location: @mortgage_address }\n else\n format.html { render :new }\n format.json { render json: @mortgage_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n # initialises a blank address for the user the address will belong to\n @address = Address.new\n @address.user = @user\n authorize! :create, @user.address\n end", "def create\n @electronic_address = ElectronicAddress.new(electronic_address_params)\n\n respond_to do |format|\n if @electronic_address.save\n format.html { redirect_to @electronic_address, notice: 'Electronic address was successfully created.' }\n format.json { render action: 'show', status: :created, location: @electronic_address }\n else\n format.html { render action: 'new' }\n format.json { render json: @electronic_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_address!\n method_not_implemented\n end", "def create\n @delivery_address = DeliveryAddress.new(params[:delivery_address])\n\n respond_to do |format|\n if @delivery_address.save\n format.html { redirect_to @delivery_address, notice: 'Delivery address was successfully created.' }\n format.json { render json: @delivery_address, status: :created, location: @delivery_address }\n else\n format.html { render action: \"new\" }\n format.json { render json: @delivery_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @store = Store.new(params[:store])\n @mapped_address = Address.find_by_id(params[:address_id])\n \n # if address is not found (nil), nothing was selected by the selectbox\n if @mapped_address.nil? \n # check if user want to assign the store with a new address\n if params[:street] != \"\"\n if params[:zipcode] != \"\"\n if params[:city] != \"\"\n @new_address = Address.new(:city => params[:city], :street => params[:street], :zipcode => params[:zipcode])\n @new_address.save\n @store.addresses << @new_address\n end\n end\n end\n else\n # can assign the selected address to store\n @store.addresses << @mapped_address\n end\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to stores_path, notice: 'Store was successfully created.' }\n format.json { render json: @store, status: :created, location: @store }\n else\n format.html { render action: \"new\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(params = {})\n wrapped_params = { address: params }\n\n @client.make_request(:post, 'end_shippers', MODEL_CLASS, wrapped_params)\n end", "def create_contact\n @contact = Spree::Address.new(contact_params)\n # Currently for demo, I will leave the country id to be 1, later update will be noticed!\n hard_code_contact(contact_params)\n respond_to do |format|\n if @contact.save\n @seller.spree_addresses << @contact\n format.html { redirect_to contacts_admin_seller_path, notice: \"Contacts #{@contact.firstname} #{@contact.lastname} is successfully created!\" }\n else\n flash[:error] = @contact.errors.full_messages\n format.html { render :new_contact }\n format.json { render :new_contact, status: :unprocessable_entity }\n end\n end\n end", "def process_addresses(params)\n assign_attributes(params)\n save(validate: false)\n add_email!\n add_addresses!\n save\n end", "def create\n \n end", "def create\n @ripple_address = RippleAddress.new(ripple_address_params)\n\n respond_to do |format|\n if @ripple_address.save\n format.html { redirect_to @ripple_address, notice: 'Ripple address was successfully created.' }\n format.json { render :show, status: :created, location: @ripple_address }\n else\n format.html { render :new }\n format.json { render json: @ripple_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @billing_address = BillingAddress.new(params[:billing_address])\n\n respond_to do |format|\n if @billing_address.save\n format.html { redirect_to @billing_address, notice: 'Billing address was successfully created.' }\n format.json { render json: @billing_address, status: :created, location: @billing_address }\n else\n format.html { render action: \"new\" }\n format.json { render json: @billing_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n end", "def create\n @address_type = AddressType.new(params[:address_type])\n\n respond_to do |format|\n if @address_type.save\n format.html { redirect_to(@address_type, :notice => 'AddressType was successfully created.') }\n format.xml { render :xml => @address_type, :status => :created, :location => @address_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @address_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @subscriber = Subscriber.find(session[:subscriber_id])\n @shipping_address = @subscriber.shipping_addresses.new(params[:shipping_address])\n @shipping_address.region = Region.find_by_id(params[:district])\n\n respond_to do |format|\n if @shipping_address.save\n format.html { redirect_to @shipping_address, notice: 'Shipping address was successfully created.' }\n format.json { render json: @shipping_address, status: :created, location: @shipping_address }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shipping_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tadress = Tadress.new(tadress_params)\n\n respond_to do |format|\n if @tadress.save\n format.html { redirect_to @tadress, notice: 'Tadress was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tadress }\n else\n format.html { render action: 'new' }\n format.json { render json: @tadress.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_address\n \n params[:place]\n address = ReceiverAddress.new(:label => params[:place], \n :city_id => params[:city_id], \n :address => params[:address])\n @receive.document = \"234\"\n @receiver.receiver_addresses << address\n respond_to do |format|\n format.html { render @receiver, action ='new'}\n end\n end", "def create\n @reserved_address = ReservedAddress.new(reserved_address_params)\n\n respond_to do |format|\n if @reserved_address.save\n flash[:success] = 'Reserved address was successfully created.'\n format.html { redirect_to vlan_path(find_vlan(@reserved_address)), notice: 'Reserved address was successfully created.' }\n format.json { render action: 'show', status: :created, location: @reserved_address }\n else\n flash[:danger] = 'Reserved address was NOT created.'\n format.html { render action: 'new' }\n format.json { render json: @reserved_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_delivery_address = UserDeliveryAddress.new(user_delivery_address_params)\n\n respond_to do |format|\n if @user_delivery_address.save\n format.html { redirect_to @user_delivery_address, notice: 'User delivery address was successfully created.' }\n format.json { render :show, status: :created, location: @user_delivery_address }\n else\n format.html { render :new }\n format.json { render json: @user_delivery_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n\tend", "def create\n error = false\n parameters = true\n if params[:receiver] && \n params[:receiver][:receiver_addresses_attributes] && \n (params[:receiver][:receiver_addresses_attributes].size > 0)\n begin\n Receiver.transaction do\n @receiver = Receiver.create(:receiver_name => params[:receiver][:receiver_name],\n :document => params[:receiver][:document])\n\n @receiver_addresses = params[:receiver][:receiver_addresses_attributes]\n @receiver_addresses.each do |address|\n ReceiverAddress.create(:receiver_id => @receiver.id, \n :label => address[1][:label],\n :address => address[1][:address],\n :city_id => address[1][:city_id]) \n end\n end\n @messages = {:success => \"El destinatario se guardo destinatario\"}\n rescue\n @messages = {:error => \"No se pudo guardar el destinatario\"}\n error = true\n end\n else\n @messages = {:alert => \"No se pudo guardar el destinatario. Debe tener al menos una direccion. Por favor, verifique los campos ingresados.\"}\n parameters = false\n end\n \n \n respond_to do |format|\n if (error and parameters) or (!error and !parameters)\n @receivers = Receiver.order('created_at DESC').limit 10\n @cities = City.all\n format.html { render :action => :new }\n format.json { render json: @receiver, status: :created, location: @receiver }\n else\n format.html { redirect_to new_receiver_path, :messages => {:success => 'El destinatario se guardo correctamente.'}}\n format.json { head :no_content }\n end\n end\n end", "def create_address_book(principal_uri, url, properties)\n end", "def create\r\n end", "def createAddress\n value = posting_address_params\n @posting=Posting.find(params[:id])\n\n if(value[:id].nil? && @posting[params[:id]].nil?)\n @address = Address.new\n if @posting[:enable_sharing]==1\n value[:hiacode]=Loolcode.create('AF','SN',20) #af for afrikelist sn for senegal... how to pull the country code?\n end\n @address.update_attributes(value)\n\n @address.save\n else\n @address = Address.find(params[:id])\n @address.update_attributes(value )\n end\n @posting.update(address_id: @address.id)\n end", "def create_property\n @p = Property.create(address: params[:address], state: params[:state], city: params[:city])\n redirect_to '/'\n end", "def new\n @company = Company.find_or_create_by(name: 'New Company')\n begin\n @company.save!\n rescue\n flash[:error] = \"Company NOT be found or was not created.\"\n nil\n end\n @address = @company.addresses.find_or_create_by( {addressable_type: 'Company', addressable_id: @company.id} )\n @address.save!\n end", "def create_frontend_address(user, expect_success, values, default_bill=nil, default_ship=nil)\n visit spree.account_path\n click_link I18n.t(:add_new_address, :scope => :address_book)\n expect(current_path).to eq(spree.new_address_path)\n\n fill_in_address(values)\n check_frontend_defaults(default_bill, default_ship)\n\n click_button Spree.t(:create)\n\n if expect_success\n expect(page).to have_content(Spree.t(:successfully_created, :resource => Spree.t(:address1)))\n expect(current_path).to eq(spree.account_path)\n expect_frontend_addresses(user)\n else\n expect(page).to have_no_content(Spree.t(:successfully_created, :resource => Spree.t(:address1)))\n end\n end", "def create\n @weventaddress = Weventaddress.new(weventaddress_params)\n\n respond_to do |format|\n if @weventaddress.save\n format.html { redirect_to @weventaddress, notice: 'Weventaddress was successfully created.' }\n format.json { render :show, status: :created, location: @weventaddress }\n else\n format.html { render :new }\n format.json { render json: @weventaddress.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \t\n end" ]
[ "0.7245075", "0.72429365", "0.72294366", "0.7202821", "0.71977246", "0.7148181", "0.71442384", "0.71442384", "0.71360093", "0.7132747", "0.71104234", "0.7057823", "0.70529497", "0.70426553", "0.70026606", "0.6993604", "0.69030267", "0.686027", "0.68338376", "0.68285334", "0.68282515", "0.6816134", "0.6806592", "0.67864466", "0.6777692", "0.67713314", "0.67551523", "0.6719414", "0.67165965", "0.6712681", "0.66892624", "0.66690105", "0.66660714", "0.6643814", "0.6641881", "0.6629834", "0.6608084", "0.659342", "0.65922934", "0.6589904", "0.65871775", "0.6582106", "0.6555913", "0.6539166", "0.65204644", "0.6508226", "0.6479395", "0.6474068", "0.6462753", "0.6456963", "0.6441038", "0.642985", "0.64285785", "0.6412635", "0.64087397", "0.6407229", "0.6403096", "0.63831407", "0.63714236", "0.63714164", "0.63708717", "0.63516897", "0.6347233", "0.6314426", "0.6297327", "0.6289068", "0.628767", "0.6287145", "0.626796", "0.6250773", "0.62425697", "0.6242529", "0.62424797", "0.62325495", "0.6232498", "0.6229501", "0.62235177", "0.62171406", "0.62083894", "0.620377", "0.6202971", "0.619129", "0.61765534", "0.61661977", "0.6164544", "0.6144726", "0.61359686", "0.6111272", "0.6111072", "0.61086", "0.6104284", "0.61031944", "0.6096823", "0.60938895", "0.6084848", "0.6081566", "0.60733473", "0.6051117", "0.6042301", "0.6037092" ]
0.67570066
26
localhost:3000/addresses/5/edit http method :GET pathedit_address_path roles and responsibilities
def edit @address=Address.new @address=Address.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n\t\t@address = current_user.addresses.find(params[:id])\n\tend", "def edit\n @addresses = @user.addresses\n end", "def edit\n @user = User.find(params[:id])\n @address = @user.address || @user.build_address\n end", "def edit\n# @postalAddress = PostalAddress.find(params[:id])\n render :layout => 'content'\n end", "def edit\n # find address to edit\n @user_address = UserAddress.find_by_id(params[:id])\n \n # get location type and name\n @location_type = @user_address.location_type\n if @user_address.location_type == \"Other\"\n @location_name = @user_address.other_name\n @row_status = \"show\"\n else\n @location_name = @user_address.location_type\n @row_status = \"hidden\"\n end\n @header = \"Edit \" + @location_name\n \n # set session to remember page arrived from \n session[:return_to] = request.referer\n \n end", "def update\n @address = @addressable.addresses.find_by_id(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to current_user, notice: 'address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_address\n traveller = Traveller.find(params[:pk])\n address = params[:value]\n\n coordinates = GoogleAPIGeocoder.do_geocode(address)\n\n if coordinates.nil?\n render json: {success: false, msg: 'Unable to find the location of the given address. Please check that it is correct.'}\n else\n traveller.update(address: address, latitude: coordinates[0], longitude: coordinates[1])\n\n if current_user.nil?\n if session[:trip] != nil\n travellers = session[:trip].travellers\n travellers[travellers.index(traveller)].address = params[:value]\n end\n\n if session[:travellers] != nil\n session[:travellers][session[:travellers].index(traveller)].address = params[:value]\n end\n end\n\n render json: {success: true}\n end\n end", "def edit_address(order_or_user, address_id, expect_success, values, type=nil)\n visit_edit_address(order_or_user, address_id)\n fill_in_address(values, type)\n click_button Spree.t('actions.update')\n\n if expect_success\n expect_address_collection_path(order_or_user)\n expect(page).to have_content(Spree.t(:successfully_updated, resource: Spree::Address.model_name.human))\n else\n expect(page).to have_no_content(Spree.t(:successfully_updated, resource: Spree::Address.model_name.human))\n expect(path_with_query).to eq(spree.admin_address_path(address_id, user_id: @user_id, order_id: @order_id))\n end\n end", "def update\n @address = current_user.addresses.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to user_address_path(current_user, @address), notice: 'Address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if current_user\n @address = Address.find(params[:id])\n if current_user == @address.user\n address = Address.new(params[:address])\n address.user = current_user\n if address.save\n @address.update_attributes(:status => 'deleted')\n flash[:notice] = I18n.t(\"stizun.address.address_changed\")\n redirect_to user_addresses_path(current_user)\n else\n flash[:error] = I18n.t(\"stizun.address.address_couldnt_be_saved\")\n render :action => 'edit'\n end\n else\n flash[:error] = I18n.t(\"stizun.address.you_have_no_permission_to_edit\")\n redirect_to root_path\n end\n end\n end", "def update\n @address = Address.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n flash[:notice] = 'Address was successfully updated.'\n #format.html { redirect_to admin_user_path(@address.user_id) } if authorized?\n format.html { redirect_to( :action=>'show', :id=>@address.id ) } # here we're editing from the user profile; add a conditional for editing from payment process\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @address.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_address\n authorize @address = Address.find(params[:id])\n end", "def edit\n \n end", "def edit\n\n end", "def edit\r\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\n\n end", "def edit\r\n \r\n end", "def edit \n end", "def edit \n end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit\nend", "def edit\nend", "def edit\nend", "def edit\n \n end", "def edit\n \n end", "def edit\n \n end", "def edit\n \n end", "def edit\n \n end", "def edit\n \n end", "def edit\n \n end", "def edit\n\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end" ]
[ "0.7930331", "0.7466074", "0.7127007", "0.71117216", "0.69689214", "0.69334215", "0.6909133", "0.6888436", "0.6828675", "0.6812284", "0.6775288", "0.67679226", "0.6715734", "0.6707032", "0.6700996", "0.6684866", "0.6684866", "0.6684866", "0.6684866", "0.6684866", "0.6684866", "0.6684866", "0.6684866", "0.6684866", "0.6684866", "0.6684866", "0.6684866", "0.6684866", "0.66729367", "0.66729367", "0.66729367", "0.66729367", "0.66729367", "0.66729367", "0.66729367", "0.66729367", "0.66729367", "0.66729367", "0.66729367", "0.66729367", "0.66729367", "0.66729367", "0.66704565", "0.66648453", "0.66648453", "0.6659905", "0.6659905", "0.6659905", "0.6659905", "0.6659905", "0.6659905", "0.6659905", "0.6659905", "0.6659905", "0.6659905", "0.6659905", "0.6659905", "0.6659905", "0.6659905", "0.6659905", "0.6659905", "0.6659905", "0.6659905", "0.6659905", "0.6659905", "0.6659905", "0.66411686", "0.66411686", "0.66411686", "0.663698", "0.663698", "0.663698", "0.663698", "0.663698", "0.663698", "0.663698", "0.66357976", "0.6625313", "0.6625313", "0.6625313", "0.6625313", "0.6625313", "0.6625313", "0.6625313", "0.6625313", "0.6625313", "0.6625313", "0.6625313", "0.6625313", "0.6625313", "0.6625313", "0.6625313", "0.6625313", "0.6625313", "0.6625313", "0.6625313", "0.6625313", "0.6625313", "0.6625313", "0.6625313" ]
0.74751925
1
EPIC TWEET GEN takes a user hashtag and how many tweets to gen returns the total rating
def generate_tweets(hashtag, how_many) total_stars = 0 how_many.times do stars = rand(5)+1 total_stars += stars Tweet.create( user_handle: Faker::Lorem.words(2).join('_'), user_display: Faker::Name.name, feedback: Faker::Lorem.sentences(2).join << " #{stars}star #doha ##{hashtag} #dmkr", rating: stars, event_hashtag: 'doha', participant_hashtag: "#{hashtag}", timestamp: rand(24.hours).ago ) end total_stars end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tweet_score\n end", "def tweet_score(favorite_count, retweet_count)\n return favorite_count + (retweet_count * 2)\n end", "def index\n number_tweets = if params[\"count\"] then params[\"count\"].to_i else 10 end\n tweet_ids = []\n if @user.interests\n for i in 1..number_tweets\n interest = @user.interests.sample\n tweet = Rails.application.config.twitter_client.search(\"#{interest[:hashtag]}\", count: 1).take(1)\n tweet_ids.push(tweet.first.id.to_s)\n end\n end\n\n render json: tweet_ids, status: :ok\n end", "def getAvgUserNumberRating(u)\n @count = 0\n @allR = getUserReviews(u)\n @allR.each do |r|\n @count += r.rating\n end\n return (@allR.count == 0) ? \"None\" : @count/@allR.count \n end", "def calculate_favorite_tweeter\n # Count each fav as 1 point\n scores = Hash[most_faved]\n scores.default = 0\n\n # Count each RT as 1.5 points\n most_retweeted.each { |screen_name, rts| scores[screen_name] += (rts * 1.5) }\n\n winning_screen_name, winning_score = scores.max_by { |_, score| score }\n\n {\n :screen_name => winning_screen_name,\n :favs_count => Hash[most_faved][winning_screen_name],\n :retweets_count => Hash[most_retweeted][winning_screen_name],\n :score => winning_score\n }\n end", "def count_tweets(username)\n\n # fetch all the tweets for this user,\n # set tweets count to max 200\n fetched_tweets = @client.user_timeline(username, {count: 200})\n\n # init a counter to keep the count of tweet happens in last 24 hours\n hour_counter = Array.new(24) { |e| e = 0 }\n\n # start the timer after fetch all the tweets\n now = Time.now\n fetched_tweets.each do |tweet|\n if now < tweet.created_at + 24 * 60 * 60\n # only consider the 24 hours tweets\n hour_counter[tweet.created_at.hour] += 1\n else\n # if loop to a tweet before 24 hours ago,\n # then terminates the loop\n break\n end\n end\n\n # convert array into hash\n # using array index as key\n # and convert key to string\n hash = Hash.new\n hour_counter.each_with_index {|val, index| hash[index.to_s] = val}\n return hash\n end", "def tweet (user_id)\n \n #generate a new tweet\n body = \"This is a new tweet being written to the DB!\"\n \n IBM_DB.exec(@conn, \"INSERT INTO tweets(tweet, user_id) VALUES( '#{body.gsub(/'/,'')}', #{user_id} );\")\n new_id = getSimpleValue(@conn, \"SELECT IDENTITY_VAL_LOCAL() FROM users\").to_i\n \n #insert 0-2 hashtags per tweet\n rand(2).times do\n new_tag = rand(@max_hash - @min_hash + 1) + @min_hash\n IBM_DB.exec(@conn, \"INSERT INTO hashtags_tweets(tweet_id, hashtag_id) VALUES ( #{ new_id }, #{ new_tag })\")\n end\n \n debug \"wrote new tweet for user: \" + user_id.to_s\n end", "def search_hashtag tag\r\n response = RestClient.get 'https://api.twitter.com/1.1/search/tweets.json', params: {q: tag, count: 100}, Authorization: 'Bearer AAAAAAAAAAAAAAAAAAAAAJr1YQAAAAAAHA%2FAKcuAEPhPSJgFqwcwKMU0wPk%3DwHtz3CIM3eluP3XQDNfXobhvApEBTpyYeWrJ31ZxUukMm1idUj'\r\n \r\n tweets = Array.new\r\n JSON.parse(response)['statuses'].each do |t|\r\n hashtags = Array.new\r\n t[\"entities\"][\"hashtags\"].each do |h|\r\n hashtags << (\"#\" + h[\"text\"].downcase)\r\n end\r\n tweet={\r\n \"id\" => t[\"id\"],\r\n \"text\" => t['text'],\r\n \"hashtags\" => hashtags\r\n }\r\n tweets << tweet\r\n end\r\n tweets\r\n end", "def feeds_with_top_tweets\n\n end", "def tweet\n\t#gets what the last value was from the timeline\n\tlast = $client_twitter.user_timeline()[0].text.match('([0-9])+').string.to_i\n\t#calculates the new value\n\tnext_square = next_number(last)\n\t#these four numbers produce swastikas, so let's just not post those. I'm comfortable getting done 8 hours early for that\n\tif next_square == 28928495 || next_square == 32632615 || next_square == 921816 || next_square == 4625936\n\t\tnext_square = next_number(next_square)\n\tend\n\t#draws the square and saves the file name\n\tfile_name = draw_grid(next_square)\n\t#gets the text of the tweet\n\tnew_tweet = generate_tweet(next_square)\n\t#opens the file and posts\n\tFile.open(file_name) do |f|\n\t\t$client_twitter.update_with_media(new_tweet, f)\n\tend\n\t#deletes the file so it doesn't clutter up the place\n\tFile.delete(file_name)\n\t#And we're done!\n\tputs \"Posted to twitter\"\nend", "def user_tweets(user_hash, opts = {})\n client = self.client(user_hash)\n user_name = user_hash['name']\n\n opts = @default_user_tweets_options.merge(opts)\n\n expected_count = opts['count'] || 20\n max_id = nil\n\n Enumerator.new do |yielder|\n # make API request & return results in an enumerator\n loop do\n query_opts = opts\n if max_id\n query_opts = opts.clone\n query_opts['max_id'] = max_id\n end\n\n results = client.user_timeline(user_name, query_opts)\n results.each do |tweet|\n id = tweet['id']\n max_id = id if (max_id.nil? || id < max_id) # max_id should descend\n yielder << tweet\n end\n\n # TODO catch RateLimitExceeded exception\n\n break if results.size < expected_count # this can happen if optional params are passed in...\n\n max_id -= 1 # subtract 1 from max_id to avoid redundant messages\n end\n end\n end", "def popularity_counter(user_id)\n likes_counter = 0\n events = Event.all.where(user_id: user_id)\n events.each do |event| \n likes_counter += event.likes.count\n end\n likes_counter\n end", "def count_getted_like\n user = User.find_by id: self.id\n reviews = user.reviews\n total = 0\n reviews.each do |review|\n total += review.count_like\n end\n return total\n end", "def process \n \n #a = Account.oldest_used\n accounts = Account.order(:updated_at).all\n a = accounts.first\n\n tweets, data, self.temp_usernames = [],[],[]\n \n config = {:count => 100, :result_type => \"recent\" }\n config[:since_id] = self.last_tweet_id.to_i unless self.last_tweet_id.nil? \n \n while true\n r = a.tc.search(self.search + \" -rt -http -#ff\", config)\n break if r.results.empty? || tweets.count > MAX_RESULTS_PER_REQUEST\n \n config[:max_id] = r.results.last.id - 1\n tweets += r.results\n puts \"Found... #{tweets.count} tweets in total\"\n end\n \n # raise tweets.map{|t| \"@\" + t.from_user + \": \" + t.text }.to_yaml \n if !tweets.empty? \n\n replies = File.readlines \"vendor/replies/\" + self.responses\n\n our_accounts_list = Account.all.map{|x| x.username}\n blocked_keywords = Keyword.all.map{|x| x.name}\n\n tweets\n .reject { |t| t.text.include? 'http' } \n .reject { |t| our_accounts_list.include? t.from_user } # Reject if are our own accounts\n .reject { |t| t.text.downcase.split(' ').any? {|i| blocked_keywords.include? i } } # Reject blocked keywords\n .reject { |t| self.repeat_user(t.from_user) }\n .each_with_index do |t,i|\n puts \"#{i}. Tweet de @\" + t.from_user\n reply = \"@#{t.from_user} \" + replies[rand(replies.count)]\n\n #check encoding and length\n\n #apply filters\n\n data << SearchesResult.new({\n :account_id => accounts.sample.id, \n :username => t.from_user, \n :tweet => t.text, \n :reply => reply,\n :tweeted_at => t.created_at\n })\n end\n\n self.last_tweet_id = tweets.first.id\n self.save\n\n if !data.empty?\n SearchesResult.import data.reverse\n end\n end\n \n self.save_log tweets.count, data.count, 1\n \n \n data.map{|t| \"@\" + t.username + \": \" + t.tweet}.to_yaml\n end", "def post(number = 1)\n results = twitter_client.search(\"#sad\")\n return unless results.try(:any?)\n results.take(number).each do |tweet|\n twitter_client.favorite(tweet)\n twitter_client.update(\"@#{tweet.user.screen_name} Happiness is the art of never holding in your mind the memory of any unpleasant thing that has passed.\")\n end\n end", "def on_timeline(tweet)\n #don't reply to retweets\n return if tweet.retweeted_status?\n #check if bot can \"pester\" this user\n return unless can_pester?(tweet.user.screen_name)\n\n #see if bot finds the tweet interesting (based off top 100 / top 20 model words)\n tokens = Ebooks::NLP.tokenize(tweet.text)\n interesting = tokens.find { |t| top100.include?(t.downcase) }\n very_interesting = tokens.find_all { |t| top20.include?(t.downcase) }.length > 2\n\n #do various actions depending on how interesting the tweet is\n delay do\n if very_interesting\n favorite(tweet) if rand < 0.5\n retweet(tweet) if rand < 0.1\n if rand < 0.05 #0.01\n userinfo(tweet.user.screen_name).pesters_left -= 1\n reply(tweet, make_response_wrapper(tweet))\n end\n elsif interesting\n favorite(tweet) if rand < 0.05\n if rand < 0.01 #0.001\n userinfo(tweet.user.screen_name).pesters_left -= 1\n reply(tweet, make_response_wrapper(tweet))\n end\n end\n end\n end", "def generate_tweet(text)\n \tTwitter::Tweet.new({id: 1,\n\t\t\t\t\t\tfavorite_count: 0,\n lang: \"en\",\n\t\t\t\t\t\tretweet_count: 0,\n\t\t\t\t\t\tsource: \"@tweeter\",\n\t\t\t\t\t\ttext: text,\n tweet_index: 0,\n user: {\n id: 0,\n screen_name: \"tweeter\"\n }})\n end", "def score(username)\n user = get(\"/v2/identity.json/twitter\", :screenName => username)\n puts user.inspect\n get(\"/v2/user.json/#{user[\"id\"]}/score\")\n end", "def user_tweets(user, count=10, since_id=nil, max_id=nil)\n print \"Getting Last %d Statuses for User %s\" % [count, user.to_s]\n print \" since %s\" % since_id if since_id\n print \" until %s\" % max_id if max_id\n print \"\\n\"\n options = {:count => count, :trim_user => true, :include_rts => true, :include_entities => true}\n options[:since_id] = since_id if since_id\n options[:max_id] = max_id if max_id\n begin\n statuses = @MT.user_timeline(user, options)\n if statuses.size > 0\n status_data = statuses.map do |s|\n {\n :user_id => s.user.id,\n :created_at => s.created_at,\n :id => s.id,\n :text => s.text,\n :source => s.source,\n :truncated => s[\"truncated\"],\n :in_reply_to_user_id => s[\"in_reply_to_user_id\"],\n :in_reply_to_screen_name => s[\"in_reply_to_screen_name\"],\n :geo => s[\"geo\"],\n :coordinates => s[\"coordinates\"],\n :place => parse_place(s[\"place\"]),\n :contributors => s[\"contributors\"],\n :retweet_count => s[\"retweet_count\"],\n :entities => parse_entities(s.attrs[\"entities\"]),\n :retweeted_status => parse_retweeted_status(s[\"retweeted_status\"])\n }\n end\n status_data\n else\n []\n end\n rescue Twitter::Error::Unauthorized, Twitter::Error::Forbidden\n puts \"Failed for %s (Protected)\" % user.to_s\n []\n end\n end", "def getIncomingTweets\n words = ['Zynga','YouTube','Yahoo','Xbox','Windows','Wikipedia','Twitter','Tumblr','Telecoms','Symbian','Oracle','Spotify','Sony','Smartphones','Skype','Samsung','Reddit','Oracle','Nokia','Nintendo','Acer','Acta','Activision','Blizzard','Adobe','Amazon','Android','AOL','Apple','Asus','Bing','Bitcoin','BitTorrent','BlackBerry','Chatroulette','snapchat','Craigslist','Dell','Digg','ebay','Facebook','Firefox','Flickr','Foursquare','gmail','google','groupon','htc','ibm','Instagram','Intel','iPad','iPadmini','iPhone','ipod','iTunes','Kickstarter','Kindle','KindleFire','Kinect','LinkedIn','Linux','Macworld','Megaupload','Microsoft','Mozilla','Myspace','Congress','Obama','Boehner','EricCantor','Biden','Pelosi','Democrats','Republicans','Cruz','Constitution','Federal','Legislature','Senate','Obamacare', 'Acquisition','AMEX','Amortization','Arbitrage','Bank','Bankrupt','Barter','Bear','Beneficiary','Bond','Broker','Brokerage','Bull','Buying','Buyout','Collateral','Commodity','Credit','Debenture','Debit','Debt','Default','Delinquency','Demand','Depository','Depreciation','Depression','Deregulation','Embezzlement','Federal','Fees','Fiscal','Foreclosure','Lendingrate','Leverage','Liability','Lien','Liquidity','Long-term','Lowrisk','Merger','NYSE','OTC','Recession','Regulation','Securities','Takeover','Underwriter']\n TweetStream::Client.new.on_error do |message|\n puts \"Error: #{message.to_s} \"\n end.track('Zynga','YouTube','Yahoo','Xbox','Windows','Wikipedia','Twitter','Tumblr','Telecoms','Symbian','Oracle','Spotify','Sony','Smartphones','Skype','Samsung','Reddit','Oracle','Nokia','Nintendo','Acer','Acta','Activision','Blizzard','Adobe','Amazon','Android','AOL','Apple','Asus','Bing','Bitcoin','BitTorrent','BlackBerry','Chatroulette','snapchat','Craigslist','Dell','Digg','ebay','Facebook','Firefox','Flickr','Foursquare','gmail','google','groupon','htc','ibm','Instagram','Intel','iPad','iPadmini','iPhone','ipod','iTunes','Kickstarter','Kindle','KindleFire','Kinect','LinkedIn','Linux','Macworld','Megaupload','Microsoft','Mozilla','Myspace','Congress','Obama','Boehner','EricCantor','Biden','Pelosi','Democrats','Republicans','Cruz','Constitution','Federal','Legislature','Senate','Obamacare', 'Acquisition','AMEX','Amortization','Arbitrage','Bank','Bankrupt','Barter','Bear','Beneficiary','Bond','Broker','Brokerage','Bull','Buying','Buyout','Collateral','Commodity','Credit','Debenture','Debit','Debt','Default','Delinquency','Demand','Depository','Depreciation','Depression','Deregulation','Embezzlement','Federal','Fees','Fiscal','Foreclosure','Lendingrate','Leverage','Liability','Lien','Liquidity','Long-term','Lowrisk','Merger','NYSE','OTC','Recession','Regulation','Securities','Takeover','Underwriter') do |status|\n if status.text.language.to_s == \"english\" && !status.retweet?\n if words.any? {|word| status.text.include?(word)}\n prep = @conn.prepare(\"INSERT INTO stream(response) VALUES(?)\")\n prep.execute status.text\n prep.close\n end\n end\n end\n end", "def num_ratings \n 5\n end", "def get_tweets(screen_name, num_tweets)\n\t\n\tresult = \"\"\n #Query num_tweets tweets from screen_name and create the HTML\n Twitter.user_timeline(screen_name, {\"count\" => num_tweets}).each do |tweet|\n \tlinkified = linkifyTweet(tweet.text)\n \tresult = result + \"<li class=\\\"tweet\\\">\n <span class=\\\"gentle\\\">#{linkified}</span>\n </li>\"\n end\n return result\nend", "def calculate_rating(query)\n @rating = 0 #initialize page rating\n count = 0\n q_keyword_weight = 0\n p_keyword_weight = 0\n query.keywords.each do |q_keyword|\n q_keyword_weight = MAX_NUM_KEYWORDS - count\n count += 1\n @keywords.each do |p_keyword|\n if p_keyword.downcase == q_keyword.downcase\n p_keyword_weight = MAX_NUM_KEYWORDS - @keywords.index(p_keyword)\n @rating += (q_keyword_weight * p_keyword_weight )\n end\n end\n end\n end", "def todays_auto_tweet_count\n self.twitter_tweets.count\n end", "def publishHashtags\n twitterclient = Twitter::Streaming::Client.new(@opts);\n count = 0\n twitterclient.sample do |object|\n if count < @opts[:limit]\n if object.is_a?(Twitter::Tweet) && object.hashtags?\n hashtags = object.hashtags\n hashtags.each do |ht|\n count += 1\n text = ht.text\n if text.match(/^[\\x20-\\x7E]*$/)\n puts(\"TWEET HASHTAG: #{ht.text}\")\n @server.publish @opts[:channel], ht.text\n end\n end\n end\n else\n twitterclient.close\n puts count\n end\n end\n end", "def compute_user_rate(user)\n user_rate = Hash.new(0)\n user_movies = @data.select { |item| item[0].to_i == user }.each { |item| user_rate[item[1].to_i] = item[2].to_i }\n user_rate\n end", "def create\n \n @tweet = Tweet.new(params[:tweet])\n \n # write stats\n @keywords.each do |word|\n \n if @tweet.text.downcase.include? word then\n \n stat = WordStatistic.where(:word => word, :day => DateTime.now.beginning_of_day..DateTime.now).first\n if stat.nil? then\n new_stat = WordStatistic.new(:word => word, :day => DateTime.now, :freq => 1)\n new_stat.save\n else\n \n stat.freq += 1\n stat.save\n end\n end\n end # keywords\n\n respond_to do |format|\n if @tweet.save\n format.json { render :json => @tweet, :notice => 'Tweet was successfully created.' }\n format.xml { render :xml => @tweet, :status => :created, :location => @tweet }\n else\n format.xml { render :xml => @tweet.errors, :status => :unprocessable_entity }\n end\n end\n end", "def search\n \t@whosaidit = params[:whosaidit]\n \t@query = params[:query]\n\n if params[:enableRT] == true\n @RToption = \"-RT\"\n else\n @RToption = \"\"\n end\n\n \t# user and keyword\n \t# @tweets = $twitter.search(\"to:#{@whosaidit} \"+ @query + \" filter:images\").take(20)\n\n \t# just keyword\n \t# @tweets = $twitter.search(@query + \" filter:images\").take(20)\n\n \t# just user\n \t@tweets = $twitter.search(\"from:#{@whosaidit}\" + \" filter:images \"+\"#{@RToption}\").take(30)\n \n \t# puts @tweets.first.inspect\n \t@twitteranalysis = \"\"\n \trender \"index\"\n end", "def initialize(twitter_user, api=TwitterApi.new, num_favs=20)\n @user_being_crawled = twitter_user\n @api = api\n @retrieved_favs = []\n @stat_keeper = StatKeeper.new\n @num_favs = num_favs\n end", "def recent_tweets(count)\n start(\"/recent/tweets/#{count}\")\n end", "def calculate_rating(user_id,movie_id)\n #user_similarity: {\"user1\"=>{\"user2\"=>similarity, \"user3\" => similarity}, \"user2\"....}\n count = 0;\n rating = 0.0\n user_similarity[user_id.to_i].each do |u,s|\n if (tmp = rating(u.to_i,movie_id.to_i)) != 0\n count += 1\n end\n rating += (tmp * 1.0 * s).round(4)\n end\n return count, rating\n end", "def rate_movie\n \treview = @room_message.message\n \t#TODO perform sentiment analysis on review text\n\t\tauthenticator = Authenticators::IamAuthenticator.new(\n\t\t\tapikey: \"ZnDzX8FfmZu92lPaf_ut1kmzir3S66geHAgYheIQvSkH\"\n\t\t)\n\t\t\n\t\tnatural_language_understanding = NaturalLanguageUnderstandingV1.new(\n\t\t\tversion: \"2019-07-12\",\n\t\t\tauthenticator: authenticator\n\t\t)\n\n\t\tnatural_language_understanding.service_url = \"https://api.us-south.natural-language-understanding.watson.cloud.ibm.com/instances/b63a4323-b4d7-412e-8c11-263319d1b818\"\n\n\t\tresponse = natural_language_understanding.analyze(\n\t\t\ttext: review,\n\t\t\tfeatures: {\n\t\t\t\temotion: {\n\t\t\t\t emotion: true,\n\t\t\t\t sentiment: true,\n\t\t\t\t}\n\t\t\t}\n\t\t)\n\n\t\t#calculate rating\n\t\temotions = response.result[\"emotion\"][\"document\"][\"emotion\"]\n\t\tputs JSON.pretty_generate(emotions)\n\t\t\n\t\tpositive = emotions[\"joy\"] * 1.25\n\t\tnegative = emotions[\"sadness\"] + emotions[\"disgust\"] + emotions[\"anger\"]\n\t\ttotal = positive + negative\n\t\trating = (positive * 10 / total).round(1)\n\t\t\n \t#TODO update user's rating for movie based on sentiment\n \t\n \t#set response message\n \tresponse_msg = \"\"\n \trating_data = \"\"\n \tif(rating >= 8)\n \t\tresponse_msg = \"Sounds like you really loved the movie! \"\n \t\trating_data = \"like\"\n \telsif(rating >= 6)\n \t\tresponse_msg = \"Sounds like you enjoyed the movie! \"\n \t\trating_data = \"like\"\n \telsif(rating >= 4)\n \t\tresponse_msg = \"Sounds like you were neutral on this movie. \"\n \t\trating_data = \"eh\"\n \telsif(rating >= 2)\n \t\tresponse_msg = \"Sounds like you disliked this movie. \"\n \t\trating_data = \"dislike\"\n \telse\n \t\tresponse_msg = \"Sounds like you really disliked this movie. \"\n \t\trating_data = \"dislike\"\n \tend\n \t\n \t\n \t#send response message\n \t@watson_message = RoomMessage.create user:current_user,\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t room: @room,\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t watsonmsg: true,\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t message: response_msg + \" (\" + rating.to_s + \"/10). I'll use this for future recommendations.\", #replace with message based on rating\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t params: @room.params\n\tRoomChannel.broadcast_to @room, @watson_message\n\turl = 'https://api.themoviedb.org/3/movie/'+ current_user.movie_id.to_s + '?api_key=305ae312343163e9a891637b00d624c9&language=en-US'\n\turi = URI(url)\n\tresponse = Net::HTTP.get(uri)\n\tjsonStr = JSON.parse(response)\n movies = Movie.where(movie_id: current_user.movie_id)\n movie = movies.first\n viewings = Viewing.where(user_id: current_user.id, movie_id: current_user.movie_id)\n viewings.first.rating = rating_data\n viewings.first.save\n end", "def get_interest_rank\n \n rank = (self.stories.count * 2) + (self.adding_users.count * 5)\n\n end", "def upvote_count\n self.up_retweet_count\n end", "def get_user_score(user)\n\t\ttotal = 0\n\t\tmy_genres_array = user[:favorite_genres].split(\"|\")\n\n\t\ttotal += self.get_score\n\t\ttotal += self.genre_bonus(my_genres_array)\n\t\ttotal += self.old_movie_bonus(user)\n\t\treturn total\n\tend", "def send_gen weights, status, parsers\n data = {\n :input => {\n :source => \"twitter\",\n :username => status.user.screen_name,\n :displayname => status.user.name,\n :userid => status.user.id_str,\n :url => \"https://twitter.com/#!/\" + status.user.screen_name + \"/status/\" + status.id_str + \"/\",\n :userimgurl => status.user.profile_image_url.gsub(/_normal/, ''),\n :raw_input => status.text,\n :text => text_score[:stripped_text],\n :metadata => nil #fix this\n }, #input\n :weights => weights, #weights\n :sentiment => {\n :text => {\n :total_score => h, #stolen from \"happiness\"\n :positive_score => nil, #fix this\n :negative_score => nil #fix this\n },\n :tweet => {\n :hash_obnoxiousess => status.entities.hashtags.length,\n :retweet => status.retweeted\n },\n :face => {\n :smiling => nil,\n :confidence => nil,\n }\n } #sentiment\n } #data\n payload = Yajl::Encoder.encode(data)\n prefs = TwitterSentiment::Prefs::Defaults.socket\n streamSock = TCPSocket.new(prefs[:host], prefs[:port])\n streamSock.write(payload)\n streamSock.close\n rescue Exception\n pp :warn, \"Failed to send payload across socket.\", :med\n end", "def twitter_search(skeyword, rec_per_page)\n recs_found = 0\n \n Twitter::Search.new(skeyword).per_page(rec_per_page).each do |r|\n #puts r.inspect\n #puts \"@\" + r.from_user + \": \" + r.text\n #puts \"at \" + r.created_at\n #puts \"......................................................................\"\n #puts\n recs_found = recs_found + 1\n end\n recs_found\nend", "def rating(u, m)\n return @trainingSet.allUsersHash[\"#{u}\"][\"#{m}\"].to_i if @trainingSet.allUsersHash[\"#{u}\"][\"#{m}\"] != nil\n return 0\n end", "def favorite_user_tweets\n puts \"Are you sure you want to favorite the most recent tweet of ALL of the unique users of #{@other_user.strip}? Y/N\"\n @decision = gets\n\n case @decision.strip\n when \"Y\"\n @unique_user_ids.each do |followerId|\n begin\n @favorite_user = Twitter.user(followerId)\n if @favorite_user.status.nil?\n puts \"Blank status for #{@favorite_user.screen_name}\"\n next\n else\n Twitter.favorite(@favorite_user.status.id)\n end\n rescue Twitter::Error::TooManyRequests => error\n puts \"Oops, we are rate limited. We will try again at: #{Time.now + error.rate_limit.reset_in + 5}\"\n sleep error.rate_limit.reset_in + 5\n retry\n rescue Twitter::Error::ServiceUnavailable => error\n sleep(10)\n retry\n rescue Twitter::Error::Forbidden => error\n puts \"You already favorited tweet from #{@favorite_user.screen_name}\"\n next\n rescue Twitter::Error::NotFound => error\n puts \"Sorry something went wrong. #{error}\"\n next\n else\n puts \">>> Favorited last tweet of #{@favorite_user.screen_name}.\"\n end\n sleep(1)\n end\n when \"N\"\n puts \"Ok, well that was a waste of time.\"\n else\n puts \"Something went wrong here. Start over.\"\n end\n\nend", "def get_tweet_counts_per_frequency(freq, tweet_name, start_time, end_time)\n \n end", "def get_politician_tweet(client, twitter_handle)\n client.user_timeline(twitter_handle).sample.text\nend", "def tweet!\n TWITTER.update(\"#{title.truncate(75)} - #{tweet_users}\\n\\nhttp://beta.briefideas.org/ideas/#{sha}\")\n self.update_columns(:tweeted => true)\n end", "def get_user_tweets\n @tweets = COLL.find(\n selector = {\"user.id\" => @user[:id]},\n opts={ :sort=>[\"created_at\", Mongo::ASCENDING],\n :fields=>[\"coordinates\",\"user\",\"text\",\"created_at\", \"entities\", \"place\"]\n })\n\n @user[:tweet_count] = @tweets.count\n @tweets.count > 1\n end", "def update_tweets_size\n total = content.length\n tweets = nil\n new_tweets = total / MAX_CHARS + ((total % MAX_CHARS).positive? ? 1 : 0)\n while new_tweets != tweets\n tweets = new_tweets # Tweets count\n pager_size = tweets.to_s.length * 2 + 2 # ' 45/45' --> 6\n real_total = pager_size * tweets + total\n new_tweets = real_total / MAX_CHARS + ((real_total % MAX_CHARS).positive? ? 1 : 0)\n end\n\n @tweet_count = tweets\n @pager_size = tweet_count.to_s.length * 2 + 2 # ' 45/45' --> 6\n end", "def generate_tweet\n raw_tweet = raw['status']\n JsonTweet.new(raw_tweet, twitter_user_id).generate_tweet if raw_tweet\n end", "def hitting_total\n self.rating_19 +\n self.rating_20 +\n self.rating_21 +\n self.rating_22 +\n self.rating_23 +\n self.rating_24 +\n self.rating_25 +\n self.rating_26 +\n self.rating_27\n end", "def index\r\n @users = User.where.not(id: current_user&.id)\r\n @tweet = Tweet.new\r\n @tweets = Tweet.all.page(params[:page])\r\n\r\n \r\n if params[:q]\r\n @tweets = Tweet.where('content LIKE ?', \"%#{params[:q]}%\").page(params[:page])\r\n if @tweets.nil?\r\n @tweets = Tweet.all.page(params[:page])\r\n end\r\n else\r\n @tweets = Tweet.all.page(params[:page])\r\n end\r\n \r\n #SCOPE comentado para evitar conflicto con buscador\r\n if signed_in?\r\n @tweets = Tweet.tweets_for_me(current_user).page(params[:page])\r\n else\r\n @tweets = Tweet.all.order(\"created_at DESC\").page(params[:page])\r\n end\r\n\r\n if params[:tweetsearch].present?\r\n @tweets = Tweet.search_my_tweets(params[:tweetsearch]).page(params[:page]).order(\"created_at DESC\")\r\n elsif params[:hashtag].present?\r\n @tweets = Tweet.search_my_tweets(\"##{params[:hashtag]}\").page(params[:page]).order(\"created_at DESC\")\r\n end\r\n\r\n end", "def tweets_count\n @_tweets_count ||= tweets.count\n end", "def adjust_weight(user)\n profiles = find_recipe_profiles(user)\n weighted_user_tastes =[]\n user_taste_hash = Hash.new\n user_taste_hash[:bitter] =0\n user_taste_hash[:earthy] =0\n user_taste_hash[:grassy] =0\n user_taste_hash[:licorice] = 0\n user_taste_hash[:nutty] = 0\n user_taste_hash[:peppery] = 0\n user_taste_hash[:sour] =0\n user_taste_hash[:spicy] = 0\n user_taste_hash[:sweet] = 0\n user_taste_hash[:woody] = 0\n profiles.each do |profile|\n user_taste_hash[:bitter] += profile.bitter\n user_taste_hash[:earthy] += profile.earthy\n user_taste_hash[:grassy] += profile.grassy\n user_taste_hash[:licorice] += profile.licorice\n user_taste_hash[:nutty] += profile.nutty\n user_taste_hash[:peppery] += profile.peppery\n user_taste_hash[:sour] += profile.sour\n user_taste_hash[:spicy] += profile.spicy\n user_taste_hash[:sweet] += profile.sweet\n user_taste_hash[:woody] += profile.woody\n end\n return user_taste_hash\n end", "def index\n @users = User.all\n\n set_up_twitter\n\n @users.each do |user|\n tweets = @client.user_timeline(user.twitter_id, count: 5)\n user.last_tweet = tweets.first.full_text\n end\n end", "def find_tweets(current_user)\n @screen_name = current_user.authentications[2].to_s\n @another_tweet = self.twitter.user_timeline(@screen_name)\n @tweet = Tweets.new\n @another_tweet.each do |t|\n @tweet.screenname = t.screen_name\n @tweet.text = t.text\n @tweet.created_at = t.created_at\n end\n @tweet.save\n end", "def generate_tweet(game)\n tweet = game.win_lose == \"W\" ? \"YES. \" + game.score : \"NO. \" + game.score\n\n tweet.concat(\". didmichiganstatewin.com\")\n return tweet\nend", "def main_object()\n sample_text = open(\"raw_combo.txt\").read()\n generator = TwitterMarkov.new sample_text\n random_txt = generator.generate()\n print random_txt\n tweet_post(random_txt)\nend", "def user_average_rating(user)\n #av = promedio (avarage), counter = contador(para calcular el total de reviews realizada)\n av, counter = 0.0, 0.0\n \n Review.where(user_id: user.id).each_with_index do |review, i|\n if review.rating\n av = av + review.rating\n counter = counter + 1.0\n end\n end\n\n av / counter\n end", "def tweet_new_tweet(tweet)\n #setup twitter client\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = $consumer_key\n config.consumer_secret = $consumer_secret\n config.access_token = $access_token\n config.access_token_secret = $access_token_secret\n end\n\n $log.debug(tweet)\n client.update(tweet)\n $log.info(\"Successfully tweeted!\")\nend", "def tweet\n\treturn \"Tweet Tweet Twitter\"\nend", "def search_tweets(hashtag, limit=nil)\n response = @api_client.get(URI::SEARCH_TWEETS_URI, { q: hashtag })\n parse(response[\"statuses\"], Tweet, limit)\n end", "def userfilter\n @tweets = Tweet.where(\"user_vote < 0 or user_vote > 0\").includes(:company).page params[:page]\n @count = Tweet.where(\"user_vote < 0 or user_vote > 0\").count\n end", "def index\n @tweets = Tweet.all\n @user = current_user\n @recent_tweets = Tweet.order(created_at: :desc).limit(10)\n @pop_tweets = Tweet.order(likes_count: :desc).limit(10)\n @tweet = Tweet.new\n #@users # 基於測試規格,必須講定變數名稱,請用此變數中存放關注人數 Top 10 的使用者資料\n end", "def tweet\r\n\treturn \"tweet tweet tweet\"\r\n\tend", "def tweet(text = \"\", id = rand(1..1000))\n double(\n attrs: { \"user\" => { \"id\" => id } },\n text: text\n )\nend", "def popularity(id, item)\n\t if item == \"course\"\n\t tweets = Tweet.find_all_by_course_id(id).count\n\t if UrlData.find_by_course_id(id).nil?\n\t links = 0\n\t else\n\t links = UrlData.find_by_course_id(id).moz_backlinks.to_f + UrlData.find_by_course_id(id).google_backlinks.to_f\n\t end\n\t elsif item == \"tutorial\"\n\t tweets = Tweet.find_all_by_tutorial_id(id).count\n\t if UrlData.find_by_tutorial_id(id).nil?\n\t links = 0\n\t else\n\t links = UrlData.find_by_tutorial_id(id).moz_backlinks.to_f + UrlData.find_by_tutorial_id(id).google_backlinks.to_f\n\t end\n\t elsif item == \"book\"\n\t tweets = Tweet.find_all_by_book_id(id).count\n\t if UrlData.find_by_book_id(id).nil?\n\t links = 0\n\t else\n\t links = UrlData.find_by_book_id(id).moz_backlinks.to_f + UrlData.find_by_book_id(id).google_backlinks.to_f\n\t end\n\n\t popularity = tweets + links\n\t popularity = popularity.to_i\n\t return popularity\n\t end\n\tend", "def twitter_user_data\n\t\t# IT WOULD BE NICE TO RE-FACTOR THIS SO IT IS THE SAME current_user as for other stats display...\n\t\t@twitter_graph = Authorization.where(\"user_id = ?\", current_user).where(\"provider = ?\", \"twitter\")\n\t\t@twitter_graph_user = TwitterUser.where(\"uid = ?\", @twitter_graph.first['uid'])\n\t\tdata_by_day = @twitter_graph_user.total_grouped_by_date(2.weeks.ago)\n\t\t#twitter_index_by_day = IvolveIndex.twitter_grouped_by_day(2.weeks.ago)\n\t\t(2.weeks.ago.to_date..Time.zone.today).map do |date|\n\t\t\tif !data_by_day[date].nil?\n\t\t\t\tcreated_at = date\n\t\t\t\tfriends_count = data_by_day[date].first.try(:friends_int_count)\n\t\t\t\tfollowers_count = data_by_day[date].first.try(:followers_int_count)\n\t\t\t\ttweets_count = data_by_day[date].first.try(:tweet_int_count)\n\t\t\t\tfavd_count = data_by_day[date].first.try(:favorite_int_count)\n\t\t\t\tlist_count = data_by_day[date].first.try(:listed_int_count)\n\t\t\telse\n\t\t\t\tcreated_at = date\n\t\t\t\tfriends_count = 0\n\t\t\t\tfollowers_count = 0\n\t\t\t\ttweets_count = 0\n\t\t\t\tfavd_count = 0\n\t\t\t\tlist_count = 0\n\t\t\tend\n\n\t\t\t{\n\t\t\t\tcreated_at: date,\n\t\t\t\tnum_friends: friends_count,\n\t\t\t\t#index_friends: twitter_index_friends,\n\t\t\t\tnum_followers: followers_count,\n\t\t\t\t#index_followers: twitter_index_followers,\n\t\t\t\ttweets_sent: tweets_count,\n\t\t\t\t#index_sent: twitter_index_sent,\n\t\t\t\ttweets_favd: favd_count,\n\t\t\t\t#index_favd: twitter_index_favd,\n\t\t\t\tnum_lists: list_count,\n\t\t\t\t#index_lists: twitter_index_lists,\n\t\t\t}\n\t\tend\n\tend", "def tweet(user, tweet_text)\n\t\tname = user.handle\n\t\ttweet = user.tweet(tweet_text)\n\t\t#Updates the global tweet list, the list of tweets by username, and the list of tweets by username and username's followers\n\t\tupdate_timeline_cache_tweets(tweet, name)\n\t\tupdate_cache_personal_tweet_list(tweet, name)\n\t\tupdate_global_cache_tweets(tweet, name)\n\tend", "def summary(user=nil)\n \t\traise RuntimeError, 'user not set!' if user.nil? && @username.nil?\n \t\tuser = @username if user.nil?\n\n \t\tAPI.get_wordcount(user)\n \tend", "def rating(u,m)\n\t\ttraining_set.each do |row|\n\t\t\tif row[\"movie_id\"] == m && row[\"user_id\"] == u \n\t\t\t\treturn row[\"rating\"]\n\t\t\tend\n\t\tend\n\t\treturn 0\n\tend", "def most_used_hashtags\n # my_tags = self.hashtags.each do |hashtag|\n # hashtag.posts.select do |post|\n # post.user_id == self \n # end\n # end \n my_tags = []\n self.posts.each do |post|\n my_tags << post.hashtags\n end\n flattened = my_tags.flatten\n tallied = Hash[flattened.group_by{|x|x}.map{|x,y|[x,y.size]}]\n # sorted.each do |hashtag|\n # # need to associate hashtag w it's count\n \n # # gives number of times hashtag appears in sorted list\n # sorted.find_all[hashtag].count \n # end\n tallies_sorted = tallied.sort_by{|x,y| y}.reverse\n my_most = tallies_sorted[0..4]\n most_used = my_most.map do |array|\n array[0]\n end\n most_used\n end", "def scan_user_scores\n\n def apply_function(voting_user, admin_client, user_client='')\n # @user_count += 1\n scan_users_score(user_client, voting_user, @target_post, @target_polls, @poll_url, update_type=@update_type,\n do_live_updates=@do_live_updates)\n end\n\n if @target_groups\n @target_groups.each do |group_plug|\n apply_to_group_users(group_plug, needs_user_client=true, skip_staged_user=true)\n end\n else\n apply_to_all_users\n end\n\nend", "def tweet\n return \"Arrrr matey\"\n end", "def like_tweet(tweet)\n Like.new(tweet: tweet, user: self)\n end", "def perform\n tweets = load_tweets\n tweets.each do |t|\n t.hashtags.each do |h|\n Trend.create(hashtags: h.text, created_at: Time.now)\n end\n end\n end", "def calculate_tar\n (Smoke.by_user(self.id).sum(:counted) * cigaret_tar).convert_to('milligram')\n .to_i\n .round(2)\n end", "def ratings_sum\nend", "def favorite_tweets\n puts \"Do you want to favorite all of the tweets from the query? The query '#{@query.strip}' has #{@tweets.size} tweets. Y/N\"\n @decision = gets\n @tweets.each do |tweet|\n begin\n Twitter.favorite(tweet.id)\n rescue Twitter::Error::TooManyRequests => error\n puts \"Oops, we are rate limited. We will try again at: #{Time.now + error.rate_limit.reset_in + 5}\"\n sleep error.rate_limit.reset_in + 5\n retry\n rescue Twitter::Error::ServiceUnavailable => error\n sleep(10)\n retry\n rescue Twitter::Error::Forbidden => error\n puts \"You already favorited tweet from #{tweet.user.screen_name}\"\n next\n rescue Twitter::Error::NotFound => error\n puts \"Sorry something went wrong. #{error}\"\n next\n else\n puts \"Favorited '#{tweet.text}' from #{tweet.user.screen_name}\"\n end\n sleep(1)\n end\nend", "def add_weiner_twitter_feeds\n\tWeiner.get.each do |twitter_results|\n\n\tend\nend", "def user_tweets(user_id)\n twitter.user_timeline(user_id)\n end", "def latest_tweets\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = ENV[\"TWITTER_CONSUMER_KEY\"]\n config.consumer_secret = ENV[\"TWITTER_CONSUMER_SECRET\"]\n end\n\n count = params[:count] || 10\n time_line = client.user_timeline(current_user.twitter_handle, {count: count})\n current_user.update(time_fetched: current_user.time_fetched+1)\n if time_line.class == Twitter::Error::NotFound\n render json: {status: 400, success: false, message: 'Twitter handle or id not valid'}\n else\n render json: {status: 200, success: true, message: 'Success', data: time_line.map{|a| a.text}.as_json}\n end\n\n rescue => e\n Rails.logger.error \"account_controller#latest_tweets - Error: #{e.message}\"\n render json: {status: 500, success: false, message: 'Unexpected error'}\n end", "def baserunning_total\n self.rating_15 + \n self.rating_16 +\n self.rating_17 +\n self.rating_18\n end", "def score(username)\n begin\n @data = self.class.get(\"?twitter_screen_name=#{username}&api_key=#{@api_key}\", verify: false)\n result = @data ? JSON.parse(@data.body) : nil\n result['peerindex'] if result\n rescue Timeout::Error\n nil\n end\n\t\tend", "def user_rating(user_id, year = Time.zone.now.year)\n return 0 unless (user = User.find(user_id)) && user.subscribed?(year)\n index = users_species_count(year).find_index { |user| user.id == user_id }\n index ? index + 1 : 0\n end", "def search_for_mbti\n # search for tweets cotaining #MBTI, #mbti, or 'mbti'\n # save them to DB if the request is valid\n hashtag_res = client.search('#mbti', result_type: 'mixed', count: 100, lang: 'en')\n hashtag_res.take(5).each { |tweet| puts \"#{tweet.user.screen_name}: #{tweet.text}\" }\n save_tweets_to_db(hashtag_res)\n # text_res = client.search('mbti', result_type: 'mixed', count: 100, lang: 'en')\n # text_res.take(5).each { |tweet| puts \"#{tweet.user.screen_name}: #{tweet.text}\" }\n\n #save tweets to DB and save last_tweet_id as max_id so can poll later\n # self.last_tweet_id = hashtag_res.first.id.to_s # || Tweet.last.t_id_str\n end", "def rating(u, m)\n rating = 0\n file = open(@training)\n file.each_line do |line|\n attrs = line.split\n uid = attrs[0].to_i\n mid = attrs[1].to_i\n if uid == u && mid == m\n return attrs[2].to_i\n end\n end\n return rating\n end", "def init_tweets(tweeter)\n all_tweets = Twitter.user_timeline(tweeter.user, :trim_user => true, :count => 200, :include_rts => true)\n tweeter.latest_tweet = all_tweets.first.id\n tweeter.twit_id = all_tweets.first.user.id\n page = 2\n\n until all_tweets.empty?\n for item in all_tweets do\n Tweet.new(:data => item, :city_id => self.id, :user => tweeter.id, ).save\n end\n all_tweets = Twitter.user_timeline(tweeter.user, :trim_user => true, :count => 200, :include_rts => true, :page => page)\n page += 1\n end\n\n end", "def scan\n # Ensure we have valid settings\n unless self.username.nil? || self.username == \"\"\n # Grab Twitter statuses as xml\n doc = Hpricot(Net::HTTP.get(URI.parse(\"http://twitter.com/statuses/user_timeline/#{self.username}.xml\")))\n statuses = (doc/\"statuses\"/\"status\")\n # Loop through statuses\n statuses.each do |status|\n # Ensure it's unique, and that we don't already have it\n if Tweet.first(:twitter_id => (status/\"id\").first.innerText).nil?\n # Save the new tweet\n tweet = Tweet.new\n tweet.twitter_id = (status/\"id\").first.innerText\n tweet.text = (status/\"text\").first.innerText\n tweet.source = (status/\"source\").first.innerText\n tweet.in_reply_to = ((status/\"in_reply_to\").first.nil? || (status/\"in_reply_to\").first.innerText == \"\") ? nil : (status/\"in_reply_to\").first.innerText\n tweet.username = (status/\"user\"/\"screen_name\").first.innerText\n tweet.published_at = DateTime.parse((status/\"created_at\").first.innerText)\n tweet.created_at = DateTime.now\n tweet.save\n end\n end\n # Set the last scan time on the settings\n self.last_scan_at = DateTime.now\n self.save\n end\n true\n end", "def popularity(movie_id)\n movie_id = movie_id.to_s\n @num_reviewers = @movie_database[movie_id].length.to_f\n @score_time = 0.0\n @temp_rating = 0.0\n \n @weight_users = 0.25\n @weight_rating = 0.25\n @weight_time = 0.50\n \n @movie_database[movie_id].each do |user, rating, time|\n #divided by 2 bil so that \"tim\" in UNIX seconds is less than 1\n @score_time += (time.to_f / 2000000000.0)\n @temp_rating += rating.to_f\n end\n \n @score_rating = (@temp_rating / @num_reviewers) * 20.0\n @score_time = (@score_time / @num_reviewers) * 100\n @score_reviewers = (@num_reviewers / @total_users) * 100.0\n \n @final_score = ( @weight_users * @score_reviewers + @weight_rating * @score_rating + @weight_time * @score_time)\n \n return @final_score \n end", "def swagger \n critiq_rating + like_rating\n end", "def crawl users_to_crawl = @seed, infinity: false\n user = users_to_crawl.to_a.sample\n twitter_catcher_main_block do\n crawl_user( user )\n users_to_crawl = @sn.users_to_crawl if infinity\n crawl( users_to_crawl.delete( user ) ) if users_to_crawl.size > 0\n end\n end", "def generate_tweet(value)\n\tr = Random.new(value)\n\n\ttweet = \"#{value}.\"\n\n\tif r.rand(36) <= 1\n\t\tcase r.rand(4).to_i\n\t\twhen 0\n\t\t\ttweet << aesthetic_statement(r)\n\t\twhen 1\n\t\t\ttweet << \" Only #{33554432 - $client_twitter.user.statuses_count} pictures \"\n\t\t\tcase r.rand(2).to_i\n\t\t\twhen 0\n\t\t\t\ttweet << \" left.\"\n\t\t\telse\n\t\t\t\ttweet << \" to go.\"\n\t\t\tend\n\t\twhen 2\n\t\t\ttweet << question_statement(r)\n\t\telse\n\t\t\ttweet << random_statement(r)\n\t\tend\n\tend\n\n\treturn tweet;\nend", "def tweet\n\t\treturn \"AHHP! Pretty bird!\"\n\tend", "def index\n @likes = Like.where(tweet_id: params[:tweet_id])\n @tweets = Tweet.paginate(page: params[:page], per_page: 10)\n end", "def like_hello\n @client.search(\"#{@hashtbonjour}\", result_type: \"recent\").take(25).collect do |tweet|\n @client.favorite(tweet)\n end\n end", "def user_topic_share_count(user_id, topic_neo_id)\n #Rails.cache.fetch(\"neo4j-#{user_id}-#{topic_id}-share_count\", :expires_in => 1.day) do\n count = 0\n query = \"\n START n=node(#{topic_neo_id})\n MATCH n-[:pull*0..20]->x<-[r:talking]-y\n WHERE y.uuid = '#{user_id}'\n RETURN r.shares\n \"\n data = Neo4j.neo.execute_query(query)\n ids = []\n if data && data['data']\n data['data'].each do |d|\n ids += d[0]\n end\n count = ids.uniq.length\n end\n count\n #end\n end", "def _hashtag_reference_ranking(text, profile)\n hashtag_references = text.split(WORD_DELIMITER).find_all do |word|\n word.match(/^#/)\n end\n \n return 100 if hashtag_references.size == 0\n\n hashtag_references.inject(0) do |ranking, hashtag|\n ranking + (profile.hashtag_mentions.has_key?(hashtag) ? (100 / hashtag_references.size) : 0)\n end\n end", "def rate(rating)\n @nb_ratings += 1\n @sum_ratings += rating\n @average_rating = @sum_ratings / @nb_ratings\n end", "def user_count; end", "def average_rating(rideshare)\n # set variables for total rating and total sum\n total_rating = {}\n sum = 0\n # loop through\n rideshare.each do |driver, trips|\n trips.each do |trip|\n # calculate total rating \n sum += trip[:rating]\n avg_rating = sum / trips.length.to_f\n total_rating[driver] = avg_rating\n end \n sum = 0\n end\n return total_rating\nend", "def webscrape_possible(hashtag_tweet)\n\t\tif tweet_contains_author?(hashtag_tweet) && tweet_contains_book_title?(hashtag_tweet)\n\t\t @author_match = hashtag_tweet.match(AUTHOR)[2].strip\n\t\t @book_title_match=hashtag_tweet.match(BOOK_TITLE)[1].gsub(\".\",\"\").strip \n \t\tend\n\tend", "def index\n\t\t@tweets = current_user.tweets\n\tend", "def index\n signin_apikey\n if params[:orderby] != nil\n if params[:orderby] == \"newest\"\n @tweets = Tweet.all.order(\"created_at DESC\")\n elsif params[:orderby] == \"past\"\n @tweets = Tweet.all.order(\"created_at ASC\")\n elsif params[:orderby] == \"ask\"\n @tweets = Tweet.where({ ask: true })\n elsif params[:orderby] == \"url\"\n @tweets = Tweet.where({ ask: false })\n else \n @tweets = Tweet.all\n end\n else\n if params[:user_id] != nil\n if params[:voted] == \"true\"\n puts params[:user_id]\n puts session[:user_id]\n if params[:user_id] == session[:user_id].to_s\n puts \"entro a dins if user_id=session_id\"\n @tweets = []\n @liked = Vote.where(idUser: params[:user_id], tipus: \"contribution\")\n @liked.each do |vote|\n @tweet =Tweet.where(id: vote.idType)\n if @tweet != nil\n @tweets.push(@tweet)\n end\n end\n else\n puts \"entro else\"\n msg = \"You can't look at the contributions voted by another user\"\n respond_to do |format|\n format.html { redirect_to '/tweets' }\n format.json { render json: msg.to_json , status: 403, location: @tweet }\n end\n return\n end\n else\n @author = User.find(params[:user_id])\n @tweets = Tweet.where(author: @author.username)\n end\n else\n @tweets = Tweet.all\n end\n end\n render :json => @tweets.to_json\n end", "def run\n super\n require 'twitter'\n\n # Initialize a Twitter search\n search = Twitter::Search.new\n\n search.containing(\"#{@object.fname} #{@object.lname}\").result_type(\"recent\").per_page(10).each do |r|\n #puts \"#{r.from_user}: #{r.text}\"\n Fact.create :user_id => @object.id, :text => \"#{r.from_user}: #{r.text}\"\n end\n\n # Enough about\n search.clear\n\n\tnil\nend" ]
[ "0.68224704", "0.6513439", "0.62277913", "0.6095222", "0.6057707", "0.60108143", "0.59993434", "0.5982066", "0.59727305", "0.5964091", "0.59188235", "0.5901227", "0.5891925", "0.58751523", "0.5863254", "0.5826423", "0.5814737", "0.58095044", "0.5809347", "0.5746908", "0.57029545", "0.57016003", "0.5701444", "0.5692261", "0.56846106", "0.56619084", "0.5657306", "0.56356347", "0.5630461", "0.55935216", "0.55924416", "0.5579417", "0.55775917", "0.55665416", "0.556642", "0.5543188", "0.55355483", "0.5526115", "0.5483113", "0.5481034", "0.5477888", "0.54765487", "0.54756516", "0.5474757", "0.5470991", "0.5469741", "0.54574263", "0.5447619", "0.5417179", "0.54117185", "0.5404459", "0.53958625", "0.5392955", "0.53815925", "0.5378414", "0.5368852", "0.53669983", "0.5364244", "0.5363976", "0.5360808", "0.5358635", "0.5353654", "0.5351671", "0.53512305", "0.5336543", "0.5332169", "0.5330785", "0.53306913", "0.5329643", "0.53243977", "0.5322258", "0.5321364", "0.5318838", "0.53151363", "0.53115064", "0.5306757", "0.5306711", "0.52976173", "0.5297098", "0.5294417", "0.5291968", "0.5290788", "0.5288664", "0.52875906", "0.52805173", "0.5270886", "0.52683353", "0.5267911", "0.52646804", "0.52614725", "0.52539444", "0.52515227", "0.52512753", "0.5247309", "0.5246149", "0.5241678", "0.5241085", "0.52378905", "0.5236664", "0.52326655" ]
0.7060241
0
accepts single string or array of strings (short_name, e.g. "DEF")
def position(position) where(positions: { short_name: position }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def short=(value)\n raise ArgumentError, _(\"Short names can only be one character.\") if value.to_s.length != 1\n @short = value.to_s\n end", "def short_name\n @short_name ||= name.to_s.split('').shift\n end", "def convert_short_name\n self.short_name = self.short_name.parameterize\n true # So the save doesn't give up?\n end", "def in_all_strings?(long_strings, short_string)\nend", "def short_name\n \"#{first_name} #{last_name[0, 1]}\"\n end", "def full_names(names = [])\nend", "def short_name\n short.to_s.sub(/^(-.).*$/, \"\\\\1\")\n end", "def canonical_short_name\n if respond_to?(:short_name)\n short_name\n elsif respond_to?(:name)\n name\n elsif respond_to?(:title)\n title\n end\n end", "def shortname\n attributes['shortName']\n end", "def short_name(how_short = 55)\n\t\tstr = self.name\n\t\tshortname = (str.length > how_short) ? (str[0..how_short] + \"...\") : str\n\t\treturn shortname\n\tend", "def short_name\n if abbreviation.nil? then\n return name\n else\n return abbreviation\n end\n end", "def shortname=(value)\n @shortname = value.nil? ? nil : value.to_s\n end", "def name\n short_code\n end", "def short_name\n if segments.empty?\n ''\n elsif segments.length == 1\n segments[0]\n else\n segments[1..-1].join(SEPARATOR)\n end\n end", "def to_s\n short || name[0]\n end", "def shortname\n name.downcase.gsub(/[^a-z]/, \"-\")\n end", "def full_name(*args)\n args.join(\" \")\n end", "def aliases\n myAliases = \"\"\n if ['Mount ',' Mountain',' Peak'].any? {|word| self.name.include?(word)}\n short = shortname\n myAliases = \"#{short} Mountain, Mount #{short}, Mt. #{short}, Mt #{short}, #{shortname} mt, #{shortname} mtn, #{short} mtn., #{short} Peak\" \n end\n myAliases\n end", "def shortname\n name.downcase.gsub(/[^a-z]/, \"\")\n end", "def rest_name\n short_name.downcase\n end", "def input_name(arr, multi = false, index = name)\n s = @name_prefix.blank? ? arr.to_s : \"#{@name_prefix}[#{arr}]\"\n s << \"[#{index}]\" if index\n s << \"[]\" if multi\n s\n end", "def two_word_name; end", "def shortname\n @shortname.nil? ? @name : @shortname\n end", "def test_string_argument\n\t\tc = Check.new\n\t\tassert c.check_arguments([1,'1',1])\n\tend", "def option_parser_short_name\n [ short_prefix, short_name ].join('')\n end", "def to_param\n short_name.present? ? short_name : super\n end", "def get_short_name\n sname = description.split(/trofeo|meeting/i)\n if sname.length > 1\n # Remove spaces, split in tokens, delete empty tokens and take just the first 3, joined together:\n (sname[1].strip.split(/\\s|\\,/).delete_if { |item| item == '' })[0..2].join(' ')\n else\n # Just use the name if it wasn't \"splittable\":\n sname[0]\n end\n end", "def short_name\n short = name[0..30]\n if name.length > 30\n short += '...'\n end\n short\n end", "def concat_strings(short, long)\n short + long + short\nend", "def shortName\n self.short_name\n end", "def short_name(str)\n res = str.scan(/\\w+/).map { |w| w[0,1] }.join(\"\")\n res.empty? ? \"a\" : res\n end", "def short_type_str\n SHORT_MARKETPLACEAPP_TYPES[type_str]\n end", "def human_name(*args)\n #defined by default_for_arg_type in initialize!\n end", "def short_name\r\n return \"#{first_name[0].chr}. #{last_name}\"\r\n end", "def full_names(names = [])\n names.select { |name| name.match /\\w\\s\\w/ }\nend", "def aliases\n short ? [name, short] : [name]\n end", "def short_name \r\n name.gsub(/([A-Z])[^A-Z]+/, '\\1')\r\n end", "def suggested_short_name(language=nil)\n (language && @short_name.find { |name| name.language == language }) || @short_name\n end", "def full_name1(first, last)\n first + \" \" + last\nend", "def short\n # this are short words\n assert PorterStemmer::Porter2.short?(\"bed\")\n assert PorterStemmer::Porter2.short?(\"shed\")\n assert PorterStemmer::Porter2.short?(\"shred\")\n\n # this are not short words\n assert !PorterStemmer::Porter2.short?(\"bead\")\n assert !PorterStemmer::Porter2.short?(\"embed\")\n assert !PorterStemmer::Porter2.short?(\"beds\")\n end", "def strings; end", "def to_param\n short_name\n end", "def short_name\n Category.short_name name\n end", "def expand_name_narrow(names, pattern, suffixes = nil)\n re1 = /\\A#{Regexp.quote(pattern)}/i\n result1 = names.grep(re1)\n return [] if result1.empty?\n return result1 if result1.size == 1\n squeeze_names(result1, pattern, suffixes)\n end", "def my_short_name\n @my_short_name ||= self.class.name.split(\"_\").last\n end", "def list_masters *names\n print names\nend", "def three_word_name; end", "def short_name\n name.size > 35 ? \"#{name[0..35]}...\" : name\n end", "def tags=(string_or_array)\n if string_or_array.kind_of?(Array)\n @tags = string_or_array\n else\n @tags = string_or_array.split(' ').map { |t| t.gsub('_', ' ') }\n end\n end", "def conform_name_to_shortname(name = nil)\n name ||= self.name\n name.to_s.downcase.strip.gsub(/[^a-z0-9]+/, \"-\").gsub(/^-|-$/, \"\")\n end", "def conform_name_to_shortname(name = nil)\n name ||= self.name\n name.to_s.downcase.strip.gsub(/[^a-z0-9]+/, \"-\").gsub(/^-|-$/, \"\")\n end", "def conform_name_to_shortname(name = nil)\n name ||= self.name\n name.to_s.downcase.lstrip.rstrip.gsub(/[^a-z0-9]+/, '-').gsub(/^-|-$/,'')\n end", "def conform_name_to_shortname(name = nil)\n name ||= self.name\n name.to_s.downcase.lstrip.rstrip.gsub(/[^a-z0-9]+/, '-').gsub(/^-|-$/,'')\n end", "def compatible_string(value, label: 'Argument')\n unless value.is_a? String\n raise ArgumentError, \"#{label} must be a String\"\n end\n\n unless value.length >= 2\n raise ArgumentError, \"#{label} must be 2 or more characters long\"\n end\n\n unless value.length < @max_input_length\n raise ArgumentError, \"#{label} must be less than #{@max_input_length} characters long\"\n end\n\n value.downcase\n end", "def in_all_strings?(long_strings, short_string)\n long_strings.all? do |long_string|\n long_string.include?(short_string)\n end\nend", "def short_params\n params.require(:short).permit(:full,:slug)\n end", "def initialize(params={})\n @long_name = params[:long_name]\n @short_name = params[:short_name]\n @types = params[:types]\n end", "def test_multi_stringflag_as_strings\n opts = @p.parse %w(--xyz dog --xyz cat)\n assert_equal true, opts[:xyz_given]\n assert_equal [\"dog\",\"cat\"], opts[:xyz]\n assert_equal [], opts[:abc] # note, multi-args default to empty array\n assert_nil opts[:ghi_given]\n assert_equal [\"gg\",\"hh\"], opts[:ghi]\n end", "def title(name, len=3)\r\n name[0,len]\r\nend", "def validate_string_array(arry)\n if arry.is_a?(Array)\n arry.each do |choice|\n validate( { choice: choice }, { choice: { kind_of: String } } )\n end\n end\n end", "def specification(full_name); end", "def test_get_first_name_returns_name_from_default_array\r\n name_gen = NameGenerator2.new\r\n\r\n fn = name_gen.get_first_name(\"don\")\r\n assert_instance_of(String, fn)\r\n end", "def full_name(first, last) #this does the same thing but can't be stored as a variable\n\tfirst + \" \" + last\nend", "def default_name\n [long_name, short_name].reject(&:empty?).first\n end", "def abbrev_name(name)\n \"#{name[0]}.#{name.split[1][0]}\".upcase\nend", "def short_name\n puts \"Jai shree mahakal\"\n end", "def shortCollectionName(c)\n c.getName.split(',')[0].strip\nend", "def my_pets_name(a)\n a.each do |name|\n if name[0] == \"S\" \n puts \"My name starts with an S for super!\"\n else\n puts \"I'm still pretty special too!\"\n end\n end\nend", "def full_name_2(first_name: first_name, last_name: last_name)\n first_name + \" \" + last_name\nend", "def full_name(first_name, last_name)\n first_name + \" \" + last_name\nend", "def full_name(first_name, last_name)\n first_name + \" \" + last_name\nend", "def string(*strings)\n strings.each(&method(:single_string))\n self\n end", "def add_word!(a_string_param, an_array_param)\n a_string_param << \" rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def use_short_names\n opts = get_options\n opts['uselongnames']=false\n save_file(opts)\n nil\n end", "def full_name(first, last)\n\tfirst + \" \" + last\nend", "def name\n @example.description.scan(/\\((\\w+)\\)/).flatten.first\n rescue\n @example.description\n end", "def simple_name\n self.name.parameterize\n end", "def long_string\n \"#{name}\"\n end", "def long_name\n long.to_s.sub(/^(--.+?)(\\s+|\\=|\\[).*$/, \"\\\\1\")\n end", "def getFullName(arg1=\"Barton\", arg2=\"Joey\")\n \"#{arg1}, #{arg2}\"\nend", "def name_array(name1, name2)\n real_name_array = [name1, name2]\n real_name_array\nend", "def name_parameterized\n parameterize(@name)\n end", "def short_key=(sk)\n if sk =~ /^-?([a-z0-9])$/i\n @short_key = $1.intern\n else\n raise ArgumentError, \"An argument short key must be a single digit or letter\"\n end\n end", "def shortname?\n !@shortname.nil?\n end", "def canonical_long_name\n if respond_to?(:verbose_name)\n verbose_name\n elsif respond_to?(:short_name)\n name\n elsif respond_to?(:description)\n description\n else\n ''\n end\n end", "def input_name_from_type(type); end", "def create_multi_name\n base_name = String.new(Faker::Games::ElderScrolls.creature)\n if base_name.split.size == 1\n adjective = Spicy::Proton.adjective.capitalize\n new_name = base_name.split.unshift(adjective)\n new_name.join(' ')\n else\n return base_name\n end\n end", "def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\n end", "def substring?(long_string, short_string)\n\nend", "def to_s\n short_name\n end", "def human_name=(_arg0); end", "def human_name=(_arg0); end", "def initialize(type, name, options={})\n @type, @name, @options = type, name, options.to_options\n @short_name = (@options.delete(:short) || name).to_sym\n end", "def switch_name\n (long.first || short.first).sub(/\\A-+(?:\\[no-\\])?/, '')\n end", "def full_name(first_name, last_name)\n first_name +\" \"+ last_name\nend", "def human_from_name; end", "def get_short_name\n \"(#{get_scheduled_date}, #{event_order}) #{event_type.i18n_short} #{get_category_type_code} #{gender_type.i18n_short}\"\n end", "def tricky_method_two(a_string_param, an_array_param)\n a_string_param << 'rutabaga' # \"pumpkinsrutabaga\"\n an_array_param = ['pumpkins', 'rutabaga'] # [\"pumpkins\", \"rutabaga\"]\nend", "def ensure_short_name\n # Drop any non-alphanumerics - It is meant to be a _rememberable_\n # and easily inputtable field!\n self.short_name.gsub! /[^a-zA-Z0-9_+\\-]/, ''\n\n # No short name? Duplicated? Just auto-generate a new one\n if short_name.nil? or short_name.blank? or\n ( other = self.class.find_by_short_name(short_name) and\n other.id != self.id )\n # Try to get the first 10 characters of the conference name - And\n # keep adding characters if needed (first from the name, then just\n # '+' signs) if it is not unique.\n #\n # Strip any high characters, as we are cutting the string, and\n # the scissor blade can fall within a wide character, yielding\n # a fugly error\n prepared = name.mb_chars.normalize(:kd).downcase.\n gsub(/\\s/, '_').gsub(/[^\\w]/,'').gsub(/[^\\x00-\\x7F]/n,'').to_s\n cutoff = 10\n short = prepared[0..cutoff]\n while self.class.find_by_short_name(short)\n cutoff += 1\n short << (prepared[cutoff] || '+')\n end\n\n self.short_name = short\n end\n\n # This is called as a validation... but corrects instead of\n # warning. So, our return value should be:\n true\n end", "def short_team_name(team_name)\n temp = team_name.split(' ')\n temp.length == 3 ? temp[0][0] + temp[1][0] + temp[2][0] : temp[0][0] + temp[1][0]\nend", "def short_team_name(team_name)\n temp = team_name.split(' ')\n temp.length == 3 ? temp[0][0] + temp[1][0] + temp[2][0] : temp[0][0] + temp[1][0]\nend" ]
[ "0.62100434", "0.60279834", "0.60020626", "0.58779836", "0.58568823", "0.58365995", "0.5806052", "0.57437354", "0.57418483", "0.5705524", "0.5699493", "0.56346136", "0.55916095", "0.5582249", "0.5560058", "0.5556142", "0.553246", "0.5529869", "0.55294186", "0.55270946", "0.55198526", "0.5518155", "0.5516272", "0.5515347", "0.55143666", "0.54827017", "0.5468702", "0.5456025", "0.5452855", "0.5443758", "0.5431245", "0.5418434", "0.53763163", "0.53737223", "0.53722274", "0.53716564", "0.5370434", "0.5334755", "0.53296995", "0.53291166", "0.5326225", "0.5320849", "0.5320363", "0.53196204", "0.5295227", "0.5294673", "0.52806485", "0.52787036", "0.5276295", "0.52742296", "0.52742296", "0.5266778", "0.5266778", "0.5265258", "0.52548945", "0.52545136", "0.5254077", "0.5253686", "0.5251849", "0.52516633", "0.52430105", "0.5233891", "0.5233828", "0.5228623", "0.52202165", "0.5201979", "0.51906663", "0.5189491", "0.51842636", "0.5182208", "0.5182208", "0.5180583", "0.5173073", "0.51687634", "0.51597667", "0.5151068", "0.5146278", "0.5137654", "0.5136633", "0.5122239", "0.5119608", "0.51035774", "0.5097066", "0.507784", "0.50759506", "0.50758654", "0.50749975", "0.5074847", "0.50725913", "0.50706095", "0.506904", "0.506904", "0.50688773", "0.5066719", "0.5064987", "0.5058751", "0.5056968", "0.50558", "0.50554174", "0.5050075", "0.5050075" ]
0.0
-1
GET /empleadobitacoras/1 GET /empleadobitacoras/1.xml
def show @empleadobitacora = Empleadobitacora.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @empleadobitacora } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @empleadosautorizado = Empleadosautorizado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @empleadosautorizado }\n end\n end", "def download_xml\n\t\turi = URI.parse(\"http://www.esmadrid.com/opendata/tiendas_v1_es.xml\")\n\t\tresponse = Net::HTTP.get_response(uri)\n\t\tcontent = response.body\n\n\t\txml = REXML::Document.new(content)\n\n\t\treturn xml\n\tend", "def show\n @orc_empenho_iten = OrcEmpenhoIten.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @orc_empenho_iten }\n end\n end", "def show\n @estabelecimento = Estabelecimento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estabelecimento }\n end\n end", "def show\n @estatu = Estatu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estatu }\n end\n end", "def index\n @employee_remunerative_concepts = @employee.employee_remunerative_concept.all\n\n respond_to do |format|\n format.html # indexoo.html.erb\n format.xml { render :xml => @employee_remunerative_concepts }\n end\n end", "def index\n @cuentas = Cuenta.all\n\n @cadena = getcuentasxml\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cadena }\n end\n end", "def show\n @estagiarios = Estagiario.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estagiarios }\n end\n end", "def show\n @estacion = Estacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estacion }\n end\n end", "def index\n @estatus = Estatu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @estatus }\n end\n end", "def show\n @empdetail = Empdetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @empdetail }\n end\n end", "def index\n @personas = Persona.where(:empleados_id => nil)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @personas }\n end\n end", "def show\n @estagio = Estagio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estagio }\n end\n end", "def show\n @expedicao = Expedicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expedicao }\n end\n end", "def index\n @entradas = Entrada.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entradas }\n end\n end", "def index\n @feria2010observaciones = Feria2010observacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feria2010observaciones }\n end\n end", "def show\n @ayudastemporal = Ayudastemporal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ayudastemporal }\n end\n end", "def index\n @acres = Acre.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @acres }\n end\n end", "def index\n @employees = $Vendor.employees.scopied.order(\"created_at desc\").page(params[:page]).per(25)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @employees }\n end\n end", "def index\n @aautos = Aauto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @aautos }\n end\n end", "def show\n @cabo_eleitoral = CaboEleitoral.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cabo_eleitoral }\n end\n end", "def show\n @evactivity = Evactivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @evactivity }\n end\n end", "def show\n @empregado = EmpregadoMiddle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @empregado }\n end\n end", "def show\n @estudiante = Estudiante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estudiante }\n end\n end", "def show\n @estudiante = Estudiante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estudiante }\n end\n end", "def index\n @asistencias = Asistencia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @asistencias }\n end\n end", "def show\n @entrada = Entrada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entrada }\n end\n end", "def show\n @entradas = Entrada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entradas }\n end\n end", "def show\n @leilao = Leilao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @leilao }\n end\n end", "def new\n @empleadobitacora = Empleadobitacora.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @empleadobitacora }\n end\n end", "def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end", "def show\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @employee }\n end\n end", "def show\n @tso = Tso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tso.to_xml(:except => [ :created_at, :updated_at ]) }\n end\n end", "def index\n @calendarios_entrega = CalendarioEntrega.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @calendarios_entrega }\n end\n end", "def index\n @ordens = Orden.where(:estado => \"Pendiente por Recolectar\").order(\"created_at DESC\")\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ordens }\n end\n end", "def show\n @relatestagiario = Relatestagiario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @relatestagiario }\n end\n end", "def index\n @descriptor_especificos = DescriptorEspecifico.paginate(:per_page => 20, :page =>params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @descriptor_especificos }\n end\n end", "def index\n @annees = Annee.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @annees }\n end\n end", "def index\n @personals = Personal.all\n\n cadena = getpersonals(@personals)\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => cadena }\n end\n end", "def show\n @calendario_entrega = CalendarioEntrega.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calendario_entrega }\n end\n end", "def show\n\t\t@employee = Employee.find(:all)\n\t\t@loanaccount = Loanaccount.find(params[:id])\n \trespond_to do |format|\t\t\n format.html \n format.xml { render :xml => @loanaccounts }\t\t#Render to XML File\n \tend\n\tend", "def index\n @departamentos = Departamento.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @departamentos }\n end\n end", "def show\n @employeebankmaster = Employeebankmaster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @employeebankmaster }\n end\n end", "def show\n @analisis = Analisis.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @analisis }\n end\n end", "def index\n @paciente = Paciente.find(params[:paciente_id])\n @visitas = @paciente.visitas\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @visitas }\n end\n end", "def index\n @attendances = Attendance.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @attendances }\n end\n end", "def show\n @asistencia = Asistencia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @asistencia }\n end\n end", "def show\n @calidadtiposdocumento = Calidadtiposdocumento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calidadtiposdocumento }\n end\n end", "def index\n @eventos = Evento.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @eventos }\n end\n end", "def index\n @pacientes = Paciente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pacientes }\n end\n end", "def show\n @interventoriasfecha = Interventoriasfecha.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @interventoriasfecha }\n end\n end", "def show\n @reclamacao = Reclamacao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reclamacao }\n end\n end", "def show\n @employeer = Employeer.find(params[:id])\n \n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @employeer }\n end\n end", "def api_xml(path,method=:get,options={})\n xml_message(amee,\"/data\"+path,method,options)\n end", "def index\n debugger\n @receitas = Receita.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @receitas }\n end\n end", "def list\n\t\t@employee = Employee.find(:all)\n\t\t@loanaccounts = Loanaccount.paginate :page => params[:page], :per_page => 10\t#Pagination\n \trespond_to do |format|\t\t\n format.html \n \t\t\tformat.xml { render :xml => @loanaccounts }\t\t#Render to XML File\n \tend\n\tend", "def index\n @activos = Activo.all\n @marcas = Marca.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @activos }\n end\n end", "def index\n @solicitudes = Solicitud.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @solicitudes }\n end\n end", "def show\n @frequencia_orgao = Frequencia::Orgao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb.erb\n format.xml { render :xml => @frequencia_orgao }\n end\n end", "def show\n @feria2010observacion = Feria2010observacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feria2010observacion }\n end\n end", "def index\n @aisles = Aisle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @aisles }\n end\n end", "def show\n @elemento = Elemento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @elemento }\n end\n end", "def index\n @feria2009beneficiarios = Feria2009beneficiario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feria2009beneficiarios }\n end\n end", "def index\n @feria2009calificaciones = Feria2009calificacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feria2009calificaciones }\n end\n end", "def show\n @ficha_tematica = FichaTematica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ficha_tematica }\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 @new_employee_request = NewEmployeeRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @new_employee_request }\n end\n end", "def show\n @estruturaindicebh = Estruturaindicebh.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estruturaindicebh }\n end\n end", "def show\n @especificacao = Especificacao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @especificacao }\n end\n end", "def show\n @estoques = Estoque.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estoques }\n end\n end", "def show\n @employee_activity_rate = EmployeeActivityRate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @employee_activity_rate }\n end\n end", "def show\n @compras_documento = ComprasDocumento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @compras_documento }\n end\n end", "def index\n @corporacion_policiacas = CorporacionPoliciaca.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @corporacion_policiacas }\n end\n end", "def index\n @feria2010beneficiarios = Feria2010beneficiario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feria2010beneficiarios }\n end\n end", "def show\n @consulta = Consulta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @consulta }\n end\n end", "def show\n @consulta = Consulta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @consulta }\n end\n end", "def show\n @consulta = Consulta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @consulta }\n end\n end", "def show\n @aisle = Aisle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aisle }\n end\n end", "def show\n @contratosinterventoria = Contratosinterventoria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contratosinterventoria }\n end\n end", "def consultar\n @usuario = Usuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @usuario }\n end\n end", "def show\n @ordendetalle = Ordendetalle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ordendetalle }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @departamento }\n end\n end", "def show\n @attendance = Attendance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @attendance }\n end\n end", "def show\n @attendance = Attendance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @attendance }\n end\n end", "def show\n @agenciamadre = Agenciamadre.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @agenciamadre }\n end\n end", "def show\n @faixa_de_desconto = FaixaDeDesconto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @faixa_de_desconto }\n end\n end", "def show\n @exalumno = @alumno.exalumno\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @exalumno }\n end\n end", "def show\n @ambito = Ambito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ambito }\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 show\n @orc_ficha = OrcFicha.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @orc_ficha }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @actus }\n end\n end", "def show\n @tipo_de_exercicio = TipoDeExercicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_de_exercicio }\n end\n end", "def show\n @telefono_empresa_cliente = TelefonoEmpresaCliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @telefono_empresa_cliente }\n end\n end", "def disp_xml_rq\n body= File.open(\"public/OTA/OTA_HotelAvailRQ100.xml\").read\n render :xml => body\n end", "def show\n @offlearn = Offlearn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @offlearn }\n end\n end", "def show\n @respuestum = Respuestum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @respuestum }\n end\n end", "def index\n @datos = Dato.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @datos }\n end\n end", "def index\n @available_offs=current_employee.available_offs\n if @available_offs\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @available_offs } \n end\n else\n render :text => \"Error\"\n end\n end", "def show\n @ep = Ep.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ep }\n end\n end", "def show\n @aauto = Aauto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aauto }\n end\n end" ]
[ "0.6690581", "0.650327", "0.64298296", "0.6412495", "0.63517797", "0.63387704", "0.6338752", "0.6316721", "0.6310457", "0.6295037", "0.62946427", "0.6285195", "0.6281537", "0.62468046", "0.6231396", "0.6227623", "0.62251335", "0.62229425", "0.6218563", "0.62143284", "0.6209825", "0.6186666", "0.6180055", "0.6174883", "0.6173444", "0.61644554", "0.6160067", "0.61537445", "0.61365217", "0.61298454", "0.6128825", "0.6124175", "0.61169714", "0.61153513", "0.61062294", "0.61028373", "0.61014193", "0.60961354", "0.6094811", "0.6082791", "0.6076034", "0.6075188", "0.60730404", "0.6060775", "0.6057282", "0.60406", "0.6040247", "0.6027556", "0.6026887", "0.6026333", "0.60251355", "0.5999437", "0.59918505", "0.5991682", "0.59899247", "0.59860164", "0.5985059", "0.59842783", "0.5978176", "0.5969156", "0.59619427", "0.5959817", "0.595808", "0.5953873", "0.5948939", "0.59486526", "0.59471345", "0.59452903", "0.59436363", "0.5942302", "0.5938237", "0.5935867", "0.59346026", "0.59301376", "0.59284854", "0.59284854", "0.59284854", "0.5925084", "0.5922643", "0.59197557", "0.5919408", "0.5916123", "0.591342", "0.591342", "0.5913407", "0.5911286", "0.5910116", "0.590707", "0.5906023", "0.5900784", "0.5900281", "0.5900207", "0.5899128", "0.58968437", "0.5895096", "0.58950007", "0.5892532", "0.5892263", "0.58908904", "0.5889209" ]
0.7056976
0
GET /empleadobitacoras/new GET /empleadobitacoras/new.xml
def new @empleadobitacora = Empleadobitacora.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @empleadobitacora } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @empleadosautorizado = Empleadosautorizado.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @empleadosautorizado }\n end\n end", "def new\n @estabelecimento = Estabelecimento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estabelecimento }\n end\n end", "def new\n @estacion = Estacion.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estacion }\n end\n end", "def new\n @estatu = Estatu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estatu }\n end\n end", "def new\n @peca = Peca.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @peca }\n end\n end", "def new\n @estagio = Estagio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estagio }\n end\n end", "def new\n @pessoa = Pessoa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pessoa }\n end\n end", "def new\n @pessoa = Pessoa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pessoa }\n end\n end", "def new\n @entrada = Entrada.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entrada }\n end\n end", "def new\n @especificacao = Especificacao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @especificacao }\n end\n end", "def new\n @entradas = Entrada.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entradas }\n end\n end", "def new\n @asistencia = Asistencia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @asistencia }\n end\n end", "def new\n @estagiarios = Estagiario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estagiarios }\n end\n end", "def new\n @new_employee_request = NewEmployeeRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @new_employee_request }\n end\n end", "def new\n @adjunto = Adjunto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @adjunto }\n end\n end", "def new\n @orc_empenho_iten = OrcEmpenhoIten.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @orc_empenho_iten }\n end\n end", "def new\n @tso = Tso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tso }\n end\n end", "def new\n @abonne = Abonne.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @abonne }\n end\n end", "def new\n @estudiante = Estudiante.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estudiante }\n end\n end", "def new\n @elemento = Elemento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @elemento }\n end\n end", "def new\n @expedicao = Expedicao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @expedicao }\n end\n end", "def new\n @relatestagiario = Relatestagiario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @relatestagiario }\n end\n end", "def new\n @aniversario = Aniversario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aniversario }\n end\n end", "def new\n @leilao = Leilao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @leilao }\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 @entidade = Entidade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entidade }\n end\n end", "def new\n @receita = Receita.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @receita }\n end\n end", "def new\n @aauto = Aauto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aauto }\n end\n end", "def new\n @solicitud = Solicitud.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solicitud }\n end\n end", "def new\n @periodista = Periodista.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @periodista }\n end\n end", "def new\n @paciente = Paciente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @paciente }\n end\n end", "def new\n @annee = Annee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @annee }\n end\n end", "def new\n @proceso = Proceso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @proceso }\n end\n end", "def new\n @orc_suplementacao = OrcSuplementacao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @orc_suplementacao }\n end\n end", "def new\n @contratosinterventoria = Contratosinterventoria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contratosinterventoria }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instituto }\n end\n end", "def new\n @alfabe = Alfabe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @alfabe }\n end\n end", "def new\n @empresa = Empresa.new(:cnpj => params[:cnpj])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @empresa }\n end\n end", "def new\n @recurso = Recurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recurso }\n end\n end", "def new\n @remocao = Remocao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @remocao }\n end\n end", "def new\n @employee = Employee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @employee }\n end\n end", "def new\n @employee = Employee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @employee }\n end\n end", "def new\n @aisle = Aisle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aisle }\n end\n end", "def new\n @tpago = Tpago.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tpago }\n end\n end", "def new\n @entidad = Entidad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entidad }\n end\n end", "def new\n @reclamacao = Reclamacao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reclamacao }\n end\n end", "def new\n @ambito = Ambito.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ambito }\n end\n end", "def new\n @ficha_tematica = FichaTematica.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ficha_tematica }\n end\n end", "def new\n @calendario_entrega = CalendarioEntrega.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendario_entrega }\n end\n end", "def new\n @aplicacion = Aplicacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aplicacion }\n end\n end", "def new\n @ep = Ep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ep }\n end\n end", "def new\n @empregado = EmpregadoMiddle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @empregado }\n end\n end", "def new\n @tarefa = Tarefa.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tarefa }\n end\n end", "def new\n @pagamento = Pagamento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pagamento }\n end\n end", "def new\n @evento = Evento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @evento }\n end\n end", "def new\n @estoques = Estoque.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estoques }\n end\n end", "def new\n @aviso = Aviso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aviso }\n end\n end", "def new\n @ponto = Ponto.new\n @t = params[:estagiario_id]\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ponto }\n end\n end", "def new\n @acre = Acre.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @acre }\n end\n end", "def new\n @actividad = Actividad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @actividad }\n end\n end", "def new\n @cuenta = Cuenta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cuenta }\n end\n end", "def new\n @cuenta = Cuenta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cuenta }\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 @persona = Persona.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @persona }\n end\n end", "def new\n @tcliente = Tcliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tcliente }\n end\n end", "def new\n @feria2010observacion = Feria2010observacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feria2010observacion }\n end\n end", "def new\n @persona = Persona.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @persona }\n end\n end", "def new\n @regiaos = Regiao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @regiaos }\n end\n end", "def new\n @evactivity = Evactivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @evactivity }\n end\n end", "def new\n @ponto = Ponto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ponto }\n end\n end", "def new\n @dupa = Dupa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dupa }\n end\n end", "def new\n @tiposproceso = Tiposproceso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tiposproceso }\n end\n end", "def new\n @cuenta = Cuenta.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cuenta }\n end\n end", "def new\n @ayudastemporal = Ayudastemporal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ayudastemporal }\n end\n end", "def new\n @asambleista = Asambleista.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @asambleista }\n end\n end", "def new_nonva_porca_pupazza\n @person= Person.new\n respond_to do |format|\n format.html\n format.xml { render :xml => @person }\n end\n end", "def new\n @consulta = Consulta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @consulta }\n end\n end", "def new\n @consulta = Consulta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @consulta }\n end\n end", "def new\n @atest = Atest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @atest }\n end\n end", "def new\n @lancamento = Lancamento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lancamento }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nomina }\n end\n end", "def new\n @prueba = Prueba.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prueba }\n end\n end", "def new\n @documentoclasificacion = Documentoclasificacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @documentoclasificacion }\n end\n end", "def new\n @vestimenta = Vestimenta.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vestimenta }\n end\n end", "def new\n @tipo_de_exercicio = TipoDeExercicio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_de_exercicio }\n end\n end", "def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end", "def new\n @relatorios = Relatorio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @relatorios }\n end\n end", "def new\n @tipo_de_documento = TipoDeDocumento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_de_documento }\n end\n end", "def new\n @crianca = Crianca.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @crianca }\n end\n end", "def new\n @empdetail = Empdetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @empdetail }\n end\n end", "def new\n @poblacionesespecial = Poblacionesespecial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @poblacionesespecial }\n end\n end", "def new\n @promocao = Promocao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @promocao }\n end\n end", "def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @po }\n end\n end", "def new\n @questao = Questao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @questao }\n end\n end", "def new\n @nossos_servico = NossosServico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nossos_servico }\n end\n end", "def new\n @plantilla = Plantilla.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @plantilla }\n end\n end", "def new\n @tipo_lancamento = TipoLancamento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_lancamento }\n end\n end", "def new\n @nostro = Nostro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nostro }\n end\n end", "def new\n @compras_documento = ComprasDocumento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @compras_documento }\n end\n end", "def new\n @correspondenciasclase = Correspondenciasclase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @correspondenciasclase }\n end\n end" ]
[ "0.7451674", "0.7325657", "0.7292314", "0.7291293", "0.72706664", "0.7242996", "0.71869254", "0.71869254", "0.717484", "0.7161069", "0.71473974", "0.71384805", "0.71382827", "0.71374106", "0.71200883", "0.7095082", "0.7088232", "0.70869154", "0.70827115", "0.70690966", "0.70663154", "0.70648086", "0.706079", "0.7057844", "0.704616", "0.7043262", "0.7042495", "0.7034947", "0.7029141", "0.70228267", "0.7021278", "0.7015776", "0.7014914", "0.70143086", "0.70133406", "0.7001582", "0.6998747", "0.69958574", "0.69927347", "0.698985", "0.6989148", "0.6989148", "0.69697845", "0.69662803", "0.6965323", "0.69597167", "0.6956844", "0.6956538", "0.6943291", "0.69403535", "0.6939506", "0.6938413", "0.69295245", "0.69285727", "0.69276917", "0.6925442", "0.69214225", "0.692088", "0.6919094", "0.69166625", "0.691605", "0.691605", "0.6911503", "0.6911371", "0.6910033", "0.6909688", "0.6909441", "0.6898768", "0.689612", "0.68927586", "0.689254", "0.68904436", "0.6888434", "0.6888077", "0.6887368", "0.6886894", "0.6884586", "0.6884586", "0.68838", "0.68825924", "0.6878718", "0.6873669", "0.68632984", "0.6859676", "0.68581086", "0.6854034", "0.6850099", "0.68462396", "0.6843273", "0.6842886", "0.684239", "0.68414843", "0.6841225", "0.68409675", "0.6840434", "0.6839468", "0.6836859", "0.6836543", "0.6832338", "0.68283844" ]
0.7533226
0
POST /empleadobitacoras POST /empleadobitacoras.xml
def create @empleadobitacora = Empleadobitacora.new(params[:empleadobitacora]) respond_to do |format| if @empleadobitacora.save format.html { redirect_to(@empleadobitacora, :notice => 'Empleadobitacora was successfully created.') } format.xml { render :xml => @empleadobitacora, :status => :created, :location => @empleadobitacora } else format.html { render :action => "new" } format.xml { render :xml => @empleadobitacora.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @empleadosautorizado = Empleadosautorizado.new(params[:empleadosautorizado])\n\n respond_to do |format|\n if @empleadosautorizado.save\n format.html { redirect_to(@empleadosautorizado, :notice => 'Empleadosautorizado was successfully created.') }\n format.xml { render :xml => @empleadosautorizado, :status => :created, :location => @empleadosautorizado }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @empleadosautorizado.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @orc_empenho_iten = OrcEmpenhoIten.new(params[:orc_empenho_iten])\n\n respond_to do |format|\n if @orc_empenho_iten.save\n flash[:notice] = 'SALVO COM SUCESSO.'\n format.html { redirect_to(@orc_empenho_iten) }\n format.xml { render :xml => @orc_empenho_iten, :status => :created, :location => @orc_empenho_iten }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @orc_empenho_iten.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @estabelecimento = Estabelecimento.new(params[:estabelecimento])\n\n respond_to do |format|\n if @estabelecimento.save\n format.html { redirect_to(@estabelecimento, :notice => 'Estabelecimento was successfully created.') }\n format.xml { render :xml => @estabelecimento, :status => :created, :location => @estabelecimento }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estabelecimento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @estatu = Estatu.new(params[:estatu])\n\n respond_to do |format|\n if @estatu.save\n format.html { redirect_to(@estatu, :notice => 'Registro creado correctamente.') }\n format.xml { render :xml => @estatu, :status => :created, :location => @estatu }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estatu.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @expedicao = Expedicao.new(params[:expedicao])\n\n respond_to do |format|\n if @expedicao.save\n flash[:notice] = 'Expedicao was successfully created.'\n format.html { redirect_to(@expedicao) }\n format.xml { render :xml => @expedicao, :status => :created, :location => @expedicao }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @expedicao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @empresa = Empresa.new(params[:empresa])\n\n respond_to do |format|\n if @empresa.save\n liberar_acesso(@empresa)\n\n format.html { redirect_to(@edital, :notice => 'Empresa criada com sucesso!') }\n format.xml { render :xml => @empresa, :status => :created, :location => @empresa }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @empresa.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n cv = ChecklistenVorlage.new({\n objekt_id: cvNode.xpath('objekt_id').text.to_s, \n bezeichner: cvNode.xpath('bezeichner').text.to_s, \n version: cvNode.xpath('version').text.to_s.to_i, \n inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool \n })\n cv.save\n\n cvNode.xpath('checklisten_eintrags/checklisten_eintrag').each do |ceNode|\n ce = ChecklistenEintrag.new({\n checklisten_vorlage_id: cv.id,\n bezeichner: ceNode.xpath('bezeichner').text.to_s,\n was: ceNode.xpath('was').text.to_s,\n wann: ceNode.xpath('wann').text.to_s,\n typ: ceNode.xpath('typ').text.to_s.to_i,\n position: ceNode.xpath('position').text.to_s.to_i\n })\n ce.save\n end\n\n respond_to do |format|\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n end\n end", "def create\n @entradas = Entrada.new(params[:entrada])\n\n respond_to do |format|\n if @entradas.save\n flash[:notice] = 'LANÇAMENTO ENTRADA EFETUADO'\n format.html { redirect_to(homes_path) }\n format.xml { render :xml => @entradas, :status => :created, :location => @entradas }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @entradas.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @resultadoconsultum = Resultadoconsultum.new(resultadoconsultum_params)\n\t\n\n\trequire 'nokogiri'\n\t\n\t@doc = Nokogiri::XML(File.open(\"exemplos/emplo.xml\"))\n\n\tcar_tires = @doc.xpath(\"//firstname\")\n\t\n\tdoc = Nokogiri::XML(File.open(\"emplo.xml\"))\n\tdoc.xpath('firstname').each do\n\t\tcar_tires\n\tend\n\n\t \n respond_to do |format|\n if @resultadoconsultum.save\n format.html { redirect_to @resultadoconsultum, notice: car_tires }\n format.json { render :show, status: :created, location: @resultadoconsultum }\n else\n format.html { render :new }\n format.json { render json: @resultadoconsultum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @estagiarios = Estagiario.new(params[:estagiario])\n\n respond_to do |format|\n if @estagiarios.save\n flash[:notice] = 'ESTAGIÁRIO CADASTRADO COM SUCESSO.'\n format.html { redirect_to(@estagiarios) }\n format.xml { render :xml => @estagiarios, :status => :created, :location => @estagiarios }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estagiarios.errors, :status => :unprocessable_entity }\n end\n end\n end", "def empleado_params\n params.require(:empleado).permit(:nro_legajo, :tipo_documento_id, :nro_documento, :apellido, :nombre, :fecha_alta, :fecha_baja)\n end", "def create\n @selecciones = Seleccion.where(\"cliente_id = ?\",usuario_actual.id)\n @peso_total = Seleccion.peso_total(usuario_actual.id)\n @precio_total = Seleccion.precio_total(usuario_actual.id)\n @tarjetas = usuario_actual.tdc\n \n #Cobro en el banco\n client = Savon::Client.new(\"http://localhost:3001/servicios/wsdl\")\n tdc = Tarjeta.where(\"id = ? AND cliente_id = ?\",params[:orden][:tarjeta_id],usuario_actual.id)\n total_pagar = params[:orden][:total]\n pago = '<Message>\n <Request>\n <numero_tdc>'+tdc.numero+'</numero_tdc>\n <nombre_tarjetahabiente>'+tdc.tarjetahabiente+'</nombre_tarjetahabiente>\n <fecha_vencimiento>'+tdc.mes_vencimiento+'/'+tdc.ano_vencimiento+'</fecha_vencimiento>\n <codigo_seguridad>'+tdc.codigo+'</codigo_seguridad>\n <tipo_tarjeta>'+tdc.tipo+'</tipo_tarjeta>\n <direccion_cobro>'+tdc.direccion+'</direccion_cobro>\n <total_pagar>'+total_pagar+'</total_pagar>\n <cuenta_receptora>'+cuenta_receptora+'</cuenta_receptora>\n </Request>\n </Message>'\n #response = client.request :verificar_pago, body: { \"value\" => pago } \n #if response.success?\n # data = response.to_hash[:verificar_pago_response][:value][:response].first\n # @respuesta = XmlSimple.xml_in(data)\n #end\n\n #NAMESPACE = 'pagotdc'\n #URL = 'http://localhost:8080/'\n #banco = SOAP::RPC::Driver.new(URL, NAMESPACE)\n #banco.add_method('verificar_pago', 'numero_tdc', 'nombre_tarjetahabiente', 'fecha_vencimiento', 'codigo_seguridad', 'tipo_tarjeta', 'direccion_cobro', 'total_pagar', 'cuenta_receptora')\n #\n \n #respuesta = banco.verificar_pago(tdc.numero, tdc.tarjetahabiente, tdc.mes_vencimiento.to_s+'/'+tdc.ano_vencimiento.to_s, tdc.codigo, tdc.tipo, params[:orden][:total], tdc.direccion)\n \n if true #respuesta.ack.eql?(0)\n params[:orden][:cliente_id] = usuario_actual.id\n params[:orden][:total] = Seleccion.precio_total(usuario_actual.id)\n params[:orden][:fecha_entrega] = \"0000-00-00\"\n @orden = Orden.new(params[:orden])\n \n if @orden.save\n @selecciones = Seleccion.where(\"cliente_id = ?\",usuario_actual.id)\n @selecciones.each do |seleccion|\n p = Producto.find(seleccion.producto_id)\n @venta = Venta.new(:producto_id=>p.id, \n :orden_id=>@orden.id,\n :categoria_id=>p.categoria_id, \n :cantidad=>seleccion.cantidad,\n :costo=>p.precio)\n @venta.save\n end\n \n Seleccion.vaciar_carro(usuario_actual.id)\n respond_to do |format|\n format.html { redirect_to ver_ordenes_path, notice: 'Orden generada correctamente.' }\n end\n else\n respond_to do |format|\n format.html { render action: \"new\" }\n end\n end\n else\n respond_to do |format|\n format.html { render action: \"new\", notice: respuesta.mensaje }\n end\n end\n end", "def new\n @empleadobitacora = Empleadobitacora.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @empleadobitacora }\n end\n end", "def create\n @estagio = Estagio.new(params[:estagio])\n\n respond_to do |format|\n if @estagio.save\n flash[:notice] = 'Estagio was successfully created.'\n format.html { redirect_to(@estagio) }\n format.xml { render :xml => @estagio, :status => :created, :location => @estagio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estagio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @cabo_eleitoral = CaboEleitoral.new(params[:cabo_eleitoral])\n @cabo_eleitoral.pessoa = Pessoa.new(params[:pessoa]) \n \n respond_to do |format|\n if @cabo_eleitoral.save\n format.html { redirect_to(@cabo_eleitoral, :notice => ' - Cabo eleitoral cadastrado com sucesso.') }\n format.xml { render :xml => @cabo_eleitoral, :status => :created, :location => @cabo_eleitoral }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cabo_eleitoral.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end", "def create\n @elecapp = Elecapp.new(from: params[:from], to: params[:to], text: params[:text], date: params[:date], ATXid: params[:ATXid], linkId: params[:linkId])\n respond_to do |format|\n if @elecapp.save\n format.html { redirect_to @elecapp, notice: \"saved successfully\"}\n format.json { render json: @elecapp}\n end\n end\n end", "def new\n \n @selecciones = Seleccion.where(\"cliente_id = ?\",usuario_actual.id)\n respond_to do |format|\n unless @selecciones.empty?\n @peso_total = Seleccion.peso_total(usuario_actual.id)\n @precio_total = Seleccion.precio_total(usuario_actual.id)\n @tarjetas = usuario_actual.tdc\n @orden = Orden.new(:direccion_entrega=>usuario_actual.direccion)\n t = Time.now\n fecha = t.strftime(\"%Y-%m-%d\")\n client = Savon::Client.new(\"http://192.168.1.121/DistribuidorFIF/webservices/servicio.php?wsdl\")\n preorden = \"<solicitud_pedido>\n <num_orden>001</num_orden>\n <nombre_comercio>Tukiosquito</nombre_comercio>\n <fecha_solicitud>\"+fecha.to_s+\"</fecha_solicitud>\n <nombre_cliente>\"+usuario_actual.nombre+\" \"+usuario_actual.apellido+\"</nombre_cliente>\n <direccion_comercio>\n <avenida>Sucre</avenida>\n <calle>-</calle>\n <edificio_casa>CC Millenium</edificio_casa>\n <local_apt>C1-15</local_apt>\n <parroquia>Leoncio Martinez</parroquia>\n <municipio>Sucre</municipio>\n <ciudad>Caracas</ciudad>\n <estado>Miranda</estado>\n <pais>Venezuela</pais>\n </direccion_comercio>\n <direccion_destino>\n <avenida>Santa Rosa</avenida>\n <calle>Tierras Rojas</calle>\n <edificio_casa>Villa Magica</edificio_casa>\n <local_apt>69</local_apt>\n <parroquia> </parroquia>\n <municipio>Zamora</municipio>\n <ciudad>Cua</ciudad>\n <estado>Miranda</estado>\n <pais>Venezuela</pais>\n </direccion_destino>\"\n @selecciones.each do |seleccion|\n p = Producto.find(seleccion.producto_id)\n preorden = preorden+\"\n <articulo>\n <id>\"+p.id.to_s+\"</id>\n <descripcion>\"+p.descripcion+\"</descripcion>\n <peso>\"+p.peso.to_s+\"</peso>\n <cantidad>\"+seleccion.cantidad.to_s+\"</cantidad>\n <precio>\"+p.precio.to_s+\"</precio>\n </articulo>\"\n end\n preorden = preorden+\"</solicitud_pedido>\"\n response = client.request :ejemplo, body: { \"value\" => preorden } \n if response.success? \n respuesta = response.to_hash[:ejemplo_response][:return]\n datos = XmlSimple.xml_in(respuesta)\n end\n\n @precio_envio = datos[\"num_orden\"][0]\n #@arreglo = XmlSimple.xml_in('')\n #@xml = XmlSimple.xml_out(@arreglo, { 'RootName' => 'solicitud_pedido' })\n #url = 'http://192.168.1.101/Antonio/tukyosquito/proyecto/servicio/servicio.php'\n #cotizacion = SOAP::RPC::Driver.new(url)\n #cotizacion.add_method('obtener','asd')\n #tdc = Tarjeta.where(\"id = ? AND cliente_id = ?\",params[:orden][:tarjeta_id],usuario_actual.id)\n #@respuesta = cotizacion.obtener('123')\n format.html # new.html.erb\n else\n format.html { redirect_to carrito_path, notice: 'No tiene productos agregados al carro de compras para generar una orden.' }\n end\n end\n end", "def empleado_params\n params.require(:empleado).permit(:codigo, :dni, :nombre, :apellido, :fechaNacimiento, :direccion, :categoria_id, :departamento_id, :antiguedad)\n end", "def etapa_params\n params.require(:etapa).permit(:fase_id, :nm_etapa, :nr_sequencia, :responsavel_id, :obs, :created_by, :updated_by)\n end", "def create\n @adjunto = Adjunto.new(params[:adjunto])\n\n respond_to do |format|\n if @adjunto.save\n format.html { redirect_to(@adjunto, :notice => 'Adjunto was successfully created.') }\n format.xml { render :xml => @adjunto, :status => :created, :location => @adjunto }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @adjunto.errors, :status => :unprocessable_entity }\n end\n end\n end", "def setorden\n @xml = params[:solicitud]\n @arreglo = Orden.validarRemota(@xml)\n if !(@arreglo.nil?)\n # @cliente = Persona.new(@xml[:cliente])\n # @cliente.save\n\n # @tarjeta = @xml[:tarjeta]\n # @tarjeta = TipoPago.new(@tarjeta)\n # @tarjeta.personas_id = @cliente.id\n # @tarjeta.save\n\n # @recoleccion = Direccion.new(@xml[:direccionrecoleccion])\n @entrega = Direccion.new(@xml[:direccionentrega])\n # @recoleccion.save\n @entrega.save\n\n @orden = Orden.new(@xml[:orden])\n @orden.estado = 'Pendiente por recolectar'\n @orden.personas_id= @arreglo[0]\n @orden.save\n\n @paquete = Paquete.new(@xml[:paquete])\n @paquete.ordens_id = @orden.id\n @paquete.personas_id = @arreglo[0]\n @paquete.save\n\n @historico1= Historico.new(:ordens_id => @orden.id, :direccions_id => @arreglo[2], :tipo => 'Recolectada')\n @historico= Historico.new(:ordens_id => @orden.id, :direccions_id => @entrega.id, :tipo => 'Entregada')\n @historico1.save\n @historico.save\n \n @monto = Enviar.montoTotal(@orden.id)\n @iva = (@monto * 0.12).round(2)\n @montototal = @monto + @iva\n Enviar.compania\n @factura = Factura.new(:companias_id => 1, :ordens_id =>@orden.id , :tipo_pagos_id => @arreglo[1] , :costoTotal => @monto ,:iva => @iva)\n @factura.save\n else\n render \"errorxml\"\n end\n end", "def emprego_params\n params.require(:emprego).permit(:titulo, :descricao, :data_inicio, :data_expiracao, :ID_Usuario, :ID_Tipo_de_Emprego)\n end", "def create\n @empleados_empresa = EmpleadosEmpresa.new(empleados_empresa_params)\n @empleados_empresa.status = 0\n\n respond_to do |format|\n if @empleados_empresa.save\n format.html { redirect_to @empleados_empresa, notice: 'Miembro de equipo de trabajo agregado correctamente' }\n format.json { render :show, status: :created, location: @empleados_empresa }\n else\n format.html { render :new }\n format.json { render json: @empleados_empresa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @elemento = Elemento.new(params[:elemento])\n\n respond_to do |format|\n if @elemento.save\n flash[:notice] = 'Elemento was successfully created.'\n format.html { redirect_to(@elemento) }\n format.xml { render :xml => @elemento, :status => :created, :location => @elemento }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @elemento.errors, :status => :unprocessable_entity }\n end\n end\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 @emprestimo = Emprestimo.new(emprestimo_params)\n\n respond_to do |format|\n if @emprestimo.save\n format.html { redirect_to @emprestimo, notice: 'Reserva/Empréstimo foi Adicionado.' }\n format.json { render :show, status: :created, location: @emprestimo }\n else\n format.html { render :new }\n format.json { render json: @emprestimo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @empleado = Empleado.new(empleado_params)\n\n respond_to do |format|\n if @empleado.save\n format.html { redirect_to @empleado, notice: 'Se ha creado un nuevo empleado.' }\n format.json { render :show, status: :created, location: @empleado }\n else\n format.html { render :new }\n format.json { render json: @empleado.errors, status: :unprocessable_entity }\n end\n end\n end", "def empleado_params\n params.require(:empleado).permit(:nombre, :nombre2, :apellido1, :apellido2, :rut, :cargo, :fecha_ingreso, :foto, :comunidad_id)\n end", "def create\n @empleado = Empleado.new(empleado_params)\n\n respond_to do |format|\n if @empleado.save\n format.html { redirect_to @empleado, notice: 'Empleado fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @empleado }\n else\n format.html { render :new }\n format.json { render json: @empleado.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @estudiante = Estudiante.new(params[:estudiante])\n\n respond_to do |format|\n if @estudiante.save\n format.html { redirect_to(@estudiante, :notice => 'Estudiante was successfully created.') }\n format.xml { render :xml => @estudiante, :status => :created, :location => @estudiante }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estudiante.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @empleado_especialidad = EmpleadoEspecialidad.new(empleado_especialidad_params)\n\n respond_to do |format|\n if @empleado_especialidad.save\n format.html { redirect_to @empleado_especialidad, notice: 'Empleado especialidad was successfully created.' }\n format.json { render :show, status: :created, location: @empleado_especialidad }\n else\n format.html { render :new }\n format.json { render json: @empleado_especialidad.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @empleado = Empleado.new(empleado_params)\n\n respond_to do |format|\n if @empleado.save\n format.html { redirect_to empleados_path, notice: 'Registro de Empleado creado.' }\n format.json { render :show, status: :created, location: @empleado }\n else\n format.html { render :new }\n format.json { render json: @empleado.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @emprego = Emprego.new(emprego_params)\n\n respond_to do |format|\n if @emprego.save\n format.html { redirect_to @emprego, notice: 'Emprego was successfully created.' }\n format.json { render action: 'show', status: :created, location: @emprego }\n else\n format.html { render action: 'new' }\n format.json { render json: @emprego.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @estoques = Estoque.new(params[:estoque])\n\n respond_to do |format|\n if @estoques.save\n flash[:notice] = 'ESTOQUE CADASTRADO COM SUCESSO.'\n format.html { redirect_to(@estoques) }\n format.xml { render :xml => @estoques, :status => :created, :location => @estoques }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estoques.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @entrada = Entrada.new(params[:entrada])\n\n respond_to do |format|\n if @entrada.save\n format.html { redirect_to([:mngr, @entrada], :notice => 'Entrada was successfully created.') }\n format.xml { render :xml => @entrada, :status => :created, :location => @entrada }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @entrada.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @estabelecimento = Estabelecimento.new(params[:estabelecimento])\n\n respond_to do |format|\n if @estabelecimento.save\n format.html { redirect_to @estabelecimento, :notice => 'Estabelecimento was successfully created.' }\n format.json { render :json => @estabelecimento, :status => :created, :location => @estabelecimento }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @estabelecimento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @estudiante = Estudiante.new(params[:estudiante])\n\n respond_to do |format|\n if @estudiante.save\n flash[:notice] = 'Creado.'\n format.html { redirect_to(@estudiante) }\n format.xml { render :xml => @estudiante, :status => :created, :location => @estudiante }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estudiante.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @estabelecimento = Estabelecimento.new(estabelecimento_params)\n @usuario = Usuario.find(usuario_params[:id])\n @estabelecimento_usuario = EstabelecimentosUsuario.create(estabelecimento: @estabelecimento, usuario: @usuario, ic_criador: true)\n\n respond_to do |format|\n if @estabelecimento.save\n format.html { redirect_to @estabelecimento, notice: 'Estabelecimento was successfully created.' }\n format.json { render json: @estabelecimento }\n else\n format.html { render :new }\n format.json { render json: @estabelecimento.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @estabelecimento = Estabelecimento.new(params[:estabelecimento])\n\n respond_to do |format|\n if @estabelecimento.save\n format.html { redirect_to @estabelecimento, notice: 'Estabelecimento was successfully created.' }\n format.json { render json: @estabelecimento, status: :created, location: @estabelecimento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estabelecimento.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @especificacao = Especificacao.new(params[:especificacao])\n\n respond_to do |format|\n if @especificacao.save\n flash[:notice] = 'Especificacao was successfully created.'\n format.html { redirect_to(@especificacao) }\n format.xml { render :xml => @especificacao, :status => :created, :location => @especificacao }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @especificacao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @exemplaresproduto = Exemplaresproduto.new(exemplaresproduto_params)\n\n respond_to do |format|\n if @exemplaresproduto.save\n format.html { redirect_to @exemplaresproduto, notice: 'Exemplaresproduto was successfully created.' }\n format.json { render :show, status: :created, location: @exemplaresproduto }\n else\n format.html { render :new }\n format.json { render json: @exemplaresproduto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @empleado = Empleado.find(params[:empleado_id])\n @incidencia_empleado = @empleado.incidencia_empleados.new(incidencia_empleado_params)\n\n respond_to do |format|\n if @incidencia_empleado.save\n format.html { redirect_to [@incidencia_empleado.empleado, @incidencia_empleado], notice: 'La Incidencia fue Asignada correctamente.' }\n format.json { render :show, status: :created, location: @incidencia_empleado }\n else\n format.html { render :new }\n format.json { render json: @incidencia_empleado.errors, status: :unprocessable_entity }\n end\n end\n end", "def appwebexemp_params\n params.require(:appwebexemp).permit(:nome, :id_seq, :endereco, :preco, :email)\n end", "def create_crm_account_from_lead\n doc = Hpricot::XML(request.raw_post)\n doc = doc.to_s.gsub(\"&amp;\",\"&\") \n doc = Hpricot::XML(doc) \n id = parse_xml(doc/:params/'id')\n account_doc = Crm::CrmLeadCrud.generate_xml_for_account(doc) \n @accounts=Crm::CrmLeadCrud.create_account_from_lead(account_doc,id)\n account = @accounts.first if !@accounts.empty?\n if account.errors.empty?\n render:text=>'success'\n else\n respond_to_errors(account.errors)\n end\n end", "def empleado_params\n params.require(:empleado).permit(:documento, :numero, :nombre, :direcion, :lugar, :telefono, :movil, :correo, :usuario, :contrasena, :documento_id)\n end", "def create\n @empregador = Empregador.new(empregador_params)\n\n respond_to do |format|\n if @empregador.save\n format.html { redirect_to empregadors_path, notice: 'O Empregador foi criado com sucesso!.' }\n format.json { render :show, status: :created, location: @empregador }\n else\n format.html { render :new }\n format.json { render json: @empregador.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @empleado = Empleado.new(empleado_params)\n\n respond_to do |format|\n if @empleado.save\n format.html { redirect_to @empleado, notice: 'Empleado was successfully created.' }\n format.json { render action: 'show', status: :created, location: @empleado }\n else\n format.html { render action: 'new' }\n format.json { render json: @empleado.errors, status: :unprocessable_entity }\n end\n end\n end", "def empresario_params\n params.require(:empresario).permit(:municipio, :activo, :modificador, :creador, :descripcion, :nombre, :apellido, :cedula, :sexo, :empresa, :telefono, :celular, :email, :whatsapp, :instagram, :twitter, :facebook, :puntov, :cNombre, :cCel1, :cCel2, :cTel, :cWhatsapp, :cEmail, :picture)\n end", "def new\n @empleadosautorizado = Empleadosautorizado.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @empleadosautorizado }\n end\n end", "def etapa_params\n params.require(:etapa).permit(:nombre, :descripcion, :etapaAnterior)\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(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end", "def create\n @agenciamadre = Agenciamadre.new(params[:agenciamadre])\n\n respond_to do |format|\n if @agenciamadre.save\n format.html { redirect_to(@agenciamadre, :notice => 'Agencia Madre fue creada satisfactoriamente.') }\n format.xml { render :xml => @agenciamadre, :status => :created, :location => @agenciamadre }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @agenciamadre.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @reclamacao = Reclamacao.new(params[:reclamacao])\n\n respond_to do |format|\n if @reclamacao.save\n format.html { redirect_to(@reclamacao, :notice => 'Reclamacao was successfully created.') }\n format.xml { render :xml => @reclamacao, :status => :created, :location => @reclamacao }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @reclamacao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @appoiment = Appoiment.new(params[:appoiment])\n\n respond_to do |format|\n if @appoiment.save\n \n format.xml { render :xml => @appoiment, :status => :created, :location => @appoiment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @appoiment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @step = TaskrequestsStep.find(params[:taskrequests_step_id])\n @absence_request = @step.absence_requests.build(params[:absence_request])\n\n respond_to do |format|\n if @absence_request.save\n format.html { redirect_to taskrequest_process_step_url(@step.taskrequest), :notice => 'Aanvraag Afwezigheid was succesvol verstuurd.' }\n format.xml { render :xml => @absence_request, :status => :created, :location => @absence_request }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @absence_request.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @emp_locacion = EmpLocacion.new(emp_locacion_params)\n\n respond_to do |format|\n if @emp_locacion.save\n format.html { redirect_to @emp_locacion, notice: 'Departamento creado correctamente.' }\n format.json { render :show, status: :created, location: @emp_locacion }\n else\n format.html { render :new }\n format.json { render json: @emp_locacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @supervisor_estagio = SupervisorEstagio.new(params[:supervisor_estagio])\n\n respond_to do |format|\n if @supervisor_estagio.save\n flash[:notice] = 'Supervisor de Estagio cadastrado com sucesso.'\n format.html { redirect_to(@supervisor_estagio) }\n format.xml { render :xml => @supervisor_estagio, :status => :created, :location => @supervisor_estagio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @supervisor_estagio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @telefono_empresa_cliente = TelefonoEmpresaCliente.new(params[:telefono_empresa_cliente])\n\n respond_to do |format|\n if @telefono_empresa_cliente.save\n format.html { redirect_to(@telefono_empresa_cliente, :notice => 'Telefono empresa cliente was successfully created.') }\n format.xml { render :xml => @telefono_empresa_cliente, :status => :created, :location => @telefono_empresa_cliente }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @telefono_empresa_cliente.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @empresas = Empresa.new(empresa_params)\n\n respond_to do |format|\n if @empresas.save\n format.html { redirect_to @empresas, notice: 'Empresa was successfully created.' }\n format.json { render :show, status: :created, location: @empresas }\n else\n format.html { render :new }\n format.json { render json: @empresas.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @abonne = Abonne.new(params[:abonne])\n\n respond_to do |format|\n if @abonne.save\n flash[:notice] = 'Abonne was successfully created.'\n format.html { redirect_to(@abonne) }\n format.xml { render :xml => @abonne, :status => :created, :location => @abonne }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @abonne.errors, :status => :unprocessable_entity }\n end\n end\n end", "def postEntityEmployee( entity_id, title, forename, surname, job_title, description, email, phone_number)\n params = Hash.new\n params['entity_id'] = entity_id\n params['title'] = title\n params['forename'] = forename\n params['surname'] = surname\n params['job_title'] = job_title\n params['description'] = description\n params['email'] = email\n params['phone_number'] = phone_number\n return doCurl(\"post\",\"/entity/employee\",params)\n end", "def create\n @apoio_educacioanl = ApoioEducacioanl.new(apoio_educacioanl_params)\n\n respond_to do |format|\n if @apoio_educacioanl.save\n format.html { redirect_to @apoio_educacioanl, notice: 'Apoio educacioanal foi cadastrado com Sucesso !' }\n format.json { render :show, status: :created, location: @apoio_educacioanl }\n else\n format.html { render :new }\n format.json { render json: @apoio_educacioanl.errors, status: :unprocessable_entity }\n end\n end\n end", "def empresa_params\n params.require(:empresa).permit(:codigo, :nombre, :catfiscal_id, :ctaivacompras, :ctaivaventas)\n end", "def create\n @empleado = Empleado.find(params[:empleado_id])\n @contrato_empleado = @empleado.contrato_empleados.new(contrato_empleado_params)\n\n respond_to do |format|\n if @contrato_empleado.save\n format.html { redirect_to [@contrato_empleado.empleado, @contrato_empleado], notice: 'Contrato Empleado was successfully created.' }\n format.json { render :show, status: :created, location: @contrato_empleado }\n else\n format.html { render :new }\n format.json { render json: @contrato_empleado.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @orc_uni_despesa = OrcUniDespesa.new(params[:orc_uni_despesa])\n\n respond_to do |format|\n if @orc_uni_despesa.save\n flash[:notice] = 'SALVO COM SUCESSO.'\n format.html { redirect_to(@orc_uni_despesa) }\n format.xml { render :xml => @orc_uni_despesa, :status => :created, :location => @orc_uni_despesa }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @orc_uni_despesa.errors, :status => :unprocessable_entity }\n end\n end\n end", "def empresa_params\n params.require(:empresa).permit(:empr_documentoIdentidad, :empr_razonSocial, :empr_nombreCorto, :empr_tipoEmpresa, :empr_sectorEconomico, :empr_docIdentReprLegal, :empr_sitioWeb, :empr_correoElectronico, :empr_otrosDatos, :empr_estadoRegistro)\n end", "def create\n @empdetail = Empdetail.new(params[:empdetail])\n\n respond_to do |format|\n if @empdetail.save\n format.html { redirect_to(@empdetail, :notice => 'Empdetail was successfully created.') }\n format.xml { render :xml => @empdetail, :status => :created, :location => @empdetail }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @empdetail.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @interventoriasfecha = Interventoriasfecha.new(params[:interventoriasfecha])\n\n respond_to do |format|\n if @interventoriasfecha.save\n format.html { redirect_to(@interventoriasfecha, :notice => 'Interventoriasfecha was successfully created.') }\n format.xml { render :xml => @interventoriasfecha, :status => :created, :location => @interventoriasfecha }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @interventoriasfecha.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @andamento_solicitacao_recebida = AndamentoSolicitacaoRecebida.new(andamento_solicitacao_recebida_params)\n\n respond_to do |format|\n if @andamento_solicitacao_recebida.save\n format.html { redirect_to @andamento_solicitacao_recebida, notice: 'Andamento solicitacao recebida was successfully created.' }\n format.json { render :show, status: :created, location: @andamento_solicitacao_recebida }\n else\n format.html { render :new }\n format.json { render json: @andamento_solicitacao_recebida.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n params[:empresa_registrada][:id_estatus] = 5 # NO VALIDADA (SIN PREFIJO)\n params[:empresa_registrada][:id_subestatus] = 2 # NO SOLVENTE\n params[:empresa_registrada][:fecha_inscripcion] = Time.now\n \n # DATOS BASICOS EMPRESA SE LLEVAN A MAYUSCULAS\n\n params[:empresa_registrada][:nombre_empresa] = params[:empresa_registrada][:nombre_empresa].upcase if params[:empresa_registrada][:nombre_empresa]\n params[:empresa_registrada][:nombre_comercial] = params[:empresa_registrada][:nombre_comercial].upcase if params[:empresa_registrada][:nombre_comercial]\n params[:empresa_registrada][:direccion_empresa] = params[:empresa_registrada][:direccion_empresa].upcase if params[:empresa_registrada][:direccion_empresa]\n params[:empresa_registrada][:circunscripcion_judicial] = params[:empresa_registrada][:circunscripcion_judicial].upcase if params[:empresa_registrada][:circunscripcion_judicial]\n params[:empresa_registrada][:rep_legal] = params[:empresa_registrada][:rep_legal].upcase if params[:empresa_registrada][:rep_legal]\n params[:empresa_registrada][:cargo_rep_legal] = params[:empresa_registrada][:cargo_rep_legal].upcase if params[:empresa_registrada][:cargo_rep_legal]\n params[:empresa_registrada][:nacionalidad_responsable_legal] = params[:empresa_registrada][:nacionalidad_responsable_legal].upcase if params[:empresa_registrada][:nacionalidad_responsable_legal]\n params[:empresa_registrada][:domicilio_responsable_legal] = params[:empresa_registrada][:domicilio_responsable_legal].upcase if params[:empresa_registrada][:domicilio_responsable_legal]\n\n\n # DATOS EAN SE LLEVAN A MAYUSCULAS\n\n params[:empresa_registrada][:rep_ean] = params[:empresa_registrada][:rep_ean].upcase if params[:empresa_registrada][:rep_ean]\n params[:empresa_registrada][:rep_ean_cargo] = params[:empresa_registrada][:rep_ean_cargo].upcase if params[:empresa_registrada][:rep_ean_cargo]\n params[:empresa_registrada][:galpon_edificio_quinta] = params[:empresa_registrada][:galpon_edificio_quinta].upcase if params[:empresa_registrada][:galpon_edificio_quinta]\n params[:empresa_registrada][:oficina_apartamento] = params[:empresa_registrada][:oficina_apartamento].upcase if params[:empresa_registrada][:oficina_apartamento]\n params[:empresa_registrada][:avenida_calle] = params[:empresa_registrada][:avenida_calle].upcase if params[:empresa_registrada][:avenida_calle]\n params[:empresa_registrada][:urbanizacion_barrio_sector] = params[:empresa_registrada][:urbanizacion_barrio_sector].upcase if params[:empresa_registrada][:urbanizacion_barrio_sector]\n params[:empresa_registrada][:parroquia_ean] = params[:empresa_registrada][:parroquia_ean].upcase if params[:empresa_registrada][:parroquia_ean]\n params[:empresa_registrada][:punto_ref_ean] = params[:empresa_registrada][:punto_ref_ean].upcase if params[:empresa_registrada][:punto_ref_ean]\n\n\n # DATOS CORREO ELECTRONICO Y SINCRONET SE LLEVAN A MAYUSCULAS\n\n params[:empresa_registrada][:rep_edi] = params[:empresa_registrada][:rep_edi].upcase if params[:empresa_registrada][:rep_edi]\n params[:empresa_registrada][:rep_edi_cargo] = params[:empresa_registrada][:rep_edi_cargo].upcase if params[:empresa_registrada][:rep_edi_cargo]\n params[:empresa_registrada][:galpon_edificio_quinta_sincronet] = params[:empresa_registrada][:galpon_edificio_quinta_sincronet].upcase if params[:empresa_registrada][:galpon_edificio_quinta_sincronet]\n params[:empresa_registrada][:piso_numero_sincronet] = params[:empresa_registrada][:piso_numero_sincronet].upcase if params[:empresa_registrada][:piso_numero_sincronet]\n params[:empresa_registrada][:oficina_apartamento_sincronet] = params[:empresa_registrada][:oficina_apartamento_sincronet].upcase if params[:empresa_registrada][:oficina_apartamento_sincronet]\n params[:empresa_registrada][:avenida_calle_sincronet] = params[:empresa_registrada][:avenida_calle_sincronet].upcase if params[:empresa_registrada][:avenida_calle_sincronet]\n params[:empresa_registrada][:urbanizacion_barrio_sector_sincronet] = params[:empresa_registrada][:urbanizacion_barrio_sector_sincronet].upcase if params[:empresa_registrada][:urbanizacion_barrio_sector_sincronet]\n params[:empresa_registrada][:parroquia_edi] = params[:empresa_registrada][:parroquia_edi].upcase if params[:empresa_registrada][:parroquia_edi]\n params[:empresa_registrada][:punto_ref_edi] = params[:empresa_registrada][:punto_ref_edi].upcase if params[:empresa_registrada][:punto_ref_edi]\n\n \n # DATOS RECURSOS SE LLEVAN A MAYUSCULA \n \n params[:empresa_registrada][:rep_recursos] = params[:empresa_registrada][:rep_recursos].upcase if params[:empresa_registrada][:rep_recursos]\n params[:empresa_registrada][:rep_recursos_cargo] = params[:empresa_registrada][:rep_recursos_cargo].upcase if params[:empresa_registrada][:rep_recursos_cargo]\n\n # DATOS MERCADEO SE LLEVAN A MAYUSCULA\n\n params[:empresa_registrada][:rep_mercadeo] = params[:empresa_registrada][:rep_mercadeo].upcase if params[:empresa_registrada][:rep_mercadeo]\n params[:empresa_registrada][:rep_mercadeo_cargo] = params[:empresa_registrada][:rep_mercadeo_cargo].upcase if params[:empresa_registrada][:rep_mercadeo_cargo]\n \n # Se obtienen los numeros completos\n\n params[:empresa_registrada][:contacto_tlf1_completo] = \"(\"+ params[:empresa_registrada][:cod_contacto_tlf1] + \")\" +\" \"+ params[:empresa_registrada][:contacto_tlf1] if params[:empresa_registrada][:cod_contacto_tlf1] != \"\"\n params[:empresa_registrada][:contacto_tlf2_completo] = \"(\"+ params[:empresa_registrada][:cod_contacto_tlf2] + \")\"+ \" \" + params[:empresa_registrada][:contacto_tlf2] if params[:empresa_registrada][:cod_contacto_tlf2] != \"\"\n params[:empresa_registrada][:contacto_tlf3_completo] =\"(\"+ params[:empresa_registrada][:cod_contacto_tlf3] + \")\" +\" \"+ params[:empresa_registrada][:contacto_tlf3] if params[:empresa_registrada][:cod_contacto_tlf3] != \"\"\n params[:empresa_registrada][:contacto_fax_completo] = \"(\"+params[:empresa_registrada][:cod_contacto_fax] + \")\" +\" \"+ params[:empresa_registrada][:contacto_fax] if params[:empresa_registrada][:cod_contacto_fax] != \"\"\n params[:empresa_registrada][:direccion_ean] = params[:empresa_registrada][:tipo_urbanizacion_barrio_sector] + \" \" + params[:empresa_registrada][:urbanizacion_barrio_sector] + \" \" + params[:empresa_registrada][:tipo_avenida_calle] + \" \" + params[:empresa_registrada][:avenida_calle] + \" \" + params[:empresa_registrada][:tipo_galpon_edificio_quinta] + \" \" + params[:empresa_registrada][:galpon_edificio_quinta] + \" \" + params[:empresa_registrada][:tipo_piso_numero] + \" \" + params[:empresa_registrada][:piso_numero] + \" \" + params[:empresa_registrada][:tipo_oficina_apartamento] + \" \" + params[:empresa_registrada][:oficina_apartamento] \n params[:empresa_registrada][:telefono1_ean_completo] = \"(\"+ params[:empresa_registrada][:cod_tlf1_ean] + \")\" +\" \"+ params[:empresa_registrada][:telefono1_ean] if params[:empresa_registrada][:cod_tlf1_ean] != \"\"\n params[:empresa_registrada][:telefono2_ean_completo] = \"(\"+ params[:empresa_registrada][:cod_tlf2_ean] + \")\" +\" \"+ params[:empresa_registrada][:telefono2_ean] if params[:empresa_registrada][:cod_tlf2_ean] != \"\"\n params[:empresa_registrada][:telefono3_ean_completo] = \"(\"+ params[:empresa_registrada][:cod_tlf3_ean] + \")\" +\" \"+ params[:empresa_registrada][:telefono3_ean] if params[:empresa_registrada][:cod_tlf3_ean] != \"\"\n params[:empresa_registrada][:fax_ean_completo] = \"(\"+ params[:empresa_registrada][:cod_fax_ean] + \")\" +\" \"+ params[:empresa_registrada][:fax_ean] if params[:empresa_registrada][:cod_fax_ean] != \"\" \n\n\n params[:empresa_registrada][:rif_completo] = params[:empresa_registrada][:tipo_rif] + \"-\" + params[:empresa_registrada][:rif]\n\n @empresa_registrada = EmpresaRegistrada.new(params[:empresa_registrada])\n\n\n respond_to do |format|\n if @empresa_registrada.save\n \n # Se registra el evento de quien creo la empresa\n Auditoria.registrar_evento(session[:usuario],\"empresa_registradas\", \"Crear\", Time.now, \"Empresa:#{@empresa_registrada.nombre_empresa} RIF:#{@empresa_registrada.rif}\")\n\n format.html { redirect_to \"/empresa_registradas\", notice: \"Empresa:#{@empresa_registrada.nombre_empresa} RIF:#{@empresa_registrada.rif_completo} registrada satisfactoriamente.\" }\n else\n format.html { render action: \"new\" }\n end\n end\n end", "def create\n @elemento = Elemento.new(elemento_params)\n\n respond_to do |format|\n if @elemento.save\n format.html { redirect_to @elemento, notice: 'Elemento fue creado con exito.' }\n format.json { render :show, status: :created, location: @elemento }\n else\n format.html { render :new }\n format.json { render json: @elemento.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @paciente = Paciente.new(params[:paciente])\n\n respond_to do |format|\n if @paciente.save\n format.html { redirect_to(@paciente, :notice => 'El Paciente se creo exitosamente.') }\n format.xml { render :xml => @paciente, :status => :created, :location => @paciente }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @paciente.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @espacio_deportivo = EspacioDeportivo.new(params[:espacio_deportivo])\n\n respond_to do |format|\n if @espacio_deportivo.save\n format.html { redirect_to root_url, :notice => \"Se hizo correctamente la creacion del espacio deportivo\" }\n format.json { render json: @espacio_deportivo, status: :created, location: @espacio_deportivo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @espacio_deportivo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @plan_quirurgico = PlanQuirurgico.new(plan_quirurgico_params)\n @plan_quirurgico.servicios = params[:servicios]\n @plan_quirurgico.estatus = \"En Proceso\"\n puts params\n puts @plan_quirurgico.examen \n respond_to do |format|\n if @plan_quirurgico.save\n format.html { redirect_to @plan_quirurgico, notice: 'El plan quirurgico fue registrado exitosamente.' }\n format.json { render :show, status: :created, location: @plan_quirurgico }\n else\n format.html { render :new }\n format.json { render json: @plan_quirurgico.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employeebankmaster = Employeebankmaster.new(params[:employeebankmaster])\n\n respond_to do |format|\n if @employeebankmaster.save\n format.html { redirect_to(@employeebankmaster, :notice => 'Employeebankmaster was successfully created.') }\n format.xml { render :xml => @employeebankmaster, :status => :created, :location => @employeebankmaster }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @employeebankmaster.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @tipo_de_exercicio = TipoDeExercicio.new(params[:tipo_de_exercicio])\n\n respond_to do |format|\n if @tipo_de_exercicio.save\n flash[:notice] = 'TipoDeExercicio was successfully created.'\n format.html { redirect_to(@tipo_de_exercicio) }\n format.xml { render :xml => @tipo_de_exercicio, :status => :created, :location => @tipo_de_exercicio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tipo_de_exercicio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @emprendedor = Emprendedor.new(params[:emprendedor])\n\n respond_to do |format|\n if @emprendedor.save\n format.html { redirect_to @emprendedor, notice: 'El Emprendedor fue creado con exito.' }\n format.json { render json: @emprendedor, status: :created, location: @emprendedor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @emprendedor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ayudastemporal = Ayudastemporal.new(params[:ayudastemporal])\n\n respond_to do |format|\n if @ayudastemporal.save\n flash[:notice] = 'Ayudastemporal was successfully created.'\n format.html { redirect_to(@ayudastemporal) }\n format.xml { render :xml => @ayudastemporal, :status => :created, :location => @ayudastemporal }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ayudastemporal.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @entidade = Entidade.new(params[:entidade])\n\n respond_to do |format|\n if @entidade.save\n format.html { redirect_to(@entidade, :notice => 'Entidade cadastrado com sucesso.') }\n format.xml { render :xml => @entidade, :status => :created, :location => @entidade }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @entidade.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @empregado = EmpregadoMiddle.new(params[:empregado])\n\n respond_to do |format|\n if @empregado.save\n flash[:notice] = 'EmpregadoMiddle was successfully created.'\n format.html { redirect_to(@empregado) }\n format.xml { render :xml => @empregado, :status => :created, :location => @empregado }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @empregado.errors, :status => :unprocessable_entity }\n end\n end\n end", "def empleado_params\n params.require(:empleado).permit(:nombre, :apellido, :cuit)\n end", "def create\n @solicitudlabexa = Solicitudlabexa.new(params[:solicitudlabexa])\n @solicitudlabexa.usuario_id = @usuario_actual.id\n @solicitudlabexa.asignatura_id = params[:asignatura][:id].to_i unless params[:asignatura].nil?\n @solicitudlabexa.fechasol=Date.today\n @solicitudlabexa.npuestos=params[:npuestos]\n @solicitudlabexa.curso=params[:nivel].to_s == \"0\" ? \"optativa\" : params[:nivel].to_s\n @solicitudlabexa.comentarios=Iconv.conv('ascii//translit//ignore', 'utf-8', params[:comentarios].to_s)\n @solicitudlabexa.horaini=params[:horaini][:comienzo]\n @solicitudlabexa.horafin=params[:horafin][:fin]\n @solicitudlabexa.asignado=false\n \n if params[:fecha]=~ /[0-3]?[0-9]\\-[0-1]?[0-9]\\-[0-9]{4}/\n nfecha=formato_europeo(params[:fecha])\n #nfechaini=params[:fechaini].to_s.split('-')\n #nfechaini=fecha[2]+\"-\"+fecha[1]+\"-\"+fecha[0]\n @solicitudlabexa.fecha=nfecha.to_date\n else\n @solicitudlabexa.fecha=nil\n end\n\n pref=\"\"\n @especiales=Laboratorio.where('especial=?',\"t\").to_a\n for especial in @especiales do\n nombre=especial.ssoo.to_s\n if params[:\"#{nombre}\"].to_s!='in'\n pref+=especial.nombre_lab.to_s+'-'+nombre+'-'+params[:\"#{nombre}\"]+\";\"\n end\n end\n @solicitudlabexa.preferencias=pref\n @solicitudlabexa.tipo=\"P\"\n \n respond_to do |format|\n\n if @solicitudlabexa.save \n CorreoTecnicos::emitesolicitudexamen(@solicitudlabexa,params[:fecha],\"\",\"Nueva \").deliver_later \n @solicitudlabexas = Solicitudlabexa.where(\"usuario_id = ? \",@usuario_actual.id).to_a\n format.html { redirect_to :action => \"index\" }\n format.xml { render :xml => @solicitudlabexas, :status => :created, :location => @solicitudlabexas }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @solicitudlabexas.errors, :status => :unprocessable_entity }\n end\n \n end\n \n end", "def create\n @actividad_tema = ActividadTema.new(actividad_tema_params)\n\n respond_to do |format|\n if @actividad_tema.save\n format.html { redirect_to @actividad_tema, notice: 'Actividad tema was successfully created.' }\n format.json { render :show, status: :created, location: @actividad_tema }\n else\n format.html { render :new }\n format.json { render json: @actividad_tema.errors, status: :unprocessable_entity }\n end\n end\n end", "def empregador_params\n params.require(:empregador).permit(:nome, :cnpj)\n end", "def create\n @etnia = Etnia.new(params[:etnia])\n\n respond_to do |format|\n if @etnia.save\n format.html { redirect_to @etnia, notice: 'Etnia was successfully created.' }\n format.json { render json: @etnia, status: :created, location: @etnia }\n else\n format.html { render action: \"new\" }\n format.json { render json: @etnia.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @abastecimento = Abastecimento.new(abastecimento_params)\n\n respond_to do |format|\n if @abastecimento.save\n format.html { redirect_to abastecimentos_url, notice: 'Abastecimento criado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :new }\n format.json { render json: @abastecimento.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @annee = Annee.new(params[:annee])\n\n respond_to do |format|\n if @annee.save\n #flash[:notice] = 'Année créée'\n format.html { redirect_to(annees_path) }\n format.xml { render :xml => @annee, :status => :created, :location => @annee }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @annee.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @faixa_de_desconto = FaixaDeDesconto.new(params[:faixa_de_desconto])\n\n respond_to do |format|\n if @faixa_de_desconto.save\n flash[:notice] = 'FaixaDeDesconto was successfully created.'\n format.html { redirect_to(@faixa_de_desconto) }\n format.xml { render :xml => @faixa_de_desconto, :status => :created, :location => @faixa_de_desconto }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @faixa_de_desconto.errors, :status => :unprocessable_entity }\n end\n end\n end", "def estudiante_params\n params.require(:estudiante).permit(:carnet, :apellidos, :nombres, :programa, :doble_programa, :doc_identidad, :fecha_nac, :sexo, :ciudad, :celular, :sit_academica, :cred_tomados, :cred_aprobados, :cred_pga, :prom_acum, :cred_transf, :ssc, :email, :cred_sem_actual, :reviso_informacion,:token_celular)\n end", "def create\n @cabasiento = Cabasiento.new(params[:cabasiento])\n\n respond_to do |format|\n if @cabasiento.save\n flash[:notice] = 'Cabasiento was successfully created.'\n format.html { redirect_to(@cabasiento) }\n format.xml { render :xml => @cabasiento, :status => :created, :location => @cabasiento }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cabasiento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @entidad = Entidad.new(params[:entidad])\n\n respond_to do |format|\n if @entidad.save\n format.html { redirect_to(@entidad, :notice => 'Entidad was successfully created.') }\n format.xml { render :xml => @entidad, :status => :created, :location => @entidad }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @entidad.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @observacionactividadadecuacion = Observacionactividadadecuacion.new(observacionactividadadecuacion_params)\n\n respond_to do |format|\n if @observacionactividadadecuacion.save\n format.html { redirect_to @observacionactividadadecuacion, notice: 'Observacionactividadadecuacion was successfully created.' }\n format.json { render :show, status: :created, location: @observacionactividadadecuacion }\n else\n format.html { render :new }\n format.json { render json: @observacionactividadadecuacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee_remunerative_concept = @employee.employee_remunerative_concept.build(params[@employee,:employee_remunerative_concept])\n\n respond_to do |format|\n if @employee_remunerative_concept.save\n format.html { redirect_to([@employee, @employee_remunerative_concept], :notice => 'Employee remunerative concept was successfully created.') }\n format.xml { render :xml => @employee_remunerative_concept, :status => :created, :location => @employee_remunerative_concept }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @employee_remunerative_concept.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @cargo_eleicao = CargoEleicao.new(params[:cargo_eleicao])\n\n respond_to do |format|\n if @cargo_eleicao.save\n format.html { redirect_to @cargo_eleicao, notice: 'Cargo eleicao was successfully created.' }\n format.json { render json: @cargo_eleicao, status: :created, location: @cargo_eleicao }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cargo_eleicao.errors, status: :unprocessable_entity }\n end\n end\n end", "def contrato_empleado_params\n params.require(:contrato_empleado).permit(:empleado_id, :contrato_id, :inicio, :fin)\n end", "def create\n @establecimiento = Establecimiento.new(establecimiento_params)\n\n respond_to do |format|\n if @establecimiento.save\n format.html { redirect_to @establecimiento, notice: 'Establecimiento was successfully created.' }\n format.json { render :show, status: :created, location: @establecimiento }\n else\n format.html { render :new }\n format.json { render json: @establecimiento.errors, status: :unprocessable_entity }\n end\n end\n end", "def emprestimo_params\n params.require(:emprestimo).permit(:user_id, :equipamento_id, :data_inicio, :data_fim, :situacao)\n end", "def create\n @aprov_estabelecimento = AprovEstabelecimento.new(aprov_estabelecimento_params)\n\n respond_to do |format|\n if @aprov_estabelecimento.save\n format.html { redirect_to @aprov_estabelecimento, notice: 'Aprov estabelecimento was successfully created.' }\n format.json { render action: 'show', status: :created, location: @aprov_estabelecimento }\n else\n format.html { render action: 'new' }\n format.json { render json: @aprov_estabelecimento.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6181944", "0.6055266", "0.60118765", "0.59468913", "0.59388566", "0.59319675", "0.59261525", "0.59180355", "0.59166557", "0.5904606", "0.59009385", "0.5896469", "0.5874492", "0.5858113", "0.5833539", "0.5826745", "0.5803622", "0.58018875", "0.57831913", "0.5769799", "0.5765782", "0.57329386", "0.5725542", "0.5718717", "0.5717825", "0.5704519", "0.56969166", "0.56926686", "0.568718", "0.5675824", "0.5673182", "0.5672968", "0.565704", "0.565688", "0.56545293", "0.5649904", "0.5648004", "0.5645289", "0.56407917", "0.5632925", "0.5630038", "0.56254566", "0.5612681", "0.560339", "0.55847514", "0.5583595", "0.55813485", "0.55747944", "0.5568129", "0.55628955", "0.5559772", "0.55586094", "0.5549185", "0.5546628", "0.55414695", "0.5535014", "0.55217344", "0.55194134", "0.5519028", "0.55156165", "0.5512417", "0.551116", "0.5504685", "0.55025285", "0.55011344", "0.54979354", "0.549636", "0.547825", "0.5477689", "0.54750293", "0.5474937", "0.5473311", "0.5467004", "0.5464675", "0.5463023", "0.5462552", "0.5461862", "0.5458306", "0.5457577", "0.54499507", "0.54441583", "0.5440911", "0.5437728", "0.5437117", "0.54344356", "0.54334384", "0.5431803", "0.54235184", "0.5422663", "0.5413372", "0.5404539", "0.5403807", "0.53967917", "0.53890204", "0.53884876", "0.5386835", "0.53855544", "0.53831106", "0.5380427", "0.53680396" ]
0.6678962
0
PUT /empleadobitacoras/1 PUT /empleadobitacoras/1.xml
def update @empleadobitacora = Empleadobitacora.find(params[:id]) respond_to do |format| if @empleadobitacora.update_attributes(params[:empleadobitacora]) format.html { redirect_to(@empleadobitacora, :notice => 'Empleadobitacora was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @empleadobitacora.errors, :status => :unprocessable_entity } end 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 @estagio = Estagio.find(params[:id])\n\n respond_to do |format|\n if @estagio.update_attributes(params[:estagio])\n flash[:notice] = 'Estagio was successfully updated.'\n format.html { redirect_to(@estagio) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estagio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update\n @empleadosautorizado = Empleadosautorizado.find(params[:id])\n\n respond_to do |format|\n if @empleadosautorizado.update_attributes(params[:empleadosautorizado])\n format.html { redirect_to(@empleadosautorizado, :notice => 'Empleadosautorizado was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @empleadosautorizado.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @estabelecimento = Estabelecimento.find(params[:id])\n\n respond_to do |format|\n if @estabelecimento.update_attributes(params[:estabelecimento])\n format.html { redirect_to(@estabelecimento, :notice => 'Estabelecimento was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estabelecimento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @supervisor_estagio = SupervisorEstagio.find(params[:id])\n\n respond_to do |format|\n if @supervisor_estagio.update_attributes(params[:supervisor_estagio])\n flash[:notice] = 'Supervisor de Estagio atualizado com sucesso.'\n format.html { redirect_to(@supervisor_estagio) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @supervisor_estagio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @oase = Oasis.find(params[:id])\n\n respond_to do |format|\n if @oase.update_attributes(params[:oase])\n format.html { redirect_to @oase, notice: 'Oasis was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @oase.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @expedicao = Expedicao.find(params[:id])\n\n respond_to do |format|\n if @expedicao.update_attributes(params[:expedicao])\n flash[:notice] = 'Expedicao was successfully updated.'\n format.html { redirect_to(@expedicao) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expedicao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @orc_suplementacao = OrcSuplementacao.find(params[:id])\n\n respond_to do |format|\n if @orc_suplementacao.update_attributes(params[:orc_suplementacao])\n flash[:notice] = 'SALVO COM SUCESSO.'\n format.html { redirect_to(@orc_suplementacao) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @orc_suplementacao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @estatu = Estatu.find(params[:id])\n\n respond_to do |format|\n if @estatu.update_attributes(params[:estatu])\n format.html { redirect_to(@estatu, :notice => 'Registro actualizado correctamente.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estatu.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @estoques = Estoque.find(params[:id])\n\n respond_to do |format|\n if @estoques.update_attributes(params[:estoque])\n flash[:notice] = 'ESTOQUE SALVO COM SUCESSO.'\n format.html { redirect_to(@estoques) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estoques.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def update\n @orc_ata = OrcAta.find(params[:id])\n\n respond_to do |format|\n if @orc_ata.update_attributes(params[:orc_ata])\n flash[:notice] = 'SALVO COM SUCESSO'\n format.html { redirect_to(@orc_ata) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @orc_ata.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @aauto = Aauto.find(params[:id])\n\n respond_to do |format|\n if @aauto.update_attributes(params[:aauto])\n format.html { redirect_to(@aauto, :notice => 'Aauto was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @aauto.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def update\n @estatuto = Estatuto.find(params[:id])\n\n respond_to do |format|\n if @estatuto.update_attributes(params[:estatuto])\n format.html { redirect_to @estatuto, notice: 'Estatuto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estatuto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to(@employee, :notice => 'Employee was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @employee.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @estagiarios = Estagiario.find(params[:id])\n\n respond_to do |format|\n if @estagiarios.update_attributes(params[:estagiario])\n flash[:notice] = 'ESTAGIÁRIO SALVO COM SUCESSO.'\n format.html { redirect_to(@estagiarios) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estagiarios.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @empdetail = Empdetail.find(params[:id])\n\n respond_to do |format|\n if @empdetail.update_attributes(params[:empdetail])\n format.html { redirect_to(@empdetail, :notice => 'Empdetail was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @empdetail.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end", "def update\n @step = TaskrequestsStep.find(params[:taskrequests_step_id])\n @absence_request = @step.absence_requests.find(params[:id])\n\n respond_to do |format|\n if @absence_request.update_attributes(params[:absence_request])\n format.html { redirect_to(@absence_request, :notice => 'Absence request was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @absence_request.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @estabelecimento = Estabelecimento.find(params[:id])\n\n respond_to do |format|\n if @estabelecimento.update_attributes(params[:estabelecimento])\n format.html { redirect_to @estabelecimento, :notice => 'Estabelecimento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @estabelecimento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @new_employee_request = NewEmployeeRequest.find(params[:id])\n\n respond_to do |format|\n if @new_employee_request.update_attributes(params[:new_employee_request])\n format.html { redirect_to(@new_employee_request, :notice => 'New employee request was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @new_employee_request.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @employee_remunerative_concept = @employee.employee_emunerative_concept.find(params[:id])\n\n respond_to do |format|\n if @employee_remunerative_concept.update_attributes(params[:employee_remunerative_concept])\n format.html { redirect_to([@employee,@employee_remunerative_concept], :notice => 'Employee remunerative concept was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @employee_remunerative_concept.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @estudiante = Estudiante.find(params[:id])\n\n respond_to do |format|\n if @estudiante.update_attributes(params[:estudiante])\n flash[:notice] = 'Actualizado.'\n format.html { redirect_to(@estudiante) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estudiante.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @estabelecimento = Estabelecimento.find(params[:id])\n\n respond_to do |format|\n if @estabelecimento.update_attributes(params[:estabelecimento])\n format.html { redirect_to @estabelecimento, notice: 'Estabelecimento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estabelecimento.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @estudiante = Estudiante.find(params[:id])\n\n respond_to do |format|\n if @estudiante.update_attributes(params[:estudiante])\n format.html { redirect_to(@estudiante, :notice => 'Estudiante was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estudiante.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_de_documento = TipoDeDocumento.find(params[:id])\n\n respond_to do |format|\n if @tipo_de_documento.update_attributes(params[:tipo_de_documento])\n format.html { redirect_to(@tipo_de_documento, :notice => 'Tipo de documento atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_de_documento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ayudastemporal = Ayudastemporal.find(params[:id])\n\n respond_to do |format|\n if @ayudastemporal.update_attributes(params[:ayudastemporal])\n flash[:notice] = 'Ayudastemporal was successfully updated.'\n format.html { redirect_to(@ayudastemporal) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ayudastemporal.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\n respond_to do |format|\n if @solexame.update(solexame_params)\n flash[:notice] = 'Solicitação foi alterada com sucesso.'\n format.html { redirect_to(@solexame) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @solexame.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @elemento = Elemento.find(params[:id])\n\n respond_to do |format|\n if @elemento.update_attributes(params[:elemento])\n flash[:notice] = 'Elemento was successfully updated.'\n format.html { redirect_to(@elemento) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @elemento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @calidadtiposdocumento = Calidadtiposdocumento.find(params[:id])\n\n respond_to do |format|\n if @calidadtiposdocumento.update_attributes(params[:calidadtiposdocumento])\n format.html { redirect_to(@calidadtiposdocumento, :notice => 'Calidadtiposdocumento was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @calidadtiposdocumento.errors, :status => :unprocessable_entity }\n end\n end\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 update\n @cargo_eleicao = CargoEleicao.find(params[:id])\n\n respond_to do |format|\n if @cargo_eleicao.update_attributes(params[:cargo_eleicao])\n format.html { redirect_to @cargo_eleicao, notice: 'Cargo eleicao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cargo_eleicao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @especificacao = Especificacao.find(params[:id])\n\n respond_to do |format|\n if @especificacao.update_attributes(params[:especificacao])\n flash[:notice] = 'Especificacao was successfully updated.'\n format.html { redirect_to(@especificacao) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @especificacao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @cabo_eleitoral = CaboEleitoral.find(params[:id])\n @cabo_eleitoral.pessoa.update_attributes(params[:pessoa]) \n\n respond_to do |format|\n if @cabo_eleitoral.update_attributes(params[:cabo_eleitoral])\n format.html { redirect_to(@cabo_eleitoral, :notice => ' - Dados atualizados com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cabo_eleitoral.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @absence.update(absence_params)\n format.html { redirect_to employee_url(@absence.employee_id), :controller => :employees, notice: \"Absence was successfully updated.\" }\n format.json { render :show, status: :ok, location: @absence }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @absence.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exalumno = @alumno.exalumno\n\n respond_to do |format|\n if @exalumno.update_attributes(params[:exalumno])\n flash[:notice] = \"Los datos del exalumno #{@exalumno.alumno.nombre_completo} se han actualizado.\"\n format.html { redirect_to(@alumno) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @exalumno.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @sofa = Sofa.find(params[:id])\n\n respond_to do |format|\n if @sofa.update_attributes(params[:sofa])\n flash[:notice] = 'Sofa was successfully updated.'\n format.html { redirect_to(@sofa) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sofa.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @frequencia_orgao = Frequencia::Orgao.find(params[:id])\n\n respond_to do |format|\n if @frequencia_orgao.update_attributes(params[:frequencia_orgao])\n format.html { redirect_to(@frequencia_orgao, :notice => 'Orgão atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @frequencia_orgao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ambito = Ambito.find(params[:id])\n\n respond_to do |format|\n if @ambito.update_attributes(params[:ambito])\n format.html { redirect_to(@ambito, :notice => 'Ambito was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ambito.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @aprov_estabelecimento.update(aprov_estabelecimento_params)\n format.html { redirect_to @aprov_estabelecimento, notice: 'Aprov estabelecimento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @aprov_estabelecimento.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @emprestimo.update(emprestimo_params)\n format.html { redirect_to @emprestimo, notice: 'Reserva/Empréstimo foi Atualizado.' }\n format.json { render :show, status: :ok, location: @emprestimo }\n else\n format.html { render :edit }\n format.json { render json: @emprestimo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @coordenador_estagio = CoordenadorEstagio.find(params[:id])\n\n respond_to do |format|\n if @coordenador_estagio.update_attributes(params[:coordenador_estagio])\n format.html { redirect_success(\"Coordenador alterado com sucesso!\",:coordenador_estagio, :index)}\n format.json { head :no_content }\n else\n format.html { redirect_error(\"Erro ao alterar coordenador!\",:coordenador_estagio, :index)}\n format.json { render json: @coordenador_estagio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @empregado = EmpregadoMiddle.find(params[:id])\n\n respond_to do |format|\n if @empregado.update_attributes(params[:empregado])\n flash[:notice] = 'EmpregadoMiddle was successfully updated.'\n format.html { redirect_to(@empregado) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @empregado.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @peca = Peca.find(params[:id])\n\n respond_to do |format|\n if @peca.update_attributes(params[:peca])\n flash[:notice] = 'Peça atualizada com sucesso.'\n format.html { redirect_to(@peca) }\n format.xml { head :ok }\n else\n flash[:notice] = 'O formulário contém erros. Verifique os campos digitados e tente novamente.'\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @peca.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @emprego.update(emprego_params)\n format.html { redirect_to @emprego, notice: 'Emprego was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @emprego.errors, status: :unprocessable_entity }\n end\n end\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 @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 @interventoriasfecha = Interventoriasfecha.find(params[:id])\n\n respond_to do |format|\n if @interventoriasfecha.update_attributes(params[:interventoriasfecha])\n format.html { redirect_to(@interventoriasfecha, :notice => 'Interventoriasfecha was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @interventoriasfecha.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @inventario = Inventario.find(params[:id])\n @foto = @inventario.foto\n \n @service = InventarioService.new(@inventario, @foto)\n respond_to do |format|\n\n if @inventario.update_attributes(params[:inventario],params[:foto_file])\n format.html { redirect_to(@inventario, :notice => 'Inventario was successfully updated.') }\n format.xml { head :ok }\n else\n\t @foto = @service.foto\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inventario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @employeebankmaster = Employeebankmaster.find(params[:id])\n\n respond_to do |format|\n if @employeebankmaster.update_attributes(params[:employeebankmaster])\n format.html { redirect_to(@employeebankmaster, :notice => 'Employeebankmaster was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @employeebankmaster.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @scheduled_employee = ScheduledEmployee.find(params[:id])\n\n respond_to do |format|\n if @scheduled_employee.update_attributes(params[:scheduled_employe])\n format.html { redirect_to @scheduled_employee, notice: 'Scheduled employe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scheduled_employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ficha_tematica = FichaTematica.find(params[:id])\n\n respond_to do |format|\n if @ficha_tematica.update_attributes(params[:ficha_tematica])\n flash[:notice] = 'FichaTematica se ha actualizado con exito.'\n format.html { redirect_to(admin_ficha_tematicas_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ficha_tematica.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @sale = Sale.find(params[:id])\n employment_id = params[:id][:employment_id]\n @sale.employee_id = @sale.employment.employee.id\n \n \n\n respond_to do |format|\n if @sale.update_attributes(params[:sale])\n \n logger.info \"Sale #{@sale.title} updated by #{current_user.email}\"\n \n format.html { redirect_to(sales_path, :notice => 'Sale was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sale.errors, :status => :unprocessable_entity }\n end\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 update\n respond_to do |format|\n if @estabelecimento.update(estabelecimento_params)\n format.html { redirect_to @estabelecimento, notice: 'Estabelecimento was successfully updated.' }\n format.json { render :show, status: :ok, location: @estabelecimento }\n else\n format.html { render :edit }\n format.json { render json: @estabelecimento.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @evento = Evento.find(params[:id])\n respond_to do |format|\n if @evento.update_attributes(params[:evento])\n flash[:notice] = 'Evento was successfully updated.'\n format.html { redirect_to(@evento) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @evento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit_axis2XML(carbon_home,http_port,https_port) \n\n\tFile.open(File.join(carbon_home , 'conf','axis2.xml')) do |config_file|\n\t\t# Open the document and edit the port (axis2.xml)\n\t\tconfig = Document.new(config_file)\n\t\t\n\t\tconfig.root.elements[25].elements[1].text=http_port\n\t\tconfig.root.elements[26].elements[1].text=https_port\n\t\n\t\t\n\t\t# Write the result to a new file.\n\t\tformatter = REXML::Formatters::Default.new\n\t\tFile.open(File.join(carbon_home , 'conf','result_axis2.xml'), 'w') do |result|\n\t\tformatter.write(config, result)\n\t\tend\n\tend \n\tFile.delete(File.join(carbon_home , 'conf','axis2.xml'))\n\tFile.rename( File.join(carbon_home , 'conf','result_axis2.xml'),File.join(carbon_home , 'conf','axis2.xml') )\n\nend", "def update\n @transaction_goods_taxis = Transaction::Goods::Taxe.find(params[:id])\n\n respond_to do |format|\n if @transaction_goods_taxis.update_attributes(params[:transaction_goods_taxis])\n format.html { redirect_to(@transaction_goods_taxis, :notice => 'Taxe was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @transaction_goods_taxis.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @evento = Evento.find(params[:id])\n\n respond_to do |format|\n if @evento.update_attributes(params[:evento])\n format.html { redirect_to(@evento, :notice => 'Evento was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @evento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @calendario_entrega = CalendarioEntrega.find(params[:id])\n\n respond_to do |format|\n if @calendario_entrega.update_attributes(params[:calendario_entrega])\n format.html { redirect_to(@calendario_entrega, :notice => 'Calendario entrega fue modificado exitosamente.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @calendario_entrega.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @frequencia_setor = Frequencia::Setor.find(params[:id])\n\n respond_to do |format|\n if @frequencia_setor.update_attributes(params[:frequencia_setor])\n format.html { redirect_to(@frequencia_setor, :notice => 'Setor atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @frequencia_setor.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 respond_to do |format|\n if @empleado.update(empleado_params)\n format.html { redirect_to @empleado, notice: 'Se ha actualizado el empleado.' }\n format.json { render :show, status: :ok, location: @empleado }\n else\n format.html { render :edit }\n format.json { render json: @empleado.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @leilao = Leilao.find(params[:id])\n\n respond_to do |format|\n if @leilao.update_attributes(params[:leilao])\n flash[:notice] = 'Leilao was successfully updated.'\n format.html { redirect_to(@leilao) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @leilao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @empleado.update(empleado_params)\n format.html { redirect_to @empleado, notice: 'Empleado was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @empleado.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @espacio_deportivo = EspacioDeportivo.find(params[:id])\n\n respond_to do |format|\n if @espacio_deportivo.update_attributes(params[:espacio_deportivo])\n format.html { redirect_to root_url, :notice => \"Se actualizo correctamente el espacio deportivo\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @espacio_deportivo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n connection.put(element_path, to_xml)\n end", "def update\n @evento = Evento.find(params[:id])\n\n respond_to do |format|\n if @evento.update_attributes(params[:evento])\n format.html { redirect_to(@evento, :notice => t('cambio')) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @evento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @contratosinterventoria = Contratosinterventoria.find(params[:id])\n\n respond_to do |format|\n if @contratosinterventoria.update_attributes(params[:contratosinterventoria])\n format.html { redirect_to(@contratosinterventoria, :notice => 'Contratosinterventoria was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contratosinterventoria.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @feria2010observacion = Feria2010observacion.find(params[:id])\n\n respond_to do |format|\n if @feria2010observacion.update_attributes(params[:feria2010observacion])\n format.html { redirect_to(@feria2010observacion, :notice => 'Feria2010observacion was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @feria2010observacion.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @appoiment = Appoiment.find(params[:id])\n\n respond_to do |format|\n if @appoiment.update_attributes(params[:appoiment])\n format.html { redirect_to(@appoiment, :notice => 'Appoiment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @appoiment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_object_xml(object_type, id, xml)\n @client.update_business_object_by_public_id({\n :busObNameOrId => object_type,\n :busObPublicId => id,\n :updateXml => xml\n })\n return last_error\n end", "def update\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.save!\n\n respond_to do |format|\n if @config_xml.update_attributes(params[:config_xml])\n flash[:notice] = 'ConfigXml was successfully updated.'\n format.html { redirect_to(@config_xml) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @config_xml.errors, :status => :unprocessable_entity }\n end\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def update\n @estoque = Estoque.find(params[:id])\n\n respond_to do |format|\n if @estoque.update_attributes(params[:estoque])\n format.html { redirect_to @estoque, notice: 'Estoque was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estoque.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 respond_to do |format|\n if @aga_employee.update(aga_employee_params)\n format.html { redirect_to @aga_employee, notice: 'Aga employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @aga_employee }\n else\n format.html { render :edit }\n format.json { render json: @aga_employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # raise params.to_s\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Работник обновлен.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @empresa_servicio = EmpresaServicio.find(params[:id])\n respond_to do |format|\n if @empresa_servicio.update_attributes(params[:empresa_servicio])\n\n format.html { redirect_to empresa_empresa_servicios_path, notice: \"Los datos del servicio fueron actualizados para la empresa #{@empresa_servicio.empresa.nombre_empresa}\"}\n \n else\n format.html { render action: \"edit\" }\n format.json { render json: @empresa_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @depositocaucion = Depositocaucion.find(params[:id])\n respond_to do |format|\n if @depositocaucion.update_attributes(params[:depositocaucion])\n flash[:notice] = 'Depositocaucion was successfully updated.'\n format.html { redirect_to(@depositocaucion) }\n format.xml { head :ok }\n else \n format.html { render :action => \"edit\" }\n format.xml { render :xml => @depositocaucion.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit_staff(edit_employee)\n employee = Employee.find(edit_employee.id)\n employee.attributes = edit_employee.attributes\n employee.save!\n end", "def update\n doc = Nokogiri::XML(request.body.read)\n bNode = doc.xpath('elwak/benutzer')\n\n @benutzer = Benutzer.find(params[:id])\n \n #Sicherstellen, dass Benutzer synchronisiert wird auch wenn nur Objekt-Zuordnungen anders sind!\n @benutzer.updated_at = DateTime.now \n\n if bNode.xpath('objekt_zuordnungs').length > 0\n @benutzer.setze_objekt_zuordnungen(bNode.xpath('objekt_zuordnungs/objekt_id').map{|oz| oz.text.to_s.to_i})\n end\n if @benutzer.update(benutzer_params(bNode))\n success(nil)\n else\n error(@benutzer.errors)\n end\n end", "def update\n @aniversario = Aniversario.find(params[:id])\n\n respond_to do |format|\n if @aniversario.update_attributes(params[:aniversario])\n format.html { redirect_to(@aniversario, :notice => 'Aniversario was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @aniversario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end", "def update\n respond_to do |format|\n if @aoo_ref.update(aoo_ref_params)\n format.html { redirect_to @aoo_ref, notice: 'Aoo ref was successfully updated.' }\n format.json { render :show, status: :ok, location: @aoo_ref }\n else\n format.html { render :edit }\n format.json { render json: @aoo_ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @aviso = Aviso.find(params[:id])\n\n respond_to do |format|\n if @aviso.update_attributes(params[:aviso])\n format.html { redirect_to(@aviso, :notice => 'Aviso fue modificado exitosamente.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @aviso.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @emprendedor = Emprendedor.find(params[:id])\n\n respond_to do |format|\n if @emprendedor.update_attributes(params[:emprendedor])\n format.html { redirect_to @emprendedor, notice: 'La actualizacion fue exitosa.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @emprendedor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @aisle = Aisle.find(params[:id])\n\n respond_to do |format|\n if @aisle.update_attributes(params[:aisle])\n format.html { redirect_to(@aisle, :notice => 'Aisle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @aisle.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @evactivity = Evactivity.find(params[:id])\n\n respond_to do |format|\n if @evactivity.update_attributes(params[:evactivity])\n flash[:notice] = 'Evactivity was successfully updated.'\n format.html { redirect_to(@evactivity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @evactivity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_should_update_link_via_API_XML\r\n get \"/logout\"\r\n put \"/links/1.xml\", :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response 401\r\n end", "def update\n @iguanasactualizacion = Iguanasactualizacion.find(params[:id])\n\n respond_to do |format|\n if @iguanasactualizacion.update_attributes(params[:iguanasactualizacion])\n format.html { redirect_to(@iguanasactualizacion, :notice => 'Iguanasactualizacion was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @iguanasactualizacion.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @empleado_especialidad.update(empleado_especialidad_params)\n format.html { redirect_to @empleado_especialidad, notice: 'Empleado especialidad was successfully updated.' }\n format.json { render :show, status: :ok, location: @empleado_especialidad }\n else\n format.html { render :edit }\n format.json { render json: @empleado_especialidad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @oyoyo = Oyoyo.find(params[:id])\n\n respond_to do |format|\n if @oyoyo.update_attributes(params[:oyoyo])\n flash[:notice] = 'Oyoyo was successfully updated.'\n format.html { redirect_to(@oyoyo) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @oyoyo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @atest = Atest.find(params[:id])\n\n respond_to do |format|\n if @atest.update_attributes(params[:atest])\n flash[:notice] = 'Atest was successfully updated.'\n format.html { redirect_to(@atest) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @atest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @entidade = Entidade.find(params[:id])\n\n respond_to do |format|\n if @entidade.update_attributes(params[:entidade])\n format.html { redirect_to(@entidade, :notice => 'Entidade atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entidade.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @orc_ficha = OrcFicha.find(params[:id])\n\n respond_to do |format|\n if @orc_ficha.update_attributes(params[:orc_ficha])\n flash[:notice] = 'SALVO COM SUCESSO.'\n format.html { redirect_to(@orc_ficha) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @orc_ficha.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @orc_uni_despesa = OrcUniDespesa.find(params[:id])\n\n respond_to do |format|\n if @orc_uni_despesa.update_attributes(params[:orc_uni_despesa])\n flash[:notice] = 'SALVO COM SUCESSO.'\n format.html { redirect_to(@orc_uni_despesa) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @orc_uni_despesa.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.64717865", "0.6093532", "0.6090856", "0.60785913", "0.60334915", "0.59933466", "0.59698045", "0.5966531", "0.596525", "0.59421456", "0.5915886", "0.58759004", "0.587027", "0.5851336", "0.5830085", "0.5815557", "0.58107173", "0.5792293", "0.57915837", "0.5786026", "0.577174", "0.57704717", "0.5766366", "0.5763019", "0.575746", "0.57485855", "0.57481164", "0.5727756", "0.5720599", "0.57202524", "0.5715962", "0.5710195", "0.57041305", "0.5693306", "0.5689069", "0.5670006", "0.5668787", "0.5667851", "0.5660816", "0.5639503", "0.5636939", "0.5623159", "0.5616201", "0.5614326", "0.5614037", "0.5613458", "0.5607624", "0.5604062", "0.56040347", "0.55993456", "0.558537", "0.5584808", "0.55837667", "0.55831903", "0.55821514", "0.55637705", "0.5559888", "0.5555552", "0.5551667", "0.5547488", "0.55460906", "0.553964", "0.55351967", "0.55312514", "0.5525664", "0.55182725", "0.5517206", "0.5516454", "0.55161184", "0.5515493", "0.551496", "0.5511829", "0.5506759", "0.55056673", "0.5502159", "0.54988796", "0.5496835", "0.5495405", "0.54920197", "0.54910135", "0.5485914", "0.54833364", "0.5481444", "0.5481409", "0.547576", "0.54641384", "0.546303", "0.54621124", "0.545973", "0.5459695", "0.5449331", "0.54479325", "0.5446397", "0.5443978", "0.5443841", "0.5443113", "0.5440165", "0.54375315", "0.5436962", "0.5435604" ]
0.6343366
1
DELETE /empleadobitacoras/1 DELETE /empleadobitacoras/1.xml
def destroy @empleadobitacora = Empleadobitacora.find(params[:id]) @empleadobitacora.destroy respond_to do |format| format.html { redirect_to(empleadobitacoras_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @empleadosautorizado = Empleadosautorizado.find(params[:id])\n @empleadosautorizado.destroy\n\n respond_to do |format|\n format.html { redirect_to(empleadosautorizados_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 @expedicao = Expedicao.find(params[:id])\n @expedicao.destroy\n\n respond_to do |format|\n format.html { redirect_to(expedicoes_url) }\n format.xml { head :ok }\n end\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def destroy\n @exalumno = @alumno.exalumno\n @exalumno.destroy\n\n respond_to do |format|\n format.html { redirect_to(alumno_path(@alumno)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estatu = Estatu.find(params[:id])\n @estatu.destroy\n\n respond_to do |format|\n format.html { redirect_to(estatus_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.html { redirect_to(emple_path) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @asignacionexa = Asignacionlabexa.find(params[:id])\r\n @asignacionexa.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(asignacionlabexas_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @estabelecimento = Estabelecimento.find(params[:id])\n @estabelecimento.destroy\n\n respond_to do |format|\n format.html { redirect_to(estabelecimentos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @elemento = Elemento.find(params[:id])\n @elemento.destroy\n\n respond_to do |format|\n format.html { redirect_to(elementos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estacion = Estacion.find(params[:id])\n @estacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(estaciones_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n client = Connection::MarkLogic.new.client\n client.send_corona_request(\"/v1/documents?uri=/amandments/amandment_#{@amandment.id}.xml\", :delete)\n @amandment.destroy\n respond_to do |format|\n format.html { redirect_to home_meeting_path, notice: 'Amandman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ficha_tematica = FichaTematica.find(params[:id])\n @ficha_tematica.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_ficha_tematicas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @adjunto = Adjunto.find(params[:id])\n @adjunto.destroy\n\n respond_to do |format|\n format.html { redirect_to(adjuntos_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @estudiante = Estudiante.find(params[:id])\n @estudiante.destroy\n\n respond_to do |format|\n format.html { redirect_to(estudiantes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estudiante = Estudiante.find(params[:id])\n @estudiante.destroy\n\n respond_to do |format|\n format.html { redirect_to(estudiantes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @empregado = EmpregadoMiddle.find(params[:id])\n @empregado.destroy\n\n respond_to do |format|\n format.html { redirect_to(empregados_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @cabo_eleitoral = CaboEleitoral.find(params[:id])\n @cabo_eleitoral.destroy\n\n respond_to do |format|\n format.html { redirect_to(cabo_eleitorals_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @empdetail = Empdetail.find(params[:id])\n @empdetail.destroy\n\n respond_to do |format|\n format.html { redirect_to(empdetails_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @calidadtiposdocumento = Calidadtiposdocumento.find(params[:id])\n @calidadtiposdocumento.destroy\n\n respond_to do |format|\n format.html { redirect_to(calidadtiposdocumentos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @orc_empenho_iten = OrcEmpenhoIten.find(params[:id])\n @orc_empenho_iten.destroy\n\n respond_to do |format|\n format.html { redirect_to(orc_empenho_itens_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @orc_ficha = OrcFicha.find(params[:id])\n @orc_ficha.destroy\n\n respond_to do |format|\n format.html { redirect_to(orc_fichas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @relatestagiario = Relatestagiario.find(params[:id])\n @relatestagiario.destroy\n\n respond_to do |format|\n format.html { redirect_to(relatestagiarios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @especificacao = Especificacao.find(params[:id])\n @especificacao.destroy\n\n respond_to do |format|\n format.html { redirect_to(especificacaos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @aauto = Aauto.find(params[:id])\n @aauto.destroy\n\n respond_to do |format|\n format.html { redirect_to(aautos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @leilao = Leilao.find(params[:id])\n @leilao.destroy\n\n respond_to do |format|\n format.html { redirect_to(leilaos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @documento = @externo.documentos.find(params[:id])\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentos_url(@externo)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def destroy\n @entradas = Entrada.find(params[:id])\n @entradas.destroy\n\n respond_to do |format|\n format.html{ redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estagio = Estagio.find(params[:id])\n @estagio.destroy\n\n respond_to do |format|\n format.html { redirect_to(estagios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\n @cita = Cita.find(params[:id])\n paciente_id=@cita.paciente_id\n Operation.delete_all \"cita_id = #{@cita.id}\"\n consulta=Consulta.find_by_cita_id(params[:id])\n consulta.update_attributes(:cita_id => nil)\n @cita.destroy\n \n respond_to do |format|\n format.html { redirect_to :controller => \"lab\",:action => \"crea_cita\",:id => paciente_id,:id_cons => consulta.id }\n format.xml { head :ok }\n end\n end", "def destroy\n @entrada = Entrada.find(params[:id])\n @entrada.destroy\n\n respond_to do |format|\n format.html { redirect_to(mngr_entradas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @consulta = Consulta.find(params[:id])\n @consulta.destroy\n\n respond_to do |format|\n format.html { redirect_to(consultas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @consulta = Consulta.find(params[:id])\n @consulta.destroy\n\n respond_to do |format|\n format.html { redirect_to(consultas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @feefile = Feefile.find(params[:id])\n directory= \"uploads\"\n path =File.join(directory,@feefile.feefilename)\n File.delete(path)\n @feefile.destroy\n \n\n respond_to do |format|\n format.html { redirect_to(feefiles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @aisle = Aisle.find(params[:id])\n @aisle.destroy\n\n respond_to do |format|\n format.html { redirect_to(aisles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @acre = Acre.find(params[:id])\n @acre.destroy\n\n respond_to do |format|\n format.html { redirect_to(acres_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @reclamacao = Reclamacao.find(params[:id])\n @reclamacao.destroy\n\n respond_to do |format|\n format.html { redirect_to(reclamacaos_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 destroy\n @supervisor_estagio = SupervisorEstagio.find(params[:id])\n @supervisor_estagio.destroy\n\n respond_to do |format|\n format.html { redirect_to(supervisor_estagios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @entidad = Entidad.find(params[:id])\n @entidad.destroy\n\n respond_to do |format|\n format.html { redirect_to(entidades_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tipo_de_documento = TipoDeDocumento.find(params[:id])\n @tipo_de_documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipos_de_documento_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @feria2010observacion = Feria2010observacion.find(params[:id])\n @feria2010observacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(feria2010observaciones_url) }\n format.xml { head :ok }\n end\n end", "def delete\n eadid = (params[\"eadid\"] || \"\").strip\n if eadid == \"\"\n log_error(\"Cannot delete EAD. No ID was provided.\")\n flash[:alert] = \"No EAD ID was provided.\"\n redirect_to upload_list_url()\n return\n end\n\n filename = ENV[\"EAD_XML_PENDING_FILES_PATH\"] + \"/\" + eadid + \".xml\"\n if !File.exist?(filename)\n log_error(\"Cannot delete EAD. File was not found: #{filename}\")\n flash[:alert] = \"Source file not found for finding aid: #{eadid}.\"\n redirect_to upload_list_url()\n return\n end\n\n target = ENV[\"EAD_XML_DELETED_FILES_PATH\"] + \"/\" + eadid + \".xml\"\n FileUtils.mv(filename, target)\n\n if !File.exist?(target)\n log_error(\"File delete failed: #{filename}\")\n flash[:alert] = \"Could not delete finding aid #{eadid}.\"\n redirect_to upload_list_url()\n return\n end\n\n Rails.logger.info(\"Findind aid #{eadid} has been deleted\")\n flash[:notice] = \"Findind aid #{eadid} has been deleted\"\n redirect_to upload_list_url()\n rescue => ex\n render_error(\"delete\", ex, current_user)\n end", "def destroy\n @asistencia = Asistencia.find(params[:id])\n @asistencia.destroy\n\n respond_to do |format|\n format.html { redirect_to(asistencias_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @direccion = Direccion.find(params[:id])\n @direccion.destroy\n\n respond_to do |format|\n format.html { redirect_to(direccions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @iguanasactualizacion = Iguanasactualizacion.find(params[:id])\n @iguanasactualizacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(iguanasactualizaciones_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @child_dupa2 = ChildDupa2.find(params[:id])\n @child_dupa2.destroy\n\n respond_to do |format|\n format.html { redirect_to(child_dupa2s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @conteudo = Conteudo.find(params[:id])\n @conteudo.destroy\nt=0\n respond_to do |format|\n format.html { redirect_to(exclusao_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ordendetalle = Ordendetalle.find(params[:id])\n @ordendetalle.destroy\n\n respond_to do |format|\n format.html { redirect_to(ordendetalles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @solexame.destroy\n\n respond_to do |format|\n format.html { redirect_to paciente_url(@solexame.paciente) }\n format.xml { head :ok }\n end\n end", "def destroy\n @certidao = Certidao.find(params[:id])\n @certidao.destroy\n\n respond_to do |format|\n format.html { redirect_to(certidaos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @asignacion = Asignacion.find(params[:id])\r\n @asignacion.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(asignacions_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @motivo_assistencia = MotivoAssistencia.find(params[:id])\n @motivo_assistencia.destroy\n\n respond_to do |format|\n format.html { redirect_to(motivos_assistencia_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estagiarios = Estagiario.find(params[:id])\n @estagiarios.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @cuenta = Cuenta.find(params[:id])\n @cuenta.destroy\n\n respond_to do |format|\n format.html { redirect_to(cuentas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @cuenta = Cuenta.find(params[:id])\n @cuenta.destroy\n\n respond_to do |format|\n format.html { redirect_to(cuentas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @cuenta = Cuenta.find(params[:id])\n @cuenta.destroy\n\n respond_to do |format|\n format.html { redirect_to(cuentas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @orc_uni_despesa = OrcUniDespesa.find(params[:id])\n @orc_uni_despesa.destroy\n\n respond_to do |format|\n format.html { redirect_to(orc_uni_despesas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @remocao = Remocao.find(params[:id])\n @remocao.destroy\n\n respond_to do |format|\n format.html { redirect_to(remocaos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ambito = Ambito.find(params[:id])\n @ambito.destroy\n\n respond_to do |format|\n format.html { redirect_to(ambitos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @documento = Documento.find(params[:id])\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to(datos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to(datos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @orc_ata = OrcAta.find(params[:id])\n @orc_ata.destroy\n @ata =\n respond_to do |format|\n format.html { redirect_to( home_path ) }\n\n format.xml { head :ok }\n end\n end", "def destroy\n @recurso = Recurso.find(params[:id])\n @recurso.destroy\n\n respond_to do |format|\n format.html { redirect_to(recursos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @peca = Peca.find(params[:id])\n @peca.destroy\n flash[:notice] = 'Peça excluída com sucesso.'\n\n respond_to do |format|\n format.html { redirect_to(pecas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @entidadfinanciera = Entidadfinanciera.find(params[:id])\n @entidadfinanciera.destroy\n\n respond_to do |format|\n format.html { redirect_to(entidadfinancieras_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @faixa_de_desconto = FaixaDeDesconto.find(params[:id])\n @faixa_de_desconto.destroy\n\n respond_to do |format|\n format.html { redirect_to(faixas_de_desconto_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @departamentos = Departamento.find(params[:id])\n @departamentos.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @receita = Receita.find(params[:id])\n @receita.destroy\n\n respond_to do |format|\n format.html { redirect_to(receitas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @domino = Domino.find(params[:id])\n @domino.destroy\n\n respond_to do |format|\n format.html { redirect_to(dominos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @alfabe = Alfabe.find(params[:id])\n @alfabe.destroy\n\n respond_to do |format|\n format.html { redirect_to(alfabes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @absence_request = AbsenceRequest.find(params[:id])\n @absence_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(absence_requests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @solicitudlabexa = Solicitudlabexa.find(params[:id])\r\n CorreoTecnicos::emitesolicitudexamen(@solicitudlabexa,params[:fecha],\"Solicitud cursada por admin\",\"Borrado de \").deliver_later \r\n\r\n @solicitudlabexa.destroy\r\n\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(solicitudlabexas_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @entidade = Entidade.find(params[:id])\n @entidade.destroy\n\n respond_to do |format|\n format.html { redirect_to(entidades_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @documentoclasificacion = Documentoclasificacion.find(params[:id])\n @documentoclasificacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentoclasificaciones_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @razdel1 = Razdel1.find(params[:id])\r\n @razdel1.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(razdel1s_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @correspondenciasclase = Correspondenciasclase.find(params[:id])\n @correspondenciasclase.destroy\n\n respond_to do |format|\n format.html { redirect_to(correspondenciasclases_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tarefa = Tarefa.find(params[:id])\n @tarefa.destroy\n \n respond_to do |format|\n format.html { redirect_to(projeto_tarefas_path(@projeto)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @relatorios = Relatorio.find(params[:id])\n @relatorios.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @recebimento = Recebimento.find(params[:id])\n @recebimento.destroy\n\n respond_to do |format|\n format.html { redirect_to(recebimentos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @agendasalerta = Agendasalerta.find(params[:id])\n @agendasalerta.destroy\n\n respond_to do |format|\n format.html { redirect_to(agendasalertas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @employeebankmaster = Employeebankmaster.find(params[:id])\n @employeebankmaster.destroy\n\n respond_to do |format|\n format.html { redirect_to(employeebankmasters_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @administrativo = Administrativo.find(params[:id])\n @administrativo.destroy\n\n respond_to do |format|\n format.html { redirect_to(administrativos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @documento = Documento.find(params[:id])\n # Eliminar los registros asociativos de las tablas JOIN \n # para las asociaciones HBTM (has_and_belongs_to_many)\n #\n @documento.reconocimientos.destroy_all\n @documento.areas.destroy_all\n\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to documentos_url, :notice => \"#{@documento.titulo} eliminado\" }\n format.json { head :no_content }\n end\n end", "def deleteEntityEmployee( 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/employee\",params)\n end", "def destroy\n @reputacao_veiculo = ReputacaoVeiculo.find(params[:id])\n @reputacao_veiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to(reputacao_veiculos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @alfresco = Alfresco.find(params[:id])\n @alfresco.destroy\n\n respond_to do |format|\n format.html { redirect_to(alfrescos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tipo_conta = TipoConta.find(params[:id])\n @tipo_conta.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_contas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @lineas_despacho = LineasDespacho.find(params[:id])\n @lineas_despacho.destroy\n\n respond_to do |format|\n format.html { redirect_to(lineas_despachos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @asociacion_perfil = AsociacionPerfil.find(params[:id])\n @asociacion_perfil.destroy\n\n respond_to do |format|\n format.html { redirect_to(asociacion_perfils_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dupa = Dupa.find(params[:id])\n @dupa.destroy\n\n respond_to do |format|\n format.html { redirect_to(dupas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @apoio_educacioanl.destroy\n respond_to do |format|\n format.html { redirect_to apoio_educacioanls_url, notice: 'Apoio educacioanal foi excluído com Sucesso !' }\n format.json { head :no_content }\n end\n end", "def destroy\n @browsenodeid = Browsenodeid.find(params[:id])\n @browsenodeid.destroy\n\n respond_to do |format|\n format.html { redirect_to(browsenodeids_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @evactivity = Evactivity.find(params[:id])\n @evactivity.destroy\n\n respond_to do |format|\n format.html { redirect_to(evactivities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @almacen = Almacen.find(params[:id])\n @almacen.destroy\n \n respond_to do |format|\n format.html { redirect_to(almacenes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @upload_file = UploadFile.find(params[:id])\n doc_no=@upload_file.doc_no\n @upload_file.destroy\n\n respond_to do |format|\n format.html { redirect_to upload_files_url(:doc_no=>doc_no) }\n format.xml { head :ok }\n end\n end" ]
[ "0.6800261", "0.6773849", "0.67611444", "0.67357093", "0.6704638", "0.66955584", "0.6689398", "0.66782993", "0.66698104", "0.66680396", "0.6651149", "0.66473156", "0.6627883", "0.66221476", "0.66168123", "0.6615853", "0.6615599", "0.6584773", "0.65734327", "0.65613747", "0.65544945", "0.6553102", "0.65460503", "0.6530755", "0.6527745", "0.6522536", "0.65144557", "0.6504515", "0.6503932", "0.649534", "0.6488689", "0.64869875", "0.6486246", "0.6486088", "0.6478904", "0.6478904", "0.64750236", "0.6472523", "0.64723754", "0.6469672", "0.64501625", "0.6436943", "0.64368796", "0.6432635", "0.64309794", "0.6427884", "0.6426343", "0.64254606", "0.64188015", "0.6405093", "0.64049745", "0.6404234", "0.6400102", "0.63960856", "0.6382877", "0.63798", "0.63791376", "0.63721865", "0.63721865", "0.63721865", "0.6368018", "0.63602376", "0.6357903", "0.63578475", "0.63540107", "0.63540107", "0.63497376", "0.6343522", "0.63412386", "0.63411933", "0.63324606", "0.63314456", "0.63296735", "0.6329278", "0.63214177", "0.6320426", "0.63144124", "0.63140064", "0.6313847", "0.631381", "0.63123775", "0.6311893", "0.63093275", "0.63089323", "0.6306727", "0.63039356", "0.63024116", "0.6301783", "0.6300317", "0.62994343", "0.6297432", "0.6297397", "0.62941337", "0.6293464", "0.6292302", "0.6289336", "0.6287192", "0.6285245", "0.62823725", "0.6282076" ]
0.7031792
0
Check that a domain exists
def verify_domain(domain) begin Socket.gethostbyname(domain) rescue SocketError return false end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exist?(domain)\n Domain.all(:name => domain).any?\n end", "def a_domain_we_care_about?(url)\n begin\n !@domains.select { |domain| URI.parse(url).host == domain.host }.empty?\n rescue\n !@domains.select { |domain| url.gsub(/https*:\\/\\//,'').starts_with?(domain.host) }.empty?\n end\n end", "def valid_domain?\n PublicSuffix.valid? domain\n end", "def in_domain?(uri)\n uri.host == @url.host\n end", "def in_domain?(uri)\n uri.host == @url.host\n end", "def is_a_domain?\n domain? && !subdomain?\n end", "def resolvable?(domain)\n Resolv.getaddress domain\n true\n rescue Resolv::ResolvError => _e\n false\n end", "def resolvable?(domain)\n Resolv.getaddress domain\n true\n rescue Resolv::ResolvError => _e\n false\n end", "def domain_check(name)\n options = { \"domains\" => [ {\"dname\" => name} ] }\n request_v2(\"domain\", \"check\", options)\n if is_success?\n record = response[\"answer\"][\"domains\"].first\n record && record[\"error_code\"].nil? && record[\"result\"] == \"Available\"\n end\n end", "def check_domain_matches(drop)\n unless custom_domain_matches? drop\n puts [ '*' * 5,\n drop.data[:url].inspect,\n env['HTTP_HOST'].inspect,\n '*' * 5\n ].join(' ')\n\n not_found\n end\n end", "def in_domain?(page, uri)\n uri.host == page.url.host\n end", "def validate_domain(domain)\n if /[A-Z0-9.-]+\\.[A-Z]{2,4}/i.match(domain) == nil\n puts \"Please try again! Valid Domain Example: 'example.com'\"\n return false\n else \n return true\n end\n end", "def exists?\n\n\t\tbegin\n\t\t\tdom\n\t\t\tdebug \"Domain %s exists? true\" % [resource[:name]]\n\t\t\ttrue\n\t\trescue Libvirt::RetrieveError => e\n\t\t\tdebug \"Domain %s exists? false\" % [resource[:name]]\n\t\t\tfalse # The vm with that name doesnt exist\n\t\tend\n\n\tend", "def exists?\n\t\tbegin\n\t\t\tdom\n\t\t\tdebug \"Domain %s exists? true\" % [resource[:name]]\n\t\t\ttrue\n\t\trescue Libvirt::RetrieveError => e\n\t\t\tdebug \"Domain %s exists? false\" % [resource[:name]]\n\t\t\tfalse # The vm with that name doesnt exist\n\t\tend\n\tend", "def sub_domain_known?(domain)\n\t\tputs \"Validate sub-domain: #{domain}\" if @verbose\n\t\tdomain=domain.strip.downcase\n\t\tsubs=dump_sub_domains\n\t\treturn subs.include?(domain)\n\trescue Exception => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\tend", "def valid?\n !domain.nil?\n end", "def valid?\n PublicSuffix.valid?(domain)\n end", "def check_domain_exists\n\n system_default_site = Site.find(:first, :conditions => {:is_default => true })\n \n @current_site = Site.find_by_fully_qualified_domain( request.host )\n \n # check:\n # * this site exists\n # and either:\n # * this site is live\n # * or user is admin\n # if not, redirect to the system default\n unless @current_site and @current_site.is_live?\n redirect_to url_for( :host => system_default_site.fully_qualified_domain, :port => system_default_site.port || request.port)\n end\n end", "def domain?(domain)\n return false if domain.nil?\n domain = normalize_domain(domain)\n domain =~ /^[a-zA-Z0-9\\-\\.]{3,255}$/ and TLDS.index(domain.split(/\\./).last)\n end", "def validate_domain(name)\n jid = Blather::JID.new(name)\n raise \"incorrect domain: #{name}\" if jid.node || jid.resource\n end", "def subdomain_is_unique\n if subdomain.present? && (League.all.count > 0)\n unless League.find_by_subdomain(subdomain).nil?\n errors.add(:subdomain, \"is already taken\")\n end\n if Apartment::Elevators::Subdomain.excluded_subdomains.include?(subdomain)\n errors.add(:subdomain, \"is not available\")\n end\n end\n end", "def has_subdomain?(subdomain)\n owned_subdomains.include?(subdomain)\n end", "def apex_domain?\n return @apex_domain if defined?(@apex_domain)\n\n answers = Resolv::DNS.open { |dns|\n dns.getresources(absolute_domain, Resolv::DNS::Resource::IN::NS)\n }\n\n @apex_domain = answers.any?\n end", "def check_domain(opts = {})\n data, _status_code, _headers = check_domain_with_http_info(opts)\n data\n end", "def domain_allowed?(domain)\n ALLOWED_SITES.include?(domain)\n end", "def valid_dns?\n @host.exchanger.has_dns_a_record?\n end", "def domain_record?\n name.blank? || name == domain.name\n end", "def domain_matches?(rule)\n rule.match(/\\A[^\\.]+\\.[^\\.]+\\z/) && @host.domain_name == rule.downcase ? true : false\n end", "def validate_domain(name)\n jid = JID.new(name)\n raise \"incorrect domain: #{name}\" if jid.node || jid.resource\n end", "def validate_domain(name)\n jid = JID.new(name)\n raise \"incorrect domain: #{name}\" if jid.node || jid.resource\n end", "def valid_dns?\n return true unless dns_enabled?\n bool = dns_a_record.size > 0 || set_error(:domain_unknown)\n if localhost? && !@config[:host_local]\n bool = set_error(:domain_no_localhost)\n end\n bool\n end", "def in_domain?(link, from_page)\n if from_page.in_domain? link then\n @opts[:inside_domain]\n else\n @opts[:outside_domain]\n end\n end", "def in_domain?(link, from_page)\n if from_page.in_domain? link then\n @opts[:inside_domain]\n else\n @opts[:outside_domain]\n end\n end", "def valid_subdomain?(env)\n return true if Storehouse.subdomains.length == 0\n regex = /(^|\\.)(#{Storehouse.subdomains.join('|')})\\./\n !!(env['HTTP_HOST'] =~ regex)\n end", "def domain_is_allowed?(url)\n true\n end", "def domain_is_allowed?(url)\n true\n end", "def valid?\n # Ensure it's a valid domain\n return false unless PublicSuffix.valid?(domain)\n\n # check using public suffix's standard logic\n rule = PeerReview.list.find domain\n return true if !rule.nil? && rule.allow?(domain)\n\n # also allow for explicit matches to domain list\n PeerReview.list.rules.any? { |rule| rule.value == domain }\n end", "def valid?\n # Ensure it's a valid domain\n return false unless PublicSuffix.valid?(domain)\n\n # Ensure non-edu\n return false if Swot::is_academic?(domain)\n\n # check using public suffix's standard logic\n rule = Gman.list.find domain\n return true if !rule.nil? && rule.allow?(domain)\n\n # also allow for explicit matches to domain list\n Gman.list.rules.any? { |rule| rule.value == domain }\n end", "def validate_subdomain\n if current_account || request.host == \"localhost\"\n elsif current_account.nil?\n redirect_to '/404.html'\n end\n end", "def has_host?(wspace,addr)\n\t\twspace.hosts.find_by_address(addr)\n\tend", "def check_for_wildcard(domain)\n address = Resolv.getaddress(\"asdjlamsdklmasdnoemfjvcn.#{domain}\")\n puts \"The address '#{address}' \"\n\n address\n rescue Resolv::ResolvError => re\n # This error means that the domain isn't using wildcard subdomains\n # Silently ignore this error and allow nil to be returned\n rescue StandardError => se\n warn \"An unexpected error occurred: #{se.message}\"\n end", "def github_domain?\n !!domain.match(/\\.github\\.com$/)\n end", "def is_subdomain?(da, db)\n\n da == db ||\n db == '' ||\n da[0, db.length + 1] == db + '.'\n end", "def fqdn_correct?(host_name, domain_name, ip_addr)\n cmd_if %{egrep -q '^#{ip_addr}[[:space:]]+#{host_name}.#{domain_name}' /etc/hosts >/dev/null}\nend", "def check_domain(keyword, tlds = nil, services = nil)\n connection.post '/domain/power_check', {\n 'keyword' => keyword,\n 'tlds' => tlds || [ 'com' ], # ,'net','org','info','us','biz','tel' ],\n 'services' => services || [ 'availability' ] # ,'suggested' ]\n }\n end", "def pages_domain?(domain = domain())\n !!domain.match(/^[\\w-]+\\.github\\.(io|com)\\.?$/i)\n end", "def subdomain name\n return unless nav.subdomain == name\n error.not_found 'Subdomain \"%s\" matched but nothing called' % name\n end", "def exists?\n name, type = resource[:name].split('/')\n # Create the resolver, pointing to the nameserver\n r = Resolv::DNS.new(:nameserver => server)\n # Do the look-up\n begin\n @dnsres = r.getresources(name, typeclass(type))\n rescue Resolv::ResolvError\n return false\n end\n # MX and SRV lookups will return empty arrays\n if @dnsres.is_a? Array\n return false if @dnsres.empty?\n end\n # The record exists!\n return true\n end", "def vagrant_domain?(node)\n node.key?('domain') && !node['domain'].nil? && node['domain'].include?('vagrantup.com')\n end", "def domain?\n return node.domain\nend", "def domain_check(*domains)\n super # placeholder so that I can add some doc\n end", "def nas?\n @domain.include?(:NAS)\n end", "def pointed_to_github_user_domain?\n dns.first.class == Net::DNS::RR::CNAME && pages_domain?(dns.first.cname.to_s) if dns?\n end", "def valid_format?\n if host_name =~ CANONICAL_HOST_REGEX && to_s.size <= MAX_HOST_LENGTH\n return true if localhost?\n return true if host_name.include?(\".\") # require FQDN\n end\n set_error(:domain_invalid)\n end", "def same_domain?(other_url)\n \tother = URI.parse(other_url)\n\t\tsame_hostname?(other) and same_scheme?(other)\n end", "def domain?(pem, domain)\n if cert = OpenSSL::X509::Certificate.new(pem) rescue nil\n OpenSSL::SSL.verify_certificate_identity(cert, domain) rescue false\n end\n end", "def domain?(pem, domain)\n if cert = OpenSSL::X509::Certificate.new(pem) rescue nil\n OpenSSL::SSL.verify_certificate_identity(cert, domain) rescue false\n end\n end", "def valid?\n # Ensure it's a valid domain\n return false unless domain && domain.valid?\n\n # check using public suffix's standard logic\n rule = PeerReview.list.find(to_s)\n\n # domain is on the domain list and\n # domain is not explicitly blacklisted and\n # domain matches a standard public suffix list rule\n !rule.nil? && rule.type != :exception && rule.allow?(\".#{domain}\")\n end", "def host_exists?(host)\n # :nocov:\n # Patch for BZ840938 to support Ruby 1.8 on machines without /etc/resolv.conf\n dns = Resolv::DNS.new((Resolv::DNS::Config.default_config_hash || {}))\n dns.getresources(host, Resolv::DNS::Resource::IN::A).any?\n # :nocov:\n end", "def has_host?(wspace,addr)\n ::ApplicationRecord.connection_pool.with_connection {\n address, scope = addr.split('%', 2)\n wspace.hosts.find_by_address(addr)\n }\n end", "def has_host?(addr)\n\t\tHost.find(:first, :conditions => [ \"address = ?\", addr])\n\tend", "def check_subdomain?\n subdomain = request.subdomain\n if subdomain == 'www'\n redirect_to root_url(host: Rails.application.config.action_mailer.default_url_options[:host])\n elsif subdomain.blank? || Company.find_by(subdomain: subdomain).nil?\n flash[:alert] = 'Get Registered First'\n redirect_to root_url(host: Rails.application.config.action_mailer.default_url_options[:host])\n end\n end", "def dns?\n !dns.nil? && !dns.empty?\n end", "def check_subdomain(subdomain, jid)\n comp = strip_domain(subdomain)\n return true if comp.domain == jid.domain\n local_jid?(jid) ? cross_domain?(comp, jid) : cross_domain?(comp)\n end", "def runasdomain?\n @resource[:runasdomain]\n end", "def exist?\n self.class.exists?(dn)\n end", "def test_domain_of\n local_string = @@local_domain + \"/myid\"\n remote_string = \"http://www.remote.com/something\"\n \n local_domain = N::URI.new(@@local_domain)\n local = N::URI.new(local_string)\n remote = N::URI.new(remote_string)\n \n assert(local.domain_of?(local))\n assert(local.domain_of?(local_string))\n assert(local_domain.domain_of?(local))\n assert(local_domain.domain_of?(local_string))\n \n assert(!local.domain_of?(local_domain))\n assert(!local.domain_of?(remote))\n assert(!local.domain_of?(remote_string))\n assert(!remote.domain_of?(local))\n end", "def has_country_site(subdomain)\n\n country_sites = Rails.application.config.country_sites\n\n if country_sites.include?(subdomain.downcase)\n return true\n end\n\n return false\n end", "def academic_domain?\n @academic_domain ||= File.exist?(file_path)\n end", "def domain_match(request_domain)\n request_domain = request_domain.downcase\n\n return true if domain == request_domain\n \n return false if request_domain =~ IPADDR\n \n return true if domain == \".#{request_domain}\"\n \n return false if !domain.include?('.') && domain != 'local'\n \n return false if !request_domain.end_with?(domain)\n\n return !(request_domain[0...-domain.length].count('.') > (request_domain[-domain.length-1] == '.' ? 1 : 0))\n end", "def valid_dns_record? (hostname)\n\t\tputs \"Validate the hostname record: #{hostname}\" if @verbose\n\t\tbegin\n\t\t\tips=Resolv.getaddresses(hostname)\n\t\t\tif ips.empty?\n\t\t\t\treturn false\n\t\t\telse\n\t\t\t\tputs \"Found: #{hostname}\" if @verbose\n\t\t\t\treturn true\n\t\t\tend\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__} for host #{hostname}: #{ee}\" if @verbose\n\t\t\treturn false\n\t\tend\n\tend", "def is_fqdn? (host)\n\t\tputs \"Validate the host-name format is valid: #{host}\" if @verbose\n\t\treturn false if is_ip?(host) or is_url?(host)\n\t\tdomain=get_domain_root(host)\n\t\tif domain.nil?\n\t\t\treturn false\n\t\telsif is_domain_root?(domain)\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n#\trescue => ee\n#\t\tputs \"Exception on method is_fqdn? for #{host}: #{ee}\" if @verbose\n#\t\treturn false\n\tend", "def s2s?(domain)\n @ports[:server] && @ports[:server].hosts.include?(domain.to_s)\n end", "def test_subdomain(rr, subdomain)\n ret = false\n rr_name = rr\n if (rr.class != Dnsruby::Name)\n rr_name = rr.name\n end\n rr_name = lose_n_labels(rr_name, @soa.name.labels.length)\n\n if (subdomain && rr_name)\n ret = (rr_name.labels()[rr_name.labels.length() - 1] == subdomain)\n else\n ret = (rr.name == @soa.name)\n end\n return ret\n end", "def test_no_domain\n assert_equal(nil, N::URI.new(\"file:thingy\").domain_part)\n end", "def domain_matches?(rule)\n rule = $1 if rule =~ /\\A@(.+)/\n return rule if domain_name && File.fnmatch?(rule, domain_name)\n return rule if dns_name && File.fnmatch?(rule, dns_name)\n false\n end", "def precheck_domain_id(domain)\n raise DomainNotFoundException.new(\"Domain not specified\") if domain.blank?\n raise DomainNotFoundException.new(\"Domain #{domain} not found\") if ['.','..'].include?(domain)\n end", "def vhost?(domain)\n !!vhost(domain)\n end", "def check_domains(opts = {})\n data, _status_code, _headers = check_domains_with_http_info(opts)\n data\n end", "def google?\n @domain.include?(:Google)\n end", "def subdomain_available?(subdomain)\n begin\n return put :subdomain_available?, {:subdomain => subdomain}\n rescue RestClient::UnprocessableEntity\n return false\n end\n end", "def bds_resolvable?\n begin\n Rex::Socket.resolv_to_dotted(datastore['DOMAIN'])\n rescue RuntimeError, SocketError\n return false\n end\n\n true\n end", "def is_url_valid_www(url)\n return url.include? \"www.\"\nend", "def exists?(domain_expr)\n domain_name = domain_expr.domain_name\n domain_attr = domain_expr.domain_attr\n\n entry = find(domain_name, domain_attr)\n db_expr, values = convert_expr(domain_expr, [], entry)\n db = storage_class_from_entry(entry, :db)\n\n db.exists?([db_expr, *values])\n end", "def is_a_subdomain?\n subdomain?\n end", "def fqdn?\n tld ? true : false\n end", "def check_domains(sld_or_domains, tlds=nil)\n query_args = {'Command' => 'Check'}\n if sld_or_domains.is_a? Array\n query_args['DomainList'] = sld_or_domains.join(',')\n else\n query_args['SLD'] = sld_or_domains\n end\n unless tlds == nil\n if tlds.is_a? Array\n query_args['TLDList'] = tlds.join(',')\n else\n query_args['TLD'] = tlds\n end\n end\n query_push(query_args)\n get_response\n # Set up a hash of domains\n checked_domains = {}\n if query_args['DomainList']\n sld_or_domains.each {|domain| checked_domains[domain] = nil}\n elsif query_args['TLDList']\n tlds.each {|tld| checked_domains[sld_or_domains + '.' + tld] = nil}\n else\n checked_domains[sld_or_domains + '.' + tlds] = nil\n end\n # RRPCodes: 210 = available, 211 = not available\n if checked_domains.length > 1\n # If we have multiple domains, run a loop to fill in results\n x = 1\n @result['DomainCount'].to_i.times do\n domain = @result['Domain' + x.to_s]\n if @result['RRPCode' + x.to_s].to_i == 210\n checked_domains[domain] = true\n elsif @result['RRPCode' + x.to_s].to_i == 211\n checked_domains[domain] = false\n end\n x += 1\n end\n else\n if @result['RRPCode'].to_i == 210\n checked_domains[sld_or_domains + '.' + tlds] = true\n elsif @result['RRPCode'].to_i == 211\n checked_domains[sld_or_domains + '.' + tlds] = false\n end\n end\n puts checked_domains.to_yaml\n end", "def exists?\n return @result unless @result.nil?\n raw_result = read_resource_recursive\n unless raw_result[:result]\n Puppet.debug 'Security Domain does NOT exist'\n return false\n end\n Puppet.debug(\"Raw result: #{raw_result.inspect}\")\n @result = resolve_state(raw_result[:data], @resource)\n @result\n end", "def has_website?\n !url.blank?\n end", "def cookie_domain?(domain, host_only = T.unsafe(nil)); end", "def ensure_the_url_has_a_subdomain\n if account_subdomain.blank?\n redirect_to public_home_page_url(true), :status => :moved_permanently\n end\n end", "def local?(url,domain_name=nil)\n return nil unless url\n !!(url.match(%r{(^|://)(127|192|10)\\.0}) || url.match(%r{(^|://)localhost}) || (domain_name && url.match(%r{\\.#{domain_name}\\b})))\n end", "def valid?\n if domain.nil?\n false\n elsif BLACKLIST.any? { |d| to_s =~ /(\\A|\\.)#{Regexp.escape(d)}\\z/ }\n false\n elsif ACADEMIC_TLDS.include?(domain.tld)\n true\n elsif academic_domain?\n true\n else\n false\n end\n end", "def valid_type?\n type == \"domain\"\n end", "def valid_type?\n type == \"domain\"\n end", "def acceptable_from_uri?(uri)\n uri = URI(uri)\n\n host = DomainName.new(uri.host)\n\n # RFC 6265 5.3\n if host.hostname == @domain\n true\n elsif @for_domain # !host-only-flag\n host.cookie_domain?(@domain_name)\n else\n @domain.nil?\n end\n end", "def has_linode_domain?\n domain&.include?(\"linode\")\n end", "def check_fields_nas_domain?\n return false if @fields[:share] == \"Google\" # File Listing\n return false if @fields[:src_sharename] == \"Google\" || @fields[:dst_sharename] == \"Google\" # File Copy/Move\n return false if @fields[:sharename] == \"Google\" # File Deletion\n return true\n end", "def domain_error(domain)\n\t\tbegin\n\t\t\tResolv::DNS.open do |dns|\n\t\t\t\t@mx = dns.getresources(domain.to_s, Resolv::DNS::Resource::IN::MX)\n\t\t\tend\n\t\t\tif @mx.empty?\n\t\t\t\t\"domain name “#{domain}” can not be found.\"\n\t\t\telse\n\t\t\t\tnil\n\t\t\tend\n\t\trescue\n\t\t\t\"unable to resolve the domain name “#{domain}”\"\n\t\tend\n\tend", "def zone_exist?(name)\n match = find_match(@dns.domains, name)\n if match != nil\n Puppet.notice \"found dns zone #{match.name}\"\n return true\n else\n Puppet.debug \"zone not found : #{name}\"\n return false\n end\n end" ]
[ "0.7785723", "0.76860976", "0.7485511", "0.74388176", "0.74388176", "0.74005896", "0.73079014", "0.73079014", "0.7281119", "0.7251366", "0.71842253", "0.71311045", "0.71124214", "0.70819384", "0.7062265", "0.7054427", "0.70375437", "0.7022726", "0.70078486", "0.6969562", "0.6968141", "0.6954167", "0.69041353", "0.6867471", "0.68487376", "0.68266726", "0.68230975", "0.6800412", "0.6793804", "0.6793804", "0.6782684", "0.67651105", "0.67651105", "0.67484385", "0.6734613", "0.6734613", "0.67120194", "0.66953236", "0.6690036", "0.6687301", "0.66846365", "0.66845125", "0.66818184", "0.6662225", "0.66164756", "0.6598852", "0.65983635", "0.65888083", "0.6575738", "0.6544278", "0.6493008", "0.6488589", "0.6485026", "0.6477936", "0.64716643", "0.64599234", "0.64599234", "0.6441786", "0.6427736", "0.6422148", "0.6413523", "0.6393109", "0.6391079", "0.6388357", "0.6387879", "0.63787264", "0.6377638", "0.63731843", "0.6342572", "0.63232344", "0.6322118", "0.6312827", "0.6311445", "0.6311334", "0.63021564", "0.62764984", "0.62742615", "0.62707376", "0.6269769", "0.6268261", "0.6263283", "0.6261365", "0.6251043", "0.6247162", "0.6221716", "0.62163854", "0.62003934", "0.6196138", "0.6191638", "0.61894447", "0.61880714", "0.6185643", "0.61839354", "0.61811364", "0.61811364", "0.6173337", "0.6169345", "0.61672", "0.61648124", "0.6160142" ]
0.77154535
1
Check that every element of an array is an integer
def int_array_check(arr) arr.each do |element| Integer(element) != nil rescue return false end return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_integer_array? array\n\t\treturn array.all? {|a| a.is_a? Integer}\n\tend", "def expect_array_of_integers(value, field, subfield)\n return false unless expect_array(value, field, subfield)\n error_count = 0\n value.each_with_index do |v, i|\n error_count += 1 unless expect_integer(v, field, \"#{subfield}[#{i}]\")\n end\n error_count == 0\n end", "def array_of_fixnums?(array)\n array.all? { |x| x.is_a? Integer } \nend", "def is_int_array(arr)\n if arr == nil || arr == ''\n return false\n elsif arr.empty?\n return true\n end\n\narr.each do |i|\n if i.class == Integer || i.class == Float && i%1==0\n else\n return false\n end\n end\ntrue\nend", "def is_a_number?(arr_value)\n\tarr_value.is_an_integer?\nend", "def all_ints?(collection)\n collection.each do |n|\n begin\n Integer(n)\n rescue\n return false\n end \n end\n true\n end", "def sum(int_array)\r\n sum = 0\r\n\r\n #puts int_array.class.to_s == 'Array'\r\n # Check that int_array behaves like array \r\n if int_array.respond_to?(:each)\r\n int_array.each do |num|\r\n if num.class.to_s =='Fixnum' \r\n sum += num\r\n else\r\n puts \"Non-integer entry #{num} of the array are not added to the sum\"\r\n end\r\n end\r\n else\r\n raise \"Input parameter is not an array\"\r\n end\r\n sum\r\nend", "def test_int_check_pass\n assert_equal int_check([]), true # EDGE CASE\n assert_equal int_check(['1']), true # pass\n assert_equal int_check(['1', '1']), true # pass\n assert_equal int_check(['1', '1', '1']), true # pass\n end", "def array_of_fixnums?(array)\n array.all? {|x| x.is_a? Fixnum}\nend", "def array_of_fixnum?(array)\n\tarray.all?{|x| x.is_a?Fixnum}\nend", "def return_only_integer(arr)\n arr.select { |element| element.is_a? Integer }\nend", "def array_of_fixnums2?(array)\n array.all? { |x| x.is_a? Fixnum }\nend", "def array_of_fixnums?(array)\n array.all? { |x| x.is_a? Fixnum }\nend", "def array_of_fixnums?(array)\n array.all? { |x| x.is_a? Fixnum }\nend", "def array_of_fixnums?(array)\n for element in array\n unless element.is_a? Fixnum\n return false\n end\n end\n return true\nend", "def array_of_fixnums?(array)\n #array.select { |e| e.is_a?(Fixnum) } == array\n array.all?{|e| e.is_a?(Fixnum)}\nend", "def filter_list(arr)\n\treturn arr.select {|x| x.is_a?(Integer) }\nend", "def array_of_fixnums?(array)\n array.all? {|a| a.is_a?(Fixnum)}\nend", "def sum(arr)\r\n #if array includes the value of non-integer,change it to 1\r\n iIntegerFlag=0\r\n #initialize the value of the sum of array's elements\r\n iSum=0\r\n #identify array\r\n if arr.instance_of?(Array) then\r\n #get the length of arr\r\n iArrLength=arr.size\r\n #justify whether the each element of array is a integer\r\n for value in arr do\r\n if !value.is_a?(Integer) then\r\n iIntegerFlag=1\r\n break\r\n end\r\n end\r\n if iIntegerFlag==1 then\r\n puts \"The array must be consisted of integers!\"\r\n return false\r\n else\r\n if iArrLength!=0 then\r\n for n in 1..iArrLength\r\n iSum=iSum+arr[n-1]\r\n end\r\n end\r\n return iSum\r\n end\r\n else\r\n puts \"Please input an array!\"\r\n return false\r\n end\r\nend", "def duplicate_number(array)\n raise ArgumentError, 'Parameter must be an array' unless array.is_a? Array\n raise ArgumentError, 'Parameter must be an array of integers' unless array.all? {|i| i.is_a?(Integer) }\n\n array.detect{ |number| array.count(number) > 1 }\nend", "def array_42(a)\n\ta.any?{|x| x == 42}\nend", "def is_integer?\n self =~ /\\A-?(?:0|[1-9][0-9]*)\\z/\n end", "def is_int(value)\n true if Integer(value) rescue false\n end", "def array_converter *arrays\n arrays.flatten.map(&:to_i)\nend", "def new_numbers (array)\n emptyArr = []\n array.each do |i|\n if i.class == Integer\n emptyArr << i\n end\n end\n return emptyArr\nend", "def get_nums_built_in(array2)\n array2.select { |el| el.is_a? Numeric }\nend", "def array_42(array)\n a = false\n\tarray.each {|i| if i == 42 then a = true end}\n return a \nend", "def test_int_check_fail\n assert_equal int_check(['k', 'k', 'k']), false # pass\n assert_equal int_check(['a', 's', 'd', 'f']), false # pass\n end", "def validate_integer_type(field)\n if field.is_a?(Integer)\n return true\n else\n return false\n end\n end", "def sum(array)\n\n raise 'array includes non integers' unless \n (array.empty? || array.all? { |x| x.integer?})\n \n array.reduce(0,:+)\n \nend", "def check_fixnum?(values)\n\tvalues.all?{ |i|\n\t\ti.is_a? Fixnum\n\t}\nend", "def integers (arr, int)\r\n current_index = 0\r\n index_item = nil\r\n arr.each do |item| \r\n if item == int\r\n index_item = current_index\r\n end\r\n current_index += 1\r\n end\r\n index_item\r\nend", "def any_int(*options)\n any_number(*options).to_i\n end", "def integer?(value)\n value.is_a?(Integer)\n end", "def valid?(array)\n array.include?(0) || array.sum != 180\nend", "def array_42(arr)\n arr.map{|x| x== 42}.count{|x| x == true} == 1 ? true : false\nend", "def sum_of_array(array)\n sum = 0\n array.each do |item|\n if item.is_a?(Integer) == true\n sum = sum + item\n else\n sum = sum + num_value(item)\n end\n end\n sum\nend", "def identify_2d_array(arry)\n arry.all? { |x| x.is_a?(Array) } &&\n arry.all? { |x| x.length == 2 } &&\n arry.all? { |x| x[0].is_a?(Integer) }\n end", "def square_the_values(array_of_integers)\n # TODO\nend", "def chk_array(array)\n array.each_index do |i|\n array[i] = hash2os(array[i]) if array[i].is_a?(Hash)\n chk_array(array[i]) if array[i].is_a?(Array)\n end\n end", "def multiple?(num, input_array)\n\tbad = false\n\t# check to be sure that num * [an array element] != [an array element]\n\tinput_array.each do |i|\n\t\tres = i * num\n\t\tinput_array.each do |j|\n\t\t\tif (res == j)\n\t\t\t\tbad = true\n\t\t\tend\n\t\tend\n\tend\n\t# check that num / [an array element] != [an array element]\n\t# order numbers so that a smaller number by a larger number\n\tinput_array.each do |i|\n\t\tif (i > num)\n\t\t\tres = i.to_f / num.to_f\n\t\telse\n\t\t\tres = num.to_f / i.to_f\n\t\tend\n\t\tif (res == res.to_i) # is it a whole number?\n\t\t\tinput_array.each do |j|\n\t\t\t\tif (res == j.to_f)\n\t\t\t\t\tbad = true \n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\treturn bad\nend", "def array_converter *arrays\n\n arrays.flatten.map(&:to_i)\n\n # The code above is the same as the code below. arrays.each would not work because\n # it will try and convert the whole array to an int, which is not possible. map will go \n # throught each item in an array and convert them to an int.\n # \n # arrays.flatten.map { |e| i.to_i }\n # \n # OR\n # \n # arrays.flatten.map do |i|\n # i.to_i\n # end\nend", "def include?(array, integer)\r\n array.each do |element|\r\n return true if element == integer\r\n end\r\n\r\nfalse\r\nend", "def number_in_array?(number, array)\n check = false\n array.each do |num| \n if num==number \n check = true\n end \n end\n return check\n end", "def array_to_integer_array_method(card_array)\n card_integer_array = []\n card_array.each do |integer|\n new_integer = integer.to_i\n card_integer_array << new_integer\n end\n return card_integer_array\nend", "def sum_array(some_array) \n sum = 0\n\tsome_array.each do |x|\n\t if x.is_a?Integer\n\t sum = sum + x\n\t end\n\t \n\t end\n\t \n\tsum\n end", "def is_numeric_2d_array?\n self.all? do |data|\n data.is_a?(Array) &&\n data.size == 2 &&\n data.is_numeric_array?\n end\n end", "def find_ints\n\todds_n_ends = [:Alabama, \"Arkansas\", 2, true, \"I do love my ma and pa\"]\n\t# Integer can be changed to String or Symbol\n\tints = odds_n_ends.select { |nums| nums.is_a? Integer}\n\tputs \"Integers: \"\n\tputs ints\nend", "def filter_out_strings(arr)\n arr.select { |num| num.is_a? (Integer) }\nend", "def sum_only_numbers(an_array)\n\tsummation = 0\n\tfor item in an_array\n\t\tif item.is_a? Integer\n\t\t\tsummation += item\n\t\tend\n\t\tif item.is_a? Float\n\t\t\tsummation += item\n\t\tend\n\tend\n\treturn summation\nend", "def sum_only_numbers(an_array)\n count = 0\n an_array.map do |array|\n \tif array.is_a? Fixnum or array.is_a? Float\n \t\tcount = count + array\n \tend\n end\t\nend", "def contains_int?\r\n \treturn false if self.empty?\r\n \treturn self.match(/^[0-9]+$/)\r\n end", "def sum_up_numbers(arr)\n sum = 0\n arr.each do |num|\n if num.is_a? Integer\n sum += num\n end\n end\n return sum\nend", "def sum_only_numbers(an_array)\n sum = 0\n an_array.select{|x| x.is_a?Numeric }.each{|x| sum +=x }\n sum\nend", "def my_array_splitting_method(source)\n source.partition{|element| element.is_a?(Integer)}\nend", "def test3(array)\n\tputs \"Test3: Should return an array of arrays -> \"\n\tabg_maker(array).any? {|x| x.class != Array} ? false : true\nend", "def is_int\r\n\t\tself.to_i.to_s != self.to_s\r\n\tend", "def sum_only_numbers(an_array)\n total = 0\n num = an_array.each { |a| total += a if a.is_a?(Fixnum)} \n \n return total\nend", "def integer?(input)\n Integer(input) rescue false\nend", "def is_integer?\n self.to_i.to_s == self\n end", "def valid_array(input_array)\n test = input_array.detect do |digit|\n (digit != 1) and (digit != 0) and (digit != \"1\") and (digit != \"0\") and (digit != true) and (digit != false)\n end\n !test\nend", "def array_to_integer_array_method\n @card_integer_array = []\n @card_array.each do |integer|\n new_integer = integer.to_i\n @card_integer_array << new_integer\n end\n return @card_integer_array\n end", "def is_an_ip_number?(str_array)\n new_array = str_array.map do |str| \n if str.to_i >= 0 && str.to_i <= 255\n true\n else\n false\n end\n end\nend", "def integer?(obj)\n obj = obj.to_s unless obj.is_a? String\n /^\\d+$/.match obj\nend", "def sum_only_numbers(an_array)\n sum = 0\n an_array.each do |item|\n item.is_a?(Integer) || item.is_a?(Float) ? sum += item : sum\n end\n return sum\nend", "def my_array_splitting_method(source)\n source.partition { |x| x.is_a? Integer }\nend", "def is_integer?(input)\n input.to_i.to_s == input\nend", "def integer?\n type == \"INTEGER\" || type == \"INT64\"\n end", "def sum_array(arry)\n sum = 0\n arry.each do |num|\n # if num = num.to_i\n sum += num\n\n\n end\n sum\nend", "def integer?(num)\n num.to_i > 0 && num.to_i.to_s == num\nend", "def filter_out_integers(arr)\n arr.select { |num| num.is_a? (String) }\nend", "def integer?(object)\n (object.to_s.to_i == object) || (object.to_i.to_s == object)\nend", "def sum_only_numbers(array)\n ll_sum = 0.0\n if array.length > 0\n for idx in array do\n if idx.is_a?(Numeric)\n ll_sum += idx\n end\n end\n end\n return ll_sum\nend", "def integer?(num)\n num.to_i.to_s == num\nend", "def sum_only_numbers(an_array)\n sum = 0\n an_array.each {|value| sum += value if value.is_a? Numeric}\n sum\nend", "def convert_array_elements_to_i(array)\n for i in 0..array.length-1\n array[i] = array[i].to_i\n end\nend", "def can_convert?\n array.is_a?(Array)\n end", "def basic_8 (array_iterate, eval_int)\n total = 0\n array_iterate.each { |n| total += 1 if n > eval_int}\n return total\nend", "def integer?() end", "def sum_only_numbers(an_array)\n sum = 0.0\n an_array = an_array.flatten\n for n in an_array\n if n.class == Float || n.class == Fixnum\n sum = sum + n\n end\n end\n sum\nend", "def integer?\n @kind == :integer_lit || @kind == :integer_exp_lit || @kind == :hex_lit || @kind == :bin_lit\n end", "def all?(array)\n i = 0\n score = 0\n\n while i < array.length\n if yield(array[i])\n score += 1\n end\n i += 1\n end\n\n score == array.length\nend", "def is_integer?(num)\n num.class == Fixnum || num.class == Bignum ||\n ( num.is_a?(Float) && !num.nan? && num.to_i == num )\nend", "def integer?(input)\n input.to_i.to_s == input\nend", "def integer?(input)\n input.to_i.to_s == input\nend", "def integer?(input)\n input.to_i.to_s == input\nend", "def average_array(array)\n array.each do |ele|\n raise \"All member must be numbers\" if !(ele.instance_of?(Integer))\n end\n\n array.sum / array.length.to_f\nend", "def validates_integer(atts, opts={})\n validatable_attributes(atts, opts) do |a,v,m|\n begin\n Kernel.Integer(v.to_s)\n nil\n rescue\n m || 'is not a number'\n end\n end\n end", "def ensure_only_fixnums_in_exposed_profiles\n# if exposed_profiles.collect { |i| false if not i.is_a?(Fixnum) }.compact.size > 0\n if exposed_profiles.collect { |i| false if not i.to_i > 0 }.compact.size > 0\n errors.add(:exposed_profiles, 'can only contain Fixnums')\n end\n end", "def oddnum arr\n # arr.select { |x| x.is_a?(Integer) }\n array = arr.select { |x| x.instance_of?(Integer) }\n final_array = array.select { |x| x.odd?}\n final_array.sort\nend", "def sum_only_numbers(an_array)\n sum=0\n an_array.each do |item|\n if item.is_a? Integer or item.is_a? Float\n\tsum+=item\n end\n end\n return sum\nend", "def exactly?(arr, num, &prc)\n count = 0\n\n arr.each do |ele|\n count += 1 if prc.call(ele)\n end\n\n count == num\nend", "def integer?(num)\n num.to_i().to_s()==num\nend", "def array_of(array, klass)\n array.any? { |i| i.class == klass }\n end", "def sum_only_numbers(an_array)\n # TODO write your code here\n total = 0\n\n an_array.each do |x|\n if(x.is_a? Numeric)\n total = total + x\n end\n end\n\n total\nend", "def test_any_match_all\n stream = FromArray.new([2, 4, 6, 8])\n assert(\n stream.any_match { |val| val %2 == 0 },\n 'All elements are even, it should match!'\n )\n end", "def check_integer\n if @position == 0 \n return false\n else return true\n end\n end", "def integer_dtype?\n [:byte, :int8, :int16, :int32, :int64].include?(self.dtype)\n end", "def is_integer?(num)\n num.class == Fixnum || num.class == Bignum ||\n ( num.is_a?(Float) && !num.nan? && num.to_i == num )\n end", "def is_integer?(num)\n num.class == Fixnum || num.class == Bignum ||\n ( num.is_a?(Float) && !num.nan? && num.to_i == num )\n end" ]
[ "0.8201035", "0.7545777", "0.74823475", "0.7456256", "0.72058266", "0.71517855", "0.69280845", "0.68447506", "0.67445415", "0.67261976", "0.67191446", "0.6716126", "0.67059094", "0.67059094", "0.66723394", "0.6657722", "0.65783113", "0.65762496", "0.6320197", "0.63043535", "0.61684805", "0.61239845", "0.60995847", "0.60696274", "0.606281", "0.6048903", "0.6047243", "0.60289294", "0.60234207", "0.6010712", "0.6003002", "0.59903914", "0.59828955", "0.59803015", "0.5966104", "0.59592855", "0.59563", "0.5954239", "0.5923566", "0.59121895", "0.5898944", "0.5893373", "0.5876059", "0.5869715", "0.58602715", "0.58409494", "0.58312124", "0.58234787", "0.5822413", "0.5810495", "0.5799301", "0.5772974", "0.5771796", "0.57432514", "0.5737476", "0.5725464", "0.57160765", "0.57127726", "0.5712261", "0.57080036", "0.5683187", "0.5659671", "0.56582105", "0.56440055", "0.5643565", "0.563832", "0.56119525", "0.5610205", "0.56008697", "0.5591102", "0.5590412", "0.5582623", "0.557813", "0.55766535", "0.5569245", "0.5568539", "0.5565526", "0.55605376", "0.5555259", "0.55431914", "0.55363345", "0.55313224", "0.55277026", "0.55257416", "0.55253327", "0.55253327", "0.55196285", "0.55139524", "0.55136186", "0.55118006", "0.5503964", "0.55036604", "0.5503467", "0.5503405", "0.5502777", "0.54991424", "0.5491958", "0.54901665", "0.5483278", "0.5483278" ]
0.78944993
1
Expect a commaseparated list of numbers as input. Ex: 45,30,15,7,6,5,4,3,2,1
def fetch_csv_array(str) # instance method #remove whitespace str.gsub!(/\s+/, "") return str.split(',') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_numbers\n puts \"Please enter a list of numbers separated by commas.\"\n puts \"Press enter when done.\"\n # Read string and split on comm. \n # Return array of values as string\n input = gets.strip.split(',')\n # Converts each eleemnt in array to integer and store in new array \n values = input.map {|x| x.to_i}\n return values\n end", "def expand_ranges(nums)\n values = []\n nums = nums.split(\",\").each {|x| x.strip!}\n nums.each do |range|\n if range.match(/-/)\n range = range.split(\"-\")\n (range[0].to_i..range[1].to_i).each {|num| values.push(num)}\n else\n values.push(range.to_i)\n end\n end\n return values.uniq\n end", "def list_of_nums(num)\n num.to_s.split('').map! {|n| n.to_i}\nend", "def single_number(nums)\n\nend", "def given\n [6,5,3,1,8,7,2,3]\nend", "def numbers\r\n puts \"Please enter a set of numbers seperated by spaces\"\r\n arr = STDIN.gets.chomp.split(/ /)\r\n return arr.map { |x| x.to_f} \r\nend", "def separate_comma(number)\n\tnumber\nend", "def splitNumber(val)\n\tresArr = []\n\twhile(val >= 1)\n\t\tresArr.push(val % 10)\n\t\tval = val / 10\n\tend\n\tresArr\nend", "def resolve(list)\n list.to_a.map(&:as_number).reduce(&:/)\n end", "def numbers\r\n\t\toutput = normalized_input.split(DEFAULT_DELIMITER).map(&:to_i)\r\n\t\toutput.select{ |number| number <= 1000 }\r\n\tend", "def split_number(s)\n if s =~ /(\\d+),(\\d+)/\n [$1.to_i,$2.to_i]\n else\n [s.to_i,s.to_i]\n end\nend", "def separate_comma(integer) #running this program gets me an array of each integer.to_s. See below for reconsidered approach\n new_array = []\n integer.to_s.split(//).each{|n| new_array << n} \nend", "def separate_comma(num)\n num_array = num.to_s.reverse.split()\n num_array.each_with_index do |item, index|\n if (index+1)%4==0\n num_array.insert(index,\",\")\n end\n end\n return num_array.reverse.join\nend", "def validate_numeric_stdin(a)\n print \"\\n(use commas for multiple selections): \"\n nums = gets.chomp.split(\",\").select { |x| /\\d+/.match x }.uniq.map(&:to_i)\n nums.reject { |z| z >= a.size }\nend", "def numbers\n gsub(/[^\\n]/, '').split#.map {|x| x.to_i} #found gsub in Ruby documentation, for handling new lines between numbers. map in array doc\nend", "def separate_comma(number)\n \n if number == nil\n return nil\n end\n \n arr = number.to_s.reverse.split(//)\n \n \n if arr.length < 7\n j = 0\n \n elsif arr.length % 2 == 0\n j = 1\n else\n j = 2\n end\n \n \n \n if arr.length < 4\n return array.join.reverse.to_s\n \n else\n i = 3\n \n while i < arr.length + j do\n array.insert(i, ',')\n i += 4\n end\n end\n \n return array.join.reverse.to_s\n \nend", "def test_int_list\n assert_equal([1,2,3], @cmdproc.get_int_list(%w(1+0 3-1 3)))\n assert_equal(0, $errors.size)\n assert_equal([2,3], @cmdproc.get_int_list(%w(a 2 3)))\n assert_equal(1, $errors.size)\n end", "def separate_comma(number)\n\n array = number.to_s.reverse.split(//)\n length = array.length\n\n if length<=6\n x = 0\n elsif length%2 == 0\n x = 1\n else \n x = 2\n end\n\n\n\n if length < 4\n return array.join.reverse.to_s \n else\n i = 3\n while i < length+n do\n array.insert(i, ',')\n i += 4\n end\n end\n return array.join.reverse.to_s\nend", "def digit_list(number)\n loop do \n puts \"Validating number.\"\n break if number >= 0 && number.is_a?(Integer)\n puts \"Number must be a positive integer! Please enter a positive integer:\"\n number = gets.chomp.to_i\n end\n puts \"Number successfully validated\"\n \n array = number.to_s.split(//)\n array.map! do |i|\n i.to_i\n end\n array\nend", "def numbers\n %w[1 2 3 4 5 6 7 8 9 0\n tenth ninth eighth seventh sixth fifth fourth third second first\n ten nine eight seven six five four three two one ]\n end", "def separate_comma(number)\n comma_separated_number = number.to_s.reverse.split('').each_slice(3).map {|obj| obj.push(\",\") }.join.chop.reverse\nend", "def separate_comma(number)\n number = number.to_s\n number = number.split('').reverse!\n array_of_ints = number.each_slice(3).to_a\n array_of_ints.each do |num|\n if num.length == 3\n num.push(',')\n end\n end\n answer = array_of_ints.flatten!.reverse!.join()\n if answer[0] == ','\n answer[0] = ''\n return answer\n end\n return answer\nend", "def single_numbers\n text, ary = parse_text, [] \n until text.empty?\n top, mid, bot, blank = text.shift(4)\n ary.push(*top.zip(mid, bot).map(&:join)) \n ary.push(\",\") unless text.empty? # add comas when input entered on multiple lines\n end\n ary\n end", "def add(string_of_numbers = \"\")\n\t\tcounter = 0\n\t\tstring_of_numbers.gsub!('$',\",\")\n\t\t# p string_of_numbers\n array_of_split_numbers = string_of_numbers.split(',') \n # p array_of_split_numbers \n\n empty_array = []\n \tarray_of_split_numbers.each do |number|\n \t\tempty_array.push(number.to_i)\n \t\t\t\t\t\t\t\tend \n\n empty_array.each do |element|\n counter += element\n\t\t\t\t\t\tend\n\t\t\t\t\t\tcounter\n\tend", "def big_numbers(array_of_integers)\n # TODO\nend", "def digit_list(integer)\n array = integer.split('')\n if array.length <= 2\n return array.join(' and ')\n else\n return array.join(', ')\n end\nend", "def sum_list_of_numbers(list_of_numbers)\n current_total = 0\n list_of_numbers.each do |current_number|\n current_total = current_total + current_number\n end\n\n return current_total\nend", "def separate_comma(number)\n number.to_s.reverse.split(\"\").each_with_index { |x,y| x << \",\" if y == 3 || y == 6 }.reverse.join\nend", "def request_player_input(message = 'Please enter an array of numbers 1-6 each separated by \" \"')\n puts message.to_s\n temp_input = gets.chomp\n temp_input = temp_input.split\n temp_input = temp_input.map(&:to_i)\n end", "def find_valid_numbers(fields)\n bounds = fields.map { |line| line.scan(/\\d+/).map(&:to_i) }\n valid_numbers = []\n bounds.each do |set|\n pair = []\n (0..set.length - 1).step(2) { |ind| pair += (set[ind]..set[ind + 1]).to_a }\n valid_numbers << pair\n end\n valid_numbers\n end", "def toNumbers(strList)\n strList.each do |i|\n \ti.to_i\n end\nend", "def separate_comma(number)\n array = number.to_s.reverse.split(//)\n length = array.length\n\n if length <= 6\n n = 0\n elsif length % 2 == 0\n n = 1\n else\n n = 2\n end\n\n if length < 4\n return array.join.reverse\n elsif length <= 9 \n i = 3 \n while i < length + n do \n array.insert(i, \",\")\n i = i + 4 \n end\n end\n\n return array.join.reverse.to_s\nend", "def digit_list(n)\n list = n.to_s\n list = list.split('')\n list = list.map do |i|\n i.to_i\n end\n return list\nend", "def lister(int)\n\tint.to_s.split('').map { |element| element.to_i }\nend", "def input_processing(multi_line)\n multi_line.split(\"\\n\").map {|nums| nums.split.map {|str| str.to_i}}\nend", "def input_processing(multi_line)\n multi_line.split(\"\\n\").map {|nums| nums.split.map {|str| str.to_i}}\nend", "def split_number(start)\n number = []\n number[0] = start / 1000 / 1000\n number[1] = start / 1000 % 1000\n number[2] = start % 1000\n return number\n end", "def separate_comma ( int )\n int.to_s.split('').to_a().reverse().each_slice(3).to_a.map(&:join).join(\",\").reverse()\nend", "def separate_comma(number)\n new_array = number.to_s.reverse.split(\"\")\n count = 0\n new_array.each do |x|\n count += 1\n if count >= 4\n x << \",\" unless count == 3 || count == 5 || count == 6 || count > 7\n end\n end\n new_array.reverse.join\nend", "def resolve(list)\n list.to_a.map(&:as_number).reduce(&:**)\n end", "def digit_list(number)\n list = number.to_s.split('')\n list.map{ |item| item.to_i }\nend", "def split_expression_into_numbers expression\n numbers = []\n\n number = []\n\n expression.each do |value|\n if ['+', '/', '*', '-'].include? value\n numbers.push number\n\n number = []\n else\n number.push value\n end\n end\n\n numbers.push number\n\n numbers\nend", "def separate_comma(input)\n number= input.to_s\n if number.length>9\n number.insert(-3,',')\n number.insert(-6,',')\n number.insert(-9,',') \n elsif number.length>6\n \tnumber.insert(-3,',')\n number.insert(-6,',')\n elsif number.length>3\n \tnumber.insert(-3,',')\n else\n \treturn number\nend\nend", "def split_number(start)\r\r\n number = []\r\r\n number[0] = start / 1000 / 1000\r\r\n number[1] = start / 1000 % 1000\r\r\n number[2] = start % 1000\r\r\n return number\r\r\n end", "def cracklepop_numbers(from, to)\n (from..to).to_a.map { |n| cracklepop_number(n) }\nend", "def digit_list(number)\n # Thank you rubocop for the &:to_i syntax\n number.to_s.chars.map &:to_i\nend", "def separate_comma(input)\n number= input.to_s\n if number.length>9\n number.insert(-4,',')\n number.insert(-8,',')\n number.insert(-12,',') \n elsif number.length>6\n \tnumber.insert(-4,',')\n number.insert(-8,',')\n elsif number.length>3\n \tnumber.insert(-4,',')\n else\n \treturn number\nend\nend", "def collect_multiples(limit)\n #numbers = [1..(limit-1)]\n multiple_numbers = []\n (1..(limit-1)).map do |number|\n if number % 3 == 0 || number % 5 == 0\n multiple_numbers << number\n end\n end\n multiple_numbers\nend", "def separate_comma(num)\n\tnum.to_s.reverse.chars.to_a.each_slice(3).to_a.map {|value|\n\t\tvalue.join(\"\")\n\t}.join(\",\").reverse\nend", "def separate_comma(num)\n\tnum.to_s.reverse.chars.to_a.each_slice(3).to_a.map {|value|\n\t\tvalue.join(\"\")\n\t}.join(\",\").reverse\nend", "def call_numbers(*)\n []\n end", "def numbers(n)\n\nend", "def commas(num)\nend", "def tokenise_numbers(tokens)\n output = []\n tokens.each do |token|\n if token.is_a?(::String) && Lib::NUMBER_REGEX =~ token\n output.push Lib::Number.new token\n else\n output.push token\n end\n end\n output\n end", "def separate_comma(random_num)\n\n if random_num >= 1000 && random_num < 10000\n random_num = (random_num.to_s).split(//,2)\n random_num = random_num.join(\",\")\n elsif random_num >= 10000 && random_num < 100000\n random_num = (random_num.to_s).split(//)\n random_num = random_num.insert(2,\",\")\n random_num = random_num.join\n elsif random_num >= 100000 && random_num < 1000000\n random_num = (random_num.to_s).split(//)\n random_num = random_num.insert(3,\",\")\n random_num = random_num.join\n elsif random_num >= 1000000 && random_num < 10000000\n random_num = (random_num.to_s).split(//)\n random_num = random_num.insert(4,\",\")\n random_num = random_num.insert(1,\",\")\n random_num = random_num.join\n elsif random_num >= 10000000 && random_num < 100000000\n random_num = (random_num.to_s).split(//)\n random_num = random_num.insert(5,\",\")\n random_num = random_num.insert(2,\",\")\n random_num = random_num.join\n else random_num < 1000\n random_num\n end\n random_num\nend", "def separate_comma(num)\n\tif num < 1000\n\t\tp num.to_s\n\telse\n\tnew_num = []\n num = num.to_s.reverse\n num = num.chars.to_a\n until num.empty?\n new_num << num.shift(3) \n new_num.push(',')\n end\n new_num.pop\n p new_num.join.reverse\n \n end\nend", "def digit_list(num)\n string = num.to_s\n array = string.split('')\n array.map {|num| num.to_i}\nend", "def digit_list(num)\n int_array = []\n digit_array = num.to_s.split(//)\n digit_array.each do |numb|\n int_array += [numb.to_i]\n end\n int_array\nend", "def param_to_integer_list(key, delimiter = ',')\n params[key].split(delimiter).map(&:to_i) if params[key]\n end", "def separate_comma (number)\n\nnumber\n.to_s\n.reverse\n.split(\"\")\n.map.with_index {|x, i| ((i+1)%3 == 0 && number.to_s.length - (i+1) > 0 ? x << \",\" : x)}\n.join\n.reverse\n\nend", "def separate_comma(int)\n\n result = []\n\n int.to_s.split(\"\").reverse.each_slice(3) do |slice|\n slice << \",\"\n result << slice\n end\n\n p result.flatten.join.chop.reverse\n\nend", "def digit_list(number)\n list = number.to_s.split('').map { |i| i.to_i }\nend", "def solution(n)\n n.to_s.reverse.scan(/\\d{1,3}/).join(',').reverse\nend", "def doubler(numbers)\n new_numbers = []\n # numbers.each { |num| new_numbers << num * 2 }\n numbers.each { |num| new_numbers.push(num * 2) }\n new_numbers\nend", "def separate_comma(integer)\n num = integer.to_s.split(\"\").reverse\n item_index = 0\n delimit_at = 3\n num.each do |item|\n if item_index == delimit_at #6, 9, 12, etc.\n num[item_index] += ','\n delimit_at += 3\n end\n item_index += 1\n end\n return num.reverse.join\nend", "def num_list\r\n sanitized_str.chars.map(&:to_i)\r\n end", "def digit_list(num)\n num.to_s.split(//).map(&:to_i)\nend", "def digit_list(num)\n num.to_s.split(//).map(&:to_i)\nend", "def separate_comma(integer)\n comma_array = []\n array_of_strings = integer.to_s.reverse.split(//)\n array_of_strings.each_slice(3){|triple_digits| comma_array << triple_digits}\n comma_array = comma_array.map{|numbers| numbers.join}\n comma_array.join(\",\").reverse\nend", "def str_range(str)\n arr = str.split(\",\")\n\n arr = arr.map do |el|\n el.to_i\n end\n # p arr\n range(arr)\nend", "def separate_comma(number)\n array = number.to_s.split('') #creates an array from number w/ digits\n number_commas = array.size/3.0 #how many commas\n if array.size < 4 #this is a 3 digit number\n return number.to_s #return number no comma needed\n elsif array.size%3 == 0\n n = -4\n (number_commas.to_i-1).times do |i|\n array.insert(n, ',')\n n -= 4\n end\n return array.join(\"\")\n else\n n = -4\n number_commas.to_i.times do |i|\n array.insert(n, ',')\n n -= 4\n end\n return array.join(\"\")\n end\nend", "def range_numerals\n [ range(:numerals) ]\n end", "def separate_comma(num)\n\tnum_s = num.to_s\n\tdigits = num_s.length\n\tif digits <= 3\n\t\tnum_s\n\telsif digits % 3 == 0\n\t\tnum_s.scan(/.../).join(\",\")\n\telse\n\t\ti = digits % 3\n\t\tnum_s[0..i-1] + \",\" + num_s[i..-1].scan(/.../).join(\",\")\n\tend\nend", "def get_numbers(first_numb, second_numb)\n\nprint \"Enter first number \"\nfirst_numb[0] = gets.chomp!\nfirst_numb[0] = first_numb[0].to_i\n\nprint \"Enter second number \"\nsecond_numb[0] = gets.chomp!\nsecond_numb[0] = second_numb[0].to_i\n\nend", "def sum(list_of_numbers)\n running_total = 0\n list_of_numbers.each do |number|\n running_total = running_total + number\n end\n\n\n return running_total\nend", "def parse_numbers(data)\n numbers = data.scan(/\\d{1,1000}/m).map(&:to_i)\n\n # extract last number if data ends with digit\n # rubocop:disable Style/IfUnlessModifier\n if !@is_last_block && data[-1] =~ /\\d/\n @prev_tail = numbers.pop\n end\n\n numbers\n end", "def separate_comma(num)\n numarray = num.to_s.chars\n finarray = Array.new\n for i in 0..numarray.length-1\n if i % 3 == 0 && i > 0\n finarray.unshift(numarray.pop + \",\")\n else\n finarray.unshift(numarray.pop)\n end\n end\n return finarray.join\nend", "def separate_comma(num)\n\tstr = num.to_s.split('')\n\tstr.reverse!\n\tcommas = []\n\tcount = 0\n\tstr.each do |i|\n\t\tif count < 3\n\t\t\tcommas.unshift(i)\n\t\t\tcount += 1\n\t\telsif count == 3 \n\t\t\tcommas.unshift(\",\")\n\t\t\tcommas.unshift(i)\n\t\t\tcount = 1\n\t\tend \n\tend\n\tcommas.join(\"\")\nend", "def separate_comma(number)\n comma_array = number.to_s.chars.reverse.each_slice(3)\n comma_array.map(&:join).join(\",\").reverse\nend", "def separate_comma(num)\n solution = add_commas_every_three(num.to_s.reverse.split(\"\"))\n solution.pop if solution[-1] == ','\n solution.join(\"\").reverse\nend", "def missing_numbers(input)\n input.sort!\n p (input[0]..input[-1]).to_a - input\nend", "def digit_list(number)\n digits = number.to_s.split('')\n digits = digits.map { |digit| digit.to_i }\n digits\nend", "def separate_comma(num)\n arr = num.to_s.split(\"\")\n arr = arr.each_index {|x|\n x = -x - 1\n arr = arr.insert(x, \",\") if x % 4 == 0\n }\n return arr.join\nend", "def input_as_array\n array = number.split('')\n\n return array.collect! { |x| x.to_i }\n end", "def numbers_for(set)\n set.text.split(' ').map(&:to_i)\nend", "def amicable_numbers(n)\r\n numbers = Array.new\r\n 2.upto(n) do |x|\r\n y = d(x)\r\n if !numbers.include?(y)\r\n numbers.push(x,y) if d(y) == x && y != x\r\n end\r\n end\r\n return numbers\r\nend", "def sum(list_of_numbers)\n running_total = 0\n list_of_numbers.each do |number|\n running_total = running_total + number\n end\n\n return running_total\n end", "def digit_list_two(positive_integer)\n list = []\n array_of_integer_strings = positive_integer.to_s.split('')\n array_of_integer_strings.each do |number|\n list << number.to_i\n end\n list \nend", "def separate_comma(integer)\n\tinteger.to_s.reverse.scan(/.{1,3}/).join(\",\").reverse\nend", "def multiples_x(number, multiple)\n current_multiple = multiple\n multiples = []\n\n while current_multiple <= number\n multiples << current_multiple\n current_multiple += multiple\n end\n\n multiples\nend", "def number_array\n @input_string.split(' ')\n end", "def separate_comma(num)\r\n\tnum_s = num.to_s\r\n\tx = num_s.length - 1\r\n\tfinal = \"\"\r\n\r\n\twhile x >= 0\r\n\t\tfinal.prepend((num_s.length - x) % 3 == 0 && x != 0 ? \",#{num_s[x]}\" : \"#{num_s[x]}\")\r\n\t\tx-= 1\r\n\tend\r\n\r\n\treturn final\r\nend", "def separate_comma(num)\n num.to_s.reverse.chars.each_slice(3).to_a.map{|sub_array| sub_array.join }.join(\",\").reverse \nend", "def digit_list(number)\n return number.abs.to_s.split('').map(&:to_i)\nend", "def ask()\n pattern = /-?\\d+/\n resp = gets\n # convert to numbers\n nums = resp.scan(pattern).map { |n| n.to_i }\nend", "def neaten_numbers(nums)\n nums.sort!\n str = nil\n range = nil\n nums.each_index do |index|\n if nums[index+1] == nums[index]+1\n range = nums[index] unless range\n else\n if range\n if str\n str = \"#{str}, #{range}-#{nums[index]}\"\n else\n str = \"#{range}-#{nums[index]}\"\n end\n range = nil\n else\n if str\n str = \"#{str}, #{nums[index]}\"\n else\n str = \"#{nums[index]}\"\n end\n end\n end\n end\n return str\n end", "def separate_comma(num)\n num_s = num.to_s\n\n if num_s.length <= 3\n return num_s\n else\n i = -4\n until i < -num_s.length\n num_s.insert(i,\",\")\n i -= 4\n end\n return num_s\n end\nend", "def splitter(num)\n num = num.to_s.split(\"\")\n num.map(&:to_i)\nend", "def input_pins(nums)\n ar = Array(nums)\n ar.each {|n| input_pin(n)} \n end", "def separate_comma(number)\n a = number.to_s.split('')\n b = a.size/3.0\n if a.size < 4\n number.to_s\n elsif a.size%3 == 0\n n = -4\n (b.to_i-1).times do |i|\n a.insert(n, ',')\n n -= 4\n end\n a.join(\"\")\n else\n n = -4\n b.to_i.times do |i|\n a.insert(n, ',')\n n -= 4\n end\n a.join(\"\")\n end\nend", "def normalize_numbers(_numbers)\n numbers = _numbers.map(&:to_i)\n min = numbers.min\n numbers.map do |n|\n n - min\n end\n end" ]
[ "0.66350985", "0.62873816", "0.62172115", "0.61534023", "0.6141241", "0.6092649", "0.6071896", "0.60180694", "0.5998458", "0.5953342", "0.5944284", "0.5944061", "0.5912464", "0.5882271", "0.5866013", "0.5864152", "0.5853406", "0.584662", "0.5843356", "0.58012307", "0.5800897", "0.5798554", "0.5776339", "0.576544", "0.57651615", "0.5752003", "0.57326126", "0.5730011", "0.572028", "0.57107764", "0.57084835", "0.5706776", "0.57056224", "0.57004493", "0.5693284", "0.5693284", "0.56814", "0.56705797", "0.56682795", "0.5668255", "0.5663516", "0.5661152", "0.56608343", "0.5660598", "0.5660514", "0.5658665", "0.56520134", "0.5650257", "0.5642578", "0.5642578", "0.56399906", "0.5637861", "0.5635736", "0.56345576", "0.5630019", "0.562532", "0.5617593", "0.5616529", "0.561394", "0.5613739", "0.56054264", "0.56043965", "0.5598633", "0.55955726", "0.5593822", "0.55879587", "0.5577503", "0.5577503", "0.5573085", "0.55729884", "0.5570155", "0.5568042", "0.5563464", "0.55585253", "0.5556917", "0.5545533", "0.55413544", "0.5536479", "0.55360585", "0.55341834", "0.5528138", "0.5523043", "0.55227435", "0.55171466", "0.55158514", "0.55155015", "0.55131036", "0.5503326", "0.55031234", "0.55014473", "0.54994404", "0.5498219", "0.5494563", "0.5488902", "0.5487215", "0.54848856", "0.54848635", "0.5484832", "0.54681224", "0.5466351", "0.5464783" ]
0.0
-1
Returns an array of DomainInfo objects from each row of the worksheet
def fetch_certs_from_worksheet(worksheet) # class method domain_infos = Array.new (2..worksheet.num_rows).each do |row| # first row is header domain = worksheet[row, DOMAIN_COL] days_to_notify = fetch_csv_array(worksheet[row, DAYS_COL]) # Don't use row if it is invalid if domain.empty? || !verify_domain(domain) || !int_array_check(days_to_notify) $stderr.puts("Error, row " + row.to_s + " of spreadsheet could not be parsed") next end if days_to_notify.empty? days_to_notify = DEFAULT_DAYS elsif days_to_notify.size == 1 && days_to_notify[0] == SUPPRESSION_SIGNAL next else days_to_notify.map!(&:to_i) end begin expiry_date = fetch_expiry_date(domain) error = '' rescue => e expiry_date = '' error = e.inspect end pagerduty_keys = fetch_csv_array(worksheet[row, PAGERDUTY_COL]) domain_infos.push(DomainInfo.new(domain, pagerduty_keys, expiry_date, days_to_notify, error)) end return domain_infos end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def domains\n domains = []\n nextToken = nil\n base_options = {:Action => 'ListDomains'}\n continue = true\n \n while continue\n options = base_options.dup\n options[:NextToken] = nextToken unless nextToken.nil?\n \n sdb_query(options) do |h|\n h.search('//DomainName').each {|e| domains << Domain.new(self, e.innerText)}\n mt = h.at('//NextToken')\n if mt\n nextToken = mt.innerText\n else\n continue = false\n end\n end\n end\n \n domains\n end", "def go_through_all_the_lines(worksheet_key)\n\n\tdata = []\n\tworksheet = get_worksheet(worksheet_key)\n\n\t# create an array called data in order to store all the emails\n\nworksheet.rows.each do |row|\n\n\t# for each of line of the row we add it into the \"data array\"\n\n\t data << row[1].gsub(/[[:space:]]/, '')\n end \n \n return data\nend", "def response_domains\n grid_rds_qs.map { |x| x.response_domain }\n end", "def get_sheet\n\tsheet = Array.new\n\ti = 1\n\twhile i < RC_C.num_rows\n\t\tsheet[i-1] = RC_C.rows[i]\n\t\ti += 1\n\tend\n\treturn sheet\nend", "def getDomains()\r\n\r\n _dprint(\"getDomains() called ...\")\r\n\r\n valid_tag = \"DOMAINLIST\"\r\n _dprint(\"Getting Domains\")\r\n\r\n mesg = <<XML\r\n <transaction>\r\n <type>3</type>\r\n <data>\r\n <domain-list>null</domain-list>\r\n </data>\r\n </transaction>\r\nXML\r\n reconnect {\r\n xml = _request(mesg)\r\n domains = XPath.match(xml, '//data/domain-list')\r\n }\r\n _dprint(\"Returning Results...\")\r\n return domains\r\n end", "def all\n if(@worksheet_obj.nil?)\n return []\n else\n @worksheet_obj.list.to_hash_array\n end\n end", "def report_data\n @data[:employees].map do |id, employee_data|\n employee = Employee.new(employee_data)\n [employee.name, week_date_ranges.map { |range| \n employee.net_hours_for_date_range(range)} ]\n end\n end", "def all\n\t\tself.google_doc.restart_session_if_necessary\n\t\treset_worksheet_obj if @worksheet_obj == nil\n\t\tif(@worksheet_obj.nil?)\n\t\t\treturn []\n\t\telse\n\t\t\t@worksheet_obj.list.to_hash_array\n\t\tend\n\tend", "def results\n get_domain_data\n end", "def rows\n Array.new self\n end", "def entries\n STDOUT.puts db.entries(@params[:domain]).map{|row| row.to_parsed_h}.to_json\n end", "def domains\n raw_data['domains']\n end", "def domains\n doc = request(\"domain-list_domains\")\n api_error?(doc)\n (doc/:data).inject([]) { |domains, domain| domains << Domain.new_from_xml(domain); domains }\n end", "def _dyn_rows(response)\n rows = []\n response.elements.each('DynTable/Data/tr') do |row|\n rows << _dyn_record(row)\n end\n rows\n end", "def rows_to_array(rows)\n collection = BlocRecord::Collection.new\n rows.each { |row| collection << new(Hash[columns.zip(row)]) }\n collection # return an array\n end", "def rows\n r = []\n cells.group_by {|cell| cell.coordinate.x}.each_pair do |key,value|\n r << Row.new(position: key,cells: value)\n end\n r\n end", "def rows\n (report[\"data\"][\"rows\"] || []).map { |row| Row.new(self, row) }\n end", "def to_a\n @rows\n end", "def load_imported_sites\n arr = Array.new\n CSV.foreach(file.path, headers: true) do |row|\n site = Site.find_by_code(row[\"code\"]) || Site.new\n\n site.build_address if site.address.nil?\n site.build_partner if site.partner.nil?\n site.build_audit if site.audit.nil?\n\n site.attributes = row.to_hash.slice(*Site.accessible_attributes)\n\n site.address.attributes = row.to_hash.dup.inject({}) do |result, (k, v)|\n result[k.gsub(/^address_/,'')] = v if k.start_with?('address_')\n result\n end\n\n site.partner.attributes = row.to_hash.dup.inject({}) do |result, (k, v)|\n result[k.gsub(/^partner_/,'')] = v if k.start_with?('partner_')\n result\n end\n\n site.audit.attributes = row.to_hash.dup.inject({}) do |result, (k, v)|\n result[k.gsub(/^audit_/,'')] = v if k.start_with?('audit_')\n result\n end\n\n sector_attributes = row.to_hash.dup.inject({site_id: site.id}) do |result, (k, v)|\n result[k.gsub(/^sector_/,'')] = v if k.start_with?('sector_')\n result\n end\n\n s = site.sectors.where(\"site_id = ? AND code = ?\", site.id, sector_attributes[\"code\"]).first\n if s.nil?\n s = site.sectors.build(sector_attributes)\n else\n s.attributes = sector_attributes\n end\n\n antenna_attributes = row.to_hash.dup.inject({sector_id: s.id}) do |result, (k, v)|\n result[k.gsub(/^antenna_/,'')] = v if k.start_with?('antenna_')\n result\n end\n\n a = s.antennas.where(\"sector_id = ? AND id = ?\", s.id, antenna_attributes[\"id\"]).first\n if a.nil?\n s.antennas.build(antenna_attributes)\n else\n a.attributes = antenna_attributes\n end\n\n\n arr.push(site)\n end\n arr\n end", "def domains\n collect { |a| a.domain }\n end", "def domains_list\n call('domains.list')[:domains]\n end", "def rows\n @array\n end", "def parse_xlsx\n 2.upto(@spreadsheet.last_row).each do |row_index|\n row = info_hash(row_index)\n \n unless row.nil?\n @data[row[:name]] ||= {\n code: row[:code],\n worlds: [],\n areas: [],\n positions: []\n }\n\n @data[row[:name]][:worlds] << row[:world] if !row[:world].blank? && !@data[row[:name]][:worlds].include?(row[:world])\n @data[row[:name]][:areas] << row[:area] if !row[:area].blank? && !@data[row[:name]][:areas].include?(row[:area])\n @data[row[:name]][:positions] << row[:position] if !row[:position].blank? && !@data[row[:name]][:positions].include?(row[:position])\n end\n end\n end", "def cells\n rows.flatten\n end", "def rows\n CellCollection.new(@data, @column)\n end", "def domains\n []\n end", "def extract_data(args = {})\n sheet_data.rows.map { |row|\n row.cells.map { |c| c && c.value(args) } unless row.nil?\n }\n end", "def rows\n RowCollection.new(@data)\n end", "def get_response()\n # process excel - get the data segments - create hash with headers\n @data = {}\n\n sheet = @excel.sheet\n headers = []\n sheet.getRow(0).cellIterator.each do |h|\n headers << @excel.cell_value(h)\n @data[@excel.cell_value(h) ] = []\n end\n\n @excel.each_row do |row|\n row.cellIterator.each_with_index do |c, i|\n # N.B null row data can spill beyond the columns defined\n @data[headers[i]] << @excel.cell_value(c) if headers[i]\n end\n end\n @data\n end", "def response_domains\n self.response_domain_datetimes.to_a + self.response_domain_numerics.to_a +\n self.response_domain_texts.to_a + self.response_domain_codes.to_a\n end", "def get_row_elements(row)\n @cells[row]\n end", "def parse_excel_file_roo(roo_obj)\n roo_obj.default_sheet = roo_obj.sheets.first\n lines = Array.new\n (1..roo_obj.last_row).each do |r|\n lines << roo_obj.row(r)\n end\n return lines\n end", "def domains\n @domains\n end", "def each_cell(row_xml)\n return [] unless row_xml\n row_xml.children.each do |cell_element|\n coordinate = ::Roo::Utils.extract_coordinate(cell_element[\"r\"])\n hyperlinks = hyperlinks(@relationships)[coordinate]\n\n yield cell_from_xml(cell_element, hyperlinks, coordinate)\n end\n end", "def excel_calculate_sheet(sheet)\n excel_calculated_cells.clear\n\n # Iterate over the used range calculating each cell.\n # The result of each cell is then saved.\n data = []\n begin\n sheet.UsedRange.Rows.each do |row|\n data << row_data = []\n row.Cells.each do |cell|\n # Calculate the cell if required.\n excel_calculate_cell(cell) if cell.HasFormula\n # Get the un-formatted value of this field.\n value = cell.Value2\n row_data << value\n end\n end\n rescue\n @logger.error(format_exception)\n data << [\"#{$!.message} (#{$!.class.name})\"]\n data << [$!.backtrace.join(\"\\n\")]\n end\n # Return the 2d array with all the data.\n data\n end", "def get_data(instance)\n data = []\n unless definition.empty?\n data << instance\n definition.each do |mapping_method|\n data = data.collect{|di| di.respond_to?(mapping_method) ? di.send(mapping_method) : nil}.flatten.compact\n end\n end\n data\n end", "def domains\n @domains ||= ldap.search_domains.map { |base| ldap.domain(base) }\n end", "def domains\n @domains ||= ldap.search_domains.map { |base| ldap.domain(base) }\n end", "def get_cells(rows, columns)\n cells = []\n rows.each do |r|\n columns.each do |c|\n cells << @fields[r][c]\n end\n end\n cells\n end", "def rows(range = 'Sheet1!A1:E')\n get_spreadsheet_data('1eu1Dk67gKnrIgQQ9Fm0Y-RCMzRfZf1UaTQzEt7hjWp0', range)\n end", "def sheets\n @sheetlist\n end", "def rows\n @rows ||=\n begin\n rows = []\n @facet_values.each_slice(2) do |pair|\n rows << new_row(pair)\n end\n rows\n end\n end", "def domains\n request('domain-list_domains').inject([]) { |domains, domain|\n domains << Domain.new(domain)\n }\n end", "def enterprise_proxied_domains\n return @enterprise_proxied_domains\n end", "def to_array(dataset)\n dataset.map do |row|\n entity_class.new row\n end\n end", "def extract_data_from_worksheets\n worksheets do |name, xml_filename|\n \n extract ExtractValues, xml_filename, [name, 'Values']\n apply_rewrite RewriteValuesToAst, [name, 'Values']\n \n extract ExtractSimpleFormulae, xml_filename, [name, 'Formulae (simple)']\n apply_rewrite RewriteFormulaeToAst, [name, 'Formulae (simple)']\n\n extract ExtractSharedFormulae, xml_filename, [name, 'Formulae (shared)']\n apply_rewrite RewriteFormulaeToAst, [name, 'Formulae (shared)']\n\n extract ExtractSharedFormulaeTargets, xml_filename, [name, 'Formulae (shared targets)']\n\n extract ExtractArrayFormulae, xml_filename, [name, 'Formulae (array)']\n apply_rewrite RewriteFormulaeToAst, [name, 'Formulae (array)']\n \n extract_tables_for_worksheet(name,xml_filename)\n end\n end", "def locales_from_xlsx_sheet_row row\n locales = []\n row.each_with_index do |cell, i|\n if i > 0\n locales.push(cell.downcase)\n end\n end\n locales\n end", "def get_my_spreadsheets()\n spreadsheet_feed_response = get_feed(SPREADSHEET_FEED)\n create_datastructure_from_xml(spreadsheet_feed_response.body)\n end", "def to_a\n Array.new @row || nilified_row\n end", "def rows\n links.map { |link| link.row }\n end", "def get\n arr = []\n\n process(csv_file).each do |record|\n arr << SOA_CSV_RECORD.new(*record.fields)\n end\n\n arr\n end", "def extract_data(args = {})\n raw_values = args.delete(:raw) || false\n return @sheet_data.map {|row| row.map {|c| if c.is_a?(Cell) then c.value(:raw => raw_values) else nil end}}\n end", "def rows\n return @rows\n end", "def make_entity_array x\n retval = Array.new\n case x.class.to_s\n when 'Entity'\n retval.push x\n when 'EntityStruct'\n retval.push x.entity\n when 'Array'\n x.each{|elem|\n if elem.class.to_s == 'Entity'\n retval.push elem\n elsif elem.class.to_s == 'EntityStruct'\n retval.push elem.entity\n else\n puts \"ERROR elem.class invalid, is #{elem.class}\"\n end # if\n } # x.each\n else\n puts \"ERROR: input class invalid, is #{x.class}\"\n exit\n end # case\n return retval\n end", "def expand_worksheet(worksheet)\n rows = worksheet.rows.dup\n\n # Take the first row which will be the column names and use the cell value as the field name\n fields = rows.shift.map{ |row| row[/\\w+/] }\n\n instances = []\n # Reject rows of only empty strings (empty cells).\n rows.reject! {|row| row.all?(&:empty?)}\n\n rows.each do |row|\n key_value_pairs = [fields.dup, row.dup].transpose\n hash = Hash[*key_value_pairs.flatten]\n instances.push(hash)\n end\n\n root = {objects: instances }\n return root.to_json.to_s\n end", "def read_domains(org_guid = nil, space_guid = nil)\n domains = []\n\n type = space_guid == nil ? (org_guid == nil ? :none : :org) : :space\n\n cc_domains = @client.domains\n domains_api = case type\n when :org then @client.organization(org_guid).domains + cc_domains.select { |cc_domain| cc_domain.owning_organization == nil }\n when :space then @client.space(space_guid).domains\n else cc_domains\n end\n\n domains_api.each do |domain_api|\n owning_org = domain_api.owning_organization\n owning_org_name = owning_org == nil ? \"Shared\" : owning_org.name\n\n domain_name = domain_api.name\n domain_wildcard = domain_api.wildcard\n domain_spaces = domain_api.spaces rescue []\n domain_guid = domain_api.guid\n\n domains << Domain.new(domain_name, domain_wildcard, owning_org_name, domain_spaces, domain_guid)\n end\n\n domains.uniq {|domain| domain.name }\n end", "def persons\n\t\t\t\treturn @persons.values unless (@persons.nil?)\n\t\t\t\treturn nil\n\t\t\tend", "def getNodeCoordinateRange(domain = \"grid\")\n qs = <<END_QS1\nSELECT x_max, y_max, z_max\n FROM testbeds\nWHERE node_domain = '#{domain}'\nEND_QS1\n \n result = Array.new\n runQuery(qs) { |x, y, z| \n result.push(x) \n result.push(y) \n result.push(z)\n }\n return result\n end", "def domains\n connection.list_domains[:domains]\n end", "def get_domain_data\n get_stored_paths.inject({ 'domain' => base_uri.hostname, 'paths' => {}}) do |hsh, path|\n hsh['paths'][path] = get_path_data(path)\n hsh\n end\n end", "def to_a\n # @rows.collect{|row| row.collect{|e| e}} \n my_rows = @rows\n r_size = my_rows.size\n res = Array.new(r_size)\n for i in 0..r_size-1 do\n res[i] = my_rows[i].dup\n end\n res\n end", "def addresses\n Array(@addresses)\n end", "def to_a\n if parsed_body['result']['companies']\n parsed_body['result']['companies'].map do |_,data|\n Result.new('Entity', renderer.result(data), self).finalize!\n end\n else\n []\n end\n end", "def gather_pollable_domains\n @logger.info 'CsyncJob Generate: Gathering current domain(s) data'\n Nameserver.select(:hostname_puny, :domain_id).all.each do |ns|\n %i[secure insecure].each do |i|\n @input_store[i][ns.hostname_puny] = [] unless @input_store[i].key? ns.hostname_puny\n end\n\n append_domains_to_list(ns)\n end\n end", "def get_data(dimensions)\n data = []\n (0...@m).each do |row_idx|\n row = []\n col_idx = 1\n while col_idx <= dimensions\n row << @x_matrix[row_idx, col_idx]\n col_idx += 1\n end\n row << @y_vector[row_idx, 0]\n data << row\n end\n data\n end", "def coordinates\n arr = []\n (0...@size).each do |row|\n (0...@size).each do |column|\n arr << Coordinate.new(x: row,y: column)\n end\n end\n arr\n end", "def publications_by_subdomain(subdomain)\n rvalue = []\n\n (ActiveFedora::SolrService.query(\"+press_sim:#{subdomain} AND +visibility_ssi:open\", rows: 100_000, sort: \"date_modified_dtsi desc\") || []).each do |solr_doc|\n sm = ::Sighrax.from_solr_document(solr_doc)\n op = ::Opds::Publication.new_from_monograph(sm, true, params[:filterByEntityId])\n rvalue.append(op.to_h) if op.valid?\n end\n\n rvalue\n end", "def get_win_domain_users(windows_domain_sid)\n\n # Randomized start and stop flags\n clue_start = Rex::Text.rand_text_alpha(8)\n clue_end = Rex::Text.rand_text_alpha(8)\n\n # Create array to store the windws accounts etc\n windows_logins = []\n\n # Fuzz the principal_id parameter (RID in this case) passed to the SUSER_NAME function\n (500..datastore['FuzzNum']).each do |principal_id|\n\n # Convert number to hex and fix order\n principal_id_hex = \"%02X\" % principal_id\n principal_id_hex_pad = (principal_id_hex.size.even? ? principal_id_hex : (\"0\"+ principal_id_hex))\n principal_id_clean = principal_id_hex_pad.scan(/(..)/).reverse.flatten.join\n\n # Add padding\n principal_id_hex_padded2 = principal_id_clean.ljust(8, '0')\n\n # Create full sid\n win_sid = \"0x#{windows_domain_sid}#{principal_id_hex_padded2}\"\n\n # Return if sid does not resolve correctly for a domain\n if win_sid.length < 48\n return nil\n end\n\n # Setup query\n sql = \"(SELECT '#{clue_start}'+(SELECT SUSER_SNAME(#{win_sid}) as name)+'#{clue_end}')\"\n\n # Execute query\n result = mssql_query(sql)\n\n # Parse result\n if result && result.body && result.body =~ /#{clue_start}([^>]*)#{clue_end}/\n windows_login = $1\n\n # Print account,group,or computer account etc\n if windows_login.length != 0\n print_status(\"#{peer} - #{windows_login}\")\n\n # Add to windows domain object list\n windows_logins.push(windows_login) unless windows_logins.include?(windows_login)\n\n # Verbose output\n if datastore['VERBOSE']\n print_status(\"Test sid: #{win_sid}\")\n end\n end\n end\n\n end\n\n # Return list of windows accounts\n windows_logins\n end", "def all_cells_array\n if self.metadata_file&.parsed? # nil-safed via &\n query = {\n name: 'All Cells', array_type: 'cells', linear_data_type: 'Study', linear_data_id: self.id,\n study_id: self.id, study_file_id: self.metadata_file.id, cluster_group_id: nil, subsample_annotation: nil,\n subsample_threshold: nil\n }\n DataArray.concatenate_arrays(query)\n else\n all_expression_matrix_cells\n end\n end", "def parse_zones(price_document_class: nil, existing_parsing_errors: nil, zones_worksheet: nil)\n data = data_from_excel_sheet(zones_worksheet)\n\n zones = []\n row_index = ROW_ZONE_DATA_START\n\n # iterate through rows\n while (row_data = data[row_index])\n parse_zone_from_row(price_document_class: price_document_class, existing_zones: zones, existing_parsing_errors: existing_parsing_errors, current_row_index: row_index, row_data: row_data)\n row_index += 1\n end\n\n return zones\n end", "def row_cells\n rowdata = []\n print_layout.each do |section|\n rowdata += row_cell_items(section[:row_cells])\n end\n rowdata\n end", "def iis_domains\n domains = []\n\n # Use the ADSI interface to get all configured domains inside IIS.\n service = WIN32OLE.connect(\"IIS://localhost/w3svc\")\n service.each do |server|\n next unless server.Class == \"IIsWebServer\"\n\n #domain = server.ServerComment\n ip, port, domain = server.ServerBindings.first.split(\":\", 3)\n\n # ignore servers without a \"host\" header (except for the default server).\n if domain.empty?\n next unless server.Name == \"1\"\n domain = \"localhost\"\n end\n\n path = server.GetObject(\"IIsWebVirtualDir\", \"root\").Path\n # NB: Since we don't have the WIN32 extension, I'll not expand the\n # directory, though, we could use the \"Scripting.Shell\" COM object...\n #log_path = Win32::Registry.expand_environ(server.LogFileDirectory) + \"\\\\W3SVC\" + server.Name\n log_path = server.LogFileDirectory + \"\\\\W3SVC\" + server.Name\n\n domains << [domain, path, log_path]\n end\n\n domains\nend", "def read_rows\n line_no = 0\n\n @sheet.rows.each do |r|\n line_no += 1\n row = row_as_array(r)\n next if empty_row?(row)\n\n data = convert_row(row, line_no)\n yield data if block_given?\n end\n end", "def as_array\n row_names = []\n rows = [] \n if @db == @@sdb\n @@sdb.select('select * from `' + @table_name + '`')[:items].each do |row| \n row.each do |row_name, row_data| \n row_names << row_name\n rows << reassemble_sdb_items(row_data)\n end\n end\n elsif @db == @@google_storage\n row_names = as_name_array\n rows = get_rows_from_names(row_names)\n end\n return row_names, rows\n end", "def to_a\n [@trd, @sld, @tld]\n end", "def rows\n @rows\n end", "def rows\n @rows\n end", "def rows\n @rows\n end", "def [](row=0)\n return @sheet_data[row]\n end", "def spreadsheet_row\n fields = []\n fields << self.block.shop_order\n if self.block.shop_order == 111\n 5.times do\n fields << \"\"\n end\n else\n fields << self.block.customer_code\n fields << self.block.process_code\n fields << self.block.part_number\n fields << self.block.part_sub\n fields << self.block.part_name.join(\"\\n\")\n end\n fields << self.block.load\n fields << self.block.is_rework\n fields << self.block.is_early\n fields << self.block.is_strip\n fields << self.block.xray_id\n fields << self.block.application\n fields << self.block.directory\n fields << self.block.product\n fields << self.block.number\n if self.block.user\n fields << self.block.user.employee_number\n fields << self.block.user.name\n else\n fields << \"\"\n fields << \"\"\n end\n fields << self.reading_at.strftime(\"%m/%d/%Y\")\n fields << self.reading_at.strftime(\"%H:%M:%S\")\n fields << self.thickness\n if self.alloy.blank?\n fields << \"\"\n else\n fields << self.alloy\n end\n fields << self.x_coordinate\n fields << self.y_coordinate\n fields << self.z_coordinate\n return fields\n end", "def get_data_array(handles)\n return [] unless handles && handles.any?\n\n entity_class_name_for_soap_request = entity_class.name.split('::').last\n response = request(:get_data_array, {'entityHandles' => {\"#{entity_class_name_for_soap_request}Handle\" => handles.collect(&:to_hash)}})\n [response[\"#{entity_class.key}_data\".intern]].flatten\n end", "def cells\n rows.map { |r| r[key] }\n end", "def domain_memberships\n data[:domain_memberships]\n end", "def domain_memberships\n data[:domain_memberships]\n end", "def domains\n @_domains ||= mxers.map { |m| Host.new(m.first).domain_name }.sort.uniq\n end", "def getRows\n return @grid.getRows\n end", "def cells\r\n assert_exists \r\n arr_cells = get_cells\r\n row_cells = Array.new(arr_cells.length)\r\n for i in 0..arr_cells.length - 1 do\r\n row_cells[i] = TableCell.new(@container, :jssh_name, arr_cells[i])\r\n end\r\n return row_cells\r\n end", "def get_people(detail_page)\n first_table = detail_page.search('div#ctl00_MainBodyContent_group_17 table.ContentPanel')\n people_array = [] \n if first_table\n list_tr = first_table.search('tr')\n for i in 1..list_tr.length-1\n list_td = list_tr[i].search('td')\n people_obj = {}\n people_obj[:role] = clean_whitespace(list_td[0].inner_text)\n people_obj[:name] = clean_whitespace(list_td[1].inner_text)\n people_obj[:address] = clean_whitespace(list_td[2].inner_text)\n \n people_array << people_obj\n end\n else\n return \"\"\n end\n return people_array\nend", "def get_people(detail_page)\n first_table = detail_page.search('div#ctl00_MainBodyContent_group_17 table.ContentPanel')\n people_array = [] \n if first_table\n list_tr = first_table.search('tr')\n for i in 1..list_tr.length-1\n list_td = list_tr[i].search('td')\n people_obj = {}\n people_obj[:role] = clean_whitespace(list_td[0].inner_text)\n people_obj[:name] = clean_whitespace(list_td[1].inner_text)\n people_obj[:address] = clean_whitespace(list_td[2].inner_text)\n \n people_array << people_obj\n end\n else\n return \"\"\n end\n return people_array\nend", "def employees\n employee_array = []\n locations.each do |location|\n location.employees.each do |employee|\n employee_array << employee\n end\n end\n employee_array\n end", "def get_dns_values (components)\n values = Array.new\n components.each do |component|\n\n attrs = component['ciAttributes']\n\n dns_record = attrs['dns_record'] || ''\n\n # backwards compliance: until all computes,lbs,clusters have dns_record populated need to get via case stmt\n if dns_record.empty?\n case component['ciClassName']\n when /Compute/\n if attrs.has_key?('public_dns') && !attrs['public_dns'].empty?\n dns_record = attrs['public_dns']+'.'\n else\n dns_record = attrs['public_ip']\n end\n\n if location == '.int' || dns_entry == nil || dns_entry.empty?\n dns_record = attrs['private_ip']\n end\n\n when /Lb/\n dns_record = attrs['dns_record']\n when /Cluster/\n dns_record = attrs['shared_ip']\n end\n else\n # unless ends w/ . or is an ip address\n dns_record += '.' unless dns_record =~ /,|\\.$|^\\d+\\.\\d+\\.\\d+\\.\\d+$/\n end\n\n if dns_record.empty?\n Chef::Log.error('azuredns:build_entries_list.rb - cannot get dns_record value for: '+component.inspect)\n exit 1\n end\n\n if dns_record =~ /,/\n values.concat dns_record.split(',')\n else\n values.push(dns_record)\n end\n end\n return values\nend", "def get_array_by_row()\n\t\tprepare(@dim_i,@dim_j)\n\t\treturn @myTab\n\tend", "def entries\n return Array(@entries)\n end", "def loadstudents\n #service = googleauthorisation(request)\n returned_authorisation = googleauthorisation(request)\n if returned_authorisation[\"authorizationurl\"]\n redirect_to returned_authorisation[\"authorizationurl\"] and return\n end\n service = returned_authorisation[\"service\"]\n #spreadsheet_id = '1CbtBqeHyYb9jRmROCgItS2eEaYSwzOMpQZdUWLMvjng'\n spreadsheet_id = current_user[:ssurl].match(/spreadsheets\\/d\\/(.*?)\\//)[1]\n logger.debug 'about to read spreadsheet'\n startrow = 3\n # first get the 3 columns - Student's Name + Year, Focus, study percentages\n range = \"STUDENTS!A#{startrow}:C\"\n response = service.get_spreadsheet_values(spreadsheet_id, range)\n @students = Array.new(response.values.length){Array.new(11)}\n #logger.debug \"students: \" + @students.inspect\n basecolumncount = 1 #index for loading array - 0 contains spreadsheet row number\n rowcount = 0\t\t\t \n response.values.each do |r|\n #logger.debug \"============ row #{rowcount} ================\"\n #logger.debug \"row: \" + r.inspect\n colcount = 0\n @students[rowcount][0] = rowcount + startrow\n r.each do |c|\n #logger.debug \"============ cell value for column #{colcount} ================\"\n \t #logger.debug \"cell value: \" + c.inspect\n \t @students[rowcount][basecolumncount + colcount] = c\n \t\t colcount = colcount + 1\n end\n rowcount = rowcount + 1\n end\n basecolumncount += 3\n # second get the 1 column - email\n range = \"STUDENTS!E#{startrow}:E\"\n response = service.get_spreadsheet_values(spreadsheet_id, range)\n #logger.debug \"students: \" + @students.inspect\n rowcount = 0\t\t\t \n response.values.each do |r|\n #logger.debug \"============ row #{rowcount} ================\"\n #logger.debug \"row: \" + r.inspect\n colcount = 0\n r.each do |c|\n #logger.debug \"============ cell value for column #{colcount} ================\"\n \t #logger.debug \"cell value: \" + c.inspect\n \t @students[rowcount][basecolumncount + colcount] = c\n \t\t colcount = colcount + 1\n end\n rowcount = rowcount + 1\n end\n basecolumncount += 1\n #third get the perferences and invcode\n range = \"STUDENTS!L#{startrow}:M\"\n response = service.get_spreadsheet_values(spreadsheet_id, range)\n rowcount = 0\n response.values.each do |r|\n colcount = 0\n r.each do |c|\n \t @students[rowcount][basecolumncount + colcount] = c\n \t\t colcount = colcount + 1\n end\n rowcount = rowcount + 1\n end\n basecolumncount += 2\n #fourth get the 3 columns daycode, term 4, daycode\n # these will be manipulated to get the savable daycode\n range = \"STUDENTS!P#{startrow}:R\"\n response = service.get_spreadsheet_values(spreadsheet_id, range)\n rowcount = 0\n response.values.each do |r|\n colcount = 0\n r.each do |c|\n \t @students[rowcount][basecolumncount + colcount] = c\n \t\t colcount = colcount + 1\n end\n rowcount = rowcount + 1\n end\n basecolumncount += 3\n #logger.debug \"students: \" + @students.inspect\n # Now to update the database\n loopcount = 0 # limit output during testing\n @students.each do |t| # step through all ss students\n pnameyear = t[1]\n logger.debug \"pnameyear: \" + pnameyear.inspect\n if pnameyear == \"\" || pnameyear == nil\n t[10] = \"invalid pnameyear - do nothing\"\n next\n end\n #pnameyear[/^zz/] == nil ? status = \"active\" : status = \"inactive\"\n name_year_sex = getStudentNameYearSex(pnameyear)\n pname = name_year_sex[0]\n year = name_year_sex[1]\n sex = name_year_sex[2]\n status = name_year_sex[3]\n logger.debug \"pname: \" + pname + \" : \" + year + \" : \" +\n sex.inspect + \" : \" + status\n # day code\n # use term 3 code unless a term 4 code, then take term 4\n t[9] == \"\" || t[9] == nil ? usedaycode = t[7] : usedaycode = t[9]\n # check if alrady an entry in the database\n # if so, update it. else create a new record.\n db_student = Student.find_by pname: pname\n if(db_student) # already in the database\n flagupdate = 0 # detect if any fields change\n updatetext = \"\"\n # first get the 4 columns - 1. Student's Name + Year, 2. Focus,\n # 3. study percentages, 4. email\n # now get the 5. perferences and 6. invcode\n # now get the 7. daycode, 8. term 4, 9. daycode\n if db_student.year != year\n db_student.year = year\n flagupdate = 1\n updatetext = updatetext + \" - year\" \n end\n if sex\n if db_student.sex != sex\n db_student.sex = sex\n flagupdate = 1\n updatetext = updatetext + \" - sex (\" + sex + \")\"\n end\n end\n if db_student.comment != t[2]\n db_student.comment = t[2]\n flagupdate = 1\n updatetext = updatetext + \" - comment\" \n end\n if db_student.study != t[3]\n db_student.study = t[3]\n flagupdate = 1\n updatetext = updatetext + \" - study percentages\" \n end\n if db_student.email != t[4]\n db_student.email = t[4]\n flagupdate = 1\n updatetext = updatetext + \" - email\" \n end\n if db_student.preferences != t[5]\n db_student.preferences = t[5]\n flagupdate = 1\n updatetext = updatetext + \" - preferences\" \n end\n if db_student.invcode != t[6]\n db_student.invcode = t[6]\n flagupdate = 1\n updatetext = updatetext + \" - invoice code\" \n end\n if db_student.daycode != usedaycode\n db_student.daycode = usedaycode\n flagupdate = 1\n updatetext = updatetext + \" - day code\" \n end\n if db_student.status != status\n db_student.status = status\n flagupdate = 1\n updatetext = updatetext + \" - status\" \n end\n logger.debug \"flagupdate: \" + flagupdate.inspect + \" db_student: \" + db_student.inspect\n if flagupdate == 1 # something changed - need to save\n if db_student.save\n logger.debug \"db_student saved changes successfully\"\n t[10] = \"updated #{db_student.id} \" + updatetext \n else\n logger.debug \"db_student saving failed - \" + @db_student.errors\n t[10] = \"failed to update\"\n end\n else\n t[10] = \"no changes\"\n end\n else\n # This Student is not in the database - so need to add it.\n #\n # first get the 4 columns - 1. Student's Name + Year, 2. Focus,\n # 3. study percentages, 4. email\n # now get the 5. perferences and 6. invcode\n # now get the 7. daycode, 8. term 4, 9. daycode\n @db_student = Student.new(\n pname: pname,\n year: year,\n comment: t[2],\n study: t[3],\n email: t[4],\n preferences: t[5],\n invcode: t[6],\n daycode: usedaycode,\n status: status,\n sex: sex\n )\n logger.debug \"new - db_student: \" + @db_student.inspect\n if @db_student.save\n logger.debug \"db_student saved successfully\"\n t[10] = \"created #{@db_student.id}\" \n else\n logger.debug \"db_student saving failed - \" + @db_student.errors.inspect\n t[10] = \"failed to create\"\n end\n end\n #exit\n if loopcount > 2\n #break\n end\n loopcount += 1\n end\n end", "def cell_rows\n cells = []\n\n # for each row\n 1.upto(3).each do |row|\n rows = []\n # for each column\n 1.upto(3).each do |column|\n rows << get_cell_value(row, column)\n end\n\n cells << rows\n end\n\n cells\n end", "def spreadsheet_annotation_search_fields\n annotations = []\n unless content_blob.nil?\n content_blob.worksheets.each do |ws|\n ws.cell_ranges.each do |cell_range|\n annotations = annotations | cell_range.annotations.collect{|a| a.value.text}\n end\n end\n end\n annotations\n end", "def get_subdomains entity_name, api_key, headers, url\n\n response = http_get_body(url,nil,headers)\n json = JSON.parse(response)\n\n #check if entries different to null\n if json[\"count\"] != 0\n # Create subdomains\n json[\"cidr\"][\"cidr16\"][\"results\"].each do |e|\n e[\"data\"][\"domains\"].each do |s|\n _create_entity(\"DnsRecord\", \"name\" => s)\n end\n end\n # Create subdomains\n json[\"cidr\"][\"cidr24\"][\"results\"].each do |e|\n e[\"data\"][\"domains\"].each do |s|\n _create_entity(\"DnsRecord\", \"name\" => s)\n end\n end\n\n # Create list of related organizations\n json[\"data\"][\"as\"][\"results\"].each do |e|\n _create_entity(\"Organization\", \"name\" => e[\"entity\"][\"organization\"])\n end\n\n # Create list of related countrys\n json[\"data\"][\"country\"][\"results\"].each do |e|\n _create_entity(\"PhysicalLocation\", \"name\" => e[\"entity\"][\"value\"])\n end\n\n # Create list of related IPs\n json[\"data\"][\"ip\"][\"results\"].each do |e|\n _create_entity(\"IpAddress\", \"name\" => e[\"entity\"][\"value\"])\n end\n end\n end", "def to_a\n result = []\n @domains.values.each do |paths|\n paths.values.each do |cookies|\n cookies.values.inject result, :<<\n end\n end\n result\n end", "def getNameserverIPs(domain, addrtype = Resolv::DNS::Resource::IN::A)\n myresolv = Resolv::DNS.new()\n\n nameserver_addresses=Array.new\n myresolv.each_resource(domain, Resolv::DNS::Resource::IN::NS) do |nsrsc|\n nameserver_addresses.push(myresolv.getresource(nsrsc.name, addrtype).address)\n end\n\n myresolv.close()\n\n return nameserver_addresses\nend", "def domains\n\tfetch(\"/Domain.List\")\nend" ]
[ "0.5899116", "0.58338934", "0.5830932", "0.5611918", "0.5611415", "0.5598804", "0.558254", "0.5574978", "0.5567311", "0.5497265", "0.5456864", "0.54358953", "0.5430412", "0.5346233", "0.53373265", "0.5312618", "0.53106946", "0.5273791", "0.52662134", "0.525596", "0.5255676", "0.52488357", "0.5247941", "0.52427053", "0.52252746", "0.52143073", "0.51937026", "0.5188206", "0.5187988", "0.5187755", "0.5183264", "0.5168547", "0.5166806", "0.515169", "0.51419634", "0.5140393", "0.51321954", "0.51321954", "0.5118505", "0.50954944", "0.50901467", "0.5073316", "0.50636536", "0.50550663", "0.5054336", "0.5048961", "0.5048581", "0.50443286", "0.50304174", "0.5025249", "0.5017694", "0.5017163", "0.5016712", "0.49994284", "0.49799776", "0.49752933", "0.4974434", "0.49680552", "0.49632588", "0.49559695", "0.49501815", "0.49491146", "0.49394652", "0.49327433", "0.49319637", "0.4931884", "0.49218452", "0.492169", "0.49051425", "0.4890439", "0.48882154", "0.48867196", "0.48789674", "0.4877588", "0.4864503", "0.48585021", "0.48585021", "0.48585021", "0.4854828", "0.48540246", "0.48475975", "0.48465988", "0.48465887", "0.48465887", "0.48412552", "0.48342046", "0.48324063", "0.4831636", "0.4831636", "0.48252475", "0.48230967", "0.4813592", "0.4812873", "0.48010257", "0.47986782", "0.4794524", "0.4786902", "0.4785951", "0.47816905", "0.4777528" ]
0.73706734
0
for subaction in check_access_right
def index @title = @for_which.sub('_', ' ').pluralize.titleize #ex, Quality Systems @definitions = params[:two_tier_definitionx_definitions][:model_ar_r] @definitions = @definitions.where(:for_which => @for_which) @definitions = @definitions.page(params[:page]).per_page(@max_pagination).order('ranking_index') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_access_control_all\n @user = User.find(params[:user_id])\n\n response_access_denied unless current_user.has_role?(:admin) || current_user.id == @user.id\n rescue\n response_access_denied\n end", "def check_can_access\n res = false\n read_actions = [ \"index\", \"list\", \"edit\" ]\n new_actions = [ \"new\", \"create\" ]\n edit_actions = [ \"edit\", \"update\", \"destroy\", \"update_logo\" ]\n\n res ||= (action_name == \"show_logo\")\n res ||= current_user.admin?\n\n if current_user.option_externalclients?\n res ||= (current_user.read_clients? and read_actions.include?(action_name))\n res ||= (current_user.edit_clients? and edit_actions.include?(action_name))\n res ||= (current_user.create_clients? and new_actions.include?(action_name))\n end\n\n if !res\n flash[\"notice\"] = _(\"Access denied\")\n redirect_from_last\n end\n end", "def AccessRights=(arg0)", "def test_set3_16_check()\n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n acc_type = 'deny' \n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n end", "def access_control\n \n end", "def verify_rights\n access_allowed?(params.slice(:controller, :action)) || permission_denied\n end", "def user_access_control_all\n @user = User.find(params[:user_id])\n\n unless !@user.admin? && current_user.admin? || current_user?(@user)\n response_access_denied\n end\n\n rescue\n response_access_denied\n end", "def check_access_control\n @bot = Bot.find(params[:id])\n\n response_access_denied unless current_user.has_role?(:admin) || current_user.id == @bot.account.user_id\n rescue\n response_access_denied\n end", "def check_permission_again\n action = params[:action].to_sym\n action = :read if action == :index || action == :show\n user = current_admin_user\n\n # Build resource from controller and params[:id]\n # Because sometimes we limit via proc, eg open current_admin_user\n subject = supervisor_resource_name.to_sym\n begin\n if !active_admin_config.is_a?(ActiveAdmin::Page)\n klass = active_admin_config.resource_class\n subject = if klass && params[:id]\n klass.find_by_id(params[:id]) || klass\n else\n klass\n end\n end\n rescue Object => error\n $stderr.puts error.message\n $stderr.puts error.backtrace\n end\n\n if !user.can?(action, subject, params)\n Rails.logger.info \"Deny access for #{supervisor_resource_name}/#{action} to #{user.class}:#{user.id}\"\n # raise ActiveAdmin::AccessDenied(...) # This is supposed way, but I prefer to redirect back\n flash[:error] = \"You don't have access to that page\"\n redirect_back_or_to \"/admin\"\n return false\n end\n rescue Object => error\n $stderr.puts error.message\n $stderr.puts error.backtrace\n end", "def has_access?( action )\n unless( action_name == :show && @sir_item.sir_log.permitted_to_access?( current_user.id )) ||\n @sir_item.sir_log.permitted_to_update?( current_user.id )\n render_no_access \n return false\n end\n g = [ :new, :create ].include?( action_name ) ? @sir_item.resp_next_entry : @sir_entry.resp_this_entry\n unless current_user.permission_to_access( feature_identifier, action, g.id )\n render_no_permission \n return false\n end\n true\n end", "def check_access\n return true if params[:controller] =~ /newrelic|login|heartbeat|awstats/\n\n #if params[:controller] =~ \"api_login\"\n # logger.info \"APILOGIN: #{params.inspect}\"\n #end\n # check controller\n if !params[:id].blank? && params[:controller] =~ /score|faq/\n if current_user && (current_user.access?(:all_users) || current_user.login_user?)\n if session[:journal_entry]\n logger.info \"REQUEST #{params[:controller]}/#{params[:action]} #{'/' + (params[:id] || \"\")} cookie: '#{session[:journal_entry]}' user: '#{current_user.id}' @ #{9.hours.from_now.to_s(:short)}\"\n end\n # cookies_required # redirects if cookies are disabled\n if params[:action] =~ /edit|update|delete|destroy|show|show.*|add|remove/\n # RAILS_DEFAULT_LOGGER.debug \"Checking access for user #{current_user.login}:\\n#{params[:controller]} id: #{params[:id]}\\n\\n\"\n id = params[:id].to_i\n return check_controller_access(params[:controller], params[:answers]) # access\n # end\n else\n puts \"ACCESS FAILED: #{params.inspect}\"\n params.clear\n redirect_to login_path\n end\n end\n return true\n end\n\n def check_controller_access(controller, answers)\n case controller\n when /faq/\n access = current_user.access?(:superadmin) || current_user.access?(:admin)\n when /score_reports|answer_reports/ # TODO: test this one!!!\n access = if answers\n answers.keys.all? { |entry| current_user.has_journal? entry }\n else\n current_user.has_journal? id\n end\n when /scores/\n access = current_user.access? :superadmin\n when /group|role/\n access = current_user.access? :superadmin\n else\n puts \"APP CHECKACCESS #{params.inspect}\"\n access = current_user.access? :superadmin\n end\n return access\n end\n end", "def test_set3_14_check() \n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n acc_type = 'deny'\n res_ob_adrs='/db/temp/test'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs) \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n end", "def has_access?( action )\n unless @sir_log.permitted_to_access?( current_user.id )\n render_no_access\n return false\n end\n return true if [ 'index', 'new', 'create', 'show_stats' ].include?( action_name )\n unless current_user.permission_to_access( feature_identifier, action, @sir_item.group_id )\n render_no_permission \n return false \n end\n return true\n end", "def action_allowed?\n if %w[edit update list_submissions].include? params[:action]\n current_user_has_admin_privileges? || current_user_teaching_staff_of_assignment?(params[:id])\n else\n current_user_has_ta_privileges?\n end\n end", "def verify_rights\n access_allowed?(controller_action_options) || permission_denied\n end", "def process_assignment_checks(user)\n can :read, AssignmentCheck do |check|\n if check.assignment_repository.user == user\n true\n else\n co = check.assignment_repository.assignment_offering.course_offering\n role = co.role_for_user(user)\n role.can_view_other_submissions?\n end\n end\n end", "def has_access? cls,action\n has_access = true\n cls.each{|c| has_access = false unless all_user_modules.map(&:controller).include?(c)}\n if has_access\n mod = all_user_modules.select{|m| m.controller == cls.last}.first\n has_access = self.permissions.select{|p| p.module_id == mod.id}.map(&:action).include?(action.to_s)\n end\n has_access\n end", "def create\n @company = Company.find(params[:company_id])\n @role = Role.find(params[:role_id])\n access_right_hash = params[:access_right]\n \n if current_user.super_admin\n is_ok = true\n else\n current_user.roles.each { |r|\n r.access_rights.each { |ar|\n puts access_right_hash['model_name']\n if ar.model_name == access_right_hash['model_name'] && ar.action == access_right_hash['action']\n is_ok = true\n end\n }\n }\n end\n \n respond_to do |format|\n if is_ok\n @access_right = @role.access_rights.create(params[:access_right])\n @access_right.company_id = current_user.company_id\n @access_right.save\n format.html { redirect_to company_role_path(@company, @role) }\n else\n format.html { redirect_to company_role_path(@company, @role), notice: 'Usted no puede conceder este permiso.' }\n end\n end\n end", "def action_allowed?\n case params[:action]\n when 'show', 'set_priority', 'index'\n ['Instructor',\n 'Teaching Assistant',\n 'Administrator',\n 'Super-Administrator',\n 'Student'].include?(current_role_name) &&\n ((%w[list].include? action_name) ? are_needed_authorizations_present?(params[:id], 'participant', 'reader', 'submitter', 'reviewer') : true)\n else\n ['Instructor',\n 'Teaching Assistant',\n 'Administrator',\n 'Super-Administrator'].include? current_role_name\n end\n end", "def accountant_allow_edit(permission)\n return accountant_right(permission) == 2\n end", "def check_ownership \t\n \taccess_denied(:redirect => @check_ownership_of) unless current_user_owns?(@check_ownership_of)\n end", "def action_allowed?\n return true if ['Instructor', 'Teaching Assistant', 'Administrator', 'Super-Administrator'].include? current_role_name\n @teams = TeamsUser.where(user_id: current_user.try(:id))\n @teams.each do |team|\n return true if Team.where(id: team.team_id).first.parent_id == sample_submission_params[:id].to_i\n end\n false\n end", "def test_set3_13_check() \n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'ALL_PRIVILEGES'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n prin_name = 'Klubicko'\n acc_type = 'deny'\n priv_name = 'ALTER'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n priv_name = 'ALTER'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n priv_name = 'DROP'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n end", "def allowed_to?(action, context, options={}, &block)\n if context && context.is_a?(Project)\n # No action allowed on archived projects\n return false unless context.active?\n # No action allowed on disabled modules\n return false unless context.allows_to?(action)\n # Admin users are authorized for anything else\n return true if admin?\n # Sandro -> risolve il problema che un author non puo' vedere le edizioni\n return true if User.current.isauthor?\n return true if User.current.ismanager?\n # fine sandro\n roles = roles_for_project(context)\n return false unless roles\n roles.detect { |role|\n (context.is_public? || role.member?) &&\n role.allowed_to?(action) &&\n (block_given? ? yield(role, self) : true)\n }\n elsif context && context.is_a?(Array)\n # Authorize if user is authorized on every element of the array\n context.map do |project|\n allowed_to?(action, project, options, &block)\n end.inject do |memo, allowed|\n memo && allowed\n end\n elsif options[:global]\n # Admin users are always authorized\n return true if admin?\n\n # authorize if user has at least one role that has this permission\n roles = memberships.collect { |m| m.roles }.flatten.uniq\n roles << (self.logged? ? Role.non_member : Role.anonymous)\n roles.detect { |role|\n role.allowed_to?(action) &&\n (block_given? ? yield(role, self) : true)\n }\n else\n false\n end\n end", "def test_set3_15_check() \n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n \n res_ob_adrs='/db/temp/test' \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp/test/hokus'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n end", "def test_set3_17_check() \n prin_name = 'nikdo'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp/*'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp/*'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n \n res_ob_adrs='/db/temp'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp/test'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n \n res_ob_adrs='/db/temp/test/hokus'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n end", "def admin_actions(user)\n can_act_as_logged_in_user(user)\n can_view_any_profile\n can_view_any_gallery\n can_edit_saved_queries\n can_curate\n can_update_metadata\n can_administer\n end", "def check_access_data(*args)\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\t#LOG.debug(fname) {\"************** args=#{args}\"}\n\t\t##############instance_variable_names.each {|vi| LOG.debug(fname) {\"#{vi} = #{eval vi}\"}}\n\t\t#@current_user = syl/creator/SICM/\n\t\t#index:\n\t\t#@_params = {\"controller\"=>\"documents\", \"action\"=>\"index\"}\n\t\t#@object_plms = {:recordset=>[#<Document id: 2, owner_id: 101, typesobject_id: 873691851, statusobject_id: 4, next_status_id: nil, previous_status_id: nil, ident: \"DOC000064\", revision: \"0\", designation: \"Designation document\", description: \"\", date: \"2013-12-07\", created_at: \"2013-12-07 09:45:44\", updated_at: \"2013-12-07 09:45:44\", group_id: 101, projowner_id: 2, domain: \"\", type_values: nil>], :query=>nil, :page=>nil, :total=>1, :nb_items=>nil, :conditions=>[\"( group_id in (101) or projowner_id in (2))\", {}]}\n\t\t#show\n\t\t#@_params = {\"controller\"=>\"documents\", \"action\"=>\"show\", \"id\"=>\"2\", \"view_id\"=>1}\n\t\t#@object_plm = DOC000064/0-Designation document-cdc-inwork\n\t\t#edit\n\t\t#@_params = {\"controller\"=>\"documents\", \"action\"=>\"edit\", \"id\"=>\"2\"}\n\t\t#@object_plm = DOC000064/0-Designation document-cdc-inwork\n\t\t#@types = [#<Typesobject id: 1016696961, forobject: \"document\", n...\n\t\t#new\n\t\t#@_params = {\"controller\"=>\"documents\", \"action\"=>\"new\"}\n\t\t#@object_plm = DOC000067/0-Designation document-directory-inwork\n\t\t#@types = [#<Typesobject id: 1045584116, forobject: \"document\", name: \"any_type\", fields: \"{}\", description: \"\", created_at: \"2013-12-06 17:53:07\", updated_at: \"2013-12-06 17:53:07\", domain: \"admin\">, #<Typesobject id: 1016696961, forobject: \"document\", name: \"calculsheet\", fields: \"{\\\"ref_doc\\\": \\\"\\\"}\", description: \"Feuille de calcul\", created_at: \"2013-12-06 17:53:07\", updated_at: \"2013-12-06 17\n\t\t#edit_lifecycle\n\t\t#@_params = {\"controller\"=>\"documents\", \"action\"=>\"edit_lifecycle\", \"id\"=>\"2\"}\n\t\t#@object_plm = DOC000064/0-Designation document-cdc-inwork\n\t\t#add_clipboard\n\t\t#@_params = {\"authenticity_token\"=>\"1UofyUu3oSh/gswSNcrVVuiSklPBsIroOCERrKBZEEc=\", \"controller\"=>\"documents\", \"action\"=>\"add_clipboard\", \"id\"=>\"2\"}\n\t\t#dupliquer\n\t\t#@_params = {\"controller\"=>\"documents\", \"action\"=>\"new_dup\", \"id\"=>\"2\"}\n\t\t#@object_orig = DOC000064/0-Designation document-cdc-inwork\n\t\t#@object = DOC000069/0-Designation document-cdc-inwork\n\t\t#@object_plm = DOC000069/0-Designation document-cdc-inwork\n\t\t#@types = [#<Typesobject id: 1045584116, forobject: \"document\", name: \"any_type\", fiel\n\t\t#\n\t\t#\n\t\tif @_params[:controller]==\"main\" && @_params[:action]==\"index\"\n\t\tret=true\n\t\telse\n\t\tret=true #false\n\t\tend\n\t\tret\n\tend", "def access action\n\t\tif current_user\n \treturn true\n else\n \treturn false\n end\n\n\tend", "def can_run_by_profile?(action)\r\nreturn false unless self.active?\r\nif self.new_record?\r\n prof = Profile.where(:name => 'Not Logged').first\r\n return prof.can_run?(action) if prof\r\nelsif action.is_a?(Hash)\r\n cond = [\"profile_id IN (?) AND accesses.action_sid = ? AND accesses.table_sid = ?\", self.profile_ids, action[:action_sid], action[:table_sid]]\r\n return ProfileAccess.where(cond).include(:access).first\r\nelsif action.is_a?(Access)\r\n return ProfileAccess.exists?(:profile_id => self.profile_ids, :access_id => action.id)\r\nend\r\nend", "def reseller_allow_edit(permission)\n return reseller_right(permission) == 2\n end", "def check_access\n permission_denied unless can_census?(year)\n end", "def check_rights\n unless is_app_authorizer?\n logger.warn 'User is not lea or sea admin and cannot access application authorizations'\n raise ActiveResource::ForbiddenAccess, caller\n end\n end", "def check_authorization\r\n params[:table] ||= params[:t] || CmsHelper.form_param(params)\r\n # Only show menu\r\n return login if params[:id].in?(%w(login logout test))\r\n\r\n table = params[:table].to_s.strip.downcase\r\n set_default_guest_user_role if session[:user_roles].nil?\r\n # request shouldn't pass\r\n if table != 'dc_memory' and \r\n (table.size < 3 or !dc_user_can(DcPermission::CAN_VIEW))\r\n return render(action: 'error', locals: { error: t('drgcms.not_authorized')} )\r\n end\r\n dc_form_read\r\n\r\n # Permissions can be also defined on form\r\n #TODO So far only can_view is used. Think about if using other permissions has sense\r\n can_view = @form.dig('permissions','can_view')\r\n if can_view.nil? or dc_user_has_role(can_view)\r\n extend_with_control_module\r\n else\r\n render(action: 'error', locals: { error: t('drgcms.not_authorized')} )\r\n end \r\nend", "def check_access_control_account_all\n @account = Account.find(params[:account_id])\n\n response_access_denied unless current_user.has_role?(:admin) || current_user.id == @account.user_id\n rescue\n response_access_denied\n end", "def access_controls_for(object)\n all_acls.select{ |ac| ac.access_to_id == object.id }\n end", "def access_rights\n convert_byte_to_access_rights @access_rights if @access_rights\n end", "def create_access_check\n permission_check('create')\n end", "def create_access_check\n permission_check('create')\n end", "def create_access_check\n permission_check('create')\n end", "def has_access?\n true\n end", "def has_access?\n true\n end", "def set_access_rights\n # @access_rights = current_v1_user.rights.where(campground_id: params[:campground_id])\n @access_rights = User.find(1).rights.find_by(campground_id: params[:campground_id])\n end", "def has_access? c\n access_rights[controller2right c] == '1'\n end", "def check_accessible\n if current_user\n myaction=Action.find_controller_action(params[:controller], params[:action])\n raise \"Page not found\" unless !myaction || myaction.accessible(current_user) || Group.find(2).has_user(current_user) # this is a nasty hack to stop errors because there are links to actions accessible only by users. Need to sort out access management!!\n end\n end", "def check_if_user_can_perform_action_on_user\n is_current_user = (admin_user == @item)\n current_user_is_root = admin_user.is_root? && is_current_user\n\n case params[:action]\n when 'edit'\n # Edit other items is not allowed unless current user is root\n # and is not the current user.\n not_allowed if admin_user.is_not_root? && !is_current_user\n when 'toggle', 'destroy'\n not_allowed if admin_user.is_not_root? || current_user_is_root\n when 'update'\n # Admin can update himself except setting the status to false!. Other\n # users can update their profile as the attributes (role & status)\n # are protected.\n status_as_boolean = params[@object_name][:status] == \"1\" ? true : false\n\n status_changed = !(@item.status == status_as_boolean)\n role_changed = !(@item.role == params[@object_name][:role])\n\n root_changed_his_status_or_role = current_user_is_root && (status_changed || role_changed)\n not_root_tries_to_change_another_user = admin_user.is_not_root? && !is_current_user\n\n not_allowed if root_changed_his_status_or_role || not_root_tries_to_change_another_user\n end\n end", "def check_user_rights\n if( params[:id] && !admin_authorized? )\n @bundle = Bundle.find(params[:id])\n if( ! @bundle.public )\n if( @bundle.created_by_user_id != @user.id )\n \t\t\t\trender :action => \"not_allowed\" \n end\n end\n end\n end", "def action_allowed?\n case params[:action]\n when 'edit'\n @questionnaire = Questionnaire.find(params[:id])\n current_user_has_admin_privileges? ||\n (current_user_is_a?('Instructor') && current_user_id?(@questionnaire.try(:instructor_id))) ||\n (current_user_is_a?('Teaching Assistant') && session[:user].instructor_id == @questionnaire.try(:instructor_id))\n else\n current_user_has_student_privileges?\n end\n end", "def has_access_to(cp)\n if can_review(cp) || can_edit(cp) || is_admin\n true\n end\n\n end", "def authorize_access\n # byebug\n redirect_to root_path, alert: \"Access Denied\" unless can? :modify, Post\n end", "def action_allowed?\n ['Instructor',\n 'Teaching Assistant',\n 'Administrator'].include? current_role_name\n end", "def action_allowed?\n ['Instructor',\n 'Teaching Assistant',\n 'Administrator'].include? current_role_name\n end", "def action_allowed?\n ['Instructor',\n 'Teaching Assistant',\n 'Administrator'].include? current_role_name\n end", "def action_allowed?\n current_user_has_student_privileges?\n end", "def checkAcl(path,principal,readGranted,writeGranted)\n acl = @authz.getacl(path)\n\t# check user1\n\tassert_not_nil(acl[principal],\"Expected for find ACE for #{principal}\"+@authz.hashToString(acl))\n\tace = acl[principal]\n\tif ( readGranted || writeGranted ) then\n\t assert_not_nil(ace[\"granted\"],\"Expected ace for #{principal} to have granted something granted ace was nil \"+@authz.hashToString(acl))\n\t puts(\"ACE for user #{principal} was \"+@authz.hashToString(ace)+\":\"+ace[\"granted\"].to_s)\n\tend\n\tif ( !readGranted || !writeGranted ) then\n assert_not_nil(ace[\"denied\"],\"Expected ace for #{principal} to have denied something, denied was nil \"+@authz.hashToString(acl))\n puts(\"ACE for user #{principal} was \"+@authz.hashToString(ace)+\":\"+ace[\"denied\"].to_s)\n end\n\n if ( readGranted ) then\n assert_equal(true,ace[\"granted\"].include?(\"jcr:read\"),\"Expected ace for #{principal} to have jcr:read granted ace was \"+@authz.hashToString(ace))\n if ( ace[\"denied\"] != nil ) then\n assert_equal(false,ace[\"denied\"].include?(\"jcr:read\"),\"Expected ace for #{principal} not to have jcr:read denied ace was \"+@authz.hashToString(ace))\n\t end\n else\n assert_equal(true,ace[\"denied\"].include?(\"jcr:read\"),\"Expected ace for #{principal} to have jcr:read denied ace was \"+@authz.hashToString(ace))\n if ( ace[\"granted\"] != nil ) then\n assert_equal(false,ace[\"granted\"].include?(\"jcr:read\"),\"Expected ace for #{principal} not to have jcr:read granted ace was \"+@authz.hashToString(ace))\n\t end\n end\n if ( writeGranted ) then\n assert_equal(true,ace[\"granted\"].include?(\"jcr:write\"),\"Expected ace for #{principal} to have jcr:write granted ace was \"+@authz.hashToString(ace))\n if ( ace[\"denied\"] != nil ) then\n assert_equal(false,ace[\"denied\"].include?(\"jcr:write\"),\"Expected ace for #{principal} not to have jcr:write denied ace was \"+@authz.hashToString(ace))\n\t end\n else\n assert_equal(true,ace[\"denied\"].include?(\"jcr:write\"),\"Expected ace for #{principal} to have jcr:write denied ace was \"+@authz.hashToString(ace))\n if ( ace[\"granted\"] != nil ) then\n assert_equal(false,ace[\"granted\"].include?(\"jcr:write\"),\"Expected ace for #{principal} not to have jcr:write granted ace was \"+@authz.hashToString(ace))\n\t end\n end\n end", "def test_set3_17_check() \n prin_name = 'nikdo'\n acc_type = 'deny'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp/*'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n prin_name = 'Klubicko'\n acc_type = 'deny'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp/*'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n \n res_ob_adrs='/db/temp'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n \n res_ob_adrs='/db/temp/test'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp/test/hokus'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n end", "def check_permission\n redirect_to dashboard_path, notice: 'You are not authorised to perform this action.' unless current_user&.admin?\n end", "def reseller_allow_read(permission)\n return reseller_right(permission) > 0\n end", "def authorize_admin\n redirect_to :login unless current_user.permission.manage_app ||\n current_user.permission.manage_attrs ||\n current_user.permission.manage_achievement_categories ||\n current_user.permission.manage_talent_trees ||\n current_user.permission.manage_talents ||\n current_user.permission.manage_quests ||\n current_user.permission.manage_skills ||\n current_user.permission.manage_achievements ||\n current_user.permission.manage_items ||\n current_user.permission.manage_titles\n end", "def access_control_conditions\n \n conditions = []\n \n if connected_user\n conditions << Conditions::JoinComparison.new('$and', \n [Conditions::Comparison.new(:permission_owner, '$eq', connected_user.username),\n Conditions::Comparison.new(:permission_modifier_owner, '$in', [2,6])])\n \n if connected_user.usergroups.length > 0\n conditions << Conditions::JoinComparison.new('$and',\n [Conditions::Comparison.new(:permission_group, '$in', connected_user.usergroups.map {|item| item.group}),\n Conditions::Comparison.new(:permission_modifier_group, '$in', [2,6])]) \n end\n \n end\n \n conditions << Conditions::Comparison.new(:permission_modifier_all, '$in', [2,6]) \n\n if conditions.length > 1\n conditions = Conditions::JoinComparison.new('$or', conditions)\n else \n conditions.first\n end\n \n end", "def state_permission(permission); end", "def ensure_is_authorized_to_view\n @is_member_of_company = (@relation == :company_admin_own_site || @relation == :company_employee || @relation == :rentog_admin_own_site)\n\n # ALLOWED\n return if @relation == :rentog_admin ||\n @relation == :rentog_admin_own_site ||\n @relation == :domain_supervisor ||\n @relation == :company_admin_own_site\n\n\n # NOT ALLOWED\n # with error message\n flash[:error] = t(\"listing_events.you_have_to_be_company_member\")\n redirect_to root\n return false\n end", "def validate_access\n if @user_logged_in != @answer.user\n render status: :forbidden\n end\n end", "def inner_check(action, resource)\n false\n end", "def current_user_can(access_types)\n current_user.id == @list.user_id || access_types.include?(current_user.access_to_list(@list))\n end", "def admin_permission\n if session[:position].to_s == \"Secretary\" or\n session[:position].to_s == \"Treasurer\" or\n session[:position].to_s == \"Chairman\"\n flash[:notice] = \"RESTRICTED: you do not have access\"\n redirect_to controller: :access, action: :admin_menu, :id => session[:user_id],\n position: session[:position]\n return false\n end\n\n end", "def permission_required \n render_403 unless admin? || @item.is_editable_by?(current_user)\n end", "def filter_access!\n treat_as get_current_role\n end", "def authorization(*args, &block); end", "def permission_required \n render_403 unless admin? || @user == current_user\n end", "def has_access(atts)\n atts[:controller] = atts[:controller] ? atts[:controller] : params[:controller]\n atts[:action] = atts[:action] ? atts[:action] : params[:action]\n atts[:user] = atts[:user] && atts[:user].is_a?(User) ? atts[:user] : current_user\n atts[:entity_id] = params[:id] ? params[:id] : nil\n\n logger.debug \"atts[:controller]: \" + atts[:controller]\n logger.debug \"atts[:action]: \" + atts[:action]\n logger.debug \"atts[:user]: \" + (atts[:user] ? atts[:user].username : \"\")\n logger.debug \"atts[:entity_id]: \" + (atts[:entity_id] ? atts[:entity_id].to_s : \"\")\n\n case atts[:controller]\n when \"comments\"\n @res = comments_filter(atts[:action], {\n :user => atts[:user],\n :comment_id => atts[:entity_id]\n })\n when \"users\"\n @res = users_filter(atts[:action], {\n :user => atts[:user],\n :entity_id => atts[:entity_id]\n })\n when \"players\"\n @res = players_filter(atts[:action], {\n :user => atts[:user],\n :player_id => atts[:entity_id]\n })\n when \"leagues\"\n @res = leagues_filter(atts[:action], {\n :user => atts[:user],\n :league_id => atts[:entity_id]\n })\n when \"teams\"\n @res = teams_filter(atts[:action], {\n :user => atts[:user],\n :team_id => atts[:entity_id]\n })\n when \"games\"\n @res = games_filter(atts[:action], {\n :user => atts[:user],\n :game_id => atts[:entity_id]\n })\n when \"halls\"\n @res = halls_filter(atts[:action], {\n :user => atts[:user],\n :hall_id => atts[:entity_id]\n })\n when \"images\"\n @res = images_filter(atts[:action], {\n :user => atts[:user],\n :image_id => atts[:entity_id]\n })\n when \"plugins\"\n @res = plugins_filter(atts[:action], {\n :user => atts[:user],\n })\n when \"wikis\"\n @res = wikis_filter(atts[:action], {\n :user => atts[:user],\n })\n when \"events\"\n @res = events_filter(atts[:action], {\n :user => atts[:user],\n })\n else\n @res = true\n end\n\n # kdyz nemam prava, nemam pristup\n if !@res\n access_denied\n end\n end", "def access_to_action(action)\n access = false\n\n # Editors can :edit\n\n if editor_access_level? & (AccessLevels::EDITOR_ACTIONS.include? action)\n access = true\n end\n\n # Admins can :delete\n\n if admin_access_level?\n access = true\n end\n\n return access\n end", "def manager_permissions\n can :manage_collection, String do |pid|\n Rails.logger.debug(\"[MANPERM] Checking from STRING\")\n test_manager(pid)\n end\n\n can :manage_collection, DRI::Batch do |obj|\n Rails.logger.debug(\"[MANPERM] Checking from Object\")\n test_manager(obj.id)\n end\n\n can :manage_collection, SolrDocument do |obj|\n Rails.logger.debug(\"[MANPERM] Checking from SolrDoc\")\n cache.put(obj.id, obj)\n test_manager(obj.id)\n end\n\n can :manage, String do |pid|\n Rails.logger.debug(\"[MANPERM] Checking from STRING\")\n test_manager(pid)\n end\n\n can :manage, DRI::Batch do |obj|\n Rails.logger.debug(\"[MANPERM] Checking from Object\")\n test_manager(obj.id)\n end\n\n can :manage, SolrDocument do |obj|\n Rails.logger.debug(\"[MANPERM] Checking from SolrDoc\")\n cache.put(obj.id, obj)\n test_manager(obj.id)\n end\n end", "def standard_authorized_user_rights\n public_access + protected_access \n end", "def permissions_policy(&block); end", "def access_control(object = nil)\n if object.present? && @cur_user.present?\n author = author?\n end\n perm = Permission\n perm.getReq(params[:controller], params[:action], request.request_method)\n redirect t('redirect.denied') unless perm.grant?(user_perm, author)\n end", "def can_execute?(user, action)\n can = nil\n own = owns?(user)\n [[:open, :closed], :appealed, :escalated].each do |state|\n if state.is_a?(Array)\n if can.nil?\n can = user.has_permission?(:appeals, action, state[0], 'all') if self.send(state[0])\n else\n can = can && user.has_permission?(:appeals, action, state[0], 'all') if self.send(state[0])\n end\n can = can || (own && user.has_permission?(:appeals, action, state[0], 'own')) if self.send(state[0])\n\n if can.nil?\n can = user.has_permission?(:appeals, action, state[1], 'all') if !self.send(state[0])\n else\n can = can && user.has_permission?(:appeals, action, state[1], 'all') if !self.send(state[0])\n end\n can = can || (own && user.has_permission?(:appeals, action, state[1], 'own')) if !self.send(state[0])\n else\n if state == :appealed\n if can.nil?\n can = user.has_permission?(:appeals, action, state, 'all') if self.punishment.appealed?\n else\n can = can && user.has_permission?(:appeals, action, state, 'all') if self.punishment.appealed?\n end\n can = can || (own && user.has_permission?(:appeals, action, state, 'own')) if self.punishment.appealed?\n else\n if can.nil?\n can = user.has_permission?(:appeals, action, state, 'all') if self.send(state)\n else\n can = can && user.has_permission?(:appeals, action, state, 'all') if self.send(state)\n end\n can = can || (own && user.has_permission?(:appeals, action, state, 'own')) if self.send(state)\n end\n end\n end\n\n if self.locked?\n can = can && user.has_permission?(:appeals, action, :locked, 'all')\n can = can || (own && user.has_permission?(:appeals, action, :locked, 'own'))\n end\n\n can\n end", "def any_logged_in(user)\n can :export_calendar, User do |user_check|\n user.id == user_check.id || can?(:act_on_behalf_of, user_check)\n end\n\n # only matters if read in any_one() is false (ie. user_check is junior)\n can :read, User do |user_check| \n user.id == user_check.id || can?(:act_on_behalf_of, user_check) || user.friends.include?(user_check) || admin_of_users_league?(user, user_check)\n end\n\n # contact details and shit\n can :read_private_details, User do |user_check|\n user.id == user_check.id || can?(:act_on_behalf_of, user_check) || admin_of_users_team?(user, user_check) || admin_of_users_league?(user, user_check)\n end\n\n # ie parent\n can :act_on_behalf_of, User do |user_check|\n user_check.junior? && user_check.parent_ids.include?(user.id)\n end\n\n # TEAM\n can :read, Team do |team|\n team.has_member?(user) || team.primary_league.has_organiser?(user) || can?(:manage_teams, team.tenant)\n end\n\n # currently only used for mobile app, prob should use on web too. TS\n can :read_private_details, Team do |team|\n team.has_member?(user) || (!team.primary_league.nil? && team.primary_league.has_organiser?(user))\n end\n\n can :export_calendar, Team do |team|\n team.has_member?(user)\n end\n\n # Not sure these should be here... Can be inferred from other info (eg. are they in the team)\n # also, they're more about whether it is feasible, rather than whether they're allowed\n # Plus, this is checking the team, and the setting belong to the user. We should just be\n # looking for the settings (if has perms to edit user), and raise invalid id not there. TS\n can :read_notification_settings, Team do |team|\n team.has_associate?(user)\n end\n can :update_notification_settings, Team do |team|\n team.has_associate?(user) \n end\n\n # EVENT\n # only matters is read in any_one gives false\n can :read, Event do |event|\n # organiser, player, player parent, or team organiser\n event.user_id == user.id || event.is_invited?(user) || user.child_invited_to?(event) || can?(:manage, event.team)\n end\n\n can :read_messages, Event do |event|\n # organiser, player, player parent, or team organiser\n event.user_id == user.id || event.is_invited?(user) || user.child_invited_to?(event) || can?(:manage, event.team)\n end\n\n # TODO: remove in favour of :read_private_details\n can :read_all_details, Event do |event|\n can? :read_private_details, Event\n end\n\n # TODO: remove in favour of :read_private_details\n can :view_private_details, Event do |event|\n can? :read_private_details, Event\n end\n\n can :read_private_details, Event do |event|\n # organiser, player, player parent, or team organiser\n event.user_id == user.id || event.is_invited?(user) || user.child_invited_to?(event) || can?(:manage, event.team)\n end\n\n # SR: Added to mimic\n can :view_private_details, DivisionSeason do |division|\n division.league.has_organiser?(user)\n end\n\n # SR: Added to mimic\n can :read_private_details, DivisionSeason do |division|\n division.league.has_organiser?(user)\n end\n\n # DEPRECATED: this is only used for view code, not actual authorisation, so should be removed from here. TS.\n can :respond_to_invite, Event do |event|\n event.teamsheet_entries.map{|tse| tse.user_id}.include?(user.id) && event.user_id != user.id\n end\n\n can :respond, TeamsheetEntry do |tse|\n # player, event organiser (legacy), parent, or team organiser\n #tse.event.team.has_associate?(user) &&\n (user.id == tse.user_id || tse.event.user_id == user.id || can?(:act_on_behalf_of, tse.user) || can?(:manage, tse.event.team))\n end\n\n can :check_in, TeamsheetEntry do |tse|\n can? :manage_roster, tse.event.team\n end\n\n # ACTIVITY ITEMS\n can :view, ActivityItem\n\n can :create_message_via_email, Event do |event|\n # organiser, or registered player\n # TODO: generalise this set of perms (and refactor to check user has role on team)\n event.user_id == user.id || event.is_invited?(user) || user.child_invited_to?(event) || can?(:manage, event.team)\n end\n\n # ACTIVITY ITEM COMMENTS AND LIKES\n can :comment_via_email, EventMessage do |message| \n # if this implementation changes then a test is required\n if message.messageable.is_a? Team \n message.messageable.has_active_member?(user)\n elsif message.messageable.is_a? Event\n can? :create_message_via_email, message.messageable\n end \n end\n\n can :comment_via_email, EventResult do |event_result|\n # if this implementation changes then a test is required\n can? :create_message_via_email, event_result.event \n end\n\n can :comment_via_email, User\n can :comment_via_email, Event \n can :comment_via_email, TeamsheetEntry \n can :comment_via_email, InviteResponse\n can :comment_via_email, InviteReminder\n end", "def is_authorized_to_perform(action)\n permission = role.shift_management_permissions_table.read_attribute(:\"#{action}\")\n return permission != :nobody\n end", "def verify_access\n unless current_user.id == @organization.user_id\n flash[:warning] = \"You do not have authority to access that.\"\n redirect_to user_path(current_user.id)\n end\n end", "def check_access\n result = false\n if current_user.is_a? Admin\n result = true\n elsif !@measurement.nil?\n patient = @measurement.patient\n result = patient.id == current_user.id or patient.dietician.id == current_user.id\n end\n unless result\n redirect_to root_path, alert: \"Brak dostępu!\"\n end\n end", "def has_access\n if !@contest.is_organized_by_or_admin(current_user.sk) && @contestproblem.at_most(:not_started_yet)\n render 'errors/access_refused' and return\n end\n end", "def check_permission(event, role)\n case role\n when 'botmaster'\n {\n granted: event.user.id == BOTMASTER_ID,\n allowed: ['botmasters']\n }\n else\n names = Role.owners(role).pluck(:username)\n {\n granted: Role.exists(event.user.id, role),\n allowed: role.pluralize #names\n }\n end\nend", "def check_permissions\n redirect_to index_path, alert: lack_permission_msg unless admin_or_organizer?\n end", "def check_authorizations!\n raise FphsNotAuthorized unless can_create_in_list?\n\n unless list_class.no_master_association || from_master.allows_user_access\n raise FphsNotAuthorized, 'Master does not allow user access'\n end\n\n raise FphsNotAuthorized, \"No access to #{source_type}\" unless can_access_source_type?\n\n raise FphsNotAuthorized, \"No access to #{assoc_name}\" unless can_access_associated_table?\n end", "def authorization; end", "def verify_admin\n :authenticate_user!\n have_no_rights('restricted area') unless current_user.isAdmin?\nend", "def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end", "def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end", "def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end", "def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end", "def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end", "def special_access_for_cfo_or_treasurer?(state)\n (current_user.cfo? && state == 'approval') ||\n (current_user.treasurer? && ['execution', 'executed'].include?(state)) ||\n (cfo_as_treasurer? && ['approval', 'execution', 'executed'].include?(state))\n end", "def authorized?(controller, action=\"index\")\n\n return true if self.admin?\n\n query = <<-EOS\nSELECT DISTINCT #{UserEngine.config(:permission_table)}.* \nFROM #{UserEngine.config(:permission_table)}, #{UserEngine.config(:role_table)}, \n #{UserEngine.config(:permission_role_table)}, #{UserEngine.config(:user_role_table)},\n #{LoginEngine.config(:user_table)}\nWHERE #{LoginEngine.config(:user_table)}.id = :person\nAND #{LoginEngine.config(:user_table)}.id = #{UserEngine.config(:user_role_table)}.user_id\nAND #{UserEngine.config(:user_role_table)}.role_id = #{UserEngine.config(:role_table)}.id\nAND #{UserEngine.config(:role_table)}.id = #{UserEngine.config(:permission_role_table)}.role_id\nAND #{UserEngine.config(:permission_role_table)}.permission_id = #{UserEngine.config(:permission_table)}.id\nAND #{UserEngine.config(:permission_table)}.controller = :controller\nAND #{UserEngine.config(:permission_table)}.action = :action\nEOS\n\n result = Permission.find_by_sql([query, {:person => self.id, \n :controller => controller.to_s, :action => action.to_s}]) \n\n return (result != nil) && (!result.empty?) \n end", "def check_access\n result = false\n if current_user.is_a? Admin\n result = true\n elsif !@training.nil?\n patient = @training.patient\n result = patient.id == current_user.id or patient.dietician.id == current_user.id\n end\n unless result\n redirect_to root_path, alert: \"Brak dostępu!\"\n end\n end", "def check_user_access\n check_access_and_redirect(@request)\n end", "def user_permission_greater? page, level \n return true if admin\n \n # access for non-members is not permitted\n as_member = Member.first(:conditions => { :user_id => id, :project_id => page.project.id })\n return false if as_member.nil?\n\n # user specific permissions have preference\n #Rails.logger.info \"Accessing user permission for user #{id} / member #{as_member.id} and page #{page.id}\"\n user_permission = WikiPageUserPermission.first(\n :conditions => {\n :wiki_page_id => page.id,\n :member_id => as_member.id\n }\n )\n\n unless user_permission.nil?\n Rails.logger.info \"Level: #{user_permission.level} => #{level}\"\n return user_permission.level >= level\n end\n \n # check whether the user belongs to a role that has permissions set\n role_permissions = WikiPageRolePermission.find(:all, :conditions => {:wiki_page_id => page.id})\n unless role_permissions.nil? or as_member.roles.empty?\n roles_ids = as_member.roles.map { |x| x.id }\n Rails.logger.info \"Accessing role permission\"\n \n role_permissions.each do |role|\n if roles_ids.index(role.role_id)\n Rails.logger.info \"Role.level #{role.level} >= #{level}\"\n return role.level >= level\n end\n end\n end\n\n # check default permission\n Rails.logger.info \"Checking default\"\n (default = page.default_permission) ? default.level >= level : true\n end", "def action_allowed?\n current_user_has_ta_privileges?\n end", "def action_allowed?\n current_user_has_ta_privileges?\n end", "def index\n @moderations = @course.moderations.all\n authorize Moderation\n end", "def has_access\n accessible = subject_has_access_to_resource?(params[:id], params[:resource])\n if accessible == true # should code a comparison agains ruby regular expressions here\n render :text => \"<a>1</a>\" \n return\n end\n # if no matching resouces found by the end of the iteration, return false\n render :text => \"<a>0</a>\"\n end" ]
[ "0.68938744", "0.67384493", "0.6637637", "0.6531055", "0.6524994", "0.6513374", "0.64853543", "0.64695", "0.6466892", "0.6466482", "0.6459577", "0.6426386", "0.64249074", "0.6399418", "0.6398919", "0.63588023", "0.6354697", "0.6342695", "0.6338652", "0.6329903", "0.63243455", "0.6321835", "0.63105315", "0.6307121", "0.62972337", "0.6264576", "0.62477666", "0.6243321", "0.6243031", "0.624298", "0.6239047", "0.62339747", "0.62327844", "0.6232389", "0.62295604", "0.6226152", "0.62085295", "0.61992836", "0.61992836", "0.61992836", "0.61983734", "0.61983734", "0.6189644", "0.6180526", "0.61723524", "0.61695546", "0.6165154", "0.6155068", "0.6151292", "0.61475587", "0.61402804", "0.61402804", "0.61402804", "0.6139889", "0.613977", "0.61370105", "0.6136825", "0.61253935", "0.6123642", "0.61217266", "0.6113872", "0.61122376", "0.6105683", "0.6099533", "0.6098271", "0.6090878", "0.60859776", "0.60827583", "0.60673654", "0.6063912", "0.60623944", "0.6058869", "0.60544103", "0.60507727", "0.6049743", "0.6047581", "0.60432935", "0.60407835", "0.60382235", "0.60337514", "0.602925", "0.6028302", "0.6025625", "0.60242087", "0.601591", "0.6010414", "0.60101795", "0.60057604", "0.60057604", "0.60057604", "0.60057604", "0.60057604", "0.6004859", "0.60013276", "0.5993724", "0.5990531", "0.5988196", "0.5988013", "0.5988013", "0.5985378", "0.59818834" ]
0.0
-1
0 1 2 3 4 5 6 7 1 2 3 4 5 6 7 2 3 4 5 6 7 3 4 5 6 7 4 5 6 7 5 6 7 6 7 7
def faster_my_min(arr) # O(n) min = arr[0] arr.each do |ele| min = ele if ele < min end min end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cracklepop3\n (1..100).zip(Array.new 100, nil).map do |i,x|\n [i%3, i%5].map.with_index do |y, j| \n x = x.to_s + ['crackle','pop'][j] if y==0\n end\n x ? x : i\n end\nend", "def series_up(n) # Got help again. My first code couldn't adapt at all. This one has a reset limit, meaning it loops the amount of times it needs to for each interger. Still not perfect, but almost there. \n list = [1]\n i = 1\n length = n*(n+1)/2\n reset = 3\n list.push i\n i += 1\n if i == reset\n reset += 1\n end\n return list\nend", "def given\n [6,5,3,1,8,7,2,3]\nend", "def number_counting_seq(n)\r\n\r\nend", "def series_up(num)\n series = 0\n list = [] #starts as empty\n #puts \"running code\"\n num.times do |pattern|\n n = 0#original num\n num.times do |num|\n list[n + series] = n + 1\n n += 1\n end \n series += pattern + 1 \n #makes it grow exponentially\n end\n return list \nend", "def five_digit_pattern()\r\n\treturn [\r\n\t\t\t[1, 0, 0, 0, 1],\r\n\t\t\t[0, 1, 0, 0, 1],\r\n\t\t\t[0, 0, 1, 0, 1],\r\n\t\t\t[0, 0, 0, 1, 1]\r\n\t\t ]\r\nend", "def series_up(num)\n size = num*(num+1)/2\n list = [1, 1, 2, 1, 2, 3, 1, 2, 3, 4]\n string = list[0..size-1]\n print string\nend", "def solution(n)\n array = Array.new\n (1..n).each do\n array.push(0)\n end\n while (array.length >= 16)\n (1..16).each do\n array.pop\n end \n end\n array.length\nend", "def series_up(n)\n list = []\n (n+1).times do |a|\n a.times do |b|\n list.push(b+1)\n end \n end\n return list\nend", "def run_length_encode\n self.pack_consecutive_duplicates.inject([]) do |array, current|\n array << [current.size, current[0]]\n array \n end\n end", "def series_up(num)\n seq = 0\n list = []\n # list[(num * (num + 1) / 2) - 1] = num wasn't doing anything for me\n num.times do |pat| # I swtiched to num.times because I couldn't do list.each because list is blank\n t = 0\n num.times do |numb|\n list[t + seq] = t + 1 # How it knows where to put what number\n t += 1\n end\n seq += pat + 1 # grows exponentially to make it add a new space every time\n end\n return list\nend", "def getSet(n)\n\t((n%8).to_s(2).rjust(3,\"0\"))\nend", "def direct_run_length_encode\n self.inject([[0, nil]]) do |array, current|\n if array[-1][-1] == current or array[-1][-1].nil?\n array[-1][-1] = current\n array[-1][0] += 1 \n else\n array[-1] = array[-1][-1] if array[-1][0] == 1\n array << [1, current]\n end\n array\n end\n end", "def crear_serie(n)\n array = [1, 2]\n\n # times indica cuantas vecesdebe ejecutarse un fragmento de codigo\n (n - 2).times {\n array << array [-1] + array [-2]\n }\n \n return array\nend", "def basic_7\n new_array = []\n i = 1\n while i <= 255\n new_array.push(i)\n i += 2\n end\n return new_array\nend", "def series_up(n)\n #nlist is the list that will be the output of the code\n nlist = []\n #i changed from an if statement to a loop.\n (n*(n+1)/2+1).times do |i|\n i.times do |x|\n nlist.push(x+1)\n end\n end\n #I use three dots to only get the information i need from the code\n return nlist[0...(n*(n+1)/2)].to_a\nend", "def toggle_lights(n)\n multipled_substring = []\n\n (1..n).each do |count|\n multiplier = 1\n\n loop do\n product = count * multiplier\n break if product > n\n multipled_substring << product\n multiplier += 1\n end\n end\n #multipled_substring\n\n final_result = []\n (1..n).each do |number|\n times_of_toggle = multipled_substring.count(number)\n \n final_result << number if times_of_toggle.odd?\n end\n p final_result\nend", "def alternating_sequence\n max = amount_of_rails - 1\n direction = 1\n current = 0\n\n result = [current]\n\n (message_length - 1).times do\n current += direction\n direction *= -1 if current.zero? || current == max\n result << current\n end\n\n result\n end", "def indices(i)\n [(i/WIDTH),(i-1) % (WIDTH)]\n end", "def indices(i)\n [(i/WIDTH),(i-1) % (WIDTH)]\n end", "def diagonal_win\n 6.times do\n end\n end", "def fds(n)\n\n # arr = []\n # (n + 1).times.each{|e| arr << e if e > 0}\n # arr.flat_map.reduce(:*)\n # arr.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n (1..n).to_a.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n\nend", "def pure_number(n)\n arr = []\n arr[0] = \"\"\n blocks = 0\n displacement = 0\n i = 1\n while(i <= n)\n blocks = blocks + 1 if(is_power_of_2?(i+1))\n if(is_4_series?(i, blocks))\n displacement = power_of_num(2, blocks-1)\n arr[i] = \"4\" + arr[i-displacement] + \"4\"\n else\n displacement = power_of_num(2, blocks) \n arr[i] = \"5\" + arr[i-displacement] + \"5\"\n end\n i+=1\n end\n arr\nend", "def basic_1\n x_range = (1..255)\n x_range.step(1) { |n| print \"#{n} \" }\n puts\nend", "def fourth_puzzle\n rng = Random.new\n ret = []\n 10.times { ret.push(rng.rand(55..100)) }\n return ret\nend", "def series_up(n) # given n, return a list that goes [1,1,2,1,2,3... n]\n n_list = []\n (n+1).times do |m|\n m.times do |val|\n n_list.push(val+1)\n end\n end\n return n_list\nend", "def series_up(nums) \r\n series = 0 # start the list at the right \r\n list = [] # the list is empty at the start \r\n nums.times do |seq| \r\n n = 0 \r\n nums.times do |nums| # run a loop for the sequence \r\n list[n + series] = n + 1 \r\n n += 1 \r\n end \r\n series += seq + 1 # exponential growth \r\nend \r\n return list \r\nend", "def sequence(count, start)\n sequence = []\n current = start\n\n count.times do\n sequence << current\n current += start\n end\n\n sequence\nend", "def sequence(count, first_nb)\n result = []\n count.times { |loop| result << (first_nb * (loop + 1)) }\n result\nend", "def seriesup(n)\n list = [] \n (n+1).times do |b| # added the +1 because this code needs to run 1 more time than the input\n b.times do |a|\n list.push(a+1) #changed the variable from b to a because it doesn't need to use the first variable, you have to use the second one to make it repeat from 1. Also, I had a space between the list.push and the (), so the push didnt even work with this space.\n end\n end\n return list\nend", "def sequence(count, start)\n seq = []\n count.times { |i| seq << start * (i + 1) }\n seq\nend", "def sequence(count, start)\n final_arr = []\n 1.upto(count) do |num|\n final_arr << num * start\n end\n final_arr\nend", "def stringy(size, start = 1)\n numbers = []\n\n size.times do |index|\n if start = 1\n number = index.even? ? 1 : 0\n elsif start = 0\n number = index.even? ? 0 : 1\n end\n numbers << number\n end\n\n numbers.join\nend", "def sequence(count, start_number)\n array = []\n count.times { |i| array << (start_number * (i + 1)) }\n array\nend", "def featured(i) # found digits method but only works > v2.4 so...\n i = i - i % 7\n loop do\n i += 7\n list = []\n x = i\n while x > 0 do\n list.unshift(x % 10)\n x /= 10\n end\n if list.length > 9; return \"There is no possible number that fulfills those requirements\" end\n if list == list.uniq; break end\n end \n i\nend", "def sequence(count, first)\n sequence = []\n number = first\n\n count.times do\n sequence << number\n number += first\n end\n sequence\nend", "def persistence(n)\n multiples = []\n until n.to_s.chars.count < 2 do\n n = n.to_s.chars.map(&:to_i).inject(:*)\n multiples << n\n end\n multiples.count\nend", "def new_board\n (\"1\"..\"7\").to_a.each_with_object({}) do |key, hash|\n hash[key] = Array.new(6) { |i| (i + 1).to_s }\n end\n end", "def sequence(count, starting_num)\n result_arr = []\n 1.upto(count) { |num| result_arr << starting_num * num }\n result_arr\nend", "def next5\n x = @exact[0,5]\n x + @list[0,5 - x.size]\n end", "def slices(n)\n digits.each_cons(n).to_a\n end", "def print_odds()\n\t(1..255).step(2) { |i| print i, \" \" }\nend", "def series_up(x)\nbignum = 1\ncount = 1 #made it one beacsue when it was 0 it only printed the number - 1\nlist = [] # changed it to list so i dont get confused\n x.times do #loop in a loop \n count = 1 #It resets it to one so it follows the pattern\n while count <= bignum #while count is less than or equal too this loop will keep on going\n list.push(count) #pushes count into the list\n count = count + 1 #making count equal to count + 1. So if count is 2, it will come out as 3\n end\n bignum = bignum + 1 #setting big number so the loop keeps on going\n end\n return list #when the loop is over it takes the list and prints it\nend", "def sequence(count, start)\n (1..count).map { |count| count * start }\nend", "def stringy(size)\n numbers = []\n\n size.times do |index|\n number = index.even? 1 : 0\n numbers << number\n end\n\n numbers.join\nend", "def seventh_puzzle\n ret = []\n 10.times { ret.push(sixth_puzzle) }\n return ret\nend", "def straight_values_from(from)\n (from.to_i...from.to_i + 5).to_a\n end", "def magic_numbers(count)\nend", "def sequence(count, startnum)\n sequence_array = []\n multiple = 1\n \n until count == 0\n sequence_array << startnum * multiple\n count -= 1\n multiple += 1\n end\n \n sequence_array\nend", "def sequence(count, first_num)\n multiples = []\n count.times {|index| multiples[index] = first_num * (index +1) }\n multiples\nend", "def stringy(size, start=1)\n numbers = []\n\n size.times do |index|\n if start == 1\n number = index.even? ? 1 : 0\n numbers << number\n elsif start == 0\n number = index.odd? ? 1 : 0\n numbers << number\n end\n end\n\n numbers.join\nend", "def pe52(startAt, endAt)\n (startAt..endAt).step(6).each do |x|\n bNum = x/6\n bNumCSort = bNum.to_s.chars.sort\n next if bNumCSort != x.to_s.chars.sort\n next if bNumCSort != (bNum*5).to_s.chars.sort\n next if bNumCSort != (bNum*4).to_s.chars.sort\n next if bNumCSort != (bNum*3).to_s.chars.sort\n next if bNumCSort != (bNum*2).to_s.chars.sort\n return bNum\n end\n false\nend", "def sequencer(num)\n array = []\n array << num\n until array.last == 1\n if num%2 == 0 \n num = num/2\n array << num \n else \n num = num*3 + 1\n array << num \n end \n end\n return array.length\nend", "def repeat(input)\n # while i < 6\n i = 0\n numbers = [ ]\n for i in (1 .. input)\n puts \"At the top i is #{i}\"\n numbers.push(i)\n\n puts \"Numbers now: \", numbers\n puts \"At the bottom i is #{i}\"\n end\n\n puts \"The number: \"\n numbers.each {|num| puts num }\nend", "def generate_sequence()\n (0..9).to_a.permutation(4).to_a #all permutations, 4 digits long\nend", "def stringy(size)\n numbers = []\n\n size.times do |index|\n number = index.even? ? 1 : 0\n numbers << number\n end\n\n numbers.join\nend", "def stringy(size)\n numbers = []\n\n size.times do |index|\n number = index.even? ? 1 : 0\n numbers << number\n end\n\n numbers.join\nend", "def monkey_count(n)\n [*1..n]\nend", "def secret_numbers\n\t\t(1..5).to_a \n\tend", "def basic_2\n x_range = (1..255)\n x_range.step(1) { |n| print \"#{n} \" if n % 2 != 0 }\n puts\nend", "def sequence(count, start)\n return [] if count == 0 \n sequence_array = []\n iterator = 1\n count.times do\n sequence_array << start * iterator \n iterator += 1 \n end \n sequence_array\nend", "def step_4\n\t\t@keystream_num_array = []\n\t\t@keystream.each do |letter|\n\t\t\t@keystream_num_array << (@alphabet.index(letter) + 1)\n\t\tend\n\t\t@keystream_num_array\n\tend", "def boredFriends(n)\n n.to_i % 9\nend", "def lights(n)\n arr = Array.new(n, false)\n n.times do |count|\n arr.each_with_index { |element, idx| arr[idx] = !element if (idx + 1) % (count + 1) == 0}\n end\n result =[]\n arr.each_with_index { |element, idx| result << idx+1 if element }\n result\nend", "def dynamic_chunk(base_ten_num) #=>inncludes first 1 in output\n base_two_num = binarify(base_ten_num)\n base_two_num.slice(static_chunk(base_ten_num).length..(base_two_num.length - 1))\nend", "def sequence(count, num)\n seq_arr = []\n 1.upto(count) { |n| seq_arr << num * n }\n seq_arr\nend", "def sequence(count, start_num)\n (1..count).map { |idx| start_num * idx }\nend", "def repeating_position\n @repeat || @digits.size\n end", "def tirar_dado\r\n\trand 1..6\r\nend", "def modified_run_length_encode\n self.run_length_encode.inject([]) do |array, current|\n array << current if current[0] > 1\n array << current[-1] if current[0] == 1\n array\n end\n end", "def sequence(count, first)\n (1..count).map { |idx| idx * first }\nend", "def ordv\n large = Array.new([0,0,0,0,0,0,0,0,0,1])\n (1..7830457).each do |n|# digit represents ,2^n\n passover = 0\n 9.downto(0).each do |i|\n large[i] *= 2\n large[i] += passover\n if large[i] >= 10\n large[i] %= 10\n passover = 1\n else\n passover = 0\n end\n end\n end\n (28433 * large.join.to_i + 1)%100000000000\nend", "def partial(i)\n return false if i > 8\n return @pan.to_s.split('')[(i-1)..(i+1)].join().to_i\n end", "def sequence3(number)\n array = []\n 1.upto(number) { |num| array << num }\n array\nend", "def gay_array(number_of_buttons, search_letter, search_buttons) \n \tarray = [ ] \n\t\n\twhile array.length <= number_of_buttons - (1 + search_buttons) do\n \t\tarray.push(new_letter(search_letter))\n \tend\n \t\n search_buttons.times do array.push(search_letter)\n\tend\t\t\n \t\t\n \treturn array.shuffle\n \n end", "def team(p, num)\n z = []\n num.times {z << []}\n i = 0\n while i < p.count\n z[ i%num ] << p[i]\n i+=1\n end\n puts z.inspect\nend", "def sequence(count, start)\n (1..count).map { |i| i * start }\nend", "def hole6\n [?A,*(?2..'10'),?J,?K,?Q].product([?C,?H,?S,?D]).map(&:join) + [?J,?J]\n # put your implementation in here, but please leave the comments above and at the 'end'\n\n end", "def knot_hash(input)\n sequence = input.bytes.to_a\n sequence << [17, 31, 73, 47, 23]\n sequence = sequence.flatten\n list = (0..255).to_a\n\n @current_position = 0\n @skip_size = 0\n # list = (0..4).to_a\n # sequence = [3, 4, 1, 5]\n\n # sequence = '1,2,3'.bytes.to_a\n # sequence << [17, 31, 73, 47, 23]\n # sequence = sequence.flatten\n\n 64.times do\n sequence.each do |seq|\n puts \"STARTING SEQ #{seq}\"\n if @current_position + seq > list.size\n puts \"wrapping\"\n ending_array = list[@current_position..-1]\n ending_array_size = ending_array.size\n puts \"ending array is #{ending_array.inspect}\"\n beginning_array = list[0...seq - ending_array.size]\n puts \"beginning array is #{beginning_array.inspect}\"\n beginning_array_size = beginning_array.size\n array_to_modify = ending_array + beginning_array\n puts \"array_to_modify is #{array_to_modify.inspect}\"\n array_to_modify.reverse!\n puts \"reversed array_to_modify is #{array_to_modify.inspect}\"\n # array_to_modify.rotate(@current_position)\n array_to_modify[0...ending_array_size].each_with_index do |a,i|\n list[@current_position+i] = a\n end\n puts list.inspect\n\n array_to_modify[-beginning_array_size..-1].each_with_index do |a,i|\n list[i] = a\n end\n\n puts list.inspect\n else\n puts \"not wrapping\"\n array_to_modify = list[@current_position...@current_position+seq]\n array_to_modify.reverse!\n array_to_modify.each_with_index do |a,i|\n list[@current_position + i] = a\n end\n puts list.inspect\n\n end\n\n if @current_position + seq + @skip_size > list.size\n @current_position = (@current_position + seq + @skip_size) % list.size\n else\n @current_position = @current_position + seq + @skip_size\n end\n puts \"@current_position is #{@current_position}\"\n @skip_size += 1\n end\n @list = list\n end\n\n foo = []\n @list.each_slice(16) do |chunk|\n foo << chunk.inject(:^)\n end\n\n result = []\n foo.each do |hex|\n if hex.to_s(16).size == 1\n result << '0' + hex.to_s(16)\n else\n result << hex.to_s(16)\n end\n end\n\n result.join\nend", "def sequence(num)\n result = []\n num.times{|i| result << i + 1}\n result\nend", "def sequence(count, first_num)\n result = []\n multiple = 1\n\n count.times do \n result << first_num * multiple\n multiple += 1\n end\n result\nend", "def element_times_index(numbers)\n i = 0\n count = 0\n while i < numbers.length\n numbers[i] = numbers[i] * count\n count += 1\n i += 1\n end\n return numbers\nend", "def cracklepop_numbers(from, to)\n (from..to).to_a.map { |n| cracklepop_number(n) }\nend", "def get_sequence(low, high)\n (low..high).to_a\nend", "def busqueda6\n 9899.step(999999999999999999999,9899){|x|break (x) unless (p x).to_s =~ /[^0-2]/}\nend", "def sequence(count, integer)\n new_arr = []\n times = 1\n count.times do \n new_arr << integer * times\n times += 1\n end\n p new_arr\nend", "def repeated_number_ranges(arr)\n\n\nend", "def magic_numbers(count)\n index = 0\n array = []\n found = 0\n while found < count\n if is_magic_number?(index)\n array.push(index)\n found += 1\n end\n index += 1\n end\n return array\nend", "def sequence(multiple, starting_num)\n return [] if multiple == 0\n counter = 1\n array = []\n loop do\n array << counter * starting_num\n counter += 1\n break if counter > multiple\n end\n array\nend", "def sequence(n)\n results = []\n 1.upto(n) {|num| results << num}\n results\nend", "def main\n max = 10 ** 9 + 7\n all = 1\n zero = 1\n nine = 1\n zn = 1\n N.times.each do\n all = all * 10 % max\n zero = zero * 9 % max\n nine = nine * 9 % max\n zn = zn * 8 % max\n end\n return (all - zero - nine + zn) % max\nend", "def ricks_data_reverse(data)\n new_data = []\n (data.length / 8).times do\n temp = []\n temp.push(data.pop(8))\n new_data += temp.reverse\n end\n new_data\nend", "def amicables(limit)\n numbers = Array.new(limit, 0)\n (1...limit).each do |i|\n ((i * 2)...limit).step(i) do |j|\n numbers[j] += i\n end\n end\n result = []\n numbers.each_with_index do |j, i|\n if j < limit && i == numbers[j] && i != j\n result << i\n end\n end\n result\nend", "def sequence(number)\n (1..number).to_a\nend", "def sequence(number)\n (1..number).to_a\nend", "def pattern(n)\n # take an array from 1 to n and print each element\n # the amount of times of the value of that element\n # join the output elements with newline characters\n (1..n).map { |num| num.to_s * num }.join(\"\\n\")\nend", "def stringy(size, switch = 1)\n numbers = []\n\n size.times do |index|\n number = index.even? ? 1 : 0 if switch == 1\n number = index.even? ? 0 : 1 if switch == 0\n numbers << number\n end\n numbers.join\nend", "def cout(n)\n\tw=[0,1,2,3,4,5,6,7,8,9]\n\tx=[]\n\tk=1\n\twhile x!=w do \n\t\tm=n*k\n\t\t\twhile m>0 do\n\t\t\t\tt=m%10\n\t\t\t\tx=x.push(t)\n\t\t\t\tx.sort!\n\t\t\t\tx.uniq!\n\t\t\t\tm=m/10\t\n\t\t\tend\n\t\tk=k+1\n\tend\nreturn (k-1)*n\nend", "def sequence(count, number)\n sequence_arr = []\n 1.upto(count) do |n|\n sequence_arr << number * n\n end\n sequence_arr\nend", "def multiples_of(number, upTo)\n result = Array.new\n (0..upTo).step(number) do |n|\n result << n\n end\n puts result.inspect\n result\nend", "def fill_buffer(step, iterations)\n buffer = [0]\n pos = 0\n\n (1..iterations).each do |i|\n pos = (pos + step) % buffer.length + 1\n buffer.insert(pos, i)\n end\n\n buffer\nend" ]
[ "0.6200348", "0.61823213", "0.61351705", "0.6132255", "0.6105782", "0.60657483", "0.60655886", "0.60507536", "0.6017837", "0.601605", "0.6014432", "0.60063165", "0.6005154", "0.59914505", "0.5982607", "0.59723574", "0.59643686", "0.5960556", "0.5937396", "0.5937396", "0.5927359", "0.5917199", "0.5909192", "0.590667", "0.5905011", "0.59041667", "0.5894898", "0.58839107", "0.5869637", "0.58549345", "0.58370876", "0.58331954", "0.58313745", "0.58228815", "0.5820346", "0.5814914", "0.5802208", "0.5796497", "0.5795568", "0.5789697", "0.5778343", "0.57752466", "0.5770911", "0.5770088", "0.5768417", "0.5767449", "0.5758822", "0.5753302", "0.5747884", "0.57439137", "0.5742656", "0.573994", "0.5739442", "0.57331777", "0.5729426", "0.5727377", "0.5727377", "0.5708497", "0.5704911", "0.56949544", "0.5694407", "0.5683742", "0.5681996", "0.56597596", "0.56595445", "0.56525993", "0.56520003", "0.56490666", "0.56452996", "0.5640002", "0.56393176", "0.563867", "0.5634728", "0.56323195", "0.56285405", "0.5627508", "0.5627412", "0.5623064", "0.5622433", "0.5620443", "0.5615778", "0.56143254", "0.5612968", "0.56098014", "0.560551", "0.5605507", "0.56003755", "0.5600085", "0.5598429", "0.5593969", "0.55921113", "0.5590633", "0.5585522", "0.5580128", "0.5580128", "0.5578488", "0.5570821", "0.55700386", "0.55684733", "0.55660605", "0.5563563" ]
0.0
-1
list = [ 0, 3, 5, 4, 5, 10, 1, 90 ] p my_min(list) => 5 p faster_my_min(list) => 5 puts
def largest_contiguous_sum(arr) largest_sum = nil p_tations = subsets(arr) p_tations.each do |tation| if largest_sum == nil largest_sum = tation.sum elsif tation.sum > largest_sum largest_sum = tation.sum end end largest_sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_min_fast(list)\n smallest = list.first\n\n list[1..-1].each { |n| smallest = n if n < smallest }\n smallest\nend", "def my_min2(list)\n min = 0\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def my_min_better(list)\n min = list.first\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def my_better_min(list)\n min = list[0] #1\n\n list.each_with_index do |ele_1, i| #n\n if ele_1 < min # 1 *n\n min = ele_1 #1 *n\n end\n end\n\n min #1\n # (i...list.length).each do |j|\n # if list[i] list[j]\nend", "def my_min_2(list)\n min = list.first\n list.each do |num|\n if num < min \n min = num\n end\n end\n min\nend", "def my_min_2(list)\r\n min = 0 # O(1)\r\n \r\n list.each do |ele| # O(n) \r\n if ele < min # O(1)\r\n min = ele # O(1)\r\n end\r\n end\r\n min # O(1) \r\nend", "def my_min_2(list) \n min = list.first \n list.each {|num| min = num if min > num }\n min\nend", "def my_min(list)\n i = 0\n min = list[0]\n while i < list.length - 1\n if list[i + 1] < min\n min = list[i + 1]\n end\n i += 1\n end\n min\nend", "def my_min(list)\n min = list[0]\n (0...list.length).each do |i| \n min = list[i] if list[i] < min\n end\n min\nend", "def my_min_ii(list)\n min = list.first\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def my_min(list)\n min = list[0]\n (1...list.length).each do |i| \n min = list[i] if list[i] < min \n end\n min\nend", "def my_min_2(list)\n smallest = 0\n list.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min(list)\n min = list.first \n\n list.each do |el|\n if el < min \n min = el \n end\n end\n min\nend", "def min(list)\n tiny = list[0]\n list.each do |n|\n if n < tiny\n tiny = n\n end\n end\n puts tiny\nend", "def my_min(list)\n min = 0\n list.each do |ele|\n list.each do |ele2|\n min = ele if ele < ele2 && ele < min\n end\n end\n min\nend", "def my_min_2(list) # n\n min_value = list.first\n i = 0\n while i < list.length\n min_value = list[i] if list[i] < min_value\n i += 1\n end\n min_value\nend", "def my_min_2(list)\n min = nil\n\n list.each do |num|\n min = num if min.nil? || num < min\n end\n\n min\nend", "def my_min(list)\n\n min = nil\n\n list.each do |ele|\n min ||= ele\n list.each do |ele2|\n if ele2 < min\n min = ele2\n end\n end\n end\n\n min\nend", "def my_min(list)\r\n smallest = list.first\r\n list.each do |ele|\r\n smallest = ele if ele < smallest\r\n end\r\n return smallest\r\nend", "def my_min2(int_list)\n min = 0\n\n int_list.each do |int|\n min = int if int < min\n end\n\n min\nend", "def min(list)\n list.min\nend", "def my_min2(list)\n min = list[0]\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def my_min(list)\n smallest = list.first\n list.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min2(list)\n result = list.first\n list.each do |el|\n result = el if el < result\n end\n result\n\nend", "def my_min_linear(list)\n smallest_number = list.first\n \n list.each do |num|\n smallest_number = num if num < smallest_number\n end\n\n smallest_number\nend", "def my_min2(list)\n smallest_number = list.first\n list.each do |num|\n smallest_number = num if num <= smallest_number\n end\n smallest_number\nend", "def faster_my_min(arr) # O(n)\n min = arr[0]\n arr.each do |ele|\n min = ele if ele < min\n end\n min\nend", "def my_min_2(nums) # O(n)\n smallest = 0\n nums.each do |num|\n smallest = num if num < smallest\n end\n smallest\nend", "def my_min(list)\n smallest_num = nil\n list.each do |num|\n if smallest_num == nil || smallest_num > num\n smallest_num = num\n end\n end\n smallest_num\nend", "def my_min(list)\r\n smallest = 0\r\n \r\n list.each_with_index do |ele1, idx1|\r\n list.each_with_index do |ele2, idx2|\r\n if idx2 > idx1 \r\n if ele1 < smallest\r\n smallest = ele1\r\n end\r\n if ele2 < smallest\r\n smallest = ele2\r\n end\r\n end\r\n end\r\n end\r\n\r\n smallest\r\nend", "def my_min_fast(arr)\n smallest = arr[0]\n arr.each do |ele|\n if ele < smallest\n smallest = ele\n end\n end\n return smallest\nend", "def my_min(list)\n\n # phase 1\n # min = list.first\n # list.each_with_index do |ele_1, i_1|\n # list.each_with_index do |ele_2, i_2|\n # if i_2 != i_1\n # if min > ele_2\n # min = ele_2\n # end\n # end\n # end\n # end\n # min\n\n # phase 2\n min = list.first\n list[1..-1].each do |ele|\n if min > ele\n min = ele\n end\n end\n min\nend", "def my_min(list)\n min = list[0]\n\n list.each do |ele| \n case min <=> ele\n when 1\n min = ele\n when 0\n next\n when -1\n min = min \n end\n end\n\n min\nend", "def my_min2(arr)\n timestart = Time.now\n smallest = arr[0]\n (1...arr.length).each do |idx|\n smallest = arr[idx] if smallest > arr[idx]\n end\n p (Time.now - timestart) * 1000\n smallest\nend", "def my_min(list)\r\n list.inject { |min,ele| min < ele ? min : ele }\r\n \r\n # Time : O(n)\r\n # Space : O(1)\r\nend", "def find_min_brute(nums)\n smallest = nums[0]\n nums.each do |n|\n (smallest = n) if n < smallest \n end\n return smallest\nend", "def smallest_integer(list_of_nums)\n p list_of_nums.min\nend", "def smallest_integer(list_of_nums)\n p list_of_nums.min\nend", "def find_min_value(array)\n min_element = 10000000\n array.length.times { |index|\n if min_element > array[index]\n min_element = array[index]\n end\n }\n return min_element# Add your solution here\nend", "def my_min_once\n min = first\n each do |num|\n if num < min\n min = num\n end\n end\n min\n end", "def my_min(arr) # Find\n min = arr[0]\n\n arr.each do |el| # Go through array once O(n)\n min = el if el < min # update min while going through if found min\n end\n min\nend", "def my_min(list) \n\n list.each_with_index do |ele, i| #O(n)\n compare_arr = list[0...i] + list[i+1..-1] # O(2n) \n return ele if compare_arr.all? { |ele2| ele < ele2 } #O(n)\n end\n\n #time complexity = O(n^2) + O(2n)\n\nend", "def better_min(array)\n min_val = array.first\n\n array.each do |el| #O(n)\n if el < min_val\n min_val = el\n end\n end\n min_val\n end", "def my_min2 # O(n) time complexity\n smallest = self.first\n self.each do |num|\n sleep(1)\n smallest = num if num < smallest \n end\n smallest\n end", "def minimum( *numbers )\n min = numbers.first\n numbers.each { |number| min = number if number < min }\n min\nend", "def minimum( *numbers )\n min = numbers.first\n numbers.each { |number| min = number if number < min }\n min\nend", "def my_min_2(arr) #O(N)\n min_num = arr.first\n \n arr.each { |num| min_num = num if num < min_num }\n \n min_num\n end", "def smallest_integer(list_of_nums)\n\tans = list_of_nums.min \nend", "def find_min(nums)\n nums.rotate(rand(1..10)).min\nend", "def find_min(*nums)\n nums.reduce do | acc, current_value |\n if acc > current_value\n current_value\n else\n acc\n end\n end\nend", "def smallest_integerv2(list_of_nums)\n # Your code goes here!\n\treturn list_of_nums.min\nend", "def iterate_once_my_min(integers)\n min = integers.first\n integers.each do |integer|\n min = integer if integer < min\n end\n min\nend", "def my_min_improved(arr)\n min = arr[0]\n\n arr.each do |el|\n min = el if el < min\n end\n\n return min\nend", "def my_min2(arr)\n minimum = arr.first\n arr.each do |num|\n minimum = num if num < minimum\n end\n minimum\nend", "def my_min_phase_2(list)\n min = list[0]\n (1...list.length).each do |i|\n min = list[i] if list[i] < min\n end\n min\nend", "def my_min(arr)\n min = arr[0]\n arr.each do |num|\n if num < min\n min = num\n end\n end\n min\n\nend", "def smallest_integer(list_of_nums)\r\n smallest = list_of_nums.first\r\n list_of_nums.each {|n| smallest = n if n < smallest}\r\n return smallest\r\nend", "def my_min_v2(arr) # O(n)\n num = arr[0]\n arr.each { |int| num = int if int < num }\n num\nend", "def smallest_integer(list_of_nums)\n smallest_num = list_of_nums[0]\n list_of_nums.each do |value|\n smallest_num = value if value < smallest_num\n end\n smallest_num\nend", "def better_my_min(array)\n smallest = array[0]\n array[1..-1].each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min(list)\n list.each do |el|\n equal_or_smaller = []\n list.each do |el2|\n equal_or_smaller << el2 if el2 < el\n end\n return el if equal_or_smaller.empty?\n end\nend", "def smallest_integer(list_of_nums)\n # Your code goes here!\n\tsmall = list_of_nums[0]\n\tlist_of_nums.each do |x|\n\t\tsmall = x if x < small\n\tend\n\treturn small\nend", "def my_min2(arr)\r\n min = arr[0]\r\n arr.each { |num| min = num if num < min }\r\n min\r\nend", "def my_min(list)\n list.each do |el|\n smallest = true\n list.each do |second_el|\n if second_el < el\n smallest = false\n end\n end\n if smallest == true\n return el\n end\n end\nend", "def smallest_integer(list_of_nums)\n small = list_of_nums[0]\n list_of_nums.each do |num|\n if num < small\n small = num\n end\n end\nsmall\nend", "def my_min(arr) #linear\n arr.reduce do |smallest, num|\n if smallest < num\n smallest\n else\n smallest = num\n end\n end\nend", "def my_min(list)\r\n smaller_ele = []\r\n list.each do |ele1|\r\n list.each do |ele2|\r\n smaller_ele << [ele1,ele2].min \r\n end\r\n end\r\n return smaller_ele.min\r\nend", "def my_min_once(arr)\n min = arr.first \n\n (0...arr.count).each do |i|\n min = arr[i] if arr[i] < min \n end\n\n min \nend", "def find_min2(array)\n min = array[0]\n \n array.each do |num|\n if num < min\n min = num\n end\n end\n \n return min\nend", "def simple_loop(list)\n smallest = list.first\n \n (1...list.length).each do |idx|\n smallest = list[idx] if list[idx] < smallest\n end\n \n smallest\nend", "def smallest_integer(list_of_nums)\n smallest = nil\n list_of_nums.each do |num|\n if smallest == nil\n smallest = num\n end\n if num <= smallest\n smallest = num\n end\n end\n smallest\nend", "def good_my_min(arr)\n smallest = arr.first\n arr.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min_2(arr)\n\n smallest_value = arr[0] # O(1)\n\n arr.each do |ele1| # [ 0, 3, 5, 4, -5, 10, 1, 90 ] O(n)\n smallest_value = ele1 if ele1 <= smallest_value #O(1)\n end\n\n smallest_value #O(1)\n\nend", "def smallest_integer(list_of_nums)\n\n small_int = list_of_nums[0]\n list_of_nums.each do |small|\n if small < small_int\n small_int = small\n end\n end\n return small_int\nend", "def my_min2(array)\n min = array.first\n array.each {|item| min = item if item <= min}\n return min\nend", "def min() end", "def smallest_integer(list_of_nums)\n # Your code goes here!\n x = list_of_nums[0]\n list_of_nums.each do |y|\n if y < x\n x = y\n end\n end\n return x\nend", "def my_min_iterative(array)\n minimum = nil\n\n array.each { |element| minimum = element if minimum.nil? || element < minimum }\n\n minimum\nend", "def my_min2(arr)\n min = arr.first \n arr.each {|ele| min = ele if ele < min }\n min\nend", "def my_min(arr)\n min = arr.first\n\n arr.each do |el|\n min = el if el < min\n end\n\n min\nend", "def my_min_linear(array)\n min = array[0]\n\n array.each do |num|\n min = num if num < min\n end\n min\nend", "def smallest_integer(list_of_nums)\n # Pseudocode\n # return nil if array is empty\n # Otherwise, initialize current minimum as the first element of the array\n # FOR each element of the array\n # IF that element is larger than the current minimum\n # Set the current minimum to that element\n # Return the current minimum\n\n #initial solution\n # return nil if list_of_nums.length == 0\n\n # minimum = list_of_nums[0]\n\n # list_of_nums.each do |el|\n # minimum = el if el < minimum\n # end\n\n # return minimum\n\n #using built-in Ruby enumerables method\n return list_of_nums.min\n\nend", "def find_min_value(array)\n min = 0\n array.length.times do |count|\n if count == 0\n min = array[count]\n else\n if array[count] < min\n min = array[count]\n end\n end\n end\n min\nend", "def my_min(arr)\n smallest = nil\n\n arr.each do |n|\n smallest = n if smallest.nil? || n < smallest\n end\n\n smallest\nend", "def my_min(array)\n min = array.first\n array.each {|el| min = el if min > el}\n min\nend", "def my_min(array) # O(n) - Linear\n counter = array[0]\n\n (1...array.length).each do |i|\n if counter > array[i]\n counter = array[i]\n end\n end\n counter\nend", "def my_min_v2(array)\n minimum = array.first\n\n array[1..-1].each do |element|\n minimum = element if minimum > element\n end\n\n minimum\nend", "def findmin(nums)\n puts \"#{nums.min}, #{nums.find_index(nums.min)}\"\nend", "def phase_1_min(list)\n smallest = 0\n list.each_with_index do |num1, indx1|\n list.each_with_index do |num2, indx2|\n next if indx1 == indx2\n smallest = num1 if num1 < num2 && num1 < smallest\n end\n end\n smallest\nend", "def smallest_integer(list_of_nums)\n return nil if list_of_nums.empty?\n smallest = list_of_nums.pop\n list_of_nums.each {|x| smallest = x if x < smallest }\n smallest\nend", "def my_min2(array)\n lowest_num = array.first\n array.each do |el1|\n next if lowest_num == el1\n if el1 < lowest_num\n lowest_num = el1\n end\n end\n lowest_num\nend", "def better_my_min\n min = self.first\n self.each do |el|\n min = el if el < min\n end\n min\n end", "def my_min(arry)\n mini = arry.first\n arry.each do |ele|\n if ele < mini\n mini = ele\n end\n end\n mini\nend", "def my_min2(array)\n minimum = array.first\n array.each_index do |idx|\n if array[idx] < minimum\n minimum = array[idx]\n end\n end\n minimum\nend", "def linear_my_min(arr)\n # arr.inject do |min, ele|\n # min > ele \n # end\n # arr.first \n\n min = arr.first \n\n arr.each do |ele|\n min = ele if ele < min \n end\n min \n\nend", "def find_smallest_int(nums)\n max = nums[0]\n min = nums[0]\n nums.each do |item|\n if item > max\n max = item;\n elsif item < min\n min = item\n end \n end \n return min\nend", "def my_min(array)\n\n smallest = array.first\n array.each_with_index do |el, i|\n smallest = el if el < smallest\n end\n smallest\n\nend", "def my_min2(arr)\n min = arr.first\n arr.each { |el| min = el if el < min }\n min\nend", "def my_min1(int_list)\n int_list.each do |int1|\n return int1 if int_list.all? { |int2| int2 >= int1 }\n end\nend", "def my_min(arr)\n\n smallest_value = arr[0]\n\n arr.each do |ele1| # [ 0, 3, 5, 4, -5, 10, 1, 90 ] O(n)\n # smallest_value = ele1 if ele1 < smallest_value\n if arr.all?{|ele2| ele1 <= ele2 } #O(n)\n smallest_value = ele1\n end\n end\n\n smallest_value\n\nend", "def my_min2(arr)\n smallest = arr.first\n arr.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend" ]
[ "0.8384789", "0.82231927", "0.8215523", "0.8174699", "0.81713325", "0.8143211", "0.8090713", "0.8060159", "0.80517286", "0.8033829", "0.8019452", "0.8008887", "0.80039126", "0.80007476", "0.7988653", "0.79828626", "0.7976922", "0.79642594", "0.79627484", "0.79389185", "0.79285884", "0.78963256", "0.7838535", "0.78268605", "0.78102577", "0.77958596", "0.7764659", "0.7749345", "0.7748645", "0.7748472", "0.7723927", "0.7721227", "0.7713894", "0.7698291", "0.7688602", "0.76142114", "0.7604959", "0.75729495", "0.7531946", "0.7531635", "0.75138927", "0.7461039", "0.74558187", "0.7449896", "0.744108", "0.744108", "0.7437472", "0.7434597", "0.740655", "0.7398263", "0.7390621", "0.7368906", "0.7366952", "0.73475915", "0.73424435", "0.73100746", "0.7302681", "0.72915876", "0.7285903", "0.7282221", "0.7278272", "0.7269641", "0.7252709", "0.724828", "0.7246013", "0.72452986", "0.7240407", "0.72361624", "0.7233495", "0.71958", "0.71914893", "0.7184107", "0.71831465", "0.7182018", "0.71787", "0.71757674", "0.71728843", "0.71714437", "0.7167363", "0.7160752", "0.7158289", "0.71545005", "0.7149616", "0.7148627", "0.7125852", "0.71200603", "0.7119507", "0.71170425", "0.71155906", "0.7103415", "0.70973784", "0.70893896", "0.70813537", "0.7079841", "0.7079686", "0.70765066", "0.7073048", "0.70720565", "0.70714545", "0.7068263", "0.7053899" ]
0.0
-1
list = [5, 1, 3] p subsets(list) p largest_contiguous_sum(list)
def faster_cont_sum(arr) # debugger sum = arr[0] bool = true run_tot = arr[0] arr[1..-1].each do |e| if bool == false && e > sum sum = e bool = true run_tot = e elsif bool == true && e + sum > sum sum += e run_tot += e elsif bool == true && e > sum sum = e else bool = false run_tot += e end end sum >= run_tot ? sum : run_tot end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def largest_contiguous_subsum(list)\n subsets = []\n (0...list.length).each do |idx1|\n (idx1...list.length).each do |idx2|\n subsets << list[idx1..idx2]\n end\n end\n\n #orignial [1,2,3]\n\n #[1]\n #[1,2]\n #[1,2,3]\n #[2]\n #[2,3]\n #[3]\n\n\n largest = subsets[0].sum\n subsets.each do |subset|\n largest = subset.sum if subset.sum > largest\n end\n\n largest\nend", "def largest_contiguous_subsum(list)\n subs = [] \n (0...list.length).each do |i|\n (i...list.length).each do |j|\n subs << list[i..j]\n end\n end\n\n subs.map {|el| el.sum}.max\nend", "def largest_contiguous_subsum1(list)\n subs = []\n (0...list.length).each do |i|\n (i...list.length).each do |j|\n subs << list[i..j]\n end\n end\n\n subs.map(&:sum).max\nend", "def largest_contiguous_subsum1(list)\n arr = []\n (0...list.length).each do |i|\n (i...list.length).each { |j| arr << list[i..j] }\n end\n largest_sum = arr.first.sum\n arr.each do |sub_arr|\n largest_sum = sub_arr.sum if sub_arr.sum > largest_sum\n end\n largest_sum\nend", "def largest_contiguous_subsum_one(list)\n sub_arr = []\n sum = 0\n list.each_with_index do |ele, i|\n (i...list.length).each do |i2|\n sub_arr << list[i..i2]\n end\n end\n sub_arr.each do |arr|\n if arr.sum > sum\n sum = arr.sum\n end\n end\n sum\nend", "def largest_contiguous_subsum(list)\n subs = []\n list.each_with_index do |ele1, idx1|\n (idx1..list.length-1).each do |idx2|\n subs.push(list[idx1..idx2])\n end\n end\n subs_sum = subs.map{|sub_arr| sub_arr.sum}\n subs_sum.flatten.max\nend", "def largest_contiguous_subsum(list)\n arr = []\n list.length.times do |id|\n arr << [list[id]]\n id2 = id + 1\n while id2 < list.length\n arr << list[id..id2]\n id2 += 1\n end\n end\n sum_arr = arr.map{ |el| el.reduce(:+)}\n arr[sum_arr.find_index{|el| el == sum_arr.max}]\nend", "def largest_contiguous_subsum(list)\r\n sub_arr = []\r\n list.each_with_index do |ele1,idx1|\r\n list.each_with_index do |ele2,idx2|\r\n sub_arr<< list[idx1..idx2] if idx2>=idx1\r\n end\r\n end\r\n p sub_arr.size\r\n sub_arr.map{ |sub| sub.sum}.max\r\n #(O(n^2 + m)\r\nend", "def largest_contiguous_subsum(arr)\n subsets = []\n\n (0...arr.length).each do |idx1|\n (idx1...arr.length).each do |idx2|\n subsets << arr[idx1..idx2]\n end\n end \n\n largest_sum = subsets.first.sum\n\n subsets.each do |subset|\n if subset.sum > largest_sum\n largest_sum = subset.sum\n end\n end\n\n print subsets\nend", "def largest_contiguous_subsum(list)\n answer=[]\n list.each_with_index do |ele,index|\n list.each_with_index do |ele2,index2|\n if index2 >= index \n answer.push(list[index..index2])\n end\n end\n end\n answer.map {|array| array.sum}.max\nend", "def largest_contiguous_subsum(list)\n helper_arr = [list.first]\n (1...list.length).each do |idx|\n if helper_arr[-1] + list[idx] > list[idx]\n helper_arr << helper_arr[-1] + list[idx]\n else\n helper_arr << list[idx]\n end\n end\n helper_arr.max\nend", "def largest_contiguous_subsum(list)\n sub_arr = []\n \n (0...list.length).each do |idx|\n (idx...list.length).each do |jdx|\n sub_arr << list[idx..jdx]\n end\n end\n\n sub_arr.map! {|ele| ele.sum}.max\nend", "def largest_contiguous_subsum(list) \n subs = []\n\n (0...list.length).each do |i|\n (i...list.length).each do |j|\n sub = list[i..j]\n subs << sub\n end\n end\n \n max = nil\n\n subs.each do |sub|\n sum = sub.sum \n if max == nil || sum > max\n max = sum\n end\n end\n max\nend", "def largest_contiguous_subsum1(list)\n sums = []\n\n list.each_with_index do |el1, i1|\n list.each_with_index do |el2, i2|\n if i1 == i2\n sums << el1\n else\n sums << el1 + el2\n end\n end\n end\n\n result = sums.first\n\n sums.each do |sum|\n result = sum if sum > result\n end\n\n result\nend", "def largest_contiguous_subsum(list)\n new_arr = []\n (0...list.length - 1).each do |i|\n (i...list.length).each do |j|\n new_arr << list[i..j]\n end\n end\n new_arr.map { |sub_arr| sub_arr.sum }.max\nend", "def largest_contiguous_subsum(list)\n # l = list.length # 1\n # result = [] # 1\n # hash = Hash.new(0) # 1\n\n # (0...l).each do |i1| # n\n # (0...l).each do |i2| # n\n # result << list[i1..i2] if i2 >= i1 # 1\n # end\n # end\n\n # result.each do |sub_arr| # n\n # hash[sub_arr] = sub_arr.sum # 1\n # end\n\n # sorted_by_val = hash.sort_by { |k, v| v } # n, \n # sorted_by_val[-1][1] # \nend", "def largest_contiguous_subsum(list)\n curr_sum = list[0]\n max_sum = list[0]\n (1...list.length).each do |idx|\n # debugger\n curr_sum += list[idx]\n if curr_sum < list[idx] \n curr_sum = list[idx]\n end\n if curr_sum > max_sum\n max_sum = curr_sum\n end\n end\n max_sum\nend", "def largest_contiguous_subsum_1(list)\n subs = []\n (0...list.length).each do |idx| #O(n)\n (idx...list.length).each do |idx_2| #O(n)\n subs << list[idx..idx_2] #O(n)\n end\n end\n max = list.first\n subs.each do |subarr|\n if subarr.sum > max\n max = subarr.sum\n end\n end\n max\nend", "def largest_contiguous_subsum(list)\n max = nil\n subarrays = []\n\n list.each_with_index do |el1, idx1|\n (idx1...list.length).each do |idx2|\n subarrays << list[idx1..idx2]\n end\n end\n\n sums = []\n subarrays.each do |array|\n sums << array.inject(:+)\n end\n\n sums.max\nend", "def largest_contiguous_subsum(list)\n # debugger\n results = [] # O(1)\n\n list.each_with_index do |el1, idx1| # O(n)\n list.each_with_index do |el2, idx2| # O(n) => O(n^2)\n next if idx2 < idx1 # O(1)\n results << list[idx1..idx2] # O(1)\n end\n end\n\n results.map! { |subsum| subsum.reduce(:+) } # O(n^2)\n results.max # O(1)\nend", "def largest_contiguous_sum(array)\n subsets = []\n subarr = []\n\n\n array.each_index do |i|\n array.each_index do |j|\n next if j < i\n subsets << array[i..j] unless subsets.include? array[i..j]\n end\n end\n sum = 0\n subsets.each do |sarr|\n next if sarr.empty?\n sum = [sarr.inject(:+), sum].max\n end\n sum\nend", "def largest_contiguous_subsum(list)\n new_arr = []\n\n (0...list.length).each do |idx1| #O(n)\n (0...list.length).each do |idx2| #O(n)\n if idx2 >= idx1 #O(1)\n new_arr << list[idx1..idx2].sum #O(1)\n end \n end \n \n end \n \n return new_arr.max #O(n)\nend", "def largest_contiguous_subsum_1(list) \n subs = [] #O(1)\n (0...list.length).each do |start_num| #O(n)\n (start_num...list.length).each do |end_num| #O(n)\n subs << list[start_num..end_num] #O(n)\n end\n end\n subs_sum = [] #O(1)\n subs.each do |sub| #O(n**2)\n sub_sum = 0 #O(1)\n sub.each {|s| sub_sum += s} #O(n)\n subs_sum << sub_sum #O(1)\n end\n subs_sum.inject do |acc,el| #O(n)\n if acc > el #O(1)\n acc #O(1)\n else\n el #O(1)\n end\n end\n end", "def largest_contiguous_subsum(arr)\n subsets = [] \n\n (0...arr.length).each do |i| \n (i...arr.length).each do |j| \n subsets << arr[i..j]\n end \n end \n \n subsets.map {|sub| sub.sum}.max \nend", "def largest_contiguous_subsum(list)\n length = 1\n sub_arrays = []\n until length == list.length\n sub_arrays += list.each_cons(length).to_a\n length += 1\n end\n sub_arrays.map! { |el| el.reduce(:+) }.max\n\n # sub_arrays = []\n #\n # list.each_with_index do |ele, idx1|\n # list.each_with_index do |ele2, idx2|\n # sub_arrays << list[idx1..idx2] unless list[idx1..idx2].length < 1\n # end\n # end\n # sub_arrays.map! { |el| el.reduce(:+) }.max\n\nend", "def largest_contiguous_subsum(list)\n # O(N*M) ==> Time\n # O(N*M) ==> Space\n sub_arrs = sub_arrays_of(list) # O(N^3)\n sums = []\n sub_arrs.each do |sub_arr| ## O(N*M)\n sums << sub_arr.sum\n end\n # Get the max of the sums array\n sums.max # O(N)\nend", "def largest_contiguous_subsum_1(list)\r\n subarrays = [] #1\r\n list.each_with_index do |ele1, i| #n\r\n list[i...list.length].each_with_index do |ele2,i2| #(n-1)\r\n subarrays << list[i..i2+i] #k \r\n end\r\n end # n^2\r\n subarrays.map { |subarray| subarray.sum}.max # n^x\r\nend", "def largest_contiguous_subsum(list)\n all_subarrays = Array.new \n i = 0 \n j = 0\n\n while j < list.length \n while i < list.length \n all_subarrays << list[j..i]\n i += 1 \n end \n j += 1 \n i = j \n end\n\n sums = Array.new\n\n all_subarrays.each do |arr|\n sum = 0\n\n arr.each { |n| sum += n }\n\n sums << sum\n end\n\n sums.max\nend", "def largest_contiguous_subsum1(list)\n greatest_sum = -1.0/0.0\n (0...list.length).each do |i|\n (i...list.length).each do |j|\n greatest_sum = list[i..j].sum if greatest_sum < list[i..j].sum\n end\n end\n greatest_sum\nend", "def largest_contiguous_sub_sum1(list)\n max = list[0]\n (0...list.length).each do |i|\n (i...list.length).each do |j| \n sub_sum = list[i..j].sum \n max = sub if sub >= max \n end\n end\n max\nend", "def largest_contiguous_subsum(list) # O(n^2)\n subs_sums = []\n\n list.each_index do |i|\n list.each_index do |j|\n next if j < i\n subs_sums << list[i..j]\n end\n end\n\n highest_array_sum = nil\n subs_sums.each do |array|\n array_sum = array.reduce(:+)\n if highest_array_sum == nil || array_sum > highest_array_sum\n highest_array_sum = array_sum\n end\n end\n\n highest_array_sum\nend", "def largest_contiguous_subsum(list) # O(n^2)\n array = []\n list.each_with_index do |ele1, i1| # O(n^2)\n (i1...list.length).each do |i2|\n array << list[i1..i2]\n end\n end\n\n max_sum = array.first.sum\n array[1..-1].each do |subarr| # O(n^2)\n sum = subarr.sum\n if sum > max_sum\n max_sum = sum\n end\n end\n\n max_sum\n\nend", "def largest_contiguous_subsum_2(list)\n current_sum = 0\n largest_sum = 0\n (0...list.length).each do |idx|\n current_sum += list[idx]\n largest_sum = current_sum if current_sum > largest_sum\n current_sum = 0 if current_sum < 0\n end\n largest_sum\nend", "def largest_contiguous_subsum(list)\r\n max_val = 0 #8\r\n current_sum = 0 #8\r\n list.each do |num|\r\n current_sum = [0, current_sum + num].max\r\n max_val = [max_val, current_sum].max\r\n end\r\n return max_val\r\nend", "def largest_contiguous_subsum(list)\n prev_max = -9999999999999\n new_max = 0\n list.each do |ele|\n new_max += ele\n prev_max = new_max if prev_max <= new_max\n new_max = 0 if new_max < 0 # Reset\n end\n prev_max\nend", "def largest_contiguous_subsum_2(list)\n largest_sum = 0\n current_sum = 0\n\n list.each do |el|\n largest_sum = current_sum \n current_sum += el \n if current_sum < el \n current_sum = el \n end \n largest_sum = current_sum if largest_sum < current_sum\n end\n\n largest_sum\nend", "def better_largest_contiguous_subsum(list)\n total_sum = list.first\n current_sum = list.first\n\n list.each_index do |idx| \n current_sum = [list[idx], current_sum + list[idx]].max\n total_sum = [total_sum, current_sum].max\n end\n\n return total_sum\nend", "def largest_contiguous_subsum(list)\n max_sum = 0\n i = 0\n while i < list.size\n curr_sum = list[0..i].take(i).sum #take from front\n max_sum = curr_sum if curr_sum > max_sum\n\n curr_sum = list[i..-1].take(i).sum #take from front\n max_sum = curr_sum if curr_sum > max_sum\n\n curr_sum = list[0..i].drop(i).sum #drop from back\n max_sum = curr_sum if curr_sum > max_sum\n\n curr_sum = list[i..-1].drop(i).sum #drop from back\n max_sum = curr_sum if curr_sum > max_sum\n\n curr_sum = list[i..-i].take(i).sum #take from front\n max_sum = curr_sum if curr_sum > max_sum\n\n curr_sum = list[i..-i].drop(i).sum #drop from back\n max_sum = curr_sum if curr_sum > max_sum\n\n i += 1\n end\n max_sum\nend", "def largest_contiguous_subsum(list)\n largest_sum = 0\n current_sum = list[0]\n (1...list.length).each do |i|\n current_sum = 0 if current_sum < 0 #we need to reset current sum if we hit a negative number\n current_sum += list[i]\n largest_sum = current_sum if current_sum > largest_sum\n end\n largest_sum\nend", "def largest_contiguous_subsum(list)\n max_sum = list.first\n current_sum = list.first\n \n (1...list.length).each do |i| \n current_sum = 0 if current_sum < 0 \n current_sum += list[i]\n max_sum = current_sum if current_sum > max_sum\n end\n max_sum\nend", "def largest_contiguous_subsum1(int_list)\n sub_arrays = []\n\n (0...int_list.length).each do |idx1|\n (idx1...int_list.length).each do |idx2|\n sub_arrays << int_list[idx1..idx2]\n end\n end\n\n sub_arrays.each_with_index do |arr, idx|\n sum_arr = arr.sum\n sub_arrays[idx] = sum_arr\n end\n\n sub_arrays.max\nend", "def largest_contiguous_subsum2(list)\n result = list.first\n sum = list.first\n\n list.each_with_index do |n, i|\n next if i == 0\n\n sum = 0 if sum < 0\n\n sum += n\n\n result = sum if sum > result\n end\n\n result\nend", "def largest_contiguous_subsum1(array)\r\n subset = []\r\n array.each_index do |i| # make subets, store into 'subset' array\r\n (i...array.length).each do |j| # o(n^2)\r\n subset << array[i..j] # o(n^3) cause slicing\r\n end\r\n end\r\n\r\n subset_sum = []\r\n subset.each do |ele|\r\n subset_sum << ele.sum\r\n end\r\n subset_sum.max\r\nend", "def largest_contiguous_subsum(list)\n current_max = list[0]\n current_sum = list[0]\n\n (1...list.size).each do |i|\n current_sum += list[i]\n if current_sum > current_max\n current_max = current_sum\n end\n\n if current_sum < 0 \n current_sum = 0\n end\n \n end\n\n current_max\nend", "def efficient_contiguous_subsum(list)\n current_sum = list[0] #0\n largest_sum = list[0] #5\n # debugger\n (1...list.length).each do |i| \n if current_sum + list[i] > 0 \n current_sum += list[i] \n largest_sum = current_sum if current_sum > largest_sum\n else \n current_sum = 0\n end \n end \n largest_sum\nend", "def largest_contiguous_subsum2(int_list)\n largest_sum = int_list.first\n curr_sum = int_list.first\n\n (1...int_list.length).each do |idx|\n curr_sum = (int_list[idx] > curr_sum + int_list[idx]) ? int_list[idx] : curr_sum + int_list[idx]\n largest_sum = curr_sum if curr_sum > largest_sum\n end\n\n largest_sum\nend", "def largest_contiguous_subsum(list)\r\n \r\n largest = -1*Float::INFINITY\r\n current_sum = 0\r\n\r\n list.each do |num|\r\n if (current_sum += num ) < 0\r\n current_sum = 0\r\n if largest < num\r\n largest = num\r\n end\r\n else\r\n largest = current_sum if largest < current_sum\r\n end\r\n end\r\n largest\r\n # last_idx = 0\r\n # list.each_with_index do |e, i|\r\n # if current_sum < 0 || (current_sum += e) > largest\r\n # last_idx = i \r\n # largest = current_sum > 0 ? current_sum : e\r\n # end\r\n # end\r\n # p largest\r\n # p last_idx\r\n # largest = -1*Float::INFINITY\r\n # current_sum = 0\r\n\r\n # last_idx.downto(0).each do |i|\r\n # if current_sum < 0 || (current_sum += list[i]) > largest\r\n # largest = current_sum > 0 ? current_sum : list[i]\r\n # end\r\n # end\r\n\r\n # largest\r\nend", "def largest_contiguous_subsum(arr)\n\n\nend", "def largest_contiguous_subsum1(list)\n p Time.now\n sub_arrays = []\n list.each_index do |i|\n list.each_index do |j|\n next if j < i\n sub_arrays << list[i..j]\n end\n end\n sub_arrays.map{|numbers| numbers.inject(:+)}.max\n p Time.now\nend", "def largest_contiguous_subsum_2(list)\n largest_sum = list.first\n current_sum = 0\n list.each do |ele| \n current_sum += ele\n if current_sum > largest_sum\n largest_sum = current_sum\n end\n current_sum = 0 if current_sum < 0 \n end\n largest_sum\nend", "def largest_contiguous_subsum2(list)\n sum = 0 # keeps track of current sum\n largest_sum = list.first # evaluates to the largest sum\n list.each do |ele|\n sum += ele \n largest_sum = sum if sum > largest_sum\n sum = 0 if sum < 0\n end\n largest_sum\nend", "def largest_contiguous_sum(arr)\n largest_sum = nil\n p_tations = subsets(arr)\n\n p_tations.each do |tation|\n if largest_sum == nil\n largest_sum = tation.sum \n elsif tation.sum > largest_sum\n largest_sum = tation.sum \n end\n end \n\n largest_sum\nend", "def largest_contiguous_subsum(list)\n max_sum = list[0]\n\ttemp_sum = list[0]\n\tdebugger\n #0(n) #note: only n^2 if nested\n \n return list.max if list.all? { |ele| ele < 0 } \n #need to add O(1) return case\n # Write a new function using O(n) time with O(1) memory. Keep a running tally of the largest sum.\n\n list_2 = list.drop(1)\n list_2.each do |ele|\n\t\ttemp_sum = [ele, temp_sum + ele].max #O(1) operation, should refactor \n #temp_sum = ele = 4, temp_sum = 1+3, [4, 8].max\n # [3, -7]\n #[3, 5 + 3] = > 3, 8 = > 8 max = 5\n #[-7, 8 - 7] => 1, 1 = > 1 max = 8\n max_sum = temp_sum if temp_sum > max_sum\n\tend\n\t\n\tmax_sum\nend", "def largest_contiguous_subsum1(array)\n sub_array = []\n\n array.each_index do |i|\n array.each_index do |j|\n next if i > j\n sub_array << array[i..j]\n end\n end\n sum = sub_array.first.inject(:+)\n sub_array.each do |el|\n sum = el.inject(:+) if el.inject(:+) > sum\n end\n sum\nend", "def better_largest_contiguous_subsum(list)\n current_largest_sum = 0\n current_sum = 0\n return list.max if list.all? {|ele| ele < 0}\n\n (0...list.length).each do |i |\n # debugger\n #add current element to current sum\n current_sum += list[i]\n\n #if current sum is less than 0 ignore it and reset to move on to next number\n if ( current_sum < 0 ) \n current_sum = 0\n end \n # if current sum is greater than our current largest sum, we want to keep it\n if current_sum > current_largest_sum\n current_largest_sum = current_sum\n end\n end\n current_largest_sum\nend", "def largest_contiguous_subsum2(array)\n # return [list[0]] if list.count == 1\n #\n # start_num = list.shift\n # large_sum = start_num\n #\n # other_list = list.dup\n #\n # idx = 0\n # while idx < list.count\n # sum = list[0..idx].inject(:+)\n # if large_sum < start_num + sum\n # large_sum = start_num + sum\n # end\n # idx += 1\n # end\n #\n # [large_sum] + largest_contiguous_subsum2(other_list)\n\n largest = nil\n current = 0\n\n array.each do |el|\n current += el\n if largest.nil? || current > largest\n largest = current\n end\n current = 0 if current < 0\n end\n\n largest\n\nend", "def largest_contiguous_subsum2(list)\n largest_sum = list[0]\n current_sum = 0\n# list = [2, 3, -6, 7, -6, 7]\n list.each do |number|\n current_sum += number\n if current_sum > largest_sum\n largest_sum = current_sum\n elsif current_sum < 0\n current_sum = 0\n end\n end\n largest_sum\nend", "def largest_contiguous_subsum2(list)\n # O(N) ==> Time\n # O(1) ==> Space\n largest = list.first\n curr = list.first\n\n len = list.length\n (1...len).each do |i|\n curr = 0 if curr < 0 \n curr += list[i]\n largest = curr if curr > largest\n end\n largest\nend", "def largest_contiguous_subsum(arr)\n subs = []\n l = arr.length\n (0...l).each do |i|\n (0...l).each do |j| \n subs << arr[i..j] if arr[i..j].length > 0 # n*n *( n) == n^3 + n\n end\n end\n subs.map(&:sum).max\nend", "def largest_contiguous_subsum_v2(list)\n largest_sum = list.first\n sum = list.first # but the first element can be a negative number\n\n (1...list.length).each do |i|\n # a negative number + a postive number always less than pos number on its own\n sum = 0 if sum < 0 # if we add to a negative sum, then result is less than pos number on its own\n sum += list[i]\n largest_sum = sum if largest_sum < sum\n end\n\n largest_sum\nend", "def largest_contiguous_subsum(arr)\n sums = []\n\n (0...arr.length).each do |idx1|\n (idx1+1...arr.length).each do |idx2|\n sums << arr[idx1..idx2].sum\n end\n end\n\n sums.max\nend", "def largest_contiguous_subsum(arr)\n sum = arr.first\n\n (0...(arr.length - 1)).each do |idx1|\n (idx1..(arr.length - 1)).each do |idx2|\n if idx1 == idx2\n ss = arr[idx1]\n else\n ss = arr[idx1..idx2].reduce(:+)\n end\n sum = ss if ss > sum\n end\n end\n sum\nend", "def largest_contiguous_subsum(array)\n sub_arrs = []\n array.each_index do |ind1|\n array[ind1..-1].each_index do |ind2|\n sub_arrs.push(array[ind1..ind2+ind1])\n end\n end\n max_sum = sub_arrs.first.sum\n sub_arrs.each {|sub| max_sum = sub.sum if sub.sum >= max_sum }\n return max_sum\nend", "def largest_contiguous_subsum_1(arr)\n res = []\n i = 0\n while i < arr.length\n j = i\n while j < arr.length\n res << arr[i..j].reduce(:+)\n j += 1\n end\n i += 1\n end\n res.max\nend", "def largest_contiguous_subsum(arr) # n^2\n subs = []\n (0...arr.length).each do |start_i|\n (start_i...arr.length).each do |end_i|\n subs << arr[start_i..end_i]\n end\n end\n\n subs.map { |sub| sub.inject(:+) }.max\nend", "def largest_contiguous_subsum(array)\n sums_list = []\n sums = []\n\n idx1 = 0\n\n while idx1 < array.length #O(n)\n idx2 = idx1 #O(1)\n while idx2 < array.length #O(n)\n sums_list << array[idx1..idx2] #O(n)\n idx2 += 1\n end\n idx1 += 1\n end\n\n sums_list.each do |list| #O(n)\n sums << list.reduce {|sum, num| sum + num} #O(n)\n end\n sums.max\nend", "def largest_contiguous_subsum(array)\n arr = []\n (0...array.length).each do |i|\n (i + 1...array.length).each do |j|\n arr << array[i] + array[j] \n end\n end\n arr.max\n \nend", "def largest_contiguous_subsum(arry)\n sums = 0\n size = arry.length\n\n (0..size - 1).each do | i|\n sub = []\n (i + 1..size).each do |j|\n sub = arry[i..j]\n if sub.sum > sums\n sums = sub.sum \n end\n end\n end\n sums\nend", "def largest_contiguous_subsum_v1(arr)\n subs = [] # ( +2 )\n\n (0...arr.length).each do |idx1| # ( n )\n (idx1..arr.length - 1).each do |idx2| # ( n )\n subs << arr[idx1..idx2].sum # ( n * ( 1 + ))\n end\n end\n\n subs.max # ( n )\nend", "def largest_contiguous_subsum(arr)\n answer = []\n arr.each_with_index do |ele1,idx1|\n arr.each_with_index do |ele2,idx2|\n answer << arr[idx1..idx2].sum \n end\n end\n answer.sort[-1]\nend", "def largest_contiguous_subsum(nums)\n running_sum = 0\n max = nums.first || 0\n\n nums.each do |n|\n running_sum += n\n max = running_sum if max < running_sum\n running_sum = 0 if running_sum < 0\n end\n max\nend", "def largest_contiguous_subsum(arr)\n max_sum = arr.first\n\n (0...arr.length).each do |start|\n (start...arr.length).each do |ending|\n sum = arr[start..ending].sum\n max_sum = sum if sum > max_sum\n end\n end\n\n max_sum\nend", "def largest_contiguous_subsum(arr)\n i = 0\n subs = []\n while i < arr.length\n j = i\n\n while j < arr.length\n subs << arr[i..j]\n\n j += 1\n end\n\n i += 1\n end\n\n\n return (subs.max {|a, b| a.sum <=> b.sum}).sum\n\nend", "def largest_contiguous_subsum(array)\n current_sum = array.first\n largest_sum = array.first\n array.each do |num|\n current_sum += num\n if largest_sum < current_sum\n largest_sum = current_sum\n end\n end\n largest_sum\nend", "def largest_contiguous_subsum(array)\n sub_arrays = []\n i = 1\n until i == array.length + 1\n array.each_cons(i) do |sub|\n sub_arrays << sub\n end\n i += 1\n end\n sub_arrays.map {|sub| sub.reduce(:+)}.max\nend", "def largest_contiguous_subsum_fast(list)\n start = Time.now\n max_sum = list[0]\n cur_sum = list[0]\n list[1..-1].each do |el|\n if el >= cur_sum && cur_sum < 0\n cur_sum = el\n else\n cur_sum += el\n end\n max_sum = cur_sum if cur_sum > max_sum\n end\n finish = Time.now\n puts \"Runtime: #{finish - start}\"\n return max_sum\nend", "def largest_contiguous_subsum(arr)\n result = []\n\n arr.each_with_index do |el1, idx1|\n i = idx1\n while i < arr.length\n result << arr[idx1..i]\n i += 1\n end\n end\n\n largest_sum = result.first.inject(:+)\n result.each do |sub_arr|\n curr_sum = sub_arr.inject(:+)\n largest_sum = curr_sum if curr_sum > largest_sum\n end\n largest_sum\nend", "def largest_contiguous_subsum_1(arr)\n largest = []\n (0...arr.length).each do |i|\n (i...arr.length).each do |j|\n largest << arr[i..j]\n end\n end\n sums = largest.map do |sub_array|\n sub_array.sum\n end\n sums.max\nend", "def largest_contiguous_subsum(arr)\n max = arr.first\n arr.each_index do |idx1|\n (idx1+1..arr.length).each do |idx2|\n sub_arr = arr[idx1...idx2]\n sum = sub_arr.reduce(:+)\n max = sum if max < sum \n end\n\n end\n max\nend", "def largest_contiguous_subsum(array)\r\n max = array.first \r\n current_sum = 0\r\n array.each do |ele|\r\n current_sum += ele\r\n max = current_sum if current_sum > max\r\n current_sum = 0 if current_sum < 0\r\n end\r\n max\r\nend", "def largest_contiguous_subsum(array)\n sub_arrays = []\n (0...array.length).each do |i|\n (0...array.length).each do |x|\n sub_arrays << array[i..x] unless array[i..x].empty?\n end\n end\n p sub_arrays.length\n max_array = sub_arrays.max_by { |sub| sub.sum }\n max_array.sum\n\nend", "def largest_contiguous_subsum(array)\n previous_sum = 0\n current_sum = 0\n array.each_with_index do |el, i|\n\n current_sum = previous_sum + el\n if previous_sum < 0\n if el < previous_sum\n current_sum = previous_sum\n else\n current_sum = el\n end\n end\n\n previous_sum = current_sum\n end\n\n current_sum\nend", "def largest_contiguous_subsum(arr)\n max = 0\n\n (0...arr.count).each do |i|\n sum = arr[i]\n (i + 1...arr.count).each do |j|\n sum += arr[j]\n max = sum if max < sum \n end \n end \n\n max\nend", "def largest_contiguous_subsum_2(list)# [2, 3, -6, 7, -6, 7]\n largest_num = list[0]#2 O(1)\n running_sum = list[0]#2 - 5 after entering loop. O(1)\n\n (1...list.length).each do |i| #O(n) \n running_sum = 0 if running_sum < 0 #O(1)\n running_sum += list[i] #O(1)\n largest_num = running_sum if running_sum > largest_num #O(1)\n end\n return largest_num #O(1)\nend", "def largest_contiguous_subsum_two(list)\n largest_sum = list[0]\n current_sum = 0\n # list.inject {|acc, ele| acc + ele}\n list.each do |ele|\n current_sum = [ele, current_sum + ele].max\n largest_sum = [largest_sum, current_sum].max\n end\n largest_sum\nend", "def largest_contiguous_subsum(array)\n new_arr = []\n (0...array.length).each do |idx1|\n sum = [array[idx1]]\n new_arr << sum\n (idx1+1...array.length).each do |idx2|\n sum += [array[idx2]]\n new_arr << sum\n end\n end\n\n sums = []\n new_arr.each do |pair|\n sums << pair.sum\n end\n\n sums.max\nend", "def largest_contiguous_subsum_n(list2)\n large = 0\n \n list2.inject do |sum, n|\n if (sum + n) > sum\n sum += n \n large = sum if sum > large\n sum\n else\n sum = 0\n end\n end\n\n large\nend", "def largest_contiguous_sub_sum1(arr)\n subarrays = []\n arr.each_with_index do |num1, i|\n arr.each_with_index do |num2, j|\n subarrays << arr[i..j] if i <= j\n end\n end\n\n subarrays.map! do |subarray|\n subarray.sum\n end\n\n subarrays.sort[-1]\nend", "def largest_contiguous_subsum(arr) #BigO of O(n)\n max = 0 \n current_sum = 0\n arr.each_with_index do |el,idx|\n if current_sum + el >= el \n current_sum += el \n else \n current_sum = el \n end \n max = current_sum if current_sum > max \n end \n max\nend", "def largest_contiguous_subsum(arr)\r\n all_sub_arrays = [] # space : O(n^2)\r\n\r\n (0...arr.length).each do |i|\r\n (i...arr.length).each do |i2|\r\n all_sub_arrays << arr[i..i2] # slice makes n^3\r\n end\r\n end\r\n\r\n all_sub_arrays.map { |sub_arr| sub_arr.sum }.max # O(n^2)\r\nend", "def largest_con_subsum_2(list)\n largest = list.first\n contiguous_sum = list.first\n\n i = 1\n \n while i < list.length\n current = list[i]\n contiguous_sum += current\n if contiguous_sum > largest\n largest = contiguous_sum \n elsif current > largest\n largest = current\n \n end\n contiguous_sum = 0 if contiguous_sum < 0\n i += 1 \n \n end\n return largest\nend", "def largest_contiguous_subsum(arr)\r\n # sub_arr = []\r\n # (0...arr.length).each do |idx|\r\n # (idx...arr.length).each do |idx_2| \r\n # sub_arr << arr[idx..idx_2]\r\n # end\r\n # end\r\n # p sub_arr.length \r\n # sub_arr.map {|sub| sub.sum }.max\r\n max = arr.first #8\r\n curr = arr.first #8\r\n arr.drop(1).each do |ele| \r\n curr = 0 if curr < 0\r\n curr += ele\r\n max = curr if curr > max\r\n end\r\n max\r\nend", "def largest_contiguous_subsum_n_2(arr)\n subs = []\n arr.each_with_index do |el1, i|\n arr.each_with_index do |el2, j|\n if j > i \n subs << arr[i..j]\n end\n end\n end\n subs\n x = subs.max_by {|arr| arr.sum}\n x.sum\nend", "def largest_contiguous_subsum_2(arr)\n sum = 0\n max = 0\n arr.each do |num|\n sum += num\n if sum > 0\n max = sum if sum > max\n else\n sum = 0\n end\n end\n max\nend", "def largest_contiguous_subsum(arry)\n bigone = arry.first || 0\n actual_sum = 0\n\n arry.each do |number|\n actual_sum += number\n if actual_sum > bigone\n bigone = actual_sum \n end\n if actual_sum < 0\n actual_sum = 0 \n end\n end\n return bigone\nend", "def sub_sum(list)\n subs = []\n\n list.each_with_index do |el1, i|\n # debugger\n (0...list.length - i).each do |len|\n subs << list[i..i + len]\n end\n\n end\n\n subs.map! do |subset|\n subset.inject(:+)\n end\n\n subs.max\nend", "def largest_contiguous_subsum(arr)\n global_sum = arr.first\n # p \"global = #{global_sum}\"\n i = 0\n pot = 0\n while i < arr.length\n pot += arr[i]\n global_sum = pot if global_sum < pot\n pot = 0 if pot < 0\n i += 1\n end\n global_sum\nend", "def largest_contiguous_sub_sum(arr)\n subarrs = [] #O(1)\n\n (0...arr.length).each do |idx| #O(n)\n (idx...arr.length).each do |jdx| #O(n/2)\n subarrs << arr[idx..jdx] #O(n)\n end\n end \n\n subarrs.map! do |array| #O(n)\n array.reduce(:+) #O(n)\n end \n\n subarrs.max #O(n)\nend", "def largest_continous_subsum\n largest = 0\n subsets = []\n\n i = 0\n while i < self.length\n j = i\n while j < self.length\n subsets << self[i..j]\n j += 1\n end\n i += 1\n end\n\n subsets.each do |pair|\n if largest < pair.reduce(:+)\n largest = pair.reduce(:+)\n end\n end\n largest\n\n end", "def largest_contiguous_subsum_slow(arr)\n res = arr.first\n (0...arr.length - 1).each do |i|\n (i+1...arr.length).each do |j|\n tmp_sum = arr[i..j].reduce(:+)\n res = tmp_sum if tmp_sum > res\n end\n end\n return res\nend", "def largest_contiguous_subsum(arr)\n sum = 0\n arr_indices = []\n running_sums = []\n arr.each_with_index do |num,idx|\n sum += num \n arr_indices << idx \n running_sums << sum\n end \n running_sums.max\n\nend" ]
[ "0.90684897", "0.8606764", "0.85836786", "0.8582223", "0.8548755", "0.85204977", "0.85172164", "0.8507042", "0.84705657", "0.84668493", "0.8454807", "0.8444789", "0.84433585", "0.8441432", "0.8426824", "0.8424723", "0.8408244", "0.83804077", "0.83785963", "0.836916", "0.83612305", "0.835828", "0.8356734", "0.8345577", "0.83379954", "0.83072126", "0.8284917", "0.82766676", "0.8263975", "0.8256083", "0.8237222", "0.82125556", "0.8186857", "0.8168467", "0.8141425", "0.8139459", "0.8137933", "0.8125152", "0.8117968", "0.8117101", "0.8114479", "0.81118894", "0.8111268", "0.80827916", "0.808266", "0.8025797", "0.8011351", "0.7993381", "0.79888964", "0.79681456", "0.7938856", "0.79342526", "0.7932033", "0.78702635", "0.78517854", "0.78467464", "0.7834436", "0.78008276", "0.77795774", "0.77722335", "0.77521676", "0.77434754", "0.77348256", "0.7731312", "0.772886", "0.77205837", "0.77168053", "0.769138", "0.7678715", "0.7661879", "0.765949", "0.76582235", "0.76544744", "0.76534605", "0.76497346", "0.764682", "0.7640481", "0.7639296", "0.75772285", "0.7573126", "0.75686187", "0.75653297", "0.7565005", "0.7533931", "0.75216854", "0.7521136", "0.7509151", "0.7507404", "0.7505115", "0.7475622", "0.7473566", "0.74705625", "0.7470366", "0.74574137", "0.7453569", "0.7451207", "0.74348694", "0.74299467", "0.74251795", "0.74146664", "0.74041384" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_report @report = Report.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def report_params params.require(:report).permit(:clearance_id, :city_id, :title, :body) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
Returns the ycoordinate which is the number on the board (5 in B5)
def y(from = 0) self[1,2].to_i - 1 + from end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_y\n @piece.color == :white ? @y : 7 - @y\n end", "def bottom_cell_y_at(y); (y + HEIGHT - 1) / HEIGHT; end", "def top_cell_y_at(y); y / HEIGHT; end", "def y\n OFFSET_FROM_TOP + (coordinates.y * 700).to_i\n end", "def y_coord(num)\n (num/65536).to_i\nend", "def get_y\n grid_height = @window.current_map.height\n half_y = HEIGHT / 2 - GRID / 2\n @y = [[@player.y - half_y, 0].max, grid_height * GRID - HEIGHT].min\n end", "def pixel_y_at(y)\n\t\t(block_size * y) + @y_offset\n\tend", "def screen_tile_y\n Graphics.height / TILE_HEIGHT\n end", "def coord(x); (x*@game.height).to_i; end", "def screen_y\n if $game_temp.enemies_position[self.index] != nil\n return $game_temp.enemies_position[self.index][1]\n else\n return $data_troops[@troop_id].members[@member_index].y + Enemy_Position_AdjustY\n end\n end", "def paddle_y\n @cr[9]\n end", "def y\n @position.y\n end", "def y\n position.y if position\n end", "def y\n position.y if position\n end", "def screen_y\n return @sy - ((@index+1)*@speed_y)\n end", "def screen_y\n y = ((@real_y - $game_map.display_y + 3) / 4 )+16\n return y \n end", "def y\n rect.y\n end", "def screen_y\n return $data_troops[@troop_id].members[@member_index].y + Enemy_Position_AdjustY\n end", "def screen_y\n y = (@real_y - $game_map.display_y + 3) / 4 \n return y \n end", "def screen_y\n y = ((@real_y - $game_map.display_y + 3) / 4 ) \n return y \n end", "def screen_y\n y = ((@real_y - $game_map.display_y + 3) / 4 ) \n return y \n end", "def row_to_y( row )\n return nil if row.nil?\n y = row - @top_line\n y = nil if ( y < 0 ) or ( y > @top_line + @diakonos.main_window_height - 1 )\n y\n end", "def row_to_y( row )\n return nil if row.nil?\n y = row - @top_line\n y = nil if ( y < 0 ) or ( y > @top_line + $diakonos.main_window_height - 1 )\n y\n end", "def screen_y\n unless Layy_Meta.active\n return screen_y_mgc_lm_gtbs\n else\n y = @actor.lm_y_h0\n y -= 40\n if @actor.unit_size > 1\n y += (@actor.unit_size - 1 << 4)\n end\n return y\n end\n end", "def palm_y\n palmPosition[2] if palmPosition\n end", "def screen_y\n n_split = [($game_troop.enemies.length * 0.5).ceil, 4].min\n case n_split\n when 1\n n_index = self.index * 2\n when 2\n if self.index < ($game_troop.enemies.length - 2)\n n_index = 0.5 + (2 * self.index)\n else\n if $game_troop.enemies.length == 3 then\n n_index = (self.index * 2) + 2\n elsif $game_troop.enemies.length == 4 then\n n_index = self.index * 2\n end\n end\n when 3\n n_index = self.index + (0.25 * (self.index + 1))\n if $game_troop.enemies.length == 5\n if self.index < 2\n n_index = self.index + (0.25 * (self.index + 1))\n else\n n_index = self.index + (0.25 * (self.index + 2)) + 1\n end\n end\n when 4\n n_index = self.index\n if $game_troop.enemies.length == 7\n if self.index < 3\n n_index = self.index\n else\n n_index = self.index + 1\n end\n end\n end\n return (n_index - ((n_index / 4).floor) * 4) * ((160 / (4)) * 1.6) + 270 - ((n_index / 4).floor * (110 - (4 * 20)))\nend", "def to_integer\n case @y\n when BLACK_CAPTURE_Y\n BLACK_CAPTURE_INT\n when WHITE_CAPTURE_Y\n WHITE_CAPTURE_INT\n else\n (@y * ChessPiece::BOARD_LENGTH) + @x\n end\n end", "def original_y\n ActorPos[index][1] || 0 rescue 0\n end", "def screen_y\n return y\n end", "def coord_to_pos(row,col)\n return nil if row.even? && col.even? || row.odd? && col.odd? #these are always empty squares in checkers!\n return row*4+(col/2).floor+1\n end", "def row_of( y )\n @top_line + y\n end", "def row_of( y )\n @top_line + y\n end", "def y_position(as: :units)\n if as == :mm\n ((row.layout.height-1) - row.number) * unit_height\n else\n row.number\n end\n end", "def line_num_to_coord(n)\n\t\t(n + 1) * font_metrics.height\n\tend", "def height\n @y1 - @y0\n end", "def rel_y\n return y - Graphics.height/2\n end", "def rel_y\n return y - Graphics.height/2\n end", "def rel_y\n return y - Graphics.height/2\n end", "def screen_y(y)\n $window.height - ((y.to_f / @scene_height) * $window.height).to_i\n end", "def xy(offset_x, offset_y)\n @board[3 * offset_y + offset_x - 4]\n end", "def get_co_x_y(x,y)\n co_y = x*BLOCK_DIMENTION + BLOCK_DIMENTION/2 + BOARD_SQUARE_POS[:board_start]\n co_x = y*BLOCK_DIMENTION + BLOCK_DIMENTION/2 + BOARD_SQUARE_POS[:board_start]\n return co_x,co_y\nend", "def defY\n y = @defY\n y -= 50*((2-@battler.index)/2) - 64 + (48*(@battle.pbMaxSize(0) - 1)) + (@expandDouble && @battler.index == 0 ? 20 : 0) if @playerpoke && @battle.pbMaxSize(0) > 1\n y += 50*(@battler.index/2) - 16 if !@playerpoke && @battle.pbMaxSize(1) > 1\n return y\n end", "def screen_y\n return 464\n end", "def next_y\n state.y + state.dy\n end", "def y\n @point[1]\n end", "def row_to_px row_number\n\n # Row 0 starts 5 units below the top of the grid.\n # Each row afterward is 20 units lower.\n grid.top.shift_down(5).shift_down(20 * row_number)\n end", "def screen_origin_y\n @cr[1]\n end", "def y_offset; end", "def y\n @location.y\n end", "def mapy\n return $game_map.events[@id].real_y * 32\n end", "def coord_to_line_num(y)\n\t\ty / font_metrics.height - 1\n\tend", "def getY() @y end", "def conveyor_belt_y\n center_y + center_y / 2 + 20\n end", "def b_offset\n @last_4[1].to_i\n end", "def screen_y\n n_split = [($game_party.actors.length * 0.5).ceil, 4].min\n case n_split\n when 1\n n_index = self.index * 2\n when 2\n if self.index < ($game_party.actors.length - 2)\n n_index = 0.5 + (2 * self.index)\n else\n if $game_party.actors.length == 3 then\n n_index = (self.index * 2) + 2\n elsif $game_party.actors.length == 4 then\n n_index = self.index * 2\n end\n end\n when 3\n n_index = self.index + (0.25 * (self.index + 1))\n if $game_party.actors.length == 5\n if self.index < 2\n n_index = self.index + (0.25 * (self.index + 1))\n else\n n_index = self.index + (0.25 * (self.index + 2)) + 1\n end\n end\n when 4\n n_index = self.index\n if $game_party.actors.length == 7\n if self.index < 3\n n_index = self.index\n else\n n_index = self.index + 1\n end\n end\n end\n return (n_index - ((n_index / 4).floor) * 4) * ((160 / (4)) * 1.6) + 270 - ((n_index / 4).floor * (110 - (4 * 20)))\nend", "def get_map_number_index(y_value)\n\tif y_value >= 0 && y_value <= 50\n\t\treturn '1'\n\telsif y_value >= 50 && y_value <= 100\n\t\treturn '2'\n\telsif y_value >= 100 && y_value <= 150\n\t\treturn '3'\n\telsif y_value >= 150 && y_value <= 200\n\t\treturn '4'\n\telsif y_value >= 200 && y_value <= 250\n\t\treturn '5'\n\telsif y_value >= 250 && y_value <= 300\n\t\treturn '6'\t\t\n\telse\n\t\treturn '?'\n\tend\nend", "def y\n return @background.y\n end", "def height\n dimensions()[:y]\n end", "def y\n @hex.y\n end", "def sgf_board_position tree\n x = ('a'.ord + tree['x']).chr\n y = ('a'.ord + tree['y']).chr\n \"#{x}#{y}\"\n end", "def up\n @y.positive? ? $theGrid[@y-1][@x] : nil\n end", "def light_pen_y\n @cr[7]\n end", "def screen_y\n @page ? super + @page.adjusted_xy[1] : super\n end", "def bottom_cell(cell)\n get_next_cell(cell) { | cell | Coordinates.new(cell.col, cell.row+1)}\n end", "def height\n @dimensions.y\n end", "def bottom()\n return @top + @height\n end", "def getBotPosition(n, grid)\n return calculate_position_coordinates(n, grid, 'm')\nend", "def line_number\n number[6..-1]\n end", "def ui_max_y\n\t\t\t\tCurses.rows\n\t\t\tend", "def bound_y (y)\n if y == @world.height\n return 0\n elsif y == -1\n return (@world.height - 1)\n else\n return y\n end\n end", "def get_y coords\n coords.last\n end", "def get_column_from_board_with_col_number(board, col_number)\n board.transpose[column_number-1]\n # column = []\n board.map { |row| row[col_number - 1] }\n # column\nend", "def position\n [ChessBoard.col_index(pos[0]), pos[1].to_i]\n end", "def convert_y_to_row(y)\n\t\treturn (((@width-1)/2) - y).round\n\tend", "def get_y(coordinates)\n y = coordinates.downcase[/[1-3]/]\n translate_coordinate(y)\n end", "def y2\n y + height\n end", "def top\n position.y\n end", "def image_position\n (@row * 6) + @column\n end", "def offsetY\n\t\t@db.hget('sgt-sector:' + @id, 'offsety').to_i\n\tend", "def distance_y_from(y)\n result = @y - y\n if $game_map.loop_vertical? && result.abs > $game_map.height / 2\n if result < 0\n result += $game_map.height\n else\n result -= $game_map.height\n end\n end\n result\n end", "def board_at_last_move\n game.board_at_move(game.move - 1)\n end", "def scene_y(y)\n $window.height - ((y.to_f / $window.height) * @scene_height)\n end", "def get_y_by_line(num_lines)\n if page_count == 1\n return (num_lines*0.16)+0.4\n else\n return ((num_lines - (((page_count-2)*66)+59))*0.16)+0.4\n end\n end", "def at(x, y)\n @codeGrid[y][x]\n end", "def tbu_id_xy(x,y)\n if list = @exy_cache[[x,y]]\n list.each do |id| \n e = @events[id]\n return id if e && e.tb_unit.battler \n end\n end\n 0\n end", "def event_original_y(id)\n $game_map.rpg_event(id).y\n end", "def height(y = @y)\n height = [y]\n return height unless @page\n @page.size[2].times { |i| height << y - (i + 1) }\n @page.size[3].times { |i| height << y + (i + 1) }\n return height\n end", "def row=(value)\n @coordinate.y = value\n end", "def offy(y)\n -(y - self.centery) + (self.height/2)\n end", "def max_y\n vertical_code_list&.codes&.count.to_i + roster_rows.to_i\n end", "def round_y(y)\n if loop_vertical?\n return (y + height) % height\n else\n return y\n end\n end", "def y\n @components[:y]\n end", "def gety\n (@lines[0...@str_idx].map(&:ymax).reduce(:+) || 0) + @str_y_idx - @start_y\n end", "def gety\n (@lines[0...@str_idx].map(&:ymax).reduce(:+) || 0) + @str_y_idx - @start_y\n end", "def cell(col, row)\n return nil if out_of_bound?(row, 0, Grid::MaxRow - 1)\n return nil if out_of_bound?(col, 0, Grid::MaxCol - 1)\n return (Grid::MaxCol * row) + col\n end", "def spritestack_coordinates\n return 25, 125\n end", "def get_y; \t\t@y \t\t\tend", "def view_y\n return 0 if @viewport.nil? || @view_y.nil?\n return @view_y\n end", "def visible_height\n @win.maxy - 2\n end", "def center_y\n (Graphics.height / TILE_HEIGHT - 1) / 2\n end" ]
[ "0.7482858", "0.7441533", "0.7369521", "0.72053385", "0.69391304", "0.67671734", "0.6676353", "0.6605911", "0.6598376", "0.6580589", "0.6579641", "0.65274876", "0.65223825", "0.65223825", "0.6426332", "0.63919497", "0.6389246", "0.6346728", "0.6339443", "0.6324527", "0.6324527", "0.6311207", "0.62969494", "0.6292704", "0.62534434", "0.6246927", "0.62183815", "0.61924404", "0.61900747", "0.6189829", "0.6088042", "0.6088042", "0.60709345", "0.6060905", "0.60546625", "0.6022512", "0.6022512", "0.6022512", "0.6010766", "0.59866387", "0.5972474", "0.59684795", "0.59670186", "0.5960577", "0.5959432", "0.5959153", "0.59555393", "0.5954291", "0.5954027", "0.59538174", "0.5953581", "0.59280646", "0.5890754", "0.5851593", "0.5834974", "0.5832243", "0.58265483", "0.58057296", "0.58050644", "0.5803623", "0.58036053", "0.5780413", "0.57762665", "0.5771507", "0.57713133", "0.5757145", "0.5753734", "0.57526726", "0.57506627", "0.5748876", "0.57344997", "0.5695419", "0.5694032", "0.5692729", "0.56873477", "0.56864345", "0.56849796", "0.56694454", "0.5638885", "0.56374043", "0.563605", "0.5633861", "0.56307733", "0.56298155", "0.5626932", "0.5625158", "0.5613629", "0.5611742", "0.56054014", "0.5604478", "0.560223", "0.5602188", "0.5600997", "0.5600997", "0.5600602", "0.5600562", "0.5594402", "0.5593291", "0.5579856", "0.55784273" ]
0.5884917
53
Returns the player name as used on the server
def name File.basename(__FILE__, '.rb') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_player\n\t @name\n\tend", "def player_name\n player.name\n end", "def player_name(id)\n name = Player.find(id)\n end", "def name\n \"Player#{@ix}\"\n end", "def get_player_name(name)\n return prompt(\"Player Name? [Player #{name}]\",\"Player #{name}\")\n end", "def get_player_name\n get_console_input.capitalize\n end", "def current_player_name\n Player.find(player_turn).name unless player_turn.nil?\n end", "def name\n @game_info['name']\n end", "def get_player_reference\n if @player.nil?\n \"Anonymous\"\n else\n @player\n end\n end", "def std_player_names\n\t\tnames = []\n\t\tfor i in 1..Constants::MAX_PLAYERS\n\t\t\tnames << \"Player\" + i.to_s\n\t\tend\n\t\tnames\n\tend", "def get_player_name\n puts \"Who is playing WITCH WARRIOR today?\"\n @validate_input.get_input\n end", "def get_player_name\n\tputs \"\\n-------------------------------------------------------\"\n\treturn gets.chomp.capitalize\nend", "def get_player_name\n if players[1].name == \"You\"\n puts \"What's your name?\"\n players[1].name = gets.chomp\n puts \"Hey, #{players[1].name}. Let's play some blackjack.\\n\\n\"\n end\n end", "def game_name\n fetch('sword_art_online.game_name')\n end", "def get_player_name\n name = STDIN.gets.chomp\n name\n end", "def name\n [\n model.discord_guild.name,\n model.discord_user.username\n ].join(' - ')\n end", "def nickname\n data = get 'name', resource: 'leaderboard'\n data.name\n end", "def displayPlayer()\n puts \"*** Player Info ***\"\n puts \"Name: #{@name}\"\n puts\n end", "def return_official_player_name(entry)\n\t\tcase entry\n\t\t\twhen /benz/\n\t\t\t\t\"benzema\"\n\t\t\twhen /brui|bruy/\n\t\t\t\t\"bruyne\"\n\t\t\twhen /cour/\n\t\t\t\t\"courtois\"\n\t\t\twhen /jong/\n\t\t\t\t\"de jong\"\n\t\t\twhen /ligt/\n\t\t\t\t\"de ligt\"\n\t\t\twhen /depa/\n\t\t\t\t\"depay\"\n\t\t\twhen /gnab/\n\t\t\t\t\"gnabri\"\n\t\t\twhen /grav/\n\t\t\t\t\"gravenberg\"\n\t\t\twhen /hav/\n\t\t\t\t\"havertz\"\n\t\t\twhen /immo/\n\t\t\t\t\"immobile\"\n\t\t\twhen /ins/\n\t\t\t\t\"insigne\"\n\t\t\twhen /kane/\n\t\t\t\t\"kane\"\n\t\t\twhen /kant/\n\t\t\t\t\"kante\"\n\t\t\twhen /lewa/\n\t\t\t\t\"lewandowski\"\n\t\t\twhen /luk/\n\t\t\t\t\"lukaku\"\n\t\t\twhen /mba|mapp|mpab/\n\t\t\t\t\"mbappe\"\n\t\t\twhen /mor/\n\t\t\t\t\"morata\"\n\t\t\twhen /moun/\n\t\t\t\t\"mount\"\n\t\t\twhen /rash/\n\t\t\t\t\"rashford\"\n\t\t\twhen /rona/\n\t\t\t\t\"ronaldo\"\n\t\t\twhen /san/\n\t\t\t\t\"sane\"\n\n\t\tend\n\tend", "def player_names\n self.players.pluck(:username).join(\", \")\n end", "def player_name(hash)\n return hash[:name]\nend", "def title\n \"Game #{self.id}: \" + players.map { |p| p.username }.join(\" vs \")\n end", "def get_player_name(n)\n puts \"Player #{n}, what's your name?\"\n name = gets.chomp\n Player.new(name)\n end", "def set_name(player_name)\n @player_name = player_name\n end", "def current_player\n @players.each do |name, letter|\n if letter == whose_turn\n return name\n end\n end\n end", "def get_name\n\t\t# Ask the player for their name\n\t\tputs \"\\nWhat is your name?\"\n\n\t\t# Utilize the player class to store the input name\n\t\tself.player_name = Person.new(gets.strip)\n\tend", "def player_label(player_hash)\r\n return \"N/A\" unless player_hash.has_key?(:player_id)\r\n\r\n \"#{player_hash[:first_name]} #{player_hash[:last_name]} (#{player_hash[:player_id]})\"\r\n end", "def get_player_name(count)\n begin\n puts \"\"\n puts \"Enter Player #{count}'s name:\"\n\n temp = gets.chomp\n\n raise InvalidName if temp == \"\"\n\n self.name = temp\n\n rescue InvalidName\n puts \"You need to enter a player name.\"\n get_player_name(count)\n\n end\n end", "def player \n \"player\" \n end", "def player_names(n)\n puts \"Player \" + n.to_s + \"! What is your name?\"\n return gets.chomp\n end", "def player_name\n\tgame_sounds\n\t\tputs \"Hey man whats your name?\"\n\t\t@your_name = $stdin.gets.chomp.upcase\n\t\tplay_game\n\tend", "def name_all_players\n (0..num_players - 1).each { |i| @players[i].name_player('Player' + i.to_s)}\n end", "def winner_name\n comp = Competitor.find_by_id(self.winner)\n name = comp.name\n return name\n end", "def player(player_name)\n players.find{|player| player.name == player_name}\n end", "def possessive(player_name)\n if player_name.downcase.ends_with?('s')\n player_name + \"'\"\n else\n player_name + \"'s\"\n end\n end", "def player\n fetch('football.players')\n end", "def proper_name\n \"#{@name} (Session: #{video_session}).#{file_extension}\"\n end", "def get_namecoin_name\n return @chunks[-10] if is_name_firstupdate?\n return @chunks[-9] if is_name_update?\n end", "def normalized_name\n @normalized_name ||= if self.name.start_with?(ClientConstants::GLOBAL_PLAYLIST_PREFIX)\n self.name[2..-1]\n else\n self.name\n end\n end", "def get_name(page)\n # Get the line that has the player's name\n name = page.grep(/og:title/)\n # Make the name the beginning of the line\n name1 = name[0][35..-1]\n # Get just the name (the first two words)\n name2 = name1.split[0..1].join(' ')\n # Replace the HTML escape for ' with '\n name2.gsub('&#39;',\"'\")\n end", "def get_name(page)\n # Get the line that has the player's name\n name = page.grep(/og:title/)\n # Make the name the beginning of the line\n name1 = name[0][35..-1]\n # Get just the name (the first two words)\n name2 = name1.split[0..1].join(' ')\n # Replace the HTML escape for ' with '\n name2.gsub('&#39;',\"'\")\n end", "def nickname\n return @nickname\n end", "def nick\n @name\n end", "def player\n\t\t@current_player\n\tend", "def show_player(name)\n if player = Player.find_by_name(name)\n puts \"____________________________________________________________________\"\n puts \"#{player.player} Age:#{player.age} Position:#{player.position}\"\n puts \"Team:#{player.team}\"\n puts \"Games Played: #{player.games_played}\"\n puts \"Goals: #{player.goals}\"\n puts \"Assists: #{player.assists}\"\n puts \"Points: #{player.points}\"\n puts \"Shooting Percentage: #{player.shooting_percentage}\"\n puts \"Plus Minus: #{player.plus_minus}\"\n puts \"Penalty Minutes: #{player.penalty_minutes}\"\n puts \"Average TOI: #{player.toi_avg}\"\n puts \"Blocks: #{player.blocks}\"\n puts \"Hits: #{player.hits}\"\n puts \"Faceoff Percentage: #{player.faceoff_percentage}\"\n puts \"____________________________________________________________________\"\n else\n raise_player_error\n end\n end", "def name\n ssh.exec!(\"hostname\").chomp\n end", "def name\n return UNNAMED if @tracks.empty?\n return @tracks.first.name()\n end", "def enter_name(name)\n return @player_name = 'Anonymus' if name.empty?\n\n @player_name = name[0...18]\n end", "def winner\n @players.each do |current_player|\n if current_player.position >= length\n #puts \"#{current_player.name} JUST WON!!!\"\n return \"#{current_player.name}\"\n end\n end\n end", "def current_player\n { name: @game.cur_player.name, home_base: @game.cur_player.home_base }\n end", "def player_string(player_num)\n player = @players[player_num]\n '-' * (FingersPerHand-player[Left]) +\n '|' * player[Left] +\n ' ' +\n '|' * player[Right] +\n '-' * (FingersPerHand-player[Right])\n end", "def welcome_player\n\t\tif rand < 0.5 then\n\t\t\tself.current_player = \"Computer\"\n\t\t\tself.computer_symbol, self.player_symbol = SYMBOLS\n\t\telse\n\t\t\tself.current_player = player\n\t\t\tself.player_symbol, self.computer_symbol = SYMBOLS\n\t\tend\n \t\"Welcome #{player}\"\n\tend", "def player_name(player)\n player == 1 ? @player_1_name : @player_2_name\nend", "def cpanel_username\n @username = `/scripts/whoowns #{domain}`.chomp\n username\n end", "def server_name\n return @server_name\n end", "def naming\n puts (\"Hello player #{@@player_count}. Please choose a name.\").blue\n name = gets.chomp\n @@player_count += 1\n return name\n end", "def nickname\n @nick\n end", "def get_name\n return \"Name: \" + @name\n end", "def name\n return @playing_girl ? @name_girl : @name_boy\n end", "def player(name)\n players.detect { |p| p.name == name }\n end", "def set_player_name(msg, name=nil)\n player = get_player msg\n unless name\n msg.reply player.name\n return\n end\n if player.name\n msg.reply \"The majestic #{player.name} refuses to change his name!\"\n return\n end\n player.name = name\n player.save\n msg.reply \"Welcome, #{player.name}!\"\n end", "def window_name\n 'HSTrackerPlayer'\n end", "def name_checker(player_name)\n\tputs \"hi #{player_name}\"\nend", "def nickname\n user_info['nickname']\n end", "def username\n \"rocky\"\n end", "def game_name()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.Run_game_name(@handle.ptr)\n result\n end", "def get_player_id\n\t\t@player_id\n\tend", "def name\n @grpc.name.split(\"/\")[5]\n end", "def name\n return @peer.name\n end", "def nickname\n @nickname\n end", "def get_name\n return @m_name\n end", "def get_name\n return @m_name\n end", "def get_name\n return @m_name\n end", "def get_name\n return @m_name\n end", "def getPlayerUID _args\n \"getPlayerUID _args;\" \n end", "def current_player\n players.first\n end", "def guild_name\n\t\t@guild_name\n\tend", "def retrieve_current_player\n session[:current_player]\n end", "def getCurrentPlayer\n @currentPlayer\n end", "def player\n return $BlizzABS.actors[0]\n end", "def player_names\n puts \"What name do you want to use, Player 1?\"\n @player_1_name = gets.chomp\n puts \"What name do you want to use, Player 2?\"\n @player_2_name = gets.chomp\n end", "def name\n puts 'Ingresa el nombre del jugador: '\n name_player = gets.chomp\n name_player\n end", "def current_player\n @players.first\n end", "def name\n\t\tn = names\n\t\treturn n[:fullname] if n[:fullname]\n\t\treturn n[:username] if n[:username]\n\t\treturn I18n.translate(\"user.name.unknown\")\n\tend", "def name\n response[\"name\"]\n end", "def get_player_by_name n\n @players.each{|p| return p if p.try(:name).try(:downcase) == n.try(:downcase) }\n end", "def tube_name\n @tube_name\n end", "def name\n\t\tsuper || game.name\n\tend", "def get_player(nickname)\n response = get(RESOURCE_PATH, nickname, headers: { 'API-VERSION': 'v2' })\n response_body = JSON.parse(response.body, symbolize_names: true)\n\n Rails.logger.info(\"GS Get Player Response: #{response_body}\")\n\n if response.success?\n #TODO: deserialize response json into Player object automatically\n nickname = response_body[:nickname]\n ext_id = response_body[:ext_id]\n avatar = response_body[:avatar]\n theme = response_body[:theme]\n player_point_types = []\n point_types_response = response_body[:point_types]\n (point_types_response || []).each do |point_type_response|\n player_point_types << GameServer::Model::PlayerPointType.new(point_name: point_type_response[:name], count: point_type_response[:amount])\n end\n\n player = GameServer::Model::Player.new(nickname, ext_id, avatar, theme)\n player.player_point_types = player_point_types\n\n get_player_response = GameServer::Client::Response::GetPlayerResponse.new(true, nil, player)\n else\n error_message = response_body[:error_message]\n\n get_player_response = GameServer::Client::Response::GetPlayerResponse.new(false, error_message, nil)\n end\n\n return get_player_response\n end", "def player_position(name)\n @players_info[name][0]\n end", "def name(type=:short)\n if type == :short && !nickname.blank?\n nickname\n elsif type == :short && displayName\n first, last = displayName.split\n \"#{first} #{last[0]}\"\n elsif type == :full && displayName\n displayName\n else\n umbcusername\n end\n end", "def label\n \tif !player.nil? && !opponent.nil?\n \t\t\"#{player_name}\\n#{opponent_name}\"\n \telsif !player.nil? && opponent.nil?\n \t\t\"#{player_name}\\n-----\"\n \telse\n \t\t\"----\\n----\"\n \tend\n end", "def getCurrentPlayer() # : Player\n @currentPlayer\n end", "def player_stats(playerName)\n players[playerName]\nend", "def server_name(s)\n (s.respond_to?('name') && s.name) ? s.name : s.identity\n end", "def name\n\t\tif name_source.present?\n\t\t\tproviders = [\"twitter\",\"facebook\",\"google_oauth2\",\"lastfm\",\"vimeo\"]\n\t\t\tp,v = name_source.split(\"::\",2)\n\t\t\treturn name_source unless p.in? providers\n\t\t\tl = self.links.find_by(provider: p)\n\t\t\tif l\n\t\t\t\tnames = l.names\n\t\t\t\treturn names[v.to_sym] if names.is_a? Hash and v and names[v.to_sym]\n\t\t\tend\n\t\tend\n\t\t\n\t\treturn custom_name if custom_name.present?\n\t\treturn email.split('@')[0].titleize if email.present?\n\t\tUser.default_name\n\tend", "def name\n app.speakers.ID(@id).name.get\n end", "def select_player_name\n puts \"\\nWho's playing today? (please enter your name)\"\n player_name = gets.chomp.strip\n puts \"\\nNice to meet you, #{player_name}.\\n \"\n return player_name\n end", "def name_all_players()\n set_name()\n set_other_name()\n end", "def name\n unless @name\n begin\n @name = get_login\n rescue TiscapError => toki_doki\n @name = ''\n raise toki_doki\n ensure\n @accepting = true\n end\n end\n \n @name\n \n # We can fairly assume that no one will concurrently ask for our name\n # until this method returns for the first time.\n end", "def get_name()\n return @me.uname if @me.brother.nil?\n return @me.brother.full_name\n end" ]
[ "0.80743104", "0.80316687", "0.79166704", "0.78131676", "0.7783446", "0.76845396", "0.7624314", "0.71422195", "0.7086779", "0.70686686", "0.7015892", "0.6980001", "0.6938531", "0.69126695", "0.6884424", "0.6844345", "0.6809426", "0.67929554", "0.6778035", "0.6736138", "0.67281747", "0.67134094", "0.6647925", "0.66476095", "0.6604932", "0.6595007", "0.6587461", "0.65789914", "0.6570751", "0.6563802", "0.65402246", "0.65173227", "0.6513648", "0.65111315", "0.65046006", "0.64945173", "0.64891344", "0.64805084", "0.6468326", "0.6440363", "0.6440363", "0.64252144", "0.64023477", "0.6402185", "0.63806987", "0.6364525", "0.6327687", "0.63249075", "0.63029385", "0.62943566", "0.6281455", "0.6263982", "0.62395275", "0.6226263", "0.6213847", "0.62122834", "0.6205771", "0.62040645", "0.619799", "0.61978877", "0.61976784", "0.61897975", "0.61894923", "0.6184602", "0.6181894", "0.61800015", "0.617404", "0.61666644", "0.6161966", "0.61571634", "0.615703", "0.615703", "0.615703", "0.615703", "0.6148141", "0.6146224", "0.6142542", "0.6140121", "0.6131687", "0.61293197", "0.61285937", "0.6122465", "0.61183923", "0.61177313", "0.6114597", "0.6113736", "0.61136246", "0.61123455", "0.61105025", "0.61063963", "0.61058706", "0.61056125", "0.6096459", "0.6092626", "0.6085297", "0.60817695", "0.6081304", "0.60746086", "0.6073662", "0.6072623", "0.6072286" ]
0.0
-1
Returns next position from the sequence to shot at. Examples: A1, B10, J9
def next_target # First shot at the priority positions begin here = @shot_queue.shift end while !shootable?(here) && !@shot_queue.empty? # Then shot according to ship discovery while !shootable?(here) do here = @discovery.next break if here.nil? end field[here] = :shot if here here end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_starting_position\n\t\tpos = @starting_positions[@pos_idx]\n\t\t@pos_idx = (@pos_idx + 1) % @starting_positions.length\n\t\tpos\n\tend", "def next\n last? ? nil : locate + 1\n end", "def to(position)\n first position + 1\n end", "def to(position)\n first position + 1\n end", "def input_to_index(nextmove)\n nextmovei = nextmove.to_i - 1\nend", "def next_number\n Sequence.next_val\n end", "def read_sequence(arr, curr_pos)\n n = arr.length\n idx = curr_pos + 1\n (n - curr_pos - 1).times do \n if arr[idx] < arr[idx - 1]\n return idx\n end\n idx += 1\n end\n \n n\nend", "def seq_index(seq)\n self.sliding_groups_of(seq.size).index(seq)\n end", "def next\n at(position + 1)\n end", "def next_sequence_number\n last_sequence_number ? last_sequence_number.next : 0\n end", "def start; @sequence[0]; end", "def input_to_index(position)\n index = position.to_i - 1\nend", "def next\n peek.tap { @position += 1 }\n end", "def input_to_index(position)\n index = position.to_i - 1\n end", "def input_to_index(position)\n position = position.to_i - 1\n return position\nend", "def input_to_index(position)\n position.to_i - 1\nend", "def input_to_index( position )\n position = position.to_i\n position = position - 1\nend", "def starting_position; end", "def input_to_index(position)\n position = position .to_i\n index = position-1\nend", "def next_match_number\n # This returns a PGresult object\n # [http://rubydoc.info/github/ged/ruby-pg/master/PGresult]\n result = Match.connection.execute(\"SELECT nextval('match_number_seq')\")\n result[0]['nextval']\n end", "def input_to_index(move)\r\n index = move.to_i - 1\r\nend", "def input_to_index(input)\n return placement = input.to_i - 1\nend", "def find_starting_idx(destination_idx, jump_idx)\n jump_idx.length > 1 ? jump_idx[destination_idx - 1] : 0\nend", "def test_get_number_by_idx\n assert_equal(@sequence[0], 5)\n \tassert_equal(@sequence[2], 13)\n assert_equal(@sequence[4], 34)\n assert_equal(@sequence[-33], nil)\n end", "def moveto_next\n return if @range.empty?\n if index = @range.index(self.pos)\n @index = index\n end\n @index += 1\n @index %= @range.size\n moveto @range[@index]\n end", "def input_to_index(move)\n move.to_i - 1\n end", "def next_seq\n @seq = (@seq + 1) & 0xffffffff\n end", "def next\n\t\tTask.order(:position).where(\"position > ?\", position).first\n\tend", "def next_position(position, command)\n action.public_send ACTIONS.detect { |e| e == command }.downcase, position\n end", "def pos() @current end", "def position_to_index(position)\n position - 1\n end", "def next_serial_number\n serial = permute(permute(@offset % BOUNDARY))\n @offset += STEP\n serial\n end", "def next\n next? ? @current + 1 : nil\n end", "def input_to_index(move)\n move = move.to_i - 1\nend", "def next_sequence_number!\n sequence_number && @sequence_number += 1\n end", "def base_sequence\n self.mutex.synchronize do\n return 0 if not self.queue[self.beg]\n return self.queue[self.beg][0]\n end\n end", "def next_move\n\t\tif @next_move.nil?\n\t\t\t@next_move = determine_next_move\n\t\tend\n\n\t\t@next_move\n\tend", "def test_current_idx\n \t@sequence.next\n \tassert_equal(@sequence.current_idx, 0)\n @sequence.next\n assert_equal(@sequence.current_idx, 1)\n end", "def nextloc(current, n)\n case current\n when 'A' then\n return (n%2==0) ? 'C' : 'B'\n when 'B' then\n return (n%2==0) ? 'A' : 'C'\n when 'C' then\n return (n%2==0) ? 'B' : 'A'\n else\n return 0\n end\nend", "def next_row\n observation_matrix.observation_matrix_rows.where('position > ?', position).order(:position).first\n end", "def move_to_next_location(current)\n return nil if current < 0 || current > 7\n\n current = current.to_i\n range = @map[current].length - 1 unless @map[current].length <= 1\n # Randomly go to a neighboring location\n next_location = generator_rand(range.to_i)\n\n next_location += 1 if next_location.zero?\n\n puts \"Heading from #{@map[current][0]} to #{@map[current][next_location]}.\"\n\n result = @iterator.get_next_location(@map[current][next_location])\n result\n end", "def see_next\n if @index >= @normalized_numbers.length\n return -1\n else\n return @normalized_numbers[@index]\n end\n end", "def advance\n @current += 1 unless at_end?\n return previous\n end", "def next_open_index(index)\n (index...(index + @size)).each do |i|\n if i >= @size\n i = i % @size\n end\n\n if @nodes[i] == nil\n return i\n end\n end\n\n return -1\n end", "def pos_to_index(position)\n position[1] * 8 + position[0]\n end", "def procession_position\n procession.index(self).to_i + 1\n end", "def procession_position\n procession.index(self).to_i + 1\n end", "def next_match char\n data = get_content\n row = focussed_index\n currval = data[row].chomp\n row.upto(data.length-1) do |ix|\n val = data[ix].chomp\n if val[0,1] == char and val != currval\n return ix\n end\n end\n 0.upto(row) do |ix|\n val = data[ix].chomp\n if val[0,1] == char and val != currval\n return ix\n end\n end\n return -1\n end", "def input_to_index(player_move)\n input = player_move.to_i\n final_move = input - 1\nend", "def nextSeqNum()\n $sequence_num = ($sequence_num + 1) % 256\n return $sequence_num\nend", "def at(index)\n\t\tx = @head\n\t\ty = 0\n\t\tuntil x == nil\n\t\t\tif y == index\n\t\t\t\treturn x\n\t\t\tend\n\t\t\ty += 1\n\t\t\tx = x.next\n\t\tend\n\tend", "def nextval current\n if ::Integer === current\n current + 1\n else\n intval = current.to_i\n if intval.to_s != current.to_s\n (current[0].ord + 1).chr\n else\n intval + 1\n end\n end\n end", "def next_spot\n\t\tif @location.nil?\n\t\t\tfirst()\t\t\n\t\telse\n\t\t\tmoving()\n\t\tend\n\tend", "def go_to_next(base_ary, position)\n ary = (base_ary + [position]).sort.reverse\n idx = ary.index(position)\n base_ary.reverse[idx]\n end", "def next_position\n (@position + face_vector).column(0).to_a\n end", "def next_value_for_sequence(sequence_name)\n %{#{sequence_name}.nextval}\n end", "def input_to_index(board_position)\n if board_position.to_i >= 1 && board_position.to_i <= 9\n index = board_position.to_i - 1\n else\n index = -1\n end\nend", "def hit_from; @seq2.from; end", "def get_position(full_move)\n full_move[0..1].map { | num | num.to_i - 1 }\n end", "def next_sequence_value(sequence_name)\n @connection.query(\"SELECT NEXT VALUE FOR #{sequence_name} FROM RDB$DATABASE\")[0][0]\n end", "def index_from_start(index); end", "def position_for_index(index)\n to_move = self.triplocations[index]\n return to_move.position if to_move\n return 1 if self.triplocations.empty?\n self.triplocations.last.position + 1\n end", "def input_to_index (pos)\n pos = ((pos.to_i) - 1)\nend", "def [](i)\n seq[i]\n end", "def [](index)\n\t\t@sequence[index]\n\tend", "def next\n self.offset(1)\n end", "def next\n\t\tself + 1\n\tend", "def next(current)\n if (@position < @history.length - 1)\n @position = @position + 1\n return @history[@position]\n end\n return current\n end", "def next_player_no\n\t\twhile @player_order.first && @skip_next_move[@player_order.first - 1] do\n\t\t\t@skip_next_move[@player_order.first - 1] = false\n\t\t\t@player_order.push(@player_order.first)\n\t\t\t@player_order.shift\n\t\tend\n\t\t@player_order.first\n\tend", "def get_sequence_start_point(params)\n param_page = params[:page] || 1\n param_per_page = params[:per_page] || 10\n\n current_page = param_page.to_i\n current_per_page = param_per_page.to_i\n\n offset = (current_page - 1) * current_per_page\n\n start_point = offset + 1\n return start_point\n end", "def next_match char\n data = get_content\n row = focussed_index + 1\n row.upto(data.length-1) do |ix|\n val = data[ix].chomp rescue return # 2010-01-05 15:28 crashed on trueclass\n #if val[0,1] == char #and val != currval\n if val[0,1].casecmp(char) == 0 #AND VAL != CURRval\n return ix\n end\n end\n row = focussed_index - 1\n 0.upto(row) do |ix|\n val = data[ix].chomp\n #if val[0,1] == char #and val != currval\n if val[0,1].casecmp(char) == 0 #and val != currval\n return ix\n end\n end\n return -1\n end", "def find_index(starting_from = 0)\n index = starting_from\n element = self[index]\n\n until element.nil?\n return index if yield(element)\n index += 1\n element = self[index]\n end\n\n nil\n end", "def current_position\n return 1 if Task.all.empty?\n Task.maximum('position') + 1\n end", "def [](loc)\n sequence[loc]\n end", "def next_sequence_id\n last_sequence_id + 1\n end", "def do_turn(robot_sequence, total_sequence, robot_position, pushed) \n return pushed, robot_position if robot_sequence.empty?\n\n desired_position = robot_sequence.first.split.last.to_i\n if robot_position != desired_position\n if desired_position > robot_position\n robot_position += 1\n else\n robot_position -= 1\n end\n #puts \"Moved to: #{robot_position}. Want to be at #{desired_position}\"\n # Only make the move if it is in sequence\n elsif robot_sequence.first == total_sequence.first && (!pushed)\n #puts \"Pushing button at #{robot_position}!\"\n robot_sequence.shift\n pushed = true\n end\n return pushed, robot_position\nend", "def starting_position=(_arg0); end", "def [](loc, idx)\n return loc if immediate?(idx)\n\n sequence[loc]\n end", "def current_idx\n return @idx >= 0 ? @idx : nil\n end", "def next\r\n next_values[0]\r\n end", "def return_next_match binding, *args\n first = nil\n ix = 0\n $view.each_with_index do |elem,ii|\n if binding.call(elem, *args)\n first ||= ii\n if ii > $cursor \n ix = ii\n break\n end\n end\n end\n return first if ix == 0\n return ix\nend", "def return_next_match binding, *args\n first = nil\n ix = 0\n $view.each_with_index do |elem,ii|\n if binding.call(elem, *args)\n first ||= ii\n if ii > $cursor \n ix = ii\n break\n end\n end\n end\n return first if ix == 0\n return ix\nend", "def find_at(index)\n return if (index + 1) > count || index < 0\n\n item = @head\n index.times { item = item.next }\n item.value\n end", "def getIndexSequence(laneBarcode)\n if !laneIndexed?(laneBarcode)\n return \"\"\n else\n tag = laneBarcode.gsub(/^[1-8]-ID/, \"\")\n return @pipelineHelper.findBarcodeSequence(\"ID\" + tag.to_s) \n end\n end", "def get_next_player(start)\n for i in 1..10\n to_check = (start + i)%10 + 10\n if self.players.where(:location => to_check).length == 1\n player = self.players.where(:location => to_check)[0]\n if player.in_hand\n return player.location\n end\n end\n end\n return -10\n end", "def from_line_index\n from_line - 1\n end", "def [](key)\n\t\tif key.kind_of?(Integer)\n if (key < @seq.length)\n \t\t\treturn @seq[key]\n end\n\t\tend\n\tend", "def position(input)\n cell_index_taken = input.to_i-1\n cells[cell_index_taken]\n end", "def pos\n @position[:current]\n end", "def next_sequence_value(sequence_name)\n select_one(\"select #{sequence_name}.nextval id from dual\")['id']\n end", "def index_of_next_closest(q, from = 0)\n index_of_closest(1, q, from)\n end", "def get_index(position:)\n row = (position - 1) / 3\n col = (position - 1) % 3\n return row, col\n end", "def next_anim_index\n @anim_index = (@anim_index + 1) % (@animation_array.size - 1)\n end", "def next_coordinate(previous, direction)\n case direction\n when 'u'\n [previous[0], previous[1] + 1]\n when 'd'\n [previous[0], previous[1] - 1]\n when 'l'\n [previous[0] - 1, previous[1]]\n when 'r'\n [previous[0] + 1, previous[1]]\n else\n raise 'Incorrect character in direction sequence'\n end\n end", "def next_available_index\n for index in 0..32 do\n break index unless self[index].exists?\n end\n end", "def next!\n rotate!.first\n end", "def position(input)\n if input.to_i.between?(1,9)\n @cells[input.to_i - 1]\n end\n end", "def next_number\n self.to_a.size + 1\n end", "def position(index)\n return [-1, -1] unless index < string.length\n\n row_start = @line_starts.select { |line_start| line_start <= index }.last\n row = @line_starts.index(row_start)\n column = index - row_start\n [row, column]\n end", "def to position\n self[0..position]\n end", "def position_result\n hurdle_match.rank.index(self) + 1\n end" ]
[ "0.74691653", "0.6972149", "0.69141716", "0.69141716", "0.68536675", "0.6752193", "0.673807", "0.6723851", "0.66539335", "0.6590219", "0.655326", "0.646682", "0.64662623", "0.64614713", "0.64523584", "0.6424467", "0.6400507", "0.63645834", "0.6360255", "0.6340886", "0.6324847", "0.6321957", "0.63213784", "0.63180465", "0.6302935", "0.62878025", "0.6286596", "0.6267151", "0.6256653", "0.6255198", "0.6253853", "0.6236244", "0.62166125", "0.62005645", "0.6186729", "0.61845344", "0.6154092", "0.6136315", "0.6133931", "0.6132359", "0.6112595", "0.6110156", "0.6087867", "0.6085806", "0.6069102", "0.6059682", "0.6059682", "0.605655", "0.6051285", "0.6031958", "0.60312", "0.60263354", "0.6025379", "0.602526", "0.60234815", "0.60068184", "0.59936076", "0.5988546", "0.5980799", "0.59741277", "0.59726894", "0.5968559", "0.59576637", "0.5946585", "0.59460896", "0.5945497", "0.59386694", "0.5933067", "0.5921526", "0.59134406", "0.59049237", "0.5903332", "0.59019536", "0.59017915", "0.5891371", "0.5887258", "0.5886349", "0.588546", "0.5884004", "0.5879799", "0.5874046", "0.5874046", "0.58464515", "0.5837528", "0.58275247", "0.581822", "0.58170956", "0.5814015", "0.58104795", "0.58002317", "0.57903326", "0.57839173", "0.57719016", "0.57616025", "0.5751961", "0.5751635", "0.57445747", "0.5741943", "0.57356167", "0.5721786", "0.5721383" ]
0.0
-1
Returns ships' positions as per server. Includes only the actual positions with no message.
def allocate_ships options =[ "5:A1:V 4:J5:V 3:A8:H 3:I1:V 2:!?:H".sub('!', ('C'..'G').sort_by { rand }.first).sub('?', (1..9).sort_by{ rand }.first.to_s), "5:I1:V 4:H6:V 3:E10:H 3:D7:V 2:!?:V".sub('!', ('A'..'G').sort_by { rand }.first).sub('?', (1..4).sort_by{ rand }.first.to_s), "5:E3:V 4:A2:V 3:A7:V 3:J5:V 2:!?:V".sub('!', ('G'..'I').sort_by { rand }.first).sub('?', (1..9).sort_by{ rand }.first.to_s), "5:F10:H 4:A10:H 3:A2:V 3:H1:H 2:!?:H".sub('!', ('C'..'I').sort_by { rand }.first).sub('?', (3..8).sort_by{ rand }.first.to_s), "5:B1:H 4:J2:V 3:J7:V 3:F10:H 2:A?:V".sub('?', (rand(8)+2).to_s), "5:F6:H 4:D5:V 3:E4:H 3:F9:H 2:!1:H".sub('!', (rand(9)+65).chr), "5:F10:H 4:B1:H 3:A2:V 3:A6:V 2:J?:V".sub('?', (rand(7)+1).to_s), "5:F1:V 4:A6:H 3:H6:H 3:F8:V 2:!?:V".sub('!', ['A','B','C','H','I','J'][rand 6]).sub('?', [1,2,8,9][rand 4].to_s), ] options[rand options.length] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_positions\n all_players = consume_player_data\n keep_position_info(all_players)\n end", "def ship_coordinates\n @ship_squares.map do |squares|\n squares.map { |square| [square.x, square.y] }\n end\n end", "def remains\n @all_ships.each_with_index.map { |x, i| [i, x.coord, x.len, x.health] }\n end", "def ships\n MyShip.where(\"location ~= POINT(?)\", self.location)\n end", "def get_ship_coords_from_player\n @fleet.each do |ship|\n until ship.valid_coords == true #ship knows if its coords are valid\n orientation = @board.get_player_orientation(ship)\n @board.get_player_coords(orientation, ship, @fleet)\n end\n @board.save_ship_to_board(ship)\n end\n end", "def positions\n Easybill::Api::Positions\n end", "def get_locations\n\n spaces_with_players = []\n @spaces.each do |space|\n if !space.is_empty\n spaces_with_players.push(space)\n end\n end\n return spaces_with_players\n end", "def fleet\n @all_ships.each_with_index.map { |x, i| [i, x.len] }\n end", "def positions(id)\n get(\"/accounts/#{id}/positions\")['positions']\n end", "def place_fleet(pos_list)\n # Try to set all ships on the field\n res = pos_list.inject(true) do |a, l|\n a && @all_ships[l[0]].set!(l[1], l[2], l[3])\n end\n\n # If success, check something???\n res = @all_ships.inject(true) { |a, ship| a && ship.coord } if res\n\n # Remove all ships otherwise\n @all_ships.each { |ship| ship.kill if ship.coord } if !res\n\n res\n end", "def create_positions\n (1..GAME_BOARD_LENGTH).each do |y|\n (1..GAME_BOARD_LENGTH).each do |x|\n self.positions.new(x: x, y: y)\n end\n end\n set_ships\n save\n end", "def get_ship_coords_automatically\n @fleet.each do |ship|\n # fetch coords for this ship automatically, given fleet and board\n # no return needed, as ship is an object which is updated by ShipCoords\n ShipCoords.new(ship:ship, fleet:@fleet, board:@board)\n @board.save_ship_to_board(ship)\n ship_count = 0\n if @autogenerated == true && ship_count == 4\n $message << \"Here is how your ships are placed. [Enter] to continue. \" unless\n $testing == true # see comment in settings.rb\n @board.show_board_and_get_input unless $testing == true\n end\n ship_count += 1\n end # of this ship\n end", "def place_ships!\n\t\t[\n\t\t\t['T', 2],\n\t\t\t['D', 3],\n\t\t\t['S', 3],\n\t\t\t['B', 4],\n\t\t\t['C', 5]\n\t\t].each do |ship|\n\t\t\tplace_ship(ship[0], ship[1])\n\t\tend\n\tend", "def get_position_list\n\n end", "def place_ships(ships, board)\n placed = []\n rows = board.size\n cols = board.first.size\n\n while ships.any?\n length = ships.first\n orientation = rand(2) == 0 ? 'h' : 'v'\n\n if orientation == 'h'\n height = 1\n width = length\n else\n height = length\n width = 1\n end\n\n x = rand(cols - width)\n y = rand(rows - height)\n ship = Ship.new(x, y, orientation, length)\n\n if ship.coords.none? { |x, y| placed.map(&:coords).flatten(1).include? [x, y] }\n placed << ship\n ships.shift\n end\n end\n\n placed\n end", "def get_neigbouring_positions(pos)\n [ pos1(pos), pos2(pos), pos3(pos), pos4(pos), pos5(pos), pos6(pos), pos7(pos), pos8(pos) ]\n end", "def get_empty_posns \n empty_posns = []\n\n @board.rows.each_with_index do |row, idx1| \n row.each_with_index do |block, idx2| \n if @board.empty?([idx1, idx2])\n empty_posns << [idx1, idx2]\n end\n end\n end\n\n empty_posns\n end", "def position\n\t\t\treturn 0 if self.button == self.acting_seat\n\t\t\tspots = 1\n\t\t\tcurrent_spot = self.acting_seat - 1\n\t\t\tself.number_of_players_in_hand.size.times do\n\t\t\t\tcurrent_spot = @state_hash['state']['players'].size - 1 if current_spot < 0\n\t\t\t\treturn spots if current_spot == self.acting_seat\n\t\t\t\tspots += 1 if still_in_hand?(@state_hash['state']['players'][current_spot]['id'])\n\t\t\t\tcurrent_spot -= 1\n\t\t\tend\n\t\tend", "def position\n\t\t\treturn 0 if self.button == self.acting_seat\n\t\t\tspots = 1\n\t\t\tcurrent_spot = self.acting_seat - 1\n\t\t\tself.number_of_players_in_hand.size.times do\n\t\t\t\tcurrent_spot = @state_hash['state']['players'].size - 1 if current_spot < 0\n\t\t\t\treturn spots if current_spot == self.acting_seat\n\t\t\t\tspots += 1 if still_in_hand?(@state_hash['state']['players'][current_spot]['id'])\n\t\t\t\tcurrent_spot -= 1\n\t\t\tend\n\t\tend", "def get_positions\n self.positions = []\n (self.order/:PosNr).each do |position|\n item = Item.new(position)\n self.positions << item if !item.placeholder? && item.valid?\n self.errors << item.to_error_log unless item.placeholder? || item.valid?\n self.warnings << item.to_warning_log unless item.clean?\n end\n end", "def index\n @positions = Position.all\n end", "def index\n @positions = current_user.positions.all\n end", "def destinations\n coords = XmlSimple.xml_in(\n @game.send( \"<movementOptions x='#{x}' y='#{y}' type='#{TYPE_FOR_SYMBOL[@type]}'/>\" )\n )[ 'coordinate' ]\n coords.map { |c|\n @game.map[ c[ 'x' ], c[ 'y' ] ]\n }\n end", "def hidden_ships_grid\n @grid.map do\n |row|\n row.map do\n |el|\n if el == :S\n :N\n else\n el\n end\n end\n end\n end", "def active_positions\n authenticated_post(\"auth/positions\").body\n end", "def place_ships\n place_carrier\n place_battleship\n place_destroyer\n place_submarines\n place_patrol_boats\n end", "def index\n if @device\n @positions = @device.positions\n else\n @positions = Position.all\n end\n end", "def index\n @managers_positions = Managers::Position.all\n end", "def get_mines(positions)\n positions.select { |pos| mine?(pos) }\n end", "def non_cabinet_position_ids\n non_cabinet_positions.map { |r| r[:id] }\n end", "def position\n fetch('football.positions')\n end", "def sunkShips (who)\n which_ships = (who == \"me\") ? \"my_ships\" : \"enemy_ships\"\n ships = self.send(which_ships).find_all_by_sunk(true)\n if !ships.nil?\n ships = ships.map { |ship| ship.ship.name }\n end\n return ships\n end", "def fork_positions\n board = @board.clone\n positions = []\n\n board.blanks.each do |blank_position|\n board.place_move(blank_position, @play_symbol)\n\n if win_positions(board).size >= 2\n positions << blank_position\n end\n\n board.undo_move(blank_position)\n end\n\n positions\n end", "def team_positions\n if has_team?\n Position.where(position_id: position&.id)\n else\n Position.none\n end\n end", "def pos\n [posx, posy]\n end", "def get_empty_locs\n empty = []\n @board.each { |index, spot| empty.push(index) if spot.nil? }\n return empty\n end", "def minmax_position(passes)\n # It's somewhere in the positions\n all_positions = positions(passes)\n\n # between the minimum and maximum seat\n min_pos, max_pos = all_positions.minmax\n\n # So we just eliminate any seat that's taken. Whatever is left over\n # is ours\n (min_pos..max_pos).to_a - all_positions\nend", "def hidden_ships_grid\n new_grid = []\n\n @grid.each_with_index do |arr, i|\n new_grid[i] = arr.map do |ele|\n if ele == :S\n ele = :N\n else\n ele\n end\n end\n end\n\n new_grid\n end", "def new_move_positions(pos)\n candidates = KnightPathFinder.valid_moves(pos)\n candidates = candidates.select { |e| !@considered_positions.include?(e) }\n @considered_positions.concat(candidates)\n return candidates\n #@considered_positions = (@considered_positions.concat(candidates)).uniq\n end", "def cal_pos\n x, y = map_location(@grid_x, @grid_y)\n x += @tile_size/2\n y += @tile_size/2\n [x,y]\n end", "def positions(passes) = passes.map { find_position(_1) }", "def positions\n relative_positions = []\n # As directional positions:\n # -1 = the bug's left\n # 0 = the bug's front\n # 1 = the bug's right\n -1.upto(1) {|i|\n n = i + @direction\n if n >= 4\n n = 0\n end\n relative_positions << n\n }\n # As relative positions:\n # 0 = to the north of the bug\n # 1 = to the east of the bug\n # 2 = to the south of the bug\n # 3 = to the west of the bug\n relative_positions\n # A translation from relative positions to the offsets needed\n # to get the absolute position.\n changes = [\n Point[0, -1], # north (0)\n Point[1, 0], # east (1)\n Point[0, 1], # south (2)\n Point[-1, 0] # west (3)\n ]\n # Calculate the absolute positions.\n result = {}\n relative_positions.each {|p|\n if p < 0\n p = 3\n end\n result[directions[p]] = @position + changes[p]\n }\n result\n end", "def pos\n\t\tif not moved_to.nil? and moved?\n\t\t\tsquare.neighbor( moved_to )\n\t\telse\n\t\t\tsquare\n\t\tend\n\tend", "def position\n [@x, @y]\n end", "def position\n [ChessBoard.col_index(pos[0]), pos[1].to_i]\n end", "def moves\n # All pieces can stay in place\n [[0,0]]\n end", "def generate_positions!\n position_names = Utils::Rules.position_names(players_count)\n sorted_players = players.sort_by(&:seat)\n \n # Find the button and name the seats after the button\n sorted_players.each do |player|\n player.position_name = 'BTN' if player.seat == @button_seat\n \n if player.seat > @button_seat\n player.position_name = position_names.pop\n end\n end\n \n # The seats before the button are named in order until we run out of seat\n sorted_players.each do |player|\n if player.seat < @button_seat\n player.position_name = position_names.pop\n end\n end\n end", "def index\n @positions = Position.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @positions }\n end\n end", "def get_possible_moves\n moves = \n\t @@offsets.collect do |move| \n\t row = @position[:row] + move[0]\n\t col = @position[:col] + move[1]\n\t\t[row, col] if row.between?(0, 7) && col.between?(0, 7)\n\t end\n\tmoves.compact\n end", "def shipments\n ret = []\n elements = @document.search self.shipments_found_in\n elements.each do |element| \n li = Shipment.new\n li.document = element\n ret << li\n end\n ret\n end", "def ear_positions\n ear_message = new_message\n ear_message.ears = 'ok'\n response = ear_message.send\n return [response.left_ear, response.right_ear]\n end", "def refresh\n @all_ships = @field.reduce(:|).find_all { |x| x }\n end", "def pos\r\n { x: @tile.x,\r\n y: @tile.y }\r\n end", "def hidden_ships_grid \n @grid.map do |row|\n row.map do |ele|\n if ele == :S \n :N \n else\n ele\n end\n end\n end\n end", "def positions\n @boards = current_company.boards.decorate\n end", "def select_ship_positions(player, ship_size)\n valid_selection = false\n while valid_selection == false\n puts \"---- #{player.name} ---- please choose positions for the #{ship_size}x1 ship: \\n\"\n puts \"must be separated by a space like: a0 a1 a3 \\n\"\n prompt = '> '\n positions = Readline.readline(prompt, true)\n positions_simbolized = positions.split(' ').map(&:to_sym)\n\n valid_selection = $current_game.create_ship(player.board, positions_simbolized, ship_size)\n message = valid_selection == true ? \"👍 Good Choice \\n\" : \"👎 wrong positions , please try again \\n\"\n puts message\n end\n end", "def s_coords(attrs)\n height = (attrs['HEIGHT'] || 0).to_i\n width = (attrs['WIDTH'] || 0).to_i\n hpos = (attrs['HPOS'] || 0).to_i\n vpos = (attrs['VPOS'] || 0).to_i\n [hpos, vpos, width, height]\n end", "def index\n @positions = Position.all(:order=>'name')\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @positions }\n end\n end", "def index\n @player_ships = PlayerShip.all\n end", "def moves\r\n # pos = [0,0]\r\n # row, col = pos\r\n all_h = []\r\n all_d = []\r\n HORIZONTAL_DIRS.each do |h_pos|\r\n h_row, h_col = h_pos\r\n all_h += grow_unblocked_moves_in_dir(h_row, h_col) #returns all moves in h_pos\r\n end\r\n DIAGONAL_DIRS.each do |d_pos|\r\n h_row, h_col = d_pos\r\n all_d += grow_unblocked_moves_in_dir(h_row, h_col) #returns all moves in d_pos\r\n end\r\n if self.class == Queen\r\n return all_h + all_d\r\n elsif self.class == Bishop\r\n return all_d\r\n elsif self.class == Rook\r\n return all_h\r\n end\r\n end", "def index\n @template_positions = TemplatePosition.all\n end", "def positions\n Rails.cache.fetch(\"#{cn}/positions\") do\n positions = position(true)\n member(true).each do |m|\n if LdapGroup.dn_is_group? m\n positions += (LdapGroup.find(m).position(true))\n end\n end\n positions\n end\n end", "def map_pois\n restaurant_positions = RestaurantPositions.new(map_params)\n\n expose restaurant_positions.call,\n each_serializer: RestaurantPositionSerializer\n end", "def all_positions_full?\n available_positions.empty?\n end", "def position\n\t\t[ @x, @y ]\n\tend", "def location\n [@posX, @posY, @facing]\n end", "def num_ships \n @grid.flatten.count(:S)\n end", "def get_moves\n [\n { row: @row + 1, col: @col + 2 },\n { row: @row + 1, col: @col - 2 },\n { row: @row + 2, col: @col + 1 },\n { row: @row + 2, col: @col - 1 },\n { row: @row - 1, col: @col + 2 },\n { row: @row - 1, col: @col - 2 },\n { row: @row - 2, col: @col + 1 },\n { row: @row - 2, col: @col - 1 }\n ].select do |move|\n [:blank_space, :enemy_piece].include? describe_location(move[:row], move[:col])\n end\n end", "def moves\n [player_one_move, player_two_move].compact\n end", "def get_all_mines\n\t\tall_mines = []\n\t\t@board.flatten.each do |square|\n\t\t\tall_mines << square.coords if square.mine == true\n\t\tend\n\t\tall_mines\n\tend", "def king_positions\n king_locations = []\n @@piece_locations.each do |piece, details|\n if details[\"type\"] == \"king\"\n king_locations << piece\n end\n end\n return king_locations\n end", "def position\n [x, y]\n end", "def potential_positions\n (0...@all_rotations.size).map do |rot_index|\n shape = @all_rotations[rot_index]\n extent = horiz_extent(shape)\n (0-extent[0]...@board.num_columns-extent[1]).map do |x|\n [x, lowest_fit(shape, x), rot_index]\n end\n end.reduce(:+)\n end", "def moves\n @moves\n end", "def show\r\n @positions.each do |p|\r\n\t puts p.inspect\r\n\tend\r\n end", "def new_move_positions(pos)\n possible_moves = KnightPathFinder.valid_moves(pos)\n possible_moves.reject! {|a_pos| @considered_position.include?(a_pos)}\n possible_moves.each {|a_pos| @considered_position << a_pos }\n possible_moves\n end", "def player_positions(board)\n\t\tif current_player(board) == \"X\"\n\t\t\tboard.cells.each_with_index do |a,i| # Find the other player's current positions held\n\t\t\t\t if a == \"O\"\n\t\t\t\t\t @other_player_positions << (i + 1).to_s # the other player is using token \"O\"\n\t\t\t\t end\n\t\t\tend\n\t\t\tboard.cells.each_with_index do |a,i| # Find the current player's current positions held\n\t\t\t\t if a == \"X\"\n\t\t\t\t\t @current_player_positions << (i + 1).to_s # the current player is using token \"X\"\n\t\t\t\t end\n\t\t\tend\n\t\tend\n\t\tif current_player(board) == \"O\"\n\t\t\tboard.cells.each_with_index do |a,i| # Find the other player's current positions held\n\t\t\t\t if a == \"X\"\n\t\t\t\t\t @other_player_positions << (i + 1).to_s # the other player is using token \"X\"\n\t\t\t\t end\n\t\t\tend\n\t\t\tboard.cells.each_with_index do |a,i| # Find the current player's current positions held\n\t\t\t\t if a == \"O\"\n\t\t\t\t\t @current_player_positions << (i + 1).to_s # current player is using token \"O\"\n\t\t\t\t end\n\t\t\tend\n\t\tend\n\tend", "def hidden_ships_grid\n hidden = Array.new(@grid.size) { [] }\n (0...@grid.size).each do |i|\n (0...@grid.size).each do |j|\n chit = self[[i, j]] == :S ? :N : self[[i, j]]\n hidden[i] << chit\n end\n end\n hidden\n end", "def place(coord_array) \n #sets spots array to the coordinates occupied by the ship\n @spots = coord_array.dup \n end", "def get_available_positions\n\t\tpositions = []\n\t\tfor i in (1..9) do\n\t\t\tx = ((i - 0.1) / 3).truncate\n\t\t\ty = (i - 1) % 3\n\t\t\tif self.is_valid?(x, y)\n\t\t\t\tpositions.push(i)\n\t\t\tend\n\t\tend\n\t\t\n\t\treturn positions\n\tend", "def position\n [row.position, column.position]\n end", "def clean_positions\n self.x_pos = self.x_pos.strip.to_i.to_s\n self.y_pos = self.y_pos.strip.to_i.to_s\n end", "def index\n @ships = Ship.all\n end", "def index\n @ships = Ship.all\n end", "def index\n @order_positions = OrderPosition.all\n end", "def all\n result = @dealing_platform.session.get('positions/sprintmarkets', API_V2).fetch :sprint_market_positions\n\n @dealing_platform.instantiate_models SprintMarketPosition, result\n end", "def new_game\n my_board = EdenPlayer.new_board\n ships = [5, 4, 3, 3, 2]\n probs = positional_probabilities my_board\n ship_pos = ships.map do |ship|\n laid = nil\n until laid\n rand_branch = rand(999) % 3\n # 1/3rd of the time, don't lay the ship in lowest probability spot\n # near edge, this gives a grouping formation that gives a few ships\n # a great area that they may be found in\n pos = rand(999) % 3 == 1 ? [rand(10), rand(10)] : draw_next_min(probs)\n laid = lay_ship({ship_length: ship, board: my_board, pos: pos})\n end\n laid\n end\n end", "def moves\n poss_moves = []\n determine_moves.each do |diff| #array of directions\n poss_moves += grow_unblocked_moves_in_dir(diff[0],diff[1])\n end\n poss_moves\n end", "def positions_of_agents\n positions = []\n @figures.each {|f| positions << f.position}\n positions.shift\n positions\n end", "def get_locations(lines, filename, params)\n positions = Hash.new\n missing_pos = Array.new\n first = true\n\t\n\tif(params[:has_positions])\n\t\tlines.each do |line|\n\t\t\tif first\n\t\t\t\tfirst = false\n\t\t\t\tnext\n\t\t\tend\n\t\t\tdata = strip_and_split(line)\n\t\t\tsnpid = data[@snpid]\n\t\t\tif data[@location] =~ /\\d/\n\t\t\t\tpositions[snpid] = Hash.new\n\t\t\t\tpositions[snpid]['chr'] = data[@chromnum]\n\t\t\t\tpositions[snpid]['chr'] =~ /(\\d+)/ or positions[snpid]['chr'] =~ /(\\w+)/\n\t\t\t\tpositions[snpid]['chr'] = $1\n\t\t\t\tpositions[snpid]['pos'] = data[@location]\n\t\t\telsif data[@snpid] =~ /\\w/\n\t\t\t\t# missing so will try to get information from database\n\t\t\t\tmissing_pos << snpid\n\t\t\tend\n\t\tend\n\n\t\t# if any missing try database for location if have mysql support\n\t\tif @@mysql_support and !missing_pos.empty?\n\t\t\tfinder = SNPpos.new\n\t\t\tsnpsinfo = finder.get_pos(missing_pos)\n\t\t\tstill_missing = Array.new\n\t\t\tmissing_pos.each do |rsid|\n\t\t\t\tif snpsinfo.has_key?(rsid) and snpsinfo[rsid]['chr'] != nil\n\t\t\t\t\tpositions[rsid] = snpsinfo[rsid]\n\t\t\t\telse\n\t\t\t\t\tstill_missing << rsid\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tmissing_pos = still_missing\n\t\tend\n\n\t\tif !missing_pos.empty?\n\t\t\twrite_missing_log(filename, missing_pos)\n\t\tend\n\telse\n\t\t# set arbitrary positions in order of input\n\t\tpos=1\n\t\tlines.each do |line|\n\t\t\tif first\n\t\t\t\tfirst = false\n\t\t\t\tnext\n\t\t\tend\n\t\t\tdata = strip_and_split(line)\n\t\t\tsnpid = data[@snp1] + '_' + data[@snp2]\n\t\t\tnext if positions.has_key?(snpid)\n\t\t\tpositions[snpid] = Hash.new\n\t\t\tpositions[snpid]['chr'] = 1\n\t\t\tpositions[snpid]['pos'] = pos\n\t\t\tpos += 1\n\t\tend\n\tend\n\n return positions\nend", "def available_moves(position = player.position, all: false)\n [\n Point.new(position.x - 1, position.y),\n Point.new(position.x, position.y - 1),\n Point.new(position.x + 1, position.y),\n Point.new(position.x, position.y + 1),\n ].select { |point| all || is_legit_move?(point) }\n end", "def npc_unit_locations\n fields = \"location_x, location_y\"\n without_locking do\n Unit.in_zone(self).select(fields).group(fields).where(:player_id => nil).\n c_select_all\n end.each_with_object(Set.new) do |row, set|\n set.add SolarSystemPoint.new(id, row['location_x'], row['location_y'])\n end\n end", "def place_random_ships\n ship_count = size / 4\n while ship_count.positive?\n row = rand(@grid.size)\n col = rand(@grid.size)\n if self[[row, col]] == :N\n self[[row, col]] = :S\n ship_count -= 1\n end\n end\n end", "def position_groups\n Easybill::Api::PositionGroups\n end", "def index\n @ships = Ship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ships }\n end\n end", "def index\n @positions = Position.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @positions }\n end\n end", "def team_team_positions\n if has_team?\n Position.where(position_id: Position.where(position_id: position&.id).ids).where.not(position_id: nil)\n else\n Position.none\n end\n end", "def coords\n coord_list = []\n (@x..(@x + @size_x - 1)).each do |i|\n (@y..(@y + @size_y - 1)).each do |j|\n coord = [i, j]\n coord_list << coord\n end\n end\n\n return coord_list\n end", "def free_positions\n taken_positions = []\n users.each do |u|\n if u.position\n taken_positions.push(u.position)\n end\n end\n User.positions - taken_positions\n end", "def index\n @fleet_ships = FleetShip.all\n end", "def index\n @ship_placements = ShipPlacement.all\n end" ]
[ "0.7049712", "0.6534757", "0.64949864", "0.6219765", "0.61478496", "0.59926206", "0.59674454", "0.59073025", "0.59050876", "0.58662504", "0.58334935", "0.5829657", "0.5801994", "0.57445455", "0.57286555", "0.57260174", "0.56145954", "0.5600293", "0.5600293", "0.5596348", "0.55300546", "0.55244946", "0.5523375", "0.55199623", "0.5500267", "0.54929173", "0.5490849", "0.54534876", "0.54422015", "0.5424832", "0.5418418", "0.54016066", "0.5396314", "0.53907907", "0.5384291", "0.53840166", "0.53680646", "0.53504235", "0.5337734", "0.5332048", "0.53222835", "0.532089", "0.5301362", "0.5300119", "0.52962345", "0.52889204", "0.5286424", "0.52845776", "0.5277398", "0.5273392", "0.5272138", "0.52654445", "0.52596843", "0.52529186", "0.524684", "0.52447575", "0.52421045", "0.523169", "0.52314526", "0.52269155", "0.52252334", "0.52193916", "0.5217176", "0.5216008", "0.5215458", "0.520046", "0.5198471", "0.5196045", "0.5187342", "0.5184108", "0.5182789", "0.51602507", "0.51501745", "0.51477337", "0.51395625", "0.5133787", "0.51329654", "0.5121119", "0.51210296", "0.5119484", "0.5118553", "0.51176256", "0.5117127", "0.5117127", "0.5108773", "0.5108297", "0.510474", "0.5104182", "0.5102692", "0.5102039", "0.51014996", "0.5097136", "0.5096902", "0.50921875", "0.50841975", "0.5083372", "0.50761586", "0.50755864", "0.5075433", "0.5046018", "0.50433403" ]
0.0
-1
Receives count Returns space delimited positions. Such as "A1 J10"
def shot(count) shots = (1..count).map do next_target || 'A1' # Out of shots already, just satisfy min-shots requirement end * ' ' shots end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 get_char_summery(string, count)\n string[0..count]\n end", "def level_print(message, count)\n\n if count > 0\n indention = \"\"\n indention += \" \" until indention.length() == 2*count\n print indention\n end\n\n puts message\nend", "def stars count\n\t\t\t\tstr = ''\n\t\t\t\tcount.times do\n\t\t\t\t\tstr += \"*\"\n\t\t\t\tend\n\t\t\t\tstr\n\t\t\tend", "def line_space(index=@buffer.line.end)\n\t\t\ts = 0\n\t\t\t@buffer[@buffer.line.start ... index].each_char do |k|\n\t\t\t\ts += char_space(k, s)\n\t\t\tend\n\t\t\t\n\t\t\ts\n\t\tend", "def alphabet_position(text)\r\n numbers = \"\"\r\n text.split(\"\").each do |letter|\r\n if is_char_in_alpha(letter) == true\r\n numbers += \"#{letter.upcase.ord - 'A'.ord + 1} \"\r\n end\r\n end\r\n return numbers.strip\r\n\r\nend", "def indent2(str, count)\n if str\n char = ' '\n #(char * count) + gsub(/(\\n+)/) { $1 + (char * count) }\n str.gsub(/(\\n+)/) { $1 + (char * count) }\n end\n end", "def pirates_say_arrrrrrrrr(string)\n r_indexes = []\n string.split(\"\").each_with_index{|letter, index| r_indexes << index if letter.downcase == \"r\"}\n plusoneindex = r_indexes.map{|index| index + 1}\n answer = \"\"\n plusoneindex.map{|index| string.split(\"\")[index]}.join\n\nend", "def take_a_number(katz_deli, name)\n katz_deli << name\n\n# katz_deli.each_with_index do |name, index|\n puts \"Welcome, #{name}. You are number #{katz_deli.length} in line.\"\n# end\nend", "def countAtE (titlevar)\n\tputs titlevar.count(\"a-e\")\nend", "def declare(map, start, string)\n count = start\n string.split(\" \").each do |token|\n map[token] = count\n count += 1\n end\nend", "def count_spaces (foo)\n foo.count(\" \")\n end", "def pe(i); str(nil, i, ')'); end", "def counting_spaces\n i = 0\n while i < 9 do\n result = @array.at(i)\n result.each do |num|\n if num == 0\n @@count = @@count + 1\n end\n end\n i = i + 1\n end\n end", "def find_spaces(mp, limit)\n\t\tspaces = []\n\t\treturn spaces if limit <= 0\n\t\tpos = -1\n\t\twhile (pos = mp.index(/\\s/, pos+1))\n\t\t\tspaces << pos\n\t\tend\n\t\tspaces.shuffle.slice(0, limit)\n\tend", "def separate_comma(number)\n case number.to_s.length\n when 0..3\n puts number.to_s\n when 4..6\n puts number.to_s.insert(-4,\",\")\n when 7..9\n puts number.to_s.insert(-4,\",\").insert(-8,\",\")\n when 10..12\n puts number.to_s.insert(-4,\",\").insert(-8,\",\").insert(-12,\",\")\n end\nend", "def count_index(to_count)\n\tmy_hash = Hash.new{|hash, key| hash[key] = []}\n\tcount = 0\n\tto_count.split('').each do |letter|\n\t\tcount += 1\n\t\tmy_hash[letter].push(count)\n\tend\n\tmy_hash\t\nend", "def staircase(n)\n i = 1\n spaces = \" \"\n destination = Array.new\n n.times do\n destination << (\" \" * (n-i)) + (\"#\" * (i))\n puts destination\n i = i + 1\n destination = []\n end\nend", "def line(katz_deli)\n length = \"The line is currently:\"\n#i'm using a string class method (.length) here to calculate the character length of the array \"katz_deli.\"\n if katz_deli.length == 0\n puts \"The line is currently empty.\"\n else\n#I'm enumerating the katz_deli array to get the name of the customer and index to calculate the customer's position on line.\n katz_deli.each_with_index do |name, index|\n#I'm using shorthand operator += to signify my variable \"length\" is equal to variable \"length\" variable \"index+1 + name\"\n#Additionally, I'm interpolating my variables below to make my code clean, and legible.\n length += \" #{index+1}. #{name}\"\n end\n puts \"#{length}\"\n end\nend", "def accum(s)\n\t# your code\n arr = s.split(\"\")\n arr.map!.with_index do |el, idx|\n mapper = el * (idx+1)\n mapper = mapper.capitalize\n puts mapper\n mapper\n end \n\n arr.join(\"-\")\nend", "def oneMore(number)\r\n symbol = number.to_s(2)\r\n kol = symbol.count(\"1\")\r\n puts(kol)\r\n #puts(12344.to_s(2))\r\n #puts (kol) #не_смог_через_return\r\nend", "def count_spaces string\n string.count(\" \")\nend", "def parse_spc\n @spc = @row[/(^[ \\t]+)/,1].to_s #sometime result is nil\n @ron = @row.strip.size\n end", "def num_decodings(s)\n i1, i2 = 1\n count = 0\n (1..s.size).each do |i|\n# s[i-1, 1] i- 1 is position & 1 is how many ele's you want \n count = s[i-1,1] != '0' ? i1 : 0 # if previous was not 0 set to i1\n count += i2 if s[i - 2, 2].between?('10', '26') && i > 1\n i2 = i1\n i1 = count\n end\n count\nend", "def printStrings strArr, maxLength\n strArr.each_with_index do |str, i|\n # center strings, add spaces on left to add shifting effect\n puts ' ' * i * 2 + str.center(maxLength)\n end\nend", "def step_3\n\t\tmessage_array = @message.downcase.split(\"\")\n\t\t@message_num_array = []\n\t\tmessage_array.each do |letter|\n\t\t\t@message_num_array << (@alphabet.index(letter) + 1)\n\t\tend\n\t\t@message_num_array\n\tend", "def split(position)\n end", "def split(position)\n end", "def counted_characters(str)\n arr = str.split('')\n new_arr = []\n counted = element_count(arr)\n\n counted.each do |k, v|\n new_arr << k if v > 2\n end\n new_arr\nend", "def accum(s)\n arr = s.split('')\n arr.map!.each_with_index do |letter, index|\n (letter * (index + 1)).capitalize\n # binding.pry\n end\n arr.join('-')\nend", "def formatted_count item, key_count\n key_count_str = number_with_delimiter(key_count.to_i, :delimiter => ',')\n \"%-25s\\t%12s\" % [item, key_count_str]\n end", "def message_split(name)\n messages = @data[name]\n\n char_me = 0\n char_them = 0\n\n messages.each do |msg|\n begin\n if msg[2].to_i == 2\n char_me = char_me + msg[1].size\n else\n char_them = char_them + msg[1].size\n end\n rescue\n next\n end\n end\n\n puts \"My char count: #{char_me} | Their char count: #{char_them}\"\n\n end", "def list_title(n=40)\n st = subject[0..n].to_s\n st += \"...\" unless subject.length <= n\n st\n end", "def count_code(string)\n count = 0\n empty = []\n (string.size - 3).times do |i|\n slice = string[i..(i + 3)]\n if slice == \"code\" \n count += 1\n end\n end\n return count \nend", "def number_counting_seq(n)\n return \"\" if n == 0\n a = \"11\"\n return a[0...n] if n <= 2\n\n res = \"11\"\n (n-2).times do\n new_piece = res.split(\"\").chunk_while { |a, b| a == b }.to_a if res.length > 1\n res = \"\"\n new_piece.each { |chunk| res += \"#{chunk.length}#{chunk[0]}\" }\n end\n res\nend", "def space\n self.last.to_i - self.first.to_i + 1\n end", "def split_at(idx)\n [self[0...idx] || \"\", self[idx..-1] || \"\"] \n end", "def assign_spaces_to_rows\n space_names.each_slice(@length).to_a\n end", "def space_separated(str: raise)\n\tfirst_index = 0\n\tlast_index = 0\n\tresults = []\n\n\tstr.size.times do\n\t\tcheck_string = str[first_index..last_index]\n\t\tif DICTIONARY[check_string]\n\t\t\tresults << check_string\n\t\t\tfirst_index = last_index += 1\n\t\t\tlast_index = first_index\n\t\telse\n\t\t\tlast_index += 1\n\t\tend\n\tend\n\n\tputs results.join(\" \")\nend", "def truncate string, count\n string = string.to_s\n string.tr!(\"\\n\",' ')\n return string if string.length <= count\n (string[0..(count-4)] + \" ...\")\n end", "def turn_count(board)\n 9 - board.count(\" \")\nend", "def *(count)\n `var result = [];\n\n for (var i = 0; i < count; i++) {\n result.push(self);\n }\n\n return result.join('');`\n end", "def *(count)\n `var result = [];\n\n for (var i = 0; i < count; i++) {\n result.push(self);\n }\n\n return result.join('');`\n end", "def title_to_number(s)\n s.split(\"\").map {|ch| ch.ord - 'A'.ord + 1}.reduce(:+)\nend", "def num_chars\n @name.split('').count\n end", "def take_a_number(deli,name)\n deli << name\n puts \"Welcome, #{name}. You are number #{deli.length} in line.\"\n\nend", "def take_a_number (deli, name)\n deli << name\n puts \"Welcome, #{name}. You are number #{deli.length} in line.\"\n return deli\nend", "def reorganize_string(a)\np a\n a = get_frequencies(a)\n\n count = count_char_numbers(a)\n\n return \"\" unless can_reorganize?(count)\n\n build_new_string(a, count)\nend", "def count_and_say(sequence)\n\treturn 0 if sequence == nil\n\tsequence = sequence.to_s\n\tn = sequence.to_s.size\n result = ''\n\ti = 1\n\trepeat = sequence[0]\n\ttimes = 1\n\twhile (i<=n) do\n\t\tif sequence[i] == repeat\n\t\t\ttimes += 1\n else\n \tresult += times.to_s + repeat.to_s\n \ttimes = 1\n repeat \t= sequence[i].to_i\n end\n i+=1\n end \n\treturn result \nend", "def row(num_space, num_star)\n space = ' ' * num_space\n star = '*' * num_star\n arr = [space, star, space]\n puts arr.join\nend", "def take_a_number(katz_deli, name)\n katz_deli.push(name)\n# return the person's name along with their position in line by using the hashtag, swingly brackets to call every arguement's iteration\n puts \"Welcome, #{name}. You are number #{katz_deli.length} in line.\"\nend", "def separate_comma(num_to_comma)\n str = num_to_comma.to_s\n count = str.length\n if count < 4\n p str\n elsif (count - 1) % 3 == 0\n while count > 1 do\n count = count - 3\n str.insert(count, \",\")\n end\n elsif (count - 2) % 3 == 0\n while count > 2 do\n count = count - 3\n str.insert(count, \",\")\n end\n elsif (count - 3) % 3 == 0\n while count > 3 do\n count = count - 3\n str.insert(count, \",\")\n end\n end\n p str\nend", "def process(line)\n rtn = []\n line.split(\"\").each do |char|\n \tif rtn[-1] == char\n \t\trtn << 2\n \telsif rtn[-1] == nil || rtn[-1].to_i == 0\n \t\trtn << char\n \telsif rtn[-2] == char\n \t\trtn[-1] += 1\n \telse\n \t\trtn << char\n \tend\n end\n return rtn.join\nend", "def pirates_say_arrrrrrrrr(string)\n \n arr = string.downcase.split('') # turning into an array and making lowercase\n \n index_no = arr.each_index.select { |r| arr[r] == 'r' } # finding the index no of each r\n \n new_index_no = index_no.map {|n| n + 1} # adding 1 to each index no\n \n p new_index_no.map {|i| arr[i] }.join # mapping the index no to the original arr and chaning to a str\n \nend", "def seperation\n puts \"-\" * 10\n end", "def take_a_number(deli, name)\n deli << name\n puts \"Welcome, #{name}. You are number #{deli.length} in line.\"\nend", "def take_a_number(deli,customer)\n deli << customer\n line_number = deli.length\n puts \"Welcome, #{customer}. You are number #{line_number} in line.\"\nend", "def balance(scanner, start, finish, count = 0)\n str = ''\n scanner = Sass::Util::MultibyteStringScanner.new(scanner) unless scanner.is_a? StringScanner\n regexp = Regexp.new(\"(.*?)[\\\\#{start.chr}\\\\#{finish.chr}]\", Regexp::MULTILINE)\n while scanner.scan(regexp)\n str << scanner.matched\n count += 1 if scanner.matched[-1] == start\n count -= 1 if scanner.matched[-1] == finish\n return [str, scanner.rest] if count == 0\n end\n end", "def name_parts(namething, count)\n parts = namething.split(\" \")\n first_name_count = parts.count - count\n return nil if count < 1\n { given: parts.first(first_name_count).join(\" \"), family: parts.last(count).join(\" \") }\n end", "def kaprekar(input)\n\t\tdef aux (input, count)\n\t\t\tif input == 6174\n\t\t\t\tcount\n\t\t\telse\n\t\t\t\tcount += 1\n\t\t\t\tarray = input.to_s.split(\"\").sort\n\t\t\t\tasc_number = array.join.to_i\n\t\t\t\tdesc_number = array.reverse.join.to_i\n\t\t\t\taux(desc_number - asc_number, count)\n\t\t\tend\n\t\tend\n\t\taux(input, 0)\n\tend", "def DashInsert(num)\n\n num.to_s.gsub(/[13579]{2,}/){|x| x.split('').join(\"-\")}\n \nend", "def extract_string(range, strscan); end", "def how_many_stars(size, line_count, stars)\n case\n when line_count == 1\n stars\n when line_count <= size / 2 + 1\n stars + '**'\n else\n stars[0..-3]\n end\nend", "def counter_effect(hit_count)\n hit_count.chars.map { |i| (0..i.to_i).to_a }\nend", "def get_tabs(tab_count)\n return \"\" if(tab_count < 0)\n return \"\\t\" * tab_count\nend", "def word_count(text, len)\r\n words, strays = text.length.divmod(len)\r\n words += 1 if strays > 0\r\n pad = \"X\" * (len - strays)\r\n return [words, pad]\r\n end", "def separate_comma(i)\n num = i.to_s\n if num.length % 3 == 0 && num.length > 3\n (num.length - 3).step(3, -3) {|v| num.insert(v, \",\")}\n elsif num.length > 3\n (num.length - 3).step(0, -3) {|v| num.insert(v, \",\")}\n end\n num\nend", "def priority_star(count)\n foo = ''\n count.times { foo << '*'}\n return foo\n end", "def get_cell_counts(array=\"\")\n cell_counts = array.split(\",\")\n cell_counts.shift\n return cell_counts\n end", "def append_to_list(found_list, index_num)\r\n\tputs (\"#{(found_list[index_num][6]+', '+found_list[index_num][7]).truncate(25).ljust(25, \" \")} #{found_list[index_num][1].truncate(40).ljust(40,\" \")} #{found_list[index_num][3].truncate(15).ljust(15,\" \")} #{found_list[index_num][0].to_s.truncate(5).ljust(5,\" \")} #{found_list[index_num][4]}\")\t\r\nend", "def input_to_index(position)\nindex = position.strip.to_i - 1\nreturn index\nend", "def print_separator(repetitions = 18)\n puts '-' * repetitions\nend", "def take_a_number(katz_deli, person)\n katz_deli.push(person)\n new_person_in_line = \" \"\n katz_deli.each_with_index do |item,index|\n new_person_in_line = \"Welcome, #{item}. You are number #{index + 1} in line.\"\n end\n puts new_person_in_line\n end", "def sentence_maker(a_single_argument)\n items = a_single_argument.count.to_i\n output = a_single_argument.values_at(0..(items-1)).join(\" \").capitalize\n return output + \".\"\nend", "def stringy(size, digit = 1)\n words = []\n size.times do\n words << digit\n digit = digit == 1 ? 0 : 1\n end\n words.join\nend", "def take_a_number(the_deli, name)\n the_deli << \"#{name}\" #names to be added into the_deli array\n puts \"Welcome, #{name}. You are number #{the_deli.length} in line.\"\nend", "def single_numbers\n text, ary = parse_text, [] \n until text.empty?\n top, mid, bot, blank = text.shift(4)\n ary.push(*top.zip(mid, bot).map(&:join)) \n ary.push(\",\") unless text.empty? # add comas when input entered on multiple lines\n end\n ary\n end", "def display_count(count)\n if count == 1\n #\"\"\n else\n count.to_s\n end\n end", "def separate_comma(number)\n new_array = number.to_s.reverse.split(\"\")\n count = 0\n new_array.each do |x|\n count += 1\n if count >= 4\n x << \",\" unless count == 3 || count == 5 || count == 6 || count > 7\n end\n end\n new_array.reverse.join\nend", "def DashInsert(num)\n\n # step1: convert the integer to a string\n # step2: determine whether a number is odd or not and grab index \n # step3: insert a dash after it \n\n num.scan(/[13597]{2}|.+/).join(\"-\")\n # num_arr = num.to_s\n # num_arr.each_char do |n|\n # \tif n % 3 = 0 \n # \t\tstr.insert(i+1, '-')\n # \tend\n # end\n # code goes here \n \nend", "def add_length(str)\n q=[]\n str.split(' ').each {|x| q<<x+\" \"+x.size.to_s}\n q\nend", "def text(text)\n (0..text.length).each do |x|\n \n end\nend", "def pnum cel\n number = cel.gsub(' ', '').gsub('(', '').gsub(')', '')\n end", "def show_game_title(title)\n formatted_title = '| ' + title + ' |'\n dashes = '-' * formatted_title.length\n puts dashes\n puts formatted_title\n puts dashes\nend", "def show_game_title(title)\n formatted_title = '| ' + title + ' |'\n dashes = '-' * formatted_title.length\n puts dashes\n puts formatted_title\n puts dashes\nend", "def separate(string)\n index = string.index ' '\n number = string.slice(0..index - 1).to_i\n [number, string.slice(index..-1).lstrip]\n end", "def take_a_number(deli, name)\n deli.push(name)\n puts \"Welcome, #{name}. You are number #{deli.count} in line.\"\nend", "def indent(str, count = 2)\n str = require_string! str\n pre = ' ' * count\n\n map_lines(str) { |line| \"#{pre}#{line}\" }\n end", "def staircase(n)\r\n # Write your code here\r\n empty = \" \"\r\n value = \"#\"\r\n n.times do |num|\r\n \tnumber = num + 1\r\n first = empty*(n-number).abs\r\n second = value*number\r\n puts first+second\r\n end\r\nend", "def separate_comma(pos_int)\n string = pos_int.to_s\n case pos_int\n when 0..999\n p string\n\n when 1000..999999\n p string.insert(-4,\",\")\n\n when 1000000..99999999\n p string.insert(-4,\",\").insert(-8,\",\")\n end\n\nend", "def black_spot(line)\n parts = line.chomp.split(\"|\")\n\n @names = parts[0].split(\" \")\n @count = parts[1].strip.to_i\n\n until @names.length == 1\n current_index = 0\n until @count == current_index\n @names.each_with_index do |name, index|\n current_index += 1\n if current_index == @count\n @names.delete_at(index)\n break\n end\n end\n end\n end\n\n puts @names[0]\n\nend", "def separator(num_of_astrsk = 24)\n $report_file.puts(\"*\" * num_of_astrsk)\nend", "def slices(count)\n raise ArgumentError, 'Argument given greater than original string' if count > @string_number.length\n numbers = @string_number.chars.map(&:to_i)\n\n numbers.each_index.with_object([]) do |index, slices|\n break slices if index > (numbers.size - count)\n slices << numbers[index, count]\n end\n end", "def scan_for_space(token); end", "def list_title(n=40)\n st = title[0..n].to_s\n st += \"...\" unless title.length <= n\n st\n end", "def tab(str, n=1, chr=' ')\n chr * n + str\nend", "def repeater(text)\n double_string = ''\n text.each_char { |char| double_string << char * 2 }\n double_string\nend", "def repeat(text , num=2)\n #text = text.chars\n val = \"\"\n i = 0\n for i in (1..num)\n val = text + \" \"+ val\n end\n return val.rstrip\n \nend", "def nhs_numberize\n return self unless length == 10\n self[0..2] + ' ' + self[3..5] + ' ' + self[6..9]\n end", "def tab(n, *string)\r\n string.each_with_index { |e, i| i == 0 ? (puts \" \" * n + e) : (puts e) }\r\n end", "def count(string)\n new_string = string.gsub(/[ ]/, '')\n new_string.size\nend" ]
[ "0.61809474", "0.6026715", "0.58224976", "0.5754692", "0.57150304", "0.5704381", "0.5620178", "0.56109375", "0.55700773", "0.5554574", "0.55437994", "0.5532034", "0.5523816", "0.5520819", "0.5513871", "0.5506417", "0.55036277", "0.5502637", "0.54989904", "0.5495267", "0.54837865", "0.54670465", "0.5463012", "0.5460839", "0.5453949", "0.5432292", "0.5430802", "0.5430802", "0.5413752", "0.5397836", "0.5395317", "0.5394961", "0.5376156", "0.53725576", "0.53716856", "0.5356803", "0.53364533", "0.5332758", "0.5328092", "0.53246546", "0.53154165", "0.5314723", "0.5314723", "0.5312922", "0.5306643", "0.530115", "0.52941585", "0.5294119", "0.52939934", "0.52915144", "0.5291449", "0.528148", "0.5281289", "0.52799326", "0.52763593", "0.52666885", "0.5261227", "0.52563345", "0.5252543", "0.52496594", "0.52468824", "0.52418476", "0.52400327", "0.5235159", "0.52347237", "0.5229832", "0.52176267", "0.52152205", "0.52134734", "0.52069825", "0.5205035", "0.52035856", "0.51984596", "0.519186", "0.51917857", "0.51917773", "0.51886374", "0.5188167", "0.51830703", "0.5180232", "0.5175672", "0.51747936", "0.51738214", "0.5173665", "0.5173665", "0.51724565", "0.51614136", "0.51591396", "0.5155137", "0.5154648", "0.5151009", "0.514813", "0.5146067", "0.5145214", "0.5143389", "0.5139897", "0.51391566", "0.5136935", "0.51368845", "0.51367086", "0.5135519" ]
0.0
-1
Expecting string: "A1:hit B10:miss" Processes the result, marks the field appropriately, changes the sequence of shots accordingly.
def process_shot_result(shot_result) shot_result.split(/:|\s/).each_slice(2) do |location, result| field[location] = result.to_sym has_hit(location) if field[location] == :hit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_protein_hit(str, desc, query_hits)\n data = str.split(\",\")\n ProteinHitFloatIndicies.each do |index|\n data[index] = data[index].to_f\n end\n data << desc\n data << query_hits\n \n ProteinHit.new(*data)\n end", "def parse_grimm(grimm_output)\n @grimm_output = grimm_output\n @parsed = {:rearrangements => []}\n parts = grimm_output.split('======================================================================')\n parts.first.split(/\\n/).each do |line|\n k, v = line.split(/:/, 2).map(&:strip)\n v.sub!(/\\s+\\(\\w+\\)$/, '') if k == \"Number of Chromosomes\"\n @parsed[k.downcase.gsub(' ', '_').to_sym] = v.match(/\\A[+-]?\\d+\\Z/) ? v.to_i : v\n end\n parts[2].split(/\\n/).each do |line|\n # Parse lines of the form:\n # Step 1: Chrom. 1, gene 587 [587] through chrom. 1, gene 591 [591]: Reversal\n next unless line =~ /^Step (\\d)+:/\n next if $1.to_i == 0\n m = line.match(/Chrom. (\\d+), gene (-?\\d+) \\[(-?\\d+)\\] through chrom. (\\d+), gene (-?\\d+) \\[(-?\\d+)\\]:([\\w ]+)/)\n @parsed[:rearrangements] << m.to_a.slice(1..-2).map(&:to_i).concat([m[-1].strip])\n end\n end", "def Process(text)\n text.to_str.gsub(/:\\(?([a-z0-9\\+\\-_]+)\\)?:/) do |match|\n\t \n # checks, if user wanted an animated smiley or not\n animated = false\n if (match.include?('(') && match.include?(')'))\n animated = true\n end\n\n # proposed image path, if image is locally available\n\tif animated\n local_image = File.join(Dir.pwd, 'public', 'smileys', 'animated', $1 + '.gif')\n else\n local_image = File.join(Dir.pwd, 'public', 'smileys', 'general', $1 + '.png')\n end\n\n # returns image tag, if image locally exists\n if File.exist?(local_image)\n ImageTag($1, animated)\n\n # image doesn't exists locally\n else\n # stores the image and returns image tag, if smiley is valid\n if SmileyExist($1, animated)\n ImageStore($1, animated)\n ImageTag($1, animated)\n else\n if animated\n '('+$1+')'\n else\n ':'+$1+':'\n end\n end\n end\n\n end\n end", "def _perform(text)\n lines = text.split(\"\\n\")\n lines.map! {|line|\n line.gsub(/\\[\\[(.)+\\]\\]/i){|found|\n /\\[\\[([a-z_]*): ([a-z_]*)\\]\\]/i =~ found\n _perform(self.send($1.to_sym, $2))\n }\n }\n lines.join(\"\\n\")\n end", "def process_data(data)\n puts '=' * 100\n puts data.class\n hash = {}\n data.split('&').each do |kv|\n key, value = kv.split('=')\n hash[key] = value\n end\n puts hash\n puts hash['glass'].chars.each_slice(10).to_a.reverse.map(&:join).join(\"\\n\")\n puts '-' * 100\n puts empty = hash['glass'].index(' ')\n puts hash['glass'][hash['x'].to_i+1]\n if hash['y'].to_i == 17\n @result = 'drop'\n return\n end\n if hash['figure'] = 'I'\n if hash['x'].to_i == empty\n @result = 'drop'\n else\n @result = \"left=#{hash['x'].to_i-empty}\"\n end\n else\n if (hash['x'].to_i == empty) && (hash['glass'][hash['x'].to_i + 1] == ' ')\n @result = 'drop'\n else\n @result = \"left=#{hash['x'].to_i-empty}\"\n end\n end\n\n # @result = 'drop'\n end", "def process_match(match,number)\n\t\tline = Hash[match.names.zip(match.captures)]\n\t\tline = Hash[line.map{|(k,v)| [k.to_sym,v]}]\n\t\tline[:type] = @line[:type]\n\t\tline[:index] = match[0].match(/^\\t{0,}/).to_s.length\n\t\tline[:number] = number\n\t\tline[:name] = 'div' and line[:type] = :tag if line[:type] == :tag_shorthand\n\t\t# attribute value to Hash\n\t\tline[:attribute] = recursive_string_to_hash(line[:attribute]) if line.key? :attribute\n\t\t# key values to String\n\t\t%w[bundle class name text value id_first id_last reset].each do |key|\n\t\t\tline[key.to_sym] = line[key.to_sym].to_s if line.key? key.to_sym\n\t\tend\n\t\t# key values to String.Strip!\n\t\t%w[text].each do |key|\n\t\t\tline[key.to_sym] = line[key.to_sym].strip! if line.key? key.to_sym\n\t\tend\n\t\t# bundle\n\t\tline[:bundle] = @line[:bundle] if line.key? :bundle and line[:bundle].to_s.length == 0\n\t\tif line[:type] == :mixin\n\t\t\tline[:bundle] = 'core' and line[:name] = line[:name][1..-1] if line[:name][0] == '.'\n\t\telsif line[:type] == :method\n\t\t\tline[:bundle] = 'core' if line[:bundle] == false\n\t\tend\n\t\t# class\n\t\tif line.key? :class and line[:class].length > 0\n\t\t\tline[:class] = '.' + line[:class]\n\t\t\tline[:attribute][:class] = line[:class].split('.').join(' ').strip!\n\t\t\tline.delete(:class)\n\t\tend\n\t\t\n\t\t# close \n\t\tline[:close] = %w(tag self none)[line[:close].to_s.length].to_sym if line.key? :close\n\t\t# id\n\t\tif line.key? :id_first and line[:id_first].length > 0\n\t\t\tline[:attribute][:id] = line[:id_first]\n\t\telsif line.key? :id_last and line[:id_last].length > 0\n\t\t\tline[:attribute][:id] = line[:id_last]\n\t\tend\n\t\tline.delete(:id_first) if line.key? :id_first\n\t\tline.delete(:id_last) if line.key? :id_last\n\t\t# reset\n\t\tline[:reset] = line[:reset].to_s.length == 0 ? false : true if line.key? :reset\n\t\t# return sorted Hash\n\t\tHash[line.sort]\n\tend", "def insert_answer insert \n @text.scan(@regex){|match| \n m=match.join(\" \")\n if m.include?(\":\")\n k=m.split(\":\")[0]\n @map[k]=insert\n end\n }\n @text.sub!(@regex, insert)\n insert_next\nend", "def hit_string\n # Return hex value\n [@hit.to_s].pack(\"H*\").gsub(\"\\n\", \"\")\n end", "def genome(liszt)\n=begin\n[samopen] SAM header is present: 2 sequences\n7621912 reads; of these:\n 4009241 (52.60%) were paired; of these:\n 1983557 (49.47%) aligned concordantly 0 times\n 1818685 (45.36%) aligned concordantly exactly 1 time\n 206999 (5.16%) aligned concordantly >1 times\n ----\n 1983557 pairs aligned concordantly 0 times; of these:\n 409503 (20.64%) aligned discordantly 1 time\n ----\n 1574054 pairs aligned 0 times concordantly or discordantly; of these:\n 3148108 mates make up the pairs; of these:\n 1009275 (32.06%) aligned 0 times\n 35392 (1.12%) aligned exactly 1 time\n 2103441 (66.82%) aligned >1 times\n 3612671 (47.40%) were unpaired; of these:\n 498719 (13.80%) aligned 0 times\n 2246121 (62.17%) aligned exactly 1 time\n 867831 (24.02%) aligned >1 times\n=end\n #puts(liszt);exit\n dict={}; liszt.shift\n dict[\"total\"]=liszt.shift.split[0]; #liszt.shift\n dict[\"paired\"]=liszt.shift.split[0]; liszt.shift #conc 0\n dict[\"conc_once\"]=liszt.shift.split[0]\n dict[\"conc_mult\"]=liszt.shift.split[0]\n liszt.shift(2); dict[\"disc_once\"]=\"\"; dict[\"disc_mult\"]=\"\"\n line=liszt.shift\n line.include?(\">1 times\") ? dict[\"disc_mult\"]=line.split[0] : dict[\"disc_once\"]=line.split[0]\n liszt.shift\n dict[\"unaligned_pairs\"]=liszt.shift.split[0]\n liszt.shift\n dict[\"unmates\"]=liszt.shift.split[0] #unaligned mates\n dict[\"mate_once\"]=liszt.shift.split[0]\n dict[\"mate_mult\"]=liszt.shift.split[0]\n dict[\"unpaired\"]=liszt.shift.split[0]\n dict[\"unpair_unaligned\"]=liszt.shift.split[0]\n dict[\"unpair_once\"]=liszt.shift.split[0]\n dict[\"unpair_mult\"]=liszt.shift.split[0]\n dict\nend", "def parry\n\t new_text = @text.split(\"\").to_a\n\t \n\t # Find their arm markers\n\t\tmarker1 = @text.index(\"@\")\n\t\tmarker2 = @text[marker1 + 1..@text.size].index(\"@\") + @text[1..marker1 + 1].size\n\t\t# 'Move' their arms\n\t\tnew_text[marker1 + 1] = change [\"/\",\"|\",\"_\"], @text[marker1 + 1]\n\t\tnew_text[marker2 + 1] = change [\"\\\\\",\"|\",\"_\"], @text[marker2 + 1]\n \n # Find their leg markers\n\t\tmarker1 = @text.index(\"$\")\n\t\tmarker2 = @text[marker1 + 1..@text.size].index(\"$\") + @text[1..marker1 + 1].size\n\t\tmarker3 = @text[marker2 + 1..@text.size].index(\"$\") + @text[1..marker2 + 1].size\n marker4 = @text[marker3 + 1..@text.size].index(\"$\") + @text[1..marker3 + 1].size\n # 'Move' their legs\n new_text[marker1 + 1] = change [\"/\",\"|\"], @text[marker1 + 1]\n new_text[marker2 + 1] = change [\"\\\\\",\"|\"], @text[marker2 + 1]\n new_text[marker3 + 1] = change [\"/\",\"|\"], @text[marker3 + 1]\n new_text[marker4 + 1] = change [\"\\\\\",\"|\"], @text[marker4 + 1]\n \n\t\t@text = new_text.join\n\tend", "def parse_input attack_details\n attack_details_arr = attack_details.split(\":\")\n attack_details_arr.each do |attack_detail|\n tribal, direction, tribal_strength = attack_detail.split(\" - \")\n attacked?(tribal_strength.to_i, direction) ? @@attack_count += 1 : 0\n end\n rebuild_wall(attack_details_arr)\n print_outcome\n end", "def analyze_fragment(data)\n\t\t\n\t\tfrags = []\t\t\n\n\t\tputs \"analyze fragment\"\n\t\t# there should only be two entries in the hash, we want data[0][seq:] & data[1][seq:]\n\t\tputs \"--AF:#{data[0][\"src\"]}\"\n\t\tputs \"--AF:#{data[0][\"src\"]}|#{data[0][\"start\"]}|#{data[0][\"strand\"]}\"\n\t\toffset = 0\n\t \twhile data[0][\"seq\"].index('-'*@cut_off, offset) != nil\n\t\t\tstart = data[0][\"seq\"].index('-'*@cut_off, offset)\n\t\t\t# this is the start in the string, not the true location of the insert in the sequence\n\t\t\t# to calculate this, need to count how many inserts (i.e. '-' are in the preceding string)\n\t\t\t# puts \"preceding string length#{data[0][\"seq\"][0..start-1].length}:start shifts from #{start}-->#{start - data[0][\"seq\"][0..start-1].count(\"-\")}: del #{data[0][\"seq\"][0..start-1].count(\"-\")}\"\n\n\t\t\ttrue_start = start - data[0][\"seq\"][0..start-1].count(\"-\")\n \t\t\t# puts \"--HIT:#{data[0][\"seq\"].index('-'*@cut_off, offset)}|#{offset}|#{data[0][\"seq\"][offset]}\"\n\t\t\t# get length of insert\n\t\t\toffset = start + @cut_off + 1\n\t\t\twhile data[0][\"seq\"][offset] == '-' \n\t\t\t\toffset+=1\n\t\t\tend\n\t\t\tputs \"---- #{ data[0][\"src\"]} insert runs from #{data[0][\"start\"]+start+1}(#{start+1}) to #{data[0][\"start\"]+offset }(#{offset})-->#{ data[0][\"label\"]}\"\n\t\t\tfrags << {\"src\" => data[0][\"src\"], \"true_start\" => data[1][\"start\"]+true_start+1, \"start\" => data[0][\"start\"]+start+1, \"stop\" => data[0][\"start\"]+offset, \"strand\" => data[0][\"strand\"], \"label\" => data[0][\"label\"]}\n\t\tend\n\n\n puts \"--AF:#{data[1][\"src\"]}|#{data[1][\"start\"]}|#{data[0][\"strand\"]}\"\n offset = 0\n while data[1][\"seq\"].index('-'*@cut_off, offset) != nil\n start = data[1][\"seq\"].index('-'*@cut_off, offset)\n\t\t\ttrue_start = start - data[1][\"seq\"][0..start-1].count(\"-\")\n # puts \"--HIT:#{data[0][\"seq\"].index('-'*@cut_off, offset)}|#{offset}|#{data[0][\"seq\"][offset]}\"\n # get length of insert\n offset = start + @cut_off + 1\n while data[1][\"seq\"][offset] == '-'\n offset+=1\n end\n puts \"---- #{ data[1][\"src\"]} insert runs from #{data[1][\"start\"]+start+1}(#{start+1}) to #{data[1][\"start\"]+offset }(#{offset})\"\n\t\t\tfrags << {\"src\" => data[1][\"src\"], \"true_start\" => data[1][\"start\"]+true_start+1, \"start\" => data[1][\"start\"]+start+1, \"stop\" => data[1][\"start\"]+offset, \"strand\" => data[1][\"strand\"], \"label\" => data[1][\"label\"]}\n\t\tend\n\n\t\tfrags\n\n\tend", "def parse_peptide_hit(str, terms)\n return nil if str == nil || str == \"-1\"\n \n peptide_data, protein_maps = str.split(\";\", 2)\n protein_maps = protein_maps.split(\",\")\n terms = terms.split(\":\")\n \n # parse peptide data\n peptide_data = peptide_data.split(\",\")\n \n PeptideHitFloatIndicies.each do |index|\n peptide_data[index] = peptide_data[index].to_f\n end\n \n PeptideHitIntIndicies.each do |index|\n peptide_data[index] = peptide_data[index].to_i\n end\n\n # parse protein_map data\n protein_maps = protein_maps.zip(terms).collect do |map_data, terms|\n data = map_data.split(\":\") + terms.split(',')\n \n # removes quotes from protein id\n data[0] = data[0][1...-1]\n \n ProteinMapIntIndicies.each {|index| data[index] = data[index].to_i }\n ProteinMap.new(*data)\n end\n \n peptide_data << protein_maps\n PeptideHit.new(*peptide_data)\n end", "def protein_hit(hit)\n key = \"h#{hit}\"\n return nil unless str = data[key]\n @protein_hits[hit] ||= parse_protein_hit(str, data[\"#{key}_text\"], query_hits(hit))\n end", "def parse_move(move)\n #Is this enough of a repetition for me to iterate? It seemed more\n #tedious for me to iterate in this situation\n from = [(8-(move[0][1].to_i)), ((\"a\"..\"h\").to_a.index(move[0][0]))]\n to = [(8-(move[1][1].to_i)), ((\"a\"..\"h\").to_a.index(move[1][0]))]\n [from, to]\n end", "def _parse_unit_output(line)\n line_match = /^\\[([AB])\\:([A-Z]+)\\#(\\d+)\\@(\\d+)\\](.*)$/.match line\n return nil unless line_match\n {\n :team => line_match[1],\n :unit_type => line_match[2],\n :unit_id => line_match[3].to_i,\n :round => line_match[4].to_i,\n :output => line_match[5]\n }\n end", "def fix_gags(hash_of_sequence_ids_to_sequence_strings, sequence_id_to_gags={})\n log = Bio::Log::LoggerPlus['bio-gag']\n \n # Get the gags\n if sequence_id_to_gags == {}\n log.info \"Predicting gags from the pileup\"\n gags do |gag|\n sequence_id_to_gags[gag.ref_name] ||= []\n sequence_id_to_gags[gag.ref_name].push gag\n end\n else\n log.info \"Using pre-specified GAG errors\"\n end\n log.info \"Found #{sequence_id_to_gags.values.flatten.length} gag errors to fix\"\n \n # Make sure all gag errors in the pileup map to a sequence input fasta file by keeping tally\n accounted_for_seq_ids = []\n fixed_sequences = {} #Hash of sequence ids to sequences without gag errors\n hash_of_sequence_ids_to_sequence_strings.each do |seq_id, seq|\n log.debug \"Now attempting to fix sequence #{seq_id}, sequence #{seq}\"\n toilet = sequence_id_to_gags[seq_id]\n if toilet.nil?\n # No gag errors found in this sequence (or pessimistically the sequence wasn't in the pileup -leaving that issue to the user though)\n fixed_sequences[seq_id] = seq\n else\n # Gag error found at least once somewhere in this sequence\n # Record that this was touched in the pileup\n accounted_for_seq_ids.push seq_id\n \n # Output the fixed-up sequence\n last_gag = 0\n fixed = ''\n toilet.sort{|a,b| a.position<=>b.position}.each do |gag|\n #log.debug \"Attempting to fix gag at position #{gag.position} in sequence #{seq_id}, which is #{seq.length} bases long\"\n fixed = fixed+seq[last_gag..(gag.position-1)]\n fixed = fixed+seq[(gag.position-1)..(gag.position-1)]\n last_gag = gag.position\n #log.debug \"After fixing gag at position #{gag.position}, fixed sequence is now #{fixed}\"\n end\n fixed = fixed+seq[last_gag..(seq.length-1)]\n fixed_sequences[seq_id] = fixed\n end\n end\n \n unless accounted_for_seq_ids.length == sequence_id_to_gags.length\n log.warn \"Unexpectedly found GAG errors in sequences that weren't in the sequence that are to be fixed: Found gags in #{sequence_id_to_gags.length}, but only fixed #{accounted_for_seq_ids.length}\"\n end\n return fixed_sequences\n end", "def initialize(text)\n @hits = []\n @all_hits = []\n overrun = ''\n text.each(\"\\n\\nseq1 = \") do |str|\n str = str.sub(/\\A\\s+/, '')\n str.sub!(/\\n(^seq1 \\= .*)/m, \"\\n\") # remove trailing hits for sure\n tmp = $1.to_s\n hit = Hit.new(overrun + str)\n overrun = tmp\n unless hit.instance_eval { @data.empty? } then\n @hits << hit\n end\n @all_hits << hit\n end\n @seq1 = @all_hits[0].seq1\n end", "def parse_line(str)\n _, color, rest = str.match(/^([\\w\\s]+) bags contain (.+)\\.$/).to_a\n containments = str.scan(/(\\d+) ([\\w\\s]+) bags?/).map { |count, color| Containment.new(color, count.to_i) }\n add(color, containments)\n end", "def process_line line\n if line.include?(\"@\") && @add_tags_to_main\n @nd[:main_tags] << line \n elsif line.include?(\"Feature:\")\n @nd[:feature] = line.sub(\"Feature:\",\"\")\n @add_tags_to_main = false\n elsif line.include?(\"Scenario:\")\n @nd[:scenarios].push({:name => line.sub(\"Scenario:\",\"\"), :steps => []})\n @add_to_s = true\n elsif\n begin\n @nd[:scenarios].last[:steps].push(line) if @add_to_s\n @add_to_s = true \n rescue\n end\n end\n end", "def reconstitute_step(step_text, table)\n @keep_hold_of_raw_table = table\n step_text+\":\"\nend", "def parse_move(str)\n case str[0]\n when \"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\"\n idx = str[0].to_i - 1\n from = @tableau[idx]\n case str[1]\n when \"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\"\n to = @tableau[str[1].to_i - 1]\n num = find_number(from,to)\n raise \"NOPE #{str}\" unless num\n when \"F\",\"f\"\n num = 1\n to = find_foundation(from)\n else\n puts \"try again #{str}\"\n end\n from.move(num, to)\n when \"D\", \"d\"\n if str.length == 2\n @stock.draw(@discard)\n else\n case str[1]\n when \"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\"\n to = @tableau[str[1].to_i-1]\n @discard.move(1, to)\n when \"F\",\"f\"\n to = find_foundation(@discard)\n @discard.move(1, to)\n else\n raise \"NOPE #{str}\"\n end\n end\n end\n end", "def parse_place\n s0 = @scanner.pos\n s1 = parse_num\n if s1 == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n s2 = parse_numkan\n if s2 == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n @reported_pos = s0\n s0 = { 'x' => s1, 'y' => s2 }\n end\n end\n if s0 == :failed\n s0 = @scanner.pos\n if match_regexp('同') == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n match_str(' ')\n @reported_pos = s0\n s0 = { 'same' => true }\n end\n end\n s0\n end", "def create_bad_scans_skip\n @index = self.short_description.index(\"skip ip\")\n @result = self.short_description[@index + 1, 22]\n @string = @result.gsub(/[skip:,]/,' ')\n @array = @string.split(/\\s*/)\n @skip_number = \"\"\n @array.each do |char|\n if(char==\"\")\n @skip_number.concat(\"\")\n elsif(char==\":\")\n @skip_number.concat(\"\")\n elsif(char==\",\")\n @skip_number.concat(\"\")\n else\n @skip_number.concat(char)\n end\n end\n self.skip = @skip_number.strip()\nend", "def test_hash_end_and_start\n\t\ttest_array1 = '2|abb2|George>Amina(16):Henry>James(4):Henry>Cyrus(17):Henry>Kublai(4):George>Rana(1):SYSTEM>Wu(100)|1518892051.753197000|c72d'.split('|').map(&:chomp)\n\t\ttest_array2 = '3|c72d|SYSTEM>Henry(100)|1518892051.764563000|7419'.split('|').map(&:chomp)\n\t\tassert_equal test_array2[1], test_array1[4]\n\tend", "def format_input(startState)\n state = Hash.new(false)\n for y in 0..$size - 1 # Because it goes line by line \"y\" comes first here\n for x in 0..$size - 1\n state[[x + 1, y + 1]] = true if startState[y].split(\"\")[x] == \"#\"\n end\n end\n return state\nend", "def parse_input (input_string)\n lines = input_string.split(/\\n/)\n\n state = :reading_map\n\n rover_x_start = 0\n rover_y_start = 0\n rover_facing_start = 0\n\n lines.each do |line|\n # drop empty lines\n next unless /(\\w)+/ =~ line\n\n case state\n when :reading_map\n match = /^\\s*(\\d+)\\s+(\\d+)\\s*$/.match(line)\n raise ArgumentError.new(\"Invalid map data >>#{line}<<\") unless match\n\n x_size = $1.to_i\n y_size = $2.to_i\n\n # the format is not the size, it's the greatest valid index\n init_map(x_size,y_size)\n\n state = :reading_rover_init\n\n when :reading_rover_init\n match = /^\\s*(\\d+)\\s+(\\d+)\\s+([NSWE])\\s*$/.match(line)\n # match = line.match /^\\s*(\\d+)\\s+(\\d+)\\s+([NSWE])\\s*$/\n raise ArgumentError.new(\"Invalid rover init >>#{line}<<\") unless match\n\n rover_x_start = $1.to_i\n rover_y_start = $2.to_i\n rover_facing_start = $3\n\n state = :reading_rover_instructions\n when :reading_rover_instructions\n match = /^\\s*([LRM]+)\\s*$/.match(line)\n raise ArgumentError.new(\"Invalid rover init >>#{line}<<\") unless match\n\n rover_instructions = $1\n\n add_rover(rover_x_start,rover_y_start,rover_facing_start,rover_instructions)\n\n state = :reading_rover_init\n end\n end\n\n end", "def parse_hms\n s0 = @scanner.pos\n s1 = match_digits!\n\n if s1 == :failed\n @scanner.pos = s0\n s0 = :failed\n elsif match_str(':') != :failed\n s3 = match_digits!\n if s3 == :failed\n @scanner.pos = s0\n s0 = :failed\n elsif match_str(':') != :failed\n s5 = match_digits!\n if s5 == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n @reported_pos = s0\n s0 = { 'h' => s1.join.to_i, 'm' => s3.join.to_i, 's' => s5.join.to_i }\n end\n else\n @scanner.pos = s0\n s0 = :failed\n end\n else\n @scanner.pos = s0\n s0 = :failed\n end\n s0\n end", "def cutinfo(string)\n inf=/\\024/=~string1\n inf=inf+2\n trans=string1[inf..-1]\nend", "def hit_or_miss (guess)\n\t\tguess === \"hit\"? \"X\" : \"0\";\n\tend", "def madlib(string)\n names = {}\n string.gsub /\\(\\(.*?\\)\\)/ do |token|\n a, b = *token[2...-2].split(':')\n if names.has_key? a\n names[a]\n elsif b\n names[a] = input(b)\n else\n input(a)\n end\n end\nend", "def initialize(str)\n str = str.sub(/\\A\\s+/, '')\n str.sub!(/\\n(^\\-\\-SPIDEY .*)/m, '') # remove trailing entries for sure\n @entry_overrun = $1\n data = str.split(/\\r?\\n(?:\\r?\\n)+/)\n d0 = data.shift.to_s.split(/\\r?\\n/)\n @hit = Hit.new(data, d0)\n @all_hits = [ @hit ]\n if d0.empty? or /\\ANo alignment found\\.\\s*\\z/ =~ d0[-1] then\n @hits = []\n else\n @hits = [ @hit ]\n end\n end", "def shift_metadata_for str\n meta, line = @metadata.first\n\n if line.nil? || line.empty? || line[0..0] == '#'\n @metadata.shift\n return meta if str.empty?\n end\n\n meta, line = @metadata.first\n\n if str.length > line.length\n\n while str.include? @metadata.first[1] do\n tmp_meta, line = @metadata.shift\n meta = tmp_meta if\n !meta || !meta[:updated_at] ||\n meta && meta[:updated_at] &&\n tmp_meta && tmp_meta[:updated_at] &&\n tmp_meta[:updated_at] > meta[:updated_at]\n end\n\n else\n @metadata.first[1] = line.split(str, 2).last.strip\n @metadata.first[1].gsub!(%r{^:(\\s+|$)}, \"\")\n end\n\n #puts \"#{str} -> #{meta.inspect}\"\n meta\n end", "def customer_hash_info(string)\n hash = {}\n i = 0 \n while i < string.length \n if string[i] == \":\"\n info = string[i-3] + string[i-2] + string[i-1]\n j = i + 1 \n information = \"\"\n until string[j] == \" \" || string[j] == \"\\n\"|| string[j].nil? \n information += string[j]\n j += 1 \n end \n hash[info] = information\n end\n i += 1 \n end \n return hash \nend", "def process_pgn_moves(arr_raw_pgn_move)\r\n #@color_on_turn = :white\r\n arr_raw_pgn_move.each do |move_str|\r\n \r\n if move_str == \"1-0\" or \r\n move_str == \"0-1\" or\r\n move_str == \"1/2-1/2\"\r\n @current_match.set_result(move_str)\r\n break\r\n end\r\n argument = trasform_pgn_move_inmymove(move_str)\r\n \r\n @current_match.add_pgn_move(move_str)\r\n @current_match.add_move(argument)\r\n \r\n do_the_move(argument)\r\n swap_color_on_turn\r\n end\r\n end", "def parse_map(data: \"\", type: \"new\")\r\n if data.empty? then return end\r\n if type == \"level\" || type == \"attract\" then type = \"new\" end\r\n case type\r\n when \"new\"\r\n tiles = data[0..965].split(//).map{ |b| b.hd }.each_slice(COLUMNS).to_a\r\n object_counts = data[966..1045].scan(/../).map{ |s| s.reverse.hd }\r\n objects = data[1046..-1].scan(/.{5}/m).map{ |o| o.chars.map{ |e| e.hd } }\r\n when \"old\"\r\n data = data[8..-1]\r\n tiles = data[0..1931].scan(/../).map{ |b| b.reverse.to_i(16) }.each_slice(COLUMNS).to_a\r\n objs = data[1932..-1]\r\n objects = []\r\n OBJECTS.sort_by{ |id, o| o[:old] }.reject{ |id, o| o[:old] == -1 }.each{ |id, type|\r\n if objs.length < 4 then break end\r\n quantity = objs[0..3].scan(/../).map(&:reverse).join.to_i(16)\r\n objs[4 .. 3 + 2 * quantity * type[:att]].scan(/.{#{2 * type[:att]}}/).each{ |o|\r\n if ![3,6,8].include?(id) # everything else\r\n objects << [id] + o.scan(/../).map{ |att| att.reverse.to_i(16) }.ljust(4,0)\r\n else # door switches\r\n atts = o.scan(/../).map{ |att| att.reverse.to_i(16) }\r\n objects << [id] + atts[0..-3].ljust(4,0) # door\r\n objects << [id + 1] + atts[-2..-1].ljust(4,0) # switch\r\n end\r\n }\r\n objs = objs[4 + 2 * quantity * type[:att]..-1]\r\n }\r\n end\r\n {tiles: tiles, objects: objects.stable_sort_by{ |o| o[0] }}\r\nrescue\r\n #print(\"ERROR: Incorrect map data\\n\")\r\n return nil\r\nend", "def parse_map(data: \"\", type: \"new\")\n if data.empty? then return end\n if type == \"level\" || type == \"attract\" then type = \"new\" end\n case type\n when \"new\"\n tiles = data[0..965].split(//).map{ |b| b.hd }.each_slice(COLUMNS).to_a\n object_counts = data[966..1045].scan(/../).map{ |s| s.reverse.hd }\n objects = data[1046..-1].scan(/.{5}/m).map{ |o| o.chars.map{ |e| e.hd } }\n when \"old\"\n data = data[8..-1]\n tiles = data[0..1931].scan(/../).map{ |b| b.reverse.to_i(16) }.each_slice(COLUMNS).to_a\n objs = data[1932..-1]\n objects = []\n OBJECTS.sort_by{ |id, o| o[:old] }.reject{ |id, o| o[:old] == -1 }.each{ |id, type|\n if objs.length < 4 then break end\n quantity = objs[0..3].scan(/../).map(&:reverse).join.to_i(16)\n objs[4 .. 3 + 2 * quantity * type[:att]].scan(/.{#{2 * type[:att]}}/).each{ |o|\n if ![3,6,8].include?(id) # everything else\n objects << [id] + o.scan(/../).map{ |att| att.reverse.to_i(16) }.ljust(4,0)\n else # door switches\n atts = o.scan(/../).map{ |att| att.reverse.to_i(16) }\n objects << [id] + atts[0..-3].ljust(4,0) # door\n objects << [id + 1] + atts[-2..-1].ljust(4,0) # switch\n end\n }\n objs = objs[4 + 2 * quantity * type[:att]..-1]\n }\n end\n {tiles: tiles, objects: objects.sort_by{ |o| o[0] }}\nrescue\n print(\"ERROR: Incorrect map data\\n\")\n return {tiles: [], objects: []}\nend", "def declare(map, start, string)\n count = start\n string.split(\" \").each do |token|\n map[token] = count\n count += 1\n end\nend", "def create_run_code\n @index = self.short_description.index(\"ip\")\n @end_index = self.short_description.index(\"and bin_id\")\n @result = self.short_description[@index + 1, @end_index - @index]\n @string = @result.gsub(/[ipa:,]/,' ')\n @array = @string.split(/\\s*/)\n @prod_run_code =\"\"\n @array.each do |char|\n if(char==\":\")\n @prod_run_code.concat(\"\")\n elsif(char==\"\")\n @prod_run_code.concat(\"\")\n elsif(char==\",\")\n @prod_run_code.concat(\"\")\n else\n @prod_run_code.concat(char)\n end\n end\n self.run_code = @prod_run_code.strip()\nend", "def processHits(hits, buffer)\n result = []\n puts \"Hits = #{hits}\"\n ptr = buffer.unpack(\"I*\")\n # Hit records are variable length. First element is the record length,\n # then the z-indexes, finally the name stack.\n p = 0\n for i in 0...hits\n name_count = ptr[p]\n z1 = ptr[p + 1].to_f / 0xffffffff\n z2 = ptr[p + 2].to_f / 0xffffffff\n names = ptr[p + 3, name_count]\n p += 3 + name_count;\n\n #puts \" number of names for hit = #{name_count}\"\n #puts \" z1 is #{z1}\"\n #puts \" z2 is #{z2}\"\n #puts \"Names = \" + names.inspect\n \n result << names\n end\n result\n end", "def modify_opponent_field_map index, move\n\t\thit = index == 10 ? \"#{Symbols::HIT} \" : Symbols::HIT\n\t\tmiss = index == 10 ? \"#{Symbols::MISS} \" : Symbols::MISS\n\t\t@opponent_field_map[index] = move.hit ? hit : miss\n\tend", "def has_hit(hit)\n asap = []\n asap.push hit.to_left, hit.to_left.to_left if field[hit.to_right] == :hit\n asap.push hit.to_right, hit.to_right.to_right if field[hit.to_left] == :hit\n asap.push hit.to_up, hit.to_up.to_up if field[hit.to_dn] == :hit\n asap.push hit.to_dn, hit.to_dn if field[hit.to_up] == :hit\n if asap.empty?\n # Force shooting around\n asap = [ hit.to_left,\n hit.to_right,\n hit.to_up,\n hit.to_dn\n ].reject { |l| l.nil? } \n end\n asap.each { |l| @shot_queue.push l }\n end", "def parse_hot \n eva = ''\n col = @row.split('%')\n return false if col.size==1\n (col.size-1).downto(0) do |c|\n eva = \"%#{col[c]}\" << eva\n @rg_hot.each do |ht|\n if(ht =~ eva;@rgx = $~)\n @key = @rgx[2]\n prms = @rgx[3].to_s.strip\n if /^\\!/ =~ @key\n @new = (multi_end2(nil)+@spc+@rgx.to_s.gsub('%!','%')).split(\"\\n\")\n swap_last_empt_src_with_end_tg(@new) #@new array of src\n @row = ''\n else\n nameidclass_var()\n # Auto closing, see in \"erb.hot\": _elsif _else:\n # when last doc out is <% end %> and hot command is %_elsif or %_else\n # then remove the last doc out <% end %>\n if @doc_out[-1] and @doc_out[-1].strip=='<% end %>'\n @doc_out.pop if %w[else elsif].include? prms.split(' ')[0]\n end\n params_inline prms #concenation line if params end with \\\n @mem_var[\"$tag\"] = @key\n if @tg_hot[@key]\n hots = @tg_hot[@key] \n hots[1]='' if !hots[1] #remark if not error!\n @new = hots[0].call(self).clone \n if @new.strip==\"\" #&& @tg_end[-1]\n @tg_end << \"#{@spc}#{hots[1][0]}\"\n empt = @row.gsub!(@rgx.to_s,\"\").strip\n @row = empt if empt == \"\" #remove if empty (only \\t,\\n)\n else\n @tg_end << \"#{@spc}#{hots[1][0]}\" if hots[1]\n @new.gsub!(/( *~\\^.*[^\\n]+)/,\"^~^~^\")\n setvar = $1 # don't parse SetMem ~^\n @new.gsub!(/\\n/,\"\\n#{@spc}\")\n get_dollar(prms,hots[1]) \n @new.gsub!(/\\^~\\^~\\^/,setvar) if setvar #restore SetMem\n re_indent(@rgx.to_s)\n end\n p \"Func>> #{@new}\" if @dbg[:parse]\n else\n @row.gsub!(@rgx.to_s,\"<!-- no hot for:#{@key} -->\")\n end\n end\n break\n end\n end\n break if @rgx\n end\n @rgx!=nil\n end", "def process_pgn_moves(arr_raw_pgn_move)\n #@color_on_turn = :white\n arr_raw_pgn_move.each do |move_str|\n \n if move_str == \"1-0\" or \n move_str == \"0-1\" or\n move_str == \"1/2-1/2\"\n @current_match.set_result(move_str)\n break\n end\n argument = trasform_pgn_move_inmymove(move_str)\n \n @current_match.add_pgn_move(move_str)\n @current_match.add_move(argument)\n \n do_the_move(argument)\n swap_color_on_turn\n end\n end", "def process(dfstr)\n tracelog {\"process(commands, input).\"}\n #\"\"\"Filesystem Size Used Avail Use%\n # /dev/grid/node-x0-y0 92T 73T 19T 79%\"\"\"\n linect = 0\n nodes = {}\n dfstr.each_line do |line|\n linect += 1\n line = line.chomp.chomp\n tracelog { \"read-line #{linect}: #{line}\" }\n if md = (/^\\/dev\\/grid\\/node\\-x(\\d+)\\-y(\\d+) +(\\d+)T +(\\d+)T +(\\d+)T +(\\d+)%$/.match line) #md = (/^\\/dev\\/grid\\/node\\-x(\\d+)\\-y(\\d+) +(\\d+) +(\\d+) +(\\d+) +(\\d+)%$/.match line)\n x = md[1].to_i\n y = md[2].to_i\n siz = md[3].to_i\n usd = md[4].to_i\n ava = md[5].to_i\n prc = md[6].to_i\n key = \"#{x},#{y}\"\n nodes[key] = {:size=>siz, :used=>usd, :avail=>ava, :useperc=>prc}\n tracelog {\"node[#{key}]=#{nodes[key]}\"}\n else\n deblog {\" skipped line ##{linect} #{line}.\"}\n end\n end\n deblog {\"#nodes=#{nodes.size} of #lines=#{linect}\"}\n \n viabpairnum = 0\n nodes.each do |a_key, a_vals|\n nodes.each do |b_key, b_vals|\n #next if a_key == b_key\n if a_vals[:used] > 0 && a_key != b_key && a_vals[:used] <= b_vals[:avail]\n tracelog {\"viable pair: A=#{a_key}, used=#{a_vals[:used]}; B=#{b_key}, avail=#{b_vals[:avail]}\"}\n viabpairnum += 1\n end\n end\n end\n viabpairnum\nend", "def digester(string, missed_cleavages) # Returns an array of chomped sequences\n\tstring.upcase!\n\tarr = (0..(string.upcase.length-1)).map {|i| string[i]}\n\tmisses = 0; splits = []\n\t(0..missed_cleavages).each do |miss_cleav|\n\t\t(0..missed_cleavages).each do |init_num|\n\t\t\tlast, curr, next_item = nil, nil, nil; keeper = \"\"\n\t\t\tmisses = init_num\n\t\t\tarr.each_index do |i|\n\t\t\t\tlast = arr[i-1]; curr = arr[i]; next_item = arr[i+1]\n\t\t#\tputs \"last, curr, next: #{last}, #{curr}, #{next_item}\"\n\t\t\t\tkeeper << curr if curr\n\t\t#\tputs \"keeper: #{keeper}\"\n\t\t\t\tif curr == 'R' or curr == 'K'\n\t\t\t\t\tunless next_item == \"P\"\n\t\t#\t\t\t\tputs \"misses:missed cleavages\t\t\t#{misses}:#{miss_cleav}\"\n\t\t\t\t\t\tif misses < miss_cleav\n\t\t\t\t\t\t\tmisses += 1\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tsplits << keeper\n\t\t\t\t\t\t\tkeeper = \"\";\tmisses = 0\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tsplits << keeper if next_item == nil\n\t\t#\t\tputs \"Splits looks like: #{splits}\"\n\t\t\tend\n\t\tend\t\t\t\n\tend\n\tsplits.uniq\nend", "def split(data, string_to_split)\n word = data.scan(/\"#{string_to_split}\":\"([\\S\\s]*?)\"/)\n string = word.split('\"]').join('').split('[\"').join('')\n return string\n end", "def parse_gamename_turn(str)\n if str =~ /^(.+)-\\d+-\\d+F?-(\\w)$/\n case $2\n when \"b\",\"B\"\n return [str[0, str.length-2], \"+\"]\n when \"w\",\"W\"\n return [str[0, str.length-2], \"-\"]\n end\n end\n return false\n end", "def process_line line\n\tcase line\n\n\twhen /^([a-z]+) is ([I|V|X|L|C|D|M])$/\n\t\tset_space_unit($1, $2)\n\n\twhen /^([a-z ]+)([A-Z]\\w+) is (\\d+) Credits$/\n\t\tget_metals_value($1.split, $2, $3)\n\n\twhen /^how much is ((\\w+ )+)\\?$/ # Get space_units and convert to numeral\n\t\tres = get_numeral_from_space_unit($1.split)\n\t\tputs \"#{$1}is #{res}\"\n\n\twhen /^how many Credits is ([a-z ]+)([A-Z]\\w+) \\?$/\n\t\tres = (get_numeral_from_space_unit($1.split) * @metals_values[$2]).to_i\n\t\tputs \"#{$1}#{$2} is #{res} Credits\"\n\n\telse\n\t\tputs \"I have no idea what you are talking about\"\n\tend\nend", "def print_hangman(mistakes)\n puts @status_image[mistakes]\n end", "def shot(count)\n shots = (1..count).map do\n next_target || 'A1' # Out of shots already, just satisfy min-shots requirement\n end * ' '\n shots\n end", "def parse_line\n s0 = @scanner.pos\n match_spaces\n s2 = parse_te\n if s2 == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n match_spaces\n s4 = @scanner.pos\n s5 = parse_fugou\n if s5 == :failed\n @scanner.pos = s4\n s4 = :failed\n else\n s6 = parse_from\n if s6 == :failed\n @scanner.pos = s4\n s4 = :failed\n else\n @reported_pos = s4\n s4 = transform_teban_fugou_from(s2, s5, s6)\n end\n end\n if s4 == :failed\n s4 = @scanner.pos\n s5 = []\n s6 = match_regexp(/[^\\r\\n ]/)\n while s6 != :failed\n s5 << s6\n s6 = match_regexp(/[^\\r\\n ]/)\n end\n @reported_pos = s4\n s4 = s5.join\n end\n if s4 == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n match_spaces\n s6 = parse_time\n s6 = nil if s6 == :failed\n match_str('+')\n if parse_nl == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n @reported_pos = s0\n s0 = { 'move' => s4, 'time' => s6 }\n end\n end\n end\n s0\n end", "def parse_query_hit(str, terms)\n return nil if str == nil || str == \"-1\"\n \n data = str.split(\",\") + terms.split(\",\")\n QueryHitFloatIndicies.each do |index|\n data[index] = data[index].to_f\n end\n QueryHitIntIndicies.each do |index|\n data[index] = data[index].to_i\n end\n \n QueryHit.new(*data)\n end", "def parse(board, color, move_str)\n str = move_str.gsub(/[+\\#!]/, '')\n capture = str.delete!('x')\n\n # the promotion piece setting, e.g. h8=Q\n if str =~ /^.*(=.).*$/\n Pawn.set_promotion_piece(color, \n Board::PieceLetterMap.detect{|k,v| v.include?($1[1,1])}[0])\n str.gsub!($1, '')\n end\n \n case str.length\n when 2\n move_to = send(str)\n piece_pos = [move_to[0], move_to[1] - Piece.advance_direction(color)]\n piece = board.at(piece_pos)\n piece ||= board.at([piece_pos[0], \n piece_pos[1] - Piece.advance_direction(color)])\n \n mv = piece ? piece.moves.detect{|m| m.to == move_to} : nil\n \n when 3\n if str == 'O-O'\n mv = board.king(color).moves.detect{|m| m.to_s == 'O-O'}\n else\n c = str[0,1]\n move_to = send(str[1,2])\n \n if c == c.capitalize\n klass = Board::PieceLetterMap.detect{|k,v| v.include?(c)}[0]\n moves = board.pieces.select do |p|\n p.class == klass and p.color == color\n end.map(&:moves).flatten\n mv = moves.detect{|m| m.to == move_to}\n elsif capture\n x_diff = str[0,1] > str[1,1] ? 1 : -1\n \n pieces = board.pieces.select do |p| \n p.class == Pawn and p.color == color and \\\n p.x == move_to[0] + x_diff\n end\n \n mv = pieces.map{|p| p.moves}.flatten.detect{|m| [move_to, [move_to[0], move_to[1]+m.piece.advance_direction]].include?(m.to)}\n end\n end\n \n when 4\n c = str[0,1]\n move_to = send(str[2,2])\n \n if c == c.capitalize\n klass = Board::PieceLetterMap.detect{|k,v| v.include?(c)}[0]\n x_diff = nil\n y_pos = nil\n if str[1,1] <= '9'\n y_pos = str[1,1].to_i - 1\n else\n x_diff = str[1] - str[2]\n end\n piece = board.pieces.detect do |p|\n p.class == klass and p.color == color and \\\n (x_diff ? p.x == move_to[0] + x_diff : p.y == y_pos)\n end\n mv = piece ? piece.moves.detect{|m| m.to == move_to} : nil\n else\n move_from = send(str[0,2])\n piece = board.at(move_from)\n mv = piece ? piece.moves.detect{|m| m.to == move_to} : nil\n end\n \n when 5\n if str == 'O-O-O'\n mv = board.king(color).moves.detect{|m| m.to_s == 'O-O-O'}\n else\n move_from = send(str[1,2])\n move_to = send(str[3,2])\n piece = board.at(move_from)\n mv = piece ? piece.moves.detect{|m| m.to == move_to} : nil\n end\n end\n \n raise ParseError.new(\"Invalid move: #{move_str}\") if mv.nil?\n \n mv\n end", "def icon_parse(char, hash={})\n\t\tif hash['visible'].include?('y')\n\t\t\t$_TAGHASH_['GSP'].concat(char)\n\t\telse\n\t\t\t$_TAGHASH_['GSP'].gsub!(char,'')\n\t\tend\n\tend", "def parse!(_bitmap)\n parts = @string_command.split(' ')\n params = {\n width: parts[1].to_i,\n height: parts[2].to_i\n }\n params\n end", "def parse_gendbr(text)\n text.gsub!(GENDBR_Reg) do |s|\n quant = s.split(',')[1].to_i(16)\n ret = s.split(']')[1]\n if $trainer.playing_girl\n beg = quant & 0xFF\n len = quant >> 8\n end_position = beg + len\n else\n beg = 0\n len = quant & 0xFF\n end_position = len + (quant >> 8)\n end\n len2 = ret.size - end_position\n next(ret[beg, len] + ret[end_position, len2].to_s)\n end\n end", "def mana(hash={})\n\t\t$_TAGHASH_['GSZ'], $_TAGHASH_['MGSZ'] = hash['text'].scan(/\\d+/o)\n\tend", "def parse_event_line(s)\n minute, word_1, word_2 = s.scan(/.+ ..:(..)\\] (\\S+) (\\S+)/).flatten\n [minute.to_i, word_1, word_2]\n end", "def fasta_parse(fasta_string)\n fasta_parts = fasta_string.split('>')[1..-1]\n no_pfamid = fasta_parts.map { |x| x.split(',')[1].chomp() }\n seqs = no_pfamid.map { |s| {:genus => s.lines.first.chomp(), :seq => s.split(\"\\n\")[1..-1].join.gsub(\"\\n\",'') } }\n seqs.sort_by! { |h| h[:genus] } #makes sure to sort alphabetically, allowing us to build partitioned character matrices\n return seqs\nend", "def parseIngredient(raw)\n name = \"\"\n quantity = 0\n measurement = \"\"\n prep_method = \"\"\n\n jooky = raw.tr('=', ',')\n if jooky.class != String\n puts \"*******************\"\n puts jooky.class\n end\n jooky = jooky.tr!(';', ',')\n jooky = jooky.tr!('{', ' ')\n jooky = jooky.tr!('}', ' ')\n jooky.strip!.slice!(-1)\n result = jooky.split(',')\n result.each { |x| \n x.tr!('\"\"', ' ')\n x.strip!\n }\n result_hash = Hash[*result.flatten]\n\n result_string = \"\"\n result_hash.delete_if {|key, value| value == \"\"}\n if result_hash.has_key?(\"quantity\")\n result_string << result_hash[\"quantity\"] + \" \"\n end\n \n if result_hash.has_key?(\"measurement\")\n result_string << result_hash[\"measurement\"] + \" \"\n end\n \n if result_hash.has_key?(\"name\")\n result_string << result_hash[\"name\"]\n end\n \n if result_hash.has_key?(\"method\")\n result_string << \", \" + result_hash[\"method\"]\n end\n \n return result_string\n\nend", "def test06()\n begin\n imagefilepath = File.join($directory, \"images\", \"DSCN0751.JPG\")\n create_imageimporter_command = CommandModule.make_createimporter(\n imagefilepath)\n object_ref = Smig.perform_command(create_imageimporter_command).to_i\n importer_object = SmigIDHash.make_objectid(objectreference: object_ref)\n getproperties_command = CommandModule.make_get_objectproperties(\n importer_object,\n imageindex: 0,\n saveresultstype: :jsonstring)\n new_json = Smig.perform_command(getproperties_command)\n old_json = '{\"{TIFF}\":{\"ResolutionUnit\":2,\"Software\":\"E4500v1.1\",\"DateTime\":\"2004:01:16 15:17:17\",\"XResolution\":300,\"ImageDescription\":\" \",\"Orientation\":1,\"YResolution\":300,\"Model\":\"E4500\",\"Make\":\"NIKON\"},\"Depth\":8,\"{IPTC}\":{\"Caption\\/Abstract\":\" \"},\"PixelHeight\":681,\"{Exif}\":{\"DateTimeOriginal\":\"2004:01:16 15:17:17\",\"MeteringMode\":5,\"ComponentsConfiguration\":[1,2,3,0],\"MaxApertureValue\":2.8,\"DigitalZoomRatio\":0,\"Saturation\":0,\"FNumber\":3.6,\"CompressedBitsPerPixel\":3,\"FocalLength\":17.7,\"SceneType\":1,\"FileSource\":3,\"SceneCaptureType\":0,\"Sharpness\":0,\"ColorSpace\":1,\"GainControl\":0,\"SubjectDistRange\":0,\"Contrast\":0,\"PixelYDimension\":681,\"WhiteBalance\":0,\"LightSource\":0,\"FlashPixVersion\":[1,0],\"DateTimeDigitized\":\"2004:01:16 15:17:17\",\"ISOSpeedRatings\":[100],\"ExposureMode\":0,\"PixelXDimension\":908,\"ExifVersion\":[2,2],\"CustomRendered\":0,\"ExposureProgram\":2,\"Flash\":24,\"ExposureTime\":0.007336757153338224,\"FocalLenIn35mmFilm\":85,\"ExposureBiasValue\":0},\"{JFIF}\":{\"DensityUnit\":1,\"YDensity\":300,\"JFIFVersion\":[1,0,1],\"XDensity\":300},\"ProfileName\":\"sRGB IEC61966-2.1\",\"DPIWidth\":300,\"DPIHeight\":300,\"ColorModel\":\"RGB\",\"Orientation\":1,\"PixelWidth\":908}'\n unless new_json.eql?(old_json)\n puts \"Old JSON: #{old_json}\"\n puts \"New JSON: #{new_json}\"\n raise \"Image file metadata or our obtaining of it has changed.\"\n end\n\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: #{Smig.exitstring}\"\n end\n puts e.message\n puts e.backtrace.to_s\n puts #{Smig.exitstring}\"\n# exit 240\n ensure\n Smig.close_object(importer_object)\n end\nend", "def format_response(response)\n case\n when response == 'OK'\n true\n when response =~ /^ACK/\n ack = format_ack(response)\n logger.warn ack\n \n ack\n when response.split.size == 1\n # set value -> value\n Hash[*(response.split.*2)]\n else\n # remove first response: \"OK\"\n response = response.split\n response.pop\n\n Hash[*response.collect{|x| x.gsub(/:$/,'')}]\n end\n end", "def transform_move(line, c)\n ret = {}\n ret['comments'] = c unless c.empty?\n if line['move'].is_a? Hash\n ret['move'] = line['move']\n else\n ret['special'] = special2csa(line['move'])\n end\n ret['time'] = line['time'] if line['time']\n ret\n end", "def segment_string(str)\n \n \n #Purpose: Initialize incidence variables\n #\n #Inputs: none\n #\n #Returns: \n #array1 = An Array that contains the component words of the original String. \n #@s = An Integer. The index of the start point of a test word.\n #@e = An Integer. The index of the end point of a test word.\n #@l = An Integer. The length of the string to be separated.\n def setup #initialize incidence variables\n array1 = [] #our word bank \n @s = 0 #start of a test word\n @e = 0 #end of a test word\n @l = str.length\n end\n \n #Purpose: Generate potential words comprised of consecutive letters from a String.\n #\n #Inputs: A String comprised of words without spaces between them.\n #\n #Returns: String comprised of the letters between the start point and end point.\n def make_word_candidates\n while @e <= l \n @word = str[@s..@e]#.join\n end\n end \n \n #Purpose: See if the potential words match entries in a dictionary. Current dictionary is a stub.\n #\n #Inputs: Potential words in String form generated by the Method make_word_candidates.\n #\n #Returns: Return message \"true\" for a dictionary match, \"false\" if not.\n def validate_word_match\n if valid_word?(@word)\n return true\n else return false \n end#this should be returning true or false\n end\n\n #Purpose: Store validated word in Array1\n #\n #Inputs: The Return \"true\" from the Method validate_word_match.\n #\n #Returns: Array containing validated words.\n def bank_valid_word_match(yes)\n if yes == true\n array1 << @word\n else nil\n end\n end\n\n #Purpose: Reset start and end points to begin looking for next word.\n #\n #Inputs: The Return \"true\" from the Method validate_word_match.\n #\n #Return: Start and End points one step beyond the end of the last found word.\n def begin_find_next_word(stepup)\n if stepup == true\n @s = @e+1\n @e += 1\n else nil\n end\n end\n\n #Purpose: Iterate end point to generate a new potential word if the previous potential word is not a word in our dictionary.\n #\n #Inputs: The Return \"false\" from the Method validate_word_match.\n def not_a_match(no)\n if no == false\n @e += 1 \n else nil \n end\n end \n\n #Purpose: Order of operations for segmenting the string.\n #\n #Inputs: none\n #\n #Returns: An Array (array1) containing the separate words that comprised the original string.\n def build_array\n setup\n while @e <= l\n make_word_candidates\n validate_word_match\n bank_valid_word_match(validate_word_match)\n begin_find_next_word(make_word_candidates)\n not_a_match(make_word_candidates)\n return array1\n end\n #return array1\n end\n \n # def output\n # return array1\n # end\n \n end", "def split_into_flow\n res = []\n current_attr = 0\n\n str_len = @str.length\n\n # skip leading invisible text\n i = 0\n i += 1 while i < str_len and @str[i].chr == \"\\0\"\n start_pos = i\n\n # then scan the string, chunking it on attribute changes\n while i < str_len\n new_attr = @attrs[i]\n if new_attr != current_attr\n if i > start_pos\n res << copy_string(start_pos, i)\n start_pos = i\n end\n\n res << change_attribute(current_attr, new_attr)\n current_attr = new_attr\n\n if (current_attr & @attributes.regexp_handling) != 0 then\n i += 1 while\n i < str_len and (@attrs[i] & @attributes.regexp_handling) != 0\n\n res << RDoc::Markup::RegexpHandling.new(current_attr,\n copy_string(start_pos, i))\n start_pos = i\n next\n end\n end\n\n # move on, skipping any invisible characters\n begin\n i += 1\n end while i < str_len and @str[i].chr == \"\\0\"\n end\n\n # tidy up trailing text\n if start_pos < str_len\n res << copy_string(start_pos, str_len)\n end\n\n # and reset to all attributes off\n res << change_attribute(current_attr, 0) if current_attr != 0\n\n res\n end", "def test_parts_with_duration(string)\n result = string.match(/\\A\\s*(test:\\s*)(.*?)(\\.\\s*:)(.*)(([.EF]):)\\s*\\(([\\d.]+)\\)\\s*\\z/m)\n \n if result.nil?\n nil\n else\n [result[2], result[4].sub(/^\\s+/, ''), result[6], result[7]]\n end\nend", "def formatbaseball(string)\n string.gsub!(/\\./,\";\")\n string.gsub!(/1B/,\"first baseman\")\n string.gsub!(/2B/,\"second baseman\")\n string.gsub!(/3B/,\"third baseman\")\n string.gsub!(/ C /,\"catcher\")\n string.gsub!(/RHP/, \"pitcher\")\n string.gsub!(/LHP/, \"pitcher\")\n string.gsub!(/INF/, \"infielder\")\n string.gsub!(/INF-OF/,\"infielder-outfielder\")\n string.gsub!(/OF/,\"outfielder\")\n string.gsub!(/Placed/,\"Put\")\n string.gsub!(/Reassigned/,\"Assigned\")\n string.gsub!(/Major League Baseball/,\"\")\n string.gsub!(/American League/,\"\")\n string.gsub!(/National League/,\"\")\n return string\nend", "def annotate(str)\n return \"#{str}'#{parstr(str)}\" if @ordering[0].isMatchingKey?(str)\n return \"#{str}\\\"#{parstr(str)}\" if @ordering[1].isMatchingKey?(str)\n return str + parstr(str)\n end", "def parse_status_into_hash(output)\n hash = HashWithIndifferentAccess.new\n\n output.each_line do |line|\n if line.match /(^.*) (.*)/\n hash[$1] = $2\n end\n end\n\n hash[\"volume\"] = hash[\"set vol_left\"] if hash[\"set vol_left\"]\n hash[\"position_integer\"] = hash[\"position\"]\n hash[\"position\"] = seconds_to_formatted_time(hash[\"position\"].to_i) if hash[\"position\"]\n\n hash[\"duration_integer\"] = hash[\"duration\"]\n hash[\"duration\"] = seconds_to_formatted_time(hash[\"duration\"].to_i) if hash[\"duration\"]\n\n hash[\"percent_complete\"] = (hash[\"position_integer\"].to_f / hash[\"duration_integer\"].to_f) * 100.0\n\n hash\n end", "def extractHit(ahit)\n hit = ahit.to_i\n cap = (hit & CAP_MASK) >> 15\n imp = (hit & IMP_MASK) >> 13\n pos = (hit & POS_MASK)\n return cap, imp, pos\n end", "def extract_multi_value_field(header, val, processed, key = nil)\n key ||= header.to_sym\n processed[key] ||= []\n val = val.strip\n # Workaround for https://jira.duraspace.org/browse/FCREPO-2038\n val.delete!(\"\\r\")\n processed[key] << (looks_like_uri?(val) && Image.controlled_properties.include?(header.to_sym) ? RDF::URI(val) : val)\n end", "def extract_string(range, strscan); end", "def parse_validation(script_output)\n\n script_output = script_output.split(\"\\n\")\n puts script_output\n puts \"hello!\"\n refseq = script_output[0]\n charmap = script_output[1]\n obsvseq = script_output[2]\n status = script_output[3]\n changes = script_output[4]\n\n lastmap = 0;\n val_html = \"\";\n map_hash = { \"Y\" => \"vfonly\",\n \"G\" => \"both\",\n \"B\" => \"vronly\",\n \"!\" => \"mismatch\",\n \"?\" => \"unsure\" }\n unless status.include? \"unequal\" #if lengths refseq obsvseq equal\n val_html += \"Observed Sequence:<br/>\"\n seqouts = [obsvseq]\n seqouts.each do |seq|\n i=0;\n seq.each_byte do |nt|\n if lastmap == 0 \n val_html += \"<span class = #{map_hash[charmap[i].chr]}>#{nt.chr}\"\n elsif lastmap == charmap[i]\n val_html += \"#{nt.chr}\"\n else\n val_html += \"</span><span class = #{map_hash[charmap[i].chr]}>#{nt.chr}\"\n end\n lastmap = charmap[i]\n i+=1\n end\n #break line\n val_html += \"<br/>\"\n end\n\n val_html += \"</span>\"\n else #there was an error \n val_html += status\n val_html += \"<br/>Reference sequence:<br/>\"\n val_html += refseq\n val_html += \"<br/>Observed sequence:<br/>\"\n val_html += obsvseq\n val_html += \"<br/>\"\n end\n\n unless changes.nil?\n changes = changes.split('|')\n val_html += \"<br/>Mismatches:<br/>\"\n changes.each do |c|\n val_html += c\n val_html += \"<br/>\"\n end\n end\n\n return val_html\n end", "def rect(a, b, screen)\n screen[0...b].each do |row|\n row[0...a] = (\"#\"*a).split(\"\")\n end\n\n screen\nend", "def populate_guard_map\n current_guard = retrieve_capture_group(@sorted_input[0], /#(\\d+)/)\n @sorted_input.each_cons(2) do |prev_line, line|\n case\n when line.include?('#')\n current_guard = retrieve_capture_group(line, /#(\\d+)/)\n when line.include?('wakes up')\n prev_time = retrieve_capture_group(prev_line, /\\d\\d:(\\S+)\\]/)\n time = retrieve_capture_group(line, /\\d\\d:(\\S+)\\]/)\n @guard_map[current_guard] ||= {}\n\n # Storing total sleep now so don't have to loop through it again later\n @guard_map[current_guard][:total_sleep] ||= 0\n @guard_map[current_guard][:total_sleep] += (time.to_i - prev_time.to_i)\n\n # Sleep times is an array of the times they sleep\n @guard_map[current_guard][:sleep_times] ||= []\n @guard_map[current_guard][:sleep_times] << [prev_time.to_i, time.to_i - 1]\n end\n end\n end", "def parse(text)\n # match = text.scan(/^(\\/[^:]+):\\s([^:]+):\\s(.+)$/)[0]\n rows = text.split(/\\n/)\n \n rows.shift(rows.length-3) if rows.length > 3\n \n match = rows[0].scan(/^(\\d+)\\t([^\\t]+)\\t([^\\t]+)\\t(.+)$/)[0]\n \n result = {\n :linenumber => match[0],\n :file => match[1],\n :filename => match[2],\n :type => match[3] =~ /warning/i ? \"warning\" : \"error\",\n :description => match[3],\n :code => rows[1],\n :position => rows[2].scan(/^(.*)\\^$/)[0][0].length\n }\n return result\nend", "def parseString(s, line, trace, transform)\r\n @sp = trace\r\n @transform = transform\r\n sent,new_sent = parseSentance(s, line, trace)\r\n\r\n matches = parseSentance(s, line, 0)\r\n good_matches = []\r\n matches.each do |match|\r\n sent, new_sent = match\r\n if sent == line\r\n print \"\\n\\n\\nMATCHED!\" + sent.nil?.to_s + \".\" + line + \".\\n\"\r\n print \"tx to:\" + new_sent.to_s + \"\\n\"\r\n else\r\n print \"\\n\\n\\nNO match\" + \".\" + sent.to_s + \".\" + line + \".\\n\"\r\n end\r\n end\r\n end", "def card_from_line(line)\n infer_set(line)\n infer_card(line)\n infer_foil(line)\n end", "def __captures(ary)\n i = 1 # Captures do NOT include $& (the entire matched string)\n lim = length\n in_str = @inputString\n while i < lim\n x = self.begin(i)\n if x == -1\n ary << nil\n else\n y = self.end(i)\n ary << in_str[x, y-x] # GEMSTONE\n end\n i += 1\n end\n ary\n end", "def processraw str, keys\n str.readlines.collect do |l|\n spltline = l.chomp.split \"|\"\n returning Hash.new do |h|\n keys.each_index do |i|\n h[keys[i]] = spltline[i] unless keys[i] == :ignore\n end\n end\n end\n end", "def parse_claim(claim)\n cid, coords = claim.split('@')\n orig, size = coords.split(':')\n tx, ty = orig.strip.split(',')\n tdx, tdy = size.strip.split('x')\n x1 = tx.to_i\n y1 = ty.to_i\n x2 = x1 + tdx.to_i\n y2 = y1 + tdy.to_i\n [cid, x1...x2, y1...y2 ]\nend", "def my_hash_maker( the_data)\n the_split = the_data.split(\"\\n\")\n new_array = the_split.map { | the_character | the_character.split(\",\") }\n my_hash = new_array.map { | the_character | {:mentions => the_character[0].to_i, :name => the_character[1], :house => the_character[2]} }\nend", "def process(tweet)\n puts tweet\n hash_to_dict(tweet).each do |tag|\n if tag[0] == \"loc\"\n tag[1] = parse_location(tag[1])\n end\n p tag\n end\nend", "def parse_string\n # Local array ( multidimensional ) to hold code structures\n parse_string_holder = []\n # Loop through each of the regular expressions in the @structures instance variable array\n @structures.each do | structure |\n # Check to see if the structure can be found in the @raw_command_string created in the previous method call\n if structure.match( @raw_command_string )\n # If any were found, loop through the found objects\n @raw_command_string.scan( structure ).each do | caught |\n # Pull out the longest array element corresponding to the whole found string\n # this is necessary due to the way Ruby handles results from a regex search; creating a MatchData\n # object which can be read and treated as an array\n found = caught.to_a.compact.max_by( &:length )\n # Find the starting point in the @raw_command_string instance variabl array using the found string as the\n # basis for a new regex.\n start = /#{ Regexp.quote( found ) }/.match( @raw_command_string ).begin( 0 )\n # Holder for substitution string\n substitute = \"\"\n # Create substitution string using least common character I could think of, if it proves necessary, this can\n # be swapped out for any other single character in the event \"~\" is needed down the road\n found.length.times { substitute << \"~\" }\n # Replace the structure in the original string ( ! = dustructive, meaning it changes the orignal object ) \n # with the substitute string to prevent duplication\n @raw_command_string.sub!( structure, substitute )\n # Add subarray to holder array consisting of the starting point ( for sorting ) and the found string\n parse_string_holder << [ start, found ]\n end\n end\n end\n # Check for non-valid structures, throw error\n if @raw_command_string.gsub( /~/, \"\" ).gsub( / /, \"\" ).length > 0\n # If there are any uncaught ( invalid ) block structures, set to false for error handling\n @parsed_command_string = false\n else\n # Assign to new instance variable a sorted multidimensional array consisting of all found command structures in \n # order of execution\n @parsed_command_string = parse_string_holder.sort\n end\n end", "def display_hangman(step)\n out = mask_string \" ____ \\n\" +\n \" |/ | \\n\" +\n \" | O \\n\" +\n \" | /|\\\\ \\n\" +\n \" | / \\\\ \\n\" +\n \"/|\\\\ \",\n \" 4444 \\n\" +\n \" 15 6 \\n\" +\n \" 1 7 \\n\" +\n \" 1 98a \\n\" +\n \" 1 b c \\n\" +\n \"213 \", step\n puts out\n out\nend", "def preprocess_truth_line(text)\n matches = text.match(/^\\d+[\\t|\\s]+Recv[\\t|\\s]+.{14}[\\t|\\s]+0x([\\d|a-f]+)[\\t|\\s]+\\w+[\\t|\\s]+\\w+[\\t|\\s]+0x[\\d|a-f]+[\\t|\\s]+([\\d|a-f]+)/)\n return nil if matches.nil?\n frame_id, frame_data = matches[1], matches[2]\n frame_id.upcase.sub(/^[0:]*/,\"\") + '#' + frame_data.upcase\nend", "def fix_sequence(part)\n\n if part.sequence[-3..-1] == 'ATG'\n puts \"--skipped #{part.biofab_id}\"\n return part\n else\n part.sequence += 'ATG'\n part.save!\n puts \"--fixed #{part.biofab_id}\"\n return part\n end\n\nend", "def split_by_key_and_value(text)\n text.match(/(^[^:]+):([^$]*)/)\n end", "def hits_shots(node)\n return [nil, nil] unless node['title']\n\n selector = if node['title'] =~ /hits/i\n /Hits: ([\\d,]+) Shots: ([\\d,]+)/i\n else\n /([\\d,]+)\\s+\\/\\s+([\\d,]+)/i\n end\n\n res = node['title'].match(selector)\n\n [res[1], res[2]].map { |r| to_integer r }\n end", "def get_gif_ref(word)\n word = word.gsub(/[\\^\\:']/,'')\n test_word = word.gsub(/[,.]/, '').downcase\n \"<img src='/images/stats/#{test_word}.gif' style='max-width: 30px;'></img>\"\nend", "def extract_type(result, raw_query, regex, mark, destination, range)\n raw_query.split(regex).inject([]) do |raw_array, chunk|\n if chunk.starts_with?(mark)\n result[destination] << chunk[range]\n else\n raw_array << chunk.strip\n end\n\n raw_array\n end\n end", "def annotate\n genes={}\n File.open(ANNOTATION,'r').each do |line|\n temp=line.split\n genes[temp[9]]={}\n genes[temp[9]][\"start\"]=temp[3].to_i\n genes[temp[9]][\"end\"]=temp[4].to_i\n genes[temp[9]][\"strand\"]=temp[6]\n genes[temp[9]][\"length\"]=temp[4].to_i - 1 - temp[3].to_i\n end\n return genes\nend", "def pre_match\n m = @match\n @string[0...(@pos - m.to_s.size)] if (not m.equal?(nil))\n end", "def test02()\n sourceMovie = File.join($directory, \"images/418_clip5_sd.m4v\")\n begin \n # Create the list of commands object, ready to have commands added to it.\n theCommands = CommandModule::SmigCommands.new\n theCommands.saveresultstype = :lastcommandresult\n\n # 1. Create a movie importer, get the movie importers base object reference.\n movieImporterName = SecureRandom.uuid\n\n movieObject = theCommands.make_createmovieimporter(sourceMovie,\n name: movieImporterName,\n addtocleanup: false)\n\n # 2. Create the get_objectproperty command and get the track id.\n getReferenceCommand = CommandModule.make_get_objectproperty(movieObject,\n property: :trackid)\n getReferenceCommand.add_option(key: :track,\n value: { trackindex: 0, mediatype: :vide })\n theCommands.add_command(getReferenceCommand)\n theResult = Smig.perform_commands(theCommands)\n trackID = { trackid: theResult.to_i } \n\n # 3. Get the media type of the track.\n getMediaTypeCommand = CommandModule.make_get_objectproperty(movieObject,\n property: :mediatype)\n getMediaTypeCommand.add_option(key: :track, value: trackID)\n res = Smig.perform_command(getMediaTypeCommand)\n raise 'First video track doesn\\'t have media type vide' unless res.eql? 'vide'\n\n # 4. Get the media type of the track.\n getIsTrackEnabled = CommandModule.make_get_objectproperty(movieObject,\n property: :trackenabled)\n getIsTrackEnabled.add_option(key: :track, value: trackID)\n res = Smig.perform_command(getIsTrackEnabled)\n raise 'Track with track id #{trackID} enabled is not YES' unless res.eql? 'YES'\n\n # 5. Get the track time range.\n getTrackTimeRange = CommandModule.make_get_objectproperty(movieObject,\n property: :timerange)\n getTrackTimeRange.add_option(key: :track, value: trackID)\n res = Smig.perform_command(getTrackTimeRange)\n timeRange = '{\"start\":{\"flags\":1,\"value\":0,\"timescale\":600,\"epoch\":0},' +\n '\"duration\":{\"flags\":1,\"value\":9000,\"timescale\":600,\"epoch\":0}}'\n raise \"Track with track id #{trackID} time range #{res}\" unless res.eql? timeRange\n\n # 6. Get the track natural size.\n getTrackNaturalSize = CommandModule.make_get_objectproperty(movieObject,\n property: :naturalsize)\n getTrackNaturalSize.add_option(key: :track, value: trackID)\n res = Smig.perform_command(getTrackNaturalSize)\n natSize = '{\"width\":400,\"height\":252}'\n raise \"Track with id #{trackID} natural size #{res}\" unless res.eql? natSize\n\n # 7. Get the nominal frame rate.\n getFrameRate = CommandModule.make_get_objectproperty(movieObject,\n property: :framerate)\n getFrameRate.add_option(key: :track, value: trackID)\n res = Smig.perform_command(getFrameRate).to_f\n raise \"Track with id #{trackID} frame rate #{res}\" unless res.eql? 10.0\n\n # 8. Get whether frames need reordering.\n getRequiresFrameReordering = CommandModule.make_get_objectproperty(movieObject,\n property: :requiresframereordering)\n getRequiresFrameReordering.add_option(key: :track, value: trackID)\n res = Smig.perform_command(getRequiresFrameReordering)\n raise \"Track with id #{trackID} frame reorder #{res}\" unless res.eql? \"NO\"\n\n # 8. Get min frame rate duration.\n getMinFramerateDuration = CommandModule.make_get_objectproperty(movieObject,\n property: :minframeduration)\n getMinFramerateDuration.add_option(key: :track, value: trackID)\n res = Smig.perform_command(getMinFramerateDuration)\n duration = '{\"flags\":1,\"value\":60,\"timescale\":600,\"epoch\":0}'\n raise \"Track with id #{trackID} min frame duration #{res}\" unless res.eql? duration\n \n # 9. Get the affine transform for the track. Usually identity.\n getAffineTransform = CommandModule.make_get_objectproperty(movieObject,\n property: :affinetransform)\n getAffineTransform.add_option(key: :track, value: trackID)\n res = Smig.perform_command(getAffineTransform)\n transform = '{\"m12\":0,\"m21\":0,\"m22\":1,\"tY\":0,\"m11\":1,\"tX\":0}'\n raise \"Track with id #{trackID} affine transform #{res}\" unless res.eql? transform\n\n # 10. Get track segment mappings for the track.\n getTrackSegmentMappings = CommandModule.make_get_objectproperty(movieObject,\n property: :tracksegmentmappings)\n getTrackSegmentMappings.add_option(key: :track, value: trackID)\n res = Smig.perform_command(getTrackSegmentMappings)\n mappings = '[{\"sourcetimerange\":{\"start\":{\"flags\":1,\"value\":0,\"timescale\"' +\n ':600,\"epoch\":0},\"duration\":{\"flags\":1,\"value\":9000,\"timescale\"' +\n ':600,\"epoch\":0}},\"targettimerange\":{\"start\":{\"flags\":1,\"value\"' +\n ':0,\"timescale\":600,\"epoch\":0},\"duration\":{\"flags\":1,\"value\":9000' +\n ',\"timescale\":600,\"epoch\":0}}}]'\n raise \"Track with id #{trackID} segment mappings #{res}\" unless res.eql? mappings\n\n # 11. Get track metadata.\n getTrackMetadata = CommandModule.make_get_objectproperty(movieObject,\n property: :metadata)\n getTrackMetadata.add_option(key: :track, value: trackID)\n res = Smig.perform_command(getTrackMetadata)\n metadata = '[]'\n raise \"Track with id #{trackID} metadata #{res}\" unless res.eql? metadata\n\n # 12. Get properties of the audio track\n audioTrackID = { mediatype: :soun, trackindex: 0 }\n getTrackMetadata = CommandModule.make_get_objectproperties(movieObject,\n saveresultstype: :jsonstring)\n getTrackMetadata.add_option(key: :track, value: audioTrackID)\n res = Smig.perform_command(getTrackMetadata)\n properties = '{\"preferredvolume\":1,\"mediatype\":\"soun\",\"timerange\":{\"start\":' +\n '{\"flags\":1,\"value\":0,\"timescale\":600,\"epoch\":0},\"duration\":{\"flags\":1,' +\n '\"value\":8973,\"timescale\":600,\"epoch\":0}},\"trackid\":1,\"languagecode\":\"und\",' +\n '\"languagetag\":\"\",\"trackenabled\":true}'\n raise \"First audio track properties #{res}\" unless res.eql? properties\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: \" + Smig.exitstring\n puts \"Exit status: \" + $errorcode.to_s\n end\n puts e.message\n puts e.backtrace.to_s\n ensure\n # 13. Close the movie object\n Smig.close_object_nothrow(movieObject)\n end\nend", "def parse_claim(str)\n Claim.new(*/^\\#(\\d+) \\@ (\\d+),(\\d+): (\\d+)x(\\d+)$/.match(str).captures.map(&:to_i))\nend", "def parse_hw_chunk(chunk)\n result = []\n chunk.gsub(/\\s+/,'').split(/;/).each { |g|\n flags = {}\n if g=~/(.*):(.*)/ then\n f,g = [$1,$2]\n f.split('').each {|c| flags[c]=true }\n if flags.keys.length>6 then $stderr.print \"warning: in this input '#{chunk}', flags '#{f}', you have more than 6 flags; this would likely occur because you were missing a semicolon\\n\" end\n [',','|','/']. each { |illegal_char|\n if flags.has_key?(illegal_char) then fatal_error(\"in this input '#{chunk}', flags '#{f}' contain the character '#{illegal_char}', which is illegal; this would likely occur because you were missing a semicolon\") end\n }\n if flags.keys.length<f.length then fatal_error(\"in this input '#{chunk}', flags '#{f}', some flags occur more than once; this would likely occur because you were missing a semicolon\") end\n end\n g = g.split(/,/).map {|x| x.split(/\\|/)}\n # g now looks like [[\"traffic/AB\"],[\"foo\",\"bar\"]]\n g = resolve_labels(g)\n result.push([flags,g])\n }\n return result\nend", "def test_if_output_splits_elements_into_strings\n assert_equal [[\"A\", \"A\"], [\"1\", \"2\"]], @board.parse_coordinates([\"A1\", \"A2\"])\n end", "def parse_game team\n parsed_team = team.rpartition(' ')\n\n name = parsed_team.first\n score = parsed_team.last.to_i\n\n {\n name: name,\n score: score\n }\nend", "def parseBeatString(str)\n pattern = []\n scanner = StringScanner.new(str)\n until scanner.pos == str.length\n checkStringElement(scanner, pattern)\n end\n pattern.ring\nend" ]
[ "0.5447488", "0.5336484", "0.5196144", "0.5193202", "0.5172869", "0.5167905", "0.5144815", "0.514023", "0.5099147", "0.50526416", "0.5049992", "0.4988325", "0.49721697", "0.49398422", "0.49225911", "0.49178684", "0.49163556", "0.49040356", "0.4890102", "0.488303", "0.48752442", "0.48534098", "0.48498347", "0.4835034", "0.48292652", "0.48202363", "0.48172405", "0.48023036", "0.47925094", "0.47875053", "0.4784305", "0.4782322", "0.47049928", "0.47018012", "0.47001043", "0.46974146", "0.46970755", "0.46944535", "0.46916944", "0.46902314", "0.4687042", "0.46860933", "0.46782753", "0.46726304", "0.46684903", "0.4657904", "0.46571493", "0.4653388", "0.46378696", "0.4619388", "0.46072897", "0.46046767", "0.4593823", "0.45932487", "0.45925117", "0.458884", "0.45810702", "0.45586511", "0.45581466", "0.45439142", "0.45409295", "0.45389277", "0.4533501", "0.4531132", "0.45310697", "0.45307297", "0.45294654", "0.45251963", "0.45220512", "0.45152503", "0.45144716", "0.45076618", "0.45062354", "0.450247", "0.45021", "0.44956532", "0.44945607", "0.44937253", "0.44877735", "0.44867653", "0.44858238", "0.44851553", "0.44831738", "0.44732246", "0.4449968", "0.4446204", "0.4446058", "0.44443396", "0.44439727", "0.44428462", "0.44386566", "0.4435233", "0.44344518", "0.44277245", "0.44186392", "0.4408626", "0.44084695", "0.44042656", "0.4403667", "0.4403132" ]
0.7211474
0
Callback for an ontarget shot
def has_hit(hit) asap = [] asap.push hit.to_left, hit.to_left.to_left if field[hit.to_right] == :hit asap.push hit.to_right, hit.to_right.to_right if field[hit.to_left] == :hit asap.push hit.to_up, hit.to_up.to_up if field[hit.to_dn] == :hit asap.push hit.to_dn, hit.to_dn if field[hit.to_up] == :hit if asap.empty? # Force shooting around asap = [ hit.to_left, hit.to_right, hit.to_up, hit.to_dn ].reject { |l| l.nil? } end asap.each { |l| @shot_queue.push l } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fireAtTarget _obj, _args\n \"_obj fireAtTarget _args;\" \n end", "def shoot\n \tuser_shoot\n\tend", "def tick!\n if target = acquire_target\n shoot_at(target)\n else\n scan_for_targets\n end\n end", "def shoot(at_coordinates, opponent_board)\n opponent_board.register_shot(at_coordinates)\n end", "def fire_shot(x, y)\n opponent_board.take_shot(x, y)\n opponent_board.fire_shot_on_board(player_board)\n end", "def shoot(at_coordinates, opponent_board)\n end", "def next_target\n # First shot at the priority positions\n begin\n here = @shot_queue.shift\n end while !shootable?(here) && !@shot_queue.empty?\n # Then shot according to ship discovery\n while !shootable?(here) do\n here = @discovery.next\n break if here.nil?\n end \n field[here] = :shot if here\n here\n end", "def npc_shot_turn\n @npc.computer_shoot(@user_board)\n end", "def fire\n if Gosu::milliseconds - @prev_shot > 60\n self.shots.push(Shot.new(self.game,\"player_shot\",@gfx_shot,@x+8,@y,90,10)) unless @live_shots >= @shots_budget\n @prev_shot = Gosu::milliseconds\n end\n end", "def aimedAtTarget _obj, _args\n \"_obj aimedAtTarget _args;\" \n end", "def fire\n if shot_elapsed > 60\n shots.push(new_shot) unless @live_shots >= @shots_budget\n end\n end", "def shoot\n @shooting = true\n end", "def update event\n @image.fill :white\n enemy_in_range?\n attack! unless @target.nil?\n end", "def player_shoot\n distance = choose_shot_distance\n room_number = choose_room_target(distance)\n @game.shoot_arrow(room_number)\n animate('>>>--------~>')\n end", "def camTarget _args\n \"camTarget _args;\" \n end", "def hook_action\n if tool_canuse?(HweaponId) and not @showing_hook\n unless character_at_playerpos?\n @hookshot.each do |hook| \n hook.direction = @direction\n hook.moveto(@x, @y)\n hook.char_steps = hook.index\n end\n @showing_hook = true\n RPG::SE.new(HookActionSe, 80).play\n @tool_anime = 30\n else\n Sound.play_buzzer\n end\n end\n end", "def handleUpdate(sprite) end", "def shoot(window,shot,player)\n\t\tshot << Bullet.new(window, self, player)\n\t\t@reload_end = Gosu::milliseconds\n\tend", "def touch_moved(touch); end", "def on_target(attr)\n @targets << attr['id'] if @buffer_targets\n end", "def afterimage\n super || @battler.afterimage rescue false\n end", "def make_item_action_result\n \n # sorry i didnt work on this...\n # couse i dont have a sprite that uses items....\n # so i just added the standby sprite here...\n # when i get more time for this i'll try what i can do for this one... ^-^\n # its the same as the ones above...\n if @active_battler.is_a?(Game_Actor)\n @spriteset.actor_sprites[@active_battler.index].pose(1)\n else\n @spriteset.enemy_sprites[@active_battler.index].enemy_pose(1)\n end\n \n @item = $data_items[@active_battler.current_action.item_id]\n unless $game_party.item_can_use?(@item.id)\n @phase4_step = 1\n return\n end\n if @item.consumable\n $game_party.lose_item(@item.id, 1)\n end\n @help_window.set_text(@item.name, 1)\n @animation1_id = @item.animation1_id\n @animation2_id = @item.animation2_id\n @common_event_id = @item.common_event_id\n index = @active_battler.current_action.target_index\n target = $game_party.smooth_target_actor(index)\n set_target_battlers(@item.scope)\n for target in @target_battlers\n target.item_effect(@item)\n end\n end", "def laserTarget _args\n \"laserTarget _args;\" \n end", "def set_shot\n @shot = Shot.find(params[:id])\n end", "def set_shot\n @shot = Shot.find(params[:id])\n end", "def set_shot\n @shot = Shot.find(params[:id])\n end", "def set_shot\n @shot = Shot.friendly.find(params[:id])\n end", "def enemy_shoot args\n # generate a random number from 0 to 99\n r = rand(100)\n # is the random number 0? that give a a 1 in 100 chance of shooting\n # is the enemy shooting? Only shoot if not already shooting.\n if r == 1 && args.state.enemy_bullet_shooting == false\n # set the enemy bullet position to the enemy position\n args.state.enemy_bullet_x = args.state.enemy_x + args.state.enemy_w / 2\n args.state.enemy_bullet_y = args.state.enemy_y\n # track state of enemy bullet\n args.state.enemy_bullet_shooting = true\n end\nend", "def render_target\n outputs.sprites << scale_up(grid.target).merge({ path: 'target.png'})\n end", "def doTarget _obj, _args\n \"_obj doTarget _args;\" \n end", "def on_completion(actor); end", "def on_taken &block\n\t\t\t@on_taken = block\n\t\tend", "def handle_hit_obstacle(object)\n end", "def setup_smooth_move_target\n if area_flag\n size = target_array.size\n xpos = target_array.inject(0) {|r,battler| r + battler.x}/size\n ypos = target_array.inject(0) {|r,battler| r + battler.y}/size\n xpos += @acts[1]\n xpos *= -1 if flip && !@ignore_flip_point\n rev = @acts[3]\n rev = true if rev.nil?\n smooth_move(xpos, ypos + @acts[2], @acts[3])\n return\n end\n return unless target\n tx = @acts[1] + target.x || 0\n ty = @acts[2] + target.y || 0\n tx *= -1 if flip && !@ignore_flip_point\n dur = @acts[3] || 25\n rev = @acts[4]\n rev = true if rev.nil?\n smooth_move(tx,ty,dur,rev)\n end", "def setup_move_to_target\n return TSBS.error(@acts[0], 4, @used_sequence) if @acts.size < 5\n stop_all_movements\n if area_flag\n size = target_array.size\n xpos = target_array.inject(0) {|r,battler| r + battler.x}/size\n ypos = target_array.inject(0) {|r,battler| r + battler.y}/size\n xpos += @acts[1]\n xpos *= -1 if flip && !@ignore_flip_point\n # Get the center coordinate of enemies\n goto(xpos, ypos + @acts[2], @acts[3], @acts[4])\n return\n end\n xpos = target.x + (flip ? -@acts[1] : @acts[1])\n ypos = target.y + @acts[2]\n goto(xpos, ypos, @acts[3], @acts[4], @acts[5] || 0)\n end", "def setup_anim\n if $game_temp.one_animation_flag || (@acts[1].nil? && item_in_use &&\n item_in_use.one_animation)\n handler = get_spriteset.one_anim\n size = target_array.size\n xpos = target_array.inject(0) {|r,battler| r + battler.x}/size\n ypos = target_array.inject(0) {|r,battler| r + battler.y}/size\n zpos = target_array.inject(0) {|r,battler| r + battler.screen_z}/size\n handler.set_position(xpos, ypos, zpos)\n sprites = target_array.collect {|t| t.sprite}\n handler.target_sprites = sprites\n anim_id = (@acts[1].nil? ? item_in_use.animation_id : @acts[1])\n anim_id = atk_animation_id1 if anim_id == -1 && actor?\n mirror = flip || @acts[2]\n $game_temp.one_animation_id = anim_id\n $game_temp.one_animation_flip = mirror\n $game_temp.one_animation_flag = false\n elsif area_flag\n target_array.uniq.each do |target|\n setup_target_anim(target, @acts)\n end\n else\n setup_target_anim(target, @acts)\n end\n end", "def camSetTarget _obj, _args\n \"_obj camSetTarget _args;\" \n end", "def setup_move_to_target\n return TSBS.error(@acts[0], 4, @used_sequence) if @acts.size < 5\n stop_all_movements\n if area_flag\n size = target_array.size\n xpos = target_array.inject(0) {|r,battler| r + battler.x}/size\n ypos = target_array.inject(0) {|r,battler| r + battler.y}/size\n xpos += @acts[1] * (flip && !@ignore_flip_point ? -1 : 1)\n # Get the center coordinate of enemies\n goto(xpos, ypos + @acts[2], @acts[3], @acts[4])\n return\n end\n xpos = target.x + (flip ? -@acts[1] : @acts[1])\n ypos = target.y + @acts[2]\n goto(xpos, ypos, @acts[3], @acts[4], @acts[5] || 0)\n end", "def on_timed_hit_success\n end", "def do_effect(target)\n end", "def i_hit(others, velocity); end", "def shots_on_target\n self.positions.where(water: false, shooted: true).count\n end", "def setup_smooth_move_target\n if area_flag\n size = target_array.size\n xpos = target_array.inject(0) {|r,battler| r + battler.x}/size\n ypos = target_array.inject(0) {|r,battler| r + battler.y}/size\n xpos += @acts[1] * (flip && !@ignore_flip_point ? -1 : 1)\n dur = @acts[3] || 25\n rev = @acts[4]\n rev = true if rev.nil?\n smooth_move(xpos, ypos + @acts[2], dur, rev)\n return\n end\n return unless target\n tx = @acts[1] + target.x || 0\n ty = @acts[2] + target.y || 0\n tx *= -1 if flip && !@ignore_flip_point\n dur = @acts[3] || 25\n rev = @acts[4]\n rev = true if rev.nil?\n smooth_move(tx,ty,dur,rev)\n end", "def create_target_picture\n @target = Sprite.new(@viewport)\n @target.bitmap = Cache.picture(MAP_TARGET)\n center(@target)\n @target.opacity = 0\n end", "def playGesture _obj, _args\n \"_obj playGesture _args;\" \n end", "def target\n base.image_for(\"#{name}_target\")\n end", "def render_target\n outputs.sprites << scale_up(state.target).merge({path: 'target.png'})\n outputs.sprites << move_and_scale_up(state.target).merge({path: 'target.png'})\n end", "def do_action\n if self.affects == \"world\" then\n player_tile = self.character.tile\n\n # an aoe effect is represented as a list of objects,\n # each one representing the effect on one tile\n ITEM_PROPERTIES[self.item_type][\"aoe\"].each do |aoe|\n dx = aoe[\"xCoordPlus\"]\n dy = aoe[\"yCoordPlus\"]\n tile_becomes = aoe[\"tileBecomes\"]\n Tile.tile_at(player_tile.x + dx, player_tile.y + dy).become tile_becomes\n end\n\n elsif self.affects == \"player\" then\n\n dx = self.moves_player_x\n dy = self.moves_player_y\n\n # Move me to the place this item takes me\n if (dx != 0 or dy != 0) then\n target_tile = Tile.tile_at(self.character.tile.x + dx,\n self.character.tile.y + dy)\n if target_tile\n self.character.tile = target_tile\n end\n end\n\n self.character.heal(self.health_effect)\n self.character.charge(self.battery_effect)\n end\n\n if self.consumable then\n self.character.item = nil\n self.destroy\n end\n\n end", "def follow(target)\n @camera_target = target\n end", "def onalg_player_has_moved(player,color, start_x, start_y, end_x, end_y)\r\n if player != @alg_player\r\n \r\n end\r\n end", "def call_shot args\n item = args.state.call_index\n\n # selecting pocket conditional tree\n if args.state.ball_chosen\n pocket = args.state.pockets[item]\n # set the pocket's image to the highlighted version of pocket\n pocket[4] = \"sprites/highlighted_pocket.png\"\n\n # change pocket\n # Direction press\n if args.state.controller.key_down.right\n pocket[4] = \"sprites/pocket.png\"\n # ignore the \"if\" if it feels non-intuitive\n if !(item == 2 || item == 5)\n # args.state.call_index = (args.state.call_index + 3) % args.state.pockets.length\n # else\n args.state.call_index = (args.state.call_index + 1) % args.state.pockets.length\n end\n # Direction press\n elsif args.state.controller.key_down.left\n pocket[4] = \"sprites/pocket.png\"\n # ignore the \"if\" if it feels non-intuitive\n if !(item == 0 || item == 3)\n # args.state.call_index = (args.state.call_index + 3) % args.state.pockets.length\n # else\n args.state.call_index = (args.state.call_index - 1) % args.state.pockets.length\n end\n # Direction press\n elsif args.state.controller.key_down.up || args.state.controller.key_down.down\n pocket[4] = \"sprites/pocket.png\"\n args.state.call_index = (args.state.call_index + 3) % args.state.pockets.length\n end\n\n # A press\n # select pocket and start cueing up\n if args.state.controller.key_down.b\n args.state.called_pocket = pocket\n args.state.movement_mode = \"cue\"\n args.state.successful_call = false\n end\n\n # B press\n # reset pocket and go back to choosing ball\n if args.state.controller.key_down.a\n pocket[4] = \"sprites/pocket.png\"\n args.state.call_index = 0\n args.state.ball_chosen = false\n called_ball = args.state.called_ball\n called_ball[1][:path] = \"sprites/ball#{called_ball[0]}.png\"\n end\n\n # selecting ball\n else\n # only look at the current player's group\n if (args.state.player == 0 && args.state.player1_type == 0) || (args.state.player == 1 && args.state.player1_type == 1)\n current_ball = args.state.balls[1 + item]\n else \n current_ball = args.state.balls[args.state.first_stripe + item]\n end\n\n number = current_ball[:ball_number]\n image = current_ball[:path]\n\n # replace this ball's image with the highlighted version\n if !(image == \"sprites/highlighted_ball#{number}.png\")\n args.state.ball_image = number\n current_ball[:path] = \"sprites/highlighted_ball#{number}.png\" \n else\n # Direction press\n # change ball\n if args.state.controller.key_down.right\n # return the current_ball to its original image\n current_ball[:path] = \"sprites/ball#{args.state.ball_image}.png\"\n # go to the next ball\n if (args.state.player == 0 && args.state.player1_type == 0) || (args.state.player == 1 && args.state.player1_type == 1)\n args.state.call_index = (args.state.call_index + 1) % (7 - args.state.pocketed_solids)\n else\n args.state.call_index = (args.state.call_index + 1) % (7 - args.state.pocketed_stripes)\n end\n\n # Direction press\n elsif args.state.controller.key_down.left\n # return the current_ball to its original image\n current_ball[:path] = \"sprites/ball#{args.state.ball_image}.png\"\n # go to the next ball\n if (args.state.player == 0 && args.state.player1_type == 0) || (args.state.player == 1 && args.state.player1_type == 1)\n args.state.call_index =(args.state.call_index - 1) % (7 - args.state.pocketed_solids)\n else\n args.state.call_index = (args.state.call_index - 1) % (7 - args.state.pocketed_stripes)\n end\n end\n\n # R1 press L1 press\n # if table open, switch ball group (by changing first player's group)\n if args.state.table_open\n if args.state.controller.key_down.r1 || args.state.controller.key_down.l1\n args.state.player1_type = 1 - args.state.player1_type\n current_ball[:path] = \"sprites/ball#{args.state.ball_image}.png\"\n end\n end\n\n # A press\n # select ball (store its original image to bring it back to normal)\n if args.state.controller.key_down.b\n args.state.called_ball = [number, current_ball]\n args.state.ball_chosen = true\n args.state.call_index = 0\n end\n end\n end\nend", "def pbBattleAnimationOverride(viewport,trainerid=-1,trainername=\"\")\n # The following example runs a common event that ought to do a custom\n # animation if some condition is true:\n #\n # if $game_map && $game_map.map_id==20 # If on map 20\n # pbCommonEvent(20)\n # return true # Note that the battle animation is done\n # end\n #\n ##### VS. animation, by Luka S.J. #####\n ##### Tweaked by Maruno #####\n if trainerid>=0\n tbargraphic=sprintf(\"Graphics/Transitions/vsBar%s\",getConstantName(PBTrainers,trainerid)) rescue nil\n tbargraphic=sprintf(\"Graphics/Transitions/vsBar%d\",trainerid) if !pbResolveBitmap(tbargraphic)\n tgraphic=sprintf(\"Graphics/Transitions/vsTrainer%s\",getConstantName(PBTrainers,trainerid)) rescue nil\n tgraphic=sprintf(\"Graphics/Transitions/vsTrainer%d\",trainerid) if !pbResolveBitmap(tgraphic)\n if pbResolveBitmap(tbargraphic) && pbResolveBitmap(tgraphic)\n outfit=$Trainer ? $Trainer.outfit : 0\n # Set up\n viewplayer=Viewport.new(0,Graphics.height/3,Graphics.width/2,128)\n viewplayer.z=viewport.z\n viewopp=Viewport.new(Graphics.width/2,Graphics.height/3,Graphics.width/2,128)\n viewopp.z=viewport.z\n viewvs=Viewport.new(0,0,Graphics.width,Graphics.height)\n viewvs.z=viewport.z\n xoffset=(Graphics.width/2)/10\n xoffset=xoffset.round\n xoffset=xoffset*10\n fade=Sprite.new(viewport)\n fade.bitmap=BitmapCache.load_bitmap(\"Graphics/Transitions/vsFlash\")\n fade.tone=Tone.new(-255,-255,-255)\n fade.opacity=100\n overlay=Sprite.new(viewport)\n overlay.bitmap=Bitmap.new(Graphics.width,Graphics.height)\n pbSetSystemFont(overlay.bitmap)\n bar1=Sprite.new(viewplayer)\n pbargraphic=sprintf(\"Graphics/Transitions/vsBar%s_%d\",getConstantName(PBTrainers,$Trainer.trainertype),outfit) rescue nil\n pbargraphic=sprintf(\"Graphics/Transitions/vsBar%d_%d\",$Trainer.trainertype,outfit) if !pbResolveBitmap(pbargraphic)\n if !pbResolveBitmap(pbargraphic)\n pbargraphic=sprintf(\"Graphics/Transitions/vsBar%s\",getConstantName(PBTrainers,$Trainer.trainertype)) rescue nil\n end\n pbargraphic=sprintf(\"Graphics/Transitions/vsBar%d\",$Trainer.trainertype) if !pbResolveBitmap(pbargraphic)\n bar1.bitmap=BitmapCache.load_bitmap(pbargraphic)\n bar1.x=-xoffset\n bar2=Sprite.new(viewopp)\n bar2.bitmap=BitmapCache.load_bitmap(tbargraphic)\n bar2.x=xoffset\n vs=Sprite.new(viewvs)\n vs.bitmap=BitmapCache.load_bitmap(\"Graphics/Transitions/vs\")\n vs.ox=vs.bitmap.width/2\n vs.oy=vs.bitmap.height/2\n vs.x=Graphics.width/2\n vs.y=Graphics.height/1.5\n vs.visible=false\n flash=Sprite.new(viewvs)\n flash.bitmap=BitmapCache.load_bitmap(\"Graphics/Transitions/vsFlash\")\n flash.opacity=0\n # Animation\n 10.times do\n bar1.x+=xoffset/10\n bar2.x-=xoffset/10\n pbWait(1)\n end\n pbSEPlay(\"Flash2\")\n pbSEPlay(\"Sword2\")\n flash.opacity=255\n bar1.dispose\n bar2.dispose\n bar1=AnimatedPlane.new(viewplayer)\n bar1.bitmap=BitmapCache.load_bitmap(pbargraphic)\n player=Sprite.new(viewplayer)\n pgraphic=sprintf(\"Graphics/Transitions/vsTrainer%s_%d\",getConstantName(PBTrainers,$Trainer.trainertype),outfit) rescue nil\n pgraphic=sprintf(\"Graphics/Transitions/vsTrainer%d_%d\",$Trainer.trainertype,outfit) if !pbResolveBitmap(pgraphic)\n if !pbResolveBitmap(pgraphic)\n pgraphic=sprintf(\"Graphics/Transitions/vsTrainer%s\",getConstantName(PBTrainers,$Trainer.trainertype)) rescue nil\n end\n pgraphic=sprintf(\"Graphics/Transitions/vsTrainer%d\",$Trainer.trainertype) if !pbResolveBitmap(pgraphic)\n player.bitmap=BitmapCache.load_bitmap(pgraphic)\n player.x=-xoffset\n bar2=AnimatedPlane.new(viewopp)\n bar2.bitmap=BitmapCache.load_bitmap(tbargraphic)\n trainer=Sprite.new(viewopp)\n trainer.bitmap=BitmapCache.load_bitmap(tgraphic)\n trainer.x=xoffset\n trainer.tone=Tone.new(-255,-255,-255)\n 25.times do\n flash.opacity-=51 if flash.opacity>0\n bar1.ox-=16\n bar2.ox+=16\n pbWait(1)\n end\n 11.times do\n bar1.ox-=16\n bar2.ox+=16\n player.x+=xoffset/10\n trainer.x-=xoffset/10\n pbWait(1)\n end\n 2.times do\n bar1.ox-=16\n bar2.ox+=16\n player.x-=xoffset/20\n trainer.x+=xoffset/20\n pbWait(1)\n end\n 10.times do\n bar1.ox-=16\n bar2.ox+=16\n pbWait(1)\n end\n val=2\n flash.opacity=255\n vs.visible=true\n trainer.tone=Tone.new(0,0,0)\n textpos=[\n [_INTL(\"{1}\",$Trainer.name),Graphics.width/4,(Graphics.height/1.5)+10,2,\n Color.new(248,248,248),Color.new(12*6,12*6,12*6)],\n [_INTL(\"{1}\",trainername),(Graphics.width/4)+(Graphics.width/2),(Graphics.height/1.5)+10,2,\n Color.new(248,248,248),Color.new(12*6,12*6,12*6)]\n ]\n pbDrawTextPositions(overlay.bitmap,textpos)\n pbSEPlay(\"Sword2\")\n 70.times do\n bar1.ox-=16\n bar2.ox+=16\n flash.opacity-=25.5 if flash.opacity>0\n vs.x+=val\n vs.y-=val\n val=2 if vs.x<=(Graphics.width/2)-2\n val=-2 if vs.x>=(Graphics.width/2)+2\n pbWait(1)\n end\n 30.times do\n bar1.ox-=16\n bar2.ox+=16\n vs.zoom_x+=0.2\n vs.zoom_y+=0.2\n pbWait(1)\n end\n flash.tone=Tone.new(-255,-255,-255)\n 10.times do\n bar1.ox-=16\n bar2.ox+=16\n flash.opacity+=25.5\n pbWait(1)\n end\n # End\n player.dispose\n trainer.dispose\n flash.dispose\n vs.dispose\n bar1.dispose\n bar2.dispose\n overlay.dispose\n fade.dispose\n viewvs.dispose\n viewopp.dispose\n viewplayer.dispose\n viewport.color=Color.new(0,0,0,255)\n return true\n end\n end\n return false\nend", "def shoot\n\t\t\t\t# Project\n\t\t\t\t@current.shoot\n\t\t\t\tself\n\t\t\tend", "def camPrepareTarget _obj, _args\n \"_obj camPrepareTarget _args;\" \n end", "def map_onprogress(*ids, &block)\n Game_Map.onprogress(ids, &block)\n end", "def fire_torpedo\n\t\tx = (@x + @@tiles[0].width/2) - Torpedo::IMG_WIDTH / 2\n\t\ty = (@y + @@tiles[0].height/2)\n\n\t\ttorpedo = Torpedo.new(x, y, @angle)\n\t\ttorpedo.player = @player\n\t\t@game_state.add_entity(torpedo)\n\t\t@torpedo_launched = Time.new\n\n\t\t@@fire_torpedo_sound.play\n\tend", "def action_target_center\n @target_x = $scene.spriteset.battleback_width / 2\n @target_y = $scene.spriteset.battleback_height / 2\n end", "def camerainteraction(*)\n super\n end", "def shoot_at (player, x, y)\n\t\tplayer.board.grid[x][y].hit!\n\tend", "def setup_change_target\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n case @acts[1]\n # --------------------\n when 0 # Original Target\n self.area_flag = item_in_use.area?\n @target = @ori_target\n @target_array = @ori_targets.clone\n # -------------------\n when 1 # All Battler\n self.area_flag = true\n t = $game_party.alive_members + $game_troop.alive_members\n @target_array = t\n $game_temp.battler_targets += t\n # -------------------\n when 2 # All Battler except user\n self.area_flag = true\n t = $game_party.alive_members + $game_troop.alive_members\n t -= [self]\n @target_array = t\n $game_temp.battler_targets += t\n # -------------------\n when 3 # All Enemies\n self.area_flag = true\n t = opponents_unit.alive_members\n @target_array = t\n $game_temp.battler_targets += t\n # -------------------\n when 4 # All Enemies except current target\n self.area_flag = true\n t = opponents_unit.alive_members\n t -= [target]\n @target_array = t\n $game_temp.battler_targets += t\n # -------------------\n when 5 # All Allies\n self.area_flag = true\n t = friends_unit.alive_members\n @target_array = t\n $game_temp.battler_targets += t\n # -------------------\n when 6 # All Allies except user\n self.area_flag = true\n t = friends_unit.alive_members\n t -= [self]\n @target_array = t\n $game_temp.battler_targets += t\n # -------------------\n when 7 # Next random enemy\n self.area_flag = false\n @target = opponents_unit.random_target\n @target_array = [@target]\n $game_temp.battler_targets += [@target]\n # -------------------\n when 8 # Next random ally\n self.area_flag = false\n @target = friends_unit.random_target\n @target_array = [@target]\n $game_temp.battler_targets += [@target]\n # -------------------\n when 9 # Absolute Targets (Enemies)\n self.area_flag = true\n @target_array = opponents_unit.abs_target(@acts[2])\n @target_array -= [target] if @acts[3]\n $game_temp.battler_targets += @target_array\n # -------------------\n when 10 # Absolute Target (Allies)\n self.area_flag = true\n @target_array = friends_unit.abs_target(@acts[2])\n @target_array -= [target] if @acts[3]\n $game_temp.battler_targets += @target_array\n # -------------------\n when 11 # self\n self.area_flag = false\n @target = self\n @target_array = [@target]\n $game_temp.battler_targets += [@target]\n end\n end", "def trigger(owner, event, *args); end", "def call_idle(sprite, anime)\n $game_player.set_step_anime(anime)\n $game_player.set_graphic(sprite)\n end", "def target!\n @target\n end", "def setup_target_anim(target, ary)\n return unless target\n anim_id = target.anim_guard_id # Animation guard\n is_self = target == self # Determine if self\n # ------------------------------------------------------------------------\n # Animation guard activation conditions\n # ------------------------------------------------------------------------\n condition = !is_self && anim_id > 0 && !item_in_use.damage.recover? &&\n !item_in_use.ignore_anim_guard? && !ary[3] && !item_in_use.parallel_anim?\n # ------------------------------------------------------------------------\n # Condition list :\n # > Animation guard won't be played to self targeting\n # > Animation guard won't be played if the index is 0 or less\n # > Animation guard won't be played if item/skill is recovery\n # > Animation guard won't be played if item/skill ignores it\n # > Animation guard won't be played if explicitly ignores in sequence\n # > Animation guard won't be played if item is parallel animation. Instead,\n # it will be played simultaneously when [:target_damage,] is triggered\n # ------------------------------------------------------------------------\n # If anim_id explicitly given\n if ary[1]\n result_anim = (condition && ary[1] > 0 ? anim_id : ary[1])\n target.animation_id = result_anim\n target.animation_mirror = flip || ary[2]\n # If self is an Actor and skill/item use normal attack animation\n elsif self.is_a?(Game_Actor) && item_in_use.animation_id == -1\n result_anim = (condition ? anim_id : atk_animation_id1)\n target.animation_id = result_anim\n target.animation_mirror = flip || ary[2]\n # If anything ...\n else\n result_anim = (condition ? anim_id : item_in_use.animation_id)\n target.animation_id = result_anim\n target.animation_mirror = flip || ary[2]\n end\n target.sprite.setup_new_animation\n end", "def computer_shot(coordinate)\n human_player.board.cells[coordinate].fire_upon\n end", "def use_item_nontarget\n Sound.play_use_item\n $game_party.consume_item(@item)\n @item_window.draw_item(@item_window.index)\n @target_window.window_update($game_party.members)\n if $game_party.all_dead?\n $scene = Scene_Gameover.new\n elsif @item.common_event_id > 0\n $game_temp.common_event_id = @item.common_event_id\n $scene = Scene_Map.new\n end\n end", "def use_item_nontarget\n Sound.play_use_item\n $game_party.consume_item(@item)\n @item_window.draw_item(@item_window.index)\n @target_window.window_update($game_party.members)\n if $game_party.all_dead?\n $scene = Scene_Gameover.new\n elsif @item.common_event_id > 0\n $game_temp.common_event_id = @item.common_event_id\n $scene = Scene_Map.new\n end\n end", "def received_shot(row, column)\n\t\traise \"You have already been here.\" if been_here?(row, column)\n\t\treturn miss(row, column) if empty?(row, column) \n\t\thit(row,column) \n\tend", "def blit; end", "def hit; end", "def second_shot_complete? frame\n frame.shot_2 != nil\n end", "def magazinesTurret _obj, _args\n \"_obj magazinesTurret _args;\" \n end", "def shoot! &block\n raise DeprecationError.new('Using Artist#shoot! without a block had been deprecated') unless block_given?\n\n Capybara.using_wait_time @options[:capybara_wait_time] do\n begin\n browser.visit @options[:url]\n\n @before_hook.call(browser) if @before_hook\n\n if @options[:selector]\n browser.wait_until do\n browser.has_css? @options[:selector]\n end\n else\n sleep @options[:sleep]\n end\n\n tempfile = Tempfile.new(['photograph','.png'])\n\n browser.driver.render tempfile.path,\n :width => options[:w] + options[:x],\n :height => options[:h] + options[:y]\n\n yield adjust_image(tempfile)\n ensure\n tempfile.unlink if tempfile\n end\n end\n end", "def target; end", "def target; end", "def onpong(&blk); super; end", "def tick!\n rotate_turret\n shoot\n end", "def target_acquired(board)\n puts \"#{@name} has acquired a target.\\nPrepare for imminent destruction.\"\n if board.hits.length == 1\n board.pos_cross(board.hits[0]).sample\n else\n target_direction(board, board.hits.sort)\n end\n end", "def setup_smooth_move_target\n targets = current_action_targets\n size = targets.size\n xpos = targets.inject(0){|r, battler| r + battler.map_char.x} / size\n ypos = targets.inject(0){|r, battler| r + battler.map_char.y} / size\n xpos += @acts[1]\n xpos *= -1 if flip && !@ignore_flip_point\n rev = @acts[3].nil? ? true : (@acts[3] || false)\n smooth_move(xpos, ypos + @acts[2], @acts[3])\n end", "def exec_tape(cmds)\n @tape.cell(cmds[:tape]) if cmds[:tape]\n end", "def register_shot(at_coordinates)\n @array[at_coordinates[0]][at_coordinates[1]] = \"o\" if @array[at_coordinates[0]][at_coordinates[1]] == \"\"\n end", "def tick_main_sequence\n @avatar.assign(@tileset.sprite_for(@avatar.cur_tile)) if @avatar.tick\n @camera.start_following(@avatar) if @avatar.walking\n @avatar.reposition(*@camera.follow)\n @map.change_tiles(*@camera.pos)\n end", "def main_sprite ; end", "def touch_began(touch); end", "def pbHitAndHPLossAnimation(targets)\n @briefMessage = false\n self.afterAnim = false\n # wait\n self.wait(4, true)\n # prepare soundeffect\n effect = []\n indexes = []\n for t in targets\n effect.push(t[2])\n indexes.push(t[0].index)\n @sprites[\"dataBox_#{t[0].index}\"].damage\n @sprites[\"dataBox_#{t[0].index}\"].animateHP(t[1], t[0].hp)\n end\n # play damage SE\n case effect.max\n when 0; pbSEPlay(\"Battle damage normal\")\n when 1; pbSEPlay(\"Battle damage weak\")\n when 2; pbSEPlay(\"Battle damage super\")\n end\n # begin animation\n for k in 1..(effect.max == 2 ? 3 : 2)\n for i in 0...8\n for t in targets\n next if k > (t[2] == 2 ? 3 : 2)\n ebDamageStateAnim(t[0], t[2], i, k > 1)\n end\n # wait frames\n self.wait(1, true)\n end\n end\n # animations for triggering Substitute\n self.substitueAll(indexes)\n # try set low HP BGM music\n setBGMLowHP(false)\n setBGMLowHP(true)\n # try to process the speech\n for t in targets\n # displays opposing trainer message if Pokemon falls to low HP\n hpchange = t[0].hp - t[1]\n handled = pbTrainerBattleSpeech(playerBattler?(t[0]) ? \"damage\" : \"damageOpp\") if hpchange.abs/t[0].totalhp.to_f >= 0.6 && hpchange < 0\n handled = pbTrainerBattleSpeech(playerBattler?(t[0]) ? \"resist\" : \"resistOpp\") if hpchange.abs/t[0].totalhp.to_f <= 0.1 && hpchange < 0 && !handled\n handled = pbTrainerBattleSpeech(playerBattler?(t[0]) ? \"lowHP\" : \"lowHPOpp\") if t[0].hp > 0 && (t[0].hp < t[0].totalhp*0.3) && !handled\n handled = pbTrainerBattleSpeech(playerBattler?(t[0]) ? \"halfHP\" : \"halfHPOpp\") if t[0].hp > 0 && (t[0].hp < t[0].totalhp*0.5) && !handled\n break if handled\n end\n end", "def cue_shot args\n x_raw = args.state.controller.right_analog_x_raw\n y_raw = args.state.controller.right_analog_y_raw\n\n # R2 press\n shot = args.state.controller.key_down.r2\n\n cue_vector = (x_raw ** 2) + (y_raw ** 2)\n if cue_vector != 0\n\n # get unit vector for diraction to apply power\n unit_x = x_raw / (cue_vector ** (1 / 2))\n unit_y = y_raw / (cue_vector ** (1 / 2))\n # used for debugging\n mag_unit = (unit_x ** 2) + (unit_y ** 2)\n\n # make power of shot proportional to size of vector (make it proportional to its greatest x or y raw)\n if x_raw.abs() > y_raw.abs()\n power = args.state.max_cue_power * (x_raw.abs() / 32000)\n else\n power = args.state.max_cue_power * (y_raw.abs() / 32000)\n end\n\n # make the shot if right trigger pressed\n if shot\n args.state.cueball[:velX] -= power * unit_x\n args.state.cueball[:velY] -= power * unit_y\n args.state.movement_mode = \"shot\"\n args.state.cueball[:path] = \"sprites/cueball.png\"\n args.state.sunk = false\n args.outputs.sounds << \"sounds/cue_hit.wav\"\n end\n\n return [unit_x, unit_y, power]\n else\n if shot\n args.state.movement_mode = \"cue\"\n args.state.cueball[:path] = \"sprites/cueball.png\"\n end\n return [0, 0, 0]\n end\nend", "def execute_enemy_talk_action\n $game_temp.talking_actor = @subject\n target_index = @subject.current_action.target_index\n target = $game_troop.members[target_index]\n @log_window.display_talk_action(@subject, target)\n $game_troop.setup_talk_event(@subject.current_action.target_index)\n while !scene_changing?\n $game_troop.interpreter.update\n target.sprite_effect_type = :whiten if target.alive?\n break unless $game_troop.interpreter.running?\n update_for_wait\n end\n $game_temp.talking_actor = nil\n end", "def receive_damage\n @hit_points-= 10\n end", "def shootLaser\n if laser.canFire && !laserFiring\n @laserFiring = true\n startLaserCountdown\n end\n end", "def assignedTarget _args\n \"assignedTarget _args;\" \n end", "def perform_damage_effect\n end", "def perform_damage_effect\n end", "def touched_by bullet\n ([@width, @height].max/3).times do\n p_vx = rand(100)/10.0 - 5\n p_vy = rand(100)/10.0 - 5\n #@window.particles << Particle.new(@window, @x + rand(@width) - @width/2, @y + rand(@height) - @height/2, p_vx, p_vy)\n @window.particles << Live_Particle.new(@window, bullet.x + rand(@width) - @width/2, bullet.y + rand(@height) - @height/2, p_vx, p_vy, @colors.rand_in, 1 + rand)\n end\n damage bullet.damage\n end", "def wave_shot\n (-4..4).each do |angle_offset|\n self.basic_shot(:angle => 10 * angle_offset + @angle + 90)\n end\n end", "def update\n @live_shots = self.shots.length\n self.shots.each do |shot|\n shot.update\n end\n self.shots.delete_if do |shot|\n shot.deleted?\n end\n\n self.game.objects.each do |object|\n if object.tags.include? \"enemy_shot\"\n if Gosu::distance(object.x,object.y,@x,@y) < 10\n @health -= 1\n object.delete\n end\n end\n end\n end", "def perform\n $driver.multi_touch @actions\n end", "def trigger_actor_action(char, in_sight_a, in_sight_e)\n # make copies of the original perception arrays\n in_sight_a_org, in_sight_e_org = in_sight_a, in_sight_e\n # check each trigger\n char.battler.triggers.each {|trigger|\n # restore percepted battlers\n in_sight_a, in_sight_e = in_sight_a_org.clone, in_sight_e_org.clone\n # reset target\n target = nil\n # get triggering battlers\n activators = case trigger.activator\n when TRGLeader then [$game_player]\n when TRGAlly then $BlizzABS.battlers.find_all {|b| b.valid?}\n when TRGSelf then [char]\n when TRGEnemy then in_sight_e.clone\n when TRGProbability then nil\n end\n # if battler activator\n if trigger.battler_activator?\n # if any trigger exists\n if activators.size > 0\n # get a target from the trigger\n target = trigger.get_a_target(char, activators)\n end\n # if probability worked\n elsif rand(100) < trigger.value\n # default target flag\n target = true\n end\n # check next trigger if this one hasn't been activated\n next if target == nil\n # temporary variables\n basic, type, skill, scope, id = nil, 0, false, 0, trigger.action_data\n # check trigger action type\n case trigger.action_type\n when TRGAttack\n # set attack data for later processing if can attack\n basic, type, scope = true, 0, 1 if char.attack_can_use?\n when TRGDefend\n # set defend data for later processing\n basic, type, scope = true, 1, 0\n when TRGSkill\n # if can use skill\n if char.skill_can_use?(id)\n # set skill data for later processing\n basic, skill, scope = false, true, $data_skills[id].scope\n end\n when TRGItem\n # if can use item\n if char.item_can_use?(id)\n # set item data for later processing\n basic, scope = false, $data_items[id].scope\n end\n end\n # check next trigger if action can't be executed\n next if basic == nil\n # get targeting scope data\n enemy, dead, all = $BlizzABS.util.get_scope_data(scope)\n # if actual target exists and not targeting multiple battlers\n if target != true && !all\n # if targeting enemies\n if enemy\n # if chosen target is not part of enemy group\n unless in_sight_e.include?(target)\n # get a new target\n target = in_sight_e[rand(in_sight_e.size)]\n end\n else\n # filter all dead allies if targeting dead allies\n in_sight_a = in_sight_a.find_all {|a| a.battler.dead?} if dead\n # if chosen target is not part of ally group\n unless in_sight_a.include?(target)\n # get a new target\n target = in_sight_a[rand(in_sight_a.size)]\n end\n end\n # force this target to be the only one targetable\n in_sight_a, in_sight_e = [target], [target]\n end\n # set up action data\n normal_action(char, in_sight_a, in_sight_e, basic, type,\n (15 - char.ai.offensive) * 10, 0, id, skill, false)\n # trigger has been activated, abort\n return true}\n # no trigger has been activated\n return false\n end", "def shot_params\n params[:shot]\n end", "def update_balloon\n if @balloon_duration > 0\n @balloon_duration -= 1\n if @balloon_duration > 0\n @balloon_sprite.x = x\n @balloon_sprite.y = y - oy\n @balloon_sprite.z = z + 200\n sx = balloon_frame_index * 32\n sy = (@balloon_id - 1) * 32\n @balloon_sprite.src_rect.set(sx, sy, 32, 32)\n else\n end_balloon\n end\n end\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 render_enemy_bullet args\n args.outputs.sprites << {\n x: args.state.enemy_bullet_x,\n y: args.state.enemy_bullet_y,\n w: args.state.enemy_bullet_w,\n h: args.state.enemy_bullet_h,\n path: 'sprites/square/orange.png'\n }\nend" ]
[ "0.60665846", "0.6014906", "0.6010438", "0.5983", "0.5895074", "0.588549", "0.58731693", "0.58648145", "0.58545506", "0.5844319", "0.5840307", "0.5747669", "0.57458043", "0.5666977", "0.56394774", "0.5603566", "0.55389214", "0.5521687", "0.5496951", "0.5493366", "0.545965", "0.5446637", "0.5434588", "0.5423305", "0.5423305", "0.5423305", "0.5398078", "0.53886074", "0.5381526", "0.5353636", "0.5340879", "0.53379136", "0.533177", "0.5318237", "0.53149295", "0.53006107", "0.52993906", "0.528131", "0.52805036", "0.5279123", "0.5278674", "0.5257977", "0.52481467", "0.52472633", "0.5230079", "0.52299297", "0.5218588", "0.51935697", "0.51697636", "0.5166807", "0.5158014", "0.51511425", "0.5119192", "0.51050663", "0.5102772", "0.5097261", "0.50959235", "0.509532", "0.5071846", "0.5067684", "0.5064386", "0.50578904", "0.5057182", "0.5057004", "0.50516623", "0.50485444", "0.50485444", "0.5046608", "0.50461954", "0.5038317", "0.50274694", "0.5026657", "0.5019096", "0.50175923", "0.50175923", "0.5011642", "0.50101787", "0.50040734", "0.49995637", "0.49976683", "0.49944383", "0.49923918", "0.49844933", "0.4980461", "0.49656516", "0.49547547", "0.4952821", "0.49462026", "0.49420285", "0.49412197", "0.49400598", "0.49400598", "0.4939702", "0.4937276", "0.4935425", "0.49225807", "0.49198315", "0.49197036", "0.4915932", "0.4914964", "0.4904293" ]
0.0
-1
for Rails < 6
def test_works get products_url assert_response :success assert_equal 1, Ahoy::Visit.count assert_equal 1, Ahoy::Event.count event = Ahoy::Event.last assert_equal "Viewed products", event.name assert_equal({}, event.properties) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def version_helper; end", "def version_helper; end", "def version_helper; end", "def version_helper; end", "def dependencies; end", "def dependencies; end", "def dependencies; end", "def vendor; end", "def appraisals; end", "def appraisals; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def rails_versions\n @rails_versions ||= gem_versions('rails')\nend", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def refutal()\n end", "def before_setup; end", "def probers; end", "def sitemaps; end", "def before_bootstrap; end", "def ordered_railties; end", "def ordered_railties; end", "def resolver; end", "def php_version\n \"5.6\"\n end", "def schubert; end", "def ext; end", "def ext; end", "def apis; end", "def target_version; end", "def helpers; end", "def helpers; end", "def helpers; end", "def extra; end", "def before_run; end", "def requirements; end", "def requirements; end", "def requirements; end", "def requirements; end", "def libs; end", "def verdi; end", "def ruby_version; '2.6.3' end", "def available; end", "def available; end", "def user_os_complex\r\n end", "def intensifier; end", "def migration_railties; end", "def migration_railties; end", "def installed_versions; end", "def get_version()\n\t\tend", "def ready; end", "def ready; end", "def support\n raise \"Not implemented\"\n end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def railties_order; end", "def railties_order; end", "def server_version; end" ]
[ "0.65551776", "0.5857164", "0.5857164", "0.5857164", "0.5857164", "0.56520194", "0.56520194", "0.56520194", "0.56059843", "0.5593165", "0.5593165", "0.5574186", "0.5574186", "0.5574186", "0.5574186", "0.5574186", "0.5574186", "0.5574186", "0.5574186", "0.5574186", "0.5574186", "0.5574186", "0.5574186", "0.5574186", "0.5574186", "0.5574186", "0.5574186", "0.5574186", "0.5574186", "0.5574186", "0.5574186", "0.5574186", "0.5574186", "0.5574186", "0.5539998", "0.5530034", "0.5530034", "0.5530034", "0.5530034", "0.55072975", "0.5486103", "0.54801476", "0.54459065", "0.5435173", "0.54236966", "0.54236966", "0.54156345", "0.5411608", "0.5409731", "0.5404979", "0.5404979", "0.54021865", "0.5401838", "0.53932106", "0.53932106", "0.53932106", "0.538781", "0.5377253", "0.5362214", "0.5362214", "0.5362214", "0.5362214", "0.535055", "0.533613", "0.5332499", "0.53266907", "0.53266907", "0.53232515", "0.53202796", "0.53038627", "0.53038627", "0.52966785", "0.5295205", "0.5289496", "0.5289496", "0.5273498", "0.5256917", "0.5256917", "0.5256917", "0.5256917", "0.5256917", "0.5256917", "0.5256917", "0.5256917", "0.5256917", "0.5256917", "0.5256917", "0.5256917", "0.5256917", "0.5256917", "0.5256917", "0.5256917", "0.5256917", "0.5256917", "0.5256917", "0.5256917", "0.5256917", "0.5256917", "0.52313256", "0.52313256", "0.52312887" ]
0.0
-1
::new Application with parameters. Parses options Sets loglevel
def initialize(*args) parse_options(*args) set_log_level @@application = self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(appname = nil)\n @appname = appname\n @log = Logger.new(STDERR)\n @log.progname = @appname\n @level = @log.level\n end", "def initialize app, logger: nil\n @app = app\n @logger = logger\n end", "def app\n # TODO: set logging level shouldn't be a class method.\n CourseList.setLoggingLevel \"ERROR\"\n CourseList.new\n end", "def initialize(options = {}, &blk)\n options ||= {}\n options[:type] = :application\n init(options, &blk)\n end", "def initialize(options = nil)\n @options = options\n @app = options[:app] if options && options[:app]\n end", "def initialize app, options = {}\n @app = app\n @except = Array(options[:except]).map { |e| regexpify e }\n @log = options[:log]\n @only = Array(options[:only]).map { |o| regexpify o }\n @path = options[:path] || \"/\"\n\n if FalseClass === @log\n @log = lambda { |m| }\n elsif !@log\n if defined? Rails\n @log = lambda { |m| Rails.logger.info \" [Onesie] #{m}\" }\n else\n @log = lambda { |m| puts \"[Onesie] #{m}\" }\n end\n end\n end", "def initialize(options = {})\n color = options[:color]\n\n @loggers = []\n @loggers << @logdev = logdev_logger(options[:logdev]) if options[:logdev]\n @loggers << stdout_logger(options[:stdout], color) if options[:stdout]\n @loggers << stdout_logger($stdout, color) if @loggers.empty?\n\n self.progname = options[:progname] || 'Omnitest'\n self.level = options[:level] || default_log_level\n end", "def initialize(app, logger:)\n @app = app\n @logger = logger\n end", "def initialize(options = {})\n\t\t\t@logger = Logger.new(STDOUT)\n\t\t\t@logger.level = Logger::INFO\n\t\tend", "def initialize(app, logger)\n @app = app\n @logger = logger\n end", "def initialize(app, logger)\n @app = app\n @logger = logger\n end", "def initialize(options = {})\n @options = default_options.merge(options)\n @app = @options.delete(:app)\n end", "def initialize(program_name = 'rails')\n @level = Logger::DEBUG\n\n return if defined? SYSLOG\n self.class.const_set :SYSLOG, Syslog.open(program_name)\n end", "def initialize(*args)\n # Handle default\n if args.empty?\n args = [STDOUT]\n end\n\n # Initialization\n @default_level = Logger::Severity::INFO\n @formatter = ::TeeLogger::Formatter.new\n @loggers = {}\n @ios = {}\n\n # Load built-in filters\n load_filters(*args)\n\n # Create logs for all arguments\n args.each do |arg|\n add_logger(arg)\n end\n end", "def new(*args, &bk)\n setup_application!\n super(*args, &bk)\n end", "def initialize(options = {})\n @logger = options[:logger]\n end", "def initialize\n @logger = RubyConfigr::AppLogger.get_logger();\n end", "def initialize(options,args)\n @options = (options||{}).each{|k,v| {k => v} }\n @args = args\n GmailCli::Logger.set_log_mode(options[:verbose])\n end", "def initialize(options={})\n @options = options.dup\n\n Logger.set(*@options[:log_to])\n end", "def new\n\t\t@application = Application.new\t\t\n\tend", "def init(*opts)\n if opts.length == 0\n @logger = Logger.new(STDOUT)\n else\n @logger = Logger.new(*opts)\n end\n @logger.formatter = Ohai::Log::Formatter.new()\n level(Ohai::Config.log_level)\n end", "def initialize(options={})\n @root = File.expand_path('../../../../../', __FILE__)\n \n if @log.nil?\n # @logdir = @root + \"/log/worker\"\n # FileUtils.mkdir_p @logdir\n # @logfile = @logdir + \"/#{self.class.to_s.downcase}.log\"\n # FileUtils.touch @logfile\n \n @log = Logger.new(STDOUT) #MultiDelegator.delegate(:write, :close).to(STDOUT, File.open(@logfile,'a'))\n @log.level = Logger::WARN # TODO Only log if development environment\n \n @log.formatter = proc do |severity, datetime, progname, msg|\n \"[#{severity}] - #{datetime}: #{msg}\\n\"\n end\n \n @log.info(\"Started logging in: #{@logfile}\")\n end\n \n return self\n end", "def initialize options\n log_file = options['file'] || default_log_file\n @logger = Logger.new log_file\n end", "def get_log_args\n args = {}\n args[\"APP_UUID\"] = @application.uuid if @application\n args[\"DOMAIN\"] = (@application.domain_namespace if @application) || (@domain.namespace if @domain)\n args\n end", "def initialize(args)\n\t\t\t\t# Initialize types\n\t\t\t\t@@valid_types = {bool: [], string: [String, \"\"], int: [Integer, 0], float: [Float, 0.0], choice: [String, \"\"], list: [Array, []], action: []}\n\n\t\t\t\t# Copy arguments\n\t\t\t\t@app_name = args[:name]\n\t\t\t\t@app_version = args[:version]\n\t\t\t\t@description = args[:description]\n\t\t\t\t@usage = args[:usage]\n\n\t\t\t\t# Copy messages\n\t\t\t\tmessages = args[:messages] || {}\n\t\t\t\tif messages.is_a?(Hash) then\n\t\t\t\t\t@messages = messages\n\t\t\t\telse\n\t\t\t\t\t@console.fatal(msg: \"CowtechLib::OptionParser::initialize msgs argument must be an hash.\")\n\t\t\t\tend\n\n\t\t\t\t# Initialize variables\n\t\t\t\t@console = Console.new\n\t\t\t\t@inserted = {name: [], short: [], long: []}\n\t\t\t\t@options = {}\n\t\t\t\t@options_map = {}\n\t\t\t\t@args = []\n\t\t\t\t@cmdline = ARGV.clone\n\n\t\t\t\tself << {name: \"help\", short: \"-h\", long: \"--help\", type: :bool, help: \"Show this message.\", priority: 1000}\n\t\t\tend", "def initialize(logdevs = {}, progname = nil, shift_age = 0, shift_size = 1_048_576)\n super(nil, shift_age, shift_size)\n @progname = progname\n @shift_age = shift_age\n @shift_size = shift_size\n @lowest_level = DEFAULT_LEVEL\n configure_logs(logdevs)\n end", "def initialize(app, config_options = {})\n super(app)\n @config = Config.new(config_options)\n end", "def initialize(options = {})\n\n # If there's no logger, let's get it setup.\n @logger = Logger.new(STDOUT) if !@logger\n\n end", "def initialize app_data\n\n @options = OpenStruct.new\n @app_data = app_data\n @logger = ARINcli::Logger.new\n\n config_file_name = Config.formulate_config_file_name( @app_data )\n if File.exist?( config_file_name )\n @config = YAML.load( File.open( config_file_name ) )\n else\n @config = YAML.load( @@yaml_config )\n end\n\n configure_logger()\n end", "def initialize(app, options)\n @app, @options = app, options\n end", "def initialize(app, options)\n @app, @options = app, options\n end", "def parse_options\n OptionParser.accept(Logger::Severity,/[0-4]/) do |s|\n case s\n when \"0\" then Logger::DEBUG\n when \"1\" then Logger::INFO\n when \"2\" then Logger::WARN\n when \"3\" then Logger::ERROR\n when \"4\" then Logger::FATAL\n else nil\n end\n end\n @optparse = OptionParser.new\n @optparse.banner = \"Usage: #{$0} [options]\"\n @optparse.define_head \"This is a Ruby application\"\n @optparse.set_summary_indent(\" \")\n @optparse.separator \"\"\n @optparse.on( '-v', '--verbose=<SEVERITY>','--[no-]verbose', Logger::Severity, '0:DEBUG/1:INFO/2:WARN/3:ERROR/4:FATAL/NONE' ) do |severity|\n @options[:verbose] = (severity==false)? nil : severity\n end\n @optparse.on( '-l', '--logfile=<logfile>', String, 'The name of the log file (verbose!=NONE)' ) do |logfile|\n @options[:logfile] = logfile\n end\n @optparse.on_tail(\"-h\", \"--help\", \"Show this message\") do\n STDOUT.puts @optparse\n exit(0)\n end\n end", "def initialize(opt)\n raise ArgumentError unless opt.kind_of? Hash\n @config = {\n confdir: File.dirname(__FILE__) + '/../etc',\n logger: Logger.new('/dev/null'),\n site: nil,\n }.merge(opt)\n \n @log = @config[:logger]\n @log.level = Logger::DEBUG\n @log.debug \"starting log\"\n\n check_sanity\n @config.each { |k,v| instance_variable_set(\"@#{k}\", v) }\n\n #TODO:@wato = Check_MK::Wato.new(@confdir)\n end", "def initialize( options )\n\t\tLoggability.format_as( :color ) if $stderr.tty?\n\t\t@options = options\n\n\t\tif @options.debug\n\t\t\t$DEBUG = true\n\t\t\t$VERBOSE = true\n\t\t\tLoggability.level = Logger::DEBUG\n\t\telsif @options.loglevel\n\t\t\tLoggability.level = @options.loglevel\n\t\tend\n\n\t\tMongrel2::Config.configure( :configdb => @options.config )\n\tend", "def application\n @application || SemanticLogger.application\n end", "def create_application_options\n option_separator\n option_separator 'Application specific options:'\n end", "def initialize(options = {})\n @appname = File.basename($0)\n @description = []\n @examples = []\n @options = {}\n @parser = OptionParser.new do |opts|\n opts.summary_width = 10\n opts.banner = ''\n opts.on('-h', '--help', 'Display this help text.') do\n @help = true\n end\n end\n self.description = options[:description] if options[:description]\n self.examples = options[:examples] if options[:examples]\n end", "def new(name)\n ARGV.shift\n #@log.debug \"command 'new' with arguments: #{ARGV.join(', ')}\"\n Generator::Application.start ARGV\n end", "def initialize(options)\n\n #check if log/ exists and create it if it doesn't\n if File.directory?(\"log\") == false\n Dir.mkdir \"log\"\n end\n\n @options = options\n end", "def initialize(app, opts = nil)\n @app = app\n @config = Marlowe::Config.override(opts)\n end", "def app(*args)\n\t\tif args == []\n\t\t\treturn MRA_App\n\t\telse\n\t\t\treturn MRA_App.by_name(*args)\n\t\tend\n\tend", "def initialize(app, opts = {})\n @app = app\n @opts = opts\n end", "def initialize(aOptions)\n\t\t@options = aOptions\n\t\t@thread = nil\n\t\t@name = aOptions[:name] || random_word(8,8)\n\t\tif not @logger = aOptions[:logger]\n\t\t\t@logger = Logger.new(STDERR)\n\t\t\t@logger.level = Logger::DEBUG\n\t\tend\n\t\tself.start() if aOptions[:auto_start]\n\tend", "def initialize(app, options_hash={}, &block)\n super\n end", "def initialize(options = {})\n @options = merge_options({}, options || {})\n @logger = @options[:logger] || Logger.new($stdout, level: :fatal)\n end", "def initialize(params={})\n @application = Aurita::Main::Application\n @decorator = Aurita::Main::Default_Decorator.new\n @logger = params[:logger]\n @logger ||= Aurita::Log::Class_Logger.new('Dispatcher')\n @benchmark_time = 0\n @num_dispatches = 0 \n end", "def initialize(options = {}, &block)\n # Backward compatibility\n options = { level: options } unless options.is_a?(Hash)\n options = options.dup\n level = options.delete(:level)\n filter = options.delete(:filter)\n @formatter = extract_formatter(options.delete(:formatter), &block)\n @app_name = options.delete(:app_name)\n @host = options.delete(:host)\n fail(ArgumentError, \"Unknown options: #{options.inspect}\") unless options.empty?\n\n # Subscribers don't take a class name, so use this class name if an subscriber\n # is logged to directly\n super(self.class, level, filter)\n end", "def logger(**opts); end", "def set_options(options)\n super(options)\n if !(filename = options[:filename]).nil?\n max_file_size = options.fetch(:max_file_size, options.fetch(:shift_size, 1048576))\n max_file_count = options.fetch(:max_file_count, options.fetch(:shift_age, 7))\n @logger = Logger.new(filename, max_file_count, max_file_size)\n elsif !(stream = options[:stream]).nil?\n @logger = Logger.new(stream)\n else\n @logger = Logger.new(STDOUT)\n end\n @logger.severity = options[:severity] if options.has_key?(:severity)\n @formatter = options.fetch(:formatter, nil)\n @logger.formatter = proc { |s,t,p,m| m }\n @name = 'Logger' if @name.nil?\n end", "def initialize(logger=Logger.new(STDERR))\n setup_signals\n @logger = logger\n @logger.level = level_from_env || Logger::INFO\n end", "def initialize(options={})\n self.config_file = options[:config_file] || 'config/librato.yml'\n super()\n self.log_prefix = '[librato-rails] '\n end", "def set_up_logging\n\n if @parameters[:log_to_file] then\n\n @logger = Logger.new(@parameters[:log_to_file])\n\n else\n\n @logger = Logger.new(STDOUT)\n\n end\n\n if @parameters[:log_detailed_messages] then\n \n @logger.sev_threshold = Logger::DEBUG\n\n else\n\n @logger.sev_threshold = Logger::INFO\n\n end\n\n end", "def initialize(logger, options = T.unsafe(nil)); end", "def initialize(application)\n @application = application\n end", "def initialize(level, options = {})\n @severity = level\n @logger = options[:logger] if options[:logger]\n default_options = { verbose: false }\n @options = OpenStruct.new(default_options.merge(options))\n end", "def initialize(*args)\n super(*args)\n @title = \"Object Log Application\"\n # NOTE: Main App URL is a hack...works with most examples\n @nav_bar = <<-EOS\n <ul class=\"menu\">\n <li><a href=\"#{@main_app_url}\">Main App</a></li>\n <li><a href=\"#{path_for('/')}\">Main Object</a></li>\n <li><a href=\"#{path_for('/objectlog')}\">ObjectLog</a></li>\n <li><a href=\"#{path_for('/clear')}\">Clear Log</a></li>\n </ul>\n EOS\n end", "def initialize(application)\n @application = application\n end", "def initialize app, args={}\n @app = app\n @master = false\n @master_info = @app.master\n @server_info = @app.cur_server\n @modules = []\n @close_watcher = args[:close_watcher]\n @console_service = CitrusAdmin::ConsoleService.create_monitor_console({\n :env => @app.env,\n :host => @master_info[:host],\n :port => @master_info[:port],\n :server_id => @server_info[:server_id],\n :server_type => @app.server_type,\n :server_info => @server_info,\n :auth_server => nil\n })\n end", "def initialize(log_level = 'debug')\n @logger = Logger.new(STDOUT, level: log_level)\n end", "def initialize(app); end", "def configure_logger_for(name)\n logger = Logger.new(@logdev, @shift_age, @shift_size)\n logger.level = @level\n logger.progname = name\n logger.formatter = formatter\n logger\n end", "def initialize(*args)\n super(*args)\n @title = \"Object Log Application\"\n # NOTE: Main App URL is a hack...works with most examples\n @nav_bar = <<-EOS\n <ul class=\"menu\">\n <li><a href=\"#{@@main_app_url}\">Main App</a></li>\n <li><a href=\"#{path_for('/')}\">Main Object</a></li>\n <li><a href=\"#{path_for('/objectlog')}\">ObjectLog</a></li>\n <li><a href=\"#{path_for('/clear')}\">Clear Log</a></li>\n </ul>\n EOS\n end", "def initialize\n @log = Logging::Logger[self]\n @options = self.default_options\n end", "def initialize(app, options = {})\n @app = app\n @printer = parse_printer(options[:printer])\n @times = (options[:times] || 1).to_i\n end", "def initialize options = {}\n @flog = Flog.new options\n end", "def initialize(*args)\n @init_args = args\n set_log(*args)\n end", "def initialize(app, &block)\n\n @app = app\n\n set Footprint::Log::Basic, STDOUT\n\n @app.class.send(:define_method, :logger,\n Proc.new do\n @env[:footprint_logger]\n end)\n\n self.instance_eval &block if block\n end", "def application!\n res = get!(APPLICATION_PATH)\n build_application(res)\n end", "def initialize (app, option)\n @app = app\n @path = option[:app_path]\n end", "def initialize(options = {})\n application_configuration.merge!(options)\n configuration_options.each do |key|\n send(\"#{key}=\", application_configuration[key])\n end\n end", "def app=(_arg0); end", "def initialize(log_level: nil, **opts)\n @debugger_address = opts.delete(:debugger_address) { true }\n opts[:accept_insecure_certs] = true unless opts.key?(:accept_insecure_certs)\n\n super(**opts)\n\n @options[:args] ||= []\n @options[:prefs] ||= {}\n @options[:env] ||= {}\n @options[:log] ||= {level: log_level} if log_level\n\n process_profile(@options.delete(:profile))\n end", "def initialize(*, verbose: '1', log_file: STDERR, **)\n v = (verbose =~ /\\d+/) ? verbose.to_i : verbose.to_sym\n self.logger = Logger.new(log_file, v)\n end", "def initialize(name = DEFAULT_NAME, options = DEFAULT_OPTIONS)\n @app_name = name\n @daemon_options = options\n super({})\n end", "def initialize( )\n ::Logging.init unless ::Logging.initialized?\n\n @name = 'root'\n @appenders = []\n @additive = false\n @caller_tracing = false\n @level = 0\n ::Logging::Logger.define_log_methods(self)\n end", "def initialize\n @options = ArgumentParser.parse\n Environment.environment = @options[:environment] || \"production\"\n + @options.delete(:environment)\n end", "def initialize(name, opts = {})\n super(name, opts)\n if url = opts['collect']\n h = {}\n opts.each {|k, v| h[k.to_sym] = v}\n opts = h\n\n opts[:domain] ||= 'log'\n opts[:appName] ||= File.basename(__FILE__, '.*')\n opts[:id] ||= \"#{Socket.gethostname}-#{Time.now.iso8601}-#{Process.pid}\"\n OML4R.init(nil, opts)\n end\n end", "def initialize(app, events = T.unsafe(nil), options = T.unsafe(nil)); end", "def parse_args\n options = { :agent_name => 'instance', :verbose => false }\n\n parser = Trollop::Parser.new do\n opt :level, \"\", :type => String, :long => \"--log-level\", :short => \"-l\"\n opt :agent\n opt :verbose\n version \"\"\n end\n\n parse do\n options.merge!(parser.parse)\n if options[:level]\n fail(\"Invalid log level '#{options[:level]}'\") unless AgentManager::LEVELS.include?(options[:level].to_sym)\n end\n options\n end\n end", "def set_log(logdev, shift_age = 0, shift_size = 1024000)\n @log = Logger.new(logdev, shift_age, shift_size)\n @log.progname = @appname\n @log.level = @level\n end", "def initialize(opts={})\n super(opts)\n @app_path = opts.fetch(:app_path, nil)\n end", "def add_applogs(options={})\n self.class.post(\"#{applogs_endpoint}/applogs.json?apikey=#{apikey}\", :body => MultiJson.encode({applog: options}))\n end", "def initialize(mode, argv = [])\n self.mode = mode\n \n # try to load the default configs\n Config.load_config(File.join(Dir.home, \".#{Config.app(mode)}\"))\n Config.load_config(File.join(Dir.pwd, \".#{Config.app(mode)}\"))\n self.config = Config.configure(mode, argv)\n self.reporter = Reporter.new(config)\n end", "def run(args)\n ret = DEFAULTS.merge({})\n\n # create option parser\n o = ::OptionParser.new do |o|\n o.banner = \"Usage: #@app [options]\"\n o.separator \" \"\n\n # add command-line options\n o.separator \"Options:\"\n\n o.on('-A', '--allow USER', 'Allow Jabber subscription from USER.') do |v|\n add_allowed(ret, v)\n end\n\n o.on('-c', '--config FILE', 'Use configuration file FILE.') do |v|\n Joggle::ConfigParser.run(v) do |key, val|\n if key == 'engine.allow'\n add_allowed(ret, val)\n elsif key == 'engine.update.range'\n add_update_range(ret, val)\n else\n ret[key] = val\n end\n end\n end\n\n o.on('-D', '--daemon', 'Run as daemon (in background).') do |v|\n ret['cli.daemon'] = true\n end\n\n o.on('--foreground', 'Run in foreground (the default).') do |v|\n ret['cli.daemon'] = false\n end\n\n o.on('-L', '--log-level LEVEL', 'Set log level to LEVEL.') do |v|\n ret['runner.log.level'] = v\n end\n\n o.on('-l', '--log FILE', 'Log to FILE.') do |v|\n ret['runner.log.path'] = v\n end\n\n o.on('-p', '--password PASS', 'Jabber password (INSECURE!).') do |v|\n ret['jabber.pass'] = v\n end\n\n o.on('-s', '--store FILE', 'Use FILE as backing store.') do |v|\n ret['runner.store.path'] = v\n end\n\n o.on('-u', '--username USER', 'Jabber username.') do |v|\n ret['jabber.user'] = v\n end\n\n o.separator ' '\n\n o.on_tail('-v', '--version', 'Print version string.') do\n puts \"Joggle %s, by %s\" % [\n Joggle::VERSION,\n 'Paul Duncan <pabs@pablotron.org>',\n ]\n exit\n end\n\n o.on_tail('-h', '--help', 'Print help information.') do\n puts o\n exit\n end\n end\n\n # parse arguments\n o.parse(args)\n\n # return results\n ret\n end", "def initialize(app_id)\n @app_id = app_id\n @iterations = 1 # Default to a single iteration\n @base_dir = Dir.pwd\n time = Time.new\n @log_dir = 'monkey_logs' + time.strftime('%Y%m%d_%H%M%S')\n @logger = Logger.new(STDOUT)\n @logger.formatter = proc do |severity, datetime, _progname, msg|\n \"#{severity}|#{datetime}: #{msg}\\n\"\n end\n end", "def initialize(*args)\n if defined?(MOD_RUBY)\n unless ENV.has_key?(\"GATEWAY_INTERFACE\")\n Apache.request.setup_cgi_env\n end\n end\n if %r{HTTP/(\\d+\\.\\d+)} =~ ENV[\"SERVER_PROTOCOL\"]\n httpv = $1\n end\n @config = WEBrick::Config::HTTP.dup.update(\n :ServerSoftware => ENV[\"SERVER_SOFTWARE\"] || \"null\",\n :HTTPVersion => HTTPVersion.new(httpv || \"1.0\"),\n :RunOnCGI => true, # to detect if it runs on CGI.\n :NPH => false # set true to run as NPH script.\n )\n if config = args.shift\n @config.update(config)\n end\n @config[:Logger] ||= WEBrick::BasicLog.new($stderr)\n @logger = @config[:Logger]\n @options = args\n end", "def initialize(*args)\n io = args.shift if args.first.is_a?(IO) || args.first.is_a?(StringIO)\n io ||= STDOUT\n opts = args.shift if args.first.is_a?(Hash)\n opts ||= {}\n raise ArgumentError, '(io, opts) are expected as parameters' unless args.empty?\n\n # module configured?\n self.class.configure() if self.class.options.empty?\n\n @options = self.class.options.deep_merge(opts)\n @logger_instance = ::Logger.new(io)\n @logger_instance.level = self.class.level_from_any(options[:logger_level])\n io.sync = true if io.respond_to?(:sync=)\n @logger_instance.formatter = self.class.formatter(options)\n end", "def initialize( app )\n\t\t@app = app\n\tend", "def build_application(config_hash)\n config = build_config(config_hash)\n\n Application.new(plugins, config)\n end", "def initialize(options={})\n\n @license = options[:license]\n @guid = options[:guid]\n @version = options[:version]\n\n @options = options\n @logger = Logger.new(STDOUT)\n @logger.level = options[:log_level] || Logger::INFO\n\n @agent = options[:agent] || \"newrelic_platform gem\"\n\n end", "def initialize(**kwargs)\n @facility = kwargs[:facility]\n @level = kwargs[:level] || ASL_LEVEL_DEBUG\n @progname = kwargs[:progname]\n @logdev = kwargs[:logdev]\n @stderr = kwargs[:stderr]\n\n if @logdev || @facility || @progname\n options = ASL_OPT_NO_DELAY | ASL_OPT_NO_REMOTE\n options |= ASL_OPT_STDERR if @stderr\n\n @aslclient = asl_open(@progname, @facility, options)\n\n asl_add_log_file(@aslclient, @logdev.fileno) if @logdev\n else\n @aslclient = nil\n end\n\n @aslmsg = asl_new(ASL_TYPE_MSG)\n asl_set(@aslmsg, ASL_KEY_FACILITY, @facility) if @facility\n asl_set_filter(@aslclient, @level)\n\n if block_given?\n begin\n yield self\n ensure\n close\n end\n end\n end", "def initialize_config(args = {})\n Localeapp.configure # load defaults\n load_config_file\n set_command_line_arguments(args)\n end", "def initialize!(app); end", "def initialize(options = {})\n @app_name = options[:app_name].to_s if options[:app_name]\n @platform = options[:platform]\n\n @purpose = check_purpose!(options[:purpose])\n\n @compressors = options[:compressors] || []\n @wrapping_libraries = options[:wrapping_libraries]\n @server_api = options[:server_api]\n\n return unless options[:user] && !options[:auth_mech]\n\n auth_db = options[:auth_source] || 'admin'\n @request_auth_mech = \"#{auth_db}.#{options[:user]}\"\n end", "def initialize(logdev, opts = {})\n @level = opts[:level] || DEBUG\n @progname = opts[:progname]\n @default_formatter = Formatter.new\n @datetime_format = opts[:datetime_format]\n @formatter = opts[:formatter]\n @logdev = logdev ? LogDevice.new(logdev) : nil\n end", "def initialize options = {}\n options = { :base_url => '', :log_level => 'INFO' }.merge options\n @global_opts = options\n @auth_world = AuthWorld.new\n @connection_pool = ConnectionPool.new(:ssl_verify_mode =>\n options[:ssl_verify_mode])\n\n @logger = Log4r::Logger.new \"RubyDav Request #{object_id}\"\n @logger.outputters = Log4r::Outputter.stdout\n @logger.level = Log4r.const_get options[:log_level].upcase\n end", "def init_logging\n app_name = ENV[\"APP_NAME\"] || \"calcentral\"\n format = PatternFormatter.new(:pattern => \"[%d] [%l] [CalCentral] %m\")\n\n Rails.logger = Log4r::Logger.new(app_name)\n Rails.logger.level = DEBUG\n Rails.logger.outputters = init_file_loggers(app_name, format)\n\n stdout = Outputter.stdout #controlled by Settings.logger.level\n stdout.formatter = format\n # level has to be set in the logger initializer, after Settings const is initialized.\n # see initializers/logging.rb\n Rails.logger.outputters << stdout\n end", "def initialize(app, options = {})\n super(app)\n @compression = options[:compression] || Zlib::DEFAULT_COMPRESSION\n end", "def builder_setup\n @result = Log4r::Logger['Mauve'] || Log4r::Logger.new('Mauve')\n @default_format = nil\n @default_level = Log4r::RootLogger.instance.level\n end", "def build_app(options = {})\n @prev_rails_env = ENV[\"RAILS_ENV\"]\n ENV[\"RAILS_ENV\"] = \"development\"\n ENV[\"SECRET_KEY_BASE\"] ||= SecureRandom.hex(16)\n\n FileUtils.rm_rf(app_path)\n FileUtils.cp_r(app_template_path, app_path)\n\n # Delete the initializers unless requested\n unless options[:initializers]\n Dir[\"#{app_path}/config/initializers/**/*.rb\"].each do |initializer|\n File.delete(initializer)\n end\n end\n\n add_to_config <<-RUBY\n config.eager_load = false\n config.session_store :cookie_store, key: \"_myapp_session\"\n config.active_support.deprecation = :log\n config.active_support.test_order = :random\n config.action_controller.allow_forgery_protection = false\n config.log_level = :info\n RUBY\n end" ]
[ "0.6818112", "0.64594615", "0.63585734", "0.6309242", "0.6167207", "0.6148861", "0.6115978", "0.6098042", "0.60679907", "0.6032628", "0.6032628", "0.5980173", "0.5972524", "0.59556144", "0.59317595", "0.5912391", "0.59084064", "0.5893129", "0.58828133", "0.5879854", "0.5864965", "0.5836176", "0.576354", "0.5736436", "0.5733807", "0.5718542", "0.57026744", "0.5692454", "0.5691377", "0.56853354", "0.56853354", "0.5666704", "0.56250805", "0.55817425", "0.55735075", "0.55475837", "0.5543882", "0.5521507", "0.5508244", "0.5505923", "0.5495716", "0.5491449", "0.546733", "0.54628664", "0.54558593", "0.545378", "0.544572", "0.54432625", "0.54374593", "0.54365134", "0.5434173", "0.5432503", "0.54304415", "0.54230565", "0.5417986", "0.5396298", "0.5383791", "0.53835654", "0.53747255", "0.5369885", "0.536865", "0.53668416", "0.5360911", "0.53566223", "0.5354331", "0.5336448", "0.53278387", "0.53263146", "0.5314333", "0.5313278", "0.5313169", "0.5304307", "0.5294173", "0.52710426", "0.5270739", "0.5265629", "0.52652186", "0.52639496", "0.5260023", "0.525267", "0.5248024", "0.5241612", "0.5241347", "0.5238962", "0.52379775", "0.5237969", "0.52283996", "0.52263325", "0.52254844", "0.52229077", "0.52149695", "0.52139705", "0.5213156", "0.51979196", "0.51955926", "0.5191136", "0.5187514", "0.5179812", "0.5172334", "0.5167235" ]
0.80029
0
Initialize on first call and then return Loggerobject
def logger @@logger ||= Logger.new(ENV['ENVIRONMENT']=="test" ? false : $stdout) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n @logger = Logging::Logger[self]\n end", "def initialize\n @log = Logging::Logger[self]\n end", "def initialize_logger\n return if @logger.blank?\n log = @logger\n log = log.to_s if log.is_a?(Pathname)\n if log.is_a?(String)\n log = File.join(TMP_ROOT_DIR, log) unless log.start_with?('/')\n @logger =\n Logger.new(log).tap { |l| l.level = Logger.const_get(@log_level) }\n end\n unless @logger.is_a?(Logger)\n raise \"expected String, got #{log.class} #{log.inspect}\"\n end\n end", "def initialize\n @logger = RubyConfigr::AppLogger.get_logger();\n end", "def initialize\n @logProvider = DefaultLogger.new\n end", "def logger\n init unless @initialized\n logger = @logger\n end", "def initialize logger = Nacreon.log\n\t\t\tself.log = logger\n\t\tend", "def logger\n initialize_logger unless @logger\n @logger\n end", "def initialize\n @logger = Logger.new('cf_flattener.log')\n end", "def initialize\n @logger = BikeIn::Common::CustomLogger.new self.to_s\n end", "def init_logger \n if not Object.const_defined?(get_rails_default_logger_name)\n Logger.new(STDOUT)\n else\n eval(get_rails_default_logger_name)\n end \n end", "def initialize\n @logger = Logger.new(STDOUT)\n super(@logger)\n end", "def initialize(logger = T.unsafe(nil)); end", "def initialize_logger()\n case logger_type\n when :local\n log_path = File.join(RAILS_ROOT, 'log', \"#{config_basename}.log\")\n system(\"cat /dev/null > #{log_path}\")\n ActiveSupport::BufferedLogger.new(log_path)\n when :remote\n RemoteLogger.new(config_basename, File.join(RAILS_ROOT, 'log'), proc_id)\n when :stderr\n logger = ActiveSupport::BufferedLogger.new($stderr)\n logger.auto_flushing = true\n logger\n else\n raise ArgumentError, \"logger_type must be :local,:remote or :stderr\"\n end\n end", "def initialize_logger()\n case logger_type\n when :local\n log_path = File.join(RAILS_ROOT, 'log', \"#{config_basename}.log\")\n system(\"cat /dev/null > #{log_path}\")\n ActiveSupport::BufferedLogger.new(log_path)\n when :remote\n RemoteLogger.new(config_basename, File.join(RAILS_ROOT, 'log'), proc_id)\n when :stderr\n logger = ActiveSupport::BufferedLogger.new($stderr)\n logger.auto_flushing = true\n logger\n else\n raise ArgumentError, \"logger_type must be :local,:remote or :stderr\"\n end\n end", "def initialize_logger()\n case logger_type\n when :local\n log_path = File.join(RAILS_ROOT, 'log', \"#{config_basename}.log\")\n system(\"cat /dev/null > #{log_path}\")\n ActiveSupport::BufferedLogger.new(log_path)\n when :remote\n RemoteLogger.new(config_basename, File.join(RAILS_ROOT, 'log'), proc_id)\n when :stderr\n logger = ActiveSupport::BufferedLogger.new($stderr)\n logger.auto_flushing = true\n logger\n else\n raise ArgumentError, \"logger_type must be :local,:remote or :stderr\"\n end\n end", "def initialize\n Logging.setup(Logger::INFO)\n end", "def initialize\n @log = Logging::Logger[self]\n @options = self.default_options\n end", "def initialize\n self.logger = Logger.new(STDOUT)\n reset!\n end", "def init_logger\n l = Logger.new(STDOUT)\n l.level = Logger::INFO\n Log.logger = l\nend", "def initLogger(debugOn = false)\r\n\t$logger = Logger.new(STDOUT)\r\n\tif debugOn\r\n\t\t$logger.level = Logger::DEBUG\r\n\telse\r\n\t\t$logger.level = Logger::INFO\r\n\tend\r\n\treturn $logger\r\nend", "def logger\n @logger ||= create_logger\n end", "def logger\n @logger ||= create_logger\n end", "def logger\n @_logger ||= ::Logger.new(log_file)\n end", "def logger=(_arg0); end", "def logger=(_arg0); end", "def logger=(_arg0); end", "def logger=(_arg0); end", "def logger=(_arg0); end", "def logger=(_arg0); end", "def logger=(_arg0); end", "def initialize_log(log_target = STDOUT)\n oldlogger ||= nil\n @logger = Logger.new(log_target)\n @logger.level = Logger::INFO\n oldlogger.close if oldlogger && !$TESTING # don't want to close testing's STDOUT logging\n @logger\n end", "def logger\n @logger ||= build_logger\n end", "def initialize\n @logger = ::Logger.new(STDOUT)\n self.level = :info\n end", "def logger\n @logger ||= _new_logger\n end", "def initialize\n\t\t@@logger = OMLogger.getLogger(DataHelper.name)\n\tend", "def logger\n @_logger ||= Logger.new(self)\n end", "def initialize( logger )\n @logger = logger\n end", "def initialize(logger)\n @log = logger\n end", "def logger; LOGGER; end", "def init(*opts)\n reset!\n @logger = logger_for(BeanStalk::Worker::Config[:log_location])\n if @logger.respond_to?(:formatter=)\n if BeanStalk::Worker::Config[:log_formatter].eql?(:json)\n @logger.formatter = Mixlib::Log::JSONFormatter.new()\n else\n @logger.formatter = Mixlib::Log::Formatter.new()\n end\n end\n @logger.level = Logger.const_get(\n BeanStalk::Worker::Config[:log_level].to_s.upcase)\n @logger\n end", "def initLogger()\n\tconfig = FileUtil.loadjson(File.dirname(__FILE__) + '/utilcfg.json')\n\tif config.key?('log.path')\n\t\tlpath = config['log.path']\n\t\tunless File.file?(lpath)\n\t\t\tdpath = lpath.gsub(/[^\\/]+$/,'')\n\t\t\tDir.mkdir(dpath) unless Dir.exist?(dpath)\n\t\tend\n\t\tif config.key?('log.interval')\n\t\t\t$logger = Logger.new(lpath, config['log.interval'])\n\t\telse\n\t\t\t$logger = Logger.new(lpath)\n\t\tend\n\tend\n\tLogUtil.setformatter\n\tLogUtil.setloglevel(config['log.level'])\nend", "def init(*opts)\n if opts.length == 0\n @logger = Logger.new(STDOUT)\n else\n @logger = Logger.new(*opts)\n end\n @logger.formatter = Ohai::Log::Formatter.new()\n level(Ohai::Config.log_level)\n end", "def log\n @logger ||= Logger.new(nil)\n @logger\n end", "def initialize()\n @log = {}\n end", "def logger\n return @local_logger if @local_logger\n FileUtils.mkdir_p(File.dirname(log_path)) unless File.exists?(File.dirname(log_path))\n\n if API_KEYS[\"logentries\"]\n token = API_KEYS[\"logentries\"][Rails.env][\"nsc\"]\n @local_logger = Le.new(token, :debug => false, :local => log_path, :ssl => true, :tag => true)\n else\n @local_logger = Logger.new(log_path)\n end\n @local_logger\n end", "def initialize(logger)\n\t\t\t\t\t@logger = logger\n\t\t\t\tend", "def initialize( )\n ::Logging.init unless ::Logging.initialized?\n\n @name = 'root'\n @appenders = []\n @additive = false\n @caller_tracing = false\n @level = 0\n ::Logging::Logger.define_log_methods(self)\n end", "def initialize(logger=Logger.new(STDERR))\n setup_signals\n @logger = logger\n @logger.level = level_from_env || Logger::INFO\n end", "def init_logging\n app_name = ENV[\"APP_NAME\"] || \"calcentral\"\n format = PatternFormatter.new(:pattern => \"[%d] [%l] [CalCentral] %m\")\n\n Rails.logger = Log4r::Logger.new(app_name)\n Rails.logger.level = DEBUG\n Rails.logger.outputters = init_file_loggers(app_name, format)\n\n stdout = Outputter.stdout #controlled by Settings.logger.level\n stdout.formatter = format\n # level has to be set in the logger initializer, after Settings const is initialized.\n # see initializers/logging.rb\n Rails.logger.outputters << stdout\n end", "def logger\n @logger ||= Logger.new(StringIO.new)\n end", "def logger\n @logger ||= set_logger\n end", "def initialize prev=nil\n @prev_logger = prev\n super(nil)\n end", "def logger=(logger); end", "def logger=(logger); end", "def logger\n @logger ||= Testable::Logger.new.create\n end", "def logger\n @logger ||= Testable::Logger.new.create\n end", "def logger\n @logger ||= NilLogger.new\n end", "def initialize(log_level = 'debug')\n @logger = Logger.new(STDOUT, level: log_level)\n end", "def _logger\n @logger ||= Log4r::Logger.new(self.class.to_s)\n end", "def initialize(*logger_args)\n if logger_args.empty?\n logger_args = [$stderr]\n end\n @base_args = logger_args\n @logger = ::Logger.new(*@base_args)\n @logger.level = :fatal\n @lock = Mutex.new\n end", "def get_logger; @logger; end", "def init(identity = nil, path = nil)\n unless @initialized\n @initialized = true\n @level_frozen = false\n logger = nil\n\n if @log_to_file_only || RightLinkConfig[:platform].windows?\n if path\n file = File.join(path, \"nanite.#{identity}.log\")\n else\n file = STDOUT\n end\n logger = Logger.new(file)\n logger.formatter = Formatter.new\n else\n logger = SyslogLogger.new(@program_name || identity || 'RightLink')\n end\n\n @logger = Multiplexer.new(logger)\n self.level = :info\n end\n @logger\n end", "def setup\n self.logger.reopen(File.open(File.join(Lokii::Config.root, Lokii::Config.log), \"a\")) if daemon? && self.logger\n self.logger ||= ::Logger.new(File.join(Lokii::Config.root, Lokii::Config.log))\n end", "def builder_setup\n @result = Log4r::Logger['Mauve'] || Log4r::Logger.new('Mauve')\n @default_format = nil\n @default_level = Log4r::RootLogger.instance.level\n end", "def logger ; @log end", "def logger\n @logger ||= Logger.new(self)\n end", "def initialize(log)\n @log = log\n end", "def logger\n @logger ||= ::Logger.new STDOUT\n end", "def logger\n @logger ||= ::Logger.new STDOUT\n end", "def logger\n @logger ||= ::Logger.new STDOUT\n end", "def logger\n @logger || StartupLogger.instance\n end", "def initialize(logfile_path=nil)\n if logfile_path\n ar_logger = Logger.new(logfile_path)\n ar_logger.level = Logger::INFO\n ActiveRecord::Base.logger = ar_logger\n end\n end", "def initialize *_args\n super\n @service_logger =\n case logger\n when 'sidekiq'\n Sidekiq::Logging.logger\n else\n Rails.logger\n end\n end", "def logger\n @logger ||= self.class.logger\n end", "def logger=(logr); @logger = logr end", "def initialize(logger, options = T.unsafe(nil)); end", "def logger\n return @logger if defined?(@logger) && !@logger.nil?\n path = log_path\n FileUtils.mkdir_p(File.dirname(path))\n prepare_logger(path)\n rescue\n prepare_logger(STDOUT)\n end", "def logger\n init_logger if Log4r::Logger[STANDARD_LOGGER].nil?\n Log4r::Logger[STANDARD_LOGGER]\n end", "def init_logger\n self.log4r_config = load_file_config('log4r.yml')\n\n if log4r_config\n Log4r::YamlConfigurator.decode_yaml(log4r_config['log4r_config'])\n\n environments = log4r_config['log4r_config']['loggers'].map do |logger|\n logger['name']\n end\n\n if environments.include?(run_env)\n self.logger = Log4r::Logger[run_env]\n else\n self.logger = Log4r::Logger['development']\n end\n else\n self.logger = Log4r::Logger.new(run_env)\n self.logger.level = Log4r::DEBUG\n self.logger.add Log4r::Outputter.stdout\n self.logger.warn\n \"Log4r configuration file #{full_config_path('log4r.yml')} not found.\"\n self.logger.info \"Log4r outputting to stdout with DEBUG level.\"\n end\n end", "def initialize(logger: default_logger)\n @logger = logger\n end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger\n @logger ||= default_logger\n end" ]
[ "0.79869616", "0.7852248", "0.76831454", "0.76336807", "0.7570718", "0.7530305", "0.7503324", "0.7495495", "0.7414495", "0.7391725", "0.7359133", "0.7348552", "0.733175", "0.72759444", "0.72759444", "0.72759444", "0.72518873", "0.7250611", "0.72284037", "0.7216499", "0.721267", "0.71847695", "0.71847695", "0.7157361", "0.71180487", "0.71180487", "0.71180487", "0.71180487", "0.71180487", "0.71180487", "0.71180487", "0.71019787", "0.7072516", "0.706535", "0.7052706", "0.70524603", "0.7039795", "0.70393765", "0.70390415", "0.7032243", "0.7020524", "0.70203596", "0.70065165", "0.6992282", "0.6978217", "0.693224", "0.69291544", "0.6915816", "0.689415", "0.6867454", "0.68552047", "0.68425256", "0.68313974", "0.6829928", "0.6829928", "0.68277353", "0.68277353", "0.6816238", "0.6809429", "0.6804166", "0.6777786", "0.6767928", "0.6750045", "0.6750005", "0.67480993", "0.6728777", "0.67235667", "0.6715061", "0.6709824", "0.6709824", "0.6709824", "0.6677933", "0.66685414", "0.6666052", "0.66647506", "0.66599435", "0.6659587", "0.6651648", "0.6647474", "0.66391236", "0.663858", "0.66375804", "0.66375804", "0.66375804", "0.66375804", "0.66375804", "0.66375804", "0.66375804", "0.66375804", "0.66375804", "0.66375804", "0.66375804", "0.66375804", "0.66375804", "0.66375804", "0.66375804", "0.66375804", "0.66375804", "0.66375804", "0.66375804", "0.6628696" ]
0.0
-1
Run the application's outer loop
def run _cmd = built_in_command( options[:args] ) _cmd ||= options[:command] ? CommandRunner.new(options[:command]) : 0 if _cmd.class == CommandRunner _cmd.run do |item| puts "%s:\n %s\n\n" % [ item.class, item.desc ] if item.is_a?(UseCase) && ENV['ENVIRONMENT'] != 'test' end else _cmd end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_loop\n end", "def run\n loop do\n break unless app_loop\n end\n end", "def loop\n end", "def loop\n end", "def loop\n end", "def loop; end", "def parentloop; end", "def main_loop\n\t\t\tbegin\n\t\t\t\tloop {\n\t\t\t\t\titerate\n\t\t\t\t\tlog.debug \"Finished iteration; sleeping for #{sleep_time}s.\"\n\t\t\t\t\tsleep sleep_time\n\t\t\t\t}\n\t\t\trescue Exception => e\n\t\t\t\t# We want to avoid crashing if at all possible, so we catch\n\t\t\t\t# everything, log it, sleep (to avoid thrashing or flooding the\n\t\t\t\t# logs completely if the error persists), and go back to the\n\t\t\t\t# main loop.\n\t\t\t\tlog.error(\"#{self.class.inspect}'s main loop crashed \" \\\n\t\t\t\t\t\t \"with #{e.inspect} at #{e.backtrace[0]}!\")\n\t\t\t\tsleep(sleep_time * 10)\n\t\t\t\tretry\n\t\t\tend\n\t\tend", "def run\n while @running\n step\n end\n end", "def main_loop\n @main_loop ||= lambda do\n # Smoother, but slower: GC.start if rand > 0.98\n next_step\n SUBSTEPS.times do\n move\n targeting\n handle_input\n remove_marked\n step_physics\n end\n end\n end", "def start\n main_loop\n end", "def run\n loop { run_once }\n end", "def loop_forever; end", "def start\n loop do\n run\n end\n end", "def run\n while 1\n if step == 1 then break end\n end\n end", "def post_loop; end", "def run\n raise NotImplementedError, 'Generic loop has nothing to do'\n end", "def kloop\n end", "def run\n Thread.start do\n begin\n while true\n main_loop\n end\n ensure\n @protocol.close if @protocol\n end\n end\n end", "def run()\n while(true)\n cycle() ;\n sleep(2) ;\n end\n end", "def pre_loop; end", "def loop( &block )\n sanity_check\n @connection.loop(&block)\n end", "def testloop\n \n end", "def serving_loop\n Thread.new { socket_loop }\n @manager.management_loop\n end", "def start() @root.mainloop end", "def run() end", "def foreverize\n loop do\n run\n end\n end", "def run\n log.trace (\"run triggered\")\n while thread_current_running?\n current_time = Time.now.to_i\n\n emit() if thread_current_running?\n while thread_current_running? && Time.now.to_i <= current_time\n sleep @run_interval\n end\n end\n end", "def endless_loop?; end", "def main\n\t\tstart\n\t\twhile self == SceneManager.scene\n\t\t\tGraphics.update\n\t\t\tController.keyboard.update\n\t\t\tupdate\n\t\t\tController.wait_next_frame\n\t\tend\n\t\tterminate\n\tend", "def preloop\n end", "def run!\n loop do\n begin\n job = Job.new(get_apps)\n job.fetch_targets!\n post_messages!(job.to_hash)\n sleep(@interval)\n rescue Errno::ECONNREFUSED => ce\n puts \"\"\n sleep(@interval)\n end\n\n end\n end", "def go\n while(true)\n process_event(wait_for_event)\n end\n end", "def run\n @running = true\n begin\n while running?\n self.ir = decode(ram.read(self.pc))\n self.pc += 1\n exec(ir[0], ir[1])\n end\n end \n end", "def run\n while 1\n sleep(0.2)\n #puts \"bezim \"+@pid.to_s\n end\n end", "def postloop\n end", "def run_event_loop\n while true\n event = @event_queue.pop\n @worker_pool.dispatch event\n \n if @stopped\n Thread.stop;\n return\n end\n end\n end", "def start_loop\n loop do\n sleep 2\n start\n end\n rescue => e\n Torkify.logger.error { e }\n end", "def in_loop\n declare_alive\n project.load\n if loop_i == -1\n say '-----------------------------------'\n say 'MiGA:%s launched.' % project.name\n say '-----------------------------------'\n load_status\n @loop_i = 0\n end\n @loop_i += 1\n check_datasets\n check_project\n if shutdown_when_done? and jobs_running.size + jobs_to_run.size == 0\n say 'Nothing else to do, shutting down.'\n return false\n end\n flush!\n if loop_i==4\n say 'Housekeeping for sanity'\n @loop_i = 0\n purge!\n end\n report_status\n sleep(latency)\n true\n end", "def infinite_loop?; end", "def run!\n @size.times do\n schedule { throw :exit }\n end\n @pool.map(&:join)\n end", "def start\n EM.synchrony do\n run\n end\n end", "def run_many(&block)\n Vedeu::Runtime::MainLoop.start! { yield }\n\n rescue Vedeu::Error::ModeSwitch\n Vedeu::Runtime::Application.restart\n end", "def endless_loop\n loop { yield }\n end", "def run(vm)\n while step(vm); end\n end", "def run\n loop do\n next unless @all_workers_started\n begin\n check_workers\n sleep Skynet::CONFIG[:WORKER_CHECK_DELAY]\n rescue SystemExit, Interrupt => e\n printlog \"Manager Exiting!\"\n exit\n rescue Exception => e\n fatal \"Something bad happened #{e.inspect} #{e.backtrace.join(\"\\n\")}\"\n end\n end\n end", "def main\n loop do\n unless @context\n begin\n self.process(self.await_input)\n rescue ConsoleInterrupt\n self.replace '^C'\n self.println ':(', 2\n rescue ConsoleError => e\n self.print _INTL(\"{1}: {2}\",self.name,e.message), 0, true\n self.println ':(', 2\n rescue ConsoleExit\n self.exit_session\n break\n end\n end\n end\n end", "def run_run_loop time = 1\n NSRunLoop.currentRunLoop.runUntilDate (Time.now + time)\nend", "def run_forever\n run\n sleep(10) while true\n end", "def run\r\n catch :quit do\r\n loop do\r\n # Prepare events\r\n @event_queue.fetch_sdl_events\r\n @event_queue << @clock.tick\r\n\r\n # Handle events\r\n @event_queue.each do |event|\r\n yield event if block_given?\r\n # Stop this program if the user closes the window\r\n throw :quit if event.is_a? Rubygame::Events::QuitRequested\r\n end\r\n end\r\n end\r\n end", "def running; end", "def running; end", "def run\n start_game\n game_loop\n end_game\n end", "def run\n Thread.new {\n loop do\n @server.update(1000)\n break if @terminate\n end\n }\n end", "def loop &block\n _loop ::Dnet, :route_loop, Entry, &block\n end", "def run\n @threads.each(&:join)\n end", "def main_loop\n Thread.start(@protocol.accept) do |client|\n @grp.add Thread.current\n Thread.current['DRb'] = { 'client' => client ,\n 'server' => self }\n DRb.mutex.synchronize do\n client_uri = client.uri\n @exported_uri << client_uri unless @exported_uri.include?(client_uri)\n end\n loop do\n begin\n succ = false\n invoke_method = InvokeMethod.new(self, client)\n succ, result = invoke_method.perform\n if !succ && verbose\n p result\n result.backtrace.each do |x|\n puts x\n end\n end\n client.send_reply(succ, result) rescue nil\n ensure\n client.close unless succ\n if Thread.current['DRb']['stop_service']\n Thread.new { stop_service }\n end\n break unless succ\n end\n end\n end\n end", "def run\n start\n jetty.join\n end", "def run\n watchers.each(&:run)\n \n self.running = true\n \n sleep_while_running\n ensure\n quit\n end", "def capture_loop capp # :nodoc:\n capp.loop do |packet|\n enqueue_packet packet\n end\n end", "def start_main_loop_thread\n current_generation = @main_loop_generation\n @main_loop_thread = create_thread_and_abort_on_exception do\n main_loop\n end\n @main_loop_thread_lock.synchronize do\n while @main_loop_generation == current_generation\n @main_loop_thread_cond.wait(@main_loop_thread_lock)\n end\n end\n end", "def run\n until halted?\n step\n end\n end", "def masterrun\n self.workersrun \n self.serverrun \n end", "def is_loop\n\n true\n end", "def start!\n until should_stop? do work end\n end", "def run!\n loop do\n begin\n alerter.read_nonblock(WAKEUP.length)\n rescue IO::WaitReadable\n interval = current_self.next_interval if current_self\n IO.select([alerter], [], [], interval)\n end\n begin\n run_ready\n reset(false)\n rescue DeadException => e\n if(e.origin_object_id == object_id)\n Zoidberg.logger.debug \"<#{self}> Terminated state encountered. Falling out of run loop!\"\n raise\n else\n current_self.raise e\n end\n rescue => e\n Zoidberg.logger.error \"<#{self}> Unexpected error in runner: #{e.class.name} - #{e}\"\n Zoidberg.logger.debug \"<#{self}> #{e.class.name}: #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n current_self.raise e\n end\n end\n end", "def run\n run_app\n adapter.run\n rescue Interrupt\n shut_down\n end", "def start\n while listen\n # Loop for-ev-er\n end\n end", "def while(&block)\n\t\t\t\t\trepeat &block\n\t\t\t\tend", "def myloop\n while true\n yield\n end\nend", "def run_em\n if !EM.reactor_running?\n Thread.new {\n EM.run {}\n }\n end \n end", "def initiate_event_loop!\n @active = true\n\n @thread = Thread.new do\n while @active\n @session_mutex.synchronize do\n @session.process(@loop_wait)\n end\n Thread.pass\n end\n end\n end", "def initiate_event_loop!\n @active = true\n\n @thread = Thread.new do\n while @active\n @session_mutex.synchronize do\n @session.process(@loop_wait)\n end\n Thread.pass\n end\n end\n end", "def main\n while true\n begin\n res = observe\n if res.ok?\n notify res\n @errors = 0\n else\n log \"OBSERVE FAILED: errors(#{errors}) code(#{res.code})\"\n @errors += 1\n if @errors > 10 then\n @parent.observed :error\n end\n sleep 10 * @errors\n end\n rescue Exception => e\n log \"OBSERVE EXCEPTION: #{e.trace}\"\n end\n end\n end", "def run\n start_processing\n at_exit { ShellOut.stop }\n end", "def loop_callback\n yield\n end", "def loop(&block)\n block ||= Proc.new { pending_requests.any? }\n session.loop{Rex::ThreadSafe.sleep(0.5); block.call }\n end", "def run\n connect = false\n until connect do\n begin\n call { |server| @server = server ; start }\n rescue\n Waves::Logger.error e.to_s\n sleep 1\n end\n connect = true\n end\n end", "def initiate_event_loop!\n @active = true\n\n @thread = Thread.new do\n while @active\n @session_mutex.synchronize do\n @session.process(@loop_wait)\n end\n Thread.pass\n end\n end\n end", "def run\n run_one_instruction while threads.length > 0\n end", "def loop &block\n _loop ::Dnet, :fw_loop, Rule, &block\n end", "def run\n end", "def run!\n @queue = []\n queue do\n @controller = Controller.new\n end\n catch :exit do\n while true\n tick\n FFI::NCurses.refresh\n end\n end\n rescue Exception => e\n Logger.log(e.message)\n Logger.log(e.backtrace.join(\"\\n\"))\n FFI::NCurses.clear\n FFI::NCurses.endwin\n raise\n end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def accept(evaluator)\n evaluator.loop(self)\n end", "def main_loop(fps = 60)\n self.fps = fps\n @ran_main_loop_p = true\n init_sync\n drive_mainloop do\n poll_event\n if block_given?\n screen.fill_rect(0, 0, screen.w, screen.h, background_color) if background_color\n yield(screen)\n end\n sync\n screen.flip\n end\n end", "def my_loop\n while true\n yield\n end\nend", "def main_process\n while @running\n Graphics.update\n update\n end\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end" ]
[ "0.7935986", "0.7788451", "0.7568866", "0.7562504", "0.7562504", "0.74086004", "0.7246963", "0.72172534", "0.7097975", "0.70818275", "0.707193", "0.7045728", "0.70312774", "0.69933915", "0.6955586", "0.68950015", "0.6889644", "0.68845767", "0.6849361", "0.668517", "0.6670535", "0.65750563", "0.6560944", "0.65527743", "0.65441173", "0.6540344", "0.6532208", "0.6531171", "0.65279084", "0.65217686", "0.6514698", "0.65105784", "0.6508994", "0.64788944", "0.6473315", "0.64435375", "0.64100516", "0.64013535", "0.6392257", "0.639007", "0.6389368", "0.63801694", "0.6370049", "0.63386524", "0.63259315", "0.6319181", "0.6298458", "0.62915426", "0.62876827", "0.625799", "0.62554973", "0.62554973", "0.6244417", "0.6239233", "0.6219291", "0.6218245", "0.6207256", "0.62061375", "0.6202756", "0.6190769", "0.6159516", "0.61559874", "0.6155819", "0.61545765", "0.61544925", "0.6153436", "0.6151359", "0.61482304", "0.614308", "0.6128461", "0.61039144", "0.609522", "0.609522", "0.60932016", "0.6092154", "0.6089747", "0.6087476", "0.60832345", "0.6082372", "0.60754263", "0.6073201", "0.60726416", "0.6070034", "0.60683364", "0.60683364", "0.60683364", "0.60683364", "0.60683364", "0.60683364", "0.60683364", "0.60683364", "0.60683364", "0.6049503", "0.6048419", "0.60481226", "0.6045481", "0.60408634", "0.60408634", "0.60368377", "0.60368377", "0.60368377" ]
0.0
-1
Called on initializer after parsing the arguments. Loglevel is set according to options v or q
def set_log_level logger.level = options[:quiet] ? Logger::FATAL : Logger::WARN logger.level = Logger::INFO if options[:verbose] logger.info("Logger.level set to #{logger.level}") raise OptionsError.new("Option mismatch - you can't provide -v and -q at the same time") if options[:quiet] && options[:verbose] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(*args)\n parse_options(*args)\n set_log_level\n @@application = self\n end", "def parse(arguments)\n super\n\n level = :info\n level = :debug if debug?\n level = :error if quiet?\n Kubetruth::Logging.setup_logging(level: level, color: color?)\n end", "def initialize\n @log = Logging::Logger[self]\n @options = self.default_options\n end", "def log_level=(_arg0); end", "def log_level=(_arg0); end", "def init(*opts)\n if opts.length == 0\n @logger = Logger.new(STDOUT)\n else\n @logger = Logger.new(*opts)\n end\n @logger.formatter = Ohai::Log::Formatter.new()\n level(Ohai::Config.log_level)\n end", "def initialize options\n log_file = options['file'] || default_log_file\n @logger = Logger.new log_file\n end", "def builder_setup\n @result = Log4r::Logger['Mauve'] || Log4r::Logger.new('Mauve')\n @default_format = nil\n @default_level = Log4r::RootLogger.instance.level\n end", "def log_level=(level); end", "def initialize(*args)\n @init_args = args\n set_log(*args)\n end", "def initialize(options = {})\n\t\t\t@logger = Logger.new(STDOUT)\n\t\t\t@logger.level = Logger::INFO\n\t\tend", "def setup!( options )\n self.level = options[:level]\n end", "def initialize(options={})\n @options = options.dup\n\n Logger.set(*@options[:log_to])\n end", "def initialize(options = {})\n @logger = options[:logger]\n end", "def initialize(options,args)\n @options = (options||{}).each{|k,v| {k => v} }\n @args = args\n GmailCli::Logger.set_log_mode(options[:verbose])\n end", "def init(*opts)\n reset!\n @logger = logger_for(BeanStalk::Worker::Config[:log_location])\n if @logger.respond_to?(:formatter=)\n if BeanStalk::Worker::Config[:log_formatter].eql?(:json)\n @logger.formatter = Mixlib::Log::JSONFormatter.new()\n else\n @logger.formatter = Mixlib::Log::Formatter.new()\n end\n end\n @logger.level = Logger.const_get(\n BeanStalk::Worker::Config[:log_level].to_s.upcase)\n @logger\n end", "def initialize(level, options = {})\n @severity = level\n @logger = options[:logger] if options[:logger]\n default_options = { verbose: false }\n @options = OpenStruct.new(default_options.merge(options))\n end", "def initialize\n self.class.output_to_stdout\n if $DEBUG\n self.class.set_level :debug\n else\n self.class.set_level :info\n end\n end", "def initialize_logger(level)\n FFMPEG.logger.progname = 'FFmpeg'\n FFMPEG.logger.level = level || Logger::ERROR\n FFMPEG.logger.formatter = proc do |severity, time, progname, msg|\n \"#{time.strftime('%F %T')} #{progname} - #{severity} - #{msg}\\n\"\n end\n FFMPEG.logger.debug 'Logger initialized.'\n end", "def init_options(options)\n @options = options.dup\n @logger = @options.delete(:logger) || Kitchen.logger\n end", "def initialize(logger, options = T.unsafe(nil)); end", "def set_options(options)\n super(options)\n if !(filename = options[:filename]).nil?\n max_file_size = options.fetch(:max_file_size, options.fetch(:shift_size, 1048576))\n max_file_count = options.fetch(:max_file_count, options.fetch(:shift_age, 7))\n @logger = Logger.new(filename, max_file_count, max_file_size)\n elsif !(stream = options[:stream]).nil?\n @logger = Logger.new(stream)\n else\n @logger = Logger.new(STDOUT)\n end\n @logger.severity = options[:severity] if options.has_key?(:severity)\n @formatter = options.fetch(:formatter, nil)\n @logger.formatter = proc { |s,t,p,m| m }\n @name = 'Logger' if @name.nil?\n end", "def verbose_logging=(_arg0); end", "def initialize(options = {})\n @options = merge_options({}, options || {})\n @logger = @options[:logger] || Logger.new($stdout, level: :fatal)\n end", "def set_up_logging\n\n if @parameters[:log_to_file] then\n\n @logger = Logger.new(@parameters[:log_to_file])\n\n else\n\n @logger = Logger.new(STDOUT)\n\n end\n\n if @parameters[:log_detailed_messages] then\n \n @logger.sev_threshold = Logger::DEBUG\n\n else\n\n @logger.sev_threshold = Logger::INFO\n\n end\n\n end", "def initialize(logger=Logger.new(STDERR))\n setup_signals\n @logger = logger\n @logger.level = level_from_env || Logger::INFO\n end", "def initialize options = {}\n @flog = Flog.new options\n end", "def initialize(options = {})\n color = options[:color]\n\n @loggers = []\n @loggers << @logdev = logdev_logger(options[:logdev]) if options[:logdev]\n @loggers << stdout_logger(options[:stdout], color) if options[:stdout]\n @loggers << stdout_logger($stdout, color) if @loggers.empty?\n\n self.progname = options[:progname] || 'Omnitest'\n self.level = options[:level] || default_log_level\n end", "def option_logging\n block = proc { |level| Logging::Logger.root.level = level; propagate_option('--logging', level) }\n @cl_parser.on('--logging LEVEL', 'Specify the minimum log level that should be logged.', &block)\n end", "def parse_options\n OptionParser.accept(Logger::Severity,/[0-4]/) do |s|\n case s\n when \"0\" then Logger::DEBUG\n when \"1\" then Logger::INFO\n when \"2\" then Logger::WARN\n when \"3\" then Logger::ERROR\n when \"4\" then Logger::FATAL\n else nil\n end\n end\n @optparse = OptionParser.new\n @optparse.banner = \"Usage: #{$0} [options]\"\n @optparse.define_head \"This is a Ruby application\"\n @optparse.set_summary_indent(\" \")\n @optparse.separator \"\"\n @optparse.on( '-v', '--verbose=<SEVERITY>','--[no-]verbose', Logger::Severity, '0:DEBUG/1:INFO/2:WARN/3:ERROR/4:FATAL/NONE' ) do |severity|\n @options[:verbose] = (severity==false)? nil : severity\n end\n @optparse.on( '-l', '--logfile=<logfile>', String, 'The name of the log file (verbose!=NONE)' ) do |logfile|\n @options[:logfile] = logfile\n end\n @optparse.on_tail(\"-h\", \"--help\", \"Show this message\") do\n STDOUT.puts @optparse\n exit(0)\n end\n end", "def initialize\n Logging.setup(Logger::INFO)\n end", "def initialize logger = Nacreon.log\n\t\t\tself.log = logger\n\t\tend", "def initialize(env)\n # get log level (default to \"warn\" if unspecified)\n log_level = (env.get('LOG_LEVEL', DEFAULT_LEVEL)).upcase\n\n # create logger from log path (default to STDERR)\n super(env.get('LOG_PATH', STDERR))\n\n # set log level (default to WARN)\n self.level = ::Logger.const_get(log_level)\n\n # log level\n info('Env::Log#initialize') do\n 'level = %p' % [log_level]\n end\n end", "def initialize(level, options)\n @severity = level\n default_options = {\n verbose: false\n }\n @options = OpenStruct.new(default_options.merge(options))\n end", "def init\n Logging.logger.root.level = :debug\n Logging.logger.root.add_appenders(\n Logging.appenders.stdout(\n :backtrace => false,\n :level => @config[:verbose] ? :debug : :info,\n :layout => Logging.layouts.pattern(:pattern => STDOUT_PATTERN)\n ),\n Logging.appenders.rolling_file(\n @log_file,\n :backtrace => true,\n :level => :debug,\n :layout => Logging.layouts.pattern(:pattern => LOG_FILE_PATTERN)\n )\n )\n Logging.mdc['client'] = 'server'\n end", "def initialize(options = {})\n\n # If there's no logger, let's get it setup.\n @logger = Logger.new(STDOUT) if !@logger\n\n end", "def initialize\n @logger = RubyConfigr::AppLogger.get_logger();\n end", "def initialize options = {}\n options = { :base_url => '', :log_level => 'INFO' }.merge options\n @global_opts = options\n @auth_world = AuthWorld.new\n @connection_pool = ConnectionPool.new(:ssl_verify_mode =>\n options[:ssl_verify_mode])\n\n @logger = Log4r::Logger.new \"RubyDav Request #{object_id}\"\n @logger.outputters = Log4r::Outputter.stdout\n @logger.level = Log4r.const_get options[:log_level].upcase\n end", "def initialize\n @logger = ::Logger.new(STDOUT)\n self.level = :info\n end", "def initialize\n\t\t@@logger = OMLogger.getLogger(DataHelper.name)\n\tend", "def initialize(log_level: nil, **opts)\n @debugger_address = opts.delete(:debugger_address) { true }\n opts[:accept_insecure_certs] = true unless opts.key?(:accept_insecure_certs)\n\n super(**opts)\n\n @options[:args] ||= []\n @options[:prefs] ||= {}\n @options[:env] ||= {}\n @options[:log] ||= {level: log_level} if log_level\n\n process_profile(@options.delete(:profile))\n end", "def configure_logging(loglevel)\n return if loglevel == :none\n if self.options[:log_file].nil?\n\tKitchenplan::Log.init(Kitchenplan::Log::MultiIO.new(STDOUT))\n else\n\tfile = File.open(options[:log_file],\"a\")\n\tKitchenplan::Log.init(Kitchenplan::Log::MultiIO.new(STDOUT,file))\n end\n Kitchenplan::Log.level = loglevel\n end", "def log_level; end", "def log_level; end", "def initialize( )\n ::Logging.init unless ::Logging.initialized?\n\n @name = 'root'\n @appenders = []\n @additive = false\n @caller_tracing = false\n @level = 0\n ::Logging::Logger.define_log_methods(self)\n end", "def logger(**opts); end", "def setup_logger\n logger = Log4r::Logger.new('drbman')\n logger.outputters = Log4r::StdoutOutputter.new(:console)\n Log4r::Outputter[:console].formatter = Log4r::PatternFormatter.new(:pattern => \"%m\")\n logger.level = Log4r::DEBUG\n logger.level = Log4r::INFO\n logger.level = Log4r::WARN if @user_choices[:quiet]\n logger.level = Log4r::DEBUG if @user_choices[:debug]\n # logger.trace = true\n logger\n end", "def logger=(_arg0); end", "def logger=(_arg0); end", "def logger=(_arg0); end", "def logger=(_arg0); end", "def logger=(_arg0); end", "def logger=(_arg0); end", "def logger=(_arg0); end", "def initialize(options)\n\n #check if log/ exists and create it if it doesn't\n if File.directory?(\"log\") == false\n Dir.mkdir \"log\"\n end\n\n @options = options\n end", "def initialize(args, flag)\n @flag = flag\n if args[:run_mode] == 'NORMAL'\n @phase = 'RUNNING'\n @activation = 'SKIP'\n @payload = 'NULL'\n else\n recover_action(self)\n end\n super(args[:logger])\n end", "def initialize(log_level = 'debug')\n @logger = Logger.new(STDOUT, level: log_level)\n end", "def initialize(*logger_args)\n if logger_args.empty?\n logger_args = [$stderr]\n end\n @base_args = logger_args\n @logger = ::Logger.new(*@base_args)\n @logger.level = :fatal\n @lock = Mutex.new\n end", "def initialize(**options)\n @max_bytes = options.fetch(:max_bytes) { 2**13 }\n @max_depth = options.fetch(:max_depth) { 3 }\n @level = options.fetch(:level) { :info }\n @metadata = options.fetch(:metadata) { [] }\n @handlers = options.fetch(:handlers) { [:console] }\n @formatter = options.fetch(:formatter) { :text }\n @date_format = options.fetch(:date_format) { \"%F\" }\n @time_format = options.fetch(:time_format) { \"%T.%3N\" }\n @output = options.fetch(:output) { $stderr }\n @types = options.fetch(:types) { {} }\n end", "def setup_logging( level=Logger::FATAL )\n\n\t\t# Turn symbol-style level config into Logger's expected Fixnum level\n\t\tif Treequel::LOG_LEVELS.key?( level.to_s )\n\t\t\tlevel = Treequel::LOG_LEVELS[ level.to_s ]\n\t\tend\n\n\t\tlogger = Logger.new( $stderr )\n\t\tTreequel.logger = logger\n\t\tTreequel.logger.level = level\n\n\t\t# Only do this when executing from a spec in TextMate\n\t\tif ENV['HTML_LOGGING'] || (ENV['TM_FILENAME'] && ENV['TM_FILENAME'] =~ /_spec\\.rb/)\n\t\t\tThread.current['logger-output'] = []\n\t\t\tlogdevice = ArrayLogger.new( Thread.current['logger-output'] )\n\t\t\tTreequel.logger = Logger.new( logdevice )\n\t\t\t# Treequel.logger.level = level\n\t\t\tTreequel.logger.formatter = Treequel::HtmlLogFormatter.new( logger )\n\t\tend\n\tend", "def setlog(level)\n $LOGLEVEL = level\n end", "def initialize( options )\n\t\tLoggability.format_as( :color ) if $stderr.tty?\n\t\t@options = options\n\n\t\tif @options.debug\n\t\t\t$DEBUG = true\n\t\t\t$VERBOSE = true\n\t\t\tLoggability.level = Logger::DEBUG\n\t\telsif @options.loglevel\n\t\t\tLoggability.level = @options.loglevel\n\t\tend\n\n\t\tMongrel2::Config.configure( :configdb => @options.config )\n\tend", "def initialize\n @level = level_for_env\n end", "def parse_args\n options = { :agent_name => 'instance', :verbose => false }\n\n parser = Trollop::Parser.new do\n opt :level, \"\", :type => String, :long => \"--log-level\", :short => \"-l\"\n opt :agent\n opt :verbose\n version \"\"\n end\n\n parse do\n options.merge!(parser.parse)\n if options[:level]\n fail(\"Invalid log level '#{options[:level]}'\") unless AgentManager::LEVELS.include?(options[:level].to_sym)\n end\n options\n end\n end", "def set_log_level(level=nil)\n defined?(Rails) and (default = (Rails.env.production? ? \"INFO\" : \"DEBUG\")) or (default = \"INFO\")\n log_level = (ENV['LOG_LEVEL'] || level || default)\n self.level = ZTK::Logger.const_get(log_level.to_s.upcase)\n end", "def initialize(name, level)\n super($stdout)\n\n @formatter = formatter\n @progname = name\n self.level = level\n end", "def initialize\n @logger = BikeIn::Common::CustomLogger.new self.to_s\n end", "def levels (args)\n if !instance_variable_defined?(:@log_level)\n Logging.class_eval(Conf.define_accessor(\"log_level\"))\n @log_level = {}\n end\n args.each do |k,v|\n @log_level[k] = v\n end\n end", "def logging_prefs=(_arg0); end", "def initialize(*, verbose: '1', log_file: STDERR, **)\n v = (verbose =~ /\\d+/) ? verbose.to_i : verbose.to_sym\n self.logger = Logger.new(log_file, v)\n end", "def enable_logging(opts); end", "def initialize\n @log_level = :info\n @ssl_verify = :none\n end", "def configure_logger!\n if config[:debug] || !ENV[\"DEBUG\"].to_s.empty?\n Bogo::Logger.logger.level = :debug\n else\n Bogo::Logger.logger.level = config.fetch(:log, :fatal)\n end\n end", "def initialize(argv)\n $main_args, $sub_command, $sub_args = split_main_and_subcommand(argv, command_list)\n\n if $main_args.include? '--verbose'\n $logger.level = Logger::DEBUG\n end\n\n $logger.info(\"CLI Parsed Inputs: #{$main_args.inspect} #{$sub_command.inspect} #{$sub_args.inspect}\")\n end", "def initialize(to_log = false, verbose = false)\n @to_log = to_log\n @verbose = verbose\n end", "def initialize()\n @log = {}\n end", "def initialize(options = {}, &block)\n # Backward compatibility\n options = { level: options } unless options.is_a?(Hash)\n options = options.dup\n level = options.delete(:level)\n filter = options.delete(:filter)\n @formatter = extract_formatter(options.delete(:formatter), &block)\n @app_name = options.delete(:app_name)\n @host = options.delete(:host)\n fail(ArgumentError, \"Unknown options: #{options.inspect}\") unless options.empty?\n\n # Subscribers don't take a class name, so use this class name if an subscriber\n # is logged to directly\n super(self.class, level, filter)\n end", "def initialize(options={})\n self.config_file = options[:config_file] || 'config/librato.yml'\n super()\n self.log_prefix = '[librato-rails] '\n end", "def log(filename = '')\n options[:log] = filename\n end", "def setup_logger\n log = Log4r::Logger.new('rpm_analytics_worker')\n\n log_format = Log4r::PatternFormatter.new(:pattern => \"[#{Process.pid}:%l] %d :: %m\")\n setup_file_logger(log, log_format) if options[:log_dir]\n setup_stdout_logger(log, log_format) if options[:log_stdout]\n\n log.level = options[:verbose] ? Log4r::DEBUG : Log4r::INFO\n log\n end", "def init_logging\n app_name = ENV[\"APP_NAME\"] || \"calcentral\"\n format = PatternFormatter.new(:pattern => \"[%d] [%l] [CalCentral] %m\")\n\n Rails.logger = Log4r::Logger.new(app_name)\n Rails.logger.level = DEBUG\n Rails.logger.outputters = init_file_loggers(app_name, format)\n\n stdout = Outputter.stdout #controlled by Settings.logger.level\n stdout.formatter = format\n # level has to be set in the logger initializer, after Settings const is initialized.\n # see initializers/logging.rb\n Rails.logger.outputters << stdout\n end", "def load_options(opts)\n return if opts.blank?\n\n if opts[:logger]\n # do not apply logger, if in stdout state\n if !%w{stdout stderr}.include?(Eye::Logger.dev)\n if opts[:logger].blank?\n Eye::Logger.link_logger(nil)\n else\n Eye::Logger.link_logger(opts[:logger])\n end\n end\n \n Eye::Logger.log_level = opts[:logger_level] if opts[:logger_level]\n end\n end", "def initialize\n @log = Logger.new(STDOUT)\n @log.level = Logger::INFO\n self.load_config\n self.init_settings\n @assemblers = []\n self.load_assemblers\n end", "def initialize(*args)\n # Handle default\n if args.empty?\n args = [STDOUT]\n end\n\n # Initialization\n @default_level = Logger::Severity::INFO\n @formatter = ::TeeLogger::Formatter.new\n @loggers = {}\n @ios = {}\n\n # Load built-in filters\n load_filters(*args)\n\n # Create logs for all arguments\n args.each do |arg|\n add_logger(arg)\n end\n end", "def log_level=(val)\n @@log_level = val\n end", "def initialize(options = nil)\n super() # MonitorMixin\n options ||= {}\n @logger = options[:logger]\n # Initializes each instance variable of the same name as option\n # keyword.\n default_options.each_pair { |key, default|\n instance_variable_set(\"@#{key}\", options.fetch(key, default))\n }\n end", "def loglevel=(level)\n @log.level=level\n end", "def initialize(options={})\n @root = File.expand_path('../../../../../', __FILE__)\n \n if @log.nil?\n # @logdir = @root + \"/log/worker\"\n # FileUtils.mkdir_p @logdir\n # @logfile = @logdir + \"/#{self.class.to_s.downcase}.log\"\n # FileUtils.touch @logfile\n \n @log = Logger.new(STDOUT) #MultiDelegator.delegate(:write, :close).to(STDOUT, File.open(@logfile,'a'))\n @log.level = Logger::WARN # TODO Only log if development environment\n \n @log.formatter = proc do |severity, datetime, progname, msg|\n \"[#{severity}] - #{datetime}: #{msg}\\n\"\n end\n \n @log.info(\"Started logging in: #{@logfile}\")\n end\n \n return self\n end", "def initialize\n @logger = Logger.new(STDOUT)\n super(@logger)\n end", "def setup_logging( level=Logger::FATAL )\n\n\t\t# Turn symbol-style level config into Logger's expected Fixnum level\n\t\tif Mongrel2::Logging::LOG_LEVELS.key?( level.to_s )\n\t\t\tlevel = Mongrel2::Logging::LOG_LEVELS[ level.to_s ]\n\t\tend\n\n\t\tlogger = Logger.new( $stderr )\n\t\tMongrel2.logger = logger\n\t\tMongrel2.logger.level = level\n\n\t\t# Only do this when executing from a spec in TextMate\n\t\tif ENV['HTML_LOGGING'] || (ENV['TM_FILENAME'] && ENV['TM_FILENAME'] =~ /_spec\\.rb/)\n\t\t\tThread.current['logger-output'] = []\n\t\t\tlogdevice = ArrayLogger.new( Thread.current['logger-output'] )\n\t\t\tMongrel2.logger = Logger.new( logdevice )\n\t\t\t# Mongrel2.logger.level = level\n\t\t\tMongrel2.logger.formatter = Mongrel2::Logging::HtmlFormatter.new( logger )\n\t\tend\n\tend", "def log=(logger); end", "def log=(_arg0); end", "def log=(_arg0); end", "def log=(_arg0); end", "def execute\n option_parser.parse!\n logger.debug \"Debug logging enabled\"\n begin\n run\n rescue Exception => e\n logger.fatal \"Encountered exception #{e}\"\n e.backtrace.map { |x| logger.fatal x }\n end\n end", "def loglevel=(level)\n @loglevel = logger.level = level\n end", "def level=(_arg0); end", "def level=(_arg0); end", "def finalize_setup\n Bolt::Logger.configure(config.log, config.color, config.disable_warnings)\n Bolt::Logger.stream = config.stream\n Bolt::Logger.analytics = analytics\n Bolt::Logger.flush_queue\n\n # Logger must be configured before checking path case and project file, otherwise logs will not display\n config.check_path_case('modulepath', config.modulepath)\n config.project.check_deprecated_file\n\n if options[:clear_cache] && File.exist?(config.project.plugin_cache_file)\n FileUtils.rm(config.project.plugin_cache_file)\n end\n\n warn_inventory_overrides_cli(options)\n validate_ps_version\n\n options\n rescue Bolt::Error => e\n outputter.fatal_error(e)\n raise e\n end", "def level=(level)\n @level = level\n @log.level = @level\n end" ]
[ "0.7408011", "0.7201211", "0.71071047", "0.6954102", "0.6954102", "0.689402", "0.6791955", "0.67912066", "0.67372584", "0.6736481", "0.6728084", "0.671521", "0.66979676", "0.6641687", "0.66245246", "0.65881974", "0.65881747", "0.652815", "0.65231496", "0.6520111", "0.6512943", "0.64469254", "0.64234704", "0.6408603", "0.640579", "0.63965017", "0.6378546", "0.63648504", "0.63620204", "0.63592", "0.6339319", "0.63055223", "0.6300183", "0.6298371", "0.62969244", "0.62922174", "0.62722063", "0.6249545", "0.62389505", "0.6231999", "0.62271374", "0.6222802", "0.6222679", "0.6222679", "0.61817694", "0.61599094", "0.61592793", "0.6128792", "0.6128792", "0.6128792", "0.6128792", "0.6128792", "0.6128792", "0.6128792", "0.6124111", "0.61135787", "0.6107926", "0.6105949", "0.61040264", "0.6097669", "0.60912496", "0.60785955", "0.60514235", "0.6046354", "0.60417956", "0.6041581", "0.60386145", "0.60325485", "0.6032242", "0.60185266", "0.6013177", "0.6012537", "0.6011157", "0.6010812", "0.60096014", "0.600689", "0.60021716", "0.5998768", "0.59964055", "0.59962875", "0.5993443", "0.59932154", "0.5974478", "0.5972157", "0.59709615", "0.59694505", "0.596328", "0.5954963", "0.5951386", "0.59506905", "0.5949439", "0.5946719", "0.5946719", "0.5946719", "0.5946413", "0.5938328", "0.593463", "0.593463", "0.5931565", "0.59236693" ]
0.70134836
3
part 1 input string output new string with words in reverse order rules empty string returns empty string maintain case given a string scan, using space as the delimeter reverse the result and return
def reverse_sentence(str) str.scan(/\w+/).reverse.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_word_by_word_naive(s)\n words = s.split(\" \")\n my_reverse(words).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(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 reverse_words(str)\n # Go for it\n str\n .scan(/(\\s*)(\\S+)(\\s*)/)\n .map { |spacer1, word, spacer2| spacer1 + word.reverse + spacer2 }\n .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 reverse_words(str)\n str.scan(/(\\s*)(\\S+)(\\s*)/).map { |space1, word, space2| space1 + word.reverse + space2}.join\nend", "def reverser\n str = yield\n words = str.split(\" \")\n\n words.each do |word|\n word.reverse!\n end\n words.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_ordering_of_words(s)\n\tsplit_words = s.split('')\n\n\toutput = []\n\tj = split_words.length\n\n\t(0..split_words.length).each do |i|\n\t\toutput[i] = split_words[j]\n\t\tj = j - 1\n\tend\n\n\treturnval = output.join('')\n\treturn returnval\nend", "def change_me(string)\n result = []\n words = string.split\n iterator = 0\n loop do\n break if iterator == words.size\n word = words[iterator]\n if word.reverse == word\n result << word.upcase\n else\n result << word\n end\n iterator += 1\n end\n result.join(' ')\nend", "def reverse_words(str)\n str.split(/(\\s)/).each { |word| word.reverse! }.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_words (string)\n array = string.split(\"\")\n array.reverse!\n final = array.join(\"\")\n return final\nend", "def wordReverse (str)\nstr.split(' ').reverse.join(' ')\nend", "def word_reverse str\n\tstr.split.reverse.join(' ')\nend", "def wordReverse (string)\n puts string.split.reverse.join(' ')\nend", "def reverse_each_word(s_input)\n a_input = s_input.split # convert scentance to array\n reversed = \"\" # string to hold reversed scentance\n # go through each word\n\n a_input.each_with_index { |word, index|\n characters = word.split \"\" # split the word into an array\n characters = characters.reverse # reverse the chars in array\n # puts \"#{characters} #{characters.is_a?(Array)}\"\n new_word = characters.join \"\" # join characters array into a word\n if index == 0\n reversed << \"#{new_word}\" # shovel the new_word into the string reversed without space if first word\n else\n reversed << \" #{new_word}\" # shovel the new_word into the string reversed\n end\n }\n reversed\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_word_order string\n string.split.reverse.join(' ')\nend", "def rearranger(str)\nstr = str.split(' ')\nfinal = str.reverse.join(' ')\nfinal = final.downcase\nend", "def reverse_words(my_words)\n if my_words == nil || my_words == \"\" || my_words.length == 1\n return my_words\n end\n i = 0\n while i < my_words.length\n start_index = 0\n end_index = 0\n while my_words[i] == \" \"\n i += 1\n end\n if my_words[i] != \" \"\n start_index = i\n end\n # creates an infinitive loops\n while my_words[i + 1] != \" \" && my_words[i + 1] != nil\n i += 1\n end\n end_index = i\n string_reverse(my_words, start_index, end_index)\n i += 1\n end\n return\nend", "def reverse_each_word_collect(string)\n string.split(\" \").collect { |i| i.reverse }.join(\" \")\nend", "def reverse_words(string)\r\n\traise ArgumentError.new('String not provided.') if string.nil?\r\n\treturn string if string.empty?\r\n\tif string.match(/\\s/) \r\n\t\treversed_words = []\r\n\t\tstring.split(/\\s/).each do |word| \r\n\t\t\treversed_words << word.reverse\r\n\t\tend\r\n\t\treversed_words.join(' ')\r\n\telse\r\n\t\tstring.reverse\r\n\tend\r\nend", "def reverse_each_word(phrase)\n phrase.split.collect {|word| word.reverse}.join(\" \")\n \n end", "def reverse_words(input_string)\n tokens = input_string.split(' ')\n swap_words(tokens)\nend", "def word_reverse (str)\n str.split(' ').reverse.join(' ')\nend", "def reverse_words(my_words)\n if my_words == nil\n return nil\n end\n index = 0\n start_index = 0\n my_words.length.times do\n if my_words[index] == \" \" # if there is a white space, run the code below\n end_index = index - 1 # drop the white space\n my_words = reverse(my_words, start_index, end_index)\n start_index = index + 1\n end\n index += 1\n end\n my_words = reverse(my_words, start_index, index - 1) # account for last word in my_words\n return my_words\nend", "def reverser\nwords=yield.split(\" \")\noutpt=\"\"\nwords.map do\n |w|\noutpt= outpt + w.reverse + \" \"\n end\noutpt [0...-1]\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 word_reverse(str)\n p str.split(' ').reverse.join(' ')\nend", "def reverse_word_order(str)\n str.split.reverse.join(' ')\nend", "def reverse_words(str)\n words = str.split(\" \")\n words.each { |word| word.reverse! }\n return words.join(\" \")\nend", "def reverse_each_word(str2)\n new_str = []\n str2.split.collect do |word|\n new_str << word.reverse!\n end\n return new_str.join(\" \") \nend", "def reverse_even_words(str)\n return_string = \"\"\n\n words = str.split()\n\n index = 0\n words.each do |word|\n index += 1\n if word.length&1==0\n if index >= 2\n return_string = return_string + \" #{word.reverse}\"\n elsif index < 2\n return_string = word.reverse\n end\n else\n if index >= 2\n return_string = return_string + \" #{word}\"\n elsif index < 2\n return_string = word\n end\n end\n end\n\n return return_string\nend", "def reverse_alternate(string)\n string.split.map.with_index{ |word, index| index.odd? ? word.reverse : word }.join(\" \")\nend", "def reverse_each_word(string)\n split_array = string.split(' ')\n reversed = []\n split_array.each do |word|\n reversed << word.reverse\n end\nreturn reversed.join(' ')\nend", "def reverse_words_refactor(string)\n jumbled_letters = string.split(\" \").each {|word| word.reverse!}.join(\" \")\nend", "def reverse(string)\n arr = string.split\n new_arr = []\n loop do\n reversed_word = arr.pop\n new_arr.push(reversed_word)\n break if arr.length == 0\n end\n new_string = new_arr.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 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 wordReverse (string_of_words)\n\n new_string = string_of_words.split(' ').reverse().join(' ')\n puts new_string\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_words(string)\n string_split = string.split\n word_count = string_split.length-1\n reversed_string = []\n string_split.each do | word |\n reversed_string << string_split[word_count]\n word_count -= 1\n end\n reversed_string.join(' ')\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_each_word(string_of_words)\n storage_array1 = string_of_words.split(\" \")\n final_message = \"\"\n storage_array1.collect do |word|\n final_message += \"#{word.reverse!} \"\n end\n final_message.strip\nend", "def wordReverse(string)\n\tp string.split(\" \").reverse().join(\" \")\nend", "def reverse_odd(str)\n reversed = ''\n idx = 0\n str.scan(/\\w+/) do |word|\n reversed << (idx.even? ? word + ' ' : word.reverse + ' ')\n idx += 1\n end\n reversed\nend", "def reverse_words(word)\n \n \n \n word = word.split(\" \")\n result = []\n word.each do |x|\n y = x.reverse\n result << x.reverse\n end\n result.join(' ') \n\nend", "def reverse_each_word(string)\n string.split(\" \").collect {|word| word.reverse!}.join(\" \")\nend", "def reverse_and_combine_text(s)\n words = s.split\n return s if words.length.eql?(1) \n current_words = []\n \n loop do\n last_word = ''\n \n words.map! do |word|\n word.reverse!\n end\n \n last_word = words.pop if words.length.odd?\n \n words.each_with_index do|word, index|\n current_words << word + words[index + 1] if index.even?\n end\n \n current_words << last_word if last_word != ''\n \n break if current_words.length == 1\n \n words = current_words\n current_words = []\n end\n \n current_words\nend", "def wordReverse(aString)\n return aString.split.reverse.join(\" \")\nend", "def reverse_words(my_words)\n return nil if my_words == nil\n return '' if my_words == ''\n\n i = 0\n all_words_end = my_words.length\n\n while i < all_words_end\n\n while my_words[i] == ' ' && i < all_words_end\n i += 1\n end\n\n start_of_word = i\n\n while my_words[i] != ' ' && i < all_words_end\n i += 1\n end\n\n end_of_word = i - 1\n\n reverse_string(my_words, start_of_word, end_of_word)\n end\n\n return my_words\n\n raise NotImplementedError\nend", "def reverseWords(str) \n str.reverse!\n str.split.map{|word| word.reverse!}.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_each_word(string)\n string.split(\" \").collect {|x| x.reverse!}.join(\" \")\nend", "def reverseWordsLite(str)\n str.reverse!\n wordStart, wordEnd = 0, 0\n str.each_char do |char|\n if char == \" \"\n reverseSubString(str, wordStart, wordEnd-1)\n wordStart = wordEnd + 1\n end\n wordEnd += 1\n end\n reverseSubString(str, wordStart, wordEnd-1)\n str\nend", "def reverse_each_word(string)\n new_arr = string.split\n new_arr.collect do |word|\n word.reverse\n end.join(' ')\n \nend", "def reverse_words(my_words)\n return my_words if my_words == nil || my_words.length == 0\n \n i = 0\n l = my_words.length\n start_char = 0\n finish_char = 0\n \n while i < l \n while my_words[i] == \" \"\n i += 1\n end\n start_char = i\n while my_words[i] != \" \" && i < l\n i += 1 \n end\n finish_char = (i -1) \n while start_char < finish_char\n temp = my_words[start]\n my_words[start_char] = my_words[finish_char]\n my_words[finish] = temp\n start_char += 1\n finish_char -= 1\n end\n end\n return my_words\nend", "def reverse_each_word(string)\n reversed = string.split(\" \").collect do |word|\n word.reverse\nend\n reversed.join(\" \")\nend", "def reverse_each_word(string)\n split = string.split\n split = split.collect do |word|\n word.reverse\n end\n return split.join(\" \")\nend", "def reverser\n words= yield.split\n for word in words\n word.reverse!\n end\n words.join(\" \")\nend", "def reverse_words(sent)\n words = sent.split(\" \")\n reversed_sent = \"\"\n words.each {|word| reversed_sent = reversed_sent + \" \" + reverse_word(word)}\n return reversed_sent\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_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!(message)\n # first we reverse the entire thing\n reverse_characters!(message, 0, message.length - 1)\n\n current_start = 0\n\n # then we reverse each word\n (0..message.length).each do |i|\n # keep going unless message is over or we found a space\n next unless i == message.length || message[i] == ' '\n\n # if we found a space reverse the word\n\n reverse_characters!(message, current_start, i - 1)\n\n # start the next word ... we already know that there can only be 1 space\n\n current_start = i + 1\n end\n\n message # don't need to return but doing this to test spec\nend", "def reverse_each_word(string)\n sentence = string.split(\" \")\n sentence.collect do |word|\nword.reverse\nend.join(\" \")\nend", "def reverse_each_word(string)\n array = string.split\n array.each do |word|\n word.reverse!\n end\n array.join(\" \")\nend", "def rule3(str = @word)\n newstr = str.chars\n\n reverse = false\n output = ''\n\n newstr.each do |char|\n if char == '!'\n reverse = !reverse\n else\n output << char\n end\n end\n\n output.reverse! unless !reverse\n output.to_s.squeeze(\" \")\n end", "def reverse_each_word(string)\n string = string.split\n reversed_string = []\n \n string.collect do |char|\n reversed_string.push(char.reverse)\n end\n \n return reversed_string.join(' ')\nend", "def reverse_words(string)\n words = string.split(\" \")\n words.map! {|element| element.reverse}\n words.join(\" \")\n\nend", "def reverse_words(string)\n string.split(' ').map{|word| word.reverse}.join(' ')\nend", "def croon str\n ans = \"\"\n words = str.split(\" \")\n words.each_with_index {|word, i|\n if words[i] == words[-1]\n ans << word.split(\"\").join(\"-\")\n ans\n return ans\n else\n ans << word.split(\"\").join(\"-\") + \" \"\n ans\n end\n }\nend", "def reverse_each_word(string) #collect returns new arr \n string.split(' ').collect {|i| i.reverse!}.join(' ')\nend", "def reverser\n if block_given?\n string = yield\n words = string.split(' ')\n words.each {|word| word.reverse!}\n words.join(' ')\n end\nend", "def reverse_each_word(string)\n words_arr = string.split\n reverse = words_arr.collect {|word| word.reverse}\n reverse.join(\" \")\nend", "def reverse_sentence(my_sentence)\n return nil if my_sentence == nil \n\n split_sentence = my_sentence.scan(/\\S+|\\s+/) \n reversed_sentence = \"\"\n i = 0 \n while i < split_sentence.length do \n reversed_sentence += split_sentence[-(i+1)]\n i += 1\n end \n return reversed_sentence\nend", "def reverse_each_word(str)\n arr = str.split\n revArr = arr.collect do |word|\n word.reverse\n end\n revArr.join(\" \")\nend", "def reverse_each_word(string)\n words = string.split(\" \")\n \n words.collect do |word|\n word.reverse!\n end\n \n words.join(\" \")\nend", "def reverse_each_word(astring)\n astring.split(\" \").collect {|word| word.reverse}.join(\" \")\nend", "def reverse_each_word(string)\n p string.split.collect {|word| word.reverse}.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_each_word(string)\n array = string.split\n array.collect do |element|\n element.reverse!\n end\n array.join(\" \")\nend", "def reverse_words(string)\n\t\ta = string.split(\" \")\n\t\tb = a.length\n\t\t\n\t\tif b > 1\n\t\t\t a.map{|value| value = value.reverse}.join(\" \")\n\t\t\telse\n\t\t\t string.reverse\n\t\tend\n\tend", "def reverse_words(sent)\r\n reverse = []\r\n sent.split(\" \").each do |word|\r\n reverse << word.reverse\r\n end\r\n return reverse.join(\" \")\r\nend", "def reverse_each_word(string)\n string.reverse.split.collect { |word| word }.reverse.join(\" \")\nend", "def reverse_odd(str)\n results = ''\n even = true\n str.scan(/\\b\\w+\\b/) do |word|\n results << (even ? word : word.reverse) << ' '\n even = !even\n end\n results.chop << '.'\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", "def reverse_each_word(string)\n string.split.collect {|word| word.reverse}.join(\" \")\nend", "def reverse_each_word(string)\n string.split.collect {|word| word.reverse}.join(\" \")\nend", "def reverse_each_word(string)\n string.split.collect {|word| word.reverse}.join(\" \")\nend", "def reverse_each_word(string)\n string.split.collect {|word| word.reverse}.join(\" \")\nend", "def reverse_sentence(my_sentence)\n #1. check if my_sentence even exists\nif my_sentence.nil? || my_sentence == \"\" || my_sentence.length == 0\n return my_sentence\nend\n\n#example input: \"coffee is the best\"\n#output: #output: \"best is the coffee\"\n# 0 1 2 3\n#store into temp array = [\"coffee\", \"is\", \"the\", \"best\"]\n#2. SPLIT SENTENCE, SAVE INTO TEMP ARRAY\n#\\s+ = whitespace\n#\\S+ = everything else not caught by \\s whitespace\ntemp_array = my_sentence.split(/(\\s+|\\S+)/)\n\n#IMPORTANT BUSINESS LOGIC STARTS BELOW\n#make another array for storage = reversed_array = []\nreversed_array = []\n#LOOP, start at lastword = temp array.length - 1\ni = temp_array.length - 1\nwhile i >= 0\n # push word = \"best\" into reversed_array\n reversed_array.push(temp_array[i])\n #decrement \n i -= 1\nend\n\n#JOIN strings from reversed_array\n# ['12','34','35','231'].join(', ')\nreversed_sentence = reversed_array.join(\"\")\n\n#clear the input using mutations http://rubyblog.pro/2017/09/pass-by-value-or-pass-by-reference\nmy_sentence.clear\n\n#use string manipulation\nmy_sentence.concat(reversed_sentence)\n\n#cannot do this because ruby is pass by value and not reference\n#my_sentence = reversed_sentence\nend", "def reverse_words(string)\n string_array = string.split(\" \")\n words = string_array.each {|word| word.reverse!}.join(\" \")\nend", "def reverse_each_word(string)\n array = string.split \" \"\n array.collect { |word| word.reverse! }\n array.join(\" \")\nend", "def reverse(string)\n words = string.split(' ')\n words.reverse!\n return words.join(' ')\nend", "def reverse_words(s)\n output = []\n arr = s.split(\" \")\n \n arr.each do |word|\n output << word.reverse\n end\n \n output.join(\" \")\nend", "def reverse_words(my_words)\n return nil if my_words == nil\n i = 0\n start_index = 0\n my_words.length.times do\n if my_words[i] == \" \"\n my_words = reverse_word(my_words, start_index, i - 1)\n start_index = i + 1\n end\n i += 1\n end\n\n my_words = reverse_word(my_words, start_index, i - 1) # for last word\n\n return my_words\nend", "def reverse_words(s)\n s.split(' ').map(&:reverse!).join(' ')\nend", "def reverse_words(string)\n string.gsub(/\\w+/) { |word| word.reverse! } \n end", "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" ]
[ "0.7333701", "0.7171058", "0.7168493", "0.71629214", "0.70760584", "0.70382446", "0.70222294", "0.7000654", "0.6996369", "0.695027", "0.69465643", "0.6941701", "0.69275767", "0.6920036", "0.6913219", "0.6903961", "0.6898942", "0.689444", "0.689444", "0.6877937", "0.68773985", "0.68632287", "0.68612635", "0.685775", "0.68544775", "0.68536615", "0.68483716", "0.684466", "0.68446094", "0.6838934", "0.68351233", "0.6818825", "0.6817032", "0.6815058", "0.68017745", "0.6794978", "0.6792761", "0.6783692", "0.6782245", "0.6778579", "0.6776133", "0.6774334", "0.6771243", "0.6771012", "0.6767518", "0.6767351", "0.676655", "0.67500925", "0.6746919", "0.6743656", "0.6742542", "0.6736367", "0.67287344", "0.67276686", "0.6726632", "0.6726486", "0.6720868", "0.6715048", "0.671235", "0.67116934", "0.6707677", "0.67027384", "0.6701505", "0.6696909", "0.66964173", "0.669563", "0.6689763", "0.66893965", "0.6686089", "0.66754866", "0.6672124", "0.66711086", "0.6669862", "0.66694576", "0.6668223", "0.6666143", "0.66638106", "0.6662372", "0.66608405", "0.6658565", "0.6657986", "0.6654589", "0.6654439", "0.66526365", "0.6652437", "0.66509145", "0.6647523", "0.66471165", "0.66445845", "0.66445845", "0.66445845", "0.66445845", "0.66439307", "0.66430825", "0.66415733", "0.66406673", "0.66396177", "0.6638869", "0.6638715", "0.66385436", "0.66384816" ]
0.0
-1
ROCHE SPECIFIC FIELDS END.
def parse_field_for_sample_id(fields,index) return false if fields[index].blank? return false if fields[index].strip.blank? self.sample_ids = fields[index].strip.split(/\'/) return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fields; end", "def fields; end", "def fields; end", "def end_field; end", "def start_field; end", "def end_field=(_arg0); end", "def fields?; @fields; end", "def computed_fields; end", "def fields\n nil\n end", "def fields\n @_fields ||= {}\n end", "def fields\n @fields ||= []\n end", "def fields\n FIELDS\n end", "def get_fields\n FIELD_DESCS\n end", "def fields\n @fields ||= []\n end", "def fields\n @fields ||= {}\n end", "def fields\n @fields ||= {}\n end", "def fields\n @fields ||= {}\n end", "def fields\n @fields ||= {}\n end", "def fields\n @fields ||= {}\n end", "def fields reload = false\n\t\t\t@fields = false if reload\n\t\t\t@fields ||= RealEstate.get_fields self\n\t\tend", "def fields\n missing_method :fields\n end", "def fields\n []\n end", "def fields!\n @schema.fields!\n end", "def get_remaining_fields(detail_page, job)\n job.full_part = get_full_part(detail_page)\n job.temp_reg = get_temp_reg(detail_page)\n job.start_date = get_start_date(detail_page)\n job.end_date = get_end_date(detail_page)\n job.contact_name = get_contact_name(detail_page)\n job.contact_phone = get_contact_phone(detail_page)\n end", "def nillify_fields\n if self.rate_type == \"Per night\"\n self.number_of_guests = self.max_number_of_guests = nil\n end\n\n if self.rate == \"Rate Amount\"\n self.discount_type = self.discount_amount = nil\n elsif self.rate == \"Discount\"\n self.net_rate = self.commission_percent = nil\n end\n\n super\n end", "def fetch_fields\n @fields\n end", "def fields\n FIELDS\n end", "def get_fields\n raise NotImplementedError.new\n end", "def fields\n @fields ||= begin\n default_fields\n end\n end", "def get_fields(template); end", "def fields; h.fields; end", "def add_fields(fields)\n\t\tend", "def fields\n @fields\n end", "def fields\n @fields\n end", "def check_fields\n columns= resource.model.column_names - AutoRest::AR_MAGIC_COLUMNS\n\n default_columns= columns.select { |attr| attr !~ /.*_count$/ }.map do |elem|\n [elem.intern, elem.titleize]\n end\n\n # For storing columns, I use an array and not a hash --i.e.: (:column => 'Title') -- \n # to ensure the order of the columns. I convert the params from linear array to \n # grouped array to alivianate user's data entry:\n # [[:col0, \"name0\"], [:col1, \"name1\"]] becomes [:col0, \"name0\", :col1, \"name1\"]\n \n # *TODO* This should be cleaned a little, because right now is a bit difficult\n # to remember the way the attributes for each view work.\n\n [:for_index, :for_new, :for_edit, :for_show].each do |key|\n arr= fields.send(key)\n exc= exclude_fields.send(key)\n\n if !arr # User has not supplied columns.\n arr= default_columns\n else\n # enum_for creates an enum from array, therefore protecting the original array contents.\n # each slice returns an array of specified elements: [1,2,3,4] => 1..4 => [[1,2],[3,4]]\n arr= arr.enum_for(:each_slice, 2).to_a\n end\n \n # Remove excluded fields.\n arr= arr.reject { |e| exc.map{|elem|elem.to_s}.include?(e[0].to_s) } if exc\n fields.send(\"#{key}=\", arr)\n end\n end", "def fields\n FIELDS\n end", "def fields=(val)\n @fields = val\n @fields = nil if @fields && @fields.empty?\n end", "def fields\n @fields ||= FieldList.new\n end", "def fields\n return @fields if defined?(@fields)\n\n @fields = array_of_items_for(Fields, :fields)\n end", "def fields\n @fields\n end", "def read_field\n end", "def controlfields\n cf = []\n org_codes = %w(NNU-TL NNU-F NyNyUA NyNyUAD NyNyUCH NBPol NyBlHS NHi)\n org_code = get_repo_org_code\n cf << add_003_tag(org_code) if org_codes.include?(org_code)\n cf << add_005_tag\n @record.controlfields = cf\n end", "def method_missing(meth, *args, &blk)\n super unless Fields.all.include?(meth)\n field meth, *args\n end", "def fields\n self.class.fields(true)\n end", "def clear_fields\n\t\tend", "def start_field=(_arg0); end", "def fetch_fields\n @result.fetch_fields\n end", "def initialize\n @fields = []\n end", "def fields\n raw['fields']\n end", "def field_extras\r\n return @field_extras\r\n end", "def method_missing name, *args, &block\n if name.to_s =~ /^(.+)_fields$/\n self.fields.select {|f| f.data_type.to_s.parameterize.underscore == $1 } || super\n else \n super\n end\n end", "def field(name); end", "def typus_fields_for(filter); end", "def fields\n raise NoMethodError, \"Descendants of MSFL::Datasets::Base are required to implement the #fields method\"\n end", "def all_fields\n found_fields = Array.new\n self.fields.each do |field|\n found_fields << field\n found_fields = found_fields + field.all_fields if field.type == 'ObjectField'\n end\n found_fields\n end", "def field_count\n super\n end", "def fields(fields = nil)\n set_option(:fields, fields)\n end", "def fields=(value)\n @fields = value\n end", "def all_fields\n superclass.all_fields.merge(own_fields)\n rescue NoMethodError\n own_fields\n end", "def fields\n all_fields\n end", "def each_field\n data['eachField']\n end", "def fields()\n @@defined_subclass_field_lists[self.class]\n end", "def get_fields()\n return @api.do_request(\"GET\", get_base_api_path() + \"/fields\")\n end", "def fields\n return @fields if @fields\n @file.rewind\n @fields = @file.gets.split(@separator).map &:strip\n end", "def fields\n @fields ||= parse_raw(@code, @raw)\n end", "def fields\n fields = orig_fields\n\n fields.instance_exec(self) do |content_type|\n fields.define_singleton_method(:add) do |field|\n content_type.update(fields: content_type.merged_fields(field))\n end\n\n fields.define_singleton_method(:create) do |params|\n field = Contentful::Management::Field.new\n Field.property_coercions.each do |key, _value|\n snakify_key = Support.snakify(key)\n param = params[snakify_key.to_sym]\n field.send(\"#{snakify_key}=\", param) if param\n end\n content_type.update(fields: content_type.merged_fields(field))\n end\n\n fields.define_singleton_method(:destroy) do |id|\n fields = content_type.fields.reject { |field| field.id == id }\n content_type.update(fields: fields)\n end\n end\n\n fields\n end", "def filter_fields\n\t \n\t \tremove_attribute(:version)\n\t \tremove_attribute(:op_success)\n\t \tattributes\n\n\t \t\n\t end", "def filter_fields\n\t \n\t \tremove_attribute(:version)\n\t \tremove_attribute(:op_success)\n\t \tattributes\n\n\t \t\n\t end", "def get_field_deserializers()\n return super.merge({\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"isAvailable\" => lambda {|n| @is_available = n.get_boolean_value() },\n })\n end", "def related_fields(method)\n \n end", "def fields\n %i[ position_title employee_type request_type\n contractor_name number_of_months annual_base_pay\n nonop_funds nonop_source justification organization__name unit__name\n review_status__name review_comment user__name created_at updated_at ]\n end", "def fields\n self.class::FIELDS\n end", "def fields\n self.class::FIELDS\n end", "def fields\n self.class::FIELDS\n end", "def fields\n @node.css('controlfield, datafield').map{|f| objectify f}\n end", "def user_defined_fields\n RubyRedtail::Query.run(\"contacts/#{@id}/udf\", @api_hash, \"GET\")\n end", "def arrangeable_fields\n raise NotImplementedError, 'You need to overwrite this method in the calling class'\n end", "def labor_request_all_fields\n LaborRequest.fields\n end", "def fields\n @fields ||= form.fields\n end", "def initialize_fields\n terms_for_editing.each do |key|\n # if value is empty, we create an one element array to loop over for output \n self[key] = [''] if self[key].empty?\n end\n end", "def all_fields\n fields.values\n end", "def display_all_fields\n @@all_fields\n end", "def fields\n %i[ position_title employee_type request_type contractor_name\n number_of_positions hourly_rate hours_per_week number_of_weeks annual_cost\n nonop_funds nonop_source justification organization__name unit__name\n review_status__name review_comment user__name created_at updated_at ]\n end", "def field_options\n [\n ['Do Not Import Field', :none],\n ['Full Name', :full_name],\n ['First Name', :first_name],\n ['Last Name', :last_name],\n ['Email', :email],\n ['Type', :type],\n ['Company', :company],\n ['Street Address', :address1],\n ['City/State/Zipcode', :address2],\n ['City', :city],\n ['State', :state],\n ['ZipCode', :zip],\n ['Source', :source],\n ['Group', :category],\n ['Mobile Phone', :phone_mobile],\n ['Business Phone', :phone_business],\n ['Home Phone', :phone_home],\n ['Fax Number', :fax_number],\n ['Temperature', :temperature],\n ['Birthday', :birthday],\n ['Anniversary', :anniversary],\n ['Spouse', :spouse],\n ['Home Purchase Date', :home_anniversary],\n ['Home Budget Price', :budget],\n ['Notes/Comments', :description]\n ]\n end", "def contents_fields\n []\n end", "def fields\n schema.fields\n end", "def fields\n schema.fields\n end", "def fields\n schema.fields\n end", "def fields=(fields)\n @fields = fields\n end", "def _field_types\n special_attribute('@fieldTypes'.freeze)\n end", "def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"nextExpectedRanges\" => lambda {|n| @next_expected_ranges = n.get_collection_of_primitive_values(String) },\n })\n end", "def modified_data_fields\n [:gender, :hispanic_latino, :veteran_status, :disability_status]\n end", "def ead_unitdate_fields(fields = Hash.new)\n start_dates, end_dates = [], []\n unless self.unitdate_normal.nil?\n self.unitdate_normal.each do |unitdate|\n start_dates << unitdate_start(unitdate)\n end_dates << unitdate_end(unitdate)\n end\n Solrizer.set_field(fields, \"unitdate_start\", start_dates.compact, :facetable, :displayable, :sortable)\n Solrizer.set_field(fields, \"unitdate_end\", end_dates.compact, :facetable, :displayable, :sortable)\n Solrizer.insert_field(fields, \"unitdate\", ead_date_display, :displayable)\n end\n return fields\n end", "def initialize\n @fields = Fields.new\n end", "def load_fields(mid)\n url = Configuration::PROPERTIES.get_property :url\n url_get_records = Configuration::PROPERTIES.get_property :url_get_fields\n\n url_get_records = url_get_records.gsub '{csk}', URI::encode(@credential[:csk])\n url_get_records = url_get_records.gsub '{aci}', URI::encode(@credential[:aci])\n url_get_records = url_get_records.gsub '{mid}', mid.to_s\n\n response = DynamicService::ServiceCaller.call_service url + url_get_records, {}, 'get'\n\n json = JSON.parse(response)\n unless json['status'] == 200\n raise json['message']\n end\n\n fields = []\n fs = json['fields']\n fs.each do |key, jf|\n field = Dynamicloud::API::Model::RecordField.new\n field.id = jf['id'].to_i\n field.identifier = jf['identifier']\n field.label = jf['label']\n field.comment = jf['comment']\n field.uniqueness = jf['uniqueness']\n field.required = jf['required']\n field.type = Dynamicloud::API::Model::RecordFieldType.get_field_type jf['field_type'].to_i\n field.items = Dynamicloud::API::DynamicloudHelper.build_items jf['items']\n field.mid = mid.to_i\n\n fields.push field\n end\n\n fields\n end", "def fields\n DatasetService.get_fields dataset_id, api_table_name\n end", "def fields\n if frozen?\n Array(@gapi.fields).map { |f| Field.from_gapi(f).freeze }.freeze\n else\n Array(@gapi.fields).map { |f| Field.from_gapi f }\n end\n end", "def all_fields\n @fields.values\n end", "def fields\n self.class.fields\n end", "def fields\n self.class.fields\n end", "def fields\n self.class.fields\n end" ]
[ "0.7586811", "0.7586811", "0.7586811", "0.7344003", "0.6795982", "0.67171514", "0.6622132", "0.6606985", "0.6510521", "0.6451728", "0.64362925", "0.6433731", "0.63694745", "0.6349932", "0.6319235", "0.6319235", "0.6319235", "0.6319235", "0.6319235", "0.6310776", "0.62928456", "0.6290309", "0.6256906", "0.62433046", "0.62339133", "0.62315285", "0.61967367", "0.6191003", "0.61860156", "0.6152575", "0.61432594", "0.61373067", "0.6114753", "0.6114753", "0.6107425", "0.61033446", "0.6099204", "0.6097848", "0.6094238", "0.6087158", "0.60864645", "0.60795486", "0.60549533", "0.60270387", "0.5989579", "0.59821254", "0.5977429", "0.5973439", "0.59622896", "0.59487474", "0.59452504", "0.5936444", "0.59173125", "0.5904199", "0.58853406", "0.5881001", "0.5859759", "0.5838681", "0.5834342", "0.58342046", "0.5828454", "0.5826433", "0.5819493", "0.5812431", "0.5806525", "0.58015645", "0.5791717", "0.5791717", "0.5791709", "0.57890904", "0.5780508", "0.5753633", "0.5753633", "0.5753633", "0.5748537", "0.57420105", "0.57415533", "0.57092476", "0.57074136", "0.56954765", "0.5684822", "0.5683316", "0.5680106", "0.5675416", "0.5666906", "0.56508225", "0.56508225", "0.56508225", "0.5632072", "0.5630724", "0.56303585", "0.5623462", "0.5623432", "0.5619875", "0.56157506", "0.5613218", "0.56053036", "0.56040233", "0.559951", "0.559951", "0.559951" ]
0.0
-1
each query will build one patient and one order inside it. the order can have many tests.
def build_response(options={}) responses = [] one_response = '' puts "sample ids are:" puts self.sample_ids return responses unless sample_ids self.sample_ids.each_with_index {|sid,key| puts "doing sample id: #{sid}" ## tests are got from the requisitions hash. tests = get_tests(sid) puts "tests are: #{tests}" ## default sequence number is 0 (THIS MAY LEAD TO PROBLEMS.) sequence_number = "#{key.to_s}" ## default patient id: patient_id = "abcde#{Time.now.to_i.to_s}" patient = Patient.new({:sequence_number => sequence_number, :patient_id => patient_id}) order = Order.new({:sequence_number => patient.sequence_number, :specimen_id => sid, :tests => tests, :priority => "R"}) responses << (patient.build_response(options) + order.build_response(options.merge({sequence_number: self.sequence_number, carrier_number: self.carrier_number, position_number: self.position_number, sample_type: self.sample_type, container_type: self.container_type}))) } puts "responses are:" puts responses.to_s return responses end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @ordereds=Ordered.all\n @preparats=Preparat.all\n @order.ordereds.build\n end", "def create\n\n @order = Order.new(:drone_id => Drone.where('name = :dname', dname: 'No Drone Assigned').first.id, :person_id => params[:orderdetail][:person_id], :status => 1)\n if @order.save\n @orderdetail = Orderdetail.new(:product_id => params[:orderdetail][:product_id],:quantity => params[:orderdetail][:quantity],:order_id => @order.id)\n \n respond_to do |format|\n if @orderdetail.save\n format.html { redirect_to @orderdetail, notice: 'Orderdetail was successfully created.' }\n format.json { render :show, status: :created, location: @orderdetail }\n else\n format.html { render :new }\n format.json { render json: @orderdetail.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def perform_query(query, operand)\n# STDERR.puts \"perform_query(q '#{query}', op '#{operand}')\"\n records = []\n\t\t \n if operand.is_a?(DataMapper::Query::Conditions::NotOperation)\n#\tSTDERR.puts \"operand is a NOT operation\"\n\tsubject = operand.first.subject\n\tvalue = operand.first.value\n elsif operand.subject.is_a?(DataMapper::Associations::ManyToOne::Relationship)\n#\tSTDERR.puts \"operand subject is a many-to-one relation: '#{operand.subject.inspect}'\"\n\tif operand.subject.parent_model == NamedQuery && operand.subject.child_model == Bug\n\t name = operand.value[operand.subject.parent_key.first.name]\n\t bugs = named_query(name)\n\t bugs.each do |bug|\n\t records << bug_to_record(query.model, bug)\n\t end\n\t return records\n\telse\n\t raise \"Unknown parent (#{operand.subject.parent_model}) child (#{operand.subject.child_model}) relation\"\n\tend\n else\n#\tSTDERR.puts \"operand is normal\"\n\tsubject = operand.subject\n\tvalue = operand.value\n end\n \n if subject.is_a?(DataMapper::Associations::ManyToOne::Relationship)\n#\tSTDERR.puts \"subject is a many-to-one relation\"\n\tsubject = subject.child_key.first\n end\n \n # typical queries\n #\n \n# STDERR.puts \"perform_query(subject '#{subject.inspect}', value '#{value.inspect}')\"\n case query.model.name\n when \"Bug\"\n\tif query.model.key.include?(subject)\n\t # get single <bug>\n\t bugs = get_bugs(value)\n\t records << bug_to_record(query.model, bugs.first)\n\telse\n\t raise \"Unknown query for bug\"\n\tend\n when \"NamedQuery\"\n\trecords << { subject.name.to_s => value }\n\t# be lazy: do the actual named query when NamedQuery#bugs gets accessed\n else\n\traise \"Unsupported model '#{query.model.name}'\"\n end\n \n records\n end", "def build\n build_order_detail_journal_rows do |virtual_order_detail|\n validate_order_detail(virtual_order_detail)\n end\n\n order_details.each { |order_detail| update_product_recharges(order_detail) }\n add_journal_rows_from_product_recharges\n self\n end", "def build_order\n @order ||= ManagementCenter::Order.new\n end", "def test_002\n target_sql = \"select shipments.number as shipment_number,\nvariants.sku as sku,\nvariants.price as price,\nvariants.weight as weight,\nvariants.height as height,\nvariants.width as width,\nvariants.depth as length,\nproducts.description as product_description,\norders.number as order_number\nfrom orders\njoin shipments on (shipments.order_id = orders.id)\njoin line_items on (line_items.order_id = orders.id)\njoin variants on (line_items.variant_id = variants.id)\njoin products on (variants.product_id = products.id)\njoin state_events on (state_events.stateful_id = orders.id and state_events.name = 'payment' and state_events.stateful_type = 'Order' and state_events.next_state in ('paid','credit_owed'))\nwhere orders.state = 'complete' and orders.shipment_state = 'ready' and state_events.created_at >= '2012-10-01' and state_events.created_at <= '2015-03-08' and shipments.warehouse_id = 28\"\n \n @sql.select do\n shipments number: 'shipment_number'\n variants :sku, :price, :weight, :height, :width, depth: 'length'\n products description: 'product_description'\n orders number: 'order_number'\n end\n \n @sql.from :orders do\n join :shipments, on: 'shipments.order_id = orders.id'\n join :line_items, on: 'line_items.order_id = orders.id'\n join :variants, on: 'line_items.variant_id = variants.id'\n join :products, on: 'variants.product_id = products.id'\n join :state_events do\n state_events stateful_id: :'orders.id',\n name: 'payment',\n stateful_type: 'Order',\n next_state: %w(paid credit_owed)\n end\n end\n\n begin_date = '2012-10-01'\n end_date = '2015-03-08'\n warehouse_id = 28\n \n @sql.where do\n orders state: 'complete', shipment_state: 'ready'\n \n con '>=' do\n state_events created_at: begin_date\n end\n con '<=' do\n state_events created_at: end_date\n end\n \n shipments warehouse_id: warehouse_id\n end\n\n assert_equal @sql.to_s, target_sql\n end", "def new\n @order = Order.new\n 2.times do\n ordered_product = @order.ordered_products.build\n groupa = @order.groupas.build\n groupb = @order.groupbs.build\n groupc = @order.groupcs.build\n end\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @order }\n end\n end", "def create\n build\n if valid? && journal_rows.present?\n journal_rows.each(&:save!)\n set_journal_for_order_details(journal, order_details.map(&:id))\n end\n self\n end", "def create_order(encounter:, date:, tests:, **kwargs)\n patient ||= encounter.patient\n date ||= encounter.encounter_datetime\n\n # test will take TB specific parameters\n\n tests.collect do |test|\n lims_order = nlims.order_tb_test(patient: patient,\n user: User.current,\n date: date,\n reason: test['reason'],\n test_type: [test['test_type']],\n sample_type: test['sample_type'],\n sample_status: test['sample_status'],\n target_lab: test['target_lab'],\n recommended_examination: test['recommended_examination'],\n treatment_history: test['treatment_history'],\n sample_date: test['sample_date'],\n sending_facility: test['sending_facility'],\n **kwargs)\n accession_number = lims_order['tracking_number']\n\n # creation happening here\n local_order = create_local_order(patient, encounter, date, accession_number)\n save_reason_for_test(encounter, local_order, test['reason'])\n\n { order: local_order, lims_order: lims_order }\n end\n end", "def set_order\n @order = Order.find(params[:id])\n #Также нужны переменные\n @client=Client.find(@order.client_id)\n @delivery=Delivery.find(@order.delivery_id)\n @employee=Employee.find(@order.employee_id)\n @ordered=Ordered.where(\"order_id=?\",@order.id)\n end", "def build_order_detail_journal_rows\n reset\n\n virtual_order_details = OrderDetailListTransformerFactory.instance(order_details).perform\n virtual_order_details.each do |virtual_order_detail|\n yield virtual_order_detail if block_given?\n # Each individual order detail may result in multiple journal rows (e.g. double-entry)\n @journal_rows.concat Array(order_detail_to_journal_row(virtual_order_detail))\n end\n\n journal_rows\n end", "def new\n @test = @subject.tests.new\n 3.times do\n question = @test.questions.build\n 4.times { question.answers.build }\n end\n end", "def order_line_report\n #will have 4 columns from the OrderLine table. This goes through the OrderLine method\n @data = OrderLine.find(:all , :select => \"order_id as oid, product_id as pid, product_price as price, ordered_quantity as quantity\", :group => \"oid\")\n end", "def ordering_query; end", "def create_local_order(patient, encounter, date, accession_number)\n Order.create patient: patient,\n encounter: encounter,\n concept: concept('Laboratory tests ordered'),\n order_type: order_type('Lab'),\n orderer: User.current.user_id,\n start_date: date,\n accession_number: accession_number,\n provider: User.current\n end", "def create_local_order(patient, encounter, date, accession_number)\n Order.create(patient: patient,\n encounter: encounter,\n concept: concept('Laboratory tests ordered'),\n order_type: order_type('Lab'),\n orderer: User.current.user_id,\n start_date: date,\n accession_number: accession_number,\n provider: User.current)\n end", "def buildOrder(orderObject)\n return Order.new(orderObject['id'], orderObject['customer_email'], orderObject['fulfilled'], buildProducts(orderObject['products']))\nend", "def provision\n @order = Order.new\n 1.times {@order.order_details.build}\n respond_to do |format|\n format.html # provision.html.erb\n format.json { render json: @order }\n end\n end", "def invoices_report\n @d = ActiveRecord::Base.connection.execute(\"\nselect 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 group by c.name\n\")\n end", "def multi_query_builder\n\n query = \"\n SELECT\n #{select_arr.join(\",\\n\\t\")}\n FROM \\t#{groups.first.parent_table}\n #{pk_join_arr.join(\"\\n\")}\n #{fk_join_arr.join(\"\\n\")};\"\n\n return query\n end", "def new\n @order = Order.new\n 1.times {@order.order_details.build}\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end", "def get_customer_order\n begin\n db = SQLite3::Database.open(ENV[\"BANGAZON\"])\n array_of_orders = db.execute(\"SELECT customers.id 'Customer Number', customers.last_name 'Last Name', customers.first_name 'First Name', orders.id 'Order Number', products.product_title 'Product', products.product_price 'Price'\n FROM orders, customers, order_products, products\n\n WHERE orders.customer_id = ?\n AND orders.id = ?\n AND order_products.product_id = products.id\", [@customer_id, @id])\n db.close\n end\n array_of_orders\n end", "def index\n @produce_tasks = ProduceTask.all\n @produce_tasks = @produce_tasks.joins(:order).where(orders: { name: params[:q] }) if params[:q].present?\n end", "def create\n @order = Order.find(params[:order_id])\n if current_user.role?('manager') and !Manager.find(current_user.manager_id).validity\n redirect_to order_order_items_path(@order), notice: t(:manager_not_valid)\n return \n end\n @order_item = OrderItem.new(params[:order_item])\n @product_ids = ProductPrice.where(price_list_id: @order.price_list_id).select('product_id').map {|x| x.product_id}\n @products = Product.where(validity: true).where(id: @product_ids) \n @select_unit_of_measure = params[:order_item][:unit_of_measure_id] \n @unit_of_measure_ids = ProductUnitOfMeasure.where(product_id: params[:order_item][:product_id]).select('unit_of_measure_id').map {|x| x.unit_of_measure_id}\n @unit_of_measures = UnitOfMeasure.where(id: @unit_of_measure_ids) \n \n @order.order_items << @order_item \n \n respond_to do |format|\n if @order_item.save\n format.html { redirect_to order_order_item_path(@order, @order_item), notice: t(:order_item_created) }\n format.json { render json: @order_item, status: :created, location: @order_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @order=params[:order].to_i\n if @order==1\n @quotes=Quote.order(title: :asc).all\n elsif @order==2\n @quotes=Quote.order(title: :desc).all\n elsif @order==3\n @quotes=Quote.joins(\"left join clients on quotes.client_id = clients.id\").order(\"clients.last_name ASC\")\n elsif @order==4\n @quotes=Quote.joins(\"left join clients on quotes.client_id = clients.id\").order(\"clients.last_name DESC\")\n elsif @order==5\n @quotes=Quote.order(total: :asc).all\n elsif @order==6\n @quotes=Quote.order(total: :desc).all\n elsif @order==7\n @quotes=Quote.order(created_at: :desc).all\n elsif @order==8\n @quotes=Quote.order(created_at: :asc).all\n elsif @order==9\n @quotes=Quote.order(status: :desc).all\n elsif @order==10\n @quotes=Quote.order(status: :asc).all\n\n else\n @quotes = Quote.all\n end\n end", "def generate_orders\n @productos_por_taxonomias.each do |taxonomia, line_items|\n # Picamos la orden actual en sub-ordenes si la orden excede la cantidad de lineas configuradas en el backend par auna orden.\n line_items.each_slice(Spree::Config[:max_order_lines]) do |line_items_slice|\n line_items_slice.each do |line_item|\n @order = nil\n current_order = Spree::Order.new( user_id: spree_current_user.id,\n bill_address_id: @main_order.bill_address_id,\n ship_address_id: @main_order.ship_address_id,\n created_by_id: spree_current_user.id )\n populator = Spree::OrderPopulator.new(current_order, current_order.currency)\n populator.populate(line_item.variant_id, line_item.quantity)\n end\n @current_order = spree_current_user.last_incomplete_spree_order\n add_salesman\n puts \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"\n @current_order.next\n @current_order.next\n @current_order.next\n @zapato = \"chao\"\n end\n end\n end", "def new_order(items, quantities, tweet_id, campaign_id)\r\n\r\n #Creates the new order in the table, with the passed parameters\r\n order = Order.new do |u|\r\n u.user_id = User.where(twitter_id: get_user_from_tweet(tweet_id)).pluck(:id).join\r\n u.tweet_id = tweet_id\r\n u.order_state_id = 1\r\n u.location_id = User.where(twitter_id: get_user_from_tweet(tweet_id)).pluck(:location_id).join\r\n if(campaign_id)\r\n u.campaign_id = campaign_id\r\n end\r\n end\r\n order.save\r\n\r\n #Creates each order_item in the Order linking table\r\n items.each_with_index do |item,i|\r\n order_item = OrderItem.new do |u|\r\n u.order_id = order.id\r\n u.item_id = Item.find_by(name: item).id\r\n u.quantity = quantities[i].to_i\r\n end\r\n order_item.save\r\n end\r\nend", "def build\n my_order = nil\n if cart = user && user.cart\n Order.transaction do\n my_order = Order.create(user: user)\n my_order.products = cart.products\n cart.destroy\n end\n else\n error = Struct.new(:full_messages).new\n error.full_messages = [\"No cart to create order from\"]\n @errors = error\n end\n my_order\n end", "def create_work_orders\n create_education_organization_work_orders\n create_education_org_calendar_work_orders\n create_master_schedule_work_orders\n create_staff_association_work_orders\n create_student_and_enrollment_work_orders\n create_competency_level_descriptor_work_order\n end", "def create\n @user = current_user\n @order = @user.order.new(order_params)\n respond_to do |format|\n if @order.save\n group_params['group_ids'].each do |g|\n gu = GroupUser.where(group_id: g)\n gu.each do |u|\n @u = User.find(u.user_id)\n @u.orders << Order.find(@order.id)\n end\n end\n\n format.html { redirect_to orders_path, notice: 'Order was successfully created.' }\n # format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n # format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def initialize(order)\n @order = order\n end", "def query1\n @cquery = \"\"\n @tquery = \"\"\n if params[:condition_query].present?\n @cquery = params[:condition_query]\n responses = AlternateName.search(@cquery).records\n @conditions = []\n responses.each do |response|\n response.medical_conditions.each do |condition|\n @conditions << condition\n end\n end\n else\n @conditions = MedicalCondition.all\n end\n if params[:therapy_query].present?\n @tquery = params[:therapy_query]\n @therapies = MedicalTherapy.search(@tquery).records\n else\n @therapies = []\n end\n end", "def order_product(q)\n$LOG.info('order_product');\n@CID=q[\"USER\"];\n@PID=q[\"PRODUCT\"];\n@orders=get_orders_by_product(@PID)\n@orders[@CID]=DateTime.now \nend", "def order(params, id)\n db = database()\n cart = cart(id)\n i = 0\n time = Time.now.to_s[0..18]\n db.execute(\"INSERT INTO invoices (Sum, UserId, Timestamp) VALUES (?, ?, ?)\", params[\"sum\"].to_i, id, time)\n invoiceid = db.execute(\"SELECT Id FROM invoices WHERE Timestamp = ?\", time)\n cart.each do |item|\n print item\n db.execute(\"INSERT INTO pizza_invoice_relation (InvoiceId, PizzaId) VALUES (?, ?)\", invoiceid, item[2])\n end\n delete_cart(id)\n end", "def execute\n relation = by_project(PrometheusAlert)\n relation = by_environment(relation)\n relation = by_metric(relation)\n relation = by_id(relation)\n ordered(relation)\n end", "def new\n @order = Order.new\n 8.times { @order.ordered_products.build }\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @order }\n end\n end", "def test_003\n\n target_sql = \"select d.id as id,\nd.taxnumber as taxnumber,\nd.social_security_type as social_security_type,\nd.taxnumber_exemption as taxnumber_exemption\nfrom distributors d\nleft join distributor_addons da on (d.id = da.distributor_id)\nwhere d.id = (11,12,13,14,15,16)\norder by d.id\"\n \n @sql.select do\n d :id, :taxnumber, :social_security_type, :taxnumber_exemption\n end\n\n @sql.from(distributors: 'd') do\n left_join distributor_addons: 'da', on: 'd.id = da.distributor_id'\n end\n\n dist_ids = [11,12,13,14,15,16]\n \n @sql.where do\n d id: dist_ids\n end\n\n @sql.order('d.id')\n\n assert_equal @sql.to_s, target_sql\n end", "def create\n code = order_params[:order_code].to_i\n shirt_type = @order_codes[code][:type]\n letter = @order_codes[code][:letter]\n count = @order_codes[code][:count]\n size = order_params[:shirt_size]\n if order_params[:letter_3] != 'none'\n letter_3 = order_params[:letter_3]\n else\n letter_3 = nil\n end\n number = OrderNumber.create!(id: order_params[:order_number])\n @order = Order.new(letter_1: order_params[:letter_1], \n letter_2: order_params[:letter_2], \n letter_3: letter_3, \n shirt_type: shirt_type, \n shirt_size: order_params[:shirt_size], \n shirt_color: order_params[:shirt_color], \n top_color: order_params[:top_color], \n bottom_color: order_params[:bottom_color], \n user_id: current_user.id,\n order_number: number)\n\n order_params[:quantity].to_i.times do |order| \n letter_1 = Letter.where(position: 'top', name: order_params[:letter_1], color: order_params[:top_color]).first.remove_one\n letter_2 = Letter.where(position: 'top', name: order_params[:letter_2], color: order_params[:top_color]).first.remove_one\n letter_4 = Letter.where(position: 'bottom', name: order_params[:letter_1], color: order_params[:bottom_color]).first.remove_one\n letter_5 = Letter.where(position: 'bottom', name: order_params[:letter_2], color: order_params[:bottom_color]).first.remove_one\n unless order_params[:letter_3] == 'none'\n letter_3 = Letter.where(position: 'top', name: order_params[:letter_3], color: order_params[:top_color]).first.remove_one\n letter_6 = Letter.where(position: 'bottom', name: order_params[:letter_3], color: order_params[:bottom_color]).first.remove_one\n end\n end\n order_params[:quantity].to_i.times do |x|\n if Item.where(item_type: shirt_type, color: order_params[:shirt_color], size: size).count > 0\n item = Item.where(item_type: shirt_type, color: order_params[:shirt_color], size: size).first\n @cost = item.cost\n item.status = 'sold'\n item.save\n else\n new_item = Item.create(item_type: shirt_type, color: order_params[:shirt_color], size: size, user_id: current_user.id, cost: 3.88)\n new_item.status = 'sold'\n @cost = item.cost\n new_item.save\n end\n end\n cost_breakdown = @order.order_breakdown(shirt_type, letter, order_params[:order_total], count, order_params[:quantity], @cost)\n current_user.account.update(\n mom_pay: current_user.account.mom_pay += cost_breakdown[:mom_pay],\n tanya_pay: current_user.account.tanya_pay += cost_breakdown[:tanya_pay],\n shop_money: current_user.account.shop_money += (cost_breakdown[:shop_money] + (order_params[:paid_shipping].to_f - order_params[:shipping_spent].to_f)),\n inventory_money: current_user.account.inventory_money += cost_breakdown[:inventory_money],\n etsy_bill: current_user.account.etsy_bill += (cost_breakdown[:etsy_bill] + order_params[:shipping_spent].to_f)\n )\n \n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :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 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 create_query\n create_raw_query.select('audio_recordings.id, audio_recordings.uuid').order('audio_recordings.recorded_date')\n end", "def build_records(amount, per_query, &block)\n amount.times do\n record = Record.new(@model_class, last_id_in_database + @records.size + 1)\n @records << record\n block.call(record) if block\n save_records if @records.size >= per_query\n end\n end", "def test_order\n @@test_orders[self] || AVAILABLE_ORDERS.first\n end", "def print_order\n p \"@@@@@@@@@ Order id: ##{order.attrs['id']}\"\n p \"Name: #{order.attrs['name']} Email: #{order.attrs['email']}\"\n p \"Status: #{order.attrs['status']}\"\n\n conn = DatabaseConnector.new.connect\n rs = conn.exec \"select li.*, products.name from line_items as li INNER JOIN products on li.product_id = products.id where li.order_id = '#{order.attrs['id']}'\"\n\n char_len = 30\n rs.each do |row|\n prod_name = \"#{row['id']} : #{row['name']}\"\n\n p \"#{prod_name} #{'-'*(char_len - prod_name.length)}---> #{row['amount']} X #{row['quantity']} = #{row['amount'].to_f * row['quantity'].to_i}\"\n end\n p '-'*55\n if order.attrs['discont_desc'] != ''\n p \"Sub Total #{'-'*25} -> #{order.attrs['sub_total']}\"\n p \"Coupon #{'-'*25} -> #{order.attrs['discont_desc']}\"\n p \"You Saved #{'-'*25} -> #{order.attrs['amount'].to_i - order.attrs['sub_total'].to_i}\"\n p '-'*55\n end\n p \"Total #{'-'*25} -> #{order.attrs['amount']}\"\n end", "def create\n @order = Order.create!(order_params)\n\t@users = User.order(:user_name)\n @restaurants = Restaurant.order(:rest_name)\n \n respond_to do |format|\n if @order.save\n \t@thispart = Participant.create!({:part_user => @order.order_organizer, :part_order => @order.id, :part_role => \"organizer\", :part_cost => 0.00})\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render action: 'show', status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def build_test_case_records(question, auto_grading, evaluation_results)\n build_test_case_records_from_test_results(question, auto_grading, evaluation_results)\n\n # Build failed test case records for test cases which were not found in any evaluation result.\n build_failed_test_case_records(question, auto_grading)\n end", "def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to(@order, :notice => 'Order was successfully created.') }\n format.xml { render :xml => @order, :status => :created, :location => @order }\n else\n if @order.ordered_products.empty?\n 8.times { @order.ordered_products.build }\n else\n no_times = 8 - @order.ordered_products.size\n no_times.times { @order.ordered_products.build }\n end\n format.html { render :action => \"new\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new_order(params = {})\r\n params = { :created => Date.today, :turnaround_year => \"2007\" }.merge(params)\r\n if self.requesting?\r\n self.requested_orders.build({ :date_requested => Date.today.to_s(:db) }.merge(params))\r\n elsif self.planning?\r\n self.planned_orders.build(params)\r\n else\r\n Order.new(params)\r\n end\r\n end", "def prepare_results\n transaction do\n if self.is_private?\n self.excercises_results.create(:pupil_id => User.stamper, :teacher_id => User.stamper)\n elsif pupils.any?\n pupils.each do |pupil_id|\n self.excercises_results.create(:pupil_id => pupil_id, :teacher_id => User.stamper)\n end\n end\n end\n end", "def create_order\n @order = Order.create\n end", "def set_order\n\n @order = Order.includes(:skills).find(params[:id])\n end", "def order(order_id)\n Order.find(order_id)\n end", "def use_test_organism(status='Association')\n create_user # ce qui crée également le tenant\n @o = Organism.first\n unless @o && @o.status == status\n create_organism(status)\n # return car create_organismfait déja un appel à get_organism_instances\n return\n end\n @p = @o.periods.first\n unless @p # c'est qu'on a effacé les exercices dans des tests\n create_organism\n return\n end\n erase_holders if @cu.holders.count > 1\n rebuild_folios if @o.nomenclature.folios.empty?\n erase_writings\n get_organism_instances\n @o\n end", "def index\n @tests = Test.where('patient_id IN (?)', params[:patient_id]).order(test_date: :desc)\n end", "def make_question_answer_tree\n before :each do\n @reply = 1\n @type_vendor = make_forms_for_app_type \"vendor\"\n @type_donor = make_forms_for_app_type \"donor\"\n \n @q1 = Questionnaire.create(:question => \"hello world\")\n @q2 = Questionnaire.create(:question => \"how are you?\")\n @a1a = Answers.create(:ans => \"hi\", :questionnaire_id => @q1.id, :leads_to => @q2.id)\n @a1b = Answers.create(:ans => @type_donor.app_type, :questionnaire_id => @q1.id, :results_to => @type_donor.id)\n @a2 = Answers.create(:ans => @type_vendor.app_type, :questionnaire_id => @q2.id, :results_to => @type_vendor.id)\n @q2.parent_id = @a1a.id\n @q2.save\n end\n end", "def build_query\n query = PhoneNumberGeolocation::Location.where(\n phone_numbers: { '$in' => customer_numbers }\n )\n query = query.of_country(@country) if same_country\n query\n end", "def create_orders!\n raise Error, \"Need to set a parser before you can create orders.\" unless @parser\n raise Error, \"No orders found to parse\" unless parser_orders = @parser.orders\n # todo, should be able to handle split orders where some pass and some fail here\n orders, errors = [], []\n\n begin\n Order.transaction do\n parser_orders.each do |order|\n begin\n orders << create_order(order)\n rescue OrderAlreadyExistsError => e # if the order already existed, no problem really, just notify\n errors << e\n rescue => e\n errors << e\n orders = [] # clear out the orders array, b/c we're about to roll everything back\n raise AtLeastPartialFailure # raise an error here b/c we dont need to even look at the order orders\n end\n end\n # raise AtLeastPartialFailure if errors.size > 0 # or raise it here?\n end # end the transaction\n\n rescue AtLeastPartialFailure\n ActiveRecord::Base.logger.warn \"got a partial failure when trying to create orders\"\n # do nothing, this is just to DB rollback\n end\n [orders, errors]\n end", "def generate_order\n user = User.all.sample\n\n # 2 kinds of users can have orders built\n # a user with a billing address is one\n # a user who still needs a shopping cart built is the other\n if user[:billing_id] || !has_cart?(user[:id])\n o = Order.new\n o[:user_id] = user.id\n o[:shipping_id] = random_user_address(user.id)\n o[:billing_id] = random_user_address(user.id)\n\n # first generated order is a shopping cart\n # all since then are placed orders with checkout dates\n if has_cart?(user.id)\n o[:checkout_date] = placement_date(user)\n end\n\n o.save\n generate_contents(o[:id])\n end\nend", "def create\n if get_food_order_params == true\n @foods = Food.all.order(:name)\n @order = Order.new(order_params)\n flash[:error] = \"La orden no puede estar vacía\"\n render :new\n else\n if order_params.to_h[\"status\"] != \"Cancelado\"\n @order = Order.new(order_params)\n @food_order = get_food_order_params\n @food_order.each{ |food_order| @order.food_orders.build(food_order)}\n end\n\n\n respond_to do |format|\n if @order.save\n flash[:success] = 'La orden ' + @order.id.to_s + ' fue creada satisfactoriamente'\n format.html { redirect_to action: \"index\"}\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end\n\n\n end", "def generate_results\n Result.destroy_all\n\n puts 'Generating results'\n\n (MULTIPLIER * 3).times do\n user_id = User.all.sample.id\n question_id = Question.all.sample.id\n result = ['true', 'false'].sample\n Result.create(user_id: user_id, question_id: question_id, result: result)\n end\nend", "def initialize(order)\n super\n @order = order\n end", "def index\n @orderdetails = Orderdetail.all\n @drones = Drone.all\n @people = Person.all\n @products = Product.all\n\n end", "def create\n @order = Order.new(params[:order])\n @member = @order.member\n\n previous_order = Order.find_by_delivery_id_and_member_id(@order.delivery.id, @member.id)\n if previous_order\n previous_order.order_items.delete_all\n previous_order.order_questions.delete_all\n previous_order.update_attributes(params[:order])\n @order = previous_order\n end\n\n respond_to do |format|\n if @order.save\n Notifier.order_confirmation(@order).deliver\n flash[:notice] = 'Order was successfully created.'\n format.html { redirect_to order_path(:id => @order, :farm_id => @farm.id) }\n format.xml { render :xml => @order, :status => :created, :location => @order }\n else\n @delivery = Delivery.find params[:delivery_id]\n format.html { render :action => \"new\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def get_results(query, conditions, order)\n query_call = \"select * from #{domain} \"\n query_call << \"where #{conditions.compact.join(' and ')}\" if conditions.length > 0\n query_call << \" #{order}\"\n if query.limit!=nil\n query_limit = query.limit\n query_call << \" limit #{query.limit}\" \n else\n #on large items force the max limit\n query_limit = 999999999 #TODO hack for query.limit being nil\n #query_call << \" limit 2500\" #this doesn't work with continuation keys as it halts at the limit passed not just a limit per query.\n end\n results = sdb.select(query_call)\n \n sdb_continuation_key = results[:next_token]\n while (sdb_continuation_key!=nil && results[:items].length < query_limit)do\n old_results = results\n results = sdb.select(query_call, sdb_continuation_key)\n results[:items] = old_results[:items] + results[:items]\n sdb_continuation_key = results[:next_token]\n end\n\n results = results[:items][0...query_limit]\n end", "def create\n\n params[:order_types].each do |order_type|\n @clinician_order = ClinicianOrder.new(params[:clinician_order])\n @clinician_order.order_type = order_type\n\n if session[:simulation_mode] \n\n @clinician_order.time_recorded = Time.now()\n @clinician_order.sim_session = request.session_options[:id]\n log_action @clinician_order\n end \n end\n #if simulation mode is active, add the session id to the note so that \n #it is only available to the current sim session and will be deleted \n #when the sim session is reset -tg\n\n\n @Visit = Visit.find(@clinician_order.visit_id) #reconstruct patient and visit to redirect back to patient -tg\n @Patient = Patient.find(@Visit.patient_id)\n\n\n respond_to do |format|\n if @clinician_order.save\n format.html { redirect_to @Patient, notice: 'Clinician order was successfully created.' }\n format.json { render json: @clinician_order, status: :created, location: @clinician_order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @clinician_order.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @orders = Order.find(:all, :order => 'order_id DESC', :limit => 20)\n @order_count_today = Order.count(:conditions => 'created_at > curdate()')\n @order_total_today = Order.find(:all, :conditions => 'created_at > curdate()').sum { |o| o.payments.sum(:amount_as_new_revenue) || 0.0 }\n\n @customers = Customer.find(:all, :order => 'customer_id DESC', :limit => 20)\n @customer_count_full_today = Customer.count(:conditions => 'created_at > curdate() AND shipping_address_id != 0')\n @customer_count_partial_today = Customer.count(:conditions => 'created_at > curdate() AND shipping_address_id = 0')\n @customer_count_orders_today = Customer.count_by_sql(\"select count(1) from customers, orders where customers.customer_id = orders.customer_id and customers.created_at > curdate()\") \n @one_question_survey = Survey.find(1)\n end", "def index\n #@orders = Order.all\n #.order(:day, :shop_id, :product_id)\n @orders = Order.find_by_sql [\"\n SELECT o.id , o.day, o.quantity, o.shop_id, o.locked, o.product_id, o.user_id, p.title as product_title, s.name as shop_name, u.name as user_name \n FROM orders AS o\n INNER JOIN products AS p ON p.id = o.product_id\n INNER JOIN shops AS s ON s.id = o.shop_id\n INNER JOIN users AS u ON u.id = o.user_id\n ORDER BY o.day, s.name, p.title\n \"]\n end", "def conditions\n sqlwhere = \"1 = 1 \"\n sqlwhere = sqlwhere + \"and orders.namel like ? \" if is_string_here?(namel)\n sqlwhere = sqlwhere + \"and orders.email like ? \" if is_string_here?(email)\n sqlwhere = sqlwhere + \"and addresses.street_address1 like ? \" if is_string_here?(street_address1)\n sqlwhere = sqlwhere + \"and addresses.street_address2 like ? \" if is_string_here?(street_address2)\n sqlwhere = sqlwhere + \"and orders.user_id = ? \" if is_object_here?(user_id)\n sqlwhere = sqlwhere + \"and orders.order_state_id = ? \" if is_object_here?(order_state_id)\n sqlwhere = sqlwhere + \"and orders.checkout_state_id = ? \" if is_object_here?(checkout_state_id)\n sqlwhere = sqlwhere + \"and orders.created_at > ? \" if is_object_here?(created_at_since)\n sqlwhere = sqlwhere + \"and orders.created_at < ? \" if is_object_here?(created_at_till)\n\n result = [sqlwhere]\n result << UnicodeUtils.downcase(namel) if is_string_here?(namel)\n result << UnicodeUtils.downcase(email) if is_string_here?(email)\n result << UnicodeUtils.downcase(street_address1) if is_string_here?(street_address1)\n result << UnicodeUtils.downcase(street_address2) if is_string_here?(street_address2)\n result << user_id if is_object_here?(user_id)\n result << order_state_id if is_object_here?(order_state_id)\n result << checkout_state_id if is_object_here?(checkout_state_id)\n result << created_at_since if is_object_here?(created_at_since)\n result << created_at_till if is_object_here?(created_at_till)\n result\n end", "def create\n @order = Order.new(order_params)\n @profile = Profile.find(params[:order][:profile_id])\n\n @order.oname = params[:order][:oname]\n @order.odescription = params[:order][:odescription]\n @order.otime = params[:order][:otime]\n @order.ocost = params[:order][:ocost]\n\n myOrder = BasicOrder.new(@order.oname, @order.odescription, @order.otime, @order.ocost)\n\n if params[:order][:food].to_s.length > 0 then\n myOrder = FoodDecorator.new(myOrder)\n end\n\n if params[:order][:travel].to_s.length > 0 then\n myOrder = TravelDecorator.new(myOrder)\n end\n\n @order.ocost = myOrder.ocost\n @order.odescription = myOrder.details\n\n logger = NewOrderLogger.instance\n logger.logInformation(\"New Order by user #{@profile.firstname} #{@profile.lastname}: #{@order.oname}, #{@order.odescription}, #{@order.otime}, #{@order.ocost}\")\n\n #puts \"ocost from @order.ocost: #{@order.ocost}\"\n #puts \"odescription from @order.od: \"+@order.odescription\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to profile_order_url(@profile,@order), notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def initialize(order = 0)\n @order = order\n end", "def populate_test_data\n @alice_mrn = 123\n @alice_picudb_id = @lomi.patients.insert({:mrn => @alice_mrn, :source => \"picudb\", :first_name => \"Alice\"})\n @alice_cerner_id = @lomi.patients.insert({:mrn => @alice_mrn, :source => \"cerner_patients\", :first_name => \"Alice\"})\n\n @alice_picudb_encounter_id = @lomi.encounters.insert({:patient_id => @alice_picudb_id,\n :source => \"picudb\",\n :admission => Time.new(2000, 12, 25),\n :discharge => Time.new(2000, 12, 28)})\n @alice_cerner_encounter_id = @lomi.encounters.insert({:patient_id => @alice_cerner_id,\n :source => \"cerner_paients\"})\n\n @alice_picudb_event_id = @lomi.events.insert({:patient_id => @alice_picudb_id,\n :encounter_id => @alice_picudb_encounter_id})\n @alice_cerner_event_id = @lomi.events.insert({:patient_id => @alice_cerner_id,\n :encounter_id => @alice_cerner_encounter_id,\n :start_time => Time.new(2000, 12, 26),\n :end_time => Time.new(2000, 12, 26) })\n end", "def index\n @orders = Order.all\n #Для подстановки нужны следующие переменные\n @clients=Client.all\n @deliveries=Delivery.all\n @employees=Employee.all\n @ordereds=Ordered.all\n end", "def get_order_list(criteria = {})\n order_criteria = {}\n order_criteria[\"ins1:OrderCreationFilterBeginTimeGMT\"] = criteria[:created_from]\n order_criteria[\"ins1:OrderCreationFilterEndTimeGMT\"] = criteria[:created_to]\n order_criteria[\"ins1:StatusUpdateFilterBeginTimeGMT\"] = criteria[:updated_from]\n order_criteria[\"ins1:StatusUpdateFilterEndTimeGMT\"] = criteria[:updated_to]\n order_criteria[\"ins1:JoinDateFiltersWithOr\"] = criteria[:join_dates]\n\n if order_ids = criteria[:order_ids]\n order_criteria[\"ins1:OrderIDList\"] = {\"ins1:int\" => order_ids}\n end\n\n if client_order_ids = criteria[:client_order_ids]\n order_criteria[\"ins1:ClientOrderIdentifierList\"] = {\"ins1:string\" => client_order_ids}\n end\n\n order_criteria[\"ins1:DetailLevel\"] = criteria[:detail_level] if criteria[:detail_level]\n order_criteria[\"ins1:ExportState\"] = criteria[:export_state] if criteria[:export_state]\n order_criteria[\"ins1:OrderStateFilter\"] = criteria[:state] if criteria[:state]\n order_criteria[\"ins1:PaymentStatusFilter\"] = criteria[:payment_status] if criteria[:payment_status]\n order_criteria[\"ins1:CheckoutStatusFilter\"] = criteria[:checkout_status] if criteria[:checkout_status]\n order_criteria[\"ins1:ShippingStatusFilter\"] = criteria[:shipping_status] if criteria[:shipping_status]\n order_criteria[\"ins1:RefundStatusFilter\"] = criteria[:refund_status] if criteria[:refund_status]\n order_criteria[\"ins1:DistributionCenterCode\"] = criteria[:distribution_center] if criteria[:distribution_center]\n order_criteria[\"ins1:PageNumberFilter\"] = criteria[:page_number]\n order_criteria[\"ins1:PageSize\"] = criteria[:page_size]\n\n soap_response = client.request :get_order_list do\n soap.header = soap_header\n soap.body = {\n \"ins0:accountID\" => creds(:account_id),\n \"ins0:orderCriteria\" => order_criteria\n }\n end\n\n @last_request = client.http\n @last_response = soap_response\n end", "def purchase_orders\n case organization_type.type_value\n when 'customer'\n PoHeader.joins(:po_lines).where('po_lines.organization_id = ?', id).order('created_at desc')\n when 'vendor'\n PoHeader.where('organization_id = ?', id).order('created_at desc')\n else\n PoHeader.where('organization_id = ?', 0).order('created_at desc')\n end\n end", "def create\n @order = Order.new(order_params)\n @order.status_id = 1\n @order.user_id = current_user.id\n params['suborders'].each do |a, b|\n startdt = (b['startdt']).to_time(:utc)\n stopdt = (b['stopdt']).to_time(:utc)\n #startdt = (b['startdt(1i)'] + '-' +b['startdt(2i)'] + '-' +b['startdt(3i)']+' ' +b['startdt(4i)']+':' +b['startdt(5i)']).to_time(:utc)\n #stopdt = (b['stopdt(1i)']+ '-' +b['stopdt(2i)'] + '-' +b['stopdt(3i)']+' ' +b['stopdt(4i)']+':' +b['stopdt(5i)']).to_time(:utc)\n wtStart = (b['startt']).to_time(:utc)\n wtStop = (b['stopt']).to_time(:utc)\n #startt = ('0-1-1 ' + b['startt(4i)'] + ':' + b['startt(5i)']).to_time(:utc)\n #stopt = ('0-1-1 ' + b['stopt(4i)']+':' +b['stopt(5i)']).to_time(:utc)\n\n @order.suborders.new(\n order_id: @order.id,\n device_id: b[:device_id],\n period_id: b[:period_id],\n startdt: startdt,\n stopdt: stopdt,\n startt: wtStart,\n stopt: wtStop\n );\n b [:files].each do |c|\n @order.suborders.last.plists.new(mediafile_id: c.to_i) unless c == ''\n end\n end\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: t('orders.creat')}\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 partial_orders\n @orders = search_reasult(params).includes(:line_items).where(\"fulflmnt_tracking_no IS NULL AND is_cancel=false\").order('order_date desc')\n @orders = Kaminari.paginate_array(@orders).page(params[:page]).per(params[:per_page] || Spree::Config[:orders_per_page])\n end", "def build_test_case_records(test_report)\n test_cases = parse_test_report(test_report)\n test_cases.map do |test_case|\n @question.test_cases.build(identifier: test_case.identifier,\n test_case_type: infer_test_case_type(test_case.name),\n expression: test_case.expression,\n expected: test_case.expected,\n hint: test_case.hint)\n end\n end", "def new\n @questionnaire = Questionnaire.new\n @quest = Quest.new\n 5.times do\n question = @questionnaire.quests.build\n 4.times { question.choices.build }\n end\n end", "def build_associations_for_searches\n # Advanced search fields\n @master.pro_infos.build\n @master.player_infos.build\n @master.addresses.build\n @master.player_contacts.build\n @master.trackers.build\n @master.tracker_histories.build\n @master.scantrons.build if @master.respond_to? :scantrons\n\n # NOT conditions\n @master.not_trackers.build\n @master.not_tracker_histories.build\n\n # Simple search fields\n @master.general_infos.build\n end", "def index\n @orders_grid = initialize_grid(@orders,\n :conditions => {:order_type => \"b2c\"}, :include => [:business, :keyclientorder, :user_logs],:order => 'created_at', :order_direction => 'desc')\n @orders_grid.with_resultset do |orders|\n @@orders_query_export = orders.order(created_at: :desc)\n end\n end", "def build_selects_from_types(order); end", "def generate \n @project=Project.find(params[:project_id])\n retrieve_query \n logger.info \"Anzahl aus Query: #{@query.issue_count} Projekt: #{@project}\"\n sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria)\n sort_update(@query.sortable_columns)\n if @query.valid?\n @limit = per_page_option\n @query.sort_criteria = sort_criteria.to_a\n @issue_count = @query.issue_count\n @issue_pages = Paginator.new @issue_count, @limit, params['page']\n @offset ||= @issue_pages.offset\n @issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version],\n :order => sort_clause,\n :offset => @offset,\n :limit => @limit)\n @issue_count_by_group = @query.issue_count_by_group \n end\n\n respond_to do |format|\n format.html { render :template => 'issues_report/report_list' } \n end\n end", "def new\n @item = OrderPosition.new\n @item.order = Order.includes(:pizzeria => :pizzas).find(params[:order_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end", "def create_order()\n\t{\n\t\t\"destination\" => {\n\t\t\t\"name\" => \"hp.jpeng\"\n\t\t},\n\t\t\"orderData\" => {\n\t\t\t\"sourceOrderId\" => [*('A'..'Z')].sample(8).join,\n\t\t\t\"items\" => [{\n\t\t\t\t\"sourceItemId\" => [*('A'..'Z')].sample(8).join,\n\t\t\t\t\"sku\" => \"Flat\",\n\t\t\t\t\"quantity\" => 1,\n\t\t\t\t\"components\" => [{\n\t\t\t\t\t\"code\" => \"Content\",\n\t\t\t\t\t\"path\" => \"https://Server/Path/business_cards.pdf\",\n\t\t\t\t\t\"fetch\" => \"true\",\n\t\t\t\t\t# \"route\" => [{\n\t\t\t\t\t# \t\t\"name\" => \"Print\",\n\t\t\t\t\t# \t\t\"eventTypeId\" => \"\"\t\t#eventTypeId found within Site Flow -> Events\n\t\t\t\t\t# \t}, {\n\t\t\t\t\t# \t\t\"name\" => \"Cut\",\n\t\t\t\t\t# \t\t\"eventTypeId\" => \"\"\n\t\t\t\t\t# \t}, {\n\t\t\t\t\t# \t\t\"name\" => \"Laminate\",\n\t\t\t\t\t# \t\t\"eventTypeId\" => \"\"\n\t\t\t\t\t# \t}, {\n\t\t\t\t\t# \t\t\"name\" => \"Finish\",\n\t\t\t\t\t# \t\t\"eventTypeId\" => \"\"\n\t\t\t\t\t# }]\n\t\t\t\t}],\n\t\t\t}],\n\t\t\t\"shipments\" => [{\n\t\t\t\t\"shipTo\" => {\n\t\t\t\t\t\"name\" => \"John Doe\",\n\t\t\t\t\t\"address1\" => \"5th Avenue\",\n\t\t\t\t\t\"town\" => \"New York\",\n\t\t\t\t\t\"postcode\" => \"12345\",\n\t\t\t\t\t\"state\" => \"New York\",\n\t\t\t\t\t\"isoCountry\" => \"US\",\n\t\t\t\t\t\"email\" => \"johnd@acme.com\",\n\t\t\t\t\t\"phone\" => \"01234567890\"\n\t\t\t\t},\n\t\t\t\t\"carrier\" => {\n\t\t\t\t\t\"code\" => \"customer\",\n\t\t\t\t\t\"service\" => \"shipping\"\n\t\t\t\t}\n\t\t\t}]\n\t\t}\n\t}.to_json()\nend", "def build_test_case_records_from_report(question, auto_grading, test_report)\n test_cases = question.test_cases.to_h { |test_case| [test_case.identifier, test_case] }\n test_results = parse_test_report(question.language, test_report)\n\n test_results.map do |test_result|\n test_case = find_test_case(test_cases, test_result)\n auto_grading.test_results.build(auto_grading: auto_grading, test_case: test_case,\n passed: test_result.passed?,\n messages: test_result.messages)\n end\n end", "def test_order=(order)\n @@test_orders[self] = order\n end", "def query\n unless defined?(@query)\n d = @data\n @query = SeqDesc.new(d[4], d[5], d[9], d[10], d[11], d[12],\n split_comma(d[19]), split_comma(d[21]))\n end\n @query\n end", "def new\n @retailorder = Retailorder.new\n \n @orderinfo = Party.find_by_sql(\"Select * from parties \n where parties.system_user_id = #{session[:s_user_id]} \")\n \n @orderinfo.each do |orderinfo|\n @retailorder.customername = orderinfo.partyname\n @retailorder.bill_address1 = orderinfo.partyaddress1\n @retailorder.bill_address2 = orderinfo.partyaddress2\n @retailorder.bill_city = orderinfo.partycity\n @retailorder.bill_state = orderinfo.partystate\n @retailorder.bill_postalcode = orderinfo.partypostalcode\n @retailorder.bill_phone = orderinfo.partyphone\n @retailorder.bill_email = orderinfo.partyemail\n \n @retailorder.ship_address1 = orderinfo.ship_address1\n @retailorder.ship_address2 = orderinfo.ship_address2\n @retailorder.ship_city = orderinfo.ship_city\n @retailorder.ship_state = orderinfo.ship_state\n @retailorder.ship_postalcode = orderinfo.ship_postalcode\n\n end\n \n \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @retailorder }\n end\n end", "def create_orders(count)\n users = User.where(admin: false)\n i = 0\n while i < count.to_i && users.count > 0 do\n Order.create(user: users[i % users.count], total_amount: 0,\n shipping_address: Faker::Address.street_address)\n i += 1\n end\nend", "def index\n @catalog_items = CatalogItem.all\n\n order_items = []\n @catalog_items.each do |catalog_item|\n order_items << OrderItem.new(\n catalog_item: catalog_item,\n quantity: 0,\n unit_price: catalog_item.price\n )\n\n end\n\n\n @order = Order.new(\n order_items: order_items\n )\n end", "def take_order adress, array, total, phonenumber\n order_id = @order_counter\n @current_orders.push (Order.new order_id, adress, array, total, phonenumber)\n @order_counter += 1\n end", "def observations_set(query)\n o = ::Observation.arel_table\n\n # Descriptors on OTUs scored\n f = 'descriptors_scored_for_otus'\n fa = 'fs_d1'\n @columns.push({header: f, projected: '\"' + fa + '\".\"' + f + '\" as ' + f } )\n\n z = o.project(\n o[:observation_object_id],\n o[:observation_object_type],\n o[:descriptor_id].count(true).as(f) # count(true) == distinct\n ).group(\n o[:observation_object_id],\n o[:observation_object_type],\n ).as(fa)\n\n query.join(z, Arel::Nodes::OuterJoin).on(\n z[:observation_object_id].eq(otu_table[:id])\n .and(z[:observation_object_type].eq('Otu'))\n )\n\n # Observations on OTUs\n f = 'otu_observation_count'\n fa = 'fs_o1'\n @columns.push({header: f, projected: '\"' + fa + '\".\"' + f + '\" as ' + f })\n\n x = o.project(\n o[:observation_object_id],\n o[:observation_object_type],\n o[:id].count.as(f)\n ).group(o[:observation_object_id], o[:observation_object_type]).as(fa)\n\n query.join(x, Arel::Nodes::OuterJoin).on(x[:observation_object_id].eq(otu_table[:id]).and( x[:observation_object_type].eq('Otu') ))\n\n # Depictions on observations on OTUs\n f = 'otu_observation_depictions'\n fa = 'fs_o2'\n @columns.push( {header: f, projected: '\"' + fa + '\".\"' + f + '\" as ' + f } )\n\n p = ::Depiction.arel_table\n y = o.join(p, Arel::Nodes::InnerJoin).on(\n o[:id].eq(p[:depiction_object_id]).and(\n p[:depiction_object_type].eq('Observation')\n )\n ).project(\n o[:observation_object_id], # an OTU id\n p[:depiction_object_type],\n p[:id].count.as(f)\n ).group(\n o[:observation_object_id],\n p[:depiction_object_type]\n ).as(fa)\n\n query.join(y, Arel::Nodes::OuterJoin).on(\n y[:observation_object_id].eq(otu_table[:id])\n )\n query\n end", "def create_order_items(order)\n raise NoOrderItemsGiven unless valid_order_items?\n\n Array(param(:order_items)).each do |order_item_params|\n order_item = build_order_item(order_item_params)\n order_item.save!\n end\n end", "def build\n { 'Shipper' => PartyBuilder.build(@model.shipper, :shipper => true),\n 'ShipTo' => PartyBuilder.build(@model.recipient),\n 'PaymentInformation' => build_payment_info,\n 'Service' => build_service,\n 'Package' => PackageBuilder.build(@model.package),\n :order! => ['Shipper', 'ShipTo', 'PaymentInformation', 'Service', 'Package'] }\n end", "def create_query( relation )\n Query.new(relation)\n end", "def get_orders_by_query_with_http_info(order_query, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrderApi.get_orders_by_query ...'\n end\n # verify the required parameter 'order_query' is set\n if @api_client.config.client_side_validation && order_query.nil?\n fail ArgumentError, \"Missing the required parameter 'order_query' when calling OrderApi.get_orders_by_query\"\n end\n # resource path\n local_var_path = '/order/orders/query'\n\n # query parameters\n query_params = {}\n query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil?\n query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil?\n query_params[:'_sort'] = opts[:'_sort'] if !opts[:'_sort'].nil?\n query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?\n\n # header parameters\n header_params = {}\n header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(order_query)\n auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'OrdersResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrderApi#get_orders_by_query\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def build(attrs = {})\n @parent.new(@query_attrs.merge(attrs))\n end", "def test_search\n @orders = Order.search(@order['order_number'])\n @orders.each { |order|\n assert_equal @order['order_number'], order.order_number\n }\n end", "def query(conditions = [], order = [], limit = 250)\n conditions.select!{ |h| Proc === self.class.searchable[h[:field].to_sym]}\n @conditions = conditions\n @order = Hash[order].reject { |field, dir| field.nil? || !self.class.sortable[field.to_sym] }.\n map{ |field, dir| (dir == 'asc') ? self.class.sortable[field.to_sym].asc : self.class.sortable[field.to_sym].desc }\n @limit = limit\n dataset\n end", "def set_order_detali\n @order_detali = OrderDetali.find(params[:id])\n end", "def index\n @po_status = params[:po_status] || 'PENDING'\n @item_name = params[:item_name]\n\n if @po_status == 'ALL'\n @purchase_orders = PurchaseOrder.all.order(po_date: :desc)\n else\n @purchase_orders = PurchaseOrder.where(status: @po_status).order(po_date: :desc)\n end\n\n \n if @item_name\n @purchase_orders = @purchase_orders.where(\"id in (select purchase_order_id from purchase_items where item_id in (select id from items where name like '%#{@item_name}%'))\")\n end\n\n\n @new_purchase_order = PurchaseOrder.new\n @new_purchase_order.po_date = Date.today\n @new_purchase_order.status = 'PENDING'\n\n end" ]
[ "0.57278603", "0.56436294", "0.55604786", "0.5551422", "0.5509067", "0.54993147", "0.54420334", "0.54282135", "0.5423543", "0.5422804", "0.539481", "0.53165156", "0.53143424", "0.52478486", "0.524699", "0.52177745", "0.52145433", "0.5202652", "0.51762056", "0.5151994", "0.51497436", "0.5133262", "0.51206976", "0.5105948", "0.5104634", "0.5101156", "0.507369", "0.5061952", "0.5052328", "0.50420547", "0.5039578", "0.5020192", "0.5008119", "0.50055367", "0.5003634", "0.5000913", "0.49877864", "0.49855888", "0.4974288", "0.4972754", "0.49708763", "0.49634135", "0.4959373", "0.49582714", "0.4952298", "0.49454236", "0.49423948", "0.49339867", "0.492857", "0.49262396", "0.49232647", "0.49189708", "0.4916299", "0.4913198", "0.4907874", "0.49074563", "0.48898768", "0.48772243", "0.487278", "0.48644587", "0.48600465", "0.48574886", "0.48553276", "0.4851711", "0.48479298", "0.4841981", "0.48386353", "0.4836323", "0.48346335", "0.48321897", "0.48264453", "0.48254776", "0.4812385", "0.47967228", "0.47963905", "0.47953376", "0.4794805", "0.4793208", "0.47903112", "0.47827572", "0.47802326", "0.47776568", "0.47764066", "0.4771684", "0.47671288", "0.47655943", "0.47643146", "0.47618067", "0.47616094", "0.47543854", "0.4752567", "0.47522017", "0.47454238", "0.47449073", "0.47421542", "0.47405013", "0.4740312", "0.47367993", "0.4730068", "0.47295353" ]
0.49952367
36
signs in when already at signin_path
def and_sign_in(player) fill_in 'Email', with: player.email fill_in 'Password', with: player.password click_button 'Sign in' # Sign in when not using Capybara as well. cookies[:remember_token] = player.remember_token end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign_in\n end", "def sign_in\n\n end", "def signin\n end", "def user_signin_status\n unless user_signed_in?\n redirect_to root_url\n end\n end", "def signed_in_user\n redirect_to signin_path, :status => 302 unless signed_in?\n end", "def signed_in_user\n redirect_to signin_path, :status => 302 unless signed_in?\n end", "def sign_in\n\tend", "def signed_in\n\t\t\tunless signed_in?#checks if the user is currently signed in, the function is housed in the sessions helper for in depth analysis\n\t\t\t\tstore_location\n\t\t\t\tredirect_to signin_url, notice: \"Please sign in.\"\n\t\t\tend\n\t\tend", "def signed_in_user\n redirect_to signin_url, notice: \"Please sign in.\" unless signed_in?\n end", "def signed_in_user\n unless signed_in?\n # If not signed in, save current location in session object\n # to be able to redirect after successful sign in.\n session[:return_to] = request.url\n # prompt sign in page\n redirect_to signin_url, notice: \"Please sign in.\"\n end\n end", "def signed_in_user\n\t store_location\n redirect_to signin_url, notice: \"Please sign in.\" unless signed_in?\n end", "def already_signed_in\n if current_user != nil\n redirect_to(root_path)\n end\n end", "def signed_in_user\n\t\t\tredirect_to signin_url, notice: \"Please sign in.\" unless signed_in?\n\t\tend", "def signIn_user\n unless signed_in?\n store_location\n redirect_to signin_url, notice: \"Please sign in.\"\n end\n end", "def sign_in(user)\n login_as user\n end", "def signed_in_user\n store_location\n redirect_to signin_url, notice: \"Please sign in.\" unless signed_in?\n end", "def signin\n sign_out\n redirect_to '/users/sign_in'\n end", "def signed_in_user\n redirect_to login_url, notice: \"Log in to continue\" unless signed_in?\n end", "def signed_in_user\n unless signed_in?\n # store friendly URL so we can redirect after signin (stored in session)\n store_location\n redirect_to signin_url, notice: \"Please sign in.\"\n end\n end", "def signed_in_user\n unless signed_in?\n store_location\n redirect_to signin_url, notice: \"Please sign in.\" unless signed_in?\n end\n end", "def signin\n if doctor_signed_in?\n redirect_to doctor_path(current_doctor)\n end\n end", "def signed_in_user\r\n unless signed_in?\r\n store_location\r\n redirect_to signin_url, notice: \"Please sign in.\"\r\n end\r\n end", "def signed_in_user\n unless signed_in?\n store_location\n redirect_to :signin, notice: \"Please sign in.\"\n end\n end", "def signed_in_user\n unless signed_in?\n store_location # for friendly forwarding\n redirect_to signin_url, notice: \"Please sign in.\"\n end\n end", "def signin_required\n return if signed_in?\n session[:return_to] = request.path if request.path\n redirect_to \"/auth/twitter\"\n end", "def signed_in_user\n unless signed_in?\n store_location\n redirect_to( signin_url, notice: \"Please sign in.\" )\n end\n end", "def signed_in\n if user_signed_in?\n true\n else\n redirect_to new_user_session_path\n end\n end", "def signed_in_user\n #Method signed_in? defined in app/helpers/sessions_helper.rb\n redirect_to signin_url, notice: \"Please sign in.\" unless signed_in? #notice :\"Please sign in\" = flash[:notice] = \"Please sign in\"\n end", "def signed_in_user\n #Method signed_in? defined in app/helpers/sessions_helper.rb\n redirect_to signin_url, notice: \"Please sign in.\" unless signed_in? #notice :\"Please sign in\" = flash[:notice] = \"Please sign in\"\n end", "def signed_in_user\n unless signed_in?\n store_location #record url of intended page before redirect\n redirect_to signin_url, notice: \"Please sign in.\"\n end\n end", "def signed_in_user\n unless signed_in?\n store_location\n redirect_to signin_url, notice: \"Please sign in.\"\n end\n end", "def signed_in_user\n unless signed_in?\n store_location\n redirect_to signin_url, notice: \"Please sign in.\"\n end\n end", "def signed_in_user\n unless signed_in?\n store_location\n redirect_to signin_url, notice: \"Please sign in.\"\n end\n end", "def require_signin\n unless signed_in?\n store_location\n flash[:notice] = \"Please sign in to continue\"\n redirect_to signin_path\n end\n end", "def signed_in_user\n\t\tunless signed_in?\n\t\t\tstore_location\n\t\t\tredirect_to signin_url \n\t\t\tflash[:success] = \"Please sign in.\"\n\t\tend\n\tend", "def signed_in_user\n unless signed_in?\n store_location\n redirect_to signin_url, notice: \"Please sign in.\"\n end\n logger.debug \"***signed_in_user - Detected signed in user...\"\n end", "def require_signin\n unless signed_in?\n store_location\n flash[:error] = \"Please sign in to continue\"\n redirect_to signin_url\n end\n end", "def signed_in_user\n\n\t\t# If check to see if user is signed in\n \tunless signed_in?\n\n \t\t# Store the last the requested action and store it\n \t\tstore_location\n\n \t\t# Redirect to the signin url with notice to signin\n \t\tredirect_to signin_url, notice: \"Please sign in.\"\n \tend\n \tend", "def require_signin\n unless signed_in?\n store_location\n flash[:error] = 'Please sign in.'\n redirect_to signin_url\n end\n end", "def signed_in_user\n unless signed_in?\n store_location\n redirect_to signin_path, notice: \"Please sign in\" \n end\n end", "def signed_in_user\n unless signed_in?\n store_location\n redirect_to signin_url, notice: \"Please sign in.\"\n end\n end", "def signed_in_user\n unless signed_in?\n store_location\n redirect_to signin_url, notice: \"Please sign in.\"\n end\n end", "def signed_in_user\n store_location #pour ensuite rediriger l'utilisateur vers la destination qu'il voulait avant\n # d'etre rediriger vers la pagne d'authentification\n redirect_to signin_url, notice: \"Please sign in.\" unless signed_in?\n end", "def signed_in\n unless signed_in? || User.first.nil?\n redirect_to root_path\n return\n end\n if signed_in? && settings.nil?\n redirect_to new_user_setting_path\n end\n end", "def signed_in_user\n unless signed_in?\n store_location\n flash[:error] = \"Please sign in.\"\n redirect_to signin_url \n end\n end", "def require_signin\n unless signed_in?\n store_location\n flash[:error] = 'Please Sign In'\n redirect_to signin_path\n end\n end", "def signed_in_user\n unless signed_in?\n store_location\n redirect_to signin_path, notice: \"Please sign in.\"\n end\n end", "def signed_in_user\n unless signed_in?\n store_location\n redirect_to signin_path, notice: \"Please sign in.\"\n end\n end", "def signed_in_user\n unless signed_in?\n store_location\n redirect_to signin_path, notice: \"Please sign in.\"\n end\n end", "def signed_in_user\n if signed_in?\n return true\n else\n redirect_to signin_url and return false\n end\n end", "def signed_in_user\n unless signed_in?\n store_location\n redirect_to root_path, notice: \"Please sign in.\"\n end\n end", "def check_signin\n if session[:login_name] == nil\n \tredirect_to sessions_url, notice: 'Sign in, please'\n end\n end", "def check_signin\n if session[:login_name] == nil\n \tredirect_to sessions_url, notice: 'Sign in, please'\n end\n end", "def check_signin\n if session[:login_name] == nil\n \tredirect_to sessions_url, notice: 'Sign in, please'\n end\n end", "def signed_in_user\n unless signed_in?\n store_location \n redirect_to signin_path, notice: \"Please sign in.\"\n end\n end", "def logging_in \n @user = User.find(current_user.id)\n sign_in @user\n\n redirect_to after_sign_in_path_for(@user)\n end", "def sign_in\n current_session || sign_user_in\nend", "def signed_in_user\n\t\tunless signed_in?\n\t\t\tstore_location\n\t\t\tredirect_to signin_url, notice: \"You have to be logged in to do this\"\n\t\tend\n\tend", "def signed_in_user\n redirect_to root_url, alert: \"Action Unsuccessful, please sign in.\" unless signed_in?\n end", "def signed_in_user\n\t\t\tunless signed_in?\n\t\t\t\tstore_location\n\t\t\t\tredirect_to signin_url, flash: {warning: \"Please sign in.\"}\n\t\t\tend\n\t\tend", "def signed_in_user\n\t\tunless signed_in?\n\t\t\tstore_location\n\t\t\tredirect_to signin_path, notice: \"Please sign in.\"\n\t\tend\n\tend", "def authenticate_user!\n if !signed_in?\n session[:user_return_to] = request.path if request.path\n redirect_to \"/auth/githubteammember\"\n end\n end", "def require_signin\n # If the user is not signed in:\n unless signed_in?\n # Calls the store_location method to save the url the unsigned in user was trying to navigate to:\n store_location\n # Establishes an error to display:\n flash[:error] = \"You must be signed in to reach that page.\"\n # Sends the unsigned in user to the sign in page.\n redirect_to signin_path\n end\n end", "def sign_in\n request.session = { authorized: true }\n end", "def logged_in_account\n unless logged_in?\n redirect_to login_path\n end\n end", "def signed_in_user\n unless signed_in?\n flash.now[:danger] = \"Please sign in first.\"\n # store the edit location for redirect back\n store_location\n redirect_to signin_url\n end\n end", "def signed_in_user\r\n redirect_to signin_url, notice: \"Fai il login\" unless signed_in?\r\n # flash[:notice] = \"Please sign in\"\r\n end", "def ensure_signed_in!\n return if signed_in?\n\n flash[:info] = 'You need to sign in to continue.'\n redirect_to sign_in_path return: request.path\n end", "def signed_in_user\n unless signed_in?\n store_location\n redirect_to signin_path, notice: \"You must be signed in to perform this action.\" \n end\n end", "def signed_in_user\n\t\t\tunless signed_in?\n\t\t\t\tstore_location\n\t\t\t\tredirect_to signin_url, notice: \"Please sign in.\"\n\t\t\tend\n\t\tend", "def sign_in\n session[:user_id] = @user.id\n end", "def signin\n\t\t\t# Author\n\t\t\tauthorize! :login, nil\n\t\tend", "def custom_user_sign_in\n if current_user.nil?\n session[:return_location] = request.referrer\n redirect_to new_user_session_path\n else\n redirect_to request.referrer || root_path\n end\n end", "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Please sign in.\"\n redirect_to signin_url\n end\n end", "def sign_in_as\n __debug_route\n __debug_request\n local_sign_in\n __log_activity(\"LOGIN #{resource}\")\n set_flash_notice(action: :create)\n auth_success_redirect\n rescue => error\n auth_failure_redirect(message: error)\n end", "def require_signin\n \tunless current_user\n # Stores the URL of the requested page in the session\n # before redirecting to the sign-in form.\n session[:intended_url] = request.url \n \t\tredirect_to new_session_url, alert: \"Please sign in first!\"\n \tend\n end", "def signed_in_user\n #call and check on method signed_in from session helper if not user login\n unless signed_in?\n #show message to the user\n flash[:danger]=\"Please sign in\"\n #link to sign in page\n redirect_to signin_url\n end\n end", "def logged_in_account\n unless logged_in?\n redirect_to login_path\n end\n \tend", "def signon\n user = Account.find_by_name( params[ :acc_name ].strip )\n if !!( user && user.authenticate( params[ :password ].strip ))\n return_to = session[ :return_to ] || base_url\n reset_session\n session[ :current_user_id ] = user.id\n session[ :keep_base_open ] = user.keep_base_open\n redirect_to return_to\n else\n flash[ :alert ] = t( 'home.signon.error' )\n redirect_to home_url\n end\n end", "def signed_in\n if not myEmail\n session[:auth_redirect] = request.path\n redirect_to '/auth/google_oauth2'\n else\n log_click\n end\n end", "def sign_in_and_redirect(resource_or_scope, *args); end", "def require_signin\n if !signed_in? \n flash.now.alert = \"先登录!\"\n redirect_to signin_path\n end\n end", "def authenticate\n return redirect_to(sign_in_url) unless signed_in?\n end", "def sign_in\n current_session || sign_user_in # not evaluated unless current session is nil\nend", "def logged_in_user\n if user_signed_in? then\n \n else\n redirect_to root_path\n end \n \n end", "def signed_in\n @status = 200\n @signed_in = user_signed_in? ? true : false\n end", "def signed_in_user\n unless signed_in?\n flash[:danger] = 'Please sign in before accessing this page'\n redirect_to signin_url\n end\n end", "def logged_in\n if current_user == nil\n redirect_to new_user_session_path\n end\n end", "def check_logged_in\n if !user_signed_in?\n redirect_to new_user_session_path\n end\n\n return\n end", "def user_signed_in\n unless signed_in?\n store_address\n redirect_to signin_path, notice: \"Please sign in\"\n end\n end", "def sign_in(resource_or_scope, *args); end", "def require_signin\n if signed_in?\n else\n if request.fullpath.to_s == '/' || request.original_url.to_s == '/'\n redirect_to signin_path\n else\n if request.fullpath.to_s.match('auth')\n auth = request.env['omniauth.auth']['extra']['raw_info']\n session[:auth] = { email: auth[:email], first_name: auth[:first_name], last_name: auth[:last_name] }\n redirect_to social_create_path\n else\n # gflash error: 'You must first sign in or sign up.'\n redirect_to signup_path, flash: { error: 'You must first sign in or sign up.' }\n end\n end\n end\n end", "def logged_in?\n if current_user == nil\n redirect_to \"/sign_in\"\n end\n end", "def require_signin\n deny_access if !signed_in?\n end", "def logged_in\n if current_user == nil\n redirect_to new_user_session_path\n end\n end", "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Please log in.\"\n redirect_to signin_url\n end\n end", "def check_sign_in\n if session? then\n flash[:error] = \"You are already logged in\"\n redirect_to dashboard_users_path\n end\n end", "def already_logged_in\n\t\t\t#current user is not nil\n\t\t\tif !current_user.nil?\n\t\t\t\tredirect_to root_url\n\t\t\tend\n\t\tend", "def logged_in_user\n unless logged_in?\n store_location\n flash[:alert] = \"Please sign up or log in\"\n redirect_to login_url\n end\n end", "def authenticate_user\n redirect_to root_path unless signed_in?\n end", "def log_in?\n if current_user\n redirect_to user_path\n end\n end" ]
[ "0.7953672", "0.7797546", "0.77806145", "0.77384025", "0.77195257", "0.77195257", "0.769542", "0.7678544", "0.76002675", "0.7583254", "0.75559705", "0.7545116", "0.75444484", "0.75334984", "0.7509104", "0.7508345", "0.75056875", "0.74942654", "0.7486416", "0.7445531", "0.7408459", "0.7407084", "0.74027294", "0.7380945", "0.73732543", "0.7370021", "0.736881", "0.73662275", "0.73662275", "0.73314744", "0.7321161", "0.7321161", "0.7321161", "0.7318873", "0.7317144", "0.73132265", "0.73026395", "0.7301256", "0.7294302", "0.72930676", "0.72863245", "0.72863245", "0.7279863", "0.72791743", "0.72774607", "0.7267276", "0.7265607", "0.7265607", "0.7265607", "0.7251295", "0.7246995", "0.7242817", "0.7242817", "0.7242817", "0.7234433", "0.72247225", "0.7218367", "0.72171676", "0.7214552", "0.72059536", "0.719517", "0.7185209", "0.71846884", "0.7178324", "0.71737486", "0.71671635", "0.7162348", "0.71507984", "0.7142244", "0.71300524", "0.71183854", "0.71079", "0.70988435", "0.70918363", "0.709102", "0.70902103", "0.70842755", "0.7071838", "0.7057379", "0.7051795", "0.70432585", "0.7036205", "0.7035767", "0.7024812", "0.7001567", "0.6994491", "0.6988059", "0.6977729", "0.6960219", "0.6953159", "0.69525486", "0.69447327", "0.6942488", "0.69249815", "0.6922563", "0.6918423", "0.69118315", "0.69063944", "0.6903183", "0.68954253", "0.6895396" ]
0.0
-1
ammount should always be provided in cents!
def initialize(order, account, options = {}) self.credentials = options.delete(:credentials) if options[:credentials] super(order, account, options) add_field 'Ds_Merchant_MerchantCode', credentials[:commercial_id] add_field 'Ds_Merchant_Terminal', credentials[:terminal_id] #add_field mappings[:transaction_type], '0' # Default Transaction Type self.transaction_type = :authorization end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cents; end", "def cents\n (amount * 100).to_i\n end", "def prepare_amount amount\n BigDecimal.new(amount)/100\n end", "def credit_in_cents\n (user.credit * 100).to_i\n end", "def damt_paid\n\tamt_paid/100.0 rescue 0.0 \nend", "def mark_up_amt\n rounder5(self.vehicle.price * 0.082)\n end", "def cents(amount)\n (amount * 100).to_i\n end", "def amount_in_cents\r\n read_attribute(:amount) \r\n end", "def cigaret_price\n 0.30\n end", "def cents\n @cents\n end", "def uberXL_fare_calculator(distance, minutes)\n base_fareXL = 3.85\n xlTotal = base_fareXL + (0.50 * minutes.to_i) + (2.85 * distance.to_i)\n if xlTotal < 10.50\n puts 10.50\n else\n puts \"The total for an UberXL is #{xlTotal}\"\n end\nend", "def amount_in_cents\n return 0 if amount.nil?\n (amount * 100).to_i\n end", "def damt_subm\n\tamt_subm/100.0 rescue 0.0 \nend", "def price_in_cents\n\t\tInteger(price * 100 + 0.50)\n\tend", "def adjusted_total_cost(distance, new_mpg, cpg)\n\tadjusted_price = (distance / new_mpg) * cpg\nend", "def get_total_cost_of_meal()\n # original meal price\n meal_cost = gets.to_f\n # tip percentage\n tip_percent = gets.to_i\n # tax percentage\n tax_percent = gets.to_i\n\n # Write your calculation code here\n tip = meal_cost * (tip_percent/100.0)\n tax = meal_cost * (tax_percent/100.0)\n\n # cast the result of the rounding operation to an int and save it as total_cost\n total_cost = (meal_cost + tip + tax).round.to_i\n\n return total_cost\nend", "def amount\n case mode\n when 'set', 'fixed' then money\n when 'percentage' then percentage\n end\n end", "def money_for_us(auction)\n total_sale = auction.current_bid * auction.quantity\n if auction.premium_service\n total_sale * 0.1 # ten percent commission\n else\n total_sale * 0.05 # five percent commission\n end\n end", "def trip_cost(distance, miles_per_gal, price_per_gal)\n result = (((distance.to_f / 100) * miles_per_gal) * price_per_gal) #can also do distance / 100.0 because as long as one of the numbers is a floating point it will return a decimal number\n return result\nend", "def price_in_cents\n\t\tInteger(@price*100 + 0.5)\n\tend", "def uberSUV_fare_calculator(distance, minutes)\n base_fareSUV = 14.00\n suvTotal = base_fareSUV + (0.80 * minutes.to_i) + (4.50 * distance.to_i)\n if suvTotal < 25.00\n puts 25.00\n else\n puts \"The total for an UberSUV is #{suvTotal}\"\n end\nend", "def percent_val\n dollar_amt ? ((dollar_amt / Contract.sum(:dollar_amt)) * 100) : nil\n end", "def fee\n (amount * 0.005) if amount\n end", "def loan_amt\n (self.buying_price*1000) * (1 - (self.deposit/100))\n end", "def dollars\n cents.to_f / 100\n end", "def cost_in_dollars\n self.cost / 100.to_f\n end", "def getamt(input) \n usdollaramt = input.to_s.gsub(/[^0-9.]+/, '')\n @amount = usdollaramt.to_i\n if @amount.between?(100,100000000)\n @output.puts 'The principal amount you entered is: ' + @amount.to_s\n @status = 'valid'\n else\n @output.puts 'Oops, Principal Amount must be between $100 and $100M!'\n end\n return @amount \n end", "def price_in_cents\n Integer(price*100 + 0.5)\n end", "def price_in_cents=(cents)\n\t\t@price = cents / 100.0\n\tend", "def price_in_cents=(cents)\n\t\t@price = cents / 100.0\n\tend", "def attack_bonus(lv)\n (110 * 3 * lv.to_f + 250) / 100 + 5\n end", "def tax(amount)\n if amount <= 240\n 0\n elsif amount <= 480\n amount * 0.15\n else\n amount * 0.28\n end\nend", "def calcuate_tax\n @price * 0.12\n end", "def bank_account_tax_due( account_type, account_amount )\nif account_type == \"normal\"\n return account_amount * 0.10\nelse\n return 0\nend\nend", "def price_in_cents\n\t\tInteger(price * 100 + 0.5)\n\tend", "def calc_bottles(spend_amt)\n spend_amt.to_i/2\nend", "def round_tax(amt)\n ((amt * @nearest_cent).ceil / @nearest_cent)\n end", "def promo_price\n price*0.75\n end", "def defense_bonus(lv)\n (80 * 3 * lv.to_f / 2 + 250) / 100 + 5\n end", "def activemerchant_amount\n (amount * 100).to_i\n end", "def allowance(amt.to_f)\r\n save.deposit(amt.to_f * 0.6)\r\n puts \"Save balance = $#{@balance}.\"\r\n spend.deposit(amt.to_f * 0.3)\r\n puts \"Spend balance = $#{@balance}.\"\r\n spare.deposit(amt.to_f * 0.1)\r\n puts \"Spare balance = $#{@balance}.\"\r\nend", "def price_in_sterling \n\t\tprice * 1.5\n\tend", "def money\n end", "def dollar_total\n total / 100.0\n end", "def extra_cost\n if extra_cost_cents.present?\n read_attribute(:extra_cost_cents) / 100.0\n else\n 0\n end\n end", "def amount\n @percent\n end", "def amount\n @percent\n end", "def share_seller\n if price == 0.0\n 100.0\n else\n cost_price / price * 100\n end\n end", "def money; end", "def total_cost(distance, mpg, cpg)\n\tprice = (distance / mpg) * cpg \nend", "def angl(hrs, mnts)\n 0.5 * (60 * hrs - 11 * mnts)\nend", "def eur(cents); end", "def calc_gold; gold_div > 0 ? item.price / gold_div : 0; end", "def suitable_halfs\n required_amount\n end", "def zero?\n cents == 0 \n end", "def price_in_cents= (price)\n @price = price / 100.0\n end", "def price_in_cents\n read_attribute(:price) \n end", "def add_taxes(amt, good_tax, import_tax)\n amt += good_tax + import_tax\n amt.round(2)\n end", "def asset_amount\n d = divisibility\n d > 0 ? (@asset_quantity.to_f / (10 ** d)).to_f : @asset_quantity\n end", "def charge\n subtotal * 0\n end", "def percentage\n \tamount / expense.cost\n end", "def euro(cents); end", "def test_returns_10_percent_for_normal_bank_account\n test_balance = 100\n account_type = \"normal\"\n tax_due = 100/10\n assert_equal(10, tax_due)\n end", "def account_percentage_amount( acc_percent = nil )\n tot_cost = 0.0 # init result\n if self.patient.is_a_firm?\n acc_percent ||= AppParameterCustomizations.get_receipt_account_percent()\n tot_cost += self.price * acc_percent.to_f / 100.0\n end\n return tot_cost\n end", "def amount\n price\n end", "def amount_cents \n (self.amount.to_f * 100).round.to_i\n end", "def acc_balance\n @page.css(\"span[data-semantic = 'header-available-balance-amount']\").text.to_money.to_f\n end", "def vat_amount(percentage)\n percentage.to_f / 100.0 * order_line.line_total_net if order_line.valid?\n end", "def round_to_nearest_cash_value; end", "def adjusted_capital\n return 0.0 if @capital <= 0.0\n return 0.0 if @interest_rate <= 0.0 || @duration <= 0.0\n (@income/ @duration) * ADJ_FACTOR\nend", "def calc_middle_tax(_amount)\n _amountret = _amount.to_f * 0.175\n return _amountret\n end", "def gross\n \"%.2f\" % params['amount'].to_f\n end", "def amount; end", "def solve(meal_cost, tip_percent, tax_percent)\n\n result = meal_cost * (1 + tip_percent.to_f / 100 + tax_percent.to_f / 100)\n puts result.round()\n \nend", "def amount_charged\n\t\t@amount = 6000\n\tend", "def total_in_dollars_and_cents\n total.to_f / 100\n end", "def test_returns_10_percent_for_normal_bank_account\n result = tax_calculator(10.00, \"normal\")\n assert_equal(1.00, result)\n end", "def price_in_cents\n (cart.total_price*100).round\n end", "def solve(meal_cost, tip_percent, tax_percent)\n total = meal_cost + (meal_cost * tip_percent)/100 + (meal_cost * tax_percent)/100\n puts total.round() \nend", "def assessed_value\n buyer_input = @contract_cost * @contract_length_years.to_f\n return buyer_input if buyer_input != 0.0 && @sum_uom == 0.0 && @sum_benchmark == 0.0\n\n return (@sum_uom + @sum_benchmark + buyer_input) / 3 unless buyer_input.zero?\n\n (@sum_uom + @sum_benchmark) / 2\n end", "def assessed_value\n buyer_input = @contract_cost * @contract_length_years.to_f\n return buyer_input if buyer_input != 0.0 && @sum_uom == 0.0 && @sum_benchmark == 0.0\n\n return (@sum_uom + @sum_benchmark + buyer_input) / 3 unless buyer_input.zero?\n\n (@sum_uom + @sum_benchmark) / 2\n end", "def booking_price\n time_price + distance_price\n end", "def /(value)\n value.respond_to?(:amount) ? (self.amount / value.convert_to(self.units).amount).to_f : self.class.new((self.amount / BigDecimal.new(value.to_s)), self.units)\n end", "def uberB_fare_calculator(distance, minutes)\n base_fareB = 7\n bTotal = base_fareB + (0.65 * minutes.to_i) + (3.75 * distance.to_i)\n if bTotal < 15\n puts 15\n else\n puts \"The total for an UberBlack is #{bTotal}\"\n end\nend", "def price_adjustment \n price_adjustment_fixed / 100.0 \n end", "def solve(meal_cost, tip_percent, tax_percent)\n tip = meal_cost * (tip_percent / 100.0)\n tax = meal_cost * (tax_percent / 100.0)\n total_cost = (meal_cost + tip + tax).round\n puts total_cost\nend", "def get_earned_credits\n begin\n puts \"\\nPlease enter total credits earned: \"\n @earned_credits = gets.chomp\n end until is_float? @earned_credits\n @earned_credits = @earned_credits.to_f\n end", "def price_in_cents\n Integer( price * 100 + 0.5 ) # +0.5 Because floating-point numbers don’t always have an exact internal representation.\n end", "def calc\n\n # get the amount (hrs or days)\n if self.rateType == 'Hour'\n\n std = self.hours.nil? ? 0 : TimeUtil.hours_to_numeric(self.hours)\n\n else\n\n std = dayValue.nil? ? 0 : dayValue\n \n end\n\n amt = 0\n \n amt = std * self.chargeRate unless self.chargeRate.nil? || self.chargeRate == 0\n self.netAmount = amt\n\n return amt\n \n end", "def uberX_fare_calculator(distance, minutes)\n base_fareX = 2.55\n xTotal = base_fareX + (0.35 * minutes.to_i) + (1.75 * distance.to_i)\n if xTotal < 8\n puts 8\n else\n puts \"The total for an UberX is #{xTotal}\"\n end\nend", "def compute_total(total)\n if discount.eq?('percent')\n percent_value = amount.to_f / 100\n total = total - (total * percent_value)\n else\n total = total - amount\n (total < 0) ? 0 : total \n end \n end", "def amount_after_tax\n if waitlist_deduct_amount.present?\n amount_after_discounted + amount_of_tax - waitlist_deduct_amount\n else\n amount_after_discounted + amount_of_tax\n end\n end", "def convert_dollars_to_cents(atr)\n cnsd = controller_name.singularize.downcase.to_sym\n if params[cnsd][atr].present?\n dollars = params[cnsd][atr].delete(',').to_f\n params[cnsd][atr] = (dollars * 100).round\n end\n end", "def calculate_amount(ride)\n base_amount = 350000\n time_diff_sec = (ride.ends_time - ride.start_time)\n time_amount = ( time_diff_sec / 60).round * 20000\n base_amount + time_amount\n end", "def tax_amount(amount)\n return ((amount * 8.9)/100).round(2)\nend", "def bill_calc\n puts \"What is the cost of the bill?:\"\n bill = gets.chomp.to_f\n puts \"What is the tip rate percentage?:\"\n tip_percentage= gets.chomp.to_f\n \n tip_total = ((bill / 100) * tip_percentage)\n \n puts \"The tip cost is : #{sprintf('%.2f',(tip_total))}\"\n puts \"The total cost including the tip is #{sprintf('%.2f',(bill + tip_total))}\"\n \nend", "def amount_in_cents(amount)\n (100 * amount).to_i\n end", "def parse_amount_owed text_amount\n (parse_amount_cents text_amount).abs\n end", "def zero?\n cents == 0\n end", "def zero?\n cents == 0\n end", "def tax_money_owed\n if update_taxable <= 43953 && update_taxable >= 0\n update_taxable * 0.15\n elsif update_taxable >= 43954 && update_taxable <=87907\n (43953*0.15) + ((update_taxable-43953) * 0.22)\n elsif update_taxable >= 87908 && update_taxable <=136270\n (43953*0.15)+ (48363*0.22) + (update_taxable * 0.26)\n elsif update_taxable >= 136270\n (43953*0.15)+ (48363*0.22)+ (43954*0.26) + (update_taxable * 0.29)\n else\n update_taxable \n end\n end" ]
[ "0.7395885", "0.6579836", "0.65370005", "0.64695483", "0.6438657", "0.64309907", "0.63770604", "0.63299894", "0.62865436", "0.6248831", "0.6237825", "0.6221687", "0.62170476", "0.62149304", "0.62042636", "0.6201402", "0.6191846", "0.6191414", "0.6186176", "0.6179767", "0.61612016", "0.6148244", "0.6133628", "0.6121934", "0.6121632", "0.6121632", "0.6116654", "0.61052907", "0.6101333", "0.6101333", "0.6098551", "0.60979855", "0.60938025", "0.6086932", "0.60849047", "0.60740274", "0.60699105", "0.6058465", "0.60535145", "0.60505944", "0.6047477", "0.6042682", "0.6031988", "0.60303235", "0.6020133", "0.6018454", "0.6018454", "0.5998011", "0.5991768", "0.5985426", "0.59840435", "0.59824604", "0.59745204", "0.59717673", "0.59709954", "0.5968069", "0.5962931", "0.5962762", "0.5957812", "0.5955541", "0.59518963", "0.5943965", "0.5939002", "0.59368384", "0.5932055", "0.5931599", "0.5930034", "0.5929824", "0.59298015", "0.59232557", "0.59216315", "0.59215826", "0.592093", "0.59164166", "0.59130436", "0.590565", "0.58997744", "0.5896023", "0.5895796", "0.588272", "0.588272", "0.58789206", "0.58689713", "0.5859963", "0.5848509", "0.5847188", "0.584153", "0.5840136", "0.5839141", "0.5838296", "0.58307964", "0.58290124", "0.5825317", "0.5816431", "0.5815686", "0.5811081", "0.58056265", "0.5803589", "0.57925886", "0.57925886", "0.5791866" ]
0.0
-1
Allow credentials to be overwritten if needed
def credentials @credentials || self.class.credentials end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def credentials=(_arg0); end", "def credentials=(_arg0); end", "def credentials=(_arg0); end", "def credentials=(_arg0); end", "def credentials=(_arg0); end", "def credentials; end", "def credentials; end", "def credentials; end", "def credentials; end", "def credentials; end", "def use_demo_credentials!\n self.username = 'demo'\n self.password = 'password'\n end", "def credentials\n @credentials ||= {}\n end", "def before_save\n super\n unless(self.values[:credentials])\n self.values[:credentials] = {}\n end\n random_sec = 3.times.map{ SecureRandom.urlsafe_base64 }.join\n self.user.run_state.random_sec = random_sec\n self.credentials = Utils::Cipher.encrypt(\n JSON.dump(self[:credentials]),\n :key => [\n SALTER,\n self.user.username,\n self.user.run_state.random_sec\n ].join(SALTER_JOINER),\n :iv => self.user.run_state.random_sec\n )\n self.extras = Sequel.pg_json(self.extras)\n self.infos = Sequel.pg_json(self.infos)\n if(password)\n self.password_digest = checksum(password)\n end\n end", "def credential_source\n super\n end", "def store\n credentials = ask_for_credentials\n\n ovewrite = if File.exist?(credentials_file)\n GoodData::CLI.terminal.ask(\"Overwrite existing stored credentials (y/n)\")\n else\n 'y'\n end\n\n if ovewrite == 'y'\n File.open(credentials_file, 'w', 0600) do |f|\n f.puts JSON.pretty_generate(credentials)\n end\n else\n puts 'Aborting...'\n end\n end", "def credentials(username,password='')\n if username.is_a?(OAuth::AccessToken)\n @credentials = username\n else\n @credentials = {:username => username, :password => password}\n end\n end", "def credentials(opts = T.unsafe(nil)); end", "def store_credentials(credentials)\n conf = configuration\n conf[:credentials] = {}\n conf[:credentials][:access_key], conf[:credentials][:secret_key] = credentials[0], credentials[1]\n store_configuration(conf)\n end", "def credentials=(value)\n super\n values = value.is_a?(Array) ? value : [value]\n self.unauthorized_record = values.first if values.first.class < ::ActiveRecord::Base\n end", "def initialize_secret(opts = {})\n secret = if opts[:username] && opts[:password]\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Using provided plain credentials\"\n \"#{opts[:username]}:#{opts[:password]}\"\n else\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Falling back to file and environment credentials\"\n opts[:auth_file] ? File.read(opts[:auth_file]) : nil\n end\n secret.strip! if secret\n secret\n end", "def load_or_create\n valid_credentials? ? load_credentials : create_credentials\n self\n end", "def credential; end", "def credential; end", "def session_passwd\n super\n end", "def session_passwd\n super\n end", "def credentials=(credentials)\n if credentials.kind_of?(ApplicationCredentials) || credentials.kind_of?(AccountCredentials)\n @credentials = credentials\n else\n raise 'Invalid credentials object'\n end\n end", "def add_credentials!\n @accessor.auth_manager.add_credentials(self)\n end", "def set_password; nil; end", "def add_credentials(post = {})\n post[:ext_person_source_id] = credentials[:ext_person_source_id]\n post[:source_username] = credentials[:username]\n post[:source_password] = credentials[:password]\n post[:ext_policy_id] = credentials[:ext_policy_id]\n post\n end", "def credentials=(target, scheme, username, password)\r\n\t\t\t`#{BITS::BITSADMIN} /setcredentials {#{@id}} #{target} #{scheme} #{username} #{password}`\r\n\t\tend", "def credential=(_arg0); end", "def credential=(_arg0); end", "def credentials(username, password, digest = false)\n self.username = username\n self.password = password\n self.digest = digest\n end", "def credentials(username, password, digest = false)\n self.username = username\n self.password = password\n self.digest = digest\n end", "def set_credentials(credentials)\n @credentials = credentials\n end", "def refresh_credentials\n if credentials_stale?\n authorization_data = ecr_client.get_authorization_token.authorization_data.first\n\n self.credentials_expire_at = authorization_data.expires_at || raise(\"NO EXPIRE FOUND\")\n user, pass = Base64.decode64(authorization_data.authorization_token).split(\":\", 2)\n ENV['DOCKER_REGISTRY_USER'] = user\n ENV['DOCKER_REGISTRY_PASS'] = pass\n end\n rescue Aws::ECR::Errors::InvalidSignatureException\n raise Samson::Hooks::UserError, \"Invalid AWS credentials\"\n end", "def credentials=(credentials)\n @lock.synchronize do\n @credentials = credentials\n end\n end", "def save\r\n SystemConfig.set :auth, to_h, true\r\n end", "def credentials= (new_credentials)\n @credentials = new_credentials\n refresh_config_for_api_objects!\n @credentials\n end", "def credentials(authorization, request); end", "def credentials_file\n dir['credentials']\n end", "def set_credentials\n @user = User.find(current_user.id)\n end", "def base_credential; end", "def store_credentials(user_id, credentials)\n\t raise NotImplementedError, 'store_credentials is not implemented.'\n\tend", "def write_credentials\n # AWS CLI is needed because writing AWS credentials is not supported by the AWS Ruby SDK.\n return unless system('which aws >/dev/null 2>&1')\n Aws::SharedCredentials::KEY_MAP.transform_values(&@credentials.method(:send)).\n merge(expiration: @expiration).each do |key, value|\n system(\"aws configure set #{key} #{value} --profile #{@session_profile}\")\n end\n end", "def update_login_credentials(username, password)\n unless username.nil? && password.nil? \n encrypted_password = encrypt(password)\n configuration_data[:credentials] = {\n username: username,\n password: encrypted_password\n }\n else\n configuration_data.delete(:credentials)\n end\n\n save_configuration\n end", "def generate_credentials\n self.username = SecureRandom.alphanumeric(12)\n self.password = SecureRandom.urlsafe_base64(12)\n end", "def credentials=(value)\n BaseTask.validate value, \"credentials\", Database::CREDENTIALS\n @credentials = value\n end", "def new_password; nil; end", "def set_credentials(credentials: nil)\n raise StandardError, 'credentials must be a hash' unless credentials.is_a?(Hash)\n\n password = ENV['CARRIER_PRODUCTS_ENCRYPTION_PASSWORD']\n encrypted_credentials = credentials.inject({}) do |hash, (key, value)|\n raise StandardError, \"#{key.to_s.capitalize} must be specified\" if value.blank? && !key.to_s.include?('test')\n\n hash[key] = AESCrypt.encrypt(value, password) if value.present?\n hash\n end\n\n self.credentials = encrypted_credentials\n self.save!\n end", "def credentials\n {\n \"username\" => self.username,\n \"password\" => self.password\n }\n end", "def credential\n authorizer.get_credentials('default')\n end", "def setup_credentials\n\n cmd = @config[:path] + @command_line_tool + \" \" + @@login_command\n\n Open3.popen3( cmd ) { |input, output, error|\n input.puts @config[:url]\n input.puts @config[:user]\n input.puts @config[:password]\n input.close\n } \n\n end", "def add_credential(db, username, password)\n @credentials ||= {}\n @credentials[db] = [ username, password ]\n apply_credentials\n end", "def auth_bypass\r\n username = datastore['HttpUsername'] || Rex::Text.rand_text_alpha_lower(4..12)\r\n password = datastore['HttpPassword'] || Rex::Text.rand_text_alpha_lower(4..12)\r\n @auth = basic_auth(username, password)\r\n\r\n res = send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_users/org.couchdb.user:#{username}\"),\r\n 'method' => 'PUT',\r\n 'ctype' => 'application/json',\r\n 'data' => %({\"type\": \"user\",\"name\": \"#{username}\",\"roles\": [\"_admin\"],\"roles\": [],\"password\": \"#{password}\"})\r\n )\r\n\r\n if res && (res.code == 200 || res.code == 201) && res.get_json_document['ok']\r\n return true\r\n else\r\n return false\r\n end\r\n end", "def credentials=(value)\n super\n values = value.is_a?(Array) ? value : [value]\n if values.first.is_a?(Hash)\n hash = values.first.with_indifferent_access\n self.facebook_name = hash[:facebook_name]\n self.facebook_username = hash[:facebook_username]\n\n hash\n end\n end", "def aws_credentials(access_key, secret_access_key)\n unless access_key.empty? || secret_access_key.empty?\n credentials = { access_key_id: access_key, secret_access_key: secret_access_key }\n File.write('../.credentials.yml', credentials.to_yaml)\n $preferences_window.destroy\n else \n Tk.messageBox('type' => 'ok',\n 'icon' => 'error',\n 'title' => 'Keys',\n 'message' => 'Access and secret keys must not be empty') \n end \n end", "def rotate_credentials!\n clear_all_reviewer_sessions!\n generate_credentials\n save!\n end", "def credentials\n authenticating_with_api? ? {:api_key => api_key} : super\n end", "def correct_credentials?\n correct_username = 'admin'\n correct_password = 'admin'\n input_username = @request.params['username']\n input_password = @request.params['password']\n correct_username == input_username && correct_password == input_password\n end", "def store_oauth2_credentials!(attributes = {})\n self.send(:\"#{self.class.oauth2_uid_field}=\", attributes[:uid])\n self.send(:\"#{self.class.oauth2_token_field}=\", attributes[:token])\n\n # Confirm without e-mail - if confirmable module is loaded.\n self.skip_confirmation! if self.respond_to?(:skip_confirmation!)\n\n # Only populate +email+ field if it's available (e.g. if +authenticable+ module is used).\n self.email = attributes[:email] || '' if self.respond_to?(:email)\n\n # Lazy hack: These database fields are required if +authenticable+/+confirmable+\n # module(s) is used. Could be avoided with :null => true for authenticatable\n # migration, but keeping this to avoid unnecessary problems.\n self.password_salt = '' if self.respond_to?(:password_salt)\n self.encrypted_password = '' if self.respond_to?(:encrypted_password)\n end", "def refresh_credentials\n DockerRegistry.all.each do |registry|\n next if registry.credentials_expire_at&.> 1.hour.from_now\n next unless client = ecr_client(registry)\n\n authorization_data = client.get_authorization_token.authorization_data.first\n username, password = Base64.decode64(authorization_data.authorization_token).split(\":\", 2)\n registry.username = username\n registry.password = password\n registry.credentials_expire_at = authorization_data.expires_at || raise(\"NO EXPIRE FOUND\")\n end\n rescue Aws::ECR::Errors::InvalidSignatureException\n raise Samson::Hooks::UserError, \"Invalid AWS credentials\"\n end", "def apply_credentials\n seeds.each do |node|\n node.credentials = @credentials || {}\n end\n true\n end", "def credentials=(values)\n return if values.blank? || !values.is_a?(Hash)\n values.symbolize_keys!\n values.each do |field, value|\n next if value.blank?\n send(\"#{field}=\", value)\n end\n end", "def password=(new_password); end", "def resident_credential?; end", "def create_credentials\n FileUtils.mkdir_p(@local_credentials_dir)\n message \"Going to create the credentials.yml in #{@local_credentials_dir}\"\n if e.ask_to_overwrite_local(@local_credentials_file_yml)\n Spinner.return :message => \"Creating #{y('credentials.yml')}..\" do\n local_credentials_yml = File.new(@local_credentials_file_yml, \"w\")\n local_credentials_yml.write(yaml_template)\n local_credentials_yml.close\n g(\"Finished creating the credentials.yml\")\n end\n end \n end", "def full_credentials\n basic_credentials.merge(\n 'x_method' => @x_method,\n 'x_version' => @x_version,\n 'x_duplicate_window' => @x_duplicate_window\n )\n end", "def setup_credentials\n unless yes?('Would you like to configure and store your credentials?')\n $stderr.puts \"Unable to proceed without credentials\"\n exit 1\n end\n\n begin\n choice = choose do |menu|\n menu.prompt = 'Which type of credentials would you like to set up? (token is highly recommended) '\n menu.choices(:password, :token, :none)\n end.to_sym\n end until [:password, :token, :none].include? choice\n\n if choice == :password\n setup_password_credentials\n elsif choice == :token\n setup_token_credentials\n else\n return false\n end\n rescue StandardError => e\n options.debug ? warn(e) : raise(e)\n false\n end", "def credentials\n { :user => @user, :password => @password }\n end", "def deploy_password\n set :password, deploy_script_password rescue nil\nend", "def authenticate_once_state\n super\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 clean_args(args)\r\n require_arg(args, :username)\r\n require_arg(args, :password)\r\n args[:username] = args[:username].downcase\r\n args[:override] = false unless args.key?(:override)\r\n return args\r\n end", "def credentials\n { :username => @email, :password => @password }\n end", "def ask_credentials\n self.email = cli.prompt \"Your Pivotal Tracker email: \"\n self.password = cli.prompt_secret \"Your Pivotal Tracker password (never stored): \"\n end", "def store_config_credentials(user, options={})\n set_config(\"#{credential_config_key}.user\", user)\n if (token = options.delete(:token))\n set_config(\"#{credential_config_key}.token\", token)\n elsif (password = options.delete(:password))\n set_config(\"#{credential_config_key}.password\", password)\n else\n warn \"no token or password set\"\n false\n end\n end", "def prevent_password_reuse?\n !@policy.password_reuse_prevention.nil?\n end", "def set_active_resource_credentials\n puts \"Changing credentials to something\"\n if @photocracy_mode\n $PHOTOCRACY = true\n username = APP_CONFIG[:PHOTOCRACY_USERNAME]\n password = APP_CONFIG[:PHOTOCRACY_PASSWORD]\n else\n $PHOTOCRACY = false\n username = APP_CONFIG[:PAIRWISE_USERNAME]\n password = APP_CONFIG[:PAIRWISE_PASSWORD]\n end\n active_resource_classes = [Choice, Density, Prompt, Question, Session]\n active_resource_classes.each do |klass|\n klass.user = username\n klass.password = password\n end\nend", "def before_save_user\n self.encrypted_password.encode! 'utf-8'\n\n # If demo is enabled, demo user cannot change email or password nor be locked\n if Feedbunch::Application.config.demo_enabled\n demo_email = Feedbunch::Application.config.demo_email\n if email_changed? && self.email_was == demo_email\n Rails.logger.info 'Somebody attempted to change the demo user email. Blocking the attempt.'\n self.errors.add :email, 'Cannot change demo user email'\n self.email = demo_email\n end\n\n demo_password = Feedbunch::Application.config.demo_password\n if encrypted_password_changed? && self.email == demo_email\n Rails.logger.info 'Somebody attempted to change the demo user password. Blocking the attempt.'\n self.errors.add :password, 'Cannot change demo user password'\n self.password = demo_password\n end\n\n if locked_at_changed? && self.email == demo_email\n Rails.logger.info 'Keeping demo user from being locked because of too many authentication failures'\n self.locked_at = nil\n end\n\n if unlock_token_changed? && self.email == demo_email\n Rails.logger.info 'Removing unlock token for demo user, demo user cannot be locked out'\n self.unlock_token = nil\n end\n end\n end", "def enter_password_shared\n end", "def password=(_arg0); end", "def password=(_arg0); end", "def password=(_arg0); end", "def password=(_arg0); end", "def before_import_save(record)\n puts \"I am calling the hook\"\n self.allow_blank_password = true\n end", "def initialize(\n username: self.class.username,\n password: self.class.password\n )\n @username = username.to_s.clone\n @password = password.to_s.clone\n end", "def before_import_save(record)\n self.allow_blank_password = true\n self.allow_blank_email = true\n end", "def form_credentials\n {\n username: @username,\n password: @password,\n }\n end", "def write_user_credentials(username, password)\n File.open(credentials_path, 'a') do |users|\n users.write(Psych.dump(\"#{username}\": encrypt_password(password)))\n end\n clean_yaml\nend", "def auth_store; end", "def old_password\n nil\n end", "def credentials\n return nil if username.nil? || password.nil?\n \"#{username}:#{password}\"\n end", "def read_credentials\n File.readlines(USERPASS_FILE).each do |line|\n user, pass = line.split\n pass = \"\" if pass == '(none)'\n @crends << [\"#{user}\", pass]\n end\n end", "def password_credentials=(value)\n @password_credentials = value\n end", "def credentials=(value)\n super\n values = value.is_a?(Array) ? value : [value]\n hash = values.first.is_a?(Hash) ? values.first.with_indifferent_access : nil\n self.openid_identifier = hash[:openid_identifier] if !hash.nil? && hash.key?(:openid_identifier)\n end", "def initialize(credentials_handle_hash = {})\n super()\n replace(credentials_handle_hash)\n end", "def allow_params_authentication!; end", "def assign_credential(username)\n raise ArgumentError, \"The username cannot be nil\" unless username\n raise ArgumentError, \"The username cannot be empty\" if username.empty?\n\n self.service.assignCredential(username.to_s)\n \n @credentials = nil\n end", "def update_credential_password(username, password)\n raise ArgumentError, \"The new password cannot be nil\" unless password\n raise ArgumentError, \"The new username cannot be nil\" unless username\n raise ArgumentError, \"The new password cannot be empty\" if password.empty?\n raise ArgumentError, \"The new username cannot be empty\" if username.empty?\n\n self.service.editCredential(username.to_s, password.to_s)\n\n @credentials = nil\n end" ]
[ "0.7015429", "0.7015429", "0.7015429", "0.7015429", "0.7015429", "0.6920988", "0.6920988", "0.6920988", "0.6920988", "0.6920988", "0.6577597", "0.6570384", "0.6561054", "0.63740367", "0.6316935", "0.62419844", "0.62210935", "0.62152225", "0.62048227", "0.61904293", "0.61595243", "0.6152182", "0.6152182", "0.6148943", "0.6148943", "0.6148094", "0.61410487", "0.6139923", "0.61370605", "0.61310977", "0.6127427", "0.6127427", "0.6126814", "0.6126814", "0.6098971", "0.60910475", "0.6082415", "0.6081565", "0.60459715", "0.60363615", "0.60254556", "0.601013", "0.60091865", "0.60020894", "0.5974791", "0.59695566", "0.5955351", "0.59507495", "0.5948959", "0.5928215", "0.5926547", "0.5926472", "0.59076136", "0.5891234", "0.5888469", "0.5885255", "0.5867167", "0.58431077", "0.58305246", "0.5830381", "0.582828", "0.5825089", "0.581882", "0.5817427", "0.5791105", "0.57882637", "0.5783208", "0.5777386", "0.576876", "0.5766402", "0.5750372", "0.57502306", "0.574901", "0.5748145", "0.5728509", "0.5723859", "0.5716391", "0.57085866", "0.5706482", "0.5693791", "0.56755376", "0.56686175", "0.56686175", "0.56686175", "0.56686175", "0.5665873", "0.5664401", "0.56568384", "0.5654992", "0.5652477", "0.5652029", "0.5650622", "0.56464994", "0.5642718", "0.563953", "0.563903", "0.5638874", "0.5637676", "0.56372976", "0.5635353" ]
0.57147014
77
Generate a signature authenticating the current request. Values included in the signature are determined by the the type of transaction.
def sign_request # By default OpenSSL generates an all-zero array for the encriptation vector # You can read it here: http://ruby-doc.org/stdlib-1.9.3/libdoc/openssl/rdoc/OpenSSL/Cipher.html#method-i-iv-3D # If you want to declare it, you can take a look at the next couple of lines #bytes = Array.new(8,0) #iv = bytes.map(&:chr).join # We need to decode the secret key key = Base64.strict_decode64(credentials[:secret_key]) # In thee cipher initialization we need to speficy the encryptation like method-length-mode (http://ruby-doc.org/stdlib-1.9.3/libdoc/openssl/rdoc/OpenSSL/Cipher.html#method-c-new). # Sermepa needs DES3 in CBC mode # The direct way the declare it's: des-ede3-cbc # You can also declare like 'des3' wich use CBC mode by default des3 = OpenSSL::Cipher::Cipher.new('des-ede3-cbc') # OpenSSL use by default PKCS padding. But Sermepa (mcrypt_encrypt PHP function) use zero padding. # OpenSSL do not allow zero padding. So we need to disable the default padding and make zero padding by hand # Padding in cryptography is to fill the data with especial characteres in order to use the data in blocks of N (https://en.wikipedia.org/wiki/Padding_(cryptography)) # We need to use blocks of 8 bytes block_length = 8 # We tell OpenSSL not to pad des3.padding = 0 # We want to encrypt des3.encrypt # Key set des3.key = key #des3.iv = iv order_number = @fields["Ds_Merchant_Order"] # Here is the 'magic'. Instead use the default OpenSSL padding (PKCS). We fill with \0 till the data have # a multiple of the block size (8, 16, 24...) order_number += "\0" until order_number.bytesize % block_length == 0 # For example: the string "123456789" will be transform in "123456789\x00\x00\x00\x00\x00\x00\x00" # data must be in blocks of 8 or the update will break key_des3 = des3.update(order_number) + des3.final # The next step is to encrypt in SHA256 the resulting des3 key with the base64 json result = OpenSSL::HMAC.digest('sha256', key_des3, merchant_parameters_base64_json) # The last step is to encode the data in base64 Base64.strict_encode64(result) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signature\n k_date = Digestor.hmac(\"AWS4\" + secret_key, date[0, 8])\n k_region = Digestor.hmac(k_date, region)\n k_service = Digestor.hmac(k_region, service)\n k_credentials = Digestor.hmac(k_service, \"aws4_request\")\n Digestor.hexhmac(k_credentials, string_to_sign)\n end", "def signature\n # Remove 'sha_sign' key from request params and concatenate all\n # key value pairs\n params = payload.to_h\n .reject { |key, value| key == :sha_sign }\n .reject { |key, value| value == '' || value == false }.sort\n .map { | key, value| \"#{key}=#{value}#{passphrase}\" }.join\n\n # Calculate SHA512 and upcase all letters, since Digistore will\n # also return upcased letters in the signature.\n Digest::SHA512.hexdigest(params).upcase\n end", "def signature\n time = Time.now\n {\n mktowsUserId: user_id,\n requestTimestamp: time.to_s,\n requestSignature: hmac(time),\n }\n end", "def generate_signature\n digest = OpenSSL::Digest.new('sha256')\n string_to_sign = \"#{@url_path}?#{sorted_parameters_query}\"\n OpenSSL::HMAC.hexdigest(digest, @api_secret_d, string_to_sign)\n end", "def calculate_signature\n normalized_string = [\n request_header.timestamp,\n request_header.nonce,\n request_header.algorithm,\n method.upcase,\n host_with_port,\n request_uri\n ].join(',')\n\n ActiveSupport::Base64.encode64s(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha256'), secret, normalized_string))\n end", "def generate_signature\n sha1x16 = Digest::SHA1.hexdigest(signed_string)\n .tap { |s| logger.debug \"sha1x16 #{s}\" }\n enc = case form_fields['signMethod']\n when '01' # 01 means RSA\n merchant_private_key.sign(OpenSSL::Digest::SHA1.new, sha1x16)\n .tap { |s| logger.debug \"enc #{s}\" }\n else # at current time (2015-05-25) no other signing method is mentioned in Unionpay's official docs\n raise \"sign method #{form_fields['signMethod']} is not implemented yet.\"\n end\n Base64.strict_encode64(enc) # has to be strict_encode64, not encode64, as the latter as an extra '\\n'\n .tap { |s| logger.debug \"final: #{s}\" }\n end", "def signing_key\n digest = \"SHA256\"\n kDate = OpenSSL::HMAC.digest(digest, \"AWS4\" + credentials.aws_secret, request_datestamp)\n kRegion = OpenSSL::HMAC.digest(digest, kDate, region)\n kService = OpenSSL::HMAC.digest(digest, kRegion, service)\n OpenSSL::HMAC.digest(digest, kService, \"aws4_request\")\n end", "def signature(request, secret, options = nil)\n new(nil, options).signature(request, secret)\n end", "def signature\n digest = \"SHA256\"\n OpenSSL::HMAC.hexdigest(digest, signing_key, string_to_sign)\n end", "def upload_signature\n @upload_signature ||=\n Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest::SHA1.new,\n options[:secret_access_key],\n self.policy_document\n )\n ).gsub(/\\n/, '')\n end", "def build_signature\n sig = case signature_method\n when \"HMAC-SHA1\"\n Base64.encode64(HMAC::SHA1.digest(signature_secret, signature_base_string)).chomp.gsub(/\\n/,'')\n when \"HMAC-MD5\"\n Base64.encode64(HMAC::MD5.digest(signature_secret, signature_base_string)).chomp.gsub(/\\n/,'')\n else\n false\n end\n Merb::Parse.escape(sig)\n end", "def signature_method\n oauth_merged_params[:oauth_signature_method] || \"HMAC-SHA1\"\n end", "def transloadit_params_signature(params)\n auth_secret = Lynr.config('app')['transloadit']['auth_secret']\n return nil if auth_secret.nil?\n digest = OpenSSL::Digest::Digest.new('sha1')\n OpenSSL::HMAC.hexdigest(digest, auth_secret, JSON.generate(params))\n end", "def signed_request_params(timestamp = nil)\n timestamp ||= Time.now.to_i\n data = \"#{self.id} - #{timestamp} - #{self.connection.partner.api_key}\"\n {\n 'user_id' => id,\n 'ts' => timestamp,\n 'sig' => Digest::SHA1.hexdigest(data).slice(0, 10)\n }\n end", "def create_signature(params, secret) # :nodoc:\n query = build_nested_query(params)\n\n require 'openssl'\n digest = OpenSSL::Digest::Digest.new('sha1')\n signature = OpenSSL::HMAC.hexdigest(digest, secret, query)\n\n # require 'pp'\n # print '----------------------------------'\n # pp params\n # pp query\n # pp secret\n # pp signature\n\n return signature\n end", "def signature_base\n tx = Stellar::Transaction.from_xdr(\n # TransactionV0 is a transaction with the AccountID discriminant\n # stripped off, we need to put it back to build a valid transaction\n # which we can use to build a TransactionSignaturePayloadTaggedTransaction\n Stellar::PublicKeyType.to_xdr(Stellar::PublicKeyType.public_key_type_ed25519) + to_xdr\n )\n\n tagged_tx = Stellar::TransactionSignaturePayload::TaggedTransaction.new(:envelope_type_tx, tx)\n\n Stellar::TransactionSignaturePayload.new(\n network_id: Stellar.current_network_id,\n tagged_transaction: tagged_tx\n ).to_xdr\n end", "def generated_signature(policy)\n return signature = Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest::Digest.new('sha1'),\n secret_access_key, policy)).gsub(\"\\n\",\"\")\n end", "def signature\n EPDQ::ShaCalculator.new(full_parameters, EPDQ.sha_in, EPDQ.sha_type).signature\n end", "def param_signature(params) \n return generate_signature(params, get_secret(params));\n end", "def signature\n sha256 = OpenSSL::Digest::SHA256.new\n hash = OpenSSL::HMAC.digest sha256, secret, string_to_sign\n\n Base64.encode64(hash).chomp\n end", "def signature\n Base64.encode64(encryption_key.sign(OpenSSL::Digest::SHA256.new, id_string))\n end", "def generate_signature\n Digest::MD5.hexdigest(Configuration.hotel_api_key + \n Configuration.hotel_shared_secret + \n Time.now.to_i.to_s)\n end", "def signature(params)\n self.class._hmac(secret, params) if secret.to_s.length > 0\n end", "def signature_key; end", "def build_signature_for(url, params)\r\n data = url + params.sort.join\r\n digest = OpenSSL::Digest.new('sha1')\r\n Base64.strict_encode64(OpenSSL::HMAC.digest(digest, ENV['TWILIO_AUTH_TOKEN'], data))\r\n end", "def signature\n @signature ||= Base64.encode64(digest).gsub(\"\\n\", '')\n end", "def signature\n Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest.new('sha1'),\n ENV['S3_SECRET_ACCESS_KEY'],\n policy_document\n )\n ).gsub(/\\n/, '')\n end", "def generate_signature(string_to_sign)\n digest = OpenSSL::Digest.new('sha256')\n OpenSSL::HMAC.hexdigest(digest, @api_secret, string_to_sign)\n end", "def signature\n @signature ||= set_signature(nil)\n end", "def sign\n url.query = url.query.to_s + \"&Signature=#{Utils.encode signature}\"\n self\n end", "def signature\n Base64.encode64(digest_with_key(string_to_sign)).strip\n end", "def generate_oauth_signature params, url\n base_request_uri = CGI::escape(url.to_s)\n query_params = []\n\n params.sort.map do |key, value|\n query_params.push(encode_param(key.to_s) + \"%3D\" + encode_param(value.to_s))\n end\n\n query_string = query_params\n .join(\"%26\")\n string_to_sign = \"#{@method}&#{base_request_uri}&#{query_string}\"\n\n if ![\"v1\", \"v2\"].include? @version\n consumer_secret = \"#{@consumer_secret}&\"\n else\n consumer_secret = @consumer_secret\n end\n\n return Base64.strict_encode64(OpenSSL::HMAC.digest(digest, consumer_secret, string_to_sign))\n end", "def compute_signature params\n if $DEBUG\n puts \"keys before sorted: #{params.keys}\"\n end\n\n sorted_keys = params.keys.sort\n\n if $DEBUG\n puts \"keys after sorted: #{sorted_keys}\"\n end\n\n canonicalized_query_string = \"\"\n\n canonicalized_query_string = sorted_keys.map {|key|\n \"%s=%s\" % [safe_encode(key.to_s), safe_encode(params[key])]\n }.join(self.service.separator)\n\n length = canonicalized_query_string.length\n\n string_to_sign = self.service.http_method + self.service.separator + safe_encode('/') + self.service.separator + safe_encode(canonicalized_query_string)\n\n if $DEBUG\n puts \"string_to_sign is #{string_to_sign}\"\n end\n\n signature = calculate_signature access_key_secret+\"&\", string_to_sign\n end", "def getSignature\n\t time = Time.now.gmtime.to_i.to_s()\n unencryptedSignature = \"#{@apiKey}#{@secretKey}#{time}#{@user}\"\n\t return Digest::MD5.hexdigest(unencryptedSignature + unencryptedSignature.length.to_s())\n\tend", "def generate_signature parameters\n temp = ''\n params = parameters.sort\n params.each do |array|\n temp += array[0].to_s + array[1].to_s\n end\n signature = @api_secret + temp\n Digest::MD5.hexdigest(signature)\n end", "def signature\n Digest::SHA256.hexdigest(@hash.to_json)\n end", "def signature_for(string)\n format('sha1=%s'.freeze, generate_hmac(string))\n end", "def perform\n query_param = @request_parameters.to_query.gsub(/^&/, '')\n\n uri = URI(@url)\n remove_txt = uri.query\n final_url = @url.gsub(/\\?#{remove_txt}\\Z/i, '')\n\n str = \"#{final_url}?#{query_param}\"\n generate_signature(str)\n end", "def generate_request_signature(components)\n string_to_sign = components.join(\"\\n\")\n\n digest = OpenSSL::Digest.new('sha1')\n Base64.encode64(OpenSSL::HMAC.digest(digest, @configuration.secret_key, string_to_sign))\n end", "def generate_request_signature(components)\n string_to_sign = components.join(\"\\n\")\n\n digest = OpenSSL::Digest.new('sha1')\n Base64.encode64(OpenSSL::HMAC.digest(digest, @configuration.secret_key, string_to_sign))\n end", "def gen_sig(mac, params)\n signed = params[\"signed\"].split(\",\").map {|k| [k, params[k]]}\n base64_encode(Signatures.sign(mac, kv_encode(signed)))\n rescue Signatures::NotFound\n nil\n end", "def create_signature(dev_id, api_method, auth_key, formatted_timestamp)\n # ts = Time.at(timestamp).strftime(\"%Y%m%d%H%M%S\")\n raw_sig = \"#{dev_id}#{api_method}#{auth_key}#{formatted_timestamp}\"\n Digest::MD5.hexdigest(raw_sig)\n end", "def signature timestamp, url\n HMAC::SHA1.hexdigest @context.secret, [url.path, url.query + \"&Timestamp=#{timestamp}&ApiKey=#{@context.key}\"].join('?')\n end", "def signature_for(string)\n format('sha1=%s'.freeze, generate_hmac(string))\n end", "def signature\n # FIXME merb keeps mangling this by replacing \"+\" with \"\\s\" \n oauth_merged_params[:oauth_signature]\n end", "def signing_input; end", "def signing_input; end", "def signature_params\n params.require(:signature).permit(:sign)\n end", "def _compute_signature(body)\n timestamp = self.class._get_timestamp\n nonce = self.class._get_nonce\n\n # Compute signature: HMAC[SHA256]_{secret} (key | timestamp | seq | nonce | body) => signature\n hm = OpenSSL::HMAC.new(self.secret, OpenSSL::Digest::SHA256.new)\n hm << self.key\n hm << timestamp\n hm << self.sequence.to_s\n hm << nonce.to_s\n hm << body\n signature = Base64.urlsafe_encode64(hm.digest)\n\n return signature, nonce, timestamp\n end", "def signature_helper(params, secret) # :nodoc:\n args = []\n params.each{|k,v| args << \"#{k}=#{v}\"}\n sortedArray = args.sort\n requestStr = sortedArray.join(\"\")\n return Digest::MD5.hexdigest(\"#{requestStr}#{secret}\")\n end", "def gen_signature(handler_path, req_msg, nonce)\n message = \"#{handler_path}|#{req_msg}|#{nonce}\"\n OpenSSL::HMAC.hexdigest(\"SHA512\", api_key, message)\n end", "def generate_signature(base_string)\n key = OpenSSL::HMAC.digest('sha1', client_secret, base_string)\n CGI::escape(Base64.encode64(key).chomp)\n end", "def signature_params\n params.require(:signature).permit(:signorityId, :userId, :value, :encryptedPublicKey, :signatureDate)\n\n end", "def generate_oauth_signature(endpoint, requestify)\n base_sig = \"POST&\" + CGI.escape(@base_url + endpoint).gsub(\"+\", \"%20\") + \"&\" + CGI.escape(requestify).gsub(\"+\", \"%20\")\n digest = OpenSSL::Digest::Digest.new('sha1')\n oauth_sig = OpenSSL::HMAC.digest(digest, @consumer_secret + \"&\", base_sig )\n oauth_sig = Base64.encode64( oauth_sig ).chomp.gsub(/\\n/,'') # eg 2j16OUZpkwcj9oogIIPgIJhOI4Q=\n oauth_sig = oauth_sig.gsub(\"=\", \"%3D\")\n oauth_sig = oauth_sig.gsub(\"+\", \"%2B\") # eg OTg2N2I2YWIxZWFhOGNmNGYwNWM1Y2NkMTM1Mzc0YjFlMWE4MjE0Zg%3D%3D\n oauth_sig = \"?oauth_signature=\" + oauth_sig \n return oauth_sig \n end", "def signature_for(data, secret)\n Base64.encode64(hmac_sha256(data, secret)).strip\n end", "def create_signatures_with_http_info(request)\n raise ArgumentError, 'Incorrect request type' unless request.is_a? CreateSignaturesRequest\n\n @api_client.config.logger.debug 'Calling API: SignApi.create_signatures ...' if @api_client.config.debugging\n # verify the required parameter 'sign_settings' is set\n raise ArgumentError, 'Missing the required parameter sign_settings when calling SignApi.create_signatures' if @api_client.config.client_side_validation && request.sign_settings.nil?\n # resource path\n local_var_path = '/signature/create'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(request.sign_settings)\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n header_params: header_params,\n query_params: query_params,\n form_params: form_params,\n body: post_body,\n access_token: get_access_token,\n return_type: 'SignResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called:\n SignApi#create_signatures\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n [data, status_code, headers]\n end", "def sign!\n @signed_date_time = Time.now.utc.strftime('%Y-%m-%dT%H:%M:%SZ')\n @signature = Cybersource::Security.generate_signature(signed_data)\n\n self\n end", "def generate_signature_base_string(method, url, params, get_post_params = {})\n normalized_url = normalize_url(url)\n normalized_params = normalize_request_param(params, get_post_params)\n return method + \"&\" + normalized_url.urlencode + \"&\" + normalized_params.urlencode\n end", "def signature\n subject = self.class.sig_subject([@payload,\n DATA_TYPE,\n ENCODING,\n ALGORITHM])\n @rsa_pkey.sign(DIGEST, subject)\n end", "def start\n # Get the parameters for this signature (received from the POST call via\n # AJAX, see batch-signature-form.js).\n id = params[:id]\n \n # Get an instantiate of the PadesSignatureStarter class, responsible for\n # receiving the signature elements and start the signature process.\n signature_starter = RestPki::PadesSignatureStarter.new(get_rest_pki_client)\n \n # Set signature policy.\n signature_starter.signature_policy_id = RestPki::StandardSignaturePolicies::PADES_BASIC\n \n # Set the security context to be used to determine trust in the certificate\n # chain. We have encapsulated the security context choice on util.rb.\n signature_starter.security_context_id = get_security_context_id\n\n # Set the visual representation for the signature.\n signature_starter.visual_representation = get_visual_representation\n \n # Set the PDF to be signed.\n signature_starter.set_pdf_tosign_from_path(get_batch_doc_path(id))\n \n # Call the start_with_webpki method, which initiates the signature. This\n # yields the token, a 43-character case-sensitive URL-safe string, which\n # identifies this signature process. We'll use this value to call the\n # sign_with_restpki method on the Web PKI component (see signature-form.js)\n # and also to complete the signature after the form is submitted (see method\n # create below). This should not be mistaken with the API access token.\n @token = signature_starter.start_with_webpki\n\n # The token acquired above can only be used for a single signature attempt.\n # In order to retry the signature it is necessary to get a new token. This\n # can be a problem if the user uses the back button of the browser, since\n # the browser might show a cached page that we rendered previously, with a\n # now stale token. To prevent this from happening, we call the method\n # set_expired_page_headers, located in application_helper.rb, which sets\n # HTTP headers to prevent caching of the page.\n set_expired_page_headers\n\n render json: \"\\\"#{@token}\\\"\"\n end", "def api_sig(params)\n sigstr = @shared_secret\n params.keys.sort { |x, y| x.to_s <=> y.to_s }.each do |k|\n sigstr += k.to_s\n sigstr += params[k].to_s\n end\n Digest::MD5.hexdigest(sigstr)\n end", "def signature\n @request.env['HTTP_X_HUB_SIGNATURE'.freeze].to_s\n end", "def sign(opts = {})\n params = {\n secret: client_secret,\n tx_json: {\n 'TransactionType' => opts[:transaction_type] || 'Payment',\n 'Account' => client_account,\n 'Destination' => opts[:destination],\n 'Amount' => opts[:amount]\n }\n }\n if opts.key?(:SendMax) and opts.key?(:Paths)\n # Complex IOU send\n params[:tx_json]['SendMax'] = opts[:SendMax]\n params[:tx_json]['Paths'] = opts[:Paths]\n end\n if opts.key?(:DestinationTag)\n params[:tx_json]['DestinationTag'] = opts[:DestinationTag]\n end\n if opts.key?(:InvoiceID)\n params[:tx_json]['InvoiceID'] = opts[:InvoiceID]\n end\n post(:sign, params)\n end", "def calculate_signature api_private_key, rndguid, current_time\n\n # concatenate the random GUID to the end of the timestamp - the result should look like this:\n string_to_sign = current_time + rndguid\n\n # Use the api private key to create a SHA256 hash and Base64 encode the whole thing\n signature = Digest::HMAC.base64digest(string_to_sign, api_private_key, Digest::SHA256)\n\nend", "def sign_key; end", "def swf_generated_signature(policy)\n return signature = Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest::Digest.new('sha1'),\n swf_secret_access_key, policy)).gsub(\"\\n\",\"\")\n end", "def sign(req, ts)\n md5_salt = \"ifxy8jvzf1q0f9uz\"\n body = \"#{CGI.escape(req)}#{ts}#{md5_salt}\"\n # md5.update body.upcase\n sign = Digest::MD5.hexdigest body\n sign.upcase\nend", "def s3_upload_signature\n signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), CONFIG['secret_access_key'], s3_upload_policy_document)).gsub(\"\\n\",\"\")\n end", "def generate\n data = flatten(stringify_keys(@params)).join\n digest = OpenSSL::Digest::Digest.new(\"sha1\")\n Base64.encode64(OpenSSL::HMAC.digest(digest, @auth_token, \"#{@url}#{data}\")).strip\n end", "def sign_payload(request_body = '')\n payload = \"#{request_body}#{shared_secret}\"\n Digest::SHA256.base64digest(payload)\n end", "def signature(key)\n Digest::SHA1.hexdigest(\"#{key}#{Config.secret}\")[0...8]\n end", "def sign(payload)\n payload = payload.merge({\n :client_id => @client_id,\n :client_secret => @client_secret,\n })\n\n scope = create_scope\n context = create_context(payload)\n s2s = create_string_to_sign(scope, context)\n signing_key = get_signing_salt\n OpenSSL::HMAC.hexdigest(@hash_algo, signing_key, s2s)\n end", "def finish_and_sign_request(request)\n request.headers[\"Date\"] = Time.now.utc.httpdate\n request.headers[\"Authorization\"] =\n \"AWS #{self.access_key}:#{Base64.encode64(build_signature_for(request)).chomp}\"\n\n request\n end", "def api_signature\n ts = timestamp\n [\n Rackspace::Email::Api.configuration.user_key,\n ts,\n hash(ts)\n ].join(':')\n end", "def encode_and_sign_to_http_request(request, signing_secret)\n authorization_info_b64 = Base64.strict_encode64(as_json)\n request.headers[ASSERTION_HEADER_NAME] = authorization_info_b64\n signature = OpenSSL::HMAC.digest(\"SHA256\", signing_secret, authorization_info_b64)\n request.headers[SIGNATURE_HEADER_NAME] = Base64.strict_encode64(signature)\n end", "def s3_upload_signature\n signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), Figaro.env.aws_secret_access_key, s3_upload_policy_document)).gsub(\"\\n\",\"\")\n end", "def sign_request(options, authorize = true)\n options.merge!(:auth_token => self.auth.token(false).to_s, :api_key => @api_key) if authorize and self.auth.token(false)\n options.delete(:api_sig)\n options.merge!(:api_sig => Digest::MD5.hexdigest(@api_secret + options.to_a.sort_by{|k| k[0].to_s}.flatten.join)) if @api_secret\n end", "def compute_signature(env)\n message = BuildMessage.new(env).build!\n HmacSignature.new(shared_key(env), message).sign\n end", "def sign_payload(request_body = '')\n payload = \"#{request_body}#{shared_secret}\"\n ::Digest::SHA256.base64digest(payload)\n end", "def signature\n @signature || ''\n end", "def s3_upload_signature\n signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), SITE['s3_access_key'], s3_upload_policy_document)).gsub(\"\\n\",\"\")\n end", "def signature_key=(_arg0); end", "def query_string_sig2\n @query_elements['Timestamp']= Time::at(Time.now).utc.strftime(\"%Y-%m-%dT%H:%M:%S.000Z\") unless @query_elements['Timestamp']\n @query_elements['AWSAccessKeyId']= @credentials.accessID\n signature_method= @query_elements['SignatureMethod']\n if @query_elements['_omit']\n @query_elements['_omit'].each do |k|\n @query_elements.delete k\n end\n @query_elements.delete '_omit'\n end\n values = @query_elements.keys.sort.collect {|key| [url_encode(key), url_encode(@query_elements[key])].join(\"=\") }\n @canonical_querystring= values.join(\"&\")\n @string_to_sign = <<\"____\".rstrip\nGET\n#{URI::parse(endpoint).host}\n#{URI::parse(endpoint).path}\n#{@canonical_querystring}\n____\n signature= @credentials.sign(signature_method,@string_to_sign)\n @query_elements['Signature'] = signature\n @query_elements.collect { |key, value| [url_encode(key), url_encode(value)].join(\"=\") }.join('&') # order doesn't matter for the actual request\n end", "def digest\n case @signature_method\n when \"HMAC-SHA256\" then OpenSSL::Digest.new(\"sha256\")\n when \"HMAC-SHA1\" then OpenSSL::Digest.new(\"sha1\")\n else\n fail InvalidSignatureMethodError\n end\n end", "def signature(params)\n string_to_sign =\n<<-DATA\n#{params[:method].to_s.upcase}\n#{params[:headers]['Canonical-URI']}\n#{params[:headers]['Canonical-QueryString']}\n#{params[:headers]['Canonical-Headers']}\n#{params[:headers]['Signed-Headers']}\n#{params[:headers]['Hex-Encode-Hash-Payload']}\nDATA\n\n amz_headers, canonical_amz_headers = {}, ''\n for key, value in params[:headers]\n if key[0..5] == 'x-amz-'\n amz_headers[key] = value\n end\n end\n amz_headers = amz_headers.sort {|x, y| x[0] <=> y[0]}\n for key, value in amz_headers\n canonical_amz_headers << \"#{key}:#{value}\\n\"\n end\n string_to_sign << canonical_amz_headers\n\n subdomain = params[:host].split(\".#{@host}\").first\n unless subdomain =~ /^(?:[a-z]|\\d(?!\\d{0,2}(?:\\.\\d{1,3}){3}$))(?:[a-z0-9]|\\.(?![\\.\\-])|\\-(?![\\.])){1,61}[a-z0-9]$/\n # TODO: err..... not sure if this is needed\n Fog::Logger.warning(\"fog: the specified glacier vault name(#{subdomain}) is not a valid dns name, which will negatively impact performance. For details see: http://docs.amazonwebservices.com/AmazonS3/latest/dev/BucketRestrictions.html\")\n params[:host] = params[:host].split(\"#{subdomain}.\")[-1]\n if params[:path]\n params[:path] = \"#{subdomain}/#{params[:path]}\"\n else\n params[:path] = subdomain\n end\n subdomain = nil\n end\n\n canonical_resource = @path.dup\n unless subdomain.nil? || subdomain == @host\n canonical_resource << \"#{Fog::AWS.escape(subdomain).downcase}/\"\n end\n canonical_resource << params[:path].to_s\n canonical_resource << '?'\n# TODO: all these keys need to change to reflect glacier\n for key in (params[:query] || {}).keys.sort\n if %w{\n acl\n lifecycle\n location\n logging\n notification\n partNumber\n policy\n requestPayment\n response-cache-control\n response-content-disposition\n response-content-encoding\n response-content-language\n response-content-type\n response-expires\n torrent\n uploadId\n uploads\n versionId\n versioning\n versions\n website\n }.include?(key)\n canonical_resource << \"#{key}#{\"=#{params[:query][key]}\" unless params[:query][key].nil?}&\"\n end\n end\n canonical_resource.chop!\n string_to_sign << canonical_resource\n\n signed_string = @hmac.sign(string_to_sign)\n Base64.encode64(signed_string).chomp!\n end", "def signer\n end", "def sign(method=\"GET\", path=\"/\", parameters={})\n # add special oauth parameters to the incoming parameter hash map\n parameters.merge!({\n oauth_consumer_key: service_consumer_key,\n oauth_version: OAUTH_VERSION,\n oauth_signature_method: SIGNATURE_ALGORITHM,\n oauth_timestamp: nonce_timestamp,\n oauth_nonce: nonce\n })\n #puts parameters.parameter_string\n to_sign_string = \"#{method}&#{e NETFLIX_URL}#{e path}&#{e parameters.parameter_string}\"\n #puts \".OAuth Base String: \"+to_sign_string\n signature = Base64.encode64(HMAC::SHA1.digest(\"#{service_shared_secret}&\", to_sign_string))\n parameters[:oauth_signature] = e signature\n end", "def sign_request(options)\n options.merge!(:pub => @api_key)\n options.merge!(:key => Digest::MD5.hexdigest(@api_secret + @api_key))\n end", "def generate_api_sig(options={})\n # Every request requires the api_key parameter\n options.merge! @auth\n # Keys must be sorted alphabetically\n api_sig = options.sort { |a, b| a.to_s <=> b.to_s }.join\n Digest::MD5.hexdigest(\"#{@secret}#{api_sig}\")\n end", "def get_sig(access_token)\n\t\tmethod_str = 'application_key=' + @options['application_key'] + 'method=users.getCurrentUser'\n\t\tDigest::MD5.hexdigest(method_str + Digest::MD5.hexdigest(access_token + @options['client_secret']))\n\tend", "def signature\n OpenSSL::HMAC.hexdigest('sha1', Redtail.config.sentry_key, \"#{@timestamp} #{@message}\")\n end", "def sign(private_key)\n # Our multiline hash for authorization will be encoded in multiple header\n # lines - X-Ops-Authorization-1, ... (starts at 1, not 0!)\n header_hash = {\n \"X-Ops-Sign\" => SIGNING_DESCRIPTION,\n \"X-Ops-Userid\" => user_id,\n \"X-Ops-Timestamp\" => canonical_time,\n \"X-Ops-Content-Hash\" => hashed_body,\n }\n\n string_to_sign = canonicalize_request\n signature = Base64.encode64(private_key.private_encrypt(string_to_sign)).chomp\n signature_lines = signature.split(/\\n/)\n signature_lines.each_index do |idx|\n key = \"X-Ops-Authorization-#{idx + 1}\"\n header_hash[key] = signature_lines[idx]\n end\n \n Mixlib::Authentication::Log.debug \"String to sign: '#{string_to_sign}'\\nHeader hash: #{header_hash.inspect}\"\n \n header_hash\n end", "def sign_request(json_req)\n if crypto_enabled? and not @secret_key.nil? then\n return Bixby::SignedJsonRequest.new(json_req, @access_key, @secret_key)\n end\n return json_req\n end", "def sign(request, signer)\n signature = signer.sign(request.method, request.uri, request.headers)\n request.headers[\"Authorization\"] = \"#{signer.name} #{account_name}:#{signature}\"\n request\n end", "def s3_upload_signature\n\t signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), YOUR_SECRET_KEY, s3_upload_policy_document)).gsub(\"\\n\",\"\")\n\t end", "def create_signatures(request)\n data, _status_code, _headers = create_signatures_with_http_info(request)\n data\n end", "def s3_upload_signature\n Base64.encode64(OpenSSL::HMAC.digest(\n OpenSSL::Digest::Digest.new('sha1'),\n @current_shard.amazon_setting.secret_access_key,\n s3_upload_policy_document)\n ).gsub(/\\n|\\r/, \"\")\n end", "def signature\n encode_tz(:edsig, 64)\n end", "def sign(params)\n Digest::MD5::hexdigest(wrap_with_secret sorted_option_string(params)).upcase\n end", "def generate!\n raise ArgumentMissingError unless has_all_required_inputs?\n payload = Base64.urlsafe_encode64(data.to_json).gsub(/[\\=\\n]/, '')\n signature = Base64.urlsafe_encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest.new('sha256'),\n secret,\n HEADER + '.' + payload\n )\n ).strip.gsub(/[\\=\\n]/, '')\n [HEADER, payload, signature].join('.')\n end" ]
[ "0.74859357", "0.73974746", "0.73694193", "0.735339", "0.71743894", "0.7172763", "0.6953532", "0.6799274", "0.6791234", "0.6732178", "0.6723466", "0.67228794", "0.6680614", "0.6646588", "0.6603755", "0.65994126", "0.6558189", "0.6557101", "0.6551077", "0.65433097", "0.65416896", "0.6526516", "0.65241617", "0.6510682", "0.65058255", "0.649726", "0.6488037", "0.64836484", "0.64821285", "0.6462656", "0.6409596", "0.63886636", "0.6372152", "0.6356879", "0.6332953", "0.63305044", "0.6325931", "0.63184386", "0.63113135", "0.63113135", "0.6299018", "0.6279804", "0.62793815", "0.6275528", "0.6273086", "0.6266502", "0.6266502", "0.62576514", "0.62533563", "0.6234615", "0.62330335", "0.6231663", "0.62226576", "0.62214863", "0.6218353", "0.6205471", "0.6196357", "0.61791056", "0.6147112", "0.613471", "0.61284393", "0.61273694", "0.6103654", "0.61005676", "0.6099285", "0.6096963", "0.6094459", "0.60941386", "0.609368", "0.6077768", "0.60715985", "0.6065946", "0.6063151", "0.6060963", "0.60483783", "0.6047579", "0.6042506", "0.6042288", "0.6039681", "0.60387504", "0.6037441", "0.6037357", "0.60260206", "0.6015543", "0.6012444", "0.6005701", "0.5996414", "0.5987626", "0.5977026", "0.59683734", "0.5966897", "0.5965768", "0.5955478", "0.5954372", "0.59512275", "0.59240735", "0.59224105", "0.5921895", "0.59208053", "0.5917776" ]
0.6041949
78
Send a manual request for the currently prepared transaction. This is an alternative to the normal view helper and is useful for special types of transaction.
def send_transaction body = merchant_parameters_base64_json headers = { } headers['Content-Length'] = body.size.to_s headers['User-Agent'] = "Active Merchant -- http://activemerchant.org" headers['Content-Type'] = 'application/x-www-form-urlencoded' # Return the raw response data ssl_post(Sermepa.operations_url, "entrada="+CGI.escape(body), headers) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_transaction(tx)\n sendrawtransaction(tx)\n end", "def transaction_request(transaction,total=nil)\n transaction_request = Cielo::TransactionRequest.new\n resul = send_request(transaction_request.serialize(transaction))\n end", "def set_txn\n @transaction = Txn.find(params[:id])\n end", "def transaction\n start_transaction\n\n yield\n ensure\n end_transaction if transaction_started?\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n check_admin\n end", "def set_transaction\n @transaction = Transaction.find_by(\n id: params[:id],\n user_id: current_user.id\n )\n\n return unless @transaction.nil?\n current_user.errors.add :authorization, 'Not Authorized'\n render_json_api_error(current_user, :unauthorized)\n end", "def set_transaction_request\n @transaction_request = TransactionRequest.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.includes(:period, :budget).where(periods: { budgets: { user: current_user }}).find(params[:transaction_id] || params[:id])\n end", "def to_raw_tx\n connection.request self.class.to_create_request, to_params\n end", "def gettransaction(txid)\n request :gettransaction, txid\n end", "def transaction_with_http_info(txid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.transaction ...'\n end\n # verify the required parameter 'txid' is set\n if @api_client.config.client_side_validation && txid.nil?\n fail ArgumentError, \"Missing the required parameter 'txid' when calling DefaultApi.transaction\"\n end\n # resource path\n local_var_path = '/api/v1/transaction'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'txid'] = txid\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', 'application/xml', ])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Transaction' \n\n # auth_names\n auth_names = opts[:auth_names] || []\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#transaction\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def display_transactions_request_screen\n\n end", "def in_transaction(opts = {})\n yield\n end", "def method_missing(*args)\n @real_txn.send(*args)\n end", "def set_transaction\n @transaction = ItemTransaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def get_transaction(id)\n submit GetTransaction.new(:transaction_id => id)\n end", "def set_transaction\n @transaction = current_user.transactions.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def show\n transaction = Transaction.find(params[:id])\n @transaction = transaction.true_for_global(@global_company, current_user) ? transaction : not_found\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transaction }\n end\n end", "def set_transaction\n if params[:id].nil?\n @transaction = Transaction.find(params[:id])\n end\n end", "def set_automated_transaction\n @automated_transaction = AutomatedTransaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def auto_transaction(run_with_auto_tx)\n @auto_transaction = run_with_auto_tx\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n set_budget\n end", "def set_transaction\n @transaction = @account.transactions.find(params[:id])\n end", "def transaction_raw_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.transaction_raw ...'\n end\n # resource path\n local_var_path = '/api/v2/transaction/raw'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'txid'] = opts[:'txid'] if !opts[:'txid'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', ])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Object' \n\n # auth_names\n auth_names = opts[:auth_names] || []\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#transaction_raw\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def transaction(&block)\n block.call\n end", "def get_transaction(*params); raise('Stub or mock required.') end", "def getrawtransaction(txid, verbose = 0)\n @api.request 'getrawtransaction', txid, verbose\n end", "def getrawtransaction(txid, verbose = 0)\n @api.request 'getrawtransaction', txid, verbose\n end", "def show\n render_success_response({\n transaction: single_serializer.new(@transaction, serializer: TransactionSerializer)\n })\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 transaction(tx_hash)\n call :get, \"/tx/#{tx_hash}\"\n end", "def update\n if @transaction_request.update(transaction_request_params)\n render :show, status: :ok, location: @transaction_request\n else\n render json: @transaction_request.errors, status: :unprocessable_entity\n end\n end", "def to_transaction\n Client::Transaction.new(self).tap do |t|\n t.response = yield if block_given?\n end\n end", "def set_transaction\n @transaction = @transactions.find(params[:id])\n end", "def set_tx\n @tx = Tx.find(params[:id])\n end", "def send_transact_request(markup)\n response = send_request(markup,\n \"#{@transact_url}/XTMail#{@session_id}\",\n 'transact')\n REXML::Document.new(response)\n end", "def transaction(&blk)\n tap(&blk)\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n @selectiveCoins = Coin.get_selective_coins()\n end", "def within_transaction\n if use_transaction\n first.within_transaction do\n yield\n success?\n end\n else\n yield\n end\n end", "def gettransaction(txid)\n @api.request 'gettransaction', txid\n end", "def gettransaction(txid)\n @api.request 'gettransaction', txid\n end" ]
[ "0.6071131", "0.5830867", "0.5824561", "0.5767469", "0.57332784", "0.572174", "0.5710437", "0.5682048", "0.5644431", "0.5639744", "0.56050134", "0.5590872", "0.55596596", "0.55311394", "0.5530475", "0.5521963", "0.5521963", "0.5521963", "0.5521963", "0.5521963", "0.5521963", "0.5521963", "0.5521963", "0.5521963", "0.55101854", "0.5499932", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.54617715", "0.5460321", "0.54587024", "0.5458318", "0.545319", "0.5449821", "0.54407287", "0.5434786", "0.54318887", "0.5425264", "0.54236114", "0.54068786", "0.5402105", "0.5402105", "0.5397942", "0.53908676", "0.53839225", "0.53535867", "0.5346014", "0.53341925", "0.53294015", "0.5322333", "0.53166306", "0.5314781", "0.5301502", "0.5297147", "0.5297147" ]
0.0
-1
Authenticates a user by their login name and unencrypted password. Returns the user or nil. uff. this is really an authorization, not authentication routine. We really need a Dispatch Chain here or something. This will also let us return a human error message. def self.authenticate(login, password) return nil if login.blank? || password.blank? u = find_by_login(login) need to get the salt u && u.authenticated?(password) ? u : nil end
def login=(value) write_attribute :login, (value ? value.downcase : nil) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate(login, password)\n u = find_by_login(login) # need to get the salt\n u && u.authenticated?(password) ? u : nil\n end", "def authenticate(login, password)\n u = users.query_for_authenticate(login).as(entity).one\n App.logger.debug \"RW users-repo.authenticate, user: #{u}\"\n if u && u.authenticate(password)\n # This bit clears a password_reset_code (this assumes it's not needed, cuz user just authenticated successfully).\n (u.password_reset_code = nil; u.save) if u.password_reset_code\n u\n else\n nil\n end\n end", "def authenticate(login, password)\n u = find(:first, :conditions => [\"#{@login_attr} = ?\", login]) # need to get the salt\n \n if u && u.authenticated?(password)\n u.last_login_at = Time.now and u.save if u.respond_to?(:last_login_at)\n u\n else\n nil\n end\n end", "def authenticate(login, password)\n u = find_in_state :first, :active, \n :conditions => [\"admin_users.login = ? OR admin_users.email = ?\", login, login]\n u && u.authenticated?(password) ? u : nil\n end", "def authenticate(username, password)\n if user = find_by_username(username)\n if user.correct_password?(password)\n user\n end\n end\n end", "def authenticate(username, password)\n user = find_user(username)\n hash = BCrypt::Password.new(user.password) rescue nil\n (hash && hash == password) ? user : nil\n 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(username, password)\n a = self.find_by_username username\n return if a.nil?\n\n if defined? ldap_auth\n if a.ldap_auth then\n dn = ''\n ldap = Net::LDAP::new(:host => 'localhost', :base => 'dc=cmteknik,dc=se')\n filter = Net::LDAP::Filter.eq('uid', username)\n ldap.search(:filter => filter) { |entry| dn = entry.dn }\n ldap.auth(dn, password)\n if ldap.bind then\n return a\n else\n return nil\n end\n end\n end\n \n hash = Digest::SHA1.hexdigest(password || \"\")\n\n if hash == a.hashed_password then\n return a\n else\n return nil\n end\n end", "def authenticate!\n user = connection.authenticate!(credentials_hash)\n\n if user\n success!(user)\n else\n fail!('Could not log in')\n end\n rescue Net::LDAP::LdapError\n fail!('Could not log in')\n end", "def authenticate!(login, password, group_names = nil)\n user = valid_login?(login, password)\n\n return user if user && is_member?(user.dn, group_names)\n end", "def authenticate(username, password)\n return unless username && password\n password = Vines::Kit.hmac(password, username)\n user = find_user_by_jid(username)\n (user && user.password == password) ? user : nil\n end", "def authenticate(login, password)\n user = @user_mapper.find_by_username(login)\n unless user && user.correct_password?(password)\n raise AccessDeniedException, \"Username and password incorrect\"\n end\n\n # Upgrade to bcrypt whenever a user logs in\n unless user.using_bcrypt?\n # upgrade_password! needs the plaintext password\n user.password = password\n user.upgrade_password!\n @user_mapper.update(user)\n end\n\n user.for_json\n end", "def authenticate_user(username,password)\n User.authenticate(username,password)\n end", "def authenticate_user(username,password)\n User.authenticate(username,password)\n end", "def authenticate(login, password)\n return nil if login.blank? || password.blank?\n\n logger.debug \"LDAP-Auth with User #{effective_user(login)}\"\n # first, search for User Entries in LDAP\n entry = search_for_user_entries(login, password)\n return nil unless entry.is_a?(Net::LDAP::Entry)\n\n # extract attributes\n attrs = attributes_values(entry)\n\n # not sure if there is a case were search result without a DN\n # but just to be on the safe side.\n if (dn=attrs.delete(:dn)).empty?\n logger.warn \"no DN\"\n return nil\n end\n\n logger.debug \"DN found for #{login}: #{dn}\"\n\n # finally, authenticate user\n ldap_con = initialize_ldap_con(dn, password)\n unless ldap_con.bind\n logger.warn \"Result: #{ldap_con.get_operation_result.code}\"\n logger.warn \"Message: #{ldap_con.get_operation_result.message}\"\n logger.warn \"Failed to authenticate #{login}\"\n return nil\n end\n # return user's attributes\n logger.debug \"Retrieved LDAP Attributes for #{login}: #{attrs}\"\n attrs\n rescue Net::LDAP::LdapError => text\n raise \"LdapError: %s\" % text\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 authenticate(username_or_email, password)\n user = PublicEarth::Db::User.new\n if username_or_email.blank?\n user.errors.add_to_base(\"NO_USERNAME\")\n elsif password.blank?\n user.errors.add_to_base(\"NO_PASSWORD\")\n else\n existing = find_by_username_or_email(username_or_email)\n if existing\n if active?(existing.id)\n begin\n user.attributes = one.authenticate(username_or_email, password)\n user.authenticated = true\n rescue\n user.errors.add(:username, \"INVALID_PASSWORD\")\n end\n else\n user.errors.add_to_base(\"UNCONFIRMED\")\n end\n else\n user.errors.add_to_base(\"INVALID_ACCOUNT\")\n end\n end\n user\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 auth(login, passwd)\n @user = User.find_by_login(login) \n if @user.passwd == encrypt(passwd, @user.salt) \\\n and @user.userstatus_id == 2\n return @user \n end\n end", "def authenticate(*credentials, &block)\n raise ArgumentError, 'at least 2 arguments required' if credentials.size < 2\n\n if credentials[0].blank?\n return authentication_response(return_value: false, failure: :invalid_login, &block)\n end\n\n if @sorcery_config.downcase_username_before_authenticating\n credentials[0].downcase!\n end\n\n user = sorcery_adapter.find_by_credentials(credentials)\n\n unless user\n return authentication_response(failure: :invalid_login, &block)\n end\n\n set_encryption_attributes\n\n if user.respond_to?(:active_for_authentication?) && !user.active_for_authentication?\n return authentication_response(user: user, failure: :inactive, &block)\n end\n\n @sorcery_config.before_authenticate.each do |callback|\n success, reason = user.send(callback)\n\n unless success\n return authentication_response(user: user, failure: reason, &block)\n end\n end\n\n unless user.valid_password?(credentials[1])\n return authentication_response(user: user, failure: :invalid_password, &block)\n end\n\n authentication_response(user: user, return_value: user, &block)\n end", "def authenticate(email, password)\n user = User.find_for_authentication(email: email)\n user.try(:valid_password?, password) ? user : nil\n end", "def username_password_authenticate(username, password)\n user = nil\n\n # NOTE: We need to uppercase the username as back office is case sensitive\n call_ok?(:authenticate_user, Username: username.upcase, Password: password) do |body|\n user = from_backoffice body, username\n end\n\n user\n end", "def perform\n u = User.find_by(username: @username)\n return u if u.try(:authenticate, @password)\n nil\n end", "def authenticate(username, password)\n Base.authenticate(username, password)\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 authenticate!\n if params.has_key?(:login)\n # The user is attempting to authenticate via params. Ignore the current user.\n user = User.authenticate(params[:login], params[:password])\n if user\n sign_in(user)\n else\n unless current_user\n if Rails.env.production?\n # display a cryptic 404\n render_404\n else\n render(:text => \"Authenticating via params failed\", :status => :unauthorized)\n end\n end\n end\n else\n # Try the current user.\n unless current_user\n if Rails.env.production?\n render_404\n else\n render(:text => \"No session, no authentication params\", :status => :unauthorized)\n end\n end\n end\n end", "def authenticate(email_or_username, password)\n return nil if email_or_username.blank?\n member = find_by_email_or_username(email_or_username)\n if member && member.password == password\n return member\n else\n return nil\n end\n end", "def authenticate\n if session[:account].blank?\n @is_login = false\n reset_session\n render \"login/error\"\n else\n @is_login = true\n @user = User.where( \"account = ?\", session[:account] )[0]\n end\n end", "def authenticate(name_or_email, password)\n m = active.find_by_email(name_or_email)\n m = active.find_by_name(name_or_email) unless m \n m && m.authenticated?(password) ? m : nil\n end", "def authenticate(*args)\n authenticate!(*args)\n rescue\n nil\n end", "def login(name_or_email, plain_password)\n name_or_email.downcase! # \n if name_or_email.include?(\"@\")\n user = User.find_by_email(name_or_email)\n else\n user = User.find_by_username(name_or_email)\n end\n if user == nil || user.password != plain_password || !user.validated\n user = nil\n end\n return user\nend", "def authenticate(user, password)\n @user = user\n @password = password\n begin\n client = self['login/authenticate']\n client[\"?username=#{@user}&password=#{@password}\"].get\n @auth = true\n rescue RestClient::Unauthorized, RestClient::RequestFailed\n @auth = false\n @user = @password = nil\n end\n\n return @auth\n end", "def authenticate(password)\n user && user.password == password\n end", "def authenticate!\n user = User.where(email: params[\"email\"]).first\n if user && user.authenticate(params[\"password\"])\n success!(user)\n else\n fail!(\"Could not log in\")\n end \n end", "def authenticate(email, password)\n # Because we use bcrypt we can't do this query in one part, first\n # we need to fetch the potential user\n user = User.find_by(email: email)\n\n if user\n # Then compare the provided password against the hashed one in the db.\n if BCrypt::Password.new(user.password).is_password? password\n # If they match we return the user\n return user\n end\n end\n # If we get here it means either there's no user with that email, or the wrong\n # password was provided. But we don't want to let an attacker know which.\n return nil\n end", "def authenticate_user(username, password, user_list)\n user_list.each do |user|\n if user[:username] == username && verify_hash_digest(user[:password]) == password\n return user\n end\n end\n \"Credentials were not correct\"\n end", "def op_authenticate(username, password)\n return 'nvu' unless valid?\n\n unless authentication_valid?(username, password)\n log \"Authentication failed for user #{username}\"\n @ticket.update!(username: username, state: 'Finished', last_error: @last_log_message)\n return 'nvu' # not valid user\n end\n\n if has_work?\n log \"Authentication successful. Reporting to QuickBooks that there is work to be done.\"\n @ticket.update!(username: username, state: 'Authenticated')\n '' # \"Any other string value = use this name for company file\"\n else\n log \"Authentication successful, but there is no work to be done\"\n @ticket.update!(username: username, state: 'Finished')\n 'none'\n end\n end", "def authenticate(username, password)\n end", "def login_from_params\n User.authenticate(params[:login], params[:password])\n end", "def authenticate_user(username, password, list_of_users)\n list_of_users.each do |user_record|\n if user_record[:username] == username && verify_hash_digest(user_record[:password]) == password\n return user_record\n end\n puts \"Credentials are not correct\"\n end\n end", "def call\n user = User.find_by_username(username)\n return user if user && user.authenticate(password_digest)\n \n errors.add :customer_authentication, 'invalid credentials'\n nil\n end", "def auth(cl)\n\t\tuser = cl.find_by_login(params[:login])\n\t\tif user.try(:authenticate, params[:pass])\n\t\t\tres payload(user)\n\t\telse\n\t\t\terr 'invalid_credentials', 'Invalid Username/Password', :unauthorized\n\t\tend\n\tend", "def login\n \tauthenticate(params)\n end", "def authenticate(email, password)\n user = User.find_by_email(email) #find user exist in db\n return user if user && user.password == password #authenticate pwd\n nil\n end", "def authenticate(username, user_password)\n data_arr = load_data\n user_data(data_arr, username, user_password)\n end", "def authenticate(user, password, account)\n user == @user &&\n (password.nil? || password == @password) &&\n (account.nil? || account == @account)\n end", "def authenticate?(email, password)\n user = User.find_by_email email\n return nil if user.nil?\n return user if user.has_password?(password)\n end", "def authenticate!\n unless params[:user].nil?\n init_local_admin\n my_username = params[:user][:username].strip\n my_password = params[:user][:password].strip\n user = User.find_by_username(my_username)\n if my_username == @local_admin[\"username\"] && my_password == @local_admin[\"password\"]\n # Local admin authentication\n if user.nil?\n user= User.new(:username => @local_admin[\"username\"], :email=>@local_admin[\"email\"], :password => @local_admin[\"password\"], \\\n :password_confirmation => @local_admin[\"password\"], :role => 0)\n user.save!\n end\n user = User.find_by_username(my_username)\n success!(user)\n elsif user && user.valid_password?(my_password) # Local user database authentication\n success!(user)\n else\n fail(\"User name or password invalid \")\n end\n else\n fail\n end\n end", "def auth_password username, password\n user = User.find_by_username username\n return nil unless (user and user.password_digest)\n if user.password == password\n return user\n else\n return nil\n end\n end", "def authenticate(email, password)\n u = first(:email => email)\n u && u.activated? && u.authenticated?(password) ? u : nil\n end", "def authenticate(user_name, password)\n options = {}\n options[:Username] = user_name\n options[:Password] = password\n\n response = self.class.post('/', :body => self.class.build_XML_request('Auth.Authenticate', self, options))\n\n self.class.response_valid? response\n if response['YourMembership_Response']['Auth.Authenticate']\n get_authenticated_user\n else\n false\n end\n end", "def authenticate(username,password)\n user = @@users_module.lookup_user(username)\n return false if not user\n salt=user['salt']\n hashpass=Digest::SHA256.hexdigest(salt + password)\n if(hashpass == user['password'])\n return true\n end\n return false\n end", "def authenticate(unencrypted_password)\n\t\tif BCrypt::Password.new(self.password_digest) == unencrypted_password\n\t\t\t# return the entire user object\n\t\t\treturn self\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def authenticate_user(username, password)\n api(\"AuthenticateUser\", username, password)\n end", "def authenticate(passwd)\n User.password_hash(passwd.to_s, salt) == password ? self : false\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(username, password)\n @username = username\n @password = password\n end", "def authenticate\n\t\t@authenticatedUser = User.where(:name => params[:user][:Name],:password => params[:user][:Password]).first\n\n\t\t@user = User.new(params[:user])\n\t\tfirst_time = false\n\n\t\tif (User.all.size == 0) && @authenticatedUser.nil? && params[:user][:Name] == \"admin\" && params[:user][:Password] == \"admin\"\n\t \t\t@authenticatedUser = User.new\n\t \t\tfirst_time = true\n\t \tend\n\n\t \tif (not @authenticatedUser.nil?) or first_time\n\t\t\tlogin_ok = is_admin(@authenticatedUser)\n\t\t\n\t\t\tif login_ok or first_time\n\t\t\t\tsession[:currentUser] = @authenticatedUser\n\t\t\t\tredirect_to :action => \"home\"\n\t\t\telse\n\t\t\t\tredirect_to '/login/index', :notice => 'Invalid username or password please try again.'\n\t\t\tend\n\t\telse\n\t\t\tredirect_to '/login/index', :notice => 'Invalid username or password please try again.'\n\t\tend\n\tend", "def authenticate\n auth.call(:authenticate)\n end", "def authenticate_signin\n\t Client.authenticate(params[:email], params[:password]) || render_unauthorized\n\t end", "def valid_login?(login, password)\n if user = user?(login) and auth(user, password)\n return user\n end\n end", "def login\n self.class.trace_execution_scoped(['Custom/login/find_user']) do\n @u = (User.find_by_primary_email(params[:username].downcase) || User.find_by_nickname(params[:username].downcase.to_s)) if params[:username]\n end\n\n self.class.trace_execution_scoped(['Custom/login/if_block']) do\n if @u and @u.has_password? and @u.valid_password?(params[:password])\n @user = @u\n elsif @u and (params[:password] == \"anonymous\") and (@u.user_type == User::USER_TYPE[:anonymous])\n @user = @u\n else\n query = {:auth_failure => 1, :auth_strategy => \"that username/password\"}\n query[:redir] = params[:redir] if params[:redir]\n redirect_to add_query_params(request.referer || Settings::ShelbyAPI.web_root, query) and return\n end\n end\n\n # any user with valid email/password is a valid Shelby user\n # this sets up redirect\n self.class.trace_execution_scoped(['Custom/login/sign_in_current_user']) do\n sign_in_current_user(@user)\n end\n redirect_to clean_query_params(@opener_location) and return\n end", "def login_from_params\n authenticate(params[:password])\n end", "def authenticate(username, password)\n auth_fail unless auth_ok?(username.intern, password.to_s)\n privileges_for(username.intern)\n end", "def authenticated_user\n user if valid? && user&.authenticated?(password)\n end", "def authenticate(unencrypted_password)\n \tif BCrypt::Password.new(self.password_digest) == unencrypted_password\n \t\treturn self\n \telse\n \t\treturn false\n \tend\n end", "def authenticate(unencrypted_password)\n \tif BCrypt::Password.new(self.password_digest) == unencrypted_password\n \t\treturn self\n \telse\n \t\treturn false\n \tend\n end", "def user\n user = User.find_by_email(email)\n return user if user&.authenticate(password)\n\n errors.add :user_authentication, 'invalid credentials'\n nil\n end", "def authenticate(unencrypted_password)\n logger.debug(unencrypted_password)\n logger.debug(self)\n if BCrypt::Password.new(self.password_digest) == unencrypted_password\n \t return self\n else\n return false\n end\n end", "def authenticate(username, password)\n username = JID.new(username).to_s rescue nil\n return if [username, password].any? {|arg| (arg || '').strip.empty? }\n\n ldap = connect(@config[:dn], @config[:password])\n entries = ldap.search(\n attributes: [@config[:name_attr], 'mail'],\n filter: filter(username))\n return unless entries && entries.size == 1\n\n user = if connect(entries.first.dn, password).bind\n name = entries.first[@config[:name_attr]].first\n User.new(jid: username, name: name.to_s, roster: [])\n end\n user\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 authenticate(username = nil, password = nil)\n @username = username\n @password = password\n response = self.request('login', :authenticate, {username: @username, password: @password})\n @token = response[:token]\n end", "def authenticate\n\t\t\tcred = env['HTTP_AUTHORIZATION']\n\t\t\treturn nil unless cred\n\t\t\tusername, password = basic_decode cred\n\t\t\treturn nil unless username && password\n\n\t\t\tModel::User.authenticate username, password\n\t\tend", "def authenticate\n @username = params[:username]\n @password = params[:password]\n user = User.find_by(username: @username)\n\n # NEED TO ADD THE PASSWORD VERIFICATION BACK IN\n if user && user.authenticate(@password)\n render json: { auth_token: user.generate_auth_token, user_id: user.id, user_name: user.name }\n else\n render json: { error: 'Invalid username or password' }, status: :unauthorized\n end\n end", "def authenticate?(name, password)\n user = get_user(name)\n\n return user && user.password == password\n end", "def auth(password)\r\n\t\treturn :empty_password if password_digest.nil?\r\n\r\n\t\treturn authenticate(password) ? :signed_in : :wrong_password\r\n\r\n\trescue BCrypt::Errors::InvalidHash\r\n\t\treturn :password_not_set\t\t\t\r\n\tend", "def authenticate!\n raise AuthenticationFailed if authentication.failed?\n raise AuthenticationRequired unless authentication.authenticated?\n end", "def authenticate( raw_vals )\n\n username = (raw_vals[:username] || raw_vals['username']).to_s.strip\n password = (raw_vals[:password] || raw_vals['password']).to_s.strip\n ip_addr = (raw_vals[:ip_address] || raw_vals['ip_address']).to_s.strip\n user_agent = (raw_vals[:user_agent] || raw_vals['user_agent']).to_s.strip\n \n ip_addr = nil if ip_addr.empty?\n user_agent = nil if user_agent.empty?\n\n if username.empty? || password.empty?\n raise Wrong_Password, \"#{raw_vals.inspect}\"\n end\n mem = Life.find.username( username ).grab(:owner).go_first!\n\n # Check for Password_Reset\n raise Password_Reset::In_Reset, mem.inspect if mem.password_in_reset?\n\n # Check for too many failed attempts.\n # Raise Account::Reset if necessary.\n fail_count = Failed_Log_In_Attempt.for_today(mem).count\n if fail_count > 2\n mem.reset_password\n raise Password_Reset::In_Reset, mem.inspect\n end\n \n # See if password matches with correct password.\n correct_password = BCrypt::Password.new(mem.data.hashed_password) === (password + mem.data.salt)\n return mem if correct_password\n\n # Update failed count.\n new_count = fail_count + 1\n \n # Insert failed password.\n Failed_Log_In_Attempt.create(\n nil,\n :owner_id => mem.data._id, \n :ip_address => ip_addr,\n :user_agent => user_agent \n )\n\n raise Wrong_Password, \"Password is invalid for: #{username.inspect}\"\n end", "def authenticate(pass)\n password.is_password?(pass) && self\n end", "def authenticate(username_or_email, password, remember = false)\n user=self.find_by_username(username_or_email) || self.find_by_email(username_or_email)\n if user\n expected_password=encrypt_password(password, user.password_seed)\n unless expected_password == user.hashed_password && user.active\n user = nil \n else\n user.create_remember_me_token if remember\n end\n end\n return user\n end", "def authenticate(encrypted_password)\n proxy_u.authenticate(encrypted_password) && self\n end", "def authenticate( request )\n\t\tauthheader = request.header.authorization or\n\t\t\tself.log_failure \"No authorization header in the request.\"\n\n\t\t# Extract the credentials bit\n\t\tbase64_userpass = authheader[ /^\\s*Basic\\s+(\\S+)$/i, 1 ] or\n\t\t\tself.log_failure \"Invalid Basic Authorization header (%p)\" % [ authheader ]\n\n\t\t# Unpack the username and password\n\t\tcredentials = base64_userpass.unpack( 'm' ).first\n\t\tself.log_failure \"Malformed credentials %p\" % [ credentials ] unless\n\t\t\tcredentials.index(':')\n\n\t\t# Split the credentials, check for valid user\n\t\tusername, password = credentials.split( ':', 2 )\n\t\tself.check_password( username, password )\n\n\t\t# Success!\n\t\tself.auth_succeeded( request, username )\n\t\treturn username\n\tend", "def authenticate(email, password)\n query = <<SQL\nSELECT id, account_name, nick_name, email\nFROM users\nWHERE email = ? AND passhash = SHA2(CONCAT(?, salt), 512)\nSQL\n result = db.xquery(query, email, password).first\n unless result\n raise Isucon5::AuthenticationError\n end\n session[:user_id] = result[:id]\n result\n end", "def attempt_login\n if params[:email].present? && params[:password].present?\n found_user = User.where(email: params[:email]).first\n authorized_user = found_user.authenticate(params[:password]) if found_user\n end\n\n if authorized_user\n authenticate_user(found_user.id)\n flash[:notice] = 'You are now logged in.'\n redirect_to(challenge_index_path)\n else\n flash.now[:notice] = 'Invalid email/password combination.'\n render('login')\n end\n end", "def login\n user = User.find_by_email(params[:email])\n\n if user && user.valid_password?(params[:password])\n expose user, serializer: CompactUserSerializer\n else\n error! :invalid_resource, user.try(:errors),\n metadata: { error_description: \"Invalid login information.\" }\n end\n end", "def authenticate(password)\n true\n end", "def authenticate(username, password)\n true\n end", "def authenticate_user!\n @authenticated_user ||= begin\n if account_signed_in? && current_account.username.present?\n DeviseUser.new(login: current_account.username, password: current_account.password)\n else\n console_access_denied\n end\n end\n end", "def authenticate(username, password)\n return nil unless password.start_with?(\"aspace-oauth-#{@provider}\")\n\n pw_path = File.join(Dir.tmpdir, password)\n return nil unless File.exist? pw_path\n\n info = JSON.parse(File.read(pw_path))['info']\n return nil unless username == info['username']\n\n JSONModel(:user).from_hash(\n username: username,\n name: info['name'],\n email: info['email']\n )\n end", "def login_user(username, password) # a[userid], \n result = db_connection().execute('SELECT id, password FROM users WHERE username=?', username)\n p result\n if result.length > 0\n if BCrypt::Password.new(result[0][\"password\"]) == password\n return {\n ok: true,\n msg: \"Logged in!\",\n id: result[0][\"id\"]\n }\n end\n return {\n ok: true,\n msg: \"Logged in!\"\n }\n end\n return {\n ok: false,\n msg: \"Password not located!\"\n }\n end", "def authenticatebis(name, password)\n if m=Member.find_by_name(name) \n \tif (m.authenticate(password))\n\t\t\t true\n\t\t\telse\n\t\t\t return -1\n\t\t\tend\n \telse\n \treturn -2\n end\n end", "def user\n user = User.find_by_email(email)\n return user if user && user.authenticate(password)\n errors.add :user_authentication, 'invalid credentials'\n nil\n end", "def login(login, password)\n raise NotImplementedError\n end", "def login(user=nil, password=nil)\n # If the user or password have already been set and no new informations\n # are given to the function, take these old informations.\n @user = user if @user.nil? \n @password = password if @password.nil?\n rep = call('User.login', {'login' => @user.to_s, 'password' => @password,\\\n 'remember' => 1})\n # Parse the cookie stored in @cookie.\n parse_cookie\n rep\n end", "def authenticated_user\n @authenticated_user ||= user(options[:login])\n end", "def authenticate!(request, params, *rest)\n opts = rest.last.kind_of?(Hash) ? rest.pop : {}\n rest = rest.flatten\n \n strategies = if rest.empty?\n if request.session[:authentication_strategies] \n request.session[:authentication_strategies]\n else\n Merb::Authentication.default_strategy_order\n end\n else\n request.session[:authentication_strategies] ||= []\n request.session[:authentication_strategies] << rest\n request.session[:authentication_strategies].flatten!.uniq!\n request.session[:authentication_strategies]\n end\n \n msg = opts[:message] || error_message\n user = nil \n # This one should find the first one that matches. It should not run antother\n strategies.detect do |s|\n s = Merb::Authentication.lookup_strategy[s] # Get the strategy from string or class\n unless s.abstract?\n strategy = s.new(request, params)\n user = strategy.run! \n if strategy.halted?\n self.headers, self.status, self.body = [strategy.headers, strategy.status, strategy.body]\n halt!\n return\n end\n user\n end\n end\n \n # Check after callbacks to make sure the user is still cool\n user = run_after_authentication_callbacks(user, request, params) if user\n \n # Finally, Raise an error if there is no user found, or set it in the session if there is.\n raise Merb::Controller::Unauthenticated, msg unless user\n session[:authentication_strategies] = nil # clear the session of Failed Strategies if login is successful \n self.user = user\n end", "def authenticate!\n not_authorized() unless logged_in?()\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 call\n user = User.find(email: @email)\n\n return user if user&.authenticate(@password)\n\n raise(Exceptions::InvalidEmailOrPassword)\n end", "def validate_login(username, password)\n user = nil\n begin\n user = @users.find_one(_id: username)\n # you will need to retrieve right document from the users collection.\n p 'This space intentionally left blank.'\n rescue\n p 'Unable to query database for user'\n end\n\n if user.nil?\n p 'User not in database'\n return nil\n end\n\n salt = user['password'].split(',')[1]\n\n if user['password'] != make_pw_hash(password, salt)\n p 'user password is not a match'\n return nil\n end\n # Looks good\n user\n end" ]
[ "0.8199555", "0.7758946", "0.7733583", "0.77321506", "0.7643159", "0.76276475", "0.75650644", "0.7422041", "0.74000347", "0.7353603", "0.73405296", "0.7333466", "0.72923356", "0.72923356", "0.72785985", "0.726604", "0.72153556", "0.7189424", "0.718413", "0.717262", "0.7137016", "0.71156824", "0.7079129", "0.7069046", "0.7059661", "0.7055978", "0.7051992", "0.70448256", "0.7043941", "0.70412207", "0.7038972", "0.7024969", "0.7011469", "0.69786084", "0.69783014", "0.6953296", "0.6933545", "0.68983704", "0.6881761", "0.6878484", "0.68757415", "0.68693405", "0.68444717", "0.6838727", "0.6836004", "0.6829245", "0.68154", "0.6808756", "0.67930394", "0.6788345", "0.6782276", "0.67694026", "0.67685646", "0.6758573", "0.6725709", "0.66983473", "0.66976273", "0.66931593", "0.66906804", "0.6689433", "0.66704065", "0.6668316", "0.662595", "0.6623791", "0.6623016", "0.66162205", "0.66157275", "0.66157275", "0.6609419", "0.66045225", "0.6598519", "0.6589685", "0.65890515", "0.65877175", "0.65664446", "0.6565182", "0.65471405", "0.65410304", "0.65392786", "0.6511266", "0.65079874", "0.6504226", "0.6503502", "0.64973813", "0.6495938", "0.64872795", "0.64851665", "0.6464496", "0.64586794", "0.6455256", "0.645397", "0.6434296", "0.64336306", "0.64288145", "0.64280546", "0.6427662", "0.642414", "0.6417183", "0.64109373", "0.6407471", "0.6402072" ]
0.0
-1
GET /buildings or /buildings.json
def index @buildings = Building.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @buildings = Building.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json :@buildings }\n end\n end", "def getbuildings\n \n puts params\n custid = params[\"custormerid\"]\n puts custid\n \n buildings = Building.where(:customer_id => custid)\n puts buildings.inspect\n respond_to do |format|\n puts \"pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp\"\n format.json { render json: buildings }\n end\n \n\n end", "def get_buildings_for_customer\n puts \"get_buildings_for_customer\"\n puts params\n @buildings = Building.where(\"customer_id = ?\", params[:customer_id])\n puts \"here are the buildings:\"\n puts @buildings\n respond_to do |format|\n format.json { render :json => @buildings }\n end\n end", "def index\n @builds = Build.all\n render json: @builds\n end", "def get_building\n #check if customer is passed as parameter\n if params[:customer].present?\n #same thing than : select building_id from customer where customer.id = id \n @buildings = Customer.find(params[:customer]).buildings\n \n else\n #if non id is given select all the buildings that are refered in the customer table\n @buildings = Customer.all\n end\n \n if request.xhr?\n #if no error \n #build response \n respond_to do |format|\n #make a json format for the response \n format.json {\n #send the list of corresponding buildings \n render json: {buildings: @buildings}\n }\n end\n end\n end", "def index\n @buildings = Building.find(:all, :include => :floors )\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @buildings }\n end\n end", "def index\n if params[:search].nil? || params[:search].empty?\n @buildings = Building.paginate(page: params[:page])\n else\n @buildings = search_buildings(params[:search])\n end\n end", "def show\n @building_type = BuildingType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @building_type }\n end\n end", "def index\n @builds = current_application.builds\n @build = current_application.builds.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @builds }\n end\n end", "def find_building_by_id\n\t\tresponse = @service.fetch_building_by_id(selected_building_id, true, patient_data)\n\t\trender json: response\n\tend", "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def index\n @building = Building.find(params[:building_id])\n @listings = Listing.all\n end", "def index\n @buildings = @buildings.order(:name)\n session[:sidebar] = 'building'\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.json { render json: @buildings }\n end\n end", "def building(building_id)\n perform_get_request(\"/building/#{building_id}\")\n end", "def building\n if params[:customer].present?\n @building = Building.where(customer_id:params[:customer])\n else\n @building = Building.all\n end\n # Now i just need to send back a json response, as well as handle the original html response.(same for battery and elevator)\n respond_to do |format|\n format.json {\n render json: {building: @building}\n }\n end\n end", "def show\n @building = Building.find(params[:id])\n\n if stale? @building\n render json: @building\n end\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 get_batterie_by_building\n @battery = Battery.where(building_id: params[:building_id])\n respond_to do |format| \n format.json { render :json => @battery }\n end\n \n end", "def show\n @build = Build.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @build }\n end\n end", "def show\n @build = Build.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @build }\n end\n end", "def building_and_grounds\n bag = SuperSuperCategory.find_by(name: \"Facilities\")\n super_categories = bag.super_categories\n\n if params[:org]\n @data = build_from_super_super_categories(super_categories, params[:org].to_i)\n else\n @data = build_from_super_super_categories(super_categories, 0)\n end\n\n render json: @data\n end", "def index\n @complex_buildings = ComplexBuilding.all\n end", "def index\n if(params.has_key?(:floor) && params.has_key?(:building))\n @nodes = Node.where(:floor => params[:floor],:building => params[:building])\n elsif(params.has_key?(:floor).present?)\n @nodes = Node.where(:floor => params[:floor])\n elsif(params.has_key?(:building).present?)\n @nodes = Node.where(:building => params[:building])\n else\n @nodes = Node.all\n end\n\n respond_to do |format|\n format.any { render json: @nodes, content_type: 'application/json' }\n end\n end", "def building_select\n p params[\"customer_id\"]\n @buildings = Building.where(customer_id: params[\"customer_id\"])\n respond_to do |format |\n format.json {\n render json: {\n buildings: @buildings\n }\n }\n end\n end", "def find_buildings(architect)\n name = architect.name\n url = Addressable::URI.parse('https://www.googleapis.com/freebase/v1/search')\n url.query_values = {\n query: name,\n type: \"/architecture/structure\",\n key: GOOGLE_CLIENT_ID\n }\n from_freebase = HTTParty.get(url, :format => :json)\n @results = from_freebase[\"result\"]\n @buildings_designed = @results.map { |building| building[\"name\"]}\n end", "def list_all\n response_json = @client.api_get_request(\"/api/build\")\n\n return nil unless response_json\n\n response_json[\"builds\"].map do |build|\n {\n :name => build[\"uri\"].sub(/^\\//,''),\n :uri => build[\"uri\"],\n :lastStarted => build[\"lastStarted\"]\n }\n end.sort{ |x,y| x[:name] <=> y[:name]}\n\n end", "def index\n @harvestings = Harvesting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @harvestings }\n end\n end", "def index\n @apartments = @building.apartments\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apartments }\n end\n end", "def index\n @builds = Build.all\n end", "def index\n @builds = Build.all\n end", "def index\n @buildingdetails = Buildingdetail.all\n end", "def index\n @buildings = Building.find_near_me(search_params)\n end", "def index\n @networkings = Networking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @networkings }\n end\n end", "def index\n @releases = @environment.releases.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @releases }\n end\n end", "def show\n @building_type = BuildingType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @building_type }\n end\n end", "def get_teaching_event_buildings_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TeachingEventBuildingsApi.get_teaching_event_buildings ...'\n end\n # resource path\n local_var_path = '/api/teaching_event_buildings'\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(['text/plain', 'application/json', 'text/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apiKey']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<TeachingEventBuilding>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TeachingEventBuildingsApi#get_teaching_event_buildings\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get\n CircleCi.request(conf, \"#{base_path}/#{build}\").get\n end", "def index\n @generations = Generation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @generations }\n end\n end", "def building_list(property_id)\n perform_get_request(\"/property/#{property_id}/building/list\")\n end", "def index\n @client_releases = ClientRelease.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @client_releases }\n end\n end", "def index\n if params[:search].present?\n @buildings = Building.near(params[:search], 50, :order => :distance)\n else\n @buildings = Building.all\n end\n\n end", "def index\n #pseudo scope \n if params[:phone] \n @agencies = Agency.find_by_phone(params[:phone]);\n if @agencies \n respond_to do |format|\n format.json { render :json => @agencies }\n format.xml { render :xml => @agencies }\n end \n else\n head :not_found\n end\n else\n # Aqui estoy haciendo que el api responda en mas de 1 formato\n @agencies = Agency.all\n respond_to do |format|\n format.json { render :json => @agencies }\n format.xml { render :xml => @agencies }\n end\n\n end \n end", "def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end", "def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end", "def list\n get('/')\n end", "def index\n @listings = Listing.all\n render json: @listings\n end", "def battery\n if params[:building].present?\n @battery = Battery.where(building_id:params[:building])\n else\n @battery = Battery.all\n end\n\n respond_to do |format|\n format.json {\n render json: {battery: @battery}\n }\n end\n end", "def index\n @rooms = Room.all\n respond_to do | format |\n format.html\n format.json\n end\n \n end", "def new\n @building_type = BuildingType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @building_type }\n end\n end", "def index\n @rooms = Room.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rooms }\n end\n end", "def builds(filters = {})\n fetch_resources_lazily(\"builds\", filters)\n end", "def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end", "def index\n if params[:harvest_id]\n @parent = Harvest.find(params[:harvest_id])\n @harvestings = @parent.harvestings\n elsif params[:person_id]\n @parent = Person.find(params[:person_id])\n @harvestings = @parent.harvestings\n else\n #should not get here\n @harvestings = Harvesting.all\n end\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @harvestings }\n end\n end", "def index\n bookings = Room.all\n\n if bookings\n render json: { status: 'SUCCESS', message: 'Successfuly got all rooms', data: bookings }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Something went wrong' }, status: :unprocessable_entity\n end\n end", "def get_battery\n if params[:building].present?\n @batteries = Building.find(params[:building]).batteries\n else\n @batteries = Building.all\n end\n if request.xhr?\n respond_to do |format|\n format.json {\n render json: {batteries: @batteries}\n }\n end\n end\n end", "def show\n @building = Building.find(params[:id])\n \n render :xml => @building\n # respond_to do |format|\n # format.html # show.html.erb\n # format.xml { render :xml => @building }\n # end\n end", "def index\n\n @houses = House.page(params[:page]).per(House::PER_PAGE_COUNT)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @houses }\n end\n end", "def index\n @branch_rooms = Room.get_all_rooms(params[:branch_id])\n \n render json: @branch_rooms\n end", "def index\n @games = Game.available\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end", "def index\n return unless params[:type] == 'building'\n\n @organizations = @organizations.only_categories(%w[Fraternity Sorority Independent Blitz Concessions])\n end", "def index\n @cannings = Canning.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cannings }\n end\n end", "def index\r\n @orgs = Org.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @orgs }\r\n end\r\n end", "def index\n @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 response = VersionResponse.new( BUILD_VERSION )\n render json: response, :status => 200\n end", "def index\n rooms = Room.includes(:problems, :registrations, :users, :owner)\n if params[:name]\n render json: rooms.where(name: params[:name])\n else\n render json: rooms\n end\n end", "def index\n @os_builds = OsBuild.all\n end", "def read ( buildId=nil )\n path = \"/api/apps/#{appId}/builds\"\n path = path << \"/#{buildId}\" if buildId != nil\n\n url = @app_url + path\n\n begin\n response = RestClient.get url, { 'X-Token' => @api_token, :accept => :json}\n rescue => err\n raise RuntimeError.new( \"HTTP connection error: #{err.message}\")\n end\n\n if [200].include? response.code\n jobj = JSON.parse( response.body.to_s)\n else\n raise RuntimeError.new( \"Invalid response: #{response.code.to_s}\")\n end\n\n end", "def index\n @listings = Listing.by_user(current_user).all\n\n render json: @listings\n end", "def show\n @village = Village.find(params[:id])\n @collections = @village.collections\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @village }\n end\n end", "def list_buildings(buildings)\n \tbuildings.each do |place|\n\t\tputs \"#{buildings.index(place)}: #{place}\"\n\tend\nend", "def index\n @postings = Posting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @postings }\n end\n end", "def get(path, params={})\n params = merge_set_up_params(params)\n @token = \"b3688c52-9235-45ca-b01f-c5b2b83a4f4f\"\n @result = Typhoeus::Request.get(API_URL + path, :params => params,\n :headers => {\"Authorization\" => \"Basic#{@token}\"})\n puts @result.body\n # check if the url looks correct in the log\n puts @result.effective_url\n # parse the result to json\n return JSON.parse(@result.body)\n end", "def info\n get '/'\n end", "def index\n @neighborhoods = Neighborhood.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @neighborhoods }\n end\n end", "def index\n #@buildings = associated_model_class.available_for_user(current_user)\n instance_variable_set(resource_instance_variable_name.pluralize, resource_class.available_for_user(current_user).page(params[:page]).per(25))\n #instance_variable_set(\"@#{self.parent_resource_class.name.underscore.pluralize}\".to_sym, self.resource_class.available_for_user(current_user))\n\n @table_columns = [ 'Address', 'Price', 'Price currency']\n if resource_class == Building\n @table_columns.insert(0, \"Type\")\n end\n\n #render json: resources_instance_variable\n\n respond_with resources_instance_variable\n end", "def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end", "def battery_select\n p params[\"building_id\"]\n @batteries = Battery.where(building_id: params[\"building_id\"])\n respond_to do |format |\n format.json {\n render json: {\n batteries: @batteries\n }\n }\n end\n end", "def index\n @generator = Generator.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @generator }\n end\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend", "def list_all_buildings_to_rent(buildings)\n clear_screen\n puts \"Choose one building to get apartments to rent\\n\\n\"\n options = {}\n buildings.each do |building|\n puts \"#{building.id} - #{building.name}\"\n options[building.id.to_s] = building\n end\n options[\"000\"] = \"Back\"\n show_return_option\n option = gets_chomp(options)\n if option != \"000\"\n see_one_building(options[option],true)\n end\nend", "def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend", "def show\n @generation = Generation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @generation }\n end\n end", "def view\n res = @client.get(path)\n @attributes = res.json if res.success?\n end", "def show\n if !user_signed_in?\n redirect_to controller: 'user', action: 'notLoggedIn'\n else\n # Get all building names in ascending order\n @buildings = Building.all.order(name: :asc).to_a.map {\n |building| building.name\n }\n\n # Same with facility types and room numbers\n @facilitytypes = FacilityType.all.order(ftype: :asc).to_a.map {\n |facilityType| facilityType.ftype\n }\n\n @rooms = Room.all.order(roomNum: :asc).to_a.map {\n |room| room.roomNum\n }\n end\n @id = params[:id]\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @bookings }\n end\n end", "def index\n @dog_walks = DogWalk.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dog_walks }\n end\n \n end", "def show\n @ninja = Ninja.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ninja }\n end\n end", "def show\n @booking = Booking.find(params[:id])\n @rooms = @booking.rooms\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end", "def show\n @ongoing = Ongoing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ongoing }\n end\n end", "def index\n @distros = getmydata(\"Distro\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @distros }\n end\n end", "def show\n begin\n render template: 'route_builders/show', status: :ok\n rescue Exception => e\n render json: {:message=> e.to_s}.to_json, status: :not_found\n end\n end", "def index\n @allocations = Allocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @allocations }\n end\n end", "def index\n @hotel_rooms = HotelRoom.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hotel_rooms }\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 show\n session[:current_building] = @building.id\n session[:current_floor] = nil\n session[:sidebar] = 'building'\n\n respond_to do |format|\n format.html # show.html.erb\n format.js\n format.json { render json: @building }\n end\n end", "def listings(**args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/listings/latest\", options: params.compact)\n end", "def listings(**args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/listings/latest\", options: params.compact)\n end", "def index\n\t\t@rooms = Room.order(updated_at: :desc)\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @rooms }\n\t\tend\n\tend", "def get_json\n response = @api.request(:get, @location)\n response.body if response.status == 200\n end", "def list\n get 'projects'\n end" ]
[ "0.7627638", "0.71269304", "0.6795006", "0.675837", "0.67289567", "0.67020917", "0.66783166", "0.66447204", "0.6616098", "0.65419984", "0.64957136", "0.64730287", "0.6461572", "0.64584154", "0.6346139", "0.63236094", "0.6305294", "0.62001073", "0.61962605", "0.61962605", "0.61830044", "0.6168074", "0.6121668", "0.61131227", "0.6098513", "0.6083908", "0.6074843", "0.60493857", "0.6020368", "0.6020368", "0.5991068", "0.5975158", "0.5951136", "0.592735", "0.59230447", "0.59177727", "0.5852175", "0.58463436", "0.58377975", "0.58362687", "0.5817753", "0.5811524", "0.5803419", "0.5803044", "0.5802337", "0.5801179", "0.5792968", "0.5792303", "0.5785408", "0.57554746", "0.57486117", "0.5738579", "0.5735355", "0.5723078", "0.5704313", "0.5688659", "0.56882936", "0.5684403", "0.56773806", "0.5667298", "0.5661339", "0.56567866", "0.5646021", "0.56447893", "0.5637775", "0.5623022", "0.5623018", "0.561125", "0.5599399", "0.55963373", "0.5594113", "0.5591702", "0.55886847", "0.5586125", "0.5580038", "0.55732137", "0.55661434", "0.55634993", "0.556174", "0.55561566", "0.55501133", "0.5548973", "0.55478114", "0.554197", "0.55373347", "0.55354583", "0.5534756", "0.5534353", "0.55310667", "0.55252147", "0.5522032", "0.5518732", "0.55184525", "0.55161077", "0.5516054", "0.5515946", "0.5515946", "0.55144435", "0.5514013", "0.5511605" ]
0.68793
2
GET /buildings/1 or /buildings/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @buildings = Building.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json :@buildings }\n end\n end", "def getbuildings\n \n puts params\n custid = params[\"custormerid\"]\n puts custid\n \n buildings = Building.where(:customer_id => custid)\n puts buildings.inspect\n respond_to do |format|\n puts \"pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp\"\n format.json { render json: buildings }\n end\n \n\n end", "def show\n @building_type = BuildingType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @building_type }\n end\n end", "def building(building_id)\n perform_get_request(\"/building/#{building_id}\")\n end", "def find_building_by_id\n\t\tresponse = @service.fetch_building_by_id(selected_building_id, true, patient_data)\n\t\trender json: response\n\tend", "def index\n @buildings = Building.all\n end", "def index\n @builds = Build.all\n render json: @builds\n end", "def get_building\n #check if customer is passed as parameter\n if params[:customer].present?\n #same thing than : select building_id from customer where customer.id = id \n @buildings = Customer.find(params[:customer]).buildings\n \n else\n #if non id is given select all the buildings that are refered in the customer table\n @buildings = Customer.all\n end\n \n if request.xhr?\n #if no error \n #build response \n respond_to do |format|\n #make a json format for the response \n format.json {\n #send the list of corresponding buildings \n render json: {buildings: @buildings}\n }\n end\n end\n end", "def index\n @builds = current_application.builds\n @build = current_application.builds.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @builds }\n end\n end", "def get_buildings_for_customer\n puts \"get_buildings_for_customer\"\n puts params\n @buildings = Building.where(\"customer_id = ?\", params[:customer_id])\n puts \"here are the buildings:\"\n puts @buildings\n respond_to do |format|\n format.json { render :json => @buildings }\n end\n end", "def show\n @building = Building.find(params[:id])\n\n if stale? @building\n render json: @building\n end\n end", "def show\n @build = Build.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @build }\n end\n end", "def show\n @build = Build.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @build }\n end\n end", "def index\n @buildings = Building.find(:all, :include => :floors )\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @buildings }\n end\n end", "def index\n @building = Building.find(params[:building_id])\n @listings = Listing.all\n end", "def get_batterie_by_building\n @battery = Battery.where(building_id: params[:building_id])\n respond_to do |format| \n format.json { render :json => @battery }\n end\n \n end", "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def index\n if params[:search].nil? || params[:search].empty?\n @buildings = Building.paginate(page: params[:page])\n else\n @buildings = search_buildings(params[:search])\n end\n end", "def index\n @buildings = @buildings.order(:name)\n session[:sidebar] = 'building'\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.json { render json: @buildings }\n end\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 building_select\n p params[\"customer_id\"]\n @buildings = Building.where(customer_id: params[\"customer_id\"])\n respond_to do |format |\n format.json {\n render json: {\n buildings: @buildings\n }\n }\n end\n end", "def list_all\n response_json = @client.api_get_request(\"/api/build\")\n\n return nil unless response_json\n\n response_json[\"builds\"].map do |build|\n {\n :name => build[\"uri\"].sub(/^\\//,''),\n :uri => build[\"uri\"],\n :lastStarted => build[\"lastStarted\"]\n }\n end.sort{ |x,y| x[:name] <=> y[:name]}\n\n end", "def show\n @building_type = BuildingType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @building_type }\n end\n end", "def index\n @builds = Build.all\n end", "def index\n @builds = Build.all\n end", "def index\n @complex_buildings = ComplexBuilding.all\n end", "def building\n if params[:customer].present?\n @building = Building.where(customer_id:params[:customer])\n else\n @building = Building.all\n end\n # Now i just need to send back a json response, as well as handle the original html response.(same for battery and elevator)\n respond_to do |format|\n format.json {\n render json: {building: @building}\n }\n end\n end", "def find_buildings(architect)\n name = architect.name\n url = Addressable::URI.parse('https://www.googleapis.com/freebase/v1/search')\n url.query_values = {\n query: name,\n type: \"/architecture/structure\",\n key: GOOGLE_CLIENT_ID\n }\n from_freebase = HTTParty.get(url, :format => :json)\n @results = from_freebase[\"result\"]\n @buildings_designed = @results.map { |building| building[\"name\"]}\n end", "def index\n response = VersionResponse.new( BUILD_VERSION )\n render json: response, :status => 200\n end", "def new\n @building_type = BuildingType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @building_type }\n end\n end", "def get\n CircleCi.request(conf, \"#{base_path}/#{build}\").get\n end", "def read ( buildId=nil )\n path = \"/api/apps/#{appId}/builds\"\n path = path << \"/#{buildId}\" if buildId != nil\n\n url = @app_url + path\n\n begin\n response = RestClient.get url, { 'X-Token' => @api_token, :accept => :json}\n rescue => err\n raise RuntimeError.new( \"HTTP connection error: #{err.message}\")\n end\n\n if [200].include? response.code\n jobj = JSON.parse( response.body.to_s)\n else\n raise RuntimeError.new( \"Invalid response: #{response.code.to_s}\")\n end\n\n end", "def building_and_grounds\n bag = SuperSuperCategory.find_by(name: \"Facilities\")\n super_categories = bag.super_categories\n\n if params[:org]\n @data = build_from_super_super_categories(super_categories, params[:org].to_i)\n else\n @data = build_from_super_super_categories(super_categories, 0)\n end\n\n render json: @data\n end", "def index\n @buildingdetails = Buildingdetail.all\n end", "def building_list(property_id)\n perform_get_request(\"/property/#{property_id}/building/list\")\n end", "def get_teaching_event_buildings_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TeachingEventBuildingsApi.get_teaching_event_buildings ...'\n end\n # resource path\n local_var_path = '/api/teaching_event_buildings'\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(['text/plain', 'application/json', 'text/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apiKey']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<TeachingEventBuilding>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TeachingEventBuildingsApi#get_teaching_event_buildings\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end", "def show\n @build = Build.find(params[:id])\n end", "def battery\n if params[:building].present?\n @battery = Battery.where(building_id:params[:building])\n else\n @battery = Battery.all\n end\n\n respond_to do |format|\n format.json {\n render json: {battery: @battery}\n }\n end\n end", "def battery_select\n p params[\"building_id\"]\n @batteries = Battery.where(building_id: params[\"building_id\"])\n respond_to do |format |\n format.json {\n render json: {\n batteries: @batteries\n }\n }\n end\n end", "def list_all_buildings_to_rent(buildings)\n clear_screen\n puts \"Choose one building to get apartments to rent\\n\\n\"\n options = {}\n buildings.each do |building|\n puts \"#{building.id} - #{building.name}\"\n options[building.id.to_s] = building\n end\n options[\"000\"] = \"Back\"\n show_return_option\n option = gets_chomp(options)\n if option != \"000\"\n see_one_building(options[option],true)\n end\nend", "def index\n @apartments = @building.apartments\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apartments }\n end\n end", "def list_buildings(buildings)\n \tbuildings.each do |place|\n\t\tputs \"#{buildings.index(place)}: #{place}\"\n\tend\nend", "def index\n @harvestings = Harvesting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @harvestings }\n end\n end", "def index\n @releases = @environment.releases.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @releases }\n end\n end", "def show\n @generation = Generation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @generation }\n end\n end", "def show\n @ninja = Ninja.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ninja }\n end\n end", "def builds(filters = {})\n fetch_resources_lazily(\"builds\", filters)\n end", "def index\n @os_builds = OsBuild.all\n end", "def index\n if(params.has_key?(:floor) && params.has_key?(:building))\n @nodes = Node.where(:floor => params[:floor],:building => params[:building])\n elsif(params.has_key?(:floor).present?)\n @nodes = Node.where(:floor => params[:floor])\n elsif(params.has_key?(:building).present?)\n @nodes = Node.where(:building => params[:building])\n else\n @nodes = Node.all\n end\n\n respond_to do |format|\n format.any { render json: @nodes, content_type: 'application/json' }\n end\n end", "def show\n @building = Building.find(params[:id])\n \n render :xml => @building\n # respond_to do |format|\n # format.html # show.html.erb\n # format.xml { render :xml => @building }\n # end\n end", "def get_battery\n if params[:building].present?\n @batteries = Building.find(params[:building]).batteries\n else\n @batteries = Building.all\n end\n if request.xhr?\n respond_to do |format|\n format.json {\n render json: {batteries: @batteries}\n }\n end\n end\n end", "def index\n @generations = Generation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @generations }\n end\n end", "def index\n @buildings = Building.find_near_me(search_params)\n end", "def index\n @client_releases = ClientRelease.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @client_releases }\n end\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend", "def index\n @networkings = Networking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @networkings }\n end\n end", "def show\n buildingId = params[:id]\n @room = Room.where(building_id: buildingId)\n end", "def get_aos_version_by_name(args = {}) \n get(\"/aosversions.json/version/#{args[:aosVersionName]}\", args)\nend", "def new\n @build = Build.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @build }\n end\n end", "def new\n @build = Build.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @build }\n end\n end", "def show\n @gen = Gen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gen }\n end\n end", "def show\n @environment = @project.environments.find_by_slug!(params[:id])\n @releases = @environment.releases\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @environment }\n end\n end", "def index\n if params[:harvest_id]\n @parent = Harvest.find(params[:harvest_id])\n @harvestings = @parent.harvestings\n elsif params[:person_id]\n @parent = Person.find(params[:person_id])\n @harvestings = @parent.harvestings\n else\n #should not get here\n @harvestings = Harvesting.all\n end\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @harvestings }\n end\n end", "def jenkins_job_build_data(build_no = nil)\n build_no = \"lastBuild\" if build_no.nil?\n options = {\"username\" => SS_hudson_username, \"password\" => SS_hudson_password}\n response = rest_call(\"#{BuildServerURL}/#{build_no}/api/json\", \"get\", options)\n data = response[\"status\"] == \"success\" ? response[\"response\"] : \"#{response[\"status\"]}: #{response[\"message\"]}\"\nend", "def show\n @release = @environment.releases.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @release }\n end\n end", "def render_version\n render json: { version: BUILD_VERSION }, status: 200\n end", "def build_info(username, access_key, build_name)\n # Get the ID of a build\n uri = URI(\"https://api.browserstack.com/app-automate/builds.json?name=#{build_name}\")\n request = Net::HTTP::Get.new(uri)\n request.basic_auth(username, access_key)\n\n res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|\n http.request(request)\n end\n\n build_info = JSON.parse(res.body)\n\n if !build_info.empty?\n build_id = build_info[0]['automation_build']['hashed_id']\n\n # Get the build info\n uri = URI(\"https://api.browserstack.com/app-automate/builds/#{build_id}/sessions\")\n request = Net::HTTP::Get.new(uri)\n request.basic_auth(username, access_key)\n\n res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|\n http.request(request)\n end\n\n build_json = JSON.parse(res.body)\n else\n raise \"No build found for given ID: #{build_name}\"\n end\n build_json\n end", "def get_aos_version(args = {}) \n get(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def building_autocomplete\n record = resource_class.new street_house_number: params[:house],\n street_prefix: params[:prefix],\n street_name: params[:street],\n street_suffix: params[:suffix],\n locality_id: params[:locality_id]\n record.auto_strip_attributes\n buildings = BuildingsOnStreet.perform(record)\n render json: buildings.to_json\n end", "def listings(**args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/listings/latest\", options: params.compact)\n end", "def listings(**args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/listings/latest\", options: params.compact)\n end", "def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end", "def room_descriptions_method\r\n my_port = 8081\r\n htttproomnumber = $roomnumber\r\n roomsNtext = \"/#{htttproomnumber}\"\r\n rooms_message = \"/rooms#{roomsNtext}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{rooms_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n return my_json[\"room\"].to_s\r\nend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def index\n if params[:search].present?\n @buildings = Building.near(params[:search], 50, :order => :distance)\n else\n @buildings = Building.all\n end\n\n end", "def fetch_build(path)\n\n is_remote = opensdg_is_path_remote(path)\n build = {}\n get_endpoints().each do |key, value|\n endpoint = is_remote ? path + '/' + value : File.join(path, fix_path(value))\n\n begin\n json_file = is_remote ? open(endpoint) : File.open(endpoint)\n build[key] = JSON.load(json_file)\n rescue StandardError => e\n # For backwards compatibility, forego the exception in some cases.\n abort_build = true\n if ['translations', 'indicator_downloads', 'disaggregation', 'data_packages'].include? key\n abort_build = false\n elsif endpoint.include? '/untranslated/'\n abort_build = false\n end\n if abort_build\n puts e.message\n abort 'Unable to read data from: ' + endpoint\n end\n end\n end\n\n return build\n end", "def fetch_build(path)\n\n is_remote = opensdg_is_path_remote(path)\n build = {}\n get_endpoints().each do |key, value|\n endpoint = is_remote ? path + '/' + value : File.join(path, fix_path(value))\n\n begin\n json_file = is_remote ? URI.open(endpoint) : File.open(endpoint)\n build[key] = JSON.load(json_file)\n rescue StandardError => e\n # For backwards compatibility, forego the exception in some cases.\n abort_build = true\n if ['translations', 'indicator_downloads', 'disaggregation', 'data_packages'].include? key\n abort_build = false\n elsif endpoint.include? '/untranslated/'\n abort_build = false\n end\n if abort_build\n puts e.message\n abort 'Unable to read data from: ' + endpoint\n end\n end\n end\n\n return build\n end", "def index\n #pseudo scope \n if params[:phone] \n @agencies = Agency.find_by_phone(params[:phone]);\n if @agencies \n respond_to do |format|\n format.json { render :json => @agencies }\n format.xml { render :xml => @agencies }\n end \n else\n head :not_found\n end\n else\n # Aqui estoy haciendo que el api responda en mas de 1 formato\n @agencies = Agency.all\n respond_to do |format|\n format.json { render :json => @agencies }\n format.xml { render :xml => @agencies }\n end\n\n end \n end", "def create\n @building = Building.new(building_params)\n\n if @building.save\n render json: @building, status: :created, location: @building\n else\n render json: @building.errors, status: :unprocessable_entity\n end\n end", "def show\n @apartment = @building.apartments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apartment }\n end\n end", "def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end", "def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end", "def view\n res = @client.get(path)\n @attributes = res.json if res.success?\n end", "def show\n render json: @build\n end", "def show\n if !user_signed_in?\n redirect_to controller: 'user', action: 'notLoggedIn'\n else\n # Get all building names in ascending order\n @buildings = Building.all.order(name: :asc).to_a.map {\n |building| building.name\n }\n\n # Same with facility types and room numbers\n @facilitytypes = FacilityType.all.order(ftype: :asc).to_a.map {\n |facilityType| facilityType.ftype\n }\n\n @rooms = Room.all.order(roomNum: :asc).to_a.map {\n |room| room.roomNum\n }\n end\n @id = params[:id]\n end", "def show\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @thing }\n end\n end", "def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend", "def show\n session[:current_building] = @building.id\n session[:current_floor] = nil\n session[:sidebar] = 'building'\n\n respond_to do |format|\n format.html # show.html.erb\n format.js\n format.json { render json: @building }\n end\n end", "def index\n @listings = Listing.all\n render json: @listings\n end", "def index\n return unless params[:type] == 'building'\n\n @organizations = @organizations.only_categories(%w[Fraternity Sorority Independent Blitz Concessions])\n end", "def show\n @village = Village.find(params[:id])\n @collections = @village.collections\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @village }\n end\n end", "def new\n @building_type = BuildingType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @building_type }\n end\n end", "def show\n @go = Go.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @go }\n end\n end", "def my_buildings\n \n end", "def show\n @floor = Floor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @floor }\n end\n end", "def get(path, params={})\n params = merge_set_up_params(params)\n @token = \"b3688c52-9235-45ca-b01f-c5b2b83a4f4f\"\n @result = Typhoeus::Request.get(API_URL + path, :params => params,\n :headers => {\"Authorization\" => \"Basic#{@token}\"})\n puts @result.body\n # check if the url looks correct in the log\n puts @result.effective_url\n # parse the result to json\n return JSON.parse(@result.body)\n end", "def index\n # @properties = Property.filter_by_building(params[:buildingnumber])\n # @building = Building.find(params[:building_id])\n @properties = Property.search(params[:search])\n end", "def show\n @builds = @job_matrix.latest_builds.group_by(&:job_id)\n @build_results = BuildResult\n .where(build_id: @job_matrix.latest_builds.pluck(:id))\n .where(ubuntu_release: Rails.application.config_for(:uosci)['supported_combinations'].keys)\n .order(created_at: :desc).includes(:user).group_by(&:build_id)\n end", "def index\n\n @houses = House.page(params[:page]).per(House::PER_PAGE_COUNT)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @houses }\n end\n end" ]
[ "0.73594165", "0.6972951", "0.6827823", "0.6796824", "0.67829406", "0.672795", "0.66243523", "0.661749", "0.6566114", "0.65500695", "0.6529503", "0.6382412", "0.6382412", "0.6378805", "0.63621306", "0.62992597", "0.6290318", "0.6259671", "0.6128736", "0.6113885", "0.609708", "0.60930604", "0.60812896", "0.60322106", "0.60322106", "0.6001505", "0.5992546", "0.59588575", "0.595137", "0.594589", "0.5937867", "0.5920837", "0.58609354", "0.584667", "0.58100504", "0.57977027", "0.5790786", "0.57588226", "0.5746963", "0.57208174", "0.57192856", "0.57163256", "0.56935805", "0.56713814", "0.5658746", "0.5651927", "0.56235695", "0.56190896", "0.56167316", "0.560694", "0.56036186", "0.55854386", "0.55839694", "0.5567907", "0.55644435", "0.5557158", "0.5551166", "0.5491503", "0.54802334", "0.54762584", "0.54762584", "0.5461957", "0.5456782", "0.5453556", "0.5445078", "0.5444315", "0.54368764", "0.5432712", "0.5428266", "0.54278374", "0.5408939", "0.5408939", "0.54070973", "0.5406537", "0.540294", "0.540294", "0.540257", "0.5401495", "0.54003835", "0.53969806", "0.53958875", "0.53921705", "0.53850013", "0.53844726", "0.5381622", "0.5380071", "0.5376464", "0.5373888", "0.5367515", "0.53605735", "0.5359793", "0.5352872", "0.5351911", "0.5339948", "0.5339861", "0.5333835", "0.5330637", "0.5329332", "0.5324206", "0.53151023", "0.5312657" ]
0.0
-1
POST /buildings or /buildings.json
def create @building = Building.new(building_params) respond_to do |format| if @building.save format.html { redirect_to @building, notice: "Building was successfully created." } format.json { render :show, status: :created, location: @building } else format.html { render :new, status: :unprocessable_entity } format.json { render json: @building.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @building = Building.new(building_params)\n\n if @building.save\n render json: @building, status: :created, location: @building\n else\n render json: @building.errors, status: :unprocessable_entity\n end\n end", "def create\n @building = Building.new(building_params)\n respond_to do |format|\n if @building.save\n format.html { redirect_to @building, notice: 'Building created.' }\n format.json { render :show, status: :created, location: @building }\n else\n format.html { render :new }\n err = @building.errors\n format.json { render json: err, status: :unprocessable_entity }\n end\n end\n end", "def create\n @building = Building.new(building_params)\n\n respond_to do |format|\n if @building.save\n format.html { redirect_to @building, notice: 'Building was successfully created.' }\n format.json { render :show, status: :created, location: @building }\n else\n format.html { render :new }\n format.json { render json: @building.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_building = Admin::Building.new(admin_building_params)\n @admin_building.user = current_user\n respond_to do |format|\n if @admin_building.save\n\n @admin_buildings = buildings(current_user)\n\n create_default_service(@admin_building)\n\n format.html { redirect_to @admin_building, notice: t(:building_notice_created) }\n format.json { render :show, status: :created, location: @admin_building }\n format.js { render :layout => false }\n else\n format.html { render :new }\n format.json { render json: @admin_building.errors, status: :unprocessable_entity }\n format.js { render :layout => false }\n end\n end\n end", "def create\n @building_type = BuildingType.new(params[:building_type])\n\n respond_to do |format|\n if @building_type.save\n format.html { redirect_to @building_type, notice: 'Building type was successfully created.' }\n format.json { render json: @building_type, status: :created, location: @building_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @building_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @buildings = Building.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json :@buildings }\n end\n end", "def create\n @building = Building.new(building_params)\n authorize! :create, @building\n\n respond_to do |format|\n if @building.save\n format.html { redirect_to @building, notice: t('.create_ok', item: @building.name) }\n format.json { render json: @building, status: :created, location: @building }\n else\n format.html { render action: 'new' }\n format.json { render json: @building.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @buildingdetail = Buildingdetail.new(buildingdetail_params)\n\n respond_to do |format|\n if @buildingdetail.save\n format.html { redirect_to @buildingdetail, notice: \"Buildingdetail was successfully created.\" }\n format.json { render :show, status: :created, location: @buildingdetail }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @buildingdetail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @featured_building = FeaturedBuilding.new(featured_building_params)\n\n respond_to do |format|\n if @featured_building.save\n format.html { redirect_to redirect_path, notice: 'Featured building was successfully created.' }\n format.json { render :show, status: :created, location: @featured_building }\n else\n format.html { render :new }\n format.json { render json: @featured_building.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @build = Build.new(params[:build])\n\n respond_to do |format|\n if @build.save\n format.html { redirect_to @build, notice: 'Build was successfully created.' }\n format.json { render json: @build, status: :created, location: @build }\n else\n format.html { render action: \"new\" }\n format.json { render json: @build.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n instance_variable_set(resource_instance_variable_name, resource_class.new())\n resource_instance_variable.assign_attributes(building_params)\n respond_to do |format|\n if resource_instance_variable.save\n format.html { redirect_to resource_instance_variable, notice: 'Building was successfully created.' }\n format.json { render :show, status: :created, location: resource_instance_variable }\n else\n format.html { render :new }\n format.json { render json: resource_instance_variable.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @building = Building.new(params[:building])\n\n respond_to do |format|\n if @building.save\n flash[:notice] = 'Building was successfully created.'\n format.html { redirect_to(@building) }\n format.xml { render :xml => @building, :status => :created, :location => @building }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @building.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @build = Build.new(build_params)\n\n respond_to do |format|\n if @build.save\n format.html { redirect_to @build, notice: \"Build was successfully created.\" }\n format.json { render :show, status: :created, location: @build }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @build.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @builds = current_application.builds\n @build = current_application.builds.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @builds }\n end\n end", "def create\n #@building = Building.new(params[:building])\n\n respond_to do |format|\n if @building.save\n flash[:notice] = 'Building was successfully created.'\n format.html { redirect_to(@building) }\n format.xml { render :xml => @building, :status => :created, :location => @building }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @building.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @os_build = OsBuild.new(os_build_params)\n\n respond_to do |format|\n if @os_build.save\n format.html { redirect_to @os_build, notice: 'Os build was successfully created.' }\n format.json { render :show, status: :created, location: @os_build }\n else\n format.html { render :new }\n format.json { render json: @os_build.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @building_type = BuildingType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @building_type }\n end\n end", "def build()\n response = send_post_request(@xml_api_build_path, {:delay => '0sec'})\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def create\n # byebug\n @building = Building.find(listing_params[:building_id])\n @listing = Listing.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to [@building, @listing], notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n format.js {}\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n format.js {}\n end\n end\n end", "def create\n @title = t('view.buildings.modal.involved_building')\n @building = @mobile_intervention.buildings.build(params[:building])\n\n if @building.save\n js_notify message: t('view.buildings.correctly_created'),\n type: 'alert-info js-notify-18px-text', time: 2500\n render partial: 'mobile_interventions/building',\n locals: { building: @building }, content_type: 'text/html'\n else\n render partial: 'new', status: :unprocessable_entity\n end\n end", "def index\n @builds = Build.all\n render json: @builds\n end", "def create\n @complex_building = ComplexBuilding.new(complex_building_params.merge(user_id: current_user.id))\n\n respond_to do |format|\n if @complex_building.save\n format.html { redirect_to @complex_building, notice: 'Complex Building was successfully created.' }\n format.json { render :show, status: :created, location: @complex_building }\n else\n format.html { render :new }\n format.json { render json: @complex_building.errors, status: :unprocessable_entity }\n end\n end\n end", "def getbuildings\n \n puts params\n custid = params[\"custormerid\"]\n puts custid\n \n buildings = Building.where(:customer_id => custid)\n puts buildings.inspect\n respond_to do |format|\n puts \"pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp\"\n format.json { render json: buildings }\n end\n \n\n end", "def build(building)\n @building = building\n end", "def building\n if params[:customer].present?\n @building = Building.where(customer_id:params[:customer])\n else\n @building = Building.all\n end\n # Now i just need to send back a json response, as well as handle the original html response.(same for battery and elevator)\n respond_to do |format|\n format.json {\n render json: {building: @building}\n }\n end\n end", "def building_params\n params.require(:building).permit(:name)\n end", "def index\n @buildings = Building.all\n end", "def building(building_id)\n perform_get_request(\"/building/#{building_id}\")\n end", "def create\n @building_type = BuildingType.new(params[:building_type])\n\n respond_to do |format|\n if @building_type.save\n flash[:notice] = 'BuildingType was successfully created.'\n format.html { redirect_to(@building_type) }\n format.xml { render :xml => @building_type, :status => :created, :location => @building_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @building_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @building = Building.find(params[:id])\n\n if @building.update_attributes(building_params)\n head :no_content\n else\n render json: @building.errors, status: :unprocessable_entity\n end\n end", "def building_params\n params.require(:building).permit(:owner, :type, :count)\n end", "def build\n CircleCi.request(conf, base_path).post\n end", "def building_params\n params.require(:building).permit(:name, :reference, :city, :adress, :zipcode, :building_image)\n end", "def create\n @neighborhood = Neighborhood.find(params[:neighborhood_id])\n @submission = @neighborhood.submissions.build(submission_params)\n\n respond_to do |format|\n if @submission.save\n format.html { redirect_to @neighborhood, notice: 'Submission was successfully created.' }\n format.json { render action: 'show', status: :created, location: @submission }\n else\n format.html { render action: 'new' }\n format.json { render json: @submission.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize UserBuilding\n @user_building = UserBuilding.new(user_building_params)\n\n respond_to do |format|\n if @user_building.save\n format.html { redirect_to @user_building, notice: 'User building was successfully created.' }\n format.json { render :show, status: :created, location: @user_building }\n else\n format.html { render :new }\n format.json { render json: @user_building.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ninja = Ninja.new(params[:ninja])\n\n respond_to do |format|\n if @ninja.save\n format.html { redirect_to @ninja, notice: 'Ninja was successfully created.' }\n format.json { render json: @ninja, status: :created, location: @ninja }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ninja.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @built_with = BuiltWith.new(built_with_params)\n respond_to do |format|\n if @built_with.save\n format.html { redirect_to @built_with, notice: 'Built with was successfully created.' }\n format.json { render :show, status: :created, location: @built_with }\n else\n format.html { render :new }\n format.json { render json: @built_with.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @build = Build.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @build }\n end\n end", "def new\n @build = Build.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @build }\n end\n end", "def quick_form\n\n if params[:building_id].blank?\n @building = Building.new\n @building_selected = false\n else\n @building = Building.find(params[:building_id])\n @building_selected = true\n end\n\n\n @buildings = Building.all\n @localities = Locality.all\n @bhks=BhkConfig.all\n @sources=Flatype.all\n @furnstats=Furnstat.all\n @contacts=Contact.all\n @labellings=Labelling.where(\"is_flat_contact_label=?\", true).all\n @rent_year= RentYear.where('name=?', Time.now.year).first\n\n @flat = @building.flats.build\n @expected_rent = @flat.expected_rents.build\n @available_from = @flat.available_froms.build\n\n if params[:contact]\n @default_contact_id=params[:contact]\n else\n @default_contact_id=0\n end\n\n @flat_contacts=@flat.flat_contacts.build\n @contact=@flat.contacts.build\n @phone=@contact.phones.build\n @email=@contact.emails.build\n @contact_types=ContactType.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json :@building }\n end\n end", "def post(path, data = {})\n request 'POST', path, body: data.to_json\n end", "def get_building\n #check if customer is passed as parameter\n if params[:customer].present?\n #same thing than : select building_id from customer where customer.id = id \n @buildings = Customer.find(params[:customer]).buildings\n \n else\n #if non id is given select all the buildings that are refered in the customer table\n @buildings = Customer.all\n end\n \n if request.xhr?\n #if no error \n #build response \n respond_to do |format|\n #make a json format for the response \n format.json {\n #send the list of corresponding buildings \n render json: {buildings: @buildings}\n }\n end\n end\n end", "def create\n p = admin_room_params\n p[:building_id] = params[:building_id]\n @admin_room = Room.new(p)\n\n respond_to do |format|\n if @admin_room.save\n format.html { redirect_to [:admin, @admin_room.building], notice: 'Room was successfully created.' }\n # format.json { render :show, status: :created, location: @admin_room.building }\n else\n format.html { render :new }\n # format.json { render json: @admin_room.errors, status: :unprocessable_entity }\n end\n end\n end", "def create ( file, releaseNotes, makeActive=false, version=\"noversion\", environment=\"Test\" )\n fileName = File.basename( file.path)\n\n build_doc = {\n :build => {\n :platform => @platform,\n :environment => environment,\n :upload => file,\n :build_file => fileName,\n :release_notes => (releaseNotes!=nil) ? releaseNotes : '',\n :active => makeActive,\n :version => version\n }\n }\n\n begin\n response = RestClient.post @app_url + \"/api/apps/#{@appId}/builds\", build_doc, {'X-Token' => @api_token, :accept => :json}\n rescue => err\n raise RuntimeError.new( \"HTTP connection error: #{err.message}\")\n end\n\n if [200, 201, 202].include? response.code\n jobj = JSON.parse( response.body.to_s)\n else\n raise RuntimeError.new( \"Invalid response: #{response.code.to_s}\")\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.js\n format.json { render json: @building }\n end\n end", "def create\n if p = create_params\n if building = Building.create(p)\n # Finds a tag and adds it the new building, or if he tag is a new one, creates that tag first\n building.tags.concat(Tag.create_with(name: \"building\").find_or_create_by(name: \"building\"))\n \n # If there are extra tags to add, find/create them and add them\n if !params.permit(:tags)[:tags].blank?\n tags = params.permit(:tags)[:tags].split(\", \")\n for t in tags\n building.tags.concat(Tag.create_with(name: t).find_or_create_by(name: t))\n end\n end\n\n @notice = \"Created the new building.\"\n render :file => \"#{Rails.root}/public/success\", :layout => false\n else\n @notice = \"Create failed.\"\n render :file => \"#{Rails.root}/public/error\", :layout => false\n end\n else\n @notice = \"Invalid variables. Requires lat, long, name, description. Permits code, altitude, tags as well.\"\n render :file => \"#{Rails.root}/public/error\", :layout => false\n end\n end", "def upload_submission(sub_info)\n uri = URI.parse(TARGET_API)\n http = Net::HTTP.new(uri.host, uri.port)\n\n req = Net::HTTP::Post.new(\"/ontologies/#{sub_info['ontology']['acronym']}/submissions\")\n req['Content-Type'] = 'application/json'\n req['Authorization'] = \"apikey token=#{TARGET_APIKEY}\"\n\n # Check if the source BioPortal is pulling the ontology from an URL\n # If yes then we will pull the ontology from this place (allow auto update of the ontology when the ontology is changed in its source URL)\n if sub_info['pullLocation'].nil?\n pull_location = \"#{sub_info['ontology']['links']['download']}?apikey=#{SOURCE_APIKEY}\"\n else\n pull_location = sub_info['pullLocation']\n end\n\n # Extract contacts\n contacts = []\n sub_info['contact'].each do |contact|\n contacts.push({'name': contact['name'],'email': contact['email']})\n end\n\n # Build the json body\n # hasOntologyLanguage options: OWL, UMLS, SKOS, OBO\n # status: alpha, beta, production, retired\n req.body = {\n 'contact': contacts,\n 'hasOntologyLanguage': sub_info['hasOntologyLanguage'],\n 'released': sub_info['released'],\n 'ontology': \"#{TARGET_API}/ontologies/#{sub_info['ontology']['acronym']}\",\n 'description': sub_info['description'],\n 'status': sub_info['status'],\n 'version': sub_info['version'],\n 'homepage': sub_info['homepage'],\n 'documentation': sub_info['documentation'],\n 'publication': sub_info['publication'],\n 'naturalLanguage': sub_info['naturalLanguage'],\n 'pullLocation': pull_location\n }.to_json\n\n #puts req.body.to_s\n response = http.start do |http|\n http.request(req)\n end\n\n return response\nend", "def create_branding(params)\n request :post, \"/v3/brandings.json\", params\n end", "def create\n @apartment = @building.apartments.build(params[:apartment])\n\n respond_to do |format|\n if @apartment.save\n format.html { redirect_to @building, notice: 'Apartment was successfully created.' }\n format.json { render json: @apartment, status: :created, location: @apartment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @apartment.errors, status: :unprocessable_entity }\n end\n end\n end", "def building_and_grounds\n bag = SuperSuperCategory.find_by(name: \"Facilities\")\n super_categories = bag.super_categories\n\n if params[:org]\n @data = build_from_super_super_categories(super_categories, params[:org].to_i)\n else\n @data = build_from_super_super_categories(super_categories, 0)\n end\n\n render json: @data\n end", "def building_params\n params.require(:building).permit(:name, :history, :image, :latitude, :longitude)\n end", "def building_select\n p params[\"customer_id\"]\n @buildings = Building.where(customer_id: params[\"customer_id\"])\n respond_to do |format |\n format.json {\n render json: {\n buildings: @buildings\n }\n }\n end\n end", "def create\n @building = Building.find(params[:building_id])\n @picture = Picture.new(picture_params)\n @picture.building = @building\n @picture.user current_user\n if @picture.save\n render json: @picture, status: :created\n else\n render json: @picture.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @admin_building.update(admin_building_params)\n @admin_buildings = buildings(current_user)\n\n format.html { redirect_to @admin_building, notice: t(:building_notice_updated) }\n format.json { render :show, status: :ok, location: @admin_building }\n format.js { render :layout => false }\n else\n format.html { render :edit }\n format.json { render json: @admin_building.errors, status: :unprocessable_entity }\n format.js { render :layout => false }\n end\n end\n end", "def create\n @building_stage_sub_stage = Building::Stage::SubStage.new(building_stage_sub_stage_params)\n\n respond_to do |format|\n if @building_stage_sub_stage.save\n format.html { redirect_to @building_stage_sub_stage, notice: 'Sub stage was successfully created.' }\n format.json { render :show, status: :created, location: @building_stage_sub_stage }\n else\n format.html { render :new }\n format.json { render json: @building_stage_sub_stage.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n\n @flat = Flat.new\n @building=Building.find(params[:building_id])\n\n\n @flat.build_bhk_config\n @bhks=Bhk.all\n @buildings=Building.all\n\n @flat.connections.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flat }\n end\n end", "def get_buildings_for_customer\n puts \"get_buildings_for_customer\"\n puts params\n @buildings = Building.where(\"customer_id = ?\", params[:customer_id])\n puts \"here are the buildings:\"\n puts @buildings\n respond_to do |format|\n format.json { render :json => @buildings }\n end\n end", "def index\n @building = Building.find(params[:building_id])\n @listings = Listing.all\n end", "def new\n @apartment = @building.apartments.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @apartment }\n end\n end", "def update\n respond_to do |format|\n if @building.update(building_params)\n format.html { redirect_to @building, notice: \"Building was successfully updated.\" }\n format.json { render :show, status: :ok, location: @building }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @building.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @buildings = @buildings.order(:name)\n session[:sidebar] = 'building'\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.json { render json: @buildings }\n end\n end", "def building_stories_params\n params.permit(:building_id, data: [:id, :name, :multiplier, :z, :floor_to_floor_height, :floor_to_ceiling_height, :building_id])\n end", "def create\n #render :text=>params\n #return\n @building = Building.new(params[:building])\n @contact=Contact.new(params[:contact])\n\n\n respond_to do |format|\n if !@contact.name.blank? && @contact.save!\n format.html { redirect_to new_property_path(:contact => params[:contact_id]), :notice => 'Contact was successfully created.' }\n elsif !params[:selected_building].blank?\n @selected_building=Building.find(params[:selected_building])\n format.html { redirect_to new_property_path(@selected_building, :contact => params[:contact_id]), :notice => \"You selected #{@selected_building.name}. Now add the flat.\" }\n else\n if @building.save\n format.html { redirect_to new_property_path(@building, :contact => params[:contact_id]), :notice => 'Building was successfully created.' }\n else\n format.html { redirect_to new_property_path(@building, :contact => params[:contact_id]), :notice => \"Property could not be created. You must choose a building and put in the flat name and configuration\" }\n end\n end\n\n end\n end", "def new\n @building_type = BuildingType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @building_type }\n end\n end", "def post_architect_dependencytracking_build_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.post_architect_dependencytracking_build ...\"\n end\n \n # resource path\n local_var_path = \"/api/v2/architect/dependencytracking/build\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#post_architect_dependencytracking_build\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def building_params\n params.require(:building).permit(:building_type, :desativado, atendimentos_attributes:[:id, :building_id, :usuario_id, :_destroy])\n end", "def show\n @building_type = BuildingType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @building_type }\n end\n end", "def create\n #@opportunity = Opportunity.new(params[:opportunity])\n #@building = Building.find(params[:building_id])\n \n respond_to do |format|\n if @opportunity.save\n flash[:notice] = 'Opportunity was successfully created.'\n format.html { redirect_to(opportunity_path(@opportunity)) }\n format.xml { render :xml => @opportunity, :status => :created, :location => @opportunity }\n else\n flash[:error] = 'Opportunity could not be created.'\n format.html { render :action => \"new\" }\n format.xml { render :xml => @opportunity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def building_params\n params.require(:building).permit(:FullNameOfTheBuildingAdministrator, :EmailOfTheAdministratorOfTheBuilding, :PhoneNumberOfTheBuildingAdministrator, :FullNameOfTheTechContactForTheBuilding, :TechContactEmail, :TechContactPhone)\n end", "def create\n\n @listing = Listing.new(listing_params)\n\n @listing.save\n\n render json: @listing\n redirect_to listings_path # redirect to home page\n end", "def index\n if params[:search].nil? || params[:search].empty?\n @buildings = Building.paginate(page: params[:page])\n else\n @buildings = search_buildings(params[:search])\n end\n end", "def create\n @bingo = Bingo.new(bingo_params)\n\n respond_to do |format|\n if @bingo.save\n format.html { redirect_to @bingo, notice: \"Bingo was successfully created.\" }\n format.json { render :show, status: :created, location: @bingo }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bingo.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_architect_dependencytracking_build_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.post_architect_dependencytracking_build ...\"\n end\n \n # resource path\n local_var_path = \"/api/v2/architect/dependencytracking/build\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud Auth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#post_architect_dependencytracking_build\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def my_buildings\n \n end", "def new\n #@building = Building.new\n #APP_CONFIG['BusinessUnit'].keys.each { |bu| @building.building_occupancies.build(:business_unit => bu, :capacity => 0) }\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @building }\n end\n end", "def build_params\n params.require(:build).permit(:number, :version, :releaseNotes, :platform, :buildIdenifier, :accessToken, :domain, :provision, :displayname, :icon, :buildFilePath)\n end", "def building_params\n params.require(:building).permit(:streetname, :streetno, :postalcode, :avatar, :search, :gst, :qst)\n end", "def post(revision, key, options)\n post_path(\n path_to_post(revision),\n options.merge(key: key),\n get_parser(:object, Tinybucket::Model::BuildStatus)\n )\n end", "def create\n @thing = Thing.new(params[:thing])\n\n respond_to do |format|\n if @thing.save\n format.html { redirect_to @thing, notice: 'Thing was successfully created.' }\n format.json { render json: @thing, status: :created, location: @thing }\n else\n format.html { render action: \"new\" }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @complex_buildings = ComplexBuilding.all\n end", "def trigger_build_for_job(job, params = {})\n uri = URI(uri_for_job(job))\n \n body = nil\n\n if params.size > 0\n method = :post\n body = compile_jenkins_json(params)\n else\n method = :get\n end\n\n execute_http_request(method, uri, body)\n end", "def perform_post_request(build_type_id, check_for_changes_only, branch: nil)\n if check_for_changes_only\n http_post \"httpAuth/app/rest/vcs-root-instances/checkingForChangesQueue?locator=buildType:#{build_type_id}\"\n else\n http_post \"httpAuth/app/rest/buildQueue\", \"<build branchName=\\\"#{branch}\\\"><buildType id=\\\"#{build_type_id}\\\"/></build>\"\n end\n end", "def build_params\n params.require(:build).permit(:repo_id, :status)\n end", "def new\n @building = Building.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @building }\n end\n end", "def buildingdetail_params\n params.require(:buildingdetail).permit(:building_id, :information, :information_value)\n end", "def building_autocomplete\n record = resource_class.new street_house_number: params[:house],\n street_prefix: params[:prefix],\n street_name: params[:street],\n street_suffix: params[:suffix],\n locality_id: params[:locality_id]\n record.auto_strip_attributes\n buildings = BuildingsOnStreet.perform(record)\n render json: buildings.to_json\n end", "def create\n # @thing = Thing.new(thing_params)\n\n # respond_to do |format|\n # if @thing.save\n # format.html { redirect_to @thing, notice: 'Thing was successfully created.' }\n # format.json { render :show, status: :created, location: @thing }\n # else\n # format.html { render :new }\n # format.json { render json: @thing.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def build\n CircleCi.request(@conf, \"/project/#{username}/#{project}\").post\n end", "def find_building_by_id\n\t\tresponse = @service.fetch_building_by_id(selected_building_id, true, patient_data)\n\t\trender json: response\n\tend", "def json_post\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n puts \"json_post: submitting #{params[:path]}\" if @@debug\n path = params[:path]\n if path\n puts \"json_post: path is #{path} l=#{path.length}\" if @@debug\n path = path.split('/').compact()\n path.delete('')\n # you cannot make rooted nodes via json atm... fix? xxx\n if path.length > 1\n name = path.pop\n nodes = Note.make_path @user,path\n puts \"json_post: making at path #{path.join('/')}\" if @@debug\n if nodes\n note = nodes.last.make_child @user,params,name\n puts \"json_post: made child #{note} from #{name} l=#{name.length}\"\n params[:path] = path.join('/') # for call to json_query\n # it is important to do a query rather than returning the note; to get freshest order\n json_query\n return\n #write_json note if note\n end\n end\n end\n render :nothing => true\n end", "def update\n respond_to do |format|\n if @featured_building.update(featured_building_params)\n format.html { redirect_to redirect_path, notice: 'Featured building was successfully updated.' }\n format.json { render :json => { success: true, data: @featured_building } }\n else\n format.html { render :edit }\n format.json { render json: @featured_building.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @generation = Generation.new(generation_params)\n\n respond_to do |format|\n if @generation.save\n format.html { redirect_to [:admin, @generation], notice: 'Generation was successfully created.' }\n format.json { render json: @generation, status: :created, location: @generation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @generation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @building.update(building_params)\n format.html { redirect_to @building, notice: t('.update_ok', item: @building.name) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @building.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @device_submission = DeviceSubmission.new(device_submission_params)\n\n respond_to do |format|\n if @device_submission.save\n format.html { redirect_to @device_submission, notice: 'Device submission was successfully created.' }\n format.json { render :show, status: :created, location: @device_submission }\n else\n format.html { render :new }\n format.json { render json: @device_submission.errors, status: :unprocessable_entity }\n end\n end\n end", "def building_params\n params.require(resource_name).permit(:type, :price, :price_currency)\n end", "def create\n @house = House.new(house_params)\n\n if @house.save\n render :show, status: :created, location: @house\n else\n render json: @house.errors, status: :unprocessable_entity\n end\n end", "def building_params #pets-string, laundry-int, parking-string, num_apt-int\n params.require(:building).permit(:address, :city, :management, :pets, :laundry, :parking, :number_apartments, :picture)\n end", "def create\n @ongoing = Ongoing.new(params[:ongoing])\n \n\n respond_to do |format|\n if @ongoing.save\n format.html { redirect_to @ongoing, notice: 'Ongoing was successfully created.' }\n format.json { render json: @ongoing, status: :created, location: @ongoing }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ongoing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @listing = @commoner.listings.build(listing_params)\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n resource_instance_variable.assign_attributes(building_params)\n respond_to do |format|\n if resource_instance_variable.save\n format.html { redirect_to resource_instance_variable, notice: 'Building was successfully updated.' }\n format.json { render :show, status: :ok, location: resource_instance_variable }\n else\n format.html { render :edit }\n format.json { render json: resource_instance_variable.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.72877383", "0.6967386", "0.6944594", "0.6861559", "0.6552082", "0.6482148", "0.6481757", "0.6374498", "0.63399714", "0.63159066", "0.6311842", "0.6302082", "0.62486374", "0.62443686", "0.6242764", "0.6158093", "0.6128274", "0.60632986", "0.5998109", "0.598286", "0.59651864", "0.596388", "0.59258103", "0.59180397", "0.591133", "0.5910268", "0.5887535", "0.588175", "0.5881038", "0.5871892", "0.5826591", "0.582591", "0.58241916", "0.5802911", "0.57860184", "0.5775626", "0.57614446", "0.57569546", "0.57569546", "0.57246035", "0.5706698", "0.5698218", "0.56925476", "0.56890416", "0.56836915", "0.5656698", "0.5656041", "0.56440866", "0.5636831", "0.5625445", "0.56252414", "0.5610759", "0.56022847", "0.5600791", "0.5581962", "0.5578416", "0.55636764", "0.5522034", "0.5521338", "0.55145407", "0.5507499", "0.54945064", "0.54881155", "0.5466345", "0.54612267", "0.54608595", "0.5454876", "0.5443962", "0.5442835", "0.54421556", "0.5440131", "0.54396045", "0.54360044", "0.5434646", "0.5428497", "0.5424273", "0.541809", "0.54111236", "0.5410959", "0.5403688", "0.5400177", "0.5395748", "0.53941923", "0.5387991", "0.5386283", "0.53783697", "0.537392", "0.53687507", "0.5358883", "0.53424263", "0.5313957", "0.53134626", "0.5313342", "0.5288683", "0.5282386", "0.5276605", "0.5275099", "0.5271032", "0.5270347", "0.5269757" ]
0.69485223
2
PATCH/PUT /buildings/1 or /buildings/1.json
def update respond_to do |format| if @building.update(building_params) format.html { redirect_to @building, notice: "Building was successfully updated." } format.json { render :show, status: :ok, location: @building } else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @building.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @building = Building.find(params[:id])\n\n if @building.update_attributes(building_params)\n head :no_content\n else\n render json: @building.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @building.update(building_params)\n format.html { redirect_to @building, notice: t('.update_ok', item: @building.name) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @building.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @building = Building.find(params[:id].to_i)\n respond_to do |format|\n if @building.update(building_params)\n format.html { redirect_to @building, notice: 'Building updated.' }\n format.json { render :show, status: :ok, location: @building }\n else\n format.html { render :edit }\n err = @building.errors\n format.json { render json: err, status: :unprocessable_entity }\n end\n end\n end", "def update\n @building_type = BuildingType.find(params[:id])\n\n respond_to do |format|\n if @building_type.update_attributes(params[:building_type])\n format.html { redirect_to @building_type, notice: 'Building type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @building_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_building.update(admin_building_params)\n @admin_buildings = buildings(current_user)\n\n format.html { redirect_to @admin_building, notice: t(:building_notice_updated) }\n format.json { render :show, status: :ok, location: @admin_building }\n format.js { render :layout => false }\n else\n format.html { render :edit }\n format.json { render json: @admin_building.errors, status: :unprocessable_entity }\n format.js { render :layout => false }\n end\n end\n end", "def update\n respond_to do |format|\n if @featured_building.update(featured_building_params)\n format.html { redirect_to redirect_path, notice: 'Featured building was successfully updated.' }\n format.json { render :json => { success: true, data: @featured_building } }\n else\n format.html { render :edit }\n format.json { render json: @featured_building.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @complex_building.update(complex_building_params)\n format.html { redirect_to @complex_building, notice: 'complex_building was successfully updated.' }\n format.json { render :show, status: :ok, location: @complex_building }\n else\n format.html { render :edit }\n format.json { render json: @complex_building.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @build = Build.find(params[:id])\n\n respond_to do |format|\n if @build.update_attributes(params[:build])\n format.html { redirect_to @build, notice: 'Build was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @build.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @build = Build.find(params[:id])\n\n respond_to do |format|\n if @build.update_attributes(params[:build])\n format.html { redirect_to @build, notice: 'Build was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @build.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @buildingdetail.update(buildingdetail_params)\n format.html { redirect_to @buildingdetail, notice: \"Buildingdetail was successfully updated.\" }\n format.json { render :show, status: :ok, location: @buildingdetail }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @buildingdetail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @os_build.update(os_build_params)\n format.html { redirect_to @os_build, notice: 'Os build was successfully updated.' }\n format.json { render :show, status: :ok, location: @os_build }\n else\n format.html { render :edit }\n format.json { render json: @os_build.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n resource_instance_variable.assign_attributes(building_params)\n respond_to do |format|\n if resource_instance_variable.save\n format.html { redirect_to resource_instance_variable, notice: 'Building was successfully updated.' }\n format.json { render :show, status: :ok, location: resource_instance_variable }\n else\n format.html { render :edit }\n format.json { render json: resource_instance_variable.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @building = Building.find(params[:id])\n\n respond_to do |format|\n if @building.update_attributes(params[:building])\n flash[:notice] = 'Building was successfully updated.'\n format.html { redirect_to(@building) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @building.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @built_with.update(built_with_params)\n format.html { redirect_to @built_with, notice: 'Built with was successfully updated.' }\n format.json { render :show, status: :ok, location: @built_with }\n else\n format.html { render :edit }\n format.json { render json: @built_with.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@building = Building.find(params[:id])\n\n respond_to do |format|\n if @building.update_attributes(params[:building])\n flash[:notice] = 'Building was successfully updated.'\n format.html { redirect_to(@building) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @building.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @build.update(build_params)\n format.html { redirect_to @build, notice: \"Build was successfully updated.\" }\n format.json { render :show, status: :ok, location: @build }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @build.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @build.update(build_params)\n format.html { redirect_to @build, notice: 'Build was successfully updated.' }\n format.json { render :show, status: :ok, location: @build }\n else\n format.html { render :edit }\n format.json { render json: @build.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @building_type = BuildingType.find(params[:id])\n\n respond_to do |format|\n if @building_type.update_attributes(params[:building_type])\n flash[:notice] = 'BuildingType was successfully updated.'\n format.html { redirect_to(@building_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @building_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listing.update(listing_params)\n @building = @listing.building\n format.html { redirect_to [@building, @listing], notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_building.update(user_building_params)\n format.html { redirect_to @user_building, notice: 'User building was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_building }\n else\n format.html { render :edit }\n format.json { render json: @user_building.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @build_number.update(build_number_params)\n format.html { redirect_to @build_number, notice: 'Build number was successfully updated.' }\n format.json { render :show, status: :ok, location: @build_number }\n else\n format.html { render :edit }\n format.json { render json: @build_number.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ninja = Ninja.find(params[:id])\n\n respond_to do |format|\n if @ninja.update_attributes(params[:ninja])\n format.html { redirect_to @ninja, notice: 'Ninja was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ninja.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @building = args[:building] if args.key?(:building)\n @number = args[:number] if args.key?(:number)\n end", "def set_building\n @building = Building.find(params[:id])\n end", "def set_building\n @building = Building.find(params[:id])\n end", "def set_building\n @building = Building.find(params[:id])\n end", "def set_building\n @building = Building.find(params[:id])\n end", "def update\n @title = t('view.buildings.modal.involved_building')\n @building = Building.find(params[:id])\n\n if @building.update_attributes(params[:building])\n js_notify message: t('view.buildings.correctly_created'),\n type: 'alert-info js-notify-18px-text', time: 2500\n render partial: 'mobile_interventions/building',\n locals: { building: @building }, content_type: 'text/html'\n else\n render partial: 'edit', status: :unprocessable_entity\n end\n rescue ActiveRecord::StaleObjectError\n redirect_to [\n 'edit', @intervention, @endowment, 'mobile_intervention', @building\n ], alert: t('view.buildings.stale_object_error')\n end", "def index\n @buildings = Building.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json :@buildings }\n end\n end", "def building(building_id)\n perform_get_request(\"/building/#{building_id}\")\n end", "def set_building\n @building = Building.where(id: params[:id]).first\n end", "def update\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to @thing, notice: 'Thing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to things_path, notice: 'Your thing was successfully updated!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @building_id = args[:building_id] if args.key?(:building_id)\n @building_name = args[:building_name] if args.key?(:building_name)\n @current = args[:current] if args.key?(:current)\n @desk_code = args[:desk_code] if args.key?(:desk_code)\n @floor_name = args[:floor_name] if args.key?(:floor_name)\n @floor_section = args[:floor_section] if args.key?(:floor_section)\n @last_update_time = args[:last_update_time] if args.key?(:last_update_time)\n @metadata = args[:metadata] if args.key?(:metadata)\n @source = args[:source] if args.key?(:source)\n @type = args[:type] if args.key?(:type)\n @value = args[:value] if args.key?(:value)\n end", "def update\n @house = House.find(params[:id])\n\n respond_to do |format|\n if @house.update_attributes(params[:house])\n format.html { redirect_to @house, notice: 'Gig was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @house.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @building = Building.new(building_params)\n\n if @building.save\n render json: @building, status: :created, location: @building\n else\n render json: @building.errors, status: :unprocessable_entity\n end\n end", "def show\n @building = Building.find(params[:id])\n\n if stale? @building\n render json: @building\n end\n end", "def update\n @build_object = BuildObject.find(params[:id])\n @build_object.user = current_user\n respond_to do |format|\n if @build_object.update_attributes(params[:build_object])\n format.html { redirect_to @build_object, notice: 'Объект успешно обновлен.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @build_object.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @help = Help.find_by_id(1)\n @allbuildings = Building.all\n @allbuildings.each do |b|\n b.gst = @help.gst\n b.qst = @help.qst\n b.save\n end\n \n respond_to do |format|\n if @help.update(help_params)\n format.html { redirect_to @help, notice: 'Help was successfully updated.' }\n format.json { render :show, status: :ok, location: @help }\n #redirect_to action: \"index\"\n else\n format.html { render :edit }\n format.json { render json: @help.errors, status: :unprocessable_entity }\n #redirect_to action: \"index\"\n end\n end\n end", "def update\n respond_to do |format|\n if @building_stage_sub_stage.update(building_stage_sub_stage_params)\n format.html { redirect_to @building_stage_sub_stage, notice: 'Sub stage was successfully updated.' }\n format.json { render :show, status: :ok, location: @building_stage_sub_stage }\n else\n format.html { render :edit }\n format.json { render json: @building_stage_sub_stage.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n job = Job.find(params[:id])\n job.update_attributes(job_params)\n render json: job\n end", "def update\n @apartment = @building.apartments.find(params[:id])\n\n respond_to do |format|\n if @apartment.update_attributes(params[:apartment])\n format.html { redirect_to building_url(@building), notice: 'Apartment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @apartment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @route_builder.update(route_builder_params)\n format.html { redirect_to @route_builder, notice: 'Route builder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @route_builder.errors, status: :internal_server_error }\n end\n end\n\n end", "def update\n goal = Goal.find params[:id]\n if goal.update(goal_params)\n render json: goal, status: 200\n else\n render json: goal.errors.full_messages, status: 422\n end\n end", "def update\n @thing = Thing.find(params[:id])\n params[:thing][:place_id] = place_id_from_form\n params[:thing][:owner_ids] = [ ] if params[:thing][:owner_ids].nil?\n params[:thing][:keeper_ids] = [ ] if params[:thing][:keeper_ids].nil?\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to(@thing, :notice => 'Thing was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @thing.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @generation = Generation.find(params[:id])\n\n respond_to do |format|\n if @generation.update_attributes(generation_params)\n format.html { redirect_to [:admin, @generation], notice: 'Generation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @generation.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 respond_to do |format|\n if @jogo.update(jogo_params)\n format.html { redirect_to @jogo, notice: 'Jogo was successfully updated.' }\n format.json { render :show, status: :ok, location: @jogo }\n else\n format.html { render :edit }\n format.json { render json: @jogo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_building = Admin::Building.new(admin_building_params)\n @admin_building.user = current_user\n respond_to do |format|\n if @admin_building.save\n\n @admin_buildings = buildings(current_user)\n\n create_default_service(@admin_building)\n\n format.html { redirect_to @admin_building, notice: t(:building_notice_created) }\n format.json { render :show, status: :created, location: @admin_building }\n format.js { render :layout => false }\n else\n format.html { render :new }\n format.json { render json: @admin_building.errors, status: :unprocessable_entity }\n format.js { render :layout => false }\n end\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n # respond_to do |format|\n # if @thing.update(thing_params)\n # format.html { redirect_to @thing, notice: 'Thing was successfully updated.' }\n # format.json { render :show, status: :ok, location: @thing }\n # else\n # format.html { render :edit }\n # format.json { render json: @thing.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def update\n @ongoing = Ongoing.find(params[:id])\n\n respond_to do |format|\n if @ongoing.update_attributes(params[:ongoing])\n format.html { redirect_to @ongoing, notice: 'Ongoing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ongoing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @updateProperties = []\n Property.all.each do |p|\n if @building.half_address == p.buildinginfo\n @updateProperties << p\n end\n end\n @updateTenants = []\n Tenant.all.each do |t|\n if @building.half_address == t.tenantbuildinginfo\n @updateTenants << t\n end\n end\n @updateExpenses = []\n Expense.all.each do |e|\n if @building.half_address == e.buildinginfo\n @updateExpenses << e\n end\n end\n\n respond_to do |format|\n if @building.update(building_params)\n @updateProperties.each do |p|\n p.buildinginfo = @building.half_address\n p.save\n end\n @updateTenants.each do |t|\n t.tenantbuildinginfo = @building.half_address\n t.save\n end\n @updateExpenses.each do |e|\n e.buildinginfo = @building.half_address\n e.save\n end\n format.html { redirect_to @building, notice: 'Building was successfully updated.' }\n format.json { render :show, status: :ok, location: @building }\n else\n format.html { render :edit }\n format.json { render json: @building.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @gen = Gen.find(params[:id])\n\n respond_to do |format|\n if @gen.update_attributes(params[:gen])\n format.html { redirect_to @gen, notice: 'Gen was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gen.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @floor = Floor.find(params[:id])\n\n respond_to do |format|\n if @floor.update_attributes(params[:floor])\n format.html { redirect_to @floor, notice: 'Floor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @floor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @clothing.update(clothing_params)\n format.html { redirect_to @clothing, notice: 'Clothing was successfully updated.' }\n format.json { render :show, status: :ok, location: @clothing }\n else\n format.html { render :edit }\n format.json { render json: @clothing.errors, status: :unprocessable_entity }\n end\n end\n end", "def save!\n client.put_build(app_id: app_id, build_id: id, build: self)\n end", "def set_building\n begin\n resource = resource_class.find(params[:id])\n instance_variable_set(resource_instance_variable_name, resource)\n rescue\n render_not_found\n end\n end", "def update\n if @building.update(update_params)\n if t = params.permit(:tags)[:tags]\n tag_names = t.split(\", \")\n tags = [Tag.create_with(name: \"building\").find_or_create_by(name: \"building\")]\n for n in tag_names\n tags += [Tag.create_with(name: n).find_or_create_by(name: n)]\n end\n @building.tags = tags\n end\n @notice = \"Updated successfully.\"\n render :file => \"#{Rails.root}/public/success\", :layout => false\n else\n @notice = \"Update failed.\"\n render :file => \"#{Rails.root}/public/error\", :layout => false\n end\n end", "def update\n @grocery = Grocery.find(params[:id])\n\n if @grocery.update(grocery_params)\n head :no_content\n else\n render json: @grocery.errors, status: :unprocessable_entity\n end\n end", "def show\n @building_type = BuildingType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @building_type }\n end\n end", "def update\n respond_to do |format|\n if @stuffing_cake.update(stuffing_cake_params)\n format.html { redirect_to @stuffing_cake, notice: 'Stuffing cake was successfully updated.' }\n format.json { render :show, status: :ok, location: @stuffing_cake }\n else\n format.html { render :edit }\n format.json { render json: @stuffing_cake.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @building_block.update(building_block_params)\n format.html { redirect_to @building_block, notice: 'Building block was successfully updated.' }\n format.json { render :show, status: :ok, location: @building_block }\n else\n format.html { render :edit }\n format.json { render json: @building_block.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @builds = current_application.builds\n @build = current_application.builds.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @builds }\n end\n end", "def update\n respond_to do |format|\n if @bingo.update(bingo_params)\n format.html { redirect_to @bingo, notice: \"Bingo was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bingo }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bingo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tooling_specification = ToolingSpecification.find(params[:id])\n\n respond_to do |format|\n if @tooling_specification.update_attributes(params[:tooling_specification])\n format.html { redirect_to @tooling_specification, notice: 'Tooling specification was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tooling_specification.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 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 find_building_by_id\n\t\tresponse = @service.fetch_building_by_id(selected_building_id, true, patient_data)\n\t\trender json: response\n\tend", "def update\n respond_to do |format|\n if @requirement.update_attributes(requirement_params)\n format.html { redirect_to action: :index, notice: 'Update Success.' }\n format.json { render action: :index, status: :accepted }\n else\n format.html { render action: :edit }\n format.json { render json: @requirement.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @building = Building.new(building_params)\n\n respond_to do |format|\n if @building.save\n format.html { redirect_to @building, notice: \"Building was successfully created.\" }\n format.json { render :show, status: :created, location: @building }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @building.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n recipe.update(recipe_params)\n render json: recipe\n end", "def update\n @plate = Plate.find(params[:id])\n\n if @plate.update(params[:plate])\n head :no_content\n else\n render json: @plate.errors, status: :unprocessable_entity\n end\n end", "def update\n if @requirement.update(requirement_params)\n render :show, status: :ok, location: @requirement\n else\n render json: @requirement.errors, status: :unprocessable_entity\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 # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n @stuff = Stuff.find(params[:id])\n\n respond_to do |format|\n if @stuff.update_attributes(params[:stuff])\n format.html { redirect_to @stuff, :notice => 'Stuff was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @stuff.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @small_generator = SmallGenerator.find(params[:id])\n\n respond_to do |format|\n if @small_generator.update_attributes(params[:small_generator])\n format.html { redirect_to @small_generator, notice: 'Small generator was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @small_generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @building = Building.new(building_params)\n respond_to do |format|\n if @building.save\n format.html { redirect_to @building, notice: 'Building created.' }\n format.json { render :show, status: :created, location: @building }\n else\n format.html { render :new }\n err = @building.errors\n format.json { render json: err, status: :unprocessable_entity }\n end\n end\n end", "def update\n #if game exists, pass here to update state\n @game = Game.find_by(id: params[:id])\n @game.update(game_params)\n render json: @game, status: 201\n end", "def create\n @building = Building.new(building_params)\n\n respond_to do |format|\n if @building.save\n format.html { redirect_to @building, notice: 'Building was successfully created.' }\n format.json { render :show, status: :created, location: @building }\n else\n format.html { render :new }\n format.json { render json: @building.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @one = One.find(params[:id])\n\n respond_to do |format|\n if @one.update_attributes(params[:one])\n format.html { redirect_to @one, notice: 'One was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @one.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_buildingdetail\n @buildingdetail = Buildingdetail.find(params[:id])\n end", "def update\n respond_to do |format|\n if @house.update(house_params)\n format.html { redirect_to @house, notice: 'House was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @house.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @floor = Floor.find(params[:id])\n params[:floor][:location_id] = params[:floor][:loc_id]\n params[:floor].delete :loc_id\n respond_to do |format|\n if @floor.update_attributes(params[:floor])\n format.html { redirect_to floors_path, notice: 'Floor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @floor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@opportunity = Opportunity.find(params[:id])\n #@floor = @opportunity.floor\n #@building = @floor.building\n\n respond_to do |format|\n if @opportunity.update_attributes(params[:opportunity])\n flash[:notice] = 'Opportunity was successfully updated.'\n format.html { redirect_to(opportunity_path(@opportunity)) }\n format.xml { head :ok }\n else\n flash[:error] = 'Opportunity could not be updated.'\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @opportunity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def build(building)\n @building = building\n end", "def update\n respond_to do |format|\n if @glo_collection.update(glo_collection_params)\n format.html { redirect_to @glo_collection, notice: 'Glo collection was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @glo_collection.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @goody = Goody.find(params[:id])\n\n respond_to do |format|\n if @goody.update_attributes(params[:goody])\n format.html { redirect_to @goody, notice: 'Goody was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goody.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @major = Major.find(params[:id])\n\n respond_to do |format|\n if @major.update_attributes(params[:major])\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @orging.update(orging_params)\n format.html { redirect_to @orging, notice: 'Orging was successfully updated.' }\n format.json { render :show, status: :ok, location: @orging }\n else\n format.html { render :edit }\n format.json { render json: @orging.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @kind = args[:kind] unless args[:kind].nil?\n @listings = args[:listings] unless args[:listings].nil?\n end", "def update!(**args)\n @kind = args[:kind] unless args[:kind].nil?\n @listings = args[:listings] unless args[:listings].nil?\n end", "def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end", "def update\n respond_to do |format|\n if @kota_stone.update(kota_stone_params)\n format.html { redirect_to kota_stones_url, notice: 'Kota stone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kota_stone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @floor_stage.update(floor_stage_params)\n format.html { redirect_to @floor_stage, notice: 'Stage was successfully updated.' }\n format.json { render :show, status: :ok, location: @floor_stage }\n else\n format.html { render :edit }\n format.json { render json: @floor_stage.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def new\n @building_type = BuildingType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @building_type }\n end\n end", "def update\n respond_to do |format|\n if @specific_gravity.update(specific_gravity_params)\n format.html { redirect_to @batch, notice: 'Specific gravity was successfully updated.' }\n format.json { render :show, status: :ok, location: @specific_gravity }\n else\n format.html { render :edit }\n format.json { render json: @specific_gravity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @junction = Junction.find(params[:id])\n\n respond_to do |format|\n if @junction.update_attributes(params[:junction])\n format.html { redirect_to @junction, notice: 'Junction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @junction.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7250559", "0.6813738", "0.68066853", "0.6684587", "0.6680801", "0.6656561", "0.63786113", "0.63300896", "0.63297075", "0.6308987", "0.6285002", "0.6258303", "0.62322617", "0.62213004", "0.6217014", "0.6213388", "0.6187155", "0.6130243", "0.61281073", "0.59931046", "0.58844346", "0.58447546", "0.57925975", "0.5758427", "0.5758427", "0.5758427", "0.5758427", "0.57142776", "0.5697099", "0.5688278", "0.5670885", "0.5668163", "0.56646323", "0.56405586", "0.5606865", "0.5595048", "0.5584985", "0.5582523", "0.557251", "0.55651855", "0.5548534", "0.5518833", "0.54950815", "0.5477885", "0.54774195", "0.54610956", "0.54511136", "0.5448386", "0.5439388", "0.54373926", "0.5437305", "0.5434178", "0.5433526", "0.54258037", "0.54213345", "0.54195297", "0.5412955", "0.5412606", "0.5406248", "0.53971744", "0.53954256", "0.5395276", "0.53801924", "0.53723896", "0.53344744", "0.5330504", "0.5321545", "0.53163815", "0.5302527", "0.5295058", "0.52933633", "0.52882034", "0.5283942", "0.5282776", "0.5280383", "0.52767366", "0.5270182", "0.5269449", "0.52671057", "0.52658147", "0.52635056", "0.5261616", "0.5260666", "0.52591825", "0.524761", "0.52475435", "0.5246064", "0.5241003", "0.5235051", "0.52340126", "0.5231045", "0.52273655", "0.52273655", "0.52272403", "0.52271396", "0.5224791", "0.52238834", "0.5223778", "0.52232045", "0.5220716" ]
0.67374265
3
DELETE /buildings/1 or /buildings/1.json
def destroy @building.destroy respond_to do |format| format.html { redirect_to buildings_url, notice: "Building was successfully destroyed." } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @building = Building.find(params[:id].to_i)\n @building.destroy\n respond_to do |format|\n format.html { redirect_to buildings_url, notice: 'Building destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @building = Building.find(params[:id])\n @building.destroy\n\n head :no_content\n end", "def destroy\n @building = Building.find(params[:id])\n @building.destroy\n\n respond_to do |format|\n format.html { redirect_to(buildings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @building_type = BuildingType.find(params[:id])\n @building_type.destroy\n\n respond_to do |format|\n format.html { redirect_to building_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_building.destroy\n respond_to do |format|\n format.html { redirect_to admin_buildings_url, notice: t(:building_notice_destroyed) }\n format.json { head :no_content }\n end\n end", "def destroy\n #@building = Building.find(params[:id])\n @building.destroy\n\n respond_to do |format|\n format.html { redirect_to(buildings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @building.destroy\n respond_to do |format|\n format.html { redirect_to buildings_url, notice: 'Building was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @build.destroy\n respond_to do |format|\n format.html { redirect_to builds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n the_name = @building.name\n unless session[:current_building].nil?\n session[:current_building] = nil if session[:current_building].to_i == @building.id.to_i\n end\n @building.destroy\n respond_to do |format|\n format.html { redirect_to buildings_url, status: 303, notice: t('.delete_ok', item: the_name) }\n format.json { head :no_content }\n end\n end", "def destroy\n @build = Build.find(params[:id])\n @build.destroy\n\n respond_to do |format|\n format.html { redirect_to builds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @build = Build.find(params[:id])\n @build.destroy\n\n respond_to do |format|\n format.html { redirect_to builds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @complex_building.destroy\n respond_to do |format|\n format.html { redirect_to complex_buildings_url, notice: 'complex_building was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @os_build.destroy\n respond_to do |format|\n format.html { redirect_to os_builds_url, notice: 'Os build was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @building_type = BuildingType.find(params[:id])\n @building_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(building_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @build.destroy\n respond_to do |format|\n format.html { redirect_to builds_url, notice: 'Build was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @build.destroy\n respond_to do |format|\n format.html { redirect_to builds_url, notice: \"Build was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end", "def destroy\n @building_id = @unit.building_id\n @unit.destroy\n respond_to do |format|\n format.html { redirect_to building_path(@building_id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @built_with.destroy\n respond_to do |format|\n format.html { redirect_to built_withs_url, notice: 'Built with was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n resource_instance_variable.destroy\n respond_to do |format|\n format.html { redirect_to buildings_url, notice: 'Building was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @buildingdetail.destroy\n respond_to do |format|\n format.html { redirect_to buildingdetails_url, notice: \"Buildingdetail was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n respond_to do |format|\n if @featured_building.destroy\n format.html { \n redirect_to destroy_redirect_url, notice: 'Featured building was successfully deleted.' \n }\n format.json { head :no_content }\n else\n flash[:error] = @featured_building.errors.messages[:base][0]\n format.html { redirect_to destroy_redirect_url }\n end\n end\n end", "def destroy\n building_id = @wing.building_id\n wing_name = @wing.name\n @wing.destroy\n respond_to do |format|\n format.html { redirect_to building_url(building_id), status: 303, notice: t('.delete_ok', item: wing_name) }\n format.json { head :no_content }\n end\n end", "def destroy\n @build_object = BuildObject.find(params[:id])\n @build_object.archive!\n\n respond_to do |format|\n format.html { redirect_to build_objects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_building.destroy\n respond_to do |format|\n format.html { redirect_to user_buildings_url, notice: 'User building was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ninja = Ninja.find(params[:id])\n @ninja.destroy\n\n respond_to do |format|\n format.html { redirect_to ninjas_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @house = House.find(params[:id])\n @house.destroy\n\n respond_to do |format|\n format.html { redirect_to gigs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n compute.delete_flavor(params[:id])\n \n\n respond_to do |format|\n format.html { redirect_to flavors_path }\n format.json { head :ok }\n end\n end", "def destroy\n @url_builder.destroy\n respond_to do |format|\n format.html { redirect_to url_builders_url, notice: 'Url builder was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def clean\n FileUtils.rm(\"#{build_name}.json\")\n end", "def destroy\n @floor.destroy\n respond_to do |format|\n format.html { redirect_to @floor.building, notice: t('flash.floor.delete') }\n format.json { head :no_content }\n end\n end", "def delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end", "def destroy\n @version = Version.find(params[:id])\n @versionconfig = @version.version_configurations.destroy_all\n @version.destroy\n\n respond_to do |format|\n format.html { redirect_to [@application, @version] }\n format.json { head :no_content }\n end\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @building = Building.find(params[:id])\n @building.destroy\n\n js_notify message: t('view.buildings.correctly_destroyed'),\n type: 'alert-danger js-notify-18px-text', time: 2500\n render nothing: true, content_type: 'text/html'\n end", "def delete\n api_delete(\"/listings/#{@listing_id}\")\n end", "def destroy\n\n respond_to do |format|\n if @route_builder.destroy\n format.html { redirect_to action: :index }\n format.json { render :nothing => true, :status => :ok}\n else\n #TODO: better message for deletion failure\n format.html { redirect_to action: :index}\n format.json { render json: {:message=> e.to_s}.to_json, status: :internal_server_error }\n end\n end\n\n end", "def destroy\n @gen = Gen.find(params[:id])\n @gen.destroy\n\n respond_to do |format|\n format.html { redirect_to gens_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing = Listing.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to building_listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @small_generator = SmallGenerator.find(params[:id])\n @small_generator.destroy\n\n respond_to do |format|\n format.html { redirect_to small_generators_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @generation = Generation.find(params[:id])\n @generation.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_generations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @house.destroy\n respond_to do |format|\n format.html { redirect_to houses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @house.destroy\n respond_to do |format|\n format.html { redirect_to houses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @house.destroy\n respond_to do |format|\n format.html { redirect_to house_url }\n format.json { head :no_content }\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def destroy\n Generator.where(id: params[:id] ).first.destroy\n respond_to do |format|\n format.html { redirect_to generators_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @specific_gravity.destroy\n respond_to do |format|\n format.html { redirect_to @batch, notice: 'Specific gravity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @thing = Thing.find(params[:id])\n @thing.destroy\n\n respond_to do |format|\n format.html { redirect_to things_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @thing = Thing.find(params[:id])\n @thing.destroy\n\n respond_to do |format|\n format.html { redirect_to things_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gasto = Gasto.find(params[:id])\n @gasto.destroy\n\n respond_to do |format|\n format.html { redirect_to gastos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @go = Go.find(params[:id])\n @go.destroy\n\n respond_to do |format|\n format.html { redirect_to manager_gos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @house = House.find(params[:id])\n @house.destroy\n\n respond_to do |format|\n format.html { redirect_to houses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @house = House.find(params[:id])\n @house.destroy\n\n respond_to do |format|\n format.html { redirect_to houses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @apartment = @building.apartments.find(params[:id])\n @apartment.destroy\n\n respond_to do |format|\n format.html { redirect_to @building, notice: 'Apartment was successfully removed.'}\n format.json { head :no_content }\n end\n end", "def destroy\n @baton = Baton.find(params[:id])\n @baton.destroy\n\n respond_to do |format|\n format.html { redirect_to batons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_room.destroy\n respond_to do |format|\n format.html { redirect_to admin_building_path(params[:building_id]), notice: 'Room was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ongoing = Ongoing.find(params[:id])\n @ongoing.destroy\n\n respond_to do |format|\n format.html { redirect_to ongoings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end", "def destroy\n @equipment_things_to_check.destroy\n respond_to do |format|\n format.html { redirect_to equipment_things_to_checks_url }\n format.json { head :no_content }\n end\n end", "def deleted(build)\n end", "def destroy\n @floor = Floor.find(params[:id])\n @floor.destroy\n\n respond_to do |format|\n format.html { redirect_to floors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @harvesting = Harvesting.find(params[:id])\n @harvesting.destroy\n\n respond_to do |format|\n format.html { redirect_to harvestings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @building_stage_sub_stage.destroy\n respond_to do |format|\n format.html { redirect_to building_stage_sub_stages_url, notice: 'Sub stage was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @publishing_house.destroy\n respond_to do |format|\n format.html { redirect_to publishing_houses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @one = One.find(params[:id])\n @one.destroy\n\n respond_to do |format|\n format.html { redirect_to ones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @house = House.find(params[:id])\n @house.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_houses_url(:realty_type => params[:realty_type]) }\n format.json { head :no_content }\n end\n end", "def destroy\n @buildchecktag.destroy\n respond_to do |format|\n format.html { redirect_to buildchecktags_url, notice: 'Buildchecktag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @definition = Definition.find(params[:id])\n @definition.destroy\n\n respond_to do |format|\n format.html { redirect_to definitions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @definition = Definition.find(params[:id])\n @definition.destroy\n\n respond_to do |format|\n format.html { redirect_to definitions_url }\n format.json { head :no_content }\n end\n end", "def delete_buildtype(buildtype_id)\n delete(\"buildTypes/#{buildtype_id}\")\n end", "def delete_api_revision(name, rev)\n delete(\"/apis/#{name}/revision/#{rev}\")\n end", "def destroy\n @htc.destroy\n respond_to do |format|\n format.html { redirect_to htcs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gatha.destroy\n respond_to do |format|\n format.html { redirect_to gathas_url }\n format.json { head :no_content }\n end\n end", "def delete()\n\n client.delete(\"/stories/#{gid}\") && true\n end", "def destroy\n @distro.destroy\n respond_to do |format|\n format.html { redirect_to distros_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 @slashdot_posting.destroy\n respond_to do |format|\n format.html { redirect_to slashdot_postings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @definition = Definition.find(params[:id])\n @definition.destroy\n\n respond_to do |format|\n format.html { redirect_to(definitions_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @deployment = Deployment.find(params[:id])\n @deployment.destroy\n\n respond_to do |format|\n format.html { redirect_to deployments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @genotype = Genotype.find(params[:id])\n @genotype.destroy\n\n respond_to do |format|\n format.html { redirect_to genotypes_url }\n format.json { head :ok }\n end\n end", "def delete(id)\n request(:delete, \"/recipes/#{id}.json\")\n end", "def destroy\n @stuff = Stuff.find(params[:id])\n @stuff.destroy\n\n respond_to do |format|\n format.html { redirect_to stuff_index_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 @gethotelstaticdatagd = Gethotelstaticdatagd.find(params[:id])\n @gethotelstaticdatagd.destroy\n\n respond_to do |format|\n format.html { redirect_to gethotelstaticdatagds_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @thing = Thing.find(params[:id])\n @thing.destroy\n\n respond_to do |format|\n format.html { redirect_to(things_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n #@opportunity = Opportunity.find(params[:id])\n #@building = @opportunity.floor.building\n @opportunity.destroy\n\n respond_to do |format|\n flash[:notice] = 'Opportunity was deleted.'\n format.html { redirect_to(opportunities_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @cake = Cake.find(params[:id])\n @cake.destroy\n\n respond_to do |format|\n format.html { redirect_to cakes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @building_block.destroy\n respond_to do |format|\n format.html { redirect_to building_blocks_path, notice: 'Building block was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @habitant.destroy\n respond_to do |format|\n format.html { redirect_to habitants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hoge = Hoge.find(params[:id])\n @hoge.destroy\n\n respond_to do |format|\n format.html { redirect_to hoges_url }\n format.json { head :ok }\n end\n end" ]
[ "0.7234771", "0.71095", "0.7079201", "0.70727664", "0.70217735", "0.70195794", "0.70169353", "0.6972529", "0.69528127", "0.69496524", "0.69496524", "0.6856756", "0.67897", "0.67828834", "0.6744567", "0.6741457", "0.6740434", "0.67290276", "0.6657518", "0.6580545", "0.6578945", "0.6577206", "0.65239364", "0.6431661", "0.63661724", "0.6329886", "0.63108045", "0.6237549", "0.6226067", "0.62192625", "0.6195531", "0.6171275", "0.61711943", "0.61155", "0.6110192", "0.6094593", "0.60844696", "0.6060015", "0.6052591", "0.6048372", "0.60464364", "0.6046064", "0.6042431", "0.604215", "0.6033558", "0.6032237", "0.60181516", "0.60181516", "0.60179573", "0.6016163", "0.6016163", "0.6016163", "0.6016163", "0.601372", "0.60095626", "0.6009032", "0.6009032", "0.60047823", "0.5995937", "0.59923303", "0.5986095", "0.5986095", "0.5982758", "0.59808415", "0.5970611", "0.596911", "0.59612864", "0.596118", "0.5953273", "0.59481096", "0.59439975", "0.5936611", "0.5935377", "0.5930713", "0.5926022", "0.59259826", "0.5915704", "0.5915704", "0.59054005", "0.5903637", "0.5900116", "0.589395", "0.58873355", "0.5884731", "0.58791953", "0.58784187", "0.5875754", "0.5872628", "0.5872194", "0.58705074", "0.5862249", "0.58620214", "0.5861572", "0.5861086", "0.5856277", "0.5854087", "0.58536744", "0.58523303", "0.585109", "0.5847783" ]
0.7013583
7
Use callbacks to share common setup or constraints between actions.
def set_building @building = Building.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a list of trusted parameters through.
def building_params params.require(:building).permit(:FullNameOfTheBuildingAdministrator, :EmailOfTheAdministratorOfTheBuilding, :PhoneNumberOfTheBuildingAdministrator, :FullNameOfTheTechContactForTheBuilding, :TechContactEmail, :TechContactPhone) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def allow_params_authentication!; end", "def whitelisted_args\n args.select &:allowed\n end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def filtered_parameters; end", "def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def expected_permitted_parameter_names; end", "def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def param_whitelist\n [:rating, :review]\n end", "def check_params; true; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def allowed?(*_)\n true\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end", "def valid_params?; end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def url_allowlist=(_arg0); end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def list_params\n params.permit(:list_name)\n end", "def valid_params_request?; end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end", "def safelists; end", "def authorize_own_lists\n authorize_lists current_user.lists\n end", "def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end", "def lists_params\n params.require(:list).permit(:name)\n\n end", "def list_params\n params.require(:list).permit(:name, :user_id)\n end", "def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end", "def check_params\n true\n end", "def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end", "def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend", "def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end", "def filter_parameters; end", "def filter_parameters; end", "def whitelist; end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.permit(:name)\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end", "def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end", "def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end", "def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def permitted_params\n []\n end", "def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end", "def params(list)\n @declared_params = list\n end", "def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end", "def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end", "def allow(ids); end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end", "def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end", "def safelist; end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def valid_for_params_auth?; end", "def default_param_whitelist\n [\"mode\"]\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def shopping_list_params\n params.require(:shopping_list).permit!\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def permitters\n @_parametrizr_permitters || {}\n end", "def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end", "def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end", "def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end", "def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end", "def url_allowlist; end", "def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end", "def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end", "def quote_params\n params.permit!\n end" ]
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.6326454", "0.63140553", "0.6299814", "0.62642586", "0.626006", "0.62578833", "0.6236823", "0.6227561", "0.6221758", "0.62200165", "0.620879", "0.61983657", "0.6195055", "0.6172993", "0.6156856", "0.61558664", "0.61521494", "0.6135789", "0.6121145", "0.61118174", "0.60736513", "0.6071645", "0.60632104", "0.60549796", "0.6043906", "0.6034662", "0.60207325", "0.6018568", "0.6016575", "0.60103434", "0.60084206", "0.600763", "0.6007443", "0.6003619", "0.6003619", "0.5995791", "0.5993301", "0.5993231", "0.5984926", "0.597122", "0.5968121", "0.5965808", "0.59640145", "0.59632224", "0.59602356", "0.59332967", "0.5927556", "0.5922805", "0.5909745", "0.5905083", "0.5904304", "0.5893434", "0.58888215", "0.58823985", "0.58823985", "0.58823985", "0.5873434", "0.58619875", "0.58533794", "0.5845531", "0.58426666", "0.58360124", "0.583218", "0.5828041", "0.5827927", "0.5816121", "0.5814705", "0.5812719", "0.581121", "0.5803423", "0.5803423", "0.57995003", "0.5794207", "0.5784923", "0.5781365", "0.5776385", "0.5774859", "0.57671493", "0.5766998", "0.57618684", "0.5758038" ]
0.0
-1
Add Examiner to report on. The report will output results for all added examiners.
def add_examiner(examiner) @total_smell_count += examiner.smells_count @examiners << examiner self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report_learner\n # I'm using the ! here so we can track down errors faster if there is an issue making\n # the report_learner\n super || create_report_learner!\n end", "def add_report\n # TODO: should traverse listener queue for conditions and callbacks\n if @rain == :warning or @rain == :imminent\n @site.reports.create\n end\n end", "def create_exams\n Course.all.each do |course|\n next if is_attending?(course) or succeeded_in?(course)\n\n exam_options = {\n :student_id => self.id,\n :course_id => course.id,\n :number => course.number,\n :attempt => attempts_for(course) + 1,\n :registered_at => Time.now\n }\n\n exams << Exam.create(exam_options)\n end\n end", "def add_email_log\n @@logs[@logname].outputters << EmailOutputter.new('email_out', # TODO (8) Make GUI for these prefs\n :server=>'heltenkelt.se',\n :port=>25,\n :domain=>'heltenkelt.se',\n :from=>'itunesfeeder@heltenkelt.se',\n :to=>'tommy@heltenkelt.se',\n :subject=>'Report from iTunesFeeder')\n end", "def record(seeder)\n seeders << seeder\n end", "def add_exhibit(exhibit)\n @exhibits.push exhibit\n end", "def append_report_for(command)\n checker.append_report_for(command, self.title, self.variant)\n end", "def set_exceller\n @exceller = Exceller.find(params[:id])\n end", "def participation employer_name, employer_id, total, enrolled, waived, plan_years, contacts\n total_employees = total_employees employer_name\n summary = summary_details employer_name, total_employees\n employer_details = summary.clone\n employer_util = ::EmployerUtil.new details: employer_details, plan_years: plan_years, total_employees: total_employees\n employer_util.add_plan_details\n\n employee_util = ::EmployeeUtil.new use_case_directory: @use_case_directory,\n employer_name: employer_name,\n enrolled: enrolled, plan_years: plan_years,\n total_employees: total_employees, waived: waived\n roster = employee_util.add_roster\n add_to_summary contacts, employer_util, plan_years, roster, summary, total_employees\n summary\n end", "def add_as_employee\n \tputs \"Called for new employee\"\n end", "def report(exception_report)\n @exceptions << exception_report\n end", "def result\n @exam = current_exam(params)\n\n @exam_reporter = @exam.evaluate(params[:answers])\n end", "def reporters; end", "def reporters; end", "def reporters; end", "def reporters; end", "def reporters; end", "def run_examination\n true\n end", "def add_employee_review(input)\n self.review = input\n positive_matches = 0\n negative_matches = 0\n\n positive = [/positive/i, /initiative/i, /great/i, /good/i, /helpful/i,\n /puntual/i, /positive/i, /encourage/i, /beneficial/i, /meets/i,\n /good/i, /(team player)/i, /(hard working)/i, /helps/i, /impressed/i, /impressive/i, /fast/i, /asset/i, /leadership/i, /leader/i, /efficient/i, /(willing to help)/i, /successfully/i,\n /pleasure/i]\n\n negative = [/negative/i, /lazy/i, /bad/i, /stubborn/i, /(misses deadlines)/i,\n /late/i, /concerns/i, /difficulty/i, /struggles/i, /limitations/i,\n /inconsistent/i, /inefficient/i, /(not done well)/i, /poorly/i,\n /badly/i, /rude/i, /(off topic)/i, /lack/i, /inadequate/i, /limitation/i, /(room for improvement)/i, ]\n positive.each do |r|\n matches = review.scan(r).count\n positive_matches += matches\n end\n negative.each do |r|\n matches = review.scan(r).count\n negative_matches += matches\n end\n self.satisfactory = (positive_matches > negative_matches)\n end", "def <<(reporter); end", "def run_after_add(attendance)\n puts 'after adding attendance'\n end", "def emp_report\n \n end", "def report\n puts \"Hello! My name is #{@name}, I've delivered #{@experience} papers\n today and I've earned $#{@earnings} so far!\"\n end", "def add_mailer(mailer)\n unless @mailers.include? mailer \n @mailers << mailer\n end\n end", "def add(alerter)\n @alerters << alerter\n alerter\n end", "def add_instructor(instructor)\n @instructors << instructor\n end", "def add_exercise(new_exercise, new_repeats, new_break)\n @exercises.push(new_exercise)\n @repititions.push(new_repeats)\n @break_time.push(new_break)\n end", "def ab_add_participant(_experiment, _alternative, _identity)\n raise \"Not implemented\"\n end", "def add_report_values\n\t\tunless self.patient.blank?\n\t\t\tself.reports.map{|report|\n\t\t\t\tif report.consider_for_processing?(self.history_tags)\n\t\t\t\t\treport.tests.map{|test|\n\t\t\t\t\t\ttest.add_result(self.patient,self.history_tags) \n\t\t\t\t\t}\n\t\t\t\tend\n\t\t\t}\n\t\tend\n\tend", "def run_before_add(attendance)\n puts 'before adding attendance'\n end", "def hire (teacher)\n @teachers << teacher\n end", "def report(report_class, cron_def = nil)\n @reports << report_class.new(cron_def)\n end", "def index\n @excellers = Exceller.all \n end", "def add\n\t\t$employee_info[get_employee_id] = {first_name: get_employee_first_name, last_name: get_employee_last_name, salary: get_employee_salary, tax_rate: get_employee_tax_rate}\n\t\tputs \"\"\n\t\tputs \"\"\n\t\tputs \"Employee successfully added!\"\n\tend", "def append_results(reports, filename, results)\n reports[filename] ||= []\n reports[filename] << {\n 'Date' => Time.now,\n 'Total' => results[:total],\n 'Complexity per method' => results[:per_method]\n }\n end", "def invite_employee(employees, event)\n employees.each do |e|\n Attendance.create(user_id: e, event_id: event, rsvp: \"Invited\")\n end\n end", "def add_email(e)\n emails << e\n end", "def generate_report_impressions\n\t\t## we don't do this at the moment.\n\t\t## now for verification.\n=begin\n\t\tself.reports.each do |report|\n\t\t\tif report.impression.blank?\n\t\t\t\treport.impression = \"\"\n\t\t\t\treport.tests.each do |test|\n\t\t\t\t\treport.impression += (\" \" + (test.display_comments_or_inference || \"\"))\n\t\t\t\tend\n\t\t\tend\n\t\tend\n=end\n\tend", "def give_all_raise\n @employees.each do |employee|\n employee.give_annual_raise\n end\n end", "def set_report\n end", "def add_error(_reportable)\n @errors << _reportable\n end", "def add_error(_reportable)\n @errors << _reportable\n end", "def examine\n if @examination_result.nil?\n @examination_result = run_examination\n else\n @examination_result\n end\n end", "def add_worker(worker)\n expect_arg :worker, Woodhouse::Layout::Worker, worker\n @workers << worker\n end", "def generate_new_hire_report\n lines = []\n\n column_titles = [\n 'Social Security Number',\n 'Name - Last',\n 'Name - First',\n 'Gender',\n 'Date of Birth',\n 'Date of Hire - Original',\n 'Date of Rehire',\n 'Termination Date',\n 'Address - Street 1',\n 'Address - Street 2',\n 'Address - City',\n 'Address - State',\n 'Address - Postal Code',\n 'Division ID',\n 'Pre-tax Deferral',\n 'Roth Amount',\n 'Matching Amount',\n 'Matching Safe Harbor',\n 'Profit Sharing',\n 'Non Elective Safe Harbor',\n 'Plan Compensation',\n 'Current Hours',\n 'Marital Status',\n 'Loan Payments',\n 'Internet Address - Other',\n 'PARTICIPANTID'\n ]\n lines.push(column_titles.join(','))\n\n plan_symlink = @config.plan.symlink\n plan = Plan.where('symlink = ?', plan_symlink).first\n @new_employees.each do |employee|\n date_of_birth = employee[RecordField::DATE_BIRTH]\n if date_of_birth.present? && date_of_birth.is_a?(Date)\n date_of_birth = DateUtils.to_string(date_of_birth)\n else\n date_of_birth = ''.to_date\n end\n participant = participant_mapping(plan.id, employee, date_of_birth)\n next if participant.nil?\n\n calculate_assumed_hour = Plan.calculate_assumed_hour(employee, plan.id)\n hours = plan.assumed_hours_setting ? calculate_assumed_hour : employee[RecordField::HOURS_REGULAR]\n cells = [\n (employee[RecordField::SSN] || '').gsub(/[^\\d]/, ''),\n employee[RecordField::NAME_LAST],\n employee[RecordField::NAME_FIRST],\n employee[RecordField::GENDER] || '',\n employee[RecordField::DATE_BIRTH] || ' ',\n employee[RecordField::DATE_HIRE] || ' ',\n employee[RecordField::DATE_REHIRE] || ' ',\n employee[RecordField::DATE_TERMINATION] || ' ',\n employee[RecordField::ADDRESS_STREET_1],\n employee[RecordField::ADDRESS_STREET_2],\n employee[RecordField::ADDRESS_CITY],\n employee[RecordField::ADDRESS_STATE],\n employee[RecordField::ADDRESS_POSTAL_CODE],\n employee[RecordField::DIVISION_ID],\n employee[RecordField::AMOUNT_CONTRIBUTION_TRADITIONAL],\n employee[RecordField::AMOUNT_CONTRIBUTION_ROTH],\n employee[RecordField::AMOUNT_MATCH],\n employee[RecordField::AMOUNT_MATCH_SAFE_HARBOR],\n employee[RecordField::AMOUNT_PROFIT_SHARING],\n employee[RecordField::AMOUNT_NON_ELECTIVE_SAFE_HARBOR],\n employee[RecordField::AMOUNT_PAY_GROSS],\n hours,\n employee[RecordField::MARITAL_STATUS],\n employee[RecordField::AMOUNT_LOAN_PAYMENTS],\n employee[RecordField::EMAIL] || ' ',\n participant.try(:id)\n ]\n lines.push(cells.join(','))\n end\n\n return lines.join(\"\\n\")\n end", "def add_checker(checker)\r\n @error_checkers << checker\r\n end", "def set_results\n @exam = Exam.find(params[:exam_id])\n end", "def build_exam_set\n @scores = new_collection\n @total_max = 0\n @total_score = 0\n @overrided_subjects = assessment_group.override_assessment_marks.find_all_by_course_id(batch.course_id).collect(&:subject_code)\n process_scores\n \n Models::ExamSet.new(\n :obj_id => assessment_group.id,\n :name => assessment_group.display_name,\n :scores => @scores,\n :aggregates => process_aggregates,\n :term_name => term_name(assessment_group),\n :term_exam => assessment_group.is_final_term,\n :group_exam => is_assessment_group?,\n :planner_exam => (assessment_group.is_final_term and (assessment_group.parent_type == 'AssessmentPlan')),\n :attendance_report => process_attendance,\n :planner_name => assessment_plan.name,\n :scoring_type => AssessmentGroup::SCORE[assessment_group.scoring_type],\n :show_percentage => (assessment_group.is_final_term && assessment_group.show_percentage?),\n :maximum_mark => assessment_group.maximum_marks,\n :hide_marks => assessment_group.hide_marks,\n :consider_skills => assessment_group.consider_skills\n )\n end", "def set_ee_report\n @ee_report = EeReport.find(params[:id])\n end", "def create\n return\n teacher = Teacher.find_by_name(params[:teacher])\n user = User.new(:username => params[:username])\n\n teacher.users << user\n \n user.record_exam(params)\n\n respond_to do |format|\n format.html { render :status => 200, :text => 'done' }\n end\n end", "def set_exapmle\n @exapmle = Exapmle.find(params[:id])\n end", "def exams_statistics\n end", "def add_line (method, parameters)\n @test_lines.push(TestLine.new(method, parameters))\n end", "def new_assessment\n AcademyEntriesMailer.new_assessment\n end", "def add_trainer(trainer)\n TrainerLocation.new(trainer, self)\n end", "def print_employer_instructions\n\n # Start new page.\n self.start_new_page()\n\n # Employer copy.\n employer = File.read(Rails.root.join('lib', 'assets', 'w2_employer.htm'))\n self.vms_text_box(employer, 0.25, 10.75, 3.75, 5, 8, :normal, :left, :center)\n self.vms_text_box(employer, 4.5, 10.75, 3.75, 5, 8, :normal, :left, :center)\n self.vms_text_box(employer, 0.25, 5.25, 3.75, 5, 8, :normal, :left, :center)\n self.vms_text_box(employer, 4.5, 5.25, 3.75, 5, 8, :normal, :left, :center)\n\n end", "def add_matcher(matcher)\n @matchers << matcher\n self\n end", "def set_exam_management\n @exam_management = ExamManagement.find(params[:id])\n end", "def add_planner(planner, appointer)\n if(planners.include?(appointer))\n planner_record = EventPlanner.new(:event_series => self,\n :user => planner,\n :appointer => approinter)\n planner_record.save!\n else\n logger.warn(\"User #{appointer.id} attempted to appoint user #{planner.id} as a planner for event #{self.id}, but is not allowed.\")\n end\n end", "def hire_employee(employee)\n @employees << employee\n end", "def set_exam_set\n @exam_set = ExamSet.find(params[:id])\n end", "def add_measure(measure_id, importer)\n @measure_importers[measure_id] = importer\n end", "def add_parser(klass)\n @ex_parsers.insert(0, klass)\n end", "def report_employee(employee)\n name, entries = *employee\n printf \"%s %.2f hours\\n\", name, total(entries)\nend", "def add_measure(measure_id, importer)\n @measure_importers[measure_id] = importer\n end", "def reporters=(_arg0); end", "def reporters=(_arg0); end", "def reporters=(_arg0); end", "def exam_details(ex)\n exams_data = ex.exams.all\n flag = false\n exams_data.each do |exam|\n exam.exam_scores.each do |es|\n flag = true if es.is_failed?\n end\n exams << exam if flag == true\n end\n exams\n end", "def append_results(reports, filename, res)\n reports[filename] ||= []\n reports[filename] << {\n 'Date' => Time.now,\n 'Total' => res.length,\n 'Tags' => format_result(res)\n }\n end", "def set_ee_report\n @ee_report = EeReport.find(params[:id])\n end", "def add_instrumentation(pattern)\n if @instrumented\n load_instrumentation_files(pattern)\n else\n @instrumentation_files << pattern\n end\n end", "def add_watcher\n email = args.shift\n create_watcher(email)\n puts \"Added #{email} as a watcher\"\n end", "def index\n @thenewsreporters = Thenewsreporter.all\n end", "def enter_examination_note(data_set)\n note = data_set[CoreConservationData::EXAMINATION_GROUP.name][0][CoreConservationData::EXAMINATION_NOTE.name]\n logger.debug \"Entering examination note '#{note}'\"\n wait_for_element_and_type(examination_note_input_locator(0), note) if note\n scroll_to_top\n end", "def experiment_applied\n application = Application.first\n ParticipantMailer.experiment_applied(application.participant, [application.schedule])\n end", "def add_entrance(exit)\n if !@entrances\n @entrances = []\n end\n @entrances << exit\n return\n end", "def add_instrumentation(file_pattern)\n record_api_supportability_metric(:add_instrumentation)\n NewRelic::Control.instance.add_instrumentation(file_pattern)\n end", "def reports\n user_reports.concat(mod_reports)\n end", "def report\n super\n\n begin\n puts \"Writing HTML reports to #{@reports_path}\"\n erb_str = File.read(@erb_template)\n renderer = ERB.new(erb_str)\n\n tests_by_suites = tests.group_by { |test| test_class(test) } # taken from the JUnit reporter\n\n suites = tests_by_suites.map do |suite, tests|\n suite_summary = summarize_suite(suite, tests)\n suite_summary[:tests] = tests.sort { |a, b| compare_tests(a, b) }\n suite_summary\n end\n\n suites.sort! { |a, b| compare_suites(a, b) }\n\n result = renderer.result(binding)\n File.open(html_file, 'w') do |f|\n f.write(result)\n end\n\n # rubocop:disable Lint/RescueException\n rescue Exception => e\n puts 'There was an error writing the HTML report'\n puts 'This may have been caused by cancelling the test run'\n puts 'Use mode => :verbose in the HTML reporters constructor to see more detail' if @mode == :terse\n puts 'Use mode => :terse in the HTML reporters constructor to see less detail' if @mode != :terse\n raise e if @mode != :terse\n end\n # rubocop:enable Lint/RescueException\n end", "def index\n @exhibits = Exhibit.added_by(current_admin_user).page(params[:page]).per(10)\n end", "def report\n\t\tend", "def index\n @introexams = Introexam.all\n end", "def add_event(event_hash)\n add_assertions!\n self.assertions.add_event(event_hash)\n end", "def report; end", "def report; end", "def report; end", "def report; end", "def report; end", "def publish_exam\n @date = Date.today\n @exam_group = ExamGroup.shod(params[:format])\n @exam_group.update(is_published: true)\n @exam_group.exams.each(&:create_exam_event)\n @batch = @exam_group.batch\n @exam_groups ||= @batch.exam_groups.all\n end", "def report\n \n end", "def index\n @exam_managements = ExamManagement.all\n end", "def add(page)\n return if task['skip_file_generation']\n num_rows = file_writer.add(page)\n\n if task['with_rehearsal'] and @index == 0 and !@rehearsaled\n if num_rows >= task['rehearsal_counts']\n load_rehearsal\n @rehearsaled = true\n end\n end\n end", "def index\n @exam_sets = ExamSet.all\n end", "def set_exam\n\t\t\t@exam = Exam.includes(:questions).find(params[:id])\n\t\tend", "def set_pe_descriptions\n physical_exams = \"Exámen físico:\\n\"\n\n if @options['head_neck_pe'] == true\n physical_exams += \" Cabeza y cuello: #{@record.consultations.last.physical_exams.where(exam_type: 'Head and Neck').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n if @options['chest_pe'] == true\n physical_exams += \" Torax: #{@record.consultations.last.physical_exams.where(exam_type: 'Chest').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n if @options['abdomen_pe'] == true\n physical_exams += \" Adbomen: #{@record.consultations.last.physical_exams.where(exam_type: 'Abdomen').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n if @options['genitals_pe'] == true\n physical_exams += \" Genitales: #{@record.consultations.last.physical_exams.where(exam_type: 'Genitals').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n if @options['soft_parts_pe'] == true\n physical_exams += \" Partes blandas: #{@record.consultations.last.physical_exams.where(exam_type: 'Soft Parts').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n if @options['extremities_pe'] == true\n physical_exams += \" Extremidades: #{@record.consultations.last.physical_exams.where(exam_type: 'Extremities').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n if @options['vascular_pe'] == true\n physical_exams += \" Vascular: #{@record.consultations.last.physical_exams.where(exam_type: 'Vascular').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n if @options['skin_pe'] == true\n physical_exams += \" Piel: #{@record.consultations.last.physical_exams.where(exam_type: 'Skin').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n if @options['mamma_pe'] == true\n physical_exams += \" Mamas: #{@record.consultations.last.physical_exams.where(exam_type: 'Mamma').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n if @options['others_pe'] == true\n physical_exams += \" Otros: #{@record.consultations.last.physical_exams.where(exam_type: 'Others').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n physical_exams += \"\\n\"\n end", "def add_teaching_event_attendee(body, opts = {})\n add_teaching_event_attendee_with_http_info(body, opts)\n nil\n end", "def add_with_class(analyzer_class, options={})\n analyzer = analyzer_class.new(target, self.options.merge(options))\n analyzer.exclude_file_patterns = exclude_file_patterns\n analyzer.logger = logger\n self.analyzers << analyzer\n analyzer\n end", "def append_report_for(command, title, variant)\n self.run(\"#{command} 2>&1 | tee -a #{self.report_filename_for(title, variant)}\")\n end", "def set_exam\n @exam_answer = ExamAnswer.find(params[:id])\n end" ]
[ "0.5348647", "0.52574337", "0.5132551", "0.5118087", "0.5097503", "0.509313", "0.5079046", "0.5067479", "0.50552934", "0.503946", "0.4997131", "0.49837166", "0.49324992", "0.49324992", "0.49324992", "0.49324992", "0.49324992", "0.49136785", "0.49005815", "0.48933992", "0.48592177", "0.48476017", "0.4822325", "0.4820948", "0.4803661", "0.47572154", "0.4755555", "0.47205478", "0.4715616", "0.47033983", "0.46934295", "0.4681893", "0.46810195", "0.46206516", "0.461661", "0.4612372", "0.4609948", "0.46094114", "0.4592633", "0.45889384", "0.45674163", "0.45674163", "0.45662174", "0.45572433", "0.45565733", "0.45529735", "0.45522496", "0.45454556", "0.4538574", "0.45383722", "0.45302057", "0.45279536", "0.45096007", "0.45043272", "0.44983086", "0.4497995", "0.44829288", "0.44721", "0.44698575", "0.44655752", "0.4460526", "0.44503593", "0.4449129", "0.4443357", "0.44374806", "0.44273317", "0.44273317", "0.44273317", "0.44224563", "0.4416966", "0.4407873", "0.43814775", "0.4374264", "0.43723598", "0.43629065", "0.43620926", "0.4359965", "0.4357474", "0.43495172", "0.4344611", "0.43442237", "0.4340251", "0.4337333", "0.43370253", "0.4332477", "0.4332477", "0.4332477", "0.4332477", "0.4332477", "0.43234387", "0.43188563", "0.4317372", "0.43149447", "0.4312591", "0.43122646", "0.43086526", "0.43073067", "0.430224", "0.42939526", "0.42888695" ]
0.7533612
0
Render the report results on STDOUT
def show raise NotImplementedError end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_report\n report = \"\"\n report << '<html>'\n report << ' <head>'\n report << \" <title>#{@title}</title>\"\n report << ' </head>'\n report << ' <body>'\n @text.each { |line| report << \" <p>#{line}</p>\" }\n report << ' </body>'\n report << '</html>'\n end", "def output_report\n\t\toutput_start\n\t\toutput_head\n\t\toutput_body_start\n\t\toutput_body\n\t\toutput_body_end\n\t\toutput_end\n\tend", "def print_results\n Report::print(@result_set)\n end", "def report(output)\n end", "def display_results\n print_header\n print_detailed_report\n write_csv_report\n display_status\n end", "def report\n super\n\n begin\n puts \"Writing HTML reports to #{@reports_path}\"\n erb_str = File.read(@erb_template)\n renderer = ERB.new(erb_str)\n\n tests_by_suites = tests.group_by { |test| test_class(test) } # taken from the JUnit reporter\n\n suites = tests_by_suites.map do |suite, tests|\n suite_summary = summarize_suite(suite, tests)\n suite_summary[:tests] = tests.sort { |a, b| compare_tests(a, b) }\n suite_summary\n end\n\n suites.sort! { |a, b| compare_suites(a, b) }\n\n result = renderer.result(binding)\n File.open(html_file, 'w') do |f|\n f.write(result)\n end\n\n # rubocop:disable Lint/RescueException\n rescue Exception => e\n puts 'There was an error writing the HTML report'\n puts 'This may have been caused by cancelling the test run'\n puts 'Use mode => :verbose in the HTML reporters constructor to see more detail' if @mode == :terse\n puts 'Use mode => :terse in the HTML reporters constructor to see less detail' if @mode != :terse\n raise e if @mode != :terse\n end\n # rubocop:enable Lint/RescueException\n end", "def write_report\n\n end", "def render output\n\t\t\t\treport_classification\n\n\t\t\t\treport_title Report.title\n\t\t\t\treport_subtitle \"Talking Points Report\"\n\t\t\t\treport_author \"This report was prepared by\\n#{Report.author}\"\n\n\t\t\t\t@output.text \"\\n\\n\\n\"\n\n\t\t\t\t@output.text \"Scan Date:\", :style => :bold\n\t\t\t\t@output.text \"#{Report.scan_date}\"\n\t\t\t\t@output.text \"\\n\"\n\n\t\t\t\t# Number of hosts / score\n\t\t\t\t@output.text \"There were #{Host.count} hosts identified, containing #{Item.critical_risks.to_a.count + Item.high_risks.to_a.count} critical and high risks findings. Of those there were #{Item.critical_risks.to_a.count} Critical risks, and #{Item.high_risks.to_a.count} High risks.\"\n\n\t\t\t\t@output.text \"These critical and highs were discovered on #{Host.unique_hosts_with_critical_and_high_count} unique hosts. #{Item.risk_percent_rounded_text} of the total assessed computers were found to have an critical or high finding.\"\n\n\t\t\t\t# @TODO need vulnerable host count\n\n\t\t\t\t@output.text \"\\n\\n\\n\"\n\n\t\t\t\t# Top Hosts with Findings\n\t\t\t\t#@TODO need this call\n\n\t\t\t\t@output.text \"\\n\\n\\n\"\n\n\t\t\t\t# Notable Findings\n\t\t\t\tItem.top_10_table(@output)\n\n\n\t\t\t\t# Plugin_output keyword search?\n\n\t\t\t\t@output.number_pages \"<page> of <total>\", :at => [output.bounds.right - 75, 0], :width => 150, :page_filter => :all\n\t\t\tend", "def report\n @report = Report.new(self)\n @results.keys.each do |key|\n yield key\n end\n @report.write\n end", "def report; end", "def report; end", "def report; end", "def report; end", "def report; end", "def report\n \n end", "def write_to_screen!\n puts report_title\n puts report_body.lines.take(show_count)\n end", "def report\n\t\tend", "def report_to_stdout\n @report_history.each do |report|\n puts(report)\n end\n end", "def output\n @output ||= report.display\n end", "def process\n ReportAdapter.new(report: runner.run(run_options), root: root).each do |issue|\n io.print issue.to_json\n io.print \"\\0\"\n end\n end", "def html_report\n begin\n require 'ruport'\n rescue LoadError\n abort(\"Couldn't load ruport, suggest that gem install ruport should help\")\n end\n\n unless @options.report_file\n html_report_file_name = 'Kismet-Wireless-Report-' + Time.now.to_s + '.html'\n end\n\n unless @options.report_file =~ /html$/\n html_report_file_name = @options.report_file + '.html'\n end\n\n @report = File.new(html_report_file_name,'w+')\n html_report_header\n html_report_stats\n \n if @options.create_map\n @report << '<hr /><br /><br />'\n html_report_map_body\n end\n @report << '<hr /><br /><br />'\n html_report_inf\n @report << '<hr /><br /><br />'\n html_report_adhoc\n @report << '<hr /><br /><br />'\n html_report_probe\n @report << \"</body>\"\n @report << \"</html>\"\n end", "def run_report\n comparison_values.tap do |results|\n display_report(results)\n end\n end", "def create_report\n print_sales_report_ASCII\n print_date\n print_products_ASCII\n print_brands_ASCII\n end", "def render\n\n\t\t\tcontent = render_object.render\n\n\t\t\tif params[:output_file]\n\t\t\t\tcreate_output_file(content)\n\t\t\telse\n\t\t\t\tputs content\n\t\t\tend\n\n\t\tend", "def run\n print_line\n print_status 'Creating HTML report...'\n\n plugins = format_plugin_results( auditstore.plugins )\n @base_path = File.dirname( options['tpl'] ) + '/' +\n File.basename( options['tpl'], '.erb' ) + '/'\n\n title_url = auditstore.options['url']\n begin\n title_url = uri_parse( auditstore.options['url'] ).host\n rescue\n end\n\n params = prepare_data.merge(\n title_url: escapeHTML( title_url ),\n audit_store: auditstore,\n plugins: plugins,\n base_path: @base_path\n )\n\n File.open( outfile, 'w' ) { |f| f.write( erb( options['tpl'], params ) ) }\n\n print_status \"Saved in '#{outfile}'.\"\n end", "def report\n table = Terminal::Table.new(headings: ['Basic', 'Result']) do |t|\n t << [\"Number of paragraphs\", number_of_paragraphs]\n t << [\"Number of sentences\", number_of_sentences]\n t << [\"Number of words\", number_of_words]\n t << [\"Number of characters\", number_of_characters]\n t << [\"Number of syllables\", number_of_syllables]\n\n t << :separator\n t << [\"Average words per sentence\", mean_of_words_per_sentence]\n t << [\"Average syllables per word\", mean_of_syllables_per_word]\n t << [\"Average syllables per content word\", syllables_per_content_word]\n\n t << :separator\n t << [\"Verbs Ocurrencies\", verb_incidence]\n t << [\"Nouns Ocurrencies\", noun_incidence]\n t << [\"Adjective Ocurrencies\", adjective_incidence]\n t << [\"Adverb Ocurrencies\", adverb_incidence]\n t << [\"Pronoun Ocurrencies\", pronoun_incidence]\n t << [\"Content Word Ocurrencies\", content_word_incidence]\n t << [\"Function Word Ocurrencies\", function_word_incidence]\n\n t << :separator\n t << [\"Flesch score\", flesch]\n end\n puts table\n end", "def generate_report()\n system(\"java -cp emma.jar emma report -r html -in coverage.em,coverage.ec\")\nend", "def interpret_report(command)\n ensure_placed\n @ui.write_text @robot.report\n end", "def report\n @output.puts \"#{posx},#{posy},#{dir.to_s.upcase}\"\n activate\n end", "def report(file, result)\n Fast.report(result,\n file: file,\n show_link: @show_link,\n show_permalink: @show_permalink,\n show_sexp: @show_sexp,\n headless: @headless,\n bodyless: @bodyless,\n colorize: @colorize)\n end", "def generate_scan_report\n freshclam_stderr = IO.read($config[\"freshclam_stderr\"])\n freshclam_stdout = @freshclam_stdout\n template = IO.read(\"views/clamav.html.erb\")\n output = ERB.new(template).result(binding)\n File.open(\"clamav.html\", \"w\") {|file| file.write(output)}\nend", "def html_report_stats\n @report << '<div id=\"title\"> General Statistics</div>'\n stat_tab = Ruport::Data::Table(%w[Stat Value])\n stat_tab << ['Number of servers Seen', @num_servers]\n stat_tab << ['Number of clients Seen', @num_clients]\n @num_by_cipher.each do |cipher, num|\n stat_tab << ['Encryption: ' + cipher, num]\n end\n @report << stat_tab.to_html\n @report << '<br /><br />'\n end", "def show\n @results = @report.results\n end", "def show\n @results = @report.results\n end", "def render(output)\n\t\t\t\treport_classification\n\n\t\t\t\treport_title NessusReport.title\n\t\t\t\treport_subtitle \"Talking Points NessusReport\"\n\t\t\t\treport_author \"This report was prepared by\\n#{NessusReport.author}\"\n\n\t\t\t\t@output.text \"\\n\\n\\n\"\n\n\t\t\t\t@output.text \"Scan Date:\", :style => :bold\n\t\t\t\t@output.text \"#{NessusReport.scan_date}\"\n\t\t\t\t@output.text \"\\n\"\n\n\t\t\t\t# Number of hosts / score\n\t\t\t\t@output.text \"There were #{Host.count} hosts identified, containing #{Item.critical_risks.to_a.count + Item.high_risks.to_a.count} critical and high risks findings. Of those there were #{Item.critical_risks.to_a.count} Critical risks, and #{Item.high_risks.to_a.count} High risks.\"\n\n\t\t\t\t@output.text \"These critical and highs were discovered on #{Host.unique_hosts_with_critical_and_high_count} unique hosts. #{Item.risk_percent_rounded_text} of the total assessed computers were found to have an critical or high finding.\"\n\n\t\t\t\t# @TODO need vulnerable host count\n\n\t\t\t\t@output.text \"\\n\\n\\n\"\n\n\t\t\t\t# Top Hosts with Findings\n\t\t\t\t#@TODO need this call\n\n\t\t\t\t@output.text \"\\n\\n\\n\"\n\n\t\t\t\t# Notable Findings\n\t\t\t\tItem.top_10_table(@output)\n\n\n\t\t\t\t# Plugin_output keyword search?\n\n\t\t\t\t@output.number_pages \"<page> of <total>\", :at => [output.bounds.right - 75, 0], :width => 150, :page_filter => :all\n\t\t\tend", "def report_results( timings )\n t = timings.first\n output.puts \n output.puts \" Total files read : #{\"%12d\" % t.value_stats.count}\"\n output.puts \" Total bytes read : #{\"%12d\" % t.value_stats.sum}\"\n output.puts \" Minimum filesize : #{\"%12d\" % t.value_stats.min}\"\n output.puts \" Average filesize : #{\"%16.3f\" % t.value_stats.mean}\"\n output.puts \" Maximum filesize : #{\"%12d\" % t.value_stats.max}\"\n output.puts \" Stddev of sizes : #{\"%16.3f\" % t.value_stats.stddev}\"\n output.puts\n\n output.puts [\"%28s\" % \"read order\", \"%20s\" % \"Elapsed time (sec)\", \"%22s\" % \"Read rate (bytes/sec)\" ].join(\" \")\n output.puts \"-\" * 72\n timings.each do |timing|\n p = [ ]\n p << \"%28s\" % timing.name\n p << \"%20.3f\" % timing.timed_stats.sum\n p << \"%22.3f\" % timing.rate\n output.puts p.join(\" \")\n end\n output.puts\n end", "def report\n sprintf \"Number of paragraphs %d \\n\" <<\n \"Number of sentences %d \\n\" <<\n \"Number of words %d \\n\" <<\n \"Number of characters %d \\n\\n\" <<\n \"Average words per sentence %.2f \\n\" <<\n \"Average syllables per word %.2f \\n\\n\" <<\n \"Flesch score %2.2f \\n\" <<\n \"Flesh-Kincaid grade level %2.2f \\n\" <<\n \"Fog Index %2.2f \\n\",\n num_paragraphs, num_sentences, num_words, num_characters,\n words_per_sentence, syllables_per_word,\n flesch, kincaid, fog\n end", "def to_html\n Report.export(@analysis, :html)\n end", "def reportall\n\t\t@marriges = Marriage.find(:all, :order =>\"register_id\")\n \t\thtml = render :layout => false \n\t\tkit = PDFKit.new(html)\n\n\t\tkit.stylesheets << RAILS_ROOT + '/public/stylesheets/styles.css' \n\n\t\tsend_data(kit.to_pdf, :filename => \"marriagereport.pdf\", :type => 'application/pdf')\n\tend", "def report\n @scan = find_scan( params.require( :id ) )\n\n format = URI( request.url ).path.split( '.' ).last\n render layout: false,\n content_type: FrameworkHelper.content_type_for_report( format ),\n text: FrameworkHelper.framework { |f| f.report_as format, @scan.report.object }\n end", "def print_sales_report\n$report_file.puts \"\n ##### ######\n # # ## # ###### #### # # ###### ##### #### ##### #####\n # # # # # # # # # # # # # # # #\n ##### # # # ##### #### ###### ##### # # # # # # #\n # ###### # # # # # # ##### # # ##### #\n # # # # # # # # # # # # # # # # #\n ##### # # ###### ###### #### # # ###### # #### # # #\n********************************************************************************\n\"\nend", "def report\n @scan = find_scan( params.require( :id ) )\n\n format = URI( request.url ).path.split( '.' ).last\n render layout: false,\n text: FrameworkHelper.\n framework { |f| f.report_as format, @scan.report.object }\n end", "def reporting_data\r\n\r\n report_sid = params[:report].blank? ? \"\" : params[:report]\r\n render(:nothing => true) and return if report_sid.blank?\r\n opts = (params[:report_options] || {}).reject{|k,v| v.blank?}\r\n opts[:format] ||= params[:format]\r\n r = BgWorkerReport.make_report(report_sid, opts)\r\n r[:title][:style] = r[:title][:style].tr(',', ';').gsub('colour', 'color') if r && r[:title] && r[:title][:style]\r\n @report = r\r\n respond_to do |format|\r\n format.json { render :json => @report }\r\n format.html { render :text => @report }\r\n end\r\n end", "def generate_report\n self.consume_stdin\n self.data_sorter\n\n @drivers.each do |driver|\n driver.total_duration\n driver.distance_calculator\n driver.average_speed\n end\n\n self.compile_report\n end", "def to_s(render_class = SimpleReports::Render::TerminalTable::Report)\n render_with(render_class)\n end", "def display_results\r\n if @errors.empty?\r\n @out.puts @results\r\n else\r\n @errors.each{ |error| @out.puts error }\r\n end\r\n end", "def render_txt\n report = report_for_rendering\n filename = filename_timestamp(report.title)\n disable_client_cache\n send_data(report.to_text, :filename => \"#{filename}.txt\")\n end", "def execute\n puts @robot.report\n end", "def finalize_standard_report\n render_pdf\n end", "def report(output)\n output << self.inspect\n output << \"\\n\"\n end", "def report(output)\n output << self.inspect\n output << \"\\n\"\n end", "def __log_report(file)\n print \"Rendering `#{file}'...\" if @ocproblem.verbose\n yield\n puts \"done!\" if @ocproblem.verbose\n end", "def build_report_body\n #@output << erb(RAILS_ROOT + \"/app/views/reports/_users.html.erb\") \n pad(10) do\n add_text usernotes\n end\n if timespan == \"Daily\" \n add_text \"Current Tasks and Tasks Modified in the last Day\"\n elsif timespan == \"Weekly\"\n add_text \"Current Tasks and Tasks Modified in the last Week\"\n else\n add_text \"Current Tasks\"\n end\n pad(10) do\n draw_table(data, :width => 600)\n end\n if timespan == \"Daily\" \n add_text \"Current Goals and Goals Modified in the last Day\"\n elsif timespan == \"Weekly\"\n add_text \"Current Goals and Goals Modified in the last Week\"\n else\n add_text \"Current Goals\"\n end\n pad(10) do\n draw_table(goaldata, :width => 600)\n end\n end", "def logReport\n @log.write( \"\\n\\n\\nFilter\\t\\t\\t\\t\\t\\t\\t\\t #{FILTER_NAME}\" + \"\\n________________________________________________________\\n\")\n @log.write( \"File name:\\t\\t\\t\\t\\t\\t\\t\" + QRY_FILE + \"\\n\")\n @log.write( \"Size: \\t\\t\\t\\t\\t\\t\\t\\t\" + File.stat(QRY_FILE).size.to_s + \" bytes\\n\")\n @log.write( \"Started:\\t\\t\\t\\t\\t\\t\\t\" + started_at.to_s + \"\\n\")\n @log.write( \"Completed:\\t\\t\\t\\t\\t\\t\\t\" + @completed_at.to_s + \"\\n\") \n @log.write( \"Input file count: \\t\\t\\t\\t\\t\" + \"%d\" % lines + \"\\n\")\n @log.write( \"Total seconds\\t\\t\\t\\t\\t\\t\" + \"%.3f\" % (completed_at - @started_at).to_f + \"\\n\" )\n @log.write( \"Average records per second:\\t\\t\\t\" + \"%.3f\" % (lines/(completed_at - started_at)).to_f + \"\\n\" )\n @log.write( \"__END__\\n\")\n @log.write( \"(c) Copyright 2009 VenueSoftware Corp. All Rights Reserved. \\n\")\n @log.close\n\n #\n # Report the results recorded in log.txt\n # \n puts \"\\n\"\n File.open(\"log.txt\", \"r\") do |f|\n while line = f.gets\n puts line\n end\n end\n Kernel.exit\nend", "def send_report_data\n render_type = RENDER_TYPES[@sb[:render_type].to_s]\n raise \"Render type #{@sb[:render_type]} is not supported\" unless render_type\n\n assert_privileges(\"render_report_#{render_type}\")\n\n return unless @sb[:render_rr_id]\n\n disable_client_cache\n result = MiqReportResult.find(@sb[:render_rr_id])\n\n filename = filename_timestamp(result.report.title, 'export_filename')\n send_data(result.get_generated_result(@sb[:render_type]),\n :filename => \"#{filename}.#{@sb[:render_type]}\",\n :type => \"application/#{@sb[:render_type]}\")\n\n result.destroy\n end", "def print_results\n UI.puts results_message\n end", "def write\n Vedeu::Output.render(rendered)\n end", "def render_report_data\n render_type = RENDER_TYPES[params[:render_type]]\n raise \"Render type #{params[:render_type]} is not supported\" unless render_type\n\n assert_privileges(\"render_report_#{render_type}\")\n\n if params[:task_id]\n # We are waiting for a task to finish.\n render_report_data_continue(params[:task_id])\n else\n # First time thru, kick off the report generate task.\n render_report_data_init(render_type)\n end\n end", "def view\n if pending?\n ask_pending\n elsif failed?\n ask_failed\n else\n puts rendered\n puts \"Rendered output for #{test_file} matches expected.\"\n end\n end", "def output_to_report_file message\n @spec_report_file.puts message\n end", "def report(properties)\n if (@short_report)\n tags = 0\n @stats.tagged_files.each {|line| tags += line[1] }\n known = 0\n @stats.known_exceptions.each {|line| known += line[1] }\n missing = 0\n @stats.missing_tags.each {|line| missing += line[1] }\n\n puts \"Licenser: scanned #{@stats.file_count} files in #{@stats.dir_count} directories.\"\n printf(\" Licensed files: %5d\\n\", tags)\n printf(\" Known exceptions: %5d\\n\", known)\n printf(\" Missing tags: %5d\\n\", missing)\n else\n puts \"Licenser: run completed at #{DateTime.now.strftime(\"%H:%M:%S on %b %d, %Y\")}\"\n puts \" scanned #{@stats.file_count} files in #{@stats.dir_count} directories.\"\n puts\n puts 'Licensed files'\n @stats.tagged_files.sort.each do |line|\n printf(\"%5d %s\\n\", line[1], line[0])\n end\n puts\n puts 'Known non-licensed files'\n @stats.known_exceptions.sort.each do |line|\n printf(\"%5d %s\\n\", line[1], line[0])\n end\n puts\n puts 'Missing tags'\n @stats.missing_tags.sort.each do |line|\n printf(\"%5d %s\\n\", line[1], line[0])\n end\n puts\n puts 'properties:'\n properties.each do |key, value|\n puts \" #{key} = #{value}\"\n end\n end\n end", "def render(result)\n headers = [:msgid,:file,:line,:short_desc,:long_desc,:details]\n data = CSV.generate(\"\", :row_sep => \"\\r\\n\", :headers => headers, :write_headers => true) do |csv|\n result.each do |row|\n csv << row.values_at(*headers)\n end\n end\n @io << data\n end", "def report_body; end", "def report_body; end", "def generateReport\n filePath = \"#{@reportFolder}/report.csv\"\n file = File.open(filePath, 'w')\n file.puts ['Screen', 'Description', 'Automation Message', 'Status'].join(',')\n @report.each do |result|\n file.puts result.join(',')\n end\n file.close\n end", "def reporting_data\r\n\r\n report_sid = params[:report].blank? ? \"\" : params[:report]\r\n render(:nothing => true) and return if report_sid.blank?\r\n opts = (params[:report_options] || {}).reject{|k,v| v.blank?}\r\n opts[:format] ||= params[:format]\r\n r = UserReport.make_report(report_sid, opts)\r\n r[:title][:style] = r[:title][:style].tr(',', ';').gsub('colour', 'color') if r && r[:title] && r[:title][:style]\r\n @report = r\r\n respond_to do |format|\r\n format.json { render :json => @report }\r\n format.html { render :text => @report }\r\n end\r\n end", "def show_results(generated_files: true)\n @end_time = Time.now\n tree = if generated_files\n [' ',\n \"Generated files: #{@out_dir}\",\n ' ',\n TTY::Tree.new(@out_dir).render]\n else\n ''\n end\n puts\n puts TTY::Box.frame(\"Start : #{@start_time}\",\n \"End : #{@end_time}\",\n \"Time : #{@end_time - @start_time} sec\",\n *tree,\n title: { top_left: \" #{self.class.name} \" },\n width: TTY::Screen.width, padding: 1)\n end", "def build_report\n puts \"building performance test comparison report...\"\n puts\n\n # load template\n report = File.read(@template_path)\n\n # metrics result\n result_comparison_table = extract_table_from_csv2html_output(@result_comparison_path)\n\n # atop summary\n atop_summary_comparison_table = extract_table_from_csv2html_output(@atop_summary_comparison_path)\n\n # atop detail\n # TODO: enable\n # atop_detail_comparison_table = extract_table(@atop_detail_comparison_path)\n\n # replace tables (do this first since table data may include parameters)\n report = report.gsub(\"$RESULT_COMPARISON_TABLE\", result_comparison_table)\n report = report.gsub(\"$ATOP_SUMMARY_COMPARISON_TABLE\", atop_summary_comparison_table)\n\n # TODO: enable\n # report = report.gsub(\"$ATOP_DETAIL_TABLE\", atop_detail_table)\n\n # replace parameters\n report = replace_parameters(report)\n\n # write report\n puts \"writing report to #{@output_path}\"\n\n File.write(@output_path, report)\nend", "def print\n results :print => true\n end", "def output\n @results\n end", "def render_pdf\n render_pdf_internal(report_for_rendering)\n end", "def print_sales_report_ASCII\n $report_file.puts \"\n\n ╔═╗┌─┐┬ ┌─┐┌─┐ ╦═╗┌─┐┌─┐┌─┐┬─┐┌┬┐\n ╚═╗├─┤│ ├┤ └─┐ ╠╦╝├┤ ├─┘│ │├┬┘ │\n ╚═╝┴ ┴┴─┘└─┘└─┘ ╩╚═└─┘┴ └─┘┴└─ ┴\n\"\nend", "def report( display_object = Kernel, display_method = :puts )\n return if display_method.nil? || !display_object.respond_to?( display_method )\n\n if processed_rows + errors_count > 0\n if edited_rows_count > 0\n display_object.send( display_method, \"\\r\\n--- UPDATED Meetings in calendar: #{ edited_rows_count }\" )\n @edited_rows_codes.each do |meeting_code|\n display_object.send( display_method, \"- #{ meeting_code }\" )\n end\n end\n if created_rows_count > 0\n display_object.send( display_method, \"\\r\\n--- CREATED Meetings in calendar: #{ created_rows_count }\" )\n @created_rows_codes.each do |meeting_code|\n display_object.send( display_method, \"- #{ meeting_code }\" )\n end\n end\n if errors_count > 0\n display_object.send( display_method, \"\\r\\n--- Tot. ERRORS during calendar processing: #{ errors_count }\" )\n @error_rows_codes.each do |meeting_code|\n display_object.send( display_method, \"- #{ meeting_code }\" )\n end\n end\n end\n end", "def generate_report(_callback_data)\n text_report = OrderReport.new.generate\n\n respond_with :message, text: text_report, parse_mode: :Markdown\n answer_callback_ok\n end", "def report_list(_)\n report_templates = ReportPrivate.all_report_templates(@path_to)\n report_templates = yield(report_templates) if block_given?\n @console.info self, ReportPrivate.table(report_templates)\n end", "def hospitalreport\n\t\t@hospitals = Hospital.find (:all)\n html = render :layout => false \n\tkit = PDFKit.new(html)\n\n\tkit.stylesheets << RAILS_ROOT + '/public/stylesheets/styles.css' \n\n\tsend_data(kit.to_pdf, :filename => \"hospitalreport.pdf\", :type => 'application/pdf')\n\tend", "def complaintsreport\n\t\t@complaints = Complaint.find(:all)\t\t\n html = render :layout => false \n\tkit = PDFKit.new(html)\n\n\tkit.stylesheets << RAILS_ROOT + '/public/stylesheets/styles.css' \n\n\tsend_data(kit.to_pdf, :filename => \"complaintsreport.pdf\", :type => 'application/pdf')\n\tend", "def results\r\n print_books\r\n print_toys\r\n print_classes\r\n end", "def write_report\n @manager.atomic_file(report_file) do |file|\n file.write(JSON.pretty_generate(get_status))\n end\n end", "def report_run(command)\n super do |report|\n @report = report\n yield report\n end\n end", "def output_results\n CukeSniffer::Formatter.output_console(self)\n end", "def output_report(report)\n # Create markdown\n report_markdown = report.markdown_value\n\n # Send markdown\n markdown(report_markdown)\n\n # Notify failure if minimum coverage hasn't been reached\n threshold = Xcov.config[:minimum_coverage_percentage].to_i\n if !threshold.nil? && (report.coverage * 100) < threshold\n fail(\"Code coverage under minimum of #{threshold}%\")\n end\n end", "def print_products\n$report_file.puts \"\n\n | | | |\n _ __ _ __ ___ __| |_ _ ___| |_ ___\n| '_ \\\\| '__/ _ \\\\ / _` | | | |/ __| __/ __|\n| |_) | | | (_) | (_| | |_| | (__| |_\\\\__ \\\\\n| .__/|_| \\\\___/ \\\\__,_|\\\\__,_|\\\\___|\\\\__|___/\n| |\n|_|\n\t \t\t\t\t\t\t\t\t\t\"\nend", "def show_report(file_name = nil, branch = proj_branch)\n file_name ||= last_report_file_name(branch)\n report = proj.show(report_branch, File.join(report_path(branch), file_name))\n report_file = Tempfile.new([report_name, report_extension])\n report_file.write(report)\n `open #{report_file.path}`\n sleep 3\n end", "def reporting_data\r\n\r\n report_sid = params[:report].blank? ? \"\" : params[:report]\r\n render(:nothing => true) and return if report_sid.blank?\r\n opts = (params[:report_options] || {}).reject{|k,v| v.blank?}\r\n opts[:format] ||= params[:format]\r\n r = DevFeedbackReport.make_report(report_sid, opts)\r\n r[:title][:style] = r[:title][:style].tr(',', ';').gsub('colour', 'color') if r && r[:title] && r[:title][:style]\r\n @report = r\r\n respond_to do |format|\r\n format.json { render :json => @report }\r\n format.html { render :text => @report }\r\n end\r\n end", "def render(format, user, *args)\n TasksheetReport.render(format, :report => self, :user => user)\n end", "def report\n require File.join File.expand_path(File.dirname(__FILE__)), \"report\"\n Brakeman::Report.new(self)\n end", "def render_output\n self.render_xls\n end", "def run\n Salesforce.set_http(session[:accesstoken], session[:accessurl])\n \t@response = Salesforce.run_report(params)\n @describe = Salesforce.describe_report(params)\n \trespond_to do |format|\n format.json { render :json => {:data => @response, :meta => @describe}.to_json}\n \tend\n end", "def write_report filename=nil\n\t\toutput_string = ''\t\t\n\t\tself.sort_drivers_by_miles.each do |key,driver|\n\t\t\toutput_string += \"#{driver.trip_report_str} \\n\"\n\t\tend\n\t\tunless filename.nil?\n\t\t\tFile.write(filename, output_string)\n\t\tend\n\t\tputs output_string\n\t\toutput_string\n\tend", "def output_to_file (products_hash, brands_hash)\n\t_sales_report_header\n\t_products_header\n\tproducts_section(products_hash)\n\tend_of_section\n\t_brands_header\n\tbrands_section(brands_hash)\n\tend_of_section\n\t$report_file.puts 'THIS REPORT HAS BEEN CREATED BY MROHDE'\nend", "def reporting_data\r\n\r\n report_sid = params[:report].blank? ? \"count_of_table_sid_by_field_sid\" : params[:report]\r\n render(:nothing => true) and return if report_sid.blank?\r\n opts = (params[:report_options] || {}).reject{|k,v| v.blank?}\r\n opts[:format] ||= params[:format]\r\n r = AccessReport.make_report(report_sid, opts)\r\n r[:title][:style] = r[:title][:style].tr(',', ';').gsub('colour', 'color') if r && r[:title] && r[:title][:style]\r\n @report = r\r\n respond_to do |format|\r\n format.json { render :json => @report }\r\n format.html { render :text => @report }\r\n end\r\n end", "def format_records(records)\n records.each do |record|\n report record\n end\n end", "def report\n return @report\n end", "def display_results\n\n title1 = sprintf(TITLE_ROW, \"METH\", \"PATH\", \"CALLED\", \"RESPONSE TIME(ms)\",\"\", \"\", \"\", \"\",\"\",\"\", \"DYNO\", \"MESSAGE\", \"SIZE\")\n puts(title1)\n printf(TITLE_ROW, \"\", \"\", \"Times\", \"Mean\",\" : \",\"Median\",\" : \",\"Mode\",\" : \", \"Range\", \"Busiest\", \"Average\", \"Max\")\n puts('-'*title1.length)\n @endpoints.each do | ep |\n if ep.called == 0 then\n printf(TITLE_ROW, ep.ep_method,ep.ep_path, \" Never\", \" \",\" : \",\" \",\" : \",\" \",\" : \", \" \", \" \", \" \", \" \")\n else\n printf(DATA_ROW,\n ep.ep_method,\n ep.ep_path,\n ep.called,\n ep.averages[:responses].mean,\n ep.averages[:responses].median,\n ep.averages[:responses].mode,\n ep.averages[:responses].range,\n ep.busiest_dyno,\n ep.averages[:bytes].mean,\n ep.averages[:bytes].hi)\n end\n end\n\n if @endpoints.unprocessed_lines > 0\n puts \"There were #{@endpoints.unprocessed_lines} Unprocessed Lines of data from #{@loglines} total lines in the log!\"\n else\n puts \"All #{@loglines} total lines in the log were processed!\"\n end\n end", "def render\n Vedeu::Output.render(buffer)\n end", "def report(output)\n output.title(options[:title]) if options[:title]\n\n if @categories.empty?\n output << \"None found.\\n\"\n else\n sorted_categories = output.slice_results(sorted_by_frequency)\n total_hits = overall_frequency\n\n output.table({:align => :left}, {:align => :right }, {:align => :right}, {:type => :ratio, :width => :rest}) do |rows|\n sorted_categories.each do |(cat, count)|\n rows << [cat, \"#{count} hits\", '%0.1f%%' % ((count.to_f / total_hits.to_f) * 100.0), (count.to_f / total_hits.to_f)]\n end\n end\n\n end\n end", "def report\n\t\t dir = \"./report/\"\n File.open(dir + \"method.mmd\", \"w\") do |f|\n f.puts \"# Methods #\"\n Dir[\"./experiments/*/*.rb\"].each do |desc|\n if File.basename(desc) == File.basename(File.dirname(desc)) + \".rb\"\n File.read(desc).split(\"\\n\").each do |line|\n if m = line.match(/^\\# (.+)/)\n f.puts m[1]\n else\n break\n end\n end\n f.puts\n f.puts\n end\n end\n end\n require 'csv'\n require \"yaml\"\n require File.dirname(__FILE__) + \"/stats\"\n CSV.open(dir + \"/data.csv\", \"w\") do |csv|\n data = {}\n Dir[\"./results/*/results.yaml\"].each do |res|\n d = YAML::load_file(res)\n da = {}\n d.each do |k, vals|\n da[k.to_s + \" mean\"], da[k.to_s + \" sd\"] = Stats::mean(vals), Stats::standard_deviation(vals)\n vals.each_with_index do |v, i|\n da[k.to_s + \" cv:\" + i.to_s] = v\n end\n end\n array_merge(data, da)\n end\n data.keys.map do |key| \n \t\t # calculate stats\n \t\t a = data[key]\n \t\t [key] + a\n \t\t end.transpose.each do |row|\n \t\t csv << row\n \t\t end\n end\n\t\t\n\t\tend", "def report io = $stdout\n only = option[:only]\n\n data = analyze only\n\n io.puts \"Total score (lower is better) = #{self.total}\"\n\n if option[:summary] then\n io.puts\n\n self.summary.sort_by { |_,v| -v }.each do |file, score|\n io.puts \"%8.2f: %s\" % [score, file]\n end\n\n return\n end\n\n data.each_with_index do |item, count|\n prefix = \"%d) \" % (count + 1) if option[:number]\n\n match = item.identical? ? \"IDENTICAL\" : \"Similar\"\n\n io.puts\n io.puts \"%s%s code found in %p (mass%s = %d)\" %\n [prefix, match, item.name, item.bonus, item.mass]\n\n item.locations.each_with_index do |loc, i|\n loc_prefix = \"%s: \" % (?A.ord + i).chr if option[:diff]\n extra = \" (FUZZY)\" if loc.fuzzy?\n io.puts \" %s%s:%d%s\" % [loc_prefix, loc.file, loc.line, extra]\n end\n\n if option[:diff] then\n io.puts\n\n nodes = hashes[item.structural_hash]\n\n sources = nodes.map do |s|\n msg = \"sexp_to_#{File.extname(s.file).sub(/./, \"\")}\"\n self.respond_to?(msg) ? self.send(msg, s) : sexp_to_rb(s)\n end\n\n io.puts n_way_diff(*sources)\n end\n end\n end", "def print_sales_rpt\n\treturn \"\n ____ _ ____ _ \n / ___| __ _| | ___ ___ | _ \\\\ ___ _ __ ___ _ __| |_ \n \\\\___ \\\\ / _` | |/ _ / __| | |_) / _ | '_ \\\\ / _ \\\\| '__| __|\n ___) | (_| | | __\\\\__ \\\\ | _ | __| |_) | (_) | | | |_ \n |____/ \\\\__,_|_|\\\\___|___/ |_| \\\\_\\\\___| .__/ \\\\___/|_| \\\\__|\n |_| \n===============================================================\\n\"\nend", "def render\n @output ||= {}\n\n @output.merge!(system_info)\n @output.merge!(active_record_connection)\n\n apply_hooks\n\n @output\n end" ]
[ "0.77427894", "0.76158184", "0.71735525", "0.71391654", "0.7050066", "0.7028997", "0.69840163", "0.6913772", "0.6765922", "0.6758176", "0.6758176", "0.6758176", "0.6758176", "0.6758176", "0.6752993", "0.67523646", "0.67520016", "0.671204", "0.67066664", "0.6648593", "0.6624833", "0.6616048", "0.6491212", "0.6490228", "0.6473081", "0.64595926", "0.6423587", "0.6401547", "0.63928646", "0.63775384", "0.6365291", "0.6363051", "0.6357999", "0.6357999", "0.6353671", "0.6340105", "0.6324874", "0.63174284", "0.6305425", "0.6305066", "0.6303678", "0.6282535", "0.627569", "0.627442", "0.6271272", "0.62643564", "0.6250544", "0.62358606", "0.6223948", "0.6214293", "0.6214293", "0.62006676", "0.6196332", "0.6185473", "0.61738", "0.6158322", "0.61508834", "0.6137158", "0.6135024", "0.6125373", "0.61223865", "0.6112822", "0.6105714", "0.6105714", "0.6102077", "0.60872614", "0.60861105", "0.60798097", "0.60714877", "0.6055625", "0.60508066", "0.6050271", "0.60378414", "0.60343003", "0.6028623", "0.6028451", "0.6027146", "0.60249746", "0.60162646", "0.6004632", "0.60001576", "0.60000896", "0.5999799", "0.5994675", "0.598893", "0.5981645", "0.59802884", "0.5978526", "0.5976468", "0.5975168", "0.596883", "0.59667146", "0.595532", "0.594738", "0.59450233", "0.593581", "0.59272987", "0.59266144", "0.5915161", "0.5906155", "0.59030014" ]
0.0
-1
def card_id attributes = pivotal_attributes(card.desc) attributes[:id] if attributes && attributes[:id] end
def update_from_pivotal_card(pivotal_card) puts "=> #{pivotal_card.attributes[:name]}" puts "=> #{pivotal_card.attributes[:current_state].upcase}\n\n" set_pivotal_attributes(pivotal_card) @pivotal_attributes.map { |k, v| @card.send("#{k}=", v) } @card.save end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def card_id\n card.id\n end", "def id\n attributes.fetch(:id)\n end", "def id\n attributes.fetch(:id)\n end", "def id\n attributes.fetch(:id)\n end", "def card_set_id(c)\n CardSet.find_by(name: c['card_set']).id\nend", "def find_plain_card(id)\n cards[id]\n end", "def id\n attributes[:id] \n end", "def card_id=(id)\n self.card = Card.find(id) || nil unless id.nil? || id == ''\n end", "def id\n attributes[:id] || digest\n end", "def payment_card(card_id)\n c_r Lokalise::Resources::PaymentCard, :find, card_id\n end", "def id\n attributes.key?(:id) ? attributes[:id] : nil\n end", "def scribd_id\n @attributes[:id]\n end", "def set_idcard\n @idcard = Idcard.find(params[:id])\n end", "def id\n @attributes[:id]\n end", "def id\n @attributes[:id]\n end", "def id\n @attributes[:id]\n end", "def id\n @attributes[:id]\n end", "def id\n @attributes[:id]\n end", "def id\n @attributes[:id]\n end", "def id\n @attributes[:id]\n end", "def id\n @attributes[:id]\n end", "def id\n @attributes[:id]\n end", "def id\n @attributes[:id]\n end", "def set_id_card\n @id_card = IdCard.find(params[:id])\n end", "def id\n @attributes[:_id]\n end", "def card_identifier\n raise 'card_identifier must be overwritten by the child class'\n end", "def id\n @attributes[:ID]\n end", "def GetCardId(db, setId, name, id)\n\treturn db.execute(\"\n\t\tSELECT\n\t\t\tCardId \n\t\tFROM \n\t\t\tCard\n\t\tWHERE\n\t\t\tName = ? AND SetId = ? AND Id = ?\n\t\t;\",[\n\t\t\tname, \n\t\t\tsetId,\n\t\t\tid,\t\t\n\t\t])\nend", "def card_identification\n message.fields[6].strip\n end", "def confly_id\n attributes['id']\n end", "def _id\n @attributes && @attributes[:_id]\n end", "def id\n @attributes.fetch('id', nil)\n end", "def id\n @attributes.fetch('id', nil)\n end", "def id\n @attributes.fetch('id', nil)\n end", "def attributes\n {\n card_token: card_token,\n card_type: card_type,\n expiration_date: expiration_date,\n card_number: card_number\n }\n end", "def id\n @attributes['id']\n end", "def get_card\n end", "def find_by_id(card_id, full_info = false)\n cleaned_card_id = card_id.gsub(/t\\d+\\z/, '')\n full_info ? full_card_map[cleaned_card_id] : card_map[cleaned_card_id]\n end", "def id\n attribute('id', 'id')\n end", "def product\n @card_product\n end", "def card\n @data[:credit_card]\n end", "def record_id\n attributes['item_id']\n end", "def identifier\n attributes.fetch(:identifier)\n end", "def id\n read_attr :id, :to_sym\n end", "def find_card(id)\n found_card = nil\n cards.each { |card| found_card = card if card.id == id.to_i }\n found_card\n end", "def id(id)\n req = Request.new(params = nil,\n headers = nil,\n body = nil)\n\n Scryfall::Card.new JSON.parse(connection.get(\"/cards/#{id}\", req).body)\n end", "def id\n read_attr :id\n end", "def id\n read_attribute(:pf_id)\n end", "def card\n\t @dance_card\n\tend", "def set_card\n @card = Cart.find(params[:id])\n end", "def card_params\n params[:card]\n end", "def set_card\n @card = Card.find(params[:id])\n end", "def set_card\n @card = Card.find(params[:id])\n end", "def set_card\n @card = Card.find(params[:id])\n end", "def set_card\n @card = Card.find(params[:id])\n end", "def set_card\n @card = Card.find(params[:id])\n end", "def leading_card\n \tCard.find_by(owner_id: id )\n end", "def id\n data[:id]\n end", "def card\n if self.stripe_card_id.present?\n customer.sources.retrieve(self.stripe_card_id)\n else\n create_card\n end\n end", "def set_infocard\n @infocard = Infocard.find(params[:id])\n end", "def set_card\n # @card = Card.find(params[:id])\n end", "def card(multiverse_id)\n get '/Pages/Card/Details.aspx', :multiverseid => multiverse_id\n end", "def attributes\n {\n cards_attributes: cards.map(&:attributes), # { |card| card.attributes },\n wallet_token: wallet_token,\n first_name: first_name,\n last_name: last_name,\n email: email,\n age: age,\n account_number: account_number\n }\n end", "def id_card_params\n params.require(:id_card).permit(:name, :department_name, :roll_number, :session)\n end", "def id\n data[:id]\n end", "def set_card\n @card = Card.find(params[:id])\n end", "def set_card\n @card = Card.find(params[:id])\n end", "def set_card\n @card = Card.find(params[:id])\n end", "def set_card\n @card = Card.find(params[:id])\n end", "def set_card\n @card = Card.find(params[:id])\n end", "def set_card\n @card = Card.find(params[:id])\n end", "def set_card\n @card = Card.find(params[:id])\n end", "def set_card\n @card = Card.find(params[:id])\n end", "def set_card\n @card = Card.find(params[:id])\n end", "def set_card\n @card = Card.find(params[:id])\n end", "def set_card\n @card = Card.find(params[:id])\n end", "def set_card\n @card = Card.find(params[:id])\n end", "def set_card\n @card = Card.find(params[:id])\n end", "def set_card\n @card = Card.find(params[:id])\n end", "def set_card\n @card = Card.find(params[:id])\n end", "def set_card\n @card = Card.find(params[:id])\n end", "def set_card\n @card = Card.find(params[:id])\n end", "def set_card\n @card = Card.find(params[:id])\n end", "def card_number_secure\n @card.display_number\n end", "def id\n\t\t\t\treturn self.payment_id\n\t\t\tend", "def cards(addressbook_id)\n end", "def set_pk_card\n @pk_card = PkCard.find(params[:id])\n end", "def card_params\n params.require(:card).permit(:name, :tcg_id)\n end", "def credit_card_number; end", "def get_info(card_id)\n credit_card = \"\"\n Cards::CreditCard.all.find {|card| credit_card = card if card.id == card_id}\n\n card_page = Nokogiri::HTML(open(credit_card.href))\n puts \"\\n#{card_page.css(\".head-contain h1\").text.strip}\".bold # Card Title\n puts \"\\nOffer: #{credit_card.offer}\"\n puts \"Fees: #{credit_card.fees}\"\n puts \"#{card_page.css(\"ul li.overall\").text.strip}\".white.bold # Rating\n\n puts \"\\n#{card_page.css(\".sec .title\")[1].text}\".blue.bold # Title \"The Good\"\n puts \"#{card_page.css(\".content .review\")[1].text.strip}\" # The Good\n puts \"\\n#{card_page.css(\".sec .title\")[2].text}\".blue.bold # Tilte \"The Not So Good\"\n puts \"#{card_page.css(\".content .review\")[2].text.strip}\" # The Not So Good\n puts \"\\n#{card_page.css(\".sec .title\")[0].text}\".blue.bold # Title \"Bottom Line\"\n puts \"#{card_page.css(\".content .review\")[0].text.strip}\" # Bottom Line\n puts \"\"\n end", "def attributes\n {\n cards_attributes: cards.map(&:attributes),\n wallet_token: wallet_token,\n first_name: first_name,\n last_name: last_name,\n email: email,\n age: age,\n account_number: account_number\n }\n end", "def find_card_by_id(id)\n @board.cards.find{|c| c.short_id == id.to_i}\n end", "def id\n data[:id]\n end", "def show\n @card_one = Card.find( params[:id] )\n setup_for_display \n end", "def get_id\n @id\n end", "def get_id\n @id\n end", "def get_id\n @id\n end", "def get_id\n @id\n end", "def set_card\n @card = Card.where(authorization_id: Authorization.current_id).find(params[:id])\n end", "def set_card\n @card = @plan.cards.find(params[:id])\n end", "def set_card\n puts '39393', request.path_parameters, '94358{394'\n @card = Card.find(params[:id])\n end" ]
[ "0.813602", "0.6921668", "0.6921668", "0.6921668", "0.6899346", "0.68909174", "0.68149", "0.6782958", "0.67380065", "0.6718253", "0.665398", "0.6568347", "0.6561171", "0.6551776", "0.6551776", "0.6551776", "0.6551776", "0.6551776", "0.6551776", "0.6551776", "0.6551776", "0.6551776", "0.6551776", "0.65402323", "0.65381086", "0.6535491", "0.65225786", "0.6510382", "0.64585954", "0.6422549", "0.64042675", "0.6397736", "0.6397736", "0.6397736", "0.6391378", "0.6382808", "0.63573265", "0.6356176", "0.63124824", "0.63058996", "0.63044375", "0.6287433", "0.6280112", "0.62655777", "0.62564814", "0.62442213", "0.62346685", "0.62241375", "0.62098217", "0.62016475", "0.6137933", "0.610265", "0.610265", "0.610265", "0.610265", "0.610265", "0.60997015", "0.609504", "0.6087149", "0.60672826", "0.60512125", "0.6050344", "0.6046627", "0.60305786", "0.602845", "0.6025938", "0.6025938", "0.6025938", "0.6025938", "0.6025938", "0.6025938", "0.6025938", "0.6025938", "0.6025938", "0.6025938", "0.6025938", "0.6025938", "0.6025938", "0.6025938", "0.6025938", "0.6025938", "0.6025938", "0.6025938", "0.60233414", "0.6019516", "0.5990839", "0.5986548", "0.5982149", "0.59497046", "0.59447116", "0.594066", "0.5939321", "0.59357214", "0.59354097", "0.59330827", "0.59330827", "0.59330827", "0.59330827", "0.5930985", "0.593053", "0.5925799" ]
0.0
-1
Use callbacks to share common setup or constraints between actions. def set_daily_activity
def set_dog @dog = Dog.find(params[:dog_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def action_daily\n # ToDo: Change the hard coded report to a Report setting, or client base\n raise 'Hard coded report implementation' unless RAILS_ENV =~ /susbkk/\n end", "def daily_activity_aaa\n\t\t@work_flows = WorkFlow.where(is_active: true)\n\t\t@workflows = WorkFlow.where(is_active: true, is_in_use: false)\n\t\tif request.post? or session[:daily_activity_report_date].present?\n\t\t\tif request.post?\n\t\t\t\t@daily_report_date = params[:daily_report_date]\n\t\t\t\tsession[:daily_activity_report_date] = @daily_report_date\n\t\t\telse\n\t\t\t\t@daily_report_date = session[:daily_activity_report_date]\n\t\t\tend\n\t\t\tdate = L1.set_db_date_format(@daily_report_date)\n\t\t\tq_string = \"STR_TO_DATE( '#{date}', '%Y-%m-%d') = STR_TO_DATE(created_at, '%Y-%m-%d')\"\n\t\t\tworkflow = params[:work_flow]\n\t\t\tif workflow.present?\n\t\t\t\tq_string += \"and work_flow_id = #{workflow}\"\n\t\t\telse\n\t\t\t\tq_string += \"and work_flow_id = #{@workflow.id}\"\n\t\t\tend\n\t\t\t@logs = TimestampLog.where(q_string)\n\t\tend\n\tend", "def daily_activity\n\t\t@work_flows = WorkFlow.where(is_active: true)\n\t\t@workflows = WorkFlow.where(is_active: true, is_in_use: false)\n\t\tif request.post? or session[:daily_activity_report_date].present?\n\t\t\tif request.post?\n\t\t\t\t@daily_report_date = params[:daily_report_date]\n\t\t\t\tsession[:daily_activity_report_date] = @daily_report_date\n\t\t\telse\n\t\t\t\t@daily_report_date = session[:daily_activity_report_date]\n\t\t\tend\n\t\t\tdate = L1.set_db_date_format(@daily_report_date)\n\t\t\tq_string = \"STR_TO_DATE( '#{date}', '%Y-%m-%d') = STR_TO_DATE(timestamp_logs.created_at, '%Y-%m-%d')\"\n\t\t\tworkflow = params[:work_flow]\n\t\t\tif workflow.present? \n\t\t\t\t@searched_work_flow = workflow\n\t\t\t\tq_string += \"and timestamp_logs.work_flow_id = #{workflow}\"\n\t\t\telse\n\t\t\t\t@searched_work_flow = @workflow.id\n\t\t\t\tq_string += \"and timestamp_logs.work_flow_id = #{@workflow.id}\"\n\t\t\tend\n\t\t\t@report_serach_result = WorkFlow.daily_report_serach(q_string)\n\t\tend\n\tend", "def activity\n end", "def activities_setup\n @activities = Activity.all\n end", "def set_daily_movement\n @daily_movement = if current_user.admin?\n DailyMovement.find(params[:id])\n else \n current_user.daily_movements.find(params[:id])\n end\n end", "def set_daily_task_log\n @daily_task_log = DailyTaskLog.find(params[:id])\n end", "def activities=(value)\n @activities = value\n end", "def set_daily_happiness\n @daily_happiness = DailyHappiness.find(params[:id])\n end", "def update_activity\n self.last_activity = Time.now\n end", "def activity(date)\n main_ledger_account.activity(date)\n end", "def set_activities_by_month\n begin\n @start_date = Date.parse(params[\"start_date\"])\n rescue\n @start_date = Date.today\n params[\"start_date\"] = @start_date\n end\n @activities = @user.activities.where(date: @start_date.at_beginning_of_month..@start_date.at_end_of_month)\n end", "def call\n add_fields(confirm_weekly_charge_today: @confirm_weekly_charge_today)\n end", "def new_activity!\n update_attributes(most_recent_activity: DateTime.now)\n end", "def set_defaults\n super\n self.event_date ||= Date.today\n self.state ||= \"new\"\n self.asset_event_type ||= AssetEventType.find_by_class_name(self.name)\n end", "def set_everyday\n @everyday = Everyday.find(params[:id])\n end", "def set_user_activity\n @user_activity = UserActivity.find(params[:id])\n end", "def set_user_activity\n @user_activity = UserActivity.find(params[:id])\n end", "def set_user_activity\n @user_activity = UserActivity.find(params[:id])\n end", "def set_user_activity\n @user_activity = UserActivity.find(params[:id])\n end", "def daily\n logger.info \" daily\"\n end", "def set_daily_step\n @daily_step = DailyStep.find(params[:id])\n end", "def set_user_activity\n @user_activity = UserActivity.find(params[:id])\n end", "def set_activity\n @activity = Activity.with_deleted.find(params[:id])\n end", "def set_daily_log\n @daily_log = DailyLog.find(params[:id])\n end", "def set_activities_for_pagination\n \n end", "def set_daily_sales\n if current_user.has_role? :global_admin\n if params[:site_id]\n @daily_sales = Site.find(params[:site_id]).daily_sales\n else\n @daily_sales = DailySale.all\n end\n else\n @daily_sales = current_user.site.daily_sales\n end\n\n @daily_sales = @daily_sales.reorder(sort_column => sort_order) if sort_column\n end", "def before_create\n self.scraped_at ||= DateTime.now\n super\n end", "def set_defaults\n\t\tself.start_date ||= (Date.today - 6.days)\n\tend", "def set_dev_activity\n @dev_activity = DevActivity.find(params[:id])\n end", "def enter_botgarden_action_date(data_set)\n action_date = data_set[BOTGARDENCurrentLocationData::ACTION_DATE.name]\n if action_date\n logger.debug \"Entering accession date '#{action_date}'\"\n enter_simple_date(botgarden_acton_date_input_locator, action_date)\n end\n end", "def agent_activity\n # activity_build.event()\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_apply_activity\n @apply_activity = ApplyActivity.find(params[:id])\n end", "def show\n set_user_activity\n end", "def cron_tasks\n end", "def set_daily_visitor\n @daily_visitor = DailyVisitor.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.where(uuid: params[:id])\n end", "def set_daily_record\n @daily_record = DailyRecord.find(params[:id])\n end", "def set_activity\n @activity = current_user.activities.find(params[:id])\n end", "def set_activity\n @activity = PublicActivity::Activity.find(params[:activity_id])\n unless @activity\n head :bad_request\n end\n end", "def set_defaults\n super\n self.asset_event_type ||= AssetEventType.find_by_class_name(self.name)\n\n self.from_line ||= transam_asset.try(:from_line)\n self.from_segment ||= transam_asset.try(:from_segment)\n self.to_line ||= transam_asset.try(:to_line)\n self.to_segment ||= transam_asset.try(:to_segment)\n self.segment_unit ||= transam_asset.try(:segment_unit)\n self.from_location_name ||= transam_asset.try(:from_location_name)\n self.to_location_name ||= transam_asset.try(:to_location_name)\n self.event_datetime ||= DateTime.now\n\n if self.start_datetime && self.state == 'started' && !self.new_record?\n unless self.start_datetime <= DateTime.now && (self.end_datetime.nil? || DateTime.now <= self.end_datetime)\n fire_state_event(:closeout)\n\n event = WorkflowEvent.new\n event.creator = User.find_by(first_name: 'system')\n event.accountable = self\n event.event_type = 'closeout'\n event.save\n end\n end\n end", "def set_activity\n @activity = PublicActivity::Activity.find(params[:id])\n end", "def set_activity\n begin\n @activity = Activity.find(params[:id])\n rescue\n end\n end", "def set_defaults\n @start_date = Date.today - 2.weeks\n @end_date = Date.today\n end", "def set_important_date\n @important_date = ImportantDate.find(params[:id])\n end", "def set_daily_timesheet\n @daily_timesheet = DailyTimesheet.find_by_id(params[:id])\n end", "def set_activity\n @activity = ActivityLog.find(params[:id]) unless params[:id].nil?\n if @activity.nil?\n redirect_to '/404'\n return\n end\n end", "def set_activity\n @activity = Activity.find(params[:id])\n @reciever = Reciever.find(@activity.reciever_id)\n end", "def after_initialize\n @date = Date.today \n end", "def set_daily_tracking\n @daily_tracking = DailyTracking.find(params[:id])\n end", "def set_delivered_at\n self.delivered_at = Date.today\n end", "def set_activity\n @activity = Activity.find_by_id(params[:id])\n end", "def initialize activity\n @activity = activity\n end", "def update_audit\n self.reload\n\n # TODO refactor for Trackables 2.0\n # currently for past-added trackables\n sync_trackables unless date.today?\n\n if date.today? and not self.settings.eql?(user.settings)\n # TODO put back in trackable check\n # if date.today? and (trackables_present? or not self.settings.eql?(user.settings))\n\n # clear existing treatment settings to make way for new ones\n treatments.uniq.each do |treatment|\n user.settings.delete_if {|key| key =~ Regexp.new(Regexp.quote(\"treatment_#{treatment.name}\")) and treatment.taken? }\n end\n\n user.update_settings(self.settings)\n #\n # self.reload\n # user.create_audit\n end\n\n end", "def set_activity\n @activity = Activity.find(params[:id]) if params[:id]\n @project = Project.find(params[:project_id])\n\n end", "def after_perform_do_stats(*args)\n Stats.increx hourly_key, 3600 * 24 # 24h\n Stats.increx daily_key, 3600 * 24 * 31 # 31d\n redis.incr monthly_key\n end", "def set_daily_board\n @daily_board = DailyBoard.find(params[:id])\n end", "def create\n @activity = Activity.new(params[:activity])\n @attcategories = Attcategory.all\n \n @activity.duration = params[:activity_hours].to_i * 60\n @activity.duration += params[:activity_minutes].to_i\n \n @activity.user = current_user\n\n respond_to do |format|\n if @activity.save\n flash[:notice] = 'Activity was successfully created.'\n format.html { redirect_to :action => :change_actattributes, :id => @activity }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def apply\n if desired.cron_exists\n action_create\n else\n action_delete\n end\n end", "def index\n @action_name = \"all\"\n @attendances = current_employee.attendances\n filter_params = params[:date]\n if filter_params\n @d = Date.civil(filter_params[:year].to_i || DateTime.now.year, filter_params[:month].to_i || DateTime.now.month, filter_params[:day].to_i || DateTime.now.day)\n if filter_params[:scope] == \"month\"\n @status = \"monthly\"\n @old_day = @d.beginning_of_month\n @new_day = @d.end_of_month\n else\n @status = \"weekly\"\n @old_day = @d.beginning_of_week\n @new_day = @d.end_of_week\n end\n else\n @status = \"weekly\"\n @old_day = DateTime.now.beginning_of_week\n @new_day = DateTime.now\n end\n @d ||= Date.today\n end", "def prepare_tracking_data\n @start_stop_action = self.get_start_stop_action\n\n @opened_datetime = Datetime.get_opened_one current_user\n if @opened_datetime.nil?\n @activity_name = ''\n else\n @activity = @opened_datetime.activity\n @activity_name = @activity.name\n @activity_spent = self.get_activity_spent_time\n end\n end", "def create\n @activity = Activity.new(params[:activity])\n @activity.user = current_user\n @activity.organization = current_user.organization\n @activity.date = change_date_format(params[:activity][:date]) if !(params[:activity][:date]).blank?\n respond_to do |format|\n if @activity.save\n format.html { redirect_to activity_path(@activity), notice: 'Data was successfully created.' }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def accessed!\n daily_requests_for(Time.now).increment!\n end", "def create\n @activity = Activity.new(params[:activity])\n @activity.user_id = current_user.id\n \n session[:project_id] = params[:activity][:project_id]\n\n respond_to do |format|\n if @activity.save\n\n if @activity.do_today != \"0\" # why is it not converted to bool? probably because it's virtual attribute\n Todotoday.create( :activity_id => @activity.id, :today => Date.today, :user_id => current_user.id,\n :position => ( Todotoday.where(:user_id => current_user.id).count + 1) )\n end\n\n format.html { redirect_to(@activity, :notice => 'Activity was successfully created.') }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n format.json { render :json => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n format.json { render :json => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def daily_morning\n logger.info \" daily_morning\"\n run('Newsletter', :send!)\n end", "def set_daily_load\n # need to fetch all of the practices for the current day of the practice\n sum_daily_load = 0 + @session_load # include session load of current survey\n surveys_today = Survey.for_user(@user_id).post_practice.surveys_on_date(@start_of_today, @end_of_today)\n # sum all surveys\n surveys_today.each do |survey|\n if survey.session_load.nil?\n return\n else\n sum_daily_load += survey.session_load\n end\n return sum_daily_load\n end\n\n # get weekly load by summing all of the session loads from the past 6 days + today\n def set_weekly_load\n sum_weekly_load = 0 + @daily_load\n # get all surveys from the past 6 days + today\n one_week_ago_start = @start_of_today - (6 * SECONDS_IN_ONE_DAY)\n surveys_this_week = Survey.for_user(@user_id).post_practice.surveys_for_week(one_week_ago_start, @end_of_today)\n # sum all surveys\n surveys_this_week.each do |survey|\n if survey.session_load.nil?\n return\n else\n sum_weekly_load += survey.session_load\n end\n end\n return sum_weekly_load\n end\n\n # set the acute load (acute load = weekly load)\n def set_acute_load\n return @weekly_load\n end\n\n # set the chronic load, the average weekly_load over the previous 4 weeks\n # need to calculate all weekly loads individually, can't access from anywhere in db\n def set_chronic_load\n # initialize for mean calculation\n array_of_weekly_loads = []\n # this week time range\n this_week_end = @end_of_today\n this_week_start = @start_of_today.ago(86400 * 6) # not necessary to have, don't use for weekly load calculation here\n # since we already calculated it already (Also and edge, to incude the current survey)\n weekly_load_this_week = @weekly_load\n array_of_weekly_loads << weekly_load_this_week\n\n # last week time range\n one_week_ago_end = @end_of_today.ago(86400 * 7)\n one_week_ago_start = @start_of_today.ago(86400 * 13)\n weekly_load_one_week_ago = calculate_weekly_load_with_dates(one_week_ago_start, one_week_ago_end)\n array_of_weekly_loads << weekly_load_one_week_ago\n\n # two weeks ago time range\n two_weeks_ago_end = @end_of_today.ago(86400 * 14)\n two_weeks_ago_start = @start_of_today.ago(86400 * 20)\n weekly_load_two_weeks_ago = calculate_weekly_load_with_dates(two_weeks_ago_start, two_weeks_ago_end)\n array_of_weekly_loads << weekly_load_two_weeks_ago\n\n # three weeks ago time range\n three_weeks_ago_end = @end_of_today.ago(86400 * 21)\n three_weeks_ago_start = @start_of_today.ago(86400 * 27)\n weekly_load_three_weeks_ago = calculate_weekly_load_with_dates(three_weeks_ago_start,three_weeks_ago_end)\n array_of_weekly_loads << weekly_load_three_weeks_ago\n\n # get average of all weekly loads from past 4 weeks\n chronic_load = array_of_weekly_loads.mean\n\n return chronic_load\n end\n\n # set the freshness index, chronic load - acute load (difference in fitness + fatigue)\n def set_freshness_index\n freshness_index = @chronic_load - @acute_load\n return freshness_index\n end\n\n # set the Acute:Chronic Worload Ratio (ACWR), Acute / Chronic\n def set_a_c_ratio\n # divide by zero possibility => must check what to do with this edge case\n if @chronic_load == 0\n return 0\n else\n a_c_ratio = @acute_load / @chronic_load\n return a_c_ratio\n end\n end\n\n # set the monotony for the past week (6 days ago thru today) (mean / std. dev.)\n def set_monotony\n # get the beginning of the week\n one_week_ago_start = @start_of_today - (6 * SECONDS_IN_ONE_DAY)\n # get all of the daily loads from the past 6 days + today\n weeks_daily_loads = Survey.for_user(@user_id).post_practice.surveys_for_week(one_week_ago_start, @end_of_today)\n\n # create an array of all the daily loads\n week_daily_loads = get_week_daily_loads(weeks_daily_loads)\n\n # get mean of the daily loads from the last week\n mean_daily_loads = week_daily_loads.mean\n\n # get standard deviation of daily loads from last week\n standard_deviation_daily_loads = week_daily_loads.standard_deviation\n\n # divide by zero possibility => must check what to do with this edge case\n if standard_deviation_daily_loads == 0\n monotony = 0\n else\n # monotony = mean of daily lodas / standard deviation\n monotony = mean_daily_loads / standard_deviation_daily_loads\n end\n\n return monotony\n end\n\n # set the daily strain for today, daily_load * monotony\n def set_daily_strain\n daily_strain = @daily_load * @monotony\n return daily_strain\n end\n\n # set the weekly strain for this week, weekly_load * monotony\n def set_weekly_strain\n weekly_strain = @weekly_load * @monotony\n return weekly_strain\n end\n\n # Validations\n\n # validate fields for post practice calcualtions\n def validate_fields_for_calculations(params)\n rpe = params[:player_rpe_rating]\n performance = params[:player_personal_performance]\n full_practice = params[:participated_in_full_practice]\n minutes = params[:minutes_participated]\n # nill checks\n if rpe.nil? || performance.nil? || full_practice.nil?\n return false\n # type checks\n elsif (!validate_integer_type(rpe) || !validate_integer_type(performance) || !validate_boolean_type(full_practice) || !validate_integer_type(minutes))\n return false\n # practice + minutes check\n elsif (full_practice == false && minutes.nil?)\n return false\n # pass preliminary checks\n else\n return true\n end\n\n end\n\n # validate whether a provided field is a boolean type\n def validate_boolean_type(field)\n if field.is_a?(TrueClass) || field.is_a?(FalseClass)\n return true\n else\n return false\n end\n end\n\n # validate integer type for provided field - MUST BE POSITIVE\n def validate_integer_type(field)\n if field.is_a?(Integer)\n return true\n else\n return false\n end\n end\n\n # Miscellaneous functions\n\n def set_today_start_end_datetime_objects\n if @current_datetime.dst?\n @start_of_today = Time.new(@current_year, @current_month, @current_day, 0, 0, 0, \"-04:00\")\n @end_of_today = Time.new(@current_year, @current_month, @current_day, 23, 59, 59, \"-04:00\")\n else\n @start_of_today = Time.new(@current_year, @current_month, @current_day, 0, 0, 0, \"-05:00\")\n @end_of_today = Time.new(@current_year, @current_month, @current_day, 23, 59, 59, \"-05:00\")\n end\n end\n\n # calculate weekly load given the start and end of the week\n def calculate_weekly_load_with_dates(startTime,endTime)\n sum_weekly_load = 0\n surveys_this_week = Survey.for_user(@user_id).post_practice.surveys_for_week(startTime, endTime)\n # sum all surveys\n surveys_this_week.each do |survey|\n if survey.session_load.nil?\n return\n else\n sum_weekly_load += survey.session_load\n end\n end\n # return the totaled\n return sum_weekly_load\n end\n\n # get array of daily loads of every day (no repeats)\n def get_week_daily_loads(weeks_surveys)\n daily_hash = {\"Monday\":0, \"Tuesday\":0, \"Wednesday\":0, \"Thursday\":0, \"Friday\":0, \"Saturday\":0, \"Sunday\":0}\n weeks_surveys.each do |survey|\n survey_day_key = get_day_of_week(survey.completed_time)\n daily_hash[survey_day_key] += survey.session_load\n end\n return daily_hash.values\n end\n\n # return the day of the week, given the datetime\n def get_day_of_week(survey_datetime)\n if survey_datetime.monday?\n day_of_week = \"Monday\"\n elsif survey_datetime.tuesday?\n day_of_week = \"Tuesday\"\n elsif survey_datetime.wednesday?\n day_of_week = \"Wednesday\"\n elsif survey_datetime.thursday?\n day_of_week = \"Thursday\"\n elsif survey_datetime.friday?\n day_of_week = \"Friday\"\n elsif survey_datetime.saturday?\n day_of_week = \"Saturday\"\n # elsif current_day.sunday?\n else\n day_of_week = \"Sunday\"\n end\n\n return day_of_week\n end\n\n\nend", "def set_daily_report\n @daily_report = DailyReport.find(params[:id])\n end", "def index\n\n # default show activities starting two months ago\n from_date = Time.now - 2.months\n to_date = Time.now + 2.months\n\n if(params.has_key?(:start_date))\n from_date = Time.parse(params[:start_date]) - 3.months\n to_date = Time.parse(params[:start_date]) + 3.months\n end\n\n @activities = Activity.includes(:activity_type).where(\"user_id=? and start>=? and start<=?\", current_user.id, from_date, to_date)\n\n total_duration = Activity.where(\"user_id=?\", current_user.id).group(:user_id).sum(:duration)[1]\n \n @total_hours = 0\n @total_minutes = 0\n if !total_duration.nil?\n @total_hours = total_duration / 60\n @total_minutes = total_duration % 60\n end\n\n #total calories\n sql = <<-SQL\n SELECT\n activities.user_id,\n SUM(activities.duration*activity_types.calories_factor) as calories\n FROM activities\n JOIN activity_types ON\n activities.activity_type_id = activity_types.id\n WHERE activities.user_id=#{ActiveRecord::Base.connection.quote(current_user.id)}\n GROUP BY activities.user_id\n SQL\n first = Activity.find_by_sql(sql).first\n @total_calories = first.nil? ? 0 : first.calories\n\n # favorite activity calculated as activity type with longest duration\n favorite = ActivityType.select('activity_types.id, activity_types.name')\n .left_joins(:activities)\n .where(\"activities.user_id=?\", current_user.id)\n .group('activity_types.id')\n .sum('activities.duration')\n\n sql = <<-SQL\n SELECT\n activity_types.id,\n activity_types.name,\n SUM(activities.duration) as duration\n FROM activity_types\n JOIN activities ON\n activities.activity_type_id = activity_types.id\n WHERE activities.user_id=#{ActiveRecord::Base.connection.quote(current_user.id)}\n GROUP BY activity_types.id\n ORDER BY duration DESC\n SQL\n first = ActivityType.find_by_sql(sql).first\n @favorite_activity_type = first.nil? ? \"-\" : first.name\n\n\n\n\n # duration per day for last 30 days\n if Rails.env.production?\n sql = <<-SQL\n SELECT\n date_trunc('day', start) \"start_date\",\n SUM(duration) as duration\n FROM activities\n WHERE user_id=#{ActiveRecord::Base.connection.quote(current_user.id)} \n AND start<=#{ActiveRecord::Base.connection.quote(Time.now)}\n AND start>=#{ActiveRecord::Base.connection.quote(Time.now - 31.days)}\n GROUP BY 1\n SQL\n data = Activity.find_by_sql(sql).map{ |i| {start: i[:start_date].strftime(\"%F\"), duration: i[:duration]} }\n .each_with_object({}) { |k, h| h[k[:start]] = {:duration => k[:duration] } }\n else\n sql = <<-SQL\n SELECT\n SUM(duration) as duration,\n date(start) as start_date\n FROM activities\n WHERE user_id=#{ActiveRecord::Base.connection.quote(current_user.id)}\n AND start<=#{ActiveRecord::Base.connection.quote(Time.now)}\n AND start>=#{ActiveRecord::Base.connection.quote(Time.now - 31.days)}\n GROUP BY date(start)\n SQL\n data = Activity.find_by_sql(sql).index_by { |t| t.start_date }\n end\n\n @minutes_data = {}\n (0..30).each { |i|\n i = 30 - i\n day = (Time.now - i.days).to_date\n count = 0\n if !data[day.strftime(\"%F\")].nil?\n count = data[day.strftime(\"%F\")][:duration]\n end\n @minutes_data[day.strftime(\"%b %d\")] = count\n }\n\n # calories per day for last 30 days\n if Rails.env.production?\n sql = <<-SQL\n SELECT\n date_trunc('day', start) \"start_date\",\n SUM(activities.duration*activity_types.calories_factor) as calories\n FROM activities\n JOIN activity_types ON\n activities.activity_type_id = activity_types.id\n WHERE user_id=#{ActiveRecord::Base.connection.quote(current_user.id)}\n AND start<=#{ActiveRecord::Base.connection.quote(Time.now)}\n AND start>=#{ActiveRecord::Base.connection.quote(Time.now - 31.days)}\n GROUP BY 1\n SQL\n data = Activity.find_by_sql(sql).map{ |i| {start: i[:start_date].strftime(\"%F\"), calories: i[:calories]} }\n .each_with_object({}) { |k, h| h[k[:start]] = {:calories => k[:calories] } }\n else\n sql = <<-SQL\n SELECT\n SUM(activities.duration*activity_types.calories_factor) as calories,\n date(start) as start_date\n FROM activities\n JOIN activity_types ON\n activities.activity_type_id = activity_types.id\n WHERE activities.user_id=#{ActiveRecord::Base.connection.quote(current_user.id)}\n AND start<=#{ActiveRecord::Base.connection.quote(Time.now)}\n AND start>=#{ActiveRecord::Base.connection.quote(Time.now - 31.days)}\n GROUP BY date(activities.start)\n SQL\n data = Activity.find_by_sql(sql).index_by { |t| t.start_date }\n end\n\n @calories_data = {}\n (0..30).each { |i|\n i = 30 - i\n day = (Time.now - i.days).to_date\n count = 0\n if !data[day.strftime(\"%F\")].nil?\n count = data[day.strftime(\"%F\")][:calories]\n end\n @calories_data[day.strftime(\"%b %d\")] = count\n }\n\n end", "def activity_on_date_range(activity, start, finish)\n get(\"/user/#{@user_id}/activities/#{activity}/date/#{format_date(start)}/#{format_date(finish)}.json\")\n end", "def before_background_callbacks(*args)\n set_audit_user\n set_request_uuid\n set_remote_address\n end" ]
[ "0.6270626", "0.6170346", "0.5965133", "0.59274125", "0.56509954", "0.5551927", "0.5538971", "0.54896075", "0.545823", "0.545567", "0.5414089", "0.5382067", "0.5381866", "0.53529984", "0.5349888", "0.53257257", "0.5322765", "0.5322765", "0.5322765", "0.5322765", "0.5322332", "0.53219354", "0.53205043", "0.52640676", "0.52574503", "0.5253766", "0.52522063", "0.5250799", "0.52485734", "0.5248208", "0.52463883", "0.5238244", "0.5237786", "0.5237786", "0.5237786", "0.5237786", "0.5237786", "0.5237786", "0.5237786", "0.5237786", "0.5237786", "0.5237786", "0.5237786", "0.5237786", "0.5237786", "0.5237786", "0.5237786", "0.5237786", "0.5237786", "0.5237786", "0.5237786", "0.5237786", "0.5237786", "0.5237786", "0.5237786", "0.523442", "0.5224566", "0.5215717", "0.52065307", "0.52017653", "0.52017653", "0.52017653", "0.52017653", "0.52017653", "0.52017653", "0.52017653", "0.52017653", "0.5185558", "0.5177648", "0.5151593", "0.514627", "0.51341766", "0.5131135", "0.51245844", "0.5124176", "0.5121167", "0.51206744", "0.5118621", "0.5091971", "0.508824", "0.50794196", "0.5073886", "0.50709426", "0.506703", "0.5055639", "0.50497276", "0.5035845", "0.50226754", "0.5017729", "0.50128645", "0.50092363", "0.50058866", "0.50032806", "0.49992275", "0.4998674", "0.49985117", "0.49794018", "0.49743798", "0.49669537", "0.496227", "0.49576423" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def daily_activity_params params.require(:daily_activity).permit(:name, :kind, :date, :description, :dog_id, :time, :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 params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
Initializes the Atari environment
def init_env type: # puts " initializing env" if debug # print "(newenv) " #if debug AtariWrapper.new gym.make(type), downsample: compr.downsample, skip_type: skip_type, preproc: preproc end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init!\n @logger = @config = @database_config = nil\n\n load_application_config\n load_database_config\n note \"Loading #{env} environment (#{Ajaila::VERSION})\"\n load_classes\n note \"Establishing database connection\"\n establish_database_connection\n note \"Running auto-upgrade migrations\"\n run_auto_upgrade_migrations\n note \"Application has been initialized\"\n self\n end", "def initialize_environment\n end", "def initialize_environment\n end", "def init_env\n @resource_descriptions = HashWithIndifferentAccess.new { |h, version| h[version] = {} }\n @controller_to_resource_id = {}\n @param_groups = {}\n\n # what versions does the controller belong in (specified by resource_description)?\n @controller_versions = Hash.new { |h, controller| h[controller] = [] }\n end", "def initialize\n # Load configuration file\n require 'yaml'\n @env = HashWithIndifferentAccess.new(YAML.load_file(File.join(File.dirname(__FILE__), '..', 'config', 'environments', \"#{ENV['RACK_ENV']}.yml\")))\n end", "def initialize\n setup_ohai\n configure\n end", "def setup_environment; end", "def initialize\n # Create temporary data directory\n create_data_dir\n\n # Init connection to ADS\n init_ads\n\n # Initialize Data science toolkit\n init_dstk\n\n # Init connection to SQLite\n # init_sqlite3\n end", "def init_talia\n return if(TaliaCore::Initializer.initialized)\n\n # If we have Rails installed, just call the Rails config \n # instead of running the manual init\n if(defined?(RAILS_ROOT) && File.exist?(File.join(RAILS_ROOT, 'config', 'environment.rb')))\n puts \"\\nInitializing Talia through Rails\"\n load(File.join(RAILS_ROOT, 'config', 'environment.rb'))\n else\n\n # If options are not set, the initializer will fall back to the internal default\n TaliaCore::Initializer.talia_root = ENV['talia_root']\n TaliaCore::Initializer.environment = ENV['environment']\n\n config_file = ENV['config'] ? ENV['config'] : 'talia_core'\n\n # run the initializer\n TaliaCore::Initializer.run(config_file) do |config|\n unless(flag?('no_standalone'))\n puts \"Always using standalone db from utilities.\"\n puts \"Give the no_standalone option to override it.\"\n config['standalone_db'] = \"true\"\n end\n end\n end\n puts(\"\\nTaliaCore initialized\")\n\n # # Flush the database if requested\n if(flag?('reset_db'))\n flush_db\n puts \"DB flushed\"\n end\n\n # Flus the rdf if requested\n if(flag?('reset_rdf'))\n flush_rdf\n puts \"RDF flushed\"\n end\n end", "def setup_env\n @databases = Influx::Config::DATABASES\n @influxdb = Influx::Config::CLIENT\nend", "def init_clients(environment=:development)\n env_config = self.config_for(environment)\n self.init_riak_client(env_config)\n end", "def initialize (environment)\n environment=environment.to_sym if environment.is_a?String\n aws_settings=Helpers.load_json_data_to_hash(\"settings/aws-data.json\")\n throw \"can't find this environment,'#{environment}'\" if !aws_settings.has_key? environment\n environment_data= aws_settings[environment]\n driver = VaultDriver.from_secrets_file environment.to_s\n if environment_data.key?(:secrets)\n notify 'vault unlocked' if driver.unlock_vault(environment_data[:secrets][:vault][:keys]) == 200\n else\n notify 'no vault secrets file.'\n end\n driver.get_vault_status\n if driver.online && !driver.locked\n vault_data,code = driver.get_json(\"secret/ossec-manager\")\n else\n throw \"vault is off line or locked\"\n end\n throw \"couldn't get ossec data\" if code >399\n @username=vault_data['username']\n @password=vault_data['password']\n addresses=OssecManager.get_ossec_manager_ip_for_environment(environment)\n throw \"there is no server address for the environment #{environment}\" if addresses==nil\n @server_address=addresses[0]\n @private_server_address=addresses[1]\n @server_port=55000\n end", "def bootstrap_init\n end", "def initialize\n configure_via_yaml\n configure_via_env\n end", "def setup!(requesting_actor_id, options=Hash.new)\n create_database!\n\n policy = OrgAuthPolicy.new(self, requesting_actor_id, options)\n policy.apply!\n\n # Environments are in erchef / SQL. Make an HTTP request to create the default environment\n headers = {:headers => {'x-ops-request-source' => 'web'}}\n rest = Chef::REST.new(Chef::Config[:chef_server_host_uri],\n Chef::Config[:web_ui_proxy_user],\n Chef::Config[:web_ui_private_key], headers)\n rest.post_rest(\"organizations/#{name}/environments\",\n {\n 'name' => '_default',\n 'description' => 'The default Chef environment'\n })\n end", "def initialize_database\n config = YAML::load(IO.read(Antfarm::Helpers.defaults_file))\n # Database setup based on adapter specified\n if config && config[ANTFARM_ENV] && config[ANTFARM_ENV].has_key?('adapter')\n if config[ANTFARM_ENV]['adapter'] == 'sqlite3'\n config[ANTFARM_ENV]['database'] = Antfarm::Helpers.db_file(ANTFARM_ENV)\n elsif config[ANTFARM_ENV]['adapter'] == 'postgres'\n config[ANTFARM_ENV]['database'] = ANTFARM_ENV\n else\n # If adapter specified isn't one of sqlite3 or postgresql,\n # default to SQLite3 database configuration.\n config = nil\n end\n else\n # If the current environment configuration doesn't specify a\n # database adapter, default to SQLite3 database configuration.\n config = nil\n end\n # Default to SQLite3 database configuration\n config ||= { ANTFARM_ENV => { 'adapter' => 'sqlite3', 'database' => Antfarm::Helpers.db_file(ANTFARM_ENV) } }\n if config[ANTFARM_ENV]['adapter'] == 'postgres'\n DataMapper.setup(:default, \"postgres:///#{config[ANTFARM_ENV]['database']}\")\n else\n DataMapper.setup(:default, \"sqlite3://#{config[ANTFARM_ENV]['database']}\")\n end\n end", "def configure\n @environment = facts.fetch(\"chef_environment\"){\"development\"}.downcase\n @fqdn = facts.fetch(\"fqdn\"){\"\"}\n @app_names = facts.fetch(\"trebuchet\"){[]}\n end", "def setup\n @agent = ::Instana::Backend::Agent.new\n @tracer = ::Instana::Tracer.new\n @processor = ::Instana::Processor.new\n @secrets = ::Instana::Secrets.new\n @serverless = ::Instana::Serverless.new\n end", "def init\n self['env'] ||= 'development'\n\n n = (self['port'] || 3000).to_i\n assert n >= 0 && n <= 65535\n self['port'] = n\n\n n = (self['workers'] || self['worker'] || ((CpuCounter.count + 1)/ 2)).to_i\n assert n > 0 && n < 1000\n self['workers'] = n\n\n unless self['root']\n set :root, Dir.pwd\n end\n self['root'] = File.realpath File.expand_path self['root']\n\n # todo warn paths not under project?\n self['views'] = project_path(self['views'] || 'views')\n if self['public']\n self['public'] = project_path(self['public'])\n end\n\n if self['assets']\n self['assets'] = project_path(self['assets'])\n end\n\n self.logger = create_logger\n\n assert !self['before_fork'] || self['before_fork'].respond_to?('call')\n assert !self['after_fork'] || self['after_fork'].respond_to?('call')\n\n self['timeout'] ||= 120\n timeout = self['timeout'].to_i\n assert timeout > 0 && timeout < 2**30\n self['timeout'] = timeout\n Ext.set_inactive_timeout timeout\n end", "def initialize_environment\n env = ws.env\n\n config = ws.config\n\n env.add_path 'PATH', File.join(ws.prefix_dir, 'gems', 'bin')\n env.add_path 'PATH', File.join(config.bundler_gem_home, 'bin')\n env.add_path 'PATH', File.join(ws.dot_autoproj_dir, 'autoproj', 'bin')\n env.set 'GEM_HOME', config.gems_gem_home\n env.set 'GEM_PATH', config.bundler_gem_home\n\n root_dir = File.join(ws.prefix_dir, 'gems')\n gemfile_path = File.join(root_dir, 'Gemfile')\n if File.file?(gemfile_path)\n env.set('BUNDLE_GEMFILE', gemfile_path)\n end\n\n if !config.private_bundler? || !config.private_autoproj? || !config.private_gems?\n env.set('GEM_PATH', *Gem.default_path)\n end\n Autobuild.programs['bundler'] = File.join(ws.dot_autoproj_dir, 'bin', 'bundler')\n\n if config.private_bundler?\n env.add_path 'GEM_PATH', config.bundler_gem_home\n end\n\n env.init_from_env 'RUBYLIB'\n env.inherit 'RUBYLIB'\n # Sanitize the rubylib we get from the environment by removing\n # anything that comes from Gem or Bundler\n original_rubylib =\n (env['RUBYLIB'] || \"\").split(File::PATH_SEPARATOR).find_all do |p|\n !p.start_with?(Bundler.rubygems.gem_dir) &&\n !Bundler.rubygems.gem_path.any? { |gem_p| p.start_with?(p) }\n end\n # And discover the system's rubylib\n if system_rubylib = discover_rubylib\n # Do not explicitely add the system rubylib to the\n # environment, the interpreter will do it for us.\n #\n # This allows to use a binstub generated for one of ruby\n # interpreter version on our workspace\n env.system_env['RUBYLIB'] = []\n env.original_env['RUBYLIB'] = (original_rubylib - system_rubylib).join(File::PATH_SEPARATOR)\n end\n\n ws.config.each_reused_autoproj_installation do |p|\n reused_w = ws.new(p)\n reused_c = reused_w.load_config\n env.add_path 'PATH', File.join(reused_w.prefix_dir, 'gems', 'bin')\n end\n\n prefix_gems = File.join(ws.prefix_dir, \"gems\")\n FileUtils.mkdir_p prefix_gems\n gemfile = File.join(prefix_gems, 'Gemfile')\n if !File.exists?(gemfile)\n File.open(gemfile, 'w') do |io|\n io.puts \"eval_gemfile \\\"#{File.join(ws.dot_autoproj_dir, 'autoproj', 'Gemfile')}\\\"\"\n end\n end\n\n if bundle_rubylib = discover_bundle_rubylib(silent_errors: true)\n update_env_rubylib(bundle_rubylib, system_rubylib)\n end\n end", "def initialize!\n load_passenger\n initialize_ush_api\n initialize_debugging\n undo_bundler\n end", "def initialize( location = 'stage', env_file = File.expand_path(\"#{__FILE__}/../../config/stage.sh\"))\n @location = location\n @env_file = env_file\n envfile_hash = process_env_file( env_file )\n #ENV explicit settings override values found in a locations config file\n @data = Hash[ SQA_ECOMM_SERVER_URL: ENV.fetch( 'SQA_ECOMM_SERVER_URL', envfile_hash['SQA_ECOMM_SERVER_URL'] ),\n SQA_ECOMM_API_SERVER_URL: ENV.fetch( 'SQA_ECOMM_API_SERVER_URL', envfile_hash['SQA_ECOMM_API_SERVER_URL'] ),\n SQA_ECOMM_DB_SERVER: ENV.fetch( 'SQA_ECOMM_DB_SERVER', envfile_hash['SQA_ECOMM_DB_SERVER'] ),\n SQA_ECOMM_DB: ENV.fetch( 'SQA_ECOMM_DB', envfile_hash['SQA_ECOMM_DB'] ),\n SQA_ECOMM_DB_UPDATE_USER: ENV.fetch( 'SQA_ECOMM_DB_UPDATE_USER', envfile_hash['SQA_ECOMM_DB_UPDATE_USER'] ),\n SQA_ECOMM_DB_UPDATE_PW: ENV.fetch( 'SQA_ECOMM_DB_UPDATE_PW', envfile_hash['SQA_ECOMM_DB_UPDATE_PW'] ),\n SQA_ECOMM_DB_READONLY_USER: ENV.fetch( 'SQA_ECOMM_DB_READONLY_USER', envfile_hash['SQA_ECOMM_DB_READONLY_USER'] ),\n SQA_ECOMM_DB_READONLY_PW: ENV.fetch( 'SQA_ECOMM_DB_READONLY_PW', envfile_hash['SQA_ECOMM_DB_READONLY_PW'] ),\n SQA_ORACLE_DB_SERVER: ENV.fetch( 'SQA_ORACLE_DB_SERVER', envfile_hash['SQA_ORACLE_DB_SERVER'] ),\n SQA_ORACLE_DB_UPDATE_USER: ENV.fetch( 'SQA_ORACLE_DB_UPDATE_USER', envfile_hash['SQA_ORACLE_DB_UPDATE_USER'] ),\n SQA_ORACLE_DB_UPDATE_PW: ENV.fetch( 'SQA_ORACLE_DB_UPDATE_PW', envfile_hash['SQA_ORACLE_DB_UPDATE_PW'] ),\n SQA_ORACLE_DB_READONLY_USER: ENV.fetch( 'SQA_ORACLE_DB_READONLY_USER', envfile_hash['SQA_ORACLE_DB_READONLY_USER'] ),\n SQA_ORACLE_DB_READONLY_PW: ENV.fetch( 'SQA_ORACLE_DB_READONLY_PW', envfile_hash['SQA_ORACLE_DB_READONLY_PW'] ),\n SQA_HJ_DB_SERVER: ENV.fetch( 'SQA_HJ_DB_SERVER', envfile_hash['SQA_HJ_DB_SERVER'] ),\n SQA_HJ_DB: ENV.fetch( 'SQA_HJ_DB', envfile_hash['SQA_HJ_DB'] ),\n SQA_HJ_DB_UPDATE_USER: ENV.fetch( 'SQA_HJ_DB_UPDATE_USER', envfile_hash['SQA_HJ_DB_UPDATE_USER'] ),\n SQA_HJ_DB_UPDATE_PW: ENV.fetch( 'SQA_HJ_DB_UPDATE_PW', envfile_hash['SQA_HJ_DB_UPDATE_PW'] ),\n SQA_HJ_DB_READONLY_USER: ENV.fetch( 'SQA_HJ_DB_READONLY_USER', envfile_hash['SQA_HJ_DB_READONLY_USER'] ),\n SQA_HJ_DB_READONLY_PW: ENV.fetch( 'SQA_HJ_DB_READONLY_PW', envfile_hash['SQA_HJ_DB_READONLY_PW'] ),\n SQA_RUDI_SERVER: ENV.fetch( 'SQA_RUDI_SERVER', envfile_hash['SQA_RUDI_SERVER'] ),\n SQA_RUDI_VERSION: ENV.fetch( 'SQA_RUDI_VERSION', envfile_hash['SQA_RUDI_VERSION'] ),\n SQA_UNIBLAB_SERVER: ENV.fetch( 'SQA_UNIBLAB_SERVER', envfile_hash['SQA_UNIBLAB_SERVER'] ),\n SQA_UNIBLAB_VERSION: ENV.fetch( 'SQA_UNIBLAB_VERSION', envfile_hash['SQA_UNIBLAB_VERSION'] ) ]\n end", "def initialize_env(named_params)\n _init_attrs(named_params.fetch(:imf))\n @source_path = named_params.fetch(:data)\n im_path = _initialize_ingest_manifest(named_params)\n _initialize_collection_manifest(im_path: im_path, named_params: named_params)\n _initialize_config(ingest_manifest_path: im_path, named_params: named_params)\n end", "def initialize_environment\n env = ws.env\n\n config = ws.config\n\n env.add_path \"PATH\", File.join(ws.prefix_dir, \"gems\", \"bin\")\n env.add_path \"PATH\", File.join(ws.dot_autoproj_dir, \"bin\")\n env.set \"GEM_HOME\", config.gems_gem_home\n env.clear \"GEM_PATH\"\n if (bundler_version = config.bundler_version)\n env.set \"BUNDLER_VERSION\", bundler_version\n else\n env.clear \"BUNDLER_VERSION\"\n end\n\n gemfile_path = File.join(ws.prefix_dir, \"gems\", \"Gemfile\")\n env.set(\"BUNDLE_GEMFILE\", gemfile_path) if File.file?(gemfile_path)\n\n if cache_dir && File.exist?(cache_dir)\n vendor_dir = File.join(File.dirname(gemfile_path), \"vendor\")\n FileUtils.mkdir_p vendor_dir\n bundler_cache_dir = File.join(vendor_dir, \"cache\")\n if File.writable?(cache_dir)\n create_cache_symlink(cache_dir, bundler_cache_dir)\n else\n Autoproj.warn \"BundlerManager: #{cache_dir} is read-only \"\\\n \"copying the cache instead of symlinking it\"\n create_cache_copy(cache_dir, bundler_cache_dir)\n end\n end\n\n Autobuild.programs[\"bundler\"] =\n Autobuild.programs[\"bundle\"] =\n File.join(ws.dot_autoproj_dir, \"bin\", \"bundle\")\n\n env.init_from_env \"RUBYLIB\"\n env.inherit \"RUBYLIB\"\n # Sanitize the rubylib we get from the environment by removing\n # anything that comes from Gem or Bundler\n original_rubylib =\n (env[\"RUBYLIB\"] || \"\").split(File::PATH_SEPARATOR).find_all do |p|\n !p.start_with?(Bundler.rubygems.gem_dir) &&\n Bundler.rubygems.gem_path\n .none? { |gem_p| p.start_with?(gem_p) }\n end\n\n # And discover the system's rubylib\n if (system_rubylib = discover_rubylib)\n # Do not explicitely add the system rubylib to the\n # environment, the interpreter will do it for us.\n #\n # This allows to use a binstub generated for one of ruby\n # interpreter version on our workspace\n env.system_env[\"RUBYLIB\"] = []\n env.original_env[\"RUBYLIB\"] = (original_rubylib - system_rubylib)\n .join(File::PATH_SEPARATOR)\n end\n\n ws.config.each_reused_autoproj_installation do |p|\n reused_w = ws.new(p)\n env.add_path \"PATH\", File.join(reused_w.prefix_dir, \"gems\", \"bin\")\n end\n\n prefix_gems = File.join(ws.prefix_dir, \"gems\")\n FileUtils.mkdir_p prefix_gems\n gemfile = File.join(prefix_gems, \"Gemfile\")\n unless File.exist?(gemfile)\n Ops.atomic_write(gemfile) do |io|\n dot_autoproj_gemfile = File.join(ws.dot_autoproj_dir, \"Gemfile\")\n io.puts \"eval_gemfile \\\"#{dot_autoproj_gemfile}\\\"\"\n end\n end\n\n if (bundle_rubylib = discover_bundle_rubylib(silent_errors: true))\n update_env_rubylib(bundle_rubylib, system_rubylib)\n end\n end", "def initialize()\n #@appliance_name, @appliance_url = Morpheus::Cli::Remote.active_appliance\n end", "def app_init!(rails_env)\n if rails_env.ssh_forwarding? && !running_rake_command?\n User.authentication_service = Fakes::AuthenticationService\n # This sets up the Fake::VBMSService with documents for the VBMS ID DEMO123. We normally\n # set this up in Fakes::AppealRepository.seed! which we don't call for this environment.\n Fakes::VBMSService.document_records = { \"DEMO123\" => Fakes::Data::AppealData.static_reader_documents }\n end\n\n if rails_env.demo? || rails_env.development?\n # If we are running a rake command like `rake db:seed` or\n # `rake db:schema:load`, we do not want to try and seed the fakes\n # because our schema may not be loaded yet and it will fail!\n if running_rake_command?\n load!\n else\n load_fakes_and_seed!(rails_env: rails_env)\n end\n end\n end", "def initialize()\n # @appliance_name, @appliance_url = Morpheus::Cli::Remote.active_appliance\n end", "def class_init\n @environments_by_name = {}\n @environments = []\n end", "def setup\n\n setup_path\n save_application_details\n add_jvm_args\n rename_server_instance\n\n \"/bin/bash ./#{SETUP_ENV_SCRIPT}\"\n end", "def initialize_environment(args, options, config)\n raise Errors::CLIMissingEnvironment.new if !config[:env]\n @env = config[:env]\n @env.ui = UI::Shell.new(@env, shell) if !@env.ui.is_a?(UI::Shell)\n end", "def setup\n @executor = NagiosHerald::Executor.new\n @options = {}\n @options[:env] = File.join(File.dirname(__FILE__), '..', 'env_files', 'check_disk.CRITICAL_ICINGA')\n end", "def initialize\n @environment_variables = {}\n @aliases = {}\n @commands = []\n end", "def in_environment(&block)\n initialize_settings\n\n Puppet::Pal.in_tmp_environment(\"choria\", :modulepath => @modulepath, :facts => facts, &block)\n end", "def setup\n\n setup_path\n save_application_details\n add_jvm_args\n rename_server_instance\n\n \"/bin/sh ./#{SETUP_ENV_SCRIPT}\"\n end", "def abs_initialize\n # only proceed if the user has a token\n user_has_token = false\n if get_abs_token\n user_has_token = true\n\n @abs_base_url = ENV[\"ABS_BASE_URL\"] ? ENV[\"ABS_BASE_URL\"] : ABS_BASE_URL\n @aws_platform = ENV[\"ABS_AWS_PLATFORM\"] ? ENV[\"ABS_AWS_PLATFORM\"] : AWS_PLATFORM\n @aws_image_id = ENV[\"ABS_AWS_IMAGE_ID\"] ? ENV[\"ABS_AWS_IMAGE_ID\"] : AWS_IMAGE_ID\n @aws_region = ENV[\"ABS_AWS_REGION\"] ? ENV[\"ABS_AWS_REGION\"] : AWS_REGION\n @aws_reap_time = ENV[\"ABS_AWS_REAP_TIME\"] ? ENV[\"ABS_AWS_REAP_TIME\"] : AWS_REAP_TIME\n @mom_size = ENV[\"ABS_AWS_MOM_SIZE\"]\n @mom_volume_size = ENV[\"ABS_AWS_MOM_VOLUME_SIZE\"] ? ENV[\"ABS_AWS_MOM_VOLUME_SIZE\"] : MOM_VOLUME_SIZE\n @metrics_size = ENV[\"ABS_AWS_METRICS_SIZE\"]\n @metrics_volume_size = ENV[\"ABS_METRICS_VOLUME_SIZE\"] ? ENV[\"ABS_METRICS_VOLUME_SIZE\"] : METRICS_VOLUME_SIZE\n @abs_beaker_pe_version = ENV[\"BEAKER_PE_VER\"] ? ENV[\"BEAKER_PE_VER\"] : nil\n end\n user_has_token\n end", "def initialize_connection(env)\n end", "def init!\n @defaults = {\n :@refresh_token => ENV[\"STC_REFRESH_TOKEN\"],\n :@client_id => ENV[\"STC_CLIENT_ID\"],\n :@client_secret => ENV[\"STC_CLIENT_SECRET\"],\n :@language_code => \"nl-NL\",\n :@environment => 'test',\n :@version => 1,\n :@verbose => false,\n }\n end", "def app_init!(rails_env)\n if rails_env.development? || rails_env.demo?\n # If we are running a rake command like `rake db:seed` or\n # `rake db:schema:load`, we do not want to try and seed the fakes\n # because our schema may not be loaded yet and it will fail!\n if running_rake_command?\n load!\n else\n load_fakes_and_seed!\n end\n end\n end", "def do_initialize\n Puppet.initialize_settings\n Puppet[:parser] = 'future' # this is required in order to work with puppet 3.8\n Puppet[:trusted_node_data] = true\n rescue ArgumentError => e\n rescue Puppet::DevError => e\n # do nothing otherwise calling init twice raises an error\n end", "def initialize env\n @env = env\n super()\n end", "def initialize env\n @env = env\n super()\n end", "def init\n require File.expand_path( '../irbtools.rb', File.dirname(__FILE__) )\n end", "def init\n clone_appd_cookbook\n chef_gem \"install berkshelf\"\n end", "def init_server\n box = @boxes[@environment_name]\n if box.nil?\n launch!\n else\n @cloud.connect_to_server(box)\n end\n end", "def initialize(chef_server_rest: nil)\n @name = \"\"\n @description = \"\"\n @default_attributes = Mash.new\n @override_attributes = Mash.new\n @env_run_lists = { \"_default\" => Chef::RunList.new }\n @chef_server_rest = chef_server_rest\n end", "def initialize()\n @config = YAML.load_file('config.yaml')\n @puppetdb = @config['puppetdb']\n @servicenow = @config['servicenoe']\n @syslog = @config['syslog']\n end", "def startup()\n check_return_code(PureHailDB.ib_startup(\"BARRACUDA\"))\n end", "def init\n Config.load_yaml\n Log.init\n reset\n end", "def do_initialize\n begin\n Puppet.initialize_settings\n Puppet[:parser] = 'future' # this is required in order to work with puppet 3.8\n Puppet[:trusted_node_data] = true\n rescue ArgumentError => e\n\n rescue Puppet::DevError => e\n # do nothing otherwise calling init twice raises an error\n end\n end", "def env=(environment); end", "def env=(environment); end", "def _init_configuration\n\t\t# Set defaults\n\t\t@setup = { \"create\" => false, \"environment\" => false, \"test\" => true, \"destroy\" => false }\n\t\t@config = false\n\tend", "def initialize(prefix, environment, node_ip, graphite_hosts, datacenter, environment_name)\n @prefix = prefix\n @environment = environment\n @node_ip = node_ip\n @graphite_hosts = graphite_hosts\n @datacenter = datacenter\n @environment_name = environment_name\n end", "def initialize\n\t\t@auth = {\n\t\t\t:username=>ENV['impac_username'], \n\t\t\t:password=>ENV['impac_password']\n\t\t}\n\tend", "def init\n return unless run_init? # check here because RemoteState::Fetcher#pull calls init directly\n # default init timeout is pretty generous in case of slow internet to download the provider plugins\n init_timeout = Integer(ENV['TS_INIT_TIMEOUT'] || 600)\n Timeout::timeout(init_timeout) do\n Terraspace::Terraform::Runner.new(\"init\", @options).run if !auto? && @options[:init] != false # will run on @options[:init].nil?\n end\n rescue Timeout::Error\n logger.error \"ERROR: It took too long to run terraform init. Here is the output logs of terraform init:\".color(:red)\n logger.error IO.read(Terraspace::Terraform::Args::Default.terraform_init_log)\n end", "def init!\n # check if configuration file is already created\n unless File.exist?(CONFIG_FILE)\n puts \"=> [PagSeguro] The configuration could not be found at #{CONFIG_FILE.inspect}\"\n return\n end\n \n # The developer mode is enabled? So install it!\n developer_mode_install! if developer?\n end", "def initialize(config={}, &block)\n env = config.delete(:environment)\n self.config = Mash.new\n self.setup(self.defaults(env).merge(config))\n self.use(&block) if block_given?\n end", "def initialize\n # set some defaults\n @has_downloaded_cookbooks = false\n @reboot = false\n @startup_tags = []\n @log_level = Logger::INFO\n @log_file = nil\n\n # replace defaults with state on disk\n load_state\n\n true\n end", "def init\n end", "def init\n end", "def init\n end", "def check_and_set_environment\n check_env\n set_env\n end", "def initialize()\n begin\n puts \"Eis::Runner::init called\" if $DEBUG\n @loaded_modules = []\n generate_module_list()\n handle = InputHandler.new()\n set_environment()\n rescue ArgumentError =>e\n puts \"\\e[31mERROR\\e[0m: No config file given...\" + e\n puts \"--------------------------------------------\"\n raise\n end\n end", "def apply_system_defaults\n if @region.nil? && @zone.nil?\n @region, @zone = Rudy::DEFAULT_REGION, Rudy::DEFAULT_ZONE\n elsif @region.nil?\n @region = @zone.to_s.gsub(/[a-z]$/, '').to_sym\n elsif @zone.nil?\n @zone = \"#{@region}b\".to_sym\n end\n \n @environment ||= Rudy::DEFAULT_ENVIRONMENT\n @role ||= Rudy::DEFAULT_ROLE\n @localhost ||= Rudy.sysinfo.hostname || 'localhost'\n @auto = false if @auto.nil?\n end", "def initialize\n @id = $$\n @hostname = Socket.gethostname\n @name = \"#{@id}@#{@hostname}\"\n @store = AssetStore.new\n @server = CloudCrowd.central_server\n @enabled_actions = CloudCrowd.actions.keys\n log 'started'\n end", "def initialize(env = :development, &block)\n @active_environment = env\n\n Loquacious.env_config = true\n Loquacious.env_prefix = \"AHN\"\n\n Loquacious::Configuration.for :core do\n root nil, :desc => \"Adhearsion application root folder\"\n\n lib \"lib\", :desc => <<-__\n Folder to include the own libraries to be used. Adhearsion loads any ruby file\n located into this folder during the bootstrap process. Set to nil if you do not\n want these files to be loaded. This folder is relative to the application root folder.\n __\n\n process_name \"ahn\", :desc => <<-__\n Adhearsion process name, useful to make it easier to find in the process list\n Pro tip: set this to your application's name and you can do \"killall myapp\"\n Does not work under JRuby.\n __\n\n event_threads 5, transform: Proc.new { |v| Adhearsion::Configuration.validate_number v }, desc: <<-__\n The number of threads to include in the event worker pool.\"\n __\n\n desc \"Log configuration\"\n logging {\n level :info, :transform => Proc.new { |v| v.to_sym }, :desc => <<-__\n Supported levels (in increasing severity) -- :trace < :debug < :info < :warn < :error < :fatal\n __\n formatter nil, :desc => <<-__\n A log formatter to apply to the stream. If nil, the Adhearsion default formatter will be used.\n __\n }\n\n type :xmpp , :transform => Proc.new { |v| v.to_sym }, :desc => <<-__\n Platform used to connect to the Telephony provider. Currently supported values:\n - :xmpp\n - :asterisk\n __\n username \"usera@127.0.0.1\", :desc => \"Authentication credentials\"\n password \"1\" , :desc => \"Authentication credentials\"\n host nil , :desc => \"Host to connect to (where rayo/asterisk is located)\"\n port Proc.new { Adhearsion::Configuration.default_port_for_platform type }, :transform => Proc.new { |v| Adhearsion::Configuration.validate_number v }, :desc => \"Port used to connect\"\n certs_directory nil , :desc => \"Directory containing certificates for securing the connection.\"\n root_domain nil , :desc => \"The root domain at which to address the server\"\n connection_timeout 60 , :transform => Proc.new { |v| Adhearsion::Configuration.validate_number v }, :desc => \"The amount of time to wait for a connection\"\n reconnect_attempts 1.0/0.0 , :transform => Proc.new { |v| Adhearsion::Configuration.validate_number v }, :desc => \"The number of times to (re)attempt connection to the server\"\n reconnect_timer 5 , :transform => Proc.new { |v| Adhearsion::Configuration.validate_number v }, :desc => \"Delay between connection attempts\"\n\n after_hangup_lifetime 1, :transform => Proc.new { |v| v.to_i }, :desc => <<-__\n Lifetime of a call after it has hung up. Should be set to the minimum functional value for your application. Call actors (threads) living after hangup consume more system resources and reduce the concurrent call capacity of your application.\n __\n\n desc \"Media configuration\"\n media {\n default_voice nil, desc: 'The default voice used for all output. Set nil to use platform default.'\n default_renderer nil, desc: 'The default renderer used for all output. Set nil to use platform default.'\n\n min_confidence 0.5, desc: 'The default minimum confidence level used for all recognizer invocations.', transform: Proc.new { |v| v.to_f }\n timeout 5, desc: 'The default timeout (in seconds) used for all recognizer invocations.', transform: Proc.new { |v| v.to_i }\n inter_digit_timeout 2, desc: 'The timeout used between DTMF digits and to terminate partial invocations', transform: Proc.new { |v| v.to_i }\n recognizer nil, desc: 'The default recognizer used for all input. Set nil to use platform default.'\n input_language 'en-US', desc: 'The default language set on generated grammars. Set nil to use platform default.'\n }\n\n desc \"Internationalisation\"\n i18n {\n locale_path [\"config/locales\"], transform: Proc.new { |v| v.split ':' }, desc: <<-__\n List of directories from which to load locale data, colon-delimited\n __\n audio_path \"app/assets/audio\", desc: <<-__\n Base path from which audio files can be found. May be a filesystem path or some other URL (like HTTP)\n __\n fallback true, desc: <<-__\n Whether to include text for translations that provide both text & audio. True or false.\n __\n }\n\n desc \"HTTP server\"\n http do\n enable true, desc: \"Enable or disable the HTTP server\"\n host \"0.0.0.0\", desc: \"IP to bind the HTTP listener to\"\n port \"8080\", desc: \"Port to bind the HTTP listener to\"\n rackup 'config.ru', desc: 'Path to Rack configuration file (relative to Adhearsion application root)'\n end\n end\n\n Loquacious::Configuration.for :core, &block if block_given?\n\n self\n end", "def build_environment(autoinst)\n environment = {\n \"AYTESTS_FILES_DIR\" => files_dir.to_s,\n \"AYTESTS_PROVIDER\" => provider.to_s,\n \"AYTESTS_WEBSERVER_PORT\" => WEBSERVER_PORT,\n \"AYTESTS_MAC_ADDRESS\" => MAC_ADDRESS\n }\n linuxrc_file = autoinst.sub_ext(\".linuxrc\")\n environment[\"AYTESTS_LINUXRC\"] = File.read(linuxrc_file).chomp if linuxrc_file.exist?\n environment\n end", "def initialize(params={})\n @logger = Logger.new(STDOUT)\n establish_main_container(params)\n if main?\n @ams = AgentManagementSystem.new(\n :addresses => agent_transport_addresses,\n :logger => logger\n )\n @df = DirectoryFacilitator.new(\n :logger => logger\n )\n @acc = AgentCommunicationChannel.new(\n :logger => logger,\n :ams => ams\n )\n else\n logger.debug \"Obtaining reference to main container AMS...\"\n @ams = main_container.ams\n logger.debug \"Done obtaining reference to main container AMS.\"\n logger.debug \"Obtaining reference to main container DF...\"\n @df = main_container.df # FIXME: broken as of JRuby 0.9.8: see http://jira.codehaus.org/browse/JRUBY-572\n logger.debug \"Done obtaining reference to main container DF.\"\n logger.debug \"Obtaining reference to main container ACC...\"\n @acc = main_container.acc\n logger.debug \"Done obtaining reference to main container ACC.\"\n end\n @config = params[:config] || \"rage.yaml\"\n end", "def setup_env()\n puts\n puts 'Setting up your environment. This should only take a minute.'\n puts\n # This uri is the one for robots to grab the catalog, if you want to download it yourself it is\n # https://www.gutenberg.org/cache/epub/feeds/rdf-files.tar.zip\n catalog_uri = 'http://gutenberg.pglaf.org/cache/generated/feeds/rdf-files.tar.zip'\n start = Time.now\n system(\"wget -w 2 -m -H #{catalog_uri} -nH -nd\") \n system(\"gunzip < rdf-files.tar.zip | tar xf -\")\n Dir.chdir(@base_dir) do\n# The files need some cleanup to work properly with the rdf gem. If they don't have a title, they won't parse and the script will choke. Run this from base_dir if you aren't using automated setup:\n# grep -rLZ \":title\" . | while IFS= read -rd '' x; do rm -f \"$x\"; done\n# Then run this to make sure it comes back clean:\n# grep -rLZ \":title\" . | while IFS= read -rd '' x; do echo \"$x\"; done\n# The problem is caused by books that were removed. They give a 404 error if you try to find them manually, but are still listed in the catalog since the catalog is auto-generated by crawling their own site.\n # Ruby defaults to using /bin/sh but I specifically want to run this in the bash shell so that read has the -d option\n system(\"bash\", \"-c\", \"grep -rLZ \\\":title\\\" . | while IFS= read -rd \\'\\' x; do rm -f \\\"$x\\\"; done\")\n end\n end_time = Time.now\n ttr = end_time-start\n print 'Time to set up catalog: ' if @verbose\n puts ttr if @verbose\nend", "def bootstrap!\n reset!\n require_relative 'kernel'\n end", "def initialize\n # Load the setup settings and any user overrides.\n @settings = Configuration::CombinedConfiguration.new\n @settings.load_configuration('default', 'Configuration/setup.yaml')\n @settings.load_configuration('user', 'Configuration/user.yaml')\n\n @ruby_bin = RbConfig::CONFIG['bindir']\n @install_flag = \".bundle/#{RUBY_VERSION}_#{ruby_platform}.flag\"\n\n # The timestamp values - the installer is run depending on these values.\n @t1 = UserSettings.last_modify_date.to_i\n @t2 = File.mtime('Gemfile').to_i\n\n @gem_path = File.join(@settings['setup.gem_path'], ruby_platform)\n @mysql_dir = File.join(FRAMEWORK_ROOT, \"#{LIB_DIR}/mysql/#{ruby_platform}\")\n\n runtime.save(:ruby_bin, @ruby_bin)\n runtime.save(:gem_path, @gem_path)\n runtime.save(:mysql_dir, @mysql_dir)\n runtime.save(:setup_settings, @settings)\n end", "def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, params={})\n init({ :name => 'ACW',\n :default_host => ENV['ACW_URL'] ? URI.parse(ENV['ACW_URL']).host : DEFAULT_HOST,\n :default_port => ENV['ACW_URL'] ? URI.parse(ENV['ACW_URL']).port : DEFAULT_PORT,\n :default_service => ENV['ACW_URL'] ? URI.parse(ENV['ACW_URL']).path : DEFAULT_PATH,\n :default_protocol => ENV['ACW_URL'] ? URI.parse(ENV['ACW_URL']).scheme : DEFAULT_PROTOCOL,\n :default_api_version => ENV['ACW_API_VERSION'] || API_VERSION },\n aws_access_key_id || ENV['AWS_ACCESS_KEY_ID'] ,\n aws_secret_access_key|| ENV['AWS_SECRET_ACCESS_KEY'],\n params)\n end", "def run_init\n run(\n result:\n ::Kitchen::Terraform::Client::Command\n .init(\n options:\n ::Kitchen::Terraform::Client::Options\n .new\n .disable_input\n .enable_lock\n .lock_timeout(duration: config_lock_timeout)\n .maybe_no_color(toggle: !config_color)\n .upgrade\n .from_module(source: config_directory)\n .enable_backend\n .force_copy\n .backend_configs(keys_and_values: config_backend_configurations)\n .enable_get\n .maybe_plugin_dir(path: config_plugin_directory)\n .verify_plugins(toggle: config_verify_plugins),\n working_directory: instance_directory\n )\n )\n end", "def setup!\n configuration = RfmAdaptor::Configuration.new(:database)\n database = configuration.__send__(self.database_name)\n raise \"Database: #{self.database_name} configuration file not exists.\" if database.blank?\n raise \"Database: #{self.database_name} environment[#{self.env}] not exists.\" if database[self.env].blank?\n self.attributes = database[self.env]\n self.setup_state = true\n end", "def initialize(environment_name = \"default\", options = {})\n merge_config! options\n @environment_name = environment_name\n @shell_wrapper = Shell.default_wrapper.new\n @shell_wrapper.setup do |s|\n source_rvm_environment\n use_rvm_environment\n end\n end", "def at_init\n\n\t\tend", "def setup_context\n self['console'] = Console.new\n load RUNTIME_PATH\n\n opal = self['opal']\n opal['loader'] = Loader.new opal, self\n opal['fs'] = FileSystem.new opal, self\n opal['platform']['engine'] = 'opal-gem'\n\n # eval \"opal.require('core');\", \"(opal)\"\n require_file 'core'\n end", "def default_environment; end", "def init!\n # check if configuration file is already created\n puts \"=> [MoIP] Sandbox mode enabled\" if sandbox?\n unless File.exist?(CONFIG_FILE)\n puts \"=> [Moip] The configuration could not be found at #{CONFIG_FILE.inspect}\"\n return\n end\n end", "def initialize(env)\n @environment = env\n set_default_options\n end", "def init\n\n end", "def bootstrap!\n reset!\n require_relative 'kernel'\n end", "def initialize_from_env\n conf_prefix = self.env_variable_prefix.upcase\n\n ENV.keys.reject { |key|\n key !~ /^#{conf_prefix}/ # Ignore everything that doesn't match the prefix\n }.each { |key|\n variable = key[conf_prefix.size..-1].downcase\n\n self.store(variable, ENV[key])\n }\n\n after_initialize\n dump\n end", "def init\n fname = path(\"init.rb\")\n load fname unless fname.nil?\n end", "def create_initializer\n create_file 'config/initializers/hyperstack.rb', <<-CODE\n # config/initializers/hyperstack.rb\n # If you are not using ActionCable, see http://hyperstack.orgs/docs/models/configuring-transport/\n Hyperstack.configuration do |config|\n config.transport = :action_cable\n config.prerendering = :off # or :on\n config.cancel_import 'react/react-source-browser' # bring your own React and ReactRouter via Yarn/Webpacker\n config.import 'hyperstack/component/jquery', client_only: true # remove this line if you don't need jquery\n config.import 'hyperstack/hotloader', client_only: true if Rails.env.development?\n end\n\n # useful for debugging\n module Hyperstack\n def self.on_error(operation, err, params, formatted_error_message)\n ::Rails.logger.debug(\n \"\\#{formatted_error_message}\\\\n\\\\n\" +\n Pastel.new.red(\n 'To further investigate you may want to add a debugging '\\\\\n 'breakpoint to the on_error method in config/initializers/hyperstack.rb'\n )\n )\n end\n end if Rails.env.development?\n CODE\n end", "def initialize(env={})\n @env = env\n end", "def default_environment=(env); end", "def env_config; end", "def env_config; end", "def env_config; end", "def env_config; end", "def initialize(config = {})\n init_config(config)\n raise ClientError.new \"Environment Variables must be specified as a hash, not a #{config[:environment].class}\" unless config[:environment].is_a?(Hash)\n end", "def init\n return unless @context.nil?\n\n $stdout.puts('Loading JARs...')\n\n load_jar_files\n\n $stdout.puts(\"Loading #{@dspace_cfg}...\")\n org.dspace.core.ConfigurationManager.load_config(@dspace_cfg)\n\n kernel_impl = org.dspace.servicemanager.DSpaceKernelInit.get_kernel(nil)\n unless kernel_impl.is_running\n $stdout.puts('Starting new DSpaceKernel...')\n kernel_impl.start(@dspace_dir)\n end\n @kernel = kernel_impl\n\n @context = org.dspace.core.Context.new\n end", "def set_env()\n @triggers.each(&:set_env)\n end", "def initialize(apps=nil, env=nil)\n @logger = Log4r::Logger.new(\"acceptance::isolated_environment\")\n\n @apps = apps || {}\n @env = env || {}\n\n # Create a temporary directory for our work\n @tempdir = Tempdir.new(\"vagrant\")\n @logger.info(\"Initialize isolated environment: #{@tempdir.path}\")\n\n # Setup the home and working directories\n @homedir = Pathname.new(File.join(@tempdir.path, \"home\"))\n @workdir = Pathname.new(File.join(@tempdir.path, \"work\"))\n\n @homedir.mkdir\n @workdir.mkdir\n\n # Set the home directory and virtualbox home directory environmental\n # variables so that Vagrant and VirtualBox see the proper paths here.\n @env[\"HOME\"] = @homedir.to_s\n @env[\"VBOX_USER_HOME\"] = @homedir.to_s\n end", "def initialise_environment(environment, pull_drupal_data_image, system_exec)\n environment.initialize_environment\n if pull_drupal_data_image\n puts '- Pulling drupal_data image from Docker Hub...'\n system_exec.execute_docker_compose(environment, :pull, %w(drupal_data));\n puts '- Completed pull of drupal_data image from Docker Hub.'\n end\nend", "def run_init_script; end", "def initialize(*args)\n @env = args.first\n end", "def environment\n Mash.new.tap do |environment|\n environment.update(new_resource.parent_ruby.ruby_environment) if new_resource.parent_ruby\n environment['BUNDLE_GEMFILE'] = new_resource.parent_bundle.gemfile_path if new_resource.parent_bundle\n environment.update(new_resource.environment) if new_resource.environment\n end\n end", "def init_repo\n Repository::Config.new(@repo, @log, @process, @type).status(3) {\n init_cmd = 'codeclimate init'\n init_result = `#{init_cmd}`\n }\n end" ]
[ "0.7116878", "0.7031185", "0.7031185", "0.6388906", "0.63299775", "0.62325126", "0.62183577", "0.6209452", "0.61974424", "0.6189368", "0.61693674", "0.61678666", "0.6166484", "0.6146462", "0.6058754", "0.6000881", "0.59633607", "0.58558", "0.5848517", "0.5842015", "0.5831085", "0.58135116", "0.5808475", "0.5806077", "0.57958895", "0.5781545", "0.5775193", "0.5726762", "0.572666", "0.57240653", "0.5709615", "0.5646214", "0.56141716", "0.56095266", "0.56037736", "0.5603702", "0.5595766", "0.5582846", "0.55802476", "0.55790466", "0.55790466", "0.5574153", "0.55699575", "0.5555472", "0.5555228", "0.55324125", "0.5531469", "0.55208194", "0.5517649", "0.5507635", "0.5507635", "0.55015653", "0.5486904", "0.54702634", "0.5463536", "0.54541725", "0.5450716", "0.54483604", "0.54436475", "0.54436475", "0.54436475", "0.5440196", "0.5434429", "0.54334354", "0.5431093", "0.54211307", "0.54200643", "0.54123485", "0.5407136", "0.5399299", "0.5396937", "0.53907835", "0.5382066", "0.53816974", "0.5381274", "0.53812635", "0.53755414", "0.53745866", "0.5374523", "0.5367221", "0.5362284", "0.5360626", "0.53600514", "0.5358452", "0.5354933", "0.53517085", "0.5343973", "0.5339936", "0.5339936", "0.5339936", "0.5339936", "0.5339377", "0.5333582", "0.53266233", "0.53253984", "0.5319525", "0.53181535", "0.53135806", "0.53117144", "0.53098774" ]
0.6776729
3
Return the fitness of a single genotype
def fitness_one genotype, env: single_env, render: false, nsteps: max_nsteps, aggr_type: :last puts "Evaluating one individual" if debug puts " Loading weights in network" if debug net.deep_reset net.load_weights genotype observation = env.reset # require 'pry'; binding.pry unless observation == env.reset_obs # => check passed, add to tests env.render if render tot_reward = 0 # # set of observations with highest novelty, representative of the ability of the individual # # to obtain novel observations from the environment => hence reaching novel env states # represent_obs = [] puts "IGNORING `nobs_per_ind=#{nobs_per_ind}` (random sampling obs)" if nobs_per_ind represent_obs = observation nobs = 1 puts " Running (max_nsteps: #{max_nsteps})" if debug runtime = nsteps.times do |i| code = compr.encode observation # print code.to_a selected_action = action_for code obs_lst, rew, done, info_lst = env.execute selected_action, skip_frames: skip_frames # puts "#{obs_lst}, #{rew}, #{done}, #{info_lst}" if debug observation = OBS_AGGR[aggr_type].call obs_lst tot_reward += rew ## NOTE: SWAP COMMENTS ON THE FOLLOWING to switch to novelty-based obs selection # # The same observation represents the state both for action selection and for individual novelty # # OPT: most obs will most likely have lower novelty, so place it first # # TODO: I could add here a check if obs is already in represent_obs; in fact # # though the probability is low (sequential markovian fully-observable env) # novelty = compr.novelty observation, code # represent_obs.unshift [observation, novelty] # represent_obs.sort_by! &:last # represent_obs.shift if represent_obs.size > nobs_per_ind # Random sampling for representative obs nobs += 1 represent_obs = observation if rand < 1.0/nobs # Image selection by random sampling env.render if render break i if done end compr.train_set << represent_obs # for novelty: # represent_obs.each { |obs, _nov| compr.train_set << obs } puts "=> Done! fitness: #{tot_reward}" if debug # print tot_reward, ' ' # if debug print "#{tot_reward}(#{runtime}) " tot_reward end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fitness individual\r\n (5 - individual).abs\r\n end", "def fitness\n @fitness ||= (\n outter_bound, inner_bound = @length -2, @length - 1\n (0..outter_bound).inject(0) do |e1, x1|\n y1 = @genes[x1]\n e1 + ((x1+1)..inner_bound).inject(0) do |e2, x2|\n y2 = @genes[x2]\n dx, dy = (x1 - x2).abs, (y1 - y2).abs\n e2 + ((y1 == y2 || dx == dy) ? 1 : 0)\n end\n end\n )\n end", "def fitness\n @population.each(&:fitness)\n end", "def fitness()\n return @fitness if @fitness\n\n raise \"inside fitness even though defined and not nill\" if @fitness\n\n last_token = @data[0]\n cost = 0\n\n @data[1..-1].each do |token|\n cost += @@costs[last_token][token]\n last_token = token\n end\n\n @fitness = -1 * cost\n\n return @fitness.to_f\n end", "def fitness\n if @fitness == 0.0\n @fitness = @fitness_alg.rank(self)\n end\n @fitness\n end", "def fitness(geneID)\n geneScore = 0\n @genePool[geneID].each_index do |i|\n geneScore += @genePool.get(geneID, i) \n end\n geneScore\n end", "def fitness(game)\n totalFitness = 0\n @bestFitness = 0\n @bestGene = 0\n @genePool.each_index do |geneID|\n fitness = game.fitness(geneID)\n @genePool[geneID].fitness = fitness\n if fitness > @bestFitness\n @bestGene = geneID\n @bestFitness = fitness\n end\n totalFitness += @genePool[geneID].fitness\n end\n totalFitness\n end", "def fitness(target)\n score = 0\n @genes.each_with_index do |gene, i|\n score += 1 if target[i] == gene\n end\n score / target.size.to_f\n end", "def fitness(target)\n score = 0\n @genes.each_with_index do |gene, i|\n score += 1 if target[i] == gene\n end\n score / target.size.to_f\n end", "def fitness\n return @fitness if @fitness\n last_token = @data[0]\n cost = 0\n @data[1..-1].each do |token|\n cost += @@costs[last_token][token]\n last_token = token\n end\n @fitness = -1 * cost\n return @fitness\n end", "def fitness\n -(0..5).map{|t| \n $pors_store = 0 # reset store\n t_val = t\n values = {:rec=>proc{$pors_store},:T=>proc{ cv=t_val; t_val=0; cv} } # using T destroys T\n (eval_genes(values) - N*t).abs \n }.sum - 0.1*size # find a tree that multiplies T by 3\n end", "def calc_fitness\n @population.each do |p|\n p.fitness(@target)\n end\n end", "def calc_fitness\n @population.each do |p|\n p.fitness(@target)\n end\n end", "def fitness\n return @fitness if @fitness\n\n consumption_per_cluster = {}\n @data.each_with_index do |v, i|\n consumption_per_cluster[v] ||= 0\n # puts @prosumers[i].id, @real_consumption\n consumption_per_cluster[v] += (@real_consumption[@prosumers[i].id] || 0)\n end\n\n total_penalties_before = @initial_imballance.map do |imballance|\n penalty(imballance)\n end\n\n total_penalties_after = 0\n res = 0;\n\n consumption_per_cluster.each do |cluster, consumption |\n # puts \"DEBUG: #{cluster}, #{consumption}\"\n p = penalty((consumption || 0) - (@targets_per_cluster[cluster] || 0))\n res += 100 * (total_penalties_before[cluster] - p) / total_penalties_before[cluster] if total_penalties_before[cluster] > 0\n end\n\n\n\n\n @fitness = res\n\n end", "def best_chromosome()\n the_best = @population[0]\n @population.each do |chromosome|\n the_best = chromosome if chromosome.fitness > the_best.fitness\n end\n return the_best\n end", "def best_chromosome\n the_best = @population[0]\n @population.each do |chromosome|\n the_best = chromosome if chromosome.fitness > the_best.fitness\n end\n return the_best\n end", "def fitness\n return @fitness if @fitness\n\n cls = (options[:kappa]).times.map { |i| [] }\n @data.each_with_index { |g, i| cls[g].push i}\n\n p_b2 = cls.map { |c| penalty_before(c) }\n p_a2 = cls.map { |c| penalty_after(c) }\n\n impr2 = p_b2.zip(p_a2).map do |b,a|\n b > 0 ? ((b - a)/b) : 0\n end.inject(0,:+)\n\n @fitness = impr2\n end", "def genetic_search(problem, fitness_fn, ngen=1000, pmut=0.0, n=20)\n # \"\"\"Call genetic_algorithm on the appropriate parts of a problem.\n # This requires that the problem has a successor function that generates\n # reasonable states, and that it has a path_cost function that scores states.\n # We use the negative of the path_cost function, because costs are to be\n # minimized, while genetic-algorithm expects a fitness_fn to be maximized.\"\"\"\n #states = [s for (a, s) in problem.successor(problem.initial_state)[:n]]\n states = problem.successor(problem.initial_state)\n random.shuffle(states)\n #fitness_fn = lambda s: - problem.path_cost(0, s, nil, s)\n #fitness_fn = {-problem.path_cost(0, s, nil, s)}\n return genetic_algorithm(states, fitness_fn, ngen, pmut)\nend", "def fitness\n Sequences.inject(0.0) do |fitness, sequence|\n # count matches\n matches = 0\n 0.upto(size - 1) do |index|\n if(self[index] == sequence[0][index])\n matches += 1\n end\n end\n # more is worse\n fitness - (sequence[1] - matches).abs\n end\n end", "def evaluate\n if @force_fitness_recalculation\n @karyotypes.each { |karyotype| update!(karyotype, fitness(karyotype)) }\n else\n @karyotypes.each do |karyotype|\n update!(karyotype, cached_fitness(karyotype)) if karyotype.fitness.nil?\n end\n end\n @karyotypes.sort_by! { |karyotype| - karyotype.fitness }\n end", "def average_fitness\n sum = 0\n @population.each { |p| sum += p.fitness(@target) }\n sum / @population.size\n end", "def average_fitness\n sum = 0\n @population.each { |p| sum += p.fitness(@target) }\n sum / @population.size\n end", "def sample_genome()\r\n\t\t# Randomly select an individual until it is accepted.\r\n\t\t# Individuals are accepted with a probability equal to\r\n\t\t# their fitness divided by the maximum fitness of the population.\r\n\t\tx = @population.sample\r\n\r\n\t\t# In the highly unlikely event that an entire generation goes by\r\n\t\t# without a single agent increasing its fitness from zero, we will\r\n\t\t# divide by 1.\r\n\t\tuntil rand(0..1) <= (x.fitness / (@best_fitness.zero? ? 1 : @best_fitness))\r\n\t\t\tx = @population.sample\r\n\t\tend\r\n\t\tx\r\n\tend", "def calc_fitness\n self.join.to_i(2)\n end", "def highest_fitness(sample_group)\n best_fitness = 0\n best_person = nil\n sample_group.each do |person|\n if person.get_energy_level > best_fitness\n best_person = person\n best_fitness = person.get_energy_level\n end\n end\n best_person\n end", "def fitness\n fitness = 0\n weight = 0\n for i in 0..@conf.size - 1\n if @conf[i] == 1\n fitness += @problem.prices[i]\n weight += @problem.weights[i]\n end\n \n if weight > @problem.M\n return -1\n end\n end\n \n return fitness\n end", "def fitness\n 0 - length_penalty - spelling_penalty\n end", "def analyze_for_fitness!(critter)\n fitvec = @crit_hist[critter].map{|seq, vio| @controller.fitness_func_hook(vio[0], vio[1], seq) }\n # Average the fitness vector to get a scalar fitness.\n critter.fitness = unless @controller.cost_func_none?\n @controller.cost_func_hook(fitvec, critter.genotype.fitness_cost)\n else\n fitvec.reduce {|a,r| a+r} / fitvec.size.to_f + critter.genotype.fitness_cost\n end\n log.debug \"Fitness Vector: #{fitvec}, fitness of #{critter.fitness} assigned to #{critter}\"\n end", "def calcFitness(sgenome)\r\n \r\n calcWeightAndValue(sgenome)\r\n\r\n if (@sum_weight > @max_weight)\r\n # penalize overweight solutions \r\n @sum_value - (@penalty * (@sum_weight - @max_weight))\r\n else \r\n @sum_value\r\n end\r\n\r\n end", "def fitness_calc(genome_size, selection_coefficient)\n\t\tfitnesses = Array.new(genome_size) {0}\n\t\trunning_fitness = 1\n\t\t(0...genome_size).each do |i|\n\t\t\tfitnesses[i] = running_fitness\n\t\t\trunning_fitness *=(1-selection_coefficient)\n\t\tend\n\t\tfitnesses\n\tend", "def calculate_stats()\r\n\t\t# Best\r\n\t\t@fittest_genome = @population.max\r\n\t\t@best_fitness = @fittest_genome.fitness\r\n\t\t# Worst\r\n\t\t@worst_fitness = @population.min.fitness\r\n\t\t# Total\r\n\t\t@total_fitness = @population.inject(0){|sum, g| sum + g.fitness}\r\n\t\t# Average\r\n\t\t@average_fitness = @total_fitness / @pop_size\r\n\tend", "def report_best_fit\n best_critter.phenotype.code\n end", "def fitness_one genotype, env: single_env, render: false, nsteps: max_nsteps\n puts \"Evaluating one individual\" if debug\n puts \" Loading weights in network\" if debug\n net.deep_reset # <= this becomes necessary as we change net struct during training\n net.load_weights genotype\n observation = env.reset\n env.render if render\n tot_reward = 0\n puts \" Running (max_nsteps: #{max_nsteps})\" if debug\n nsteps.times do |i|\n\n\n # TODO: refactor based on `atari_ulerl`\n raise \"Update this from ulerl\"\n # execute once, execute skip, unshift result, convert all\n # need to pass also some of the helper functions in this class\n\n\n selected_action, normobs, novelty = action_for observation\n # observation, reward, done, info = env.step(selected_action).to_a\n observations, rewards, dones, infos = skip_frames.times.map do\n SKIP_TYPE[skip_type].call(selected_action, env).to_a\n end.transpose\n # NOTE: this below blurs the observation. An alternative is to isolate what changes.\n observation = observations.reduce(:+) / observations.size\n reward = rewards.reduce :+\n done = dones.any?\n\n tot_reward += reward\n env.render if render\n break if done\n end\n puts \"=> Done, fitness: #{tot_reward}\" if debug\n tot_reward\n end", "def average_fitness\n total_fitness = 0\n @all_persons.each do |person|\n total_fitness += person.get_energy_level\n end\n if @all_persons.empty?\n return 0\n else\n total_fitness / @total_people\n end\n end", "def fittest\n @population[0]\n end", "def calculate_fitness\n return 'done' if @dna == @target_dna\n fit_arr = []\n @target_dna.each_with_index do |e, i|\n fit_arr.push((@dna[i] - e).abs)\n end\n (1 / fit_arr.inject(:+).to_f) * 100\n end", "def evaluate_chromosome(chromosome)\n @num_evaluations += 1\n chromosome.fitness = @selected_func.call chromosome\n end", "def fitness_params\n params.fetch(:fitness, {})\n end", "def fitness(matches)\n max_match = matches[0]\n matches.each do |match|\n if max_match[2] < match[2]\n max_match = match\n end\n end\n return max_match\n end", "def solve(func)\n # setup population\n if @start_population.nil?\n population = Array.new(@population_size) do\n # generate random genotype according to the chromosome type\n { :genotype => @genotype_space.get_random }\n end\n else\n population = @start_population.map do |x|\n { :genotype => x }\n end\n end\n\n # initialize variables\n gen = 0\n overall_best = nil\n\n population_mutex = Mutex.new\n\n # default behavior is to loop forever\n begin\n gen += 1\n @logger.info(\"GA - Starting generation #{gen}\") if @logger\n\n # create latch to control program termination\n latch = Concurrent::CountDownLatch.new(@population_size)\n\n # assess fitness for every member of the population\n population.each do |s|\n @pool.post do\n # do we need to syncronize this call through population_mutex?\n # probably not.\n ret = func.call(s[:genotype])\n\n # protect write access to population struct using mutex\n population_mutex.synchronize do\n s[:fitness] = ret\n end\n\n # update latch\n latch.count_down\n end\n end\n\n # wait for all the threads to terminate\n latch.wait\n\n # find fittest member\n population_best = population.max_by {|x| x[:fitness] }\n\n # calculate overall best\n if overall_best.nil?\n overall_best = population_best\n else\n overall_best = [ overall_best, population_best ].max_by {|x| x[:fitness] }\n end\n\n # print results\n puts \"> gen #{gen}, best: #{overall_best[:genotype]}, #{overall_best[:fitness]}\" unless @quiet\n\n # execute controller\n @controller.call(self, overall_best) if @controller\n\n # selection by binary tournament\n children = new_generation(population)\n\n # update population and generation number\n population = children\n end while @exit_condition.nil? or !@exit_condition.call(gen, overall_best)\n\n # return best sample\n overall_best\n end", "def gen_fit_fn type, ntrials: nil\n type ||= :parallel\n case type\n # SEQUENTIAL ON SINGLE ENVIRONMENT\n # => to catch problems with `Parallel` env spawning\n when :sequential_single\n -> (genotypes) { genotypes.map &method(:fitness_one) }\n # SEQUENTIAL ON MULTIPLE ENVIRONMENTS\n # => to catch problems in multiple env spawning avoiding `Parallel`\n when :sequential_multi\n -> (genotypes) do\n genotypes.zip(parall_envs).map do |genotype, env|\n fitness_one genotype, env: env\n end.to_na\n end\n # PARALLEL ON MULTIPLE ENVIRONMENTS\n # => because why not\n when :parallel\n nprocs = Parallel.processor_count - 1 # it's actually faster this way\n -> (genotypes) do\n Parallel.map(0...genotypes.shape.first, in_processes: nprocs) do |i|\n fitness_one genotypes[i,true], env: parall_envs[i]\n end.to_na\n end\n else raise ArgumentError, \"Unrecognized fit type: `#{type}`\"\n end\n end", "def sort_by_fitness\n sort_by { |individual| individual.fitness }\n end", "def get_public_genotype\n if self.marker.class.to_s == \"Snp\"\n return self.genotype_allele\n else\n return self.size\n end\n end", "def report_fitness_species\n {\n best: nil,\n worst: nil,\n }\n end", "def test_population_fitness(population)\n\tpopulation.map.with_index {|net, i| [test_fitness(net), i]}\nend", "def run\n generate_initial_population #Generate initial population\n\n @max_generation.times do |i|\n\n message = \"Generation: #{i}, best fitness: #{@population[0].fitness}\"\n @options[:stats][:gen] ||= []\n @options[:stats][:gen][i] = {\n fitness: @population[0].fitness,\n time: Time.now - @options[:stats][:start_run]\n }\n puts message\n unless @options[:rb_channel].nil?\n @options[:rb_channel].publish({data: message, event: 'output'}.to_json)\n end\n\n selected_to_breed = selection #Evaluates current population\n offsprings = reproduction selected_to_breed #Generate the population for this new generation\n replace_worst_ranked offsprings\n end\n return best_chromosome\n end", "def select_fittest\n @children.max{ |this,that| this.fitness <=> that.fitness }\n end", "def matching_fitness(self_survey, user_survey)\n fitness = 0\n if self_survey.sociality == user_survey.sociality then fitness += 1 end\n if self_survey.familiarity == user_survey.familiarity then fitness += 1 end\n if self_survey.awaken == user_survey.awaken then fitness += 1 end\n if self_survey.smoke == user_survey.smoke then fitness += 1 end\n if self_survey.game == user_survey.game then fitness += 1 end\n if self_survey.waketime == user_survey.waketime then fitness += 1 end\n return fitness\n end", "def best\n @population && @population.first\n end", "def run(population_size, crossover_prop, mutation_prop)\r\n @crossover_prop = crossover_prop\r\n @mutation_prop = mutation_prop\r\n generate_population population_size \r\n \r\n iteration = 0\r\n while(yield(@best_fitness, iteration))\r\n new_population = selection\r\n i = 0\r\n while i < new_population.size \r\n gen1 = new_population[i]\r\n gen2 = new_population[i+1]\r\n gen1, gen2 = crossover gen1, gen2\r\n new_population[i] = mutate gen1\r\n new_population[i+1] = mutate gen2\r\n i = i+2\r\n end\r\n @population = new_population\r\n update_fitness_vector\r\n iteration+=1\r\n\r\n max = @fitness_vector.max\r\n if max > @best_fitness\r\n @best_fitness = max\r\n @best_gen = @population[@fitness_vector.index(max)]\r\n end\r\n puts max\r\n \r\n end\r\n\r\n return @best_gen, @best_fitness\r\n end", "def fitness(s,val,wt,cap)\n v = 0\n w = 0\n for i in 0..s.length-1\n mult = s[i..i].to_i\n w += mult * wt[i]\n if w > cap\n return 0\n end\n v += mult * val[i]\n end\n return v\nend", "def group_fitness\n unless @all_persons.empty?\n @all_persons.each do |person|\n puts \"#{person}: #{person.get_energy_level}\"\n end\n end\n end", "def evaluate_fitness(list)\n list.inject(0) { |fitness, team| fitness + team.satisfaction }\n end", "def selection\n dist = PRNG.rand * fitness.sum\n\n population.each do |script|\n dist -= script.fitness\n return script if dist <= 0\n end\n end", "def objective_function(vector)\r\n return vector.inject(0.0) {|sum, x| sum + (x ** 2.0)} # Calculates fitness value. sums up vector[0]^2 + vector[1]^2 and that's the fitness\r\nend", "def write_best_fitness(output_file)\n open(output_file, 'a') { |f|\n if !@all_persons.empty?\n f.puts \"#{@generation} #{highest_fitness(@all_persons).get_energy_level}\\n\"\n else\n f.puts \"#{@generation} 0\\n\"\n end\n }\n end", "def calcFitness(game_sim)\r\n\t\t@heuristic[0] = game_sim.snek.weights[0]*game_sim.distance_from_food\r\n\t\t@heuristic[1] = game_sim.snek.weights[1]*game_sim.squareness\r\n\t\t@heuristic[2] = game_sim.snek.weights[2]*game_sim.compactness\r\n\t\t@heuristic[3] = game_sim.snek.weights[3]*game_sim.score\r\n\t\t@heuristic[4] = game_sim.snek.weights[4]*game_sim.connectivity\r\n\t\t@heuristic[5] = game_sim.snek.weights[5]*game_sim.dead_end\r\n\t\treturn @heuristic.sum # sum of heuristics = fitness\r\n\tend", "def to_s(); \"#<#{self.class}: fitness=#@fitness, position=#@position>\";end", "def new_generation\n # Incrementiamo il contatore di generazioni, per motivi di\n # studio e statistica, e poi generiamo una roulette propor-\n # zionale al fitness. \n # NOTA: non si può chiamare new_generation se non è stato\n # prima eseguito un test sul fitness.\n @current_generation += 1\n roulette = Roulette.new(@fitness_pool)\n \n # Ottenuta la roulette possiamo farla girare in modo da\n # estrarre coppie di cromosomi da riprodurre\n # Il loop viene eseguito popolazione / 2 volte perché ogni\n # accoppiamento produce due figli.\n # Esistono versioni alternative che da ogni accoppiamento\n # fanno nascere un solo figlio. \n new_population = []\n (@population.size / 2).times do\n mother = @population[roulette.extract]\n father = @population[roulette.extract]\n \n # Inseriamo i figli nella nuova popolazione\n Chromosome.mated_pair(mother, father).each do |chromosome|\n new_population << chromosome\n end\n end\n \n # Il vecchio lascia il posto al nuovo - è la legge della vita\n @population = new_population\n end", "def update_fitness(goal=nil)\n if goal\n @fitness += goal.value\n @goals_reached += 1\n end\n # Slowly die.\n slowly_die\n # Return updated fitness.\n @fitness\n end", "def report_worst_fit\n worst_critter.phenotype.code\n end", "def compute_best\n best = @population.max_by { |x| x.fitness(@target) }\n @finished = true if best.fitness(@target) == @perfect_score\n best.phrase\n end", "def compute_best\n best = @population.max_by { |x| x.fitness(@target) }\n @finished = true if best.fitness(@target) == @perfect_score\n best.phrase\n end", "def fitness\n if dog_count == 0 || cat_count == 0 || mouse_count == 0\n return 0;\n end\n count_error = (100 - total_count).abs\n amount_error = (100 - total_cost).abs\n if count_error > 50 || amount_error > 50\n return 0\n else\n return 100 - (count_error + amount_error) \n end\n end", "def fitness_question2(fitness_answer2)\n if fitness_answer2 == \"I work really hard and sweat A LOT.\"\n @fitness_score2 = 0\n elsif fitness_answer2 == \"I work pretty hard but take a lot of breaks.\"\n @fitness_score2 = 1\n elsif fitness_answer2 == \"I don't sweat.\"\n @fitness_score2 = 2\n end\n @fitness_score2\nend", "def get_feature_value_genuine(feature_id) get_feature_value(feature_id).value_genuine end", "def fitness(vals)\n begin\n IterativeLearning::FunctionLearning.sum_of_error(self.target_values, vals)\n rescue StandardError\n condition.fitness(vals)\n end\n end", "def select_next_generation\n if @is_high_fit\n # sort in decreasing order by fitness values\n @chromosomes.sort! do |left_chrom, right_chrom|\n right_chrom.fitness <=> left_chrom.fitness\n end\n else\n # sort in increasing order of fitness values\n @chromosomes.sort! do |left_chrom, right_chrom|\n left_chrom.fitness <=> right_chrom.fitness\n end\n end\n @chromosomes.slice!(@pop_size..@chromosomes.size)\n end", "def set_fitness\n @fitness = Fitness.find(params[:id])\n end", "def search(population_size: 20, maximum_number_of_generations: 100, number_of_mutation_sites: 2, crossover_probability: 0.95, mutation_probability: 0.05)\n\n population_size = population_size.to_i unless population_size.kind_of?(Integer)\n maximum_number_of_generations = maximum_number_of_generations.to_i unless maximum_number_of_generations.kind_of?(Integer)\n # number_of_mutation_sites = BigDecimal(number_of_mutation_sites.to_s) unless number_of_mutation_sites.kind_of?(BigDecimal)\n # crossover_probability = BigDecimal(crossover_probability.to_s) unless crossover_probability.kind_of?(BigDecimal)\n # mutation_probability = BigDecimal(mutation_probability.to_s) unless mutation_probability.kind_of?(BigDecimal)\n number_of_mutation_sites = number_of_mutation_sites.to_i unless number_of_mutation_sites.kind_of?(Integer)\n crossover_probability = crossover_probability.to_f unless crossover_probability.kind_of?(Float)\n mutation_probability = mutation_probability.to_f unless mutation_probability.kind_of?(Float) \n\n initialize_population(population_size)\n\n maximum_number_of_generations.times do |generation_index|\n\n @population_copy = deep_clone_population\n\n population_size.times do |individual_index|\n\n # if bigdecimal_rand < crossover_probability\n if rand < crossover_probability\n\n # Crossover pair:\n crossover_pair_1_index = generate_random_index(population_size)\n crossover_pair_2_index = generate_random_index(population_size) \n\n crossover(crossover_pair_1_index, crossover_pair_2_index)\n\n end\n\n # if bigdecimal_rand < mutation_probability\n if rand < mutation_probability\n\n mutation_individual_index = generate_random_index(population_size)\n\n mutate(mutation_individual_index, number_of_mutation_sites)\n\n end\n\n end\n\n end\n\n objective_function_value = @population_fitness.send(@objective_method_name)\n decision_variable_values = @population[@population_fitness.index(objective_function_value)]\n\n { best_decision_variable_values: decision_variable_values, best_objective_function_value: objective_function_value }\n\n end", "def max_population\n @store[:population].max\n end", "def selection()\n acum_fitness = 0\n\n fitness_range = get_fitness_range(@population)\n\n if fitness_range.max - fitness_range.min > 0\n @population.each do |chromosome| \n acum_fitness += chromosome.get_normalized_fitness(fitness_range)\n end\n end\n\n # selected_to_breed\n @breed_count.times.map { select_random_individual(acum_fitness, fitness_range) }\n end", "def init_population\n (0...@pop_size).each do\n chromosome = Chromosome.new\n (0...@num_genes).each do\n gene = rand 0..1\n chromosome << gene\n end\n evaluate_chromosome chromosome\n compare_func = @is_high_fit ? :> : :<\n if @best_fit.nil? ||\n chromosome.fitness.public_send(compare_func, @best_fit)\n @best_fit = chromosome.fitness\n end\n @chromosomes << chromosome\n end\n end", "def binary_tournament(pop)\n i, j = rand(pop.size), rand(pop.size)\n j = rand(pop.size) while j==i\n return (pop[i][:fitness] > pop[j][:fitness]) ? pop[i] : pop[j]\nend", "def get_genus_species(genus_option, self_option)\n # see Protonym\n true\n end", "def geomean x\n sum = 0.0\n x.each{ |v| sum += Math.log(v) }\n sum /= x.size\n Math.exp sum\n end", "def run\n generate_initial_population() #Generate initial population \n\n (1..@max_generation).each do |generation_number|\n puts \"\\nGeneration #{generation_number}\"\n\n fitness_range = get_fitness_range(@population)\n\n next if fitness_range.max == fitness_range.min\n\n @population.sort!()\n\n selected_to_breed = selection() # Evaluates current population \n\n offsprings = reproduction(selected_to_breed) # Generate the population for this new generation\n\n replace_worst_ranked(offsprings)\n\n puts to_s()\n\n mutate()\n\n increment_age()\n end\n\n #return best_chromosome()\n return @population.sort { |a, b| b.fitness <=> a.fitness}\n end", "def fitness_question1(fitness_answer1)\n if fitness_answer1 == \"3 or more times per week\"\n @fitness_score1 = 0\n elsif fitness_answer1 == \"1 - 2 times per week\"\n @fitness_score1 = 1\n elsif fitness_answer1 == \"never\"\n @fitness_score1 = 2\n end\n @fitness_score1\nend", "def show_ind which=:best, until_end: false\n ind = case which\n when :best then opt.best.last\n when :mean then opt.mu\n when NArray then which\n else raise ArgumentError, \"Which should I show? `#{which}`\"\n end\n nsteps = until_end ? max_nsteps*1000 : max_nsteps\n print \"Re-running best individual \"\n fit = fitness_one ind, render: true, nsteps: nsteps\n puts \"-- fitness: #{fit}\"\n end", "def genus\n family = a2\n if family\n @sentences << \"#{name_clause} is a genus of #{a1} in the family #{family}.\"\n else\n @sentences << \"#{name_clause} is a family of #{a1}.\"\n end\n # We may have a few genera that don't have a family in their ancestry. In those cases, shorten the taxonomy sentence:\n # [name clause] is a genus in the [A1]\n end", "def getG\r\n return @g\r\n end", "def create_fitness(options={})\n options = {\n access_token: options[:access_token],\n fitness: {\n timestamp: options[:timestamp],\n primary_type: options[:primary_type],\n intensity: options[:intensity],\n start_time: options[:start_time],\n total_distance: options[:total_distance],\n duration: options[:duration],\n source: options[:source]\n }\n }\n\n response = post(\"/#{Validic.api_version}/fitness.json\", options)\n response if response\n end", "def create_fitness(options={})\n options = {\n access_token: options[:access_token],\n fitness: {\n timestamp: options[:timestamp],\n primary_type: options[:primary_type],\n intensity: options[:intensity],\n start_time: options[:start_time],\n total_distance: options[:total_distance],\n duration: options[:duration],\n source: options[:source]\n }\n }\n\n response = post(\"/#{Validic.api_version}/fitness.json\", options)\n response if response\n end", "def evaluate_chromosome(chromosome)\n @num_evaluations += 1\n chromosome.fitness = @knapsack_func.call chromosome, @values, @weights, @max_weight\n end", "def evaluate_chromosome(chromosome)\n @num_evaluations += 1\n chromosome.fitness = @knapsack_func.call chromosome, @values, @weights, @max_weight\n end", "def get_generation(n)\n\t\treturn @generations[n]\n\tend", "def execute\n @generation = 0\n output_hash = { best_fit: nil, gen_of_best_fit: 0, func_evals_of_best_fit: 0,\n relative_error: nil, optimal_func_val: nil }\n begin\n init_population\n p 'population initialized'\n select_taguchi_array\n p \"the selected taguchi array is L#{@taguchi_array.size}\"\n while @generation < @max_generation\n selected_indexes = roulette_select\n cross_individuals selected_indexes\n generate_offspring_by_taguchi_method\n mutate_individuals\n select_next_generation\n if (@generation % 50).zero?\n p \"Generation: #{@generation}- Fitness: #{@chromosomes.first.fitness}\"\n end\n update_output_hash output_hash\n break if has_stopping_criterion_been_met? output_hash[:best_fit]\n @generation += 1\n end\n relative_error = (((output_hash[:best_fit] + 1) / (@optimal_func_val + 1)) - 1).abs\n output_hash[:relative_error] = relative_error\n output_hash[:optimal_func_val] = @optimal_func_val\n rescue StandardError => e\n p e.message\n p e.backtrace.inspect\n end\n p output_hash\n output_hash\n end", "def search(threshold)\r\n until @population.contains_an_individual_with_fitness_as_good_as?(threshold)\r\n # DEBUG CODE\r\n puts \"Reproducing... #{@population.size}\"\r\n new_population = @population.class.new\r\n (@population.size/2).times do\r\n x = @population.random_selection\r\n y = @population.random_selection\r\n children = @population.first.class.reproduce(x, y)\r\n children.each do |child|\r\n child.mutate if rand() <= mutation_rate\r\n end\r\n children.each {|child| new_population.push(child)}\r\n end\r\n @population = new_population\r\n end\r\n return @population.best_individual\r\n end", "def run\n calculate_ideal_subject_distribution\n\n #p \"population size >>>>>> \" + @population_size.to_s\n #p \"max generations >>>>>> \" + @max_generation.to_s\n\n result = {}\n best_chromosomes = []\n generate_initial_population #Generate initial population \n @max_generation.times do |g|\n\n selected_to_breed = selection #Evaluates current population \n\n offsprings = reproduction selected_to_breed #Generate the population for this new generation\n\n replace_worst_ranked offsprings\n\n #Sort the chromosomes again by fitness after offsprings\n #being merged\n @population.sort! { |a, b| b.fitness <=> a.fitness}\n\n # fs = @population.collect {|x| x.fitness }\n # File.open(\"fitnesses.txt\", \"a\") do |f|\n # f.puts \"generation (#{fs.size}) #{g.to_s} = \" + fs.join(\", \")\n # end\n\n best_chromosomes << @population[0]\n end\n result[:chromosomes] = best_chromosomes\n result[:population_size] = @population_size\n result[:generations] = @max_generation\n return result\n end", "def write_average_fitness(output_file)\n open(output_file, 'a') { |f|\n f.puts \"#{@generation} #{average_fitness}\\n\"\n }\n end", "def get_IG()\n return (get_AIBC(1) / Experimento.new(nil, @glucosa, @glucosa).get_AIBC(1)) * 100\n end", "def fitness_count\n find_user.activities.where(category: \"Health & Fitness\").where(accomplished: true).count\n end", "def calculate_fitness(graph)\n distances = 0\n @chromossome.each_with_index do |citie, current|\n break if current + 1 >= size\n other_ind = @chromossome[current + 1]\n distances += graph.vertices[citie][other_ind]\n end\n @fitness = distances\n end", "def population\n @populations.first\n end", "def compete(population,size=5)\n\t\t#fight to the death\n\t\tcompetition = Population.new(size,false)\n\t\tsize.times do \n\t\t\tcompetition.addMember(population.getRandomMember())\n\t\tend\n\t\treturn competition.getFittest\n\tend", "def get_generation\n @generation\n end", "def check_fitness\r\n\t\tcourse = Course.find_by(courseID: courseID)\r\n\t\treturn course.intensity > 0\r\n\tend", "def genes()\n puts 'vcf_life gene'\n return nil if @data[:info].blank?\n return nil if @data[:info][:ann].blank?\n #return nil if @data[:info][:hgvs].blank?\n VcfTools.get_genes_from_ann( @data[:info][:ann] )\n end", "def treasure_prob\n return $data_enemies[@enemy_id].treasure_prob\n end", "def binary_tournament(population)\n i = rand(population.size)\n j = rand(population.size - 1)\n j += 1 if j >= i\n\n select_fittest(population[i], population[j])\n end" ]
[ "0.7668033", "0.7638386", "0.7604713", "0.7116792", "0.708517", "0.69775146", "0.68600476", "0.683236", "0.683236", "0.6810001", "0.6671243", "0.66366965", "0.66366965", "0.656321", "0.64838034", "0.6465341", "0.64458907", "0.63760954", "0.62340516", "0.6218323", "0.6193037", "0.6193037", "0.616264", "0.61455077", "0.6112831", "0.6093497", "0.5981755", "0.5967202", "0.5919076", "0.59085155", "0.5895884", "0.58839715", "0.58705366", "0.58649665", "0.58169574", "0.5810409", "0.58055234", "0.57996875", "0.5760337", "0.57431054", "0.57411635", "0.573974", "0.5713746", "0.5695263", "0.568519", "0.5627308", "0.55947727", "0.5588986", "0.5567094", "0.554482", "0.5524782", "0.54956204", "0.5463099", "0.54624593", "0.5448415", "0.5435519", "0.5428987", "0.5426405", "0.53786147", "0.53632766", "0.53506804", "0.53475547", "0.53475547", "0.5319494", "0.5315308", "0.5307514", "0.5243597", "0.52306765", "0.5217687", "0.5207497", "0.5179292", "0.5177491", "0.5147692", "0.5126263", "0.508787", "0.5085363", "0.50717306", "0.502076", "0.5020268", "0.5015095", "0.49906647", "0.49835786", "0.49835786", "0.49777701", "0.49777701", "0.49767694", "0.4970928", "0.4967076", "0.496097", "0.49591416", "0.4954182", "0.495036", "0.4930296", "0.49285784", "0.4889286", "0.48872346", "0.48844072", "0.4884151", "0.48796904", "0.4845981" ]
0.582388
34
Builds a function that return a list of fitnesses for a list of genotypes. Since Parallel runs in separate fork, this overload is needed to fetch out the training set before returning the fitness to the optimizer
def gen_fit_fn type, ntrials: ntrials_per_ind return super unless type.nil? || type == :parallel nprocs = Parallel.processor_count - 1 # it's actually faster this way puts "Running in parallel on #{nprocs} processes" -> (genotypes) do print "Fits: " fits, parall_infos = Parallel.map(0...genotypes.shape.first, in_processes: nprocs, isolation: true) do |i| # env = parall_envs[Parallel.worker_number] env = parall_envs[i] # leveraging dynamic env allocation # fit = fitness_one genotypes[i, true], env: env fits = ntrials.times.map { fitness_one genotypes[i, true], env: env } fit = fits.to_na.mean print "[m#{fit}] " [fit, compr.parall_info] end.transpose puts # newline here because I'm done `print`ing all ind fits puts "Exporting training images" parall_infos.each &compr.method(:add_from_parall_info) puts "Training optimizer" fits.to_na end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_fit_fn type, ntrials: nil\n type ||= :parallel\n case type\n # SEQUENTIAL ON SINGLE ENVIRONMENT\n # => to catch problems with `Parallel` env spawning\n when :sequential_single\n -> (genotypes) { genotypes.map &method(:fitness_one) }\n # SEQUENTIAL ON MULTIPLE ENVIRONMENTS\n # => to catch problems in multiple env spawning avoiding `Parallel`\n when :sequential_multi\n -> (genotypes) do\n genotypes.zip(parall_envs).map do |genotype, env|\n fitness_one genotype, env: env\n end.to_na\n end\n # PARALLEL ON MULTIPLE ENVIRONMENTS\n # => because why not\n when :parallel\n nprocs = Parallel.processor_count - 1 # it's actually faster this way\n -> (genotypes) do\n Parallel.map(0...genotypes.shape.first, in_processes: nprocs) do |i|\n fitness_one genotypes[i,true], env: parall_envs[i]\n end.to_na\n end\n else raise ArgumentError, \"Unrecognized fit type: `#{type}`\"\n end\n end", "def evaluate\n if @force_fitness_recalculation\n @karyotypes.each { |karyotype| update!(karyotype, fitness(karyotype)) }\n else\n @karyotypes.each do |karyotype|\n update!(karyotype, cached_fitness(karyotype)) if karyotype.fitness.nil?\n end\n end\n @karyotypes.sort_by! { |karyotype| - karyotype.fitness }\n end", "def solve(func)\n # setup population\n if @start_population.nil?\n population = Array.new(@population_size) do\n # generate random genotype according to the chromosome type\n { :genotype => @genotype_space.get_random }\n end\n else\n population = @start_population.map do |x|\n { :genotype => x }\n end\n end\n\n # initialize variables\n gen = 0\n overall_best = nil\n\n population_mutex = Mutex.new\n\n # default behavior is to loop forever\n begin\n gen += 1\n @logger.info(\"GA - Starting generation #{gen}\") if @logger\n\n # create latch to control program termination\n latch = Concurrent::CountDownLatch.new(@population_size)\n\n # assess fitness for every member of the population\n population.each do |s|\n @pool.post do\n # do we need to syncronize this call through population_mutex?\n # probably not.\n ret = func.call(s[:genotype])\n\n # protect write access to population struct using mutex\n population_mutex.synchronize do\n s[:fitness] = ret\n end\n\n # update latch\n latch.count_down\n end\n end\n\n # wait for all the threads to terminate\n latch.wait\n\n # find fittest member\n population_best = population.max_by {|x| x[:fitness] }\n\n # calculate overall best\n if overall_best.nil?\n overall_best = population_best\n else\n overall_best = [ overall_best, population_best ].max_by {|x| x[:fitness] }\n end\n\n # print results\n puts \"> gen #{gen}, best: #{overall_best[:genotype]}, #{overall_best[:fitness]}\" unless @quiet\n\n # execute controller\n @controller.call(self, overall_best) if @controller\n\n # selection by binary tournament\n children = new_generation(population)\n\n # update population and generation number\n population = children\n end while @exit_condition.nil? or !@exit_condition.call(gen, overall_best)\n\n # return best sample\n overall_best\n end", "def calc_fitness\n @population.each do |p|\n p.fitness(@target)\n end\n end", "def calc_fitness\n @population.each do |p|\n p.fitness(@target)\n end\n end", "def fitness_calc(genome_size, selection_coefficient)\n\t\tfitnesses = Array.new(genome_size) {0}\n\t\trunning_fitness = 1\n\t\t(0...genome_size).each do |i|\n\t\t\tfitnesses[i] = running_fitness\n\t\t\trunning_fitness *=(1-selection_coefficient)\n\t\tend\n\t\tfitnesses\n\tend", "def run\n calculate_ideal_subject_distribution\n\n #p \"population size >>>>>> \" + @population_size.to_s\n #p \"max generations >>>>>> \" + @max_generation.to_s\n\n result = {}\n best_chromosomes = []\n generate_initial_population #Generate initial population \n @max_generation.times do |g|\n\n selected_to_breed = selection #Evaluates current population \n\n offsprings = reproduction selected_to_breed #Generate the population for this new generation\n\n replace_worst_ranked offsprings\n\n #Sort the chromosomes again by fitness after offsprings\n #being merged\n @population.sort! { |a, b| b.fitness <=> a.fitness}\n\n # fs = @population.collect {|x| x.fitness }\n # File.open(\"fitnesses.txt\", \"a\") do |f|\n # f.puts \"generation (#{fs.size}) #{g.to_s} = \" + fs.join(\", \")\n # end\n\n best_chromosomes << @population[0]\n end\n result[:chromosomes] = best_chromosomes\n result[:population_size] = @population_size\n result[:generations] = @max_generation\n return result\n end", "def fitness\n return @fitness if @fitness\n\n consumption_per_cluster = {}\n @data.each_with_index do |v, i|\n consumption_per_cluster[v] ||= 0\n # puts @prosumers[i].id, @real_consumption\n consumption_per_cluster[v] += (@real_consumption[@prosumers[i].id] || 0)\n end\n\n total_penalties_before = @initial_imballance.map do |imballance|\n penalty(imballance)\n end\n\n total_penalties_after = 0\n res = 0;\n\n consumption_per_cluster.each do |cluster, consumption |\n # puts \"DEBUG: #{cluster}, #{consumption}\"\n p = penalty((consumption || 0) - (@targets_per_cluster[cluster] || 0))\n res += 100 * (total_penalties_before[cluster] - p) / total_penalties_before[cluster] if total_penalties_before[cluster] > 0\n end\n\n\n\n\n @fitness = res\n\n end", "def evaluate_fitness(list)\n list.inject(0) { |fitness, team| fitness + team.satisfaction }\n end", "def fitness\n @population.each(&:fitness)\n end", "def genetic_search(problem, fitness_fn, ngen=1000, pmut=0.0, n=20)\n # \"\"\"Call genetic_algorithm on the appropriate parts of a problem.\n # This requires that the problem has a successor function that generates\n # reasonable states, and that it has a path_cost function that scores states.\n # We use the negative of the path_cost function, because costs are to be\n # minimized, while genetic-algorithm expects a fitness_fn to be maximized.\"\"\"\n #states = [s for (a, s) in problem.successor(problem.initial_state)[:n]]\n states = problem.successor(problem.initial_state)\n random.shuffle(states)\n #fitness_fn = lambda s: - problem.path_cost(0, s, nil, s)\n #fitness_fn = {-problem.path_cost(0, s, nil, s)}\n return genetic_algorithm(states, fitness_fn, ngen, pmut)\nend", "def fitness\n -(0..5).map{|t| \n $pors_store = 0 # reset store\n t_val = t\n values = {:rec=>proc{$pors_store},:T=>proc{ cv=t_val; t_val=0; cv} } # using T destroys T\n (eval_genes(values) - N*t).abs \n }.sum - 0.1*size # find a tree that multiplies T by 3\n end", "def fitness_one genotype, env: single_env, render: false, nsteps: max_nsteps, aggr_type: :last\n puts \"Evaluating one individual\" if debug\n puts \" Loading weights in network\" if debug\n net.deep_reset\n net.load_weights genotype\n observation = env.reset\n # require 'pry'; binding.pry unless observation == env.reset_obs # => check passed, add to tests\n env.render if render\n tot_reward = 0\n # # set of observations with highest novelty, representative of the ability of the individual\n # # to obtain novel observations from the environment => hence reaching novel env states\n # represent_obs = []\n\n puts \"IGNORING `nobs_per_ind=#{nobs_per_ind}` (random sampling obs)\" if nobs_per_ind\n represent_obs = observation\n nobs = 1\n\n puts \" Running (max_nsteps: #{max_nsteps})\" if debug\n runtime = nsteps.times do |i|\n code = compr.encode observation\n # print code.to_a\n selected_action = action_for code\n obs_lst, rew, done, info_lst = env.execute selected_action, skip_frames: skip_frames\n # puts \"#{obs_lst}, #{rew}, #{done}, #{info_lst}\" if debug\n observation = OBS_AGGR[aggr_type].call obs_lst\n tot_reward += rew\n ## NOTE: SWAP COMMENTS ON THE FOLLOWING to switch to novelty-based obs selection\n # # The same observation represents the state both for action selection and for individual novelty\n # # OPT: most obs will most likely have lower novelty, so place it first\n # # TODO: I could add here a check if obs is already in represent_obs; in fact\n # # though the probability is low (sequential markovian fully-observable env)\n # novelty = compr.novelty observation, code\n # represent_obs.unshift [observation, novelty]\n # represent_obs.sort_by! &:last\n # represent_obs.shift if represent_obs.size > nobs_per_ind\n\n # Random sampling for representative obs\n nobs += 1\n represent_obs = observation if rand < 1.0/nobs\n\n # Image selection by random sampling\n\n env.render if render\n break i if done\n end\n compr.train_set << represent_obs\n # for novelty:\n # represent_obs.each { |obs, _nov| compr.train_set << obs }\n puts \"=> Done! fitness: #{tot_reward}\" if debug\n # print tot_reward, ' ' # if debug\n print \"#{tot_reward}(#{runtime}) \"\n tot_reward\n end", "def fitness_one genotype, env: single_env, render: false, nsteps: max_nsteps\n puts \"Evaluating one individual\" if debug\n puts \" Loading weights in network\" if debug\n net.deep_reset # <= this becomes necessary as we change net struct during training\n net.load_weights genotype\n observation = env.reset\n env.render if render\n tot_reward = 0\n puts \" Running (max_nsteps: #{max_nsteps})\" if debug\n nsteps.times do |i|\n\n\n # TODO: refactor based on `atari_ulerl`\n raise \"Update this from ulerl\"\n # execute once, execute skip, unshift result, convert all\n # need to pass also some of the helper functions in this class\n\n\n selected_action, normobs, novelty = action_for observation\n # observation, reward, done, info = env.step(selected_action).to_a\n observations, rewards, dones, infos = skip_frames.times.map do\n SKIP_TYPE[skip_type].call(selected_action, env).to_a\n end.transpose\n # NOTE: this below blurs the observation. An alternative is to isolate what changes.\n observation = observations.reduce(:+) / observations.size\n reward = rewards.reduce :+\n done = dones.any?\n\n tot_reward += reward\n env.render if render\n break if done\n end\n puts \"=> Done, fitness: #{tot_reward}\" if debug\n tot_reward\n end", "def fitness\n return @fitness if @fitness\n\n cls = (options[:kappa]).times.map { |i| [] }\n @data.each_with_index { |g, i| cls[g].push i}\n\n p_b2 = cls.map { |c| penalty_before(c) }\n p_a2 = cls.map { |c| penalty_after(c) }\n\n impr2 = p_b2.zip(p_a2).map do |b,a|\n b > 0 ? ((b - a)/b) : 0\n end.inject(0,:+)\n\n @fitness = impr2\n end", "def bench_for(num_particles, core_counts)\n\n # Create Hash to return using the constructor\n # Hash[ [ [a,b], [c,d] ] ] -> {a=>b, c=>d}\n Hash[ Distributions.map do |distribution_name|\n\n # Create array [distribution_name, proc]\n [ distribution_name, Proc.new do\n\n # Make special case for shared_and_replicated distribution\n # which uses OMP_NUM_THREADS > 1.\n if distribution_name == \"shared_and_replicated\"\n core_counts.each do |num_cores|\n if num_cores >= 8\n bench(\n distribution_name,\n num_particles,\n MinReps,\n num_cores/8,\n 8\n )\n end\n end\n else\n core_counts.each do |num_cores|\n bench(\n distribution_name,\n num_particles,\n MinReps,\n num_cores,\n 1\n )\n end\n end\n\n end ]\n\n end ]\n\nend", "def estimate_with_gen_data(n_gen, parameters, x, n_iter, tol=nil)\n result = Array.new(n_gen) { nil }\n n_gen.times do |i|\n xi = gen_data(parameters, x)\n result[i] = MLRatioSolve.do_iters_with_start(n_iter, xi, parameters[:gamma], tol)\n end\n result\n end", "def fitness_params\n params.fetch(:fitness, {})\n end", "def run\n generate_initial_population #Generate initial population\n\n @max_generation.times do |i|\n\n message = \"Generation: #{i}, best fitness: #{@population[0].fitness}\"\n @options[:stats][:gen] ||= []\n @options[:stats][:gen][i] = {\n fitness: @population[0].fitness,\n time: Time.now - @options[:stats][:start_run]\n }\n puts message\n unless @options[:rb_channel].nil?\n @options[:rb_channel].publish({data: message, event: 'output'}.to_json)\n end\n\n selected_to_breed = selection #Evaluates current population\n offsprings = reproduction selected_to_breed #Generate the population for this new generation\n replace_worst_ranked offsprings\n end\n return best_chromosome\n end", "def calc_fitness\n self.join.to_i(2)\n end", "def evolve(opts = {})\n\n values = 0..2_147_483_647\n num_offspring = opts[:population_size] - opts[:elites]\n\n # Ensure that only a single thread is used for evaluation if local\n # robustness is being used.\n opts[:evaluation_theads] = 1 if opts[:measure] == 'Local'\n\n # Ensure that the number of threads is no greater than the number\n # of individuals.\n opts[:breeding_threads] = [opts[:breeding_threads], num_offspring].min\n opts[:evaluation_threads] = [opts[:evaluation_threads], opts[:population_size]].min\n\n # Load the benchmark function samples.\n samples = JSON.load(File.open(\"#{File.dirname(__FILE__)}/samples.json\", 'rb')).freeze\n\n # Determine the number of arguments to the target function.\n vars = samples[opts[:benchmark]][0].length == 3 ? ['x', 'y'] : ['x']\n\n # Calculate division of labour for breeding.\n batches = (0...num_offspring).to_a.in_groups(opts[:breeding_threads])\n batches = Array.new(opts[:breeding_threads]) do |t|\n [t, batches[t][0], batches[t][-1] + 1]\n end\n\n # Construct the soft grammar.\n grammar = JSON.load(File.open(\"#{File.dirname(__FILE__)}/grammar.json\", 'rb'))\n grammar['var'] = vars\n grammar = Grammar.new('program', grammar)\n\n # Setup the RNGs.\n threads = [opts[:breeding_threads], opts[:evaluation_threads]].max\n random = Array.new(threads) { Random.new }\n\n # Initialise the population.\n population = Array.new(opts[:population_size]) do\n spawn(random[0], opts[:length], values)\n end\n\n # Evaluate the population and find the best solution.\n num_evaluations = evaluate!(population,\n benchmark: opts[:benchmark],\n measure: opts[:measure],\n samples: samples,\n grammar: grammar,\n evaluation_threads: opts[:evaluation_threads],\n num_evaluations: 0,\n evaluation_limit: opts[:evaluation_limit])\n\n best_individual = population.min\n generations = 0\n\n # Keep evolving until the evaluation limit is reached.\n until num_evaluations >= opts[:evaluation_limit]\n\n # Keep generating individuals until we run out of space.\n offspring = Array.new(num_offspring, nil)\n batches.peach(opts[:breeding_threads]) do |t, start_at, end_at|\n\n until start_at == end_at\n \n # Select and clone two parents from the existing population.\n x = tournament_selection(random[t],\n population,\n opts[:tournament_size]).clone\n y = tournament_selection(random[t],\n population,\n opts[:tournament_size]).clone\n\n # Perform two point crossover on the two parents to produce\n # two proto-children.\n crossover!(random[t],\n opts[:crossover_rate],\n x.chromosome,\n y.chromosome)\n\n # Perform mutation on the two proto-children to produce two\n # complete offspring for the next generation.\n mutate!(random[t],\n opts[:mutation_rate],\n values,\n x.chromosome)\n offspring[start_at] = x\n start_at += 1\n\n # Only mutate and add the second proto-child to the offspring\n # if there is room for it.\n unless start_at == end_at\n mutate!(random[t],\n opts[:mutation_rate],\n values,\n y.chromosome)\n offspring[start_at] = y\n start_at += 1\n end\n\n end\n end\n\n # Evaluate the newly created offspring and compare the best individual\n # against the best found so far during the evolution.\n num_evaluations += evaluate!(offspring,\n benchmark: opts[:benchmark],\n measure: opts[:measure],\n samples: samples,\n grammar: grammar,\n num_evaluations: num_evaluations,\n evaluation_limit: opts[:evaluation_limit])\n\n best_offspring = offspring.min\n best_individual = best_offspring if best_offspring < best_individual\n\n # Perform replacement to give the population for the next generation. \n replace!(population, offspring, opts[:elites])\n generations += 1\n\n # Console output.\n unless opts[:silent]\n puts \"Generation #{generations}: #{best_individual.fitness}\"\n end\n\n end\n\n # Return the best individual found during the evolution.\n return best_individual\n\nend", "def select_fittest\n fittest = []\n self.size.times do\n selected_index = Selector.pick_big_one(scores)\n fittest << @players[selected_index]\n end\n fittest\n end", "def execute\n @generation = 0\n output_hash = { best_fit: nil, gen_of_best_fit: 0, func_evals_of_best_fit: 0,\n relative_error: nil, optimal_func_val: nil }\n begin\n init_population\n p 'population initialized'\n select_taguchi_array\n p \"the selected taguchi array is L#{@taguchi_array.size}\"\n while @generation < @max_generation\n selected_indexes = roulette_select\n cross_individuals selected_indexes\n generate_offspring_by_taguchi_method\n mutate_individuals\n select_next_generation\n if (@generation % 50).zero?\n p \"Generation: #{@generation}- Fitness: #{@chromosomes.first.fitness}\"\n end\n update_output_hash output_hash\n break if has_stopping_criterion_been_met? output_hash[:best_fit]\n @generation += 1\n end\n relative_error = (((output_hash[:best_fit] + 1) / (@optimal_func_val + 1)) - 1).abs\n output_hash[:relative_error] = relative_error\n output_hash[:optimal_func_val] = @optimal_func_val\n rescue StandardError => e\n p e.message\n p e.backtrace.inspect\n end\n p output_hash\n output_hash\n end", "def calcFitness(sgenome)\r\n \r\n calcWeightAndValue(sgenome)\r\n\r\n if (@sum_weight > @max_weight)\r\n # penalize overweight solutions \r\n @sum_value - (@penalty * (@sum_weight - @max_weight))\r\n else \r\n @sum_value\r\n end\r\n\r\n end", "def test_population_fitness(population)\n\tpopulation.map.with_index {|net, i| [test_fitness(net), i]}\nend", "def genus_proximum_candidates(concept)\n return @concept_types_cache[concept] unless @concept_types_cache[concept].nil?\n @concept_types_cache[concept] = candidate_set_for_syntax_trees(concept.types_trees, @genus_filters)\n end", "def fittest_n(n)\n sort_by_fitness[0, n]\n end", "def fit; end", "def fitness(geneID)\n geneScore = 0\n @genePool[geneID].each_index do |i|\n geneScore += @genePool.get(geneID, i) \n end\n geneScore\n end", "def optimise(number_of_generations = 0)\n previous_best = best_fitness\n\n # optimise\n if number_of_generations > 0\n evolve_n_times(number_of_generations)\n else\n optimise_by_strategy\n end\n\n @best_fitness = @fitness_evaluator.fitness(best)\n\n @best_fitness > previous_best\n end", "def fitness\n fitness = 0\n weight = 0\n for i in 0..@conf.size - 1\n if @conf[i] == 1\n fitness += @problem.prices[i]\n weight += @problem.weights[i]\n end\n \n if weight > @problem.M\n return -1\n end\n end\n \n return fitness\n end", "def train\n run_aggregation\n run_syntetics\n run_values_to_ranges\n run_reverse\n\n [name, classifier]\n end", "def genus_proximum_candidates(concept)\n return @concept_types_cache[concept] unless @concept_types_cache[concept].nil?\n @concept_types_cache[concept] = candidate_set_for_syntax_trees(concept.types_trees, @genus_filters)\n end", "def fitness\n @fitness ||= (\n outter_bound, inner_bound = @length -2, @length - 1\n (0..outter_bound).inject(0) do |e1, x1|\n y1 = @genes[x1]\n e1 + ((x1+1)..inner_bound).inject(0) do |e2, x2|\n y2 = @genes[x2]\n dx, dy = (x1 - x2).abs, (y1 - y2).abs\n e2 + ((y1 == y2 || dx == dy) ? 1 : 0)\n end\n end\n )\n end", "def fit=(_arg0); end", "def run(population_size, crossover_prop, mutation_prop)\r\n @crossover_prop = crossover_prop\r\n @mutation_prop = mutation_prop\r\n generate_population population_size \r\n \r\n iteration = 0\r\n while(yield(@best_fitness, iteration))\r\n new_population = selection\r\n i = 0\r\n while i < new_population.size \r\n gen1 = new_population[i]\r\n gen2 = new_population[i+1]\r\n gen1, gen2 = crossover gen1, gen2\r\n new_population[i] = mutate gen1\r\n new_population[i+1] = mutate gen2\r\n i = i+2\r\n end\r\n @population = new_population\r\n update_fitness_vector\r\n iteration+=1\r\n\r\n max = @fitness_vector.max\r\n if max > @best_fitness\r\n @best_fitness = max\r\n @best_gen = @population[@fitness_vector.index(max)]\r\n end\r\n puts max\r\n \r\n end\r\n\r\n return @best_gen, @best_fitness\r\n end", "def run_best_case\n user = User.find(1)\n timetable = user.timetables[2]\n timetable.subjects = user.subjects.ids.sample(5)\n\n p \">>>>>>> Running Best Case for Population Size\"\n run_for_population_size(timetable)\n # p \">>>>>>> Running Best Case for Generations\"\n # run_for_generations(timetable)\n\n # tp all_runs\n #tp all_runs.map { |x| x[:chromosomes] }\n #p all_runs.map(&:fitness).inject(0, :+) / all_runs.size\n #tp all_runs[0].data.collect {|x| x.subject }\n end", "def calculate_fitness\r\n total_fitness = 0\r\n\r\n # Arrays to hold the attribute values for each team\r\n gender = []\r\n ethnicity = []\r\n grade = []\r\n id = []\r\n\r\n (0..@teams - 1).each do |y| # Iterating through all teams\r\n (0..@length - 1).each do |x| # Iterating through all students\r\n next unless @position[x][y] == 1\r\n\r\n # Only checking for forbidden team formations\r\n # if there are any forbidden pairs at all\r\n unless @forbidden_pairs.nil?\r\n temp = [] # List with students that are forbidden to join the team\r\n\r\n # Checking if the particular student is already in\r\n # the list of forbidden students for the particular team\r\n\r\n if temp.include? @table[x]['id'] # If this student cannot be assigned to this team\r\n initial_particle_assignment # Change the current postion with a random one\r\n calculate_fitness #and calculate its new fitness\r\n return false # terminate the method\r\n end\r\n\r\n # Adding all forbidden mates of the student to the list with forbidden teammates\r\n if @forbidden_pairs.key?(@table[x]['id'])\r\n temp.append(@forbidden_pairs[@table[x]['id']])\r\n end\r\n end\r\n\r\n # Extract attributes of students in the team\r\n # into the temporary arrays so the distances can be computed\r\n gender.push(@table[x]['Gender'])\r\n ethnicity.push(@table[x]['Ethnicity'])\r\n grade.push(@table[x]['Grade'].to_i)\r\n end\r\n\r\n # Calculate the distances between students\r\n (0..grade.length - 2).each do |i|\r\n (i + 1..grade.length - 1).each do |index|\r\n dist = 0 # sum of distances\r\n # As this is non-numeric attribute represented however\r\n # by a numeric value, we're interested only if\r\n # they are different, not by how much as it is irrelevant\r\n dist += @gender_weight unless gender[i] == gender[index]\r\n dist += @ethnicity_weight unless ethnicity[i] == ethnicity[index]\r\n dist += (grade[i] - grade[index])**2\r\n\r\n # Adding the distances between students for\r\n # the current team to the total fitness\r\n dist.positive? ? total_fitness += Math.sqrt(dist) : total_fitness -= Math.sqrt(dist.abs)\r\n end\r\n end\r\n case grade.uniq.length\r\n when 1\r\n total_fitness -= 80\r\n when 2\r\n total_fitness -= 150\r\n when 1\r\n total_fitness -= 300\r\n end\r\n\r\n gender.clear\r\n ethnicity.clear\r\n grade.clear\r\n end\r\n\r\n @fitness = total_fitness\r\n # Check if the current fitness is better than the personal best one\r\n update_p_best\r\n end", "def [](*parameters)\n homogenized_parameters = homogenized_list_of_arrays(parameters)\n\n permutation_lookup = {}\n\n all_range_permutations = permutations_of_list_of_ranges(homogenized_parameters)\n all_range_permutations.each do |parameter_permutation|\n permutation_lookup[parameter_permutation] = call(*parameter_permutation)\n end\n\n should_reduce_results = permutation_lookup.values.uniq.count == 1\n if should_reduce_results\n permutation_lookup.values.first\n else\n permutation_lookup\n end\n end", "def best_fit(subpaths_so_far, needed_references, subpath_to_references_map, best_so_far, &proc)\n debug \">>> best_fit(subpaths #{subpaths_so_far.inspect}, #{needed_references.length} remaining references needed)\"\n if needed_references.empty?\n debug \">>> best_fit: no more references needed, calling block with: #{subpaths_so_far.join(\", \")}\"\n proc.call(subpaths_so_far)\n best_so_far = [ subpaths_so_far.length, best_so_far ].min\n else\n return best_so_far if subpaths_so_far.length >= best_so_far\n\n # Now, go through it and pick each subpath in turn, recursing. We do this in\n # descending order of size, since, while not guaranteed, large sets are more\n # likely to be included in the optimal result than small sets. This doesn't\n # affect the final result, but helps us run faster.\n #\n # We sort alphabetically within subpaths of the same size, so that we will\n # end up returning the alphabetically-first set of subpaths that covers all\n # the needed references, if multiple sets of the same length both cover it.\n remaining_subpaths_in_order = (subpath_to_references_map.keys - subpaths_so_far).sort do |a, b|\n out = (b.length <=> a.length)\n out = (a <=> b) if out == 0\n out\n end\n \n remaining_subpaths_in_order.each do |subpath|\n # Only pick subpaths alphabetically greater than all the subpaths we've tried\n # so far. In other words, only try (aaa, bbb), not also (bbb, aaa). This makes\n # the algorithm hugely faster; we're trying distinct combinations of subsets, not\n # all permutations. All permutations is exponential and makes this run forever\n # very, very fast.\n unless subpaths_so_far.detect { |s| s > subpath }\n # Compute the set of new subpaths we'll try, and the references that will be\n # remaining.\n new_subpaths = subpaths_so_far + [ subpath ]\n remaining_references = needed_references - subpath_to_references_map[subpath]\n if remaining_references.empty?\n # No references remain; we've covered them all. Output the result.\n proc.call(new_subpaths)\n \n # If we've got a new best match, don't even bother trying the other subpaths.\n # Since we add one new subpath on each recursive call to #best_fit, the other\n # subpaths can't possibly do any *better* than what we've found, and since\n # we try paths in alphabetical order, we want to yield only the very first\n # path that we try.\n return new_subpaths.length if new_subpaths.length < best_so_far\n else\n result = best_fit(\n new_subpaths,\n remaining_references,\n subpath_to_references_map,\n best_so_far,\n &proc)\n\n best_so_far = [ best_so_far, result ].min\n end\n end\n end\n end\n \n best_so_far\n end", "def search(population_size: 20, maximum_number_of_generations: 100, number_of_mutation_sites: 2, crossover_probability: 0.95, mutation_probability: 0.05)\n\n population_size = population_size.to_i unless population_size.kind_of?(Integer)\n maximum_number_of_generations = maximum_number_of_generations.to_i unless maximum_number_of_generations.kind_of?(Integer)\n # number_of_mutation_sites = BigDecimal(number_of_mutation_sites.to_s) unless number_of_mutation_sites.kind_of?(BigDecimal)\n # crossover_probability = BigDecimal(crossover_probability.to_s) unless crossover_probability.kind_of?(BigDecimal)\n # mutation_probability = BigDecimal(mutation_probability.to_s) unless mutation_probability.kind_of?(BigDecimal)\n number_of_mutation_sites = number_of_mutation_sites.to_i unless number_of_mutation_sites.kind_of?(Integer)\n crossover_probability = crossover_probability.to_f unless crossover_probability.kind_of?(Float)\n mutation_probability = mutation_probability.to_f unless mutation_probability.kind_of?(Float) \n\n initialize_population(population_size)\n\n maximum_number_of_generations.times do |generation_index|\n\n @population_copy = deep_clone_population\n\n population_size.times do |individual_index|\n\n # if bigdecimal_rand < crossover_probability\n if rand < crossover_probability\n\n # Crossover pair:\n crossover_pair_1_index = generate_random_index(population_size)\n crossover_pair_2_index = generate_random_index(population_size) \n\n crossover(crossover_pair_1_index, crossover_pair_2_index)\n\n end\n\n # if bigdecimal_rand < mutation_probability\n if rand < mutation_probability\n\n mutation_individual_index = generate_random_index(population_size)\n\n mutate(mutation_individual_index, number_of_mutation_sites)\n\n end\n\n end\n\n end\n\n objective_function_value = @population_fitness.send(@objective_method_name)\n decision_variable_values = @population[@population_fitness.index(objective_function_value)]\n\n { best_decision_variable_values: decision_variable_values, best_objective_function_value: objective_function_value }\n\n end", "def fitness(vals)\n begin\n IterativeLearning::FunctionLearning.sum_of_error(self.target_values, vals)\n rescue StandardError\n condition.fitness(vals)\n end\n end", "def fitness(game)\n totalFitness = 0\n @bestFitness = 0\n @bestGene = 0\n @genePool.each_index do |geneID|\n fitness = game.fitness(geneID)\n @genePool[geneID].fitness = fitness\n if fitness > @bestFitness\n @bestGene = geneID\n @bestFitness = fitness\n end\n totalFitness += @genePool[geneID].fitness\n end\n totalFitness\n end", "def select_fittest\n @children.max{ |this,that| this.fitness <=> that.fitness }\n end", "def evaluate_chromosome(chromosome)\n @num_evaluations += 1\n chromosome.fitness = @selected_func.call chromosome\n end", "def benchmark(genotype_class, html_outfile='report.html', csv_outfile=nil, &b)\n start = Time.now\n\n dsl_obj = StrategiesDSL.new; dsl_obj.instance_eval(&b)\n all_tests = dsl_obj.get_tests\n generations = dsl_obj.generations\n population_size = dsl_obj.population_size\n repeat_tests = dsl_obj.repeat\n setup_proc = dsl_obj.setup\n teardown_proc = dsl_obj.teardown\n\n track_stat = dsl_obj.track_stat\n\n n_tests = all_tests.size\n tests_done = 0\n puts \"#{n_tests} Total tests:\"\n\n overall_best = [nil, -1.0 / 0.0]\n \n data = all_tests.map{|selection_module,crossover_module,mutator_module|\n tests_done += 1\n print \"\\nRunning test #{tests_done}/#{n_tests} : #{selection_module} / #{crossover_module} / #{mutator_module}\\t\"\n\n gclass = Class.new(genotype_class) { use selection_module,crossover_module,mutator_module }\n start_test = Time.now\n\n test_stats = (0...repeat_tests).map{\n print '.'; $stdout.flush\n\n population = Population.new(gclass,population_size)\n setup_proc.call(population)\n best = population.evolve_silent(generations).last\n\n stat = track_stat.call(best)\n teardown_proc.call(population)\n\n overall_best = [best, stat] if overall_best[0].nil? || (overall_best[1] <=> stat) < 0 # use <=> to allow arrays\n stat\n }\n [selection_module, crossover_module,mutator_module,\n (Time.now-start_test) / repeat_tests, test_stats]\n }\n\n html_output(html_outfile, data, genotype_class, Time.now-start, overall_best, dsl_obj)\n csv_output(csv_outfile , data)\n\n puts '',table_details(data).to_s\n return data\n end", "def find_best_permutation(functions, *args)\n scores = []\n functions.each_with_index do |fn, idx|\n method(fn).call(*args) # Permute on first call\n scores[idx] = [energy(), fn]\n method(fn).call(*args) # Reverse permutation on second call\n end\n best_fn = scores.shuffle.max_by {|x| x[0]}\n method(best_fn[1]).call(*args)\n end", "def report_best_fit\n best_critter.phenotype.code\n end", "def fit(x, y, g, h)\n x = ::Rumale::Validation.check_convert_sample_array(x)\n y = ::Rumale::Validation.check_convert_target_value_array(y)\n ::Rumale::Validation.check_sample_size(x, y)\n\n # Initialize some variables.\n n_features = x.shape[1]\n @params[:max_features] ||= n_features\n @n_leaves = 0\n @leaf_weights = []\n @feature_importances = Numo::DFloat.zeros(n_features)\n @sub_rng = @rng.dup\n # Build tree.\n build_tree(x, y, g, h)\n @leaf_weights = Numo::DFloat[*@leaf_weights]\n self\n end", "def search feature_vectors, max_iterations=DEFAULT_MAX_ITERATIONS\n super(feature_vectors)\n\n # initialize iteration parameters and resolution\n parameter, resolution = pattern_for_range costs, gammas\n\n max_iterations.times do\n values = Hash.new { |h, k| h[k] = [] }\n parameter.each do |cost, gamma|\n # was this parameter pair already tested?\n params = ParameterSet.new(gamma, cost)\n next if results.has_key?(params.key)\n\n # n-fold cross validation\n @folds.each.with_index do |fold,index|\n # start async SVM training | ( trainings_set, parameter, validation_sets)\n model, result, _ = @worker.train( fold, params,\n @folds.select.with_index{|e,ii| index!=ii } )\n next if model.nil?\n values[params.key] << result\n end\n end\n\n # calculate means for each parameter pair\n values = values.map{|k,v| {k => v.instance_eval { reduce(:+) / size.to_f }}}\n # flatten array of hashed into one hash\n results.merge! Hash[*values.map(&:to_a).flatten]\n\n # get the pair with the best value\n best = results.invert[results.values.max]\n\n p \"best #{best}: #{results.values.max}\"\n # get new search window\n parameter, resolution = pattern_for_center [best[:cost],best[:gamma]], resolution.map{|e| e/Math.sqrt(2)}, [costs, gammas]\n end\n\n best_parameter = ParameterSet.from_key results.invert[results.values.max]\n # retrain the model with the best results and all of the available data\n best_parameter.enable_probability!\n model = train_svm feature_vectors, best_parameter\n return model, results, best_parameter\n end", "def calculate_fitness\n return 'done' if @dna == @target_dna\n fit_arr = []\n @target_dna.each_with_index do |e, i|\n fit_arr.push((@dna[i] - e).abs)\n end\n (1 / fit_arr.inject(:+).to_f) * 100\n end", "def make\n @stats = []\n @history.each {|generation| make_stats(generation) } \n when_best\n self\n end", "def train(sgd, obj, w, train_set, num_epoch = 50, batch_size = 2000)\n iters = []\n losses = []\n iters << 0\n losses << obj.func(train_set[\"data\"], sgd.weights)\n\n num_epoch.times do |t|\n if t % 10 == 0 \n puts \"# epoch: #{t}\"\n end\n train_set[\"data\"].each_slice(batch_size) do |batch| \n sgd.update(batch)\n # iters << i\n # losses << obj.func(batch, sgd.weights)\n # i += 1\n end\n iters << t + 1\n losses << obj.func(train_set[\"data\"], sgd.weights)\n end\n scores = score_binary_classification_model(train_set[\"data\"], w, obj)\n train_auc_1 = calc_auc_only_1(scores)\n puts train_auc_1\n return [sgd, iters, losses]\nend", "def run_all\n results = []\n results << { name: \"DFS\", result: dfs }\n results << { name: \"BFS\", result: bfs }\n results << { name: \"Iterative DFS\", result: iterative_dfs }\n results << { name: \"Greedy Euc.\", result: greedy(Euclidian.new(@final, false)) }\n results << { name: \"Greedy Zero\", result: greedy(Zero.new(@final, false)) }\n results << { name: \"A Star Euc.\", result: a_star(Euclidian.new(@final, true)) }\n results << { name: \"A Star Zero\", result: a_star(Zero.new(@final, true)) }\n end", "def run\n generate_initial_population() #Generate initial population \n\n (1..@max_generation).each do |generation_number|\n puts \"\\nGeneration #{generation_number}\"\n\n fitness_range = get_fitness_range(@population)\n\n next if fitness_range.max == fitness_range.min\n\n @population.sort!()\n\n selected_to_breed = selection() # Evaluates current population \n\n offsprings = reproduction(selected_to_breed) # Generate the population for this new generation\n\n replace_worst_ranked(offsprings)\n\n puts to_s()\n\n mutate()\n\n increment_age()\n end\n\n #return best_chromosome()\n return @population.sort { |a, b| b.fitness <=> a.fitness}\n end", "def analyze_for_fitness!(critter)\n fitvec = @crit_hist[critter].map{|seq, vio| @controller.fitness_func_hook(vio[0], vio[1], seq) }\n # Average the fitness vector to get a scalar fitness.\n critter.fitness = unless @controller.cost_func_none?\n @controller.cost_func_hook(fitvec, critter.genotype.fitness_cost)\n else\n fitvec.reduce {|a,r| a+r} / fitvec.size.to_f + critter.genotype.fitness_cost\n end\n log.debug \"Fitness Vector: #{fitvec}, fitness of #{critter.fitness} assigned to #{critter}\"\n end", "def fittest\n @population[0]\n end", "def compute_best_score(team, pilots, pilot_contests)\n combination = []\n total = 0.0\n total_possible = 0\n puts 'compute_score TBD'\nend", "def fit(x, y)\n x = ::Rumale::Validation.check_convert_sample_array(x)\n y = ::Rumale::Validation.check_convert_label_array(y)\n ::Rumale::Validation.check_sample_size(x, y)\n\n n_samples, n_features = x.shape\n @params[:max_features] = n_features if @params[:max_features].nil?\n @params[:max_features] = [@params[:max_features], n_features].min\n y = Numo::Int32.cast(y) unless y.is_a?(Numo::Int32)\n uniq_y = y.to_a.uniq.sort\n @classes = Numo::Int32.asarray(uniq_y)\n @n_leaves = 0\n @leaf_labels = []\n @feature_ids = Array.new(n_features) { |v| v }\n @sub_rng = @rng.dup\n build_tree(x, y.map { |v| uniq_y.index(v) })\n eval_importance(n_samples, n_features)\n @leaf_labels = Numo::Int32[*@leaf_labels]\n self\n end", "def fit(*args)\n range, items = parse_fit_args(args)\n r = range.map{|x| \"#{x} \"}.join\n c = items.cmd_str\n puts send_cmd(\"fit #{r}#{c}\")\n nil\n end", "def fitness\n if @fitness == 0.0\n @fitness = @fitness_alg.rank(self)\n end\n @fitness\n end", "def fit\n raise NotImplementedError, \"#{__method__} has to be implemented in #{self.class}.\"\n end", "def fit\n raise NotImplementedError, \"#{__method__} has to be implemented in #{self.class}.\"\n end", "def build_house() \n gather_team()\n @workers.each do |worker|\n worker.get_to_work()\n end\n end", "def calc_contribution(f)\n if not get_classes.size == 2\n abort \"[#{__FILE__}@#{__LINE__}]: \\n\"+\n \" Relief applicable only to two-class problems without missing data\"\n end\n \n ## use all samples if @m not provided\n #@m = get_sample_size if not @m\n \n k1, k2 = get_classes\n score = 0.0\n \n @m.times do \n # pick a sample at random\n rs, rk = pick_a_sample_at_random\n \n # find the nearest neighbor for each class\n nbrs = find_nearest_nb(rs, rk)\n \n # calc contribution from neighbors\n score += calc_score(f, rs, rk, nbrs)\n end\n \n s = score / @m\n \n set_feature_score(f, :BEST, s)\n end", "def simpsonParallel(lowerBound, upperBound, samples, proc1, noOfThreads)\n samples = samples/noOfThreads # calculate sample size for one thread\n chunkSize = 1.0*(upperBound - lowerBound)/noOfThreads\n sol = 0.0\n\t\n threadArr = Array.new(noOfThreads)\n \n for i in 0..(noOfThreads-1) # spawn processes\n threadArr[i] = Thread.new(i){ |n|\n lb = lowerBound + chunkSize * n\n ub = lb + chunkSize\n subSol = simpson(lb, ub, samples, proc1)\n subSol\n }\n end\n\n threadArr.each {|t| t.join;} #wait until all the subproblems are solved\n sol = threadArr.reduce(0) { |sum, thread| sum + thread.value }\n return sol\nend", "def fit\n @coefficients = [1.0, 2.0]\n end", "def fit\n @coefficients = [1.0, 2.0]\n end", "def calculate\n candidates = []\n\n generalized_cause = NLU::Generalization.new(symbols: @symbols).generalize(@cause)\n\n #ap \"sentence: #{cause_sentence}\"\n #ap \"learned: #{@learned.inspect}\"\n\n # We go through everything that was learned before\n @learned.each do |function_name, criteria|\n criteria[:generalizations].each do |generalization|\n\n # We generate a pre-candidate for this generalization. It starts\n # with score zero because we don't know yet whether this criteria\n # fits the sentence or not.\n local_candidate = {\n fn: function_name,\n attrs: { },\n score: 0.0\n }\n\n #ap \"generalized_cause #{generalized_cause}\"\n\n # We then generalize the cause sentence and go through it.\n # We will match *each* learned generalization against the cause\n # generalization.\n generalized_cause.each_with_index do |cause_rule, cause_index|\n\n\n # Wildcard\n #\n # Matches these:\n #\n # > i want a [type:wildcard:some_name_for_this_wildcard]\n # > i want a ford\n #\n wildcard = \"[#{NLU::Generalization::RESERVED_TYPES[:wildcard]}]\"\n #ap \"wildcard: #{wildcard}\"\n wildcard_regex = Regexp.escape(wildcard)\n if generalization =~ /wildcard/i\n wildcard_generalization = generalization\n .gsub(/\\[(type:wildcard)(.+)\\]/i, '[\\1]')\n end\n #ap \"wildcard_generalization(#{wildcard_generalization}) =~ cause_rule(#{wildcard_regex})\"\n if wildcard_generalization.to_s =~ Regexp.new(wildcard_regex, Regexp::IGNORECASE)\n #ap \"true -> #{wildcard_generalization} =~ /#{Regexp.new(wildcard_regex, Regexp::IGNORECASE)}/i\"\n\n rule = wildcard_generalization.gsub(\"#{wildcard}\", \"(.+)\")\n #ap \"rule #{rule}\"\n #binding.pry\n if value = cause_sentence.join(\" \").match(Regexp.new(rule, Regexp::IGNORECASE))\n value = value[-1]\n prop = attr_name_from_type_param(generalization)\n\n local_candidate = local_candidate.merge({\n attrs: {\n prop => value\n },\n score: 0.75\n })\n end\n\n # If we find a learned generalization that matches the generalized\n # sentence, we will save it.\n elsif generalization == cause_rule\n cause_rule.split(\" \").each_with_index do |typed_string, index|\n\n # If the learned generalization has a type anywhere, we will\n # check what is the corresponding word in the cause sentence.\n #\n # For example, consider the following sentence:\n #\n # [type:subject] want a [type:make]\n #\n # and the sentence\n #\n # I want a ford\n #\n # Finding `[type:make]` at position 3 of the array, we will\n # get `ford` at the position 3 of the cause sentence. With\n # that we can come up with `{make: 'ford'}`.\n #\n if typed_string =~ /\\[type/i\n local_candidate[:score] += 1\n type = attr_name_from_type_param(typed_string)\n prop = type_properties(type)\n type_token_length = prop[:token_length]\n\n # In `i want a car`, this will get the `i`. If the type\n # says instead that it's formed by two symbols (e.g\n # `i want`), then it will take `i want`.\n #\n # The -1 in the brackets is because otherwise it would be\n # translated to the following if the type had 1 symbol\n #\n # cause_sentence[1..1+1]\n #\n # That would take 2 words (`[1..2]`). We want one word, so\n #\n # cause_sentence[1..1+1-1]\n #\n word_for_type = cause_sentence[index..index+(type_token_length-1)]\n #ap \"> type: #{type} - #{index} #{cause_sentence[index..index+type_token_length]}\"\n\n local_candidate[:attrs][type] = word_for_type.join(\" \")\n\n # When it's just the same sentence as one seen before, no\n # generalizations\n else\n local_candidate[:score] = 1\n end\n end\n\n end\n end\n\n if local_candidate[:score] > 0\n candidates << local_candidate\n end\n end\n end\n\n # TODO - normalization is taking out some elements that are good.\n #candidates = normalize_scores(candidates)\n candidates = pick_candidates(candidates)\n candidates = merge_attributes(candidates)\n\n candidates\n end", "def parallel_do(enum, options = {}, &block)\n parallelizer.parallelize(enum, options, &block).to_a\n end", "def test_scenario2\n data = [{'filename' => File.dirname(__FILE__)+'/data/iris.csv',\n 'number_of_models' => 5,\n 'tlp' => 1,\n 'local_file' => File.dirname(__FILE__)+'/tmp/batch_predictions.csv',\n 'predictions_file' => File.dirname(__FILE__)+'/data/batch_predictions_e.csv',\n 'params' => {\"combiner\" => 0}},\n {'filename' => File.dirname(__FILE__)+'/data/iris.csv',\n 'number_of_models' => 5,\n 'tlp' => 1,\n 'local_file' => File.dirname(__FILE__)+'/tmp/batch_predictions.csv',\n 'predictions_file' => File.dirname(__FILE__)+'/data/batch_predictions_e_c1.csv',\n 'params' => {\"combiner\" => 1, \"confidence\" => true}},\n {'filename' => File.dirname(__FILE__)+'/data/iris.csv',\n 'number_of_models' => 5,\n 'tlp' => 1,\n 'local_file' => File.dirname(__FILE__)+'/tmp/batch_predictions.csv',\n 'predictions_file' => File.dirname(__FILE__)+'/data/batch_predictions_e_c2.csv',\n 'params' => {\"combiner\" => 2, \"confidence\" => true}},\n {'filename' => File.dirname(__FILE__)+'/data/iris.csv',\n 'number_of_models' => 5,\n 'tlp' => 1,\n 'local_file' => File.dirname(__FILE__)+'/tmp/batch_predictions.csv',\n 'predictions_file' => File.dirname(__FILE__)+'/data/batch_predictions_e_o_k_v.csv',\n 'params' => {\"operating_kind\" => \"votes\", \"confidence\" => true}},\n {'filename' => File.dirname(__FILE__)+'/data/iris.csv',\n 'number_of_models' => 5,\n 'tlp' => 1,\n 'local_file' => File.dirname(__FILE__)+'/tmp/batch_predictions.csv',\n 'predictions_file' => File.dirname(__FILE__)+'/data/batch_predictions_e_o_k_p.csv',\n 'params' => {\"operating_kind\" => \"probability\", \"probability\" => true}},\n {'filename' => File.dirname(__FILE__)+'/data/iris.csv',\n 'number_of_models' => 5,\n 'tlp' => 1,\n 'local_file' => File.dirname(__FILE__)+'/tmp/batch_predictions.csv',\n 'predictions_file' => File.dirname(__FILE__)+'/data/batch_predictions_e_o_k_c.csv',\n 'params' => {\"operating_kind\" => \"confidence\", \"confidence\" => true}}\n ]\n\n puts\n puts \"Scenario: Successfully creating a batch prediction for an ensemble\"\n\n data.each do |item|\n puts\n puts \"Given I create a data source uploading a #{item['filename']} file\"\n source = @api.create_source(item[\"filename\"], {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create dataset with local source\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n puts \"And I create an ensemble of #{item['number_of_models']} models and #{item['tlp']} tlp\"\n # \"tlp\"=> item[\"tlp\"]\n ensemble = @api.create_ensemble(dataset, {\"number_of_models\"=> item[\"number_of_models\"], \"seed\" => 'BigML', 'ensemble_sample'=>{'rate' => 0.7, 'seed' => 'BigML'}, 'missing_splits' => false})\n\n puts \"And I wait until the ensemble is ready\"\n assert_equal(BigML::HTTP_CREATED, ensemble[\"code\"])\n assert_equal(@api.ok(ensemble), true)\n\n puts \"When I create a batch prediction for the dataset with the ensemble and params <%s>\" % JSON.generate(item['params'])\n batch_prediction = @api.create_batch_prediction(ensemble, dataset, item['params'])\n\n puts \"And I wait until the batch prediction is ready\"\n assert_equal(BigML::HTTP_CREATED, batch_prediction[\"code\"])\n assert_equal(@api.ok(batch_prediction), true) \n\n puts \"And I download the created predictions file to #{item['local_file']}\"\n filename = @api.download_batch_prediction(batch_prediction, item[\"local_file\"])\n assert_not_nil(filename)\n\n puts \"Then the batch prediction file is like #{item['predictions_file']}\"\n assert_equal(FileUtils.compare_file(item[\"local_file\"], item[\"predictions_file\"]), true)\n\n\n end\n\n end", "def fitness(target)\n score = 0\n @genes.each_with_index do |gene, i|\n score += 1 if target[i] == gene\n end\n score / target.size.to_f\n end", "def fitness(target)\n score = 0\n @genes.each_with_index do |gene, i|\n score += 1 if target[i] == gene\n end\n score / target.size.to_f\n end", "def init_population\n (0...@pop_size).each do\n chromosome = Chromosome.new\n (0...@num_genes).each do\n gene = rand 0..1\n chromosome << gene\n end\n evaluate_chromosome chromosome\n compare_func = @is_high_fit ? :> : :<\n if @best_fit.nil? ||\n chromosome.fitness.public_send(compare_func, @best_fit)\n @best_fit = chromosome.fitness\n end\n @chromosomes << chromosome\n end\n end", "def get_required_features(features)\n end", "def calculates(problems)\n problems.each do |each_prob|\n calculate_problem(each_prob)\n end\nend", "def fit(x, y)\n x = check_convert_sample_array(x)\n y = check_convert_tvalue_array(y)\n check_sample_tvalue_size(x, y)\n\n if @params[:solver] == 'svd' && enable_linalg?(warning: false)\n fit_svd(x, y)\n elsif @params[:solver] == 'lbfgs'\n fit_lbfgs(x, y)\n else\n fit_sgd(x, y)\n end\n\n self\n end", "def fitness(s,val,wt,cap)\n v = 0\n w = 0\n for i in 0..s.length-1\n mult = s[i..i].to_i\n w += mult * wt[i]\n if w > cap\n return 0\n end\n v += mult * val[i]\n end\n return v\nend", "def optimizers\n @workers.select { |w| supported_worker?(w) }\n end", "def fit(x, _y = nil)\n x = ::Rumale::Validation.check_convert_sample_array(x)\n\n n_features = x.shape[1]\n @n_output_features = 1\n @params[:degree].times do |t|\n @n_output_features += Array.new(n_features) { |n| n }.repeated_combination(t + 1).size\n end\n self\n end", "def fittest\n min\n end", "def estimations\n all_estimations = []\n\n self.pupils.each do |p|\n all_estimations << p.estimations\n end\n\n all_estimations.flatten\n end", "def calculate(options={})\n options = { op_ids: operator_ids, req_types: REQ_TYPES }.merge(options)\n options[:req_type] = [options[:req_type]] if !options[:req_type].is_a? Array\n\n options[:op_ids].each do |operator_id|\n puts \"operator: #{operator_id}\"\n options[:req_types].each do |req_type|\n puts \" req_type: #{req_type}\"\n zone_ids = extract_zone_ids(operator_id)\n get_subset_sizes(zone_ids).each do |subset_size|\n puts \" zone combination of #{subset_size}...\"\n zone_ids.combination(subset_size).each do |zone_set|\n min = net_residual_demand(operator_id, req_type, zone_set)\n if block_given?\n yield(operator_id, req_type, zone_set, min)\n else\n @results.add(operator: operator_id, req_type: req_type, zone_set: zone_set, yarray: min)\n end\n end\n end\n end\n end\n end", "def make_fit(vals)\n return vals if vals.size < SPARK_WIDTH\n\n vals << vals.last if vals.size.odd?\n ret = vals.each_slice(2).with_object([]) { |s, a| a << (s.sum / 2) }\n make_fit(ret)\n end", "def fitness()\n return @fitness if @fitness\n\n raise \"inside fitness even though defined and not nill\" if @fitness\n\n last_token = @data[0]\n cost = 0\n\n @data[1..-1].each do |token|\n cost += @@costs[last_token][token]\n last_token = token\n end\n\n @fitness = -1 * cost\n\n return @fitness.to_f\n end", "def compute_best\n best = @population.max_by { |x| x.fitness(@target) }\n @finished = true if best.fitness(@target) == @perfect_score\n best.phrase\n end", "def compute_best\n best = @population.max_by { |x| x.fitness(@target) }\n @finished = true if best.fitness(@target) == @perfect_score\n best.phrase\n end", "def run_experiment_set(options)\n\n\tset = options[:set ] or raise ArgumentError\n\trun_count = options[:run_count] or raise ArgumentError\n\tbasename = options[:basename ] or raise ArgumentError\n\n\tgenome_ids = set[:genomes]\n\tsearch_ids = set[:searchs]\n\n\tdefinition = {\n\t\t:genomes => Hash[genome_ids.zip(genome_ids.collect{ |id| $genomes[id] })],\n\t\t:searchs => Hash[search_ids.zip(search_ids.collect{ |id| $searchs[id] })],\n\t\t:experiments => set[:experiments]\n\t}\n\n\t# initialise overall result file content\n\tdata = {}\n\tdata[:run_count ] = run_count\n\tdata[:definition] = definition\n\n\t# generate individual experiments\n\tcombinations = []\n\tcombinations_index = []\n\tdefinition[:experiments].each do |eid|\n\t\tdefinition[:searchs].each do |sid, s|\n\t\t\tdefinition[:genomes].each do |gid, g|\n\t\t\t\tcombinations << {\n\t\t\t\t\t:experiment => $experiments[eid],\n\t\t\t\t\t:genome_init => GenomeInitFactory.from_definition(g),\n\t\t\t\t\t:search_init => MetaheuristicInitFactory.from_definition(s)\n\t\t\t\t}\n\n\t\t\t\tcombinations_index << {\n\t\t\t\t\t:experiment => eid,\n\t\t\t\t\t:genome_init => gid,\n\t\t\t\t\t:search_init => sid\n\t\t\t\t}\n\t\t\tend\n\t\tend\n\tend\n\n\t#\tfor each combination of genome, search, and experiment\n#\tcombinations_result = combinations.threadify(CPU_COUNT) do |c|\n\n\texperiment_id = Time.now.to_i.to_s\n\n\tcombinations_result = combinations.collect do |c|\n\t\t\n\t log_id_string = c.__id__.to_s\n\n\t\texperiment = c[:experiment ] # experiment\n\t\tgenome_init = c[:genome_init] # genome_init\n\t\tsearch_init = c[:search_init] # search_init\n\n\t\tevaluator_init = experiment[:evaluator_block_init] # evaluator_init\n\t\tevaluations_max = experiment[:evaluations_max] # evaluations_max \n\t\tfitness_max = experiment[:fitness_max ] # fitness_max\n\t\tinput_count = experiment[:input_count ] # input_count\n\t\toutput_count = experiment[:output_count ] # output_count\n\n\t\t# each run\n\t\tc_results = (0...run_count).to_a.threadify(CPU_COUNT) do |run|\n\n\t\t\t# search\n\t\t\tevaluator = evaluator_init.call\n\t\t\tsearch = search_init.call(\n\t\t\t\t:genome_init => lambda{ genome_init.call(input_count, output_count) },\n\t\t\t\t:evaluator => evaluator)\n\n\t\t\tevaluations = []\n\t\t\tfitnesses = []\n\n\t\t\thighest_fitness = nil\n\t\t\thighest_fitness_evaluation = nil\n\t\t\tevaluations_success = nil\n#\t\t\tphenotype_evaluations_success = nil\n\n\t\t\twhile search.results.evaluation < evaluations_max\n\n#\t\t\t\t$current_min_update_count = $max_update_count\n\t\t\t\tsearch.run_once\n#\t\t\t\t$max_update_count = [$max_update_count, ($current_min_update_count * 1.5).to_i].min\n\n\t\t\t\t# check new highest fitness\n\t\t\t\tresults = search.results\n\t\t\t\tbest = results.best\n\t\t\t\tif highest_fitness.nil? || best[:fitness] > highest_fitness \n\t\t\t\t\thighest_fitness = best[:fitness]\n\t\t\t\t\thighest_fitness_evaluation = best[:evaluation]\n\n\t\t\t\t\tfitnesses << highest_fitness\n\t\t\t\t\tevaluations << highest_fitness_evaluation\n\t\t\t\t\n\t\t\t\t\t# log improvement\n#\t\t\t\t\t$stdout << \"info #{log_id_string} run #{run}, generation #{search.generation}, fitness max #{highest_fitness}, pheno eval #{evaluator.phenotype_evaluations}\\n\"\n\t\t\t\t\t$stdout << \"info #{log_id_string} run #{run}, generation #{results.generation}, fitness max #{highest_fitness}\\n\"\n\t\t\t\t\tbest_genome = best[:solution]\n\t\t\t\t\tgenome_string = best_genome.to_s\n\t\t\t\t\tgenome_string.each_line do |line|\n\t\t\t\t\t\t$stdout << \"debug #{log_id_string} fittest genome #{line}\"\n\t\t\t\t\tend\n\t\t\n\t\t\t\t\tFile.open(\"output/genome-#{experiment_id}-#{log_id_string}-run_#{run.to_s.rjust(2, '0')}-eval_#{highest_fitness_evaluation.to_s.rjust(5, '0')}-fitness_#{highest_fitness.to_s.rjust(8, '0')}.yaml\", 'w+'){ |f| YAML.dump(best_genome.to_hash, f) }\n\t\t\t\t\n\t\t\t\t\t# check fitness max reached\n\t\t\t\t\tif highest_fitness == fitness_max\n\t\t\t\t\t\tevaluation_success = highest_fitness_evaluation\n#\t\t\t\t\t\tphenotype_evaluations_success = evaluator.phenotype_evaluations\n\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t# log no improvement\n#\t\t\t\t\t$stdout << \"info #{log_id_string} run #{run}, generation #{search.generation}, pheno eval #{evaluator.phenotype_evaluations}\\n\"\n\t\t\t\t\t$stdout << \"info #{log_id_string} run #{run}, generation #{results.generation}\\n\"\n\t\t\t\tend\n\t\t\t\t$stdout.flush\n\t\t\tend\n\n\t\t\t# run result\n\t\t\t{\n\t\t\t\t:combination_id => c.__id__,\n\t\t\t\t:fitnesses => fitnesses,\n\t\t\t\t:evaluations => evaluations,\n\t\t\t\t:evaluation_success => evaluation_success\n#\t\t\t\t:phenotype_evaluations => phenotype_evaluations_success\n\t\t\t}\n\t\tend\n\n\t\tc_results\n\tend\n\n\t# here we've run all combinations\n\t# fill in results hash\n\tcombination_count = combinations.size\n\n\thash = {}\n\n\tcombination_count.times do |i|\n\t\tc = combinations[ i]\n\t\tidx = combinations_index[ i]\n\t\tr = combinations_result[i]\n\n\t\th1 = (hash[idx[:experiment]] ||= {})\n\t\th2 = (h1[ idx[:genome_init]] ||= {})\n\n\t\tassert{ h2[idx[:search_init]].nil? }\n\t\th2[idx[:search_init]] = r\n\tend\n\n\tdata[:results] = hash\n\n\tfilename = \"#{Time.now.strftime('%Y%m%d-%H%M%S')}-#{experiment_id}-#{basename}.yaml\"\n\tFile.open(filename, 'w') do |f|\n\t\tYAML.dump(data, f)\n\tend\nend", "def evaluate_chromosome(chromosome)\n @num_evaluations += 1\n chromosome.fitness = @knapsack_func.call chromosome, @values, @weights, @max_weight\n end", "def evaluate_chromosome(chromosome)\n @num_evaluations += 1\n chromosome.fitness = @knapsack_func.call chromosome, @values, @weights, @max_weight\n end", "def train\n run_thresholds\n run_values_to_ranges\n run_reverse\n\n @classifiers\n end", "def compute( inputs, type, &block )\n return self.items.map {|v| v.compute( inputs, type )}.forzip(nil,&block)\n end", "def getEvaluations\n\t\tharness.evaluations\n\tend", "def selection(matingPool, totalFitness)\n matingPool.clear\n # elitism in matingPool 0\n matingPool.add(@genePool[@bestGene])\n # create roulette wheel\n @genePool.each_index do |geneID|\n fraction = @genePool[geneID].fitness.to_f / totalFitness.to_f\n n = (fraction * @genePool.size).to_i\n n.times do\n matingPool.add(@genePool[geneID]) \n end\n end\n end", "def generate_best_pairings(state)\n teams = state.teams\n\n state.matches = state.driver.matches_hash\n\n state.score_range = state.scores.values.max - state.scores.values.min\n state.average_score_difference = state.score_range / teams.length.to_f\n\n state.team_index_map = teams.map.with_index.to_h\n\n Algorithm::Matching.minimum_weight_perfect_matching(teams) do |home_team, away_team|\n cost_function(state, home_team, away_team)\n end\n end", "def fit\n #raise NotImplementedError, \"Define fit() in the inherited class.\"\n raise NotImplementedError, \"Define #{__method__}() in the inherited class.\"\n end", "def get_mixture_mpset(queries, types, weights, o = {})\n queries.map_with_index do |q,i|\n qidx = o[:qno] ? (o[:qno] - $offset) : i\n qno = o[:qno] ? o[:qno] : (i + $offset)\n #info [\"QWord\",\"Field\",types,\"=== #{i}th : #{q} ===\"].flatten.join(\"\\t\") if $o[:verbose]\n #info weights.inspect if $o[:verbose]\n flms = []\n types.each_with_index do |type, j|\n case type\n when :prior : flms << ($hlm_weight || [1.0 / $fields.size] * $fields.size)\n when :uniform : flms << [1.0 / $fields.size] * $fields.size\n when :cug : flms << get_col_freq(:prob=>true)\n when :cbg : flms << get_col_freq(:bgram=>true)\n when :rug : flms << $rsflms[qidx][1].map_hash{|k,v|[k,v.to_p]}\n when :rbg : flms << $rsflms[qidx][2].map_hash{|k,v|[k,v.to_p]}\n when :ora : flms << $rlflms1[qidx].map_hash{|k,v|[k,v.to_p]}\n when :rug2 : flms << $dflms_rs.find_all{|e|e[0] == qno}\n when :ora2 : flms << $dflms_rl.find_all{|e|e[0] == qno}\n end\n end\n get_mixture_map_prob(q, flms, types , weights, o )\n end\n end", "def group_fitness\n unless @all_persons.empty?\n @all_persons.each do |person|\n puts \"#{person}: #{person.get_energy_level}\"\n end\n end\n end", "def initialize (inMask, outMask, size, randomize)\n @wordBits = 0.size * 8 # size of a word on your machine\n @inMask = inMask\n @outMask = outMask\n @size = size # number of genes\n @inLen = @inMask.inject(0, :+) # sum the bits\n @outLen = @outMask.inject(0, :+) # sum the bits\n\n @geneLen = 2**@inLen * @outLen # length of gene needed for solution\n @bestGene = 0\n @bestFitness = 0 \n @genePool = []\n # allocate the genepool and seed it with random bits\n @size.times do |i|\n @genePool[i] = Gene.new(@geneLen)\n if randomize\n @genePool[i].numWords.times do |j|\n @genePool[i].setWord(j, rand(@genePool[i].wordMax))\n end\n end\n end\n end", "def call\n results = []\n @save.provinces.each do |id, province|\n next unless province.owner\n next if province.has_manufactory?\n\n # Could also include subjects\n next unless province.owner == @save.player_tag\n\n trade_goods = province.trade_goods\n trade_node_name = province.trade_node_name\n price = @save.trade_good_prices[trade_goods]\n trade_node = @save.trade_network[trade_node_name]\n owner_trade_share = trade_node.total_collector_share[province.owner]\n owner_trade_value = (owner_trade_share * price / 12.0).round(6)\n\n # Can't build manufactory anyway\n next if trade_goods == \"gold\" or trade_goods == \"unknown\"\n\n # This is not from the save, we recalculate estimate\n autonomy = province.effective_autonomy\n autonomy = 0 if province.estate == \"burghers\"\n usefulness = 1.0 - autonomy/100.0\n base_production_income = 1.0 * price / 12.0\n workshop_multiplier = 1.0\n workshop_multiplier = 1.5 if province.buildings.include?(\"workshop\")\n workshop_multiplier = 2.0 if province.buildings.include?(\"counting_house\")\n\n # This is multiplied by a lot of things\n # - goods produced\n # - prosperity 25%\n # - production leader 10%\n # - war exhaustion -X%\n # - nearby merchant companies +X%\n # - nearby trade companies +X%\n # - happy burgers 10%\n # - national ideas\n # - furnacess\n # - trading in coal\n # - local production efficiency\n # - workshops [TAKEN INTO ACCOUNT]\n # - production efficiency\n # - adm tech bonus 0% to 20%\n # - ahead of time adm bonus 20%\n # and maybe others, for ballpark figure picking 1.50x\n estimated_production_value = (base_production_income * workshop_multiplier * usefulness)\n estimated_production_value *= 1.50\n\n estimated_total_value = (owner_trade_value + estimated_production_value).round(6)\n\n results << [country_name(province.owner), estimated_total_value, trade_goods, id, province.name]\n results[-1] << \"[construction in progress]\" if province.construction_in_progress?\n end\n results.sort_by{|t,v,g,i,pn| [t,-v,g,i,pn]}.each do |row|\n puts row.join(\"\\t\")\n end\n end" ]
[ "0.73316866", "0.5610868", "0.55328923", "0.5483374", "0.5483374", "0.5461839", "0.542036", "0.5326921", "0.5294536", "0.5168102", "0.49848086", "0.4983288", "0.4887613", "0.48796126", "0.48698297", "0.48691118", "0.47602278", "0.47268122", "0.47265217", "0.4715118", "0.4691627", "0.4691019", "0.46865448", "0.4683396", "0.46660715", "0.46590915", "0.46571288", "0.46507743", "0.4635049", "0.46346176", "0.463079", "0.46240547", "0.46117908", "0.45886558", "0.45403412", "0.4539003", "0.45362315", "0.45015872", "0.44836777", "0.44705197", "0.44693813", "0.44680047", "0.44594577", "0.44302246", "0.44227445", "0.44209123", "0.441939", "0.44155493", "0.4403064", "0.43938154", "0.43734577", "0.43729612", "0.4363202", "0.43432724", "0.43396103", "0.43389234", "0.43384218", "0.43152955", "0.425807", "0.42370203", "0.42271796", "0.4224321", "0.4224321", "0.4218327", "0.42046228", "0.41988817", "0.41986632", "0.41986632", "0.4196147", "0.41950583", "0.41844177", "0.41754472", "0.41754472", "0.41640303", "0.41550794", "0.41496238", "0.41445693", "0.41368625", "0.41348958", "0.41347432", "0.41281673", "0.41226473", "0.41222435", "0.4116951", "0.41051355", "0.4102424", "0.4102424", "0.4101296", "0.40962768", "0.40962768", "0.409128", "0.4083393", "0.4074045", "0.40719122", "0.40709692", "0.4070171", "0.40656665", "0.4061339", "0.4051051", "0.40495443" ]
0.7254702
1
Return an action for an encoded observation The neural network is activated on the code, then its output is interpreted as a corresponding action
def action_for code output = net.activate code nans = output.isnan # this is a pretty reliable bug indicator raise "\n\n\tNaN network output!!\n\n" if nans.any? # action = output[0...6].max_index # limit to 6 actions action = output.max_index end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def action_for observation\n # TODO: continuous actions (checked at `init_env`)\n input = observation.tolist.to_a\n # TODO: probably a function generator here would be notably more efficient\n # TODO: the normalization range depends on the net's activation function!\n output = net.activate input\n begin # NaN outputs are pretty good bug indicators\n action = output.max_index\n rescue ArgumentError, Parallel::UndumpableException\n puts \"\\n\\nNaN NETWORK OUTPUT!\"\n output.map! { |out| out = -Float::INFINITY if out.nan? }\n action = output.index output.max\n end\n end", "def action( input = nil )\n\n\t\t# evaluate @code added via the constructor\n\t\teval(@code) unless @code.nil?\n\n\tend", "def output\n output = []\n neurons.each do |neuron|\n output << neuron.activation\n end\n end", "def action_interpreter(act)\n if act.class==Array\n case act[0]\n when :msg\n unless(act[1])\n @message_window.contents.clear\n else\n display_message(act[1],true)\n end\n when :@action_selector\n @action_selector.visible=act[1]\n #@message_window.width=(act[1] ? 201 : 320)\n @Actions_Counter=0\n when :@skill_selector\n @skill_selector.visible=act[1]\n @message_window.visible=!act[1]\n @Actions_Counter=0\n when :@Actions_Counter\n @Actions_Counter=act[1]\n when :@atk_index\n @atk_index=act[1]\n @Actions_Counter=0\n when :select_atk_caract\n pos=0\n actor=@actors[@actor_actions.size]\n actor.skills_set.each_index do |i|\n skill=actor.skills_set[i]\n if skill and skill.atk_class==act[1]\n pos=i\n break\n end\n end\n case pos\n when 0\n @Actions_To_DO=[:A]+@Actions_To_DO\n when 1\n @Actions_To_DO=[:RIGHT,:A]+@Actions_To_DO\n when 2\n @Actions_To_DO=[:DOWN,:A]+@Actions_To_DO\n else\n @Actions_To_DO=[:RIGHT,:DOWN,:A]+@Actions_To_DO\n end\n #>\n end\n end\n end", "def _lex_to_state_actions; end", "def _lex_to_state_actions; end", "def _lex_to_state_actions; end", "def _lex_to_state_actions; end", "def activate x\n\t\tcase @type\n\n\t\t#perceptron types\n\t\twhen :sigmoid\n\t\t\tsigmoid(x)\n\t\twhen :threshold\n\t\t\tthreshold(x)\n\t\twhen :tanh\n\t\t\ttanh(x)\n\t\twhen :none\n\t\t\tnone(x)\n\t\twhen :rectified_liniar_unit\n\t\t\trectified_liniar_unit(x)\n\t\twhen :leaky_rectified_liniar_unit\n\t\t\tleaky_rectified_liniar_unit(x)\n\t\twhen :radial_basis\n\t\t\tradial_basis(x)\n\n\t\t#I/O\n\t\twhen :input #no params\n\t\t\tnone(x)\n\t\twhen :output #no params\t\t\t\n\t\t\tnone(x)\n\t\telse\n\t\t\traise \"unknown node type: #{@type}\"\n\t\tend\n\tend", "def action(event)\n @neko.send event.target[:action]\n end", "def _lex_from_state_actions; end", "def _lex_from_state_actions; end", "def _lex_from_state_actions; end", "def _lex_from_state_actions; end", "def _lex_to_state_actions=(_arg0); end", "def _lex_to_state_actions=(_arg0); end", "def _lex_to_state_actions=(_arg0); end", "def _lex_to_state_actions=(_arg0); end", "def traversal_action(instruction)\n case\n when instruction[1] == :openassign then openassign(instruction)\n when instruction[1] == :closeassign then closeassign(instruction)\n \n when instruction[1] == :openvectordefinition then openvectordefinition(instruction)\n when instruction[1] == :closevectordefinition then closevectordefinition(instruction)\n\n when instruction[1] == :openvectorref then openvectorref(instruction)\n when instruction[1] == :closevectorref then closevectorref(instruction)\n \n when instruction[1] == :opendef then opendef(instruction)\n when instruction[1] == :openfuncbody then openfuncbody(instruction)\n when instruction[1] == :closefuncbody then closefuncbody(instruction)\n when instruction[1] == :closedef then closedef(instruction)\n\n when instruction[1] == :openfunc then openfunc(instruction)\n when instruction[1] == :closefunc then closefunc(instruction)\n\n when instruction[1] == :openaction then openaction(instruction)\n when instruction[1] == :closeaction then closeaction(instruction)\n\n when instruction[1] == :identifier then identifier(instruction)\n when instruction[1] == :int then int(instruction)\n when instruction[1] == :float then float(instruction)\n when instruction[1] == :range then range(instruction)\n when instruction[1] == :ref then ref(instruction)\n end\n end", "def action\n @action ||= calculate_action\n end", "def Action(code) # Sends a raw Action ID (see key.h)\n success?(parse(cmd(with_args(code))))\n end", "def op\n sequence[ip]\n end", "def predict(input)\n # Perform forward propagation to predict output\n \n # Activation on input nodes should simply be the input\n @activation_input[-1] = 1 # set bias node's activation to 1\n @activation_input[0..-2] = input\n \n # Compute the weighted sum into each hidden node\n @hiddenNodes.times do |x|\n s = 0.0\n @inputNodes.times do |i|\n s = s + (@activation_input[i] * @w_1[i][x])\n end\n # update activation for the hidden layer\n @activation_hidden[x] = NeuralNetwork::activation(s)\n end\n \n # Now compute the weighted sum into each output node\n @outputNodes.times do |x|\n s = 0.0\n @hiddenNodes.times do |h|\n s = s + (@activation_hidden[h] * @w_2[h][x])\n end\n # update activations for the output layer\n @activation_output[x] = NeuralNetwork::activation(s)\n end\n\n @activation_output\n\n end", "def sigmoidal(activation_value)\n\tneuron_value=1/(1 + 2.71828 ** activation_value)\n\treturn neuron_value\nend", "def action\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 5)\n return_value = ActionReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal22 = nil\n string_literal24 = nil\n __ACTION26__ = nil\n action_scope_name23 = nil\n id25 = nil\n\n tree_for_char_literal22 = nil\n tree_for_string_literal24 = nil\n tree_for_ACTION26 = nil\n stream_AT = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token AT\")\n stream_T__73 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__73\")\n stream_ACTION = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token ACTION\")\n stream_action_scope_name = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule action_scope_name\")\n stream_id = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule id\")\n begin\n # at line 127:4: '@' ( action_scope_name '::' )? id ACTION\n char_literal22 = match(AT, TOKENS_FOLLOWING_AT_IN_action_584) \n if @state.backtracking == 0\n stream_AT.add(char_literal22)\n end\n # at line 127:8: ( action_scope_name '::' )?\n alt_11 = 2\n case look_11 = @input.peek(1)\n when TOKEN_REF then look_11_1 = @input.peek(2)\n\n if (look_11_1 == T__73) \n alt_11 = 1\n end\n when RULE_REF then look_11_2 = @input.peek(2)\n\n if (look_11_2 == T__73) \n alt_11 = 1\n end\n when T__67, T__68 then alt_11 = 1\n end\n case alt_11\n when 1\n # at line 127:9: action_scope_name '::'\n @state.following.push(TOKENS_FOLLOWING_action_scope_name_IN_action_587)\n action_scope_name23 = action_scope_name\n @state.following.pop\n if @state.backtracking == 0\n stream_action_scope_name.add(action_scope_name23.tree)\n end\n string_literal24 = match(T__73, TOKENS_FOLLOWING_T__73_IN_action_589) \n if @state.backtracking == 0\n stream_T__73.add(string_literal24)\n end\n\n end\n @state.following.push(TOKENS_FOLLOWING_id_IN_action_593)\n id25 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add(id25.tree)\n end\n __ACTION26__ = match(ACTION, TOKENS_FOLLOWING_ACTION_IN_action_595) \n if @state.backtracking == 0\n stream_ACTION.add(__ACTION26__)\n end\n # AST Rewrite\n # elements: ACTION, id, action_scope_name, AT\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 # 127:44: -> ^( '@' ( action_scope_name )? id ACTION )\n # at line 127:47: ^( '@' ( action_scope_name )? id ACTION )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(stream_AT.next_node, root_1)\n\n # at line 127:53: ( action_scope_name )?\n if stream_action_scope_name.has_next?\n @adaptor.add_child(root_1, stream_action_scope_name.next_tree)\n\n end\n\n stream_action_scope_name.reset();\n @adaptor.add_child(root_1, stream_id.next_tree)\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# - - - - - - - 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__, 5)\n\n end\n \n return return_value\n end", "def expression_to_action(e)\n if atom? e\n atom_to_action e\n else\n list_to_action e\n end\n end", "def action\n @action ||= flow.execute\n end", "def action\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 5 )\n return_value = ActionReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal22 = nil\n string_literal24 = nil\n __ACTION26__ = nil\n action_scope_name23 = nil\n id25 = nil\n\n tree_for_char_literal22 = nil\n tree_for_string_literal24 = nil\n tree_for_ACTION26 = nil\n stream_AT = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token AT\" )\n stream_T__73 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__73\" )\n stream_ACTION = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token ACTION\" )\n stream_action_scope_name = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule action_scope_name\" )\n stream_id = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule id\" )\n begin\n # at line 118:4: '@' ( action_scope_name '::' )? id ACTION\n char_literal22 = match( AT, TOKENS_FOLLOWING_AT_IN_action_579 )\n if @state.backtracking == 0\n stream_AT.add( char_literal22 )\n end\n # at line 118:8: ( action_scope_name '::' )?\n alt_11 = 2\n case look_11 = @input.peek( 1 )\n when TOKEN_REF then look_11_1 = @input.peek( 2 )\n\n if ( look_11_1 == T__73 )\n alt_11 = 1\n end\n when RULE_REF then look_11_2 = @input.peek( 2 )\n\n if ( look_11_2 == T__73 )\n alt_11 = 1\n end\n when T__67, T__68 then alt_11 = 1\n end\n case alt_11\n when 1\n # at line 118:9: action_scope_name '::'\n @state.following.push( TOKENS_FOLLOWING_action_scope_name_IN_action_582 )\n action_scope_name23 = action_scope_name\n @state.following.pop\n if @state.backtracking == 0\n stream_action_scope_name.add( action_scope_name23.tree )\n end\n string_literal24 = match( T__73, TOKENS_FOLLOWING_T__73_IN_action_584 )\n if @state.backtracking == 0\n stream_T__73.add( string_literal24 )\n end\n\n end\n @state.following.push( TOKENS_FOLLOWING_id_IN_action_588 )\n id25 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add( id25.tree )\n end\n __ACTION26__ = match( ACTION, TOKENS_FOLLOWING_ACTION_IN_action_590 )\n if @state.backtracking == 0\n stream_ACTION.add( __ACTION26__ )\n end\n # AST Rewrite\n # elements: action_scope_name, ACTION, id, AT\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 # 118:44: -> ^( '@' ( action_scope_name )? id ACTION )\n # at line 118:47: ^( '@' ( action_scope_name )? id ACTION )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_AT.next_node, root_1 )\n\n # at line 118:53: ( action_scope_name )?\n if stream_action_scope_name.has_next?\n @adaptor.add_child( root_1, stream_action_scope_name.next_tree )\n\n end\n\n stream_action_scope_name.reset();\n @adaptor.add_child( root_1, stream_id.next_tree )\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# - - - - - - - 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__, 5 )\n\n end\n \n return return_value\n end", "def train(image, target_char)\n # quantize to two-color\n image = quantize_image(image)\n #image.write(filename_for_quantized_image(target_char, 'gif'))\n\n # the binary string we expect to see from the output nodes\n @target_binary_string = char_to_binary_string(target_char)\n\n # feed the image data forward through the network to obtain a result\n #\n assign_inputs image\n calculate_hidden_outputs\n calculate_final_outputs\n\n # propagate the error correction backward through the net\n #\n calculate_output_errors\n calculate_hidden_errors\n adjust_output_weights\n adjust_input_weights\n end", "def send_to_analysis\n transition_to :in_analysis\n end", "def alaram_operation action\n @state = action\n notify\nend", "def action!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 10 )\n\n type = ACTION\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 141:10: 'action'\n match( \"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__, 10 )\n\n end", "def token!\n # at line 1:8: ( T__48 | T__49 | T__50 | T__51 | T__52 | CATEGORY_KEY | LINK_KEY | X_OCCI_ATTRIBUTE_KEY | X_OCCI_LOCATION_KEY | ACTION | ACTIONS | AMPERSAND | AT | ATTRIBUTES | BACKSLASH | CATEGORY | CLASS | COLON | DASH | DOT | EQUALS | GT | HASH | KIND | LINK | LOCATION | LT | MIXIN | PERCENT | PLUS | QUESTION | QUOTE | REL | SCHEME | SELF | SEMICOLON | SLASH | SQUOTE | TERM | TILDE | TITLE | UNDERSCORE | LBRACKET | RBRACKET | LOALPHA | UPALPHA | DIGIT | WS | ESC )\n alt_5 = 49\n alt_5 = @dfa5.predict( @input )\n case alt_5\n when 1\n # at line 1:10: T__48\n t__48!\n\n when 2\n # at line 1:16: T__49\n t__49!\n\n when 3\n # at line 1:22: T__50\n t__50!\n\n when 4\n # at line 1:28: T__51\n t__51!\n\n when 5\n # at line 1:34: T__52\n t__52!\n\n when 6\n # at line 1:40: CATEGORY_KEY\n category_key!\n\n when 7\n # at line 1:53: LINK_KEY\n link_key!\n\n when 8\n # at line 1:62: X_OCCI_ATTRIBUTE_KEY\n x_occi_attribute_key!\n\n when 9\n # at line 1:83: X_OCCI_LOCATION_KEY\n x_occi_location_key!\n\n when 10\n # at line 1:103: ACTION\n action!\n\n when 11\n # at line 1:110: ACTIONS\n actions!\n\n when 12\n # at line 1:118: AMPERSAND\n ampersand!\n\n when 13\n # at line 1:128: AT\n at!\n\n when 14\n # at line 1:131: ATTRIBUTES\n attributes!\n\n when 15\n # at line 1:142: BACKSLASH\n backslash!\n\n when 16\n # at line 1:152: CATEGORY\n category!\n\n when 17\n # at line 1:161: CLASS\n class!\n\n when 18\n # at line 1:167: COLON\n colon!\n\n when 19\n # at line 1:173: DASH\n dash!\n\n when 20\n # at line 1:178: DOT\n dot!\n\n when 21\n # at line 1:182: EQUALS\n equals!\n\n when 22\n # at line 1:189: GT\n gt!\n\n when 23\n # at line 1:192: HASH\n hash!\n\n when 24\n # at line 1:197: KIND\n kind!\n\n when 25\n # at line 1:202: LINK\n link!\n\n when 26\n # at line 1:207: LOCATION\n location!\n\n when 27\n # at line 1:216: LT\n lt!\n\n when 28\n # at line 1:219: MIXIN\n mixin!\n\n when 29\n # at line 1:225: PERCENT\n percent!\n\n when 30\n # at line 1:233: PLUS\n plus!\n\n when 31\n # at line 1:238: QUESTION\n question!\n\n when 32\n # at line 1:247: QUOTE\n quote!\n\n when 33\n # at line 1:253: REL\n rel!\n\n when 34\n # at line 1:257: SCHEME\n scheme!\n\n when 35\n # at line 1:264: SELF\n self!\n\n when 36\n # at line 1:269: SEMICOLON\n semicolon!\n\n when 37\n # at line 1:279: SLASH\n slash!\n\n when 38\n # at line 1:285: SQUOTE\n squote!\n\n when 39\n # at line 1:292: TERM\n term!\n\n when 40\n # at line 1:297: TILDE\n tilde!\n\n when 41\n # at line 1:303: TITLE\n title!\n\n when 42\n # at line 1:309: UNDERSCORE\n underscore!\n\n when 43\n # at line 1:320: LBRACKET\n lbracket!\n\n when 44\n # at line 1:329: RBRACKET\n rbracket!\n\n when 45\n # at line 1:338: LOALPHA\n loalpha!\n\n when 46\n # at line 1:346: UPALPHA\n upalpha!\n\n when 47\n # at line 1:354: DIGIT\n digit!\n\n when 48\n # at line 1:360: WS\n ws!\n\n when 49\n # at line 1:363: ESC\n esc!\n\n end\n end", "def instruction name, instruction\n end", "def xlate_action()\n return ACTION_XLATES[@action] if (ACTION_XLATES.has_key?(@action))\n return(@action.to_s) \n end", "def input(applied_action_as_symbol_or_string = :inspect)\r\n gets.send(applied_action_as_symbol_or_string)\r\nend", "def list_to_action(e)\n if atom? e\n if e == :quote\n @quote\n elsif e == :lambda\n @lambda\n elsif e == :cond\n @cond\n end\n else\n @application # -> will become a function\n end \n end", "def activation_output(w, x)\n sum = (0..@feature_count-1).inject(0.0) { |sum, i| (sum + (w[i] * x[i])) }\n ((sum + @bias) >= @theta) ? 1 : 0\nend", "def action a\n text a.name\n mnemonic a.mnemonic unless a.mnemonic.nil?\n command { a.call }\n end", "def action a\n text a.name\n mnemonic a.mnemonic unless a.mnemonic.nil?\n command { a.call }\n end", "def code_cell\r\n # Code the cell (logic in code_cell here)\r\n codings = Mx.code_cell(params)\r\n\r\n # Navigate between cells if you are in on click\r\n if @coding_mode == :one_click \r\n @position += 1\r\n if @mode == 'row'\r\n unless @chrs.length > @position\r\n notice \"You've finished one-click coding for that OTU.\"\r\n redirect_to :action => :show_otus, :id => @mx.id and return\r\n end\r\n @chr = @chrs[@position] # update the @chr, the @otu stays the same\r\n elsif @mode == 'col'\r\n unless @otus.length > @position\r\n notice \"You've finished one-click coding for that character.\"\r\n redirect_to :action => 'show_characters', :id => @mx.id and return\r\n end\r\n @otu = @otus[@position] # update the @otu, the @chr stays the same\r\n else\r\n raise\r\n end\r\n end\r\n\r\n # TODO: This really is not optimal, because we have to laod all the variables again\r\n # Ideally (in the AJAX call here) we'd just render the template 'mxes/code/code' without the redirect\r\n # If we get here in a standard POST we'd get a :code_cell action in the URL/browser using a render :template, which we don't want\r\n redirect_to code_mx_path(@proj, @mx, @mode, @position, @chr, @otu) \r\n end", "def _lex_from_state_actions=(_arg0); end", "def _lex_from_state_actions=(_arg0); end", "def _lex_from_state_actions=(_arg0); end", "def _lex_from_state_actions=(_arg0); end", "def WorkflowAction(input, workflow, &block) # rubocop:disable Naming/MethodName\n workflow_id = PowerConverter.convert_to_sipity_workflow_id(workflow)\n\n result = case input\n when WorkflowAction\n input if input.workflow_id == workflow_id\n when String, Symbol\n WorkflowAction.find_by(workflow_id: workflow_id, name: input.to_s)\n end\n\n handle_conversion(input, result, :to_sipity_action, &block)\n end", "def action\n Actions[ self[:action] ]\n end", "def evaluate\n @output_value = Math.tanh(@input_value - @bias)\n #p \"output value #{@output_value}\"\n @forward_nodes.each do |node, weight|\n #p \"weight #{weight} old input #{node.input_value}\"\n node.input_value += @output_value * weight\n #p \"new input #{node.input_value}\"\n end\n @input_value = 0\n end", "def activation_function(value)\n Math.tanh(value)\n end", "def show\n respond_to do |format|\n format.html { render :show }\n format.text do\n data = LuaScript::Dumper.dump_with_func('actionstate', @action_state.for_lua).encode('Shift_JIS')\n name = @action_state.chara + '.lua'\n send_data(data, filename: name)\n end\n end\n end", "def perform_transition(tensor, input, _next_evaluator, execution_context)\n cache_key = \"#{tensor.graph.object_id}_#{input.name}:#{object_id}\"\n return @context[:_cache][cache_key] if @context[:_cache].key?(cache_key)\n\n result = @session.delegate_to_evaluator(input, @context, execution_context)\n convert_from_buffer(input, result).tap do |buffer|\n @context[:_cache][cache_key] = buffer if input.is_const\n end\n end", "def atom_to_action(e)\n if number? e || @@consts.include?(e)\n @const\n else\n @identifier\n end\n end", "def translate\n @actions.each do |a|\n self.send(:\"parse_#{a['type'].gsub('-','_')}\", a)\n end\n @output = @output.split(\"\\n\").collect {|l| l.strip}.join(\"\\n\")\n end", "def show\n if(params[:algorithm]==\"fibonacci\")\n @output = @algorithm[:output]\n redirect_to controller: 'welcome', action: 'interview_prep', locals: {output: @output}\n end\n end", "def to_proc\n @action\n end", "def code(response=false)\n output = self.topic.code\n unless output == \"\"\n next_exercise = topic.exercises.first\n while next_exercise != self\n snippet = next_exercise.simplified(next_exercise.response)\n output = insert_code(snippet, next_exercise.insert, output)\n next_exercise = next_exercise.lower_item\n end\n if response\n output = insert_code(response,self.insert,output)\n end\n end\n return output\n end", "def output\n return nil if input_wires.any?\n\n case gate\n when \"AND\"\n values[0] & values[1]\n when \"OR\"\n values[0] | values[1]\n when \"NOT\"\n ~values[0]\n when \"LSHIFT\"\n values[0] << values[1]\n when \"RSHIFT\"\n values[0] >> values[1]\n else\n values[0]\n end\n end", "def execute()\n create_amplifiers()\n i = 0\n j = 0\n\n until @intcode[@amplifiers[i][:pointer]] == STOP_CODE\n\n instruction = @amplifiers[i][:intcode][@amplifiers[i][:pointer]].digits\n\n parameters = InstructionParameters.new.identify(\n instruction,\n @amplifiers[i][:pointer],\n @amplifiers[i][:intcode]\n )\n\n results = IntcodeInstructions.new.execute(instruction[0],@amplifiers[i][:pointer],@amplifiers[i][:intcode],parameters)\n\n @amplifiers[i][:intcode] = results[:intcode]\n\n @amplifiers[i][:pointer] = results[:pointer]\n\n if instruction[0] == 3\n @amplifiers[i][:intcode][parameters[0]] = @signals[j]\n elsif instruction[0] == 4\n #@signals.push(@amplifiers[i][:intcode][parameters[0]])\n puts parameters[0]\n i += 1\n j += 1\n end\n\n i = 0 if i == @amplifiers.length\n\n end\n\n\n puts @signals\n end", "def respond_to(inputs, activation_fn=Network::ACTIVATION_FN)\r\n outputs = Matrix.column_vector inputs\r\n net = nil\r\n @layers.each do |layer|\r\n inputs = outputs\r\n outputs, net = activate_layer(inputs, layer, activation_fn)\r\n end\r\n # Return outputs as a flattened array.\r\n return *convert(outputs)#, net.to_a.flatten\r\n end", "def rule_action\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 11)\n return_value = RuleActionReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal55 = nil\n __ACTION57__ = nil\n id56 = nil\n\n tree_for_char_literal55 = nil\n tree_for_ACTION57 = nil\n stream_AT = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token AT\")\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 178:4: '@' id ACTION\n char_literal55 = match(AT, TOKENS_FOLLOWING_AT_IN_rule_action_979) \n if @state.backtracking == 0\n stream_AT.add(char_literal55)\n end\n @state.following.push(TOKENS_FOLLOWING_id_IN_rule_action_981)\n id56 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add(id56.tree)\n end\n __ACTION57__ = match(ACTION, TOKENS_FOLLOWING_ACTION_IN_rule_action_983) \n if @state.backtracking == 0\n stream_ACTION.add(__ACTION57__)\n end\n # AST Rewrite\n # elements: AT, id, 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 # 178:18: -> ^( '@' id ACTION )\n # at line 178:21: ^( '@' id ACTION )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(stream_AT.next_node, root_1)\n\n @adaptor.add_child(root_1, stream_id.next_tree)\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# - - - - - - - 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__, 11)\n\n end\n \n return return_value\n end", "def instructions\n \n end", "def feedforward(val)\n @output = val * weight # Compute output\n @sender = a.origin # Start animation at originating neuron\n @sending = true # Turn on sending\n end", "def collect_predifined_actions(curr_smazzata, name)\r\n @action_queue = []\r\n curr_smazzata[:actions].each do |action|\r\n if action[:arg][0] == name\r\n @action_queue << ({:type => action[:type], :arg => action[:arg]})\r\n else\r\n #p action\r\n # action not for the algorithm player\r\n end\r\n end\r\n end", "def processing_instruction(data)\n end", "def action_do(action)\n\t\tif action == \"a\"\n\t\t\tself.search_weapon\n\t\telsif action == \"s\"\n\t\t\tself.search_health_pack\n\t\telsif action == \"0\"\n\t\t\tself.attacks(@@ennemis[action.to_i])\n\t\telsif action == \"1\"\n\t\t\tself.attacks(@@ennemis[action.to_i])\n\t\tend\n\t\tputs \"\"\t\t\n\tend", "def activation_system(input)\n b = input\n\n a = b | 65536\n b = 13159625\n\n while a > 0\n b += a & 255\n b &= 16777215\n\n b *= 65899\n b &= 16777215\n\n a /= 256\n end\n\n b\nend", "def action\n play_decision_se\n send(ACTION_LIST[@image_indexes[@index]])\n end", "def action\n \treturn self[:action].to_sym\n \n end", "def code_action_provider\n attributes.fetch(:codeActionProvider)\n end", "def instruction\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n value = nil\n instruction_start_index = @input.index\n put_ingredient_into_mixing_bowl1 = nil\n liquefy_mixing_bowl2 = nil\n pour_contents_into_baking_dish3 = nil\n fold_ingredient_into_mixing_bowl4 = nil\n clean_the_mixing_bowl5 = nil\n take_ingredient_from_refrigerator6 = nil\n remove_ingredient_from_mixing_bowl7 = nil\n refrigerate_for_hours8 = nil\n add_ingredient_to_mixing_bowl9 = nil\n serve_with10 = nil\n mix_the_mixing_bowl_well11 = nil\n combine_ingredient_into_mixing_bowl12 = nil\n stir_mixing_bowl13 = nil\n stir_ingredient_into_the_mixing_bowl14 = nil\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 value\n end\n # at line 36:3: ( put_ingredient_into_mixing_bowl | liquefy_mixing_bowl | pour_contents_into_baking_dish | fold_ingredient_into_mixing_bowl | clean_the_mixing_bowl | take_ingredient_from_refrigerator | remove_ingredient_from_mixing_bowl | refrigerate_for_hours | add_ingredient_to_mixing_bowl | serve_with | set_aside | mix_the_mixing_bowl_well | combine_ingredient_into_mixing_bowl | divide_ingredient_into_mixing_bowl | stir_mixing_bowl | stir_ingredient_into_the_mixing_bowl )\n alt_1 = 16\n alt_1 = @dfa1.predict( @input )\n case alt_1\n when 1\n # at line 36:5: put_ingredient_into_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_put_ingredient_into_mixing_bowl_IN_instruction_83 )\n put_ingredient_into_mixing_bowl1 = put_ingredient_into_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = put_ingredient_into_mixing_bowl1\n \n # <-- action\n end\n\n when 2\n # at line 39:5: liquefy_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_liquefy_mixing_bowl_IN_instruction_91 )\n liquefy_mixing_bowl2 = liquefy_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = liquefy_mixing_bowl2\n \n # <-- action\n end\n\n when 3\n # at line 42:5: pour_contents_into_baking_dish\n @state.following.push( TOKENS_FOLLOWING_pour_contents_into_baking_dish_IN_instruction_99 )\n pour_contents_into_baking_dish3 = pour_contents_into_baking_dish\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = pour_contents_into_baking_dish3\n \n # <-- action\n end\n\n when 4\n # at line 45:5: fold_ingredient_into_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_fold_ingredient_into_mixing_bowl_IN_instruction_107 )\n fold_ingredient_into_mixing_bowl4 = fold_ingredient_into_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = fold_ingredient_into_mixing_bowl4\n \n # <-- action\n end\n\n when 5\n # at line 48:5: clean_the_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_clean_the_mixing_bowl_IN_instruction_115 )\n clean_the_mixing_bowl5 = clean_the_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = clean_the_mixing_bowl5\n \n # <-- action\n end\n\n when 6\n # at line 51:5: take_ingredient_from_refrigerator\n @state.following.push( TOKENS_FOLLOWING_take_ingredient_from_refrigerator_IN_instruction_123 )\n take_ingredient_from_refrigerator6 = take_ingredient_from_refrigerator\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = take_ingredient_from_refrigerator6\n \n # <-- action\n end\n\n when 7\n # at line 54:5: remove_ingredient_from_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_remove_ingredient_from_mixing_bowl_IN_instruction_131 )\n remove_ingredient_from_mixing_bowl7 = remove_ingredient_from_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = remove_ingredient_from_mixing_bowl7\n \n # <-- action\n end\n\n when 8\n # at line 57:5: refrigerate_for_hours\n @state.following.push( TOKENS_FOLLOWING_refrigerate_for_hours_IN_instruction_139 )\n refrigerate_for_hours8 = refrigerate_for_hours\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = refrigerate_for_hours8\n \n # <-- action\n end\n\n when 9\n # at line 60:5: add_ingredient_to_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_add_ingredient_to_mixing_bowl_IN_instruction_147 )\n add_ingredient_to_mixing_bowl9 = add_ingredient_to_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = add_ingredient_to_mixing_bowl9\n \n # <-- action\n end\n\n when 10\n # at line 63:5: serve_with\n @state.following.push( TOKENS_FOLLOWING_serve_with_IN_instruction_155 )\n serve_with10 = serve_with\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = serve_with10\n \n # <-- action\n end\n\n when 11\n # at line 66:5: set_aside\n @state.following.push( TOKENS_FOLLOWING_set_aside_IN_instruction_163 )\n set_aside\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = $serve_with.value\n \n # <-- action\n end\n\n when 12\n # at line 69:5: mix_the_mixing_bowl_well\n @state.following.push( TOKENS_FOLLOWING_mix_the_mixing_bowl_well_IN_instruction_171 )\n mix_the_mixing_bowl_well11 = mix_the_mixing_bowl_well\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = mix_the_mixing_bowl_well11\n \n # <-- action\n end\n\n when 13\n # at line 72:5: combine_ingredient_into_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_combine_ingredient_into_mixing_bowl_IN_instruction_179 )\n combine_ingredient_into_mixing_bowl12 = combine_ingredient_into_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = combine_ingredient_into_mixing_bowl12\n \n # <-- action\n end\n\n when 14\n # at line 75:5: divide_ingredient_into_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_divide_ingredient_into_mixing_bowl_IN_instruction_187 )\n divide_ingredient_into_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = $stir_ingredient_into_the_mixing_bowl.value\n \n # <-- action\n end\n\n when 15\n # at line 78:5: stir_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_stir_mixing_bowl_IN_instruction_195 )\n stir_mixing_bowl13 = stir_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = stir_mixing_bowl13\n \n # <-- action\n end\n\n when 16\n # at line 81:5: stir_ingredient_into_the_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_stir_ingredient_into_the_mixing_bowl_IN_instruction_203 )\n stir_ingredient_into_the_mixing_bowl14 = stir_ingredient_into_the_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = stir_ingredient_into_the_mixing_bowl14\n \n # <-- action\n end\n\n end\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__, 1 )\n memoize( __method__, instruction_start_index, success ) if @state.backtracking > 0\n\n end\n \n return value\n end", "def actions() ; info[:actions] ; end", "def actions() ; info[:actions] ; end", "def actionPerformed(actionEvent)\n #puts actionEvent.getSource.getAction.snippet.code\n end", "def opcode\n @instruction.opcode\n end", "def action\n ::HubEdos::Common::Reference::Descriptor.new(@data['action']) if @data['action']\n end", "def action!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 51)\n\n type = ACTION\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 547:4: NESTED_ACTION ( '?' )?\n nested_action!\n # at line 547:18: ( '?' )?\n alt_12 = 2\n look_12_0 = @input.peek(1)\n\n if (look_12_0 == ??) \n alt_12 = 1\n end\n case alt_12\n when 1\n # at line 547:20: '?'\n match(??)\n # --> action\n type = SEMPRED \n # <-- action\n\n end\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 51)\n\n end", "def processing_instruction?; end", "def processing_instruction?; end", "def category_actions\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 10 )\n array = nil\n act = nil\n next_act = nil\n # - - - - @init action - - - -\n array = Array.new\n\n begin\n # at line 84:10: ';' ( WS )? 'actions' '=' '\\\"' act= action_location ( ( WS )? next_act= action_location )* '\\\"'\n match(T__11, TOKENS_FOLLOWING_T__11_IN_category_actions_441)\n # at line 84:14: ( WS )?\n alt_16 = 2\n look_16_0 = @input.peek(1)\n\n if (look_16_0 == WS)\n alt_16 = 1\n end\n case alt_16\n when 1\n # at line 84:14: WS\n match(WS, TOKENS_FOLLOWING_WS_IN_category_actions_443)\n\n end\n match(T__20, TOKENS_FOLLOWING_T__20_IN_category_actions_446)\n match(T__13, TOKENS_FOLLOWING_T__13_IN_category_actions_448)\n match(T__14, TOKENS_FOLLOWING_T__14_IN_category_actions_450)\n @state.following.push(TOKENS_FOLLOWING_action_location_IN_category_actions_454)\n act = action_location\n @state.following.pop\n # --> action\n array << (act && @input.to_s(act.start, act.stop))\n # <-- action\n # at line 85:10: ( ( WS )? next_act= action_location )*\n while true # decision 18\n alt_18 = 2\n look_18_0 = @input.peek(1)\n\n if (look_18_0.between?(WS, DIGIT) || look_18_0 == T__10 || look_18_0 == T__13 || look_18_0.between?(T__28, T__42))\n alt_18 = 1\n\n end\n case alt_18\n when 1\n # at line 85:12: ( WS )? next_act= action_location\n # at line 85:12: ( WS )?\n alt_17 = 2\n look_17_0 = @input.peek(1)\n\n if (look_17_0 == WS)\n alt_17 = 1\n end\n case alt_17\n when 1\n # at line 85:12: WS\n match(WS, TOKENS_FOLLOWING_WS_IN_category_actions_470)\n\n end\n @state.following.push(TOKENS_FOLLOWING_action_location_IN_category_actions_475)\n next_act = action_location\n @state.following.pop\n # --> action\n array << (next_act && @input.to_s(next_act.start, next_act.stop))\n # <-- action\n\n else\n break # out of loop for decision 18\n end\n end # loop for decision 18\n match(T__14, TOKENS_FOLLOWING_T__14_IN_category_actions_482)\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__, 10 )\n\n end\n\n return array\n end", "def action_a\n $game_system.se_play($data_system.decision_se)\n scene = GamePlay::Skill_Learn.new(@pokemon, @ui.learnable_skills[@index].id)\n scene.main\n if scene.learnt\n @return_data = true\n @running = false\n else\n Graphics.transition\n end\n end", "def code\n @code\n end", "def code\n @code\n end", "def send_act(conn, act)\r\n conn.respond(Yajl::Encoder.encode(act))\r\n end", "def code\n @code\n end", "def code\n @code\n end", "def _lex_trans_actions; end", "def _lex_trans_actions; end", "def _lex_trans_actions; end", "def _lex_trans_actions; end", "def rule_action\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n return_value = RuleActionReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal55 = nil\n __ACTION57__ = nil\n id56 = nil\n\n tree_for_char_literal55 = nil\n tree_for_ACTION57 = nil\n stream_AT = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token AT\" )\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 169:4: '@' id ACTION\n char_literal55 = match( AT, TOKENS_FOLLOWING_AT_IN_rule_action_974 )\n if @state.backtracking == 0\n stream_AT.add( char_literal55 )\n end\n @state.following.push( TOKENS_FOLLOWING_id_IN_rule_action_976 )\n id56 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add( id56.tree )\n end\n __ACTION57__ = match( ACTION, TOKENS_FOLLOWING_ACTION_IN_rule_action_978 )\n if @state.backtracking == 0\n stream_ACTION.add( __ACTION57__ )\n end\n # AST Rewrite\n # elements: ACTION, id, AT\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 # 169:18: -> ^( '@' id ACTION )\n # at line 169:21: ^( '@' id ACTION )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_AT.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_id.next_tree )\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# - - - - - - - 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__, 11 )\n\n end\n \n return return_value\n end", "def op_code\n 2004\n end", "def cfn_action(action)\n @task.actions[:cfn] = action\n end", "def act(char, x, y)\n if @map[x,y] && @map[x,y].action\n $log.debug(\"Action: #{@map[x,y].action}\") if $log\n self.send(@map[x,y].action, char)\n end\n end", "def show\n win_prediction\n end", "def output(n)\n out = Output.new(self)\n out.code(n.to_s.upcase) unless n.nil?\n out\n end", "def number_to_action(number)\n code = number.to_i.to_s(26).tr('0-9a-q', 'a-z')\n \"action_#{code}\"\nend", "def code\n @code\n end", "def token!\n # at line 1:8: ( STRING | SHELL_STRING | CMD_OUTPUT | SPACE | COMMAND_END | VARIABLE | GLOB | CHUNK | OPEN_PAR | CLOSE_PAR | PIPELINE_OPERATOR | REDIRECT | COMMENT )\n alt_25 = 13\n alt_25 = @dfa25.predict( @input )\n case alt_25\n when 1\n # at line 1:10: STRING\n string!\n\n when 2\n # at line 1:17: SHELL_STRING\n shell_string!\n\n when 3\n # at line 1:30: CMD_OUTPUT\n cmd_output!\n\n when 4\n # at line 1:41: SPACE\n space!\n\n when 5\n # at line 1:47: COMMAND_END\n command_end!\n\n when 6\n # at line 1:59: VARIABLE\n variable!\n\n when 7\n # at line 1:68: GLOB\n glob!\n\n when 8\n # at line 1:73: CHUNK\n chunk!\n\n when 9\n # at line 1:79: OPEN_PAR\n open_par!\n\n when 10\n # at line 1:88: CLOSE_PAR\n close_par!\n\n when 11\n # at line 1:98: PIPELINE_OPERATOR\n pipeline_operator!\n\n when 12\n # at line 1:116: REDIRECT\n redirect!\n\n when 13\n # at line 1:125: COMMENT\n comment!\n\n end\n end", "def action\n @attributes[:action]\n end", "def action\n @attributes[:action]\n end" ]
[ "0.73423195", "0.6029049", "0.57453024", "0.56295407", "0.55935466", "0.55935466", "0.55935466", "0.55935466", "0.5586722", "0.535108", "0.53325653", "0.53325653", "0.53325653", "0.53325653", "0.5329259", "0.5329259", "0.5329259", "0.5329259", "0.53101176", "0.5266695", "0.5259595", "0.521097", "0.5209648", "0.51824623", "0.5165117", "0.5147622", "0.5139729", "0.5114711", "0.50889117", "0.5084322", "0.50799406", "0.5068833", "0.5063003", "0.5062278", "0.5055745", "0.5050732", "0.5048567", "0.5040624", "0.5019104", "0.5019104", "0.5013088", "0.49883118", "0.49883118", "0.49883118", "0.49883118", "0.49848115", "0.49820057", "0.49811497", "0.4977156", "0.4973057", "0.495553", "0.49496827", "0.4919668", "0.4918613", "0.49128312", "0.48933524", "0.48914075", "0.48909745", "0.48868954", "0.48785713", "0.486211", "0.4862046", "0.4861454", "0.4858445", "0.48517212", "0.48437783", "0.4840353", "0.48356497", "0.483557", "0.4831086", "0.48255432", "0.48255432", "0.48249835", "0.4818123", "0.4813473", "0.48103064", "0.4806938", "0.4806938", "0.48026595", "0.48021066", "0.47958264", "0.47958264", "0.47957504", "0.47955713", "0.47955713", "0.47857073", "0.47857073", "0.47857073", "0.47857073", "0.47823206", "0.47804174", "0.4770082", "0.4766976", "0.47479424", "0.47462115", "0.4743708", "0.47429046", "0.47379377", "0.47363213", "0.47363213" ]
0.7457633
0
Save experiment current state to file
def dump fname="dumps/atari_#{Time.now.strftime '%y%m%d_%H%M'}.bin" raise NotImplementedError, "doesn't work with BDNES atm" if config[:opt][:type] == :BDNES File.open(fname, 'wb') do |f| Marshal.dump( { config: config, best: opt.best.last, mu: opt.mu, sigma: opt.sigma, centrs: compr.centrs }, f) end puts "Experiment data dumped to `#{fname}`" true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_state file=nil\n App.out.write_text_files file\nend", "def save file='GOL.sav'\n File.open(file,'w') do |f|\n Marshal.dump(state,f)\n end\n end", "def save_state_if_changed\n data = ''\n @state_mutex.synchronize do\n return if @current_version == @saved_version\n data = serialize\n @saved_version = @current_version\n @last_save_time = Time.now.to_f\n end\n\n @logger.info(\"Writing state at version #@saved_version to #@state_file\")\n tmpfile = @state_file + '.tmp'\n File.open(tmpfile, File::CREAT|File::EXCL|File::RDWR, 0600) do |f|\n f.write(data)\n end\n File.rename(tmpfile, @state_file)\n end", "def save_states(fname)\n raise \"assertion failed: @optimizer.nil?\" if @optimizer.nil?\n if @update_on_kvstore\n @kvstore.save_optimizer_states(fname, dump_optimizer: true)\n else\n IO.binwrite(fname, @updaters[0].get_states(dump_optimizer: true))\n end\n end", "def save\n unless @changed\n $log.debug 'Not saving state, nothing changed'\n return\n end\n statefile_filename = state_filename\n $log.debug \"Saving state to #{statefile_filename}\"\n File.open(statefile_filename, 'w') do |file|\n file.puts state.to_yaml\n end\n @changed = false\n end", "def save\n dump = Marshal.dump(self)\n file = File.new(FILENAME, 'w')\n file = Zlib::GzipWriter.new(file)\n file.write(dump)\n file.close\n puts \"Bot state saved.\"\n end", "def write_state\n logger.info \"Writing state back to #{configuration.state_file}\" do\n @run_context.write_state!\n end\n end", "def save_state\n @refused['size'] = @auth_log.size\n IO.write(state_file, Psych.to_json(@refused))\n end", "def save\n File.open(SaveLocation, 'w') do |file|\n file.puts @value.join(\"\")\n file.puts @progress.join(\"\")\n file.puts @bad_guesses.join(\"\")\n end\n end", "def save_state\n json_object = { :secret_word => @secret_word, :display_content => @display_content,\n \t :failed_attemps => @failed_attemps }.to_json\n File.open(\"saved_state.json\", \"w\") { |file| file.write(json_object) }\n end", "def write_out_state\n if @options[:out_file]\n filename = @options[:out_file]\n else\n filename = @tmp_state\n end\n @log.debug \"Writing out state into #{filename}\"\n File.open(filename,'w') do |f|\n f.puts YAML.dump(@results)\n end\n end", "def save # :nodoc:\n if @file\n File.open(SAVE_FILE, 'w') do |f|\n Marshal.dump(file, f)\n end\n else\n forget\n end\n end", "def save # :nodoc:\n if @file\n File.open(SAVE_FILE, 'w') do |f|\n Marshal.dump(file, f)\n end\n else\n forget\n end\n end", "def save\n @saved = @state\n end", "def save\n save_to_file(@output_file, @contents)\n end", "def save_state\n return unless @state_writer\n\n @state_writer.call(@state)\n end", "def save\n if file\n # Ensure the current store has been loaded before we try to re-write it, this\n # is necessary if the program generator has crashed before creating a test\n store\n p = Pathname.new(file)\n FileUtils.mkdir_p(p.dirname)\n File.open(p, 'w') { |f| f.puts JSON.pretty_generate(store) }\n end\n end", "def save_state\n # start will al state to be saved\n state_to_save = { 'startup_tags' => startup_tags,\n 'reboot' => reboot?,\n 'log_level' => log_level }\n\n # only save a log file one is defined\n if log_file\n state_to_save['log_file'] = log_file\n end\n\n # only save persist the fact we downloaded cookbooks if we are in dev mode\n if download_once?\n state_to_save['has_downloaded_cookbooks'] = has_downloaded_cookbooks?\n end\n\n RightScale::JsonUtilities::write_json(RightScale::CookState::STATE_FILE, state_to_save)\n true\n end", "def save\n File.open(@test_name, \"w+\") do |file|\n file.write(render)\n end\n end", "def save_file\r\n @saved = true\r\n saving\r\n Dir.mkdir(\"saves\") unless Dir.exists? \"saves\"\r\n File.open(\"my_save.yaml\", \"w\") {|f| f.puts YAML::dump(self) }\r\n end", "def save\n File.open(file, 'w') do |f|\n self.attributes.each {|key, value| f.write \"#{key}: '#{value}'\\n\" }\n end\n end", "def write_state; end", "def write_state; end", "def save\n File.open(@file, 'w') do |file|\n file.write(Psych.dump(@params))\n end\n @saved = true\n end", "def save_state()\n server_hash = @server_manager.get_server_hash(@servers)\n\n File.open(@data_path,\"w\") do |f|\n f.write(server_hash.to_json)\n end\n end", "def save!\n File.open(@config[\"state_file\"], \"r\") do |fl|\n fl.flock(File::LOCK_EX)\n\n sequence = (@state.key?(\"sequence\") ? @state[\"sequence\"] + 1 : 0)\n data_file = @config[\"data_dir\"] + format(\"/%03d/%03d/%03d.osm.gz\", sequence / 1000000, (sequence / 1000) % 1000, (sequence % 1000))\n tmp_state = @config[\"state_file\"] + \".tmp\"\n tmp_data = \"/tmp/changeset_data.osm.tmp\"\n # try and write the files to tmp locations and then\n # move them into place later, to avoid in-progress\n # clashes, or people seeing incomplete files.\n begin\n FileUtils.mkdir_p(File.dirname(data_file))\n Zlib::GzipWriter.open(tmp_data) do |fh|\n fh.write(changeset_dump(open_changesets))\n end\n @state[\"sequence\"] = sequence\n File.open(tmp_state, \"w\") do |fh|\n fh.write(YAML.dump(@state))\n end\n\n # sanity check: the files we're moving into place\n # should be non-empty.\n raise \"Temporary gzip file should exist, but doesn't.\" unless File.exist?(tmp_data)\n raise \"Temporary state file should exist, but doesn't.\" unless File.exist?(tmp_state)\n raise \"Temporary gzip file should be non-empty, but isn't.\" if File.zero?(tmp_data)\n raise \"Temporary state file should be non-empty, but isn't.\" if File.zero?(tmp_state)\n\n FileUtils.mv(tmp_data, data_file)\n FileUtils.mv(tmp_state, @config[\"state_file\"])\n fl.flock(File::LOCK_UN)\n\n rescue\n STDERR.puts(\"Error! Couldn't update state.\")\n fl.flock(File::LOCK_UN)\n raise\n end\n end\n end", "def save\n file_name = ask_save_file\n save_file = File.open(file_name, 'w')\n save_file.puts(serialize)\n save_file.close\n puts \"Game has been saved to Save File #{file_name[-5]}!\"\n puts \"\\n\\n\"\n end", "def save!; File.write @path, @data end", "def save!\n begin\n case filename\n when STDOUT_FLAG\n $stdout.write(contents)\n else\n ::File.open(@filename,\"w\") do |f|\n f.write(contents)\n end\n end\n @dirty = false\n rescue => e\n raise FileAccessError, \"Error saving file #{@filename} : #{e.message}\"\n end\n end", "def state_out(path:)\n add option: \"-state-out=#{path}\"\n end", "def save_game\n Dir.mkdir(\"../saves\") unless Dir.exists?(\"../saves\")\n @@save_count += 1\n binding.pry\n log_saves\n savefile = \"../saves/save_#{@@save_count}.yml\"\n File.open(savefile, 'w') do | file |\n file.write(self.to_yaml)\n end\n end", "def save\n return if saved?\n self.saved = true\n original_path = interpolate_path(:original)\n stream.write_to(original_path)\n end", "def save_game\n\t\t# If current game was previously saved, delete the old version of current game...\n\t\tif @running_saved_game != nil\n\t\t\tover_write_data\n\t\tend\n\t\t# And add new version of current game to saved data\n\t\tFile.open(@path, 'a+') do |f|\n\t\t\t\tf.puts \"#{@word.join},#{@guess},#{@wrong_letters},#{@turn}\"\n\t\tend\n\tend", "def write()\n open(CurrentFilename, 'w'){|fp|\n Marshal.dump(@current_setting, fp)\n }\n end", "def save\n pathname.open('w') { |file| file.write(data) }\n end", "def save\n filename = Time.now.strftime(\"measures-%Y-%m-%d-%H%M%S.json\")\n dirname = \"goals/measures\"\n hash = { \"objective\" => @name}\n @outcomes.each {|o|\n hash.store(\"outcome\", o.name)\n hash.store(\"scale\", \"#{o.scale.class.name}.rb\")\n hash.store(\"baseline\", o.baseline)\n hash.store(\"baseline date\", o.baseline_date)\n hash.store(\"target\", o.target)\n hash.store(\"target date\", o.target_date)\n hash.store(\"measure\", o.last_measure.value)\n hash.store(\"measure date\", Time.now.strftime(\"%b %-d, %Y\"))\n }\n\n if !File.exists? dirname\n FileUtils.mkdir_p dirname\n end\n\n File.open(\"#{dirname}/#{filename}\",\"a\") do |f|\n f.write(JSON.pretty_generate(hash))\n f.write(\"\\n\")\n end\n end", "def log_saves \n s_log = File.open(\"../saves/log.yml\", \"w\")\n s_log.puts @@save_count\n s_log.close\n end", "def save\n ::File.open(@file, \"w\") { |file| file << self.to_hash.to_yaml }\n end", "def save_status(file_path)\n begin\n Pathname.new(file_path).open('wb') do |f|\n @saved_at = Fluent::Engine.now\n @saved_duration = @saved_at - @last_checked\n Marshal.dump({\n :counts => @counts,\n :saved_at => @saved_at,\n :saved_duration => @saved_duration,\n :aggregate => @aggregate,\n :count_key => @count_key,\n :patterns => @patterns,\n }, f)\n end\n rescue => e\n log.warn \"out_datacounter: Can't write store_file #{e.class} #{e.message}\"\n end\n end", "def save_experiment_file(filename:)\n \"Save the experiment as #{filename} in #{params[:experiment_filepath]}\"\n end", "def save_experiment_file(filename:)\n \"Save the experiment as #{filename} in #{params[:experiment_filepath]}\"\n end", "def save!\n raise Informative, 'This XCScheme object was not initialized ' \\\n 'using a file path. Use save_as instead.' unless @file_path\n File.open(@file_path, 'w') do |f|\n f.write(to_s)\n end\n end", "def save\n File.open(@base_file, \"w\") do |f|\n f.puts(JSON.pretty_generate(@config))\n end\n File.open(@completions_file, \"w\") do |f|\n f.puts(JSON.pretty_generate(@completions.to_a))\n end\n end", "def save_status(file_path)\n begin\n Pathname.new(file_path).open('wb') do |f|\n @saved_at = Fluent::Engine.now\n @saved_duration = @saved_at - @last_checked\n Marshal.dump({\n :counts => @counts,\n :matches => @matches,\n :saved_at => @saved_at,\n :saved_duration => @saved_duration,\n :regexp => @regexp,\n :exclude => @exclude,\n :input_key => @input_key,\n }, f)\n end\n rescue => e\n log.warn \"out_grepcounter: Can't write store_file #{e.class} #{e.message}\"\n end\n end", "def save_to_file\n File.open(\"results/#{seq_name}\"+\".txt\", 'w') { |file|\n \n n=1\n \n @actions.each do |a|\n file.puts a.description\n n +=1 \n end\n } \n \n end", "def save_game\n\t\tputs \"Type a name for your saved game\"\n\t\tgame_name = gets.chomp\n\t\tfilename = \"#{game_name}.txt\"\n\n\t\t ex_file = File.expand_path(\"./saved_games/#{filename}\")\n\t\t \n\t\tif File.exists?(ex_file)\n\t puts \"#{filename} exists\" #overwrite method?\n\t \n\t self.save_game\n\t else\n\t\t\tFile.open(ex_file, \"w\") do |f|\n\n\t\t\t\tf.puts YAML::dump(game_state)\n\n\t\t\t\tputs \"Your game was saved as #{filename}\" \n\t\t\tend\n\t\tend\n\tend", "def save\n File.open(path, 'w+') { |f| f.write(to_rb + \"\\n\") }\n end", "def save_seed\n File.open(cache_file, 'w') do |file|\n file.puts MultiJson.dump(@seed)\n end\n true\n end", "def save\n @filename = @filename || gen_filename\n file = File.open(File.join(@dir, @filename), 'w') { |f|\n f.puts @issue.to_yaml\n }\n end", "def save_game(game_state)\n save_file = File.open('save_game.yml', 'w')\n YAML.dump(game_state, save_file)\n save_file.close\n exit\n end", "def save_to(path); end", "def save\n file = File.new(@file,\"w+\")\n @properties.each {|key,value| file.puts \"#{key}=#{value}\\n\" }\n file.close\n end", "def save\n # Nothing in base class. This should be used to persist settings in\n # subclasses that use files.\n end", "def save\n file = File.new(@file, 'w+')\n @properties.each { |key, value| file.puts \"#{key}=#{value}\\n\" }\n end", "def persist!\n ::File.write(self.path, Marshal.dump(self))\n rescue => e\n puts e.message\n exit\n end", "def save! path\n File.open(path, 'w') do |file|\n file.write(to_s)\n end\n end", "def save_game\n store = YAML.dump(self)\n File.open('lib/saved_game.yml', 'w') do |file|\n file.puts(store)\n end\n puts 'your game has been saved!'\n end", "def save\n file_path = self.class.file_path(@save_id)\n File.open(file_path, 'w') { |file| \n bytes = file.write @items.inspect\n if bytes > 0\n puts \"saved to #{file_path}\"\n else\n puts \"save to #{file_path} failed\"\n end\n }\n end", "def save(path)\n File.open(path,\"w\"){|out| out.puts Marshal.dump(self) }\n end", "def save_output\n\n end", "def save(filename)\n File.write(filename, self.to_s)\n end", "def save\n File.open(@path, \"w\") do |file|\n Psych.dump({version: VERSION}, file)\n doc = {}\n @stats.each_pair do |article_path, article_stat|\n doc[article_path] = {\n stat: article_stat,\n related: @related[article_path] || [],\n }\n end\n Psych.dump(doc, file)\n end\n end", "def save()\n File.open(CONFIG_FILE, 'w'){ |f| f.write config.to_yaml } # Store\n end", "def save\n File.binwrite(file, JSON.pretty_generate(@cache))\n end", "def save_settings\n File.open(@path, \"w\") do |file|\n file.write @settings.to_yaml\n end\n end", "def save\n return unless @playground.collecting?\n\n connection.set_experiment_created_at @id, Time.now\n end", "def save!\n filepath.dirname.mkpath\n filepath.open( \"w\" ) do |f|\n f << YAML.dump( @entries )\n end\n clear_modified\n true\n end", "def save\n \tdata = self\n \t\n \tFile.open('store.yml','w') do |f|\n \t\tf.write(data.to_yaml)\n \tend\n \tputs data\n \tputs \"Saved!\"\n \tputs \"\"\n end", "def save_output(data)\n ::File.open(datastore['OUTFILE'], 'wb') do |f|\n f.write(data)\n print_status(\"Saved results in #{datastore['OUTFILE']}\")\n end\n end", "def save_output(data)\n ::File.open(datastore['OUTFILE'], 'wb') do |f|\n f.write(data)\n print_status(\"Saved results in #{datastore['OUTFILE']}\")\n end\n end", "def save_game\n\t\tputs \"Type a name for your saved game\"\n\t\tgame_name = gets.chomp\t\n\t\tfilename = \"#{game_name}.yml\"\n\n\t\t ex_file = File.expand_path(\"./saved_games/#{filename}\")\n\t\t \n\t\tif File.exists?(ex_file)\n\t puts \"#{filename} exists\" #overwrite method?\n\t \n\t self.save_game\n\t else\n\t\t\tFile.open(ex_file, \"w\") do |f|\n\t\t\t\tgame_state = YAML::dump(self)\n\t\t\t\tf.puts game_state\n\t\t\t\tputs \"Your game was saved as #{filename}\" \n\t\t\tend\n\t\tend\n\tend", "def save_state\n @saved_state = clone.to_hash\n @changed = {}\n end", "def save_state\n @saved_state = clone.to_hash\n @changed = {}\n end", "def save_to_file\n f = File.open(\"#{IMAGE_DATA_DIR}/#{self.id}\",\"w\")\n f.write(self.data)\n f.close\n end", "def create_save\n @save_data = {:turns => @turns,:guesses => @guesses,:secret_word => @secret_word, :hidden_word => @hidden_word}\n save = File.new(\"./lib/save.txt\", \"w+\")\n save.puts JSON::dump(save_data)\n save.close\n end", "def save\n file = File.new(@file,\"w+\")\n @properties.each {|key,value| file.puts \"#{key}=#{value}\\n\" }\nend", "def save\n now = Time.now\n\n data = {\n :id => @id,\n :desc => @desc,\n :ctime => Timestamp.dump(@ctime) || Timestamp.dump(now),\n :mtime => Timestamp.dump(now),\n :ppg_filename => @ppg_filename,\n }\n jobinfo.write(YAML.dump(data))\n end", "def handle_state_save\n # dump state\n $log.debug? && dump_state\n state.save\n rescue => save_exception\n $stderr.puts \"Error saving state, #{save_exception}\"\n end", "def save(options = {})\n save_to(@path, options)\n end", "def save_persist_state\n return unless @persist_file\n new_persist_options = {}\n BaseWorker.worker_classes.each do |worker_class|\n worker_class.each_config(@adapter_factory.worker_config_class) do |config_name, ignored_extended_worker_config_class, default_options|\n static_options = default_options.merge(@worker_options[config_name] || {})\n worker_config = self[config_name]\n hash = {}\n # Only store off the config values that are specifically different from default values or values set in the workers.yml file\n # Then updates to these values will be allowed w/o being hardcoded to an old default value.\n worker_config.bean_get_attributes do |attribute_info|\n if attribute_info.attribute[:config_item] && attribute_info.ancestry.size == 1\n param_name = attribute_info.ancestry[0].to_sym\n value = attribute_info.value\n hash[param_name] = value if static_options[param_name] != value\n end\n end\n new_persist_options[config_name] = hash unless hash.empty?\n end\n end\n if new_persist_options != @persist_options\n @persist_options = new_persist_options\n File.open(@persist_file, 'w') do |out|\n YAML.dump(@persist_options, out )\n end\n end\n end", "def save\n File.open(file_path, 'w') do |file|\n YAML.dump(data, file)\n end\n end", "def write_save_data(file)\r\n write_characters(file)\r\n write_frame(file)\r\n write_setup(file)\r\n write_data(file)\r\n end", "def save_to(path)\n (File.open(path, 'w') << to_s).close\n path\n end", "def save_to(path)\n (File.open(path, 'w') << to_s).close\n path\n end", "def save_state_when_changed\n @state_mutex.synchronize do\n loop do\n break if @current_version > @saved_version\n @logger.debug(\"Waiting for state change at version #@current_version\")\n @current_version_condition.wait @state_mutex\n end\n end\n\n # Wait a bit if we wrote the previous data recently.\n time_to_sleep = [@save_interval - (Time.now.to_f - @last_save_time), 0].max\n @logger.debug(\"Sleeping #{time_to_sleep} sec before writing state\")\n sleep(time_to_sleep)\n\n # We know that the version's changed, so this should always do a write.\n save_state_if_changed\n end", "def save\n File.write(yfile, to_yaml)\n end", "def save_data\n puts \"saving data\"\n\n File.open(generate_filename(self), \"w\") do |f|\n f.write(ostruct_to_hash(self.json).to_yaml)\n end\n end", "def save_file\n raise ArgumentError, 'Need a Path to save the file' if @path.nil?\n File.open(@path, 'w') do |f|\n f.write to_s\n end\n end", "def save\n File.open(@path, \"w\") do |f|\n f.write(JSON.pretty_generate(\n \"version\" => VERSION,\n \"reqs\" => reqs,\n ))\n end\n end", "def save_tracker_cache\n # These values should only be written if the audit has been successful!!\n # Best to write it back to a new file - then move the new file to the\n # original location (overwriting the original)\n return if @parent.ret_val == 3\n tracker_file = get_tracker_filename\n File.open(tracker_file + \".temp\", 'w') { |f|\n # First, save the initial timestamp and the current SOA serial\n f.puts(@initial_timestamp.to_s)\n f.puts(@last_soa_serial.to_s)\n # Now save the cache!!\n Status.strings.each {|s|\n status = s.downcase\n eval \"@cache.#{status}.each {|key, time|\n write_key_to_file(f, key.to_s, status, time[0], time[1])\n }\".untaint\n }\n\n }\n # Now move the .temp file over the original\n File.delete(tracker_file)\n File.rename(tracker_file+\".temp\", tracker_file)\n end", "def save!(file_path)\n File.open(file_path, \"w\") do |f|\n f.write(YAML.dump(@log))\n end\n end", "def save\n completed_achievements = []\n @data_achievements.each do |index, achievement|\n completed_achievements << index if achievement.completed?\n end\r\n \r\n File.open(SAVE_FILE, \"wb+\") do |f|\r\n f.flock File::LOCK_EX\r\n completed_achievements |= load_save(f)\n Marshal.dump(completed_achievements, f)\r\n end\n end", "def save fname, options={}\n File.open(fname,\"wb\"){ |f| f << export(options) }\n end", "def save_to_file(path)\n variables_to_save = instance_variables.reject { |v| v =~ /_proc$/ || v =~ /^@med/ }\n File.open(path, 'w') { |f| f.puts(\n variables_to_save.inject({}) { |h,n| h[n] = instance_variable_get(n); h }.to_yaml\n ) }\n end", "def save_game\n save_data = YAML::dump(self)\n puts \"Please enter a name for your save game:\"\n prompt\n @filename = gets.chomp\n File.open(\"./saved/#{@filename}\", \"w\") { |file| file.write(save_data)}\n puts \"Saved\"\n get_input\n end", "def save\n File.open(file_name, 'w') { |f| f.write config.to_yaml }\n end", "def persist\n settings = {\n area: @focus[:key]\n }\n File.open(@path, 'w') do |file|\n file.write settings.to_yaml\n end\n end", "def save_game\n puts \"=================================================\"\n puts \"\\nSaving game...\"\n filename = \"../saved_games/hangman_save.json\"\n File.open(filename, \"w\") { |file| file.puts self.serialize }\n puts \"Game Saved.\"\n puts \"\\n=================================================\"\n end", "def autosave; end", "def store_wffile\n # verify if there is actually a file to be saved\n if @file_data\n # create the WORKFLOW_STORE Folder if it does not exist\n FileUtils.mkdir_p File.join WORKFLOW_STORE, \"#{id}\"\n # create the file and write the data to the file system\n File.open(workflow_filename, 'wb') do |f|\n f.write(@file_data.read)\n end\n # ensure that the data is only save once by clearing the cache after savig\n @file_data = nil\n end\n end", "def save\n prepare\n h = {}\n h[:title] = @title\n h[:sequence] = @sequence.map(&:export)\n outfile = File.join(@basedir, \"#{@name}.json\")\n File.open(outfile, 'w') do |f|\n f.write JSON.pretty_generate(h)\n end\n end" ]
[ "0.72709334", "0.714959", "0.71045995", "0.70323086", "0.7001762", "0.6900428", "0.68939084", "0.68493694", "0.6837613", "0.6777941", "0.67706263", "0.6675716", "0.6675716", "0.66502476", "0.66332906", "0.6569457", "0.6548317", "0.6497103", "0.64881146", "0.64701843", "0.64398307", "0.6413645", "0.6413645", "0.63950986", "0.63874483", "0.63494384", "0.6344247", "0.6330922", "0.632169", "0.6279179", "0.6278731", "0.62721604", "0.6263365", "0.62501043", "0.62393445", "0.6235097", "0.6231789", "0.6215108", "0.6206339", "0.6199208", "0.6199208", "0.61871123", "0.6171156", "0.6165381", "0.6151624", "0.6140357", "0.61096835", "0.610567", "0.6068187", "0.60646474", "0.605865", "0.6055755", "0.6054498", "0.60528183", "0.60488087", "0.6032062", "0.6027497", "0.60268134", "0.6023287", "0.60196894", "0.6014732", "0.6013762", "0.59814495", "0.5961659", "0.5940563", "0.59364223", "0.593464", "0.5923476", "0.59234136", "0.59234136", "0.59187645", "0.5914552", "0.5914552", "0.59099096", "0.59059185", "0.59014976", "0.5893002", "0.5881922", "0.5878167", "0.58764946", "0.5875745", "0.58699626", "0.58693635", "0.58693635", "0.58679134", "0.58610165", "0.58568984", "0.5843025", "0.5835467", "0.5826626", "0.5822384", "0.58189464", "0.58172435", "0.58171123", "0.58167404", "0.58131266", "0.5810142", "0.58097094", "0.5804963", "0.579932", "0.57943195" ]
0.0
-1
Load experiment state from file
def load fname=Dir["dumps/atari_*.bin"].sort.last hsh = File.open(fname, 'r') { |f| Marshal.load f } initialize hsh[:config] opt.instance_variable_set :@best, hsh[:best] opt.instance_variable_set :@mu, hsh[:mu] opt.instance_variable_set :@sigma, hsh[:sigma] compr.instance_variable_set :@centrs, hsh[:centrs] # Uhm haven't used that yet... # what else needs to be done in order to be able to run `#show_ind` again? puts "Experiment data loaded from `#{fname}`" true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load\n statefile_filename = state_filename\n if File.exist?(statefile_filename) &&\n File.file?(statefile_filename) &&\n File.readable?(statefile_filename)\n $log.debug \"Loading state from #{statefile_filename}\"\n @state = YAML.load_file(statefile_filename)\n else\n $log.debug 'No statefile found.'\n clean\n end\n @changed = false\n end", "def load_states(fname)\n init_kvstore unless @kv_initialized\n\n if @update_on_kvstore\n @kvstore.load_optimizer_states(fname)\n @optimizer = @kvstore.updater.optimizer\n else\n states = IO.binread(fname)\n @updaters.each do |updater|\n updater.set_states(states)\n updater.optimizer = @updaters[0].optimizer\n end\n @optimizer = @updaters[0].optimizer\n end\n end", "def load_state\n begin\n if File.file?(\"#{$statefile}\") && File.readable?(\"#{$statefile}\") \n @current_state = File.read(\"#{$statefile}\").strip.split(':')\n end\n rescue\n error('Invalid Resume Point')\n exit 1\n end\n end", "def load_state file=nil\n file=App.outpath + \"save.rb\" if file.nil?\n f=File.open(file,'r')\n content=f.read\n # puts content\n App.out= YAML.load(content)\n f.close\nend", "def load_state\n save_file = File.read(\"saved_state.json\")\n json_hash = JSON.parse(save_file)\n @secret_word = json_hash[\"secret_word\"]\n @display_content = json_hash[\"display_content\"]\n @failed_attemps = json_hash[\"failed_attemps\"]\n end", "def load\n return false unless File.file?(FILENAME)\n file = File.new(FILENAME, 'r')\n file = Zlib::GzipReader.new(file)\n state = Marshal.load(file.read)\n file.close\n reset(state)\n puts \"Bot state loaded.\"\n end", "def load file='GOL.sav'\n self.state=File.open(file,'r') do |f|\n Marshal.load(f)\n end\n end", "def load_state\n if File.file?(STATE_FILE)\n state = RightScale::JsonUtilities::read_json(STATE_FILE)\n @log_level = state['log_level'] || Logger::INFO\n Log.info(\"Initializing CookState from #{STATE_FILE} with #{state.inspect}\") if @log_level == Logger::DEBUG\n\n @has_downloaded_cookbooks = state['has_downloaded_cookbooks']\n @startup_tags = state['startup_tags'] || []\n @reboot = state['reboot']\n @log_file = state['log_file'] # nil if not in state loaded from disk\n end\n true\n end", "def load(environment=nil)\n load_from_file(file, environment)\n end", "def from_file(path)\n\t\t\t\told_eval_path,@current_eval_path = @current_eval_path,path\n\t\t\t\tinstance_eval path.read, path.to_s\n\t\t\tensure\n\t\t\t\t@current_eval_path = old_eval_path\n\t\t\tend", "def load(file); end", "def load(file_path); end", "def load(file_path); end", "def load_act_file(path)\n\t\t\t\traise \"act file at path #{path} didn't exist\" unless path.exist?\n\t\t\t\tui.log \"loading acts from #{path}\"\n\n\t\t\t\tfrom_file(path)\n\t\t\tend", "def load_state\n return YAML.load(self.state)\n end", "def load_file(file); end", "def from_file path\n run File.read(path) if File.exists? path\n end", "def load(playground, stack, file)\n raise \"Circular dependency detected: #{stack.join('=>')}=>#{file}\" if stack.include?(file)\n\n source = File.read(file)\n stack.push file\n id = File.basename(file, \".rb\").downcase.gsub(/\\W/, \"_\").to_sym\n context = Object.new\n context.instance_eval do\n extend Definition\n experiment = eval(source, context.new_binding(playground, id), file) # rubocop:todo Security/Eval\n raise NameError.new(\"Expected #{file} to define experiment #{id}\", id) unless playground.experiments[id]\n\n return experiment\n end\n rescue StandardError\n error = NameError.exception($!.message, id)\n error.set_backtrace $!.backtrace\n raise error\n ensure\n stack.pop\n end", "def initialize\n @state_file = \"./workspace.json\"\n get_state\n self\n end", "def load_file(filename); end", "def load_file(filename); end", "def state_file\n return File.join(File.dirname(__FILE__), 'state.json')\n end", "def load_from_file(path)\n YAML.load_file(path).each { |n,v| instance_variable_set(n, v) }\n end", "def load_file(file_path)\n\t\t\tcode = File.open(file_path) { |f| f.read }\n\t\t\t@interpreter.run(code)\n\t\tend", "def load(path); end", "def load_storage\n YAML.load_file(file_path) || {}\n end", "def load(filename)\n end", "def load\n config = YAML.load_file @config_path\n @path = config['steam']\n end", "def load_file(path)\n load(path)\n end", "def load_transitions(filename)\n file = File.read(filename)\n JSON.parse(file)\n end", "def read_file(file)\n extension = file.split('.').last\n\n raise \"Models file should be of the format yml or xmi. The given file '#{file}' has an '#{extension}' extension.\" unless extension =~ /yml|xmi/\n\n begin\n @original_hash = extension == \"xmi\" ? XmiReader.new(file).to_h : YAML::load_file(file) \n HashWithIndifferentAccess.new(original_hash).symbolize_keys!\n\n rescue StandardError => e\n raise \"Models file '#{file}' could not be loaded: #{e}\"\n end\n end", "def load(filename)\n\t\tend", "def load\r\n\t\tload_file\r\n\t\tconfigure\r\n\tend", "def load\n input(@infile)\n true\n end", "def initialize(file = \"\")\n @file = file\n @replays = []\n\n load if File.exist?(file)\n end", "def load_file(file_path)\n\t\t\tcode = File.open(file_path) { |f| f.read }\n\t\t\trun(code)\n\t\tend", "def from_file(file)\n from_s Utils::read_file file\n end", "def from_file(file)\n from_s Utils::read_file file\n end", "def initialize(path, load=nil)\n @path = path\n @inihash = {}\n \n if load or ( load.nil? and FileTest.readable_real? @path )\n restore()\n end\n end", "def load_from(path)\n Halcyon::Config::File.load(path)\n end", "def load\r\n return unless File.exist?(STORAGE)\r\n\r\n props = YAML.load(File.read(STORAGE))\r\n props.each{|k, v| instance_variable_set(\"@#{k}\", v) }\r\n end", "def read_state\n logger.info \"Reading current state from #{configuration.state_file}\" do\n state_file = File.expand_path(configuration.state_file)\n if File.exist?(state_file)\n begin\n JSON.parse(IO.read(state_file))\n rescue => e\n raise e.class, \"Unable to read/parse state file\\n #{e}\"\n end.each { |uid,params| @run_context.add_state uid, params }\n else\n logger.info \"State file does not exist at #{state_file}. Creating...\"\n state_dir = File.dirname(state_file)\n if Dir.exist? state_dir\n File.write state_file, {}.to_json\n else\n raise \"Cannot create state file in #{state_dir}. Does that directory exist?\"\n end\n end\n\n logger.debug \"Found #{@run_context.state.count} resource(s) in state:\"\n @run_context.state.each { |uid,res| logger.debug \" #{uid}\" }\n end\n end", "def fromFile( filename ) \n lines = IO.readlines( filename )\n loadAll( lines )\n end", "def load(filename)\n update! YAML.load_file(filename)\n end", "def load(file)\n File.open(path(file)).read\n end", "def load\n if File.exists? @file\n @main = YAML::load_file @file\n else\n self.load_defaults\n end\n end", "def handle_state_load\n state.load\n # dump state\n $log.debug? && dump_state\n rescue => load_exception\n $stderr.puts \"Error loading state, #{load_exception}\"\n end", "def load\n @cache = JSON.parse(File.read(file))\n rescue\n @cache = {}\n end", "def load( filepath )\n unserialize( IO.read( filepath ) )\n end", "def file(path)\n data = self.files[path.to_sym]\n \n if data.nil?\n data = { }\n self.files[path.to_sym] = data\n end\n \n StateModule::File::new(path, data)\n end", "def load_file(filename)\n instance_eval File.read(filename), filename, 1\n self\n end", "def load_state\n return {} unless @state_reader\n\n @state_reader.call\n end", "def load_file(file)\n return if @loaded.include? file\n\n # We have to specify Kernel.load, because we have a load method.\n begin\n # Store the file path so we don't try to reload it\n @loaded << file\n Kernel.load(file)\n rescue ScriptError => detail\n # Don't store the path if the file can't be loaded\n # in case it's loadable later on.\n @loaded.delete(file)\n Facter.warn \"Error loading fact #{file} #{detail}\"\n end\n end", "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_from_file filename\n fnm = File.exist?(filename) ? filename : File.join(@wd,filename)\n load_configuration(fnm)\n end", "def load!(file_path)\n if File.exist? file_path\n @log = YAML.load(File.read(file_path))\n else\n @log = {}\n end\n end", "def reload\n load @filename\n end", "def load_seed\n if(File.exists?(cache_file))\n @seed = MultiJson.load(File.read(cache_file)).to_smash\n else\n @seed = fetch_events\n end\n end", "def load_from_file(filename)\n load_from_string(File.read(filename))\n end", "def load_file(file)\n kernel_load(file)\n end", "def load\n file_name = ask_save_file\n save_file = File.open(file_name, 'r')\n save_file.pos = 0\n contents = unserialize(save_file.read)\n @name = contents['name']\n @guess = contents['guess']\n @word = contents['word']\n @bank = contents['bank']\n @lives = contents['lives']\n @letter = contents['letter']\n puts \"Game has been loaded from Save File #{file_name[-5]}!\"\n puts \"\\n\\n\"\n end", "def load_model_element_file(filename)\n YAML.load(File.open(filename, 'r'))\n end", "def load_from_file(dir, file=\"/specs.def\")\n JSON.parse(IO.read(File.join(dir, file))) rescue raise ArgumentError\n end", "def load\n sleeper = 0.0\n while File.exist? lock_file\n sleeper += 0.1 if sleeper <= 10.0\n sleep(sleeper.to_i)\n end\n # :symbolize_names does not play nicely with :create_additions\n tmp = JSON.parse(File.read(path),\n {:symbolize_names=>false, :create_additions=>true})\n @data = {}\n tmp.each_pair{ |k,v| self[k] = v }\n end", "def load_file(file)\n File.open(file, \"r\") { |f| load(f) }\n end", "def struct_load(file_path)\n if(eval_disabled?)\n raise 'Ruby based configuration evaluation is currently disabled!'\n else\n result = Module.new.instance_eval(\n IO.read(file_path), file_path, 1\n )\n result._dump.to_smash\n end\n end", "def load_from_file(file_path)\n require \"erb\"\n opts = YAML.load(ERB.new(File.read(file_path)).result) || {}\n symbolize_keys(opts)\n end", "def load_file(path)\n load_string(File.binread(path))\n end", "def load_file(path)\n @configuration_data = YAML.load_file(path)[CONFIGURATION_KEY]\n end", "def initialize(path)\n @data = YAML.load_file(path)\n end", "def load\n initialize(File.info(uuid).entity)\n end", "def load_game\n file = File.open(\"../saves/log.yml\", \"r\")\n s_log = file.read.to_i\n file.close\n if s_log == 0\n puts \"No save data.\"\n else\n puts \"Select a save file (1 to #{s_log}).\"\n s_choice = gets.chomp.to_i\n if s_choice <= s_log\n puts \"Loading save game # #{s_choice}...\"\n game_state = YAML.load(File.read(\"../saves/save_#{s_choice}.yml\"))\n game_state.play\n else\n puts \"Selected save file does not exist.\"\n end\n end\n end", "def load_state\n begin\n save_file = File.read(\"saved_state.json\")\n rescue\n return \"No saved game found\"\n end\n json_hash = JSON.parse(save_file)\n json_hash[\"json_board\"].each do |key, value|\n value == nil ? @board[key] = nil : \n @board[key] = Chess.const_get(value[\"class\"]).new(value[\"team\"])\n end\n @current_player = json_hash[\"current_player\"]\n return \"Game loaded\"\n end", "def load_stacks_file(payload, directory)\n stacks_path = File.join(directory, '.stacks')\n if(File.exists?(stacks_path))\n Bogo::Config.new(file_path).data\n else\n Smash.new\n end\n end", "def load\n if File.exist?(@file_path)\n\n @_cache = JSON File.open(@file_path, &:read).strip\n else\n $stderr.puts \"#{@file_path} does not exist\"\n end\n end", "def load\n flush\n replay\n end", "def load\n if File.exist?(@path) && !self.loaded?\n @source = File.read(@path)\n context = Context.new(self)\n eval @source, context.binding, @path.to_s, 1\n @loaded = true\n end \n end", "def initialize(path)\n @data = File.open(path, 'rb')\n reload!\n end", "def load!( file )\n Yell.new Yell::Configuration.load!(file)\n end", "def load\n eval(@data, TOPLEVEL_BINDING, @filename)\n end", "def load()\n code = File.open(@filename) {|file| file.read}\n dup = @players.last.dup\n begin\n dup.reset\n dup.instance_eval(code)\n @players.push(dup)\n rescue\n puts \"LOAD ERROR #{$!}\"\n end\n @load_time = Time.now.to_i\n end", "def load_states\n @doc.root.elements['states'].each_element(\"state\") do |state|\n state_name = state.attributes['name']\n\n if state.attributes['image'] != nil then\n state_image = Image.load(state.attributes['image'])\n elsif state.attributes['sym'] != nil then\n sym = state.attributes['sym']\n\n if @named_images[sym] == nil then\n raise \"No image assigned in 'load_pre' section of Model source #@src to symbolic name '#{sym}'.\"\n end\n\n state_image = @named_images[sym]\n end\n\n @model.add_pair state_name, state_image\n end\n end", "def read_file(path)\r\n YAML::load( File.open(path) )\r\n end", "def load_file(filename)\n full_file = File.expand_path(filename, @dispatch.save_dir)\n save_dir(full_file)\n begin\n File.new(full_file, 'r').each do |line|\n break unless load(full_file, $., line)\n end\n rescue\n puts \"Error loading file #{full_file}\"\n end\n restore_dir\n end", "def load_sample(file)\n path = Rails.root.join(\"lib\", \"assets\", \"sample_data\", \"#{file}.json\")\n file_data = File.read(path)\n return JSON.parse(file_data, symbolize_names: true)\n end", "def parse_tf_state(path)\n check_terraform_applied\n\n tf_state = YAML.load(File.read(path))\n tf_output = tf_state[\"modules\"].first[\"outputs\"]\n tf_output.map { |k, v| tf_output[k] = v[\"value\"] }\n\n tf_output\n end", "def load_source!\n @source = load_file_contents\n end", "def load()\n\n checkFileExists()\n loadConfigs()\n checkConfigs() \n end", "def load_from_file!(file_path)\n raise IOError, \"File #{file_path} not exist\" unless File.exist?(file_path)\n raw_data = IO.read(file_path)\n load_from_json!(raw_data)\n end", "def file path\n STDERR.puts \"file called with: #{path}\"\n puts \"Loading file: #{path}\"\n begin\n load path\n rescue => e\n puts e.inspect\n puts e.backtrace.join(\"\\n\\tfrom \")\n end\n end", "def reload; @data = File.read @path end", "def load_state(state)\n state.symbolize_keys!\n\n @mine = state[:mine].present?\n @revealed = state[:revealed].present?\n @flagged = state[:flagged].present?\n @neighbors_count = state[:neighbors_count]\n end", "def internal\n @internal ||= load_from_file\n end", "def load; end", "def load; end", "def load; end", "def fromFile cfgfile\n\t\tself.out \"from file #{cfgfile}\"\n\t\t# ran data\n\t\tinstance_eval File.read( cfgfile), cfgfile\n\tend", "def load(name); 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 load(file)\r\n if file == String # does this work?\r\n @path = file\r\n end\r\n\r\n @reader = Reader.new(file)\r\n load_section self, @reader\r\n @reader.close\r\n end" ]
[ "0.7093774", "0.7014233", "0.6991194", "0.6873482", "0.67228097", "0.6681344", "0.6655697", "0.64155716", "0.63604575", "0.6351798", "0.63413507", "0.63364935", "0.63364935", "0.62787664", "0.6261359", "0.625404", "0.62057805", "0.61825734", "0.61801845", "0.6169137", "0.6169137", "0.6129261", "0.6062406", "0.6033476", "0.6032432", "0.6027175", "0.60093504", "0.5984325", "0.5982623", "0.59444165", "0.5925521", "0.5906267", "0.5900778", "0.5868037", "0.58606297", "0.5857663", "0.58416086", "0.58416086", "0.58348334", "0.583392", "0.5827129", "0.58206457", "0.5813292", "0.57910603", "0.5789434", "0.5787829", "0.5779677", "0.57722497", "0.5771504", "0.5757918", "0.5742475", "0.5742271", "0.5742159", "0.57189435", "0.5718062", "0.571524", "0.5711402", "0.57002836", "0.5699759", "0.5698569", "0.5689233", "0.5686767", "0.5677437", "0.56773233", "0.5676973", "0.5670293", "0.5666842", "0.5657996", "0.5654145", "0.56418574", "0.5637334", "0.56370574", "0.5635787", "0.56030595", "0.5591851", "0.55905443", "0.5589653", "0.55715555", "0.5565216", "0.55519474", "0.5551909", "0.5551481", "0.55506", "0.55476564", "0.5546854", "0.5545599", "0.55452156", "0.55420595", "0.554062", "0.5536579", "0.553237", "0.5526239", "0.5517687", "0.5516768", "0.5516768", "0.5516768", "0.55139935", "0.5504145", "0.55026674", "0.5495517" ]
0.6352793
9
go all the way to the right save that node as the 'parent row' go left, try to repeat "go all the way to the right" try to repeat go left go to 'parent row' repeat from 'go left' every node vistited will be nth largest
def kth_largest(node, k) largest = BinarySearchTree.maximum(node) return largest if (k==1) (1...k).each do largest = next_largest(largest) end largest end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_right_child\n # Guard condition for movement not possible\n return nil if blank_x - 1 < 0\n\n # Make the movement\n new_state = swap_right\n\n # Avoids loop\n parents_array = parent_states(3)\n return nil if parents_array.include?(new_state)\n\n # Returns new node\n Node.new(new_state, self, blank_x - 1, blank_y)\n end", "def heapify_down\n # Swap the current_node (starting with root) with its smallest child until it's smaller than both of its children\n previous_current_node = nil\n current_node = 0\n # When the current_node is not changing, then it has swapped as many times as it can\n until previous_current_node == current_node\n previous_current_node = current_node\n right_child = right_child_node current_node\n left_child = left_child_node current_node\n\n # Bounds check for when current_node is one of the last two nodes\n # Or if there are only two nodes total\n if right_child >= @nodes.size\n # Correctly order nodes if there are only two nodes\n if @nodes.size == 2 && @nodes[left_child] < @nodes[current_node]\n @nodes[current_node], @nodes[left_child] = @nodes[left_child], @nodes[current_node] \n end\n break\n end\n\n # If current_node is greater than either of its children\n if @nodes[current_node] > @nodes[left_child] || @nodes[current_node] > @nodes[right_child]\n # Swap with the smallest child\n if @nodes[left_child] <= @nodes[right_child]\n @nodes[current_node], @nodes[left_child] = @nodes[left_child], @nodes[current_node]\n current_node = left_child\n else\n @nodes[current_node], @nodes[right_child] = @nodes[right_child], @nodes[current_node]\n current_node = right_child\n end\n end\n end\n end", "def bubble_down()\n\t\t# remove max and swap with last node\n\t\t@elements[0] = @elements.pop\n\t\ti = 0\n\t\twhile(i < @elements.length)\n\t\t\tmax_idx = i\n\t\t\t# find greater of left and right child\n\t\t\tif((2*i + 1) < @elements.length && @elements[2*i + 1][@orderBy] >= @elements[max_idx][@orderBy])\n\t\t\t\tmax_idx = 2*i + 1\n\t\t\tend\n\t\t\tif((2*i + 2) < @elements.length && @elements[2*i + 2][@orderBy] >= @elements[max_idx][@orderBy])\n\t\t\t\tmax_idx = 2*i + 2\n\t\t\tend\n\t\t\t# if left or right child is greater, swap and update i\n\t\t\tif(max_idx != i)\n\t\t\t\tswap(i, max_idx)\n\t\t\t\ti = max_idx\n\t\t\t# if not, we are done\n\t\t\telse\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\tend", "def percolate_down(i)\n sorted = false\n left, right = left_child(i), right_child(i)\n max = ((left != -1) && (@array[left] > @array[i])) ? left : i\n max = right if ((right != -1) && (@array[right] > @array[max]))\n if max == i\n sorted = true\n else\n @array[max], @array[i] = @array[i], @array[max]\n end\n percolate_down(max) if (sorted == false) && (i >= 0)\n @array\n end", "def calculate_left_child\n # Guard condition for movement not possible\n return nil if blank_x + 1 == size\n\n # Make the movement\n new_state = swap_left\n\n # Avoids loop\n parents_array = parent_states(3)\n return nil if parents_array.include?(new_state)\n\n # Returns new node\n Node.new(new_state, self, blank_x + 1, blank_y)\n end", "def explore_upwards(node)\n node = node.parent until node.parent.nil? || node.parent.left == node\n node.parent.nil? ? nil : node.parent.data\nend", "def heap_down(index)\n left_child = 2 * index + 1\n right_child = 2 * index + 2\n min_child = nil\n\n # Return if there's no left child\n return if left_child > @store.length - 1\n\n # If there's no RIGHT child AND parent is greater than LEFT child...\n # swap parent with left child\n if @store[right_child].nil? && @store[index].key > @store[left_child].key\n swap(index, left_child)\n heap_down(index)\n elsif @store[right_child] #Otherwise, which child is min?\n if @store[right_child].key <= @store[left_child].key\n min_child = @store.index(@store[right_child])\n else\n min_child = @store.index(@store[left_child])\n end\n end\n\n # If parent is greater than minimum child, swap them\n if min_child && @store[index].key > @store[min_child].key\n swap(index, min_child)\n heap_down(index)\n end\n end", "def find_end_of_node_path(i)\n left_index = left_child_index(i)\n right_index = right_child_index(i)\n \n if left_index > @heap_size && right_index > @heap_size\n i\n elsif right_index > @heap_size\n left_index\n else\n max_child_index = -1\n left_child_value = self[left_index - 1]\n right_child_value = self[right_index - 1]\n if right_child_value && left_child_value > right_child_value\n max_child_index = left_index\n else\n max_child_index = right_index\n end\n find_end_of_node_path max_child_index\n end\n end", "def bubble_up(index, node)\n while (index!=0 && @ary[(index-1)/2].key > node.key) #while parent is bigger,\n @ary[index], @ary[(index-1)/2] = @ary[(index-1)/2], @ary[index] #swap\n index = (index-1)/2\n end\n end", "def set_default_left_and_right\n unless @skip_nested_set_callbacks\n maxright = base_class.first(scoped(:order => \"#{right_column_name} DESC\")).try(right_column_name) || 0\n # adds the new node to the right of all existing nodes\n self[left_column_name] = maxright + 1\n self[right_column_name] = maxright + 2\n end\n end", "def heap_down(index)\n left_child_index = index * 2 + 1\n right_child_index = index * 2 + 2\n #check to see if the right child exists\n if @store[right_child_index] != nil\n # Define the min_child\n min_child = @store[right_child_index].key < @store[left_child_index].key ? right_child_index : left_child_index\n # if the min_child less than the parent, swap it and continue heaping down\n if @store[min_child].key < @store[index].key\n swap(min_child, index)\n heap_down(min_child)\n end\n elsif @store[left_child_index] != nil #check to see if the left child exists\n if @store[left_child_index].key < @store[index].key #if the min_child less than the parent, swap it and continue heaping down\n swap(left_child_index, index)\n heap_down(left_child_index)\n end\n end\n \n end", "def next_largest(node)\n if node.right\n # find smallest node to the right\n return left_most_node(node.right)\n end\n\n # no nodes to the right; climb up\n until true\n parent_node = node.parent\n if parent_node.nil?\n # at the top of the tree, and nothing bigger to the right.\n return nil\n elsif parent_node.left == node\n # parent is bigger than us\n return parent_node\n else\n # parent is smaller, keep climbing.\n node = parent_node\n end\n end\nend", "def set_default_left_and_right\n maxright = dataset.nested.max(self.class.qualified_right_column).to_i || 0\n # adds the new node to the right of all existing nodes\n self.left = maxright + 1\n self.right = maxright + 2\n end", "def heap_down(index)\n\n left_child_index = 2 * index + 1\n right_child_index = 2 * index + 2\n\n # BASE CASES\n # stop if we're at the last leaf in the tree \n return if @store[left_child_index].nil? && @store[right_child_index].nil?\n # stop if both children are greater than or equal to parent\n return if @store[left_child_index].key >= @store[index].key && @store\n\n # RECURSIVE CASES\n # if parent is greater than left child, swap and look at next level --\n # need @store[index] conditional to stop code running after we've reached \n # the bottom of the heap\n if @store[index] && @store[index].key > @store[left_child_index].key\n @store[index], @store[left_child_index] = @store[left_child_index], @store[index] \n heap_down(left_child_index)\n end\n\n # if parent is greater than right child, swap and look at next level\n if @store[index] && @store[index].key > @store[right_child_index].key\n @store[index], @store[right_child_index] = @store[right_child_index], @store[index] \n heap_down(right_child_index)\n end\n\n end", "def before_create\n maxright = self.class.maximum(acts_as_nested_set_options[:right_column], :conditions => acts_as_nested_set_options[:scope]) || 0\n # adds the new node to the right of all existing nodes\n self[acts_as_nested_set_options[:left_column]] = maxright+1\n self[acts_as_nested_set_options[:right_column]] = maxright+2\n end", "def heap_down(parentIndex)\n # compare node @ parentIndex to its children\n # if parent <= both children, min heap :-) base case\n # if parent > either/both child, swap places with the smaller child, then min_heap_down(childIndex), recursion!\n # when no more children to compare to, base case :-)\n \n # first find out if parent has LC or RC\n indexLC = parentIndex * 2 + 1 \n indexRC = indexLC + 1\n \n if @store.length > indexRC\n # both LC & RC exist, need to compare with both children\n if (@store[parentIndex].key > @store[indexLC].key) && (@store[parentIndex].key > @store[indexRC].key)\n # both LC & RC broke the heap property, which one is smaller?\n @store[indexLC].key > @store[indexRC].key ? (indexOfSmallerChild = indexRC) : (indexOfSmallerChild = indexLC)\n swap(parentIndex, indexOfSmallerChild)\n heap_down(indexOfSmallerChild)\n \n elsif @store[parentIndex].key > @store[indexLC].key\n # only LC broke the heap property\n swap(parentIndex, indexLC)\n heap_down(indexLC)\n \n elsif @store[parentIndex].key > @store[indexRC].key\n # only RC broke the heap property\n swap(parentIndex, indexRC)\n heap_down(indexRC)\n \n else \n # both children are bigger than parent -> min heap :-) base case\n return\n end\n \n elsif @store.length > indexLC\n # only LC exists\n if @store[parentIndex].key <= @store[indexLC].key\n # min heap :-) base case\n return \n else\n swap(parentIndex, indexLC)\n heap_down(indexLC)\n end\n \n else\n # no children, base case\n return\n end\n end", "def left_child(indx)\n 2*indx + 1\n end", "def bubble_down(index)\n left = index*2+1 #left child\n right = index*2+2 #right child\n\n smaller_child_index = pick_smaller(left, right)\n\n while (smaller_child_index!=nil && @ary[smaller_child_index].key < @ary[index].key)\n\n @ary[index], @ary[smaller_child_index] = @ary[smaller_child_index], @ary[index] #swap\n\n index = smaller_child_index\n left = index*2+1 #left child\n right = index*2+2 #right child\n smaller_child_index = pick_smaller(left, right)\n\n end\n end", "def longest_slide_down(pyramid)\n pyramid.each_with_index do |row, ri|\n row.each_with_index do |elem, ei|\n next if ri < 1\n # set variables\n left = pyramid[ri - 1][ei - 1]\n right = pyramid[ri - 1][ei]\n left = left.nil? ? 0 : left\n right = right.nil? ? 0 : right\n pyramid[ri][ei] += left > right ? left : right\n end\n end\n return pyramid.last.max\nend", "def swim index\n parent_index = (index - 1) / 2\n\n # continue to bubble upward while we have not reached the root,\n # and while we are less than the parent element\n while (index > 0 && less_than?(index, parent_index))\n \n # swap the two values\n swap_values_at(index, parent_index)\n index = parent_index\n # set new parent index based on the bubble up\n parent_index = (index - 1) / 2\n end\n end", "def build_tree(arr)\n\ntree = []\n\ntree.push(Node.new(arr[0]))\n\n arr[1..-1].each do |i|\n new_node = Node.new(i)\n\n condition = false\n current = tree[0]\n until condition == true\n if i > current.value && current.find_right_child.count == 0\n new_node.create_parent(current)\n current.create_right_child(new_node)\n tree.push(new_node)\n condition = true\n elsif i < current.value && current.find_left_child.count == 0\n new_node.create_parent(current)\n current.create_left_child(new_node)\n tree.push(new_node)\n condition = true\n elsif i > current.value && current.find_right_child.count == 1\n current = current.find_right_child[0]\n elsif i < current.value && current.find_left_child.count == 1\n current = current.find_left_child[0]\n end\n end\n end\n tree\nend", "def next_largest(node)\n if node.right\n return node.right.val if node.right.left.nil?\n child = node.right\n while true\n return child.left.val if child.left.left.nil?\n child = child.left\n end\n end\n\n if node.parent.left == node\n return node.parent.val\n end\n\n if node.parent.right == node\n parent = node.parent\n while true\n return nil if parent.parent.nil?\n if parent.parent.left == parent\n return parent.parent.val\n end\n parent = parent.parent\n end\n end\n\nend", "def fixBTree( node, index)\n # If the left sibling has more than min keys.\n if (index != 0 && node.arr[index - 1].n > self.min)\n self.borrowFromLeft(node, index)\n elsif (index != node.n && node.arr[index + 1].n > self.min)\n self.borrowFromRight(node, index)\n else\n if (index != node.n)\n self.merge(node, index)\n else\n self.merge(node, index - 1)\n end\n end\n end", "def change_n_order(mode)\n return false unless self.parent\n\n if mode == 1\n if self.n_order != 1\n kw = self.parent.childs.where(n_order: self.n_order-1).first\n if kw\n kw.n_order += 1\n self.n_order -= 1\n kw.save\n self.save\n end\n end\n\n elsif mode == 2\n kw = self.parent.childs.where(n_order: self.n_order+1).last\n puts \"---- kw: #{kw.n_order} vs self: #{self.n_order}\"\n if kw && self.n_order < kw.n_order\n kw.n_order -= 1\n self.n_order += 1\n kw.save\n self.save\n end\n end\n end", "def build_tree(list)\n root = Node.new(list[0], nil)\n list[1...list.length].each do |item|\n current_node = root\n while !item.nil?\n if item > current_node.value\n if current_node.right_child.nil?\n current_node.right_child = Node.new(item, current_node)\n item = nil\n else\n current_node = current_node.right_child\n end\n elsif item < current_node.value\n if current_node.left_child.nil?\n current_node.left_child = Node.new(item, current_node)\n item = nil\n else\n current_node = current_node.left_child\n end\n else\n item = nil\n end\n end\n end\n root\nend", "def heapify_downward(i)\n #find the lowest node index that the node i could fall to\n end_node_index = find_end_of_node_path(i)\n \n #stash the value of node i for later\n start_node_value = self[i - 1] \n\n #search for the eventual final index where node i will fall\n swap_node_index = search_path_for_insert_position(i, end_node_index, start_node_value)\n \n #Move all parent nodes from the swap node index, up one level\n traversing_node_index = swap_node_index \n swap_node_value = self[traversing_node_index - 1]\n parent_value = self[parent_index(traversing_node_index) - 1]\n while traversing_node_index != i \n traversing_node_index = parent_index(traversing_node_index)\n self[traversing_node_index - 1] = swap_node_value\n swap_node_value = parent_value\n parent_value = self[parent_index(traversing_node_index) - 1]\n end\n \n #finally set the swap node index value to be our initial value \n self[swap_node_index - 1] = start_node_value \n end", "def sink index\n loop do\n # define all other relevant index values\n last_item_index = size - 1\n l_child = 2 * index + 1\n r_child = 2 * index + 2\n # default to L in case of tie\n smaller_child = l_child\n # set smaller_child to right_child if that is a valid index and it is less than the left\n smaller_child = r_child if (r_child < last_item_index && less_than?(r_child, l_child))\n # if we are outside the bounds of our tree\n # or if we cannot sink item at `index` anymore\n break if (l_child >= last_item_index || less_than?(index, smaller_child))\n # otherwise, swap the values, \"bubbling\" the item down\n swap_values_at(smaller_child, index)\n # set the new index to the positions we've just moved to\n index = smaller_child\n end\n end", "def explore_downwards(node)\n node = node.left until node.left.nil?\n node.data\nend", "def left_child_node(index)\n index * 2 + 1\n end", "def expand_children node=:current_index\n $multiplier = 999 if !$multiplier || $multiplier == 0\n node = row_to_node if node == :current_index\n return if node.children.empty? # or node.is_leaf?\n #node.children.each do |e| \n #expand_node e # this will keep expanding parents\n #expand_children e\n #end\n node.breadth_each($multiplier) do |e|\n expand_node e\n end\n $multiplier = 0\n _structure_changed true\n end", "def left_to_right_approach\n largest_prod_of_all_rows = 0\n for each_row in (0..19)\n curr_largest_prod_in_row = left_to_right_helper($grid_of_numbers[each_row])\n if curr_largest_prod_in_row > largest_prod_of_all_rows\n largest_prod_of_all_rows = curr_largest_prod_in_row\n end\n end\n \n return largest_prod_of_all_rows\nend", "def next_largest(node)\n if node.right\n return left_most(node.right)\n end\n greater_parent(node.parent,node.value)\nend", "def heapify_up\n # Swap the current_node (starting with last child) with it's parent if it is smaller\n previous_current_node = nil\n current_node = @nodes.size - 1\n # When the current_node is not changing, then it has swapped as many times as it can\n until previous_current_node == current_node\n previous_current_node = current_node\n parent_node = parent(current_node)\n \n # Bounds check for when the current_node is the root\n break if current_node.zero? \n\n # Swap with the parent if the parent is bigger\n if @nodes[current_node] < @nodes[parent_node]\n @nodes[current_node], @nodes[parent_node] = @nodes[parent_node], @nodes[current_node]\n current_node = parent_node\n end\n end\n end", "def renumber_full_tree\n indexes = []\n n = 1\n transaction do\n for r in roots # because we may have virtual roots\n n = 1 + r.calc_numbers(n, indexes)\n end\n for i in indexes\n base_set_class.update_all(\"#{left_col_name} = #{i[:lft]}, #{right_col_name} = #{i[:rgt]}\", \"#{self.class.primary_key} = #{i[:id]}\")\n end\n end\n ## reload?\n end", "def percolate_down(idx = 0)\n return self if idx > (@data.size / 2 - 1)\n child = idx * 2 + 1\n child += 1 if (child != @data.size - 1) && (@data[child] > @data[child + 1])\n if @data[idx] > @data[child]\n temp = @data[idx]\n @data[idx] = @data[child]\n @data[child] = temp\n return percolate_down(child)\n end\n return self\n end", "def right_rotate(node)\n l_child = node.l\n if node.p\n node == node.p.l ? node.p.l = l_child : node.p.r = l_child\n else\n @root = l_child\n end\n node.l = l_child.r\n l_child.r.p = node\n l_child.r = node\n l_child.p = node.p\n node.p = l_child\n end", "def left_most(node)\n if node.left\n left_most(node.left)\n else\n node\n end\nend", "def bottoms_up_method\n\t\t# 1. take the nodes that went the farthest (i.e.: max tree level)\n\t\tmax_level = @tree.tree_bottom.collect(&:level).max\n\t\t# 2. Of those, use the one with the minimum sum value\n\t\twinner = @tree.tree_bottom.select{|t|t.level==max_level}.min_by(&:sum)\n\t\t# binding.pry \n\t\tbottoms_up_dir(winner).dir\n\tend", "def renumber_full_tree\n indexes = []\n n = 1\n transaction do\n for r in roots # because we may have virtual roots\n n = r.calc_numbers(n, indexes)\n end\n for i in indexes\n base_set_class.update_all(\"#{left_col_name} = #{i[:lft]}, #{right_col_name} = #{i[:rgt]}\", \"#{self.class.primary_key} = #{i[:id]}\")\n end\n end\n ## reload?\n end", "def heap_down(index)\n left_index = index * 2 + 1\n right_index = index * 2 + 2\n\n if right_index < @store.length\n min_child = @store[left_index].key < @store[right_index].key ? left_index : right_index\n if @store[index].key > @store[min_child].key\n swap(index, min_child)\n heap_down(min_child)\n end\n elsif left_index < @store.length\n if @store[index].key > @store[left_index].key\n swap(index, left_index)\n end\n end\n end", "def maximum(tree_node = @root)\n curr_node = tree_node\n until curr_node.right.nil?\n @parent = curr_node\n curr_node = curr_node.right\n end\n\n curr_node\n end", "def heap_down(index)\n # calculate index of (possible) children\n child_L = index * 2 + 1\n child_R = index * 2 + 2\n\n # base case #1 - if current node has no children at all\n return if child_L >= @store.length \n # base case #2 - if a child exists and current node is smaller than min_child\n min_child = child_L\n if child_R < @store.length\n min_child = @store[child_L].key < @store[child_R].key ? child_L : child_R\n end\n\n return if @store[index].key < @store[min_child].key\n\n # recursive case: swap and run again\n swap(index, min_child)\n heap_down(min_child)\n end", "def promote_node_two_children(parent_node,target_node, max_left_sub_tree, max_left_sub_tree_parent_node)\n\n if parent_node.value <= max_left_sub_tree.value\n parent_node.right = max_left_sub_tree\n promote_node(max_left_sub_tree_parent_node, max_left_sub_tree.left)\n\n\n max_left_sub_tree.left = target_node.left if !target_node.left.nil?\n\n max_left_sub_tree.right = target_node.right if !target_node.right.nil?\n\n\n\n\n\n\n else\n parent_node.left = max_left_sub_tree\n promote_node(max_left_sub_tree_parent_node, max_left_sub_tree.left)\n\n\n max_left_sub_tree.left = target_node.left if !target_node.left.nil?\n\n max_left_sub_tree.right = target_node.right if !target_node.right.nil?\n\n\n end\n\n end", "def move_down\n # Ensure each parent node to this node (the goal here is to hit a question node) is valid\n !survey.node_maps.select do |i|\n i.node == self\n end.collect do |node_map|\n # Must have children to move lower!\n # And the children are also answers!\n next unless !node_map.children.empty? && !node_map.children.select { |j| j.node.class.ancestors.include?(::ActiveRecordSurvey::Node::Answer) }.empty?\n\n # I know this looks overly complicated, but we need to always work with the survey.node_maps - never children/parent of the relation\n parent_node = survey.node_maps.select do |j|\n node_map.parent == j\n end.first\n\n children = survey.node_maps.select do |j|\n node_map.children.include?(j)\n end\n\n children_children = survey.node_maps.select do |j|\n children.collect(&:children).flatten.include?(j)\n end\n\n children.each do |c|\n parent_node.children << c\n end\n\n children.each do |c|\n c.children << node_map\n end\n\n children_children.each do |i|\n node_map.children << i\n end\n end\n end", "def build_tree(arr)\n #arr.shuffle!\n arr.each do |x|\n if @root == nil\n @root = Node.new(x)\n else\n current_node = @root\n until current_node == nil\n if x < current_node.value\n parent = current_node\n direction = \"left\"\n current_node = current_node.left_child\n elsif x > current_node.value\n parent = current_node\n direction = \"right\"\n current_node = current_node.right_child\n end\n end\n if direction == \"left\"\n parent.left_child = Node.new(x)\n elsif direction == \"right\"\n parent.right_child = Node.new(x)\n end\n end\n end\n end", "def calculate_down_child\n # Guard condition for movement not possible\n return nil if blank_y - 1 < 0\n\n # Make the movement\n new_state = swap_down\n\n # Avoids loop\n parents_array = parent_states(10)\n return nil if parents_array.include?(new_state)\n\n # Returns new node\n Node.new(new_state, self, blank_x, blank_y - 1)\n end", "def convert_to_mirror_iterative(node)\n return if node.nil?\n\n queue = [node]\n while queue.any?\n current = queue.shift\n queue << current.left unless current.left.nil?\n queue << current.right unless current.right.nil?\n current.left = current.left\n current.right = current.right\n end\nend", "def solution(t)\n # write your code in Ruby 2.2\n depth = 0\n childs = []\n\n childs << t.l if t.l\n childs << t.r if t.r\n\n while not childs.empty? do\n depth += 1\n\n cc = []\n childs.each do |t|\n cc << t.l if t.l\n cc << t.r if t.r\n end\n\n childs = cc\n end\n\n depth\nend", "def right_child_index(i)\n (i * 2) + 1\n end", "def set_default_left_and_right\n maxright = nested_set_scope.remove_order_by.max(right_field_name) || 0\n self[left_field_name] = maxright + 1\n self[right_field_name] = maxright + 2\n self[:depth] = 0\n end", "def right_child_node(index)\n index * 2 + 2\n end", "def left_child_index(i)\n i * 2\n end", "def with_rows_and_height\n root = self\n queue = [root]\n visited = []\n\n until queue.empty?\n current = queue.shift\n adjacency_list = current.children\n\n self.height += 1\n adjacency_list.each do |node|\n root.rows << (node.nil? ? \"x\" : node.value)\n next if node.nil?\n visited << node.value\n\n if node.distance == Float::INFINITY\n node.distance = current.distance + 1\n node.parent = current\n queue.push(node)\n end\n end\n end\n\n self\n end", "def heapify_down(custom_start_index = 0)\n current_index = custom_start_index\n next_index = nil\n while(self.has_left_child(current_index))\n if(\n self.has_right_child(current_index) && \n self.pair_is_in_correct_order(self.get_right_child_index(current_index), self.get_left_child_index(current_index)))\n \n next_index = self.get_right_child_index(current_index)\n else\n next_index = self.get_left_child_index(current_index)\n end\n \n break if(self.pair_is_in_correct_order(current_index, next_index))\n self.swap(current_index, next_index)\n current_index = next_index\n end\n end", "def buildTree(node,arr)\n node.value = arr.shift\n size = (arr.size/2.0).round\n if size > 0\n left, right = arr.each_slice( size ).to_a\n if left and left.count > 0\n node.left = TreeNode.new\n buildTree(node.left, left)\n end\n if right and right.count > 0\n node.right = TreeNode.new\n buildTree(node.right, right)\n end\n end\nend", "def bubble_up(i)\n while i > 0\n parent = (i+1) / 2 - 1\n if @contents[parent].key >= @contents[i].key then\n @contents[parent],@contents[i] = @contents[i],@contents[parent]\n i = parent\n else return\n end\n end\n end", "def right_child(parent_index)\n right = 2 * parent_index + 2\n return -1 if right > (@array.size - 1)\n right\n end", "def borrowFromRight( node, index)\n child = node.arr[index]\n sibling = node.arr[index + 1]\n # node key is inserted as the last key in child.\n child.keys[child.n] = node.keys[index]\n # Sibling's first child is inserted as the last child of child.\n if (!(child.leaf))\n child.arr[(child.n) + 1] = sibling.arr[0]\n end\n # First key from sibling is inserted into node.\n node.keys[index] = sibling.keys[0]\n \n # Moving all keys in sibling one step left\n i = 1\n while (i < sibling.n)\n sibling.keys[i - 1] = sibling.keys[i]\n i += 1\n end\n i = 1\n # Moving the child pointers one step behind\n while (!sibling.leaf && i <= sibling.n)\n sibling.arr[i - 1] = sibling.arr[i]\n i += 1\n end\n # Increase child key count and decrease sibling key count.\n child.n += 1\n sibling.n -= 1\n return\n end", "def percolate_up(idx = @data.size - 1)\n return self if idx == 0\n parent = (idx - 1) / 2\n if @data[idx] < @data[parent]\n temp = @data[idx]\n @data[idx] = @data[parent]\n @data[parent] = temp\n return percolate_up(parent)\n end\n return self\n end", "def rearrange_recursively(klass, items, parent = nil)\n last = nil\n items.each do |item|\n record = klass.find(item['id'])\n if last\n record.move_to_right_of(last)\n else\n parent ? record.move_to_child_of(parent) : record.move_to_root\n end\n last = record\n if item['children']\n rearrange_recursively klass, item['children'], record\n end\n end\n end", "def doubleWithLeftChild(k3)\n k3.left = rotateWithRightChild(k3.left)\n rotateWithLeftChild(k3)\n end", "def calculate_up_child\n # Guard condition for movement not possible\n return nil if blank_y + 1 == size\n\n # Make the movement\n new_state = swap_up\n\n # Avoids loop\n parents_array = parent_states(3)\n return nil if parents_array.include?(new_state)\n\n # Returns new node\n Node.new(new_state, self, blank_x, blank_y + 1)\n end", "def backtrack!(nodes)\n while true\n return nil if nodes.empty? # backtracked back to 0, so we are done\n \n # We tried nodes.last and it didn't work, so\n # pop it off and uncover the corresponding columns.\n node = nodes.pop\n node.unchoose_except_self_column\n \n # Try the next node in this column.\n x = node.down\n\n return x unless x.is_a? Column\n \n # Our downwards iteration has gone full-circle\n # back to the column object where it started.\n x.uncover # Uncover the column.\n end\n end", "def build_tree_helper(arr)\n\treturn Node.new(arr[0]) if arr.size == 1\n\tnode = Node.new(arr.slice!(arr.size / 2))\n\ttree = build_tree(arr)\n\tuntil (node.value > tree.value && tree.right_child.nil?) || (node.value <= tree.value && tree.left_child.nil?)\n\t\ttree = node.value > tree.value ? tree.right_child : tree.left_child\n\tend\n\tif node.value > tree.value\n\t\ttree.right_child = node\n\t\tnode.parent = tree\n\telse\n\t\ttree.left_child = node\n\t\tnode.parent = tree\n\tend\nend", "def attempt_set_position_in_list(target_logical_position)\n DB.open do |db|\n ordered_siblings = db[self.class.node_model.table_name].filter(\n :root_record_id => self.root_record_id, :parent_id => self.parent_id\n ).order(:position)\n siblings_count = ordered_siblings.count\n\n target_logical_position = [target_logical_position, siblings_count - 1].min\n\n current_physical_position = self.position\n current_logical_position = ordered_siblings.where { position < current_physical_position }.count\n\n # If we are already at the correct logical position, do nothing\n return if (target_logical_position == current_logical_position)\n\n # We'll determine which node will fall to the left of our moved node, and\n # which will fall to the right. We're going to set our physical position to\n # the halfway point of those two nodes. For example, if left node is\n # position 1000 and right node is position 2000, we'll take position 1500.\n # If there's no gap, we'll create one!\n #\n left_node_idx = target_logical_position - 1\n\n if current_logical_position < target_logical_position\n # If the node is being moved to the right, we need to adjust our index to\n # compensate for the fact that everything logically shifts to the left as we\n # pop it out.\n left_node_idx += 1\n end\n\n left_node_physical_position =\n if left_node_idx < 0\n # We'll be the first item in the list (nobody to the left of us)\n nil\n else\n ordered_siblings.offset(left_node_idx).get(:position)\n end\n\n right_node_idx = left_node_idx + 1\n\n right_node_physical_position =\n if right_node_idx >= siblings_count\n # We'll be the last item in the list (nobody to the right of us)\n nil\n else\n ordered_siblings.offset(right_node_idx).get(:position)\n end\n\n new_position =\n if left_node_physical_position.nil? && right_node_physical_position.nil?\n # We're first in the list!\n new_position = TreeNodes::POSITION_STEP\n else\n if right_node_physical_position.nil?\n # Add to the end\n left_node_physical_position + TreeNodes::POSITION_STEP\n else\n left_node_physical_position ||= 0\n\n if (right_node_physical_position - left_node_physical_position) <= 1\n # We need to create a gap to fit our moved node\n right_node_physical_position = ensure_gap(right_node_physical_position)\n end\n\n # Put the node we're moving halfway between the left and right nodes\n left_node_physical_position + ((right_node_physical_position - left_node_physical_position) / 2)\n end\n end\n\n self.class.dataset.db[self.class.table_name]\n .filter(:id => self.id)\n .update(:position => new_position,\n :system_mtime => Time.now)\n end\n end", "def maximum(tree_node = @root)\n curr = tree_node\n until curr.right.nil? \n curr = curr.right\n end\n curr \n end", "def build_tree( n , d )\n \n if d.key?('v')\n n < d['v'] ? build_tree(n , d['l']) : build_tree(n, d['r'])\n else\n d['l'] = {}\n d['v'] = n\n d['r'] = {}\n end\n \nend", "def left_right(key, node)\n case child_count(node)\n when 1\n node.left.nil? ? node.right : node.left\n when 2\n node.data > key ? node.left : node.right\n end\n end", "def successor(node)\n return if node.nil?\n # if right subtree exists, return leftmost node under it\n # i.e. this is the next higher number than the one at current node\n r = node.right\n if r\n return nil if r.nil?\n while r.left\n r = r.left\n end\n return r\n else\n # if there is no right subtree, we have to go up to parent because\n # there is no number greater than the current node\n # so we have to keep going up parents until we figure out that the\n # child was the left child of the parent because that must mean\n # the parent has to be greater in value than the current node\n current = node\n parent = current.parent\n while parent && parent.left != current\n current = parent\n parent = parent.parent\n end\n return parent\n end\nend", "def go_to_bottom(nodes=nil, target)\n\t\tnext_row = []\n\n\t\tif nodes.nil?\n\t\t\tnodes = [self.root]\n\t\tend\n\n\t\tnodes.each do |node|\n\t\t\tif node.left.nil?\n\t\t\t\tnode.left = target\n\t\t\t\tnode.left.parent = node\n\t\t\t\treturn\n\t\t\telsif node.right.nil?\n\t\t\t\tnode.right = target\n\t\t\t\tnode.right.parent = node\n\t\t\t\treturn\n\t\t\telse\n\t\t\t\tnext_row << node.left\n\t\t\t\tnext_row << node.right\n\t\t\tend\n\t\tend\n\n\t\tif next_row.count > 0\n\t\t\tgo_to_bottom(next_row, target)\n\t\tend\n\tend", "def go_to_bottom(nodes=nil, target)\n\t\tnext_row = []\n\n\t\tif nodes.nil?\n\t\t\tnodes = [self.root]\n\t\tend\n\n\t\tnodes.each do |node|\n\t\t\tif node.left.nil?\n\t\t\t\tnode.left = target\n\t\t\t\tnode.left.parent = node\n\t\t\t\treturn\n\t\t\telsif node.right.nil?\n\t\t\t\tnode.right = target\n\t\t\t\tnode.right.parent = node\n\t\t\t\treturn\n\t\t\telse\n\t\t\t\tnext_row << node.left\n\t\t\t\tnext_row << node.right\n\t\t\tend\n\t\tend\n\n\t\tif next_row.count > 0\n\t\t\tgo_to_bottom(next_row, target)\n\t\tend\n\tend", "def make_other_rows \n left = 2\n right = @n - 1\n\n (0..t-1).each do |c|\n (1..m-1).each do |r|\n @rounds[c][r] = \"#{left}-#{right}\"\n right = right_decrement(right)\n if r < m-1\n left = left_increment(left)\n elsif r == m-1\n left = left_increment_for_the_last_column(left)\n end\n end\n end\n end", "def bubble_down(i)\n while true\n child1 = (i+1) * 2 - 1\n child2 = (i+1) * 2\n if child1 >= size then return\n elsif child2 >= size then\n if @contents[i].key >= @contents[child1].key then\n @contents[i],@contents[child1] = @contents[child1],@contents[i]\n return\n else return\n end\n else min = if @contents[child1].key <= @contents[child2].key\n then child1 else child2\n end\n if @contents[i].key > @contents[min].key\n @contents[i],@contents[min] = @contents[min],@contents[i]\n i = min\n else return\n end\n end\n end\n end", "def heap_down(index)\n # base case 1, can't reach any more child nodes\n # ^ meaning heap node has reached deepest depth of heap\n if 2 * (index + 1) - 1 < @store.length - 1\n child_i = 2 * (index + 1) - 1 # (index + 1) to account for zero index\n \n swap(child_i, child_i + 1) if @store[child_i].key > @store[(child_i + 1)].key\n\n if @store[child_i].key < @store[index].key\n swap(index, child_i)\n heap_down(child_i) \n end\n # base case 2, index is not last element\n elsif index < @store.length - 1\n swap(index, index + 1) if @store[index].key > @store[index + 1].key\n end\n # note that add will reorder the heap through swap\n end", "def heap_down(index=0)\n return if @store.empty?\n\n while ((2 * index) + 1) < @store.length # so long as we have a left child, continue to swap\n rightIndex = (2 * index) + 2\n leftIndex = (2 * index) + 1\n smallerIndex = leftIndex\n if (rightIndex < @store.length) && (@store[rightIndex].key < @store[leftIndex].key)\n smallerIndex = rightIndex\n end\n\n if @store[index].key < @store[smallerIndex].key\n break\n else\n swap(index, smallerIndex)\n end\n index = smallerIndex\n end\n end", "def display_tree(an_array)\r\n an_array.length\r\n count = 1\r\n (count - 1).upto(count) do\r\n end\r\nend", "def right_sibling\n siblings.\n where( arel[position_column].gt(self[position_column]) ).\n reorder( arel[position_column].asc ).\n first\n end", "def reorder\n sibs = siblings\n return if sibs.empty?\n sibs.each do |s|\n if self.ranking >= s.ranking\n self.move_to_left_of(s) and return\n end\n end\n self.move_to_right_of(sibs.last)\n end", "def heap_down(index)\n left_index = 2 * index + 1\n right_index = 2 * index + 2\n\n return if left_index > @store.length - 1 || right_index > @store.length - 1\n\n child_index = (@store[left_index].key < @store[right_index].key ? left_index : right_index)\n\n unless @store[index].key < @store[child_index].key\n swap(child_index, index)\n\n heap_down(child_index)\n end\n end", "def calc_numbers(n, indexes) #:nodoc:\n my_lft = n\n # performance improvements (3X or more for tables with lots of columns) by using :select to load just id, lft and rgt\n ## i don't use the scope condition here, because it shouldn't be needed\n my_children = self.class.find_in_nested_set(:all, :conditions => \"#{prefixed_parent_col_name} = #{self.id}\",\n :order => \"#{prefixed_left_col_name}\", :select => \"#{self.class.primary_key}, #{prefixed_left_col_name}, #{prefixed_right_col_name}\")\n if my_children.empty?\n my_rgt = (n += 1)\n else\n for c in (my_children)\n n = c.calc_numbers(n + 1, indexes)\n end\n my_rgt = (n += 1)\n end\n indexes << {:id => self.id, :lft => my_lft, :rgt => my_rgt} unless self[left_col_name] == my_lft && self[right_col_name] == my_rgt\n return n\n end", "def adjusted_down(adjusted_array, parent, limit)\n top = adjusted_array[parent]\n while (child = 2 * parent) <= limit\n child += 1 if (child < limit) && (adjusted_array[child] < adjusted_array[child + 1])\n break if top >= adjusted_array[child]\n\n adjusted_array[parent] = adjusted_array[child]\n parent = child\n end\n adjusted_array[parent] = top\nend", "def heap_up(index)\n if index == 0\n # no more upstream to compare to\n return\n \n else\n # Compare node @ index to its parent\n # if child >= parent, min heap :-) base case\n # if child < parent, swap places, then heap_up(parentIndex), recursion!\n \n # this gets the correct ParentIndex for either L or R childIndex\n # ex: for parent @ index 1, its LC should be at index 3 and RC at index 4\n # calculating the parentIndex for index 3... we get (0.5).ceil = 1\n # and calculating the parentIndex for index 4... we get 1.ceil = 1\n parentIndex = ((index - 2).to_f / 2).ceil\n \n if @store[index].key >= @store[parentIndex].key\n return \n else\n swap(index, parentIndex)\n heap_up(parentIndex)\n return\n end\n end\n end", "def restructure\n node_id = params[:node_id].to_i\n parent_id = params[:parent_id].to_i\n prev_id = params[:prev_id].to_i\n next_id = params[:next_id].to_i\n\n render :text => \"Do nothing\" and return if parent_id.zero? && prev_id.zero? && next_id.zero?\n\n @realty_category ||= parent.realty_categories.find(node_id)\n\n if prev_id.zero? && next_id.zero?\n @realty_category.move_to_child_of parent.realty_categories.find(parent_id)\n elsif !prev_id.zero?\n @realty_category.move_to_right_of parent.realty_categories.find(prev_id)\n elsif !next_id.zero?\n @realty_category.move_to_left_of parent.realty_categories.find(next_id)\n end\n end", "def parent(i)\n\treturn ((i+1)/2).floor-1 #could be simpler\nend", "def rebalance_for_left_delete\n\t\t\trebalance = false\n\t\t\t[if black?\n\t\t\t\tif @right.black?\n\t\t\t\t\tif @right.children_color?(:black)\n\t\t\t\t\t\t# make whole sub-tree 1 level lower and ask rebalance\n\t\t\t\t\t\trebalance = true\n\t\t\t\t\t\twith_right(@right.with_color(:red))\n\t\t\t\t\telse\n\t\t\t\t\t\t# move 1 black from the right to the left by single/double rotation\n\t\t\t\t\t\tbalanced_rotate_left\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\t# flip this sub-tree into another type of 3-children node\n\t\t\t\t\tret = rotate_left\n\t\t\t\t\t# try to rebalance in sub-tree\n\t\t\t\t\tleft, rebalance = ret.left.rebalance_for_left_delete\n\t\t\t\t\traise 'should not happen' if rebalance\n\t\t\t\t\tret.with_left(left)\n\t\t\t\tend\n\t\t\telse # red\n\t\t\t\tif @right.children_color?(:black)\n\t\t\t\t\t# make right sub-tree 1 level lower\n\t\t\t\t\twith_right(@right.with_color(color)).with_color(@right.color)\n\t\t\t\telse\n\t\t\t\t\t# move 1 black from the right to the left by single/double rotation\n\t\t\t\t\tbalanced_rotate_left\n\t\t\t\tend\n\t\t\tend, rebalance]\n\t\tend", "def each_with_level(objects)\n path = [nil]\n objects.sort_by(&left_column_name.to_sym).each do |o|\n if o._parent_id != path.last\n # we are on a new level, did we decent or ascent?\n if path.include?(o._parent_id)\n # remove wrong wrong tailing paths elements\n path.pop while path.last != o._parent_id\n else\n path << o._parent_id\n end\n end\n yield(o, path.length - 1)\n end\n end", "def parent(index)\n # Ruby automatically floors integers\n return (index - 1) / 2 if index.even?\n index / 2 \n end", "def sorted_rows(rows, done = [])\n return done if rows.empty?\n\n if done.empty?\n done = start_nodes(rows)\n rows -= done\n end\n\n done += next_rows(rows, done)\n rows -= done\n\n sorted_rows(rows, done)\nend", "def heap_up(index)\n # base case: index is 0 \n if index > 0 \n # we need to subtract 1 from index to account for 0-indexing\n parent_i = (index - 1)/2\n\n # make sure its sibling isn't smaller, else swap them\n # i think technically you can just change which index\n # index is compared to, but the test got mad at me when i tried\n # that and i'm not sure how to avoid that, so i just swapped them \n # so i wouldn't have to change parent_i\n if @store[parent_i + 1].key < @store[parent_i].key \n swap(parent_i + 1, parent_i) \n end\n\n # check if swap needs to happen\n if @store[index].key < @store[parent_i].key\n swap(index, parent_i) \n heap_up(parent_i) # recursive call to keep bubbling up \n end\n\n # don't need to recursive call if reaches here; at correct position\n end\n end", "def toh_iterative(n)\n t = [['A', 'B', 'C']]\n col = 0 # starting column\n top = 1 # starting top disk\n n.downto(1) do |i|\n t.unshift([i, '', '']) # build starting tower array\n end\n t.to_table # print it\n moves = 2 ** n - 1\n\n moves.times do \n !n.even? ? left = 1 : left = -1 # if n odd, move odd disks left, else move right.\n startcol = col\n startrow = t.transpose[col].index(top)\n\n if !top.even?\n # move left if disk odd and n odd. move right if disk odd and n even.\n col -= left\n else\n # move right if disk even and n odd. move left if disk even and n odd.\n col += left \n end\n\n col = 2 if col < 0 # If moves off edge, swing it back around.\n col = 0 if col > 2\n \n endtop = t.transpose[col].detect {|d| d != ''} # top disk in new column\n row = t.transpose[col].index(endtop) - 1 # 1st empty row in new column\n\n t[startrow][startcol] = '' # erase entry in disk's previous location\n t[row][col] = top # write disk in new location\n t.to_table\n\n top_maybe = []\n\n (0..2).each do |c| # What disk do we move next?\n top_maybe[c] = t.transpose[c].detect {|d| d != ''} # top disk in column c\n\n # May not move current disk in next move. Make it high so it's not picked.\n top_maybe[c] = 100 if c == col \n top_maybe[c] = 100 if top_maybe[c].is_a?(String) # Column is empty\n end\n\n top = top_maybe.min # Next disk is smallest possible one.\n col = top_maybe.index(top)\n end\nend", "def heap_up(index)\n return if index == 0\n parent = (index - 1 ) / 2\n # Compare the new node with it's parent\n # If they are out of order swap and heap-up\n if @store[parent].key > @store[index].key\n #swap\n swap(index, parent)\n #continue heap-up\n heap_up(parent)\n end\n \n end", "def next_child_lft\n if child = children.find(:first, :order => %(lftq DESC))\n return lftp + child.lftp, lftq + child.lftq\n else\n return lftp + rgtp, lftq + rgtq\n end\n end", "def move count\n dir = count <0 ? 'in' : 'out' \n r= db.execute { \"select from ( traverse #{dir}(\\\"tg_grid_of\\\") from #{rrid} while $depth <= #{count.abs}) where $depth = #{count.abs} \" } \n if r.size == 1\n r.first\n else\n nil\n end\n end", "def collapse_parent node=:current_index\n node = row_to_node if node == :current_index\n parent = node.parent\n return if parent.nil?\n goto_parent node\n collapse_node parent\n end", "def bubble_up()\n\t\ti = @elements.length - 1\n\t\twhile(i > 0)\n\t\t\t# compare with its parent. swap if parent is less than it\n\t\t\tif @elements[(i-1)/2][@orderBy] >= @elements[i][@orderBy]\n\t\t\t\tbreak\n\t\t\telse\n\t\t\t\tswap((i-1)/2, i)\n\t\t\t\ti = (i-1)/2\n\t\t\tend\n\t\tend\n\tend", "def children\n out = [] \n (0..2).each do |row|\n (0..2).each do |col|\n pos = [row, col]\n out << next_move_node(pos) if @board.empty?(pos)\n end\n end\n out\n end", "def build_next_moves current_node\n cur_pos = current_node.value \n\n (0...8).each do |col|\n (0...8).each do |row|\n next_pos = [col, row] \n if valid_move?(cur_pos,next_pos)\n current_node.add_child(PolyTreeNode.new(next_pos))\n @all_positions[next_pos] = true \n end\n end\n end\n end", "def double_left_rotate( node=@tree )\n node.left = node.right.left\n node.right.left = nil\n node.value, node.left.value = node.left.value, node.value\n end", "def freshen_parent_and_child_indexes\n freshen_parent_and_child_indexes(0)\n end", "def reorder(options = {})\n if options[:parent] =~ /\\d/\n self.move_to_child_of options[:parent]\n else\n self.move_to_child_of Category.root\n end\n self.move_to_left_of options[:right].to_i if options[:right] =~ /\\d/\n end", "def find_lca_with_parents(node1, node2)\n one = depth(node1)\n two = depth(node2)\n\n diff = (one - two).abs\n\n if one > two\n diff.times do |i|\n two = two.parent\n end\n else\n diff.times do |i|\n one = one.parent\n end\n end\n\n\n until one == two\n one = one.parent\n two = two.parent\n end\n\n two\nend" ]
[ "0.6511597", "0.6508354", "0.64810616", "0.642226", "0.6399149", "0.6385493", "0.63786757", "0.6341004", "0.63172305", "0.6306539", "0.62997794", "0.6299388", "0.62524074", "0.6251893", "0.6248318", "0.6239566", "0.62389463", "0.61730915", "0.6151419", "0.61332077", "0.61247844", "0.6121907", "0.61089903", "0.6108443", "0.6107171", "0.6098793", "0.60654086", "0.60565", "0.60494995", "0.6012352", "0.5992713", "0.5986665", "0.59770215", "0.59514934", "0.59460336", "0.59413123", "0.5938889", "0.59363437", "0.59262127", "0.59218305", "0.58971703", "0.5894857", "0.5891507", "0.5886863", "0.58841664", "0.58811086", "0.58754", "0.5873775", "0.58650374", "0.58629566", "0.5862463", "0.58621037", "0.5839544", "0.5835538", "0.58270717", "0.58142203", "0.58062094", "0.5789215", "0.57697177", "0.576141", "0.57595146", "0.5757275", "0.57328635", "0.57260925", "0.57260805", "0.57200927", "0.5705754", "0.5702244", "0.56959593", "0.5691959", "0.5691959", "0.56891614", "0.56886554", "0.56730646", "0.5668904", "0.5668663", "0.5667356", "0.56671906", "0.5667022", "0.56647676", "0.5658466", "0.5652869", "0.5643663", "0.56232363", "0.56216127", "0.5620751", "0.56170005", "0.5616704", "0.5611941", "0.56097734", "0.56092846", "0.56080776", "0.55985755", "0.55964535", "0.55928767", "0.55912465", "0.5586325", "0.5582695", "0.5582139", "0.55819905", "0.5581052" ]
0.0
-1