Class: VirtusConvert::Array
- Inherits:
-
Object
- Object
- VirtusConvert::Array
- Defined in:
- lib/virtus_convert/array.rb
Instance Method Summary collapse
-
#initialize(array = [], options = {}) ⇒ Array
constructor
A new instance of Array.
- #to_hash ⇒ Object
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 = [], = {}) array.reject!{|item| item.nil?} if [:reject_nils] @array = array.map{|item| VirtusConvert.new(item, )} end |
Instance Method Details
#to_hash ⇒ Object
8 9 10 |
# File 'lib/virtus_convert/array.rb', line 8 def to_hash @array.map(&:to_hash) end |