Class: Object

Inherits:
BasicObject
Defined in:
lib/bowline/ext/object.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) to_js(*args)

Aim is to convert the object into:

* A hash or
* An array of hashes


5
6
7
8
9
10
11
12
13
# File 'lib/bowline/ext/object.rb', line 5

def to_js(*args)
  if respond_to?(:serializable_hash)
    serializable_hash(*args)
  elsif respond_to?(:attributes)
    attributes
  else
    self
  end
end