Module: GSGraph::Serialization
Instance Method Summary collapse
Instance Method Details
#as_json(options = {}) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/gs_graph/serialization.rb', line 7 def as_json( = {}) hash = self.to_hash hash.delete_if do |k, v| v.blank? end hash end |
#to_hash(options = {}) ⇒ Object
3 4 5 |
# File 'lib/gs_graph/serialization.rb', line 3 def to_hash( = {}) raise "Define #{self.class}#to_hash!" end |
#to_json(options = {}) ⇒ Object
15 16 17 |
# File 'lib/gs_graph/serialization.rb', line 15 def to_json( = {}) as_json.to_json end |