46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/rbcli/configuration/configurate.rb', line 46
def self.included klass
name = klass.name.split('::')[-1]
klass.singleton_class.class_eval do
define_method :rbcli_private_running_method do |&block|
@self_before_instance_eval = eval 'self', block.binding
instance_eval &block
end
define_method :method_missing do |method, *args, &block|
msg = "Invalid Configurate.#{self.name.split('::')[-1].downcase} method called: `#{method}` in file #{File.expand_path caller[0]}"
Rbcli::log.fatal {msg}
raise Exception.new msg
end
end
Rbcli::Configurate.singleton_class.class_eval do
define_method name.downcase.to_sym do |&block|
mod = self.const_get name
mod.rbcli_private_running_method &block
end
end
end
|