bodacious bodacious - 7 months ago 16
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 :)


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.