module Athena::Validator::PropertyPath
Overview
Utility type for working with property paths.
Defined in:
property_path.crClass Method Summary
-
.append(base_path : String, sub_path : String) : String
Appends the provided sub_path to the provided base_path based on the following rules:
Class Method Detail
def self.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"