del_opt(opts)
click to toggle source
def del_opt(opts)
[ opts ].flatten.each do |opt|
return delete(opt) if has_key?(opt)
end
nil
end
del_opts(*opts)
click to toggle source
def del_opts(*opts)
opts.flatten.map{|opt| delopt(opt)}
opts
end
get_opt(opts, options = {})
click to toggle source
def get_opt(opts, options = {})
options = Map.for(options.is_a?(Hash) ? options : {:default => options})
default = options[:default]
[ opts ].flatten.each do |opt|
return fetch(opt) if has_key?(opt)
end
default
end
get_opts(*opts)
click to toggle source
def get_opts(*opts)
opts.flatten.map{|opt| getopt(opt)}
end
has_opt(opts)
click to toggle source
def has_opt(opts)
[ opts ].flatten.each do |opt|
return true if has_key?(opt)
end
false
end
has_opts(*opts)
click to toggle source
def has_opts(*opts)
opts.flatten.all?{|opt| hasopt(opt)}
end
pop()
click to toggle source
def pop
arguments.pop if arguments.last.object_id == object_id
self
end
pop!()
click to toggle source
def pop!
arguments.pop if arguments.last.object_id == object_id
self
end
popped?()
click to toggle source
def popped?
!(arguments.last.object_id == object_id)
end
set_opt(opts, value = nil)
click to toggle source
def set_opt(opts, value = nil)
[ opts ].flatten.each do |opt|
return self[opt]=value
end
return value
end
set_opts(opts)
click to toggle source
def set_opts(opts)
opts.each{|key, value| setopt(key, value)}
opts
end