Sha256: 5dbf8475773bd5aadaf782dd0990a858fc8579ac6cdeae2652058178dcb2e693
Contents?: true
Size: 1.8 KB
Versions: 1
Compression:
Stored size: 1.8 KB
Contents
# Provides a module to store global states # module BubbleWrap module App module_function # Returns the application's document directory path where users might be able to upload content. # @return [String] the path to the document directory def documents_path NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, true)[0] end # Returns the application resource path where resource located # @return [String] the application main bundle resource path def resources_path NSBundle.mainBundle.resourcePath end # Returns the default notification center # @return [NSNotificationCenter] the default notification center def notification_center NSNotificationCenter.defaultCenter end def user_cache NSUserDefaults.standardUserDefaults end def alert(msg,cancelButtonTitle='OK') alert = UIAlertView.alloc.initWithTitle msg, message: nil, delegate: nil, cancelButtonTitle: cancelButtonTitle, otherButtonTitles: nil alert.show alert end @states = {} def states @states end def name NSBundle.mainBundle.objectForInfoDictionaryKey 'CFBundleDisplayName' end def identifier NSBundle.mainBundle.bundleIdentifier end # Return application frame def frame UIScreen.mainScreen.applicationFrame end # Application Delegate def delegate UIApplication.sharedApplication.delegate end # @return [NSLocale] locale of user settings def current_locale languages = NSLocale.preferredLanguages if languages.count > 0 return NSLocale.alloc.initWithLocaleIdentifier(languages.first) else return NSLocale.currentLocale end end end end ::App = BubbleWrap::App
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bubble-wrap-0.3.0 | lib/bubble-wrap/app.rb |