hobofields 0.9.102 → 0.9.103
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/hobo_fields.rb +1 -1
- data/test/rich_types.rdoctest +8 -1
- metadata +5 -6
data/lib/hobo_fields.rb
CHANGED
data/test/rich_types.rdoctest
CHANGED
@@ -68,16 +68,23 @@ This class defines the methods `to_html` to customize the way the type is render
|
|
68
68
|
"is too long (you shouldn't shout that much)" if length > 100
|
69
69
|
end
|
70
70
|
|
71
|
+
def format
|
72
|
+
# make sure we have enough exclamation marks
|
73
|
+
self =~ /!!!$/ ? self + "!!!" : self
|
74
|
+
end
|
75
|
+
|
71
76
|
def to_html(xmldoctype = true)
|
72
77
|
upcase
|
73
78
|
end
|
74
79
|
|
75
80
|
end
|
76
81
|
|
77
|
-
That's all there is to it. Defining `to_html` and `validate` are optional, defining `COLUMN_TYPE` and calling `HoboFields.register_type` are not.
|
82
|
+
That's all there is to it. Defining `to_html`, `format` and `validate` are optional, defining `COLUMN_TYPE` and calling `HoboFields.register_type` are not.
|
78
83
|
|
79
84
|
We use `DelegateClass` so that we can act like a string without actually being a string.
|
80
85
|
|
86
|
+
The format function is added as a before\_validation hook. Ensure that multiple invocations of your format function is safe -- shout.format.format should return the same as shout.format.
|
87
|
+
|
81
88
|
You can use `LoudText` in your model with
|
82
89
|
|
83
90
|
fields do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hobofields
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.103
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Locke
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-12-
|
12
|
+
date: 2009-12-10 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.9.
|
33
|
+
version: 0.9.103
|
34
34
|
version:
|
35
35
|
description:
|
36
36
|
email: tom@tomlocke.com
|
@@ -38,9 +38,8 @@ executables: []
|
|
38
38
|
|
39
39
|
extensions: []
|
40
40
|
|
41
|
-
extra_rdoc_files:
|
42
|
-
|
43
|
-
- README.txt
|
41
|
+
extra_rdoc_files: []
|
42
|
+
|
44
43
|
files:
|
45
44
|
- CHANGES.txt
|
46
45
|
- LICENSE.txt
|