Class: Hash

Inherits:
Object show all
Defined in:
lib/transmission-rss/core_ext/Hash.rb

Direct Known Subclasses

TransmissionRSS::Config

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(symbol, *args) ⇒ Object

If a method is missing it is interpreted as the key of the hash. If the method has an argument (for example by “method=”), the key called “method” is set to the respective argument.



5
6
7
8
9
10
11
# File 'lib/transmission-rss/core_ext/Hash.rb', line 5

def method_missing(symbol, *args)
  if args.size == 0
    self[symbol.to_s]
  else
    self[symbol.to_s.slice 0..-2] = args.first
  end
end