Class: RDoc::Generator::POT::MessageExtractor
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/rdoc/generator/pot/message_extractor.rb |
Overview
Extracts message from ::RDoc::Store
Class Method Summary
-
.new(store) ⇒ MessageExtractor
constructor
Creates a message extractor for
store
.
Instance Method Summary
-
#extract
Extracts messages from
store
, stores them intoPO
and returns it. - #entry(msgid, options) private
- #extract_from_klass(klass) private
- #extract_text(text, comment, location = nil) private
Constructor Details
.new(store) ⇒ MessageExtractor
Creates a message extractor for store
.
Instance Method Details
#entry(msgid, options) (private)
[ GitHub ]#extract
Extracts messages from store
, stores them into PO
and returns it.
# File 'lib/rdoc/generator/pot/message_extractor.rb', line 19
def extract @store.all_classes_and_modules.each do |klass| extract_from_klass(klass) end @po end
#extract_from_klass(klass) (private)
[ GitHub ]# File 'lib/rdoc/generator/pot/message_extractor.rb', line 28
def extract_from_klass klass extract_text(klass.comment_location, klass.full_name) klass.each_section do |section, constants, attributes| extract_text(section.title, "#{klass.full_name}: section title") section.comments.each do |comment| extract_text(comment, "#{klass.full_name}: #{section.title}") end end klass.each_constant do |constant| extract_text(constant.comment, constant.full_name) end klass.each_attribute do |attribute| extract_text(attribute.comment, attribute.full_name) end klass.each_method do |method| extract_text(method.comment, method.full_name) end end
#extract_text(text, comment, location = nil) (private)
[ GitHub ]# File 'lib/rdoc/generator/pot/message_extractor.rb', line 51
def extract_text text, comment, location = nil return if text.nil? = { :extracted_comment => comment, :references => [location].compact, } i18n_text = RDoc::I18n::Text.new(text) i18n_text. do |part| @po.add(entry(part[:paragraph], )) end end