Class: Travis::Yaml::Nodes::Version

Inherits:
Scalar show all
Defined in:
lib/travis/yaml/nodes/version.rb

Instance Attribute Summary

Attributes inherited from Scalar

#value

Attributes inherited from Node

#parent

Class Method Summary collapse

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

#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, #verify_language, #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

Class Method Details

.[](expression) ⇒ Object



4
5
6
# File 'lib/travis/yaml/nodes/version.rb', line 4

def self.[](expression)
  Class.new(self) { format(expression) }
end

.format(expression = nil) ⇒ Object



8
9
10
11
# File 'lib/travis/yaml/nodes/version.rb', line 8

def self.format(expression = nil)
  @format = expression if expression
  @format ||= superclass.respond_to?(:format) ? superclass.format : //
end

Instance Method Details

#value=(value) ⇒ Object



13
14
15
16
# File 'lib/travis/yaml/nodes/version.rb', line 13

def value=(value)
  return super unless value and value.to_s !~ self.class.format
  error "value %p is not a valid version", value.to_s
end