lib/bindata/deprecated.rb in bindata-1.8.2 vs lib/bindata/deprecated.rb in bindata-1.8.3

- old
+ new

@@ -18,16 +18,16 @@ module BinData class Base # Don't override initialize. If you are defining a new kind of datatype # (list, array, choice etc) then put your initialization code in - # #initialize_instance. This is because BinData objects can be initialized - # as prototypes and your initialization code may not be called. + # #initialize_instance. BinData objects might be initialized as prototypes + # and your initialization code may not be called. # # If you're subclassing BinData::Record, you are definitely doing the wrong # thing. Read the documentation on how to use BinData. - # http://bindata.rubyforge.org/manual.html#records + # http://github.com/dmendel/bindata/wiki/Records alias_method :initialize_without_warning, :initialize def initialize_with_warning(*args) owner = method(:initialize).owner if owner != BinData::Base msg = "Don't override #initialize on #{owner}." @@ -44,7 +44,13 @@ unless args.empty? fail "#{caller[0]} remove the call to super in #initialize_instance" end end + # #offset has been renamed to #abs_offset. + # Eventually #rel_offset will be renamed to #offset. + def offset + warn "#offset is deprecated in #{debug_name}. Use #abs_offset instead" + abs_offset + end end end