Module: Sym::Configurable::ClassMethods

Defined in:
lib/sym/configurable.rb

Instance Method Summary collapse

Instance Method Details

#configObject



14
15
16
# File 'lib/sym/configurable.rb', line 14

def config
  instance
end

#configure {|config| ... } ⇒ Object

Yields:



18
19
20
21
# File 'lib/sym/configurable.rb', line 18

def configure
  yield config if block_given?
  config
end

#defaults!Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/sym/configurable.rb', line 23

def defaults!
  [ self, *self.ancestors ].each do |klazz|
    next unless klazz.is_a?(Class)
    if klazz.const_defined?(:DEFAULTS)
      default_proc = self.const_get(:DEFAULTS)
      if default_proc.respond_to?(:call)
        configure(&default_proc)
      end
    end
  end
end

#property(prop_name) ⇒ Object Also known as: prop, []



35
36
37
# File 'lib/sym/configurable.rb', line 35

def property(prop_name)
  config.send(prop_name)
end