Class: Typed::Default
- Inherits:
-
Object
- Object
- Typed::Default
- Defined in:
- lib/typed/default.rb
Instance Method Summary collapse
- #[]=(key, val) ⇒ Object
-
#initialize(kvs) ⇒ Default
constructor
A new instance of Default.
- #merge!(hash) ⇒ Object
- #register_lazy(key, block) ⇒ Object
Constructor Details
#initialize(kvs) ⇒ Default
Returns a new instance of Default.
3 4 5 |
# File 'lib/typed/default.rb', line 3 def initialize(kvs) @kvs = kvs end |
Instance Method Details
#[]=(key, val) ⇒ Object
7 8 9 10 |
# File 'lib/typed/default.rb', line 7 def []=(key, val) return if @kvs.exist?(key.to_s) @kvs[key.to_s] = val end |
#merge!(hash) ⇒ Object
12 13 14 15 16 |
# File 'lib/typed/default.rb', line 12 def merge!(hash) hash.each_pair do |key, val| self[key] = val end end |