Method: JsonRpcObjects::Version#method_missing
- Defined in:
- lib/json-rpc-objects/version.rb
#method_missing(name) ⇒ JsonRpcObjects::Generic::Object
Handles unknown call as request for appropriate class.
Camel case is defined by underscores, so for example #some_class<tt> will be transformed to <tt>SomeClass.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/json-rpc-objects/version.rb', line 71 def method_missing(name) name = name.to_s # Class name class_name = "_" << name class_name.gsub!(self.class::CLASS_NAME_GENERATOR) { |s| s[1].chr.upcase } # Module name module_name = @module.name + "::" + class_name # File path file_path = "x" << module_name file_path.gsub!(self.class::FILE_NAME_GENERATOR) { |s| s[0].chr << "-" << s[1].chr } file_path.replace(file_path[2..-1]) file_path.gsub!("::", "/") file_path.downcase! if not @@files.has_key? file_path require file_path @@files[file_path] = true end return __get_module(module_name) end |