Class: DescribeProject

Inherits:
Struct
  • Object
show all
Defined in:
lib/commands/describe_project.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#date_formatObject

Returns the value of attribute date_format

Returns:

  • (Object)

    the current value of date_format



1
2
3
# File 'lib/commands/describe_project.rb', line 1

def date_format
  @date_format
end

#project_nameObject

Returns the value of attribute project_name

Returns:

  • (Object)

    the current value of project_name



1
2
3
# File 'lib/commands/describe_project.rb', line 1

def project_name
  @project_name
end

Instance Method Details

#call(formatter_class = ConsoleFormatter, records = records) ⇒ Object



2
3
4
# File 'lib/commands/describe_project.rb', line 2

def call formatter_class = ConsoleFormatter, records = records
  formatter(formatter_class).present records
end

#format(date_format = date_format) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/commands/describe_project.rb', line 18

def format date_format = date_format
  {
      'Metric' => 'name',
      'Value' => 'last_value',
      'Changed at' => "last_updated_at.try :strftime, '#{date_format}'",
      'Changed by' => "last_updated_by"
  }
end

#formatter(formatter_class, format = format) ⇒ Object



14
15
16
# File 'lib/commands/describe_project.rb', line 14

def formatter formatter_class, format = format
  formatter_class.new format
end

#project(project_name = project_name) ⇒ Object



6
7
8
# File 'lib/commands/describe_project.rb', line 6

def project project_name = project_name
  Project.find_by name: project_name
end

#records(project = project) ⇒ Object



10
11
12
# File 'lib/commands/describe_project.rb', line 10

def records project = project
  project.metrics
end