Class: NSNumber
- Defined in:
- lib/cocoa/sugarcube-timer/timer.rb,
lib/ios/sugarcube-numbers/nsnumber.rb,
lib/osx/sugarcube-numbers/nsnumber.rb,
lib/cocoa/sugarcube-nsdate/nsnumber.rb,
lib/cocoa/sugarcube-numbers/nsnumber.rb more...
Instance Method Summary collapse
- #after(date) ⇒ Object
- #ago ⇒ Object
- #before(date) ⇒ Object
- #every(user_info = nil, &fire) ⇒ Object
- #hence ⇒ Object
- #later(user_info = nil, &fire) ⇒ Object
- #nsdate ⇒ Object
-
#pixels ⇒ Object
(also: #pixel)
Uses the screen scale to determine how many pixels (converts “pixels” to “points”).
- #string_with_style(style = NSNumberFormatterDecimalStyle) ⇒ Object
- #to_bool ⇒ Object
Instance Method Details
permalink #after(date) ⇒ Object
[View source]
15 16 17 |
# File 'lib/cocoa/sugarcube-nsdate/nsnumber.rb', line 15 def after(date) date + self end |
permalink #ago ⇒ Object
[View source]
11 12 13 |
# File 'lib/cocoa/sugarcube-nsdate/nsnumber.rb', line 11 def ago self.before(NSDate.new) end |
permalink #before(date) ⇒ Object
[View source]
7 8 9 |
# File 'lib/cocoa/sugarcube-nsdate/nsnumber.rb', line 7 def before(date) date - self end |
permalink #every(user_info = nil, &fire) ⇒ Object
[View source]
7 8 9 |
# File 'lib/cocoa/sugarcube-timer/timer.rb', line 7 def every(user_info=nil, &fire) NSTimer.scheduledTimerWithTimeInterval(self, target: fire, selector: 'call:', userInfo: user_info, repeats: true) end |
permalink #hence ⇒ Object
[View source]
19 20 21 |
# File 'lib/cocoa/sugarcube-nsdate/nsnumber.rb', line 19 def hence self.after(NSDate.new) end |
permalink #later(user_info = nil, &fire) ⇒ Object
[View source]
3 4 5 |
# File 'lib/cocoa/sugarcube-timer/timer.rb', line 3 def later(user_info=nil, &fire) NSTimer.scheduledTimerWithTimeInterval(self, target: fire, selector: 'call:', userInfo: user_info, repeats: false) end |
permalink #nsdate ⇒ Object
[View source]
3 4 5 |
# File 'lib/cocoa/sugarcube-nsdate/nsnumber.rb', line 3 def nsdate NSDate.dateWithTimeIntervalSince1970(self) end |
permalink #pixels ⇒ Object Also known as: pixel
Uses the screen scale to determine how many pixels (converts “pixels” to “points”)
9 10 11 |
# File 'lib/ios/sugarcube-numbers/nsnumber.rb', line 9 def pixels self.to_f / UIScreen.mainScreen.scale end |
permalink #string_with_style(style = NSNumberFormatterDecimalStyle) ⇒ Object
[View source]
3 4 5 6 7 8 |
# File 'lib/cocoa/sugarcube-numbers/nsnumber.rb', line 3 def string_with_style(style=NSNumberFormatterDecimalStyle) if style.respond_to?(:nsnumberstyle) style = style.nsnumberstyle end NSNumberFormatter.localizedStringFromNumber(self, numberStyle:style) end |
permalink #to_bool ⇒ Object
[View source]
10 11 12 |
# File 'lib/cocoa/sugarcube-numbers/nsnumber.rb', line 10 def to_bool boolValue end |