In Files

  • net-imap-0.2.2/lib/net/imap/command_data.rb

Net::IMAP::StringFormatter

Constants

LITERAL_REGEX

Public Instance Methods

nstring(str) click to toggle source

coerces non-nil using to_s

 
               # File net-imap-0.2.2/lib/net/imap/command_data.rb, line 294
def nstring(str)
  str.nil? ? nil : string(str)
end
            
string(str) click to toggle source

coerces using to_s

 
               # File net-imap-0.2.2/lib/net/imap/command_data.rb, line 284
def string(str)
  str = str.to_s
  if str =~ LITERAL_REGEX
    Literal.new(str)
  else
    QuotedString.new(str)
  end
end
            
valid_nstring?(str) click to toggle source

Allows nil, symbols, and strings

 
               # File net-imap-0.2.2/lib/net/imap/command_data.rb, line 279
def valid_nstring?(str)
  str.nil? || valid_string?(str)
end
            
valid_string?(str) click to toggle source

Allows symbols in addition to strings

 
               # File net-imap-0.2.2/lib/net/imap/command_data.rb, line 274
def valid_string?(str)
  str.is_a?(Symbol) || str.respond_to?(:to_str)
end