fossyl 0.5.1 → 0.6.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 547c155930215a26faddf0e942dc683202e2eaa6
4
- data.tar.gz: 997cc04b1841743ca4cd91de377aa76144b7dc6c
3
+ metadata.gz: c9848e6cce91e36c09ea8d32a5a353001c37da61
4
+ data.tar.gz: 401e7936d48e3846c2ef89e5e08e1e955a094fc4
5
5
  SHA512:
6
- metadata.gz: 7e2b0ede55b2479efa2ba98b2eae6b97ea2fc916c50960abc8b3e06a9f337d9fb08c29bc27d677a6f2800deedba5709741342f8e313553f0a20bc846eea1be1e
7
- data.tar.gz: 3b4e9e5acd719b8b8768915ab9ee58d62def84b3a9573bda48e5accbc3f625c8ee40a66b753c9f36e5928c4a7af829990c01404dd3aab65f16ac83e831eca40b
6
+ metadata.gz: 5ccd47a82e527d62aefa34a45301a1b8fdab06476a3775c7324f45cb0e60b7a8d9d852d215466d4cc3426ffafa85797b82512fd2177012fac82898291522beec
7
+ data.tar.gz: f7af4d4a373716c0ee5fef8554cbc6405792c63281351db24781bc9f9be4742f28f6421d59f6e1ed832b0d61e492ddd36267b7d85d517a8102572368b08c1255
data/.travis.yml CHANGED
@@ -1,5 +1,3 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.3
4
- - jruby-19mode # JRuby in 1.9 mode
5
- - rbx-19mode
3
+ - 2.0.0
data/README.md CHANGED
@@ -22,13 +22,13 @@ Or install it yourself as:
22
22
  require "fossyl"
23
23
 
24
24
  # Encoding
25
- Fossyl.dump("strings") # => "7:strings"
25
+ Fossyl.dump("bytes") # => "5:bytes"
26
26
  Fossyl.dump(12) # => "i12e"
27
27
  Fossyl.dump([1, "two", 3]) # => "li1e3:twoi3ee"
28
28
  Fossyl.dump(a: 1, b: "two", c: [1]) # => "d1:ai1e1:b3:two1:cli1eee"
29
29
 
30
30
  # Decoding
31
- Fossyl.load("7:strings") # => "strings"
31
+ Fossyl.load("5:bytes") # => "bytes"
32
32
  Fossyl.load("i12e") # => 12
33
33
  Fossyl.load("li1e3:twoi3ee") # => [1, "two", 3]
34
34
  Fossyl.load("d1:ai1e1:b3:two1:cli1eee") # => { "a" => 1, "b" => "two", "c" => [1] }
@@ -36,9 +36,7 @@ Fossyl.load("d1:ai1e1:b3:two1:cli1eee") # => { "a" => 1, "b" => "two", "c" => [1
36
36
 
37
37
  ## Supported Platforms
38
38
 
39
- * Ruby 1.9.3
40
- * JRuby _(1.9 mode)_
41
- * Rubinius _(1.9 mode)_
39
+ * Ruby 2.0.x
42
40
 
43
41
  ## Contributing
44
42
 
data/fossyl.gemspec CHANGED
@@ -1,10 +1,10 @@
1
1
  # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
2
+ lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = "fossyl"
7
- gem.version = "0.5.1"
7
+ gem.version = "0.6.0"
8
8
  gem.authors = ["Adam Tanner"]
9
9
  gem.email = ["adam@adamtanner.org"]
10
10
  gem.description = %q{Pre-historic Bencoding}
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
13
13
 
14
14
  gem.files = `git ls-files`.split($/)
15
15
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
16
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
16
+ gem.test_files = gem.files.grep(%r{^spec/})
17
17
  gem.require_paths = ["lib"]
18
18
 
19
19
  gem.add_development_dependency "rake"
data/lib/fossyl/parser.rb CHANGED
@@ -8,7 +8,7 @@ class Fossyl::Parser
8
8
  end
9
9
 
10
10
  def parse
11
- return parse_string if scanner.scan(/\d+/)
11
+ return parse_bytes if scanner.scan(/\d+/)
12
12
  return parse_integer if scanner.scan(/i/)
13
13
  return parse_list if scanner.scan(/l/)
14
14
  return parse_dictionary if scanner.scan(/d/)
@@ -17,10 +17,10 @@ class Fossyl::Parser
17
17
  end
18
18
 
19
19
  private
20
- def parse_string
20
+ def parse_bytes
21
21
  length = scanner.matched.to_i
22
- scanner.getch # Skip the ':'
23
- length.times.map { scanner.getch }.join
22
+ scanner.get_byte # Skip the ':'
23
+ length.times.map { scanner.get_byte }.join
24
24
  end
25
25
 
26
26
  def parse_integer
data/lib/fossyl.rb CHANGED
@@ -17,7 +17,7 @@ module Fossyl
17
17
  end
18
18
 
19
19
  def self.load(string)
20
- Fossyl::Parser.new(string).parse
20
+ Fossyl::Parser.new(string.b).parse
21
21
  end
22
22
  end
23
23
 
data/spec/fossyl_spec.rb CHANGED
@@ -3,8 +3,8 @@ require "minitest/autorun"
3
3
  require "fossyl"
4
4
 
5
5
  describe Fossyl do
6
- it "encodes strings" do
7
- Fossyl.dump("Fossyl").must_equal("6:Fossyl")
6
+ it "encodes bytes" do
7
+ Fossyl.dump("Fossyl\x9B").must_equal("7:Fossyl\x9B")
8
8
  end
9
9
 
10
10
  it "encodes integers" do
@@ -22,8 +22,8 @@ describe Fossyl do
22
22
  Fossyl.dump(string: "Fossyl", integer: -12, list: [0, 12]).must_equal("d7:integeri-12e4:listli0ei12ee6:string6:Fossyle")
23
23
  end
24
24
 
25
- it "decodes strings" do
26
- Fossyl.load("6:Fossyl").must_equal("Fossyl")
25
+ it "decodes bytes" do
26
+ Fossyl.load("7:Fossyl\x9B").must_equal("Fossyl\x9B".b)
27
27
  end
28
28
 
29
29
  it "decodes integers" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fossyl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Tanner