class RTP::ExtendedPlan
The Extended plan class.
@note Relations:
* Parent: Plan * Children: none
Attributes
The Record
which this instance belongs to.
Public Class Methods
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
Creates a new ExtendedPlan
.
@param [Record] parent a record which is used to determine the proper parent of this instance
# 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
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
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
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
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
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
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
Returns self.
@return [ExtendedPlan] self
# File lib/rtp-connect/extended_plan.rb, line 86 def to_extended_plan self end