Class: Repubmark::Elems::Power

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

Instance Attribute Summary

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, base, exponent) ⇒ Power

Returns a new instance of Power.



8
9
10
11
12
13
# File 'lib/repubmark/elems/power.rb', line 8

def initialize(parent, base, exponent)
  super parent

  @base     = Integer base
  @exponent = Integer exponent
end

Instance Method Details

#to_gemtextObject



25
# File 'lib/repubmark/elems/power.rb', line 25

def to_gemtext = "#@base#{unicode_exponent}".freeze

#to_htmlObject



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

def to_html = "#@base<sup>#@exponent</sup>".freeze

#to_summary_plainObject



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

def to_summary_plain = "#@base#{unicode_exponent}".freeze

#unicode_exponentObject (private)



29
30
31
# File 'lib/repubmark/elems/power.rb', line 29

def unicode_exponent
  @unicode_exponent ||= Repubmark.unicode_sup @exponent
end

#word_countObject

Basic methods #



19
# File 'lib/repubmark/elems/power.rb', line 19

def word_count = 1