Module: Roby::Coordination::Models::Arguments
- Extended by:
- MetaRuby::Attributes
- Included in:
- Base, FaultResponseTable
- Defined in:
- lib/roby/coordination/models/arguments.rb
Defined Under Namespace
Classes: Argument
Instance Method Summary collapse
-
#argument(name, options = {}) ⇒ Argument
Define a new argument for this coordination model.
-
#validate_arguments(arguments) ⇒ Object
Validates that the provided argument hash is valid for this particular coordination model.
Instance Method Details
#argument(name, options = {}) ⇒ Argument
Define a new argument for this coordination model
Arguments are made available within the coordination model as Variable objects
13 |
# File 'lib/roby/coordination/models/arguments.rb', line 13 inherited_attribute(:argument, :arguments, map: true) { {} } |
#validate_arguments(arguments) ⇒ Object
Validates that the provided argument hash is valid for this particular coordination model
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/roby/coordination/models/arguments.rb', line 35 def validate_arguments(arguments) arguments = Kernel. arguments arguments.each_key do |arg_name| unless find_argument(arg_name) raise ArgumentError, "#{arg_name} is not an argument on #{self}" end end each_argument do |_, arg| next if arguments.has_key?(arg.name) if arg.required raise ArgumentError, "#{arg.name} is required by #{self}, but is "\ "not provided (given arguments: #{arguments})" end arguments[arg.name] = arg.default end arguments end |