Class: HotCocoa::NSRangedProxyAttributedString

Inherits:
Object
  • Object
show all
Defined in:
lib/hotcocoa/attributed_string_helpers.rb

Overview

Proxies the range of an attributed string.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string, range) ⇒ NSRangedProxyAttributedString

Returns a new instance of NSRangedProxyAttributedString.

Parameters:


119
120
121
122
# File 'lib/hotcocoa/attributed_string_helpers.rb', line 119

def initialize string, range
  @string = string
  @range  = range
end

Instance Attribute Details

#rangeRange (readonly)

Range in the string this proxy represents.

Returns:


115
116
117
# File 'lib/hotcocoa/attributed_string_helpers.rb', line 115

def range
  @range
end

#stringNSMutableAttributedString (readonly)

The string this proxy belongs to.


109
110
111
# File 'lib/hotcocoa/attributed_string_helpers.rb', line 109

def string
  @string
end

Instance Method Details

#attributesHotCooca::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.

Returns:

  • (HotCooca::NSRangedProxyAttributeHash)

130
131
132
# File 'lib/hotcocoa/attributed_string_helpers.rb', line 130

def attributes
  HotCocoa::NSRangedProxyAttributeHash.new self
end