last method implemented

This commit is contained in:
Ward Wouts 2002-04-28 15:04:19 +00:00
parent 507adc9005
commit 9126879af1

View file

@ -175,9 +175,7 @@ end
def alpha (group)
name = group["name"]
for i in (0...@newsrc["list"].length)
# print @newsrc["list"][i]["name"],"\n"
if ((name <=> @newsrc["list"][i]["name"]) == -1)
# splice @$list, $i, 0, $group
upper = @newsrc["list"].slice!(i..@newsrc["list"].length)
@newsrc["list"] += [ group ]
@newsrc["list"] += upper
@ -188,14 +186,9 @@ def alpha (group)
end
def before(group, before)
# print "before\n"
name = group["name"]
for i in (0...@newsrc["list"].length)
# print @newsrc["list"][i]["name"],"\n"
if (@newsrc["list"][i]["name"] == before.to_s)
# print @newsrc["list"][i]["name"],"\n"
upper = @newsrc["list"].slice!(i..@newsrc["list"].length)
@newsrc["list"] += [ group ]
@newsrc["list"] += upper
@ -212,7 +205,6 @@ def after(group, after)
for i in (0...@newsrc["list"].length)
if (@newsrc["list"][i]["name"] == after.to_s)
#print @newsrc["list"][i+1]["name"],"\n"
upper = @newsrc["list"].slice!((i+1)..@newsrc["list"].length)
@newsrc["list"] += [ group ]
@newsrc["list"] += upper
@ -323,23 +315,18 @@ def num_groups
end
def groups
list = @newsrc["list"]
list = list.collect{|x| x["name"]}
return list
list = @newsrc["list"].dup
list.collect!{|x| x["name"]}
end
def sub_groups
list = @newsrc["list"]
list = list.collect{|x| x["subscribed"] ? x["name"] : nil}
list.compact!
return list
list = @newsrc["list"].dup
list.collect!{|x| x["subscribed"] ? x["name"] : nil}.compact!
end
def unsub_groups
list = @newsrc["list"]
list = list.collect{|x| x["subscribed"] ? nil : x["name"]}
list.compact!
return list
list = @newsrc["list"].dup
list.collect!{|x| x["subscribed"] ? nil : x["name"]}.compact!
end
def marked_articles(name, options = {"where" => ""})
@ -354,8 +341,7 @@ def unmarked_articles(name, from, to, options = {"where" => ""})
add_group(name, options)
end
range = Set::IntSpan.new("#{from}-#{to}")
unmarked = range.diff(@newsrc["group"][name]["articles"])
return unmarked.elements
return range.diff(@newsrc["group"][name]["articles"]).elements
end
def get_articles(name, options = {"where" => ""})
@ -420,6 +406,6 @@ end # module
# [x] sub_groups
# [x] unsub_groups
# [x] marked_articles
# [ ] unmarked_articles
# [x] unmarked_articles
# [x] get_articles
# [x] set_articles