module ScratchPaper

Constants

VERSION

Public Instance Methods

scratch_note(type, message) click to toggle source
# File lib/scratchpaper.rb, line 7
def scratch_note(type, message)
  RestClient.post("http://#{ENV["SCRATCHPAPER_URL"]}/#{ENV["SCRATCHPAPER_KEY"]}",
                  :data => [type, message].to_json)

  :ok
end
sl(data) click to toggle source
# File lib/scratchpaper.rb, line 22
def sl(data)
  scratch_note("list", data)
end
sp(data) click to toggle source
# File lib/scratchpaper.rb, line 14
def sp(data)
  scratch_note("text", data)
end
sr(data) click to toggle source
# File lib/scratchpaper.rb, line 26
def sr(data)
  case data
  when ActiveRecord::Relation
    st([data.attribute_names] + data.map { |r| r.attributes.values })
  when ActiveRecord::Base
    st(data.attributes.to_a)
  end
end
st(data) click to toggle source
# File lib/scratchpaper.rb, line 18
def st(data)
  scratch_note("table", data)
end