Class: NBTFile::Types::String

Inherits:
BaseScalar
  • Object
show all
Defined in:
lib/nbtfile.rb

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ String

Returns a new instance of String.



880
881
882
883
884
885
# File 'lib/nbtfile.rb', line 880

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

Instance Method Details

#to_sObject Also known as: to_str



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

def to_s ; @value.dup ; end