Class: Redwood::Location

Inherits:
Object show all
Defined in:
lib/sup/message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, info) ⇒ Location

Returns a new instance of Location.



771
772
773
774
# File 'lib/sup/message.rb', line 771

def initialize source, info
  @source = source
  @info = info
end

Instance Attribute Details

#infoObject (readonly)

Returns the value of attribute info.



769
770
771
# File 'lib/sup/message.rb', line 769

def info
  @info
end

#sourceObject (readonly)

Returns the value of attribute source.



768
769
770
# File 'lib/sup/message.rb', line 768

def source
  @source
end

Instance Method Details

#==(o) ⇒ Object



819
820
821
# File 'lib/sup/message.rb', line 819

def == o
  o.source.id == source.id and o.info == info
end

#each_raw_message_line(&b) ⇒ Object

much faster than raw_message



803
804
805
# File 'lib/sup/message.rb', line 803

def each_raw_message_line &b
  source.each_raw_message_line info, &b
end

#hashObject



823
824
825
# File 'lib/sup/message.rb', line 823

def hash
  [source.id, info].hash
end

#labels?Boolean

Returns:

  • (Boolean)


815
816
817
# File 'lib/sup/message.rb', line 815

def labels?
  source.labels? info
end

#parsed_messageObject



807
808
809
# File 'lib/sup/message.rb', line 807

def parsed_message
  source.load_message info
end

#raw_headerObject



776
777
778
# File 'lib/sup/message.rb', line 776

def raw_header
  source.raw_header info
end

#raw_messageObject



780
781
782
# File 'lib/sup/message.rb', line 780

def raw_message
  source.raw_message info
end

#sync_back(labels, message) ⇒ Object



784
785
786
787
788
789
790
791
792
793
794
795
796
# File 'lib/sup/message.rb', line 784

def sync_back labels, message
  synced = false
  return synced unless sync_back_enabled? and valid?
  source.synchronize do
    new_info = source.sync_back(@info, labels)
    if new_info
      @info = new_info
      Index.sync_message message, true
      synced = true
    end
  end
  synced
end

#sync_back_enabled?Boolean

Returns:

  • (Boolean)


798
799
800
# File 'lib/sup/message.rb', line 798

def sync_back_enabled?
  source.respond_to? :sync_back and $config[:sync_back_to_maildir] and source.sync_back_enabled?
end

#valid?Boolean

Returns:

  • (Boolean)


811
812
813
# File 'lib/sup/message.rb', line 811

def valid?
  source.valid? info
end