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 ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(name, namespace, &block) ⇒ Executable
Returns a new instance of Executable.
10 11 12 13 14 |
# File 'lib/getversion/executable.rb', line 10 def initialize(name, namespace, &block) @name = name @namespace = namespace @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
8 9 10 |
# File 'lib/getversion/executable.rb', line 8 def block @block end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/getversion/executable.rb', line 8 def name @name end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
8 9 10 |
# File 'lib/getversion/executable.rb', line 8 def namespace @namespace end |
Class Method Details
.version(name, &block) ⇒ Object
27 28 29 |
# File 'lib/getversion/executable.rb', line 27 def self.version(name, &block) Executable.new(name, nil, &block).version end |
Instance Method Details
#path ⇒ Object
21 22 23 24 25 |
# File 'lib/getversion/executable.rb', line 21 def path dir = PathFinder.find_path @name dir = nil if dir == '.' dir ? Path.new(dir, name).evaluated_path : @name end |
#version ⇒ Object
16 17 18 19 |
# File 'lib/getversion/executable.rb', line 16 def version c = ExecutionContext.new path c.execute &@block if @block end |