Class: Ykutils::FilePermision

Inherits:
Object
  • Object
show all
Defined in:
lib/ykutils/filepermision.rb

Defined Under Namespace

Classes: PermisionEntry

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str) ⇒ FilePermision

Returns a new instance of FilePermision.



21
22
23
24
25
# File 'lib/ykutils/filepermision.rb', line 21

def initialize(str)
  @owner = PermisionEntry.new(str[0..2])
  @group = PermisionEntry.new(str[3..5])
  @other = PermisionEntry.new(str[6..8])
end

Instance Attribute Details

#groupObject (readonly)

Returns the value of attribute group.



3
4
5
# File 'lib/ykutils/filepermision.rb', line 3

def group
  @group
end

#otherObject (readonly)

Returns the value of attribute other.



3
4
5
# File 'lib/ykutils/filepermision.rb', line 3

def other
  @other
end

#ownerObject (readonly)

Returns the value of attribute owner.



3
4
5
# File 'lib/ykutils/filepermision.rb', line 3

def owner
  @owner
end

Instance Method Details

#to_hashObject



31
32
33
# File 'lib/ykutils/filepermision.rb', line 31

def to_hash
  { "owner" => @owner.to_hash, "group" => @group.to_hash, "other" => @other.to_hash }
end

#to_sObject



27
28
29
# File 'lib/ykutils/filepermision.rb', line 27

def to_s
  @owner.to_s + @group.to_s + @other.to_s
end