Module: Lotus::Validations::AttributeDefiner::ClassMethods Private
- Defined in:
- lib/lotus/validations/attribute_definer.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
-
#_attribute(name, options = {}, &block) ⇒ Object
private
Define an attribute.
-
#attribute(name, options = {}, &block) ⇒ Object
private
Define an attribute.
-
#defined_attributes ⇒ Array<String>
private
Set of user defined attributes.
-
#included(base) ⇒ Object
private
Override Ruby’s hook for modules.
-
#inherited(base) ⇒ Object
private
Override Ruby’s hook for modules.
Instance Method Details
#_attribute(name, options = {}, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Define an attribute
267 268 269 270 271 272 273 274 275 |
# File 'lib/lotus/validations/attribute_definer.rb', line 267 def _attribute(name, = {}, &block) if block_given? define_nested_attribute(name, , &block) validates(name, {}) else define_attribute(name, ) validates(name, ) end end |
#attribute(name, options = {}, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Define an attribute
value which coerces to TrueClass
257 258 259 |
# File 'lib/lotus/validations/attribute_definer.rb', line 257 def attribute(name, = {}, &block) _attribute(name, , &block) end |
#defined_attributes ⇒ Array<String>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Set of user defined attributes
283 284 285 |
# File 'lib/lotus/validations/attribute_definer.rb', line 283 def defined_attributes @defined_attributes ||= Set.new(super) end |
#included(base) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Override Ruby’s hook for modules.
56 57 58 59 |
# File 'lib/lotus/validations/attribute_definer.rb', line 56 def included(base) super base.defined_attributes.merge(defined_attributes) end |
#inherited(base) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Override Ruby’s hook for modules.
69 70 71 72 |
# File 'lib/lotus/validations/attribute_definer.rb', line 69 def inherited(base) super base.defined_attributes.merge(defined_attributes) end |