Method: OpenC3::ConfigParser#verify_parameter_naming
- Defined in:
- lib/openc3/config/config_parser.rb
#verify_parameter_naming(index, usage = "") ⇒ Object
Verifies the indicated parameter in the config doesn’t start or end with an underscore, doesn’t contain a double underscore, doesn’t contain spaces and doesn’t start with a close bracket.
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
# File 'lib/openc3/config/config_parser.rb', line 254 def verify_parameter_naming(index, usage = "") param = @parameters[index - 1] if param.end_with? '_' raise Error.new(self, "Parameter #{index} (#{param}) for #{@keyword} cannot end with an underscore ('_').", usage, @url) end if param.include? '__' raise Error.new(self, "Parameter #{index} (#{param}) for #{@keyword} cannot contain a double underscore ('__').", usage, @url) end if param.include? ' ' raise Error.new(self, "Parameter #{index} (#{param}) for #{@keyword} cannot contain a space (' ').", usage, @url) end if param.start_with?('}') raise Error.new(self, "Parameter #{index} (#{param}) for #{@keyword} cannot start with a close bracket ('}').", usage, @url) end end |