Module: ActiveModel::Form::StringAttribute

Defined in:
lib/active_model/form/attributes.rb

Class Method Summary collapse

Class Method Details

.limitObject


84
85
86
# File 'lib/active_model/form/attributes.rb', line 84

def self.limit
  nil
end

.number?Boolean

Returns:

  • (Boolean)

80
81
82
# File 'lib/active_model/form/attributes.rb', line 80

def self.number?
  false
end

.parse(v) ⇒ Object


66
67
68
69
70
71
72
73
74
# File 'lib/active_model/form/attributes.rb', line 66

def self.parse(v)
  if v.present?
    String.new(v)
  elsif ['', nil].include? v.to_s.strip
    nil
  else
    raise "Couldn't parse string attribute value: '#{v}'"
  end
end

.typeObject


76
77
78
# File 'lib/active_model/form/attributes.rb', line 76

def self.type
  :string
end