effective_datatables 3.0.5 → 3.0.6

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
  SHA1:
3
- metadata.gz: 9661a4c6eba5a48628670afc02bbfed2288ffd1e
4
- data.tar.gz: 688f0281eb5be12a2d80d3405043529906651a57
3
+ metadata.gz: 6baae8c780d1f157f3ffeaab844b16e923514236
4
+ data.tar.gz: a51f0b958bd5570bf449e38c7a5c912ad7b0e3a3
5
5
  SHA512:
6
- metadata.gz: 692fb8fcd1cfc8c68bde471887525fa280ecef5266f279e3be86db5d13dc8311a57fa37aedf08d9f0e8ea69bd827364c65f4379e705992e97f0d92772d6ac513
7
- data.tar.gz: 048b6b8dea7fa887d35ceb37f7b649471d1d0749f2154d954495ef0dc2fe290c4c6faceb07f10f32ca6ae1d02ff87b0106487945ce1dd671031b4468f8ee0bb1
6
+ metadata.gz: dbd77588b6c63d4eb651eedd870d2fc0648d01c92bdfba957c7928fa36b292465037a069def544afaeb086f3fa81058b4bf671b1ccc8f26fdf7f0a551fd98909
7
+ data.tar.gz: 72d53698fe71bb5bd0ae20605422a76648e90b90d203537ce0a5a7a79602ad5a8df663ddacac173da5d86cecb9593a474b8164a16f5a764f4d20e99f45adad9b
@@ -52,6 +52,8 @@ module Effective
52
52
  end
53
53
 
54
54
  def format_column(value, column)
55
+ return if value.nil?
56
+
55
57
  case column[:as]
56
58
  when :boolean
57
59
  case value
@@ -60,23 +62,23 @@ module Effective
60
62
  when String ; value
61
63
  end
62
64
  when :currency
63
- view.number_to_currency(value) if value.present?
65
+ view.number_to_currency(value)
64
66
  when :date
65
- (value.strftime('%F') rescue BLANK) if value.present?
67
+ (value.strftime('%F') rescue BLANK)
66
68
  when :datetime
67
- (value.strftime('%F %H:%M') rescue BLANK) if value.present?
69
+ (value.strftime('%F %H:%M') rescue BLANK)
68
70
  when :decimal
69
71
  value
70
72
  when :duration
71
- view.number_to_duration(value) if value.present?
73
+ view.number_to_duration(value)
72
74
  when :effective_addresses
73
- value.to_html if value.present?
75
+ value.to_html
74
76
  when :effective_obfuscation
75
77
  value
76
78
  when :effective_roles
77
79
  value.join(', ')
78
80
  when :email
79
- view.mail_to(value) if value.present?
81
+ view.mail_to(value)
80
82
  when :integer
81
83
  value
82
84
  when :percentage
@@ -86,8 +88,11 @@ module Effective
86
88
  when String ; value
87
89
  end
88
90
  when :price
89
- raise 'column type: price expects an Integer representing the number of cents' unless value.kind_of?(Integer)
90
- view.number_to_currency(value / 100.0) if value.present?
91
+ case value
92
+ when Integer ; view.number_to_currency(value / 100.0) # an Integer representing the number of cents
93
+ when Numeric ; view.number_to_currency(value)
94
+ when String ; value
95
+ end
91
96
  else
92
97
  value.to_s
93
98
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveDatatables
2
- VERSION = '3.0.5'.freeze
2
+ VERSION = '3.0.6'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_datatables
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.5
4
+ version: 3.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect