Code Review
/
packages
/
precise
/
mcollective.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
history
|
raw
|
HEAD
Update mcollective.init script according to OSCI-969
[packages/precise/mcollective.git]
/
mcollective-2.3.3
/
lib
/
mcollective
/
vendor
/
json
/
lib
/
json
/
add
/
complex.rb
1
unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
2
require 'json'
3
end
4
defined?(::Complex) or require 'complex'
5
6
class Complex
7
def self.json_create(object)
8
Complex(object['r'], object['i'])
9
end
10
11
def as_json(*)
12
{
13
JSON.create_id => self.class.name,
14
'r' => real,
15
'i' => imag,
16
}
17
end
18
19
def to_json(*)
20
as_json.to_json
21
end
22
end