Class: Daedal::Attributes::QueryArray

Inherits:
Virtus::Attribute
  • Object
show all
Defined in:
lib/daedal/attributes.rb

Instance Method Summary collapse

Instance Method Details

#coerce(value) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/daedal/attributes.rb', line 50

def coerce(value)
  unless value.is_a? Array
    value = [value]
  end

  value.each do |q|
    unless q.is_a? Daedal::Queries::BaseQuery
      raise "Must give an array of queries"
    end
  end

  value
end