Class: PagesCore::HtmlFormatter
- Inherits:
-
Object
- Object
- PagesCore::HtmlFormatter
- Includes:
- ActionView::Helpers::AssetTagHelper, ImagesHelper
- Defined in:
- app/formatters/pages_core/html_formatter.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(string, options = {}) ⇒ HtmlFormatter
constructor
A new instance of HtmlFormatter.
- #to_html ⇒ Object
Methods included from ImagesHelper
#dynamic_image_tag, #original_dynamic_image_tag, #uncropped_dynamic_image_tag
Constructor Details
#initialize(string, options = {}) ⇒ HtmlFormatter
Returns a new instance of HtmlFormatter.
13 14 15 16 |
# File 'app/formatters/pages_core/html_formatter.rb', line 13 def initialize(string, = {}) @string = string @options = end |
Class Method Details
.to_html(string, options = {}) ⇒ Object
8 9 10 |
# File 'app/formatters/pages_core/html_formatter.rb', line 8 def to_html(string, = {}) new(string, ).to_html end |
Instance Method Details
#to_html ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'app/formatters/pages_core/html_formatter.rb', line 18 def to_html string = parse_images(parse_files((@string))) if @options[:shorten] && string.length > @options[:shorten] string = string[0..@options[:shorten]] + "..." end string += " #{@options[:append]}" if @options[:append] RedCloth.new(string).to_html.html_safe end |