malloc 1.3.7 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Rakefile +1 -1
  2. data/lib/malloc_ext.rb +11 -0
  3. data/test/tc_malloc.rb +6 -0
  4. metadata +4 -4
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ require 'rake/loaders/makefile'
7
7
  require 'rbconfig'
8
8
 
9
9
  PKG_NAME = 'malloc'
10
- PKG_VERSION = '1.3.7'
10
+ PKG_VERSION = '1.4.0'
11
11
  CFG = RbConfig::CONFIG
12
12
  CXX = ENV[ 'CXX' ] || 'g++'
13
13
  RB_FILES = FileList[ 'lib/**/*.rb' ]
data/lib/malloc_ext.rb CHANGED
@@ -113,6 +113,17 @@ module Hornetseye
113
113
  inspect
114
114
  end
115
115
 
116
+ # Read complete data
117
+ #
118
+ # @example Export to string
119
+ # m = Malloc.new 3
120
+ # m.write 'abc'
121
+ # m.export
122
+ # "abc"
123
+ def export
124
+ read @size
125
+ end
126
+
116
127
  # Operator for doing pointer arithmetic
117
128
  #
118
129
  # @example Pointer arithmetic
data/test/tc_malloc.rb CHANGED
@@ -61,6 +61,12 @@ class TC_Malloc < Test::Unit::TestCase
61
61
  assert_raise( RuntimeError ) { m.write Malloc.new( 7 ) }
62
62
  end
63
63
 
64
+ def test_export
65
+ m = Malloc.new 3
66
+ m.write 'abc'
67
+ assert_equal 'abc', m.export
68
+ end
69
+
64
70
  def test_plus
65
71
  assert_raise( RuntimeError ) { Malloc.new( 2 ) + ( -1 ) }
66
72
  assert_nothing_raised { Malloc.new( 2 ) + 2 }
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 1
7
- - 3
8
- - 7
9
- version: 1.3.7
7
+ - 4
8
+ - 0
9
+ version: 1.4.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jan Wedekind
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-12 00:00:00 +00:00
17
+ date: 2010-12-30 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency