Module: Virtus::Group::ClassMethods
- Defined in:
- lib/virtus/group.rb
Instance Method Summary collapse
- #attribute_group ⇒ Object
- #attribute_groups ⇒ Object
- #group(name, &block) ⇒ Object
- #inherited(base) ⇒ Object
Instance Method Details
#attribute_group ⇒ Object
37 38 39 |
# File 'lib/virtus/group.rb', line 37 def attribute_group self.attribute_groups.for_class(self) end |
#attribute_groups ⇒ Object
41 42 43 |
# File 'lib/virtus/group.rb', line 41 def attribute_groups @attribute_groups ||= AttributeGroups.new end |
#group(name, &block) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/virtus/group.rb', line 26 def group(name, &block) attribute_tracker = AttributeTracker.new(self, &block) if attribute_group.has_key?(name) attribute_group[name] ||= [] attribute_group[name] |= attribute_tracker.tracked_attributes else attribute_group[name] = attribute_tracker.tracked_attributes end end |
#inherited(base) ⇒ Object
45 46 47 48 |
# File 'lib/virtus/group.rb', line 45 def inherited(base) super base.attribute_group.merge!(self.attribute_group) end |