class Flexus::RulesCollection

Wraps inflections array

Public Class Methods

new(*args) click to toggle source
# File lib/flexus/rules_collection.rb, line 11
def initialize(*args)
  @collection = Array.new(*args)
end

Public Instance Methods

==(other) click to toggle source
# File lib/flexus/rules_collection.rb, line 30
def ==(other)
  @collection == other.to_a
end
apply_to(word) click to toggle source

Applies first found rule to given word

@param [String] word

@return [String]

modified word

@api private

# File lib/flexus/rules_collection.rb, line 24
def apply_to(word)
  result = word.dup
  each { |rule, replacement| break if result.gsub!(rule, replacement) }
  result
end
to_a() click to toggle source
# File lib/flexus/rules_collection.rb, line 34
def to_a
  @collection.dup
end