Class: RIMS::Protocol::SearchParser
- Inherits:
-
Object
- Object
- RIMS::Protocol::SearchParser
- Defined in:
- lib/rims/protocol/parser.rb
Instance Attribute Summary collapse
-
#charset ⇒ Object
Returns the value of attribute charset.
Instance Method Summary collapse
-
#initialize(mail_store, folder, charset_aliases: RFC822::DEFAULT_CHARSET_ALIASES, charset_convert_options: nil) ⇒ SearchParser
constructor
A new instance of SearchParser.
- #parse(search_key) ⇒ Object
- #parse_msg_flag_disabled(name) ⇒ Object
Constructor Details
#initialize(mail_store, folder, charset_aliases: RFC822::DEFAULT_CHARSET_ALIASES, charset_convert_options: nil) ⇒ SearchParser
Returns a new instance of SearchParser.
281 282 283 284 285 286 287 288 289 290 291 292 |
# File 'lib/rims/protocol/parser.rb', line 281 def initialize(mail_store, folder, charset_aliases: RFC822::DEFAULT_CHARSET_ALIASES, charset_convert_options: nil) @mail_store = mail_store @folder = folder @charset_aliases = charset_aliases @charset_convert_options = || {} @charset = nil @mail_cache = Hash.new{|hash, uid| if (msg_txt = @mail_store.msg_text(@folder.mbox_id, uid)) then hash[uid] = RFC822::Message.new(msg_txt, charset_aliases: @charset_aliases) end } end |
Instance Attribute Details
#charset ⇒ Object
Returns the value of attribute charset.
299 300 301 |
# File 'lib/rims/protocol/parser.rb', line 299 def charset @charset end |
Instance Method Details
#parse(search_key) ⇒ Object
774 775 776 777 778 779 780 781 |
# File 'lib/rims/protocol/parser.rb', line 774 def parse(search_key) cond = parse_cached(search_key) proc{|msg| found = cond.call(msg) @mail_cache.clear found } end |
#parse_msg_flag_disabled(name) ⇒ Object
355 356 357 358 359 360 361 |
# File 'lib/rims/protocol/parser.rb', line 355 def parse_msg_flag_disabled(name) proc{|next_cond| proc{|msg| (! @mail_store.msg_flag(@folder.mbox_id, msg.uid, name)) && next_cond.call(msg) } } end |