Sha256: aabbcb8cd6eaa15c1d5f762b652995c0cd132d1b79ec48f904517fc15be230e3

Contents?: true

Size: 466 Bytes

Versions: 3

Compression:

Stored size: 466 Bytes

Contents

module Troo
  class Preference
    include Virtus.value_object

    values do
      attribute :label, String
      attribute :value, String
    end

    class << self
      # @param  [Hash]
      # @return [String]
      def view(parameters)
        new(parameters).view
      end
    end

    # @return [String]
    def view
      [formatted_label, value].join(' ')
    end

    private

    def formatted_label
      (label + ':').rjust(25, ' ')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
troo-0.0.15 lib/troo/preference.rb
troo-0.0.14 lib/troo/preference.rb
troo-0.0.13 lib/troo/preference.rb