Support for default attribute values #26

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@Confusion

(Sorry, I messed up #24 by pushing additional commits to this branch, which should be considered separately for inclusion. I force-pushed to remove them, but for some reason the commit in that pull request was also removed)

I've added support for a :default option to attribute declarations. This makes it easy to declare default values, without requiring you to write initialize functions that set them. When working with an XML schema, these :default values can nicely reflect the 'default' declarations in the XSD.

Our use case is we generate classes that include HappyMapper from information parsed from an XSD. With this extension we can easily add a :default => 'some_value' to the generated attribute :foo, String lines, based on the default declarations parsed from the XSD. However, it seems like something that may more generally be considered useful.

Ivo Wever Support for default attribute values
Added a :default option to attribute declarations, which result in a
default value being set on objects. This default value will not be
included in generated XML.
a4b9bf9
@dam5s

This require breaks the build. It should be require 'spec_helper'

@dam5s
Owner
dam5s commented Dec 27, 2012

Fixed and merged

@dam5s dam5s closed this Dec 27, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment