Class: Notifications::ActionList

Inherits:
Object
  • Object
show all
Defined in:
lib/notifications.rb

Instance Method Summary collapse

Constructor Details

#initialize(action_list = []) ⇒ ActionList

Returns a new instance of ActionList.



145
146
147
# File 'lib/notifications.rb', line 145

def initialize(action_list = [])
  @action_list = action_list
end

Instance Method Details

#<<(action) ⇒ Object



149
150
151
# File 'lib/notifications.rb', line 149

def <<(action)
  @action_list << action
end

#[](id) ⇒ Object



153
154
155
# File 'lib/notifications.rb', line 153

def [](id)
  @action_list[id]
end

#lengthObject



157
158
159
# File 'lib/notifications.rb', line 157

def length
  @action_list.length
end

#packObject



161
162
163
164
165
166
167
168
# File 'lib/notifications.rb', line 161

def pack
  al = @action_list.map do |action|
    action.normalize
  end

  al.flatten!
  al
end