Module: HashieModel::ArrayOf::ClassMethods

Defined in:
lib/hashie_model/array_of.rb

Instance Method Summary collapse

Instance Method Details

#array_of(klass) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/hashie_model/array_of.rb', line 6

def array_of(klass)
  Class.new(Array) do
    define_method(:initialize) do |values|
      replace values.map { |value| klass.new(value) }
    end
  end
end