Class: LLT::Token::Punctuation

Inherits:
LLT::Token show all
Includes:
XmlEscape
Defined in:
lib/llt/token/punctuation.rb

Instance Attribute Summary collapse

Attributes inherited from LLT::Token

#functions, #special_roles

Instance Method Summary collapse

Methods inherited from LLT::Token

#==, #add_form, #add_forms, #has_special_role?, #set_special_role, #use

Constructor Details

#initialize(string, id = nil) ⇒ Punctuation

Returns a new instance of Punctuation.



12
13
14
15
16
17
18
19
20
# File 'lib/llt/token/punctuation.rb', line 12

def initialize(string, id = nil)
  super
  # this is part of an old interface that is mostly unused
  # some parts remain - find and delete em
  @string = xml_decode(string)
  @opening = false
  @closing = false
  @other   = false
end

Instance Attribute Details

#closingObject

Returns the value of attribute closing.



10
11
12
# File 'lib/llt/token/punctuation.rb', line 10

def closing
  @closing
end

#openingObject

Returns the value of attribute opening.



10
11
12
# File 'lib/llt/token/punctuation.rb', line 10

def opening
  @opening
end

#otherObject

Returns the value of attribute other.



10
11
12
# File 'lib/llt/token/punctuation.rb', line 10

def other
  @other
end

Instance Method Details

#as_xmlObject



40
41
42
# File 'lib/llt/token/punctuation.rb', line 40

def as_xml
  xml_encode(@string)
end

#empty?Boolean Also known as: no_forms?

cannot hold anything atm, is therefore never really empty

Returns:

  • (Boolean)


23
24
25
# File 'lib/llt/token/punctuation.rb', line 23

def empty?
  false
end

#inspectObject



36
37
38
# File 'lib/llt/token/punctuation.rb', line 36

def inspect
  "#{"Punctuation token:".yellow} #{@string}"
end

#punctuationObject



32
33
34
# File 'lib/llt/token/punctuation.rb', line 32

def punctuation
  @string
end

#set_functionsObject



28
29
30
# File 'lib/llt/token/punctuation.rb', line 28

def set_functions
  [:punctuation]
end