Class: Files::FormField

Inherits:
Object
  • Object
show all
Defined in:
lib/files.com/models/form_field.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}, options = {}) ⇒ FormField

Returns a new instance of FormField.



7
8
9
10
# File 'lib/files.com/models/form_field.rb', line 7

def initialize(attributes = {}, options = {})
  @attributes = attributes || {}
  @options = options || {}
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



5
6
7
# File 'lib/files.com/models/form_field.rb', line 5

def attributes
  @attributes
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/files.com/models/form_field.rb', line 5

def options
  @options
end

Instance Method Details

#default_optionObject

string - Default option for radio and dropdown



43
44
45
# File 'lib/files.com/models/form_field.rb', line 43

def default_option
  @attributes[:default_option]
end

#field_typeObject

string - Type of Field



33
34
35
# File 'lib/files.com/models/form_field.rb', line 33

def field_type
  @attributes[:field_type]
end

#form_field_set_idObject

int64 - Form field set id



48
49
50
# File 'lib/files.com/models/form_field.rb', line 48

def form_field_set_id
  @attributes[:form_field_set_id]
end

#help_textObject

string - Help text to be displayed



28
29
30
# File 'lib/files.com/models/form_field.rb', line 28

def help_text
  @attributes[:help_text]
end

#idObject

int64 - Form field id



13
14
15
# File 'lib/files.com/models/form_field.rb', line 13

def id
  @attributes[:id]
end

#labelObject

string - Label to be displayed



18
19
20
# File 'lib/files.com/models/form_field.rb', line 18

def label
  @attributes[:label]
end

#options_for_selectObject

array - Options to display for radio and dropdown



38
39
40
# File 'lib/files.com/models/form_field.rb', line 38

def options_for_select
  @attributes[:options_for_select]
end

#requiredObject

boolean - Is this a required field?



23
24
25
# File 'lib/files.com/models/form_field.rb', line 23

def required
  @attributes[:required]
end