module Punchout::Punchable
Classes that include this module become punchable.
Calling `Instance#punch(obj)`, will return a class, the class of which is determined by one or more characteristics of `obj`
Attributes
matcher[RW]
An instance of something that acts like a {Matcher}
Public Instance Methods
punch(obj)
click to toggle source
Punches a class based on the object passed and the {Matcher}s tied to this {Punchable}
@param obj The object that determines what we punch @return [Class] The {Class} that matched against `obj`
# File lib/punchout.rb, line 34 def punch(obj) puncher.punch(obj) end
punchable?()
click to toggle source
Indicates whether this module is punchable
TODO: This method might become an indication of whether any punchers are registered. Or it just might die. Not sure yet.
# File lib/punchout.rb, line 15 def punchable? true end
puncher()
click to toggle source
The {Puncher} assocated with this punchable.
@return [Puncher] a {Puncher}
# File lib/punchout.rb, line 25 def puncher @puncher ||= Puncher.new end