Class: GemDating::Result
- Inherits:
-
Object
- Object
- GemDating::Result
- Defined in:
- lib/gem_dating/result.rb
Instance Attribute Summary collapse
-
#specs ⇒ Object
readonly
Returns the value of attribute specs.
Instance Method Summary collapse
-
#initialize(specs) ⇒ Result
constructor
A new instance of Result.
- #table_print ⇒ Object
- #to_a ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(specs) ⇒ Result
Returns a new instance of Result.
6 7 8 |
# File 'lib/gem_dating/result.rb', line 6 def initialize(specs) @specs = specs end |
Instance Attribute Details
#specs ⇒ Object (readonly)
Returns the value of attribute specs.
5 6 7 |
# File 'lib/gem_dating/result.rb', line 5 def specs @specs end |
Instance Method Details
#table_print ⇒ Object
24 25 26 |
# File 'lib/gem_dating/result.rb', line 24 def table_print TablePrint::Printer.table_print(specs, [:name, :version, {date: {time_format: "%Y-%m-%d", width: 10}}]).encode("utf-8") end |
#to_a ⇒ Object
10 11 12 |
# File 'lib/gem_dating/result.rb', line 10 def to_a specs end |
#to_h ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/gem_dating/result.rb', line 14 def to_h specs.each_with_object({}) do |spec, result| result[spec.name] = { "name" => spec.name, "version" => spec.version.to_s, "date" => spec.date.strftime("%Y-%m-%d") } end end |