Module: Dragonfly::Configurable::ClassMethods

Defined in:
lib/dragonfly/configurable.rb

Instance Method Summary collapse

Instance Method Details

#config_methodsObject


121
122
123
124
125
126
# File 'lib/dragonfly/configurable.rb', line 121

def config_methods
  @config_methods ||= configurable_ancestors.inject([]) do |conf_methods, klass|
    conf_methods |= klass.config_methods
    conf_methods
  end
end

#configurable_ancestorsObject


140
141
142
# File 'lib/dragonfly/configurable.rb', line 140

def configurable_ancestors
  @configurable_ancestors ||= ancestors.select{|a| a.included_modules.include?(Configurable) } - [self]
end

#default_configurationObject


114
115
116
117
118
119
# File 'lib/dragonfly/configurable.rb', line 114

def default_configuration
  @default_configuration ||= configurable_ancestors.reverse.inject({}) do |default_config, klass|
    default_config.merge!(klass.default_configuration)
    default_config
  end
end

#nested_configurablesObject


128
129
130
# File 'lib/dragonfly/configurable.rb', line 128

def nested_configurables
  @nested_configurables ||= []
end

#register_configuration(name, config = nil, &config_in_block) ⇒ Object


132
133
134
# File 'lib/dragonfly/configurable.rb', line 132

def register_configuration(name, config=nil, &config_in_block) 
  saved_configs[name] = config_in_block || config
end

#saved_configsObject


136
137
138
# File 'lib/dragonfly/configurable.rb', line 136

def saved_configs
  @saved_configs ||= {}
end