Class: HotCocoa::NSRangedProxyAttributedString
- Defined in:
- lib/hotcocoa/attributed_string_helpers.rb
Overview
Proxies the range of an attributed string.
Instance Attribute Summary collapse
-
#range ⇒ Range
readonly
Range in the string this proxy represents.
-
#string ⇒ NSMutableAttributedString
readonly
The string this proxy belongs to.
Instance Method Summary collapse
-
#attributes ⇒ HotCooca::NSRangedProxyAttributeHash
This method is useful because it allows an attributed string to return a hash of attributes that use Rubyish names instead of Objective-C ones.
-
#initialize(string, range) ⇒ NSRangedProxyAttributedString
constructor
A new instance of NSRangedProxyAttributedString.
Constructor Details
#initialize(string, range) ⇒ NSRangedProxyAttributedString
Returns a new instance of NSRangedProxyAttributedString.
114 115 116 117 |
# File 'lib/hotcocoa/attributed_string_helpers.rb', line 114 def initialize string, range @string = string @range = range end |
Instance Attribute Details
#range ⇒ Range (readonly)
Range in the string this proxy represents.
110 111 112 |
# File 'lib/hotcocoa/attributed_string_helpers.rb', line 110 def range @range end |
#string ⇒ NSMutableAttributedString (readonly)
The string this proxy belongs to.
104 105 106 |
# File 'lib/hotcocoa/attributed_string_helpers.rb', line 104 def string @string end |
Instance Method Details
#attributes ⇒ HotCooca::NSRangedProxyAttributeHash
This method is useful because it allows an attributed string to return a hash of attributes that use Rubyish names instead of Objective-C ones.
125 126 127 |
# File 'lib/hotcocoa/attributed_string_helpers.rb', line 125 def attributes HotCocoa::NSRangedProxyAttributeHash.new self end |