Module: LS4RPC

Defined in:
lib/ls4/command/rpc.rb

Constant Summary collapse

CS_METHODS =
[]
DS_METHODS =
[]
GW_METHODS =
[]

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.cs_rpc(name, *args) ⇒ Object



51
52
53
54
# File 'lib/ls4/command/rpc.rb', line 51

def self.cs_rpc(name, *args)
	CS_METHODS << [name, args]
	rpc(name, args)
end

.ds_rpc(name, *args) ⇒ Object



56
57
58
59
# File 'lib/ls4/command/rpc.rb', line 56

def self.ds_rpc(name, *args)
	DS_METHODS << [name, args]
	rpc(name, args)
end

.gw_rpc(name, *args) ⇒ Object



61
62
63
64
# File 'lib/ls4/command/rpc.rb', line 61

def self.gw_rpc(name, *args)
	GW_METHODS << [name, args]
	rpc(name, args)
end

.rpc(name, args) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/ls4/command/rpc.rb', line 43

def self.rpc(name, args)
	self.module_eval <<-RUBY
		def #{name}(#{args.join(',')})
			call(:#{([name]+args).join(',')})
		end
	RUBY
end

Instance Method Details

#showObject



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/ls4/command/rpc.rb', line 66

def show
	puts "Gateway methods:"
	GW_METHODS.each {|name,args|
		puts "  #{name}(#{args.join(', ')})"
	}
	puts ""
	puts "Config Server methods:"
	CS_METHODS.each {|name,args|
		puts "  #{name}(#{args.join(', ')})"
	}
	puts ""
	puts "Data Server methods:"
	(DS_METHODS+GW_METHODS).each {|name,args|
		puts "  #{name}(#{args.join(', ')})"
	}
	nil
end