Class: FactoryHelper::Company

Inherits:
Base
  • Object
show all
Defined in:
lib/factory-helper/company.rb

Constant Summary

Constants inherited from Base

Base::Letters, Base::Numbers, Base::ULetters

Class Method Summary collapse

Methods inherited from Base

bothify, fetch, flexible, letterify, method_missing, numerify, parse, rand_in_range, regexify, translate

Class Method Details

.bsObject

When a straight answer won’t do, BS to the rescue!



25
26
27
# File 'lib/factory-helper/company.rb', line 25

def bs
  translate('factory_helper.company.bs').collect {|list| list.sample(:random => FactoryHelper::Config.random) }.join(' ')
end

.buzzwordObject



20
21
22
# File 'lib/factory-helper/company.rb', line 20

def buzzword
  translate('factory_helper.company.buzzwords').flatten.sample(:random => FactoryHelper::Config.random)
end

.catch_phraseObject

Generate a buzzword-laden catch phrase.



16
17
18
# File 'lib/factory-helper/company.rb', line 16

def catch_phrase
  translate('factory_helper.company.buzzwords').collect {|list| list.sample(:random => FactoryHelper::Config.random) }.join(' ')
end

.duns_numberObject



33
34
35
# File 'lib/factory-helper/company.rb', line 33

def duns_number
  ('%09d' % FactoryHelper::Config.random.rand(10 ** 9)).gsub(/(\d\d)(\d\d\d)(\d\d\d\d)/, '\\1-\\2-\\3')
end

.einObject



29
30
31
# File 'lib/factory-helper/company.rb', line 29

def ein
  ('%09d' % FactoryHelper::Config.random.rand(10 ** 9)).gsub(/(\d\d)(\d\d\d\d\d\d\d)/, '\\1-\\2')
end

.logoObject

Get a random company logo url in PNG format.



38
39
40
41
# File 'lib/factory-helper/company.rb', line 38

def 
  rand_num = FactoryHelper::Config.random.rand(13) + 1
  "http://pigment.github.io/fake-logos/logos/medium/color/#{rand_num}.png"
end

.nameObject



7
8
9
# File 'lib/factory-helper/company.rb', line 7

def name
  parse('company.name')
end

.suffixObject



11
12
13
# File 'lib/factory-helper/company.rb', line 11

def suffix
  fetch('company.suffix')
end