Module: Babylon
- Defined in:
- lib/babylon.rb,
lib/babylon/router.rb,
lib/babylon/runner.rb,
lib/babylon/base/view.rb,
lib/babylon/generator.rb,
lib/babylon/router/dsl.rb,
lib/babylon/base/stanza.rb,
lib/babylon/xmpp_parser.rb,
lib/babylon/xpath_helper.rb,
lib/babylon/base/controller.rb,
lib/babylon/xmpp_connection.rb,
lib/babylon/client_connection.rb,
lib/babylon/component_connection.rb
Overview
Babylon is a XMPP Component Framework based on EventMachine. It uses the Nokogiri GEM, which is a Ruby wrapper for Libxml2. It implements the MVC paradigm. You can create your own application by running :
$> babylon app_name
This will generate some folders and files for your application. Please see README.rdoc for further instructions
Defined Under Namespace
Modules: Base, Generator, Router Classes: AuthenticationError, ClientConnection, ComponentConnection, NoConnection, NotConnected, Route, Runner, StanzaRouter, StanzaTooBig, XmlNotWellFormed, XmppConnection, XmppParser, XpathHelper
Class Method Summary collapse
-
.cache_views ⇒ Object
Caches the view files to improve performance.
-
.config ⇒ Object
Return the configuration for this component.
-
.config=(conf) ⇒ Object
Set the configuration for this component.
-
.decode_xml(str) ⇒ Object
Decodes XML special characters.
- .environment ⇒ Object
- .environment=(_env) ⇒ Object
-
.logger ⇒ Object
Returns a shared logger for this component.
-
.router ⇒ Object
Retruns the router.
-
.router=(router) ⇒ Object
Sets up the router.
- .views ⇒ Object
Class Method Details
.cache_views ⇒ Object
Caches the view files to improve performance.
64 65 66 67 68 69 |
# File 'lib/babylon.rb', line 64 def self.cache_views @@views= {} Dir.glob('app/views/*/*').each do |f| @@views[f] = File.read(f) end end |
.config ⇒ Object
Return the configuration for this component.
96 97 98 |
# File 'lib/babylon.rb', line 96 def self.config @@config end |
.config=(conf) ⇒ Object
Set the configuration for this component.
90 91 92 |
# File 'lib/babylon.rb', line 90 def self.config=(conf) @@config = conf end |
.decode_xml(str) ⇒ Object
Decodes XML special characters.
102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/babylon.rb', line 102 def self.decode_xml(str) entities = { 'lt' => '<', 'gt' => '>', '#38' => '&', 'amp' => '&', 'quot' => '"', '#13' => "\r", } entities.keys.inject(str) { |string, key| string.gsub(/&#{key};/, entities[key]) } end |
.environment ⇒ Object
40 41 42 43 44 45 |
# File 'lib/babylon.rb', line 40 def self.environment unless self.class_variable_defined?("@@env") @@env = "development" end @@env end |
.environment=(_env) ⇒ Object
36 37 38 |
# File 'lib/babylon.rb', line 36 def self.environment=(_env) @@env = _env end |
.logger ⇒ Object
Returns a shared logger for this component.
80 81 82 83 84 85 86 |
# File 'lib/babylon.rb', line 80 def self.logger unless self.class_variable_defined?("@@logger") @@logger = Log4r::Logger.new("BABYLON") @@logger.add(Log4r::Outputter.stdout) if Babylon.environment == "development" end @@logger end |
.router ⇒ Object
Retruns the router
55 56 57 58 59 60 |
# File 'lib/babylon.rb', line 55 def self.router unless self.class_variable_defined?("@@router") @@router = nil end @@router end |
.router=(router) ⇒ Object
Sets up the router
49 50 51 |
# File 'lib/babylon.rb', line 49 def self.router=(router) @@router = router end |
.views ⇒ Object
71 72 73 74 75 76 |
# File 'lib/babylon.rb', line 71 def self.views unless self.class_variable_defined?("@@views") @@views= {} end @@views end |