Class: Bolt::Yarn

Inherits:
Object
  • Object
show all
Defined in:
lib/bolt/yarn.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fiber, index) ⇒ Yarn

Returns a new instance of Yarn.



9
10
11
12
13
# File 'lib/bolt/yarn.rb', line 9

def initialize(fiber, index)
  @fiber = fiber
  @index = index
  @value = nil
end

Instance Attribute Details

#fiberObject (readonly)

Returns the value of attribute fiber.



7
8
9
# File 'lib/bolt/yarn.rb', line 7

def fiber
  @fiber
end

#indexObject (readonly)

Returns the value of attribute index.



7
8
9
# File 'lib/bolt/yarn.rb', line 7

def index
  @index
end

#valueObject (readonly)

Returns the value of attribute value.



7
8
9
# File 'lib/bolt/yarn.rb', line 7

def value
  @value
end

Instance Method Details

#alive?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/bolt/yarn.rb', line 15

def alive?
  fiber.alive?
end

#resumeObject



19
20
21
# File 'lib/bolt/yarn.rb', line 19

def resume
  @value = fiber.resume
end