Method: Net::SFTP::Protocol::V01::Attributes#gid

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

#gidObject

Returns the group-id of the group that owns the file, or nil if that information is not available. If a :group key exists, but not a :gid key, the Etc module will be used to reverse lookup the id from the name. This might fail on some systems (e.g., Windows).



172
173
174
175
176
177
178
# File 'lib/net/sftp/protocol/01/attributes.rb', line 172

def gid
  if attributes[:group] && !attributes.key?(:gid)
    require 'etc'
    attributes[:gid] = Etc.getgrnam(attributes[:group]).gid
  end
  attributes[:gid]
end