Class: GitWit::Actions::Dscl::GroupMembership
- Inherits:
-
Base
- Object
- Thor::Actions::EmptyDirectory
- Base
- GitWit::Actions::Dscl::GroupMembership
- Defined in:
- lib/git_wit/actions/dscl/group_membership.rb
Instance Attribute Summary collapse
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Attributes inherited from Base
Instance Method Summary collapse
- #exists? ⇒ Boolean
-
#initialize(base, user, group, config = {}) ⇒ GroupMembership
constructor
A new instance of GroupMembership.
Methods inherited from Base
Constructor Details
#initialize(base, user, group, config = {}) ⇒ GroupMembership
Returns a new instance of GroupMembership.
5 6 7 8 |
# File 'lib/git_wit/actions/dscl/group_membership.rb', line 5 def initialize(base, user, group, config = {}) super base, :group_membership, "#{user} #{group}", config @user, @group = user, group end |
Instance Attribute Details
#group ⇒ Object (readonly)
Returns the value of attribute group.
3 4 5 |
# File 'lib/git_wit/actions/dscl/group_membership.rb', line 3 def group @group end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
3 4 5 |
# File 'lib/git_wit/actions/dscl/group_membership.rb', line 3 def user @user end |
Instance Method Details
#exists? ⇒ Boolean
10 11 12 13 |
# File 'lib/git_wit/actions/dscl/group_membership.rb', line 10 def exists? check = `dsmemberutil checkmembership -U '#{user}' -G '#{group}' 2>/dev/null` $?.success? && !!(check =~ /is a member/) end |