class ActiveAdmin::Dependency::Matcher
Attributes
name[R]
Public Class Methods
new(name)
click to toggle source
# File lib/active_admin/dependency.rb, line 62 def initialize(name) @name = name end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/active_admin/dependency.rb, line 86 def <=>(other) spec!.version <=> Gem::Version.create(other) end
inspect()
click to toggle source
# File lib/active_admin/dependency.rb, line 90 def inspect info = spec ? "#{spec.name} #{spec.version}" : "(missing)" "<ActiveAdmin::Dependency::Matcher for #{info}>" end
match!(*reqs)
click to toggle source
# File lib/active_admin/dependency.rb, line 78 def match!(*reqs) unless match? reqs raise DependencyError, "You provided #{spec!.name} #{spec!.version} but we need: #{reqs.join ', '}." end end
match?(*reqs)
click to toggle source
# File lib/active_admin/dependency.rb, line 74 def match?(*reqs) !!spec && Gem::Requirement.create(reqs).satisfied_by?(spec.version) end
spec()
click to toggle source
# File lib/active_admin/dependency.rb, line 66 def spec @spec ||= Gem.loaded_specs[name] end
spec!()
click to toggle source
# File lib/active_admin/dependency.rb, line 70 def spec! spec || raise(DependencyError, "To use #{name} you need to specify it in your Gemfile.") end