Class: PasteHub::DropboxTodo
Instance Method Summary
collapse
Methods inherited from PluginBase
#display_config, #initialize
Instance Method Details
#newly_arrived(message) ⇒ Object
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/pastehub/plugin/dropbox_todo.rb', line 48
def newly_arrived(message)
config = PasteHub::Config.instance
path = config.publicPath
filename = todo?(message)
if filename
FileUtils.mkdir_p( path + "pastehub_todo/", { :mode => 0700 } )
open( path + "pastehub_todo/" + filename + ".txt", "w" ) {|f|
f.puts "pastehub todo"
}
STDERR.printf( "Info: Added todo [%s]\n", filename )
end
nil
end
|
#todo?(message) ⇒ Boolean
39
40
41
42
43
44
45
46
|
# File 'lib/pastehub/plugin/dropbox_todo.rb', line 39
def todo?(message)
m = message.match( /(^|[ ])[#]todo([ ]|$)/i )
if m
message.gsub( /[ ]?[#]todo[ ]?/i, "" )
else
nil
end
end
|