Class: Statistrano::Util::FilePermissions

Inherits:
Object
  • Object
show all
Defined in:
lib/statistrano/util/file_permissions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(int) ⇒ FilePermissions

Returns a new instance of FilePermissions.



8
9
10
# File 'lib/statistrano/util/file_permissions.rb', line 8

def initialize int
  @user, @group, @others = int.to_s.chars.to_a
end

Instance Attribute Details

#groupObject (readonly)

Returns the value of attribute group.



6
7
8
# File 'lib/statistrano/util/file_permissions.rb', line 6

def group
  @group
end

#othersObject (readonly)

Returns the value of attribute others.



6
7
8
# File 'lib/statistrano/util/file_permissions.rb', line 6

def others
  @others
end

#userObject (readonly)

Returns the value of attribute user.



6
7
8
# File 'lib/statistrano/util/file_permissions.rb', line 6

def user
  @user
end

Instance Method Details

#to_chmodObject



12
13
14
15
# File 'lib/statistrano/util/file_permissions.rb', line 12

def to_chmod
  Struct.new(:user, :group, :others)
        .new( chmod_map(user), chmod_map(group), chmod_map(others) )
end