Module: Normatron::Filters::TitleizeFilter

Extended by:
Helpers
Defined in:
lib/normatron/filters/titleize_filter.rb

Class Method Summary collapse

Methods included from Helpers

acronym_regex, acronyms, evaluate_regexp, evaluate_strip, inflections, mb_send

Class Method Details

.evaluate(input) ⇒ String

Capitalizes the first character of each word.

Examples:

TitleizeFilter.evaluate("at your will!") #=> "At Your Will!"

Using as ActiveRecord::Base normalizer

normalize :attribute_a, :with => :titleize
normalize :attribute_b, :with => [:custom_filter, :titleize]

Parameters:

  • input (String)

    A character sequence

Returns:

  • (String)

    The titleized character sequence or the object itself

See Also:



24
25
26
# File 'lib/normatron/filters/titleize_filter.rb', line 24

def self.evaluate(input)
  input.kind_of?(String) ? mb_send(:titleize, input) : input
end