Class: Tipi::Parser
- Inherits:
-
Object
- Object
- Tipi::Parser
- Defined in:
- lib/tipi/parser.rb
Instance Attribute Summary collapse
-
#allowed_schemes ⇒ Object
Returns the value of attribute allowed_schemes.
-
#extensions ⇒ Object
writeonly
Sets the attribute extensions.
-
#no_escape ⇒ Object
writeonly
Sets the attribute no_escape.
Instance Method Summary collapse
- #extensions? ⇒ Boolean
-
#initialize(text, options = {}) ⇒ Parser
constructor
A new instance of Parser.
- #no_escape? ⇒ Boolean
- #to_html ⇒ Object
Constructor Details
#initialize(text, options = {}) ⇒ Parser
Returns a new instance of Parser.
12 13 14 15 16 17 |
# File 'lib/tipi/parser.rb', line 12 def initialize(text, = {}) @allowed_schemes = %w(http https ftp ftps) @text = text @extensions = @no_escape = nil .each_pair {|k,v| send("#{k}=", v) } end |
Instance Attribute Details
#allowed_schemes ⇒ Object
Returns the value of attribute allowed_schemes.
6 7 8 |
# File 'lib/tipi/parser.rb', line 6 def allowed_schemes @allowed_schemes end |
#extensions=(value) ⇒ Object (writeonly)
Sets the attribute extensions
7 8 9 |
# File 'lib/tipi/parser.rb', line 7 def extensions=(value) @extensions = value end |
#no_escape=(value) ⇒ Object (writeonly)
Sets the attribute no_escape
9 10 11 |
# File 'lib/tipi/parser.rb', line 9 def no_escape=(value) @no_escape = value end |
Instance Method Details
#extensions? ⇒ Boolean
8 |
# File 'lib/tipi/parser.rb', line 8 def extensions?; @extensions; end |
#no_escape? ⇒ Boolean
10 |
# File 'lib/tipi/parser.rb', line 10 def no_escape?; @no_escape; end |
#to_html ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/tipi/parser.rb', line 19 def to_html @out = '' @p = false @stack = [] parse_block(@text) @out end |