Class: Rabbit::READMEParser

Inherits:
Object
  • Object
show all
Includes:
GetText, PathManipulatable
Defined in:
lib/rabbit/readme-parser.rb

Constant Summary

Constants included from GetText

GetText::DOMAIN

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from GetText

included

Constructor Details

#initialize(logger = nil) ⇒ READMEParser

Returns a new instance of READMEParser.



27
28
29
30
31
# File 'lib/rabbit/readme-parser.rb', line 27

def initialize(logger=nil)
  @logger = logger || Logger.default
  @title = nil
  @description = nil
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



26
27
28
# File 'lib/rabbit/readme-parser.rb', line 26

def description
  @description
end

#loggerObject

Returns the value of attribute logger.



25
26
27
# File 'lib/rabbit/readme-parser.rb', line 25

def logger
  @logger
end

#titleObject (readonly)

Returns the value of attribute title.



26
27
28
# File 'lib/rabbit/readme-parser.rb', line 26

def title
  @title
end

Instance Method Details

#parse(path = nil) ⇒ Object



33
34
35
36
37
38
# File 'lib/rabbit/readme-parser.rb', line 33

def parse(path=nil)
  path ||= remove_backup_paths(Dir.glob("README*"))[0]
  raise _("No README found") if path.nil?

  parse_content(File.read(path), File.extname(path))
end