GithubHelp home page GithubHelp logo

toshia / mruby-pluggaloid Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shibafu528/mruby-pluggaloid-1-0

0.0 2.0 0.0 6 KB

https://github.com/toshia/pluggaloid for mruby

License: MIT License

Ruby 100.00%

mruby-pluggaloid's Introduction

Pluggaloid for mruby

pluggaloid gemをmrubyにポーティングしたものです。

Original Description

mikutterのプラグイン機構です。 登録したプラグイン同士がイベントを使って通信できるようになります。

Installation

Add conf.gem line to your build_config.rb:

MRuby::Build.new do |conf|

    # ... (snip) ...

    conf.gem :github => 'shibafu528/mruby-pluggaloid'
end

Usage

main = Pluggaloid.new(Delayer.generate_class(priority: %i<high normal low>, default: :normal))

main.Plugin.create(:write_to_stdout) do
  on_logging do |message|
    puts "logging: #{message}"
  end
end

main.Plugin.call(:logging, "boot.")
main.Plugin.call(:logging, "event test.")
main.Plugin.call(:logging, "exit.")

main.Delayer.run while not main.Delayer.empty?

Pluggaloid::new

Pluggaloid::newは、プラグイン機構を制御するためのDelayer, Plugin, Event, Listener, Filterのサブクラスを新しく作って返すメソッドです。 戻り値はStructで、それぞれのクラス名がメンバの名前になっています。

Member Description
Delayer Pluggaloid::new に渡したDelayer
Plugin Pluggaloid::Plugin のサブクラス
Event Pluggaloid::Event のサブクラス
Listener Pluggaloid::Listener のサブクラス
Filter Pluggaloid::Filter のサブクラス

コンストラクタの唯一の引数には Delayer.generate_class(priority: %i<high normal low>, default: :normal)のように、優先順位付きでデフォルト優先度が設定されたDelayerを渡します。

Contributing

  1. Fork it ( https://github.com/shibafu528/mruby-pluggaloid/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

mruby-pluggaloid's People

Contributors

shibafu528 avatar

Watchers

Toshiaki Asai avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.