class FortuneFinder

Constants

YEAR

Public Class Methods

all() click to toggle source
# File lib/fortune-finder.rb, line 23
def all
  @all ||= Dir["#{domains_path}/*.toml"].map { |d| lookup File.basename(d, ".toml") }.sort_by { |d| d.rank }
end
domains_path() click to toggle source
# File lib/fortune-finder.rb, line 15
def domains_path
  @domains_path ||= File.expand_path "./data/#{YEAR}", File.dirname(__FILE__)
end
lookup(domain) click to toggle source
# File lib/fortune-finder.rb, line 19
def lookup(domain)
  FortuneFinder.new(domain).lookup
end

Public Instance Methods

fortune1000?()
Alias for: valid?
fortune100?() click to toggle source
# File lib/fortune-finder.rb, line 38
def fortune100?
  ranked? && record.rank <= 100
end
fortune500?() click to toggle source
# File lib/fortune-finder.rb, line 42
def fortune500?
  ranked? && record.rank <= 500
end
fortune50?() click to toggle source
# File lib/fortune-finder.rb, line 34
def fortune50?
  ranked? && record.rank <= 50
end
lookup()
Alias for: record
ranked?()
Alias for: valid?
record() click to toggle source

Look up a domain name to see if it's the Fortune 2000 list.

Returns a hash with the ranking and company name if one is found e.g.

#=> {:rank => 1, :name => 'GitHub'}

returns nil if nothing is found.

# File lib/fortune-finder.rb, line 51
def record
  @record ||= begin
    record = FortuneFinder::Record.new(domain)
    record if record.exists?
  end
end
Also aliased as: lookup
valid?() click to toggle source
# File lib/fortune-finder.rb, line 28
def valid?
  !!record
end
Also aliased as: ranked?, fortune1000?