Class: Metro::Generators::LayoutGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/metro/layout/layout_generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#app_nameObject (readonly)

Returns the value of attribute app_name.



10
11
12
# File 'lib/generators/metro/layout/layout_generator.rb', line 10

def app_name
  @app_name
end

Instance Method Details

#generate_layoutObject



12
13
14
15
16
# File 'lib/generators/metro/layout/layout_generator.rb', line 12

def generate_layout
  app = ::Rails.application
  @app_name = app.class.to_s.split("::").first
  template "layout.html.erb", "app/views/layouts/#{layout_name}.html.erb"
end