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

#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:


298
299
300
# File 'lib/statefully/state.rb', line 298

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)

313
314
315
# File 'lib/statefully/state.rb', line 313

def none?
  true
end