Class: UV::Pipe

Inherits:
Object
  • Object
show all
Includes:
Stream
Defined in:
lib/uv/pipe.rb

Instance Method Summary collapse

Methods included from Stream

#accept, #listen, #readable?, #shutdown, #start_read, #stop_read, #writable?, #write

Methods included from Handle

#active?, close, #close, #closing?, #initialize, #ref, #unref

Methods included from Assertions

#assert_arity, #assert_block, #assert_boolean, #assert_signal, #assert_type

Methods included from Resource

#check_result, #check_result!, #to_ptr

Methods included from Listener

define_callback, undefine_callbacks

Instance Method Details

#bind(name) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/uv/pipe.rb', line 13

def bind(name)
  assert_type(String, name, "name must be a String")

  name = windows_path name if FFI::Platform.windows?
  check_result! UV.pipe_bind(handle, name)

  self
end

#connect(name, &block) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/uv/pipe.rb', line 22

def connect(name, &block)
  assert_block(block)
  assert_arity(1, block)
  assert_type(String, name, "name must be a String")

  @connect_block = block

  name = windows_path name if FFI::Platform.windows?
  UV.pipe_connect(UV.create_request(:uv_connect), handle, name, callback(:on_connect))

  self
end

#open(fileno) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/uv/pipe.rb', line 5

def open(fileno)
  assert_type(Integer, fileno, "io#fileno must return an integer file descriptor")

  check_result! UV.pipe_open(handle, fileno)

  self
end

#pending_instances=(count) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/uv/pipe.rb', line 35

def pending_instances=(count)
  assert_type(Integer, count, "count must be an Integer")

  UV.pipe_pending_instances(handle, count)

  self
end