Class: EacRubyUtils::Envs::File

Inherits:
Object
  • Object
show all
Defined in:
lib/eac_ruby_utils/envs/file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#envObject (readonly)

Returns the value of attribute env.



6
7
8
# File 'lib/eac_ruby_utils/envs/file.rb', line 6

def env
  @env
end

#pathObject (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

Returns:



13
14
15
# File 'lib/eac_ruby_utils/envs/file.rb', line 13

def exist?
  env.command('stat', path).execute[:exit_code].zero?
end

#readObject



17
18
19
# File 'lib/eac_ruby_utils/envs/file.rb', line 17

def read
  env.command('cat', path).execute!
end