class Todo::Cli::Cmd

Public Class Methods

new(args, opts) click to toggle source
Calls superclass method
# File lib/todo/cli/cmd.rb, line 18
def initialize(args, opts)
  opts = normalize_dates(opts)
  super
end

Public Instance Methods

format(list, opts = {}) click to toggle source
# File lib/todo/cli/cmd.rb, line 31
def format(list, opts = {})
  Format.new(list, opts).apply
end
io() click to toggle source
# File lib/todo/cli/cmd.rb, line 23
def io
  if opts[:file]
    Src::File.new(opts[:file])
  else
    Src::Io.new(slice(opts, :in, :out))
  end
end
normalize_date(date) click to toggle source
# File lib/todo/cli/cmd.rb, line 42
def normalize_date(date)
  Support::Date.new.format(date)
end
normalize_dates(opts) click to toggle source
# File lib/todo/cli/cmd.rb, line 35
def normalize_dates(opts)
  [:before, :after].inject(opts) do |opts, key|
    opts[key] = normalize_date(opts[key]) if opts[key]
    opts
  end
end