Class: Doublesing::Builtins::Header
- Inherits:
-
Object
- Object
- Doublesing::Builtins::Header
- Defined in:
- lib/doublesing/builtins/header.rb
Instance Method Summary collapse
-
#initialize(a) ⇒ Header
constructor
A new instance of Header.
- #to_s ⇒ Object
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_s ⇒ Object
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 |