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.
65 66 67 68 69 70 71 |
# File 'lib/babylon.rb', line 65 def self.cache_views @@views= {} Dir.glob('app/views/**/*').each do |f| Babylon.logger.debug("adding view #{f}") @@views[f] = File.read(f) if File.file?(f) end end |
.config ⇒ Object
Return the configuration for this component.
98 99 100 |
# File 'lib/babylon.rb', line 98 def self.config @@config end |
.config=(conf) ⇒ Object
Set the configuration for this component.
92 93 94 |
# File 'lib/babylon.rb', line 92 def self.config=(conf) @@config = conf end |
.decode_xml(str) ⇒ Object
Decodes XML special characters.
104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/babylon.rb', line 104 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
41 42 43 44 45 46 |
# File 'lib/babylon.rb', line 41 def self.environment unless self.class_variable_defined?("@@env") @@env = "development" end @@env end |
.environment=(_env) ⇒ Object
37 38 39 |
# File 'lib/babylon.rb', line 37 def self.environment=(_env) @@env = _env end |
.logger ⇒ Object
Returns a shared logger for this component.
82 83 84 85 86 87 88 |
# File 'lib/babylon.rb', line 82 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
56 57 58 59 60 61 |
# File 'lib/babylon.rb', line 56 def self.router unless self.class_variable_defined?("@@router") @@router = nil end @@router end |
.router=(router) ⇒ Object
Sets up the router
50 51 52 |
# File 'lib/babylon.rb', line 50 def self.router=(router) @@router = router end |
.views ⇒ Object
73 74 75 76 77 78 |
# File 'lib/babylon.rb', line 73 def self.views unless self.class_variable_defined?("@@views") @@views= {} end @@views end |