Class: Mastar::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/mastar/configuration.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Configuration

Returns a new instance of Configuration.



4
5
6
7
8
9
10
# File 'lib/mastar/configuration.rb', line 4

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

Instance Method Details

#key(key = nil) ⇒ Object



22
23
24
25
# File 'lib/mastar/configuration.rb', line 22

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

#name(name = nil) ⇒ Object



12
13
14
15
# File 'lib/mastar/configuration.rb', line 12

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

#value(value = nil) ⇒ Object



17
18
19
20
# File 'lib/mastar/configuration.rb', line 17

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