Class: General::GInclude

Inherits:
GPrePartial show all
Defined in:
lib/gprepartials/ginclude.rb

Overview

Created: 1 - 30 - 2017

Constant Summary collapse

REGEX =

Regular expression matches GInclude

/\A@@include\s+(?<filename>\w+(\/\w+)*?)\r?\n/

Instance Method Summary collapse

Methods inherited from GPrePartial

#to_s

Constructor Details

#initialize(match) ⇒ GInclude

Creates a new GInclude

Parameters: match - the match result returned from the parser



37
38
39
40
# File 'lib/gprepartials/ginclude.rb', line 37

def initialize(match)
	super
	@filename = match[:filename]
end

Instance Method Details

#applyObject

Applies the GInclude

Return: the value returned from the executed GInclude



45
# File 'lib/gprepartials/ginclude.rb', line 45

def apply; IO.read(@filename+General::GIO::EXTENSION) + "\r\n"; end