Class: ActiveSupport::EnvironmentInquirer
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
| 
         Class Chain: 
        
          self,
           
      StringInquirer,
          ::String
         | 
    |
| 
         Instance Chain: 
        
          self,
           
      StringInquirer,
          ::String
         | 
    |
| Inherits: | 
        ActiveSupport::StringInquirer
        
  | 
    
| Defined in: | activesupport/lib/active_support/environment_inquirer.rb | 
Constant Summary
- 
    DEFAULT_ENVIRONMENTS =
    # File 'activesupport/lib/active_support/environment_inquirer.rb', line 10
Optimization for the three default environments, so this inquirer doesn’t need to rely on the slower delegation through method_missing that
StringInquirerwould normally entail.%w[ development test production ] - 
    LOCAL_ENVIRONMENTS =
    # File 'activesupport/lib/active_support/environment_inquirer.rb', line 13
Environments that’ll respond true for #local?
%w[ development test ] 
::String - Inherited
  
Class Method Summary
- .new(env) ⇒ EnvironmentInquirer constructor
 
Instance Attribute Summary
- 
    
      #local?  ⇒ Boolean 
    
    readonly
    
Returns true if we’re in the development or test environment.
 
::String - Inherited
| #acts_like_string? | Enables more predictable duck-typing on String-like classes.  | 
    
| #blank? | A string is blank if it’s empty or contains whitespaces only:  | 
    
| #is_utf8? | Returns   | 
    
| #present? | |
Instance Method Summary
StringInquirer - Inherited
::String - Inherited
| #at | If you pass a single integer, returns a substring of one character at that position.  | 
    
| #camelcase | Alias for String#camelize.  | 
    
| #camelize | By default,   | 
    
| #classify | Creates a class name from a plural table name like Rails does for table names to models.  | 
    
| #constantize | 
  | 
    
| #dasherize | Replaces underscores with dashes in the string.  | 
    
| #deconstantize | Removes the rightmost segment from the constant expression in the string.  | 
    
| #demodulize | Removes the module part from the constant expression in the string.  | 
    
| #downcase_first | Converts the first character to lowercase.  | 
    
| #ends_with?, | |
| #exclude? | The inverse of   | 
    
| #first | Returns the first character.  | 
    
| #foreign_key | Creates a foreign key name from a class name.  | 
    
| #from | Returns a substring from the given position to the end of the string.  | 
    
| #html_safe | Marks a string as trusted safe.  | 
    
| #humanize | Capitalizes the first word, turns underscores into spaces, and (by default) strips a trailing ‘_id’ if present.  | 
    
| #in_time_zone | Converts String to a   | 
    
| #indent | Indents the lines in the receiver:  | 
    
| #indent! | Same as   | 
    
| #inquiry | Wraps the current string in the   | 
    
| #last | Returns the last character of the string.  | 
    
| #mb_chars | 
  | 
    
| #parameterize | Replaces special characters in a string so that it may be used as part of a ‘pretty’ URL.  | 
    
| #pluralize | Returns the plural form of the word in the string.  | 
    
| #remove | Returns a new string with all occurrences of the patterns removed.  | 
    
| #remove! | Alters the string by removing all occurrences of the patterns.  | 
    
| #safe_constantize | 
  | 
    
| #singularize | The reverse of   | 
    
| #squish | Returns the string, first removing all whitespace on both ends of the string, and then changing remaining consecutive whitespace groups into one space each.  | 
    
| #squish! | Performs a destructive squish.  | 
    
| #starts_with?, | |
| #strip_heredoc | Strips indentation in heredocs.  | 
    
| #tableize | Creates the name of a table like Rails does for models to table names.  | 
    
| #titlecase | Alias for String#titleize.  | 
    
| #titleize | Capitalizes all the words and replaces some characters in the string to create a nicer looking title.  | 
    
| #to | Returns a substring from the beginning of the string to the given position.  | 
    
| #to_date | Converts a string to a   | 
    
| #to_datetime | Converts a string to a   | 
    
| #to_time | Converts a string to a   | 
    
| #truncate | Truncates a given   | 
    
| #truncate_bytes | Truncates   | 
    
| #truncate_words | Truncates a given   | 
    
| #underscore | The reverse of   | 
    
| #upcase_first | Converts the first character to uppercase.  | 
    
| #as_json | |
Constructor Details
    .new(env)  ⇒ EnvironmentInquirer 
  
# File 'activesupport/lib/active_support/environment_inquirer.rb', line 15
def initialize(env) raise(ArgumentError, "'local' is a reserved environment name") if env == "local" super(env) DEFAULT_ENVIRONMENTS.each do |default| instance_variable_set :"@#{default}", env == default end @local = in? LOCAL_ENVIRONMENTS end
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ActiveSupport::StringInquirer
Instance Attribute Details
    #local?  ⇒ Boolean  (readonly)
  
Returns true if we’re in the development or test environment.
# File 'activesupport/lib/active_support/environment_inquirer.rb', line 36
def local? @local end