Class: Regenerate::ParsedRegenerateCommentLine
- Inherits:
-
Object
- Object
- Regenerate::ParsedRegenerateCommentLine
- Defined in:
- lib/regenerate/web-page.rb
Instance Attribute Summary collapse
-
#hasCommentEnd ⇒ Object
readonly
Returns the value of attribute hasCommentEnd.
-
#hasCommentStart ⇒ Object
readonly
Returns the value of attribute hasCommentStart.
-
#isEmptySection ⇒ Object
readonly
Returns the value of attribute isEmptySection.
-
#isInstanceVar ⇒ Object
readonly
Returns the value of attribute isInstanceVar.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#sectionEnd ⇒ Object
readonly
Returns the value of attribute sectionEnd.
-
#sectionStart ⇒ Object
readonly
Returns the value of attribute sectionStart.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#checkIsValid ⇒ Object
only call this method if isRejennerCommentLine returns true.
-
#initialize(line, match) ⇒ ParsedRegenerateCommentLine
constructor
A new instance of ParsedRegenerateCommentLine.
- #instanceVarName ⇒ Object
- #isRejennerCommentLine ⇒ Object
- #isRuby ⇒ Object
- #raiseParseException(message) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(line, match) ⇒ ParsedRegenerateCommentLine
Returns a new instance of ParsedRegenerateCommentLine.
179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/regenerate/web-page.rb', line 179 def initialize(line, match) @hasCommentStart = match[1] != "" @sectionStart = match[2] != "" @isInstanceVar = match[4] != "" @name = match[3] @value = match[6] @sectionEnd = match[7] != "" @hasCommentEnd = match[8] != "" @line = line @isEmptySection = @sectionStart && @sectionEnd end |
Instance Attribute Details
#hasCommentEnd ⇒ Object (readonly)
Returns the value of attribute hasCommentEnd.
176 177 178 |
# File 'lib/regenerate/web-page.rb', line 176 def hasCommentEnd @hasCommentEnd end |
#hasCommentStart ⇒ Object (readonly)
Returns the value of attribute hasCommentStart.
176 177 178 |
# File 'lib/regenerate/web-page.rb', line 176 def hasCommentStart @hasCommentStart end |
#isEmptySection ⇒ Object (readonly)
Returns the value of attribute isEmptySection.
177 178 179 |
# File 'lib/regenerate/web-page.rb', line 177 def isEmptySection @isEmptySection end |
#isInstanceVar ⇒ Object (readonly)
Returns the value of attribute isInstanceVar.
176 177 178 |
# File 'lib/regenerate/web-page.rb', line 176 def isInstanceVar @isInstanceVar end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
177 178 179 |
# File 'lib/regenerate/web-page.rb', line 177 def line @line end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
177 178 179 |
# File 'lib/regenerate/web-page.rb', line 177 def name @name end |
#sectionEnd ⇒ Object (readonly)
Returns the value of attribute sectionEnd.
176 177 178 |
# File 'lib/regenerate/web-page.rb', line 176 def sectionEnd @sectionEnd end |
#sectionStart ⇒ Object (readonly)
Returns the value of attribute sectionStart.
176 177 178 |
# File 'lib/regenerate/web-page.rb', line 176 def sectionStart @sectionStart end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
177 178 179 |
# File 'lib/regenerate/web-page.rb', line 177 def value @value end |
Instance Method Details
#checkIsValid ⇒ Object
only call this method if isRejennerCommentLine returns true
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
# File 'lib/regenerate/web-page.rb', line 212 def checkIsValid if !@isInstanceVar and !["ruby", "class"].include?(@name) raiseParseException("Unknown section name #{@name.inspect}") end if @isEmptySection and (!@hasCommentStart && !@hasCommentEnd) raiseParseException("Empty section, but is not a closed comment") end if !@sectionStart && !@hasCommentEnd raiseParseException("End of section in comment start") end if !@sectionEnd && !@hasCommentStart raiseParseException("Start of section in comment end") end if (@sectionStart && @sectionEnd) && isRuby raiseParseException("Empty ruby section") end end |
#instanceVarName ⇒ Object
203 204 205 |
# File 'lib/regenerate/web-page.rb', line 203 def instanceVarName return @name end |
#isRejennerCommentLine ⇒ Object
195 196 197 |
# File 'lib/regenerate/web-page.rb', line 195 def isRejennerCommentLine return (@hasCommentStart || @hasCommentEnd) && (@sectionStart || @sectionEnd) end |
#isRuby ⇒ Object
199 200 201 |
# File 'lib/regenerate/web-page.rb', line 199 def isRuby !@isInstanceVar && @name == "ruby" end |
#raiseParseException(message) ⇒ Object
207 208 209 |
# File 'lib/regenerate/web-page.rb', line 207 def raiseParseException() raise ParseException.new("Error parsing line #{@line.inspect}: #{message}") end |
#to_s ⇒ Object
191 192 193 |
# File 'lib/regenerate/web-page.rb', line 191 def to_s "#{@hasCommentStart ? "<!-- ":""}#{@sectionStart ? "[ ":""}#{@isInstanceVar ? "@ ":""}#{@name.inspect}#{@value ? " "+@value:""}#{@sectionEnd ? " ]":""}#{@hasCommentEnd ? " -->":""}" end |