Class: Hash
Overview
tweak Hash
Instance Method Summary collapse
- #mash!(&block) ⇒ Object
-
#method_missing(name, *args) ⇒ Object
Object-like behavior.
- #slice(*args) ⇒ Object
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
permalink #method_missing(name, *args) ⇒ Object
Object-like behavior
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/texlab/hash.rb', line 16 def method_missing name, *args name_string = name.to_s case name_string[-1] when "=" self[name_string[0..-2].to_sym] = args[0] when "!" self[name_string[0..-2].to_sym] = {} when "?" !! self[name_string[0..-2]] else self[name] end end |
Instance Method Details
permalink #mash!(&block) ⇒ Object
[View source]
48 49 50 |
# File 'lib/texlab/hash.rb', line 48 def mash! &block replace mash(&block) end |
permalink #slice(*args) ⇒ Object
[View source]
30 31 32 |
# File 'lib/texlab/hash.rb', line 30 def slice *args args.mash{|k| self[k]} end |