Module: Hamlbars::Ext::RailsHelper

Included in:
Template
Defined in:
lib/hamlbars/ext/rails_helper.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Object) included(base)



5
6
7
# File 'lib/hamlbars/ext/rails_helper.rb', line 5

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

- (Object) evaluate(scope, locals, &block)



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/hamlbars/ext/rails_helper.rb', line 9

def evaluate(scope,locals,&block)
  scope = scope.dup

  scope.class.send(:include, ActionView::Helpers) if defined?(::ActionView)
  if defined?(::Rails)
    scope.class.send(:include, Rails.application.helpers)
    scope.class.send(:include, Rails.application.routes.url_helpers)
    scope.default_url_options = Rails.application.config.action_controller.default_url_options || {}
  end
  super(scope, locals, &block)
end