lib/trav3/options.rb in trav3-0.1.1 vs lib/trav3/options.rb in trav3-0.2.0
- old
+ new
@@ -4,11 +4,11 @@
build(**args)
end
def opts
if @opts.empty?
- ""
+ ''
else
"?#{@opts.join('&')}"
end
end
@@ -17,20 +17,25 @@
for (key, value) in args
remove(key)
@opts.push("#{key}=#{value}")
end
+
+ self
end
def remove(key)
@opts = @opts.keep_if {|item, _|
!(/^#{key}=/ === "#{item}")
}
end
def +(other)
raise ArgumentError, "Invalid type provided." unless other.is_a?(Options)
+
@opts += other.instance_variable_get(:@opts)
+
+ self
end
def to_s
opts
end