0.0
No commit activity in last 3 years
No release in over 3 years
Ukagaka SHIORI subsystem 'Sana' MVC Helper
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.7.9
~> 0.1
~> 10.0
~> 3.4
~> 0.11
~> 0.8.7

Runtime

>= 0.0.4
>= 0.0.3
 Project Readme

Gem Gem Gemnasium Inch CI Travis Build Status AppVeyor Build Status codecov.io Code Climate

Ukagaka SHIORI subsystem 'Sana' MVC Helper

Installation

Add this line to your application's Gemfile:

gem 'sana-mvcbase'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sana-mvcbase

Usage

require 'sana-mvcbase'
require 'shiolink'

# define controllers

# for load(), unload()
class DLController < SanaController
  def _load(dirpath)
    MySave.load
    p dirpath
  end

  def _unload
    p :unload
  end
end

# view rendering module
module MyViewModule
  def render_response(name)
    MyView.talk(name || event_id)
  end
end

# view rendering base controller
class MyWithViewController < SanaAnyEventController
  include MyViewModule
end

# normal talk controller
class TalkEventsController < MyWithViewController
  def OnBoot
    @foo = MySave.foo_flag
    @bar = MyModel.bar(params.shell_name)
  end

  def OnFirstBoot
    @foo = MySave.foo_flag
    render :OnBoot
  end
end

# resource controller
class ResourcesController < SanaController
  def homeurl
    "http://www.example.com/foo/"
  end
end

# register routing

router = SanaRouter.new(TalkEventsController)
router.draw do
  controller DLController do
    load
    unload
  end

  controller ResourcesController do
    route :homeurl
  end

  route :OnBoot, {shell_name: 0, halted: 6, halted_ghost_name: 7}

  # OnFirstBoot is not registered but will called with default controller (= TalkEventsController)
end

# app start

sana = Sana.new(router.events)
shiolink = Shiolink.new(sana.method(:load), sana.method(:unload), sana.method(:request))
shiolink.start

API

API Document

License

This is released under MIT License.