Class: Formwandler::FieldDefinition
- Inherits:
-
Object
- Object
- Formwandler::FieldDefinition
- Defined in:
- lib/formwandler/field_definition.rb
Instance Attribute Summary collapse
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#delocalize ⇒ Object
readonly
Returns the value of attribute delocalize.
-
#disabled ⇒ Object
readonly
Returns the value of attribute disabled.
-
#hidden ⇒ Object
readonly
Returns the value of attribute hidden.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #hidden_options ⇒ Object
- #hide_option(name, value = true) ⇒ Object
-
#initialize(name, hidden: false, disabled: false, default: nil, delocalize: nil, model: nil, source: nil, options: nil) ⇒ FieldDefinition
constructor
A new instance of FieldDefinition.
Constructor Details
#initialize(name, hidden: false, disabled: false, default: nil, delocalize: nil, model: nil, source: nil, options: nil) ⇒ FieldDefinition
Returns a new instance of FieldDefinition.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/formwandler/field_definition.rb', line 7 def initialize(name, hidden: false, disabled: false, default: nil, delocalize: nil, model: nil, source: nil, options: nil) @name = name @hidden = hidden @disabled = disabled @default = default @delocalize = delocalize @model = model @source = source || name @options = end |
Instance Attribute Details
#default ⇒ Object (readonly)
Returns the value of attribute default.
5 6 7 |
# File 'lib/formwandler/field_definition.rb', line 5 def default @default end |
#delocalize ⇒ Object (readonly)
Returns the value of attribute delocalize.
5 6 7 |
# File 'lib/formwandler/field_definition.rb', line 5 def delocalize @delocalize end |
#disabled ⇒ Object (readonly)
Returns the value of attribute disabled.
5 6 7 |
# File 'lib/formwandler/field_definition.rb', line 5 def disabled @disabled end |
#hidden ⇒ Object (readonly)
Returns the value of attribute hidden.
5 6 7 |
# File 'lib/formwandler/field_definition.rb', line 5 def hidden @hidden end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
5 6 7 |
# File 'lib/formwandler/field_definition.rb', line 5 def model @model end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/formwandler/field_definition.rb', line 5 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/formwandler/field_definition.rb', line 5 def @options end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
5 6 7 |
# File 'lib/formwandler/field_definition.rb', line 5 def source @source end |
Instance Method Details
#hidden_options ⇒ Object
22 23 24 |
# File 'lib/formwandler/field_definition.rb', line 22 def @hidden_options ||= {} end |
#hide_option(name, value = true) ⇒ Object
18 19 20 |
# File 'lib/formwandler/field_definition.rb', line 18 def hide_option(name, value = true) [name.to_s] = value end |