Class: Raml::PropertiesNode
Direct Known Subclasses
AbstractMethod, AbstractResource, Body, Documentation, Raml::Parameter::AbstractParameter, Response, Root, SecurityScheme::Instance
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
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
#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.
88 89 90 |
# File 'lib/raml/node.rb', line 88 def optional @optional end |
Instance Method Details
#_regexp_property ⇒ Object
82 |
# File 'lib/raml/node.rb', line 82 def _regexp_property ; self.class._regexp_property ; end |
#non_scalar_properties ⇒ Object
80 |
# File 'lib/raml/node.rb', line 80 def non_scalar_properties; self.class.non_scalar_properties; end |
#scalar_properties ⇒ Object
78 |
# File 'lib/raml/node.rb', line 78 def scalar_properties ; self.class.scalar_properties ; end |