Class: FFI::Struct
- Inherits:
-
Object
- Object
- FFI::Struct
- Defined in:
- lib/snarl.rb
Overview
Snarl (www.fullphat.net/snarl.html) is a simple notification system, similar to Growl under OSX. This is a simple pure Ruby wrapper to the native API.
Direct Known Subclasses
Snarl::SnarlAPI::CopyDataStruct, Snarl::SnarlAPI::SnarlStruct, Snarl::SnarlAPI::SnarlStructEx
Instance Method Summary collapse
-
#copy_chars(to_field, string) ⇒ Object
ltodo add to ez.
-
#method_missing(*args) ⇒ Object
like a.value = “b”.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args) ⇒ Object
like a.value = “b”
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/snarl.rb', line 28 def method_missing(*args) # like a.value = "b" name = args[0].to_s value = args[1] if name[-1..-1] == '=' name = name[0..-2].to_sym self[name] = value else self[name] # like a.value end end |
Instance Method Details
#copy_chars(to_field, string) ⇒ Object
ltodo add to ez
18 19 20 21 22 23 24 25 26 |
# File 'lib/snarl.rb', line 18 def copy_chars(to_field, string) i = 0 string.each_byte{|b| self[to_field][i] = string[i].ord i += 1 } self[to_field][string.length] = 0 # todo assert we don't tramp :) end |