Class: Most::Report

Inherits:
Object show all
Defined in:
lib/most/structures/types/report.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = 'Untitled Report', specs = {}) ⇒ Report

Returns a new instance of Report.



26
27
28
29
30
31
# File 'lib/most/structures/types/report.rb', line 26

def initialize(name = 'Untitled Report', specs = {})
  @name  = name
  @specs = specs
  
  @units = []
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



24
25
26
# File 'lib/most/structures/types/report.rb', line 24

def name
  @name
end

#specsObject

Returns the value of attribute specs.



24
25
26
# File 'lib/most/structures/types/report.rb', line 24

def specs
  @specs
end

#unitsObject

Returns the value of attribute units.



24
25
26
# File 'lib/most/structures/types/report.rb', line 24

def units
  @units
end

Instance Method Details

#add_entry(entry) ⇒ Object Also known as: <<



33
34
35
# File 'lib/most/structures/types/report.rb', line 33

def add_entry(entry)
  @units << entry
end

#delete_entry(entry) ⇒ Object Also known as: delete



48
49
50
# File 'lib/most/structures/types/report.rb', line 48

def delete_entry(entry)
  @units.delete(entry)
end

#delete_entry_at(index) ⇒ Object Also known as: delete_at



53
54
55
# File 'lib/most/structures/types/report.rb', line 53

def delete_entry_at(index)
  @units.delete_at(index)
end

#first_entryObject Also known as: first



58
59
60
# File 'lib/most/structures/types/report.rb', line 58

def first_entry()
  @units.first
end

#first_entry=(entry) ⇒ Object Also known as: first=



63
64
65
# File 'lib/most/structures/types/report.rb', line 63

def first_entry=(entry)
  @units.first = entry
end

#get_entry(index) ⇒ Object Also known as: []



38
39
40
# File 'lib/most/structures/types/report.rb', line 38

def get_entry(index)
  @units[index]
end

#last_entryObject Also known as: last



68
69
70
# File 'lib/most/structures/types/report.rb', line 68

def last_entry()
  @units.last
end

#last_entry=(entry) ⇒ Object Also known as: last=



73
74
75
# File 'lib/most/structures/types/report.rb', line 73

def last_entry=(entry)
  @units.last = entry
end

#set_entry(index, value) ⇒ Object Also known as: []=



43
44
45
# File 'lib/most/structures/types/report.rb', line 43

def set_entry(index, value)
  @units[index] = value
end

#to_sObject Also known as: text



78
79
80
# File 'lib/most/structures/types/report.rb', line 78

def to_s()
  to_yaml()
end