Class: Leftovers::DefinitionSet

Inherits:
Object
  • Object
show all
Defined in:
lib/leftovers/definition_set.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#definitionsObject (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

Returns:

  • (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

Returns:

  • (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_sObject



21
22
23
# File 'lib/leftovers/definition_set.rb', line 21

def location_s
  @definitions.first.location_s
end

#namesObject



13
14
15
# File 'lib/leftovers/definition_set.rb', line 13

def names
  @definitions.map(&:names)
end

#test?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/leftovers/definition_set.rb', line 33

def test?
  @definitions.any?(&:test?)
end

#to_sObject



17
18
19
# File 'lib/leftovers/definition_set.rb', line 17

def to_s
  @definitions.map(&:to_s).join(', ')
end