- 授权协议: MIT
- 开发语言: Ruby
- 操作系统: 跨平台
- 软件首页: http://hanamirb.org/
- 软件文档: http://hanamirb.org/guides
- 官方下载: https://github.com/hanami/hanami
软件介绍
Hanami 是一个全栈的 Ruby 的 Web 框架。是一个非常精简、用于单一用途的库。
Hanami 包含如下组件:
Hanami::Model - 实体的持久化、仓库和数据映射
Hanami::View - 视图和模板的呈现
Hanami::Controller - 全功能、快速可测试的控制层
Hanami::Validations - Ruby 数据的验证
Hanami::Router - Rack 兼容的 HTTP 路由
Hanami::Helpers - 视图助手
Hanami::Mailer - 邮件工具包
Hanami::Assets - 附件管理
Hanami::Utils - Ruby 核心扩展和工具包
目录结构:
% 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
