Module: Hexp::CssSelector::Named

Included in:
Class, Element, Id
Defined in:
lib/hexp/css_selector.rb

Overview

Common behavior for parse tree elements that have a name

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameString (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The name of this element

Returns:

  • (String)


60
61
62
# File 'lib/hexp/css_selector.rb', line 60

def name
  @name
end

Instance Method Details

#initialize(name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Shared constructor that sets a name

Parameters:

  • name (String)

    the name of the element



68
69
70
# File 'lib/hexp/css_selector.rb', line 68

def initialize(name)
  @name = name.freeze
end

#inspectString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return a representation convenient for debugging

Returns:

  • (String)


77
78
79
# File 'lib/hexp/css_selector.rb', line 77

def inspect
  "<#{self.class.name.split('::').last} name=#{name}>"
end