Sha256: d29a65f47a5271c2e3ac10ef5b9ab4a8aae066df72fe5c4dce5e61e5c460c0f8
Contents?: true
Size: 871 Bytes
Versions: 1
Compression:
Stored size: 871 Bytes
Contents
require 'aequitas' require 'aequitas/virtus_integration/inline_attribute_rule_extractor' # module Virtus # class Attribute # Object.accept_options :required# , :prohibited, :forbidden # hmm... # String.accept_options :length, :format # Decimal.accept_options :precision, :scale # Float.accept_options :precision, :scale # end # end module Aequitas module ClassMethods def self.extended(base) super base.extend Aequitas::VirtusIntegration::ClassMethods end end module VirtusIntegration module ClassMethods # WARNING: overriding Virtus' private API here, this is fragile def virtus_add_attribute(attribute) super inline_attribute_rules = InlineAttributeRuleExtractor.extract(attribute) validation_rules.context(:default).concat(inline_attribute_rules) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
aequitas-0.0.2 | lib/aequitas/virtus_integration.rb |