Permalink
Browse files

Working on documentation

  • Loading branch information...
1 parent 7fe7b38 commit c7b1e723ed34030599432e08cead6fe9af7c2b3c @wedesoft committed Nov 17, 2010
Showing with 12 additions and 16 deletions.
  1. +10 −0 README.md
  2. +2 −16 lib/malloc_ext.rb
View
@@ -25,5 +25,15 @@ Alternatively you can build and install the Ruby extension from source as follow
Usage
-----
+Simply run Interactive Ruby:
+
+ $ irb
+
+You can load the Ruby extension like this:
+
+ require 'rubygems'
+ require 'malloc'
+ include Hornetseye
+
See documentation of {Hornetseye::Malloc} on how to use this Ruby extension.
View
@@ -45,8 +45,6 @@ class << self
# Allocate the specified number of bytes of raw memory.
#
# @example Allocate raw memory
- # require 'malloc'
- # include Hornetseye
# m = Malloc.new 32
# # Malloc(32)
#
@@ -67,8 +65,6 @@ def new( size )
# Number of bytes allocated
#
# @example Querying size of allocated memory
- # require 'malloc'
- # include Hornetseye
# m = Malloc.new 32
# m.size
# # 32
@@ -81,8 +77,7 @@ def new( size )
# Display information about this object
#
# @example Displaying information about a Malloc object
- # require 'malloc'
- # Hornetseye::Malloc.new( 8 ).inspect
+ # Malloc.new( 8 ).inspect
# "Malloc(8)"
#
# @return [String] A string with information about this object.
@@ -110,8 +105,7 @@ def dup
# Display information about this object
#
# @example Displaying information about a Malloc object
- # require 'malloc'
- # Hornetseye::Malloc.new( 8 ).to_s
+ # Malloc.new( 8 ).to_s
# "Malloc(8)"
#
# @return [String] A string with information about this object.
@@ -122,8 +116,6 @@ def to_s
# Operator for doing pointer arithmetic
#
# @example Pointer arithmetic
- # require 'malloc'
- # include Hornetseye
# m = Malloc.new 4
# # Malloc(4)
# m.write 'abcd'
@@ -149,8 +141,6 @@ def +( offset )
# Read data from memory
#
# @example Reading and writing data
- # require 'malloc'
- # include Hornetseye
# m = Malloc.new 4
# # Malloc(4)
# m.write 'abcd'
@@ -173,8 +163,6 @@ def read( length )
# Write data to memory
#
# @example Reading and writing data
- # require 'malloc'
- # include Hornetseye
# m = Malloc.new 4
# # Malloc(4)
# m.write 'abcd'
@@ -208,8 +196,6 @@ def write( data )
# Shortcut for instantiating Malloc object
#
# @example Create malloc object
- # require 'malloc'
- # include Hornetseye
# m = Malloc 4
# # Malloc(4)
#

0 comments on commit c7b1e72

Please sign in to comment.