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)


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

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



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

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



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

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)


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

def to_ast()
    [
        @url,
        @title
    ]
end