lib/captain_planet/builder.rb
# Converts the incoming klass value into something we can instanciate for realz
Converts the incoming klass value into something we can instanciate for realz
Converts the incoming klass value into something we can instanciate for realz
def klass
      if @klass.is_a?(Class)
        @klass
      else
        unless /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/ =~ @klass.to_s
          raise NameError, "#{@klass.inspect} is not a valid constant name!"
        end
        Object.module_eval("::#{$1}", __FILE__, __LINE__)
      end
    end
def klass if @klass . is_a? ( Class ) @klass else unless / \A (?:::)?([A-Z] \w *(?:::[A-Z] \w *)*) \z / =~ @klass . to_s raise NameError , "#{@klass.inspect} is not a valid constant name!" end Object . module_eval ( "::#{$1}" , __FILE__ , __LINE__ ) end end
Converts the incoming klass value into something we can instanciate for realz
Converts the incoming klass value into something we can instanciate for realz