Class: Raml::Parser::Resource

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Util
Defined in:
lib/raml/parser/resource.rb

Constant Summary collapse

HTTP_METHODS =
%w[get put post delete]
BASIC_ATTRIBUTES =
%w[display_name description]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ Resource

Returns a new instance of Resource.



21
22
23
# File 'lib/raml/parser/resource.rb', line 21

def initialize(parent)
  @parent = parent
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



18
19
20
# File 'lib/raml/parser/resource.rb', line 18

def attributes
  @attributes
end

#parent_nodeObject

Returns the value of attribute parent_node.



18
19
20
# File 'lib/raml/parser/resource.rb', line 18

def parent_node
  @parent_node
end

#resourceObject

Returns the value of attribute resource.



18
19
20
# File 'lib/raml/parser/resource.rb', line 18

def resource
  @resource
end

#trait_namesObject

Returns the value of attribute trait_names.



18
19
20
# File 'lib/raml/parser/resource.rb', line 18

def trait_names
  @trait_names
end

Instance Method Details

#parse(parent_node, uri_partial, attributes) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/raml/parser/resource.rb', line 25

def parse(parent_node, uri_partial, attributes)
  @parent_node = parent_node
  @resource = Raml::Resource.new(@parent_node, uri_partial)
  @attributes = prepare_attributes(attributes)
  apply_resource_type
  parse_attributes
  resource
end