Class: Debtective::Comments::Print

Inherits:
Object
  • Object
show all
Defined in:
lib/debtective/comments/print.rb

Overview

Print elements as a table in the stdout and return the block result

Defined Under Namespace

Classes: Column

Constant Summary collapse

COLUMNS =
[
  Column.new(
    "location",
    "%-100.100s",
    -> { _1.location }
  ),
  Column.new(
    "type",
    "%-7.7s",
    -> { _1.type }
  ),
  Column.new(
    "author",
    "%-20.20s",
    -> { _1.commit.author.name || "?" }
  )
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(user_name: nil) ⇒ Print

Returns a new instance of Print.

Parameters:

  • user_name (String) (defaults to: nil)

    git user name to filter with



30
31
32
# File 'lib/debtective/comments/print.rb', line 30

def initialize(user_name: nil)
  @user_name = user_name
end

Instance Method Details

#callObject

Returns yielded bloc result.

Returns:

  • (Object)

    yielded bloc result



35
36
37
38
39
40
41
42
43
44
# File 'lib/debtective/comments/print.rb', line 35

def call
  puts separator
  puts headers_row
  puts separator
  trace.enable
  result = yield
  trace.disable
  puts separator
  result
end