Module: Squeel::Configuration
- Included in:
- Squeel
- Defined in:
- lib/squeel/configuration.rb
Overview
The Squeel configuration module. The Squeel module extends this to provide its configuration capability.
Instance Method Summary collapse
-
#alias_predicate(new_name, existing_name) ⇒ Object
Create an alias to an existing predication method.
-
#configure {|config| ... } ⇒ Object
Start a Squeel configuration block in an initializer.
-
#load_core_extensions(*exts) ⇒ Object
Load core extensions for Hash, Symbol, or both.
Instance Method Details
#alias_predicate(new_name, existing_name) ⇒ Object
Create an alias to an existing predication method. The _any/_all variations will be created automatically.
46 47 48 49 50 51 |
# File 'lib/squeel/configuration.rb', line 46 def alias_predicate(new_name, existing_name) raise ArgumentError, 'the existing name should be the base name, not an _any/_all variation' if existing_name.to_s =~ /(_any|_all)$/ ['', '_any', '_all'].each do |suffix| PredicateMethods.class_eval "alias :#{new_name}#{suffix} :#{existing_name}#{suffix} unless defined?(#{new_name}#{suffix})" end end |
#configure {|config| ... } ⇒ Object
Start a Squeel configuration block in an initializer.
22 23 24 |
# File 'lib/squeel/configuration.rb', line 22 def configure yield self end |
#load_core_extensions(sym) ⇒ Object #load_core_extensions(sym1, sym2) ⇒ Object
Load core extensions for Hash, Symbol, or both
35 36 37 38 39 |
# File 'lib/squeel/configuration.rb', line 35 def load_core_extensions(*exts) exts.each do |ext| require "core_ext/#{ext}" end end |