Sha256: 3b76f02617b63035d310560411c6e2135c09fdcd7ea640931d2d43b888642fbe
Contents?: true
Size: 969 Bytes
Versions: 1
Compression:
Stored size: 969 Bytes
Contents
module FakeEtc def self.add_groups(group_hash) group_hash.each do |group_name, group_info| group = Struct::Group.new(group_name, 'x', group_info[:gid], group_info[:mem]) @groups[group_name] = group end end def self.clear_groups @groups = {} end def self.getgrnam(group_name) group = @groups[group_name] fail ArgumentError, "can't find group for #{group_name}" if group.nil? group end def self.getgrgid(gid) group = @groups.values.find { |g| g.gid == gid } fail ArgumentError, "can't find group for #{gid}" if group.nil? group end def self.getgrent @group_ents ||= @groups.values @group_ents.shift end def self.endgrent @group_ents = nil end def self.group return getgrent unless block_given? @groups.values.each do |g| yield g end endgrent nil end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fakeetc-0.1.0 | lib/fakeetc/groups.rb |