lib/ostruct.rb in ostruct-0.3.2 vs lib/ostruct.rb in ostruct-0.3.3

- old
+ new

@@ -105,11 +105,11 @@ # ending with `!`. # # For all these reasons, consider not using OpenStruct at all. # class OpenStruct - VERSION = "0.3.2" + VERSION = "0.3.3" # # Creates a new OpenStruct object. By default, the resulting OpenStruct # object will have no attributes. # @@ -231,10 +231,18 @@ if !respond_to?(name, true) false elsif name.match?(/!$/) true else - method!(name).owner < OpenStruct + owner = method!(name).owner + if owner.class == ::Class + owner < ::OpenStruct + else + self.class.ancestors.any? do |mod| + return false if mod == ::OpenStruct + mod == owner + end + end end end def freeze @table.freeze