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 c8fb62c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/stimulus_reflex/open_struct_fix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Calling this in OpenStruct 0.5.2 fails:
# os = OpenStruct.new(class: "my-class", method: "post")

if OpenStruct::VERSION == "0.5.2"
if defined?(OpenStruct::VERSION) && OpenStruct::VERSION == "0.5.2"
class OpenStruct
private def is_method_protected!(name)
if !respond_to?(name, true)
Expand All @@ -15,10 +15,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 c8fb62c

Please sign in to comment.