Class: TinyTds::Bin
- Inherits:
-
Object
- Object
- TinyTds::Bin
- Defined in:
- lib/tiny_tds/bin.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #info ⇒ Object
-
#initialize(name) ⇒ Bin
constructor
A new instance of Bin.
- #path ⇒ Object
- #run(*args) ⇒ Object
Constructor Details
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/tiny_tds/bin.rb', line 8 def name @name end |
Class Method Details
.exe(name, *args) ⇒ Object
11 12 13 14 15 |
# File 'lib/tiny_tds/bin.rb', line 11 def exe(name, *args) bin = new(name) puts bin.info unless args.any? { |x| x == '-q' } bin.run(*args) end |
Instance Method Details
#info ⇒ Object
39 40 41 |
# File 'lib/tiny_tds/bin.rb', line 39 def info "[TinyTds][v#{TinyTds::VERSION}][#{name}]: #{path}" end |
#path ⇒ Object
35 36 37 |
# File 'lib/tiny_tds/bin.rb', line 35 def path @path ||= @exefile && File.exist?(@exefile) ? @exefile : which end |
#run(*args) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/tiny_tds/bin.rb', line 27 def run(*args) with_ports_paths do return nil unless path Kernel.system Shellwords.join(args.unshift(path)) $CHILD_STATUS.to_i end end |