Class: ReservedSubdomain::Pattern
- Inherits:
-
Object
- Object
- ReservedSubdomain::Pattern
- Defined in:
- lib/reserved_subdomain/pattern.rb
Constant Summary collapse
- PATTERNS =
[ /.*[_-]feed$/, /.*[_-]support$/, /^v[0-9]{,2}$/, /^xn--/, ].freeze
Instance Attribute Summary collapse
-
#subdomain ⇒ Object
readonly
Returns the value of attribute subdomain.
Instance Method Summary collapse
-
#initialize(subdomain) ⇒ Pattern
constructor
A new instance of Pattern.
- #reserved? ⇒ Boolean
Constructor Details
#initialize(subdomain) ⇒ Pattern
Returns a new instance of Pattern.
12 13 14 |
# File 'lib/reserved_subdomain/pattern.rb', line 12 def initialize(subdomain) @subdomain = subdomain end |
Instance Attribute Details
#subdomain ⇒ Object (readonly)
Returns the value of attribute subdomain.
10 11 12 |
# File 'lib/reserved_subdomain/pattern.rb', line 10 def subdomain @subdomain end |
Instance Method Details
#reserved? ⇒ Boolean
16 17 18 |
# File 'lib/reserved_subdomain/pattern.rb', line 16 def reserved? PATTERNS.any? { |pattern| subdomain =~ pattern } end |