Class: OpenEHR::RM::DataStructures::History::IntervalEvent

Inherits:
Event
  • Object
show all
Defined in:
lib/open_ehr/rm/data_structures/history.rb

Instance Attribute Summary collapse

Attributes inherited from Event

#data, #state, #time

Instance Method Summary collapse

Methods inherited from Event

#offset

Constructor Details

#initialize(args = { }) ⇒ IntervalEvent

Returns a new instance of IntervalEvent.



80
81
82
83
84
85
# File 'lib/open_ehr/rm/data_structures/history.rb', line 80

def initialize(args = { })
  super(args)
  self.width = args[:width]
  self.math_function = args[:math_function]
  self.sample_count = args[:sample_count]
end

Instance Attribute Details

#math_functionObject

Returns the value of attribute math_function.



77
78
79
# File 'lib/open_ehr/rm/data_structures/history.rb', line 77

def math_function
  @math_function
end

#sample_countObject

Returns the value of attribute sample_count.



78
79
80
# File 'lib/open_ehr/rm/data_structures/history.rb', line 78

def sample_count
  @sample_count
end

#widthObject

Returns the value of attribute width.



77
78
79
# File 'lib/open_ehr/rm/data_structures/history.rb', line 77

def width
  @width
end

Instance Method Details

#interval_start_timeObject



99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/open_ehr/rm/data_structures/history.rb', line 99

def interval_start_time
  date_time = ::Time.iso8601(time.as_string)
  start_time = (@width.years).years.ago date_time
  start_time = (@width.months).months.ago start_time
  start_time = (@width.days).days.ago start_time
  start_time = (@width.hours).hours.ago start_time
  start_time = (@width.minutes).minutes.ago start_time
  seconds = @width.seconds
  unless @width.fractional_second.nil?
    seconds += @width.fractional_second
  end
  start_time = seconds.ago start_time
  return DvDateTime.new(:value => start_time.iso8601)
end