Sha256: fbdbb45419f11f56862b6c04bee592c21fe06c6a2f8aca3db104dbb41d86ea3d
Contents?: true
Size: 449 Bytes
Versions: 1
Compression:
Stored size: 449 Bytes
Contents
require_relative '../collection' class SiteHub class Collection < Hash class RouteCollection < Collection def add(id, route, *_opts) self[id] = route end def valid? !empty? end def resolve(id: nil, env: nil) return values.first unless values.find(&:rule) result = values.find { |route| route.applies?(env) } result && result.resolve(env: env) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sitehub-0.5.0.alpha3 | lib/sitehub/collection/route_collection.rb |