Class: Tempo::Views::ViewRecords::Container

Inherits:
Object
  • Object
show all
Defined in:
lib/tempo/views/view_records/container.rb

Direct Known Subclasses

TimeRecordContainer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Container

Returns a new instance of Container.



13
14
15
16
17
18
19
20
# File 'lib/tempo/views/view_records/container.rb', line 13

def initialize(options={})
  # TODO: add error checking for pre and post, better handling nil values
  @pre = options.fetch( :pre, nil )
  @post = options.fetch( :post, nil )
  @type = "container"
  @collection = [] # handle records on init?
  Reporter.add_view_record self unless options[:postpone]
end

Instance Attribute Details

#postObject

Returns the value of attribute post.



11
12
13
# File 'lib/tempo/views/view_records/container.rb', line 11

def post
  @post
end

#preObject

Returns the value of attribute pre.



11
12
13
# File 'lib/tempo/views/view_records/container.rb', line 11

def pre
  @pre
end

#typeObject

Returns the value of attribute type.



11
12
13
# File 'lib/tempo/views/view_records/container.rb', line 11

def type
  @type
end

Instance Method Details

#add(record) ⇒ Object

add a splat?



23
24
25
# File 'lib/tempo/views/view_records/container.rb', line 23

def add(record)
  @collection << record
end

#recordsObject

TODO: Implement pre and post method with logic to handle both

views reocrds and strings. See post in TimeRecordContainer
for use case


31
32
33
# File 'lib/tempo/views/view_records/container.rb', line 31

def records
  @collection
end