Class: Bbcode::HandlerElement

Inherits:
Object
  • Object
show all
Defined in:
lib/bbcode/handler_element.rb

Overview

Private data source for an Element updated by the Handler

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(handler, tagname, attributes, start_source) ⇒ HandlerElement

Returns a new instance of HandlerElement.



9
10
11
12
13
14
15
16
17
# File 'lib/bbcode/handler_element.rb', line 9

def initialize( handler, tagname, attributes, start_source )
  @handler = handler
  @tagname = tagname
  @attributes = attributes
  @start_source = start_source
  @end_source = nil
  @childs = []
  @element = Element.new(self)
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



7
8
9
# File 'lib/bbcode/handler_element.rb', line 7

def attributes
  @attributes
end

#childsObject

Returns the value of attribute childs.



6
7
8
# File 'lib/bbcode/handler_element.rb', line 6

def childs
  @childs
end

#elementObject (readonly)

Returns the value of attribute element.



7
8
9
# File 'lib/bbcode/handler_element.rb', line 7

def element
  @element
end

#end_sourceObject (readonly)

Returns the value of attribute end_source.



7
8
9
# File 'lib/bbcode/handler_element.rb', line 7

def end_source
  @end_source
end

#handlerObject (readonly)

Returns the value of attribute handler.



7
8
9
# File 'lib/bbcode/handler_element.rb', line 7

def handler
  @handler
end

#start_sourceObject (readonly)

Returns the value of attribute start_source.



7
8
9
# File 'lib/bbcode/handler_element.rb', line 7

def start_source
  @start_source
end

#tagnameObject (readonly)

Returns the value of attribute tagname.



7
8
9
# File 'lib/bbcode/handler_element.rb', line 7

def tagname
  @tagname
end

Instance Method Details

#end_element(source) ⇒ Object



19
20
21
# File 'lib/bbcode/handler_element.rb', line 19

def end_element( source )
  @end_source = source
end

#sourceObject



23
24
25
# File 'lib/bbcode/handler_element.rb', line 23

def source
  "#{@start_source}#{@element.content.source}#{@end_source}"
end