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



25
26
27
28
29
30
31
# File 'lib/html_namespacing/plugin/rails.rb', line 25

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
# File 'lib/html_namespacing/plugin/rails.rb', line 11

def self.install(options = {})
  @options = options
  install_rails_2_3(options)
end

.javascript_optional_suffixObject



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

def self.javascript_optional_suffix
  @options[:javascript_optional_suffix]
end

.javascript_rootObject



33
34
35
# File 'lib/html_namespacing/plugin/rails.rb', line 33

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

.path_to_namespace(relative_path) ⇒ Object

Called by ActionView



17
18
19
20
21
22
23
# File 'lib/html_namespacing/plugin/rails.rb', line 17

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

.skip_template?(path) ⇒ Boolean



53
54
55
56
57
58
59
60
61
62
# File 'lib/html_namespacing/plugin/rails.rb', line 53

def self.skip_template?(path)
  specifier = @options[:skip_templates]
  if specifier.respond_to?(:call)
    specifier.call(path)
  elsif specifier.respond_to?(:include?)
    specifier.include?(path)
  else
    specifier === path
  end
end

.stylesheet_optional_suffixObject



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

def self.stylesheet_optional_suffix
  @options[:stylesheet_optional_suffix]
end

.stylesheet_rootObject



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

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

.template_formatsObject



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

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