Class: SignedXml::C14NTransform
- Inherits:
-
Object
- Object
- SignedXml::C14NTransform
- Includes:
- Nokogiri::XML
- Defined in:
- lib/signed_xml/c14n_transform.rb
Instance Attribute Summary collapse
-
#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") ⇒ C14NTransform
constructor
A new instance of C14NTransform.
Constructor Details
#initialize(method = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315") ⇒ C14NTransform
Returns a new instance of C14NTransform.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/signed_xml/c14n_transform.rb', line 8 def initialize(method = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315") 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 end |
Instance Attribute Details
#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
20 21 22 23 24 |
# File 'lib/signed_xml/c14n_transform.rb', line 20 def apply(input) raise ArgumentError, "input #{input.inspect}:#{input.class} is not canonicalizable" unless input.respond_to?(:canonicalize) input.canonicalize(method, nil, with_comments) end |