class ActiveRecordDoctor::Help
Turn a detector class into a human-readable help text.
Constants
- GLOBAL_COMMENT
- LOCAL_COMMENT
Attributes
klass[R]
Public Class Methods
new(klass)
click to toggle source
# File lib/active_record_doctor/help.rb, line 6 def initialize(klass) @klass = klass end
Public Instance Methods
to_s()
click to toggle source
# File lib/active_record_doctor/help.rb, line 10 def to_s <<-HELP #{klass.underscored_name} - #{klass.description} Configuration options: #{config_to_s} HELP end
Private Instance Methods
config_to_s()
click to toggle source
# File lib/active_record_doctor/help.rb, line 26 def config_to_s klass.config.map do |key, metadata| type = if metadata[:global] GLOBAL_COMMENT else LOCAL_COMMENT end " - #{key} (#{type}) - #{metadata.fetch(:description)}" end.join("\n") end