Class: RemoteFiles::AbstractStore
- Inherits:
-
Object
- Object
- RemoteFiles::AbstractStore
show all
- Defined in:
- lib/remote_files/abstract_store.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of AbstractStore.
5
6
7
|
# File 'lib/remote_files/abstract_store.rb', line 5
def initialize(identifier)
@identifier = identifier
end
|
Instance Attribute Details
#identifier ⇒ Object
Returns the value of attribute identifier.
3
4
5
|
# File 'lib/remote_files/abstract_store.rb', line 3
def identifier
@identifier
end
|
Instance Method Details
#[]=(name, value) ⇒ Object
13
14
15
|
# File 'lib/remote_files/abstract_store.rb', line 13
def []=(name, value)
options[name] = value
end
|
#copy_to_store!(file, target_store) ⇒ Object
29
30
31
|
# File 'lib/remote_files/abstract_store.rb', line 29
def copy_to_store!(file, target_store)
raise "You need to implement #{self.class.name} #copy_to_store!"
end
|
#delete!(identifier) ⇒ Object
41
42
43
|
# File 'lib/remote_files/abstract_store.rb', line 41
def delete!(identifier)
raise "You need to implement #{self.class.name}#delete!"
end
|
#directory_name ⇒ Object
21
22
23
|
# File 'lib/remote_files/abstract_store.rb', line 21
def directory_name
raise "You need to implement #{self.class.name}:#directory_name"
end
|
#file_from_url(url, options = {}) ⇒ Object
57
58
59
60
61
62
63
64
65
|
# File 'lib/remote_files/abstract_store.rb', line 57
def file_from_url(url, options = {})
matched = url_matcher.match(url)
return nil unless matched
file_identifier = CGI.unescape(matched[1])
RemoteFiles::File.new(file_identifier, options.merge(:stored_in => [self]))
end
|
#files(prefix = '') ⇒ Object
25
26
27
|
# File 'lib/remote_files/abstract_store.rb', line 25
def files(prefix = '')
raise "You need to implement #{self.class.name} #files"
end
|
#options ⇒ Object
9
10
11
|
# File 'lib/remote_files/abstract_store.rb', line 9
def options
@options ||= {}
end
|
#read_only? ⇒ Boolean
53
54
55
|
# File 'lib/remote_files/abstract_store.rb', line 53
def read_only?
options[:read_only] == true
end
|
#retrieve!(identifier) ⇒ Object
37
38
39
|
# File 'lib/remote_files/abstract_store.rb', line 37
def retrieve!(identifier)
raise "You need to implement #{self.class.name}#retrieve!"
end
|
#store!(file) ⇒ Object
33
34
35
|
# File 'lib/remote_files/abstract_store.rb', line 33
def store!(file)
raise "You need to implement #{self.class.name}#store!"
end
|
#to_sym ⇒ Object
17
18
19
|
# File 'lib/remote_files/abstract_store.rb', line 17
def to_sym
@identifier.to_sym
end
|
#url(identifier) ⇒ Object
45
46
47
|
# File 'lib/remote_files/abstract_store.rb', line 45
def url(identifier)
raise "You need to implement #{self.class.name}#url"
end
|
#url_matcher ⇒ Object
49
50
51
|
# File 'lib/remote_files/abstract_store.rb', line 49
def url_matcher
raise "You need to implement #{self.class.name}:#url_matcher"
end
|