Class: BootstrapFormBuilder::ParsedArgs

Inherits:
Object
  • Object
show all
Defined in:
lib/bootstrap_form_builder/form_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ ParsedArgs



69
70
71
72
73
# File 'lib/bootstrap_form_builder/form_builder.rb', line 69

def initialize(*args)
  @options = args.extract_options!
  @args = args
  @classes = StringList.new(@options.delete(:class))
end

Instance Attribute Details

#classesObject

Returns the value of attribute classes.



67
68
69
# File 'lib/bootstrap_form_builder/form_builder.rb', line 67

def classes
  @classes
end

Instance Method Details

#optionsObject



75
76
77
78
79
80
81
# File 'lib/bootstrap_form_builder/form_builder.rb', line 75

def options
  if @classes.empty?
    @options
  else
    @options.merge(class: @classes.to_s)
  end
end

#shiftObject



83
84
85
# File 'lib/bootstrap_form_builder/form_builder.rb', line 83

def shift
  @args.shift
end

#to_aObject



87
88
89
90
91
92
93
# File 'lib/bootstrap_form_builder/form_builder.rb', line 87

def to_a
  if @classes.empty? && @options.empty?
    @args
  else
    @args + [options]
  end
end