Module: Ronin::Support
- Defined in:
- lib/ronin/support/version.rb,
lib/ronin/support/inflector.rb
Constant Summary collapse
- VERSION =
ronin-support version
'0.3.0'
- INFLECTORS =
The Inflectors supported by ronin-support
{ :datamapper => { :path => 'dm-core', :const => 'DataMapper::Inflector' }, :active_support => { :path => 'active_support/inflector', :const => 'ActiveSupport::Inflector' }, :extlib => { :path => 'extlib/inflection', :const => 'Extlib::Inflection' } }
Class Method Summary collapse
-
.load_inflector!(name) ⇒ true
private
Loads an Inflector library and sets the
Ronin::Support::Inflector
constant.
Class Method Details
.load_inflector!(name) ⇒ true
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Loads an Inflector library and sets the Ronin::Support::Inflector
constant.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/ronin/support/inflector.rb', line 60 def Support.load_inflector!(name) name = name.to_sym unless (inflector = INFLECTORS[name]) raise(ArgumentError,"unsupported Inflector: #{name}") end begin require inflector[:path] rescue Gem::LoadError => e raise(e) rescue ::LoadError raise(LoadError,"unable to load #{inflector[:path]}") end begin const_set('Inflector', eval("::#{inflector[:const]}")) rescue NameError raise(NameError,"unable to find #{inflector[:const]}") end return true end |