Class: Chamber::Refinements::Enumerable
- Inherits:
-
Object
- Object
- Chamber::Refinements::Enumerable
- Defined in:
- lib/chamber/refinements/enumerable.rb
Class Method Summary collapse
Class Method Details
.deep_validate_keys(object, &block) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/chamber/refinements/enumerable.rb', line 8 def self.deep_validate_keys(object, &block) case object when ::Hash object.each do |(key, value)| fail ::Chamber::Errors::NonConformingKey unless key == yield(key) deep_validate_keys(value, &block) end when ::Array object.map { |v| deep_validate_keys(v, &block) } else object end end |