Module: Notably::Notification::ClassMethods
- Defined in:
- lib/notably/notification.rb
Instance Method Summary collapse
- #create(attributes = {}) ⇒ Object
- #group_by(*args) ⇒ Object
- #group_within(block = nil) ⇒ Object
- #required_attributes(*args) ⇒ Object
Instance Method Details
#create(attributes = {}) ⇒ Object
104 105 106 |
# File 'lib/notably/notification.rb', line 104 def create(attributes={}) new(attributes).save end |
#group_by(*args) ⇒ Object
117 118 119 120 121 122 123 124 |
# File 'lib/notably/notification.rb', line 117 def group_by(*args) if args.any? @group_by ||= [] @group_by += args else @group_by ||= [] end end |
#group_within(block = nil) ⇒ Object
126 127 128 129 130 131 132 |
# File 'lib/notably/notification.rb', line 126 def group_within(block=nil) if block @group_within = block else @group_within ||= ->(receiver) { receiver.last_notification_read_at } end end |
#required_attributes(*args) ⇒ Object
108 109 110 111 112 113 114 115 |
# File 'lib/notably/notification.rb', line 108 def required_attributes(*args) if args.any? @required_attributes ||= [] @required_attributes += args else @required_attributes ||= [] end end |