Class: Bickle::LengthDecorator

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/bickle/length_decorator.rb

Instance Method Summary collapse

Constructor Details

#initialize(build, column_widths = {}) ⇒ LengthDecorator

Returns a new instance of LengthDecorator.



3
4
5
6
7
8
# File 'lib/bickle/length_decorator.rb', line 3

def initialize(build, column_widths = {})
  @build         = build
  @column_widths = column_widths

  super(@build)
end

Instance Method Details

#branchObject



18
19
20
# File 'lib/bickle/length_decorator.rb', line 18

def branch
  normalize_width(@build.branch, "branch", 10)
end

#commitObject



14
15
16
# File 'lib/bickle/length_decorator.rb', line 14

def commit
  normalize_width(@build.commit, "commit", 5)
end

#messageObject



22
23
24
25
26
27
28
# File 'lib/bickle/length_decorator.rb', line 22

def message
  message = @build.message
  message = message.gsub(/\s+/, " ")
  message = message.strip

  normalize_width(message, "message", 50)
end

#stateObject



10
11
12
# File 'lib/bickle/length_decorator.rb', line 10

def state
  normalize_width(@build.state, "state", 10)
end