class Ticard::FileRepository

Protected Instance Methods

path(card) click to toggle source
# File lib/ticard/file_repository.rb, line 6
def path(card)
  regex = /\/c\/(.+?)\/\d*-?(.*?)\/?$/
  match = regex.match(card.url)
  id = match[1]
  name = match[2]
  "#{name}_#{id}.md"
end
read(card_path) click to toggle source
# File lib/ticard/file_repository.rb, line 14
def read(card_path)
  File.read(card_path)
end
write(card, &b) click to toggle source
# File lib/ticard/file_repository.rb, line 18
def write(card, &b)
  File.open(path(card), 'w', &b)
end