Class: Travis::Yaml::Nodes::OS

Inherits:
Sequence show all
Defined in:
lib/travis/yaml/nodes/os.rb

Instance Attribute Summary

Attributes inherited from Sequence

#children

Attributes inherited from Node

#parent

Instance Method Summary collapse

Methods inherited from Sequence

#==, [], #add_value, #add_value!, #deep_verify, #each_scalar, #empty?, #identifier, #inspect, #nested_warnings, #prepare, #to_s, type, #verify, #verify_children, #visit_child, #visit_mapping, #visit_scalar, #visit_sequence, #with_value, #with_value!

Methods inherited from Node

#decrypt, #decrypted?, #deep_verify, #dup, #encrypt, #encrypted?, #error, #errors, #errors?, has_default?, #initialize, #method_missing, #nested_warning, #nested_warnings, #prepare, #respond_to_missing?, #serialize, #to_json, #to_legacy_ruby, #to_ruby, #to_s, #to_yaml, #verify, #visit_child, #visit_mapping, #visit_pair, #visit_scalar, #visit_sequence, #visit_unexpected, #warngings?, #warning, #warnings, #with_value

Constructor Details

This class inherits a constructor from Travis::Yaml::Nodes::Node

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Travis::Yaml::Nodes::Node

Instance Method Details

#verify_language(language) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/travis/yaml/nodes/os.rb', line 6

def verify_language(language)
  children.delete_if do |os|
    next false if os.supports_language? language.to_s
    warning "dropping %p, does not support %p", os, language
    true
  end

  if children.empty?
    default_os = language.respond_to?(:default_os) ? language.default_os : OSEntry.default
    warning "no suitable operating system given for %p, using %p", language, default_os.to_s
    children << OSEntry.new(self) { |os| os.value = default_os }
  end
end