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]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ Resource

Returns a new instance of Resource.



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

def initialize(parent)
  @parent = parent
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



16
17
18
# File 'lib/raml/parser/resource.rb', line 16

def attributes
  @attributes
end

#parent_nodeObject

Returns the value of attribute parent_node.



16
17
18
# File 'lib/raml/parser/resource.rb', line 16

def parent_node
  @parent_node
end

#resourceObject

Returns the value of attribute resource.



16
17
18
# File 'lib/raml/parser/resource.rb', line 16

def resource
  @resource
end

#trait_namesObject

Returns the value of attribute trait_names.



16
17
18
# File 'lib/raml/parser/resource.rb', line 16

def trait_names
  @trait_names
end

Instance Method Details

#parse(parent_node, uri_partial, attributes) ⇒ Object



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

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