Class: Hx::Interop::Interceptor::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/interop/interceptor/base.rb

Overview

Base class for read and write interceptors

Direct Known Subclasses

Read, Write

Instance Method Summary collapse

Constructor Details

#initialize(stream, &block) ⇒ Base

Returns a new instance of Base.

Raises:

  • (ArgumentError)


6
7
8
9
10
11
# File 'lib/interop/interceptor/base.rb', line 6

def initialize(stream, &block)
  raise ArgumentError, 'Expected a block that takes exactly 2 arguments' unless [2, -1].include? block&.arity

  @stream  = stream
  @handler = block
end