Class: Tempo::Views::ViewRecords::Log

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

Overview

Base Composite log class, used for extending views for any child of Tempo::Model::Log Inherits the id, and type from ViewRecords::Model, and adds an start time and date_id.

The Log View Model is an abstract model that is extended to create views for children of the Log Model class. See ViewRecords::TimeRecord for an example.

Direct Known Subclasses

TimeRecord

Instance Attribute Summary collapse

Attributes inherited from Model

#id, #type

Instance Method Summary collapse

Constructor Details

#initialize(model, options = {}) ⇒ Log

Returns a new instance of Log.



15
16
17
18
19
# File 'lib/tempo/views/view_records/log.rb', line 15

def initialize(model, options={})
  super model, options
  @start_time = model.start_time
  @d_id = model.d_id
end

Instance Attribute Details

#d_idObject

Returns the value of attribute d_id.



13
14
15
# File 'lib/tempo/views/view_records/log.rb', line 13

def d_id
  @d_id
end

#start_timeObject

Returns the value of attribute start_time.



13
14
15
# File 'lib/tempo/views/view_records/log.rb', line 13

def start_time
  @start_time
end

Instance Method Details

#format(&block) ⇒ Object



21
22
23
24
# File 'lib/tempo/views/view_records/log.rb', line 21

def format(&block)
  block ||= lambda {|model| "#{ model.type.capitalize} #{model.d_id}-#{model.id} #{model.start_time.strftime('%H:%M')}"}
  block.call self
end