Class: Baywatch::Config
- Inherits:
-
Object
show all
- Defined in:
- lib/baywatch/config.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
6
7
8
|
# File 'lib/baywatch/config.rb', line 6
def initialize
@configurations = {}
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
24
25
26
27
|
# File 'lib/baywatch/config.rb', line 24
def method_missing(method, *args, &block)
raise "You should pass one Block #{method}" if block.nil?
@configurations[method.to_sym] = block
end
|
Instance Attribute Details
#configurations ⇒ Object
Returns the value of attribute configurations.
4
5
6
|
# File 'lib/baywatch/config.rb', line 4
def configurations
@configurations
end
|
Instance Method Details
#[](val) ⇒ Object
14
15
16
|
# File 'lib/baywatch/config.rb', line 14
def [](val)
@configurations[val.to_sym]
end
|
#include?(action) ⇒ Boolean
10
11
12
|
# File 'lib/baywatch/config.rb', line 10
def include?(action)
@configurations.keys.include?(action.to_sym)
end
|
#only(*args, &block) ⇒ Object
18
19
20
21
22
|
# File 'lib/baywatch/config.rb', line 18
def only(*args, &block)
args.each do |action|
@configurations[action.to_sym] = block
end
end
|