class Ticard::Parser

Public Class Methods

new(text) click to toggle source
# File lib/ticard/parser.rb, line 4
def initialize(text)
  @text = text
end

Public Instance Methods

content() click to toggle source
# File lib/ticard/parser.rb, line 12
def content
  regex = /.*<!---.*?-->[\b\n]*(.*)/m
  regex.match(@text)[1]
end
metadata(field) click to toggle source
# File lib/ticard/parser.rb, line 17
def metadata(field)
  regex = /.*<!---.*?^\b*#{field} (.+?)$.*-->.+/m
  regex.match(@text)[1]
end
parse() click to toggle source
# File lib/ticard/parser.rb, line 8
def parse
  Card.new(content, :url => metadata("url"), :stored_md5 => metadata("md5"))
end