Class: Gloo::Core::Here

Inherits:
Object
  • Object
show all
Defined in:
lib/gloo/core/here.rb

Constant Summary collapse

HERE =
'^'.freeze

Class Method Summary collapse

Class Method Details

.expand_here(engine, pn) ⇒ Object

Expand here reference if present.



24
25
26
27
28
29
30
31
32
# File 'lib/gloo/core/here.rb', line 24

def self.expand_here( engine, pn )
  target = engine.exec_env.here_obj

  here = pn.elements.first
  remainder = pn.elements[ 1..-1 ].join( '.' )

  here.length.times { target = target.parent }
  pn.set_to "#{target.pn}.#{remainder}"
end

.includes_here_ref?(elements) ⇒ Boolean

Does the pathname start with here reference?

Returns:

  • (Boolean)


17
18
19
# File 'lib/gloo/core/here.rb', line 17

def self.includes_here_ref?( elements )
  return elements.first&.start_with?( HERE )
end