module Cog::Generator::Filters

Filters are methods which translate text into more text

Public Instance Methods

call_filter(name, text) click to toggle source

Call a filter by name @param name [Symbol] the filter to call @param text [String] the text to pass through the filter @return [String] the filtered text

# 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) click to toggle source

@param text [String] some text which should be rendered as a comment @return [String] a comment appropriate for the current language context

# File lib/cog/generator/filters.rb, line 9
def comment(text)
  Cog.active_language.comment text
end