Class: GCI::Job
- Inherits:
-
Object
- Object
- GCI::Job
- Defined in:
- lib/gci/job.rb
Defined Under Namespace
Classes: Collection
Class Method Summary collapse
Instance Method Summary collapse
- #attributes ⇒ Object
- #change(&block) ⇒ Object
-
#initialize(**attrs) {|_self| ... } ⇒ Job
constructor
A new instance of Job.
- #stage=(value) ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(**attrs) {|_self| ... } ⇒ Job
Returns a new instance of Job.
74 75 76 77 |
# File 'lib/gci/job.rb', line 74 def initialize(**attrs) @attrs = attrs yield(self) if block_given? end |
Class Method Details
.define_attr_accessors(name) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/gci/job.rb', line 34 def self.define_attr_accessors(name) define_method("#{name}=") do |value| @attrs[name] = value end define_method(name) do @attrs[name] end end |
Instance Method Details
#attributes ⇒ Object
93 94 95 |
# File 'lib/gci/job.rb', line 93 def attributes to_h.except(:name) end |
#change(&block) ⇒ Object
83 84 85 |
# File 'lib/gci/job.rb', line 83 def change(&block) self.class.new(**@attrs.deep_dup, &block) end |
#stage=(value) ⇒ Object
79 80 81 |
# File 'lib/gci/job.rb', line 79 def stage=(value) @attrs[:stage] = value.to_s end |
#to_h ⇒ Object
87 88 89 90 91 |
# File 'lib/gci/job.rb', line 87 def to_h data = @attrs data[:stage] = data[:stage].to_s if data[:stage] data end |