我有以下内容:
class Foo
def bar
"foobar"
end
def baz
"foobaz"
end
def qux(arg)
...
end
end
如何覆盖as_json
,以便它包含方法的键和值bar
,baz
而不是qux
,而不明确指定它们?
我有以下内容:
class Foo
def bar
"foobar"
end
def baz
"foobaz"
end
def qux(arg)
...
end
end
如何覆盖as_json
,以便它包含方法的键和值bar
,baz
而不是qux
,而不明确指定它们?