Class: GGem::Gem
- Inherits:
-
Object
- Object
- GGem::Gem
- Defined in:
- lib/ggem/gem.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#root_path ⇒ Object
readonly
Returns the value of attribute root_path.
Instance Method Summary collapse
-
#initialize(path, name) ⇒ Gem
constructor
A new instance of Gem.
- #module_name ⇒ Object
- #path ⇒ Object
- #ruby_name ⇒ Object
- #save! ⇒ Object
Constructor Details
#initialize(path, name) ⇒ Gem
Returns a new instance of Gem.
10 11 12 13 |
# File 'lib/ggem/gem.rb', line 10 def initialize(path, name) raise NoNameError if name.to_s.empty? @root_path, self.name = path, name end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/ggem/gem.rb', line 8 def name @name end |
#root_path ⇒ Object (readonly)
Returns the value of attribute root_path.
8 9 10 |
# File 'lib/ggem/gem.rb', line 8 def root_path @root_path end |
Instance Method Details
#module_name ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/ggem/gem.rb', line 23 def module_name transforms = { '_' => '', '-' => '' } @module_name ||= transform_name(transforms){ |part| part.capitalize } end |
#path ⇒ Object
20 |
# File 'lib/ggem/gem.rb', line 20 def path; File.join(@root_path, @name); end |
#ruby_name ⇒ Object
31 32 33 |
# File 'lib/ggem/gem.rb', line 31 def ruby_name @ruby_name ||= transform_name{ |part| part.downcase } end |