Sha256: f81ec02b4bb535342442e4ba144134b425b13e47179309111ede19049abccf67

Contents?: true

Size: 1.94 KB

Versions: 2

Compression:

Stored size: 1.94 KB

Contents

= Rubyfox::SFSObject {<img src="https://secure.travis-ci.org/neopoly/rubyfox-sfsobject.png?branch=master" alt="Build Status" />}[https://travis-ci.org/neopoly/rubyfox-sfsobject]

Converts between SmartFox's SFSObjects and Ruby Hashes.

Gem[https://rubygems.org/gems/rubyfox-sfsobject] |
Source[https://github.com/neopoly/rubyfox-sfsobject] |
Documentation[http://rubydoc.info/github/neopoly/rubyfox-sfsobject/master/file/README.rdoc]

== Installation

Add this line to your application's Gemfile:

  gem 'rubyfox-sfsobject'

And then execute:

  $ bundle

Or install it yourself as:

  $ gem install rubyfox-sfsobject

== Usage

=== Bulk mode

  require 'rubyfox/sfsobject/bulk'
  sfs_object = Rubyfox::SFSObject::Bulk.to_sfs({ :hello => "world" })
  # => SFSObject ready to use in SmartFox
  hash = Rubyfox::SFSObject::Bulk.to_hash(sfs_object)
  # => { :hello => "world" }


=== Schema mode

  require 'rubyfox/sfsobject/schema'
  schema = { :hello => String }
  sfs_object = Rubyfox::SFSObject::Schema.to_sfs(schema, { :hello => "world" })
  # => SFSObject ready to use in SmartFox
  hash = Rubyfox::SFSObject::Schema.to_hash(schema, sfs_object)
  # => { :hello => "world" }

=== Core extension

You can extend Hash and SFSObject with method shortcuts:

  require 'rubyfox/sfsobject/core_ext'
  sfs_object = { :hello => "world" }.to_sfs
  # => SFSObject
  sfs_object.to_hash
  # { :hello => "world" }

==== JSON

  require 'rubyfox/sfsobject/core_ext'
  json = sfs_object.to_json
  Rubyfox::SFSObject.from_json(json)

==== Hash-like access

  require 'rubyfox/sfsobject/core_ext'
  sfs_object[:string] = "value"
  sfs_object[:string] # => "value"


== Caveats

*Note* that all hash keys will be converted to symbols.

== TODO

* More docs, please!

== Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubyfox-sfsobject-0.2.1-java README.rdoc
rubyfox-sfsobject-0.2.0-java README.rdoc