Class: CraftBook::NBT::ValueTag Abstract
- Defined in:
- lib/craftbook/nbt/value_tag.rb
Overview
This class is abstract.
Abstract base class for tags that can contain a single primitive value.
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 collapse
Attributes inherited from Tag
Instance Method Summary collapse
-
#initialize(type, name, value) ⇒ ValueTag
constructor
Creates a new instance of the ValueTag class.
-
#to_h ⇒ Hash{Symbol => Object}
The hash-representation of this object.
Methods inherited from Tag
parse, #pretty, #pretty_print, #stringify, #to_json
Constructor Details
#initialize(type, name, value) ⇒ ValueTag
Creates a new instance of the CraftBook::NBT::ValueTag class.
21 22 23 24 |
# File 'lib/craftbook/nbt/value_tag.rb', line 21 def initialize(type, name, value) super(type, name) self.value = value end |
Instance Attribute Details
#value ⇒ Object
14 15 16 |
# File 'lib/craftbook/nbt/value_tag.rb', line 14 def value @value end |
Instance Method Details
#to_h ⇒ Hash{Symbol => Object}
Returns the hash-representation of this object.
32 33 34 |
# File 'lib/craftbook/nbt/value_tag.rb', line 32 def to_h { name: @name, type: @type, value: @value } end |