# Releases
# v1.0.0
What's new:
- Support for Ruby 3.2
- Support for attribute delegation
-
Allow to set
render_nil
defaults
- JSON and XML schema namespace mapping support
What's changed:
-
Use
ShaleError
as a base class for exceptions - Fix compilation error for bundled JSON schemas
- Fix type inference for XML schema when default namespace is used
- Fix XML schema handling with a period in the element name
# v0.9.0
What's new:
- Support for converting collections
- Support for CSV
- Allow to specify version and add encoding to XML declaration
# you can also pass string to encoding e.g. encoding: 'ASCII'
person.to_xml(pretty: true, declaration: '1.1', encoding: true)
# =>
#
# <?xml version="1.1" encoding="UTF-8"?>
# <Person>
# <Address city="London"/>
# </Person>
# v0.8.0
What's new:
- Bring back Ruby 2.6 support (it's the version JRuby supports)
-
You can group mappings using
group
block
What's changed:
-
Attributes are defined now on a anonymous module.
It allows to override accessors and
super
works as expected.
# v0.7.1
What's changed:
- Fix broken handling of Date and Time types
# v0.7.0
What's new:
-
You can set
render_nil: true
option on a mapping to control hownil
values are rendered (default isfalse
):
-
You can pass
only: []
andexcept: []
options that allow to control what attributes are rendered/parsed:
- You can pass a context object to extractor/generator methods:
What's changed:
-
:pretty
and:declaration
options are keyword arguments now:
- Extractor/generator methods for JSON/YAML/TOML accept now whole document instead of relaying on a return value (this behavior is consisten with XML mapping)
class Person < Shale::Mapper
attribute :first_name, Shale::Type::String
json do
map 'first_name', using: { from: :first_name_from, to: first_name_to }
end
def first_name_from(model, value)
model.first_name = value
end
def first_name_to(model, doc)
doc['first_name'] = model.first_name
end
end
# v0.6.0
What's new:
- You can now use your own models with Shale mappers:
- Support for TOML:
- Support for CDATA nodes in XML:
What's changed:
- Allow to map XML content using methods
- Prevent adding default mapping after mapping block was declared
# v0.5.0
What's new:
- You can now generate Shale models from XML Schema
What's changed:
- Drop support for Ruby 2.6
- Due to REXML being promoted to bundled gems in Ruby 3 Shale doesn't set REXML as a default XML parser. To work with XML documents, XML adapter needs to be set explicitly e.g.