Module: InJson::ClassMethods
- Defined in:
- lib/in_json.rb
Instance Method Summary collapse
-
#in_json(name = :default) { ... } ⇒ Object
Defines an InJson definition that can be used to convert an object to JSON format InstanceMethods#in_json.
Instance Method Details
#in_json(name = :default) { ... } ⇒ Object
Defines an InJson definition that can be used to convert an object to JSON format InstanceMethods#in_json
51 52 53 54 55 56 57 |
# File 'lib/in_json.rb', line 51 def in_json(name = :default, &block) definitions = read_inheritable_attribute(:in_json_definitions) || {} definitions[name] = Definition.new.instance_eval(&block) write_inheritable_attribute :in_json_definitions, definitions end |