Sha256: b7dd54f46ceefadb096ca36f4940ba7127eaf9c62619625cf0efc6fde0c4ee19

Contents?: true

Size: 830 Bytes

Versions: 2

Compression:

Stored size: 830 Bytes

Contents

module Fortitude
  module Erector
    class << self
      def is_erector_available?
        @is_erector_available ||= begin
          begin
            gem 'erector'
          rescue Gem::LoadError => le
            # ok
          end

          begin
            require 'erector'
          rescue LoadError => le
            # ok
          end

          if defined?(::Erector::Widget) then :yes else :no end
        end

        @is_erector_available == :yes
      end

      def is_erector_widget_class?(widget_class)
        return false unless is_erector_available?
        return false unless widget_class.kind_of?(::Class)
        return true if widget_class == ::Erector::Widget
        return false if widget_class == ::Object
        return is_erector_widget_class?(widget_class.superclass)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fortitude-0.0.9-java lib/fortitude/erector.rb
fortitude-0.0.9 lib/fortitude/erector.rb