Class: Actions::SafeContext
- Inherits:
-
Object
- Object
- Actions::SafeContext
- Extended by:
- Forwardable
- Defined in:
- lib/actions/safe_context.rb
Instance Method Summary collapse
-
#initialize(context = {}) ⇒ SafeContext
constructor
A new instance of SafeContext.
- #input!(name, type: Object, required: false, mutable: false) ⇒ Object
- #output!(name, type: Object) ⇒ Object
Constructor Details
#initialize(context = {}) ⇒ SafeContext
Returns a new instance of SafeContext.
9 10 11 |
# File 'lib/actions/safe_context.rb', line 9 def initialize(context = {}) @context = Context.build(context) end |
Instance Method Details
#input!(name, type: Object, required: false, mutable: false) ⇒ Object
13 14 15 16 |
# File 'lib/actions/safe_context.rb', line 13 def input!(name, type: Object, required: false, mutable: false) attribute!(name, type: type, readonly: !mutable) validate!(name, type: type, required: required) end |
#output!(name, type: Object) ⇒ Object
18 19 20 |
# File 'lib/actions/safe_context.rb', line 18 def output!(name, type: Object) attribute!(name, type: type, readonly: false) end |