Module: Tarantool::Model::State

Extended by:
ActiveSupport::Concern
Included in:
Tarantool::Model
Defined in:
tarantool-model/lib/tarantool/model/state.rb

Overview

Persistence state and the raw tuple a record was loaded from or last written with; Relation#after continues past that tuple.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#tuple ⇒ Object (readonly)

Returns the value of attribute tuple.



17
18
19
# File 'tarantool-model/lib/tarantool/model/state.rb', line 17

def tuple
  @tuple
end

Instance Method Details

#destroyed? ⇒ Boolean

Returns:

  • (Boolean)


23
# File 'tarantool-model/lib/tarantool/model/state.rb', line 23

def destroyed? = @destroyed == true

#freeze ⇒ Object

Assigning to a destroyed record must fail; freezing self alone leaves the attribute set writable.



26
27
28
29
30
# File 'tarantool-model/lib/tarantool/model/state.rb', line 26

def freeze
  @attributes = @attributes.clone.freeze

  super
end

#new_record? ⇒ Boolean

Returns:

  • (Boolean)


19
# File 'tarantool-model/lib/tarantool/model/state.rb', line 19

def new_record? = !@persisted

#persisted? ⇒ Boolean

Returns:

  • (Boolean)


21
# File 'tarantool-model/lib/tarantool/model/state.rb', line 21

def persisted? = @persisted == true && !destroyed?