Class: GGem::Gem

Inherits:
Object
  • Object
show all
Defined in:
lib/ggem/gem.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, name) ⇒ Gem

Returns a new instance of Gem.



10
11
12
# File 'lib/ggem/gem.rb', line 10

def initialize(path, name)
  @root_path, self.name = path, name
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



8
9
10
# File 'lib/ggem/gem.rb', line 8

def name
  @name
end

#root_pathObject (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_nameObject



22
23
24
25
# File 'lib/ggem/gem.rb', line 22

def module_name
  transforms = {'_' => '', '-' => ''}
  @module_name ||= transform_name(transforms){ |part| part.capitalize }
end

#pathObject



19
# File 'lib/ggem/gem.rb', line 19

def path; File.join(@root_path, @name); end

#ruby_nameObject



27
28
29
# File 'lib/ggem/gem.rb', line 27

def ruby_name
  @ruby_name ||= transform_name{ |part| part.downcase }
end

#save!Object



14
15
16
17
# File 'lib/ggem/gem.rb', line 14

def save!
  Template.new(self).tap{ |t| t.save; t.init }
  self
end