Sha256: 3320b51670ec0d5473fa094a84ce0e71cf2126bf94ac1c094a2b3a1a402c49a0

Contents?: true

Size: 626 Bytes

Versions: 4

Compression:

Stored size: 626 Bytes

Contents

Dir[File.join File.dirname(__FILE__), 'matchi', '*.rb'].each do |fname|
  require_relative fname
end

# Namespace for the Matchi library.
#
# @api public
#
# @example Match that 42 is equal to 42
#   matcher = Matchi.fetch(:Equal, 42)
#   matcher.matches? { 42 } # => true
module Matchi
  # Select a matcher from those available.
  #
  # @param matcher_id [Symbol] The name of the constant of the matcher to fetch.
  # @param args       [Array] Parameters to initialize the class of the matcher.
  #
  # @return [#matches?] the matcher
  def self.fetch(matcher_id, *args)
    const_get(matcher_id, false).new(*args)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
matchi-0.0.9 lib/matchi.rb
matchi-0.0.8 lib/matchi.rb
matchi-0.0.7 lib/matchi.rb
matchi-0.0.6 lib/matchi.rb