Class: Inkcite::Renderer::Footnote::Instance

Inherits:
Object
  • Object
show all
Defined in:
lib/inkcite/renderer/footnote.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, symbol, text, active = true) ⇒ Instance

Returns a new instance of Instance.



26
27
28
29
30
31
# File 'lib/inkcite/renderer/footnote.rb', line 26

def initialize id, symbol, text, active=true
  @id = id
  @symbol = symbol.to_s
  @text = text
  @active = active
end

Instance Attribute Details

#activeObject Also known as: active?

True if this footnote is active. By default all footnotes are activate but those read from footnotes.tsv are inactive until referenced in the source.



23
24
25
# File 'lib/inkcite/renderer/footnote.rb', line 23

def active
  @active
end

#idObject (readonly)

Optional, unique ID assigned by the designer for this footnote so that a numeric footnote can be referenced repeatedly, non-linearly throughout the email.



10
11
12
# File 'lib/inkcite/renderer/footnote.rb', line 10

def id
  @id
end

#symbolObject

Symbol associated with the footnote. Typically going to be numeric but could be a user-specified symbol - e.g. †.



14
15
16
# File 'lib/inkcite/renderer/footnote.rb', line 14

def symbol
  @symbol
end

#textObject (readonly)

The message associated with the footnote that will be displayed when the footnotes tag is rendered.



18
19
20
# File 'lib/inkcite/renderer/footnote.rb', line 18

def text
  @text
end

Instance Method Details

#numberObject



33
34
35
# File 'lib/inkcite/renderer/footnote.rb', line 33

def number
  @symbol.to_i
end

#numeric?Boolean

Returns true if this footnote is numeric rather than a symbol - e.g. †

Returns:

  • (Boolean)


39
40
41
# File 'lib/inkcite/renderer/footnote.rb', line 39

def numeric?
  @symbol == @symbol.to_i.to_s
end

#symbol?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/inkcite/renderer/footnote.rb', line 47

def symbol?
  !numeric?
end

#to_sObject



51
52
53
# File 'lib/inkcite/renderer/footnote.rb', line 51

def to_s
  "#{symbol} #{text}"
end