Class: RDoc::Readme

Inherits:
Object
  • Object
show all
Defined in:
lib/rdoc-readme.rb,
lib/rdoc-readme/version.rb,
lib/rdoc-readme/rake_task.rb

Overview

:nodoc:

Defined Under Namespace

Classes: RakeTask

Constant Summary collapse

VERSION =
'0.1.2'

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Readme

Create new RDoc::Readme generator.

Yields:

  • (_self)

Yield Parameters:

  • _self (RDoc::Readme)

    the object that the method was called on



46
47
48
49
# File 'lib/rdoc-readme.rb', line 46

def initialize
  yield self if block_given?
  self
end

Instance Method Details

#from_file(fn) ⇒ Object

Read RDoc from file. Returns Array of output lines.

Params:

+fn+:: Read from this file.


78
79
80
# File 'lib/rdoc-readme.rb', line 78

def from_file(fn)
  from_file_handle( File.open(fn) )
end

#from_file_handle(fh) ⇒ Object

Read RDoc from file handle. Returns Array of output lines.

Params:

+fh+:: Read from this file handle.


56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/rdoc-readme.rb', line 56

def from_file_handle(fh)
  out   = []
  rdoc  = false

  fh.readlines.each do |line|
    line.chomp!

    if rdoc
      _comment?(line) ? ( out << _sanitize(line) )               : rdoc = false
    else
      _start?(line)   ? ( rdoc = true ; out << _sanitize(line) ) : rdoc = false
    end
  end

  out
end