Class: Mack::ViewHelpers::FormHelpers::FormElement

Inherits:
Object
  • Object
show all
Defined in:
lib/mack/view_helpers/form_helpers.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ FormElement

Returns a new instance of FormElement.



312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
# File 'lib/mack/view_helpers/form_helpers.rb', line 312

def initialize(*args)
  args = args.parse_splat_args
  self.calling_method = :to_s
  self.options = {}
  case args
  when Symbol, String
    self.calling_method = args
  when Hash
    self.options = args
  when Array
    self.calling_method = args[0]
    self.options = args[1]
  when nil
  else
    raise ArgumentError.new("You must provide either a Symbol, a String, a Hash, or a combination thereof.")
  end
  if self.options[:checked]
    self.options[:checked] = :checked
  end
end

Instance Attribute Details

#calling_methodObject

Returns the value of attribute calling_method.



309
310
311
# File 'lib/mack/view_helpers/form_helpers.rb', line 309

def calling_method
  @calling_method
end

#optionsObject

Returns the value of attribute options.



310
311
312
# File 'lib/mack/view_helpers/form_helpers.rb', line 310

def options
  @options
end