Class: OpenEHR::AssumedLibraryTypes::ISO8601Timezone

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

Instance Method Summary collapse

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_stringObject 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

#hourObject



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?

Returns:

  • (Boolean)


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

#minuteObject



553
554
555
# File 'lib/open_ehr/assumed_library_types.rb', line 553

def minute
  return @timezone.minute
end

#signObject



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