108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
# File 'lib/extmodules/magic.rb', line 108
def self.included(base)
base.class_eval do
alias_method :mod_listener, :prepare_config
define_method :prepare_config do
mod_listener rescue "skip"
call = @config[:call]
if call.is_a? Array
if call.first.is_a? Array
call.each do |c|
call_on = call[0]
call_fn = call[1]
end
else
call_on = call[0]
call_fn = call[1]
end
else
call = []
{
:call_on => @default_config[:call_on],
:call_fn => @config[:call]
}
call << [@default_config[:call_on], @config[:call]]
end
@default_config.merge! :emptyText => "Select #{text}" unless text.nil?
end
end
end
|