Class: GooglePlusMarkdown
- Inherits:
-
Object
- Object
- GooglePlusMarkdown
- Defined in:
- lib/googleplus_markdown.rb
Instance Method Summary collapse
Instance Method Details
#convert(data) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/googleplus_markdown.rb', line 11 def convert(data) # Let's declare the output string. markdown = "" # I need the creation date so I can set the file name. # Of course, Google can't just call it a 'created' date. date_created = data['published'] file_name = "#{date_created}.md" # Instead of doing multiple writes to a file, I'm going to # build a string that I can pass around to various functions. # When I'm done, I'll write *that* to the file. markdown.concat(generate_front_matter(data)) # I'm getting the raw text of the post, with Google+'s half-assed # implementation of Textile for markup. markdown.concat("#{retrieve_post_content(data)}\n\n") # Let's get some photos tacked onto the end, shall we? markdown.concat("#{attach_images(data)}\n") # If anybody replied to these posts, let's retrieve the replies # and tack them onto the end. Some of them are actually worth a damn. replies = data['object']['replies']['items'] unless(replies == nil) markdown.concat("#{retrieve_replies(replies)}") end handle_file_io(markdown, file_name) end |