Class: Adjutant::Line
- Inherits:
-
Struct
- Object
- Struct
- Adjutant::Line
- Defined in:
- lib/adjutant/line.rb
Constant Summary collapse
- COMMENT_SIGN =
"#"
- USERNAME_SIGN =
"@"
- TODO_LINE =
"TODO:"
Instance Attribute Summary collapse
-
#line ⇒ Object
Returns the value of attribute line.
Instance Method Summary collapse
- #contain_comment? ⇒ Boolean
- #contain_todo? ⇒ Boolean
- #contain_username? ⇒ Boolean
- #empty_comment? ⇒ Boolean
- #end_of_comment? ⇒ Boolean
- #point_of_interes? ⇒ Boolean
- #usefull? ⇒ Boolean
- #usefull_text ⇒ Object
Instance Attribute Details
#line ⇒ Object
Returns the value of attribute line
2 3 4 |
# File 'lib/adjutant/line.rb', line 2 def line @line end |
Instance Method Details
#contain_comment? ⇒ Boolean
9 |
# File 'lib/adjutant/line.rb', line 9 def contain_comment?() line.scan(/\+\s*#{COMMENT_SIGN}/).any? end |
#contain_todo? ⇒ Boolean
13 |
# File 'lib/adjutant/line.rb', line 13 def contain_todo?() line.scan(/#{TODO_LINE}/).any? end |
#contain_username? ⇒ Boolean
12 |
# File 'lib/adjutant/line.rb', line 12 def contain_username?() line.scan(/(#{USERNAME_SIGN}\w+)/).any? end |
#empty_comment? ⇒ Boolean
16 |
# File 'lib/adjutant/line.rb', line 16 def empty_comment?() line.scan(/\+\s*#{COMMENT_SIGN}\s*(\S+)/).empty? end |
#end_of_comment? ⇒ Boolean
15 |
# File 'lib/adjutant/line.rb', line 15 def end_of_comment?() contain_comment?() ? empty_comment? : true end |
#point_of_interes? ⇒ Boolean
11 |
# File 'lib/adjutant/line.rb', line 11 def point_of_interes?() contain_username? || contain_todo? end |
#usefull? ⇒ Boolean
7 |
# File 'lib/adjutant/line.rb', line 7 def usefull?() contain_comment? && point_of_interes? end |
#usefull_text ⇒ Object
18 19 20 21 |
# File 'lib/adjutant/line.rb', line 18 def usefull_text matched = line.scan(/\+\s*#\s*/).first line[matched.size .. -1] unless matched.nil? end |