Class: LazyGraph::PathParser::PathPart

Inherits:
Struct
  • Object
show all
Defined in:
lib/lazy_graph/path_parser/path_part.rb

Overview

Represents a single part of a path.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#partObject

Returns the value of attribute part

Returns:

  • (Object)

    the current value of part


7
8
9
# File 'lib/lazy_graph/path_parser/path_part.rb', line 7

def part
  @part
end

Instance Method Details

#==(other) ⇒ Object


12
13
14
15
16
17
18
# File 'lib/lazy_graph/path_parser/path_part.rb', line 12

def ==(other)
  return part == other.to_sym if other.is_a?(String)
  return part == other if other.is_a?(Symbol)
  return part == other if other.is_a?(Array)

  super
end

#index?Boolean

Returns:

  • (Boolean)

8
9
10
# File 'lib/lazy_graph/path_parser/path_part.rb', line 8

def index?
  @index ||= part =~ INDEX_REGEXP
end