Class: ExpressTemplates::Markup::Yielder

Inherits:
Object
  • Object
show all
Defined in:
lib/express_templates/markup/yielder.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Yielder

Returns a new instance of Yielder.



4
5
6
# File 'lib/express_templates/markup/yielder.rb', line 4

def initialize(*args)
  @arg = args.first
end

Instance Method Details

#compileObject



8
9
10
11
12
13
14
# File 'lib/express_templates/markup/yielder.rb', line 8

def compile
  if @arg
    "yield(#{@arg.inspect})" # usually a symbol but may be string
  else
    "yield"
  end
end

#to_templateObject



16
17
18
# File 'lib/express_templates/markup/yielder.rb', line 16

def to_template
  compile
end