Parent

Class Index [+]

Quicksearch

RR::WildcardMatchers::DuckType

Attributes

required_methods[RW]

Public Class Methods

new(*required_methods) click to toggle source
   # File lib/rr/wildcard_matchers/duck_type.rb, line 6
6:       def initialize(*required_methods)
7:         @required_methods = required_methods
8:       end

Public Instance Methods

==(other) click to toggle source
    # File lib/rr/wildcard_matchers/duck_type.rb, line 25
25:       def ==(other)
26:         return false unless other.is_a?(self.class)
27:         self.required_methods == other.required_methods
28:       end
Also aliased as: eql?
eql?(other) click to toggle source
Alias for: ==
inspect() click to toggle source
    # File lib/rr/wildcard_matchers/duck_type.rb, line 18
18:       def inspect
19:         formatted_required_methods = required_methods.collect do |method_name|
20:           method_name.inspect
21:         end.join(', ')
22:         "duck_type(#{formatted_required_methods})"
23:       end
wildcard_match?(other) click to toggle source
    # File lib/rr/wildcard_matchers/duck_type.rb, line 10
10:       def wildcard_match?(other)
11:         return true if self == other
12:         required_methods.each do |m|
13:           return false unless other.respond_to?(m)
14:         end
15:         return true
16:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.