Class: TeutonFile
- Inherits:
-
Object
- Object
- TeutonFile
- Defined in:
- lib/teuton/case_manager/case/builtin/teuton_file.rb
Instance Method Summary collapse
- #directory? ⇒ Boolean
- #exist? ⇒ Boolean
-
#initialize(teuton_host, param) ⇒ TeutonFile
constructor
A new instance of TeutonFile.
- #regular? ⇒ Boolean
Constructor Details
#initialize(teuton_host, param) ⇒ TeutonFile
Returns a new instance of TeutonFile.
3 4 5 6 7 8 9 |
# File 'lib/teuton/case_manager/case/builtin/teuton_file.rb', line 3 def initialize(teuton_host, param) @teuton_host = teuton_host @parent = teuton_host.parent @result = @parent.result @host = teuton_host.host @param = param end |
Instance Method Details
#directory? ⇒ Boolean
17 18 19 20 21 |
# File 'lib/teuton/case_manager/case/builtin/teuton_file.rb', line 17 def directory? @parent.target("File #{@param} is directory?") @parent.run "file #{@param}", on: @host @parent.expect @result.grep_v('cannot open').grep(@param).grep('directory').count.eq 1 end |
#exist? ⇒ Boolean
11 12 13 14 15 |
# File 'lib/teuton/case_manager/case/builtin/teuton_file.rb', line 11 def exist? @parent.target("File #{@param} exists?") @parent.run "file #{@param}", on: @host @parent.expect @result.grep_v('cannot open').grep(@param).count.eq 1 end |
#regular? ⇒ Boolean
23 24 25 26 27 |
# File 'lib/teuton/case_manager/case/builtin/teuton_file.rb', line 23 def regular? @parent.target("File #{@param} is regular?") @parent.run "file #{@param}", on: @host @parent.expect @result.grep(@param).grep('directory').count.eq 0 end |