Class: Dish::Plate

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

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Plate

Returns a new instance of Plate.



3
4
5
# File 'lib/dish/plate.rb', line 3

def initialize(hash)
  @dish_original_hash = Hash[hash.map { |k, v| [k.to_s, v] }]
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



7
8
9
10
11
12
13
14
15
# File 'lib/dish/plate.rb', line 7

def method_missing(method, *args, &block)
  method = method.to_s
  if method.end_with?("?")
    key = method[0..-2]
    dish_check_for_presence(key)
  else
    dish_get_value(method)
  end
end