Class: PixxxerTemplate
- Inherits:
-
Object
- Object
- PixxxerTemplate
- Defined in:
- lib/pixxxer/template.rb
Instance Method Summary collapse
- #add_field(field_name) ⇒ Object
- #depixxxit(string) ⇒ Object
-
#initialize ⇒ PixxxerTemplate
constructor
A new instance of PixxxerTemplate.
- #pixxxit(hash) ⇒ Object
Constructor Details
#initialize ⇒ PixxxerTemplate
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 |