class MicroBunny::EventLookup

Attributes

name[R]

Public Class Methods

new(name) click to toggle source
# File lib/microbunny/event_lookup.rb, line 3
def initialize(name)
  @name = name.is_a?(Symbol) ? camelize(name.to_s) : name
end

Public Instance Methods

consumer() click to toggle source
# File lib/microbunny/event_lookup.rb, line 11
def consumer
  constantize(name + "Consumer")
end
event() click to toggle source
# File lib/microbunny/event_lookup.rb, line 7
def event
  constantize(name + "Event")
end

Private Instance Methods

camelize(string) click to toggle source
# File lib/microbunny/event_lookup.rb, line 18
def camelize(string)
  string.split('_').map(&:capitalize).join
end
constantize(string) click to toggle source
# File lib/microbunny/event_lookup.rb, line 22
def constantize(string)
  Object.const_get(string)
end