linqueta / rails-healthcheck

A simple way to configure a healthcheck route for a Rails application
MIT License
136 stars 10 forks source link

Makes controller private methods public #43

Closed jcavalieri closed 3 years ago

jcavalieri commented 3 years ago

The existing controller methods are helpful, so making the public can change code that looks like this:

  # -- Custom Response --
  config.custom = lambda { |controller, checker|
    return controller.render(plain: 'Everything is awesome!') unless checker.errored?
    controller.send(:verbose?) ? controller.send(:verbose_error, checker) : controller.send(:head_error)
  }

Can instead look like this:

  # -- Custom Response --
  config.custom = lambda { |controller, checker|
    return controller.render(plain: 'Everything is awesome!') unless checker.errored?
    controller.verbose? ? controller.verbose_error(checker) : controller.head_error
  }

Thoughts?