OSDN Git Service
(root)
/
pettanr
/
pettanr.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
t#:
[pettanr/pettanr.git]
/
lib
/
common.rb
1
require 'json'
2
3
module JSON
4
def self.parse_no_except(data)
5
res = data
6
begin
7
res = JSON.parse(data) if data.is_a?(String)
8
rescue
9
return false
10
end
11
res
12
end
13
end
14
15
class Hash
16
def to_attr
17
self.map {|k, n| "#{k}=\"#{n}\"" }.join(' ')
18
end
19
end
20