Sha256: 9b05b2d2142a279c91ebb3d9976ea7c024602578a007120b7f5397a815b97781
Contents?: true
Size: 758 Bytes
Versions: 6
Compression:
Stored size: 758 Bytes
Contents
# frozen_string_literal: true # # Temporary fix until this PR gets merged: # https://github.com/ruby/ostruct/pull/37 # Thanks to @Laykou # # Calling this in OpenStruct 0.5.2 fails: # os = OpenStruct.new(class: "my-class", method: "post") if defined?(OpenStruct::VERSION) && OpenStruct::VERSION == "0.5.2" class OpenStruct private def is_method_protected!(name) if !respond_to?(name, true) false elsif name.match?(/!$/) true else owner = method!(name).owner if owner.instance_of?(::Class) owner < ::OpenStruct else class!.ancestors.any? do |mod| return false if mod == ::OpenStruct mod == owner end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems