Sha256: 14685442d542bc3c26214c234dfb74d829f516cb541b1ae3920300471ab54e92

Contents?: true

Size: 654 Bytes

Versions: 2

Compression:

Stored size: 654 Bytes

Contents

class DescribeProject < Struct.new :project_name, :date_format
  def call formatter_class = ConsoleFormatter, records = records
    formatter(formatter_class).present records
  end

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

  def records project = project
    project.metrics
  end

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

  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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
techcor-0.0.10 lib/commands/describe_project.rb
techcor-0.0.9 lib/commands/describe_project.rb