Class: Tempo::Views::ViewRecords::Project
- Defined in:
- lib/tempo/views/view_records/project.rb
Overview
Project ViewRecords adds the project title, any tags, and a duration to the composite model. It also keeps track of the maximum title length of all Project views.
:depth is inhereted from Composite
Instance Attribute Summary collapse
-
#current ⇒ Object
Returns the value of attribute current.
-
#duration ⇒ Object
Returns the value of attribute duration.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#title ⇒ Object
Returns the value of attribute title.
Attributes inherited from Composite
Attributes inherited from Model
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(model, options = {}) ⇒ Project
constructor
A new instance of Project.
Methods inherited from Composite
Methods inherited from Model
Constructor Details
#initialize(model, options = {}) ⇒ Project
Returns a new instance of Project.
21 22 23 24 25 26 27 28 |
# File 'lib/tempo/views/view_records/project.rb', line 21 def initialize(model, ={}) super model, @title = model.title @tags = model. @current = model.current? @duration = Duration.new self.class.max_title_length @title.length end |
Instance Attribute Details
#current ⇒ Object
Returns the value of attribute current.
12 13 14 |
# File 'lib/tempo/views/view_records/project.rb', line 12 def current @current end |
#duration ⇒ Object
Returns the value of attribute duration.
12 13 14 |
# File 'lib/tempo/views/view_records/project.rb', line 12 def duration @duration end |
#tags ⇒ Object
Returns the value of attribute tags.
12 13 14 |
# File 'lib/tempo/views/view_records/project.rb', line 12 def @tags end |
#title ⇒ Object
Returns the value of attribute title.
12 13 14 |
# File 'lib/tempo/views/view_records/project.rb', line 12 def title @title end |
Class Method Details
.max_title_length(len = 0) ⇒ Object
15 16 17 18 |
# File 'lib/tempo/views/view_records/project.rb', line 15 def max_title_length(len=0) @max_title_length ||= 0 @max_title_length = @max_title_length > len ? @max_title_length : len end |