Class: GetVersion::Executable
- Inherits:
-
Object
- Object
- GetVersion::Executable
- Defined in:
- lib/getversion/executable.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, namespace, &block) ⇒ Executable
constructor
A new instance of Executable.
- #path(dir = nil) ⇒ Object
- #version(dir = nil) ⇒ Object
Constructor Details
#initialize(name, namespace, &block) ⇒ Executable
Returns a new instance of Executable.
9 10 11 12 13 |
# File 'lib/getversion/executable.rb', line 9 def initialize(name, namespace, &block) @name = name @namespace = namespace @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
7 8 9 |
# File 'lib/getversion/executable.rb', line 7 def block @block end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/getversion/executable.rb', line 7 def name @name end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
7 8 9 |
# File 'lib/getversion/executable.rb', line 7 def namespace @namespace end |
Class Method Details
.version(name, &block) ⇒ Object
19 20 21 |
# File 'lib/getversion/executable.rb', line 19 def self.version(name, &block) Executable.new(name, nil, &block).version end |
Instance Method Details
#path(dir = nil) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/getversion/executable.rb', line 23 def path(dir=nil) dir ||= ExecutablePathFinder.find_dir @name dir = nil if dir == '.' return @name unless dir File.join dir, @name end |
#version(dir = nil) ⇒ Object
15 16 17 |
# File 'lib/getversion/executable.rb', line 15 def version(dir=nil) ExecutionContext.execute path(dir), &@block end |