Class: SignedXml::C14NTransform
- Inherits:
-
Object
- Object
- SignedXml::C14NTransform
- Includes:
- Nokogiri::XML
- Defined in:
- lib/signed_xml/c14n_transform.rb
Instance Attribute Summary collapse
-
#inclusive_namespaces ⇒ Object
readonly
Returns the value of attribute inclusive_namespaces.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#with_comments ⇒ Object
readonly
Returns the value of attribute with_comments.
Instance Method Summary collapse
- #apply(input) ⇒ Object
-
#initialize(method = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315", inclusive_namespaces = []) ⇒ C14NTransform
constructor
A new instance of C14NTransform.
Constructor Details
#initialize(method = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315", inclusive_namespaces = []) ⇒ C14NTransform
Returns a new instance of C14NTransform.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/signed_xml/c14n_transform.rb', line 9 def initialize(method = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315", inclusive_namespaces = []) method, with_comments = method.split('#') @method = case method when "http://www.w3.org/TR/2001/REC-xml-c14n-20010315" then XML_C14N_1_0 when "http://www.w3.org/2001/10/xml-exc-c14n" then XML_C14N_EXCLUSIVE_1_0 when "http://www.w3.org/2006/12/xml-c14n11" then XML_C14N_1_1 else raise ArgumentError, "unknown canonicalization method #{method}" end @with_comments = !!with_comments @inclusive_namespaces = inclusive_namespaces end |
Instance Attribute Details
#inclusive_namespaces ⇒ Object (readonly)
Returns the value of attribute inclusive_namespaces.
7 8 9 |
# File 'lib/signed_xml/c14n_transform.rb', line 7 def inclusive_namespaces @inclusive_namespaces end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
5 6 7 |
# File 'lib/signed_xml/c14n_transform.rb', line 5 def method @method end |
#with_comments ⇒ Object (readonly)
Returns the value of attribute with_comments.
6 7 8 |
# File 'lib/signed_xml/c14n_transform.rb', line 6 def with_comments @with_comments end |
Instance Method Details
#apply(input) ⇒ Object
23 24 25 26 27 |
# File 'lib/signed_xml/c14n_transform.rb', line 23 def apply(input) raise ArgumentError, "input #{input.inspect}:#{input.class} is not canonicalizable" unless input.respond_to?(:canonicalize) input.canonicalize(method, inclusive_namespaces, with_comments) end |