Vardhan Varma wrote:
> 
> Hello all,
> 
>    I want to 'load' and 'eval' a file, in the context of class instance.
> ie.
>   say a file "loadfile" contains
> 
> -----loadfile-----
> add_file ( "foo", "bar")
> rem_file ( "xyz", "abc")
> -----loadfile-----
> 
>   No in my code, i want to something like
>   load_file( "loadfile", cls )
>   such that add_file() call should result in cls.add_file();
> 
>  I'm a ruby-nuby, so pls tell me code snippet to do this.

x = MyClass.new
x.instance_eval(IO.readlines("loadfile").join)