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:



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

#rangeRange (readonly)

Range in the string this proxy represents.

Returns:



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

def range
  @range
end

#stringNSMutableAttributedString (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

#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)


125
126
127
# File 'lib/hotcocoa/attributed_string_helpers.rb', line 125

def attributes
  HotCocoa::NSRangedProxyAttributeHash.new self
end