Class: XmlParsable::Elements::TimeElement
- Inherits:
-
AbstractElement
- Object
- AbstractElement
- XmlParsable::Elements::TimeElement
- Defined in:
- lib/xmlparsable/elements/time.rb
Overview
Parses content into a ruby Time value
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #finalize ⇒ Object
-
#initialize(name, attributes, parent, *arguments) ⇒ TimeElement
constructor
A new instance of TimeElement.
- #read(text) ⇒ Object
Methods inherited from AbstractElement
Constructor Details
#initialize(name, attributes, parent, *arguments) ⇒ TimeElement
Returns a new instance of TimeElement.
11 12 13 |
# File 'lib/xmlparsable/elements/time.rb', line 11 def initialize(name, attributes, parent, *arguments) @name, @parent, @string = name, parent, "" end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/xmlparsable/elements/time.rb', line 9 def name @name end |
Instance Method Details
#finalize ⇒ Object
19 20 21 22 |
# File 'lib/xmlparsable/elements/time.rb', line 19 def finalize stripped = @string.strip @parent.close(self, stripped == "" ? nil : Time.parse(stripped)) end |
#read(text) ⇒ Object
15 16 17 |
# File 'lib/xmlparsable/elements/time.rb', line 15 def read(text) @string << text end |