Class: DiverDown::Web::DefinitionEnumerator
- Inherits:
-
Object
- Object
- DiverDown::Web::DefinitionEnumerator
- Includes:
- Enumerable
- Defined in:
- lib/diver_down/web/definition_enumerator.rb
Instance Method Summary collapse
- #each {|parent_bit_id, bit_id, definition| ... } ⇒ Object
-
#initialize(store, title: '', source: '', definition_group: '') ⇒ DefinitionEnumerator
constructor
A new instance of DefinitionEnumerator.
- #size ⇒ Integer (also: #length)
Constructor Details
#initialize(store, title: '', source: '', definition_group: '') ⇒ DefinitionEnumerator
Returns a new instance of DefinitionEnumerator.
11 12 13 14 15 16 |
# File 'lib/diver_down/web/definition_enumerator.rb', line 11 def initialize(store, title: '', source: '', definition_group: '') @store = store @title = title @source = source @definition_group = definition_group end |
Instance Method Details
#each {|parent_bit_id, bit_id, definition| ... } ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/diver_down/web/definition_enumerator.rb', line 19 def each return enum_for(__method__) unless block_given? definition_groups = @store.definition_groups definition_groups.each do |definition_group| definitions = @store.filter_by_definition_group(definition_group) definitions.each do next unless match_definition?(_1) yield(_1) end end end |
#size ⇒ Integer Also known as: length
34 35 36 |
# File 'lib/diver_down/web/definition_enumerator.rb', line 34 def size @store.size end |