Dex 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.md +1 -2
  2. data/lib/Dex.rb +6 -4
  3. data/lib/Dex/version.rb +1 -1
  4. data/spec/Dex.rb +8 -0
  5. metadata +2 -2
data/README.md CHANGED
@@ -2,8 +2,7 @@
2
2
  Dex
3
3
  ================
4
4
 
5
- A Ruby gem providing a function to
6
- log exceptions to sqlite3.
5
+ A Ruby gem to log exceptions with sqlite3.
7
6
 
8
7
  Requirements/Installation
9
8
  ------------
data/lib/Dex.rb CHANGED
@@ -6,7 +6,6 @@ class Dex
6
6
  module DEFAULT
7
7
  DB_NAME = "/tmp/dex_exceptions.db"
8
8
  TABLE_NAME = :dex_exceptions
9
- RACK_DIR = File.join( File.dirname( __FILE__ ) , "/Dex/Rack" )
10
9
  end
11
10
 
12
11
  def self.default k
@@ -98,12 +97,15 @@ class Dex
98
97
  end
99
98
  end
100
99
 
101
- table.insert \
102
- :message => e.message, \
103
- :exception => e.exception.class.name, \
100
+ h = Hash[
101
+ :message => e.message,
102
+ :exception => e.exception.class.name,
104
103
  :backtrace => e.backtrace.join("\n"),
105
104
  :status => 0,
106
105
  :created_at => Time.now.utc
106
+ ].merge other
107
+
108
+ table.insert h
107
109
  end
108
110
 
109
111
  def remove_field name
@@ -1,3 +1,3 @@
1
1
  class Dex
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -101,6 +101,14 @@ describe "Dex :insert" do
101
101
  }
102
102
  end
103
103
 
104
+ it "saves merges optional Hash with exception" do
105
+ dex = new_dex "new_fields"
106
+ dex.db.transaction(:rollback=>:always) {
107
+ id = dex.insert( except("Optional Hash"), :fd1=>"field 1", :fd2=>"field 2" )
108
+ dex.filter(:id=>id).first[:fd1].should == "field 1"
109
+ }
110
+ end
111
+
104
112
  end # === Dex :insert
105
113
 
106
114
  describe "Dex :keep_only" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Dex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
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-05-05 00:00:00.000000000 Z
12
+ date: 2012-05-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bacon