Class: Doublesing::Builtins::Header

Inherits:
Object
  • Object
show all
Defined in:
lib/doublesing/builtins/header.rb

Instance Method Summary collapse

Constructor Details

#initialize(a) ⇒ Header

Returns a new instance of Header.



4
5
6
7
# File 'lib/doublesing/builtins/header.rb', line 4

def initialize(a)
  @level = a[0].to_i
  @body = a[1].to_s
end

Instance Method Details

#to_sObject



8
9
10
11
12
13
14
# File 'lib/doublesing/builtins/header.rb', line 8

def to_s
  if @level && @level > 0
    "<h#{@level}>#{@body}</h#{@level}>"
  else
    "<h1>#{@body}</h1>"
  end
end