tori 0.4.0 → 0.4.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/lib/tori/file.rb +10 -6
- data/lib/tori/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13b7fb38fdb55e8c050508df44902f0eba8e395c
|
4
|
+
data.tar.gz: 454e9d1433db7d637d01dc29595a69cf53668095
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 355e802d40cd93d147c573656f5ef4fba70b396eeb4db1927eabd0cdf7776505546252a2d97673a3a1cdc4b0e203ad86d9903c6339079765f0e61e1c37aa1a6e
|
7
|
+
data.tar.gz: 4962d066361815dd3aa739af5e1b87cb7ec196c699f2a6944e18e4f0614aaf3a3d1ad8e5dce43a0890e508697def5fb711562a0cc67c6b5b7d0f8d65e07ea772
|
data/lib/tori/file.rb
CHANGED
@@ -2,7 +2,7 @@ module Tori
|
|
2
2
|
class File
|
3
3
|
def initialize(model, title: nil, from: nil, &block)
|
4
4
|
@model = model
|
5
|
-
@title = title
|
5
|
+
@title = title.kind_of?(String) ? title.to_sym : title
|
6
6
|
if from.respond_to?(:read) and from.respond_to?(:rewind)
|
7
7
|
from.rewind
|
8
8
|
@from = from.read
|
@@ -14,13 +14,13 @@ module Tori
|
|
14
14
|
|
15
15
|
def name
|
16
16
|
context = Context.new(@title)
|
17
|
-
if @filename_callback
|
18
|
-
|
19
|
-
context.__bind__(@model)
|
17
|
+
filename_callback = if @filename_callback
|
18
|
+
@filename_callback
|
20
19
|
else
|
21
|
-
|
22
|
-
context.__bind__(@model)
|
20
|
+
Tori.config.filename_callback
|
23
21
|
end
|
22
|
+
context.define_singleton_method(:__filename_callback__, filename_callback)
|
23
|
+
context.__filename_callback__(@model)
|
24
24
|
end
|
25
25
|
alias to_s name
|
26
26
|
|
@@ -28,6 +28,10 @@ module Tori
|
|
28
28
|
!@from.nil?
|
29
29
|
end
|
30
30
|
|
31
|
+
def read
|
32
|
+
Tori.config.backend.read name
|
33
|
+
end
|
34
|
+
|
31
35
|
def write(opts = nil)
|
32
36
|
Tori.config.backend.write name, @from, opts
|
33
37
|
end
|
data/lib/tori/version.rb
CHANGED