Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/texlab/hash.rb,
lib/texlab/hash.rb
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
#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
#mash!(&block) ⇒ Object
48 49 50 |
# File 'lib/texlab/hash.rb', line 48 def mash! &block replace mash(&block) end |
#slice(*args) ⇒ Object
30 31 32 |
# File 'lib/texlab/hash.rb', line 30 def slice *args args.mash{|k| self[k]} end |