8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/simple_helpers/support.rb', line 8
def self.create_method(controller, name)
controller.class_eval do
define_method(name) do |*args|
if args.empty?
send "#{name}_get"
else
send "#{name}_set", args.first
end
end
define_method("#{name}_set") do |*args|
instance_variable_set "@#{name}", args.first
end
define_method("#{name}_get") do |*args|
"%{prefix}%{prefix_separator}%{content}%{suffix_separator}%{suffix}" %
SimpleHelpers::Support.simple_helper_parts(controller, name)
end
end
end
|