Class: Gloo::Core::Here
- Inherits:
-
Object
- Object
- Gloo::Core::Here
- Defined in:
- lib/gloo/core/here.rb
Constant Summary collapse
- HERE =
'^'.freeze
Class Method Summary collapse
-
.expand_here(engine, pn) ⇒ Object
Expand here reference if present.
-
.includes_here_ref?(elements) ⇒ Boolean
Does the pathname start with here reference?.
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.( 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?
17 18 19 |
# File 'lib/gloo/core/here.rb', line 17 def self.includes_here_ref?( elements ) return elements.first&.start_with?( HERE ) end |