Class: FactoryScenarios::Mail::Preview

Inherits:
Object
  • Object
show all
Defined in:
lib/factory_scenarios/mail/preview.rb

Instance Method Summary collapse

Instance Method Details

#login_as(&block) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/factory_scenarios/mail/preview.rb', line 10

def (&block)
  if block_given?
    @login_as = block
  elsif @login_as
    @login_as.call *self.message_args
  end
end

#mailer(mailer = nil) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/factory_scenarios/mail/preview.rb', line 26

def mailer(mailer=nil)
  if mailer
    @mailer = mailer
  else
    @mailer
  end
end

#mailer_messageObject



2
3
4
# File 'lib/factory_scenarios/mail/preview.rb', line 2

def mailer_message
  mailer.send(message, *self.message_args)
end

#message(message = nil) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/factory_scenarios/mail/preview.rb', line 34

def message(message=nil)
  if message
    @message = message
  else
    @message
  end
end

#message_args(&block) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/factory_scenarios/mail/preview.rb', line 42

def message_args(&block)
  if block_given?
    @message_args = block
  else
    @_args ||= @message_args.call
  end
end

#name(name = nil) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/factory_scenarios/mail/preview.rb', line 18

def name(name=nil)
  if name
    @name = name
  else
    @name
  end
end

#renderObject



6
7
8
# File 'lib/factory_scenarios/mail/preview.rb', line 6

def render
  message
end