Module: Operandi::Dsl::ArgumentsDsl::ClassMethods
- Defined in:
- lib/operandi/dsl/arguments_dsl.rb
Instance Method Summary collapse
-
#arg(name, opts = {}) ⇒ Object
Define an argument for the service.
-
#arguments ⇒ Hash
Get all arguments including inherited ones.
-
#own_arguments ⇒ Hash
Get only arguments defined in this class.
-
#remove_arg(name) ⇒ Object
Remove an argument from the service.
Instance Method Details
#arg(name, opts = {}) ⇒ Object
Define an argument for the service
39 40 41 42 43 44 45 46 47 |
# File 'lib/operandi/dsl/arguments_dsl.rb', line 39 def arg(name, opts = {}) Validation.validate_symbol_name!(name, :argument, self) Validation.validate_reserved_name!(name, :argument, self) Validation.validate_name_conflicts!(name, :argument, self) Validation.validate_type_required!(name, :argument, self, opts) own_arguments[name] = Settings::Field.new(name, self, opts.merge(field_type: FieldTypes::ARGUMENT)) @arguments = nil # Clear memoized arguments since we're modifying them end |
#arguments ⇒ Hash
Get all arguments including inherited ones
60 61 62 |
# File 'lib/operandi/dsl/arguments_dsl.rb', line 60 def arguments @arguments ||= build_arguments end |
#own_arguments ⇒ Hash
Get only arguments defined in this class
67 68 69 |
# File 'lib/operandi/dsl/arguments_dsl.rb', line 67 def own_arguments @own_arguments ||= {} end |
#remove_arg(name) ⇒ Object
Remove an argument from the service
52 53 54 55 |
# File 'lib/operandi/dsl/arguments_dsl.rb', line 52 def remove_arg(name) own_arguments.delete(name) @arguments = nil # Clear memoized arguments since we're modifying them end |