Class: Saxon::ItemType::LexicalStringConversion::DurationConversion
- Inherits:
-
Object
- Object
- Saxon::ItemType::LexicalStringConversion::DurationConversion
- Defined in:
- lib/saxon/item_type/lexical_string_conversion.rb
Overview
Convert a value in seconds into an XDM Duration string
Instance Attribute Summary collapse
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
Instance Method Summary collapse
-
#call(value, item_type) ⇒ Object
Produce a lexical Duration string from a numeric Ruby value representing seconds.
-
#initialize(pattern) ⇒ DurationConversion
constructor
A new instance of DurationConversion.
Constructor Details
#initialize(pattern) ⇒ DurationConversion
Returns a new instance of DurationConversion.
131 132 133 |
# File 'lib/saxon/item_type/lexical_string_conversion.rb', line 131 def initialize(pattern) @pattern = pattern end |
Instance Attribute Details
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
129 130 131 |
# File 'lib/saxon/item_type/lexical_string_conversion.rb', line 129 def pattern @pattern end |
Instance Method Details
#call(value, item_type) ⇒ Object
Produce a lexical Duration string from a numeric Ruby value representing seconds
137 138 139 140 |
# File 'lib/saxon/item_type/lexical_string_conversion.rb', line 137 def call(value, item_type) return numeric(value) if Numeric === value LexicalStringConversion.validate(value, item_type, pattern) end |