Class: Paru::PandocFilter::Quoted

Inherits:
Inline show all
Defined in:
lib/paru/filter/quoted.rb

Overview

A Quoted node represents a quote with a type and the contents of the quote

Constant Summary collapse

QUOTE_TYPE =

A quote is either a single quote or a double quote

%w[SingleQuote DoubleQuote].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(contents) ⇒ Quoted

Create a new Quote node based on the contents

Parameters:

  • contents (Array)


39
40
41
42
# File 'lib/paru/filter/quoted.rb', line 39

def initialize(contents)
  @quote_type = contents[0]
  super(contents[1])
end

Instance Attribute Details

#quote_typeQUOTE_TYPE

Returns:



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/paru/filter/quoted.rb', line 30

class Quoted < Inline
  # A quote is either a single quote or a double quote
  QUOTE_TYPE = %w[SingleQuote DoubleQuote].freeze

  attr_accessor :quote_type

  # Create a new Quote node based on the contents
  #
  # @param contents [Array]
  def initialize(contents)
    @quote_type = contents[0]
    super(contents[1])
  end

  # The AST contents of a Quote node
  def ast_contents
    [
      @quote_type,
      super
    ]
  end
end

Instance Method Details

#ast_contentsObject

The AST contents of a Quote node



45
46
47
48
49
50
# File 'lib/paru/filter/quoted.rb', line 45

def ast_contents
  [
    @quote_type,
    super
  ]
end