Class: NBTFile::Types::ByteArray

Inherits:
Object
  • Object
show all
Includes:
Private::Base
Defined in:
lib/nbtfile.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ ByteArray

Returns a new instance of ByteArray.



896
897
898
899
900
901
# File 'lib/nbtfile.rb', line 896

def initialize(value)
  unless value.respond_to? :to_str
    raise TypeError, "String or string-like expected"
  end
  @value = value.to_str
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



894
895
896
# File 'lib/nbtfile.rb', line 894

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



903
904
905
# File 'lib/nbtfile.rb', line 903

def ==(other)
  self.class == other.class && @value == other.value
end

#to_sObject Also known as: to_str



907
# File 'lib/nbtfile.rb', line 907

def to_s ; @value.dup ; end