Module: SimpleContentManagement::ContentText
- Extended by:
- ActiveSupport::Concern
- Included in:
- SimplePage
- Defined in:
- lib/simple_content_management/content_text.rb
Instance Method Summary collapse
Instance Method Details
#update_content_text ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/simple_content_management/content_text.rb', line 13 def update_content_text tmpfile = Tempfile.new "content-text" begin tmpfile.write self.content_html tmpfile.flush # IO.popen for safe execution of commands within JRuby. backticks + utf8 = error self.content_text = IO.popen(%{lynx -dump -force_html "#{tmpfile.path}"}, "rb").read ensure tmpfile.close true # `true` also deletes (unlinks) the file end end |
#update_content_text! ⇒ Object
8 9 10 11 |
# File 'lib/simple_content_management/content_text.rb', line 8 def update_content_text! update_content_text save end |