Class: CraftBook::NBT::IntArrayTag
- Inherits:
-
EnumerableTag
- Object
- Tag
- EnumerableTag
- CraftBook::NBT::IntArrayTag
- Defined in:
- lib/craftbook/nbt/int_array_tag.rb
Overview
Represents a contiguous collection of signed 32-bit integers in the range of -2147483648
to 2147483647
inclusive.
Constant Summary
Constants inherited from Tag
Tag::TYPE_BYTE, Tag::TYPE_BYTE_ARRAY, Tag::TYPE_COMPOUND, Tag::TYPE_DOUBLE, Tag::TYPE_END, Tag::TYPE_FLOAT, Tag::TYPE_INT, Tag::TYPE_INT_ARRAY, Tag::TYPE_LIST, Tag::TYPE_LONG, Tag::TYPE_LONG_ARRAY, Tag::TYPE_SHORT, Tag::TYPE_STRING
Instance Attribute Summary
Attributes inherited from Tag
Instance Method Summary collapse
-
#initialize(name, *values) ⇒ IntArrayTag
constructor
Creates a new instance of the IntArrayTag class.
-
#stringify ⇒ String
The NBT tag as an SNBT string.
-
#to_h ⇒ Hash{Symbol => Object}
The hash-representation of this object.
-
#to_s ⇒ String
The NBT tag as a formatted and human-readable string.
Methods inherited from EnumerableTag
#[], #[]=, #each, #push, #size
Methods inherited from Tag
parse, #pretty, #pretty_print, #to_json
Constructor Details
#initialize(name, *values) ⇒ IntArrayTag
Creates a new instance of the CraftBook::NBT::IntArrayTag class.
15 16 17 |
# File 'lib/craftbook/nbt/int_array_tag.rb', line 15 def initialize(name, *values) super(TYPE_INT_ARRAY, name, *values) end |
Instance Method Details
#stringify ⇒ String
Returns the NBT tag as an SNBT string.
33 34 35 |
# File 'lib/craftbook/nbt/int_array_tag.rb', line 33 def stringify "#{snbt_prefix}[I;#{to_a.join(',')}]" end |
#to_h ⇒ Hash{Symbol => Object}
Returns the hash-representation of this object.
21 22 23 |
# File 'lib/craftbook/nbt/int_array_tag.rb', line 21 def to_h { name: @name, type: @type, values: @values } end |
#to_s ⇒ String
Returns the NBT tag as a formatted and human-readable string.
27 28 29 |
# File 'lib/craftbook/nbt/int_array_tag.rb', line 27 def to_s "TAG_Int_Array(#{@name ? "\"#{@name}\"" : 'None'}): #{size} #{size == 1 ? 'item' : 'items'}" end |