Class: LittleWeasel::Filters::EnUs::CurrencyFilter

Inherits:
WordFilter
  • Object
show all
Defined in:
lib/LittleWeasel/filters/en_us/currency_filter.rb

Overview

This class represents a currency filter.

Instance Attribute Summary

Attributes inherited from WordFilter

#filter_on

Class Method Summary collapse

Methods inherited from WordFilter

#filter_match?, #filter_off!, #filter_off?, #filter_on!, #filter_on?, #initialize

Methods included from Modules::ClassNameToSymbol

included, #to_sym

Constructor Details

This class inherits a constructor from LittleWeasel::Filters::WordFilter

Class Method Details

.filter_match?(word) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/LittleWeasel/filters/en_us/currency_filter.rb', line 12

def filter_match?(word)
  /^[-+]?\$[[:digit:]]{1,3}(?:,?[[:digit:]]{3})*(?:\.[[:digit:]]{2})?$/.match? word.to_s
end