Sha256: 6b8df60ea80e6cbff0ee7765e673156f10462b7375f3f5fe9af35ce27565068b

Contents?: true

Size: 961 Bytes

Versions: 1

Compression:

Stored size: 961 Bytes

Contents

# frozen_string_literal: true
module MasterDataTool
  class MasterDataFile
    attr_reader :spec_name, :table_name, :path, :override_identifier

    def initialize(spec_name:, table_name:, path:, override_identifier:)
      @spec_name = spec_name
      @table_name = table_name
      @path = path
      @override_identifier = override_identifier
      freeze
    end

    class << self
      def build(spec_name:, path:, override_identifier:)
        table_name = MasterDataTool.resolve_table_name(spec_name: spec_name, csv_path: path, override_identifier: override_identifier)
        new(spec_name: spec_name, table_name: table_name, path: path, override_identifier: override_identifier)
      end
    end

    def basename
      @path.basename
    end

    def ==(other)
      other.class === self &&
        other.hash == hash
    end

    alias eql? ==

    def hash
      [@spec_name, @table_name, @path, @override_identifier].join.hash
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
master_data_tool-0.23.0 lib/master_data_tool/master_data_file.rb