Class: Shaped::Shapes::Method
- Inherits:
-
Shaped::Shape
- Object
- Shaped::Shape
- Shaped::Shapes::Method
- Defined in:
- lib/shaped/shapes/method.rb
Instance Method Summary collapse
-
#initialize(method_name) ⇒ Method
constructor
A new instance of Method.
- #matched_by?(object) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(method_name) ⇒ Method
Returns a new instance of Method.
4 5 6 |
# File 'lib/shaped/shapes/method.rb', line 4 def initialize(method_name) @method_name = method_name end |
Instance Method Details
#matched_by?(object) ⇒ Boolean
8 9 10 |
# File 'lib/shaped/shapes/method.rb', line 8 def matched_by?(object) !!object.public_send(@method_name) end |
#to_s ⇒ Object
12 13 14 |
# File 'lib/shaped/shapes/method.rb', line 12 def to_s "object returning truthy for ##{@method_name}" end |