class Spectifly::Base::Field
Public Instance Methods
extract_attributes()
click to toggle source
Calls superclass method
Spectifly::Base::EntityNode#extract_attributes
# File lib/spectifly/base/field.rb, line 6 def extract_attributes super @multiple = @attributes.delete('Multiple') == true if @tokens.include?('?') && @type && @type != 'Boolean' raise ArgumentError, "Boolean field has conflicting type" end end
extract_restrictions()
click to toggle source
Calls superclass method
Spectifly::Base::EntityNode#extract_restrictions
# File lib/spectifly/base/field.rb, line 14 def extract_restrictions super ['Minimum Value', 'Maximum Value', 'Valid Values'].each do |restriction| if @attributes[restriction] token = Spectifly::Support.tokenize(restriction) @restrictions[token] = @attributes.delete(restriction) end end @validations.each do |validation| if validation =~ /^Must match regex "(.*)"$/ @validations.delete(validation) @restrictions['regex'] = /#{$1}/ end end @restrictions end
multiple?()
click to toggle source
# File lib/spectifly/base/field.rb, line 37 def multiple? @multiple end
type()
click to toggle source
Calls superclass method
Spectifly::Base::EntityNode#type
# File lib/spectifly/base/field.rb, line 31 def type type = super type = 'boolean' if @tokens.include?('?') type || 'string' end