packable 1.3.12 → 1.3.13
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 +4 -4
- data/README.rdoc +1 -2
- data/lib/packable/extensions/io.rb +3 -7
- data/lib/packable/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1bd805026140ccad5845e20b2ff64e243e2f8884fdb3cb640d98d7e8019e0a5
|
4
|
+
data.tar.gz: cfa942ab0edee1ea3e527672dfc5a4a378a575b583995df1867afa2693c524d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b3252d9dc47e15c925a33551f6e5fca3b146ebb8a872310e3e0e10c9172695da7f31eae7e605ef048079dba1485ff55bc9b20a28868f710ee2be4f732e3c8c4
|
7
|
+
data.tar.gz: 12fc57813c4d17964bd9ee74a9a61bdcf6fcdeab1bf7761e4695af184b15241093a0a1632a12b1801fcd4cb247814de18c0e8700117115aa18d64dc253a14dd0
|
data/README.rdoc
CHANGED
@@ -53,7 +53,6 @@ That's it! Simply <tt>require 'packable'</tt> in your code to use it.
|
|
53
53
|
== Compatibility
|
54
54
|
|
55
55
|
Designed to work with ruby 1.8 & 1.9.
|
56
|
-
If using with ruby 2.5 and higher be sure not to pass `Hash` and `Symbol` arguments to `write` unless you want it to be packed.
|
57
56
|
|
58
57
|
= Documentation
|
59
58
|
|
@@ -164,7 +163,7 @@ This is to insure compatibility with the usual behavior of IO objects:
|
|
164
163
|
|
165
164
|
We "cheated" in the previous example; instead of writing <tt>io.packed.write(...)</tt> we used the shorter form.
|
166
165
|
This works because we're passing more than one argument; for only one argument we must call <tt>io.packed.write(66)</tt>
|
167
|
-
less the usual +write+ method is called.
|
166
|
+
less the usual +write+ method is called.
|
168
167
|
|
169
168
|
Since the standard library desn't define the <tt>>></tt> operator for IO objects, we are free to use either <tt>io.packed</tt> or <tt>io</tt> directly.
|
170
169
|
Note that reading one value only will return that value directly, not an array containing that value:
|
@@ -53,21 +53,17 @@ module Packable
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def each_with_packing(*options, &block)
|
56
|
-
return each_without_packing(*options, &block) if options.empty? || (Integer === options.first) || (String === options.first)
|
56
|
+
return each_without_packing(*options, &block) if options.empty? || (Integer === options.first) || (String === options.first) || tty?
|
57
57
|
return Enumerator.new(self, :each_with_packing, *options) unless block_given?
|
58
58
|
yield read(*options) until eof?
|
59
59
|
end
|
60
60
|
|
61
61
|
def write_with_packing(*arg)
|
62
|
-
|
63
|
-
pack_and_write(*arg)
|
64
|
-
else
|
65
|
-
write_without_packing(*arg)
|
66
|
-
end
|
62
|
+
(arg.length <= 1 || tty?) ? write_without_packing(*arg) : pack_and_write(*arg)
|
67
63
|
end
|
68
64
|
|
69
65
|
def read_with_packing(*arg)
|
70
|
-
return read_without_packing(*arg) if arg.empty? || arg.first.nil? || arg.first.is_a?(Numeric)
|
66
|
+
return read_without_packing(*arg) if arg.empty? || arg.first.nil? || arg.first.is_a?(Numeric) || tty?
|
71
67
|
values = Packable::Packers.to_class_option_list(*arg).map do |klass, options, original|
|
72
68
|
if options[:read_packed]
|
73
69
|
options[:read_packed].call(self)
|
data/lib/packable/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: packable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marc-André Lafortune
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backports
|