Class: Grepity::Line
- Inherits:
-
Object
- Object
- Grepity::Line
- Defined in:
- lib/grepity/line.rb
Instance Attribute Summary collapse
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
Instance Method Summary collapse
-
#initialize(contents, number) ⇒ Line
constructor
A new instance of Line.
- #result(text, options = {}) ⇒ Object
Constructor Details
#initialize(contents, number) ⇒ Line
Returns a new instance of Line.
7 8 9 |
# File 'lib/grepity/line.rb', line 7 def initialize(contents, number) @contents, @number = contents, number + 1 end |
Instance Attribute Details
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
5 6 7 |
# File 'lib/grepity/line.rb', line 5 def contents @contents end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
5 6 7 |
# File 'lib/grepity/line.rb', line 5 def number @number end |
Instance Method Details
#result(text, options = {}) ⇒ Object
11 12 13 14 |
# File 'lib/grepity/line.rb', line 11 def result(text, = {}) return colorized_line_with_text(number, text) if [:line] colorized_text(text) end |