Sha256: 55baa86426aa9d8eaa6683a2313165e1b363c98fdc1a0863ae8f276af55be97f

Contents?: true

Size: 697 Bytes

Versions: 2

Compression:

Stored size: 697 Bytes

Contents

require "active_support/core_ext/string"
require "active_support/inflector"

module Teaspoon
  module Formatters
    class Description
      attr_reader :name, :description

      def initialize(name, details)
        @name = name
        @description = details[:description]
        @default = details[:default]
      end

      def default?
        @default
      end

      def cli_help
        "  #{name}#{' (default)' if default?} - #{description}"
      end

      def class_name
        "#{name.to_s.camelize}Formatter"
      end

      def require_path
        "teaspoon/formatters/#{name}_formatter"
      end

      def <=>(other)
        name <=> other.name
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
teaspoon-0.9.1 lib/teaspoon/formatters/description.rb
teaspoon-0.9.0 lib/teaspoon/formatters/description.rb