Class: RulesIO::MiddlewareConfigurator
- Inherits:
-
Object
- Object
- RulesIO::MiddlewareConfigurator
- Defined in:
- lib/rulesio/railtie.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
Returns the value of attribute configuration.
-
#root ⇒ Object
Returns the value of attribute root.
Class Method Summary collapse
Instance Method Summary collapse
- #configure(&block) ⇒ Object
-
#initialize ⇒ MiddlewareConfigurator
constructor
A new instance of MiddlewareConfigurator.
- #method_missing(mid, *args, &block) ⇒ Object
Constructor Details
#initialize ⇒ MiddlewareConfigurator
Returns a new instance of MiddlewareConfigurator.
64 65 66 |
# File 'lib/rulesio/railtie.rb', line 64 def initialize @configuration = {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(mid, *args, &block) ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/rulesio/railtie.rb', line 72 def method_missing(mid, *args, &block) mname = mid.id2name if block_given? @configuration[mname.to_sym] = *block else if args.size == 1 @configuration[mname.to_sym] = args.first else @configuration[mname.to_sym] = args end end end |
Instance Attribute Details
#configuration ⇒ Object
Returns the value of attribute configuration.
55 56 57 |
# File 'lib/rulesio/railtie.rb', line 55 def configuration @configuration end |
#root ⇒ Object
Returns the value of attribute root.
55 56 57 |
# File 'lib/rulesio/railtie.rb', line 55 def root @root end |
Class Method Details
Instance Method Details
#configure(&block) ⇒ Object
68 69 70 |
# File 'lib/rulesio/railtie.rb', line 68 def configure(&block) instance_eval &block end |