core_extended 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
File without changes
@@ -0,0 +1,13 @@
1
+ require 'base64'
2
+
3
+ module Marshal
4
+
5
+ def self.encode64(object)
6
+ Base64.encode64(dump(object))
7
+ end
8
+
9
+ def self.decode64(string)
10
+ load(Base64.decode64(string))
11
+ end
12
+
13
+ end
@@ -1,3 +1,3 @@
1
1
  module CoreExtended
2
- VERSION = "0.0.3"
2
+ VERSION = '0.0.4'
3
3
  end
@@ -0,0 +1,26 @@
1
+ require 'minitest_helper'
2
+
3
+ describe Marshal do
4
+
5
+ class Klass
6
+ def initialize(str)
7
+ @str = str
8
+ end
9
+ def say_hello
10
+ @str
11
+ end
12
+ end
13
+
14
+ it 'Dump and encode base 64' do
15
+ obj = Klass.new 'hello world'
16
+ Marshal.encode64(obj).must_match %r(^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$)
17
+ end
18
+
19
+ it 'Decode base 64 and load' do
20
+ serialization = Marshal.encode64(Klass.new('hello people'))
21
+ obj = Marshal.decode64 serialization
22
+ obj.must_be_instance_of Klass
23
+ obj.say_hello.must_equal 'hello people'
24
+ end
25
+
26
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: core_extended
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-29 00:00:00.000000000 Z
12
+ date: 2013-06-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -105,11 +105,13 @@ files:
105
105
  - LICENSE.txt
106
106
  - README.md
107
107
  - Rakefile
108
- - extension.gemspec
108
+ - core_extended.gemspec
109
109
  - lib/core_extended.rb
110
+ - lib/core_extended/marshal.rb
110
111
  - lib/core_extended/string.rb
111
112
  - lib/core_extended/version.rb
112
113
  - spec/coverage_helper.rb
114
+ - spec/marshal_spec.rb
113
115
  - spec/minitest_helper.rb
114
116
  - spec/string_spec.rb
115
117
  homepage: https://github.com/gabynaiman/core_extended
@@ -139,6 +141,7 @@ specification_version: 3
139
141
  summary: Ruby core extensions
140
142
  test_files:
141
143
  - spec/coverage_helper.rb
144
+ - spec/marshal_spec.rb
142
145
  - spec/minitest_helper.rb
143
146
  - spec/string_spec.rb
144
147
  has_rdoc: