Class: Dry::Inflector::Rules Private

Inherits:
Object
  • Object
show all
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

Since:

  • 0.1.0

Instance Method Summary collapse

Constructor Details

#initializeRules

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.

Since:

  • 0.1.0



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.

Since:

  • 0.1.0



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.

Since:

  • 0.1.0



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.

Since:

  • 0.1.0



26
27
28
# File 'lib/dry/inflector/rules.rb', line 26

def insert(index, array)
  @rules.insert(index, array)
end