inifile 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,6 +7,6 @@ script: "rake"
7
7
 
8
8
  rvm:
9
9
  - 1.8.7
10
- - 1.9.2
10
+ - 1.9.3
11
11
  - jruby
12
12
 
@@ -1,3 +1,8 @@
1
+ == 2.0.2 / 2012-09-14
2
+
3
+ Bug Fixes
4
+ - Lack of newline at end of file causes error (thanks erebor) [issue #12]
5
+
1
6
  == 2.0.1 / 2012-09-06
2
7
 
3
8
  Bug Fixes
@@ -8,7 +8,7 @@ class IniFile
8
8
  include Enumerable
9
9
 
10
10
  class Error < StandardError; end
11
- VERSION = '2.0.1'
11
+ VERSION = '2.0.2'
12
12
 
13
13
  # Public: Open an INI file and load the contents.
14
14
  #
@@ -449,7 +449,7 @@ private
449
449
  # otherwise scan and store characters till we hit the start of some
450
450
  # special section like a quote, newline, comment, etc.
451
451
  else
452
- tmp = scanner.scan_until(%r/([\n"#{@param}#{@comment}]|\\[\[\]#{@param}#{@comment}"])/m)
452
+ tmp = scanner.scan_until(%r/([\n"#{@param}#{@comment}] | \z | \\[\[\]#{@param}#{@comment}"])/mx)
453
453
  parse_error if tmp.nil?
454
454
 
455
455
  len = scanner[1].length
@@ -252,6 +252,13 @@ class TestIniFile < Test::Unit::TestCase
252
252
  assert_raise(IniFile::Error) {IniFile.new :filename => 'test/data/bad_1.ini'}
253
253
  end
254
254
 
255
+ def test_initialize_from_string_without_ending_newline
256
+ content = "[section_one]\n foo=bar"
257
+ ini_file = IniFile.new(content)
258
+ assert ini_file.has_section?('section_one')
259
+ assert_equal 'bar', ini_file['section_one']['foo']
260
+ end
261
+
255
262
  def test_initialize_from_string
256
263
  content = File.read('test/data/good.ini')
257
264
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inifile
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-06 00:00:00.000000000 Z
12
+ date: 2012-09-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bones-git