class InciScore::Response
Attributes
components[R]
score[R]
unrecognized[R]
valid[R]
Public Class Methods
new(options = {})
click to toggle source
# File lib/inci_score/response.rb, line 7 def initialize(options = {}) @components = options.fetch(:components) { [] } @score = options.fetch(:score) { 0.0 } @unrecognized = options.fetch(:unrecognized) { [] } @valid = options.fetch(:valid) { false } end
Public Instance Methods
to_json()
click to toggle source
# File lib/inci_score/response.rb, line 14 def to_json { components: @components, unrecognized: @unrecognized, score: @score, valid: @valid }.to_json end
to_s()
click to toggle source
# File lib/inci_score/response.rb, line 18 def to_s %Q{ TOTAL SCORE: \t#{@score} VALID STATE: \t#{@valid} COMPONENTS: #{@components.map { |c| "\t#{c}" }.join("\n")} UNRECOGNIZED: #{@unrecognized.map { |c| "\t#{c}" }.join("\n")} } end