Class: Kanrisuru::Mode::Permission
- Inherits:
-
Object
- Object
- Kanrisuru::Mode::Permission
- Defined in:
- lib/kanrisuru/mode/permission.rb
Instance Attribute Summary collapse
-
#symbolic ⇒ Object
Returns the value of attribute symbolic.
Instance Method Summary collapse
- #all? ⇒ Boolean
- #execute=(boolean) ⇒ Object
- #execute? ⇒ Boolean
-
#initialize(numeric, symbolic) ⇒ Permission
constructor
A new instance of Permission.
- #numeric ⇒ Object
- #numeric=(numeric) ⇒ Object
- #read=(boolean) ⇒ Object
- #read? ⇒ Boolean
- #to_i ⇒ Object
- #to_s ⇒ Object
- #write=(boolean) ⇒ Object
- #write? ⇒ Boolean
Constructor Details
#initialize(numeric, symbolic) ⇒ Permission
Returns a new instance of Permission.
8 9 10 11 12 13 |
# File 'lib/kanrisuru/mode/permission.rb', line 8 def initialize(numeric, symbolic) @numeric = numeric @symbolic = symbolic update_symbolic_rwx end |
Instance Attribute Details
#symbolic ⇒ Object
Returns the value of attribute symbolic.
6 7 8 |
# File 'lib/kanrisuru/mode/permission.rb', line 6 def symbolic @symbolic end |
Instance Method Details
#all? ⇒ Boolean
27 28 29 |
# File 'lib/kanrisuru/mode/permission.rb', line 27 def all? read? && write? && execute? end |
#execute=(boolean) ⇒ Object
59 60 61 62 63 64 |
# File 'lib/kanrisuru/mode/permission.rb', line 59 def execute=(boolean) @executable = boolean update_numeric update_symbolic end |
#execute? ⇒ Boolean
74 75 76 |
# File 'lib/kanrisuru/mode/permission.rb', line 74 def execute? @executable end |
#numeric ⇒ Object
23 24 25 |
# File 'lib/kanrisuru/mode/permission.rb', line 23 def numeric @numeric.to_s end |
#numeric=(numeric) ⇒ Object
38 39 40 41 42 43 |
# File 'lib/kanrisuru/mode/permission.rb', line 38 def numeric=(numeric) @numeric = numeric update_numeric_rwx update_symbolic end |
#read=(boolean) ⇒ Object
45 46 47 48 49 50 |
# File 'lib/kanrisuru/mode/permission.rb', line 45 def read=(boolean) @readable = boolean update_numeric update_symbolic end |
#read? ⇒ Boolean
66 67 68 |
# File 'lib/kanrisuru/mode/permission.rb', line 66 def read? @readable end |
#to_i ⇒ Object
15 16 17 |
# File 'lib/kanrisuru/mode/permission.rb', line 15 def to_i numeric.to_i end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/kanrisuru/mode/permission.rb', line 19 def to_s symbolic end |
#write=(boolean) ⇒ Object
52 53 54 55 56 57 |
# File 'lib/kanrisuru/mode/permission.rb', line 52 def write=(boolean) @writeable = boolean update_numeric update_symbolic end |
#write? ⇒ Boolean
70 71 72 |
# File 'lib/kanrisuru/mode/permission.rb', line 70 def write? @writeable end |