Sha256: a601989f0884bcd3a544c61ae949420ae82e4e6b7bc95cc8f3f2046a5e09f04d

Contents?: true

Size: 535 Bytes

Versions: 7

Compression:

Stored size: 535 Bytes

Contents

module Rasti
  class Form
    module Types
      class Array

        include Castable

        attr_reader :type

        def self.[](type)
          new type
        end

        def to_s
          "#{self.class}[#{type}]"
        end
        alias_method :inspect, :to_s

        private

        def initialize(type)
          @type = type
        end

        def valid?(value)
          value.is_a? ::Array
        end

        def transform(value)
          value.map { |e| type.cast e }
        end

      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rasti-form-1.1.1 lib/rasti/form/types/array.rb
rasti-form-1.1.0 lib/rasti/form/types/array.rb
rasti-form-1.0.3 lib/rasti/form/types/array.rb
rasti-form-1.0.2 lib/rasti/form/types/array.rb
rasti-form-1.0.1 lib/rasti/form/types/array.rb
rasti-form-1.0.0 lib/rasti/form/types/array.rb
rasti-form-0.1.0 lib/rasti/form/types/array.rb