Class: OLE_QA::Framework::OLELS::Editor_Note
- Inherits:
-
Data_Object
- Object
- Common_Object
- Data_Object
- OLE_QA::Framework::OLELS::Editor_Note
- Defined in:
- lib/olels/objects/editor_note.rb
Overview
Any of Various Notes which Appear on the OLE Library System Instance Editor
Instance Attribute Summary collapse
-
#line_number ⇒ Object
The line number of an instance of this object.
-
#note_type ⇒ Object
The type of Instance Note represented by an instance of this object.
-
#subline_number ⇒ Object
The subline number of an instance of this object.
-
#yaml_file ⇒ Object
The YAML element definitions file loaded by an instance of this class.
Attributes inherited from Common_Object
Instance Method Summary collapse
-
#initialize(browser, note_type, line_number, subline_number = 0) ⇒ Editor_Note
constructor
A new instance of Editor_Note.
-
#parse_elements(element_hash) ⇒ Object
Replace element identifiers in a series of element hashes.
Methods inherited from Common_Object
Methods included from Helpers
#browser, #load_yml, #set_element, #set_function
Constructor Details
#initialize(browser, note_type, line_number, subline_number = 0) ⇒ Editor_Note
Subline Number is only necessary when instantiating for a note type which represents a subline element. e.g., ownership_note = OLE_QA::Framework::OLELS::Editor_Note.new(browser, ‘ownership note’, 2, 1) Otherwise leave this set to 0.
Returns a new instance of Editor_Note.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/olels/objects/editor_note.rb', line 38 def initialize(browser, note_type, line_number, subline_number = 0) super(browser) @line_number = line_number line_identifier = line_number - 1 @subline_number = subline_number @subline_identifier = subline_number - 1 @note_type = note_type subdir = '/olels/objects/editor_note/' case @note_type when 'access info' yaml_file = 'access_info.yml' when 'holdings note' yaml_file = 'holdings_note.yml' when 'item note' yaml_file = 'item_note.yml' when 'ownership note' yaml_file = 'ownership_note.yml' end @yaml_file = yaml_file note_elements = load_yml(subdir, yaml_file) parse_elements(note_elements) set_elements(note_elements) end |
Instance Attribute Details
#line_number ⇒ Object
The line number of an instance of this object.
24 25 26 |
# File 'lib/olels/objects/editor_note.rb', line 24 def line_number @line_number end |
#note_type ⇒ Object
The type of Instance Note represented by an instance of this object.
21 22 23 |
# File 'lib/olels/objects/editor_note.rb', line 21 def note_type @note_type end |
#subline_number ⇒ Object
The subline number of an instance of this object.
-
Set to 0 by default.
-
0 indicates that an instance is not a subline element.
-
Used when note_type = ‘ownership note’.
30 31 32 |
# File 'lib/olels/objects/editor_note.rb', line 30 def subline_number @subline_number end |
#yaml_file ⇒ Object
The YAML element definitions file loaded by an instance of this class.
33 34 35 |
# File 'lib/olels/objects/editor_note.rb', line 33 def yaml_file @yaml_file end |
Instance Method Details
#parse_elements(element_hash) ⇒ Object
Replace element identifiers in a series of element hashes.
-
Replace LINEID with line_identifier
-
Replace LINENUM with @line_number
-
Replace SUBLINEID with @subline_identifier
-
Replace SUBLINENUM with @subline_number
71 72 73 74 75 76 |
# File 'lib/olels/objects/editor_note.rb', line 71 def parse_elements(element_hash) replace_identifiers(element_hash, /SUBLINEID/, @subline_identifier.to_s) replace_identifiers(element_hash, /SUBLINENUM/, @subline_number.to_s) replace_identifiers(element_hash, /LINEID/, line_identifier.to_s) replace_identifiers(element_hash, /LINENUM/, @line_number.to_s) end |