class RPCoder::Param
Attributes
name[RW]
options[RW]
type[RW]
Public Class Methods
new(name, type, options = {})
click to toggle source
# File lib/rpcoder/param.rb, line 8 def initialize(name, type, options = {}) @name = name @type = type @options = options end
original_types()
click to toggle source
# File lib/rpcoder/param.rb, line 3 def self.original_types [:int, :String, :Boolean, :Array] end
Public Instance Methods
array?()
click to toggle source
# File lib/rpcoder/param.rb, line 14 def array? options[:array?] end
array_or_type()
click to toggle source
# File lib/rpcoder/param.rb, line 18 def array_or_type if array? "Array" else type end end
array_param()
click to toggle source
# File lib/rpcoder/param.rb, line 30 def array_param Param.new(name, options[:array_type]) end
element_accessor(elem = 'elem', options = {})
click to toggle source
# File lib/rpcoder/param.rb, line 43 def element_accessor(elem = 'elem', options = {}) if options[:object?] "object['#{elem}']" else elem end end
instance_creator(elem = 'elem', options = {})
click to toggle source
# File lib/rpcoder/param.rb, line 34 def instance_creator(elem = 'elem', options = {}) elem = element_accessor(elem, options) if original_type? elem else "new #{type}(#{elem})" end end
original_type?()
click to toggle source
# File lib/rpcoder/param.rb, line 26 def original_type? Param.original_types.include?(type.to_sym) end