Class: Skywatch::Script
- Inherits:
-
Object
- Object
- Skywatch::Script
- Defined in:
- lib/skywatch/tool.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
- #destroy ⇒ Object
- #disable ⇒ Object
- #enable ⇒ Object
- #enabled? ⇒ Boolean
-
#initialize(path) ⇒ Script
constructor
A new instance of Script.
Constructor Details
#initialize(path) ⇒ Script
Returns a new instance of Script.
173 174 175 176 |
# File 'lib/skywatch/tool.rb', line 173 def initialize(path) @path = path @name = File.basename(path) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
167 168 169 |
# File 'lib/skywatch/tool.rb', line 167 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
166 167 168 |
# File 'lib/skywatch/tool.rb', line 166 def path @path end |
Class Method Details
.[](path) ⇒ Object
169 170 171 |
# File 'lib/skywatch/tool.rb', line 169 def self.[](path) self.new(path) end |
Instance Method Details
#destroy ⇒ Object
191 192 193 |
# File 'lib/skywatch/tool.rb', line 191 def destroy rm @path end |
#disable ⇒ Object
186 187 188 189 |
# File 'lib/skywatch/tool.rb', line 186 def disable enable # since this is relative, force 0700 chmod File.stat(@path).mode & ~0100, @path end |
#enable ⇒ Object
182 183 184 |
# File 'lib/skywatch/tool.rb', line 182 def enable chmod File.stat(@path).mode | 0700, @path end |
#enabled? ⇒ Boolean
178 179 180 |
# File 'lib/skywatch/tool.rb', line 178 def enabled? File.executable? @path end |