Sha256: abbb9e3091dcef46ff348176873424b8f94cac2453c48a954e179b8e19e80526

Contents?: true

Size: 1.07 KB

Versions: 73

Compression:

Stored size: 1.07 KB

Contents

module Berkshelf
  class BaseFormatter
    class << self
      #
      # @macro formatter_method
      #   @method $1(*args)
      #     Create a formatter method for the declaration
      #
      def formatter_method(name)
        class_eval <<-EOH, __FILE__, __LINE__ + 1
          def #{name}(*args)
            raise AbstractFunction,
              "##{name} must be implemented on \#{self.class.name}!"
          end
        EOH
      end
    end

    # UI methods
    formatter_method :deprecation
    formatter_method :error
    formatter_method :msg
    formatter_method :warn

    # Object methods
    formatter_method :fetch
    formatter_method :info
    formatter_method :install
    formatter_method :list
    formatter_method :outdated
    formatter_method :package
    formatter_method :search
    formatter_method :show
    formatter_method :skipping
    formatter_method :uploaded
    formatter_method :use
    formatter_method :vendor
    formatter_method :version

    # The cleanup hook is defined by subclasses and is called by the CLI.
    def cleanup_hook; end
  end
end

Version data entries

73 entries across 73 versions & 1 rubygems

Version Path
berkshelf-8.0.15 lib/berkshelf/formatters/base.rb
berkshelf-8.0.13 lib/berkshelf/formatters/base.rb
berkshelf-8.0.12 lib/berkshelf/formatters/base.rb
berkshelf-8.0.9 lib/berkshelf/formatters/base.rb
berkshelf-8.0.7 lib/berkshelf/formatters/base.rb
berkshelf-8.0.5 lib/berkshelf/formatters/base.rb
berkshelf-8.0.2 lib/berkshelf/formatters/base.rb
berkshelf-8.0.1 lib/berkshelf/formatters/base.rb
berkshelf-8.0.0 lib/berkshelf/formatters/base.rb
berkshelf-7.2.2 lib/berkshelf/formatters/base.rb
berkshelf-7.2.1 lib/berkshelf/formatters/base.rb
berkshelf-7.2.0 lib/berkshelf/formatters/base.rb
berkshelf-7.1.0 lib/berkshelf/formatters/base.rb
berkshelf-7.0.10 lib/berkshelf/formatters/base.rb
berkshelf-7.0.9 lib/berkshelf/formatters/base.rb
berkshelf-7.0.8 lib/berkshelf/formatters/base.rb
berkshelf-7.0.7 lib/berkshelf/formatters/base.rb
berkshelf-6.3.4 lib/berkshelf/formatters/base.rb
berkshelf-7.0.6 lib/berkshelf/formatters/base.rb
berkshelf-7.0.5 lib/berkshelf/formatters/base.rb