Class: CoercibleString
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from String
#previous, #previous!, #remove_extended, #remove_extended!, #tap, #to_header, #underscore, #valid_utf8?
Class Method Details
.coerce(string) ⇒ Object
101
102
103
|
# File 'lib/aws/s3/extensions.rb', line 101
def coerce(string)
new(string).coerce
end
|
Instance Method Details
106
107
108
109
110
111
112
113
114
115
116
|
# File 'lib/aws/s3/extensions.rb', line 106
def coerce
case self
when 'true'; true
when 'false'; false
when /^[1-9]+\d*$/; Integer(self)
when datetime_format; Time.parse(self)
else
self
end
end
|