Class: Schoolmaster::BaseAnalyser

Inherits:
Object
  • Object
show all
Defined in:
lib/schoolmaster/analysers/base_analyser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ BaseAnalyser

Returns a new instance of BaseAnalyser.



5
6
7
8
# File 'lib/schoolmaster/analysers/base_analyser.rb', line 5

def initialize(params)
  @command = params.fetch(:command, "")
  @args = params.fetch(:args, [])
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



3
4
5
# File 'lib/schoolmaster/analysers/base_analyser.rb', line 3

def args
  @args
end

#commandObject (readonly)

Returns the value of attribute command.



3
4
5
# File 'lib/schoolmaster/analysers/base_analyser.rb', line 3

def command
  @command
end

Instance Method Details

#default_argsObject



15
16
17
# File 'lib/schoolmaster/analysers/base_analyser.rb', line 15

def default_args
  []
end

#runObject



10
11
12
13
# File 'lib/schoolmaster/analysers/base_analyser.rb', line 10

def run
  arg_str = (args | default_args).join(" ")
  system("#{command} #{arg_str}")
end