Sha256: ff94a62196a64b4f66e3ceb7ce1ff7827656490b9cc1c2380edfc938df11f2db

Contents?: true

Size: 511 Bytes

Versions: 3

Compression:

Stored size: 511 Bytes

Contents

module Kharon
  module Helpers

    # Validates the datas passed as parameter with a Phenix::Validator and the given instructions.
    # @param  [Hash] datas the parameters to validate with the given instructions.
    # @param  [Proc] block the instructions to apply on the validator.
    # @return [Hash] the validated and filtered datas.
    def validate(datas, &block)
      validator = Kharon::Factory.validator(datas)
      validator.instance_eval(&block)
      return validator.filtered
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kharon-0.4.0 lib/kharon/helpers/validate.rb
kharon-0.3.1 lib/validate.rb
kharon-0.3.0 lib/validate.rb