Class: Sodium::Buffer::ZeroingDelegator
- Inherits:
-
Object
- Object
- Sodium::Buffer::ZeroingDelegator
show all
- Defined in:
- lib/sodium/buffer.rb
Instance Method Summary
collapse
Constructor Details
#initialize(string, &finalizer) ⇒ ZeroingDelegator
Returns a new instance of ZeroingDelegator.
207
208
209
210
211
212
213
214
215
216
217
|
# File 'lib/sodium/buffer.rb', line 207
def initialize(string, &finalizer)
Sodium::Buffer::ZeroingDelegator._mlock! string, string.bytesize
Sodium::Buffer::ZeroingDelegator._finalize! self, string, string.bytesize,
&finalizer
self.__setobj__(string)
self.__getobj__.freeze
self .freeze
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args, &block) ⇒ Object
237
238
239
240
241
242
243
244
245
|
# File 'lib/sodium/buffer.rb', line 237
def method_missing(*args, &block)
self.__getobj__.__send__(*args, &block)
ensure
$@.delete_if do |trace|
trace =~ %r{ \A #{Regexp.quote(__FILE__)}:#{__LINE__ - 5} : }x
end if $@
end
|
Instance Method Details
#to_s ⇒ Object
Also known as:
dup, clone
219
220
221
|
# File 'lib/sodium/buffer.rb', line 219
def to_s
self
end
|
#to_str ⇒ Object
223
224
225
226
227
228
229
230
|
# File 'lib/sodium/buffer.rb', line 223
def to_str
self.__getobj__.
tr('', '').
freeze
end
|