tinycode 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 07affc4666974e192c3359925596623e35d4674732c10a3db1563f9ff487b331
4
- data.tar.gz: 82bb76504b5f0e22eec2607150732a53d888f4e509539ca289f98eadb8ebdf95
3
+ metadata.gz: 3438fb3aab3c2d58592ed6c9bc1f63f37e98effbecb60a67f110d4306a3822aa
4
+ data.tar.gz: 65b47a8b537de5b3e40b6c0dfd7efd5789135e2ae71d463df1e372cc697eb436
5
5
  SHA512:
6
- metadata.gz: 220eaf04d0307e8ccdc8914511ffe4d6a8a6276ba82d5f2e9fbfc1347167f9d164657d6bb6cf2d8113ae4d413725024aec82863658fe79af004bf3583b474a6c
7
- data.tar.gz: 225c34e6887baf7973fd275c7c8ac6e2f68826c1ad6afee1aa94abcf1512f26e9aa061fe0b10f1dcaf3e497752e0fb6b028f00f24ae44c626224e4c87596547c
6
+ metadata.gz: 2214f092bbbc76b3daa8f694a2ddf04556ae80a5627cb80e0060ad25b842ad431c948a828e1d0f0dcb29ab1a3dc8171e3f8ca81a4c9f1f66b3495074dfd126fd
7
+ data.tar.gz: b9824631c29c06ec9fd66b1e127f9a3c35c5956ee4514758c07b3290317a253609a36d73201795686ea419fb0a86444ed043e353d3397d2ecf279435a40c4d3a
data/.rubocop.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  require: rubocop-rspec
2
2
 
3
3
  AllCops:
4
- TargetRubyVersion: 3.0.0
4
+ TargetRubyVersion: 2.6.0
5
5
  NewCops: enable
6
6
 
7
7
  Layout/ArgumentAlignment:
data/.yardopts ADDED
@@ -0,0 +1,2 @@
1
+ lib/**/*.rb -
2
+ README.md LICENSE
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tinycode (0.1.0)
4
+ tinycode (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Tinycode
2
2
 
3
- This gem provides an encoder and decoder for tinycode, which is a bencode like
3
+ This gem provides an encoder and decoder for tinycode, which is a [Bencode] like
4
4
  encoding that supports more data-types and slightly smaller encoded sizes.
5
5
 
6
6
  The encoder supports arrays, hashes, strings, symbols, and integers, as well as
@@ -9,13 +9,13 @@ specialized fixed-width integers: `Tinycode::U8`, `Tinycode::U16`,
9
9
  Like [YAML] but unlike [JSON], this encoder maintains a distinction between
10
10
  strings and symbols.
11
11
 
12
- The encoding is inspired by [BEncode]'s tag-length-value construction for strings, which eliminates the need for escaping in Strings.
12
+ The encoding is inspired by Bencode's tag-length-value construction for strings, which eliminates the need for escaping in Strings.
13
13
  This makes this encoding particularly appropriate for serializing binary strings
14
14
  directly.
15
15
 
16
16
  [YAML]: https://ruby-doc.org/stdlib-3.0.2/libdoc/yaml/rdoc/YAML.html
17
17
  [JSON]: https://ruby-doc.org/stdlib-3.0.2/libdoc/json/rdoc/JSON.html
18
- [BEncode]: https://en.wikipedia.org/wiki/Bencode
18
+ [Bencode]: https://en.wikipedia.org/wiki/Bencode
19
19
 
20
20
  ## Demo
21
21
 
data/Rakefile CHANGED
@@ -16,4 +16,4 @@ task :watch do
16
16
  sh 'rerun -p "{**/*.{rb,gemspec},exe/**/*,Gemfile*,Rakefile}" -x rake yard spec lint:auto_correct'
17
17
  end
18
18
 
19
- task default: [:yard, :spec, :lint]
19
+ task default: [:spec, :lint]
@@ -28,7 +28,7 @@ module Tinycode
28
28
  end
29
29
 
30
30
  def load(tinycode)
31
- raise ArgumentError, "Cannot convert #{Tinycode.class} to String" if !tinycode.respond_to?(:to_str)
31
+ raise ArgumentError, "Cannot convert #{tinycode.class} to String" if !tinycode.respond_to?(:to_str)
32
32
 
33
33
  tinycode = tinycode.to_str.b
34
34
  struct, length = load_with_length(tinycode)
@@ -102,7 +102,7 @@ module Tinycode
102
102
 
103
103
  def load_id(tinycode)
104
104
  length = tinycode.index(/[':]/)
105
- value = tinycode[...length]
105
+ value = tinycode[0...length]
106
106
  value = if tinycode[length] == ':'
107
107
  value.to_sym
108
108
  else
@@ -117,7 +117,7 @@ module Tinycode
117
117
  end
118
118
 
119
119
  def dump_symbol(sym)
120
- dump_string(sym.name, code: ':')
120
+ dump_string(sym.to_s, code: ':')
121
121
  end
122
122
 
123
123
  def load_symbol(sym)
@@ -150,7 +150,7 @@ module Tinycode
150
150
 
151
151
  def load_varint(tinycode)
152
152
  length = tinycode.each_byte.lazy.take_while {|b| b > 0x7F }.count + 1
153
- [tinycode[...length].unpack1('w'), length]
153
+ [tinycode[0...length].unpack1('w'), length]
154
154
  end
155
155
 
156
156
  def load_boolean(tinycode)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tinycode
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
data/tinycode.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.executables = spec.files.grep(%r{\Aexe/}) {|f| File.basename(f) }
30
30
  spec.require_paths = ['lib']
31
31
 
32
- spec.required_ruby_version = '>= 3.0.0'
32
+ spec.required_ruby_version = '>= 2.6.0'
33
33
 
34
34
  spec.add_development_dependency 'rake', '~> 13.0'
35
35
  spec.add_development_dependency 'rerun', '~> 0.13'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tinycode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Gittemeier
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-21 00:00:00.000000000 Z
11
+ date: 2021-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -132,6 +132,7 @@ extra_rdoc_files: []
132
132
  files:
133
133
  - ".rspec"
134
134
  - ".rubocop.yml"
135
+ - ".yardopts"
135
136
  - Gemfile
136
137
  - Gemfile.lock
137
138
  - LICENSE
@@ -159,7 +160,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
159
160
  requirements:
160
161
  - - ">="
161
162
  - !ruby/object:Gem::Version
162
- version: 3.0.0
163
+ version: 2.6.0
163
164
  required_rubygems_version: !ruby/object:Gem::Requirement
164
165
  requirements:
165
166
  - - ">="