class Field::Base
Attributes
form[RW]
name[RW]
options[RW]
Public Class Methods
factory(*args)
click to toggle source
# File lib/field/base.rb, line 7 def self.factory(*args) new(*args) end
new(name, options = {})
click to toggle source
# File lib/field/base.rb, line 11 def initialize(name, options = {}) @name = name @options = options end
Public Instance Methods
attribute()
click to toggle source
# File lib/field/base.rb, line 26 def attribute String end
inject_attributes()
click to toggle source
# File lib/field/base.rb, line 30 def inject_attributes @container.attribute @name, attribute end
inject_validations()
click to toggle source
# File lib/field/base.rb, line 34 def inject_validations if @options.any? @container.send(:validates, @name, @options) end end
presenter_class()
click to toggle source
# File lib/field/base.rb, line 44 def presenter_class nil end
setup_container(container)
click to toggle source
# File lib/field/base.rb, line 16 def setup_container(container) @container = container if Helper.container_is_virtus?(container) inject_attributes end inject_validations end
value()
click to toggle source
# File lib/field/base.rb, line 40 def value @form.send(name) if @form end