class Apolo::Domains::Cups
Attributes
job[RW]
jobs_count[RW]
minutes[RW]
Public Class Methods
new(printer_name)
click to toggle source
# File lib/apolo/domains/cups.rb, line 7 def initialize(printer_name) if printer_name.nil? printer = CupsPrinter.new(printers.first) @printer_name = printer.name else @printer_name = printer_name end get_data end
Public Instance Methods
get_data()
click to toggle source
# File lib/apolo/domains/cups.rb, line 22 def get_data pointer = FFI::MemoryPointer.new :pointer @jobs_count = CupsFFI::cupsGetJobs(pointer, @printer_name, 0, CupsFFI::CUPS_WHICHJOBS_ACTIVE) @job = CupsFFI::CupsJobS.new(pointer.get_pointer(0)) if @jobs_count > 0 @minutes = (Time.now - Time.at(@job[:creation_time])).to_i / 60 else @minutes = 0 end end
printers()
click to toggle source
# File lib/apolo/domains/cups.rb, line 18 def printers CupsPrinter.get_all_printer_names end