Sha256: 85d15cb67cd61ccd796438606e925fef7ccc783a07edc383a597690d88b10070
Contents?: true
Size: 644 Bytes
Versions: 17
Compression:
Stored size: 644 Bytes
Contents
require 'ostruct' module ActionLogic class ActionContext < OpenStruct SUCCESS = :success FAILURE = :failure HALTED = :halted def initialize(params = {}) params[:status] ||= SUCCESS super(params) end def update!(status, message) self.status = status self.message = message end def fail!(message = "") update!(FAILURE, message) end def halt!(message = "") update!(HALTED, message) end def success? self.status == SUCCESS end def failure? self.status == FAILURE end def halted? self.status == HALTED end end end
Version data entries
17 entries across 17 versions & 1 rubygems