class OLE_QA::Framework::OLELS::Editor_Note

Any of Various Notes which Appear on the OLE Library System Instance Editor

Attributes

line_number[RW]

The line number of an instance of this object.

note_type[RW]

The type of Instance Note represented by an instance of this object.

subline_number[RW]

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’.

yaml_file[RW]

The YAML element definitions file loaded by an instance of this class.

Public Class Methods

new(browser, note_type, line_number, subline_number = 0) click to toggle source

@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.
Calls superclass method OLE_QA::Framework::Common_Object::new
# 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

Public Instance Methods

parse_elements(element_hash) click to toggle source

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

# 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