Class: WikiContentStub
- Includes:
- ChunkManager
- Defined in:
- app/models/wiki_content.rb
Overview
A simplified version of WikiContent. Useful to avoid recursion problems in WikiContent.new
Constant Summary
Constants included from ChunkManager
ChunkManager::ACTIVE_CHUNKS, ChunkManager::HIDE_CHUNKS, ChunkManager::MASK_RE
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Attributes included from ChunkManager
#chunk_id, #chunks, #chunks_by_id, #chunks_by_type
Instance Method Summary collapse
-
#initialize(content, options) ⇒ WikiContentStub
constructor
A new instance of WikiContentStub.
-
#inside_chunks(chunk_types) ⇒ Object
Detects the mask strings contained in the text of chunks of type chunk_types and yields the corresponding chunk ids example: content = “chunk123categorychunk <pre>chunk456categorychunk</pre>” inside_chunks(Literal::Pre) ==> yield 456.
Methods included from ChunkManager
#add_chunk, #delete_chunk, #find_chunks, #init_chunk_manager, #merge_chunks, #page_id, #scan_chunkid
Methods inherited from String
Constructor Details
#initialize(content, options) ⇒ WikiContentStub
Returns a new instance of WikiContentStub.
97 98 99 100 101 |
# File 'app/models/wiki_content.rb', line 97 def initialize(content, ) super(content) @options = init_chunk_manager end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
95 96 97 |
# File 'app/models/wiki_content.rb', line 95 def @options end |
Instance Method Details
#inside_chunks(chunk_types) ⇒ Object
Detects the mask strings contained in the text of chunks of type chunk_types and yields the corresponding chunk ids example: content = “chunk123categorychunk <pre>chunk456categorychunk</pre>” inside_chunks(Literal::Pre) ==> yield 456
107 108 109 110 111 112 113 114 |
# File 'app/models/wiki_content.rb', line 107 def inside_chunks(chunk_types) chunk_types.each{|chunk_type| chunk_type.apply_to(self) } chunk_types.each{|chunk_type| @chunks_by_type[chunk_type].each{|hide_chunk| scan_chunkid(hide_chunk.text){|id| yield id } } } end |