Class: ApiView::Default
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#convert ⇒ Object
delegate to class method.
Methods inherited from Base
attributes, #collect_attributes, #field, for_model, #initialize, #instance_convert, main_object, parent_attributes, render
Constructor Details
This class inherits a constructor from ApiView::Base
Class Method Details
.convert(obj) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/api_view/default.rb', line 3 def self.convert(obj) if obj.respond_to? :to_api then obj.to_api elsif obj.respond_to? :to_hash then obj.to_hash elsif obj.respond_to? :serializable_hash then obj.serializable_hash else obj end end |
Instance Method Details
#convert ⇒ Object
delegate to class method
16 17 18 |
# File 'lib/api_view/default.rb', line 16 def convert self.class.convert(object) end |