Class: LadderConverter::PlcCode
- Inherits:
-
Object
- Object
- LadderConverter::PlcCode
- Defined in:
- lib/ladder_converter/plc_code.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#devices ⇒ Object
readonly
Returns the value of attribute devices.
-
#mnemonic ⇒ Object
readonly
Returns the value of attribute mnemonic.
Instance Method Summary collapse
- #add_device(device) ⇒ Object
- #device ⇒ Object
-
#initialize(mnemonic, devices) ⇒ PlcCode
constructor
A new instance of PlcCode.
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
#devices ⇒ Object (readonly)
Returns the value of attribute devices.
6 7 8 |
# File 'lib/ladder_converter/plc_code.rb', line 6 def devices @devices end |
#mnemonic ⇒ Object (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 |
#device ⇒ Object
18 19 20 |
# File 'lib/ladder_converter/plc_code.rb', line 18 def device devices.first end |