Class: NSMutableAttributedString
- Inherits:
-
Object
- Object
- NSMutableAttributedString
- Defined in:
- lib/hotcocoa/core_extensions/nsmutable_attributed_string.rb
Overview
HotCocoa extensions to the NSMutableAttributeString class.
Instance Method Summary (collapse)
-
- (Object) <<(s)
Just like
String#<<. -
- (Object) []=(r, s)
Replace an arbitrary range of an attributed string with another string.
Instance Method Details
- (Object) <<(s)
Just like String#<<
7 8 9 10 11 12 13 14 |
# File 'lib/hotcocoa/core_extensions/nsmutable_attributed_string.rb', line 7 def << s case s when String mutableString.appendString s else appendAttributedString s end end |
- (Object) []=(r, s)
Replace an arbitrary range of an attributed string with another string.
21 22 23 24 25 26 27 28 |
# File 'lib/hotcocoa/core_extensions/nsmutable_attributed_string.rb', line 21 def []= r, s case s when String replaceCharactersInRange r.relative_to(length), withString: s else replaceCharactersInRange r.relative_to(length), withAttributedString: s end end |