Top Level Namespace

Defined Under Namespace

Modules: Dish Classes: Array, Hash

Instance Method Summary collapse

Instance Method Details

#Dish(hash_or_array, klass = Dish::Plate) ⇒ Object



1
2
3
4
5
6
7
# File 'lib/dish/helper.rb', line 1

def Dish(hash_or_array, klass = Dish::Plate)
  case hash_or_array
  when Hash then klass.new(hash_or_array)
  when Array then hash_or_array.map { |v| Dish(v, klass) }
  else hash_or_array
  end
end