Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
PATH
remote: .
specs:
hermod (3.4.0)
hermod (3.5.0.pre1)
activesupport (> 3.2)
libxml-ruby (~> 5.0.3)
libxml-ruby (>= 5.0.3, < 6.1.0)

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -56,7 +56,7 @@ GEM
concurrent-ruby (~> 1.0)
io-console (0.8.2)
json (2.19.3)
libxml-ruby (5.0.6)
libxml-ruby (6.0.0)
listen (3.10.0)
logger
rb-fsevent (~> 0.10, >= 0.10.3)
Expand Down Expand Up @@ -151,11 +151,11 @@ CHECKSUMS
guard (2.20.1) sha256=ab9cd7873854e6b76080c0589f781ff3e390e441bdda20165804df54f977015a
guard-compat (1.2.1) sha256=3ad21ab0070107f92edfd82610b5cdc2fb8e368851e72362ada9703443d646fe
guard-minitest (3.0.0) sha256=0c418e62a4081a429e4e66ad094a3b66f113423542b43ad7b2df0c87f19d5728
hermod (3.4.0)
hermod (3.5.0.pre1)
i18n (1.14.8) sha256=285778639134865c5e0f6269e0b818256017e8cde89993fdfcbfb64d088824a5
io-console (0.8.2) sha256=d6e3ae7a7cc7574f4b8893b4fca2162e57a825b223a177b7afa236c5ef9814cc
json (2.19.3) sha256=289b0bb53052a1fa8c34ab33cc750b659ba14a5c45f3fcf4b18762dc67c78646
libxml-ruby (5.0.6) sha256=ef82ff4b4c6aaaa9629f0a2d5deccd9502507e368bf2c5a98d675f634013ca46
libxml-ruby (6.0.0) sha256=a9d9458d018dee591d0995fdc1110cd67ec32b7be67d36fdb9e0b01a4ca9dac4
listen (3.10.0) sha256=c6e182db62143aeccc2e1960033bebe7445309c7272061979bb098d03760c9d2
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
lumberjack (1.4.2) sha256=40de5ae46321380c835031bcc1370f13bba304d29f2b5f5bb152061a5a191b95
Expand Down
2 changes: 1 addition & 1 deletion hermod.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Gem::Specification.new do |spec|

spec.required_ruby_version = ">= 3.4"

spec.add_runtime_dependency "libxml-ruby", "~> 5.0.3"
spec.add_runtime_dependency "libxml-ruby", ">= 5.0.3", "< 6.1.0"
spec.add_runtime_dependency "activesupport", "> 3.2"

spec.add_development_dependency "bundler", "~> 2.6", ">= 2.6.2"
Expand Down
2 changes: 1 addition & 1 deletion lib/hermod/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Hermod
VERSION = "3.4.0"
VERSION = "3.5.0.pre1"
end
6 changes: 3 additions & 3 deletions lib/hermod/xml_node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ def initialize(name, value, attributes={})
@attributes = attributes
end

# Internal: turns the XmlNode into an XML::Node including any attributes
# Internal: turns the XmlNode into a LibXML::XML::Node including any attributes
# without any sanitisation (currently - this may change in a future
# version).
#
# Returns an XML::Node built from the XmlNode object.
# Returns a LibXML::XML::Node built from the XmlNode object.
def to_xml
if value.respond_to? :to_xml
value.to_xml
else
XML::Node.new(@name, @value).tap do |node|
LibXML::XML::Node.new(@name, @value).tap do |node|
@attributes.each do |attribute_name, attribute_value|
node[attribute_name] = attribute_value if attribute_value.present?
end
Expand Down
8 changes: 4 additions & 4 deletions lib/hermod/xml_section.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'xml'
require 'libxml-ruby'
require 'hermod/xml_section_builder'
require 'hermod/sanitisation'

Expand All @@ -22,15 +22,15 @@ def self.build(options = {}, &block)

attr_reader :attributes

# Public: turns the XmlSection into an XML::Node instance (from
# Public: turns the XmlSection into a LibXML::XML::Node instance (from
# libxml-ruby). This creates this as a node, adds any attributes (after
# sanitising them according to HMRC's rules) and then adds child nodes in
# the order they were defined in the DSL. Nodes that have been called multiple
# times are added in the order they were called.
#
# Returns an XML::Node
# Returns a LibXML::XML::Node
def to_xml
XML::Node.new(self.class.xml_name).tap do |root_node|
LibXML::XML::Node.new(self.class.xml_name).tap do |root_node|
# Add attributes
attributes.each do |attribute_name, attribute_value|
sane_value = sanitise_attribute(attribute_value)
Expand Down
2 changes: 1 addition & 1 deletion spec/minitest_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def nodes(node_name)
#
# index - the zero-based index of the node you wish to retrieve
#
# Returns an XML::Node (from LibXML)
# Returns a LibXML::XML::Node
def node_by_index(index)
subject.to_xml.to_a[index]
end
Expand Down
Loading