Class: NfseGyn::Sanitizer

Inherits:
Object show all
Defined in:
lib/nfse_gyn/sanitizer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Sanitizer

Returns a new instance of Sanitizer.



5
6
7
# File 'lib/nfse_gyn/sanitizer.rb', line 5

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



3
4
5
# File 'lib/nfse_gyn/sanitizer.rb', line 3

def value
  @value
end

Instance Method Details

#clearObject



9
10
11
12
13
14
15
# File 'lib/nfse_gyn/sanitizer.rb', line 9

def clear
  return nil if value.nil?
  temp = I18n.transliterate(value)
  temp.tr!('-', ' ')
  temp.gsub!(/,|\./, '')
  temp.scan(/\w+|\s+/i).join
end