Class: Paru::PandocFilter::Str

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

Overview

A Str node represents a string

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Str

Create a new Str node based on the value

Parameters:

  • value (String)


35
36
37
# File 'lib/paru/filter/str.rb', line 35

def initialize(value)
  @string = value
end

Instance Attribute Details

#stringString

Returns the value of this Str node.

Returns:

  • (String)

    the value of this Str node.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/paru/filter/str.rb', line 29

class Str < Inline
  attr_accessor :string

  # Create a new Str node based on the value
  #
  # @param value [String]
  def initialize(value)
    @string = value
  end

  # The AST contents
  def ast_contents
    @string
  end

  # Has the Str node a string value? Of course!
  #
  # @return [Boolean] true
  def has_string?
    true
  end

  # Has the Str node inline contents?
  #
  # @return [Boolean] false
  def has_inline?
    false
  end
end

Instance Method Details

#ast_contentsObject

The AST contents



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

def ast_contents
  @string
end

#has_inline?Boolean

Has the Str node inline contents?

Returns:

  • (Boolean)

    false



54
55
56
# File 'lib/paru/filter/str.rb', line 54

def has_inline?
  false
end

#has_string?Boolean

Has the Str node a string value? Of course!

Returns:

  • (Boolean)

    true



47
48
49
# File 'lib/paru/filter/str.rb', line 47

def has_string?
  true
end