Class: Proc
- Inherits:
-
Object
- Object
- Proc
- Defined in:
- lib/lab42/stream/proc.rb
Instance Method Summary collapse
-
#make_behavior(*args) ⇒ Object
TODO: Use this from core/fn as soon as available.
- #memoized ⇒ Object
- #not ⇒ Object
Instance Method Details
#make_behavior(*args) ⇒ Object
TODO: Use this from core/fn as soon as available
16 17 18 19 |
# File 'lib/lab42/stream/proc.rb', line 16 def make_behavior *args raise ArgumentError, "cannot specify behavior with block and args: #{args.inspect}" unless args.compact.empty? self end |
#memoized ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/lab42/stream/proc.rb', line 2 def memoized already_run = false result = nil ->{ if already_run result else already_run = true result = call() end } end |
#not ⇒ Object
21 22 23 24 25 |
# File 'lib/lab42/stream/proc.rb', line 21 def not -> (*args, &blk) { ! self.(*args, &blk) } end |