Class: SynchronizeUsers::FromGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/synchronize-users/from_group.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection, query, target_group) ⇒ FromGroup

Returns a new instance of FromGroup.



3
4
5
6
7
# File 'lib/synchronize-users/from_group.rb', line 3

def initialize(connection, query, target_group)
  @connection = connection
  @query = query
  @target_group = target_group
end

Instance Method Details

#each_new_userObject



9
10
11
12
13
14
15
# File 'lib/synchronize-users/from_group.rb', line 9

def each_new_user
  @connection.find(@query).each do |group|
    group.members.each do |member|
      yield member unless @target_group.has_user?(member)
    end
  end
end