Class: OpenEHR::AssumedLibraryTypes::ISO8601Timezone

Inherits:
Object
  • Object
show all
Defined in:
lib/openehr/assumed_library_types.rb

Instance Method Summary collapse

Constructor Details

#initialize(string) ⇒ ISO8601Timezone

Returns a new instance of ISO8601Timezone.



552
553
554
# File 'lib/openehr/assumed_library_types.rb', line 552

def initialize(string)
  @timezone = Timezone.new(string)
end

Instance Method Details

#as_stringObject Also known as: to_s



576
577
578
579
580
581
582
583
# File 'lib/openehr/assumed_library_types.rb', line 576

def as_string
  if @timezone.hour < 0
    s = ''
  else
    s = '+'
  end
  sprintf("%s%02d%02d", s, @timezone.hour, @timezone.minute)
end

#hourObject



556
557
558
# File 'lib/openehr/assumed_library_types.rb', line 556

def hour
  return @timezone.hour
end

#is_gmt?Boolean Also known as: gmt?

Returns:

  • (Boolean)


572
573
574
# File 'lib/openehr/assumed_library_types.rb', line 572

def is_gmt?
  return (@timezone.hour == 0 and @timezone.minute == 0)
end

#minuteObject



560
561
562
# File 'lib/openehr/assumed_library_types.rb', line 560

def minute
  return @timezone.minute
end

#signObject



564
565
566
567
568
569
570
# File 'lib/openehr/assumed_library_types.rb', line 564

def sign
  if @timezone.hour < 0
    return -1
  else
    return +1
  end
end