lib/plc/emulator/plc_plugins.rb in ladder_drive-0.6.0 vs lib/plc/emulator/plc_plugins.rb in ladder_drive-0.6.1
- old
+ new
@@ -83,15 +83,14 @@
attr_reader :config
class << self
def devices_with_plc_from_str plc, dev_str
- devices = dev_str.split(",").map{|e| e.split("-")}.map do |devs|
+ dev_str.split(",").map{|e| e.split("-")}.map do |devs|
devs = devs.map{|d| plc.device_by_name d.strip}
d1 = devs.first
d2 = devs.last
- d = d1
[d2.number - d1.number + 1, 1].max.times.inject([]){|a, i| a << d1; d1 += 1; a}
end.flatten
end
def device_names_with_plc_from_str plc, dev_str
@@ -116,10 +115,10 @@
def name
@name ||= self.class.name.split(":").last.underscore.scan(/(.*)_plugin$/).first.first
end
def disabled?
- config[:disable]
+ config.empty? || config[:disable]
end
def run_cycle plc
return false unless self.plc == plc
end