toto 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/toto.rb +2 -1
- data/toto.gemspec +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
data/lib/toto.rb
CHANGED
@@ -223,6 +223,7 @@ module Toto
|
|
223
223
|
def load
|
224
224
|
data = if @obj.is_a? File
|
225
225
|
meta, self[:body] = @obj.read.split(/\n\n/, 2)
|
226
|
+
@obj.close
|
226
227
|
YAML.load(meta)
|
227
228
|
elsif @obj.is_a? Hash
|
228
229
|
@obj
|
@@ -248,7 +249,7 @@ module Toto
|
|
248
249
|
sum = if self[:body] =~ config[:delim]
|
249
250
|
self[:body].split(config[:delim]).first
|
250
251
|
else
|
251
|
-
self[:body].match(/(.{1,#{length || config[:length]}}.*?)(\n|\Z)/m).to_s
|
252
|
+
self[:body].match(/(.{1,#{length || config[:length] || config[:max]}}.*?)(\n|\Z)/m).to_s
|
252
253
|
end
|
253
254
|
markdown(sum.length == self[:body].length ? sum : sum.strip.sub(/\.\Z/, '…'))
|
254
255
|
end
|
data/toto.gemspec
CHANGED