Class: Amy::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/amy/parser.rb

Constant Summary collapse

OPTIONS_FILE =
".amy"

Instance Method Summary collapse

Constructor Details

#initialize(base_dir = "doc/") ⇒ Parser

Returns a new instance of Parser.



10
11
12
13
14
# File 'lib/amy/parser.rb', line 10

def initialize(base_dir = "doc/")
  @generator = Amy::Generator.new base_dir
  @options   = load_options_file
  @mode      = @options['mode'] || 'file'
end

Instance Method Details

#execute(dir) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/amy/parser.rb', line 18

def execute(dir)
  specs  = load_specs dir
  if (@mode == "code")
    specs['links'] = @options['links']
    specs['base_url'] = @options['base_url']
    specs['api_version'] = @options['api_version']
  end
  compile_json_specs_with dir, specs
  generate_main_page_with specs
  copy_styles_and_js
  true
end