Module: Normatron::Filters::Helpers

Instance Method Summary collapse

Instance Method Details

#acronym_regexObject



21
22
23
# File 'lib/normatron/filters/helpers.rb', line 21

def acronym_regex
  inflections.acronym_regex
end

#acronymsObject



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)
  options = properties.flatten.compact.uniq
  constructs = options.map{ |s| "\\p{#{s.to_s}}" } * ""
  regex = /[#{'^' if action == :keep}#{constructs}]/u
  value.gsub(regex, "")
end

#inflectionsObject



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