class Cult::Driver

Attributes

required_gems[RW]

Public Class Methods

driver_name() click to toggle source
# File lib/cult/driver.rb, line 25
def driver_name
  name.split('::')
      .last
      .sub(/Driver\z/, '')
      .gsub(/([a-z])([A-Z])/, '\1-\2')
      .downcase
end
inspect() click to toggle source
Calls superclass method
# File lib/cult/driver.rb, line 34
def inspect
  self == Driver ? super : "#{super}/#{driver_name}"
end
Also aliased as: to_s
named_array_identifier() click to toggle source
# File lib/cult/driver.rb, line 40
def named_array_identifier
  driver_name
end
new(*args) click to toggle source
Calls superclass method
# File lib/cult/driver.rb, line 83
def self.new(*args)
  try_requires!
  super
end
setup!() click to toggle source
# File lib/cult/driver.rb, line 78
def self.setup!
  try_requires!
end
to_s()
Alias for: inspect
try_requires!() click to toggle source

Attempts to loads all of the required gems before doing any real work

# File lib/cult/driver.rb, line 56
def self.try_requires!
  req = Array(required_gems).map do |gem|
    begin
      require gem
      nil
    rescue LoadError
      gem
    end
  end.compact

  unless req.empty?
    fail GemNeededError.new(req)
  end
end

Public Instance Methods

inspect() click to toggle source
# File lib/cult/driver.rb, line 45
def inspect
  "\#<#{self.class.name} \"#{self.class.driver_name}\">"
end
to_s() click to toggle source
# File lib/cult/driver.rb, line 50
def to_s
  self.class.driver_name
end