Class: PyCall::LibPython::PyMethodDef

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/pycall/libpython/pytypeobject_struct.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ PyMethodDef

Returns a new instance of PyMethodDef.



75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/pycall/libpython/pytypeobject_struct.rb', line 75

def initialize(*args)
  case args.length
  when 3, 4
    name, meth, flags, doc = *args
    super()
    self.ml_name = name
    self[:ml_meth] = meth
    self[:ml_flags] = flags
    self.ml_doc = doc
  else
    super
  end
end

Instance Method Details

#ml_doc=(str) ⇒ Object



94
95
96
97
# File 'lib/pycall/libpython/pytypeobject_struct.rb', line 94

def ml_doc=(str)
  @saved_doc = FFI::MemoryPointer.from_string(str || '')
  self.pointer.put_pointer(offset_of(:ml_name), @saved_doc)
end

#ml_name=(str) ⇒ Object



89
90
91
92
# File 'lib/pycall/libpython/pytypeobject_struct.rb', line 89

def ml_name=(str)
  @saved_name = FFI::MemoryPointer.from_string(str || '')
  self.pointer.put_pointer(offset_of(:ml_name), @saved_name)
end