Class: SinatraHelpers::Generator::App

Inherits:
Object
  • Object
show all
Defined in:
lib/sinatra_helpers/generator/app.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ App

Returns a new instance of App.



13
14
15
16
17
# File 'lib/sinatra_helpers/generator/app.rb', line 13

def initialize(path)
  @root_path = File.dirname(path)
  self.name = File.basename(path)
  @class_name = @name.classify
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



11
12
13
# File 'lib/sinatra_helpers/generator/app.rb', line 11

def name
  @name
end

#root_pathObject (readonly)

Returns the value of attribute root_path.



11
12
13
# File 'lib/sinatra_helpers/generator/app.rb', line 11

def root_path
  @root_path
end

Instance Method Details

#generateObject



23
24
25
# File 'lib/sinatra_helpers/generator/app.rb', line 23

def generate
  build_template(File.join(self.root_path, self.name), SinatraHelpers::Generator::TEMPLATE)
end