Module: SettingCrazy::ClassMethods

Defined in:
lib/settingcrazy/class_methods.rb

Instance Method Summary collapse

Instance Method Details

#_inheritorObject



16
17
18
# File 'lib/settingcrazy/class_methods.rb', line 16

def _inheritor
  @inheritor
end

#_setting_namespacesObject



20
21
22
# File 'lib/settingcrazy/class_methods.rb', line 20

def _setting_namespaces
  @setting_namespaces
end

#setting_namespace(name, options = {}) ⇒ Object



11
12
13
14
# File 'lib/settingcrazy/class_methods.rb', line 11

def setting_namespace(name, options = {})
  @setting_namespaces ||= {}
  @setting_namespaces[name.to_sym] = Namespace.new(name, options)
end

#setting_template(record) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/settingcrazy/class_methods.rb', line 24

def setting_template(record)
  case @template
    when String  then @template.constantize
    when Class   then @template
    when Proc    then @template.call(record)
  end
end

#settings_inherit_via(reflection, options = {}) ⇒ Object



7
8
9
# File 'lib/settingcrazy/class_methods.rb', line 7

def settings_inherit_via(reflection, options = {})
  @inheritor = Inheritor.new(reflection, options)
end

#use_setting_template(template = nil, &block) ⇒ Object



3
4
5
# File 'lib/settingcrazy/class_methods.rb', line 3

def use_setting_template(template = nil, &block)
  @template = template || block
end