class Hiptest::NodeModifiers::CallTypes
Public Class Methods
new()
click to toggle source
# File lib/hiptest-publisher/node_modifiers/parameter_type_adder.rb, line 98 def initialize @callable_items = {} @current_callable_item = nil end
Public Instance Methods
add_argument_type(name, type)
click to toggle source
# File lib/hiptest-publisher/node_modifiers/parameter_type_adder.rb, line 109 def add_argument_type(name, type) @current_callable_item[name] ||= {types: Set.new} @current_callable_item[name][:types] << type end
add_callable_item(item_name, item_type)
click to toggle source
# File lib/hiptest-publisher/node_modifiers/parameter_type_adder.rb, line 103 def add_callable_item(item_name, item_type) name = "#{item_type}-#{item_name}" @callable_items[name] ||= {} @current_callable_item = @callable_items[name] end
type_of(item_name, parameter_name, item_type)
click to toggle source
# File lib/hiptest-publisher/node_modifiers/parameter_type_adder.rb, line 114 def type_of(item_name, parameter_name, item_type) name = "#{item_type}-#{item_name}" callable_item = @callable_items[name] return :String if callable_item.nil? parameter = callable_item[parameter_name] return :String if parameter.nil? return type_from_types(parameter[:types]) end
Private Instance Methods
type_from_types(types)
click to toggle source
# File lib/hiptest-publisher/node_modifiers/parameter_type_adder.rb, line 127 def type_from_types(types) types = types - [:null] if types.empty? :null elsif types.length == 1 types.first elsif types == Set[:float, :int] :float else :String end end