Class: StatusCat::Checkers::Base

Inherits:
Object
  • Object
show all
Extended by:
ActiveSupport::DescendantsTracker
Defined in:
lib/status_cat/checkers/base.rb

Constant Summary collapse

FORMAT =
"%s | %s | %s\n".freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#statusObject (readonly)

Returns the value of attribute status.



8
9
10
# File 'lib/status_cat/checkers/base.rb', line 8

def status
  @status
end

#valueObject (readonly)

Returns the value of attribute value.



8
9
10
# File 'lib/status_cat/checkers/base.rb', line 8

def value
  @value
end

Class Method Details

.class_to_name(klass) ⇒ Object



10
11
12
# File 'lib/status_cat/checkers/base.rb', line 10

def self.class_to_name(klass)
  klass.to_s.split('::').last.underscore.to_sym
end

Instance Method Details

#nameObject



14
15
16
17
# 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) ⇒ Object



19
20
21
# 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