Class: OLE_QA::Framework::Line_Object
- Inherits:
-
Data_Object
- Object
- Common_Object
- Data_Object
- OLE_QA::Framework::Line_Object
- Defined in:
- lib/common/line_object.rb
Overview
A Data Object in OLE that represents a single line in a given area. A line object can usually be added or deleted, and may or may not have its own line objects beneath it in the page-object hierarchy.
Direct Known Subclasses
OLEFS::Invoice_Current_Item, OLEFS::Invoice_Line, OLEFS::Line_Item, OLEFS::Receiving_Line, OLELS::Access_Info_Line, OLELS::Batch_Data_Mapping_Line, OLELS::Batch_Delete_Field_Line, OLELS::Batch_Rename_Field_Line, OLELS::Control_006_Line, OLELS::Control_007_Line, OLELS::Data_Line, OLELS::Export_Filter_Line, OLELS::Holdings_Note, OLELS::Import_Defaults_Line, OLELS::Import_Match_Line, OLELS::Import_PF_Line, OLELS::Item_Note, OLELS::Ownership_Extent_Line, OLELS::Patron_Address_Line, OLELS::Patron_Email_Line, OLELS::Patron_Phone_Line, OLELS::Workbench_Line, Subline_Object
Instance Attribute Summary collapse
-
#line_number ⇒ Object
The line number that this object will have on the screen.
-
#sublines ⇒ Object
readonly
An array containing the name (Symbol) of each subline element on the line object.
Attributes inherited from Common_Object
Instance Method Summary collapse
-
#initialize(ole_session, line_number = 1) ⇒ Line_Object
constructor
A new instance of Line_Object.
-
#line_id ⇒ Object
A reader method for the line_id function.
-
#set_subline(name, klas, force = false) ⇒ Object
(also: #subline)
Set a subline object definition on a page object.
Methods inherited from Common_Object
Methods included from Helpers
#browser, #load_yml, #set_element, #set_function
Constructor Details
#initialize(ole_session, line_number = 1) ⇒ Line_Object
Returns a new instance of Line_Object.
31 32 33 34 35 36 |
# File 'lib/common/line_object.rb', line 31 def initialize(ole_session, line_number = 1) @line_number = line_number super(ole_session) @sublines = Array.new set_sublines if defined?(self.set_sublines) end |
Instance Attribute Details
#line_number ⇒ Object
The line number that this object will have on the screen.
-
This is the 1-based line number used for replacement of human-readable identifiers.
24 25 26 |
# File 'lib/common/line_object.rb', line 24 def line_number @line_number end |
#sublines ⇒ Object (readonly)
An array containing the name (Symbol) of each subline element on the line object.
27 28 29 |
# File 'lib/common/line_object.rb', line 27 def sublines @sublines end |
Instance Method Details
#line_id ⇒ Object
A reader method for the line_id function.
-
This is the 0-based line number used for replacement of programmatic identifiers such as element IDs.
40 41 42 |
# File 'lib/common/line_object.rb', line 40 def line_id @line_number - 1 end |
#set_subline(name, klas, force = false) ⇒ Object Also known as: subline
Set a subline object definition on a page object.
-
A subline object created with this method becomes an accessor attribute associated with an instance variable on the page or data object on which it is created.
59 60 61 62 63 64 65 66 |
# File 'lib/common/line_object.rb', line 59 def set_subline(name, klas, force = false) raise StandardError, "Name must be a symbol. Given: #{name} (#{name.class})" unless name.instance_of?(Symbol) raise StandardError, "Klas must be a class. Given: #{klas} (#{klas.class})" unless klas.instance_of?(Class) raise StandardError, "Subline object is already defined. (Use the 'force = true' option to suppress this error.)" if @sublines.include?(name) && ! force instance_variable_set("@#{name}", klas.new(@ole, self, 1)) make_reader(name) unless force @sublines << name unless force end |