Sha256: 228b569476fdb4ea46b8c64cc6ba8876cf8edd32f6aab1ab0a56229118d8ec5c

Contents?: true

Size: 554 Bytes

Versions: 6

Compression:

Stored size: 554 Bytes

Contents

# frozen_string_literal: true

module Gemsmith
  module Aids
    # Parses a raw string into a valid gem and/or class name which can be used to construct gem skeletons
    # and related Ruby objects.
    class Gem
      def initialize string = "unknown", util: Thor::Util
        @string = string
        @util = util
      end

      def name
        @name ||= util.snake_case(string).tr(" ", "_").tr "-", "_"
      end

      def klass
        @klass ||= util.camel_case name
      end

      private

      attr_reader :string, :util
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gemsmith-7.5.0 lib/gemsmith/aids/gem.rb
gemsmith-7.4.0 lib/gemsmith/aids/gem.rb
gemsmith-7.3.0 lib/gemsmith/aids/gem.rb
gemsmith-7.2.0 lib/gemsmith/aids/gem.rb
gemsmith-7.1.0 lib/gemsmith/aids/gem.rb
gemsmith-7.0.0 lib/gemsmith/aids/gem.rb