class method
self.validate_app
Ruby on Rails 1.0.1
Last seen in v1.3.0Signature
self.validate_app(app)
Validates app‘s as URI hostnames containing only alphanumeric characters and hyphens. An ArgumentError is raised if app is invalid.
URI::GID.validate_app('bcx') # => 'bcx' URI::GID.validate_app('foo-bar') # => 'foo-bar' URI::GID.validate_app(nil) # => ArgumentError URI::GID.validate_app('foo/bar') # => ArgumentError
Parameters
-
appreq
Source
# File lib/global_id/uri/gid.rb, line 43
def validate_app(app)
parse("gid://#{app}/Model/1").app
rescue URI::Error
raise ArgumentError, 'Invalid app name. ' \
'App names must be valid URI hostnames: alphanumeric and hyphen characters only.'
end
Defined in lib/global_id/uri/gid.rb line 43
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in URI::GID