Sha256: ecfe03fdde4abc5524a822cdba5a9f1d444f18deeb0a31ce3e68ba0b3ecf1d77
Contents?: true
Size: 1.28 KB
Versions: 18
Compression:
Stored size: 1.28 KB
Contents
# # This file is part of the ballast gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>. # Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php. # module Ballast # A context for an operation. It is basically a Hash with few enhancements, like owner, errors and output support. class Context < Interactor::Context # Builds a new context. # # @param owner [Object] The owner of this context. # @param additional [Hash] Additional parameters to include into the context. def self.build(owner, additional = {}) super({ owner: owner, errors: [], output: nil, response: HashWithIndifferentAccess.new }.merge(additional).ensure_access(:indifferent)) end # Lookups missing methods in the delegatee hash. # # @param method [Symbol] The method to lookup. # @param args [Array] The arguments passed to the method. *This is ignored.* # @param block [Proc] The block passed to the method. *This is ignored.* # @return [Object] The value for the method, if present. def method_missing(method, *args, &block) object = __getobj__ if object[method] then object[method] else super(method, *args, &block) end end end end
Version data entries
18 entries across 18 versions & 1 rubygems