Module: FastBrowser::RustLib
- Extended by:
- FFI::Library, LibraryExtensions
- Defined in:
- lib/fast_browser.rb
Class Method Summary collapse
-
.call_and_free_string(method, *args) ⇒ Object
Sends the given method name (‘method`) to self, copies the returned string into a Ruby string and then calls `.free_string` to deallocate the original returned string.
- .parse_user_agent(string) ⇒ Object
Methods included from LibraryExtensions
attach_string_returning_function
Class Method Details
.call_and_free_string(method, *args) ⇒ Object
Sends the given method name (‘method`) to self, copies the returned string into a Ruby string and then calls `.free_string` to deallocate the original returned string.
34 35 36 37 38 |
# File 'lib/fast_browser.rb', line 34 def self.call_and_free_string method, *args string, ptr = send method, *args _free_string ptr string end |
.parse_user_agent(string) ⇒ Object
40 41 42 43 44 45 |
# File 'lib/fast_browser.rb', line 40 def self.parse_user_agent string FFI::AutoPointer.new( self._parse_user_agent(string), self.method(:_free_user_agent) ) end |