Class: Repubmark::Elems::Abbrev

Inherits:
Base
  • Object
show all
Defined in:
lib/repubmark/elems/abbrev.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#parent

Instance Method Summary collapse

Methods inherited from Base

#absolute_url, #config, #count_words, #html_class, #own_url, parent?, parents, #relative_url

Constructor Details

#initialize(parent, abbrev, transcript) ⇒ Abbrev

Returns a new instance of Abbrev.



10
11
12
13
14
15
# File 'lib/repubmark/elems/abbrev.rb', line 10

def initialize(parent, abbrev, transcript)
  super parent

  self.abbrev = abbrev
  self.transcript = transcript
end

Instance Attribute Details

#abbrevObject

Returns the value of attribute abbrev.



8
9
10
# File 'lib/repubmark/elems/abbrev.rb', line 8

def abbrev
  @abbrev
end

#transcriptObject

Returns the value of attribute transcript.



8
9
10
# File 'lib/repubmark/elems/abbrev.rb', line 8

def transcript
  @transcript
end

Instance Method Details

#escape_abbrevObject (private)



47
# File 'lib/repubmark/elems/abbrev.rb', line 47

def escape_abbrev = CGI.escape_html(abbrev).freeze

#escape_transcriptObject (private)



49
# File 'lib/repubmark/elems/abbrev.rb', line 49

def escape_transcript = CGI.escape_html(transcript).freeze

#to_gemtextObject



29
# File 'lib/repubmark/elems/abbrev.rb', line 29

def to_gemtext = abbrev

#to_htmlObject



25
26
27
# File 'lib/repubmark/elems/abbrev.rb', line 25

def to_html
  %(<abbr title="#{escape_transcript}">#{escape_abbrev}</abbr>).freeze
end

#to_summary_plainObject



23
# File 'lib/repubmark/elems/abbrev.rb', line 23

def to_summary_plain = abbrev

#word_countObject

Basic methods #



21
# File 'lib/repubmark/elems/abbrev.rb', line 21

def word_count = 1