Module: Cts::Mpx::Driver::Helpers
- Defined in:
- lib/cts/mpx/driver/helpers.rb
Overview
Collection of simple helpers for the development of the SDK
Class Method Summary collapse
-
.raise_if_not_a(objects, type) ⇒ nil
used to raise an exception if the array of objects is not of the specified type.
-
.raise_if_not_a_hash(objects) ⇒ nil
Raise an error if any object in the array is not of a type Hash.
-
.raise_if_not_an_array(objects) ⇒ nil
Raise an error if any object in the array is not of a type Array.
-
.required_arguments(keywords, a_binding) ⇒ nil
Raise an error if any keywords are not included inside of a specified binding.
Class Method Details
.raise_if_not_a(objects, type) ⇒ nil
used to raise an exception if the array of objects is not of the specified type.
20 21 22 23 |
# File 'lib/cts/mpx/driver/helpers.rb', line 20 def raise_if_not_a(objects, type) objects.each { |k| Exceptions.raise_unless_argument_error?(k, type) } nil end |
.raise_if_not_a_hash(objects) ⇒ nil
Raise an error if any object in the array is not of a type Hash
46 47 48 49 |
# File 'lib/cts/mpx/driver/helpers.rb', line 46 def raise_if_not_a_hash(objects) raise_if_not_a(objects, Hash) nil end |
.raise_if_not_an_array(objects) ⇒ nil
Raise an error if any object in the array is not of a type Array
33 34 35 36 |
# File 'lib/cts/mpx/driver/helpers.rb', line 33 def raise_if_not_an_array(objects) raise_if_not_a(objects, Array) nil end |
.required_arguments(keywords, a_binding) ⇒ nil
Raise an error if any keywords are not included inside of a specified binding.
60 61 62 63 |
# File 'lib/cts/mpx/driver/helpers.rb', line 60 def required_arguments(keywords, a_binding) keywords.each { |keyword| Exceptions.raise_unless_required_keyword?(a_binding, keyword) } nil end |