Module: FAP

Defined in:
lib/fap.rb,
lib/fap/paw.rb,
lib/fap/mixins.rb,
lib/fap/property.rb,
lib/fap/relation.rb,
lib/fap/collection.rb,
lib/fap/mixins/relations.rb,
lib/fap/mixins/properties.rb

Defined Under Namespace

Modules: Mixins Classes: Collection, Paw, Property, Relation

Constant Summary collapse

VERSION =
'0.0.3'

Class Method Summary collapse

Class Method Details

.constantize(camel_cased_word) ⇒ Object

extracted from Extlib

Constantize tries to find a declared constant with the name specified in the string. It raises a NameError when the name is not in CamelCase or is not initialized.

“Module”.constantize #=> Module “Class”.constantize #=> Class



24
25
26
27
28
29
# File 'lib/fap.rb', line 24

def self.constantize(camel_cased_word)
  unless /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/ =~ camel_cased_word
    raise NameError, "#{camel_cased_word.inspect} is not a valid constant name!"
  end
  Object.module_eval "::#{$1}", __FILE__, __LINE__
end