Class: Poppins::ReferenceLink

Inherits:
Object
  • Object
show all
Defined in:
lib/poppins/reference_link.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url = "", link_text = "", label = "") ⇒ ReferenceLink

Returns a new instance of ReferenceLink.



11
12
13
14
15
# File 'lib/poppins/reference_link.rb', line 11

def initialize(url="", link_text="", label="")
  @url = url
  @link_text = link_text
  @label = label
end

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label.



9
10
11
# File 'lib/poppins/reference_link.rb', line 9

def label
  @label
end

#label_regexObject (readonly)

Returns the value of attribute label_regex.



9
10
11
# File 'lib/poppins/reference_link.rb', line 9

def label_regex
  @label_regex
end

Returns the value of attribute link_regex.



9
10
11
# File 'lib/poppins/reference_link.rb', line 9

def link_regex
  @link_regex
end

Returns the value of attribute link_text.



9
10
11
# File 'lib/poppins/reference_link.rb', line 9

def link_text
  @link_text
end

#urlObject (readonly)

Returns the value of attribute url.



9
10
11
# File 'lib/poppins/reference_link.rb', line 9

def url
  @url
end

Class Method Details

.label_regexObject



21
22
23
# File 'lib/poppins/reference_link.rb', line 21

def self.label_regex
  @label_regex
end

.label_regex_with_possible_newlinesObject



25
26
27
# File 'lib/poppins/reference_link.rb', line 25

def self.label_regex_with_possible_newlines
  @label_regex_with_possible_newlines
end


17
18
19
# File 'lib/poppins/reference_link.rb', line 17

def self.link_regex
  @link_regex
end

Instance Method Details

#as_end_referenceObject



29
30
31
# File 'lib/poppins/reference_link.rb', line 29

def as_end_reference
  "[#{@link_text}]: #{@url}"
end

#as_found_in_textObject



33
34
35
# File 'lib/poppins/reference_link.rb', line 33

def as_found_in_text
  "[#{@link_text}]"
end

#to_sObject



37
38
39
# File 'lib/poppins/reference_link.rb', line 37

def to_s
  "[#{@label}]: #{@url}, found for text: #{@link_text}\n"
end