Class: Rubygrep::Outputter
- Inherits:
-
Object
- Object
- Rubygrep::Outputter
- Defined in:
- lib/rubygrep/outputter.rb
Constant Summary collapse
- COLORS =
{red: 31, magenta: 35}
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #error(message, line_data) ⇒ Object
-
#initialize(options = {}) ⇒ Outputter
constructor
A new instance of Outputter.
- #out(match_data, line_data) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Outputter
Returns a new instance of Outputter.
8 9 10 |
# File 'lib/rubygrep/outputter.rb', line 8 def initialize( = {}) @options = end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
6 7 8 |
# File 'lib/rubygrep/outputter.rb', line 6 def @options end |
Instance Method Details
#error(message, line_data) ⇒ Object
16 17 18 |
# File 'lib/rubygrep/outputter.rb', line 16 def error(, line_data) $stdout << "#{colorize(line_data[:path])}: #{}\n" end |
#out(match_data, line_data) ⇒ Object
12 13 14 |
# File 'lib/rubygrep/outputter.rb', line 12 def out(match_data, line_data) $stdout << (match_data, line_data) end |