Skip to content

Commit

Permalink
fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoroth committed Jan 18, 2022
1 parent f8ddc3f commit aadb190
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/stimulus_reflex/open_struct_fix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
# Calling this in OpenStruct 0.5.2 fails:
# os = OpenStruct.new(class: "my-class", method: "post")

unless defined?(OpenStruct)
require "ostruct"
end

if OpenStruct::VERSION == "0.5.2"
class OpenStruct
private def is_method_protected!(name)
Expand All @@ -15,10 +19,10 @@ class OpenStruct
true
else
owner = method!(name).owner
if owner.class == ::Class
if owner.instance_of?(::Class)
owner < ::OpenStruct
else
self.class!.ancestors.any? do |mod|
class!.ancestors.any? do |mod|
return false if mod == ::OpenStruct
mod == owner
end
Expand Down

0 comments on commit aadb190

Please sign in to comment.