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

- (Object) members (readonly)

Member nodes



13
14
15
# File 'lib/hexp/css_selector.rb', line 13

def members
  @members
end

Class Method Details

+ (Object) included(klass)

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:



29
30
31
32
33
# File 'lib/hexp/css_selector.rb', line 29

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

Instance Method Details

- (Object) initialize(members)

Shared initializer for parse tree nodes with children (members)



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

def initialize(members)
  @members = Hexp.deep_freeze(members)
end

- (String) inspect

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)


40
41
42
# File 'lib/hexp/css_selector.rb', line 40

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