Module: OpenEHR::AssumedLibraryTypes::ISO8601TimeModule
- Included in:
- ISO8601DateTimeModule, ISO8601Time
- Defined in:
- lib/open_ehr/assumed_library_types.rb
Overview
end of ISO8601_DATE
Instance Attribute Summary collapse
-
#fractional_second ⇒ Object
Returns the value of attribute fractional_second.
-
#hour ⇒ Object
Returns the value of attribute hour.
-
#minute ⇒ Object
Returns the value of attribute minute.
-
#second ⇒ Object
Returns the value of attribute second.
-
#timezone ⇒ Object
Returns the value of attribute timezone.
Instance Method Summary collapse
- #as_string ⇒ Object
- #has_fractional_second? ⇒ Boolean
- #is_decimal_sign_comma? ⇒ Boolean
- #is_extended? ⇒ Boolean
- #is_partial? ⇒ Boolean
- #minute_unknown? ⇒ Boolean
- #second_unknown? ⇒ Boolean
- #to_second ⇒ Object
Instance Attribute Details
#fractional_second ⇒ Object
Returns the value of attribute fractional_second.
240 241 242 |
# File 'lib/open_ehr/assumed_library_types.rb', line 240 def fractional_second @fractional_second end |
#hour ⇒ Object
Returns the value of attribute hour.
240 241 242 |
# File 'lib/open_ehr/assumed_library_types.rb', line 240 def hour @hour end |
#minute ⇒ Object
Returns the value of attribute minute.
240 241 242 |
# File 'lib/open_ehr/assumed_library_types.rb', line 240 def minute @minute end |
#second ⇒ Object
Returns the value of attribute second.
240 241 242 |
# File 'lib/open_ehr/assumed_library_types.rb', line 240 def second @second end |
#timezone ⇒ Object
Returns the value of attribute timezone.
240 241 242 |
# File 'lib/open_ehr/assumed_library_types.rb', line 240 def timezone @timezone end |
Instance Method Details
#as_string ⇒ Object
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 |
# File 'lib/open_ehr/assumed_library_types.rb', line 306 def as_string s = sprintf("%02d", @hour) if !@minute.nil? s += ":" + sprintf("%02d",@minute) if !@second.nil? s += ":" + sprintf("%02d", @second) if !@fractional_second.nil? s += "." + @fractional_second.to_s[2..-1] if !@timezone.nil? s += @timezone end end end end return s end |
#has_fractional_second? ⇒ Boolean
278 279 280 |
# File 'lib/open_ehr/assumed_library_types.rb', line 278 def has_fractional_second? return !@fractional_second.nil? end |
#is_decimal_sign_comma? ⇒ Boolean
294 295 296 |
# File 'lib/open_ehr/assumed_library_types.rb', line 294 def is_decimal_sign_comma? false end |
#is_extended? ⇒ Boolean
298 299 300 |
# File 'lib/open_ehr/assumed_library_types.rb', line 298 def is_extended? true end |
#is_partial? ⇒ Boolean
302 303 304 |
# File 'lib/open_ehr/assumed_library_types.rb', line 302 def is_partial? second_unknown? or minute_unknown? end |
#minute_unknown? ⇒ Boolean
249 250 251 |
# File 'lib/open_ehr/assumed_library_types.rb', line 249 def minute_unknown? @minute.nil? end |
#second_unknown? ⇒ Boolean
258 259 260 |
# File 'lib/open_ehr/assumed_library_types.rb', line 258 def second_unknown? @second.nil? end |
#to_second ⇒ Object
323 324 325 326 327 328 |
# File 'lib/open_ehr/assumed_library_types.rb', line 323 def to_second second = (nilthenzero(@hour)*60 + nilthenzero(@minute))*60 + nilthenzero(@second) + nilthenzero(@fractional_second) return second end |