lib/wright/util/file_owner.rb in wright-0.4.4 vs lib/wright/util/file_owner.rb in wright-0.5.0

- old
+ new

@@ -7,13 +7,18 @@ attr_accessor :user # @return [String, Integer] the group's name or gid attr_accessor :group + def initialize(user_and_group = nil, group = nil) + self.user_and_group = user_and_group + self.group = group if group + end + # Sets user and group simultaneously. # - # @param [String, Integer] user_and_group a user in +user:group+ + # @param user_and_group [String, Integer] a user in +user:group+ # notation or a uid # # @example # owner = FileOwner.new # @@ -36,11 +41,11 @@ # @return [void] # @raise [ArgumentError] if the owner string contains more than # one colon def user_and_group=(user_and_group) user, group = split_user_and_group(user_and_group) - @user = user - @group = group if group + self.user = user + self.group = group if group end private def split_user_and_group(user_and_group)