Sha256: 418dbffe8223b7544b578171c54418cbab8a69b507fde78a387e9ea680d433c9

Contents?: true

Size: 507 Bytes

Versions: 2

Compression:

Stored size: 507 Bytes

Contents

# coding: utf-8
module Mastar
  class Configuration
    def initialize(options = {})
      opts = options.is_a?(Hash) ? options : {}
      [:name, :value, :key].each do |k|
        v = opts[k] || opts[k.to_s]
        __send__(k, v.to_sym) if v
      end
    end

    def name(name = nil)
      @name = name if name
      @name || :name
    end

    def value(value = nil)
      @value = value if value
      @value || :id
    end

    def key(key = nil)
      @key = key if key
      @key
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mastar-1.0.0 lib/mastar/configuration.rb
mastar-0.9.0 lib/mastar/configuration.rb