Class: Fitting::Host
- Inherits:
-
Object
- Object
- Fitting::Host
- Defined in:
- lib/fitting/host.rb
Defined Under Namespace
Class Method Summary collapse
Instance Method Summary collapse
- #cover! ⇒ Object
-
#initialize(host, skip) ⇒ Host
constructor
A new instance of Host.
- #to_s ⇒ Object
Constructor Details
#initialize(host, skip) ⇒ Host
Returns a new instance of Host.
12 13 14 15 16 |
# File 'lib/fitting/host.rb', line 12 def initialize(host, skip) @host = host @skip = skip @cover = false end |
Class Method Details
.find!(log) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/fitting/host.rb', line 18 def self.find!(log) yaml = YAML.safe_load(File.read('.fitting.yml')) yaml['hosts']&.map do |host| if log.host == host.first.first return new(host.first.first, host.first.last) end end raise NotFound.new(log.host, log) end |
Instance Method Details
#cover! ⇒ Object
28 29 30 31 |
# File 'lib/fitting/host.rb', line 28 def cover! @cover = true raise Skip if @skip == 'skip' end |
#to_s ⇒ Object
33 34 35 |
# File 'lib/fitting/host.rb', line 33 def to_s @host end |