Code Monkey home page Code Monkey logo

swx-ruby's Introduction

======================================
SWX Ruby: SWX on Rails Plugin Beta 0.5
======================================

GETTING STARTED
===============
SWX on Rails will look for your service classes in RAILS_ROOT/app/services.
Simply create standard Ruby classes and drop them in this folder. Service classes 
are composed of instance methods. SWX on Rails will instantiate your service
class, call the specified method, and send the response back to the Flash Player.

Take a peek at app/services/hello_world.rb for a working service class example.
Alright, alright, I'll just show it to you here:

# hello_world.rb----------------------------------------
# Class and method names follow standard Ruby convention
class HelloWorld
	# Service class methods are instance methods.
	def just_say_the_words
		'Hello World!'
	end
end
#-------------------------------------------------------

Here's a Moo card-esque example to call HelloWorld#just_say_the_words from the 
Flash Player (place a MovieClip on stage with an instance name of 'loader' and
fire up your development server):

//------------------------------------------------------
loader.serviceClass = "HelloWorld";
// Method names follow ActionScript convention 
// (converted to underscored server-side)
loader.method = "justSayTheWords";
loader.debug = true;
loader.loadMovie("http://localhost:3000/swx", "POST");

function onEnterFrame() {
 // Will output 'Hello World!' once the SWX file is loaded.
 trace(loader.result);
}
//------------------------------------------------------

When you're ready for some robust ActionScript trickery, head to 
http://swxformat.org/download/ to grab the SWX ActionScript library.

Oh yeah, you may return ActiveRecord objects from your service classes; 
SWX on Rails will happily serialize them for you. Go ahead, give it a try!

SWX on Rails is beta and may break, throw its toys, eat your
firstborn child, etc. 
Please post bug reports/suggestions to http://groups.google.com/group/swxruby. 
Full-featured tracker coming soon.
=======================================
NOTE: You may notice some Security Sandbox Violations when testing the example
above in the Flash IDE. Rest assured, this is OK. Visit 
http://swxformat.org/132 for further explanation.

swx-ruby's People

Contributors

mattetti 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.