Ask a Question related to Ruby, Design and Development.
-
Yukihiro Matsumoto #1
Re: Freezing OpenStruct
Hi,
In message "Freezing OpenStruct"
on 03/08/26, Gavin Sinclair <gsinclair@soyabean.com.au> writes:
|The irb session below demonstrates that OpenStruct objects (part of
|the standard library) allow modification after a #freeze. Is this
|desirable?
I forgot to check frozen status. Thanks.
matz.
Yukihiro Matsumoto Guest
-
Contribute 3 freezing
I use a Mac Mini and have downloaded the trial version of Contribute 3. I'm not a technical wiz but also not a technophobe & I like to think that... -
Freezing while Loading ~~~HELP~~~
My Illustrator 10 on windows XP keeps freezing during the loading stage. It says reading fonts but does nothing else after that. What can I do. The... -
TERMINALS ARE FREEZING
Hello, I have a 43P running AIX 4.3.3 with three RANs attached to it. Recently the system is freezing selectively terminals and printer. I... -
ASP.NET freezing
Ok, I realize this is a fairly open-ended question, but I'm not entirely sure what caused this or how it happened. My application draws a graph... -
Freezing a Pattern
I scanned a polish green marble slab and created marble pattern with it. I use this pattern on text. My problem is that every character takes on a... -
Florian Frank #2
Re: Freezing OpenStruct
On 2003-08-26 21:39:34 +0900, Gavin Sinclair wrote:
It don't think so. A quick fix would be that:> The irb session below demonstrates that OpenStruct objects (part of
> the standard library) allow modification after a #freeze. Is this
> desirable?
Index: ostruct.rb
================================================== =================
RCS file: /src/ruby/lib/ostruct.rb,v
retrieving revision 1.6
diff -u -p -r1.6 ostruct.rb
--- ostruct.rb 18 Nov 2002 20:09:46 -0000 1.6
+++ ostruct.rb 26 Aug 2003 15:05:08 -0000
@@ -38,6 +38,11 @@ class OpenStruct
@table.delete name.to_sym
end
+ def freeze
+ super
+ @table.freeze
+ end
+
def inspect
str = "<#{self.class}"
for k,v in @table
--
Simplicity is prerequisite for reliability. [Handwritten annotation]
-- Edsger Dijkstra, How do we tell truths that might hurt?
Florian Frank Guest



Reply With Quote

