Module: Haml::RailsHelpers
- Extended by:
- RailsHelpers
- Includes:
- Helpers
- Included in:
- RailsHelpers
- Defined in:
- lib/haml/rails_helpers.rb
Instance Method Summary collapse
-
#capture_haml(*args, &block)
-
#find_and_preserve(input = nil, tags = DEFAULT_PRESERVE_TAGS, &block)
-
#precede(str, &block)
-
#preserve(input = nil, &block)
-
#succeed(str, &block)
-
#surround(front, back = front, &block)
Methods included from Helpers
Instance Method Details
#capture_haml(*args, &block)
41 42 43 |
# File 'lib/haml/rails_helpers.rb', line 41
def capture_haml(*args, &block)
capture(*args, &block)
end
|
#find_and_preserve(input = nil, tags = DEFAULT_PRESERVE_TAGS, &block)
13 14 15 16 17 |
# File 'lib/haml/rails_helpers.rb', line 13
def find_and_preserve(input = nil, tags = DEFAULT_PRESERVE_TAGS, &block)
return find_and_preserve(capture_haml(&block), input || tags) if block
Preserver.find_and_preserve(input, tags) { |content| preserve(content) }
end
|
#precede(str, &block)
31 32 33 34 |
# File 'lib/haml/rails_helpers.rb', line 31
def precede(str, &block)
str = escape_once(str) unless str.html_safe?
"#{str}#{capture_haml(&block).chomp}\n".html_safe
end
|
#preserve(input = nil, &block)
19 20 21 22 |
# File 'lib/haml/rails_helpers.rb', line 19
def preserve(input = nil, &block)
return preserve(capture_haml(&block)) if block
super.html_safe
end
|
#succeed(str, &block)
36 37 38 39 |
# File 'lib/haml/rails_helpers.rb', line 36
def succeed(str, &block)
str = escape_once(str) unless str.html_safe?
"#{capture_haml(&block).chomp}#{str}\n".html_safe
end
|
#surround(front, back = front, &block)
24 25 26 27 28 29 |
# File 'lib/haml/rails_helpers.rb', line 24
def surround(front, back = front, &block)
output = capture_haml(&block)
front = escape_once(front) unless front.html_safe?
back = escape_once(back) unless back.html_safe?
"#{front}#{output.chomp}#{back}\n".html_safe
end
|