Class: Hash

Inherits:
Object show all
Defined in:
lib/scaruby/converter.rb,
lib/scaruby/core_ext/hash.rb

Direct Known Subclasses

Scaruby::Map

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/scaruby/core_ext/hash.rb', line 6

def method_missing(name, *args, &block)
  result = Scaruby::Map.new(self).send(name, *args, &block)
  if result.is_a?(Scaruby::Map)
    result.to_hash
  else
    result
  end
end

Instance Method Details

#to_scarubyObject



13
14
15
# File 'lib/scaruby/converter.rb', line 13

def to_scaruby
  Scaruby::Map.new(self)
end