Class: Tempo::Views::ViewRecords::Log
- 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
Instance Attribute Summary collapse
-
#d_id ⇒ Object
Returns the value of attribute d_id.
-
#start_time ⇒ Object
Returns the value of attribute start_time.
Attributes inherited from Model
Instance Method Summary collapse
- #format(&block) ⇒ Object
-
#initialize(model, options = {}) ⇒ Log
constructor
A new instance of Log.
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, ={}) super model, @start_time = model.start_time @d_id = model.d_id end |
Instance Attribute Details
#d_id ⇒ Object
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_time ⇒ Object
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 |