Sha256: 870ba1e19fc5e9a600f71dad0b43e533ca4fcf136056301c1091cc34a7c0f41f

Contents?: true

Size: 460 Bytes

Versions: 2

Compression:

Stored size: 460 Bytes

Contents

module Troo
  class Preference
    include Virtus.value_object

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

    class << self
      # @param  [Hash]
      # @return []
      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

2 entries across 2 versions & 1 rubygems

Version Path
troo-0.0.12 lib/troo/preference.rb
troo-0.0.11 lib/troo/preference.rb