Module: IdentityParade

Defined in:
lib/identity_parade.rb,
lib/identity_parade/match.rb,
lib/identity_parade/matcher.rb,
lib/identity_parade/version.rb,
lib/identity_parade/matchers/hash_matcher.rb,
lib/identity_parade/matchers/array_matcher.rb,
lib/identity_parade/matchers/float_matcher.rb,
lib/identity_parade/matchers/string_matcher.rb,
lib/identity_parade/matchers/boolean_matcher.rb,
lib/identity_parade/matchers/integer_matcher.rb,
lib/identity_parade/matchers/numeric_matcher.rb,
lib/identity_parade/matchers/true_class_matcher.rb,
lib/identity_parade/matchers/false_class_matcher.rb

Overview

This gem allows to compare two types.

Defined Under Namespace

Modules: Matchers Classes: Match, Matcher

Constant Summary collapse

VERSION =
'1.0.0'.freeze

Class Method Summary collapse

Class Method Details

.configObject

:reek:Attribute because we want to share the config



21
22
23
# File 'lib/identity_parade.rb', line 21

def config
  @config ||= RecursiveOpenStruct.new
end

.configure {|config| ... } ⇒ Object

Allows to configure the global configuration

Yields:



26
27
28
# File 'lib/identity_parade.rb', line 26

def configure
  yield(config)
end

.match(left, right) ⇒ Float

Get the matching score of two basic data types

Parameters:

  • left

  • right

Returns:

  • the matching score



39
40
41
# File 'lib/identity_parade.rb', line 39

def match(left, right)
  IdentityParade::Match.new(left, right).score
end

.match?(left, right) ⇒ TrueClass, FalseClass

Checks if a matching score is higher than the globally configure match_score.

Parameters:

  • left

  • right

Returns:

  • the result



50
51
52
# File 'lib/identity_parade.rb', line 50

def match?(left, right)
  match(left, right) >= IdentityParade.config.match_score
end