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

Inherits:
Event show all
Defined in:
lib/openehr/rm/data_structures/history.rb

Constant Summary

Constants included from Common::Archetyped::LocaterConstants

Common::Archetyped::LocaterConstants::CONTENT_PATH_SEPARATOR, Common::Archetyped::LocaterConstants::CURRENT_TRANSACTION_ID, Common::Archetyped::LocaterConstants::FRAGMENT_SEPARATOR, Common::Archetyped::LocaterConstants::MULTIPART_ID_DELIMITER, Common::Archetyped::LocaterConstants::ORGANIZER_PATH_SEPARATOR

Instance Attribute Summary collapse

Attributes inherited from Event

#data, #state, #time

Attributes inherited from Common::Archetyped::Locatable

#archetype_details, #archetype_node_id, #feeder_audit, #links, #name, #uid

Attributes inherited from Common::Archetyped::Pathable

#parent

Instance Method Summary collapse

Methods inherited from Event

#offset

Methods inherited from Common::Archetyped::Locatable

#concept, #is_archetype_root?

Methods inherited from Common::Archetyped::Pathable

#item_at_path, #items_at_path, #path_exists?, #path_of_item, #path_unique?

Constructor Details

#initialize(args = { }) ⇒ IntervalEvent

Returns a new instance of IntervalEvent.



82
83
84
85
86
87
# File 'lib/openehr/rm/data_structures/history.rb', line 82

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.



79
80
81
# File 'lib/openehr/rm/data_structures/history.rb', line 79

def math_function
  @math_function
end

#sample_countObject

Returns the value of attribute sample_count.



80
81
82
# File 'lib/openehr/rm/data_structures/history.rb', line 80

def sample_count
  @sample_count
end

#widthObject

Returns the value of attribute width.



79
80
81
# File 'lib/openehr/rm/data_structures/history.rb', line 79

def width
  @width
end

Instance Method Details

#interval_start_timeObject



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

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.seconds.ago start_time
  return OpenEHR::RM::DataTypes::Quantity::DateTime::DvDateTime.new(:value => start_time.iso8601)
end