trefoil 0.1.0 → 0.1.1
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 +4 -4
- data/.rubocop.yml +5 -0
- data/lib/trefoil/board.rb +1 -1
- data/lib/trefoil/client.rb +1 -0
- data/lib/trefoil/post.rb +4 -4
- data/lib/trefoil/thread.rb +13 -2
- data/lib/trefoil/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f1a4186b852b09088347a46d27e9f85e139c15d43d00878489f5f953911bb66
|
4
|
+
data.tar.gz: 5ad9c8ebf46635cf4eeec8199627157553d6d213a88c367c5adb15b2393db113
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75c45ae63bdbce88799aeb3f003c75847ca2629f6162361084e933dc6653138d2af3efd89176a8c6e0f5c4038cb0da70300995a17c25611f8b8e7953c99b4141
|
7
|
+
data.tar.gz: cbfc8d0b14f02c4c7c4c22d641c32423fbb4fcc0ac57eb49683142878e18495ede7cc7122473bb75c2a5ed9fc14c563e3c986ad86f9af7d04320e9a036744c72
|
data/.rubocop.yml
CHANGED
data/lib/trefoil/board.rb
CHANGED
data/lib/trefoil/client.rb
CHANGED
data/lib/trefoil/post.rb
CHANGED
@@ -30,15 +30,15 @@ module Trefoil
|
|
30
30
|
# Whether this post has an image associated with it
|
31
31
|
# @return [true, false]
|
32
32
|
def image?
|
33
|
-
!@data[:filename].
|
33
|
+
!@data[:filename].nil?
|
34
34
|
end
|
35
35
|
|
36
|
-
#
|
36
|
+
# Image object of this post, if any.
|
37
37
|
# @return [Image, nil] An Image or nil if no image is present.
|
38
|
-
def
|
38
|
+
def image
|
39
39
|
return nil unless image?
|
40
40
|
|
41
|
-
Image.new(@data)
|
41
|
+
Image.new(@data, @board)
|
42
42
|
end
|
43
43
|
|
44
44
|
# Url to this post
|
data/lib/trefoil/thread.rb
CHANGED
@@ -20,7 +20,7 @@ module Trefoil
|
|
20
20
|
# An array of all posts in the thread
|
21
21
|
# @return [Array<Post>] All posts in this thread since last update
|
22
22
|
def posts
|
23
|
-
|
23
|
+
fetch_posts if @posts.nil?
|
24
24
|
@posts
|
25
25
|
end
|
26
26
|
|
@@ -39,9 +39,20 @@ module Trefoil
|
|
39
39
|
|
40
40
|
# Fetch all posts into
|
41
41
|
def fetch_posts
|
42
|
-
@
|
42
|
+
@posts = []
|
43
|
+
@client.get("/#{@board.name}/thread/#{@id}.json")[:posts].each do |post|
|
43
44
|
@posts << Post.new(@client, @board, self, post)
|
44
45
|
end
|
45
46
|
end
|
46
47
|
end
|
48
|
+
|
49
|
+
# Used for catalog
|
50
|
+
class ThreadStub < Thread
|
51
|
+
attr_reader :op
|
52
|
+
|
53
|
+
def initialize(client, board, id, op)
|
54
|
+
@op = op
|
55
|
+
super(client, board, id)
|
56
|
+
end
|
57
|
+
end
|
47
58
|
end
|
data/lib/trefoil/version.rb
CHANGED