Class: Shul::Shule::Radiogroup

Inherits:
Component show all
Defined in:
lib/shul.rb

Instance Method Summary collapse

Methods inherited from Box

#append_child, #deep_clone, #obj, #obj=, #remove

Constructor Details

#initialize(name = 'radiogroup', attributes: nil, rexle: nil) ⇒ Radiogroup

Returns a new instance of Radiogroup.



175
176
177
178
179
180
# File 'lib/shul.rb', line 175

def initialize(name='radiogroup', attributes: nil, rexle: nil)

  h = {value: ''}
  h.merge!(attributes) if attributes
  super(name, attributes: VisualAttributes.new(h), rexle: rexle)
end

Instance Method Details

#append_item(label, value) ⇒ Object



182
183
184
185
186
# File 'lib/shul.rb', line 182

def append_item(label, value)
  
  self.add @rexle.create_element('radio', label: label, value: value)
  
end

#radio(index) ⇒ Object



188
189
190
191
192
193
194
# File 'lib/shul.rb', line 188

def radio(index)
  
  if index <= self.elements.length then
    self.elements[index] 
  end
  
end