lib/vernacular.rb in vernacular-0.1.0 vs lib/vernacular.rb in vernacular-0.1.1
- old
+ new
@@ -84,17 +84,24 @@
private
def install
@installed ||=
- if defined?(Bootsnap)
+ if defined?(Bootsnap) && using_bootsnap_compilation?
class << Bootsnap::CompileCache::ISeq
prepend ::Vernacular::BootsnapMixin
end
else
class << RubyVM::InstructionSequence
prepend ::Vernacular::InstructionSequenceMixin
end
end
+ end
+
+ def using_bootsnap_compilation?
+ filepath, = RubyVM::InstructionSequence.method(:load_iseq).source_location
+ filepath =~ %r{/bootsnap/}
+ rescue NameError
+ false
end
end
end