class ERBLint::Utils::BlockMap::ConnectedErbNodes

Attributes

nodes[R]
type[R]

Public Class Methods

new(type, nodes) click to toggle source
# File lib/erb_lint/utils/block_map.rb, line 49
def initialize(type, nodes)
  @type = type
  @nodes = ordered(nodes)
end

Public Instance Methods

&(other) click to toggle source
# File lib/erb_lint/utils/block_map.rb, line 66
def &(other)
  nodes.select { |node| other.include?(node) }
end
concat(other) click to toggle source
# File lib/erb_lint/utils/block_map.rb, line 54
def concat(other)
  @nodes = ordered(@nodes.concat(other.nodes))
end
include?(other) click to toggle source
# File lib/erb_lint/utils/block_map.rb, line 58
def include?(other)
  @nodes.map(&:loc).include?(other.loc)
end
inspect() click to toggle source
# File lib/erb_lint/utils/block_map.rb, line 62
def inspect
  "\#<#{self.class.name} type=#{type.inspect} nodes=#{nodes.inspect}>"
end

Private Instance Methods

ordered(nodes) click to toggle source
# File lib/erb_lint/utils/block_map.rb, line 72
def ordered(nodes)
  nodes
    .uniq(&:loc)
    .sort { |a, b| a.loc.begin_pos <=> b.loc.begin_pos }
end