exception-hashify 0.0.1

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.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color --format documentation
2
+
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in exception-hashify.gemspec
4
+ gemspec
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "exception-hashify/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "exception-hashify"
7
+ s.version = Exception::Hashify::VERSION
8
+ s.authors = ["Rafael Souza"]
9
+ s.email = ["me@rafaelss.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{Transform your exceptions into hashes}
12
+ s.description = %q{A very simples gem that transforms exceptions into hashes}
13
+
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ s.require_paths = ["lib"]
18
+
19
+ s.add_development_dependency "rspec", "~> 2.6.0"
20
+ end
21
+
@@ -0,0 +1,16 @@
1
+ require "exception-hashify/version"
2
+
3
+ class Exception
4
+ module Hashify
5
+ def to_hash
6
+ @hash ||= {
7
+ :class_name => self.class.name,
8
+ :message => message,
9
+ :backtrace => backtrace
10
+ }
11
+ end
12
+ end
13
+
14
+ include Hashify
15
+ end
16
+
@@ -0,0 +1,6 @@
1
+ class Exception
2
+ module Hashify
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
6
+
@@ -0,0 +1,15 @@
1
+ require "spec_helper"
2
+
3
+ describe Exception::Hashify do
4
+
5
+ it "should return a hash with exception information" do
6
+ with_exception do |ex|
7
+ hash = ex.to_hash
8
+ hash[:class_name].should == "RuntimeError"
9
+ hash[:message].should == "teste"
10
+ hash[:backtrace].should be_a Array
11
+ hash[:backtrace].should_not be_empty
12
+ end
13
+ end
14
+ end
15
+
@@ -0,0 +1,8 @@
1
+ require "exception-hashify"
2
+
3
+ Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|file| require file}
4
+
5
+ RSpec.configure do |config|
6
+ config.include Helpers
7
+ end
8
+
@@ -0,0 +1,11 @@
1
+ module Helpers
2
+
3
+ def with_exception
4
+ begin
5
+ raise "teste"
6
+ rescue => ex
7
+ yield ex
8
+ end
9
+ end
10
+ end
11
+
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: exception-hashify
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Rafael Souza
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-07-27 00:00:00.000000000 -03:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rspec
17
+ requirement: &2152907820 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: 2.6.0
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: *2152907820
26
+ description: A very simples gem that transforms exceptions into hashes
27
+ email:
28
+ - me@rafaelss.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - .gitignore
34
+ - .rspec
35
+ - Gemfile
36
+ - Rakefile
37
+ - exception-hashify.gemspec
38
+ - lib/exception-hashify.rb
39
+ - lib/exception-hashify/version.rb
40
+ - spec/exception-hashify_spec.rb
41
+ - spec/spec_helper.rb
42
+ - spec/support/helpers.rb
43
+ has_rdoc: true
44
+ homepage: ''
45
+ licenses: []
46
+ post_install_message:
47
+ rdoc_options: []
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirements: []
63
+ rubyforge_project:
64
+ rubygems_version: 1.6.2
65
+ signing_key:
66
+ specification_version: 3
67
+ summary: Transform your exceptions into hashes
68
+ test_files:
69
+ - spec/exception-hashify_spec.rb
70
+ - spec/spec_helper.rb
71
+ - spec/support/helpers.rb