Class: Set
- Inherits:
-
Object
- Object
- Set
- Defined in:
- lib/invokable/set.rb
Overview
Extend stdlib Set object by adding #to_proc which will allow a set to be treated as a function of the membership of it’s elements.
Instance Method Summary collapse
-
#to_proc ⇒ Proc
Return a proc that takes an value and return true if the value is an element of the set, but returns false otherwise.
Instance Method Details
#to_proc ⇒ Proc
Return a proc that takes an value and return true if the value is an element of the set, but returns false otherwise.
10 11 12 13 14 |
# File 'lib/invokable/set.rb', line 10 def to_proc lambda do |element| include?(element) end end |