saoshyant 1.1 → 1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/saoshyant.rb +6 -1
  3. data/saoshyant.gemspec +2 -2
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f799681f89ad3b560a80e46485547b9eb1e471f70d687682af05bbe6fa06f67
4
- data.tar.gz: 9fc6cddcd7ba72e262585299dc2df801ae6de83858a41a08c67388e7788c0a15
3
+ metadata.gz: 1e8f5039563d5adf7b102e4735e3af9f7ac53b003ec45116e49b8bfb2556a5b9
4
+ data.tar.gz: a7510586753167922756af504696d79e707b65e43baecba6b9be4120565b6b46
5
5
  SHA512:
6
- metadata.gz: '085dc244ff5d1f39092c1568408cc3357ea83b902385fd5ca03b320a71d68e5733c195bc9fdacba3a909aad0ef56e595ed7fecda3606bb1a3dbda7fe4c757cac'
7
- data.tar.gz: e6bbe044e9a8b17dc046f60ffde6c0210bb639c68c2b60730fbf9ff150cc44df75f13ccd6e40f1d3407a987d16eef2cddb02b288dd8ddabe49e0ff9dceea6674
6
+ metadata.gz: 8a557ab6a290bd574415a47f05791be506a465cc5f39df37005e26ff3d5c2c9a55fc1d50194b01de286b3bae12847fe22dfd7e9083356812528e8fdbdb1eae40
7
+ data.tar.gz: 0af188cc8d2ca50bc0462781c5b3d8188dc987021c8041baa22c9b360d1ebd5a36e05b634123124fbb13681f08e7f430a95cbfe77da4bb06d14a33f3bf6eca62
data/lib/saoshyant.rb CHANGED
@@ -7,6 +7,7 @@ module Saoshyant
7
7
  include ActiveSupport::Rescuable
8
8
 
9
9
  @@exception_klasses = {}
10
+ @@block = nil
10
11
 
11
12
  included do
12
13
  rescue_from Exception, with: :execute_exception
@@ -19,11 +20,15 @@ module Saoshyant
19
20
  @@exception_klasses.merge!(exception_klass => {code: code, log: log})
20
21
  end
21
22
 
23
+ def saoshyant(&block)
24
+ @@block = block
25
+ end
26
+
22
27
  def execute_exception ex
23
28
  code = Saoshyant::ExceptionHandler.code_status ex, @@exception_klasses
24
29
  log = Saoshyant::ExceptionHandler.log_status ex, @@exception_klasses
25
30
 
26
31
  Saoshyant::ExceptionLogger.log(ex.message) if log == true
27
- $saoshyant_response.call(code, ex.message, ex.class.inspect)
32
+ @@block.call(code, ex.message, ex.class.inspect)
28
33
  end
29
34
  end
data/saoshyant.gemspec CHANGED
@@ -1,8 +1,8 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'saoshyant'
3
- s.version = '1.1'
3
+ s.version = '1.2'
4
4
  s.date = '2020-02-10'
5
- s.summary = "Handle Rails Exception Apis"
5
+ s.summary = "Handle Rails Exception"
6
6
  s.description = "when exceptoin raised we dont want see it in ugly and red display, saoshyant present it in json response"
7
7
  s.authors = ["Majid Imanzade"]
8
8
  s.email = 'majidimanzade1@gmail.com'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saoshyant
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.1'
4
+ version: '1.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Majid Imanzade
@@ -91,5 +91,5 @@ requirements: []
91
91
  rubygems_version: 3.1.2
92
92
  signing_key:
93
93
  specification_version: 4
94
- summary: Handle Rails Exception Apis
94
+ summary: Handle Rails Exception
95
95
  test_files: []