Class: Bijou::Filter
- Inherits:
-
Object
- Object
- Bijou::Filter
- Defined in:
- lib/bijou/filters.rb
Overview
A filter may be used to modify text from an output tag prior to rendering. For example, the output tag:
<%= user.first_name | h %>
Will pipe the text returned from the first_name method through the h
filter. The h
filter represents Bijou::EncodeHTML and serves to escape the text for HTML presentation.
Note that filters may be chained by listing them one after the other following the pipe separator. For example, the following output tag and filter sequence:
<%= user.first_name | th %>
first invokes the t
filter, which trims text using EncodeTrim, and then pipes the result of that to the h
filter, for final HTML presentation.
Direct Known Subclasses
EncodeAttributeValue, EncodeHTML, EncodeTrim, EncodeURL, EncodeWiki
Class Method Summary collapse
-
.apply(input) ⇒ Object
The base filter is a no-op, returning the original string, unaltered.
Instance Method Summary collapse
-
#render(input) ⇒ Object
Used during code generation to produce the code that will be used to call the apply method.
Class Method Details
.apply(input) ⇒ Object
The base filter is a no-op, returning the original string, unaltered.
37 38 39 |
# File 'lib/bijou/filters.rb', line 37 def self.apply(input) input # no-op end |
Instance Method Details
#render(input) ⇒ Object
Used during code generation to produce the code that will be used to call the apply method.
32 33 34 |
# File 'lib/bijou/filters.rb', line 32 def render(input) "Bijou::Filter.apply(#{input})" end |