Class: GMail::TagList
- Inherits:
-
Object
- Object
- GMail::TagList
- Includes:
- Enumerable
- Defined in:
- lib/gmail/taglist.rb
Overview
Represent a bag of tags backed by a TC db
Instance Attribute Summary (collapse)
-
- (Object) list
Returns the value of attribute list.
Instance Method Summary (collapse)
-
- (Object) <<(e)
<<.
-
- (Fixnum) [](k)
[].
-
- (Fixnum) []=(k, v)
[]=.
-
- (Object) add(e)
add.
-
- (Object) each
iterator.
-
- (Boolean) include?(elem)
include?.
-
- (TagList) initialize
constructor
Constructor.
-
- (Array) keys
keys.
-
- (Fixnum) length
length.
Constructor Details
- (TagList) initialize
Constructor
17 18 19 |
# File 'lib/gmail/taglist.rb', line 17 def initialize @list = Hash.new{0} end |
Instance Attribute Details
- (Object) list
Returns the value of attribute list
14 15 16 |
# File 'lib/gmail/taglist.rb', line 14 def list @list end |
Instance Method Details
- (Object) <<(e)
<<
43 44 45 46 47 48 49 50 |
# File 'lib/gmail/taglist.rb', line 43 def <<(e) if e.class == GMail::Tag @list[e] += 1 else @list[GMail::Tag.new(e)] += 1 end self end |
- (Fixnum) [](k)
29 30 31 |
# File 'lib/gmail/taglist.rb', line 29 def [](k) @list[k] end |
- (Fixnum) []=(k, v)
[]=
37 38 39 |
# File 'lib/gmail/taglist.rb', line 37 def []=(k, v) @list[k] = v end |
- (Object) add(e)
add
54 55 56 |
# File 'lib/gmail/taglist.rb', line 54 def add(e) self.<<(e) end |
- (Object) each
iterator
22 23 24 |
# File 'lib/gmail/taglist.rb', line 22 def each @list.each_key{|e| yield e} end |
- (Boolean) include?(elem)
include?
60 61 62 |
# File 'lib/gmail/taglist.rb', line 60 def include?(elem) @list.include?(elem) end |
- (Array) keys
keys
72 73 74 |
# File 'lib/gmail/taglist.rb', line 72 def keys @list.keys end |
- (Fixnum) length
length
66 67 68 |
# File 'lib/gmail/taglist.rb', line 66 def length @list.length end |