Class: ViewHistory
- Inherits:
-
Struct
- Object
- Struct
- ViewHistory
- Defined in:
- lib/commands/view_history.rb
Instance Attribute Summary collapse
-
#date_format ⇒ Object
Returns the value of attribute date_format.
-
#project_name ⇒ Object
Returns the value of attribute project_name.
-
#properties(project = project) ⇒ Object
Returns the value of attribute properties.
Instance Method Summary collapse
- #call(formatter = formatter, records = records) ⇒ Object
- #format(date_format = date_format, metrics = metrics) ⇒ Object
- #formatter(format = format) ⇒ Object
- #metrics(project = project, properties = properties) ⇒ Object
- #project(project_name = project_name) ⇒ Object
- #records(metrics = metrics) ⇒ Object
Instance Attribute Details
#date_format ⇒ Object
Returns the value of attribute date_format
1 2 3 |
# File 'lib/commands/view_history.rb', line 1 def date_format @date_format end |
#project_name ⇒ Object
Returns the value of attribute project_name
1 2 3 |
# File 'lib/commands/view_history.rb', line 1 def project_name @project_name end |
#properties(project = project) ⇒ Object
Returns the value of attribute properties
1 2 3 |
# File 'lib/commands/view_history.rb', line 1 def properties @properties end |
Instance Method Details
#call(formatter = formatter, records = records) ⇒ Object
2 3 4 |
# File 'lib/commands/view_history.rb', line 2 def call formatter = formatter, records = records formatter.present records end |
#format(date_format = date_format, metrics = metrics) ⇒ Object
28 29 30 |
# File 'lib/commands/view_history.rb', line 28 def format date_format = date_format, metrics = metrics {'Date' => "created_at.strftime('#{date_format}')"}.merge list_metrics_format(metrics) end |
#formatter(format = format) ⇒ Object
14 15 16 |
# File 'lib/commands/view_history.rb', line 14 def formatter format = format ConsoleFormatter.new format end |
#metrics(project = project, properties = properties) ⇒ Object
22 23 24 25 26 |
# File 'lib/commands/view_history.rb', line 22 def metrics project = project, properties = properties properties.map do |property| project.property property end.compact end |
#project(project_name = project_name) ⇒ Object
6 7 8 |
# File 'lib/commands/view_history.rb', line 6 def project project_name = project_name Project.find_by name: project_name end |
#records(metrics = metrics) ⇒ Object
10 11 12 |
# File 'lib/commands/view_history.rb', line 10 def records metrics = metrics metrics.collect(&:values).flatten end |