Sha256: d08775a5db107d24cbff0fc09c141d3ae8a7d5fccc9ac02b75c54f36ae4e39c5

Contents?: true

Size: 553 Bytes

Versions: 13

Compression:

Stored size: 553 Bytes

Contents

class NSError

  # @example
  #     NSError.error('just a simple error message')
  #     NSError.error('just a simple error message',
  #       domain: 'foo',
  #       code: 255,
  #       userInfo: { 'object' => 'foo' }
  #     )
  def self.error(message='Error', options={})
    domain = options[:domain] || 'Error'
    code = options[:code] || 0
    info = { NSLocalizedDescriptionKey => message }
    if options[:userInfo]
      info.merge! options[:userInfo]
    end
    NSError.alloc.initWithDomain(domain, code: code, userInfo: info)
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
sugarcube-4.0.0 lib/ios/sugarcube-factories/nserror.rb
sugarcube-3.5.0 lib/ios/sugarcube-factories/nserror.rb
sugarcube-3.4.2 lib/ios/sugarcube-factories/nserror.rb
sugarcube-3.4.1 lib/ios/sugarcube-factories/nserror.rb
sugarcube-3.4.0 lib/ios/sugarcube-factories/nserror.rb
sugarcube-3.3.7 lib/ios/sugarcube-factories/nserror.rb
sugarcube-3.3.6 lib/ios/sugarcube-factories/nserror.rb
sugarcube-3.3.5 lib/ios/sugarcube-factories/nserror.rb
sugarcube-3.3.4 lib/ios/sugarcube-factories/nserror.rb
sugarcube-3.3.3 lib/ios/sugarcube-factories/nserror.rb
sugarcube-3.3.2 lib/ios/sugarcube-factories/nserror.rb
sugarcube-3.3.1 lib/ios/sugarcube-factories/nserror.rb
sugarcube-3.3.0 lib/ios/sugarcube-factories/nserror.rb