Class: Smartest::FixtureClassRegistry
- Inherits:
-
Object
- Object
- Smartest::FixtureClassRegistry
- Includes:
- Enumerable
- Defined in:
- lib/smartest/fixture_class_registry.rb
Instance Method Summary collapse
- #add(klass) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize ⇒ FixtureClassRegistry
constructor
A new instance of FixtureClassRegistry.
- #to_a ⇒ Object
Constructor Details
#initialize ⇒ FixtureClassRegistry
Returns a new instance of FixtureClassRegistry.
7 8 9 |
# File 'lib/smartest/fixture_class_registry.rb', line 7 def initialize @fixture_classes = [] end |
Instance Method Details
#add(klass) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/smartest/fixture_class_registry.rb', line 11 def add(klass) unless klass.is_a?(Class) && klass <= Fixture raise ArgumentError, "fixture class must inherit from Smartest::Fixture" end @fixture_classes << klass unless @fixture_classes.include?(klass) end |
#each(&block) ⇒ Object
19 20 21 |
# File 'lib/smartest/fixture_class_registry.rb', line 19 def each(&block) @fixture_classes.each(&block) end |
#to_a ⇒ Object
23 24 25 |
# File 'lib/smartest/fixture_class_registry.rb', line 23 def to_a @fixture_classes.dup end |