lib/headdesk/checks/teak.rb in headdesk-0.12.0 vs lib/headdesk/checks/teak.rb in headdesk-0.13.0

- old
+ new

@@ -29,24 +29,25 @@ # # Instance methods for Teak based checks # module InstanceMethods def preconditions? - apk.class?('io.teak.sdk.Teak') + begin + major, minor, revision = apk.find_class('io.teak.sdk.Teak') + .field('SDKVersion') + .value + .to_version + @teak_sdk = OpenStruct.new( + version: "#{major}.#{minor}.#{revision}", + major: major, minor: minor, revision: revision + ) + rescue NoMethodError => _e + return false + end + true end def teak_sdk - return @teak_sdk if @teak_sdk - - major, minor, revision = apk.find_class('io.teak.sdk.Teak') - .field('SDKVersion') - .value - .to_version - @teak_sdk = OpenStruct.new( - version: "#{major}.#{minor}.#{revision}", - major: major, minor: minor, revision: revision - ) - @teak_sdk end end end end