protokoll 0.5.3 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,6 +30,7 @@ module Protokoll
30
30
  event += "%m" if pattern.include? "%m"
31
31
  event += "%H" if pattern.include? "%H"
32
32
  event += "%M" if pattern.include? "%M"
33
+ event += "%d" if pattern.include? "%d"
33
34
  event
34
35
  end
35
36
  end
@@ -2,22 +2,22 @@ module Protokoll
2
2
  extend ActiveSupport::Concern
3
3
 
4
4
  module ClassMethods
5
-
5
+
6
6
  # Class method available in models
7
- #
7
+ #
8
8
  # == Example
9
9
  # class Order < ActiveRecord::Base
10
10
  # protokoll :number
11
11
  # end
12
12
  #
13
13
  def protokoll(column, _options = {})
14
- options = { :pattern => "%Y%m#####",
14
+ options = { :pattern => "%Y%m#####",
15
15
  :number_symbol => "#",
16
16
  :column => column,
17
17
  :start => 0 }
18
18
 
19
19
  options.merge!(_options)
20
-
20
+
21
21
  # Defining custom method
22
22
  send :define_method, "reserve_#{options[:column]}!".to_sym do
23
23
  self[column] = Counter.next(self, options)
@@ -25,11 +25,11 @@ module Protokoll
25
25
 
26
26
  # Signing before_create
27
27
  before_create do |record|
28
- return if record[column].present?
29
-
30
- record[column] = Counter.next(self, options)
28
+ unless record[column].present?
29
+ record[column] = Counter.next(self, options)
30
+ end
31
31
  end
32
32
  end
33
33
  end
34
-
34
+
35
35
  end
@@ -1,3 +1,3 @@
1
1
  module Protokoll
2
- VERSION = "0.5.3"
2
+ VERSION = "0.6.0"
3
3
  end