dohruby 0.2.0 → 0.2.1
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/CHANGELOG +2 -0
- data/lib/doh/util/to_display.rb +87 -0
- metadata +3 -2
data/CHANGELOG
CHANGED
@@ -0,0 +1,87 @@
|
|
1
|
+
require 'doh/core/date'
|
2
|
+
require 'doh/core/bigdecimal'
|
3
|
+
|
4
|
+
class Object
|
5
|
+
def to_display
|
6
|
+
to_s
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class DateTime
|
11
|
+
def to_display
|
12
|
+
strftime('%m/%d/%Y %I:%M%P')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class Date
|
17
|
+
def to_display
|
18
|
+
strftime('%m/%d/%Y')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class TrueClass
|
23
|
+
def to_display
|
24
|
+
'yes'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class FalseClass
|
29
|
+
def to_display
|
30
|
+
'no'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class BigDecimal
|
35
|
+
def to_display
|
36
|
+
'$' + to_dig(2)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class PhoneDisplayString < String
|
41
|
+
def to_display
|
42
|
+
Doh::display_phone(self)
|
43
|
+
end
|
44
|
+
|
45
|
+
def to_s
|
46
|
+
self
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
class PostalDisplayString < String
|
51
|
+
def to_display
|
52
|
+
Doh::display_postal(self)
|
53
|
+
end
|
54
|
+
|
55
|
+
def to_s
|
56
|
+
self
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
class SsnDisplayString < String
|
61
|
+
def to_display
|
62
|
+
Doh::display_ssn(self)
|
63
|
+
end
|
64
|
+
|
65
|
+
def to_s
|
66
|
+
self
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
module Doh
|
71
|
+
|
72
|
+
def self.display_phone(str)
|
73
|
+
return str unless str.size == 10
|
74
|
+
str[0..2] + '-' + str[3..5] + '-' + str[6..9]
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.display_postal(str)
|
78
|
+
return str unless str.size == 9
|
79
|
+
return str[0..4] + '-' + str[5..8]
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.display_ssn(str)
|
83
|
+
return str unless str.size == 9
|
84
|
+
str[0..2] + '-' + str[3..4] + '-' + str[5..8]
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dohruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Makani & Kem Mason
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-06-
|
12
|
+
date: 2008-06-20 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -117,6 +117,7 @@ files:
|
|
117
117
|
- lib/doh/util/num_or_self.rb
|
118
118
|
- lib/doh/util/source_ip.rb
|
119
119
|
- lib/doh/util/time_util.rb
|
120
|
+
- lib/doh/util/to_display.rb
|
120
121
|
- lib/doh.rb
|
121
122
|
- test/core
|
122
123
|
- test/core/tc_bigdecimal.rb
|