Class: Adjutant::Line

Inherits:
Struct
  • Object
show all
Defined in:
lib/adjutant/line.rb

Constant Summary collapse

COMMENT_SIGN =
"#"
USERNAME_SIGN =
"@"
TODO_LINE =
"TODO:"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#lineObject

Returns the value of attribute line

Returns:

  • (Object)

    the current value of line



2
3
4
# File 'lib/adjutant/line.rb', line 2

def line
  @line
end

Instance Method Details

#contain_comment?Boolean

Returns:

  • (Boolean)


9
# File 'lib/adjutant/line.rb', line 9

def contain_comment?()  line.scan(/\+\s*#{COMMENT_SIGN}/).any?  end

#contain_todo?Boolean

Returns:

  • (Boolean)


13
# File 'lib/adjutant/line.rb', line 13

def contain_todo?()     line.scan(/#{TODO_LINE}/).any?          end

#contain_username?Boolean

Returns:

  • (Boolean)


12
# File 'lib/adjutant/line.rb', line 12

def contain_username?() line.scan(/(#{USERNAME_SIGN}\w+)/).any? end

#empty_comment?Boolean

Returns:

  • (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

Returns:

  • (Boolean)


15
# File 'lib/adjutant/line.rb', line 15

def end_of_comment?()   contain_comment?() ? empty_comment? : true       end

#point_of_interes?Boolean

Returns:

  • (Boolean)


11
# File 'lib/adjutant/line.rb', line 11

def point_of_interes?() contain_username? || contain_todo?      end

#usefull?Boolean

Returns:

  • (Boolean)


7
# File 'lib/adjutant/line.rb', line 7

def usefull?()          contain_comment? && point_of_interes?   end

#usefull_textObject



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