Class: PrintHost

Inherits:
ApplicationRecord show all
Defined in:
app/models/print_host.rb

Defined Under Namespace

Classes: NotReady

Constant Summary collapse

PROTOCOLS =

i18n-tasks-use t("activerecord.models.print_host")

Print.constants.map { [const_get("Print::#{it}::PROTOCOL"), const_get("Print::#{it}")] }.to_h.freeze

Constants inherited from ApplicationRecord

ApplicationRecord::SAFE_NAME_LENGTH

Instance Method Summary collapse

Methods inherited from ApplicationRecord

find_param

Instance Method Details

#input_types ⇒ Object



17
18
19
# File 'app/models/print_host.rb', line 17

def input_types
  PROTOCOLS[protocol]::INPUT_TYPES
end


21
22
23
# File 'app/models/print_host.rb', line 21

def print_later(file:)
  SendFileToPrintHostJob.perform_later(print_host: self, file: file)
end

#service ⇒ Object



13
14
15
# File 'app/models/print_host.rb', line 13

def service
  PROTOCOLS[protocol].new(print_host: self)
end