Module: Tengine::Job::NamePath

Included in:
Vertex
Defined in:
lib/tengine/job/name_path.rb

Constant Summary collapse

SEPARATOR =
'/'.freeze
ABSOLUTE_PATH_REGEXP =
/^\//.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.absolute?(name_path) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/tengine/job/name_path.rb', line 9

def absolute?(name_path)
  ABSOLUTE_PATH_REGEXP =~ name_path
end

Instance Method Details

#name_pathObject



14
15
16
17
18
# File 'lib/tengine/job/name_path.rb', line 14

def name_path
  name = respond_to?(:name) ? self.name : self.class.name.split('::').last.underscore
  parent ? "#{parent.name_path}#{SEPARATOR}#{name}" :
    "#{SEPARATOR}#{name}"
end

#name_path_until_expansionObject



20
21
22
23
24
25
26
27
28
# File 'lib/tengine/job/name_path.rb', line 20

def name_path_until_expansion
  name = respond_to?(:name) ? self.name : self.class.name.split('::').last.underscore
  if self.respond_to?(:was_expansion) && self.was_expansion
    "#{SEPARATOR}#{name}"
  else
    parent ? "#{parent.name_path_until_expansion}#{SEPARATOR}#{name}" :
      "#{SEPARATOR}#{name}"
  end
end