Skip to content

walf443/classx-pluggable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

= classx-pluggable

plagger's like plugin system for classx based applicaton

== Synopsis

in your context class.

  require 'classx'
  require 'classx/pluggable'
  class YourApp
    include ClassX
    include ClassX::Pluggable

    def run
      call_event("SETUP", {})
      # you app
      call_event("TEARDOWN", {})
    end
  end

in your plugin class

  require 'classx'
  require 'classx/pluggable'
  class YourApp
    class Plugin
      include ClassX
      include ClassX::Pluggable::Plugin

      class SomePlugin < Plugin
        def register
          add_event("SETUP", :on_setup)
        end

        def on_setup param
          # param is Hash
          # hooked setup
        end
      end
    end
  end

or it's easy to defining with ClassX::Pluggable::Plugin::AutoRegister

  class YourApp
    class Plugin
      include ClassX
      include ClassX::Pluggable::Plugin
      include ClassX::Pluggable::Plugin::AutoRegister

      class SomePlugin < Plugin
        def on_setup param
          # do some thing.
        end
      end
    end
  end

and, on your start up script.

  app = YourApp.new
  app.load_plugins([
    { :module => YourApp::Plugin::SomePlugin, :config => {} },
  ])

  app.run

== Description

== Installation

=== Archive Installation

	rake install

=== Gem Installation

	gem install classx-pluggable

== Features/Problems

CAVEAT: this project is early development. API may be vary in future.

== Copyright

Author::    Keiji, Yoshimi <walf443 at gmail.com>
Copyright:: Copyright (c) 2008 Keiji, Yoshimi
License:: you can redistribute it and/or modify it under the same terms as Ruby itself.

About

plagger's like plugin system for classx based application.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages