class Cheatly::Adapter::File

Public Instance Methods

all() click to toggle source
# File lib/cheatly/adapter/file.rb, line 11
def all
  Dir["sheets/*.md"].map { |f| f.scan(/sheets\/(.*).md/)[0][0] }
end
create(name, body) click to toggle source
# File lib/cheatly/adapter/file.rb, line 15
def create(name, body)
  f = ::File.new("sheets/#{name}.md", "w")
  f.write(body)
  f.close
end
find(name) click to toggle source
# File lib/cheatly/adapter/file.rb, line 6
def find(name)
  path = "sheets/#{name}.md"
  ::File.read(path)
end
update(name, body) click to toggle source
# File lib/cheatly/adapter/file.rb, line 21
def update(name, body)
  ::File.delete("sheets/#{name}.md")
  create(name, body)
end