On Mon, Feb 4, 2008 at 9:34 PM, Carl Youngblood
<youngblood.carl / gmail.com> wrote:
> Howdy everyone,
>

Heya

>  Can anyone explain to me why
>
>  class Fil
>   def self.add_class name
>     class_eval "#{name.capitalize} = Class.new(self)"
>   end
>  end
>
>  behaves differently than
>
>  class Fil
>   def self.add_class name
>     eval "#{name.capitalize} = Class.new(self)"
>   end
>  end
>
>  especially with regards the dynamic placement of the classes created on
>  the fly?
>

eval and class_eval work on different scopes. eval works just in its
current scope(here your method), however class_eval works for the
whole class(your Fil)