Class: OpenEHR::AssumedLibraryTypes::ISO8601Timezone
- Inherits:
-
Object
- Object
- OpenEHR::AssumedLibraryTypes::ISO8601Timezone
- Defined in:
- lib/open_ehr/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.
545 546 547 |
# File 'lib/open_ehr/assumed_library_types.rb', line 545 def initialize(string) @timezone = Timezone.new(string) end |
Instance Method Details
#as_string ⇒ Object Also known as: to_s
569 570 571 572 573 574 575 576 |
# File 'lib/open_ehr/assumed_library_types.rb', line 569 def as_string if @timezone.hour < 0 s = '' else s = '+' end sprintf("%s%02d%02d", s, @timezone.hour, @timezone.minute) end |
#hour ⇒ Object
549 550 551 |
# File 'lib/open_ehr/assumed_library_types.rb', line 549 def hour return @timezone.hour end |
#is_gmt? ⇒ Boolean Also known as: gmt?
565 566 567 |
# File 'lib/open_ehr/assumed_library_types.rb', line 565 def is_gmt? return (@timezone.hour == 0 and @timezone.minute == 0) end |
#minute ⇒ Object
553 554 555 |
# File 'lib/open_ehr/assumed_library_types.rb', line 553 def minute return @timezone.minute end |
#sign ⇒ Object
557 558 559 560 561 562 563 |
# File 'lib/open_ehr/assumed_library_types.rb', line 557 def sign if @timezone.hour < 0 return -1 else return +1 end end |