Module: Stendhal::Matchers

Included in:
Example
Defined in:
lib/stendhal/matchers.rb,
lib/stendhal/matchers/kind.rb,
lib/stendhal/matchers/equality.rb,
lib/stendhal/matchers/predicate.rb,
lib/stendhal/matchers/abstract_matcher.rb

Defined Under Namespace

Classes: AbstractMatcher, Equality, Kind, Predicate

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/stendhal/matchers.rb', line 19

def method_missing(m,*args)
  if m.to_s =~ /be_(\w+)/
    Predicate.new(($1 + '?').to_sym)
  else
    super(m,*args)
  end
end

Instance Method Details

#be_a(kind) ⇒ Object Also known as: be_kind_of, be_a_kind_of



13
14
15
# File 'lib/stendhal/matchers.rb', line 13

def be_a(kind)
  Kind.new(kind)
end

#eq(other) ⇒ Object Also known as: eql



8
9
10
# File 'lib/stendhal/matchers.rb', line 8

def eq(other)
  Equality.new(other)
end