bodacious bodacious - 1 year ago 63
Objective-C Question

How do I rewrite Objective C options bitmasks to to Ruby for RubyMotion?

How do I rewrite:

NSUInteger options = kCFCalendarUnitYear | kCFCalendarUnitMonth | kCFCalendarUnitDay;

To Ruby for Rubymotion?

Thanks :)

Answer Source

Almost the exact same way. The only difference really is that since Ruby requires constants to start with a capital letter, you must use a capital K instead:

options = KCFCalendarUnitYear | KCFCalendarUnitMonth | KCFCalendarUnitDay
# returns 28, same as in Objective-C.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download