bithex 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: 4bf95c38d17be6a0a1a3c2f71935b82d1d5add9886950a0f46bea231bcb82b6c
4
- data.tar.gz: ad9055a08bcc1b54ed373ca56ae19ebbd90d71d9c956c9f4fc9d8d8d678f6f10
3
+ metadata.gz: 4fe743fb9d20b3f4dc702db5622b4c71f58ad09f1ce8e52d060b10f83d6becd8
4
+ data.tar.gz: '090a8a3ee36b65cb35a70e73932fa15447d02a334895f8161c9d859f4fabc7d3'
5
5
  SHA512:
6
- metadata.gz: 4273bf78339a029633f7d2904b371c094048b510dbff139245f6a8007fd3b404ec7f0d6a3ae29134049eb4512f7cf47ea0a65a9bede814983eeed8c5b3210f9a
7
- data.tar.gz: 120ad8343b393a0bc4af815ea1e8a3a3c0de73bb1b58f402cf15de89ffe9188fba8c45815bedc4ae76fd878c5d871456726989eb96debf0dfa657d99c4e04251
6
+ metadata.gz: 14a8fac6a3104f7dc9d557a592405e67d32b29176b7975e3fe7a8a180877e6f813d4c6017db966632a825275d0997dc90c6a2ce92079250c1af2d2b24de1428b
7
+ data.tar.gz: e9b65ceb8881f735cbae2d324bb6c1b92e3224e657ee6eb0e2c28cfbe30e9220b7e1c3cc09d26e9c0eac62950c14ecea5c7d36c72735fcec6b285aa72771b442
data/README.md CHANGED
@@ -49,7 +49,7 @@ upload.save
49
49
 
50
50
  ## Contributing
51
51
 
52
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bithex.
52
+ Bug reports and pull requests are welcome on GitHub at https://github.com/sharshenov/bithex.
53
53
 
54
54
  ## License
55
55
 
@@ -10,18 +10,26 @@ module Bithex
10
10
  validate_subtype
11
11
  end
12
12
 
13
+ def type
14
+ :bithex
15
+ end
16
+
13
17
  def deserialize(value)
14
18
  return if value.blank?
15
19
 
16
20
  format("%0#{hex_value_length}x", value.to_i(2))
17
21
  end
18
22
 
23
+ alias type_cast_from_database deserialize
24
+
19
25
  def serialize(value)
20
26
  return if value.blank?
21
27
 
22
- [value.to_s].pack('H*').unpack1('B*')
28
+ [value.to_s].pack('H*').unpack('B*')[0]
23
29
  end
24
30
 
31
+ alias type_cast_for_database serialize
32
+
25
33
  def assert_valid_value(value)
26
34
  return if value.blank?
27
35
 
@@ -43,7 +51,7 @@ module Bithex
43
51
  end
44
52
 
45
53
  def validate_format(value)
46
- return if value.match?(/\h+/)
54
+ return if value =~ /\h+/
47
55
 
48
56
  raise ArgumentError,
49
57
  "Expected '#{value}' to be a hex string"
@@ -1,3 +1,3 @@
1
1
  module Bithex
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bithex
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
  - Rustam Sharshenov