Class: General::GFullPlaceholder

Inherits:
GPartial
  • Object
show all
Defined in:
lib/gpartials/gfullplaceholder.rb

Overview

Created: 1 - 19 - 2016

Constant Summary collapse

REGEX =

Matches GFullPlaceholders

/@#/
STRING =

String representation of GFullPlaceholder

"@#"

Instance Attribute Summary

Attributes inherited from GPartial

#name

Instance Method Summary collapse

Constructor Details

#initialize(match, defaults = {}) ⇒ GFullPlaceholder

Initializes the GFullPlaceholder with the given match

Parameter: match - the match data from the string being parsed Parameter: defaults - the hash of default data from the GTemplate



40
# File 'lib/gpartials/gfullplaceholder.rb', line 40

def initialize(match, defaults={}); super({name: :__full}, defaults); end

Instance Method Details

#apply(data) ⇒ Object

Returns a string representation of the given data

Parameter: data - the data being applied

Returns: a string representation of the given data



47
# File 'lib/gpartials/gfullplaceholder.rb', line 47

def apply(data); data.to_s; end

#regex(first = false) ⇒ Object

Raises TypeError

Parameter: first - true if this is the first in a given template

Raises: TypeError

Raises:

  • (TypeError)


61
# File 'lib/gpartials/gfullplaceholder.rb', line 61

def regex(first=false); raise TypeError.new("GFullPlaceholder cannot be matched"); end

#string(first = false) ⇒ Object

Returns a string representation of the GFullPlaceholder

Parameter: first - true if this is the first in a given template

Returns: a string representation of the GFullPlaceholder



54
# File 'lib/gpartials/gfullplaceholder.rb', line 54

def string(first=false); STRING; end