Class: Leftovers::DefinitionSet
- Inherits:
-
Object
- Object
- Leftovers::DefinitionSet
- Defined in:
- lib/leftovers/definition_set.rb
Instance Attribute Summary collapse
-
#definitions ⇒ Object
readonly
Returns the value of attribute definitions.
Instance Method Summary collapse
- #highlighted_source(*args) ⇒ Object
- #in_collection?(collection) ⇒ Boolean
- #in_test_collection?(collection) ⇒ Boolean
-
#initialize(definitions) ⇒ DefinitionSet
constructor
A new instance of DefinitionSet.
- #location_s ⇒ Object
- #names ⇒ Object
- #test? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(definitions) ⇒ DefinitionSet
Returns a new instance of DefinitionSet.
7 8 9 10 11 |
# File 'lib/leftovers/definition_set.rb', line 7 def initialize(definitions) @definitions = definitions freeze end |
Instance Attribute Details
#definitions ⇒ Object (readonly)
Returns the value of attribute definitions.
5 6 7 |
# File 'lib/leftovers/definition_set.rb', line 5 def definitions @definitions end |
Instance Method Details
#highlighted_source(*args) ⇒ Object
25 26 27 |
# File 'lib/leftovers/definition_set.rb', line 25 def highlighted_source(*args) @definitions.first.highlighted_source(*args) end |
#in_collection?(collection) ⇒ Boolean
29 30 31 |
# File 'lib/leftovers/definition_set.rb', line 29 def in_collection?(collection) @definitions.any? { |d| d.in_collection?(collection) } end |
#in_test_collection?(collection) ⇒ Boolean
37 38 39 |
# File 'lib/leftovers/definition_set.rb', line 37 def in_test_collection?(collection) @definitions.any? { |d| d.in_test_collection?(collection) } end |
#location_s ⇒ Object
21 22 23 |
# File 'lib/leftovers/definition_set.rb', line 21 def location_s @definitions.first.location_s end |
#names ⇒ Object
13 14 15 |
# File 'lib/leftovers/definition_set.rb', line 13 def names @definitions.map(&:names) end |
#test? ⇒ Boolean
33 34 35 |
# File 'lib/leftovers/definition_set.rb', line 33 def test? @definitions.any?(&:test?) end |
#to_s ⇒ Object
17 18 19 |
# File 'lib/leftovers/definition_set.rb', line 17 def to_s @definitions.map(&:to_s).join(', ') end |