Class: Count

Inherits:
Common show all
Defined in:
lib/glark/output/count.rb

Direct Known Subclasses

Glark::Count, Grep::Count

Instance Attribute Summary

Attributes inherited from Formatted

#formatted

Attributes inherited from Results

#count

Instance Method Summary collapse

Methods inherited from Common

#add_match, #at_match_limit?, #displayed_name, #initialize, #process_match

Methods inherited from Formatted

#get_line_to_print, #initialize

Methods inherited from Results

#add_match, #initialize, #matched?

Constructor Details

This class inherits a constructor from Common

Instance Method Details

#display_matches?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/glark/output/count.rb', line 8

def display_matches?
  false
end

#process_end(lnum) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/glark/output/count.rb', line 19

def process_end lnum
  if @invert_match
    write_count @file.get_lines.size - @count
  elsif matched?
    write_count @count
  end
end

#write_count(ct) ⇒ Object



12
13
14
15
16
17
# File 'lib/glark/output/count.rb', line 12

def write_count ct
  if @show_file_name
    print_file_name
  end
  print_count ct
end