Class: Igniter::Extensions::Contracts::Incremental::NodeState

Inherits:
Object
  • Object
show all
Defined in:
lib/igniter/extensions/contracts/incremental/node_state.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, value:, value_version:, dep_snapshot: {}) ⇒ NodeState

Returns a new instance of NodeState.



10
11
12
13
14
15
16
# File 'lib/igniter/extensions/contracts/incremental/node_state.rb', line 10

def initialize(name:, value:, value_version:, dep_snapshot: {})
  @name = name.to_sym
  @value = value
  @value_version = Integer(value_version)
  @dep_snapshot = dep_snapshot.transform_keys(&:to_sym).freeze
  freeze
end

Instance Attribute Details

#dep_snapshotObject (readonly)

Returns the value of attribute dep_snapshot.



8
9
10
# File 'lib/igniter/extensions/contracts/incremental/node_state.rb', line 8

def dep_snapshot
  @dep_snapshot
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/igniter/extensions/contracts/incremental/node_state.rb', line 8

def name
  @name
end

#valueObject (readonly)

Returns the value of attribute value.



8
9
10
# File 'lib/igniter/extensions/contracts/incremental/node_state.rb', line 8

def value
  @value
end

#value_versionObject (readonly)

Returns the value of attribute value_version.



8
9
10
# File 'lib/igniter/extensions/contracts/incremental/node_state.rb', line 8

def value_version
  @value_version
end

Instance Method Details

#to_hObject



18
19
20
21
22
23
24
25
# File 'lib/igniter/extensions/contracts/incremental/node_state.rb', line 18

def to_h
  {
    name: name,
    value: value,
    value_version: value_version,
    dep_snapshot: dep_snapshot
  }
end