Class: WebAppTheme::Generators::Base

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/web_app_theme.rb

Class Method Summary collapse

Class Method Details

.haml?Boolean

Returns true, if Haml is in use.

Returns:

  • (Boolean)


14
15
16
17
18
19
20
# File 'lib/generators/web_app_theme.rb', line 14

def self.haml?
  if RUBY_VERSION < '1.9'
    Module.constants.include?('Haml')
  else
    Module.constants.include?(:Haml)
  end
end

.source_rootObject

Automatically sets the source root based on the class name.



7
8
9
10
11
# File 'lib/generators/web_app_theme.rb', line 7

def self.source_root
  @_web_app_theme_source_root ||= begin
    File.expand_path(File.join(File.dirname(__FILE__), 'web_app_theme', generator_name, 'templates')) if generator_name
  end
end