Class: Ircmad::WebSocket::Buffer
- Inherits:
-
Object
- Object
- Ircmad::WebSocket::Buffer
- Defined in:
- lib/ircmad/web_socket/buffer.rb
Instance Attribute Summary collapse
-
#ary ⇒ Object
readonly
Returns the value of attribute ary.
-
#max ⇒ Object
readonly
Returns the value of attribute max.
Instance Method Summary collapse
-
#initialize(_max = 100) ⇒ Buffer
constructor
A new instance of Buffer.
- #method_missing(action, *args, &block) ⇒ Object
- #push(element) ⇒ Object (also: #<<)
Constructor Details
#initialize(_max = 100) ⇒ Buffer
Returns a new instance of Buffer.
6 7 8 |
# File 'lib/ircmad/web_socket/buffer.rb', line 6 def initialize(_max = 100) @max = _max end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(action, *args, &block) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/ircmad/web_socket/buffer.rb', line 22 def method_missing(action, *args, &block) if ary.respond_to?(action.to_s) ary.send(action.to_s, *args, &block) else super end end |
Instance Attribute Details
#ary ⇒ Object (readonly)
Returns the value of attribute ary.
4 5 6 |
# File 'lib/ircmad/web_socket/buffer.rb', line 4 def ary @ary end |
#max ⇒ Object (readonly)
Returns the value of attribute max.
4 5 6 |
# File 'lib/ircmad/web_socket/buffer.rb', line 4 def max @max end |
Instance Method Details
#push(element) ⇒ Object Also known as: <<
10 11 12 13 14 15 |
# File 'lib/ircmad/web_socket/buffer.rb', line 10 def push(element) if size > max shift end ary << element end |