lib/net/sftp/protocol/01/base.rb
# Normalizes the given flags parameter, converting it into a combination
# of IO constants.
Normalizes the given flags parameter, converting it into a combination
of IO constants.
Normalizes the given flags parameter converting it into a combination of IO constants .
def normalize_open_flags(flags)
        if String === flags
          case flags.tr("b", "")
          when "r"  then IO::RDONLY
          when "r+" then IO::RDWR
          when "w"  then IO::WRONLY | IO::TRUNC | IO::CREAT
          when "w+" then IO::RDWR | IO::TRUNC | IO::CREAT
          when "a"  then IO::APPEND | IO::CREAT | IO::WRONLY
          when "a+" then IO::APPEND | IO::CREAT | IO::RDWR
          else raise ArgumentError, "unsupported flags: #{flags.inspect}"
          end
        else
          flags.to_i
        end
      end
def normalize_open_flags ( flags ) if String === flags case flags . tr ( "b" , "" ) when "r" then IO :: RDONLY when "r+" then IO :: RDWR when "w" then IO :: WRONLY | IO :: TRUNC | IO :: CREAT when "w+" then IO :: RDWR | IO :: TRUNC | IO :: CREAT when "a" then IO :: APPEND | IO :: CREAT | IO :: WRONLY when "a+" then IO :: APPEND | IO :: CREAT | IO :: RDWR else raise ArgumentError , "unsupported flags: #{flags.inspect}" end else flags . to_i end end
Normalizes the given flags parameter, converting it into a combination
of IO constants.
Normalizes the given flags parameter converting it into a combination of IO constants .
flags
<not_specific>