def self.default_display_methods(target)
if target.class.respond_to? :columns
if target.class.columns.first.respond_to? :name
return target.class.columns.collect(&:name)
else
return target.class.columns
end
end
return target.fields.keys if target.respond_to? :fields and target.fields.is_a? Hash
return target.keys if target.is_a? Hash
return target.members.collect(&:to_sym) if target.is_a? Struct
methods = []
target.methods.each do |method_name|
method = target.method(method_name)
if method.owner == target.class
if method.arity == 0
methods << method_name.to_s
end
end
end
methods.delete_if { |m| m[-1].chr == "!" }
methods
end