last method implemented
This commit is contained in:
parent
507adc9005
commit
9126879af1
1 changed files with 8 additions and 22 deletions
|
|
@ -175,9 +175,7 @@ end
|
||||||
def alpha (group)
|
def alpha (group)
|
||||||
name = group["name"]
|
name = group["name"]
|
||||||
for i in (0...@newsrc["list"].length)
|
for i in (0...@newsrc["list"].length)
|
||||||
# print @newsrc["list"][i]["name"],"\n"
|
|
||||||
if ((name <=> @newsrc["list"][i]["name"]) == -1)
|
if ((name <=> @newsrc["list"][i]["name"]) == -1)
|
||||||
# splice @$list, $i, 0, $group
|
|
||||||
upper = @newsrc["list"].slice!(i..@newsrc["list"].length)
|
upper = @newsrc["list"].slice!(i..@newsrc["list"].length)
|
||||||
@newsrc["list"] += [ group ]
|
@newsrc["list"] += [ group ]
|
||||||
@newsrc["list"] += upper
|
@newsrc["list"] += upper
|
||||||
|
|
@ -188,14 +186,9 @@ def alpha (group)
|
||||||
end
|
end
|
||||||
|
|
||||||
def before(group, before)
|
def before(group, before)
|
||||||
# print "before\n"
|
|
||||||
name = group["name"]
|
name = group["name"]
|
||||||
|
|
||||||
|
|
||||||
for i in (0...@newsrc["list"].length)
|
for i in (0...@newsrc["list"].length)
|
||||||
# print @newsrc["list"][i]["name"],"\n"
|
|
||||||
if (@newsrc["list"][i]["name"] == before.to_s)
|
if (@newsrc["list"][i]["name"] == before.to_s)
|
||||||
# print @newsrc["list"][i]["name"],"\n"
|
|
||||||
upper = @newsrc["list"].slice!(i..@newsrc["list"].length)
|
upper = @newsrc["list"].slice!(i..@newsrc["list"].length)
|
||||||
@newsrc["list"] += [ group ]
|
@newsrc["list"] += [ group ]
|
||||||
@newsrc["list"] += upper
|
@newsrc["list"] += upper
|
||||||
|
|
@ -212,7 +205,6 @@ def after(group, after)
|
||||||
|
|
||||||
for i in (0...@newsrc["list"].length)
|
for i in (0...@newsrc["list"].length)
|
||||||
if (@newsrc["list"][i]["name"] == after.to_s)
|
if (@newsrc["list"][i]["name"] == after.to_s)
|
||||||
#print @newsrc["list"][i+1]["name"],"\n"
|
|
||||||
upper = @newsrc["list"].slice!((i+1)..@newsrc["list"].length)
|
upper = @newsrc["list"].slice!((i+1)..@newsrc["list"].length)
|
||||||
@newsrc["list"] += [ group ]
|
@newsrc["list"] += [ group ]
|
||||||
@newsrc["list"] += upper
|
@newsrc["list"] += upper
|
||||||
|
|
@ -323,23 +315,18 @@ def num_groups
|
||||||
end
|
end
|
||||||
|
|
||||||
def groups
|
def groups
|
||||||
list = @newsrc["list"]
|
list = @newsrc["list"].dup
|
||||||
list = list.collect{|x| x["name"]}
|
list.collect!{|x| x["name"]}
|
||||||
return list
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def sub_groups
|
def sub_groups
|
||||||
list = @newsrc["list"]
|
list = @newsrc["list"].dup
|
||||||
list = list.collect{|x| x["subscribed"] ? x["name"] : nil}
|
list.collect!{|x| x["subscribed"] ? x["name"] : nil}.compact!
|
||||||
list.compact!
|
|
||||||
return list
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def unsub_groups
|
def unsub_groups
|
||||||
list = @newsrc["list"]
|
list = @newsrc["list"].dup
|
||||||
list = list.collect{|x| x["subscribed"] ? nil : x["name"]}
|
list.collect!{|x| x["subscribed"] ? nil : x["name"]}.compact!
|
||||||
list.compact!
|
|
||||||
return list
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def marked_articles(name, options = {"where" => ""})
|
def marked_articles(name, options = {"where" => ""})
|
||||||
|
|
@ -354,8 +341,7 @@ def unmarked_articles(name, from, to, options = {"where" => ""})
|
||||||
add_group(name, options)
|
add_group(name, options)
|
||||||
end
|
end
|
||||||
range = Set::IntSpan.new("#{from}-#{to}")
|
range = Set::IntSpan.new("#{from}-#{to}")
|
||||||
unmarked = range.diff(@newsrc["group"][name]["articles"])
|
return range.diff(@newsrc["group"][name]["articles"]).elements
|
||||||
return unmarked.elements
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_articles(name, options = {"where" => ""})
|
def get_articles(name, options = {"where" => ""})
|
||||||
|
|
@ -420,6 +406,6 @@ end # module
|
||||||
# [x] sub_groups
|
# [x] sub_groups
|
||||||
# [x] unsub_groups
|
# [x] unsub_groups
|
||||||
# [x] marked_articles
|
# [x] marked_articles
|
||||||
# [ ] unmarked_articles
|
# [x] unmarked_articles
|
||||||
# [x] get_articles
|
# [x] get_articles
|
||||||
# [x] set_articles
|
# [x] set_articles
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue