Sha256: d703b51ebed3a1f2356e8b1469419391816ee91a50e5e0930194a2906b9a846a
Contents?: true
Size: 725 Bytes
Versions: 2
Compression:
Stored size: 725 Bytes
Contents
require 'matchi' module Spectus # The module includes the list of matcher methods. # # @api public # module Matchers Matchi.constants.each do |const| name = const .to_s .gsub(/::/, '/') .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') .gsub(/([a-z\d])([A-Z])/, '\1_\2') .downcase # Define a method for the given matcher. # # @example Given the `Matchi::Equal` matcher, its method would be: # def equal(expected) # Matchi::Equal.new(expected) # end # # @return [#matches?] The matcher. define_method name do |*args| Matchi.const_get(const).new(*args) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spectus-3.0.4 | lib/spectus/matchers.rb |
spectus-3.0.3 | lib/spectus/matchers.rb |