Class: Alula::Storage
- Inherits:
-
Object
show all
- Defined in:
- lib/alula/storage.rb,
lib/alula/storages/item.rb
Defined Under Namespace
Classes: FileItem, FileStorage, Item
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options, opts = {}) ⇒ Storage
23
24
25
26
27
28
|
# File 'lib/alula/storage.rb', line 23
def initialize(options, opts = {})
@options = options
@site = opts[:site]
@outputted = []
end
|
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
5
6
7
|
# File 'lib/alula/storage.rb', line 5
def options
@options
end
|
#outputted ⇒ Object
Returns the value of attribute outputted.
6
7
8
|
# File 'lib/alula/storage.rb', line 6
def outputted
@outputted
end
|
Class Method Details
.load(opts = {}) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/alula/storage.rb', line 8
def self.load(opts = {})
site = opts[:site]
type = site.config.storage.keys.last
cls_name = type[0].upcase + type[1..-1] + "Storage"
if self.const_defined?(cls_name)
cls = self.const_get(cls_name)
return cls.new(site.config.storage[type], opts)
else
return nil
end
end
|
Instance Method Details
#custom(name) ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/alula/storage.rb', line 38
def custom(name)
if name.kind_of?(Regexp)
self.customs.select{|key, item| key[name]}
else
self.customs[name]
end
end
|
#page(name) ⇒ Object
34
35
36
|
# File 'lib/alula/storage.rb', line 34
def page(name)
self.pages[name]
end
|
#post(name) ⇒ Object
30
31
32
|
# File 'lib/alula/storage.rb', line 30
def post(name)
self.posts[name]
end
|