Class: OpenEHR::AssumedLibraryTypes::ISO8601Timezone
- Inherits:
-
Object
- Object
- OpenEHR::AssumedLibraryTypes::ISO8601Timezone
- Defined in:
- lib/openehr/assumed_library_types.rb
Instance Method Summary collapse
- #as_string ⇒ Object (also: #to_s)
- #hour ⇒ Object
-
#initialize(string) ⇒ ISO8601Timezone
constructor
A new instance of ISO8601Timezone.
- #is_gmt? ⇒ Boolean (also: #gmt?)
- #minute ⇒ Object
- #sign ⇒ Object
Constructor Details
#initialize(string) ⇒ ISO8601Timezone
Returns a new instance of ISO8601Timezone.
551 552 553 |
# File 'lib/openehr/assumed_library_types.rb', line 551 def initialize(string) @timezone = Timezone.new(string) end |
Instance Method Details
#as_string ⇒ Object Also known as: to_s
575 576 577 578 579 580 581 582 |
# File 'lib/openehr/assumed_library_types.rb', line 575 def as_string if @timezone.hour < 0 s = '' else s = '+' end sprintf("%s%02d%02d", s, @timezone.hour, @timezone.minute) end |
#hour ⇒ Object
555 556 557 |
# File 'lib/openehr/assumed_library_types.rb', line 555 def hour return @timezone.hour end |
#is_gmt? ⇒ Boolean Also known as: gmt?
571 572 573 |
# File 'lib/openehr/assumed_library_types.rb', line 571 def is_gmt? return (@timezone.hour == 0 and @timezone.minute == 0) end |
#minute ⇒ Object
559 560 561 |
# File 'lib/openehr/assumed_library_types.rb', line 559 def minute return @timezone.minute end |
#sign ⇒ Object
563 564 565 566 567 568 569 |
# File 'lib/openehr/assumed_library_types.rb', line 563 def sign if @timezone.hour < 0 return -1 else return +1 end end |