class Fixnum
Public Instance Methods
cgcolor(alpha=nil)
click to toggle source
# File lib/ios/sugarcube-color/fixnum.rb, line 22 def cgcolor(alpha=nil) uicolor(alpha).CGColor end
nscolor(alpha=nil)
click to toggle source
0xffeedd.nscolor
>¶ ↑
NSColor.colorWithRed(0xFF / 255.0, green: 0xEE / 255.0, blue: 0xDD / 255.0, alpha: 1.0) # ≈ NSColor.colorWithRed(1.0, green: 0.933, blue: 0.867, alpha: 1.0) 0xffeedd.nscolor(0.25)
>¶ ↑
NSColor.colorWithRed(0xFF / 255.0, green: 0xEE / 255.0, blue: 0xDD / 255.0, alpha: 0.25) # ≈ NSColor.colorWithRed(1.0, green: 0.933, blue: 0.867, alpha: 0.25)
# File lib/osx/sugarcube-color/fixnum.rb, line 12 def nscolor(alpha=nil) alpha = 1.0 if alpha.nil? red = ((self & 0xFF0000) >> 16).to_f / 255.0 green = ((self & 0xFF00) >> 8).to_f / 255.0 blue = (self & 0xFF).to_f / 255.0 NSColor.rgba(red, green, blue, alpha.to_f) end
nstimezone()
click to toggle source
# File lib/cocoa/sugarcube-nsdate/fixnum.rb, line 3 def nstimezone NSTimeZone.timeZoneForSecondsFromGMT(self) end
nth()
click to toggle source
# File lib/all/sugarcube-numbers/fixnum.rb, line 3 def nth # if the first two digits of rank are between 11 and 20, it's an # 'up-teenth' kinda number modulo_100 = self % 100 if modulo_100 < 10 || modulo_100 > 20 case self % 10 when 1 return 'st' when 2 return 'nd' when 3 return 'rd' end end return "th" end
ordinalize()
click to toggle source
# File lib/all/sugarcube-numbers/fixnum.rb, line 21 def ordinalize return "#{self}#{nth}" end
skcolor(alpha=nil)
click to toggle source
# File lib/ios/sugarcube-color/fixnum.rb, line 26 def skcolor(alpha=nil) uicolor(alpha) end
uicolor(alpha=nil)
click to toggle source
0xffeedd.uicolor
>¶ ↑
UIColor.colorWithRed(0xFF / 255.0, green: 0xEE / 255.0, blue: 0xDD / 255.0, alpha: 1.0) # ≈ UIColor.colorWithRed(1.0, green: 0.933, blue: 0.867, alpha: 1.0) 0xffeedd.uicolor(0.25)
>¶ ↑
UIColor.colorWithRed(0xFF / 255.0, green: 0xEE / 255.0, blue: 0xDD / 255.0, alpha: 0.25) # ≈ UIColor.colorWithRed(1.0, green: 0.933, blue: 0.867, alpha: 0.25)
# File lib/ios/sugarcube-color/fixnum.rb, line 12 def uicolor(alpha=nil) alpha = 1.0 if alpha.nil? red = ((self & 0xFF0000) >> 16).to_f / 255.0 green = ((self & 0xFF00) >> 8).to_f / 255.0 blue = (self & 0xFF).to_f / 255.0 UIColor.colorWithRed(red, green: green, blue: blue, alpha: alpha.to_f) end