Hanami —— Ruby 的 Web 框架

栏目: Ruby · 发布时间: 8年前

内容简介:Hanami —— Ruby 的 Web 框架

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

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Introduction to Programming in Java

Introduction to Programming in Java

Robert Sedgewick、Kevin Wayne / Addison-Wesley / 2007-7-27 / USD 89.00

By emphasizing the application of computer programming not only in success stories in the software industry but also in familiar scenarios in physical and biological science, engineering, and appli......一起来看看 《Introduction to Programming in Java》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

随机密码生成器
随机密码生成器

多种字符组合密码

URL 编码/解码
URL 编码/解码

URL 编码/解码