dimples 1.2.6 → 1.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1736eb52dc11b031fa9a1b6cff9a5e52a16e8a90
4
- data.tar.gz: 8d2ca4393894d87537c247f78441ea34ecef79d1
3
+ metadata.gz: 3a73dc6ff33514291145038bf268afb9accc0850
4
+ data.tar.gz: 2322912a45d40638953802426d010f94b4f244bf
5
5
  SHA512:
6
- metadata.gz: 1f9ef86dd1d02349c99e2b8825e016fcba6a10aa6d280bf3f1e7bc63fa65c8110836d30aab4643df215094f5c7b7b18cc46eecbfee1010e9ab0f8d56e1d6fd02
7
- data.tar.gz: 4f4be16cd059884d030a8a7f0ae0f55faf7978d79d84953087cc8fc2c6e8dd38f3db3f78c8125e0fd7cf96d0e2b4b9e98878e4f2229efa991c392b7db6a78d3b
6
+ metadata.gz: 9c3e1148fc8dd3c9145cfb89e0dacaeb3dddadfc906625bae5f9a8407f6466cf408133af07a50cbc4f0809a5173c988855e843883928b743f71ea2b26ff141bc
7
+ data.tar.gz: b5d15cac9bcb4a3a9bf51e9c4916ceef8d7020060be89d07dbc123fbd59866a05423213bf558e244e834f2620a4964035dc339abb6e08b1d5a24c61c30d4555b
@@ -3,14 +3,16 @@ module Dimples
3
3
  include Frontable
4
4
 
5
5
  attr_accessor :slug
6
+ attr_accessor :path
6
7
  attr_accessor :name
7
8
  attr_accessor :posts
8
9
 
9
- def initialize(slug, path = nil)
10
+ def initialize(slug, path)
10
11
  @slug = slug
12
+ @path = path
11
13
  @name = @slug.capitalize
12
14
 
13
- read_with_yaml(path) if path
15
+ read_with_yaml(path)
14
16
 
15
17
  @posts = []
16
18
  end
@@ -17,7 +17,7 @@ module Dimples
17
17
  if metadata
18
18
  metadata.each_pair do |key, value|
19
19
  self.class.send(:attr_accessor, key.to_sym) unless self.respond_to?(key.to_sym)
20
- instance_variable_set("@#{key}", value)
20
+ self.send("#{key}=", value)
21
21
  end
22
22
  end
23
23
 
data/lib/dimples/post.rb CHANGED
@@ -11,7 +11,6 @@ module Dimples
11
11
  attr_accessor :layout
12
12
  attr_accessor :slug
13
13
  attr_accessor :date
14
- attr_accessor :categories
15
14
  attr_accessor :year
16
15
  attr_accessor :month
17
16
  attr_accessor :day
@@ -34,7 +33,7 @@ module Dimples
34
33
  @date = Time.mktime(parts[1], parts[2], parts[3])
35
34
 
36
35
  @layout = @site.config['layouts']['post']
37
- @categories = []
36
+ @categories = {}
38
37
 
39
38
  @year = @date.strftime('%Y')
40
39
  @month = @date.strftime('%m')
@@ -47,6 +46,19 @@ module Dimples
47
46
  @contents
48
47
  end
49
48
 
49
+ def categories=(slugs)
50
+ @categories = {}
51
+
52
+ slugs.each do |slug|
53
+ @site.categories[slug].posts << self
54
+ @categories[slug] = @site.categories[slug]
55
+ end
56
+ end
57
+
58
+ def categories
59
+ @categories
60
+ end
61
+
50
62
  def output_file_path(parent_path)
51
63
  parts = [parent_path]
52
64
 
data/lib/dimples/site.rb CHANGED
@@ -95,11 +95,6 @@ module Dimples
95
95
  Dir.glob(File.join(@source_paths[:posts], '*.*')).reverse.each do |path|
96
96
  post = @post_class.new(self, path)
97
97
 
98
- post.categories.each do |slug|
99
- @categories[slug] ||= Dimples::Category.new(slug)
100
- @categories[slug].posts << post
101
- end
102
-
103
98
  %w[year month day].each do |date_type|
104
99
  if @config['generation']["#{date_type}_archives"]
105
100
 
@@ -1,3 +1,3 @@
1
1
  module Dimples
2
- VERSION = "1.2.6"
2
+ VERSION = "1.2.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dimples
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.6
4
+ version: 1.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Bogan