Sha256: 959b788deed8abe55d78ab02050c5cc24e01db241d0611c1c6ebfc493d6a8bb6
Contents?: true
Size: 701 Bytes
Versions: 1
Compression:
Stored size: 701 Bytes
Contents
module ResponseState class Service def self.response_states(*states) @valid_states = Array(states) end def self.valid_states @valid_states || [] end def self.call(*args, &block) self.new(*args).call(&block) end def call(&block) fail NotImplementedError, "A ResponseState::Service should implement the call method.\nThe call method should perform the relevant work of the service and yield a ResponseState::Response object.\n" end def send_state(state, message=nil, context=nil, valid_states=nil) valid_states ||= self.class.valid_states ResponseState::Response.new(state, message, context, valid_states) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
response_state-0.4.0 | lib/response_state/service.rb |