class LicenseAuto::Readme
Attributes
license_content[R]
RDOC_EXT = /.rdoc$/ RDOC_PATTERN = //
RST_EXT = /.rst/ RST_PATTERN = //
Public Class Methods
new(filename, content)
click to toggle source
# File lib/license_auto/license/readme.rb, line 16 def initialize(filename, content) @content = content.encode('UTF-8', :invalid => :replace, :undef => :replace) impl = formator(filename) @license_content = if impl.nil? LicenseAuto.info("Unknown readme format: #{filename}, returned full-text instead") @content else impl.cut_license(@content) end end
Public Instance Methods
extensions()
click to toggle source
# File lib/license_auto/license/readme.rb, line 28 def extensions [Markdown, RDoc] end
formator(filename)
click to toggle source
# File lib/license_auto/license/readme.rb, line 32 def formator(filename) extensions.find { |format| format::FILE_EXTENSION.match(filename) } end