Class: Wordlist::Modifiers::Modifier

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/wordlist/modifiers/modifier.rb

Overview

Modifier base class.

Since:

  • 1.0.0

Direct Known Subclasses

Capitalize, Downcase, Sub, Tr, Upcase

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(wordlist) ⇒ Modifier

Initializes the modifier.

Parameters:

  • wordlist (Enumerable)

    The wordlist to modify.

Since:

  • 1.0.0



23
24
25
# File 'lib/wordlist/modifiers/modifier.rb', line 23

def initialize(wordlist)
  @wordlist = wordlist
end

Instance Attribute Details

#wordlistEnumerable (readonly)

The wordlist to modify.

Returns:

  • (Enumerable)

Since:

  • 1.0.0



15
16
17
# File 'lib/wordlist/modifiers/modifier.rb', line 15

def wordlist
  @wordlist
end

Instance Method Details

#each {|word| ... } ⇒ Enumerator

This method is abstract.

Enumerates over every modification of every word in the wordlist.

Yields:

  • (word)

Yield Parameters:

  • word (String)

Returns:

  • (Enumerator)

Raises:

  • (NotImplementedError)

Since:

  • 1.0.0



38
39
40
# File 'lib/wordlist/modifiers/modifier.rb', line 38

def each(&block)
  raise(NotImplementedError,"#{self.class}##{__method__} was not implemented")
end