Class: Ballast::Context
- Inherits:
-
Interactor::Context
- Object
- Interactor::Context
- Ballast::Context
- Defined in:
- lib/ballast/context.rb
Overview
A context for an operation. It is basically a Hash with few enhancements, like owner, errors and output support.
Class Method Summary (collapse)
-
+ (Object) build(owner, additional = {})
Builds a new context.
Instance Method Summary (collapse)
-
- (Object) method_missing(method, *args, &block)
Lookups missing methods in the delegatee hash.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
- (Object) method_missing(method, *args, &block)
Lookups missing methods in the delegatee hash.
28 29 30 31 32 33 34 35 36 |
# File 'lib/ballast/context.rb', line 28 def method_missing(method, *args, &block) object = __getobj__ if object[method] then object[method] else super(method, *args, &block) end end |
Class Method Details
+ (Object) build(owner, additional = {})
Builds a new context.
13 14 15 16 17 18 19 20 |
# File 'lib/ballast/context.rb', line 13 def self.build(owner, additional = {}) super({ owner: owner, errors: [], output: nil, response: HashWithIndifferentAccess.new }.merge(additional).ensure_access(:indifferent)) end |