Class: ParameterSets::SchemaDSL
- Inherits:
-
Object
- Object
- ParameterSets::SchemaDSL
- Defined in:
- lib/parameter_sets/schema_dsl.rb
Instance Attribute Summary collapse
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
Instance Method Summary collapse
-
#initialize ⇒ SchemaDSL
constructor
A new instance of SchemaDSL.
- #permit(field, *other_fields) ⇒ Object
Constructor Details
#initialize ⇒ SchemaDSL
Returns a new instance of SchemaDSL.
4 5 6 |
# File 'lib/parameter_sets/schema_dsl.rb', line 4 def initialize @fields = [] end |
Instance Attribute Details
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
8 9 10 |
# File 'lib/parameter_sets/schema_dsl.rb', line 8 def fields @fields end |
Instance Method Details
#permit(field, *other_fields) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/parameter_sets/schema_dsl.rb', line 10 def permit(field, *other_fields) if other_fields[0].is_a?(Symbol) permit(field) other_fields.each { |field| permit(field) } else if = other_fields[0] @fields << {field => } else @fields << field end end end |