Class: Norman::KeyIterator
- Inherits:
-
Object
- Object
- Norman::KeyIterator
- Includes:
- Enumerable
- Defined in:
- lib/norman/abstract_key_set.rb
Instance Attribute Summary collapse
-
#callable ⇒ Object
readonly
Returns the value of attribute callable.
-
#keys ⇒ Object
readonly
Returns the value of attribute keys.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(keys, &callable) ⇒ KeyIterator
constructor
A new instance of KeyIterator.
Constructor Details
#initialize(keys, &callable) ⇒ KeyIterator
Returns a new instance of KeyIterator.
97 98 99 100 |
# File 'lib/norman/abstract_key_set.rb', line 97 def initialize(keys, &callable) @keys = keys @callable = callable end |
Instance Attribute Details
#callable ⇒ Object (readonly)
Returns the value of attribute callable.
95 96 97 |
# File 'lib/norman/abstract_key_set.rb', line 95 def callable @callable end |
#keys ⇒ Object (readonly)
Returns the value of attribute keys.
95 96 97 |
# File 'lib/norman/abstract_key_set.rb', line 95 def keys @keys end |
Instance Method Details
#each(&block) ⇒ Object
102 103 104 |
# File 'lib/norman/abstract_key_set.rb', line 102 def each(&block) block_given? ? keys.each {|k| yield callable.call(k)} : to_enum end |