Class: Languages::Ruby::CommentRuby
- Defined in:
- lib/kuniri/language/ruby/comment_ruby.rb
Overview
CommentRuby is responsible for handling ruby comments.
Instance Method Summary collapse
- #get_comment(pLine) ⇒ Object
-
#initialize ⇒ CommentRuby
constructor
A new instance of CommentRuby.
- #is_multiple_line_comment?(pLine) ⇒ Boolean
- #is_multiple_line_comment_end?(pLine) ⇒ Boolean
- #is_single_line_comment?(pLine) ⇒ Boolean
- #prepare_line_comment(pString) ⇒ Object protected
Constructor Details
#initialize ⇒ CommentRuby
Returns a new instance of CommentRuby.
14 15 16 |
# File 'lib/kuniri/language/ruby/comment_ruby.rb', line 14 def initialize @flagMultipleLine = false end |
Instance Method Details
#get_comment(pLine) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/kuniri/language/ruby/comment_ruby.rb', line 19 def get_comment(pLine) # Single line return pLine.scan(/#(.*)/)[0].join if is_single_line_comment?(pLine) # Multiple line multipleLine = handle_multiple_line(pLine) return multipleLine if multipleLine return nil end |
#is_multiple_line_comment?(pLine) ⇒ Boolean
37 38 39 40 |
# File 'lib/kuniri/language/ruby/comment_ruby.rb', line 37 def is_multiple_line_comment?(pLine) return true if (pLine =~ /^=begin(.*?)/ || @flagMultipleLine) return false end |
#is_multiple_line_comment_end?(pLine) ⇒ Boolean
43 44 45 46 |
# File 'lib/kuniri/language/ruby/comment_ruby.rb', line 43 def is_multiple_line_comment_end?(pLine) return true if pLine =~ /^=end/ return false end |
#is_single_line_comment?(pLine) ⇒ Boolean
31 32 33 34 |
# File 'lib/kuniri/language/ruby/comment_ruby.rb', line 31 def is_single_line_comment?(pLine) return true if pLine =~ /#(.*)/ return false end |
#prepare_line_comment(pString) ⇒ Object (protected)
51 52 53 54 |
# File 'lib/kuniri/language/ruby/comment_ruby.rb', line 51 def prepare_line_comment(pString) return "" if pString =~ /=begin/ return pString end |