Class: BasicAssumption::Configuration
- Inherits:
-
Object
- Object
- BasicAssumption::Configuration
- Defined in:
- lib/basic_assumption/configuration.rb
Overview
Provides app-level configuration options for BasicAssumption
. Useful in a Rails initializer or something similar.
Class Method Summary collapse
-
.configure {|self.new| ... } ⇒ Object
Example BasicAssumption::Configuration.configure do |conf| conf.default_assumption = Proc.new { “I <3 GitHub.” } end.
Instance Method Summary collapse
-
#default_assumption=(value) ⇒ Object
Allows setting the default behavior for
assume
calls in your app. -
#emulate_exposure! ⇒ Object
Invoke this method if you want to have API compatibility with the DecentExposure library.
Class Method Details
.configure {|self.new| ... } ⇒ Object
Example
BasicAssumption::Configuration.configure do |conf|
conf.default_assumption = Proc.new { "I <3 GitHub." }
end
9 10 11 |
# File 'lib/basic_assumption/configuration.rb', line 9 def self.configure #:yields: config_instance yield self.new end |
Instance Method Details
#default_assumption=(value) ⇒ Object
Allows setting the default behavior for assume
calls in your app. Note this is an assignment, which differs from the default_assumption
calls inside of classes that extend BasicAssumption
.
28 29 30 |
# File 'lib/basic_assumption/configuration.rb', line 28 def default_assumption=(value) BasicAssumption::DefaultAssumption.default = value end |
#emulate_exposure! ⇒ Object
Invoke this method if you want to have API compatibility with the DecentExposure library. (www.github.com/voxdolo/decent_exposure) Namely, this provides expose
and default_exposure
which work identically to assume
and default_assumption
(or rather, vice-versa.)
18 19 20 21 22 23 |
# File 'lib/basic_assumption/configuration.rb', line 18 def emulate_exposure! BasicAssumption.module_eval do alias expose assume alias default_exposure default_assumption end end |