lib/ostruct.rb in ostruct-0.5.4 vs lib/ostruct.rb in ostruct-0.5.5
- old
+ new
@@ -105,11 +105,11 @@
# ending with <code>!</code>.
#
# For all these reasons, consider not using OpenStruct at all.
#
class OpenStruct
- VERSION = "0.5.4"
+ VERSION = "0.5.5"
#
# Creates a new OpenStruct object. By default, the resulting OpenStruct
# object will have no attributes.
#
@@ -195,10 +195,10 @@
# require "ostruct"
# data = OpenStruct.new("country" => "Australia", :capital => "Canberra")
# data.each_pair.to_a # => [[:country, "Australia"], [:capital, "Canberra"]]
#
def each_pair
- return to_enum(__method__) { @table.size } unless block_given!
+ return to_enum(__method__) { @table.size } unless defined?(yield)
@table.each_pair{|p| yield p}
self
end
#