module Chamomile::Application

Primary mixin for Chamomile applications. Combines Model + Commands and provides a declarative callback DSL for handling events.

class Counter
  include Chamomile::Application

  def initialize
    @count = 0
  end

  on_key(:up, "k")  { @count += 1 }
  on_key(:down, "j") { @count -= 1 }
  on_key("q")        { quit }

  def view
    "Count: #{@count}"
  end
end