Method: Restforce::Mash.build

Defined in:
lib/restforce/mash.rb

.build(val, client) ⇒ Object

Pass in an Array or Hash and it will be recursively converted into the appropriate Restforce::Collection, Restforce::SObject and Restforce::Mash objects.


13
14
15
16
17
18
19
20
21
22
# File 'lib/restforce/mash.rb', line 13

def build(val, client)
  case val
  when Array
    val.collect { |a_val| self.build(a_val, client) }
  when Hash
    self.klass(val).new(val, client)
  else
    val
  end
end