Class: Praxis::Docs::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/praxis/docs/generator.rb

Constant Summary collapse

API_DOCS_DIRNAME =
'docs/api'
EXCLUDED_TYPES_FROM_OUTPUT =
Set.new([
  Attributor::Boolean,
  Attributor::CSV,
  Attributor::DateTime,
  Attributor::Float,
  Attributor::Hash,
  Attributor::Ids,
  Attributor::Integer,
  Attributor::Object,
  Attributor::String,
  Attributor::Symbol
]).freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root) ⇒ Generator

Returns a new instance of Generator.



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/praxis/docs/generator.rb', line 24

def initialize(root)
  require 'yaml'
  @resources_by_version =  Hash.new do |h,k|
    h[k] = Set.new
  end
  initialize_directories(root)

  Attributor::AttributeResolver.current = Attributor::AttributeResolver.new
  collect_infos
  collect_resources
  collect_types
end

Instance Attribute Details

#doc_root_dirObject (readonly)

Returns the value of attribute doc_root_dir.



8
9
10
# File 'lib/praxis/docs/generator.rb', line 8

def doc_root_dir
  @doc_root_dir
end

#infos_by_versionObject (readonly)

Returns the value of attribute infos_by_version.



7
8
9
# File 'lib/praxis/docs/generator.rb', line 7

def infos_by_version
  @infos_by_version
end

#resources_by_versionObject (readonly)

Returns the value of attribute resources_by_version.



7
8
9
# File 'lib/praxis/docs/generator.rb', line 7

def resources_by_version
  @resources_by_version
end

#types_by_idObject (readonly)

Returns the value of attribute types_by_id.



7
8
9
# File 'lib/praxis/docs/generator.rb', line 7

def types_by_id
  @types_by_id
end

Instance Method Details

#save!Object



37
38
39
40
41
42
# File 'lib/praxis/docs/generator.rb', line 37

def save!
  write_index_file
  resources_by_version.keys.each do |version|
    write_version_file(version)
  end
end