Class: OodCore::Job::Adapters::Torque::FFI::Attropl
- Inherits:
-
FFI::Struct
- Object
- FFI::Struct
- OodCore::Job::Adapters::Torque::FFI::Attropl
- Defined in:
- lib/ood_core/job/adapters/torque/ffi.rb
Overview
Struct for Attribute Operation C-linked list
Class Method Summary collapse
-
.from_list(list) ⇒ Attropl
Convert to C-linked list of structs from list of hashes.
Class Method Details
.from_list(list) ⇒ Attropl
Convert to C-linked list of structs from list of hashes
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
# File 'lib/ood_core/job/adapters/torque/ffi.rb', line 253 def self.from_list(list) list = list.map(&:to_h) attropl = nil prev = Attropl.new(::FFI::Pointer::NULL) list.each do |attrib| attropl = Attropl.new attropl[:name] = ::FFI::MemoryPointer.from_string attrib[:name].to_s attropl[:value] = ::FFI::MemoryPointer.from_string attrib[:value].to_s attropl[:resource] = ::FFI::MemoryPointer.from_string attrib[:resource].to_s attropl[:op] = (attrib[:op] || :eq).to_sym attropl[:next] = prev prev = attropl end attropl end |