def get_accessor_property(prop_value, context=@page_context)
if (prop_value !~ /^[_A-Za-z][_A-Za-z0-9]*\??$/) then
raise PropertyError, "invalid accessor format: #{prop_value.inspect}: at #{@widget_id.inspect}"
end
if (context.public_methods(true).include? prop_value) then
attr_reader = context.method(prop_value)
else
attr_reader = nil
end
if (prop_value =~ /\?$/) then
attr_writer = nil
elsif (context.public_methods(true).include? "#{prop_value}=") then
attr_writer = context.method("#{prop_value}=")
else
attr_writer = nil
end
proc{|*args|
case (args.length)
when 0
if (attr_reader) then
attr_reader.call
else
raise PropertyError, "not readable accessor: #{prop_value.inspect}"
end
when 1
if (attr_writer) then
attr_writer.call(args[0])
else
raise PropertyError, "not writable accessor: #{prop_value.inspect}"
end
else
raise PropertyError, 'invalid accessor arguments: ' + args.map{|a| a.inspect }.joni(', ') + ": at #{@widget_id.inspect}"
end
}
end