Sha256: 1b3290d9337bee9ef74778153e449ce7190e6f096b05b0395adfa1f08147834b

Contents?: true

Size: 523 Bytes

Versions: 3

Compression:

Stored size: 523 Bytes

Contents

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

3 entries across 3 versions & 1 rubygems

Version Path
gemsmith-6.2.0 lib/gemsmith/aids/gem.rb
gemsmith-6.1.0 lib/gemsmith/aids/gem.rb
gemsmith-6.0.0 lib/gemsmith/aids/gem.rb