Class: Tempo::Views::ViewRecords::Project

Inherits:
Composite show all
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

Attributes inherited from Composite

#depth

Attributes inherited from Model

#id, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Composite

#format, max_depth

Methods inherited from Model

#format

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, options={})
  super model, options
  @title = model.title
  @tags = model.tags
  @current = model.current?
  @duration = Duration.new
  self.class.max_title_length @title.length
end

Instance Attribute Details

#currentObject

Returns the value of attribute current.



12
13
14
# File 'lib/tempo/views/view_records/project.rb', line 12

def current
  @current
end

#durationObject

Returns the value of attribute duration.



12
13
14
# File 'lib/tempo/views/view_records/project.rb', line 12

def duration
  @duration
end

#tagsObject

Returns the value of attribute tags.



12
13
14
# File 'lib/tempo/views/view_records/project.rb', line 12

def tags
  @tags
end

#titleObject

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