Class: Bricolage::JobFile
- Inherits:
-
Object
- Object
- Bricolage::JobFile
- Defined in:
- lib/bricolage/jobfile.rb
Instance Attribute Summary collapse
-
#class_id ⇒ Object
readonly
Returns the value of attribute class_id.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(class_id, values, path) ⇒ JobFile
constructor
A new instance of JobFile.
- #job_id ⇒ Object
- #subsystem ⇒ Object
Constructor Details
#initialize(class_id, values, path) ⇒ JobFile
Returns a new instance of JobFile.
82 83 84 85 86 |
# File 'lib/bricolage/jobfile.rb', line 82 def initialize(class_id, values, path) @class_id = class_id @values = values @path = Pathname(path) end |
Instance Attribute Details
#class_id ⇒ Object (readonly)
Returns the value of attribute class_id.
88 89 90 |
# File 'lib/bricolage/jobfile.rb', line 88 def class_id @class_id end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
90 91 92 |
# File 'lib/bricolage/jobfile.rb', line 90 def path @path end |
#values ⇒ Object (readonly)
Returns the value of attribute values.
89 90 91 |
# File 'lib/bricolage/jobfile.rb', line 89 def values @values end |
Class Method Details
.load(ctx, path) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/bricolage/jobfile.rb', line 7 def JobFile.load(ctx, path) values = if /\.sql\.job\z/ =~ path.to_s (ctx, path) else ctx.parameter_file_loader.load_yaml(path) end parse(values, path) end |
.parse(values, path) ⇒ Object
75 76 77 78 79 80 |
# File 'lib/bricolage/jobfile.rb', line 75 def JobFile.parse(values, path) values = values.dup class_id = values.delete('class') or raise ParameterError, "missing job class: #{path}" new(class_id, values, path) end |
Instance Method Details
#job_id ⇒ Object
92 93 94 95 |
# File 'lib/bricolage/jobfile.rb', line 92 def job_id base = @path.basename('.job').to_s File.basename(base, '.*') end |
#subsystem ⇒ Object
97 98 99 |
# File 'lib/bricolage/jobfile.rb', line 97 def subsystem @path.parent.basename.to_s end |