class Lolita::Configuration::Base
This is superclass of other configuration classes, that is used to configure different parts of resource.
Attributes
component[W]
dbi[R]
dbp[R]
Public Class Methods
new(dbp, *args)
click to toggle source
# File lib/lolita/configuration/base.rb, line 10 def initialize(dbp, *args) set_and_validate_dbp dbp set_attributes *args end
Public Instance Methods
component()
click to toggle source
# File lib/lolita/configuration/base.rb, line 15 def component @component ||= "Lolita::Components::#{self.class.to_s.sub("Lolita::","")}Component".constantize.new(self) end
Private Instance Methods
set_and_validate_dbp(dbp)
click to toggle source
# File lib/lolita/configuration/base.rb, line 21 def set_and_validate_dbp(dbp) @dbp = dbp @dbi = dbp raise Lolita::UnknownDBPError.new("No DBP specified for #{self.class.to_s.split("::").last}") unless @dbp end
Also aliased as: set_and_validate_dbi
set_attributes(*args)
click to toggle source
Used to set attributes if block not given.
# File lib/lolita/configuration/base.rb, line 30 def set_attributes(*args) options = args && args.extract_options! || {} options.each do |attr_name,value| if attr_name == :association_name self.association_name = value else self.send("#{attr_name}=".to_sym,value) end end end