Module: Happy::Controller::Configurable::ClassMethods

Defined in:
lib/happy/controller/configurable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#settingsObject

Returns the value of attribute settings


21
22
23
# File 'lib/happy/controller/configurable.rb', line 21

def settings
  @settings
end

Instance Method Details

#inherited(subclass) ⇒ Object

Make sure inherited classes also get a copy of this class' settings.


32
33
34
# File 'lib/happy/controller/configurable.rb', line 32

def inherited(subclass)
  subclass.settings = settings.dup unless settings.nil?
end

#set(k, v) ⇒ Object

Change a default setting on this controller class.


25
26
27
28
# File 'lib/happy/controller/configurable.rb', line 25

def set(k, v)
  self.settings ||= {}
  settings[k.to_sym] = v
end