Class: Aozora2Html::StyleStack

Inherits:
Object
  • Object
show all
Defined in:
lib/aozora2html/style_stack.rb

Overview

スタイルの状態管理用スタック

スタイルの入れ子を扱えるようにスタック構造になっている。各要素は‘[コマンド文字列, 閉じる際に使うHTML文字列]`という2要素の配列になっている。

Instance Method Summary collapse

Constructor Details

#initializeStyleStack

Returns a new instance of StyleStack.



9
10
11
# File 'lib/aozora2html/style_stack.rb', line 9

def initialize
  @stack = []
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/aozora2html/style_stack.rb', line 17

def empty?
  @stack.empty?
end

#lastObject



25
26
27
# File 'lib/aozora2html/style_stack.rb', line 25

def last
  @stack.last
end

#last_commandObject



29
30
31
# File 'lib/aozora2html/style_stack.rb', line 29

def last_command
  @stack.last[0]
end

#popObject



21
22
23
# File 'lib/aozora2html/style_stack.rb', line 21

def pop
  @stack.pop
end

#push(elem) ⇒ Object



13
14
15
# File 'lib/aozora2html/style_stack.rb', line 13

def push(elem)
  @stack.push(elem)
end