Class: NSAttributedString
- Inherits:
-
Object
- Object
- NSAttributedString
- Defined in:
- lib/hotcocoa/core_extensions/nsattributed_string.rb
Overview
HotCocoa extensions to the NSAttributedString class.
Instance Method Summary (collapse)
-
- (Object) +(s)
Just like
String#+. -
- (Object) [](r)
Similar to
String#[], but only supports ranges at the moment. -
- (HotCocoa::NSRangedProxyAttributeHash) attributes
Hash of attributes used in the attributed string.
-
- (NSMutableAttributedString) with_attributes(attributes = {})
Make a new attributed string with the string of the receiver and the attributes passed as arguments.
Instance Method Details
- (Object) +(s)
Just like String#+
17 18 19 20 21 |
# File 'lib/hotcocoa/core_extensions/nsattributed_string.rb', line 17 def + s attributed_string = mutableCopy attributed_string << s attributed_string end |
- (Object) [](r)
Similar to String#[], but only supports ranges at the moment.
35 36 37 |
# File 'lib/hotcocoa/core_extensions/nsattributed_string.rb', line 35 def [] r attributedSubstringFromRange r.relative_to(length) end |
- (HotCocoa::NSRangedProxyAttributeHash) attributes
Hash of attributes used in the attributed string.
27 28 29 |
# File 'lib/hotcocoa/core_extensions/nsattributed_string.rb', line 27 def attributes HotCocoa::NSRangedProxyAttributedString.new(self, 0..-1).attributes end |
- (NSMutableAttributedString) with_attributes(attributes = {})
Make a new attributed string with the string of the receiver and the attributes passed as arguments.
11 12 13 |
# File 'lib/hotcocoa/core_extensions/nsattributed_string.rb', line 11 def with_attributes attributes = {} string.with_attributes attributes end |