Class: NSError
- Defined in:
- lib/cocoa/sugarcube-to_s/nserror.rb,
lib/ios/sugarcube-factories/nserror.rb,
lib/cocoa/sugarcube-localized/nserror.rb
Class Method Summary collapse
Instance Method Summary collapse
- #localized ⇒ Object (also: #_)
- #to_s ⇒ Object
Class Method Details
.error(message = 'Error', options = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/ios/sugarcube-factories/nserror.rb', line 10 def self.error(='Error', ={}) domain = [:domain] || 'Error' code = [:code] || 0 info = { NSLocalizedDescriptionKey => } if [:userInfo] info.merge! [:userInfo] end NSError.alloc.initWithDomain(domain, code: code, userInfo: info) end |
Instance Method Details
#localized ⇒ Object Also known as: _
3 4 5 |
# File 'lib/cocoa/sugarcube-localized/nserror.rb', line 3 def localized localizedDescription end |
#to_s ⇒ Object
3 4 5 6 7 8 |
# File 'lib/cocoa/sugarcube-to_s/nserror.rb', line 3 def to_s "#<#{self.class.to_s}:0x#{self.object_id.to_s(16)}, "+ "description=#{self.localizedDescription.inspect}, code=#{code}, "+ "domain=#{domain.inspect}, userInfo=#{userInfo.inspect}"+ ">" end |