Class: EacRubyUtils::Envs::Executable
- Includes:
- SimpleCache
- Defined in:
- lib/eac_ruby_utils/envs/executable.rb
Defined Under Namespace
Classes: ProgramNotFoundError
Constant Summary
Constants included from SimpleCache
SimpleCache::UNCACHED_METHOD_PATTERN
Instance Attribute Summary collapse
-
#check_args ⇒ Object
readonly
Returns the value of attribute check_args.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #command(*command_args) ⇒ Object
- #exist? ⇒ Boolean
-
#initialize(env, name, *check_args) ⇒ Executable
constructor
A new instance of Executable.
- #validate ⇒ Object
- #validate! ⇒ Object
Methods included from SimpleCache
#method_missing, #reset_cache, #respond_to_missing?
Constructor Details
#initialize(env, name, *check_args) ⇒ Executable
Returns a new instance of Executable.
12 13 14 15 16 |
# File 'lib/eac_ruby_utils/envs/executable.rb', line 12 def initialize(env, name, *check_args) @env = env @name = name @check_args = check_args end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class EacRubyUtils::SimpleCache
Instance Attribute Details
#check_args ⇒ Object (readonly)
Returns the value of attribute check_args.
10 11 12 |
# File 'lib/eac_ruby_utils/envs/executable.rb', line 10 def check_args @check_args end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
10 11 12 |
# File 'lib/eac_ruby_utils/envs/executable.rb', line 10 def env @env end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/eac_ruby_utils/envs/executable.rb', line 10 def name @name end |
Instance Method Details
#command(*command_args) ⇒ Object
34 35 36 37 |
# File 'lib/eac_ruby_utils/envs/executable.rb', line 34 def command(*command_args) validate! env.command(name, *command_args) end |
#exist? ⇒ Boolean
18 19 20 |
# File 'lib/eac_ruby_utils/envs/executable.rb', line 18 def exist? exist end |
#validate ⇒ Object
22 23 24 25 26 |
# File 'lib/eac_ruby_utils/envs/executable.rb', line 22 def validate return nil if exist? "Program \"#{name}\" not found in environment #{env}" end |
#validate! ⇒ Object
28 29 30 31 32 |
# File 'lib/eac_ruby_utils/envs/executable.rb', line 28 def validate! = validate raise ProgramNotFoundError, if end |