Class: Semi::Variables::Url
- Inherits:
-
Base
- Object
- Base
- Semi::Variables::Url
show all
- Defined in:
- lib/semi/variables/url.rb
Constant Summary
collapse
- @@url_re =
Regexp.new('^(?<proto>https?|ftp|file):\/\/(?<host>[a-z\.0-9\-_]+)?(?::(?<port>\d{1,5}))?\/?(?<path>.*?)\/?(?<file>[^\/\?]+)?(?:\?(?<params>.*?))?$', Regexp::IGNORECASE)
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #set, #to_s
Class Method Details
.validate(value) ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'lib/semi/variables/url.rb', line 12
def self.validate(value)
if ['String', 'Semi::Variables::Url'].include? value.class.to_s
if @@url_re.match(value)
return true
end
end
false
end
|
Instance Method Details
#validate ⇒ Object
8
9
10
|
# File 'lib/semi/variables/url.rb', line 8
def validate
self.validate(@value)
end
|