class List

Public Class Methods

new(filename = nil) click to toggle source
# File bin/todo, line 6
def initialize(filename = nil)
  @items = JSON.parse(IO.read(filename)) unless filename.nil?
  @items ||= []
end

Public Instance Methods

items(tag = nil) click to toggle source

Should be able to push/pop/delete/etc

# File bin/todo, line 12
def items(tag = nil)
  if tag.nil?
    @items
  else
    @items.select { |item| item['tags'].include? tag }
  end
end