lib/sugarcube/string.rb in sugarcube-0.1.4 vs lib/sugarcube/string.rb in sugarcube-0.1.5
- old
+ new
@@ -1,13 +1,17 @@
class String
+ def nsurl
+ @url ||= NSURL.alloc.initWithString(self)
+ end
+
def uiimage
- UIImage.imageNamed(self)
+ @uiimage = UIImage.imageNamed(self)
end
def uifont(size=UIFont.systemFontSize)
- UIFont.fontWithName(self, size:size)
+ @uifont = UIFont.fontWithName(self, size:size)
end
def uicolor(alpha=nil)
if self[0,1] == '#'
# #fff
@@ -26,10 +30,10 @@
end
# This can be called as `"Hello".localized` or `"Hello"._`. The `str._`
# syntax is meant to be reminiscent of gettext-style `_(str)`.
def localized(value=nil, table=nil)
- NSBundle.mainBundle.localizedStringForKey(self, value:value, table:table)
+ @localized = NSBundle.mainBundle.localizedStringForKey(self, value:value, table:table)
end
alias :_ :localized
end