class ProcessSettings::TargetAndSettings
This class encapsulates a single YAML file with target and process_settings.
Attributes
filename[R]
settings[R]
target[R]
Public Class Methods
from_json_docs(filename, target_json_doc, settings_json_doc)
click to toggle source
# File lib/process_settings/target_and_settings.rb, line 37 def from_json_docs(filename, target_json_doc, settings_json_doc) target_json_doc = Target.new(target_json_doc) settings = Settings.new(settings_json_doc) new(filename, target_json_doc, settings) end
new(filename, target, settings)
click to toggle source
# File lib/process_settings/target_and_settings.rb, line 11 def initialize(filename, target, settings) @filename = filename target.is_a?(Target) or raise ArgumentError, "target must be a Target; got #{target.inspect}" @target = target settings.is_a?(Settings) or raise ArgumentError, "settings must be a Settings; got #{settings.inspect}" @settings = settings end
Public Instance Methods
==(rhs)
click to toggle source
# File lib/process_settings/target_and_settings.rb, line 21 def ==(rhs) to_json_doc == rhs.to_json_doc end
eql?(rhs)
click to toggle source
# File lib/process_settings/target_and_settings.rb, line 25 def eql?(rhs) self == rhs end
to_json_doc()
click to toggle source
# File lib/process_settings/target_and_settings.rb, line 29 def to_json_doc { "target" => @target.json_doc, "settings" => @settings.json_doc } end
with_static_context(static_context_hash)
click to toggle source
returns a copy of self with target simplified based on given static_context_hash (or returns self if there is no difference)
# File lib/process_settings/target_and_settings.rb, line 47 def with_static_context(static_context_hash) new_target = target.with_static_context(static_context_hash) if new_target == @target self else self.class.new(@filename, new_target, @settings) end end