Sha256: 70cdb68f689d6467c063222fd4faba0e4078cfaa2d8b7a6fe83abcea470382d2
Contents?: true
Size: 454 Bytes
Versions: 4
Compression:
Stored size: 454 Bytes
Contents
require_relative '../collection' class SiteHub class Collection < Hash class RouteCollection < Collection def add(id, route, *_opts) self[id] = route end def valid? !keys.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
4 entries across 4 versions & 1 rubygems