fossil 0.5.43 → 0.5.44

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.43
1
+ 0.5.44
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fossil}
8
- s.version = "0.5.43"
8
+ s.version = "0.5.44"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Daniel Sudol", "Patrick Lardin"]
@@ -107,6 +107,12 @@ end
107
107
  class DateTime
108
108
  include TimeFunctions
109
109
 
110
+ # using a date of 2000,1,1 is arbitrary
111
+ def self.from_fos_time(minutes)
112
+ minutes = 0 unless minutes
113
+ (Time.utc(2000, 1, 1) + minutes.minutes).to_datetime
114
+ end
115
+
110
116
  # creates utc time from days and minutes
111
117
  def self.from_fos_date_time(days, minutes)
112
118
  days = 0 unless days
@@ -244,7 +244,7 @@ class Sequel::Model
244
244
  when :date
245
245
  Date.from_fos_days(column_value) if column_value
246
246
  when :time
247
- Time.from_fos_time(column_value) if column_value
247
+ DateTime.from_fos_time(column_value) if column_value
248
248
  when :currency
249
249
  # (column_value || 0).to_currency
250
250
  number_to_currency((column_value || 0).to_f/100, :unit=>'', :precision=>2)
@@ -259,15 +259,21 @@ class Sequel::Model
259
259
  end
260
260
 
261
261
  method_view_name = method_name.to_s + "_view"
262
- # now the view method for all except currency, delimited or boolean
263
- unless type == (:currency or :delimited or :boolean)
262
+
263
+ # view methods for time type
264
+ if type == :time
264
265
  inst_def method_view_name do
265
266
  value = send(method_name)
266
- value.to_s if value
267
+ value.strftime('%H:%M') if value
267
268
  end
268
269
  end
269
- # extra view method for date type
270
+ # view methods for date type
270
271
  if type == :date
272
+ inst_def method_view_name do
273
+ value = send(method_name)
274
+ value.to_s if value
275
+ end
276
+ # extra view methods for date type
271
277
  method_view_name = method_name.to_s + "_view_mdy"
272
278
  # method that returns the column value as a Date in mdy format
273
279
  inst_def method_view_name do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 43
9
- version: 0.5.43
8
+ - 44
9
+ version: 0.5.44
10
10
  platform: ruby
11
11
  authors:
12
12
  - Daniel Sudol