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
- #referee_name_from_rendered(rendered_name) ⇒ Object
- #render_obj(raw) ⇒ Object
- #replace_name_reference(old_name, new_name) ⇒ Object
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
22 23 24 |
# File 'mod/core/chunk/reference.rb', line 22 def referee_card @referee_card ||= referee_name && Card.fetch(referee_name) end |
#referee_name_from_rendered(rendered_name) ⇒ Object
17 18 19 20 |
# File 'mod/core/chunk/reference.rb', line 17 def referee_name_from_rendered rendered_name ref_card = fetch_referee_card rendered_name ref_card ? ref_card.name : rendered_name.to_name end |
#render_obj(raw) ⇒ Object
38 39 40 41 42 43 44 |
# File 'mod/core/chunk/reference.rb', line 38 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
26 27 28 29 30 31 32 33 34 35 36 |
# File 'mod/core/chunk/reference.rb', line 26 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.swap old_name, new_name end end |