Sha256: 541c42fae35d828f0a47a01283adaf7f43b9a61f3d8ac6086fc35320a99442a4
Contents?: true
Size: 696 Bytes
Versions: 1
Compression:
Stored size: 696 Bytes
Contents
class Trailblazer::V2_1::Operation class Result # @param success Boolean validity of the result object # @param data Context def initialize(success, data) @success, @data = success, data end def success? @success end def failure? ! success? end extend Forwardable def_delegators :@data, :[] # DISCUSS: make it a real delegator? see Nested. # DISCUSS: the two methods below are more for testing. def inspect(*slices) return "<Result:#{success?} #{slice(*slices).inspect} >" if slices.any? "<Result:#{success?} #{@data.inspect} >" end def slice(*keys) keys.collect { |k| self[k] } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
trailblazer-future-2.1.0.rc1 | lib/trailblazer/v2_1/operation/result.rb |