hruby-0.2.7: Embed Ruby in your Haskell program.

Safe HaskellNone

Foreign.Ruby.Bindings

Synopsis

Documentation

type RValue = Ptr CULongSource

This is the type of Ruby values. It is defined as a pointer to some unsigned long, just like Ruby does. The actual value is either pointed to, or encoded in the pointer.

type RID = CULongSource

The Ruby ID type, mostly used for symbols.

data RType Source

Ruby native types, as encoded in the Value type.

Instances

mkRegistered0 :: Registered0 -> IO (FunPtr Registered0)Source

Creates a function pointer suitable for usage with rb_define_global_function of type Registered0 (with 0 arguments).

mkRegistered1 :: Registered1 -> IO (FunPtr Registered1)Source

Creates a function pointer suitable for usage with rb_define_global_function of type Registered1 (with 1 RValue arguments).

mkRegistered2 :: Registered2 -> IO (FunPtr Registered2)Source

Creates a function pointer suitable for usage with rb_define_global_function of type Registered2 (with 2 RValue arguments).

rb_define_global_functionSource

Arguments

:: String

Name of the function

-> FunPtr a

Pointer to the function (created with something like mkRegistered0)

-> Int

Number of arguments the function accepts.

-> IO () 

Defines a global function that can be called from the Ruby world. This function must only accept RValues as arguments.

rb_iv_setSource

Arguments

:: RValue

The object

-> String 
-> RValue

The value to set

-> IO RValue

The value you just set

Sets an instance variable

rb_load_protectSource

Arguments

:: String

Path to the script

-> Int

Just set this to 0, unless you know what you are doing

-> IO Int

Return code, equal to 0 if everything went right. showErrorStack can be used in case of errors.

Loads a ruby script (and executes it).