Class: Hokusai::Event
- Inherits:
-
Object
show all
- Defined in:
- ui/src/hokusai/event.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Instance Attribute Details
#bubbles ⇒ Object
Returns the value of attribute bubbles.
5
6
7
|
# File 'ui/src/hokusai/event.rb', line 5
def bubbles
@bubbles
end
|
#captures ⇒ Object
Returns the value of attribute captures.
5
6
7
|
# File 'ui/src/hokusai/event.rb', line 5
def captures
@captures
end
|
#stopped ⇒ Object
Returns the value of attribute stopped.
6
7
8
|
# File 'ui/src/hokusai/event.rb', line 6
def stopped
@stopped
end
|
Class Method Details
.name(name) ⇒ Object
8
9
10
|
# File 'ui/src/hokusai/event.rb', line 8
def self.name(name)
@name = name
end
|
Instance Method Details
#bubble ⇒ Object
43
44
45
46
47
48
49
|
# File 'ui/src/hokusai/event.rb', line 43
def bubble
while block = captures.pop
block.emit(name, self)
break if stopped
end
end
|
#matches(block) ⇒ Object
36
37
38
39
40
41
|
# File 'ui/src/hokusai/event.rb', line 36
def matches(block)
return false if block.node.portal.nil?
val = block.node.portal.ast.event(name)
!!val
end
|
#name ⇒ Object
12
13
14
|
# File 'ui/src/hokusai/event.rb', line 12
def name
self.class.instance_variable_get("@name")
end
|
#stop ⇒ Object
20
21
22
|
# File 'ui/src/hokusai/event.rb', line 20
def stop
self.stopped = true
end
|
#to_json ⇒ Object
32
33
34
|
# File 'ui/src/hokusai/event.rb', line 32
def to_json
raise Hokusai::Error.new("#{self.class} must implement to_json")
end
|