Module: Str2Duck
- Defined in:
- lib/str2duck/config.rb,
lib/str2duck/format.rb,
lib/str2duck/parser.rb,
lib/str2duck/regexp.rb,
lib/str2duck/support.rb,
lib/str2duck/mpatch/object.rb,
lib/str2duck/mpatch/string.rb
Defined Under Namespace
Modules: Config, Format, MPatch, Regexp
Class Method Summary
collapse
Class Method Details
.parse(string_data_obj) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/str2duck/parser.rb', line 4
def self.parse string_data_obj
raise ArgumentError,"invalid input, must be string!" if string_data_obj.class != String
return_value= nil
[ :datetime, :date, :time, :true, :false, :float, :integer, :json, :yaml ].each do |method_name|
if ::Str2Duck::Config.__send__(method_name)
return_value ||= Str2Duck::Format.__send__ method_name, string_data_obj
end
end
return_value ||= string_data_obj
return return_value
end
|
.return_value_parse(object) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
|
# File 'lib/str2duck/support.rb', line 4
def return_value_parse object
case object
when nil
return false
when 0
return true
else
nil
end
end
|