Module: Cog::Generator::Filters
- Included in:
- Cog::Generator
- Defined in:
- lib/cog/generator/filters.rb
Overview
Filters are methods which translate text into more text
Instance Method Summary collapse
-
#call_filter(name, text) ⇒ String
Call a filter by name.
-
#comment(text) ⇒ String
A comment appropriate for the current language context.
Instance Method Details
#call_filter(name, text) ⇒ String
Call a filter by name
17 18 19 20 21 22 |
# File 'lib/cog/generator/filters.rb', line 17 def call_filter(name, text) gcontext[:filters] ||= %w(comment) name = name.to_s raise Errors::NoSuchFilter.new(name) unless gcontext[:filters].member? name method(name).call text end |
#comment(text) ⇒ String
Returns a comment appropriate for the current language context.
9 10 11 |
# File 'lib/cog/generator/filters.rb', line 9 def comment(text) Cog.active_language.comment text end |