Class: Anyway::Env
- Inherits:
-
Object
- Object
- Anyway::Env
- Defined in:
- lib/anyway/env.rb
Constant Summary collapse
- ARRAY_RXP =
Regexp to detect array values Array value is a values that contains at least one comma and doesn’t start/end with quote
/\A[^'"].*\s*,\s*.*[^'"]\z/
Instance Method Summary collapse
- #clear ⇒ Object
-
#initialize ⇒ Env
constructor
A new instance of Env.
- #method_missing(meth, *args, &block) ⇒ Object
- #reload ⇒ Object
Constructor Details
#initialize ⇒ Env
Returns a new instance of Env.
10 11 12 13 |
# File 'lib/anyway/env.rb', line 10 def initialize @data = {} load end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/anyway/env.rb', line 26 def method_missing(meth, *args, &block) meth = meth.to_s.gsub(/\_/,'') if args.empty? and @data.key?(meth) @data[meth] end end |
Instance Method Details
#clear ⇒ Object
21 22 23 24 |
# File 'lib/anyway/env.rb', line 21 def clear @data.clear self end |
#reload ⇒ Object
15 16 17 18 19 |
# File 'lib/anyway/env.rb', line 15 def reload clear load self end |