Sha256: 659272b0a8bffe1ade1d657c34c6271d151095676428cdf305b8db71cec65e0a
Contents?: true
Size: 746 Bytes
Versions: 1
Compression:
Stored size: 746 Bytes
Contents
module Bickle class LengthDecorator < SimpleDelegator def initialize(build, column_widths = {}) @build = build @column_widths = column_widths super(@build) end def state normalize_width(@build.state, "state", 10) end def commit normalize_width(@build.commit, "commit", 5) end def branch normalize_width(@build.branch, "branch", 10) end def message message = @build.message message = message.gsub(/\s+/, " ") message = message.strip normalize_width(message, "message", 50) end private def normalize_width(value, key, default) width = Integer(@column_widths[key] || default) value[0...width] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bickle-0.0.1 | lib/bickle/length_decorator.rb |