Class: Agio::XMLDecl
- Inherits:
-
Object
- Object
- Agio::XMLDecl
- Defined in:
- lib/agio/data.rb
Overview
A simple wrapper around the contents of an XML declaration in an XHTML document.
Instance Attribute Summary collapse
-
#encoding ⇒ Object
readonly
Returns the value of attribute encoding.
-
#standalone ⇒ Object
readonly
Returns the value of attribute standalone.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(options = {}) ⇒ XMLDecl
constructor
A new instance of XMLDecl.
- #inspect ⇒ Object
- #to_a ⇒ Object
- #to_s ⇒ Object
- #to_str ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ XMLDecl
Returns a new instance of XMLDecl.
47 48 49 50 51 |
# File 'lib/agio/data.rb', line 47 def initialize( = {}) @version = [:version] @encoding = [:encoding] @standalone = [:standalone] end |
Instance Attribute Details
#encoding ⇒ Object (readonly)
Returns the value of attribute encoding.
53 54 55 |
# File 'lib/agio/data.rb', line 53 def encoding @encoding end |
#standalone ⇒ Object (readonly)
Returns the value of attribute standalone.
53 54 55 |
# File 'lib/agio/data.rb', line 53 def standalone @standalone end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
53 54 55 |
# File 'lib/agio/data.rb', line 53 def version @version end |
Instance Method Details
#==(other) ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/agio/data.rb', line 76 def ==(other) case other when String to_s == other when Array to_a == other when Agio::XMLDecl to_s == other.to_s else false end end |
#inspect ⇒ Object
68 69 70 |
# File 'lib/agio/data.rb', line 68 def inspect %Q(#<#{self.class} '#{to_s}'>) end |
#to_a ⇒ Object
55 56 57 |
# File 'lib/agio/data.rb', line 55 def to_a [ version, encoding, standalone ] end |
#to_s ⇒ Object
59 60 61 62 63 64 65 66 |
# File 'lib/agio/data.rb', line 59 def to_s s = %Q(<?xml ) s += %Q(version="#{version}" ) unless version.nil? s += %Q(encoding="#{encoding}" ) unless encoding.nil? s += %Q(standalone="#{!!standalone}" ) unless standalone.nil? s += "?>" s end |
#to_str ⇒ Object
72 73 74 |
# File 'lib/agio/data.rb', line 72 def to_str to_s end |