protokoll 0.1.2 → 0.1.3

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.
@@ -63,39 +63,21 @@ module Protokoll
63
63
  (pattern =~ /[#]+/ and $&).length
64
64
  end
65
65
 
66
- def time_outdated?(pattern, record_date)
67
- if (pattern.include? "%y") # year
68
- return true if Time.now.year > record_date.year
69
- end
70
-
71
- if (pattern.include? "%m") # month
72
- return true if Time.now.month > record_date.month
73
- end
74
-
75
- if (pattern.include? "%d") # day
76
- return true if Time.now.day > record_date.day
77
- end
78
-
79
- if (pattern.include? "%H") # hour
80
- return true if Time.now.hour > record_date.hour
81
- end
82
-
83
- if (pattern.include? "%M") # minute
84
- return true if Time.now.minute > record_date.min
85
- end
86
- end
87
-
88
66
  def outdated?(record)
89
67
  Time.now.strftime(update_event).to_i > record.created_at.strftime(update_event).to_i
90
68
  end
91
69
 
70
+ # BUG 1 : If using %y%m# and only year changes (user stays
71
+ # more then one year without updating the model) counter doesn't updates!
92
72
  def update_event
93
73
  pattern = options[:pattern]
94
- return "%M" if pattern.include? "%M"
95
- return "%H" if pattern.include? "%H"
96
- return "%m" if pattern.include? "%m"
97
- return "%y" if pattern.include? "%y" or pattern.include? "%Y"
98
- return ""
74
+ event = String.new
75
+
76
+ event += "%Y" if pattern.include? "%y" or pattern.include? "%Y"
77
+ event += "%m" if pattern.include? "%m"
78
+ event += "%H" if pattern.include? "%H"
79
+ event += "%M" if pattern.include? "%M"
80
+ event
99
81
  end
100
82
 
101
83
  end
@@ -1,3 +1,3 @@
1
1
  module Protokoll
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end