class Statefully::State::None

{None} is a null-value of {State}

Public Class Methods

new() click to toggle source

Constructor for the {None} object @api private

# File lib/statefully/state.rb, line 345
def initialize
  @_members = {}.freeze
  @previous = self
end

Public Instance Methods

ancestry() click to toggle source

Base case - {None} state does not have any ancestry

@return [Array<State>] @api public @example

Statefully::State::None.instance.ancestry
=> []
# File lib/statefully/state.rb, line 311
def ancestry
  []
end
history() click to toggle source

Return all historical changes to this {State}

@return [Array<Diff>] @api public @example

Statefully::State.create.succeed(key: 'val').history
=> [#<Statefully::Diff::Changed added={key: "val"}>, #<Statefully::Diff::Created>]
# File lib/statefully/state.rb, line 322
def history
  []
end
none?() click to toggle source

Check if the current {State} is none (a null-object of {State})

@return [Boolean] @api public @example

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

state.previous.none?
=> true
# File lib/statefully/state.rb, line 337
def none?
  true
end