Module: MetaMongo::Utils
- Defined in:
- lib/meta_mongo/utils.rb
Class Method Summary collapse
Class Method Details
.create_class(string) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/meta_mongo/utils.rb', line 17 def create_class(string) return nil if to_class(string) begin Object.const_set(string.to_s, Class.new) rescue NameError end end |
.remove_class(string) ⇒ Object
11 12 13 14 15 |
# File 'lib/meta_mongo/utils.rb', line 11 def remove_class(string) return nil unless to_class(string) Object.send(:remove_const, string.to_sym) end |
.to_class(string) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/meta_mongo/utils.rb', line 4 def to_class(string) begin return Object.const_get(string.to_s) rescue NameError end end |