Class: WikiSymbol
- Inherits:
-
Chunk::Abstract
- Object
- Chunk::Abstract
- WikiSymbol
- Defined in:
- app/models/chunks/wiki_symbols.rb
Instance Attribute Summary collapse
-
#symbol_code ⇒ Object
Returns the value of attribute symbol_code.
Attributes inherited from Chunk::Abstract
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(match_data, revision) ⇒ WikiSymbol
constructor
A new instance of WikiSymbol.
- #unmask(content) ⇒ Object
Methods inherited from Chunk::Abstract
#mask, #post_mask, #pre_mask, #revert
Constructor Details
#initialize(match_data, revision) ⇒ WikiSymbol
Returns a new instance of WikiSymbol.
7 8 9 10 |
# File 'app/models/chunks/wiki_symbols.rb', line 7 def initialize(match_data, revision) super(match_data, revision) @symbol_code = match_data[1] end |
Instance Attribute Details
#symbol_code ⇒ Object
Returns the value of attribute symbol_code.
5 6 7 |
# File 'app/models/chunks/wiki_symbols.rb', line 5 def symbol_code @symbol_code end |
Class Method Details
.pattern ⇒ Object
3 |
# File 'app/models/chunks/wiki_symbols.rb', line 3 def self.pattern() /<:(.*?)>/ end |
Instance Method Details
#unmask(content) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'app/models/chunks/wiki_symbols.rb', line 12 def unmask(content) tag = case symbol_code when 'cbx' then '<input type="checkbox" disabled />' when 'cbxc' then '<input type="checkbox" disabled checked />' else symbol_code end return self if content.gsub!( Regexp.new(mask(content)), tag ) end |