Class: CF::Data
Overview
Wrapper for CFData
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
-
.from_string(s) ⇒ CF::Data
Creates a CFData from a ruby string.
Instance Method Summary collapse
-
#size ⇒ Integer
The size in bytes of the CFData.
-
#to_s ⇒ String
(also: #to_ruby)
Creates a ruby string from the wrapped data.
Methods inherited from Base
check_cftype, #eql?, #equals?, finalize, #hash, #initialize, #null?, #to_cf, typecast
Methods included from Memory
#inspect, #release, #retain, #to_ptr
Methods included from Register
Constructor Details
This class inherits a constructor from CF::Base
Class Method Details
Instance Method Details
#size ⇒ Integer
The size in bytes of the CFData
31 32 33 |
# File 'lib/corefoundation/data.rb', line 31 def size CF.CFDataGetLength(self) end |
#to_s ⇒ String Also known as: to_ruby
Creates a ruby string from the wrapped data. The encoding will always be ASCII_8BIT
24 25 26 27 |
# File 'lib/corefoundation/data.rb', line 24 def to_s ptr = CF.CFDataGetBytePtr(self) ptr.read_string(CF.CFDataGetLength(self)).force_encoding(Encoding::ASCII_8BIT) end |