Module: Pingback

Defined in:
lib/webby-pingback.rb

Overview

This modules expects there to be a constant called Conf that is a hash with two values:

:db

Path to the SQLite database file

:forum_api_key

The Disqus forum api key to fetch the trackback url

Defined Under Namespace

Classes: Receiver, Sender

Class Method Summary collapse

Class Method Details

.toggle_trackback_done(filename, mode = true) ⇒ Object

So we don’t try to ping twice!



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/webby-pingback.rb', line 22

def self.toggle_trackback_done(filename, mode = true)
  File.open(filename, 'r+') do |file|
    pos = file.each_line do |line|
      break pos if line.match(/^trackback_done: (\w+)/)
      pos = file.pos
    end

    file.seek(pos + 16)
    file.write(' true') # Has to be 5 chars to cover all of false :)
  end
end