Class: VirtusConvert::Array

Inherits:
Object
  • Object
show all
Defined in:
lib/virtus_convert/array.rb

Instance Method Summary collapse

Constructor Details

#initialize(array = [], options = {}) ⇒ Array

Returns a new instance of Array.



3
4
5
6
# File 'lib/virtus_convert/array.rb', line 3

def initialize(array = [], options = {})
  array.reject!{|item| item.nil?} if options[:reject_nils]
  @array = array.map{|item| VirtusConvert.new(item, options)}
end

Instance Method Details

#to_hashObject



8
9
10
# File 'lib/virtus_convert/array.rb', line 8

def to_hash
  @array.map(&:to_hash)
end