eac_ruby_utils 0.91.0 → 0.92.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/eac_ruby_utils/bit_array.rb +4 -1
- data/lib/eac_ruby_utils/byte.rb +14 -2
- data/lib/eac_ruby_utils/byte_array.rb +1 -1
- data/lib/eac_ruby_utils/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d74824328749892433f50acfff8dd16d867abab61ab7115c55f4e3de45a8a8c
|
4
|
+
data.tar.gz: 04b5e0aa890040410a27a38597dc8d46758f406666ae90042bd0ff13fa0cdb60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 908be31eb44d2d44909f78f7ef5e3a7bb5bf7f5a731d6e0640604c83cf655ca8f49d854114abc9f1a72b3c918999bd651a6bcc78b2a885083d057331a0d4c4eb
|
7
|
+
data.tar.gz: 2bab742f8f453836e06bca57d3528fa442542c53aad1c22fdde7563dfb2d29ffa41ce35700c474b12e338be97cfe2990270882292eb102392868721c25023679
|
@@ -27,8 +27,11 @@ module EacRubyUtils
|
|
27
27
|
push(value)
|
28
28
|
end
|
29
29
|
|
30
|
+
# @return [EacRubyUtils::BitArray] +self+.
|
30
31
|
def push_array(other_bit_array)
|
31
|
-
|
32
|
+
values_array.push(*other_bit_array.to_a)
|
33
|
+
|
34
|
+
self
|
32
35
|
end
|
33
36
|
|
34
37
|
# @param value [EacRubyUtils::Bit]
|
data/lib/eac_ruby_utils/byte.rb
CHANGED
@@ -6,6 +6,7 @@ require 'eac_ruby_utils/patches/module/compare_by'
|
|
6
6
|
|
7
7
|
module EacRubyUtils
|
8
8
|
class Byte
|
9
|
+
ASSEMBLY_HEXADECIMAL_PREFIX = '$'
|
9
10
|
BIT_COUNT = 8
|
10
11
|
BIT_INDEX_RANGE = (0..7).freeze
|
11
12
|
VALUE_RANGE = (0..255).freeze
|
@@ -77,8 +78,9 @@ module EacRubyUtils
|
|
77
78
|
self.class.new(bit.zero? ? value & ~mask : value | mask)
|
78
79
|
end
|
79
80
|
|
80
|
-
|
81
|
-
|
81
|
+
# @return [EacRubyUtils::BitArray]
|
82
|
+
def to_bit_array(range = BIT_INDEX_RANGE)
|
83
|
+
::EacRubyUtils::BitArray.new(range.map { |bit_index| self[bit_index] })
|
82
84
|
end
|
83
85
|
|
84
86
|
# @return [Integer]
|
@@ -86,6 +88,16 @@ module EacRubyUtils
|
|
86
88
|
value
|
87
89
|
end
|
88
90
|
|
91
|
+
# @return [String]
|
92
|
+
def to_asm_hex
|
93
|
+
ASSEMBLY_HEXADECIMAL_PREFIX + to_hex
|
94
|
+
end
|
95
|
+
|
96
|
+
# @return [String]
|
97
|
+
def to_hex
|
98
|
+
value.to_s(16).upcase.rjust(2, '0')
|
99
|
+
end
|
100
|
+
|
89
101
|
private
|
90
102
|
|
91
103
|
attr_writer :value
|
@@ -5,7 +5,7 @@ require 'eac_ruby_utils/patches/module/compare_by'
|
|
5
5
|
|
6
6
|
module EacRubyUtils
|
7
7
|
class ByteArray
|
8
|
-
delegate :to_a, :size, :count, :length, :[], :fetch, to: :values_array
|
8
|
+
delegate :to_a, :size, :count, :length, :[], :fetch, :map, to: :values_array
|
9
9
|
compare_by :values_array
|
10
10
|
|
11
11
|
def initialize(values = [])
|