Sha256: 3742eec56b962c4e07a114550d9e653011251c20e8039aec22efd5e42623e2bd
Contents?: true
Size: 434 Bytes
Versions: 8
Compression:
Stored size: 434 Bytes
Contents
class Structure # Converts structure to a JSON representation. def as_json(options = nil) subset = if options if only = options[:only] attributes.slice(*Array.wrap(only)) elsif except = options[:except] attributes.except(*Array.wrap(except)) else attributes.dup end else attributes.dup end { JSON.create_id => self.class.name }. merge(subset) end end
Version data entries
8 entries across 8 versions & 1 rubygems