Class: Ez::Settings::Interface

Inherits:
Object
  • Object
show all
Includes:
Configurator
Defined in:
lib/ez/settings/interface.rb,
lib/ez/settings/interface/key.rb,
lib/ez/settings/interface/group.rb

Defined Under Namespace

Classes: Group, Key

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Interface

Returns a new instance of Interface.



33
34
35
36
37
# File 'lib/ez/settings/interface.rb', line 33

def initialize(name)
  @name = name
  @keys = []
  @groups = []
end

Instance Attribute Details

#groupsObject (readonly)

Returns the value of attribute groups.



31
32
33
# File 'lib/ez/settings/interface.rb', line 31

def groups
  @groups
end

#nameObject (readonly)

Returns the value of attribute name.



31
32
33
# File 'lib/ez/settings/interface.rb', line 31

def name
  @name
end

#storeObject (readonly)

Returns the value of attribute store.



31
32
33
# File 'lib/ez/settings/interface.rb', line 31

def store
  @store
end

Class Method Details

.define(name, &block) ⇒ Object



23
24
25
26
27
# File 'lib/ez/settings/interface.rb', line 23

def self.define(name, &block)
  interface = new(name)
  interface.instance_eval(&block)
  interface
end

Instance Method Details

#define(&block) ⇒ Object



39
40
41
# File 'lib/ez/settings/interface.rb', line 39

def define(&block)
  instance_eval(&block)
end

#group(name, options = {}, &block) ⇒ Object



43
44
45
# File 'lib/ez/settings/interface.rb', line 43

def group(name, options = {}, &block)
  find_or_initialize_group(name, options, &block)
end

#keysObject



47
48
49
# File 'lib/ez/settings/interface.rb', line 47

def keys
  groups.map(&:keys).flatten
end