Sha256: 51bc128e331e433b022b70f46bd3676db1103ea78af102e599d48f8b3d0177ef
Contents?: true
Size: 906 Bytes
Versions: 5
Compression:
Stored size: 906 Bytes
Contents
module ActiveAdmin module Dependencies # Provides a simple query interface to check for gem dependencies # # ActiveAdmin::Dependencies.draper # => #<Gem::Specification:0x3ffb89c49ae0 draper-1.2.1> # # ActiveAdmin::Dependencies.draper? # => true # # ActiveAdmin::Dependencies.draper? :<=, '1.1.0' # => false # # ActiveAdmin::Dependencies.draper? :==, '1.2.1' # => true # def self.check_for(gem_name) gem_name = gem_name.to_s singleton_class.send :define_method, gem_name do Gem.loaded_specs[gem_name] end singleton_class.send :define_method, gem_name+'?' do |verb = nil, version = nil| spec = send gem_name if verb && version !!spec && spec.version.send(verb, Gem::Version.create(version)) else !!spec end end end check_for :draper end end
Version data entries
5 entries across 5 versions & 2 rubygems