Sha256: 3a9009029ed23d9526b9337872cf6a42ad06b174a785b93e67750e283a56f306

Contents?: true

Size: 722 Bytes

Versions: 1

Compression:

Stored size: 722 Bytes

Contents

module Troo
  class Configuration
    include Virtus.value_object

    values do
      attribute :name
      attribute :api_url
      attribute :api_key
      attribute :api_token
      attribute :api_oauth_token
      attribute :api_oauth_token_secret
      attribute :database
      attribute :allow_remote, Boolean, default: true
      attribute :logs,         Boolean, default: false
    end

    class << self
      # @param  []
      # @param  [String]
      # @return []
      def load(file, env)
        new(YAML.load_file(file)[env])
      end
    end

    # @return []
    def view
      attributes.map do |label, value|
        Preference.view(label: label, value: value)
      end.join("\n")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
troo-0.0.11 lib/troo/configuration.rb