Class: Dry::Inflector::Rules Private
- Inherits:
-
Object
- Object
- Dry::Inflector::Rules
- Defined in:
- lib/dry/inflector/rules.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A set of inflection rules
Instance Method Summary collapse
- #apply_to(word) ⇒ Object private
- #each(&blk) ⇒ Object private
-
#initialize ⇒ Rules
constructor
private
A new instance of Rules.
- #insert(index, array) ⇒ Object private
Constructor Details
#initialize ⇒ Rules
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Rules.
12 13 14 |
# File 'lib/dry/inflector/rules.rb', line 12 def initialize @rules = [] end |
Instance Method Details
#apply_to(word) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
18 19 20 21 22 |
# File 'lib/dry/inflector/rules.rb', line 18 def apply_to(word) result = word.dup each { |rule, replacement| break if result.gsub!(rule, replacement) } result end |
#each(&blk) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
32 33 34 |
# File 'lib/dry/inflector/rules.rb', line 32 def each(&blk) @rules.each(&blk) end |
#insert(index, array) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 |
# File 'lib/dry/inflector/rules.rb', line 26 def insert(index, array) @rules.insert(index, array) end |