Class: Gem::Commands::CreateCommand::Builder
- Inherits:
-
Object
- Object
- Gem::Commands::CreateCommand::Builder
- Defined in:
- lib/rubygems/commands/create_command.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#gem_class ⇒ Object
The class name of the gem in CamelCase.
- #get_binding ⇒ Object
-
#initialize(name, params = {}) ⇒ Builder
constructor
A new instance of Builder.
-
#path ⇒ Object
The path of the gem.
Constructor Details
#initialize(name, params = {}) ⇒ Builder
Returns a new instance of Builder.
12 13 14 15 16 17 18 19 20 |
# File 'lib/rubygems/commands/create_command.rb', line 12 def initialize(name, params = {}) @name = name.to_s params.each do |(key, value)| self.class.send(:define_method, key) do value.respond_to?(:gsub) ? value.gsub(IDENTIFIER, @name) : value end end end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/rubygems/commands/create_command.rb', line 10 def name @name end |
Instance Method Details
#gem_class ⇒ Object
The class name of the gem in CamelCase.
28 29 30 |
# File 'lib/rubygems/commands/create_command.rb', line 28 def gem_class name.split('-').map { |seg| seg.gsub(/(?:^|_| )(.)/) { $1.upcase } }.join('::') end |
#get_binding ⇒ Object
32 33 34 |
# File 'lib/rubygems/commands/create_command.rb', line 32 def get_binding binding end |
#path ⇒ Object
The path of the gem.
23 24 25 |
# File 'lib/rubygems/commands/create_command.rb', line 23 def path name.gsub('-', '/') end |