Sha256: 5114f0e27a752cf14a26ce3893f46bf974726a84e8fea282853ac5f4b07fe40a

Contents?: true

Size: 507 Bytes

Versions: 2

Compression:

Stored size: 507 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::Validator.new(datas)
      validator.instance_eval(&block)
      return validator.filtered
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kharon-0.5.1 lib/kharon/helpers/validate.rb
kharon-0.5.0 lib/kharon/helpers/validate.rb