binaryparse 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/blocker.rb +11 -1
  2. metadata +2 -2
data/lib/blocker.rb CHANGED
@@ -345,7 +345,17 @@ module BinaryBlocker
345
345
  @value.all? { |o| o.deblock(io) }
346
346
  end
347
347
  end
348
-
348
+
349
+ def to_h
350
+ result = {}
351
+ @lookup.each_pair do |key, index|
352
+ value = @value[index].value
353
+ value = value.to_h if value.respond_to? :to_h
354
+ result[key] = value
355
+ end
356
+ result
357
+ end
358
+
349
359
  def method_missing(sym, *args)
350
360
  super unless @lookup
351
361
  if pos = @lookup[sym]
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: binaryparse
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.2.6
7
- date: 2006-12-08 00:00:00 -05:00
6
+ version: 0.2.7
7
+ date: 2006-12-13 00:00:00 -05:00
8
8
  summary: Binaryparse is a simple Ruby DSL to parse semi-complicated binary structures. This includes structures dynamic in length, which cannot be handled by DL::Struct or BitStructEx.
9
9
  require_paths:
10
10
  - lib