Class: WordCountRecursive::Command

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

Instance Method Summary collapse

Constructor Details

#initializeCommand

Returns a new instance of Command.



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/wcr/command.rb', line 3

def initialize
  @paths, @options = ::WordCountRecursive::ArgumentsParser.new.parse

  if @options.include? :version
    puts @options[:version]
    exit(1)
  end

  @command = `wc #{@options[:command_opts]} #{"\`find #{@paths || '.'} -type f #{@options[:hidden_files]}\`"}`
  @command = @command.split('\n').grep(/^[^\.]/)
end

Instance Method Details

#wcrObject



15
16
17
# File 'lib/wcr/command.rb', line 15

def wcr
  @command.each {|line| puts line.chomp }
end