simple_show 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/simple_show/base.rb +10 -8
- data/lib/simple_show/version.rb +1 -1
- metadata +4 -4
data/lib/simple_show/base.rb
CHANGED
@@ -48,15 +48,17 @@ module SimpleShow
|
|
48
48
|
else
|
49
49
|
value = options[:value] || @record.send(attr)
|
50
50
|
end
|
51
|
-
if
|
52
|
-
if [:
|
53
|
-
|
54
|
-
|
55
|
-
|
51
|
+
if value
|
52
|
+
if options[:format].present?
|
53
|
+
if [:datetime, :timestamp, :time, :date].include?(@record.class.columns_hash[attr.to_s].type)
|
54
|
+
value = value.send(options[:format].is_a?(Symbol) ? :to_s : :strftime, options[:format])
|
55
|
+
else
|
56
|
+
value = options[:format] % value
|
57
|
+
end
|
58
|
+
elsif (helper = %w[to_currency to_human to_human_size to_percentage to_phone with_delimiter with_precision].detect{|e| options[e.to_sym].present?})
|
59
|
+
options[helper.to_sym] = {} unless options[helper.to_sym].is_a? Hash
|
60
|
+
value = @binding.send("number_#{helper}", value, options[helper.to_sym])
|
56
61
|
end
|
57
|
-
elsif (helper = %w[to_currency to_human to_human_size to_percentage to_phone with_delimiter with_precision].detect{|e| options[e.to_sym].present?})
|
58
|
-
options[helper.to_sym] = {} unless options[helper.to_sym].is_a? Hash
|
59
|
-
value = @binding.send("number_#{helper}", value, options[helper.to_sym])
|
60
62
|
end
|
61
63
|
|
62
64
|
@binding.content_tag(SimpleShow.value_tag, :class => SimpleShow.value_class) do
|
data/lib/simple_show/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_show
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Philip Hallstrom
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-08-
|
18
|
+
date: 2011-08-13 00:00:00 Z
|
19
19
|
dependencies: []
|
20
20
|
|
21
21
|
description: "SimpleShow is to #show what SimpleForm is to #edit"
|