Module: HtmlNamespacing::Plugin::Rails

Defined in:
lib/html_namespacing/plugin/rails.rb

Defined Under Namespace

Modules: Helpers

Class Method Summary collapse

Class Method Details

.handle_exception(e, template, view) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/html_namespacing/plugin/rails.rb', line 29

def self.handle_exception(e, template, view)
  if func = @options[:handle_exception_callback]
    func.call(e, template, view)
  else
    raise(e)
  end
end

.install(options = {}) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/html_namespacing/plugin/rails.rb', line 11

def self.install(options = {})
  @options = options
  if ::Rails::VERSION::MAJOR == 3
    install_rails_3(options)
  else
    install_rails_2_3(options)
  end
end

.javascript_optional_suffixObject



45
46
47
# File 'lib/html_namespacing/plugin/rails.rb', line 45

def self.javascript_optional_suffix
  @options[:javascript_optional_suffix]
end

.javascript_rootObject



37
38
39
# File 'lib/html_namespacing/plugin/rails.rb', line 37

def self.javascript_root
  @options[:javascript_root] || RAILS_ROOT + '/app/javascripts/views'
end

.path_to_namespace(relative_path) ⇒ Object

Called by ActionView



21
22
23
24
25
26
27
# File 'lib/html_namespacing/plugin/rails.rb', line 21

def self.path_to_namespace(relative_path)
  if func = @options[:path_to_namespace_callback]
    func.call(relative_path)
  else
    HtmlNamespacing::Plugin.default_relative_path_to_namespace(relative_path)
  end
end

.stylesheet_optional_suffixObject



49
50
51
# File 'lib/html_namespacing/plugin/rails.rb', line 49

def self.stylesheet_optional_suffix
  @options[:stylesheet_optional_suffix]
end

.stylesheet_rootObject



41
42
43
# File 'lib/html_namespacing/plugin/rails.rb', line 41

def self.stylesheet_root
  @options[:stylesheet_root] || RAILS_ROOT + '/app/stylesheets/views'
end

.template_formatsObject



53
54
55
# File 'lib/html_namespacing/plugin/rails.rb', line 53

def self.template_formats
  @formats ||= Set.new((@options[:template_formats] || [:html]).collect(&:to_sym))
end