==(other)
click to toggle source
def ==(other)
other.is_a?(Param) && other.type == type && other.name == name
end
eql?(other)
click to toggle source
hash()
click to toggle source
def hash
self.class.hash ^ type.hash ^ name.hash
end
map_type(&block)
click to toggle source
def map_type(&block)
if block
Param.new(name: name, type: yield(type), location: location)
else
enum_for :map_type
end
end
to_json(state = _ = nil)
click to toggle source
def to_json(state = _ = nil)
{ type: type, name: name }.to_json(state)
end
to_s()
click to toggle source
def to_s
if name
if Parser::KEYWORDS.include?(name.to_s)
"#{type} `#{name}`"
else
"#{type} #{name}"
end
else
"#{type}"
end
end