class ActiveAdmin::Dependency::Matcher

Attributes

name[R]

Public Class Methods

new(name) click to toggle source
# File lib/active_admin/dependency.rb, line 61
def initialize(name)
  @name = name
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/active_admin/dependency.rb, line 85
def <=>(other)
  spec!.version <=> Gem::Version.create(other)
end
inspect() click to toggle source
# File lib/active_admin/dependency.rb, line 89
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 77
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 73
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 65
def spec
  @spec ||= Gem.loaded_specs[name]
end
spec!() click to toggle source
# File lib/active_admin/dependency.rb, line 69
def spec!
  spec || raise(DependencyError, "To use #{name} you need to specify it in your Gemfile.")
end