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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tori/file.rb +10 -6
  3. data/lib/tori/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 008108fbf732144ba0e7b7d840daf1b5ceeaf776
4
- data.tar.gz: ab5268fcb9f9e216eef8347d5b0b32f2684f6a82
3
+ metadata.gz: 13b7fb38fdb55e8c050508df44902f0eba8e395c
4
+ data.tar.gz: 454e9d1433db7d637d01dc29595a69cf53668095
5
5
  SHA512:
6
- metadata.gz: 25ddda231a1ee85f8353d65f214a5ae6fbb0f6cf547615c907cd05caf4dbb47b9263ac77550496e7c0d9fe6c4b96f5c5548e0a548fef375503ab6db7eb53f781
7
- data.tar.gz: ab35a2002c3203fdfa3dd5ca32e93c7dbdd3d8238dcefccadb9a540f33865274bf2b7a7a74e1a4420ff07dbcb98f572363b9d79212949caf508121fa0bed7d61
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
- context.define_singleton_method(:__bind__, @filename_callback)
19
- context.__bind__(@model)
17
+ filename_callback = if @filename_callback
18
+ @filename_callback
20
19
  else
21
- context.define_singleton_method(:__bind__, Tori.config.filename_callback)
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
@@ -1,3 +1,3 @@
1
1
  module Tori
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tori
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ksss