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.



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

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

Instance Method Details

#as_stringObject 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

#hourObject



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?

Returns:

  • (Boolean)


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

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

#minuteObject



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

def minute
  return @timezone.minute
end

#signObject



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