Sha256: bfe80c5f87701a8ee8efb3f3fc2ba0ad393754fa7a6c309029cd8b0dc169230e

Contents?: true

Size: 862 Bytes

Versions: 4

Compression:

Stored size: 862 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, path, override_identifier)
        new(spec_name, table_name, path, 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

4 entries across 4 versions & 1 rubygems

Version Path
master_data_tool-0.22.0 lib/master_data_tool/master_data_file.rb
master_data_tool-0.21.1 lib/master_data_tool/master_data_file.rb
master_data_tool-0.21.0 lib/master_data_tool/master_data_file.rb
master_data_tool-0.20.0 lib/master_data_tool/master_data_file.rb