Class: Hash

Inherits:
Object show all
Defined in:
lib/at-validations.rb

Overview

We’re adding (monkey-patching) a method to Object and to Hash.

Hash gets this convenience method:

{hello: :world}.matches_mask({
  _id: atv_string,
  status: atv_union(
            atv_number,
            atv_block {|e| e >= 200 && e < 300 })
})

Instance Method Summary collapse

Instance Method Details

#matches_mask(mask, opts = {}) ⇒ Object



17
18
19
# File 'lib/at-validations.rb', line 17

def matches_mask(mask, opts = {})
  ATValidations::Predicates.atv_hash(mask, opts).call(self)
end