Class: RTP::ExtendedField
- Defined in:
- lib/rtp-connect/extended_field.rb
Overview
Relations:
-
Parent: Field
-
Children: none
The ExtendedField class.
Instance Attribute Summary collapse
-
#accessory_code ⇒ Object
Returns the value of attribute accessory_code.
-
#accessory_type ⇒ Object
Returns the value of attribute accessory_type.
-
#field_id ⇒ Object
Returns the value of attribute field_id.
-
#high_dose_authorization ⇒ Object
Returns the value of attribute high_dose_authorization.
-
#is_fff ⇒ Object
Returns the value of attribute is_fff.
-
#original_beam_name ⇒ Object
Returns the value of attribute original_beam_name.
-
#original_beam_number ⇒ Object
Returns the value of attribute original_beam_number.
-
#original_plan_uid ⇒ Object
Returns the value of attribute original_plan_uid.
-
#parent ⇒ Object
readonly
The Record which this instance belongs to.
Attributes inherited from Record
Class Method Summary collapse
-
.load(string, parent) ⇒ ExtendedField
Creates a new (treatment) ExtendedField by parsing a RTPConnect string line.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
(also: #eql?)
Checks for equality.
-
#children ⇒ Array
Gives an empty array, as these instances are child-less by definition.
-
#hash ⇒ Fixnum
Computes a hash code for this object.
-
#initialize(parent) ⇒ ExtendedField
constructor
Creates a new (treatment) ExtendedField.
-
#to_extended_field ⇒ ExtendedField
Returns self.
-
#to_s ⇒ String
(also: #to_str)
Encodes the ExtendedField object + any hiearchy of child objects, to a properly formatted RTPConnect ascii string.
Methods inherited from Record
#encode, #get_parent, #load, #to_record, #values
Constructor Details
#initialize(parent) ⇒ ExtendedField
Creates a new (treatment) ExtendedField.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/rtp-connect/extended_field.rb', line 38 def initialize(parent) super('EXTENDED_FIELD_DEF', 4, 10) # Parent relation (may get more than one type of record here): @parent = get_parent(parent.to_record, Field) @parent.add_extended_field(self) @attributes = [ # Required: :keyword, :field_id, :original_plan_uid, # Optional: :original_beam_number, :original_beam_name, :is_fff, :accessory_code, :accessory_type, :high_dose_authorization ] end |
Instance Attribute Details
#accessory_code ⇒ Object
Returns the value of attribute accessory_code.
18 19 20 |
# File 'lib/rtp-connect/extended_field.rb', line 18 def accessory_code @accessory_code end |
#accessory_type ⇒ Object
Returns the value of attribute accessory_type.
19 20 21 |
# File 'lib/rtp-connect/extended_field.rb', line 19 def accessory_type @accessory_type end |
#field_id ⇒ Object
Returns the value of attribute field_id.
13 14 15 |
# File 'lib/rtp-connect/extended_field.rb', line 13 def field_id @field_id end |
#high_dose_authorization ⇒ Object
Returns the value of attribute high_dose_authorization.
20 21 22 |
# File 'lib/rtp-connect/extended_field.rb', line 20 def end |
#is_fff ⇒ Object
Returns the value of attribute is_fff.
17 18 19 |
# File 'lib/rtp-connect/extended_field.rb', line 17 def is_fff @is_fff end |
#original_beam_name ⇒ Object
Returns the value of attribute original_beam_name.
16 17 18 |
# File 'lib/rtp-connect/extended_field.rb', line 16 def original_beam_name @original_beam_name end |
#original_beam_number ⇒ Object
Returns the value of attribute original_beam_number.
15 16 17 |
# File 'lib/rtp-connect/extended_field.rb', line 15 def original_beam_number @original_beam_number end |
#original_plan_uid ⇒ Object
Returns the value of attribute original_plan_uid.
14 15 16 |
# File 'lib/rtp-connect/extended_field.rb', line 14 def original_plan_uid @original_plan_uid end |
#parent ⇒ Object (readonly)
The Record which this instance belongs to.
12 13 14 |
# File 'lib/rtp-connect/extended_field.rb', line 12 def parent @parent end |
Class Method Details
.load(string, parent) ⇒ ExtendedField
Creates a new (treatment) ExtendedField by parsing a RTPConnect string line.
29 30 31 32 |
# File 'lib/rtp-connect/extended_field.rb', line 29 def self.load(string, parent) ef = self.new(parent) ef.load(string) end |
Instance Method Details
#==(other) ⇒ Boolean Also known as: eql?
Checks for equality.
Other and self are considered equivalent if they are of compatible types and their attributes are equivalent.
66 67 68 69 70 |
# File 'lib/rtp-connect/extended_field.rb', line 66 def ==(other) if other.respond_to?(:to_extended_field) other.send(:state) == state end end |
#children ⇒ Array
Gives an empty array, as these instances are child-less by definition.
78 79 80 |
# File 'lib/rtp-connect/extended_field.rb', line 78 def children return Array.new end |
#hash ⇒ Fixnum
Two objects with the same attributes will have the same hash code.
Computes a hash code for this object.
88 89 90 |
# File 'lib/rtp-connect/extended_field.rb', line 88 def hash state.hash end |
#to_extended_field ⇒ ExtendedField
Returns self.
96 97 98 |
# File 'lib/rtp-connect/extended_field.rb', line 96 def to_extended_field self end |
#to_s ⇒ String Also known as: to_str
Encodes the ExtendedField object + any hiearchy of child objects, to a properly formatted RTPConnect ascii string.
105 106 107 108 109 110 111 112 113 |
# File 'lib/rtp-connect/extended_field.rb', line 105 def to_s str = encode if children children.each do |child| str += child.to_s end end return str end |