Class: LexM::Sublemma
- Inherits:
-
Object
- Object
- LexM::Sublemma
- Defined in:
- lib/lexm/sublemma.rb
Overview
Represents a sublemma, which can be either a textual sublemma or a redirection
Instance Attribute Summary collapse
-
#redirect ⇒ Object
Returns the value of attribute redirect.
-
#source_column ⇒ Object
Source location information.
-
#source_file ⇒ Object
Source location information.
-
#source_line ⇒ Object
Source location information.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(text = nil, redirect = nil, source_file = nil, source_line = nil, source_column = nil) ⇒ Sublemma
constructor
Initialize a new sublemma.
-
#redirected? ⇒ Boolean
Is this a pure redirection sublemma?.
-
#to_s ⇒ String
Convert to string representation.
Constructor Details
#initialize(text = nil, redirect = nil, source_file = nil, source_line = nil, source_column = nil) ⇒ Sublemma
Initialize a new sublemma
24 25 26 27 28 29 30 |
# File 'lib/lexm/sublemma.rb', line 24 def initialize(text = nil, redirect = nil, source_file = nil, source_line = nil, source_column = nil) @text = text @redirect = redirect @source_file = source_file @source_line = source_line @source_column = source_column end |
Instance Attribute Details
#redirect ⇒ Object
Returns the value of attribute redirect.
14 15 16 |
# File 'lib/lexm/sublemma.rb', line 14 def redirect @redirect end |
#source_column ⇒ Object
Source location information
16 17 18 |
# File 'lib/lexm/sublemma.rb', line 16 def source_column @source_column end |
#source_file ⇒ Object
Source location information
16 17 18 |
# File 'lib/lexm/sublemma.rb', line 16 def source_file @source_file end |
#source_line ⇒ Object
Source location information
16 17 18 |
# File 'lib/lexm/sublemma.rb', line 16 def source_line @source_line end |
#text ⇒ Object
Returns the value of attribute text.
14 15 16 |
# File 'lib/lexm/sublemma.rb', line 14 def text @text end |
Instance Method Details
#redirected? ⇒ Boolean
Is this a pure redirection sublemma?
34 35 36 |
# File 'lib/lexm/sublemma.rb', line 34 def redirected? @text.nil? && !@redirect.nil? end |
#to_s ⇒ String
Convert to string representation
40 41 42 43 44 45 46 |
# File 'lib/lexm/sublemma.rb', line 40 def to_s if redirected? @redirect.to_s else @text end end |