Class: Poppins::ReferenceLink
- Inherits:
-
Object
- Object
- Poppins::ReferenceLink
- Defined in:
- lib/poppins/reference_link.rb
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#label_regex ⇒ Object
readonly
Returns the value of attribute label_regex.
-
#link_regex ⇒ Object
readonly
Returns the value of attribute link_regex.
-
#link_text ⇒ Object
readonly
Returns the value of attribute link_text.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #as_end_reference ⇒ Object
- #as_found_in_text ⇒ Object
-
#initialize(url = "", link_text = "", label = "") ⇒ ReferenceLink
constructor
A new instance of ReferenceLink.
- #to_s ⇒ Object
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
#label ⇒ Object (readonly)
Returns the value of attribute label.
9 10 11 |
# File 'lib/poppins/reference_link.rb', line 9 def label @label end |
#label_regex ⇒ Object (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 |
#link_regex ⇒ Object (readonly)
Returns the value of attribute link_regex.
9 10 11 |
# File 'lib/poppins/reference_link.rb', line 9 def link_regex @link_regex end |
#link_text ⇒ Object (readonly)
Returns the value of attribute link_text.
9 10 11 |
# File 'lib/poppins/reference_link.rb', line 9 def link_text @link_text end |
#url ⇒ Object (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_regex ⇒ Object
21 22 23 |
# File 'lib/poppins/reference_link.rb', line 21 def self.label_regex @label_regex end |
.label_regex_with_possible_newlines ⇒ Object
25 26 27 |
# File 'lib/poppins/reference_link.rb', line 25 def self.label_regex_with_possible_newlines @label_regex_with_possible_newlines end |
.link_regex ⇒ Object
17 18 19 |
# File 'lib/poppins/reference_link.rb', line 17 def self.link_regex @link_regex end |
Instance Method Details
#as_end_reference ⇒ Object
29 30 31 |
# File 'lib/poppins/reference_link.rb', line 29 def as_end_reference "[#{@link_text}]: #{@url}" end |
#as_found_in_text ⇒ Object
33 34 35 |
# File 'lib/poppins/reference_link.rb', line 33 def as_found_in_text "[#{@link_text}]" end |
#to_s ⇒ Object
37 38 39 |
# File 'lib/poppins/reference_link.rb', line 37 def to_s "[#{@label}]: #{@url}, found for text: #{@link_text}\n" end |