如何在macruby / scriptingbridge中构造“谁的名字是X”样式语句?

时间:2013-02-01 04:38:28

标签: macruby

在AppleScript中:

set allItems to every item whose name is "foo"

在rb-appscript中:

all_items = items[its.name.eq "Foo"]

有没有办法在MacRuby / ScriptingBridge中构建类似的搜索/谓词/你有什么?

1 个答案:

答案 0 :(得分:0)

问题:解决了!

predicate = NSPredicate.predicateWithFormat %(name = "Foo")
all_items = items.filterUsingPredicate(predicate)

Handy reference