Module: RandomlyGenerated
- Defined in:
- lib/randomly_generated.rb,
lib/randomly_generated/version.rb
Defined Under Namespace
Classes: Integer, Object, String
Constant Summary
collapse
- VERSION =
"0.0.1"
Class Method Summary
collapse
Class Method Details
.method_missing(method_name, *args, &block) ⇒ Object
13
14
15
16
17
18
19
20
21
|
# File 'lib/randomly_generated.rb', line 13
def self.method_missing(method_name, *args, &block)
if respond_to?(method_name)
class_name = method_name.to_s.split("_").map(&:capitalize).join
class_const = Object.const_get("::RandomlyGenerated::#{class_name}")
class_const.new(*args, &block)
else
super
end
end
|
.respond_to?(method_name) ⇒ Boolean
8
9
10
11
|
# File 'lib/randomly_generated.rb', line 8
def self.respond_to?(method_name)
class_name = method_name.to_s.split("_").map(&:capitalize).join
Object.const_defined?("::RandomlyGenerated::#{class_name}")
end
|