Class: Typhon::Head

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

Overview

heads get loaded into this class on the ‘call’ method, provides convenient access to stomp, rate limiters etc

Instance Method Summary collapse

Instance Method Details

#define_singleton_method(*args, &block) ⇒ Object



5
6
7
8
9
# File 'lib/typhon/head.rb', line 5

def define_singleton_method(*args, &block)
  class << self
    self
  end.send(:define_method, *args, &block)
end

#ratelimit(name, time = 60) ⇒ Object



11
12
13
14
15
# File 'lib/typhon/head.rb', line 11

def ratelimit(name, time=60)
  @limiters ||= {}

  @limiters[name] ||= RateLimit.new(time)
end

#stompObject



17
18
19
# File 'lib/typhon/head.rb', line 17

def stomp
  Typhon.stomp
end