class RTP::ExtendedPlan

The Extended plan class.

@note Relations:

* Parent: Plan
* Children: none

Attributes

encoding[R]
fullname[R]
parent[RW]

The Record which this instance belongs to.

patient_comments[R]

Public Class Methods

load(string, parent) click to toggle source

Creates a new ExtendedPlan by parsing a RTPConnect string line.

@param [#to_s] string the extended plan definition record string line @param [Record] parent a record which is used to determine the proper parent of this instance @return [ExtendedPlan] the created ExtendedPlan instance @raise [ArgumentError] if given a string containing an invalid number of elements

# File lib/rtp-connect/extended_plan.rb, line 24
def self.load(string, parent)
  ep = self.new(parent)
  ep.load(string)
end
new(parent) click to toggle source

Creates a new ExtendedPlan.

@param [Record] parent a record which is used to determine the proper parent of this instance

Calls superclass method
# File lib/rtp-connect/extended_plan.rb, line 33
def initialize(parent)
  super('EXTENDED_PLAN_DEF', 4, 5)
  # Parent relation (may get more than one type of record here):
  @parent = get_parent(parent.to_record, Plan)
  @parent.add_extended_plan(self)
  @attributes = [
    # Required:
    :keyword,
    :encoding,
    :fullname,
    # Optional:
    :patient_comments
  ]
end

Public Instance Methods

==(other) click to toggle source

Checks for equality.

Other and self are considered equivalent if they are of compatible types and their attributes are equivalent.

@param other an object to be compared with self. @return [Boolean] true if self and other are considered equivalent

# File lib/rtp-connect/extended_plan.rb, line 56
def ==(other)
  if other.respond_to?(:to_extended_plan)
    other.send(:state) == state
  end
end
Also aliased as: eql?
children() click to toggle source

Gives an empty array, as these instances are child-less by definition.

@return [Array] an emtpy array

# File lib/rtp-connect/extended_plan.rb, line 68
def children
  return Array.new
end
encoding=(value) click to toggle source

Sets the encoding attribute.

@param [nil, to_s] value the new attribute value

# File lib/rtp-connect/extended_plan.rb, line 94
def encoding=(value)
  @encoding = value && value.to_s
end
eql?(other)
Alias for: ==
fullname=(value) click to toggle source

Sets the fullname attribute.

@param [nil, to_s] value the new attribute value

# File lib/rtp-connect/extended_plan.rb, line 102
def fullname=(value)
  @fullname = value && value.to_s
end
hash() click to toggle source

Computes a hash code for this object.

@note Two objects with the same attributes will have the same hash code.

@return [Fixnum] the object's hash code

# File lib/rtp-connect/extended_plan.rb, line 78
def hash
  state.hash
end
patient_comments=(value) click to toggle source

Sets the patient_comments attribute.

@param [nil, to_s] value the new attribute value

# File lib/rtp-connect/extended_plan.rb, line 110
def patient_comments=(value)
  @patient_comments = value && value.to_s
end
to_extended_plan() click to toggle source

Returns self.

@return [ExtendedPlan] self

# File lib/rtp-connect/extended_plan.rb, line 86
def to_extended_plan
  self
end