bin_struct 0.2.0 → 0.2.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: 5a90f75409d497521af8957e89577a4e8b7c14211e5343aa9126a71ef413d759
4
- data.tar.gz: b07e2bf73d2cb1f4b7be4340944cd52df4382fc94f171607357adf10ddc7a914
3
+ metadata.gz: df710325cf6aa4414fc997d77033b8bea34d4dc80e571ceb184462b2aa047eb3
4
+ data.tar.gz: aa372402e27bc5b254b7e4e82cb7d9b2178823c84adc3c1bda17bba7806ff05e
5
5
  SHA512:
6
- metadata.gz: 6acd7aeb0516bf6692ae5971aecb10c8ae685936f24302d909ff16f055118a68588876409819d0ba966e4f3a7b524b194e58713bfb0ccaef95eb542fca221bb3
7
- data.tar.gz: 790bf0b81cef084c030e0412731e3b0b852815fa1f66f5d28564278579e12b7e3fd3ef3674c6f36dd32bc792e1c248f7f20b3f65f505d3193f370b2d8c6f1d88
6
+ metadata.gz: 6ef8207d1fc62509bda66a0caa779ec2b6b95e2a7805fb10199423bcf1300a7f05dd5c5b595f33f8b6605b93277e485a5a18f80a83b7c6954339eea0541f6073
7
+ data.tar.gz: b47f00bd2497c5330eeb6a01721b3cbd4a305d624e6df7dce2fd13b8f996c61e287ab92df393ea0fcb67fece0396497354220e9a56cb50bf617fa0d9b3ccdaff
data/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
3
3
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
4
4
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
5
 
6
+ ## 0.2.1 - 2024-11-25
7
+
8
+ ### Added
9
+
10
+ - `CString` and `String` initializers now accepts `:value` option to set string initial value.
11
+
12
+ ### Changed
13
+
14
+ - `IntString` initializer option `:string` is renamed into `:value`.
15
+
6
16
  ## 0.2.0 - 2024-07-21
7
17
 
8
18
  ### Changed
data/README.md CHANGED
@@ -1,3 +1,6 @@
1
+ [![Gem Version](https://badge.fury.io/rb/bin_struct.svg)](https://badge.fury.io/rb/bin_struct)
2
+ [![Specs](https://github.com/lemontree55/bin_struct/actions/workflows/main.yml/badge.svg)](https://github.com/lemontree55/bin_struct/actions/workflows/main.yml)
3
+
1
4
  # BinStruct
2
5
 
3
6
  BinStruct provides a simple way to create and dissect binary data. It is an extraction from [PacketGen](https://github.com/lemontree55/packetgen) 3.x Fields.
@@ -6,9 +9,12 @@ BinStruct provides a simple way to create and dissect binary data. It is an extr
6
9
 
7
10
  Installation using RubyGems is easy:
8
11
 
9
- $ gem install bin_struct
12
+ ```shell
13
+ gem install bin_struct
14
+ ```
10
15
 
11
16
  Or add it to a Gemfile:
17
+
12
18
  ```ruby
13
19
  gem 'bin_struct'
14
20
  ```
@@ -76,8 +76,9 @@ module BinStruct
76
76
 
77
77
  # @param [Hash] options
78
78
  # @option options [Integer] :static_length set a static length for this string
79
+ # @option options [::String] :value string value (default to +''+)
79
80
  def initialize(options = {})
80
- register_internal_string(+'')
81
+ register_internal_string(options[:value] || +'')
81
82
  @static_length = options[:static_length]
82
83
  end
83
84
 
@@ -20,9 +20,9 @@ module BinStruct
20
20
 
21
21
  # @param [Hash] options
22
22
  # @option options [Class] :length_type should be a {Int} subclass. Default to {Int8}.
23
- # @option options [::String] :string String value. Default to +""+
23
+ # @option options [::String] :value String value. Default to +""+
24
24
  def initialize(options = {})
25
- @string = BinStruct::String.new.read(options[:string] || '')
25
+ @string = BinStruct::String.new.read(options[:value] || +'')
26
26
  @length = (options[:length_type] || Int8).new
27
27
  calc_length
28
28
  end
@@ -32,8 +32,9 @@ module BinStruct
32
32
  # @option options [Int,Proc] :length_from object or proc from which
33
33
  # takes length when reading
34
34
  # @option options [Integer] :static_length set a static length for this string
35
+ # @option options [::String] :value string value (default to +''+)
35
36
  def initialize(options = {})
36
- register_internal_string(+'')
37
+ register_internal_string(options[:value] || +'')
37
38
  initialize_length_from(options)
38
39
  @static_length = options[:static_length]
39
40
  end
@@ -8,5 +8,5 @@
8
8
 
9
9
  module BinStruct
10
10
  # BinStruct version
11
- VERSION = '0.2.0'
11
+ VERSION = '0.2.1'
12
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bin_struct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - LemonTree55
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-21 00:00:00.000000000 Z
11
+ date: 2024-11-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'BinStruct is a binary dissector and generator. It eases manipulating
14
14
  complex binary data.