Class: Aozora2Html::Tag::ReferenceMentioned
- Inherits:
-
Inline
- Object
- Aozora2Html::Tag
- Inline
- Aozora2Html::Tag::ReferenceMentioned
- Defined in:
- lib/aozora2html/tag/reference_mentioned.rb
Overview
参照先用
前方参照でこいつだけは中身をチェックする子要素を持つAozora2Html::Tag::Inlineは全てこいつのサブクラス
Direct Known Subclasses
Decorate, Dir, InlineCaption, InlineFontSize, InlineKeigakomi, InlineYokogumi, Midashi, Ruby
Instance Attribute Summary collapse
-
#target ⇒ Object
Returns the value of attribute target.
Instance Method Summary collapse
- #block_element?(elt) ⇒ Boolean
-
#initialize(*_args) ⇒ ReferenceMentioned
constructor
rubocop:disable Lint/MissingSuper.
- #target_string ⇒ Object
Methods inherited from Aozora2Html::Tag
#char_type, #inspect, #syntax_error
Constructor Details
#initialize(*_args) ⇒ ReferenceMentioned
rubocop:disable Lint/MissingSuper
12 13 14 15 16 |
# File 'lib/aozora2html/tag/reference_mentioned.rb', line 12 def initialize(*_args) # rubocop:disable Lint/MissingSuper return unless defined?(@target) && block_element?(@target) syntax_error end |
Instance Attribute Details
#target ⇒ Object
Returns the value of attribute target.
10 11 12 |
# File 'lib/aozora2html/tag/reference_mentioned.rb', line 10 def target @target end |
Instance Method Details
#block_element?(elt) ⇒ Boolean
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/aozora2html/tag/reference_mentioned.rb', line 18 def block_element?(elt) case elt when Array elt.any? { |x| block_element?(x) } when String elt.include?('<div') else elt.is_a?(Aozora2Html::Tag::Block) end end |
#target_string ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/aozora2html/tag/reference_mentioned.rb', line 29 def target_string case @target when Aozora2Html::Tag::ReferenceMentioned @target.target_string when Array @target.collect do |x| if x.is_a?(Aozora2Html::Tag::ReferenceMentioned) x.target_string else x end end.join else @target end end |