toto 0.3.1 → 0.3.2

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. data/VERSION +1 -1
  2. data/lib/toto.rb +2 -1
  3. data/toto.gemspec +1 -1
  4. metadata +1 -1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
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
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{toto}
8
- s.version = "0.3.1"
8
+ s.version = "0.3.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["cloudhead"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - cloudhead