Sha256: a4e93b3da63e0721247390cee169e8757407def9064440154565bd636da88314

Contents?: true

Size: 733 Bytes

Versions: 13

Compression:

Stored size: 733 Bytes

Contents

module BubbleWrap
  module_function

  # @return [UIcolor]
  def rgb_color(r,g,b)
    rgba_color(r,g,b,1)
  end

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

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

  # I had issues with #p on the device, this is a temporary workaround
  def p(arg)
    NSLog arg.inspect
  end

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

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
bubble-wrap-1.9.7 motion/core.rb
bubble-wrap-1.9.6 motion/core.rb
bubble-wrap-1.9.5 motion/core.rb
bubble-wrap-1.9.4 motion/core.rb
bubble-wrap-1.9.3 motion/core.rb
bubble-wrap-1.9.2 motion/core.rb
bubble-wrap-1.9.1 motion/core.rb
bubble-wrap-1.9.0 motion/core.rb
bubble-wrap-1.8.0 motion/core.rb
bubble-wrap-1.7.1 motion/core.rb
bubble-wrap-1.7.0 motion/core.rb
bubble-wrap-1.6.0 motion/core.rb
bubble-wrap-1.6.0.rc1 motion/core.rb