Hanami - Ruby 的 Web 框架


MIT
跨平台
Ruby

软件简介

Hanami 是一个全栈的 Ruby 的 Web 框架。是一个非常精简、用于单一用途的库。

Hanami 包含如下组件:

目录结构:

% tree apps/web
apps/web
├── application.rb
├── assets
│   ├── favicon.ico
│   ├── images
│   ├── javascripts
│   └── stylesheets
├── config
│   └── routes.rb
├── controllers
├── templates
│   └── application.html.erb
└── views
    └── application_layout.rb

8 directories, 5 files

示例代码:

# apps/web/controllers/dashboard/index.rbmodule Web::Controllers::Dashboard
  class Index
    include Web::Action

    def initialize(greeting: Greeting.new)
      @greeting = greeting
    end

    def call(params)
      self.body = @greeting.message
    end
  endend