Parent

Stringex::Configuration::Base

Attributes

settings[RW]

Public Class Methods

configure(&block) click to toggle source
# File lib/stringex/configuration/base.rb, line 29
def self.configure(&block)
  configurator = Stringex::Configuration::Configurator.new(self)
  yield configurator
end
new(local_options = {}) click to toggle source
# File lib/stringex/configuration/base.rb, line 6
def initialize(local_options = {})
  current_settings = default_settings.merge(system_wide_customizations)
  current_settings.merge! local_options

  @settings = OpenStruct.new(current_settings)
end
system_wide_customizations() click to toggle source
# File lib/stringex/configuration/base.rb, line 34
def self.system_wide_customizations
  @system_wide_customizations ||= {}
end
unconfigure!() click to toggle source
# File lib/stringex/configuration/base.rb, line 38
def self.unconfigure!
  @system_wide_customizations = {}
end

Public Instance Methods

adapter() click to toggle source

NOTE: This does not cache itself so that instance and class can be cached on the adapter without worrying about thread safety or race conditions

# File lib/stringex/configuration/base.rb, line 15
def adapter
  adapter_name = settings.adapter || Stringex::ActsAsUrl::Adapter.first_available
  case adapter_name
  when Class
    adapter_name.send :new, self
  when :active_record
    Stringex::ActsAsUrl::Adapter::ActiveRecord.new self
  when :mongoid
    Stringex::ActsAsUrl::Adapter::Mongoid.new self
  else
    raise ArgumentError, "#{adapter_name} is not a defined ActsAsUrl adapter. Please feel free to implement your own and submit it back upstream."
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.