Class: PayeeParser

Inherits:
Object
  • Object
show all
Defined in:
lib/ynap/payee_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(regex = nil) ⇒ PayeeParser

Returns a new instance of PayeeParser.



4
5
6
# File 'lib/ynap/payee_parser.rb', line 4

def initialize(regex = nil)
  @regex = regex || Ynap.regexp
end

Instance Attribute Details

#regexObject (readonly)

Returns the value of attribute regex.



2
3
4
# File 'lib/ynap/payee_parser.rb', line 2

def regex
  @regex
end

Instance Method Details

#cleaned_name(label) ⇒ Object



8
9
10
11
# File 'lib/ynap/payee_parser.rb', line 8

def cleaned_name(label)
  matched = label.match(@regex)
  matched.nil? ? label : matched[:name].strip
end