Skip to content

Commit 6ae1ba6

Browse files
committed
hate the .md
1 parent 430e8ba commit 6ae1ba6

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

README.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,27 @@ This is a simple rubygem wrapper for the class written by Peter Cooper and poste
1313
Basic, pure Ruby bit array. Pretty fast (for what it is) and memory efficient.
1414
Works well for Bloom filters (the reason I wrote it).
1515

16-
Create a bit array 1000 bits wide
16+
Create a bit array 1000 bits wide:
17+
1718
```ruby
1819
ba = BitArray.new(1000)
1920
```
2021

21-
Setting and reading bits
22+
Setting and reading bits:
23+
2224
```ruby
23-
ba[100] = 1
24-
ba[100] .. => 1
25-
ba[100] = 0
25+
ba[100] = 1
26+
ba[100] .. => 1
27+
ba[100] = 0
2628
```
2729

28-
More
30+
More:
31+
2932
```ruby
30-
ba = BitArray.new(20)
31-
[1,3,5,9,11,13,15].each { |i| ba[i] = 1 }
32-
ba.to_s
33-
#=> "01010100010101010000"
34-
ba.total_set
35-
#=> 7
33+
ba = BitArray.new(20)
34+
[1,3,5,9,11,13,15].each { |i| ba[i] = 1 }
35+
ba.to_s
36+
#=> "01010100010101010000"
37+
ba.total_set
38+
#=> 7
3639
```

0 commit comments

Comments
 (0)