class Mooset::SynchronizeGroup
Attributes
from[RW]
opts[RW]
to[RW]
Public Class Methods
new(from, to, opts)
click to toggle source
# File lib/mooset/synchronize_group.rb, line 5 def initialize(from, to, opts) @from = from @to = to @opts = opts end
Public Instance Methods
call()
click to toggle source
# File lib/mooset/synchronize_group.rb, line 11 def call @from.groups.find(@opts[:query]).each do |group| to_group = @to.groups.find(group) if !to_group to_group = @to.groups.import(group) end to_member_ids = to_group.members.map(&:id) group.members.each do |user| #next unless user.id =~ /Alexandru/ next if @opts[:skip] && @opts[:skip].any? { |o| user.username == o } to_user = @to.users.find(user) if !to_user to_user = @to.users.import(user) end to_group << to_user unless to_member_ids.include?(to_user.id) end end end