Class: Gemsmith::Aids::Gem
- Inherits:
-
Object
- Object
- Gemsmith::Aids::Gem
- Defined in:
- lib/gemsmith/aids/gem.rb
Overview
Parses a raw string into a valid gem and/or class name which can be used to construct gem skeletons and related Ruby objects.
Instance Method Summary collapse
-
#initialize(string = "unknown", util: Thor::Util) ⇒ Gem
constructor
A new instance of Gem.
- #klass ⇒ Object
- #name ⇒ Object
Constructor Details
#initialize(string = "unknown", util: Thor::Util) ⇒ Gem
Returns a new instance of Gem.
6 7 8 9 |
# File 'lib/gemsmith/aids/gem.rb', line 6 def initialize string = "unknown", util: Thor::Util @string = string @util = util end |
Instance Method Details
#klass ⇒ Object
15 16 17 |
# File 'lib/gemsmith/aids/gem.rb', line 15 def klass @klass ||= util.camel_case name end |
#name ⇒ Object
11 12 13 |
# File 'lib/gemsmith/aids/gem.rb', line 11 def name @name ||= util.snake_case(string).tr(" ", "_").tr "-", "_" end |