Class: Whenauser::MiddlewareConfigurator
- Inherits:
-
Object
- Object
- Whenauser::MiddlewareConfigurator
show all
- Defined in:
- lib/whenauser/railtie.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
43
44
45
|
# File 'lib/whenauser/railtie.rb', line 43
def initialize
@configuration = {}
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(mid, *args, &block) ⇒ Object
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/whenauser/railtie.rb', line 51
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.
35
36
37
|
# File 'lib/whenauser/railtie.rb', line 35
def configuration
@configuration
end
|
Class Method Details
.apply(&block) ⇒ Object
37
38
39
40
41
|
# File 'lib/whenauser/railtie.rb', line 37
def self.apply(&block)
x = new
x.configure(&block) if block_given?
x
end
|
Instance Method Details
47
48
49
|
# File 'lib/whenauser/railtie.rb', line 47
def configure(&block)
instance_eval &block
end
|