Class: Statefully::State::None

Inherits:
Statefully::State show all
Includes:
Singleton
Defined in:
lib/statefully/state.rb

Overview

None is a null-value of Statefully::State

Instance Attribute Summary

Attributes inherited from Statefully::State

#previous

Instance Method Summary collapse

Methods inherited from Statefully::State

create, #diff, #each, #failed?, #fetch, #finished?, #inspect, #key?, #keys, #resolve, #successful?

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Statefully::State

Instance Method Details

#ancestryArray<State>

Base case - Statefully::State::None state does not have any ancestry

Examples:

Statefully::State::None.instance.ancestry
=> []

Returns:



311
312
313
# File 'lib/statefully/state.rb', line 311

def ancestry
  []
end

#historyArray<Diff>

Return all historical changes to this Statefully::State

Examples:

Statefully::State.create.succeed(key: 'val').history
=> [#<Statefully::Diff::Changed added={key: "val"}>, #<Statefully::Diff::Created>]

Returns:



322
323
324
# File 'lib/statefully/state.rb', line 322

def history
  []
end

#none?Boolean

Check if the current Statefully::State is none (a null-object of Statefully::State)

Examples:

state = Statefully::State.create
state.none?
=> false

state.previous.none?
=> true

Returns:

  • (Boolean)


337
338
339
# File 'lib/statefully/state.rb', line 337

def none?
  true
end