Sha256: 3861fa4a5855bfea1695afb79988faa95656be5ac571ea6f5bffb40dd9dbc62f

Contents?: true

Size: 798 Bytes

Versions: 3

Compression:

Stored size: 798 Bytes

Contents

require "platina_world/loggers/base"

module PlatinaWorld
  module Loggers
    class FileStatus < Base
      def create(path)
        info(action: :create, path: path)
      end

      def skip(path)
        info(action: :skip, path: path)
      end

      private

      def formatter_class
        PlatinaWorld::Loggers::FileFormatter
      end
    end

    class FileFormatter
      def call(severity, time, program_name, message)
        file_format(message[:action]) % message
      end

      def file_format(action)
        case action
        when :create
          "      \e[32m%{action}\e[0m  %{path}\n"
        when :skip
          "      \e[34m%{action}  \e[0m  %{path}\n"
        when :failed
          "      \e[31m%{action}  \e[0m  %{path}\n"
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
platina_world-0.1.5 lib/platina_world/loggers/file_status.rb
platina_world-0.1.4 lib/platina_world/loggers/file_status.rb
platina_world-0.1.3 lib/platina_world/loggers/file_status.rb