Module: Hexp::CssSelector::Members

Extended by:
Forwardable
Included in:
CommaSequence, Sequence, SimpleSequence
Defined in:
lib/hexp/css_selector.rb

Overview

Common behavior for parse tree nodes based on a list of members

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#membersArray (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.

Member nodes

Returns:

  • (Array)


16
17
18
# File 'lib/hexp/css_selector.rb', line 16

def members
  @members
end

Class Method Details

.included(klass) ⇒ 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.

Create a class level collection constructor

Examples:

CommaSequence[member1, member2]

Parameters:



33
34
35
36
37
38
# File 'lib/hexp/css_selector.rb', line 33

def self.included(klass)
  super
  def klass.[](*members)
    new(members)
  end
end

Instance Method Details

#initialize(members) ⇒ 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 initializer for parse tree nodes with children (members)



21
22
23
# File 'lib/hexp/css_selector.rb', line 21

def initialize(members)
  @members = members
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 debugging representation

Returns:

  • (String)


45
46
47
# File 'lib/hexp/css_selector.rb', line 45

def inspect
  "#{self.class.name.split('::').last}[#{self.members.map(&:inspect).join(', ')}]"
end