Class: Vigilem::Core::DefaultBuffer

Inherits:
SimpleDelegator
  • Object
show all
Includes:
Buffer
Defined in:
lib/vigilem/core/default_buffer.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Buffer

#concat, #deep_dup, #empty?, new, #offset, #offset!, #peek, #pop, #shift, #slice, #slice!

Constructor Details

#initialize(type = []) ⇒ DefaultBuffer

Returns a new instance of DefaultBuffer.

Parameters:

  • type (#slice!) (defaults to: [])


13
14
15
# File 'lib/vigilem/core/default_buffer.rb', line 13

def initialize(type=[])
  super(type)
end

Class Method Details

.wrap(type) ⇒ DefaultBuffer

like new except type is not optional and passes through an object that is already of self type

Parameters:

  • type

Returns:



22
23
24
25
26
27
28
# File 'lib/vigilem/core/default_buffer.rb', line 22

def self.wrap(type)
  if type.is_a? self      
    type
  else
    new(type)
  end
end

Instance Method Details

#==(other_obj) ⇒ TrueClass || FalseClass

Parameters:

  • other_obj

Returns:

  • (TrueClass || FalseClass)


33
34
35
36
# File 'lib/vigilem/core/default_buffer.rb', line 33

def ==(other_obj)
  super(other_obj) || 
    __getobj__ == other_obj.respond.__getobj__
end

#inspectString

Returns:

  • (String)


40
41
42
# File 'lib/vigilem/core/default_buffer.rb', line 40

def inspect
  "#<#{self.class}:0x#{object_id} #{super}>"
end