Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/AWS.rb

Overview

A custom implementation of Hash that allows us to access hash values using dot notation

Examples:

Access the hash keys in the standard way or using dot notation

foo[:bar] => "baz"
foo.bar => "baz"

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



32
33
34
35
36
# File 'lib/AWS.rb', line 32

def method_missing(meth, *args, &block)
  if args.size == 0
    self[meth.to_s] || self[meth.to_sym]
  end
end

Instance Method Details

#does_not_have?(key) ⇒ Boolean



46
47
48
# File 'lib/AWS.rb', line 46

def does_not_have?(key)
  self[key].nil? || self[key].to_s.empty?
end

#has?(key) ⇒ Boolean



42
43
44
# File 'lib/AWS.rb', line 42

def has?(key)
  self[key] && !self[key].to_s.empty?
end

#typeObject



38
39
40
# File 'lib/AWS.rb', line 38

def type
  self['type']
end