Class: Lab42::Stream::Behavior
- Inherits:
-
Object
- Object
- Lab42::Stream::Behavior
- Defined in:
- lib/lab42/stream/behavior.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call(*args) ⇒ Object
-
#initialize(&blk) ⇒ Behavior
constructor
A new instance of Behavior.
Constructor Details
#initialize(&blk) ⇒ Behavior
Returns a new instance of Behavior.
7 8 9 |
# File 'lib/lab42/stream/behavior.rb', line 7 def initialize( &blk ) @behavior = blk end |
Class Method Details
.const(const_rval) ⇒ Object
17 18 19 |
# File 'lib/lab42/stream/behavior.rb', line 17 def const(const_rval) __const_hash__.fetch!(const_rval, new{ |*_| const_rval}) end |
.make(*args, &blk) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/lab42/stream/behavior.rb', line 21 def make(*args, &blk) if blk raise ArgumentError, "cannot specify behavior with block and args: #{args.inspect}" unless args.empty? blk else _make_from_args( args ) end end |
.make1(*args, &blk) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/lab42/stream/behavior.rb', line 30 def make1(*args, &blk) if blk blk else _make_from_args( args ) end end |
Instance Method Details
#call(*args) ⇒ Object
11 12 13 |
# File 'lib/lab42/stream/behavior.rb', line 11 def call( *args ) @behavior.( *args ) end |