Class: Card::Content::Chunk::Reference
- Defined in:
- mod/core/chunk/reference.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#referee_name ⇒ Object
Returns the value of attribute referee_name.
Attributes inherited from Abstract
Instance Method Summary collapse
- #referee_card ⇒ Object
- #render_obj(raw) ⇒ Object
-
#replace_name_reference(old_name, new_name) ⇒ Object
FIXME: if we need this, then it should be faster, using fetch_id def referee_id referee_card and referee_card.id end.
Methods inherited from Abstract
#as_json, #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
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'mod/core/chunk/reference.rb', line 7 def name @name end |
#referee_name ⇒ Object
Returns the value of attribute referee_name.
7 8 9 |
# File 'mod/core/chunk/reference.rb', line 7 def referee_name @referee_name end |
Instance Method Details
#referee_card ⇒ Object
19 20 21 |
# File 'mod/core/chunk/reference.rb', line 19 def referee_card @referee_card ||= referee_name && Card.fetch(referee_name) end |
#render_obj(raw) ⇒ Object
40 41 42 43 44 45 46 |
# File 'mod/core/chunk/reference.rb', line 40 def render_obj raw if format && raw.is_a?(Card::Content) format.process_content raw else raw end end |
#replace_name_reference(old_name, new_name) ⇒ Object
FIXME: if we need this, then it should be faster, using fetch_id def referee_id referee_card and referee_card.id end
28 29 30 31 32 33 34 35 36 37 38 |
# File 'mod/core/chunk/reference.rb', line 28 def replace_name_reference old_name, new_name @referee_card = nil @referee_name = nil if name.is_a? Card::Content name.find_chunks(Chunk::Reference).each do |chunk| chunk.replace_reference old_name, new_name end else @name = name.to_name.replace(old_name, new_name) end end |