Brújula

Build Status Code Climate Test Coverage

Yet another Ruby RAML parser aiming for version 1.0 fully support

Status

Brujula is still under development and not the full RAML specification is covered. Please see SPEC_SUPPORT.md for more information.

Use

Install the gem brujula via your preferred method, and use parse_file to load and parse any RAML file

require 'brujula'

root = Brujula.parse_file('path/my_example_api.raml')

# Alternatively

raml = <<-RAML
# version 1.0
title: 'My example API'
/examples:
  get:

RAML

root = Brujula.parse(raml)

As expected, the properties of the root object can be accessed from the root object

root.title
=> 'My example API'

Object collections, such as Resources, Methods or Security Schemes, inherits from Brujula::MapObject, which implements the Enumerable module. Thus, you can use any of this module's method to get collection objects.

root.resources.each_with_object([]) do |resource, resource_names|
  resource_names << resource.name
end

Alternatively, you can you use hash methods such as [] or fetch to get specific objects by its key name

root.resources['/examples']

Contributing

Pull request are kindly requested. Specially in the form of RAML examples. If you are using some advances features of RAML 1.0 spec, like annotations, type inheritance or libraries, and you would like to help this project, please have a look at CONTRIBUTING.md.

License

See LICENSE.