Class: Rubeechat::InfoList::Buffer

Inherits:
Object
  • Object
show all
Defined in:
lib/rubeechat/info_list.rb

Overview

a very cheezy implemenation of a buffer object

Instance Method Summary collapse

Constructor Details

#initialize(ptr, hash) ⇒ Buffer

Returns a new instance of Buffer.



7
8
9
10
# File 'lib/rubeechat/info_list.rb', line 7

def initialize(ptr, hash)
  @p = ptr
  @hash = hash
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *a, &b) ⇒ Object (private)



26
27
28
29
30
31
32
33
# File 'lib/rubeechat/info_list.rb', line 26

def method_missing(name, *a, &b)
  name = name.to_sym
  if @hash.has_key?(name)
    @hash[name]
  else
    super(name, *a, &b)
  end
end

Instance Method Details

#current_buffer?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/rubeechat/info_list.rb', line 21

def current_buffer?
  current_buffer == 1
end

print a message to this buffer



13
14
15
# File 'lib/rubeechat/info_list.rb', line 13

def print(msg)
  Weechat.print(@p, msg)
end

#serverObject



17
18
19
# File 'lib/rubeechat/info_list.rb', line 17

def server
  name.split('.').first
end