evnt 3.2.6 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0018c224758da691335945353b6168dfc983aa13d7bda8e1e1d08e0b7f23de51'
4
- data.tar.gz: e8842f6d62ac1b78a1ca6db497702ba9c6bea6afed34e01f7e57ba57597246a7
3
+ metadata.gz: 8ef1b5762fd449d75c4ae69dc161adcbb551d447c660e818e99b99a017fa31df
4
+ data.tar.gz: 54abf9e98b18f38fa5c11b3dd04413f0acad251840b48d234452f1575128e504
5
5
  SHA512:
6
- metadata.gz: 96fa1e160c588b1840a30405b4963cc302a6c5a83f4912bd3c114eba909a4d8ca95164beaab2432661147c95aafc927dd0c117701285472b48d9382b2ddb8cf2
7
- data.tar.gz: 7b614dba5252f70d8f3106bd55de60278b8e541d47dadece24359d90f94d03b39db82f781a97358ede91aa154d9ed6efe667fb20072c3091413685f6ee34157c
6
+ metadata.gz: d95dcf19b416dc055707153fae3ef77abd188e8291417f39966677677523084665db75842b4dc2ee592e583acb2d63955176027aa87e1ca7135b8658aef82437
7
+ data.tar.gz: 3fd2d0dfc03ed1b5431358bfc52bf6eb125b6dfc067c8808f8e7ed2aa8bece0cb7f96ea58780cc916955ec306c7b42cea7e8d7b51fe426c5423f3713627c048e
data/README.md CHANGED
@@ -29,10 +29,24 @@ gem 'evnt'
29
29
 
30
30
  ## Development
31
31
 
32
+ ### RDoc documentation
33
+
32
34
  To update the rdoc documentation run:
33
35
 
34
36
  ```console
35
-
36
37
  rdoc --op rdoc
38
+ ```
39
+
40
+ ### Docsify documentation
41
+
42
+ Install docsify as global node dependency
43
+
44
+ ```shell
45
+ npm install -g docsify
46
+ ```
47
+
48
+ See documentation on local machine
37
49
 
50
+ ```shell
51
+ docsify serve ./docs
38
52
  ```
data/lib/evnt/event.rb CHANGED
@@ -50,7 +50,7 @@ module Evnt
50
50
  _init_event_data(params)
51
51
  _validate_payload
52
52
  _run_event_steps
53
- _notify_handlers
53
+ _notify_handlers if @state[:saved]
54
54
  end
55
55
 
56
56
  # Public functions:
@@ -65,6 +65,27 @@ module Evnt
65
65
  @state[:reloaded]
66
66
  end
67
67
 
68
+ ##
69
+ # This function tells if the event is saved or not.
70
+ # As default an event is considered saved. It should be updated to
71
+ # not saved when the to_write_event has some problems.
72
+ ##
73
+ def saved?
74
+ @state[:saved]
75
+ end
76
+
77
+ ##
78
+ # This function can be used to set the event as not saved.
79
+ # A not saved event should not notify handlers.
80
+ # If the exceptions option is active, it should raise a new error.
81
+ ##
82
+ def set_not_saved
83
+ @state[:saved] = false
84
+
85
+ # raise error if event needs exceptions
86
+ raise 'Event can not be saved' if @options[:exceptions]
87
+ end
88
+
68
89
  # Private functions:
69
90
  ############################################################################
70
91
 
@@ -74,11 +95,13 @@ module Evnt
74
95
  def _init_event_data(params)
75
96
  # set state
76
97
  @state = {
77
- reloaded: !params[:evnt].nil?
98
+ reloaded: !params[:evnt].nil?,
99
+ saved: true
78
100
  }
79
101
 
80
102
  # set options
81
103
  initial_options = {
104
+ exceptions: false,
82
105
  silent: false
83
106
  }
84
107
  default_options = _safe_default_options || {}
data/lib/evnt/version.rb CHANGED
@@ -3,6 +3,6 @@
3
3
  # Evnt.
4
4
  module Evnt
5
5
 
6
- VERSION = '3.2.6'
6
+ VERSION = '3.3.0'
7
7
 
8
8
  end
@@ -15,7 +15,7 @@ module Evnt
15
15
  path = informations.first.split('::')
16
16
  @event_class = path.last.camelize
17
17
  @event_modules = path - [path.last]
18
- @event_name = path.map(&:underscore).join('_') # TODO: Remove "event" at the end of name if it's present.
18
+ @event_name = event_name_clean(path.map(&:underscore).join('_'))
19
19
  @event_attributes = (informations - [informations.first]).map { |a| ":#{a}" }.join(', ')
20
20
 
21
21
  template(
@@ -31,6 +31,12 @@ module Evnt
31
31
  path
32
32
  end
33
33
 
34
+ def event_name_clean(event_name)
35
+ return event_name unless event_name.end_with?('_event')
36
+
37
+ event_name.gsub('_event', '')
38
+ end
39
+
34
40
  end
35
41
 
36
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evnt
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.6
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ideonetwork