pickle-surprise 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/pickle-surprise.rb +26 -4
- data/lib/pickle-surprise/version.rb +1 -1
- data/pickle-surprise.gemspec +3 -2
- data/spec/pickle-surprise_spec.rb +2 -2
- metadata +24 -4
data/lib/pickle-surprise.rb
CHANGED
@@ -1,24 +1,46 @@
|
|
1
1
|
require "pickle-surprise/version"
|
2
2
|
require "pickle-surprise/pickle"
|
3
3
|
|
4
|
+
# = Pickle interface
|
5
|
+
#
|
6
|
+
# This module has some class methods to you build an interface.
|
4
7
|
module Pickle
|
8
|
+
# Get how many pickles do you have
|
9
|
+
#
|
10
|
+
# @return [Integer]
|
5
11
|
def self.count
|
6
12
|
Surprise::Pickle.count
|
7
13
|
end
|
8
14
|
|
15
|
+
# Get all your pickles
|
16
|
+
#
|
17
|
+
# @return [Mongoid::Criteria]
|
9
18
|
def self.all
|
10
19
|
Surprise::Pickle.all
|
11
20
|
end
|
12
21
|
|
13
|
-
|
14
|
-
Surprise::Pickle.last
|
15
|
-
end
|
16
|
-
|
22
|
+
# Delete all your pickles
|
17
23
|
def self.reset
|
18
24
|
Surprise::Pickle.delete_all
|
19
25
|
end
|
20
26
|
|
21
27
|
module Surprise
|
28
|
+
# The most important method in Pickle::Surprise. A pickle, by default, has
|
29
|
+
# these 3 attributes:
|
30
|
+
# * msg: a message
|
31
|
+
# * ns: a namespace
|
32
|
+
# * ts: a timestamp
|
33
|
+
#
|
34
|
+
# Attribute __ts__ has a default value to Time.now.
|
35
|
+
#
|
36
|
+
# As Pickle::Surprise use [mongodb](http://www.mongodb.org/) you can save
|
37
|
+
# extra attibutes of any type, but they can be serializable.
|
38
|
+
#
|
39
|
+
# You can use block mode: if any exception is raised inside block, it
|
40
|
+
# creates a new pickle using exception message. If you pass a hash and a
|
41
|
+
# block, it merges hash with exception message and create a pickle.
|
42
|
+
#
|
43
|
+
# @param [Hash] attributes for your pickle
|
22
44
|
def Pickle(params={},&block)
|
23
45
|
if block
|
24
46
|
begin
|
data/pickle-surprise.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.version = Pickle::Surprise::VERSION
|
9
9
|
gem.authors = ["Daniel Libanori"]
|
10
10
|
gem.email = ["daniellibanori@gmail.com"]
|
11
|
-
gem.description = %q{Save stuff you do not expect, in your database.}
|
12
|
-
gem.summary = %q{
|
11
|
+
gem.description = %q{Save stuff you do not expect, in your mongo database and see them later.}
|
12
|
+
gem.summary = %q{Pickle::Surprise saves any serializable message at your mongo database. We do like logs, but sometimes you just can't grep them. Pickle::Surprise may help you: it saves any message you want at your database so you can read them later. As we use mongo as database, you can a lot of things, they just have to be serializable.}
|
13
13
|
gem.homepage = "https://github.com/dlibanori/pickle-surprise"
|
14
14
|
|
15
15
|
gem.files = `git ls-files`.split($/)
|
@@ -21,4 +21,5 @@ Gem::Specification.new do |gem|
|
|
21
21
|
gem.add_development_dependency 'rake'
|
22
22
|
gem.add_development_dependency 'rspec', '~> 2.11.0'
|
23
23
|
gem.add_development_dependency 'guard-rspec'
|
24
|
+
gem.add_development_dependency 'yard'
|
24
25
|
end
|
@@ -25,7 +25,7 @@ describe Pickle::Surprise do
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
pickle = Pickle.last
|
28
|
+
pickle = Pickle.all.last
|
29
29
|
expect(pickle.msg).to eq('from an exception')
|
30
30
|
end
|
31
31
|
|
@@ -44,7 +44,7 @@ describe Pickle::Surprise do
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
pickle = Pickle.last
|
47
|
+
pickle = Pickle.all.last
|
48
48
|
expect(pickle.ns).to eq('namespace')
|
49
49
|
end
|
50
50
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pickle-surprise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
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: 2012-09-
|
12
|
+
date: 2012-09-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mongoid
|
@@ -75,7 +75,23 @@ dependencies:
|
|
75
75
|
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
|
-
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: yard
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
description: Save stuff you do not expect, in your mongo database and see them later.
|
79
95
|
email:
|
80
96
|
- daniellibanori@gmail.com
|
81
97
|
executables: []
|
@@ -122,8 +138,12 @@ rubyforge_project:
|
|
122
138
|
rubygems_version: 1.8.23
|
123
139
|
signing_key:
|
124
140
|
specification_version: 3
|
125
|
-
summary:
|
141
|
+
summary: ! 'Pickle::Surprise saves any serializable message at your mongo database. We
|
142
|
+
do like logs, but sometimes you just can''t grep them. Pickle::Surprise may help
|
143
|
+
you: it saves any message you want at your database so you can read them later. As
|
144
|
+
we use mongo as database, you can a lot of things, they just have to be serializable.'
|
126
145
|
test_files:
|
127
146
|
- spec/pickle-surprise/pickle_spec.rb
|
128
147
|
- spec/pickle-surprise_spec.rb
|
129
148
|
- spec/spec_helper.rb
|
149
|
+
has_rdoc:
|