Sha256: 6fe5fc9d92fd76b11e3ff990f060ec40385227b3f5c7346ba80eb7e5095c9985

Contents?: true

Size: 1.29 KB

Versions: 5

Compression:

Stored size: 1.29 KB

Contents

# -*- coding: utf-8 -*-
#
# Copyright (C) 2012  Koji SHIMADA <koji.shimada@enishi-tech.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

module Logaling
  module GlossarySources
    class Base
      attr_reader :source_path, :glossary

      def initialize(relative_source_path, glossary)
        @source_path = relative_source_path
        @glossary = glossary
      end

      def eql?(other)
        return false unless self.class == other.class
        source_path == other.source_path
      end

      def hash
        @source_path.hash
      end

      def mtime
        File.mtime(absolute_path)
      end

      def absolute_path
        @glossary.project.repository.expand_path(@source_path)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
logaling-command-0.2.5 lib/logaling/glossary_sources/base.rb
logaling-command-0.2.4 lib/logaling/glossary_sources/base.rb
logaling-command-0.2.3 lib/logaling/glossary_sources/base.rb
logaling-command-0.2.2 lib/logaling/glossary_sources/base.rb
logaling-command-0.2.1 lib/logaling/glossary_sources/base.rb