class TopCompanies::Company

Attributes

ceo[RW]
location[RW]
name[RW]
sector[RW]
slug[RW]
website[RW]

Public Class Methods

all() click to toggle source
# File lib/top_companies/company.rb, line 25
def self.all
    @@all
end
create_from_collection(companies_array) click to toggle source
# File lib/top_companies/company.rb, line 13
def self.create_from_collection(companies_array)
    companies_array.each do |company_hash|
        TopCompanies::Company.new(company_hash)
    end
end
new(company_hash) click to toggle source
# File lib/top_companies/company.rb, line 6
def initialize(company_hash)
    company_hash.each do |attribute, value|
        self.send("#{attribute}=", value)
    end
    @@all << self
end

Public Instance Methods

add_attributes(company_hash) click to toggle source
# File lib/top_companies/company.rb, line 19
def add_attributes(company_hash)
    company_hash.each do |attribute, value|
        self.send("#{attribute}=", value)
    end
end