Class: Card::Content::Chunk::Reference

Inherits:
Abstract show all
Defined in:
mod/content/lib/card/content/chunk/reference.rb

Overview

handle chunks of card content that refer to other cards

Direct Known Subclasses

QueryReference

Instance Attribute Summary collapse

Attributes inherited from Abstract

#process_chunk, #text

Instance Method Summary collapse

Methods inherited from Abstract

#as_json, #burn_after_reading, #burn_read, #card, context_ok?, #format, full_match, full_re, #initialize, #inspect, #interpret, #reference_code, #result, #to_s

Constructor Details

This class inherits a constructor from Card::Content::Chunk::Abstract

Instance Attribute Details

#nameObject

Returns the value of attribute name.



9
10
11
# File 'mod/content/lib/card/content/chunk/reference.rb', line 9

def name
  @name
end

#referee_nameObject



11
12
13
14
15
16
17
18
# File 'mod/content/lib/card/content/chunk/reference.rb', line 11

def referee_name
  return if name.nil?

  @referee_name ||= referee_raw_name
  @referee_name = @referee_name.absolute_name card.name
rescue Card::Error::NotFound
  # do not break on missing id/codename references.
end

Instance Method Details

#referee_cardObject



24
25
26
# File 'mod/content/lib/card/content/chunk/reference.rb', line 24

def referee_card
  @referee_card ||= referee_name && Card.fetch(referee_name)
end

#referee_raw_nameObject



20
21
22
# File 'mod/content/lib/card/content/chunk/reference.rb', line 20

def referee_raw_name
  Name[render_obj(name)]
end