Class: CC::Yaml::Nodes::Severity

Inherits:
Scalar show all
Defined in:
lib/cc/yaml/nodes/severity.rb

Constant Summary collapse

SEVERITIES =
[
  "info".freeze,
  "minor".freeze,
  "major".freeze,
  "critical".freeze,
  "blocker".freeze
].freeze

Instance Attribute Summary

Attributes inherited from Scalar

#value

Attributes inherited from Node

#parent

Instance Method Summary collapse

Methods inherited from Scalar

#!@, #==, [], cast, #cast, #cast?, cast?, default, #default_type, default_type, #each_scalar, #empty?, has_default?, #inspect, #prepare, #visit_child, #visit_scalar, #visit_sequence, #with_value, #with_value!

Methods inherited from Node

#as_json, #deep_verify, #dup, #error, #errors, #errors?, has_default?, #initialize, #method_missing, #nested_warning, #nested_warnings, #prepare, #respond_to_missing?, #to_s, #verify, #visit_child, #visit_mapping, #visit_pair, #visit_scalar, #visit_sequence, #visit_unexpected, #warning, #warnings, #warnings?, #with_value

Constructor Details

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

Dynamic Method Handling

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

Instance Method Details

#value=(value) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/cc/yaml/nodes/severity.rb', line 13

def value=(value)
  unless value.nil?
    normalized_value = value.to_s.strip.downcase
    if SEVERITIES.include? normalized_value
      @value = normalized_value
    else
      error("Unexpected severity %s", value.inspect)
    end
  end
end