class BranchableCDNAssets::FileManager::Permissions

Attributes

group[R]
others[R]
user[R]

Public Class Methods

new(int) click to toggle source
# File lib/branchable_cdn_assets/file_manager/permissions.rb, line 8
def initialize int
  @user, @group, @others = int.to_s.chars.to_a
end

Public Instance Methods

to_chmod() click to toggle source
# File lib/branchable_cdn_assets/file_manager/permissions.rb, line 12
def to_chmod
  Struct.new(:user, :group, :others)
        .new( chmod_map(user), chmod_map(group), chmod_map(others) )
end

Private Instance Methods

chmod_map(num) click to toggle source
# File lib/branchable_cdn_assets/file_manager/permissions.rb, line 19
def chmod_map num
  {
    "7" => "rwx",
    "6" => "rw",
    "5" => "rx",
    "4" => "r",
    "3" => "wx",
    "2" => "w",
    "1" => "x",
    "0" => "-"
  }.fetch num
end