Class: Aio::Text::MatchStringInfo
- Inherits:
-
Struct
- Object
- Struct
- Aio::Text::MatchStringInfo
- Defined in:
- lib/aio/core/text/match_string_info.rb
Overview
将提取的关键信息附带的增加所在上下文以及行数
Instance Attribute Summary collapse
-
#compare_val ⇒ Object
存放比较后的不同值,也是 MachStringInfo 类.
-
#content ⇒ Object
Returns the value of attribute content.
-
#line ⇒ Object
Returns the value of attribute line.
-
#var ⇒ Object
Returns the value of attribute var.
Instance Method Summary collapse
-
#compare_content ⇒ Object
差异值的文本.
-
#compare_line ⇒ Object
差异值的行数.
-
#compare_val? ⇒ Boolean
判断是否有compare_val值.
-
#eql?(other_match) ⇒ Boolean
覆盖原有的eql?.
-
#initialize(var, content, line) ⇒ MatchStringInfo
constructor
A new instance of MatchStringInfo.
- #inspect ⇒ Object
- #method_missing(m, *args) ⇒ Object
-
#same_content?(other_match) ⇒ Boolean
判断和另一个class是否是同一个content.
-
#same_line?(other_match) ⇒ Boolean
判断是否和另一个值为同一行.
- #to_s ⇒ Object
Constructor Details
#initialize(var, content, line) ⇒ MatchStringInfo
Returns a new instance of MatchStringInfo.
9 10 11 12 13 14 15 |
# File 'lib/aio/core/text/match_string_info.rb', line 9 def initialize(var, content, line) super( var, content, line ) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args) ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'lib/aio/core/text/match_string_info.rb', line 62 def method_missing(m, *args) if var.respond_to?(m) var.send(m, *args) else super end end |
Instance Attribute Details
#compare_val ⇒ Object
存放比较后的不同值,也是 MachStringInfo 类
7 8 9 |
# File 'lib/aio/core/text/match_string_info.rb', line 7 def compare_val @compare_val end |
#content ⇒ Object
Returns the value of attribute content
4 5 6 |
# File 'lib/aio/core/text/match_string_info.rb', line 4 def content @content end |
#line ⇒ Object
Returns the value of attribute line
4 5 6 |
# File 'lib/aio/core/text/match_string_info.rb', line 4 def line @line end |
#var ⇒ Object
Returns the value of attribute var
4 5 6 |
# File 'lib/aio/core/text/match_string_info.rb', line 4 def var @var end |
Instance Method Details
#compare_content ⇒ Object
差异值的文本
49 50 51 |
# File 'lib/aio/core/text/match_string_info.rb', line 49 def compare_content compare_val.content end |
#compare_line ⇒ Object
差异值的行数
54 55 56 |
# File 'lib/aio/core/text/match_string_info.rb', line 54 def compare_line compare_val.line end |
#compare_val? ⇒ Boolean
判断是否有compare_val值
44 45 46 |
# File 'lib/aio/core/text/match_string_info.rb', line 44 def compare_val? !@compare_val.nil? end |
#eql?(other_match) ⇒ Boolean
覆盖原有的eql?
26 27 28 |
# File 'lib/aio/core/text/match_string_info.rb', line 26 def eql?(other_match) self.to_s.eql?(other_match.to_s) end |
#inspect ⇒ Object
17 18 19 |
# File 'lib/aio/core/text/match_string_info.rb', line 17 def inspect var.to_s end |
#same_content?(other_match) ⇒ Boolean
判断和另一个class是否是同一个content
31 32 33 |
# File 'lib/aio/core/text/match_string_info.rb', line 31 def same_content?(other_match) content == other_match.content end |
#same_line?(other_match) ⇒ Boolean
判断是否和另一个值为同一行
36 37 38 39 40 41 |
# File 'lib/aio/core/text/match_string_info.rb', line 36 def same_line?(other_match) if same_content? return line == other_match.line end return false end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/aio/core/text/match_string_info.rb', line 21 def to_s var end |