Ticket #726 (new defect)
Methods added to String do not get added to all strings
| Reported by: | dylan@… | Owned by: | lsansonetti@… |
|---|---|---|---|
| Priority: | blocker | Milestone: | MacRuby Later |
| Component: | MacRuby | Keywords: | |
| Cc: |
Description
Methods added to the string class are not being added to the string returned from NSMutableString. I've also seen this with stringValue from NSTextFieldCell.
The following will generate an error, even though the classes of the two objects are both 'String'.
I'm not sure if this occurs with other open classes.
class String
def cook
puts 'Bacon!'
end
def to_mutable_attributed_string
NSMutableAttributedString.alloc.initWithString( self )
end
end
base_string = 'breakfast'
puts base_string.class
base_string.cook
mutable = base_string.to_mutable_attributed_string
puts mutable.string.class
mutable.string.cook
Attachments
Change History
Note: See
TracTickets for help on using
tickets.


