Method: LHS::Collection#method_missing

Defined in:
lib/lhs/collection.rb

#method_missing(name, *args, &block) ⇒ Object (protected)



55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/lhs/collection.rb', line 55

def method_missing(name, *args, &block)
  if _collection.respond_to?(name)
    value = _collection.send(name, *args, &block)
    record = LHS::Record.for_url(value[:href]) if value.is_a?(Hash) && value[:href]
    record ||= _record
    value = enclose_item_in_data(value) if value.is_a?(Hash)
    return value if METHOD_NAMES_EXLCUDED_FROM_WRAPPING.include?(name.to_s)
    wrap_return(value, record, name, args)
  elsif _data._raw.is_a?(Hash)
    get(name, *args)
  end
end