Class: Jazzy::SourceDocument
Instance Attribute Summary collapse
#abstract, #access_control_level, #children, #column, #declaration, #default_impl_abstract, #discussion, #end_line, #file, #from_protocol_extension, #line, #mark, #name, #nav_order, #other_language_declaration, #parameters, #parent_in_code, #parent_in_docs, #return, #start_line, #type, #typename, #usr
Instance Method Summary
collapse
#abstract_glob, #alternative_abstract, #alternative_abstract_file, #fully_qualified_name, #namespace_ancestors, #namespace_path, #objc_category_name, #render?, #type?
Instance Attribute Details
#overview ⇒ Object
Returns the value of attribute overview.
7
8
9
|
# File 'lib/jazzy/source_document.rb', line 7
def overview
@overview
end
|
#readme_path ⇒ Object
Returns the value of attribute readme_path.
8
9
10
|
# File 'lib/jazzy/source_document.rb', line 8
def readme_path
@readme_path
end
|
Instance Method Details
#config ⇒ Object
10
11
12
|
# File 'lib/jazzy/source_document.rb', line 10
def config
Config.instance
end
|
#config_readme ⇒ Object
27
28
29
|
# File 'lib/jazzy/source_document.rb', line 27
def config_readme
readme_path.read if readme_path && readme_path.exist?
end
|
#content(source_module) ⇒ Object
18
19
20
21
|
# File 'lib/jazzy/source_document.rb', line 18
def content(source_module)
return readme_content(source_module) if name == 'index'
overview
end
|
#fallback_readme ⇒ Object
31
32
33
34
35
36
37
|
# File 'lib/jazzy/source_document.rb', line 31
def fallback_readme
%w(README.md README.markdown README.mdown README).each do |potential_name|
file = config.source_directory + potential_name
return file.read if file.exist?
end
false
end
|
#generated_readme(source_module) ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/jazzy/source_document.rb', line 39
def generated_readme(source_module)
if podspec = config.podspec
<<-EOS
# #{podspec.name}
### #{podspec.summary}
#{podspec.description}
### Installation
```ruby
pod '#{podspec.name}'
```
### Authors
#{source_module.author_name}
EOS
else
<<-EOS
# #{source_module.name}
### Authors
#{source_module.author_name}
EOS
end
end
|
#readme_content(source_module) ⇒ Object
23
24
25
|
# File 'lib/jazzy/source_document.rb', line 23
def readme_content(source_module)
config_readme || fallback_readme || generated_readme(source_module)
end
|
#url ⇒ Object
14
15
16
|
# File 'lib/jazzy/source_document.rb', line 14
def url
name.downcase.strip.tr(' ', '-').gsub(/[^\w-]/, '') + '.html'
end
|