Class: Thornbed::Providers::Provider
- Inherits:
-
Object
- Object
- Thornbed::Providers::Provider
show all
- Defined in:
- lib/thornbed/provider.rb
Constant Summary
collapse
- USER_AGENT =
"Thornbed/#{Thornbed::VERSION}"
Class Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Class Attribute Details
.providers ⇒ Object
Returns the value of attribute providers.
11
12
13
|
# File 'lib/thornbed/provider.rb', line 11
def providers
@providers
end
|
Class Method Details
.inherited(subclass) ⇒ Object
14
15
16
|
# File 'lib/thornbed/provider.rb', line 14
def self.inherited(subclass)
providers << subclass
end
|
Instance Method Details
#get(url) ⇒ Object
31
32
33
|
# File 'lib/thornbed/provider.rb', line 31
def get(url)
raise NotImplementedError, "Subclasses must implement a get method."
end
|
#pattern ⇒ Object
18
19
20
21
|
# File 'lib/thornbed/provider.rb', line 18
def pattern
raise NotImplementedError,
'Subclasses must implement a pattern method'
end
|
#provider_name ⇒ Object
27
28
29
|
# File 'lib/thornbed/provider.rb', line 27
def provider_name
self.class.to_s.split('::')[-1]
end
|
#valid?(url) ⇒ Boolean
23
24
25
|
# File 'lib/thornbed/provider.rb', line 23
def valid?(url)
!!pattern.match(url)
end
|