1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/ostruct.rb: Remove rdoc details on marshal_{load|dump} and fix rdoc

[ruby-core:42557] [ruby-core:42780]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
marcandre 2012-10-28 21:18:11 +00:00
parent 8c163b8599
commit af29f7d2a3

View file

@ -114,32 +114,14 @@ class OpenStruct
end end
# #
# Provides marshalling support for use by the Marshal library. Returning the # Provides marshalling support for use by the Marshal library.
# underlying Hash table that contains the functions defined as the keys and
# the values assigned to them.
#
# require 'ostruct'
#
# person = OpenStruct.new
# person.name = 'John Smith'
# person.age = 70
#
# person.marshal_dump # => { :name => 'John Smith', :age => 70 }
# #
def marshal_dump def marshal_dump
@table @table
end end
# #
# Provides marshalling support for use by the Marshal library. Accepting # Provides marshalling support for use by the Marshal library.
# a Hash of keys and values which will be used to populate the internal table
#
# require 'ostruct'
#
# event = OpenStruct.new
# hash = { 'time' => Time.now, 'title' => 'Birthday Party' }
# event.marshal_load(hash)
# event.title # => 'Birthday Party'
# #
def marshal_load(x) def marshal_load(x)
@table = x @table = x
@ -147,7 +129,7 @@ class OpenStruct
end end
# #
# #modifiable is used internally to check if the OpenStruct is able to be # Used internally to check if the OpenStruct is able to be
# modified before granting access to the internal Hash table to be modified. # modified before granting access to the internal Hash table to be modified.
# #
def modifiable def modifiable
@ -240,7 +222,7 @@ class OpenStruct
# #
# Compares this object and +other+ for equality. An OpenStruct is equal to # Compares this object and +other+ for equality. An OpenStruct is equal to
# +other+ when +other+ is an OpenStruct and the two object's Hash tables are # +other+ when +other+ is an OpenStruct and the two objects' Hash tables are
# equal. # equal.
# #
def ==(other) def ==(other)