Method: Net::SFTP::Protocol::V01::Attributes.from_buffer

Defined in:
lib/net/sftp/protocol/01/attributes.rb

.from_buffer(buffer) ⇒ Object

Parses the given buffer and returns an Attributes object compsed from the data extracted from it.



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/net/sftp/protocol/01/attributes.rb', line 59

def from_buffer(buffer)
  flags = buffer.read_long
  data = {}

  elements.each do |name, type, condition|
    if flags & condition == condition
      if type == :special
        data[name] = send("parse_#{name}", buffer)
      else
        data[name] = buffer.send("read_#{type}")
      end
    end
  end

  new(data)
end