hruby-0.3.8: Embed a Ruby intepreter in your Haskell program !

Safe HaskellNone
LanguageHaskell2010

Foreign.Ruby.Bindings

Synopsis

Documentation

type RValue = Ptr CULong Source #

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 = CULong Source #

The Ruby ID type, mostly used for symbols.

data RType Source #

Ruby native types, as encoded in the Value type.

Instances
Show RType Source # 
Instance details

Defined in Foreign.Ruby.Bindings

Methods

showsPrec :: Int -> RType -> ShowS #

show :: RType -> String #

showList :: [RType] -> ShowS #

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_function Source #

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_define_method Source #

Arguments

:: RValue

Object to which a method is added

-> String

Name of the method

-> FunPtr a

Pointer to the Haskell function (created with something like mkRegistered1)

-> Int

-1, -2, or number of arguments the function accepts other than the receiver.

-> IO () 

Defines an instance method.

The Haskell function must accept the receiver as the first argument. If argc >= 0, the type of the arguments of the function must be RValue.

rb_define_singleton_method :: RValue -> String -> FunPtr a -> Int -> IO () Source #

Defines a singleton method.

Arguments are the same as rb_define_method.

rb_define_module_function :: RValue -> String -> FunPtr a -> Int -> IO () Source #

Defines a module function (module_function) to a module.

Arguments are the same as rb_define_method.

rb_iv_set Source #

Arguments

:: RValue

The object

-> String

The variable name (without the @)

-> RValue

The value to set

-> IO RValue

The value you just set

Sets an instance variable

rb_load_protect Source #

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).