Class: HS::Code
Instance Attribute Summary collapse
-
#lang ⇒ Object
Returns the value of attribute lang.
Attributes inherited from Element
#children, #class_name, #style
Instance Method Summary collapse
Methods inherited from Element
Methods included from ElementPreview
#element_preview, #text_preview
Constructor Details
This class inherits a constructor from HS::Element
Instance Attribute Details
#lang ⇒ Object
Returns the value of attribute lang.
5 6 7 |
# File 'lib/hs/elements/code.rb', line 5 def lang @lang end |
Instance Method Details
#inline? ⇒ Boolean
7 8 9 |
# File 'lib/hs/elements/code.rb', line 7 def inline? lang.nil? end |
#params ⇒ Object
15 16 17 18 19 20 |
# File 'lib/hs/elements/code.rb', line 15 def params params = super return params if inline? params.merge(lang: lang) end |
#tag_name ⇒ Object
11 12 13 |
# File 'lib/hs/elements/code.rb', line 11 def tag_name inline? ? 'code' : 'pre' end |