Class: Tex2png::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/tex2png/command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Command

Returns a new instance of Command.



5
6
7
8
9
# File 'lib/tex2png/command.rb', line 5

def initialize(name)
  @name = name
  @path = IO.popen("which #{name}").read.chomp
  CommandNotFound.raise!(name) {path.empty?}
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/tex2png/command.rb', line 3

def name
  @name
end

#outObject (readonly)

Returns the value of attribute out.



3
4
5
# File 'lib/tex2png/command.rb', line 3

def out
  @out
end

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/tex2png/command.rb', line 3

def path
  @path
end

Instance Method Details

#run(*args) ⇒ Object



11
12
13
# File 'lib/tex2png/command.rb', line 11

def run(*args)
  Result.new(name, IO.popen(%Q|#{path} #{args.join(" ")}|, :err => [:child, :out]))
end