Class: Sankey::Reagent

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(size, name = '') ⇒ Reagent

Returns a new instance of Reagent.



5
6
7
8
# File 'lib/reagent.rb', line 5

def initialize(size, name = '')
  @size = size
  @name = name
end

Instance Attribute Details

#drainObject

Returns the value of attribute drain.



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

def drain
  @drain
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#sizeObject (readonly)

Returns the value of attribute size.



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

def size
  @size
end

#sourceObject

Returns the value of attribute source.



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

def source
  @source
end

Instance Method Details

#add_drain(process, order = nil) ⇒ Object



20
21
22
23
# File 'lib/reagent.rb', line 20

def add_drain(process, order = nil)
  process.add_input self, order
  @drain = process
end

#add_source(process, order = nil) ⇒ Object



25
26
27
28
# File 'lib/reagent.rb', line 25

def add_source(process, order = nil)
  process.add_output self, order
  @source= process
end

#joins_laterObject



30
31
32
33
34
35
36
37
38
# File 'lib/reagent.rb', line 30

def joins_later
  drain.input.each do |r|
    next if r == self
    if r.source != nil
      return true
    end
  end
  false
end