Sha256: 1aca502a73ad8fe8831fc2860a3a3d1b9153ca63fe06de172233e706ced0d3cc

Contents?: true

Size: 636 Bytes

Versions: 1

Compression:

Stored size: 636 Bytes

Contents

module PyCall
  module Utils
    def dir(pyobj)
      value = LibPython.PyObject_Dir(pyobj)
      return value.to_ruby unless value.null?
      raise PyError.fetch
    end

    def int(pyobj)
      @int ||= PyCall.eval('int')
      @int.(pyobj)
    end

    def len(pyobj)
      @len ||= PyCall.eval('len')
      @len.(pyobj)
    end

    def slice(*args)
      Slice.new(*args)
    end

    def str(pyobj)
      @str ||= PyCall.eval('str')
      @str.(pyobj)
    end

    def tuple(*args)
      PyCall::Tuple[*args]
    end

    def type(pyobj)
      @type ||= PyCall.eval('type')
      @type.(pyobj)
    end
  end

  extend Utils
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pycall-0.1.0.alpha.20170224b lib/pycall/utils.rb