OSDN Git Service
(root)
/
pettanr
/
pettanr.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
add json parser on common
[pettanr/pettanr.git]
/
lib
/
common.rb
diff --git a/lib/common.rb
b/lib/common.rb
new file mode 100644
(file)
index 0000000..
44ebcdf
--- /dev/null
+++ b/
lib/common.rb
@@ -0,0
+1,14
@@
+require 'json'
+
+module JSON
+ def self.parse_no_except(data)
+ res = data
+ begin
+ res = JSON.parse(data) if data.is_a?(String)
+ rescue
+ return false
+ end
+ res
+ end
+end
+