Module: Restorm::Model::Parse::ClassMethods
- Defined in:
- lib/restorm/model/parse.rb
Instance Method Summary collapse
-
#include_root_in_json(value, options = {}) ⇒ Object
Return or change the value of ‘include_root_in_json`.
-
#parse_root_in_json(value, options = {}) ⇒ Object
Return or change the value of ‘parse_root_in_json`.
-
#request_new_object_on_build(value = nil) ⇒ Object
Return or change the value of ‘request_new_object_on_build`.
-
#root_element(value = nil) ⇒ Object
Return or change the value of ‘root_element`.
Instance Method Details
#include_root_in_json(value, options = {}) ⇒ Object
Return or change the value of ‘include_root_in_json`
82 83 84 85 |
# File 'lib/restorm/model/parse.rb', line 82 def include_root_in_json(value, = {}) @_restorm_include_root_in_json = value @_restorm_include_root_in_json_format = [:format] end |
#parse_root_in_json(value, options = {}) ⇒ Object
Return or change the value of ‘parse_root_in_json`
104 105 106 107 |
# File 'lib/restorm/model/parse.rb', line 104 def parse_root_in_json(value, = {}) @_restorm_parse_root_in_json = value @_restorm_parse_root_in_json_format = [:format] end |
#request_new_object_on_build(value = nil) ⇒ Object
Return or change the value of ‘request_new_object_on_build`
116 117 118 |
# File 'lib/restorm/model/parse.rb', line 116 def request_new_object_on_build(value = nil) @_restorm_request_new_object_on_build = value end |
#root_element(value = nil) ⇒ Object
Return or change the value of ‘root_element`. Always defaults to the base name of the class.
131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/restorm/model/parse.rb', line 131 def root_element(value = nil) if value.nil? @_retorm_root_element ||= if json_api_format? name.split("::").last.pluralize.underscore.to_sym else name.split("::").last.underscore.to_sym end else @_restorm_root_element = value.to_sym end end |