Sha256: 4b3582b9fd229a416cc7f1d356951ad15d3a0322cf50bb78dc3c6fbf68e84a41

Contents?: true

Size: 640 Bytes

Versions: 6

Compression:

Stored size: 640 Bytes

Contents

module Redwood

class ComposeMode < EditMessageMode
  attr_reader :body, :header

  def initialize h={}
    super()
    @header = {
      "From" => AccountManager.default_account.full_address,
      "Message-Id" => gen_message_id,
    }

    @header["To"] = [h[:to]].flatten.compact.map { |p| p.full_address }
    @body = sig_lines
    regen_text
  end

  def lines; @text.length; end
  def [] i; @text[i]; end

protected

  def handle_new_text new_header, new_body
    @header = new_header
    @body = new_body
  end

  def regen_text
    @text = header_lines(@header - EditMessageMode::NON_EDITABLE_HEADERS) + [""] + @body
  end
end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sup-0.0.1 lib/sup/modes/compose-mode.rb
sup-0.0.3 lib/sup/modes/compose-mode.rb
sup-0.0.6 lib/sup/modes/compose-mode.rb
sup-0.0.2 lib/sup/modes/compose-mode.rb
sup-0.0.4 lib/sup/modes/compose-mode.rb
sup-0.0.5 lib/sup/modes/compose-mode.rb