Method: FormObject::Base#as_json

Defined in:
lib/form_object/base.rb

#as_jsonObject

This method is used to turn the attributes of the form into a stringified object that resembles json

Returns:

  • form atttrubytes as a strigified hash [Hash]



275
276
277
278
279
# File 'lib/form_object/base.rb', line 275

def as_json
  instance_variables.each_with_object({}) do |var, obj|
      obj[var.to_s.gsub('@','')] = instance_variable_get(var)
  end.stringify_keys
end