Class: GLib::Bytes
Overview
Overrides for GBytes, GLib’s immutable array of bytes.
Class Method Summary collapse
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(arr) ⇒ Bytes
constructor
A new instance of Bytes.
Constructor Details
#initialize(arr) ⇒ Bytes
Returns a new instance of Bytes.
25 26 27 28 |
# File 'lib/ffi-glib/bytes.rb', line 25 def initialize(arr) data = GirFFI::SizedArray.from :guint8, arr.size, arr store_pointer Lib.g_bytes_new data.to_ptr, data.size end |
Class Method Details
.from(obj) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ffi-glib/bytes.rb', line 14 def self.from(obj) case obj when self obj when FFI::Pointer wrap obj else new obj end end |
Instance Method Details
#each(&block) ⇒ Object
10 11 12 |
# File 'lib/ffi-glib/bytes.rb', line 10 def each(&block) data.each(&block) end |