Sha256: 592483e4a0aa2e8e1cb26275ba847b83274d31a56adea754523baba19268a507

Contents?: true

Size: 729 Bytes

Versions: 1

Compression:

Stored size: 729 Bytes

Contents

module Texico
  class Template
    # FileStatus
    #
    # The FileStatus object represents the result of a copy command on a
    # template file. This class should never be used directly.
    class FileStatus
      STATUS = %i[successful target_exist replaced_target].freeze

      attr_reader :file

      def initialize(file, status = STATUS[0])
        unless STATUS.include?(status) || status.is_a?(Exception)
          raise ArgumentError, 'Unknown status'
        end

        @status    = status
        @file      = file

        freeze
      end

      def to_s
        "#{file.basename} [#{status}]"
      end

      def status
        @status.is_a?(Exception) ? :template_error : @status
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
texico-0.2.0 lib/texico/template/file_status.rb