class Exlibris::Aleph::Table::Reader::Base

Attributes

admin_library[R]
filename[R]

Public Class Methods

new(admin_library, filename) click to toggle source
# File lib/exlibris/aleph/table/reader/base.rb, line 8
def initialize(admin_library, filename)
  @admin_library = admin_library
  @filename = filename
end

Public Instance Methods

all() click to toggle source
# File lib/exlibris/aleph/table/reader/base.rb, line 13
def all
  raise RuntimeError.new('Should be implmented in sub classes')
end

Protected Instance Methods

rows() click to toggle source
# File lib/exlibris/aleph/table/reader/base.rb, line 18
def rows
  @rows ||= file.map do |line|
    matcher = matcher_constant.new(line)
    row_contant.new(matcher.matched_data) if matcher.matches?
  end.compact
end

Private Instance Methods

absolute_path() click to toggle source
# File lib/exlibris/aleph/table/reader/base.rb, line 30
def absolute_path
  @absolute_path ||= "#{table_path}/#{relative_path}/#{filename}"
end
demodulized_class_name() click to toggle source
# File lib/exlibris/aleph/table/reader/base.rb, line 50
def demodulized_class_name
  @demodulized_class_name ||= self.class.name.split('::').last
end
file() click to toggle source
# File lib/exlibris/aleph/table/reader/base.rb, line 26
def file
  @file ||= File.new(absolute_path)
end
matcher_constant() click to toggle source
# File lib/exlibris/aleph/table/reader/base.rb, line 42
def matcher_constant
  eval("Matcher::#{demodulized_class_name}")
end
relative_path() click to toggle source
# File lib/exlibris/aleph/table/reader/base.rb, line 34
def relative_path
  @relative_path ||= "#{admin_library.normalized_code}/tab"
end
row_contant() click to toggle source
# File lib/exlibris/aleph/table/reader/base.rb, line 46
def row_contant
  eval("Row::#{demodulized_class_name}")
end
table_path() click to toggle source
# File lib/exlibris/aleph/table/reader/base.rb, line 38
def table_path
  @table_path ||= Config.table_path
end