class Tempo::Views::ViewRecords::Model
Base model class, used for extending views for any child of Tempo::Model::Base
Sets the id, and type, where type is the class type of the model, for example “project” for Tempo::Model::Project
. ViewReord::Model should handle any type of tempo model without error, but most likely won't be as useful as a child class taylored to the specifics of the actual model's child class.
Containers send :pospone => true in options in order to manage triggering the message themselves
Attributes
id[RW]
type[RW]
Public Class Methods
new(model, options={})
click to toggle source
# File lib/tempo/views/view_records/base.rb, line 129 def initialize(model, options={}) @id = model.id # example: Tempo::Model::Something => "something" @type = /Tempo::Model::(.*)$/.match( model.class.to_s )[1].downcase Reporter.add_view_record self unless options[:postpone] end
Public Instance Methods
format(&block)
click to toggle source
# File lib/tempo/views/view_records/base.rb, line 137 def format(&block) block ||= lambda {|model| "#{ model.type.capitalize} #{model.id}"} block.call self end