Class: CharDetector::Line
- Inherits:
-
Object
- Object
- CharDetector::Line
- Defined in:
- lib/char_detector/line.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
Instance Method Summary collapse
-
#initialize(number, content, pattern) ⇒ Line
constructor
A new instance of Line.
- #scanline ⇒ Object
Constructor Details
#initialize(number, content, pattern) ⇒ Line
Returns a new instance of Line.
3 4 5 6 7 |
# File 'lib/char_detector/line.rb', line 3 def initialize(number, content, pattern) @number = number @content = content @pattern = pattern end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
9 10 11 |
# File 'lib/char_detector/line.rb', line 9 def content @content end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
9 10 11 |
# File 'lib/char_detector/line.rb', line 9 def number @number end |
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
9 10 11 |
# File 'lib/char_detector/line.rb', line 9 def pattern @pattern end |
Instance Method Details
#scanline ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/char_detector/line.rb', line 11 def scanline return nil if matched_chars.empty? # TODO null object pattern? hash = {} hash[:line] = number hash[:columns] = matched_columns return hash end |