Module: BubbleWrap

Defined in:
motion/shortcut.rb,
lib/bubble-wrap/loader.rb,
lib/bubble-wrap/version.rb,
lib/bubble-wrap/requirement.rb,
lib/bubble-wrap/ext/motion_project_app.rb,
lib/bubble-wrap/requirement/path_manipulation.rb,
motion/http.rb,
motion/core.rb,
motion/sms/sms.rb,
motion/reactor.rb,
motion/core/app.rb,
motion/core/kvo.rb,
motion/core/json.rb,
motion/font/font.rb,
motion/mail/mail.rb,
motion/rss_parser.rb,
motion/sms/result.rb,
motion/http/query.rb,
motion/core/string.rb,
motion/media/media.rb,
motion/mail/result.rb,
motion/core/device.rb,
motion/core/osx/app.rb,
motion/media/player.rb,
motion/core/ios/app.rb,
motion/reactor/queue.rb,
motion/http/response.rb,
motion/reactor/timer.rb,
motion/reactor/future.rb,
motion/util/constants.rb,
motion/core/osx/device.rb,
motion/core/ios/device.rb,
motion/util/deprecated.rb,
motion/core/persistence.rb,
motion/location/location.rb,
motion/reactor/eventable.rb,
motion/core/device/screen.rb,
motion/reactor/deferrable.rb,
motion/ui/ui_view_wrapper.rb,
motion/ui/ui_control_wrapper.rb,
motion/core/device/osx/screen.rb,
motion/core/device/ios/camera.rb,
motion/reactor/periodic_timer.rb,
motion/core/device/ios/screen.rb,
motion/reactor/default_deferrable.rb,
motion/ui/ui_view_controller_wrapper.rb,
motion/core/device/ios/camera_wrapper.rb,
motion/network-indicator/network-indicator.rb

Overview

Provides a nice DSL for interacting with the standard UIImagePickerController

Defined Under Namespace

Modules: App, CLLocationWrap, Constants, Deprecated, Device, Ext, Font, HTTP, JSON, KVO, Location, Mail, Media, NetworkIndicator, Persistence, Reactor, SMS, String, UIControlWrapper, UIViewControllerWrapper, UIViewWrapper Classes: RSSParser, Requirement

Constant Summary

LOADER_PRESENT =
true
VERSION =
'1.5.0'
MIN_MOTION_VERSION =
'2.17'
SETTINGS =
{}

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Object) create_uuid



28
29
30
31
# File 'motion/core.rb', line 28

def create_uuid
  uuid = CFUUIDCreate(nil)
  CFUUIDCreateString(nil, uuid)
end

+ (Object) debug=(val)



8
9
10
# File 'motion/shortcut.rb', line 8

def self.debug=(val)
  BubbleWrap::SETTINGS[:debug] = val
end

+ (Boolean) debug?

Returns:

  • (Boolean)


12
13
14
# File 'motion/shortcut.rb', line 12

def self.debug?
  BubbleWrap::SETTINGS[:debug]
end

+ (Object) localized_string(key, value = nil)



19
20
21
# File 'motion/core.rb', line 19

def localized_string(key, value=nil)
  NSBundle.mainBundle.localizedStringForKey(key, value:value, table:nil)
end

+ (Object) p(arg)

I had issues with #p on the device, this is a temporary workaround



24
25
26
# File 'motion/core.rb', line 24

def p(arg)
  NSLog arg.inspect
end

+ (Object) require(file_spec, &block)



23
24
25
# File 'lib/bubble-wrap/loader.rb', line 23

def require(file_spec, &block)
  Requirement.scan(caller.first, file_spec, &block)
end

+ (Object) require_ios(requirement = nil, &callback)



27
28
29
30
31
32
33
# File 'lib/bubble-wrap/loader.rb', line 27

def require_ios(requirement = nil, &callback)
  if !Motion::Project::App.osx?
    callback.call
  else
    puts "bubble-wrap/#{requirement} requires iOS to use." if requirement
  end
end

+ (Object) require_osx(requirement = nil, &callback)



35
36
37
38
39
40
41
# File 'lib/bubble-wrap/loader.rb', line 35

def require_osx(requirement = nil, &callback)
  if Motion::Project::App.osx?
    callback.call
  else
    puts "bubble-wrap/#{requirement} requires OS X to use." if requirement
  end
end

+ (UIcolor) rgb_color(r, g, b)

Returns:

  • (UIcolor)


5
6
7
# File 'motion/core.rb', line 5

def rgb_color(r,g,b)
  rgba_color(r,g,b,1)
end

+ (UIcolor) rgba_color(r, g, b, a)

Returns:

  • (UIcolor)


10
11
12
13
14
15
16
17
# File 'motion/core.rb', line 10

def rgba_color(r,g,b,a)
  r,g,b = [r,g,b].map { |i| i / 255.0}
  if App.osx?
    NSColor.colorWithDeviceRed(r, green: g, blue: b, alpha: a)
  else
    UIColor.colorWithRed(r, green: g, blue:b, alpha:a)
  end
end

+ (Object) root



19
20
21
# File 'lib/bubble-wrap/loader.rb', line 19

def root
  File.expand_path('../../../', __FILE__)
end

+ (Object) use_weak_callbacks=(val)



16
17
18
# File 'motion/shortcut.rb', line 16

def self.use_weak_callbacks=(val)
  BubbleWrap::SETTINGS[:use_weak_callbacks] = val
end

+ (Boolean) use_weak_callbacks?

Returns:

  • (Boolean)


20
21
22
# File 'motion/shortcut.rb', line 20

def self.use_weak_callbacks?
  BubbleWrap::SETTINGS[:use_weak_callbacks]
end

Instance Method Details

- (Object) version



24
25
26
# File 'motion/shortcut.rb', line 24

def version
  BubbleWrap::VERSION
end