Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Lotus

Luca Guidi
October 14, 2014

 Lotus

Lotus: a complete web framework for Ruby.

Luca Guidi

October 14, 2014
Tweet

More Decks by Luca Guidi

Other Decks in Programming

Transcript

  1. Lotus A c o mp l e t e web

    framework @jodosha / #lotusrb
  2. Cost of maintenance 0 20 40 60 80 Years 0

    1 2 3 Covenience Simplicity
  3. router = Lotus::Router.new do get '/', to: 'home#index', as: :home

    resources :books end ! router.path(:home) # => '/' router.call(env) # Rack env run router # in config.ru
  4. class Show include Lotus::Action ! expose :book ! def initialize(repository

    = BooksRepository) @repository = repository end ! def call(params) @book = @repository.find params[:id] end end
  5. book = Object.new repository = Minitest::Mock.new repository.expect(:find, book, [Integer]) !

    action = Show.new(repository) action.call(id: 23) # => [200, {}, nil] ! repository.verify action.book.must_equal book # assigns(:book) isn’t needed
  6. Q&A