summaryrefslogtreecommitdiff
path: root/lib/ostruct.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-11-18 20:09:46 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-11-18 20:09:46 +0000
commitc52339881c949810f1e1e7a3f2172d25ebd50191 (patch)
tree7b9078c5be0e68a7cf5952a5cff2e1316cbdef94 /lib/ostruct.rb
parent7da58dad33a266e668e74c3b59f750706efaab58 (diff)
* instruby.rb: not rewrite installed scripts when dry-run mode.
* lib/ostruct.rb (OpenStruct::initialize): should symbolize keys instead of values. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/ostruct.rb')
-rw-r--r--lib/ostruct.rb12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/ostruct.rb b/lib/ostruct.rb
index 8bc0628..50a7cec 100644
--- a/lib/ostruct.rb
+++ b/lib/ostruct.rb
@@ -13,7 +13,7 @@ class OpenStruct
@table = {}
if hash
for k,v in hash
- @table[k] = v.to_sym
+ @table[k.to_sym] = v
end
end
end
@@ -27,7 +27,7 @@ class OpenStruct
end
mname.chop!
@table[mname.intern] = args[0]
- elsif args.length == 0
+ elsif len == 0
@table[mid]
else
raise NoMethodError, "undefined method `#{mname}' for #{self}", caller(1)
@@ -41,12 +41,8 @@ class OpenStruct
def inspect
str = "<#{self.class}"
for k,v in @table
- str += " "
- str += k.to_s
- str += "="
- str += v.inspect
+ str << " #{k}=#{v.inspect}"
end
- str += ">"
- str
+ str << ">"
end
end