Sha256: d7c7c877a596c01f92c1ae2e7853afc239bb318fc28a3424d474679469edb826

Contents?: true

Size: 918 Bytes

Versions: 4

Compression:

Stored size: 918 Bytes

Contents

module BerkeleyLibrary
  module TIND
    module Mapping

      class MultipleRule
        include Util

        attr_reader :tag_origin
        attr_reader :tag_destination
        attr_reader :indicator
        attr_reader :pre_existed_tag
        attr_reader :subfield_key
        attr_reader :position_from_to

        def initialize(row)
          @tag_origin = row[:tag_origin]
          @tag_destination = row[:tag_destination]
          @indicator = Util.indicator(row[:new_indecator])
          @pre_existed_tag = row[:map_if_no_this_tag_existed]
          @subfield_key = row[:subfield_key]
          @position_from_to = extract_position(row[:value_from], row[:value_to])
        end

        private

        # return an array with string positons for extracting value
        def extract_position(f, t)
          return nil unless f && t

          [f.to_i, t.to_i]
        end
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
berkeley_library-tind-0.7.2 lib/berkeley_library/tind/mapping/multiple_rule.rb
berkeley_library-tind-0.7.1 lib/berkeley_library/tind/mapping/multiple_rule.rb
berkeley_library-tind-0.7.0 lib/berkeley_library/tind/mapping/multiple_rule.rb
berkeley_library-tind-0.6.0 lib/berkeley_library/tind/mapping/multiple_rule.rb