archival 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/archival.gemspec +1 -1
- data/lib/archival/builder.rb +12 -7
- data/lib/archival/template_array.rb +34 -0
- data/lib/archival/version.rb +1 -1
- data/lib/archival.rb +1 -0
- data/package.json +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 823433cd1bdae7bc4e3a6179451a875e7fbe5de17c4ceaa8a0b246cdd9fa3b61
|
4
|
+
data.tar.gz: 778ef490bf23365d6e1fa1207d0f959ead5a59edbaebebeebe16837981a6c230
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbbbd3c0ef92fabfcc08608adc376ce1272c36e30aa6f3b6d9e12d0ce5b9dd781b1fac4663262b144a85fe42ad951df396004f08518059820f6fc0c45d8a082c
|
7
|
+
data.tar.gz: fee79490a8d086eee8779e985483f0b80e75b1ec0df657eb19ed8c74a3a2e5590a8c2e4f74f20ce529e1536e204c3f62574cc5c6ac777bc38c07ebcd1723f3b4
|
data/archival.gemspec
CHANGED
data/lib/archival/builder.rb
CHANGED
@@ -9,6 +9,9 @@ Liquid::Template.error_mode = :strict
|
|
9
9
|
Liquid::Template.register_tag('layout', Layout)
|
10
10
|
|
11
11
|
module Archival
|
12
|
+
class DuplicateKeyError < StandardError
|
13
|
+
end
|
14
|
+
|
12
15
|
class Builder
|
13
16
|
attr_reader :page_templates
|
14
17
|
|
@@ -110,14 +113,16 @@ module Archival
|
|
110
113
|
end
|
111
114
|
|
112
115
|
def sort_objects(objects)
|
113
|
-
#
|
114
|
-
#
|
115
|
-
|
116
|
-
|
117
|
-
obj['order'].to_s || name
|
116
|
+
# Sort by either 'order' key or object name, depending on what is
|
117
|
+
# available.
|
118
|
+
sorted_by_keys = objects.sort_by do |name, obj|
|
119
|
+
obj.key?('order') ? obj['order'].to_s : name
|
118
120
|
end
|
119
|
-
sorted_objects =
|
120
|
-
|
121
|
+
sorted_objects = Archival::TemplateArray.new
|
122
|
+
sorted_by_keys.each do |d|
|
123
|
+
raise DuplicateKeyError if sorted_objects.key?(d[0])
|
124
|
+
|
125
|
+
sorted_objects.push(d[1])
|
121
126
|
sorted_objects[d[0]] = d[1]
|
122
127
|
end
|
123
128
|
sorted_objects
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archival
|
4
|
+
class TemplateArray < Array
|
5
|
+
alias subscript_access []
|
6
|
+
alias subscript_write []=
|
7
|
+
|
8
|
+
def initialize(*args)
|
9
|
+
super(*args)
|
10
|
+
@data = {}
|
11
|
+
end
|
12
|
+
|
13
|
+
def [](*args)
|
14
|
+
key = args[0]
|
15
|
+
return @data[key] if key.is_a? String
|
16
|
+
return @data[key] if key.is_a? Symbol
|
17
|
+
|
18
|
+
subscript_access(*args)
|
19
|
+
end
|
20
|
+
|
21
|
+
def []=(*args)
|
22
|
+
key = args[0]
|
23
|
+
if key.is_a?(String) || key.is_a?(Symbol)
|
24
|
+
@data[key] = args[1]
|
25
|
+
return
|
26
|
+
end
|
27
|
+
subscript_write(*args)
|
28
|
+
end
|
29
|
+
|
30
|
+
def key?(key)
|
31
|
+
@data.key?(key)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/archival/version.rb
CHANGED
data/lib/archival.rb
CHANGED
data/package.json
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: archival
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesse Ditson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11-
|
11
|
+
date: 2021-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: liquid
|
@@ -105,6 +105,7 @@ files:
|
|
105
105
|
- lib/archival/listen.rb
|
106
106
|
- lib/archival/logger.rb
|
107
107
|
- lib/archival/rake_tasks.rb
|
108
|
+
- lib/archival/template_array.rb
|
108
109
|
- lib/archival/version.rb
|
109
110
|
- lib/tags/layout.rb
|
110
111
|
- package.json
|