Class: Raml::Schema

Inherits:
ValueNode show all
Defined in:
lib/raml/node/schema.rb

Instance Attribute Summary

Attributes inherited from ValueNode

#value

Attributes inherited from Node

#name, #parent

Instance Method Summary collapse

Methods inherited from ValueNode

#initialize

Methods inherited from Node

#initialize, relative_path

Constructor Details

This class inherits a constructor from Raml::ValueNode

Instance Method Details

#documentString

Returns HTML documenting the node and child nodes.



17
18
19
# File 'lib/raml/node/schema.rb', line 17

def document
  highlight @value, parent.media_type
end

#json_schema?Boolean



6
7
8
# File 'lib/raml/node/schema.rb', line 6

def json_schema?
  /"\$schema":\s*"http:\/\/json-schema.org\/[^"]*"/ === @value
end

#xml_schema?Boolean



11
12
13
# File 'lib/raml/node/schema.rb', line 11

def xml_schema?
  /<xs:schema [^>]*xmlns:xs="http:\/\/www\.w3\.org\/2001\/XMLSchema"[^>]*>/ === @value
end