class Test < Attributor::Struct
attributes do
attribute :href, Attributor::URI, path: %r{/foo/\d+}
end
end
puts Test.example.dump
=> {:href=>"http://example.com/hydrocoralline/804302141"}
Although, it would correctly validate against it:
t = Test.load( {href: "/bar/123"} )
puts t.validate
=> $.href value (/bar/123) does not match path (/\/foo\/\d+/)
Although, it would correctly validate against it: