Class: Html2Bbcode::Html::Element
- Inherits:
-
Object
- Object
- Html2Bbcode::Html::Element
- Extended by:
- Forwardable, Attributes
- Defined in:
- lib/html/element.rb
Instance Attribute Summary collapse
-
#element ⇒ Object
readonly
Returns the value of attribute element.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #build_bbcode_element ⇒ Object
- #font_color ⇒ Object
- #font_size ⇒ Object
-
#initialize(element, options = {}) ⇒ Element
constructor
A new instance of Element.
- #process ⇒ Object
- #to_bbcode_element ⇒ Object
Methods included from Attributes
Constructor Details
#initialize(element, options = {}) ⇒ Element
Returns a new instance of Element.
9 10 11 12 13 14 |
# File 'lib/html/element.rb', line 9 def initialize element, = {} @element = element @options = add_src_to_text if name.eql? 'img' end |
Instance Attribute Details
#element ⇒ Object (readonly)
Returns the value of attribute element.
16 17 18 |
# File 'lib/html/element.rb', line 16 def element @element end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
16 17 18 |
# File 'lib/html/element.rb', line 16 def @options end |
Instance Method Details
#build_bbcode_element ⇒ Object
36 37 38 |
# File 'lib/html/element.rb', line 36 def build_bbcode_element + bbcode_content + end |
#font_color ⇒ Object
40 41 42 |
# File 'lib/html/element.rb', line 40 def font_color element_color.get end |
#font_size ⇒ Object
44 45 46 |
# File 'lib/html/element.rb', line 44 def font_size get_size.to_i if get_font_size end |
#process ⇒ Object
22 23 24 |
# File 'lib/html/element.rb', line 22 def process children.map(&:to_bbcode_element).join end |
#to_bbcode_element ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/html/element.rb', line 26 def to_bbcode_element if name == 'br' "\n" elsif element? build_bbcode_element elsif text? text end end |