Module: Hamlbars::Ext::RailsHelper::ClassMethods

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

Instance Method Summary collapse

Instance Method Details

#disable_rails_helpers!Object



31
32
33
# File 'lib/hamlbars/ext/rails_helper.rb', line 31

def disable_rails_helpers!
  @enable_rails_helpers = false
end

#enable_rails_helpers!Object



22
23
24
25
# File 'lib/hamlbars/ext/rails_helper.rb', line 22

def enable_rails_helpers!
  (Rails.env == 'development' ? Logger.new(STDOUT) : Rails.logger).warn "WARNING (hamlbars): Enabling helpers in assets can have unintended consequences and violates separation of concerns. You have been warned."
  @enable_rails_helpers = true
end

#rails_helpers_enabled?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/hamlbars/ext/rails_helper.rb', line 27

def rails_helpers_enabled?
  !!@enable_rails_helpers
end