Sha256: bcca50c26e80fc9645a7a19297dd409af5a3713cb82d63ca3f88a675ea97fd50

Contents?: true

Size: 467 Bytes

Versions: 1

Compression:

Stored size: 467 Bytes

Contents

require "hanami-validations"

module Prezzo
  module Context
    def self.included(base)
      base.class_eval do
        base.include(Hanami::Validations)
      end
    end

    def valid?
      validation.success?
    end

    def errors
      validation.errors
    end

    def fetch(*args)
      attributes.fetch(*args)
    end

    def attributes
      validation.output
    end

    private

    def validation
      @_validation ||= validate
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
prezzo-0.2.0 lib/prezzo/context.rb