Class: Dima::Html::FormFields

Inherits:
Object
  • Object
show all
Defined in:
lib/dima/html/form.rb

Overview

Form fields.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#editObject

Returns the value of attribute edit.



272
273
274
# File 'lib/dima/html/form.rb', line 272

def edit
  @edit
end

Instance Method Details

#<<(field) ⇒ Object



278
279
280
# File 'lib/dima/html/form.rb', line 278

def << (field)
  fields << field
end

#empty?Boolean

Returns:

  • (Boolean)


286
287
288
# File 'lib/dima/html/form.rb', line 286

def empty?
  fields.empty?
end

#fieldsObject



274
275
276
# File 'lib/dima/html/form.rb', line 274

def fields
  @fields ||= []
end

#sizeObject



282
283
284
# File 'lib/dima/html/form.rb', line 282

def size
  self.fields.size
end

#to_nObject



290
291
292
293
294
295
296
297
298
299
300
301
# File 'lib/dima/html/form.rb', line 290

def to_n
  unless empty?
    node = Node.new(tag: 'div', attributes: { class: 'dim-column dim-col50'})
    fields.each do |f|
      old_edit = f.edit
      f.edit = self.edit
      node << f.to_n
      f.edit = old_edit
    end
    node
  end
end