Class: KPM::Formatter::VersionFormatter
- Inherits:
-
Object
- Object
- KPM::Formatter::VersionFormatter
- Defined in:
- lib/kpm/formatter.rb
Overview
Used for the version map
Instance Method Summary collapse
-
#initialize(label, versions) ⇒ VersionFormatter
constructor
A new instance of VersionFormatter.
- #label ⇒ Object
- #size ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(label, versions) ⇒ VersionFormatter
Returns a new instance of VersionFormatter.
36 37 38 39 |
# File 'lib/kpm/formatter.rb', line 36 def initialize(label, versions) @label = label @versions = versions end |
Instance Method Details
#label ⇒ Object
56 57 58 |
# File 'lib/kpm/formatter.rb', line 56 def label "#{@label.to_s.upcase.gsub(/_/, ' ')} sha1=[], def=(*), del=(x)" end |
#size ⇒ Object
41 42 43 |
# File 'lib/kpm/formatter.rb', line 41 def size to_s.size end |
#to_s ⇒ Object
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/kpm/formatter.rb', line 45 def to_s @versions.map do |q| sha1 = format_sha(q[:sha1]) disabled = '' disabled = '(x)' if q[:is_disabled] default = '' default = '(*)' if q[:is_default] "#{q[:version]}#{sha1}#{default}#{disabled}" end.join(', ') end |