Class: Diminutivity::Matcher
- Inherits:
-
Object
- Object
- Diminutivity::Matcher
- Defined in:
- lib/diminutivity.rb
Instance Attribute Summary collapse
-
#namefile ⇒ Object
Returns the value of attribute namefile.
-
#names ⇒ Object
Returns the value of attribute names.
Instance Method Summary collapse
-
#initialize(namefile = NAMEFILE) ⇒ Matcher
constructor
A new instance of Matcher.
- #match(name, source_name) ⇒ Object
Constructor Details
#initialize(namefile = NAMEFILE) ⇒ Matcher
Returns a new instance of Matcher.
10 11 12 13 14 15 16 17 18 |
# File 'lib/diminutivity.rb', line 10 def initialize(namefile=NAMEFILE) self.names = {} self.namefile = namefile CSV.read(Pathname.new(__FILE__).parent.join("../#{namefile}")).each do |row| row.each do |name| names[name] = row - [name] end end end |
Instance Attribute Details
#namefile ⇒ Object
Returns the value of attribute namefile.
8 9 10 |
# File 'lib/diminutivity.rb', line 8 def namefile @namefile end |
#names ⇒ Object
Returns the value of attribute names.
8 9 10 |
# File 'lib/diminutivity.rb', line 8 def names @names end |
Instance Method Details
#match(name, source_name) ⇒ Object
20 21 22 |
# File 'lib/diminutivity.rb', line 20 def match(name,source_name) names[name].include? source_name end |