Class: EacRubyUtils::Envs::File
- Defined in:
- lib/eac_ruby_utils/envs/file.rb
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #exist? ⇒ Boolean
-
#initialize(env, path) ⇒ File
constructor
A new instance of File.
- #read ⇒ Object
Constructor Details
#initialize(env, path) ⇒ File
Returns a new instance of File.
8 9 10 11 |
# File 'lib/eac_ruby_utils/envs/file.rb', line 8 def initialize(env, path) @env = env @path = path end |
Instance Attribute Details
#env ⇒ Object (readonly)
Returns the value of attribute env.
6 7 8 |
# File 'lib/eac_ruby_utils/envs/file.rb', line 6 def env @env end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/eac_ruby_utils/envs/file.rb', line 6 def path @path end |
Instance Method Details
#exist? ⇒ Boolean
13 14 15 |
# File 'lib/eac_ruby_utils/envs/file.rb', line 13 def exist? env.command('stat', path).execute[:exit_code].zero? end |
#read ⇒ Object
17 18 19 |
# File 'lib/eac_ruby_utils/envs/file.rb', line 17 def read env.command('cat', path).execute! end |