Class: RichText::HTML
- Inherits:
-
Object
- Object
- RichText::HTML
- Defined in:
- lib/rich-text/html.rb
Constant Summary collapse
- ConfigError =
Class.new(StandardError)
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(config) ⇒ HTML
constructor
A new instance of HTML.
- #render(delta) ⇒ Object
Constructor Details
#initialize(config) ⇒ HTML
Returns a new instance of HTML.
15 16 17 18 19 |
# File 'lib/rich-text/html.rb', line 15 def initialize(config) @default_block_tag = config.html_default_block_tag @block_tags = config. @inline_tags = config. end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
9 10 11 |
# File 'lib/rich-text/html.rb', line 9 def config @config end |
Class Method Details
Instance Method Details
#render(delta) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/rich-text/html.rb', line 21 def render(delta) raise TypeError.new("cannot convert retain or delete ops to html") unless delta.insert_only? html = delta.each_line.inject('') do |html, line| html << render_line(line) end normalize(html) end |