lib/ury_rapid/services/responses/structure_builder.rb
# Defines shortcuts for common argument type-name pairs
#
# This creates, for each argument name in 'arguments', a method with
# that name serves as a shortcut for calling 'type' with that name.
#
# @api      public
# @example  Defining some argument shortcuts.
#   # Assume 'uint32' is an existing type.
#   def_argument_shortcuts :uint32, %i(position count index)
#   # We can now substitute 'position' etc. for 'uint32(position' etc.
#   # in calls to #struct.
#
# @param type [Symbol]
#   The type, defined by #def_type, of all argument shortcuts to be
#   defined by this method call.
#
# @param arguments [Array]
#   An array of symbols, each representing a common argument name for
#   which a shortcut method should be made that creates an argument
#   with type 'type' and said argument name.
#
# @return [null]
Defines shortcuts for common argument type-name pairs
This creates, for each argument name in 'arguments', a method with
that name serves as a shortcut for calling 'type' with that name.
Defines shortcuts for common argument type - name pairs This creates for each argument name in ' arguments ' a method with that name serves as a shortcut for calling ' type ' with that name .
def def_argument_shortcuts(type, arguments)
          arguments.each do |argument|
            create_method(argument) { send(type, argument) }
          end
        end
def def_argument_shortcuts ( type , arguments ) arguments . each do | argument | create_method ( argument ) { send ( type , argument ) } end end
Defines shortcuts for common argument type-name pairs
This creates, for each argument name in 'arguments', a method with
that name serves as a shortcut for calling 'type' with that name.
Defines shortcuts for common argument type - name pairs This creates for each argument name in ' arguments ' a method with that name serves as a shortcut for calling ' type ' with that name .
None
null
type
The type, defined by #def_type, of all argument shortcuts to be defined by this method call.
The type defined by #def_type of all argument shortcuts to be defined by this method call .
arguments
An array of symbols, each representing a common argument name for which a shortcut method should be made that creates an argument with type 'type' and said argument name.
An array of symbols each representing a common argument name for which a shortcut method should be made that creates an argument with type ' type ' and said argument name .
api
None
example
Defining some argument shortcuts. # Assume 'uint32' is an existing type. def_argument_shortcuts :uint32, %i(position count index) # We can now substitute 'position' etc. for 'uint32(position' etc. # in calls to #struct.
Defining some argument shortcuts . # Assume ' uint32 ' is an existing type . def_argument_shortcuts : uint32 %i ( position count index ) # We can now substitute ' position ' etc . for ' uint32 ( position ' etc . # in calls to #struct .