lib/sapos/print/configuration.rb in sapos-print-1.0.10 vs lib/sapos/print/configuration.rb in sapos-print-1.1.0
- old
+ new
@@ -4,11 +4,11 @@
module Sapos
module Print
class Configuration
- attr_accessor :printer, :adapter, :interface, :q, :key, :emv_path, :emv_terminal, :user_id, :verbose, :duplicate_control, :cache
+ attr_accessor :printer, :adapter, :interface, :q, :key, :emv_path, :emv_terminal, :user_id, :verbose, :duplicate_control, :cache, :printers
def self.write(args = {})
config_file = "#{Sapos::Print.app_directory}/config.yml"
File.write(config_file, args.to_yaml)
end
@@ -17,10 +17,11 @@
config_file = "#{Sapos::Print.app_directory}/config.yml"
if File.exist?(config_file)
template = ERB.new(File.read(config_file))
result = YAML.load(template.result(binding))
@printer = result[:printer]
+ @printers = result[:printers] || []
@adapter = result[:adapter]
@interface = result[:interface]
@q = result[:q]
@key = result[:key]
@emv_path = result[:emv_path]
@@ -48,10 +49,10 @@
def duplicate_control?
@duplicate_control.to_s.downcase.eql?("si")
end
def to_h
- {printer: @printer, adapter: @adapter, interface: @interface, q: @q, key: @key, emv_path: @emv_path, emv_terminal: @emv_terminal, user_id: @user_id, duplicate_control: @duplicate_control }
+ {printer: @printer, adapter: @adapter, interface: @interface, q: @q, key: @key, emv_path: @emv_path, emv_terminal: @emv_terminal, user_id: @user_id, duplicate_control: @duplicate_control, printers: @printers }
end
end
end
end
\ No newline at end of file