Module: Normatron::Filters
- Defined in:
- lib/normatron/filters.rb,
lib/normatron/filters/helpers.rb,
lib/normatron/filters/dump_filter.rb,
lib/normatron/filters/keep_filter.rb,
lib/normatron/filters/ascii_filter.rb,
lib/normatron/filters/blank_filter.rb,
lib/normatron/filters/chomp_filter.rb,
lib/normatron/filters/strip_filter.rb,
lib/normatron/filters/remove_filter.rb,
lib/normatron/filters/squish_filter.rb,
lib/normatron/filters/upcase_filter.rb,
lib/normatron/filters/squeeze_filter.rb,
lib/normatron/filters/camelize_filter.rb,
lib/normatron/filters/downcase_filter.rb,
lib/normatron/filters/swapcase_filter.rb,
lib/normatron/filters/titleize_filter.rb,
lib/normatron/filters/dasherize_filter.rb,
lib/normatron/filters/capitalize_filter.rb,
lib/normatron/filters/underscore_filter.rb
Overview
Top-Level namespace of all built-in Normatron filters.
All filters share some characteristics:
- They have the Filter suffix in the name.
- Has a class method called
evaluate
, which runs what the filter claims to do. - The first argument of the
evaluate
method always will be the variable to be filtered. - When filtraton is done succesfully, the
object_id
of filtered value and input value are different. - They treat unicode characters(
/[\p{Ll}\p{Lu}]/u
) instead of only ASCII characters(/[a-zA-Z]/
).
Class | Symbol | Short Description |
---|---|---|
AsciiFilter |
:ascii |
Converts Unicode(and accented ASCII) characters to their plain-text ASCII equivalents. |
BlankFilter |
:blank |
Returns nil for a blank string or the string itself otherwise. |
CamelizeFilter |
:camelize |
Convert string to UpperCamelCase or lowerCamelCase. |
CapitalizeFilter |
:capitalize |
Makes only the first character as capital letter. |
ChompFilter |
:chomp |
Remove the given record separator from the end of the string. |
DasherizeFilter |
:dasherize |
Replaces all underscores with dashes. |
DowncaseFilter |
:downcase |
Lowercase all characters. |
DumpFilter |
:dump |
Creates a literal string representation. |
KeepFilter |
:keep |
Remove the characters that doesn’t match the given properties. |
RemoveFilter |
:remove |
Remove the characters that match the given properties. |
SqueezeFilter |
:squeeze |
Remove multiple occurences of the same character. |
SquishFilter |
:squish |
Strips the input, remove line-breaks and multiple spaces. |
SwapcaseFilter |
:swapcase |
Replaces uppercased characters by lowercased and vice versa. |
TitleizeFilter |
:titleize |
Capitalizes the first character of each word. |
UnderscoreFilter |
:underscore |
Makes an underscored lowercase form from the expression in the string. |
UpcaseFilter |
:upcase |
Uppercase all characters. |
Defined Under Namespace
Modules: AsciiFilter, BlankFilter, CamelizeFilter, CapitalizeFilter, ChompFilter, DasherizeFilter, DowncaseFilter, DumpFilter, Helpers, KeepFilter, RemoveFilter, SqueezeFilter, SquishFilter, StripFilter, SwapcaseFilter, TitleizeFilter, UnderscoreFilter, UpcaseFilter