Skip to content
  • Charles Oliver Nutter's avatar
    09e03725
    Use optimized subclass of StringInquirer for Rails.env · 09e03725
    Charles Oliver Nutter authored
    This adds a StringInquirer subclass EnvironmentInquirer that
    predefines the three default environments as query methods, in
    order to avoid dispatching through `method_missing` for every call
    to those methods. The original StringInquirer was not modified due
    to the side effects of having new env-related methods on it. This
    new class was not implemented using lazy method definition to
    avoid the open-ended possibility of defining a new method for all
    query calls. The three default environments should cover a high
    percentage of real-world uses, and users with custom environments
    could add their own to this class.
    
    Fixes #37803.
    09e03725
    Use optimized subclass of StringInquirer for Rails.env
    Charles Oliver Nutter authored
    This adds a StringInquirer subclass EnvironmentInquirer that
    predefines the three default environments as query methods, in
    order to avoid dispatching through `method_missing` for every call
    to those methods. The original StringInquirer was not modified due
    to the side effects of having new env-related methods on it. This
    new class was not implemented using lazy method definition to
    avoid the open-ended possibility of defining a new method for all
    query calls. The three default environments should cover a high
    percentage of real-world uses, and users with custom environments
    could add their own to this class.
    
    Fixes #37803.
Loading