Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
plagger's like plugin system for classx based application.
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples/test_runner
lib/classx
spec
tasks
ChangeLog
README
Rakefile

README

= 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.
Something went wrong with that request. Please try again.