Class: RamlRubyClient::Parser
- Inherits:
-
Object
- Object
- RamlRubyClient::Parser
- Defined in:
- lib/raml_ruby_client/generator/parser.rb
Instance Attribute Summary collapse
-
#raml_object ⇒ Object
readonly
Returns the value of attribute raml_object.
Instance Method Summary collapse
- #apis ⇒ Object
- #base_uri ⇒ Object
- #config_keys ⇒ Object
-
#initialize(raml_file) ⇒ Parser
constructor
A new instance of Parser.
- #library_path ⇒ Object
- #module_name ⇒ Object
- #namespace ⇒ Object
Constructor Details
#initialize(raml_file) ⇒ Parser
Returns a new instance of Parser.
5 6 7 |
# File 'lib/raml_ruby_client/generator/parser.rb', line 5 def initialize(raml_file) @raml_object = Raml.parse_file(raml_file) end |
Instance Attribute Details
#raml_object ⇒ Object (readonly)
Returns the value of attribute raml_object.
3 4 5 |
# File 'lib/raml_ruby_client/generator/parser.rb', line 3 def raml_object @raml_object end |
Instance Method Details
#apis ⇒ Object
17 18 19 |
# File 'lib/raml_ruby_client/generator/parser.rb', line 17 def apis @apis ||= raml_object.resources.map {|key, resource| parse_apis(key, resource) }.flatten end |
#base_uri ⇒ Object
9 10 11 |
# File 'lib/raml_ruby_client/generator/parser.rb', line 9 def base_uri raml_object.base_uri end |
#config_keys ⇒ Object
13 14 15 |
# File 'lib/raml_ruby_client/generator/parser.rb', line 13 def config_keys ['endpoint'] end |
#library_path ⇒ Object
29 30 31 |
# File 'lib/raml_ruby_client/generator/parser.rb', line 29 def library_path namespace.gsub("/", "_").downcase end |
#module_name ⇒ Object
25 26 27 |
# File 'lib/raml_ruby_client/generator/parser.rb', line 25 def module_name namespace.camelize.gsub('::', '') end |
#namespace ⇒ Object
21 22 23 |
# File 'lib/raml_ruby_client/generator/parser.rb', line 21 def namespace @namespace ||= raml_object.title.gsub(" ", "/") end |