Sha256: d6f91e30322ab2380bf51c450f2504c4d89bbb7deeb58067582af0583e17ff1d

Contents?: true

Size: 546 Bytes

Versions: 3

Compression:

Stored size: 546 Bytes

Contents

module Yema
  module Virtus
    module Validations

      def self.included(base)
        base.instance_eval do
          include ::Virtus::ValueObject
          include Yema::Validations
          extend ClassMethods
        end
      end

      module ClassMethods

        private

        def virtus_add_attribute(attribute)
          super
          build_validation(attribute)
        end

        def build_validation(attribute)
          rules.merge(Yema::Virtus::Attribute.build(attribute).rules)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yema-0.0.3 lib/yema/virtus/validations.rb
yema-0.0.2 lib/yema/virtus/validations.rb
yema-0.0.1 lib/yema/virtus/validations.rb