Class: Paru::PandocFilter::Target

Inherits:
Object
  • Object
show all
Defined in:
lib/paru/filter/target.rb

Overview

A Target represents the target of a link or image

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(contents) ⇒ Target

Create a new Target based on the contents

Parameters:

  • contents (Array)


36
37
38
39
# File 'lib/paru/filter/target.rb', line 36

def initialize(contents)
  @url = contents[0]
  @title = contents[1]
end

Instance Attribute Details

#titleString

Returns the title of the target.

Returns:

  • (String)

    the title of the target



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

class Target
  attr_accessor :url, :title

  # Create a new Target based on the contents
  #
  # @param contents [Array]
  def initialize(contents)
    @url = contents[0]
    @title = contents[1]
  end

  # Create an AST representation of this Target
  #
  # @return [Array]
  def to_ast
    [
      @url,
      @title
    ]
  end
end

#urlString

Returns the target.

Returns:

  • (String)

    the target



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

class Target
  attr_accessor :url, :title

  # Create a new Target based on the contents
  #
  # @param contents [Array]
  def initialize(contents)
    @url = contents[0]
    @title = contents[1]
  end

  # Create an AST representation of this Target
  #
  # @return [Array]
  def to_ast
    [
      @url,
      @title
    ]
  end
end

Instance Method Details

#to_astArray

Create an AST representation of this Target

Returns:

  • (Array)


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

def to_ast
  [
    @url,
    @title
  ]
end