Module: Hanami::Validations
- Defined in:
- gems/gems/hanami-validations-1.3.5/lib/hanami/validations.rb,
gems/gems/hanami-validations-1.3.5/lib/hanami/validations/form.rb,
gems/gems/hanami-validations-1.3.5/lib/hanami/validations/version.rb,
gems/gems/hanami-validations-1.3.5/lib/hanami/validations/namespace.rb,
gems/gems/hanami-validations-1.3.5/lib/hanami/validations/predicates.rb,
gems/gems/hanami-validations-1.3.5/lib/hanami/validations/inline_predicate.rb,
gems/gems/hanami-validations-2.2.0.beta1/lib/hanami/validations/form.rb,
gems/gems/hanami-validations-2.2.0.beta1/lib/hanami/validations/version.rb
Overview
Hanami::Validations is a set of lightweight validations for Ruby objects.
Defined Under Namespace
Modules: ClassMethods, Predicates
Instance Method Summary collapse
-
#initialize(input = {}) ⇒ Object
Initialize a new instance of a validator.
-
#to_h ⇒ Hash
Returns a Hash with the defined attributes as symbolized keys, and their relative values.
-
#validate ⇒ Dry::Validations::Result
Validates the object.
Instance Method Details
#initialize(input = {}) ⇒ Object
Initialize a new instance of a validator
Source: | on GitHub
def initialize(input = {}) @input = input.to_h end |
#to_h ⇒ Hash
Returns a Hash with the defined attributes as symbolized keys, and their relative values.
Source: | on GitHub
def to_h validate.output end |
#validate ⇒ Dry::Validations::Result
Validates the object.
Source: | on GitHub
def validate self.class.schema.call(@input) end |