module NginxTail::Inflections

Public Class Methods

component_to_module_name(component) click to toggle source
# File lib/ntail.rb, line 7
def self.component_to_module_name(component)
  # this mimicks the ActiveSupport::Inflector.camelize() method in Rails...
  component.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
end
component_to_ntail_module(component) click to toggle source
# File lib/ntail.rb, line 11
def self.component_to_ntail_module(component)
  # this mimicks the ActiveSupport::Inflector.constantize() method in Rails...
  NginxTail.const_get(self.component_to_module_name(component)) rescue nil
end