35 lines
667 B
Ruby
35 lines
667 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Repubmark
|
|
module Elems
|
|
class Power < Base
|
|
parents :Joint
|
|
|
|
def initialize(parent, base, exponent)
|
|
super parent
|
|
|
|
@base = Integer base
|
|
@exponent = Integer exponent
|
|
end
|
|
|
|
#################
|
|
# Basic methods #
|
|
#################
|
|
|
|
def word_count = 1
|
|
|
|
def to_summary_plain = "#@base#{unicode_exponent}".freeze
|
|
|
|
def to_html = "#@base<sup>#@exponent</sup>".freeze
|
|
|
|
def to_gemtext = "#@base#{unicode_exponent}".freeze
|
|
|
|
private
|
|
|
|
def unicode_exponent
|
|
@unicode_exponent ||= Repubmark.unicode_sup @exponent
|
|
end
|
|
end
|
|
end
|
|
end
|