Class: Command::DecoratingHash
- Inherits:
-
Hash
- Object
- Hash
- Command::DecoratingHash
- Defined in:
- lib/command/decoratinghash.rb
Instance Attribute Summary collapse
-
#target ⇒ Object
Returns the value of attribute target.
Class Method Summary collapse
Instance Method Summary collapse
- #keys ⇒ Object
- #own_size ⇒ Object (also: #own_length)
- #size ⇒ Object (also: #length)
Instance Attribute Details
#target ⇒ Object
Returns the value of attribute target.
11 12 13 |
# File 'lib/command/decoratinghash.rb', line 11 def target @target end |
Class Method Details
.new(target) ⇒ Object
13 14 15 16 17 |
# File 'lib/command/decoratinghash.rb', line 13 def self.new(target) obj = super() do |h,k| h.target && h.target[k] end obj.target = target obj end |
Instance Method Details
#keys ⇒ Object
27 28 29 |
# File 'lib/command/decoratinghash.rb', line 27 def keys @target ? (super | @target.keys) : super end |
#own_size ⇒ Object Also known as: own_length
19 |
# File 'lib/command/decoratinghash.rb', line 19 alias own_size size |
#size ⇒ Object Also known as: length
22 23 24 |
# File 'lib/command/decoratinghash.rb', line 22 def size @target ? keys.size : super end |