Module: Operandi::Dsl::OutputsDsl::ClassMethods
- Defined in:
- lib/operandi/dsl/outputs_dsl.rb
Instance Method Summary collapse
-
#output(name, opts = {}) ⇒ Object
Define an output for the service.
-
#outputs ⇒ Hash
Get all outputs including inherited ones.
-
#own_outputs ⇒ Hash
Get only outputs defined in this class.
-
#remove_output(name) ⇒ Object
Remove an output from the service.
Instance Method Details
#output(name, opts = {}) ⇒ Object
Define an output for the service
35 36 37 38 39 40 41 42 43 |
# File 'lib/operandi/dsl/outputs_dsl.rb', line 35 def output(name, opts = {}) Validation.validate_symbol_name!(name, :output, self) Validation.validate_reserved_name!(name, :output, self) Validation.validate_name_conflicts!(name, :output, self) Validation.validate_type_required!(name, :output, self, opts) own_outputs[name] = Settings::Field.new(name, self, opts.merge(field_type: FieldTypes::OUTPUT)) @outputs = nil # Clear memoized outputs since we're modifying them end |
#outputs ⇒ Hash
Get all outputs including inherited ones
56 57 58 |
# File 'lib/operandi/dsl/outputs_dsl.rb', line 56 def outputs @outputs ||= build_outputs end |
#own_outputs ⇒ Hash
Get only outputs defined in this class
63 64 65 |
# File 'lib/operandi/dsl/outputs_dsl.rb', line 63 def own_outputs @own_outputs ||= {} end |
#remove_output(name) ⇒ Object
Remove an output from the service
48 49 50 51 |
# File 'lib/operandi/dsl/outputs_dsl.rb', line 48 def remove_output(name) own_outputs.delete(name) @outputs = nil # Clear memoized outputs since we're modifying them end |