Class: RDoc::Parser::ChangeLog::Git::LogEntry
- Inherits:
-
Struct
- Object
- Struct
- RDoc::Parser::ChangeLog::Git::LogEntry
- Defined in:
- lib/rdoc/parser/changelog.rb
Constant Summary collapse
- HEADING_LEVEL =
3
Instance Attribute Summary collapse
-
#author ⇒ Object
Returns the value of attribute author.
-
#base ⇒ Object
Returns the value of attribute base.
-
#commit ⇒ Object
Returns the value of attribute commit.
-
#contents ⇒ Object
Returns the value of attribute contents.
-
#date ⇒ Object
Returns the value of attribute date.
-
#email ⇒ Object
Returns the value of attribute email.
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #aref ⇒ Object
-
#initialize(base, commit, author, email, date, contents) ⇒ LogEntry
constructor
A new instance of LogEntry.
- #label(context = nil) ⇒ Object
- #level ⇒ Object
-
#pretty_print(q) ⇒ Object
:nodoc:.
- #text ⇒ Object
Constructor Details
#initialize(base, commit, author, email, date, contents) ⇒ LogEntry
Returns a new instance of LogEntry.
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
# File 'lib/rdoc/parser/changelog.rb', line 258 def initialize(base, commit, , email, date, contents) case contents when String contents = RDoc::Markdown.parse(contents).parts.each do |body| case body when RDoc::Markup::Heading body.level += HEADING_LEVEL + 1 end end case first = contents[0] when RDoc::Markup::Paragraph contents[0] = RDoc::Markup::Heading.new(HEADING_LEVEL + 1, first.text) end end super end |
Instance Attribute Details
#author ⇒ Object
Returns the value of attribute author
255 256 257 |
# File 'lib/rdoc/parser/changelog.rb', line 255 def @author end |
#base ⇒ Object
Returns the value of attribute base
255 256 257 |
# File 'lib/rdoc/parser/changelog.rb', line 255 def base @base end |
#commit ⇒ Object
Returns the value of attribute commit
255 256 257 |
# File 'lib/rdoc/parser/changelog.rb', line 255 def commit @commit end |
#contents ⇒ Object
Returns the value of attribute contents
255 256 257 |
# File 'lib/rdoc/parser/changelog.rb', line 255 def contents @contents end |
#date ⇒ Object
Returns the value of attribute date
255 256 257 |
# File 'lib/rdoc/parser/changelog.rb', line 255 def date @date end |
#email ⇒ Object
Returns the value of attribute email
255 256 257 |
# File 'lib/rdoc/parser/changelog.rb', line 255 def email @email end |
Instance Method Details
#accept(visitor) ⇒ Object
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
# File 'lib/rdoc/parser/changelog.rb', line 298 def accept visitor visitor.accept_heading self begin if visitor.respond_to?(:code_object=) code_object = visitor.code_object visitor.code_object = self end contents.each do |body| body.accept visitor end ensure if visitor.respond_to?(:code_object) visitor.code_object = code_object end end end |
#aref ⇒ Object
279 280 281 |
# File 'lib/rdoc/parser/changelog.rb', line 279 def aref "label-#{commit}" end |
#label(context = nil) ⇒ Object
283 284 285 |
# File 'lib/rdoc/parser/changelog.rb', line 283 def label context = nil aref end |
#level ⇒ Object
275 276 277 |
# File 'lib/rdoc/parser/changelog.rb', line 275 def level HEADING_LEVEL end |
#pretty_print(q) ⇒ Object
:nodoc:
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
# File 'lib/rdoc/parser/changelog.rb', line 315 def pretty_print q # :nodoc: q.group(2, '[log_entry: ', ']') do q.text commit q.text ',' q.breakable q.group(2, '[date: ', ']') { q.text date } q.text ',' q.breakable q.group(2, '[author: ', ']') { q.text } q.text ',' q.breakable q.group(2, '[email: ', ']') { q.text email } q.text ',' q.breakable q.pp contents end end |
#text ⇒ Object
287 288 289 290 291 292 293 294 295 296 |
# File 'lib/rdoc/parser/changelog.rb', line 287 def text case base when nil "#{date}" when /%s/ "{#{date}}[#{base % commit}]" else "{#{date}}[#{base}#{commit}]" end + " {#{}}[mailto:#{email}]" end |