Skip to content

module Athena::Validator::PropertyPath #

Utility type for working with property paths.

Class methods#

.append(base_path : String, sub_path : String) : String#

Appends the provided sub_path to the provided base_path based on the following rules:

  • If the base path is empty, the sub path is returned as is.
  • If the base path is not empty, and the sub path starts with an [, the concatenation of the two paths is returned.
  • If the base path is not empty, and the sub path does not start with an [, the concatenation of the two paths is returned, separated by a ..
AVD::PropertyPath.append "", "sub_path"          # => "sub_path"
AVD::PropertyPath.append "base_path", "[0]"      # => "base_path[0]"
AVD::PropertyPath.append "base_path", "sub_path" # => "base_path.sub_path"
View source