def build_leaf(object)
      this = self
      run_validator = method(:run_validator)
      check_types = method(:check_types)

      object.instance_exec do
        define_singleton_method(this.name) { this.value }
        define_singleton_method("#{this.name}=") do |value|
          run_validator.call(value)
          check_types.call(value)
          this.value = value
        end
      end

      object
    end
def build_leaf(object)
      this = self
      run_validator = method(:run_validator)
      check_types = method(:check_types)

      object.instance_exec do
        define_singleton_method(this.name) { this.value }
        define_singleton_method("#{this.name}=") do |value|
          run_validator.call(value)
          check_types.call(value)
          this.value = value
        end
      end

      object
    end
Finalize a nested object.