Class: Artichoke::Message

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

Instance Method Summary collapse

Constructor Details

#initialize(message) ⇒ Message

Returns a new instance of Message.



4
5
6
# File 'lib/artichoke/message.rb', line 4

def initialize(message)
  @message = message
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block) ⇒ Object (private)

Delegate all other methods to the Gmail message



18
19
20
21
22
23
24
# File 'lib/artichoke/message.rb', line 18

def method_missing(*args, &block)
  if block_given?
    @message.send(*args, &block)
  else
    @message.send(*args)
  end
end

Instance Method Details

#attachment_nameObject



8
9
10
# File 'lib/artichoke/message.rb', line 8

def attachment_name
  attachments.first.filename
end

#message_contentObject



12
13
14
# File 'lib/artichoke/message.rb', line 12

def message_content
  text_part.try(:decoded) || html_part.try(:decoded) || body.decoded
end