Class: MakeData::FakerFinder
- Inherits:
-
Object
- Object
- MakeData::FakerFinder
- Defined in:
- lib/make_data.rb
Instance Attribute Summary collapse
-
#category ⇒ Object
Returns the value of attribute category.
Class Method Summary collapse
Instance Method Summary collapse
- #available_methods ⇒ Object
-
#initialize(category) ⇒ FakerFinder
constructor
A new instance of FakerFinder.
- #klass ⇒ Object
Constructor Details
#initialize(category) ⇒ FakerFinder
Returns a new instance of FakerFinder.
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
#category ⇒ Object
Returns the value of attribute category.
9 10 11 |
# File 'lib/make_data.rb', line 9 def category @category end |
Class Method Details
.available_categories ⇒ Object
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_methods ⇒ Object
24 25 26 |
# File 'lib/make_data.rb', line 24 def available_methods klass.methods - klass.superclass.methods end |
#klass ⇒ Object
20 21 22 |
# File 'lib/make_data.rb', line 20 def klass Faker.const_get(@category) end |