Sha256: 8c48bcb082b14f1bcae0e4f3b762260b14af02cb2c01025995bc7f54fb27def8

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

# -*- encoding: utf-8 -*-

module Aequitas
  module VirtusIntegration
    module InlineAttributeRuleExtractor

      def self.extract(attribute)
        type = 
          case attribute
          when ::Virtus::Attribute::Boolean;  self::Boolean
          when ::Virtus::Attribute::String;   self::String
          when ::Virtus::Attribute::Array;    self::Array
          # when ::Virtus::Attribute::Decimal;  self::Decimal
          # when ::Virtus::Attribute::Float;    self::Float
          when ::Virtus::Attribute::Numeric;  self::Numeric
          when ::Virtus::Attribute::Object;   self::Object
          end

        type.new(attribute).extract
      end

    end # module InlineAttributeRuleExtractor
  end # module VirtusIntegration
end # module Aequitas

require 'aequitas/virtus_integration/inline_attribute_rule_extractor/object'
require 'aequitas/virtus_integration/inline_attribute_rule_extractor/array'
require 'aequitas/virtus_integration/inline_attribute_rule_extractor/boolean'
require 'aequitas/virtus_integration/inline_attribute_rule_extractor/string'
require 'aequitas/virtus_integration/inline_attribute_rule_extractor/numeric'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aequitas-0.0.2 lib/aequitas/virtus_integration/inline_attribute_rule_extractor.rb