Class: ChupaText::Decomposer

Inherits:
Object
  • Object
show all
Defined in:
lib/chupa-text/decomposer.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Decomposer

Returns a new instance of Decomposer.



25
26
27
# File 'lib/chupa-text/decomposer.rb', line 25

def initialize(options)
  @options = options
end

Class Method Details

.registryObject



20
21
22
# File 'lib/chupa-text/decomposer.rb', line 20

def registry
  @@registry ||= DecomposerRegistry.new
end

Instance Method Details

#decompose(data) ⇒ Object

Raises:

  • (NotImplementedError)


41
42
43
# File 'lib/chupa-text/decomposer.rb', line 41

def decompose(data)
  raise NotImplementedError, "must implement #{self.class}\##{__method__}"
end

#target?(data) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


29
30
31
# File 'lib/chupa-text/decomposer.rb', line 29

def target?(data)
  raise NotImplementedError, "must implement #{self.class}\##{__method__}"
end

#target_score(data) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/chupa-text/decomposer.rb', line 33

def target_score(data)
  if target?(data)
    0
  else
    nil
  end
end