Class: LexM::LemmaRedirect
- Inherits:
-
Object
- Object
- LexM::LemmaRedirect
- Defined in:
- lib/lexm/lemma_redirect.rb
Overview
Represents a redirection to another lemma, with optional relation types
Instance Attribute Summary collapse
-
#target ⇒ Object
Returns the value of attribute target.
-
#types ⇒ Object
Returns the value of attribute types.
Instance Method Summary collapse
-
#initialize(target, types = []) ⇒ LemmaRedirect
constructor
Initialize a new redirection.
-
#to_s ⇒ String
Convert to string representation.
Constructor Details
#initialize(target, types = []) ⇒ LemmaRedirect
Initialize a new redirection
19 20 21 22 |
# File 'lib/lexm/lemma_redirect.rb', line 19 def initialize(target, types = []) @target = target @types = types || [] end |
Instance Attribute Details
#target ⇒ Object
Returns the value of attribute target.
14 15 16 |
# File 'lib/lexm/lemma_redirect.rb', line 14 def target @target end |
#types ⇒ Object
Returns the value of attribute types.
14 15 16 |
# File 'lib/lexm/lemma_redirect.rb', line 14 def types @types end |
Instance Method Details
#to_s ⇒ String
Convert to string representation
26 27 28 29 30 31 32 33 34 |
# File 'lib/lexm/lemma_redirect.rb', line 26 def to_s if @types.empty? ">#{@target}" elsif @types.length == 1 ">(#{@types.first})#{@target}" else ">(#{@types.join(',')})#{@target}" end end |