Skip to content

Latest commit

 

History

History
135 lines (77 loc) · 5.02 KB

CHANGES.textile

File metadata and controls

135 lines (77 loc) · 5.02 KB

1.2.7

  • Moving Format.binding_for_definition to Format#{format}_binding_for_definition, making it an instance method in its own “namespace”. This allows mixing in multiple representer engines into a user’s representer module.

1.2.6

  • Extracted HashRepresenter which operates on hash structures. This allows you to “parse” form data, e.g. as in Rails’ params hash. Internally, this is used by JSON and partly by YAML.

1.2.5

  • Add support for YAML.

1.2.4

  • ObjectBinding no longer tries to extend nil values when rendering and :render_nil is set.
  • In XML you can now use :wrap to define an additional container tag around properties and collections.

1.2.3

  • Using virtus for coercion now works in both classes and modules. Thanks to @solnic for a great collaboration. Open-source rocks!

1.2.2

  • Added XML::AttributeHash to store hash key-value pairs in attributes instead of dedicated tags.
  • JSON::Hash, XML::Hash and XML::AttributeHash now respect :exclude and :include when parsing and rendering.

1.2.1

  • Deprecated :represent_nil favor of :render_nil.
  • API change: if a property is missing in an incoming document and there is no default set it is completely ignored and not set in the represented object.

1.2.0

  • Deprecated :except in favor of :exclude.
  • A property with false value will now be included in the rendered representation. Same applies to parsing, false values will now be included. That particularly means properties that used to be unset (i.e. nil) after parsing might be false now.
  • You can include nil values now in your representations since #property respects :represent_nil => true.

1.1.6

  • Added :if option to property.

1.1.5

  • Definitions are now properly cloned when Config is cloned.

1.1.4

  • representable_attrs is now cloned when a representer module is included in an inheriting representer.

1.1.3

  • Introduced `#compile_fragment` and friends to make it simpler overriding parsing and rendering steps.

1.1.2

  • Allow `Module.hash` to be called without arguments as this seems to be required in Padrino.

1.1.1

  • When a representer module is extended we no longer set the @representable_attrs ivar directly but use a setter. This makes it work with mongoid and fixes trailblazer/roar#10.

1.1.0

  • Added `JSON::Collection` to have plain list representations. And `JSON::Hash` for hashes.
  • Added the `hash` class method to XML and JSON to represent hashes.
  • Defining `:extend` only on a property now works for rendering. If you try parsing without a `:class` there’ll be an exception, though.

1.0.1

  • Allow passing a list of modules to :extend, like :extend => [Ingredient, IngredientRepresenter].

1.0.0

  • 1.0.0 release! Party time!

0.13.1

  • Removed property :name from @XML in favor of :attribute => true.

0.13.0

  • We no longer create accessors in Representable.property – you have to do this yourself using attr_accessors.

0.12.0

  • :as is now :class.

0.11.0

  • Representer modules can now be injected into objects using #extend.
  • The :extend option allows setting a representer module for a typed property. This will extend the contained object at runtime roughly following the DCI pattern.
  • Renamed #representable_property and #representable_collection to #property and #collection as we don’t have to fear namespace collisions in modules.

0.10.3

  • Added representable_property :default => ... option which is considered for both serialization and deserialization. The default is applied when the value is nil. Note that an empty string ain’t nil.
  • representable_attrs are now pushed to instance level as soon as possible.

0.10.2

  • Added representable_property :accessors => false option to suppress adding accessors.
  • Representable.representation_wrap is no longer inherited.
  • Representers can now be defined in modules. They inherit to including modules.

0.10.1

  • The block in to_* and from_* now yields the symbolized property name. If you need the binding/definition you gotta get it yourself.
  • Runs with Ruby 1.8 and 1.9.

0.10.0

  • Wrapping can now be set through Representable.representation_wrap=. Possible values are:
  • false: No wrapping. In XML context, this is undefined behaviour. Default in JSON.
  • String: Wrap with provided string.
  • true: compute wrapper from class name.

0.9.3

  • Removed the :as => [..] syntax in favor of :array => true.

0.9.2

  • Arguments and block now successfully forwarded in #from_*.

0.9.1

  • Extracted common serialization into Representable#create_representation_with and deserialization into #update_properties_from.
  • Both serialization and deserialization now accept a block to make them skip elements while iterating the property definitions.

0.9.0

Changes

  • Removed the :tag option in favor of :from. The Definition#from method is now authorative for all name mappings.
  • Removed the active_support and i18n dependency.