Class: ERBLint::Utils::BlockMap::ConnectedErbNodes
- Inherits:
-
Object
- Object
- ERBLint::Utils::BlockMap::ConnectedErbNodes
- Defined in:
- lib/erb_lint/utils/block_map.rb
Instance Attribute Summary collapse
-
#nodes ⇒ Object
readonly
Returns the value of attribute nodes.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #&(other) ⇒ Object
- #concat(other) ⇒ Object
- #include?(other) ⇒ Boolean
-
#initialize(type, nodes) ⇒ ConnectedErbNodes
constructor
A new instance of ConnectedErbNodes.
- #inspect ⇒ Object
Constructor Details
#initialize(type, nodes) ⇒ ConnectedErbNodes
Returns a new instance of ConnectedErbNodes.
49 50 51 52 |
# File 'lib/erb_lint/utils/block_map.rb', line 49 def initialize(type, nodes) @type = type @nodes = ordered(nodes) end |
Instance Attribute Details
#nodes ⇒ Object (readonly)
Returns the value of attribute nodes.
47 48 49 |
# File 'lib/erb_lint/utils/block_map.rb', line 47 def nodes @nodes end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
47 48 49 |
# File 'lib/erb_lint/utils/block_map.rb', line 47 def type @type end |
Instance Method Details
#&(other) ⇒ Object
66 67 68 |
# File 'lib/erb_lint/utils/block_map.rb', line 66 def &(other) nodes.select { |node| other.include?(node) } end |
#concat(other) ⇒ Object
54 55 56 |
# File 'lib/erb_lint/utils/block_map.rb', line 54 def concat(other) @nodes = ordered(@nodes.concat(other.nodes)) end |
#include?(other) ⇒ Boolean
58 59 60 |
# File 'lib/erb_lint/utils/block_map.rb', line 58 def include?(other) @nodes.map(&:loc).include?(other.loc) end |
#inspect ⇒ Object
62 63 64 |
# File 'lib/erb_lint/utils/block_map.rb', line 62 def inspect "#<#{self.class.name} type=#{type.inspect} nodes=#{nodes.inspect}>" end |