Class: Launch::Job
- Inherits:
-
Object
- Object
- Launch::Job
- Defined in:
- lib/launch/job.rb,
ext/launch.c
Class Method Summary collapse
Instance Method Summary collapse
- #attributes=(attributes) ⇒ Object
-
#initialize(attributes = {}) {|_self| ... } ⇒ Job
constructor
A new instance of Job.
- #inspect ⇒ Object
- #launch_attributes ⇒ Object
- #launch_attributes=(attributes) ⇒ Object
- #remove ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
- #submit ⇒ Object
Constructor Details
#initialize(attributes = {}) {|_self| ... } ⇒ Job
Returns a new instance of Job.
113 114 115 116 117 118 119 |
# File 'lib/launch/job.rb', line 113 def initialize(attributes = {}) @launch_attributes = {} self.attributes = attributes yield self if block_given? end |
Class Method Details
.checkin ⇒ Object
6 7 8 9 10 |
# File 'lib/launch/job.rb', line 6 def checkin from_launch Launch.(Messages::CHECKIN) rescue Errno::EPERM raise JobError.new(nil, "must checkin from process spawned by lauchd for job with sockets") end |
.find(label) ⇒ Object
12 13 14 15 16 |
# File 'lib/launch/job.rb', line 12 def find(label) from_launch Launch.(Messages::GETJOB => label) rescue Errno::ESRCH raise UnknownJob.new(nil, "no job exists with the label `#{label}'") end |
Instance Method Details
#attributes=(attributes) ⇒ Object
107 108 109 110 111 |
# File 'lib/launch/job.rb', line 107 def attributes=(attributes) attributes.each do |key, value| send(:"#{key}=", value) end end |
#inspect ⇒ Object
121 122 123 |
# File 'lib/launch/job.rb', line 121 def inspect "#<#{self.class} #{attributes_inspect}>" end |
#launch_attributes ⇒ Object
125 126 127 |
# File 'lib/launch/job.rb', line 125 def launch_attributes @launch_attributes end |
#launch_attributes=(attributes) ⇒ Object
129 130 131 |
# File 'lib/launch/job.rb', line 129 def launch_attributes=(attributes) @launch_attributes = attributes end |
#remove ⇒ Object
133 134 135 |
# File 'lib/launch/job.rb', line 133 def remove (Messages::REMOVEJOB => label) end |
#start ⇒ Object
137 138 139 |
# File 'lib/launch/job.rb', line 137 def start (Messages::STARTJOB => label) end |
#stop ⇒ Object
141 142 143 |
# File 'lib/launch/job.rb', line 141 def stop (Messages::STOPJOB => label) end |
#submit ⇒ Object
145 146 147 |
# File 'lib/launch/job.rb', line 145 def submit (Messages::SUBMITJOB => launch_attributes) end |