class StatusCat::Checkers::Base

Constants

FORMAT

Attributes

status[R]
value[R]

Public Class Methods

class_to_name(klass) click to toggle source
# File lib/status_cat/checkers/base.rb, line 10
def self.class_to_name(klass)
  klass.to_s.split('::').last.underscore.to_sym
end

Public Instance Methods

name() click to toggle source
# File lib/status_cat/checkers/base.rb, line 14
def name
  Base.class_to_name(self.class)
  # self.class.to_s.split('::').last.underscore.to_sym
end
to_s(format = FORMAT) click to toggle source
# File lib/status_cat/checkers/base.rb, line 19
def to_s(format = FORMAT)
  format(format, name, value, status || I18n.t(:ok, scope: :status_cat))
end

Protected Instance Methods

fail_on_exception() { || ... } click to toggle source

rubocop:disable Lint/RescueException

# File lib/status_cat/checkers/base.rb, line 26
def fail_on_exception
  begin
    return yield
  rescue Exception => e
    return e
  end
  return nil
end
gem_missing?(gem, present) click to toggle source

rubocop:enable Lint/RescueException

# File lib/status_cat/checkers/base.rb, line 36
def gem_missing?(gem, present)
  return false if present

  @status = "#{gem} gem is not installed"
  return true
end