Module: Her::Model::Parse::ClassMethods
- Defined in:
- lib/her/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`
84 85 86 87 |
# File 'lib/her/model/parse.rb', line 84 def include_root_in_json(value, = {}) @_her_include_root_in_json = value @_her_include_root_in_json_format = [:format] end |
#parse_root_in_json(value, options = {}) ⇒ Object
Return or change the value of ‘parse_root_in_json`
106 107 108 109 |
# File 'lib/her/model/parse.rb', line 106 def parse_root_in_json(value, = {}) @_her_parse_root_in_json = value @_her_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`
118 119 120 |
# File 'lib/her/model/parse.rb', line 118 def request_new_object_on_build(value = nil) @_her_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.
133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/her/model/parse.rb', line 133 def root_element(value = nil) if value.nil? if json_api_format? @_her_root_element ||= self.name.split("::").last.pluralize.underscore.to_sym else @_her_root_element ||= self.name.split("::").last.underscore.to_sym end else @_her_root_element = value.to_sym end end |