Class: BBC::Programmes::Base
- Inherits:
-
Object
- Object
- BBC::Programmes::Base
show all
- Includes:
- Spira::Resource
- Defined in:
- lib/bbc/programmes/base.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.fetch(identifier) ⇒ Object
13
14
15
16
17
|
# File 'lib/bbc/programmes/base.rb', line 13
def self.fetch(identifier)
programme = self.for(identifier)
programme.fetch!
programme
end
|
.subclasses ⇒ Object
34
35
36
37
38
39
40
41
42
|
# File 'lib/bbc/programmes/base.rb', line 34
def self.subclasses
subclasses = []
ObjectSpace.each_object(Class) do |klass|
if klass.ancestors.include?(self)
subclasses << klass
end
end
subclasses
end
|
Instance Method Details
#fetch! ⇒ Object
19
20
21
22
23
|
# File 'lib/bbc/programmes/base.rb', line 19
def fetch!
BBC::Programmes.fetch(subject)
self.reload
self
end
|
#pid ⇒ Object
25
26
27
28
29
30
31
32
|
# File 'lib/bbc/programmes/base.rb', line 25
def pid
pid = attribute_get(:pid)
if pid.nil?
subject.to_s =~ /(\w+)\#(\w+)$/
pid = $1
end
pid
end
|