Class: Moku6::Catalog

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(events) ⇒ Catalog

: (Array events) -> void



9
# File 'lib/moku6/catalog.rb', line 9

def initialize(events) = @events = events

Instance Attribute Details

#eventsObject (readonly)

: Array



6
7
8
# File 'lib/moku6/catalog.rb', line 6

def events
  @events
end

Instance Method Details

#actionsObject

: () -> Array



12
# File 'lib/moku6/catalog.rb', line 12

def actions = events.map(&:action)

#empty?Boolean

: () -> bool

Returns:

  • (Boolean)


21
# File 'lib/moku6/catalog.rb', line 21

def empty? = events.empty?

#find(action) ⇒ Object

: (String? action) -> Event?



18
# File 'lib/moku6/catalog.rb', line 18

def find(action) = events.find { |e| e.action == action }

#sortedObject

: () -> Array



15
# File 'lib/moku6/catalog.rb', line 15

def sorted = events.sort_by { |e| e.action.to_s }