SlideShare ist ein Scribd-Unternehmen logo
1 von 21
Downloaden Sie, um offline zu lesen
Serialize out of the
               Cerealize Box
           a drop-in replacement for ActiveRecord's serialize




cblue.tw
class Cat < ActiveRecord::Base

  serialize :can, Hash
end

 cblue.tw
Cat.create(:can =>
            {:food => ‘fish’,
             :mood => ‘dish’})


 cblue.tw
YAML
           is a human friendly
           data serialization



cblue.tw
YAML
           is not a machine friendly
           data serialization



cblue.tw
YAML
      SLOW for machine




cblue.tw
to the rescue
cblue.tw
class Cat < ActiveRecord::Base

  serialize :can, Hash
end

 cblue.tw
class Cat < ActiveRecord::Base
  include Cerealize
  serialize :can, Hash
end

 cblue.tw
class Cat < ActiveRecord::Base
  include Cerealize
  cerealize :can, Hash
end

 cblue.tw
cblue.tw
SAVED!!




cblue.tw
YAML
Marshal    Encoding JSON


cblue.tw
AUTO   detection
           YAML
  Encoding
Marshal
             JSON


cblue.tw
AUTO   detection
             YAML
  Encoding
Marshal
               JSON
conversion
cblue.tw   AUTO
class Cat < ActiveRecord::Base
  include Cerealize
  cerealize :can, Hash,
    :encoding => :marshal
end

 cblue.tw
class Cat < ActiveRecord::Base
  include Cerealize
  cerealize :can, Hash,
    :encoding => :yaml
end

 cblue.tw
class Cat < ActiveRecord::Base
  include Cerealize
  cerealize :can, Hash,
    :encoding => :json #future
end

 cblue.tw
Try it Today!
gem install cerealize

cblue.tw
Try it Today!
 script/plugin install
git://github.com/cardinalblue/cerealize.git

  cblue.tw
Contribution
             WANTED!!
http://github.com/cardinalblue/cerealize

 cblue.tw

Weitere ähnliche Inhalte

Was ist angesagt?

5 kinesis lightning
5 kinesis lightning5 kinesis lightning
5 kinesis lightningBigDataCamp
 
Nick Sieger JRuby Concurrency EMRubyConf 2011
Nick Sieger JRuby Concurrency EMRubyConf 2011Nick Sieger JRuby Concurrency EMRubyConf 2011
Nick Sieger JRuby Concurrency EMRubyConf 2011Nick Sieger
 
Extracting ruby gem
Extracting ruby gemExtracting ruby gem
Extracting ruby gemYura Tolstik
 
State management in a GraphQL era
State management in a GraphQL eraState management in a GraphQL era
State management in a GraphQL erakristijanmkd
 
CoffeeScript: JavaScript, but Better!
CoffeeScript: JavaScript, but Better! CoffeeScript: JavaScript, but Better!
CoffeeScript: JavaScript, but Better! Jack Franklin
 
Object Trampoline: Why having not the object you want is what you need.
Object Trampoline: Why having not the object you want is what you need.Object Trampoline: Why having not the object you want is what you need.
Object Trampoline: Why having not the object you want is what you need.Workhorse Computing
 
I, For One, Welcome Our New Perl6 Overlords
I, For One, Welcome Our New Perl6 OverlordsI, For One, Welcome Our New Perl6 Overlords
I, For One, Welcome Our New Perl6 Overlordsheumann
 
JRuby @ Boulder Ruby
JRuby @ Boulder RubyJRuby @ Boulder Ruby
JRuby @ Boulder RubyNick Sieger
 
Keeping objects healthy with Object::Exercise.
Keeping objects healthy with Object::Exercise.Keeping objects healthy with Object::Exercise.
Keeping objects healthy with Object::Exercise.Workhorse Computing
 
The $path to knowledge: What little it take to unit-test Perl.
The $path to knowledge: What little it take to unit-test Perl.The $path to knowledge: What little it take to unit-test Perl.
The $path to knowledge: What little it take to unit-test Perl.Workhorse Computing
 
Web Apps in Perl - HTTP 101
Web Apps in Perl - HTTP 101Web Apps in Perl - HTTP 101
Web Apps in Perl - HTTP 101hendrikvb
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworksdiego_k
 
Going crazy with Node.JS and CakePHP
Going crazy with Node.JS and CakePHPGoing crazy with Node.JS and CakePHP
Going crazy with Node.JS and CakePHPMariano Iglesias
 
Presentation of JSConf.eu
Presentation of JSConf.euPresentation of JSConf.eu
Presentation of JSConf.euFredrik Wendt
 

Was ist angesagt? (20)

5 kinesis lightning
5 kinesis lightning5 kinesis lightning
5 kinesis lightning
 
Nick Sieger JRuby Concurrency EMRubyConf 2011
Nick Sieger JRuby Concurrency EMRubyConf 2011Nick Sieger JRuby Concurrency EMRubyConf 2011
Nick Sieger JRuby Concurrency EMRubyConf 2011
 
Extracting ruby gem
Extracting ruby gemExtracting ruby gem
Extracting ruby gem
 
State management in a GraphQL era
State management in a GraphQL eraState management in a GraphQL era
State management in a GraphQL era
 
Unit Testing Lots of Perl
Unit Testing Lots of PerlUnit Testing Lots of Perl
Unit Testing Lots of Perl
 
Mojo as a_client
Mojo as a_clientMojo as a_client
Mojo as a_client
 
CoffeeScript: JavaScript, but Better!
CoffeeScript: JavaScript, but Better! CoffeeScript: JavaScript, but Better!
CoffeeScript: JavaScript, but Better!
 
Object Trampoline: Why having not the object you want is what you need.
Object Trampoline: Why having not the object you want is what you need.Object Trampoline: Why having not the object you want is what you need.
Object Trampoline: Why having not the object you want is what you need.
 
Metadata-driven Testing
Metadata-driven TestingMetadata-driven Testing
Metadata-driven Testing
 
I, For One, Welcome Our New Perl6 Overlords
I, For One, Welcome Our New Perl6 OverlordsI, For One, Welcome Our New Perl6 Overlords
I, For One, Welcome Our New Perl6 Overlords
 
JRuby @ Boulder Ruby
JRuby @ Boulder RubyJRuby @ Boulder Ruby
JRuby @ Boulder Ruby
 
Keeping objects healthy with Object::Exercise.
Keeping objects healthy with Object::Exercise.Keeping objects healthy with Object::Exercise.
Keeping objects healthy with Object::Exercise.
 
The $path to knowledge: What little it take to unit-test Perl.
The $path to knowledge: What little it take to unit-test Perl.The $path to knowledge: What little it take to unit-test Perl.
The $path to knowledge: What little it take to unit-test Perl.
 
Web Apps in Perl - HTTP 101
Web Apps in Perl - HTTP 101Web Apps in Perl - HTTP 101
Web Apps in Perl - HTTP 101
 
Effective Benchmarks
Effective BenchmarksEffective Benchmarks
Effective Benchmarks
 
Getting testy with Perl
Getting testy with PerlGetting testy with Perl
Getting testy with Perl
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworks
 
Going crazy with Node.JS and CakePHP
Going crazy with Node.JS and CakePHPGoing crazy with Node.JS and CakePHP
Going crazy with Node.JS and CakePHP
 
Troubleshooting Puppet
Troubleshooting PuppetTroubleshooting Puppet
Troubleshooting Puppet
 
Presentation of JSConf.eu
Presentation of JSConf.euPresentation of JSConf.eu
Presentation of JSConf.eu
 

Andere mochten auch

2008-12-21 Rubinius
2008-12-21 Rubinius2008-12-21 Rubinius
2008-12-21 RubiniusLin Jen-Shin
 
Concurrent Ruby Application Servers
Concurrent Ruby Application ServersConcurrent Ruby Application Servers
Concurrent Ruby Application ServersLin Jen-Shin
 
The Architecture of PicCollage Server
The Architecture of PicCollage ServerThe Architecture of PicCollage Server
The Architecture of PicCollage ServerLin Jen-Shin
 
Server Development Workflow For PicCollage
Server Development Workflow For PicCollageServer Development Workflow For PicCollage
Server Development Workflow For PicCollageLin Jen-Shin
 
2012 05-08-lambda-draft
2012 05-08-lambda-draft2012 05-08-lambda-draft
2012 05-08-lambda-draftLin Jen-Shin
 
2007-06-24 The Lost Piece
2007-06-24 The Lost Piece2007-06-24 The Lost Piece
2007-06-24 The Lost PieceLin Jen-Shin
 
2008-01-25 Tangible Value
2008-01-25 Tangible Value2008-01-25 Tangible Value
2008-01-25 Tangible ValueLin Jen-Shin
 
2010-04-13 Reactor Pattern & Event Driven Programming 2
2010-04-13 Reactor Pattern & Event Driven Programming 22010-04-13 Reactor Pattern & Event Driven Programming 2
2010-04-13 Reactor Pattern & Event Driven Programming 2Lin Jen-Shin
 
2010-02-09 Reactor Pattern & Event Driven Programming
2010-02-09 Reactor Pattern & Event Driven Programming2010-02-09 Reactor Pattern & Event Driven Programming
2010-02-09 Reactor Pattern & Event Driven ProgrammingLin Jen-Shin
 

Andere mochten auch (9)

2008-12-21 Rubinius
2008-12-21 Rubinius2008-12-21 Rubinius
2008-12-21 Rubinius
 
Concurrent Ruby Application Servers
Concurrent Ruby Application ServersConcurrent Ruby Application Servers
Concurrent Ruby Application Servers
 
The Architecture of PicCollage Server
The Architecture of PicCollage ServerThe Architecture of PicCollage Server
The Architecture of PicCollage Server
 
Server Development Workflow For PicCollage
Server Development Workflow For PicCollageServer Development Workflow For PicCollage
Server Development Workflow For PicCollage
 
2012 05-08-lambda-draft
2012 05-08-lambda-draft2012 05-08-lambda-draft
2012 05-08-lambda-draft
 
2007-06-24 The Lost Piece
2007-06-24 The Lost Piece2007-06-24 The Lost Piece
2007-06-24 The Lost Piece
 
2008-01-25 Tangible Value
2008-01-25 Tangible Value2008-01-25 Tangible Value
2008-01-25 Tangible Value
 
2010-04-13 Reactor Pattern & Event Driven Programming 2
2010-04-13 Reactor Pattern & Event Driven Programming 22010-04-13 Reactor Pattern & Event Driven Programming 2
2010-04-13 Reactor Pattern & Event Driven Programming 2
 
2010-02-09 Reactor Pattern & Event Driven Programming
2010-02-09 Reactor Pattern & Event Driven Programming2010-02-09 Reactor Pattern & Event Driven Programming
2010-02-09 Reactor Pattern & Event Driven Programming
 

2010 04-24-cerealize

  • 1. Serialize out of the Cerealize Box a drop-in replacement for ActiveRecord's serialize cblue.tw
  • 2. class Cat < ActiveRecord::Base serialize :can, Hash end cblue.tw
  • 3. Cat.create(:can => {:food => ‘fish’, :mood => ‘dish’}) cblue.tw
  • 4. YAML is a human friendly data serialization cblue.tw
  • 5. YAML is not a machine friendly data serialization cblue.tw
  • 6. YAML SLOW for machine cblue.tw
  • 8. class Cat < ActiveRecord::Base serialize :can, Hash end cblue.tw
  • 9. class Cat < ActiveRecord::Base include Cerealize serialize :can, Hash end cblue.tw
  • 10. class Cat < ActiveRecord::Base include Cerealize cerealize :can, Hash end cblue.tw
  • 13. YAML Marshal Encoding JSON cblue.tw
  • 14. AUTO detection YAML Encoding Marshal JSON cblue.tw
  • 15. AUTO detection YAML Encoding Marshal JSON conversion cblue.tw AUTO
  • 16. class Cat < ActiveRecord::Base include Cerealize cerealize :can, Hash, :encoding => :marshal end cblue.tw
  • 17. class Cat < ActiveRecord::Base include Cerealize cerealize :can, Hash, :encoding => :yaml end cblue.tw
  • 18. class Cat < ActiveRecord::Base include Cerealize cerealize :can, Hash, :encoding => :json #future end cblue.tw
  • 19. Try it Today! gem install cerealize cblue.tw
  • 20. Try it Today! script/plugin install git://github.com/cardinalblue/cerealize.git cblue.tw
  • 21. Contribution WANTED!! http://github.com/cardinalblue/cerealize cblue.tw