Class: System

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

Instance Method Summary collapse

Constructor Details

#initializeSystem

Returns a new instance of System.



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

def initialize()
    @heating = Relais.new
    @cooling = Relais.new
end

Instance Method Details

#set(value) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/system.rb', line 8

def set(value)
    if value > 0
        @heating.on
        @cooling.off

    elsif value < 0
        @heating.off
        @cooling.on

    else
        @heating.off
        @cooling.off
    end
end

#stringObject



23
24
25
# File 'lib/system.rb', line 23

def string()
    "The heating is #{@heating.status}\nThe coolling is #{@cooling.status}"
end