field_pattern validation: {type: 'length', length: '50-200'}
def field_pattern data
validation = data[:validation]
validation
end
{:type=>"length", :length=>"3-100"}
validation[:type] # или validation[:length]
undefined method `[]' for nil:NilClass
validation.class
Hash
def field_pattern data
validation = data[:validation]
validation
end
v = field_pattern validation: {type: 'length', length: '50-200'}
v[:type] # "length"
v[:length] # "50-200"
def field_pattern data
$validation = data[:validation]
$validation
end
$validation[:type] # "length"
$validation[:length] # "50-200"