Class: Raml::PropertiesNode
Direct Known Subclasses
AbstractMethod, AbstractResource, Body, Documentation, Raml::Parameter::AbstractParameter, Response, Root
Instance Attribute Summary collapse
-
#optional ⇒ Boolean
Whether the property is optional.
Attributes inherited from Node
Instance Method Summary collapse
- #_regexp_property ⇒ Object
-
#initialize(name, properties, parent) ⇒ PropertiesNode
constructor
A new instance of PropertiesNode.
- #non_scalar_properties ⇒ Object
- #scalar_properties ⇒ Object
Methods inherited from Node
Constructor Details
#initialize(name, properties, parent) ⇒ PropertiesNode
Returns a new instance of PropertiesNode.
150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/raml/node.rb', line 150 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
#optional ⇒ Boolean
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.
148 149 150 |
# File 'lib/raml/node.rb', line 148 def optional @optional end |
Instance Method Details
#_regexp_property ⇒ Object
142 |
# File 'lib/raml/node.rb', line 142 def _regexp_property ; self.class._regexp_property ; end |
#non_scalar_properties ⇒ Object
140 |
# File 'lib/raml/node.rb', line 140 def non_scalar_properties; self.class.non_scalar_properties; end |
#scalar_properties ⇒ Object
138 |
# File 'lib/raml/node.rb', line 138 def scalar_properties ; self.class.scalar_properties ; end |