twitter-lists 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/twitter-lists/list.rb +14 -5
  3. metadata +1 -1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -18,20 +18,29 @@ module Twitter
18
18
  end
19
19
 
20
20
  def parse(str)
21
- n= new
21
+ n = new
22
22
  n.user, n.name = str.sub(/^@/,'').split('/')
23
23
  n
24
24
  end
25
25
 
26
- def union(*lists)
26
+ def parse_and_load(str)
27
+ n = parse(str)
28
+ n.load_members
29
+ n
30
+ end
31
+
32
+ def lists_to_sets(lists)
27
33
  lists = lists.collect { |l| l.is_a?(List) ? l : parse(l) }
28
- sets = lists.collect { |l| Set.new l.members }
34
+ lists.collect { |l| l.load_members ; Set.new(l.members) }
35
+ end
36
+
37
+ def union(*lists)
38
+ sets = lists_to_sets(lists)
29
39
  sets.inject { |u,s| s.union u }.to_a
30
40
  end
31
41
 
32
42
  def intersection(*lists)
33
- lists = lists.collect { |l| l.is_a?(List) ? l : parse(l) }
34
- sets = lists.collect { |l| Set.new l.members }
43
+ sets = lists_to_sets(lists)
35
44
  sets.inject { |i,s| s.intersection i }.to_a
36
45
  end
37
46
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitter-lists
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael D. Ivey