Class: Raml::PropertiesNode

Inherits:
Node
  • Object
show all
Defined in:
lib/raml/node.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#name, #parent

Instance Method Summary collapse

Constructor Details

#initialize(name, properties, parent) ⇒ PropertiesNode

Returns a new instance of PropertiesNode.



90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/raml/node.rb', line 90

def initialize(name, properties, parent)
  if name.is_a? String and name.end_with? '?'
    allow_optional? parent
    name = name.dup.chomp! '?'
    @optional = true
  else
    @optional = false
  end

  super name, parent

  @children ||= []
  parse_and_validate_props properties
end

Instance Attribute Details

#optionalBoolean

Returns whether the property is optional. Only valid for decendant nodes a Trait::Instance or ResourceType::Instance. Indicated by a trailing “?” on the property name in the RAML source.

Returns:

  • (Boolean)

    whether the property is optional. Only valid for decendant nodes a Trait::Instance or ResourceType::Instance. Indicated by a trailing “?” on the property name in the RAML source.



88
89
90
# File 'lib/raml/node.rb', line 88

def optional
  @optional
end

Instance Method Details

#_regexp_propertyObject



82
# File 'lib/raml/node.rb', line 82

def _regexp_property     ; self.class._regexp_property     ; end

#non_scalar_propertiesObject



80
# File 'lib/raml/node.rb', line 80

def non_scalar_properties; self.class.non_scalar_properties; end

#scalar_propertiesObject



78
# File 'lib/raml/node.rb', line 78

def scalar_properties    ; self.class.scalar_properties    ; end