Class: PixxxerTemplate

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

Instance Method Summary collapse

Constructor Details

#initializePixxxerTemplate

Returns a new instance of PixxxerTemplate.



4
5
6
# File 'lib/pixxxer/template.rb', line 4

def initialize
	@fields = {}
end

Instance Method Details

#add_field(field_name) ⇒ Object



7
8
9
10
# File 'lib/pixxxer/template.rb', line 7

def add_field(field_name)
	@fields[field_name] = PixxxerField.new(field_name, self)
	@fields[field_name]
end

#depixxxit(string) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/pixxxer/template.rb', line 11

def depixxxit(string)
	record = {}
	@fields.each do |field_name, field|
		record[field_name] = field.depixxxit string
	end
	record
end

#pixxxit(hash) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/pixxxer/template.rb', line 18

def pixxxit(hash)
	string = ''
	@fields.each do |field_name, field|
		string = field.pixxxit hash, string
	end
	string
end