class Hermod::XmlSectionBuilder
def date_node(name, options={})
options - a hash of options used to set up validations.
name - the name of the node. This will become the name of the method on the XmlSection.
Public: defines a node for sending a date to HMRC
def date_node(name, options={}) validators = [].tap do |validators| validators << Validators::ValuePresence.new unless options.delete(:optional) validators << Validators::TypeChecker.new(Date) { |value| value.respond_to? :strftime } end create_method(name, [], validators, options) do |value, attributes| [(value ? value.strftime(format_for(:date)) : nil), attributes] end end