Class: Cups::Job
- Inherits:
-
Object
- Object
- Cups::Job
- Defined in:
- lib/ffi-cups/job.rb
Instance Attribute Summary collapse
-
#completed_time ⇒ Object
Returns the value of attribute completed_time.
-
#creation_time ⇒ Object
Returns the value of attribute creation_time.
-
#format ⇒ Object
Returns the value of attribute format.
-
#id ⇒ Object
Returns the value of attribute id.
-
#printer ⇒ Object
Returns the value of attribute printer.
-
#processing_time ⇒ Object
Returns the value of attribute processing_time.
-
#size ⇒ Object
Returns the value of attribute size.
-
#state ⇒ Object
Returns the value of attribute state.
-
#title ⇒ Object
Returns the value of attribute title.
Class Method Summary collapse
-
.get_job(id, name = nil, filter = -1,, connection = nil) ⇒ Job
Get job from id.
-
.get_jobs(name = nil, filter = -1,, connection = nil) ⇒ Array
Get jobs by filter or destination name.
Instance Method Summary collapse
-
#initialize(id, title, printer) ⇒ Job
constructor
A new instance of Job.
Constructor Details
#initialize(id, title, printer) ⇒ Job
Returns a new instance of Job.
7 8 9 10 11 |
# File 'lib/ffi-cups/job.rb', line 7 def initialize(id, title, printer) @id = id @title = title @printer = printer end |
Instance Attribute Details
#completed_time ⇒ Object
Returns the value of attribute completed_time.
3 4 5 |
# File 'lib/ffi-cups/job.rb', line 3 def completed_time @completed_time end |
#creation_time ⇒ Object
Returns the value of attribute creation_time.
3 4 5 |
# File 'lib/ffi-cups/job.rb', line 3 def creation_time @creation_time end |
#format ⇒ Object
Returns the value of attribute format.
3 4 5 |
# File 'lib/ffi-cups/job.rb', line 3 def format @format end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/ffi-cups/job.rb', line 3 def id @id end |
#printer ⇒ Object
Returns the value of attribute printer.
3 4 5 |
# File 'lib/ffi-cups/job.rb', line 3 def printer @printer end |
#processing_time ⇒ Object
Returns the value of attribute processing_time.
3 4 5 |
# File 'lib/ffi-cups/job.rb', line 3 def processing_time @processing_time end |
#size ⇒ Object
Returns the value of attribute size.
3 4 5 |
# File 'lib/ffi-cups/job.rb', line 3 def size @size end |
#state ⇒ Object
Returns the value of attribute state.
3 4 5 |
# File 'lib/ffi-cups/job.rb', line 3 def state @state end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/ffi-cups/job.rb', line 3 def title @title end |
Class Method Details
.get_job(id, name = nil, filter = -1,, connection = nil) ⇒ Job
Get job from id
41 42 43 44 45 46 |
# File 'lib/ffi-cups/job.rb', line 41 def self.get_job(id, name=nil, filter=-1, connection=nil) jobs = get_jobs(name, filter, connection) jobs.each do |j| return j if j.id == id end end |
.get_jobs(name = nil, filter = -1,, connection = nil) ⇒ Array
Get jobs by filter or destination name
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ffi-cups/job.rb', line 18 def self.get_jobs(name=nil, filter=-1, connection=nil) p_jobs = FFI::MemoryPointer.new :pointer cups_jobs = cupsGetJobs2(p_jobs, name, filter, connection) jobs = [] cups_jobs.each do |j| job = Cups::Job.new(j[:id].dup, j[:title].dup, j[:dest].dup) job.format = j[:format] job.state = j[:state] job.size = j[:size] job.completed_time = Time.at(j[:completed_time]) job.creation_time = Time.at(j[:creation_time]) job.processing_time = Time.at(j[:processing_time]) jobs.push(job) end return jobs end |