Module: Card::Env::Success::Target

Included in:
Card::Env::Success
Defined in:
card/lib/card/env/success/target.rb

Overview

The success “target” is the destination upon success.

@card, @name, @id, etc all refer to the target card

Instance Method Summary collapse

Instance Method Details

#card(name_context = @name_context) ⇒ Object



46
47
48
49
50
51
52
53
54
# File 'card/lib/card/env/success/target.rb', line 46

def card name_context=@name_context
  if @card
    @card
  elsif @id
    Card.fetch @id
  elsif @name
    Card.fetch @name.to_name.absolute(name_context), new: @new_args
  end
end

#content=(content) ⇒ Object



42
43
44
# File 'card/lib/card/env/success/target.rb', line 42

def content= content
  @new_args[:content] = content
end

#id=(id) ⇒ Object

Deprecated.


28
29
30
31
32
# File 'card/lib/card/env/success/target.rb', line 28

def id= id
  # for backwards compatibility use mark here.
  # id was often used for the card name
  self.mark = id
end

#mark=(value) ⇒ Object

TODO: refactor to use cardish



18
19
20
21
22
23
24
25
# File 'card/lib/card/env/success/target.rb', line 18

def mark= value
  case value
  when Integer then @id = value
  when Card then @card = value
  else
    self.target = value
  end
end

#target(name_context = @name_context) ⇒ Object



13
14
15
# File 'card/lib/card/env/success/target.rb', line 13

def target name_context=@name_context
  card(name_context) || @target || Card.fetch(name_context)
end

#target=(value) ⇒ Object



8
9
10
11
# File 'card/lib/card/env/success/target.rb', line 8

def target= value
  @id = @name = @card = nil
  @target = process_target value
end

#type=(type) ⇒ Object



34
35
36
# File 'card/lib/card/env/success/target.rb', line 34

def type= type
  @new_args[:type] = type
end

#type_id=(type_id) ⇒ Object



38
39
40
# File 'card/lib/card/env/success/target.rb', line 38

def type_id= type_id
  @new_args[:type_id] = type_id.to_i
end