module Blogtext
Constants
- VERSION
Public Class Methods
cli_convert()
click to toggle source
# File lib/blogtext.rb, line 34 def self.cli_convert @filename = ARGV[0] puts @filename @changes = convert @filename IO.write(@filename,@changes) end
convert(filename)
click to toggle source
# File lib/blogtext.rb, line 29 def self.convert filename @contents = IO.read(filename) perform end
new_contents(arr)
click to toggle source
# File lib/blogtext.rb, line 12 def self.new_contents(arr) arr.join("\n") end
perform()
click to toggle source
# File lib/blogtext.rb, line 16 def self.perform res = [] @contents.each_with_index do |l,i| res.push("<h1>#{l.strip}</h1>") if (i == 0) res.push("<h3>#{l.strip}</h3>") if (i == 1) res.push(Video.add(l)) if l.start_with?("[video]") res.push(Image.add(l)) if l.start_with?("[image]") res.push(Quote.add(l)) if l.start_with?("[quote]") res.push(Paragraph.add(l.strip)) if ((i>1) && !l.start_with?("[quote]","[image]","[video]")) end @newcontents = new_contents(res) end
version_info()
click to toggle source
# File lib/blogtext/version.rb, line 4 def self.version_info puts "Blogtext gem - Version #{VERSION}" puts "Author: Ed de Almeida (evaldoajunior@gmail.com)" end