Sha256: 4a847956c50be9562ae46811b01310a728ee10ea09bd17f658b0c91f422ea152
Contents?: true
Size: 1.37 KB
Versions: 3
Compression:
Stored size: 1.37 KB
Contents
module Exlibris module Aleph module Table module Reader class Base attr_reader :admin_library, :filename def initialize(admin_library, filename) @admin_library = admin_library @filename = filename end def all raise RuntimeError.new('Should be implmented in sub classes') end protected 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 def file @file ||= File.new(absolute_path) end def absolute_path @absolute_path ||= "#{table_path}/#{relative_path}/#{filename}" end def relative_path @relative_path ||= "#{admin_library.normalized_code}/tab" end def table_path @table_path ||= Config.table_path end def matcher_constant eval("Matcher::#{demodulized_class_name}") end def row_contant eval("Row::#{demodulized_class_name}") end def demodulized_class_name @demodulized_class_name ||= self.class.name.split('::').last end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
exlibris-aleph-2.0.4 | lib/exlibris/aleph/table/reader/base.rb |
exlibris-aleph-2.0.3 | lib/exlibris/aleph/table/reader/base.rb |
exlibris-aleph-2.0.0 | lib/exlibris/aleph/table/reader/base.rb |