Class: Field::Telephone

Inherits:
Base
  • Object
show all
Defined in:
lib/field/telephone.rb

Instance Attribute Summary

Attributes inherited from Base

#fieldset, #form, #name, #value

Instance Method Summary collapse

Methods inherited from Base

#add_attributes, #form?, #initialize

Constructor Details

This class inherits a constructor from Field::Base

Instance Method Details

#add_validations(klass, options) ⇒ Object



6
7
8
9
10
# File 'lib/field/telephone.rb', line 6

def add_validations(klass, options)
  klass.validates name, telephone: true

  super
end

#attributeObject



12
13
14
# File 'lib/field/telephone.rb', line 12

def attribute
  ::Attribute::Telephone
end

#outputObject



16
17
18
19
# File 'lib/field/telephone.rb', line 16

def output
  return unless value
  ::Telephone.new(value).formatted
end