Class: InciScore::Computer
- Inherits:
-
Object
- Object
- InciScore::Computer
- Defined in:
- lib/inci_score/computer.rb
Constant Summary collapse
- TOLERANCE =
30.0- PERCENT =
100.0
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(src:, catalog: Catalog.fetch, tolerance: TOLERANCE, rules: Normalizer::DEFAULT_RULES) ⇒ Computer
constructor
A new instance of Computer.
Constructor Details
#initialize(src:, catalog: Catalog.fetch, tolerance: TOLERANCE, rules: Normalizer::DEFAULT_RULES) ⇒ Computer
Returns a new instance of Computer.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/inci_score/computer.rb', line 12 def initialize(src:, catalog: Catalog.fetch, tolerance: TOLERANCE, rules: Normalizer::DEFAULT_RULES) @src = src @catalog = catalog @tolerance = Float(tolerance) @rules = rules @unrecognized = [] end |
Instance Method Details
#call ⇒ Object
23 24 25 26 27 28 |
# File 'lib/inci_score/computer.rb', line 23 def call @response ||= Response.new(components: components.map(&:name), unrecognized: @unrecognized, score: score, valid: valid?) end |