Class: Stagecraft::IndexAttribute

Inherits:
Object
  • Object
show all
Defined in:
lib/stagecraft/core/attribute.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data:, format:, &on_change) ⇒ IndexAttribute

Returns a new instance of IndexAttribute.

Raises:

  • (ArgumentError)


67
68
69
70
71
72
73
74
75
76
# File 'lib/stagecraft/core/attribute.rb', line 67

def initialize(data:, format:, &on_change)
  @format = format.to_sym
  raise ArgumentError, "index format must be :uint16 or :uint32" unless %i[uint16 uint32].include?(@format)

  @version = 0
  @on_change = on_change
  @initialized = false
  self.data = data
  @initialized = true
end

Instance Attribute Details

#countObject (readonly)

Returns the value of attribute count.



65
66
67
# File 'lib/stagecraft/core/attribute.rb', line 65

def count
  @count
end

#dataObject

Returns the value of attribute data.



65
66
67
# File 'lib/stagecraft/core/attribute.rb', line 65

def data
  @data
end

#formatObject (readonly)

Returns the value of attribute format.



65
66
67
# File 'lib/stagecraft/core/attribute.rb', line 65

def format
  @format
end

#versionObject (readonly)

Returns the value of attribute version.



65
66
67
# File 'lib/stagecraft/core/attribute.rb', line 65

def version
  @version
end