module SimpleFormObject::ClassMethods
Public Instance Methods
_attribute(attribute_name)
click to toggle source
# File lib/simple_form_object.rb, line 28 def _attribute(attribute_name) _attributes.select{|a| a.name == attribute_name}.first end
_attributes()
click to toggle source
# File lib/simple_form_object.rb, line 24 def _attributes @_attributes ||= [] end
_delegation_target()
click to toggle source
# File lib/simple_form_object.rb, line 20 def _delegation_target @_delegation_target end
attribute(name, type = :string, options = {})
click to toggle source
# File lib/simple_form_object.rb, line 10 def attribute(name, type = :string, options = {}) self.send(:attr_accessor, name) _attributes << Attribute.new(name, type, options) end
delegate_all(options = {})
click to toggle source
# File lib/simple_form_object.rb, line 16 def delegate_all(options = {}) @_delegation_target = options.fetch(:to) end
model_name()
click to toggle source
# File lib/simple_form_object.rb, line 32 def model_name ActiveModel::Name.new(self, nil, self.to_s.gsub(/Form$/, '')) end