module SimpleFormObject::ClassMethods
TODO: There are a number of self. calls that rubocop claims are redundant in this file that need to be investigated. rubocop:disable Style/RedundantSelf
Public Instance Methods
_attribute(attribute_name)
click to toggle source
# File lib/simple_form_object.rb, line 34 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 26 def _attributes @_attributes ||= [] end
_delegation_target()
click to toggle source
# File lib/simple_form_object.rb, line 22 def _delegation_target @_delegation_target end
attribute(name, type = :string, options = {})
click to toggle source
# File lib/simple_form_object.rb, line 12 def attribute(name, type = :string, options = {}) self.send(:attr_accessor, name) _attributes << Attribute.new(name, options, type) end
attributes()
click to toggle source
# File lib/simple_form_object.rb, line 30 def attributes @_attributes end
delegate_all(options = {})
click to toggle source
# File lib/simple_form_object.rb, line 18 def delegate_all(options = {}) @_delegation_target = options.fetch(:to) end
model_name()
click to toggle source
# File lib/simple_form_object.rb, line 38 def model_name ActiveModel::Name.new(self, nil, self.to_s.gsub(/Step$/, "")) end