Class: Ramaze::Fiber

Inherits:
Fiber show all
Defined in:
lib/ramaze/snippets/ramaze/fiber.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#stateObject

Returns the value of attribute state.



10
11
12
# File 'lib/ramaze/snippets/ramaze/fiber.rb', line 10

def state
  @state
end

Class Method Details

.new(*args) ⇒ Object

initialize isn’t being called, so we have to hook into ::new



4
5
6
7
8
# File 'lib/ramaze/snippets/ramaze/fiber.rb', line 4

def self.new(*args)
  instance = super
  instance.state = {}
  instance
end

Instance Method Details

#[](key) ⇒ Object



12
13
14
# File 'lib/ramaze/snippets/ramaze/fiber.rb', line 12

def [](key)
  @state[key]
end

#[]=(key, value) ⇒ Object



16
17
18
# File 'lib/ramaze/snippets/ramaze/fiber.rb', line 16

def []=(key, value)
  @state[key] = value
end

#key?(key) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/ramaze/snippets/ramaze/fiber.rb', line 20

def key?(key)
  @state.key?(key)
end