module IdentityParade
This gem allows to compare two types.
Constants
- VERSION
Public Class Methods
config()
click to toggle source
:reek: Attribute because we want to share the config
# File lib/identity_parade.rb, line 21 def config @config ||= RecursiveOpenStruct.new end
configure() { |config| ... }
click to toggle source
Allows to configure the global configuration
# File lib/identity_parade.rb, line 26 def configure yield(config) end
Public Instance Methods
match(left, right)
click to toggle source
Get the matching score of two basic data types
@param left [Number, String, Array, TrueClass, FalseClass] left @param right [Number, String, Array, TrueClass, FalseClass] right
@return [Float] the matching score
# File lib/identity_parade.rb, line 39 def match(left, right) IdentityParade::Match.new(left, right).score end
match?(left, right)
click to toggle source
Checks if a matching score is higher than the globally configure match_score.
@param left [Number, String, Array, TrueClass, FalseClass] left @param right [Number, String, Array, TrueClass, FalseClass] right
@return [TrueClass, FalseClass] the result
# File lib/identity_parade.rb, line 50 def match?(left, right) match(left, right) >= IdentityParade.config.match_score end