marshal64 0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ log
2
+ TODO
3
+ locks
4
+ *.gem
5
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Makarchev K
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,15 @@
1
+ Marshal + Base64 coder. Usefull for serialize data to db.
2
+
3
+ gem 'marshal64'
4
+
5
+ ```ruby
6
+ str = Marshal64.dump(x)
7
+ x = Marshal64.load(str)
8
+ ```
9
+
10
+ or
11
+
12
+ ```ruby
13
+ str = Marshal64.encode(x)
14
+ x = Marshal64.decode(str)
15
+ ```
@@ -0,0 +1,8 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
5
+
6
+ require 'rspec/core/rake_task'
7
+ task :default => :spec
8
+ RSpec::Core::RakeTask.new(:spec)
@@ -0,0 +1,18 @@
1
+ require 'base64'
2
+
3
+ module Marshal64
4
+ VERSION = "0.1"
5
+
6
+ class << self
7
+ def dump(obj)
8
+ Base64::encode64(Marshal.dump(obj))
9
+ end
10
+ alias :encode :dump
11
+
12
+ def load(str)
13
+ Marshal.load(Base64::decode64(str))
14
+ end
15
+ alias :decode :load
16
+ end
17
+
18
+ end
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{marshal64}
5
+ s.version = "0.1"
6
+
7
+ s.authors = ["Makarchev K"]
8
+
9
+ s.description = %q{Marshal + Base64 coder. Usefull for serialize data to db.}
10
+ s.summary = %q{Marshal + Base64 coder. Usefull for serialize data to db.}
11
+
12
+ s.email = %q{kostya27@gmail.com}
13
+ #s.homepage = %q{http://github.com/kostya/marshal64}
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ["lib"]
19
+
20
+ s.add_development_dependency "rspec"
21
+ s.add_development_dependency "rake"
22
+
23
+ end
@@ -0,0 +1,21 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ describe Marshal64 do
4
+
5
+ it "should dump/load" do
6
+ x = {:args => [1, 2, 3, :a, 'b'], 'queue' => :name}
7
+ str = Marshal64.dump(x)
8
+ str.is_a?(String).should be_true
9
+
10
+ obj = Marshal64.load(str)
11
+ obj.is_a?(Hash).should be_true
12
+ obj.should == x
13
+ end
14
+
15
+ it "should encode/decode" do
16
+ x = {:args => [1, 2, 3, :a, 'b'], 'queue' => :name}
17
+ str = Marshal64.encode(x)
18
+ Marshal64.decode(str).should == x
19
+ end
20
+
21
+ end
@@ -0,0 +1,4 @@
1
+ require 'rubygems'
2
+ require "bundler/setup"
3
+
4
+ require 'marshal64.rb'
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: marshal64
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Makarchev K
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-08-22 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: Marshal + Base64 coder. Usefull for serialize data to db.
47
+ email: kostya27@gmail.com
48
+ executables: []
49
+ extensions: []
50
+ extra_rdoc_files: []
51
+ files:
52
+ - .gitignore
53
+ - Gemfile
54
+ - LICENSE
55
+ - README.md
56
+ - Rakefile
57
+ - lib/marshal64.rb
58
+ - marshal64.gemspec
59
+ - spec/marshal64_spec.rb
60
+ - spec/spec_helper.rb
61
+ homepage:
62
+ licenses: []
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ! '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ segments:
74
+ - 0
75
+ hash: -800643155
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ! '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ segments:
83
+ - 0
84
+ hash: -800643155
85
+ requirements: []
86
+ rubyforge_project:
87
+ rubygems_version: 1.8.24
88
+ signing_key:
89
+ specification_version: 3
90
+ summary: Marshal + Base64 coder. Usefull for serialize data to db.
91
+ test_files: []