Class: LadderConverter::PlcCode

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

Direct Known Subclasses

KvCode

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mnemonic, devices) ⇒ PlcCode

Returns a new instance of PlcCode.



9
10
11
12
# File 'lib/ladder_converter/plc_code.rb', line 9

def initialize mnemonic, devices
  @mnemonic = own_mnemonic mnemonic
  @devices = devices.map{|d| own_device d}.select{|d| d && d.length != 0}
end

Instance Attribute Details

#devicesObject (readonly)

Returns the value of attribute devices.



6
7
8
# File 'lib/ladder_converter/plc_code.rb', line 6

def devices
  @devices
end

#mnemonicObject (readonly)

Returns the value of attribute mnemonic.



5
6
7
# File 'lib/ladder_converter/plc_code.rb', line 5

def mnemonic
  @mnemonic
end

Instance Method Details

#add_device(device) ⇒ Object



14
15
16
# File 'lib/ladder_converter/plc_code.rb', line 14

def add_device device
  @devices << own_device(device)
end

#deviceObject



18
19
20
# File 'lib/ladder_converter/plc_code.rb', line 18

def device
  devices.first
end