class Attribrutal::Type::Array

Public Class Methods

[](subtype) click to toggle source
# File lib/attribrutal/coercion.rb, line 45
def self.[] (subtype)
  new(subtype)
end
new(subtype) click to toggle source
# File lib/attribrutal/coercion.rb, line 36
def initialize(subtype)
  @subtype = subtype
end

Public Instance Methods

coerce(arg, default = nil) click to toggle source
# File lib/attribrutal/coercion.rb, line 40
def coerce(arg, default = nil)
  return default unless arg
  arg.collect {|member| @subtype.coerce(member) }
end