Method: Corosync::CMAP#set
- Defined in:
- lib/corosync/cmap.rb
#set(name, type, value) ⇒ Number, String
Set a key to the specified type & value. This will create the key if it doesn’t exist, and will otherwise modify it, including changing the type if it doesn’t match.
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/corosync/cmap.rb', line 126 def set(name, type, value) # get byte size if type == :string then size = value.bytesize elsif SIZEMAP.keys.include?(type) then size = SIZEMAP[type].bytes elsif type == :float then size = 4 elsif type == :double then size = 8 elsif type == :binary then size = value.bytesize end value_ptr = FFI::MemoryPointer.new(size) value_ptr.write_type(type, value) Corosync.cs_send(:cmap_set, @handle, name, value_ptr, size, type) value end |