Sha256: 5182f6ccfac7720164ad928d30e392bde941578f6c45f74b31eba36bcbe9a81a
Contents?: true
Size: 990 Bytes
Versions: 1
Compression:
Stored size: 990 Bytes
Contents
# -*- encoding: utf-8 -*- require 'aequitas/virtus_integration/inline_attribute_rule_extractor' module Aequitas module VirtusIntegration module InlineAttributeRuleExtractor class Object attr_reader :attribute def initialize(attribute) @attribute = attribute end def options attribute.options end def extract inline_rules = [] inline_rules.concat Array(extract_presence_rule) # inline_rules.concat Array(extract_primitive_type_rule) end def extract_presence_rule required = options.fetch(:required, false) Rule::Presence::NotBlank.new(attribute.name) if required end def extract_primitive_type_rule Rule::PrimitiveType::Virtus.new(attribute.name, :attribute => attribute) end end # class Object end # module InlineAttributeRuleExtractor end # module VirtusIntegration end # module Aequitas
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
aequitas-0.0.2 | lib/aequitas/virtus_integration/inline_attribute_rule_extractor/object.rb |