Module: Net::IMAP::StringFormatter
| Relationships & Source Files | |
| Defined in: | lib/net/imap/command_data.rb | 
Constant Summary
- 
    LITERAL_REGEX =
    
 # File 'lib/net/imap/command_data.rb', line 288/[\x80-\xff\r\n]/n
Class Method Summary
- 
    
      .nstring(str)  
    
    mod_func
    coerces non-nil using to_s
- 
    
      .string(str)  
    
    mod_func
    coerces using to_s
- 
    
      .valid_nstring?(str)  ⇒ Boolean 
    
    mod_func
    Allows nil, symbols, and strings. 
- 
    
      .valid_string?(str)  ⇒ Boolean 
    
    mod_func
    Allows symbols in addition to strings. 
Class Method Details
.nstring(str) (mod_func)
coerces non-nil using to_s
# File 'lib/net/imap/command_data.rb', line 313
def nstring(str) str.nil? ? nil : string(str) end
.string(str) (mod_func)
coerces using to_s
# File 'lib/net/imap/command_data.rb', line 303
def string(str) str = str.to_s if str =~ LITERAL_REGEX Literal.new(str) else QuotedString.new(str) end end
    .valid_nstring?(str)  ⇒ Boolean  (mod_func)
  
Allows nil, symbols, and strings
# File 'lib/net/imap/command_data.rb', line 298
def valid_nstring?(str) str.nil? || valid_string?(str) end
    .valid_string?(str)  ⇒ Boolean  (mod_func)
  
Allows symbols in addition to strings
# File 'lib/net/imap/command_data.rb', line 293
def valid_string?(str) str.is_a?(Symbol) || str.respond_to?(:to_str) end