Class: Web::Narflates::Foreach

Inherits:
Object
  • Object
show all
Defined in:
lib/web/template.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(array, itemname, contents) ⇒ Foreach

Returns a new instance of Foreach.



238
239
240
241
242
# File 'lib/web/template.rb', line 238

def initialize (array,itemname,contents)
	@array = array
	@itemname = itemname
	@contents = contents
end

Instance Attribute Details

#arrayObject (readonly)

Returns the value of attribute array.



237
238
239
# File 'lib/web/template.rb', line 237

def array
  @array
end

#contentsObject (readonly)

Returns the value of attribute contents.



237
238
239
# File 'lib/web/template.rb', line 237

def contents
  @contents
end

#itemnameObject (readonly)

Returns the value of attribute itemname.



237
238
239
# File 'lib/web/template.rb', line 237

def itemname
  @itemname
end

Instance Method Details



244
245
246
247
248
249
250
# File 'lib/web/template.rb', line 244

def print (globals,io) 
	globals.resolve(array,@itemname).each { |item|
	  contents.each { |i|
	    i.print(item,io)
	  }
	}
end