Sha256: c6e8f203b6f6225ac5315d01f2862a40a1456d739ed59cd51ed065b6efcca43a

Contents?: true

Size: 648 Bytes

Versions: 1

Compression:

Stored size: 648 Bytes

Contents

module Rung
  class State
    include ValueObject

    def initialize(state, success, operation)
      @success = success
      @operation = operation
      @state = state
    end

    def method_missing(method, *args)
      return @state.send(method, *args) if @state.respond_to?(method)

      super
    end

    def respond_to_missing?(method_name, include_private = false)
      @state.respond_to?(method_name, include_private) || super
    end

    attr_reader :operation

    def success?
      @success
    end

    def fail?
      !success?
    end

    alias failure? fail?
    alias failed? fail?
    alias successful? success?
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rung-0.1 lib/rung/state.rb