Module: Str2Duck
- Defined in:
- lib/str2duck/config.rb,
lib/str2duck/format.rb,
lib/str2duck/parser.rb,
lib/str2duck/regexp.rb,
lib/str2duck/mpatch/object.rb
Defined Under Namespace
Modules: Config, Format, MPatch, Regexp
Class Method Summary
collapse
Class Method Details
.activesupport ⇒ Object
4
5
6
7
8
|
# File 'lib/str2duck/parser.rb', line 4
def self.activesupport
require(File.join 'active_support','time')
rescue LoadError
return true
end
|
.parse(str) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/str2duck/parser.rb', line 10
def self.parse str
raise(ArgumentError,"invalid input, must be string like") unless str.class <= String
@activesupport ||= activesupport
[ :datetime, :date, :time, :true, :false, :float, :integer, :json, :yaml ].each do |method_name|
if ::Str2Duck::Config.public_send(method_name)
var = Str2Duck::Format.public_send method_name, str
return var unless var.nil?
end
end
return str
end
|