bindata 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bindata might be problematic. Click here for more details.

data/ChangeLog CHANGED
@@ -1,5 +1,9 @@
1
1
  = BinData Changelog
2
2
 
3
+ == Version 1.4.2 (2011-08-06)
4
+
5
+ * =~ now works for strings.
6
+
3
7
  == Version 1.4.1 (2011-06-20)
4
8
 
5
9
  * Added :default option for Choices.
@@ -32,5 +32,5 @@ require 'bindata/deprecated'
32
32
  #
33
33
  # Copyright (c) 2007 - 2011 Dion Mendel.
34
34
  module BinData
35
- VERSION = "1.4.1"
35
+ VERSION = "1.4.2"
36
36
  end
@@ -214,6 +214,11 @@ module BinData
214
214
  pp.pp(snapshot)
215
215
  end
216
216
 
217
+ # Override and delegate =~ as it is defined in Object.
218
+ def =~(other)
219
+ snapshot =~ other
220
+ end
221
+
217
222
  # Returns a user friendly name of this object for debugging purposes.
218
223
  def debug_name
219
224
  if @parent
data/manual.md CHANGED
@@ -40,7 +40,7 @@ manipulating.
40
40
  It supports all the common datatypes that are found in structured binary
41
41
  data. Support for dependent and variable length fields is built in.
42
42
 
43
- Last updated: 2011-06-20
43
+ Last updated: 2011-08-06
44
44
 
45
45
  ## License
46
46
 
@@ -36,6 +36,18 @@ describe BinData::String, "when assigning" do
36
36
  end
37
37
  end
38
38
 
39
+ describe BinData::String do
40
+ subject { BinData::String.new("testing") }
41
+
42
+ it "should compare with regexp" do
43
+ (/es/ =~ subject).should == 1
44
+ end
45
+
46
+ it "should compare with regexp" do
47
+ (subject =~ /es/).should == 1
48
+ end
49
+ end
50
+
39
51
  describe BinData::String, "with :read_length" do
40
52
  subject { BinData::String.new(:read_length => 5) }
41
53
 
@@ -342,3 +342,23 @@ describe BinData::Record, "with custom sized integers" do
342
342
  end
343
343
  end
344
344
 
345
+ describe BinData::Primitive, "representing a string" do
346
+ class PascalStringPrimitive < BinData::Primitive
347
+ uint8 :len, :value => lambda { data.length }
348
+ string :data, :read_length => :len
349
+
350
+ def get; self.data; end
351
+ def set(v) self.data = v; end
352
+ end
353
+
354
+ subject { PascalStringPrimitive.new("testing") }
355
+
356
+ it "should compare to regexp" do
357
+ (subject =~ /es/).should == 1
358
+ end
359
+
360
+ it "should compare to regexp" do
361
+ (/es/ =~ subject).should == 1
362
+ end
363
+ end
364
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bindata
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 4
9
- - 1
10
- version: 1.4.1
9
+ - 2
10
+ version: 1.4.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dion Mendel
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-20 00:00:00 +08:00
18
+ date: 2011-08-06 00:00:00 +08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency