Class: Weechat::CustomBuffer

Inherits:
Delegator
  • Object
show all
Defined in:
lib/weechat/custom_buffer.rb

Overview

Subclass to create a custom buffer

Direct Known Subclasses

CustomFreeContentBuffer

Constant Summary

@@tracked_buffers =
{}

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ CustomBuffer

Creates a new instance of the custom buffer using the given name



27
28
29
30
31
32
33
34
35
36
# File 'lib/weechat/custom_buffer.rb', line 27

def initialize(name)
  buffer = Buffer.new(name,
        lambda {|b, input| @@tracked_buffers[b.ptr].handle_input(input)},
        lambda {|b| @@tracked_buffers[b.ptr].buffer_closed}
  )
  super(buffer)
  @@tracked_buffers[buffer.ptr] = self
  @base_buffer = buffer

end

Instance Method Details

#__getobj__Object



10
11
12
# File 'lib/weechat/custom_buffer.rb', line 10

def __getobj__
  @base_buffer
end

#buffer_closedObject

Override to add a buffer closed action



21
22
23
# File 'lib/weechat/custom_buffer.rb', line 21

def buffer_closed

end

#handle_inputObject

Override to determine what should be done when the user enters input



16
17
18
# File 'lib/weechat/custom_buffer.rb', line 16

def handle_input

end