Class: Leptris::XML::Comment

Inherits:
Node
  • Object
show all
Defined in:
lib/leptris/xml/comment.rb

Instance Attribute Summary

Attributes inherited from Node

#c_ptr, #document

Instance Method Summary collapse

Methods inherited from Node

#<=>, #==, #cdata?, #child, #children, #comment?, #css_path, #dup, #element?, #element_children, #ensure_alive!, #ensure_writable!, #first_element_child, #initialize, #inner_text, #inspect, #last_element_child, #line, #next_element, #next_sibling, #parent, #path, #previous_element, #previous_sibling, #processing_instruction?, #readonly_document?, #text, #text?, #traverse, #type, #unlink, wrap

Methods included from Searchable

#at, #at_css, #at_xpath, #css, #search, wrap_xpath_first_result, wrap_xpath_result, #xpath

Constructor Details

This class inherits a constructor from Leptris::XML::Node

Instance Method Details

#contentObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/leptris/xml/comment.rb', line 6

def content
  return @content if memo_hit?(@content_version)
  ensure_alive!
  result = Leptris::XML::FFI.leptris_comment_node_get_content(@c_ptr)
  if @document
    @content = result
    @content_version = @document.version
  end
  result
end

#content=(new_content) ⇒ Object



17
18
19
20
21
22
# File 'lib/leptris/xml/comment.rb', line 17

def content=(new_content)
  ensure_writable!
  Leptris::XML::FFI.check_status(
    Leptris::XML::FFI.leptris_comment_node_set_content(@c_ptr, new_content.to_s))
  new_content
end

#nameObject



4
# File 'lib/leptris/xml/comment.rb', line 4

def name; "comment"; end