Class: CO2Equivalents::Group

Inherits:
Object
  • Object
show all
Defined in:
lib/co2_equivalents/group.rb

Class Method Summary collapse

Class Method Details

.citation(*args) ⇒ Object



15
16
17
18
19
20
# File 'lib/co2_equivalents/group.rb', line 15

def citation(*args)
  @citations ||= []
  citation = Citation.new *args
  @citations.push(citation)
  citation
end

.citationsObject



22
23
24
# File 'lib/co2_equivalents/group.rb', line 22

def citations
  @citations
end

.description(value = nil) ⇒ Object



8
9
10
11
12
13
# File 'lib/co2_equivalents/group.rb', line 8

def description(value = nil)
  if value
    @description = value
  end
  @description
end

.equivalencesObject



33
34
35
# File 'lib/co2_equivalents/group.rb', line 33

def equivalences
  @equivalences ||= {}
end

.equivalent(*args) ⇒ Object



26
27
28
29
30
31
# File 'lib/co2_equivalents/group.rb', line 26

def equivalent(*args)
  args.unshift self
  equivalent = CO2Equivalents.register *args
  equivalences[equivalent.name] = equivalent
  equivalent
end

.inherited(subclass) ⇒ Object



4
5
6
# File 'lib/co2_equivalents/group.rb', line 4

def inherited(subclass)
  CO2Equivalents.groups.push subclass
end