Class: PyCall::Set

Inherits:
Object
  • Object
show all
Includes:
PyObjectWrapper
Defined in:
lib/pycall/set.rb

Constant Summary

Constants included from PyObjectWrapper

PyObjectWrapper::OPERATOR_METHOD_NAMES

Instance Attribute Summary

Attributes included from PyObjectWrapper

#__pyptr__

Instance Method Summary collapse

Methods included from PyObjectWrapper

#[], #[]=, #call, #coerce, #dup, extend_object, #inspect, #kind_of?, #method_missing, #respond_to_missing?, #to_f, #to_i, #to_s

Constructor Details

#initialize(pyobj) ⇒ Set

Returns a new instance of Set.



5
6
7
# File 'lib/pycall/set.rb', line 5

def initialize(pyobj)
  super(pyobj)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class PyCall::PyObjectWrapper

Instance Method Details

#include?(obj) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/pycall/set.rb', line 15

def include?(obj)
  1 == LibPython.PySet_Contains(__pyobj__, Conversions.from_ruby(obj))
end

#sizeObject Also known as: length



9
10
11
# File 'lib/pycall/set.rb', line 9

def size
  LibPython.PySet_Size(__pyobj__)
end