Module: Hatetepe::Events

Included in:
Parser
Defined in:
lib/hatetepe/events.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#stateObject (readonly)

Returns the value of attribute state.



7
8
9
# File 'lib/hatetepe/events.rb', line 7

def state
  @state
end

Class Method Details

.included(klass) ⇒ Object



3
4
5
# File 'lib/hatetepe/events.rb', line 3

def self.included(klass)
  klass.extend ClassMethods
end

Instance Method Details

#event(name, *args) ⇒ Object



9
10
11
# File 'lib/hatetepe/events.rb', line 9

def event(name, *args)
  send(:"on_#{name}").each {|blk| blk.call *args }
end

#event!(name, *args) ⇒ Object



13
14
15
16
# File 'lib/hatetepe/events.rb', line 13

def event!(name, *args)
  @state = name
  event name, *args
end