nstrct 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -2
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/nstrct/instruction.rb +3 -3
- data/lib/nstrct/version.rb +1 -1
- data/spec/protocol_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07a1b9cf6f2bd4ee746fbcc14a5cd00fc1b77943
|
4
|
+
data.tar.gz: 84587496b57c398bf6095d21dd00e8e4a265a709
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 181ae7887ac173d4f3b597010ed27ba11b028452746de2257053728c511c4eef69c6814f97c289b0230af08773b3ae04fbf382dfb20b2d4ee126eef33d3fb02c
|
7
|
+
data.tar.gz: e316f75f821c6137706eebb8de7663fd813986027f36fcc5684a9c58240f9754f911772e52aebb79723a107239322ac22269c74f7ca933f58d0bf8d626b4b9b8
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -27,7 +27,7 @@ bytes = instruction.pack
|
|
27
27
|
A more complex example:
|
28
28
|
|
29
29
|
```ruby
|
30
|
-
instruction = Nstrct::Instruction.build_instruction(232, [:boolean, true], [:int8, 2], [:float32, 1.0], [
|
30
|
+
instruction = Nstrct::Instruction.build_instruction(232, [:boolean, true], [:int8, 2], [:float32, 1.0], [:uint16, [54, 23, 1973]])
|
31
31
|
instruction.pack
|
32
32
|
```
|
33
33
|
|
data/lib/nstrct/instruction.rb
CHANGED
@@ -18,12 +18,12 @@ module Nstrct
|
|
18
18
|
|
19
19
|
# Build an instruction for a code and some arguments.
|
20
20
|
#
|
21
|
-
# Message.build_instruction 54, [
|
21
|
+
# Message.build_instruction 54, [:int8, [7, 8, 9]]
|
22
22
|
#
|
23
23
|
def self.build(code, *args)
|
24
24
|
arguments = args.map do |arg|
|
25
|
-
if arg[
|
26
|
-
Nstrct::Argument.new(arg[0]
|
25
|
+
if arg[1].is_a?(Array)
|
26
|
+
Nstrct::Argument.new(arg[0], arg[1], true)
|
27
27
|
else
|
28
28
|
Nstrct::Argument.new(arg[0], arg[1], false)
|
29
29
|
end
|
data/lib/nstrct/version.rb
CHANGED
data/spec/protocol_spec.rb
CHANGED
@@ -31,7 +31,7 @@ describe Nstrct::Instruction do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'should pack and unpack an instructionw with arguments' do
|
34
|
-
instruction1 = Nstrct::Instruction.build(232, [:float32, 1.0 ], [
|
34
|
+
instruction1 = Nstrct::Instruction.build(232, [:float32, 1.0 ], [:boolean, []], [:boolean, true], [:int8, 2], [:float32, 1.0], [:uint16, [54, 23, 1973]])
|
35
35
|
instruction2 = Nstrct::Instruction.parse(instruction1.pack)
|
36
36
|
expect(instruction1.inspect).to eq(instruction2.inspect)
|
37
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nstrct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joël Gähwiler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: digest-crc
|