Module: Normatron::Filters::Helpers
- Included in:
- CamelizeFilter, CapitalizeFilter, DowncaseFilter, KeepFilter, RemoveFilter, StripFilter, SwapcaseFilter, TitleizeFilter, UnderscoreFilter, UpcaseFilter
- Defined in:
- lib/normatron/filters/helpers.rb
Instance Method Summary collapse
- #acronym_regex ⇒ Object
- #acronyms ⇒ Object
- #evaluate_regexp(value, action, *properties) ⇒ Object
- #inflections ⇒ Object
- #mb_send(method, value) ⇒ Object
Instance Method Details
#acronym_regex ⇒ Object
21 22 23 |
# File 'lib/normatron/filters/helpers.rb', line 21 def acronym_regex inflections.acronym_regex end |
#acronyms ⇒ Object
17 18 19 |
# File 'lib/normatron/filters/helpers.rb', line 17 def acronyms inflections.acronyms end |
#evaluate_regexp(value, action, *properties) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/normatron/filters/helpers.rb', line 10 def evaluate_regexp(value, action, *properties) = properties.flatten.compact.uniq constructs = .map{ |s| "\\p{#{s.to_s}}" } * "" regex = /[#{'^' if action == :keep}#{constructs}]/u value.gsub(regex, "") end |
#inflections ⇒ Object
25 26 27 |
# File 'lib/normatron/filters/helpers.rb', line 25 def inflections ActiveSupport::Inflector::Inflections.instance end |
#mb_send(method, value) ⇒ Object
29 30 31 |
# File 'lib/normatron/filters/helpers.rb', line 29 def mb_send(method, value) value.mb_chars.send(method).to_s end |