Class: Ykutils::FilePermision
- Inherits:
-
Object
- Object
- Ykutils::FilePermision
- Defined in:
- lib/ykutils/filepermision.rb
Defined Under Namespace
Classes: PermisionEntry
Instance Attribute Summary collapse
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#other ⇒ Object
readonly
Returns the value of attribute other.
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
Instance Method Summary collapse
-
#initialize(str) ⇒ FilePermision
constructor
A new instance of FilePermision.
- #to_hash ⇒ Object
- #to_s ⇒ Object
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
#group ⇒ Object (readonly)
Returns the value of attribute group.
3 4 5 |
# File 'lib/ykutils/filepermision.rb', line 3 def group @group end |
#other ⇒ Object (readonly)
Returns the value of attribute other.
3 4 5 |
# File 'lib/ykutils/filepermision.rb', line 3 def other @other end |
#owner ⇒ Object (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_hash ⇒ Object
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_s ⇒ Object
27 28 29 |
# File 'lib/ykutils/filepermision.rb', line 27 def to_s @owner.to_s + @group.to_s + @other.to_s end |