Class: StatusEnumerator
- Inherits:
-
Object
- Object
- StatusEnumerator
- Defined in:
- lib/status_enumerator.rb
Defined Under Namespace
Classes: Status
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(target) ⇒ StatusEnumerator
constructor
A new instance of StatusEnumerator.
- #status_class ⇒ Object
Constructor Details
#initialize(target) ⇒ StatusEnumerator
Returns a new instance of StatusEnumerator.
2 3 4 5 |
# File 'lib/status_enumerator.rb', line 2 def initialize(target) raise ArgumentError, '%s is not redpond to #each' % target.class.name if target.nil? or !target.respond_to?(:each) @target = target end |
Instance Method Details
#each(&block) ⇒ Object
7 8 9 |
# File 'lib/status_enumerator.rb', line 7 def each(&block) status_class.send(:new, nil, &block).send(:each_status, @target) end |
#status_class ⇒ Object
11 |
# File 'lib/status_enumerator.rb', line 11 def status_class; Status end |