Class: MakeData::FakerFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/make_data.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(category) ⇒ FakerFinder

Returns a new instance of FakerFinder.

Raises:

  • (ArgumentError)


11
12
13
14
# File 'lib/make_data.rb', line 11

def initialize(category)
  @category = category
  raise ArgumentError.new("Invalid Category") unless Faker.const_get(@category)
end

Instance Attribute Details

#categoryObject

Returns the value of attribute category.



9
10
11
# File 'lib/make_data.rb', line 9

def category
  @category
end

Class Method Details

.available_categoriesObject



16
17
18
# File 'lib/make_data.rb', line 16

def self.available_categories
  Faker.constants - [:Config, :VERSION, :Base, :UniqueGenerator]
end

Instance Method Details

#available_methodsObject



24
25
26
# File 'lib/make_data.rb', line 24

def available_methods
  klass.methods - klass.superclass.methods
end

#klassObject



20
21
22
# File 'lib/make_data.rb', line 20

def klass
  Faker.const_get(@category)
end